build: fix compiling against openssl with no-psk

Node 15 prior to this commit will not compile if openssl is built with
no-psk. Compiling emits an error like this:

```
crypto_tls.cc:(.text+0x4c27): undefined reference to
`node::crypto::TLSWrap::SetCACerts(node::crypto::SecureContext*)'
```

Blame on crypto_tls.cc shows the file was created in a refactor. Before
that refactor SetCACerts was defined outside OPENSSL_NO_PSK ifndef.

PR-URL: https://github.com/nodejs/node/pull/36881
Fixes: https://github.com/nodejs/node/issues/36464
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Caleb ツ Everett authored and Ruy Adorno committed 2021-01-24 21:43:36 -05:00
1 parent 70ee7dce62
commit 7ce7404f79
1 file changed
+2 -2
+2 -2
View File
@@ -1339,8 +1339,6 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) {
return SSL_TLSEXT_ERR_OK;
}
#ifndef OPENSSL_NO_PSK
int TLSWrap::SetCACerts(SecureContext* sc) {
int err = SSL_set1_verify_cert_store(
ssl_.get(), SSL_CTX_get_cert_store(sc->ctx_.get()));
@@ -1355,6 +1353,8 @@ int TLSWrap::SetCACerts(SecureContext* sc) {
return 1;
}
#ifndef OPENSSL_NO_PSK
void TLSWrap::SetPskIdentityHint(const FunctionCallbackInfo<Value>& args) {
TLSWrap* p;
ASSIGN_OR_RETURN_UNWRAP(&p, args.Holder());