Skip to content

Commit 772f8d0

Browse files
committed
QuickJS: added missed OPENSSL context for errors in WebCrypto.
1 parent 4c86233 commit 772f8d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

external/qjs_webcrypto_module.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -3242,22 +3242,22 @@ qjs_webcrypto_import_key(JSContext *cx, JSValueConst this_val, int argc,
32423242
case QJS_KEY_FORMAT_PKCS8:
32433243
bio = BIO_new_mem_buf(key_data.start, key_data.length);
32443244
if (bio == NULL) {
3245-
JS_ThrowTypeError(cx, "BIO_new_mem_buf() failed");
3245+
qjs_webcrypto_error(cx, "BIO_new_mem_buf() failed");
32463246
goto fail;
32473247
}
32483248

32493249
pkcs8 = d2i_PKCS8_PRIV_KEY_INFO_bio(bio, NULL);
32503250
if (pkcs8 == NULL) {
32513251
BIO_free(bio);
3252-
JS_ThrowTypeError(cx, "d2i_PKCS8_PRIV_KEY_INFO_bio() failed");
3252+
qjs_webcrypto_error(cx, "d2i_PKCS8_PRIV_KEY_INFO_bio() failed");
32533253
goto fail;
32543254
}
32553255

32563256
pkey = EVP_PKCS82PKEY(pkcs8);
32573257
if (pkey == NULL) {
32583258
PKCS8_PRIV_KEY_INFO_free(pkcs8);
32593259
BIO_free(bio);
3260-
JS_ThrowTypeError(cx, "EVP_PKCS82PKEY() failed");
3260+
qjs_webcrypto_error(cx, "EVP_PKCS82PKEY() failed");
32613261
goto fail;
32623262
}
32633263

@@ -3272,7 +3272,7 @@ qjs_webcrypto_import_key(JSContext *cx, JSValueConst this_val, int argc,
32723272
start = key_data.start;
32733273
pkey = d2i_PUBKEY(NULL, &start, key_data.length);
32743274
if (pkey == NULL) {
3275-
JS_ThrowTypeError(cx, "d2i_PUBKEY() failed");
3275+
qjs_webcrypto_error(cx, "d2i_PUBKEY() failed");
32763276
goto fail;
32773277
}
32783278

@@ -3720,7 +3720,7 @@ qjs_convert_p1363_to_der(JSContext *cx, EVP_PKEY *pkey, u_char *p1363,
37203720

37213721
if (len < 0) {
37223722
js_free(cx, data);
3723-
JS_ThrowTypeError(cx, "i2d_ECDSA_SIG() failed");
3723+
qjs_webcrypto_error(cx, "i2d_ECDSA_SIG() failed");
37243724
goto fail;
37253725
}
37263726

0 commit comments

Comments
 (0)