@@ -3611,12 +3611,10 @@ void CipherBase::Init(const char* cipher_type,
3611
3611
HandleScope scope (env ()->isolate ());
3612
3612
MarkPopErrorOnReturn mark_pop_error_on_return;
3613
3613
3614
- #ifdef NODE_FIPS_MODE
3615
3614
if (FIPS_mode ()) {
3616
3615
return env ()->ThrowError (
3617
3616
" crypto.createCipher() is not supported in FIPS mode." );
3618
3617
}
3619
- #endif // NODE_FIPS_MODE
3620
3618
3621
3619
const EVP_CIPHER* const cipher = EVP_get_cipherbyname (cipher_type);
3622
3620
if (cipher == nullptr )
@@ -3802,13 +3800,11 @@ bool CipherBase::InitAuthenticated(const char* cipher_type, int iv_len,
3802
3800
return false ;
3803
3801
}
3804
3802
3805
- #ifdef NODE_FIPS_MODE
3806
3803
// TODO(tniessen) Support CCM decryption in FIPS mode
3807
3804
if (mode == EVP_CIPH_CCM_MODE && kind_ == kDecipher && FIPS_mode ()) {
3808
3805
env ()->ThrowError (" CCM decryption not supported in FIPS mode" );
3809
3806
return false ;
3810
3807
}
3811
- #endif
3812
3808
3813
3809
// Tell OpenSSL about the desired length.
3814
3810
if (!EVP_CIPHER_CTX_ctrl (ctx_.get (), EVP_CTRL_AEAD_SET_TAG, auth_tag_len,
@@ -4683,7 +4679,6 @@ static AllocatedBuffer Node_SignFinal(Environment* env,
4683
4679
}
4684
4680
4685
4681
static inline bool ValidateDSAParameters (EVP_PKEY* key) {
4686
- #ifdef NODE_FIPS_MODE
4687
4682
/* Validate DSA2 parameters from FIPS 186-4 */
4688
4683
if (FIPS_mode () && EVP_PKEY_DSA == EVP_PKEY_base_id (key)) {
4689
4684
DSA* dsa = EVP_PKEY_get0_DSA (key);
@@ -4699,7 +4694,6 @@ static inline bool ValidateDSAParameters(EVP_PKEY* key) {
4699
4694
(L == 2048 && N == 256 ) ||
4700
4695
(L == 3072 && N == 256 );
4701
4696
}
4702
- #endif // NODE_FIPS_MODE
4703
4697
4704
4698
return true ;
4705
4699
}
@@ -6859,7 +6853,6 @@ void InitCryptoOnce() {
6859
6853
settings = nullptr ;
6860
6854
#endif
6861
6855
6862
- #ifdef NODE_FIPS_MODE
6863
6856
/* Override FIPS settings in cnf file, if needed. */
6864
6857
unsigned long err = 0 ; // NOLINT(runtime/int)
6865
6858
if (per_process::cli_options->enable_fips_crypto ||
@@ -6874,8 +6867,6 @@ void InitCryptoOnce() {
6874
6867
ERR_error_string (err, nullptr ));
6875
6868
UNREACHABLE ();
6876
6869
}
6877
- #endif // NODE_FIPS_MODE
6878
-
6879
6870
6880
6871
// Turn off compression. Saves memory and protects against CRIME attacks.
6881
6872
// No-op with OPENSSL_NO_COMP builds of OpenSSL.
@@ -6920,7 +6911,6 @@ void SetEngine(const FunctionCallbackInfo<Value>& args) {
6920
6911
}
6921
6912
#endif // !OPENSSL_NO_ENGINE
6922
6913
6923
- #ifdef NODE_FIPS_MODE
6924
6914
void GetFipsCrypto (const FunctionCallbackInfo<Value>& args) {
6925
6915
args.GetReturnValue ().Set (FIPS_mode () ? 1 : 0 );
6926
6916
}
@@ -6938,8 +6928,6 @@ void SetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
6938
6928
return ThrowCryptoError (env, err);
6939
6929
}
6940
6930
}
6941
- #endif /* NODE_FIPS_MODE */
6942
-
6943
6931
6944
6932
void Initialize (Local<Object> target,
6945
6933
Local<Value> unused,
@@ -6976,10 +6964,8 @@ void Initialize(Local<Object> target,
6976
6964
env->SetMethod (target, " setEngine" , SetEngine);
6977
6965
#endif // !OPENSSL_NO_ENGINE
6978
6966
6979
- #ifdef NODE_FIPS_MODE
6980
6967
env->SetMethodNoSideEffect (target, " getFipsCrypto" , GetFipsCrypto);
6981
6968
env->SetMethod (target, " setFipsCrypto" , SetFipsCrypto);
6982
- #endif
6983
6969
6984
6970
env->SetMethod (target, " pbkdf2" , PBKDF2);
6985
6971
env->SetMethod (target, " generateKeyPairRSA" , GenerateKeyPairRSA);
0 commit comments