Skip to content

Commit c2e44ef

Browse files
committed
fixup! crypto: enable SIV and GCM-SIV modes in Cipher/Decipher APIs
1 parent 769a8fb commit c2e44ef

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

deps/ncrypto/ncrypto.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,11 +3165,9 @@ bool SSLCtxPointer::setCipherSuites(const char* ciphers) {
31653165

31663166
// ============================================================================
31673167

3168-
#if OPENSSL_VERSION_MAJOR >= 3
3168+
#if OPENSSL_WITH_AES_SIV || OPENSSL_WITH_AES_GCM_SIV
31693169
Cipher::Cipher(EVP_CIPHER* cipher)
31703170
: cipher_(cipher), fetched_cipher_(cipher, EVP_CIPHER_free) {}
3171-
#else
3172-
Cipher::Cipher(EVP_CIPHER* cipher) : cipher_(cipher) {}
31733171
#endif
31743172

31753173
const Cipher Cipher::FromName(const char* name) {
@@ -3202,7 +3200,7 @@ const Cipher Cipher::FromNid(int nid) {
32023200
const EVP_CIPHER* cipher = EVP_get_cipherbynid(nid);
32033201
if (cipher != nullptr) return Cipher(cipher);
32043202

3205-
#if OPENSSL_VERSION_MAJOR >= 3
3203+
#if OPENSSL_WITH_AES_SIV || OPENSSL_WITH_AES_GCM_SIV
32063204
const char* name = OBJ_nid2sn(nid);
32073205
if (name != nullptr) return FromName(name);
32083206
#endif
@@ -3360,7 +3358,7 @@ const char* Cipher::getName() const {
33603358
const char* name = OBJ_nid2sn(nid);
33613359
if (name != nullptr) return name;
33623360
}
3363-
#if OPENSSL_VERSION_MAJOR >= 3
3361+
#if OPENSSL_WITH_AES_SIV || OPENSSL_WITH_AES_GCM_SIV
33643362
return EVP_CIPHER_get0_name(cipher_);
33653363
#else
33663364
return {};

deps/ncrypto/ncrypto.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ class Cipher final {
414414
Cipher(const Cipher&) = default;
415415
Cipher& operator=(const Cipher&) = default;
416416
inline Cipher& operator=(const EVP_CIPHER* cipher) {
417+
#if OPENSSL_WITH_AES_SIV || OPENSSL_WITH_AES_GCM_SIV
417418
fetched_cipher_.reset();
419+
#endif
418420
cipher_ = cipher;
419421
return *this;
420422
}
@@ -508,10 +510,14 @@ class Cipher final {
508510
}
509511

510512
private:
513+
#if OPENSSL_WITH_AES_SIV || OPENSSL_WITH_AES_GCM_SIV
511514
explicit Cipher(EVP_CIPHER* cipher);
515+
#endif
512516

513517
const EVP_CIPHER* cipher_ = nullptr;
518+
#if OPENSSL_WITH_AES_SIV || OPENSSL_WITH_AES_GCM_SIV
514519
std::shared_ptr<EVP_CIPHER> fetched_cipher_;
520+
#endif
515521
};
516522

517523
// ============================================================================

0 commit comments

Comments
 (0)