Skip to content

Commit 01fe3df

Browse files
committed
Merge macro checks
1 parent 8ff9d53 commit 01fe3df

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

deps/ncrypto/ncrypto.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,8 +1857,8 @@ DataPointer pbkdf2(const Digest& md,
18571857
return {};
18581858
}
18591859

1860-
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2
1861-
#ifndef OPENSSL_NO_ARGON2
1860+
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2 && \
1861+
!defined(OPENSSL_NO_ARGON2)
18621862
DataPointer argon2(const Buffer<const char>& pass,
18631863
const Buffer<const unsigned char>& salt,
18641864
uint32_t lanes,
@@ -1948,7 +1948,6 @@ DataPointer argon2(const Buffer<const char>& pass,
19481948

19491949
return {};
19501950
}
1951-
#endif // !OPENSSL_NO_ARGON2
19521951
#endif
19531952

19541953
// ============================================================================

deps/ncrypto/ncrypto.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,8 @@ DataPointer pbkdf2(const Digest& md,
15391539
uint32_t iterations,
15401540
size_t length);
15411541

1542-
#ifndef OPENSSL_NO_ARGON2
1542+
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2 && \
1543+
!defined(OPENSSL_NO_ARGON2)
15431544
enum class Argon2Type { ARGON2I, ARGON2D, ARGON2ID };
15441545

15451546
DataPointer argon2(const Buffer<const char>& pass,
@@ -1552,7 +1553,7 @@ DataPointer argon2(const Buffer<const char>& pass,
15521553
const Buffer<const unsigned char>& secret,
15531554
const Buffer<const unsigned char>& ad,
15541555
Argon2Type type);
1555-
#endif // !OPENSSL_NO_ARGON2
1556+
#endif
15561557

15571558
// ============================================================================
15581559
// Version metadata

src/crypto/crypto_argon2.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include "crypto/crypto_argon2.h"
22

3-
namespace node::crypto {
4-
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2
5-
#ifndef OPENSSL_NO_ARGON2
3+
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2 && \
4+
!defined(OPENSSL_NO_ARGON2)
65
#include <openssl/core_names.h>
76

7+
namespace node::crypto {
8+
89
using v8::FunctionCallbackInfo;
910
using v8::JustVoid;
1011
using v8::Maybe;
@@ -167,6 +168,6 @@ bool Argon2Traits::DeriveBits(Environment* env,
167168
return true;
168169
}
169170

170-
#endif // !OPENSSL_NO_ARGON2
171-
#endif
172171
} // namespace node::crypto
172+
173+
#endif

src/crypto/crypto_argon2.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include "crypto/crypto_util.h"
77

88
namespace node::crypto {
9-
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2
10-
#ifndef OPENSSL_NO_ARGON2
9+
#if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 2 && \
10+
!defined(OPENSSL_NO_ARGON2)
1111

1212
// Argon2 is a password-based key derivation algorithm
1313
// defined in https://datatracker.ietf.org/doc/html/rfc9106
@@ -76,7 +76,6 @@ struct Argon2Job {
7676
static void Initialize(Environment* env, v8::Local<v8::Object> target) {}
7777
};
7878

79-
#endif // !OPENSSL_NO_ARGON2
8079
#endif
8180
} // namespace node::crypto
8281

0 commit comments

Comments
 (0)