Skip to content

Commit 0d0cb13

Browse files
committed
src: simplify some ifdefs that are covered by ncrypto
1 parent 98cf41b commit 0d0cb13

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

deps/ncrypto/ncrypto.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,6 +3356,10 @@ EVPKeyCtxPointer EVPKeyCtxPointer::New(const EVPKeyPointer& key) {
33563356
}
33573357

33583358
EVPKeyCtxPointer EVPKeyCtxPointer::NewFromID(int id) {
3359+
#ifdef OPENSSL_IS_BORINGSSL
3360+
// DSA keys are not supported with BoringSSL
3361+
if (id == EVP_PKEY_DSA) return {};
3362+
#endif
33593363
return EVPKeyCtxPointer(EVP_PKEY_CTX_new_id(id, nullptr));
33603364
}
33613365

src/crypto/crypto_dh.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ MaybeLocal<Value> DataPointerToBuffer(Environment* env, DataPointer&& data) {
6565
std::unique_ptr<Flag> flag(static_cast<Flag*>(ptr));
6666
DataPointer free_me(data, len, flag->secure);
6767
},
68-
new Flag { data.isSecure() });
68+
new Flag{data.isSecure()});
6969
data.release();
7070

7171
auto ab = ArrayBuffer::New(env->isolate(), std::move(backing));

src/crypto/crypto_dsa.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@ using v8::Value;
2828

2929
namespace crypto {
3030
EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
31-
#ifdef OPENSSL_IS_BORINGSSL
32-
// Operation is unsupported in BoringSSL
33-
return {};
34-
#else
3531
auto param_ctx = EVPKeyCtxPointer::NewFromID(EVP_PKEY_DSA);
3632

37-
if (!param_ctx.initForParamgen() ||
33+
if (!param_ctx || !param_ctx.initForParamgen() ||
3834
!param_ctx.setDsaParameters(
3935
params->params.modulus_bits,
4036
params->params.divisor_bits != -1
@@ -49,7 +45,6 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
4945
EVPKeyCtxPointer key_ctx = key_params.newCtx();
5046
if (!key_ctx.initForKeygen()) return {};
5147
return key_ctx;
52-
#endif
5348
}
5449

5550
// Input arguments for DsaKeyPairGenJob

src/crypto/crypto_keys.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,6 @@ void KeyObjectHandle::GetAsymmetricKeyType(
924924
}
925925

926926
bool KeyObjectHandle::CheckEcKeyData() const {
927-
#ifdef OPENSSL_IS_BORINGSSL
928-
// Operation is unsupported on BoringSSL
929-
return true;
930-
#else
931927
MarkPopErrorOnReturn mark_pop_error_on_return;
932928

933929
const auto& key = data_.GetAsymmetricKey();
@@ -937,7 +933,6 @@ bool KeyObjectHandle::CheckEcKeyData() const {
937933

938934
return data_.GetKeyType() == kKeyTypePrivate ? ctx.privateCheck()
939935
: ctx.publicCheck();
940-
#endif
941936
}
942937

943938
void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
 (0)