[njs] Fixed WebCrypto sign() and verify() methods with OpenSSL 3.0.1.

Dmitry Volyntsev xeioex at nginx.com
Wed Dec 22 16:55:11 UTC 2021


details:   https://hg.nginx.org/njs/rev/dd2386828c1c
branches:  
changeset: 1776:dd2386828c1c
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Dec 22 16:54:13 2021 +0000
description:
Fixed WebCrypto sign() and verify() methods with OpenSSL 3.0.1.

Since 3.0.1 EVP_DigestSignFinal() expects siglen to contain the
actual buffer size for signature buffer.

diffstat:

 external/njs_webcrypto.c |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 6906e8a60d3a -r dd2386828c1c external/njs_webcrypto.c
--- a/external/njs_webcrypto.c	Wed Dec 22 10:50:16 2021 +0800
+++ b/external/njs_webcrypto.c	Wed Dec 22 16:54:13 2021 +0000
@@ -2077,6 +2077,8 @@ njs_ext_sign(njs_vm_t *vm, njs_value_t *
             dst = (u_char *) &m[0];
         }
 
+        outlen = olen;
+
         ret = EVP_DigestSignFinal(mctx, dst, &outlen);
         if (njs_slow_path(ret <= 0 || olen != outlen)) {
             njs_webcrypto_error(vm, "EVP_DigestSignFinal() failed");


More information about the nginx-devel mailing list