details: https://github.com/nginx/njs/commit/637fc26eac8622ccf8c73cfa4604e9afe54c3f34 branches: master commit: 637fc26eac8622ccf8c73cfa4604e9afe54c3f34 user: Dmitry Volyntsev <xei...@nginx.com> date: Thu, 8 May 2025 18:03:21 -0700 description: WebCrypto: making SHA-256 the default hash algorithm.
--- external/njs_webcrypto_module.c | 4 ++-- external/qjs_webcrypto_module.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/external/njs_webcrypto_module.c b/external/njs_webcrypto_module.c index dcca91ce..8cc172cc 100644 --- a/external/njs_webcrypto_module.c +++ b/external/njs_webcrypto_module.c @@ -4642,8 +4642,8 @@ njs_algorithm_hash(njs_vm_t *vm, njs_value_t *options, if (njs_value_is_object(options)) { val = njs_vm_object_prop(vm, options, &string_hash, &value); - if (njs_slow_path(val == NULL)) { - njs_value_undefined_set(njs_value_arg(&value)); + if (val == NULL) { + return NJS_HASH_SHA256; } } else { diff --git a/external/qjs_webcrypto_module.c b/external/qjs_webcrypto_module.c index 937f96c3..f26b6505 100644 --- a/external/qjs_webcrypto_module.c +++ b/external/qjs_webcrypto_module.c @@ -4437,6 +4437,11 @@ qjs_algorithm_hash(JSContext *cx, JSValue options, qjs_webcrypto_hash_t *hash) if (JS_IsObject(options)) { v = JS_GetPropertyStr(cx, options, "hash"); + if (JS_IsUndefined(v)) { + *hash = QJS_HASH_SHA256; + return JS_UNDEFINED; + } + if (JS_IsException(v)) { return JS_EXCEPTION; } _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel