@@ -2683,9 +2683,11 @@ void CipherBase::Init(const FunctionCallbackInfo<Value>& args) {
2683
2683
cipher->Init (*cipher_type, key_buf, key_buf_len, auth_tag_len);
2684
2684
}
2685
2685
2686
- #define IS_SUPPORTED_AUTHENTICATED_MODE (mode ) ((mode) == EVP_CIPH_CCM_MODE || \
2687
- (mode) == EVP_CIPH_GCM_MODE || \
2688
- (mode) == EVP_CIPH_OCB_MODE)
2686
+ static bool IsSupportedAuthenticatedMode (int mode) {
2687
+ return mode == EVP_CIPH_CCM_MODE ||
2688
+ mode == EVP_CIPH_GCM_MODE ||
2689
+ mode == EVP_CIPH_OCB_MODE;
2690
+ }
2689
2691
2690
2692
void CipherBase::InitIv (const char * cipher_type,
2691
2693
const char * key,
@@ -2703,7 +2705,7 @@ void CipherBase::InitIv(const char* cipher_type,
2703
2705
2704
2706
const int expected_iv_len = EVP_CIPHER_iv_length (cipher);
2705
2707
const int mode = EVP_CIPHER_mode (cipher);
2706
- const bool is_authenticated_mode = IS_SUPPORTED_AUTHENTICATED_MODE (mode);
2708
+ const bool is_authenticated_mode = IsSupportedAuthenticatedMode (mode);
2707
2709
const bool has_iv = iv_len >= 0 ;
2708
2710
2709
2711
// Throw if no IV was passed and the cipher requires an IV
@@ -2876,7 +2878,7 @@ bool CipherBase::IsAuthenticatedMode() const {
2876
2878
// Check if this cipher operates in an AEAD mode that we support.
2877
2879
CHECK (ctx_);
2878
2880
const int mode = EVP_CIPHER_CTX_mode (ctx_.get ());
2879
- return IS_SUPPORTED_AUTHENTICATED_MODE (mode);
2881
+ return IsSupportedAuthenticatedMode (mode);
2880
2882
}
2881
2883
2882
2884
0 commit comments