Skip to content

Commit 51f5237

Browse files
committed
fixup
1 parent 10febea commit 51f5237

File tree

3 files changed

+191
-178
lines changed

3 files changed

+191
-178
lines changed

include/ncrypto.h

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ class ECKeyPointer;
262262
class Dsa;
263263
class Rsa;
264264
class Ec;
265-
class AEAD;
266-
class AEADCtxPointer;
265+
class Aead;
266+
class AeadCtxPointer;
267267

268268
struct StackOfXASN1Deleter {
269269
void operator()(STACK_OF(ASN1_OBJECT) * p) const {
@@ -1755,25 +1755,25 @@ class KEM final {
17551755

17561756
// ============================================================================
17571757
// AEAD (Authenticated Encryption with Associated Data)
1758-
// Note that AEAD primitives are accessed through the Cipher class instead, if
1759-
// using OpenSSL.
1758+
// Note that the underlying EVP_AEAD interface is specific to BoringSSL. AEAD
1759+
// primitives are accessed through the Cipher class instead, if using OpenSSL.
17601760

17611761
#ifdef OPENSSL_IS_BORINGSSL
1762-
class AEAD final : public ModeMixin<AEAD> {
1762+
class Aead final : public ModeMixin<Aead> {
17631763
private:
17641764
// BoringSSL does not keep a list of AEADs, so we need to maintain our own.
1765-
struct AEADInfo {
1765+
struct AeadInfo {
17661766
std::string name;
17671767
int mode;
17681768
int nid = 0; // Note: BoringSSL only defines NIDs for some AEADs
17691769
};
17701770

17711771
public:
1772-
AEAD() = default;
1773-
AEAD(const AEADInfo* info, const EVP_AEAD* aead) : info_(info), aead_(aead) {}
1774-
AEAD(const AEAD&) = default;
1775-
AEAD& operator=(const AEAD&) = default;
1776-
NCRYPTO_DISALLOW_MOVE(AEAD)
1772+
Aead() = default;
1773+
Aead(const AeadInfo* info, const EVP_AEAD* aead) : info_(info), aead_(aead) {}
1774+
Aead(const Aead&) = default;
1775+
Aead& operator=(const Aead&) = default;
1776+
NCRYPTO_DISALLOW_MOVE(Aead)
17771777

17781778
inline const EVP_AEAD* get() const { return aead_; }
17791779
inline operator const EVP_AEAD*() const { return aead_; }
@@ -1787,59 +1787,59 @@ class AEAD final : public ModeMixin<AEAD> {
17871787
int getMaxTagLength() const;
17881788
std::string_view getName() const;
17891789

1790-
static const AEAD FromName(const char* name);
1790+
static const Aead FromName(std::string_view name);
17911791

17921792
// TODO(npaun): BoringSSL does not define NIDs for all AEADs.
17931793
// Decide if we will even implement this method.
17941794
// int getNid() const;
17951795
// static const AEAD FromNid(int nid);
17961796

1797-
static const AEAD FromCtx(std::string_view name, const AEADCtxPointer& ctx);
1797+
static const Aead FromCtx(std::string_view name, const AeadCtxPointer& ctx);
17981798

17991799
// Utilities to get various AEADs by type.
18001800

1801-
static const AEAD EMPTY;
1802-
static const AEAD AES_128_GCM;
1803-
static const AEAD AES_192_GCM;
1804-
static const AEAD AES_256_GCM;
1805-
static const AEAD CHACHA20_POLY1305;
1806-
static const AEAD XCHACHA20_POLY1305;
1807-
static const AEAD AES_128_CTR_HMAC_SHA256;
1808-
static const AEAD AES_256_CTR_HMAC_SHA256;
1809-
static const AEAD AES_128_GCM_SIV;
1810-
static const AEAD AES_256_GCM_SIV;
1811-
static const AEAD AES_128_GCM_RANDNONCE;
1812-
static const AEAD AES_256_GCM_RANDNONCE;
1813-
static const AEAD AES_128_CCM_BLUETOOTH;
1814-
static const AEAD AES_128_CCM_BLUETOOTH_8;
1815-
static const AEAD AES_128_CCM_MATTER;
1816-
// static const AEAD AES_128_EAX;
1817-
// static const AEAD AES_256_EAX;
1801+
static const Aead EMPTY;
1802+
static const Aead AES_128_GCM;
1803+
static const Aead AES_192_GCM;
1804+
static const Aead AES_256_GCM;
1805+
static const Aead CHACHA20_POLY1305;
1806+
static const Aead XCHACHA20_POLY1305;
1807+
static const Aead AES_128_CTR_HMAC_SHA256;
1808+
static const Aead AES_256_CTR_HMAC_SHA256;
1809+
static const Aead AES_128_GCM_SIV;
1810+
static const Aead AES_256_GCM_SIV;
1811+
static const Aead AES_128_GCM_RANDNONCE;
1812+
static const Aead AES_256_GCM_RANDNONCE;
1813+
static const Aead AES_128_CCM_BLUETOOTH;
1814+
static const Aead AES_128_CCM_BLUETOOTH_8;
1815+
static const Aead AES_128_CCM_MATTER;
1816+
static const Aead AES_128_EAX;
1817+
static const Aead AES_256_EAX;
18181818

18191819
private:
18201820
const EVP_AEAD* aead_ = nullptr;
1821-
const AEADInfo* info_ = nullptr;
1821+
const AeadInfo* info_ = nullptr;
18221822

1823-
using AEADConstructor = const EVP_AEAD* (*)();
1824-
static const std::unordered_map<AEADConstructor, AEADInfo> aeadIndex;
1825-
static const AEAD FromConstructor(AEADConstructor construct);
1823+
using AeadConstructor = const EVP_AEAD* (*)();
1824+
static const std::unordered_map<AeadConstructor, AeadInfo> aeadIndex;
1825+
static const Aead FromConstructor(AeadConstructor construct);
18261826
};
18271827

1828-
class AEADCtxPointer final {
1828+
class AeadCtxPointer final {
18291829
public:
1830-
static AEADCtxPointer New(
1831-
const AEAD& aead,
1830+
static AeadCtxPointer New(
1831+
const Aead& aead,
18321832
bool encrypt,
18331833
const unsigned char* key = nullptr,
18341834
size_t keyLen = 0,
18351835
size_t tagLen = EVP_AEAD_DEFAULT_TAG_LENGTH /* = 0 */);
18361836

1837-
AEADCtxPointer() = default;
1838-
explicit AEADCtxPointer(EVP_AEAD_CTX* ctx);
1839-
AEADCtxPointer(AEADCtxPointer&& other) noexcept;
1840-
AEADCtxPointer& operator=(AEADCtxPointer&& other) noexcept;
1841-
NCRYPTO_DISALLOW_COPY(AEADCtxPointer)
1842-
~AEADCtxPointer();
1837+
AeadCtxPointer() = default;
1838+
explicit AeadCtxPointer(EVP_AEAD_CTX* ctx);
1839+
AeadCtxPointer(AeadCtxPointer&& other) noexcept;
1840+
AeadCtxPointer& operator=(AeadCtxPointer&& other) noexcept;
1841+
NCRYPTO_DISALLOW_COPY(AeadCtxPointer)
1842+
~AeadCtxPointer();
18431843

18441844
inline bool operator==(std::nullptr_t) const noexcept {
18451845
return ctx_ == nullptr;
@@ -1850,7 +1850,7 @@ class AEADCtxPointer final {
18501850
void reset(EVP_AEAD_CTX* ctx = nullptr);
18511851
EVP_AEAD_CTX* release();
18521852

1853-
bool init(const AEAD& aead,
1853+
bool init(const Aead& aead,
18541854
bool encrypt,
18551855
const unsigned char* key = nullptr,
18561856
size_t keyLen = 0,

0 commit comments

Comments
 (0)