File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -120,10 +120,9 @@ void InitCryptoOnce() {
120
120
}
121
121
}
122
122
if (0 != err) {
123
- fprintf (stderr,
124
- " openssl fips failed: %s\n " ,
125
- ERR_error_string (err, nullptr ));
126
- UNREACHABLE ();
123
+ auto * isolate = Isolate::GetCurrent ();
124
+ auto * env = Environment::GetCurrent (isolate);
125
+ return ThrowCryptoError (env, err);
127
126
}
128
127
129
128
// Turn off compression. Saves memory and protects against CRIME attacks.
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ namespace node {
31
31
using v8::Context;
32
32
using v8::Local;
33
33
using v8::Object;
34
+ using v8::TryCatch;
34
35
using v8::Value;
35
36
36
37
namespace crypto {
@@ -39,10 +40,15 @@ void Initialize(Local<Object> target,
39
40
Local<Value> unused,
40
41
Local<Context> context,
41
42
void * priv) {
43
+ Environment* env = Environment::GetCurrent (context);
44
+
42
45
static uv_once_t init_once = UV_ONCE_INIT;
46
+ TryCatch try_catch{env->isolate ()};
43
47
uv_once (&init_once, InitCryptoOnce);
44
-
45
- Environment* env = Environment::GetCurrent (context);
48
+ if (try_catch.HasCaught () && !try_catch.HasTerminated ()) {
49
+ try_catch.ReThrow ();
50
+ return ;
51
+ }
46
52
47
53
AES::Initialize (env, target);
48
54
CipherBase::Initialize (env, target);
You can’t perform that action at this time.
0 commit comments