crypto: make X.509 inspection guards explicit

Require a supported backend when selecting the BIT STRING length
capability. Reject other backends at compile time, matching the
surrounding checks used to catch unsupported OpenSSL backports.

Assisted-by: Codex
Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67245
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Filip Skokan authored and Node.js GitHub Bot committed 2026-11-11 10:46:22 +00:00
1 parent 5498ee6eb5
commit 2336a1f005
1 file changed
+4 -2
+4 -2
View File
@@ -64,10 +64,12 @@
// OpenSSL 4 makes ASN1_STRING opaque and provides a checked BIT STRING length
// accessor. Earlier OpenSSL releases and pinned BoringSSL expose the decoded
// unused-bit count through ASN1_STRING::flags.
#if !NCRYPTO_USE_BORINGSSL && OPENSSL_VERSION_PREREQ(4, 0)
#if NCRYPTO_USE_OPENSSL_PROVIDER && OPENSSL_VERSION_PREREQ(4, 0)
#define NCRYPTO_HAS_ASN1_BIT_STRING_GET_LENGTH 1
#else
#elif NCRYPTO_USE_OPENSSL_PROVIDER || NCRYPTO_USE_BORINGSSL
#define NCRYPTO_HAS_ASN1_BIT_STRING_GET_LENGTH 0
#else
#error "Unsupported crypto backend"
#endif
// BoringSSL's X.509 signer can encode only its restricted RSA-PSS parameter