File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ NAN_METHOD(privateKeyModInverse) {
8181 v8::Local<v8::Object> private_key_buffer = info[0 ].As <v8::Object>();
8282 CHECK_TYPE_BUFFER (private_key_buffer, EC_PRIVATE_KEY_TYPE_INVALID);
8383 CHECK_BUFFER_LENGTH (private_key_buffer, 32 , EC_PRIVATE_KEY_LENGTH_INVALID);
84- const unsigned char * private_key = (const unsigned char *) node::Buffer::Data (private_key_buffer);
84+ unsigned char private_key[32 ];
85+ memcpy (&private_key[0 ], node::Buffer::Data (private_key_buffer), 32 );
8586
8687 secp256k1_scalar s;
8788 int overflow = 0 ;
@@ -93,11 +94,10 @@ NAN_METHOD(privateKeyModInverse) {
9394
9495 secp256k1_scalar_inverse (&s, &s);
9596
96- unsigned char b[32 ];
97- secp256k1_scalar_get_b32 (b, &s);
97+ secp256k1_scalar_get_b32 (private_key, &s);
9898 secp256k1_scalar_clear (&s);
9999
100- info.GetReturnValue ().Set (COPY_BUFFER (&b [0 ], 32 ));
100+ info.GetReturnValue ().Set (COPY_BUFFER (&private_key [0 ], 32 ));
101101}
102102
103103NAN_METHOD (privateKeyTweakAdd) {
You can’t perform that action at this time.
0 commit comments