| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f54ace6 commit 823dce3
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1897,7 +1897,7 @@ EVPKeyPointer EVPKeyPointer::NewRawPrivate( | |||
| 1897 | 1897 | EVP_PKEY_new_raw_private_key(id, nullptr, data.data, data.len)); | |
| 1898 | 1898 | } | |
| 1899 | 1899 | ||
| 1900 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 1900 | + #if OPENSSL_WITH_PQC | ||
| 1901 | 1901 | EVPKeyPointer EVPKeyPointer::NewRawSeed( | |
| 1902 | 1902 | int id, const Buffer<const unsigned char>& data) { | |
| 1903 | 1903 | if (id == 0) return {}; | |
@@ -1968,7 +1968,7 @@ EVP_PKEY* EVPKeyPointer::release() { | |||
| 1968 | 1968 | int EVPKeyPointer::id(const EVP_PKEY* key) { | |
| 1969 | 1969 | if (key == nullptr) return 0; | |
| 1970 | 1970 | int type = EVP_PKEY_id(key); | |
| 1971 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 1971 | + #if OPENSSL_WITH_PQC | ||
| 1972 | 1972 | // https://github.com/openssl/openssl/issues/27738#issuecomment-3013215870 | |
| 1973 | 1973 | if (type == -1) { | |
| 1974 | 1974 | if (EVP_PKEY_is_a(key, "ML-DSA-44")) return EVP_PKEY_ML_DSA_44; | |
@@ -2032,7 +2032,7 @@ DataPointer EVPKeyPointer::rawPublicKey() const { | |||
| 2032 | 2032 | return {}; | |
| 2033 | 2033 | } | |
| 2034 | 2034 | ||
| 2035 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 2035 | + #if OPENSSL_WITH_PQC | ||
| 2036 | 2036 | DataPointer EVPKeyPointer::rawSeed() const { | |
| 2037 | 2037 | if (!pkey_) return {}; | |
| 2038 | 2038 | switch (id()) { | |
@@ -2515,7 +2515,7 @@ bool EVPKeyPointer::isOneShotVariant() const { | |||
| 2515 | 2515 | switch (type) { | |
| 2516 | 2516 | case EVP_PKEY_ED25519: | |
| 2517 | 2517 | case EVP_PKEY_ED448: | |
| 2518 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 2518 | + #if OPENSSL_WITH_PQC | ||
| 2519 | 2519 | case EVP_PKEY_ML_DSA_44: | |
| 2520 | 2520 | case EVP_PKEY_ML_DSA_65: | |
| 2521 | 2521 | case EVP_PKEY_ML_DSA_87: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,11 +28,14 @@ | |||
| 28 | 28 | #include <openssl/fips.h> | |
| 29 | 29 | #endif // OPENSSL_FIPS | |
| 30 | 30 | ||
| 31 | - #if OPENSSL_VERSION_MAJOR >= 3 | ||
| 32 | - #define OSSL3_CONST const | ||
| 33 | - #if OPENSSL_VERSION_MINOR >= 5 | ||
| 31 | + // Define OPENSSL_WITH_PQC for post-quantum cryptography support | ||
| 32 | + #if OPENSSL_VERSION_NUMBER >= 0x30500000L | ||
| 33 | + #define OPENSSL_WITH_PQC 1 | ||
| 34 | 34 | #include <openssl/core_names.h> | |
| 35 | 35 | #endif | |
| 36 | + | ||
| 37 | + #if OPENSSL_VERSION_MAJOR >= 3 | ||
| 38 | + #define OSSL3_CONST const | ||
| 36 | 39 | #else | |
| 37 | 40 | #define OSSL3_CONST | |
| 38 | 41 | #endif | |
@@ -820,7 +823,7 @@ class EVPKeyPointer final { | |||
| 820 | 823 | const Buffer<const unsigned char>& data); | |
| 821 | 824 | static EVPKeyPointer NewRawPrivate(int id, | |
| 822 | 825 | const Buffer<const unsigned char>& data); | |
| 823 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 826 | + #if OPENSSL_WITH_PQC | ||
| 824 | 827 | static EVPKeyPointer NewRawSeed(int id, | |
| 825 | 828 | const Buffer<const unsigned char>& data); | |
| 826 | 829 | #endif | |
@@ -917,7 +920,7 @@ class EVPKeyPointer final { | |||
| 917 | 920 | DataPointer rawPrivateKey() const; | |
| 918 | 921 | BIOPointer derPublicKey() const; | |
| 919 | 922 | ||
| 920 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 923 | + #if OPENSSL_WITH_PQC | ||
| 921 | 924 | DataPointer rawSeed() const; | |
| 922 | 925 | #endif | |
| 923 | 926 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -177,7 +177,7 @@ bool ExportJWKAsymmetricKey(Environment* env, | |||
| 177 | 177 | // Fall through | |
| 178 | 178 | case EVP_PKEY_X448: | |
| 179 | 179 | return ExportJWKEdKey(env, key, target); | |
| 180 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 180 | + #if OPENSSL_WITH_PQC | ||
| 181 | 181 | case EVP_PKEY_ML_DSA_44: | |
| 182 | 182 | // Fall through | |
| 183 | 183 | case EVP_PKEY_ML_DSA_65: | |
@@ -280,7 +280,7 @@ int GetNidFromName(const char* name) { | |||
| 280 | 280 | nid = EVP_PKEY_X25519; | |
| 281 | 281 | } else if (strcmp(name, "X448") == 0) { | |
| 282 | 282 | nid = EVP_PKEY_X448; | |
| 283 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 283 | + #if OPENSSL_WITH_PQC | ||
| 284 | 284 | } else if (strcmp(name, "ML-DSA-44") == 0) { | |
| 285 | 285 | nid = EVP_PKEY_ML_DSA_44; | |
| 286 | 286 | } else if (strcmp(name, "ML-DSA-65") == 0) { | |
@@ -620,7 +620,7 @@ Local<Function> KeyObjectHandle::Initialize(Environment* env) { | |||
| 620 | 620 | SetProtoMethod(isolate, templ, "exportJwk", ExportJWK); | |
| 621 | 621 | SetProtoMethod(isolate, templ, "initECRaw", InitECRaw); | |
| 622 | 622 | SetProtoMethod(isolate, templ, "initEDRaw", InitEDRaw); | |
| 623 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 623 | + #if OPENSSL_WITH_PQC | ||
| 624 | 624 | SetProtoMethod(isolate, templ, "initMlDsaRaw", InitMlDsaRaw); | |
| 625 | 625 | #endif | |
| 626 | 626 | SetProtoMethod(isolate, templ, "initJwk", InitJWK); | |
@@ -643,7 +643,7 @@ void KeyObjectHandle::RegisterExternalReferences( | |||
| 643 | 643 | registry->Register(ExportJWK); | |
| 644 | 644 | registry->Register(InitECRaw); | |
| 645 | 645 | registry->Register(InitEDRaw); | |
| 646 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 646 | + #if OPENSSL_WITH_PQC | ||
| 647 | 647 | registry->Register(InitMlDsaRaw); | |
| 648 | 648 | #endif | |
| 649 | 649 | registry->Register(InitJWK); | |
@@ -838,7 +838,7 @@ void KeyObjectHandle::InitEDRaw(const FunctionCallbackInfo<Value>& args) { | |||
| 838 | 838 | args.GetReturnValue().Set(true); | |
| 839 | 839 | } | |
| 840 | 840 | ||
| 841 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 841 | + #if OPENSSL_WITH_PQC | ||
| 842 | 842 | void KeyObjectHandle::InitMlDsaRaw(const FunctionCallbackInfo<Value>& args) { | |
| 843 | 843 | Environment* env = Environment::GetCurrent(args); | |
| 844 | 844 | KeyObjectHandle* key; | |
@@ -971,7 +971,7 @@ Local<Value> KeyObjectHandle::GetAsymmetricKeyType() const { | |||
| 971 | 971 | return env()->crypto_x25519_string(); | |
| 972 | 972 | case EVP_PKEY_X448: | |
| 973 | 973 | return env()->crypto_x448_string(); | |
| 974 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 974 | + #if OPENSSL_WITH_PQC | ||
| 975 | 975 | case EVP_PKEY_ML_DSA_44: | |
| 976 | 976 | return env()->crypto_ml_dsa_44_string(); | |
| 977 | 977 | case EVP_PKEY_ML_DSA_65: | |
@@ -1254,7 +1254,7 @@ void Initialize(Environment* env, Local<Object> target) { | |||
| 1254 | 1254 | NODE_DEFINE_CONSTANT(target, kWebCryptoKeyFormatJWK); | |
| 1255 | 1255 | NODE_DEFINE_CONSTANT(target, EVP_PKEY_ED25519); | |
| 1256 | 1256 | NODE_DEFINE_CONSTANT(target, EVP_PKEY_ED448); | |
| 1257 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 1257 | + #if OPENSSL_WITH_PQC | ||
| 1258 | 1258 | NODE_DEFINE_CONSTANT(target, EVP_PKEY_ML_DSA_44); | |
| 1259 | 1259 | NODE_DEFINE_CONSTANT(target, EVP_PKEY_ML_DSA_65); | |
| 1260 | 1260 | NODE_DEFINE_CONSTANT(target, EVP_PKEY_ML_DSA_87); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -152,7 +152,7 @@ class KeyObjectHandle : public BaseObject { | |||
| 152 | 152 | static void Init(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 153 | 153 | static void InitECRaw(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 154 | 154 | static void InitEDRaw(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 155 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 155 | + #if OPENSSL_WITH_PQC | ||
| 156 | 156 | static void InitMlDsaRaw(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 157 | 157 | #endif | |
| 158 | 158 | static void InitJWK(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ using v8::Value; | |||
| 14 | 14 | ||
| 15 | 15 | namespace crypto { | |
| 16 | 16 | ||
| 17 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 17 | + #if OPENSSL_WITH_PQC | ||
| 18 | 18 | constexpr const char* GetMlDsaAlgorithmName(int id) { | |
| 19 | 19 | switch (id) { | |
| 20 | 20 | case EVP_PKEY_ML_DSA_44: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | 10 | namespace node { | |
| 11 | 11 | namespace crypto { | |
| 12 | - #if OPENSSL_VERSION_MAJOR >= 3 && OPENSSL_VERSION_MINOR >= 5 | ||
| 12 | + #if OPENSSL_WITH_PQC | ||
| 13 | 13 | bool ExportJwkMlDsaKey(Environment* env, | |
| 14 | 14 | const KeyObjectData& key, | |
| 15 | 15 | v8::Local<v8::Object> target); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments