Skip to content
Snippets Groups Projects
Commit cb0740b1 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Throw a JS exception if do_cryptInit() fails

Catch cryptlib version mismatch gracefully
parent e10260bc
No related branches found
No related tags found
No related merge requests found
Pipeline #8135 failed
......@@ -3076,7 +3076,10 @@ js_cryptcert_constructor(JSContext *cx, uintN argc, jsval *arglist)
JSString * jscert;
size_t len;
do_cryptInit(lprintf);
if (!do_cryptInit(lprintf)) {
JS_ReportError(cx, "do_cryptInit failure");
return JS_FALSE;
}
obj = JS_NewObject(cx, &js_cryptcert_class, NULL, NULL);
JS_SET_RVAL(cx, arglist, OBJECT_TO_JSVAL(obj));
if (argc != 1) {
......
......@@ -961,7 +961,10 @@ js_cryptcon_constructor(JSContext *cx, uintN argc, jsval *arglist)
int status;
int algo;
do_cryptInit(lprintf);
if (!do_cryptInit(lprintf)) {
JS_ReportError(cx, "do_cryptInit failure");
return JS_FALSE;
}
obj = JS_NewObject(cx, &js_cryptcon_class, NULL, NULL);
JS_SET_RVAL(cx, arglist, OBJECT_TO_JSVAL(obj));
if (argc != 1) {
......
......@@ -448,7 +448,10 @@ js_cryptkeyset_constructor(JSContext *cx, uintN argc, jsval *arglist)
JSString * fn;
size_t fnslen;
do_cryptInit(lprintf);
if (!do_cryptInit(lprintf)) {
JS_ReportError(cx, "do_cryptInit failure");
return JS_FALSE;
}
obj = JS_NewObject(cx, &js_cryptkeyset_class, NULL, NULL);
JS_SET_RVAL(cx, arglist, OBJECT_TO_JSVAL(obj));
if (argc < 1 || argc > 2) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment