diff options
author | Dmitry Volyntsev <xeioex@nginx.com> | 2025-05-08 18:03:21 -0700 |
---|---|---|
committer | Dmitry Volyntsev <xeioexception@gmail.com> | 2025-05-16 12:15:29 -0700 |
commit | 637fc26eac8622ccf8c73cfa4604e9afe54c3f34 (patch) | |
tree | e0786f88342def84927988fa1279444867c210ff | |
parent | 04721dd3ecb53e080f3f578f587b069c5bc21dae (diff) | |
download | njs-637fc26eac8622ccf8c73cfa4604e9afe54c3f34.tar.gz njs-637fc26eac8622ccf8c73cfa4604e9afe54c3f34.zip |
WebCrypto: making SHA-256 the default hash algorithm.
-rw-r--r-- | external/njs_webcrypto_module.c | 4 | ||||
-rw-r--r-- | 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; } |