[njs] SSL: fixed building with OpenSSL <= 1.0.1.

Dmitry Volyntsev xeioex at nginx.com
Wed Oct 13 16:56:53 UTC 2021


details:   https://hg.nginx.org/njs/rev/1b63a726fcea
branches:  
changeset: 1723:1b63a726fcea
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Oct 13 16:31:00 2021 +0000
description:
SSL: fixed building with OpenSSL <= 1.0.1.

This closes #429 issue on Github.

diffstat:

 external/njs_openssl.h   |  3 +++
 external/njs_webcrypto.c |  4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 776277c313be -r 1b63a726fcea external/njs_openssl.h
--- a/external/njs_openssl.h	Wed Oct 13 15:29:50 2021 +0000
+++ b/external/njs_openssl.h	Wed Oct 13 16:31:00 2021 +0000
@@ -45,6 +45,9 @@
 #endif
 
 
+#define njs_bio_new_mem_buf(b, len) BIO_new_mem_buf((void *) b, len)
+
+
 #if (OPENSSL_VERSION_NUMBER < 0x30000000L && !defined ERR_peek_error_data)
 #define ERR_peek_error_data(d, f)    ERR_peek_error_line_data(NULL, NULL, d, f)
 #endif
diff -r 776277c313be -r 1b63a726fcea external/njs_webcrypto.c
--- a/external/njs_webcrypto.c	Wed Oct 13 15:29:50 2021 +0000
+++ b/external/njs_webcrypto.c	Wed Oct 13 16:31:00 2021 +0000
@@ -598,7 +598,7 @@ njs_cipher_pkey(njs_vm_t *vm, njs_str_t 
     md = njs_algorithm_hash_digest(key->hash);
 
     EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING);
-    EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md);
+    EVP_PKEY_CTX_set_signature_md(ctx, md);
     EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md);
 
     ret = cipher(ctx, NULL, &outlen, data->start, data->length);
@@ -1714,7 +1714,7 @@ njs_ext_import_key(njs_vm_t *vm, njs_val
 
     switch (fmt) {
     case NJS_KEY_FORMAT_PKCS8:
-        bio = BIO_new_mem_buf(start, key_data.length);
+        bio = njs_bio_new_mem_buf(start, key_data.length);
         if (njs_slow_path(bio == NULL)) {
             njs_webcrypto_error(vm, "BIO_new_mem_buf() failed");
             goto fail;


More information about the nginx-devel mailing list