|
9 | 9 |
|
10 | 10 | namespace node { |
11 | 11 |
|
12 | | -using v8::FastApiCallbackOptions; |
13 | | -using v8::FastApiTypedArray; |
14 | 12 | using v8::FunctionCallbackInfo; |
15 | 13 | using v8::Local; |
16 | 14 | using v8::Object; |
@@ -48,32 +46,12 @@ void TimingSafeEqual(const FunctionCallbackInfo<Value>& args) { |
48 | 46 | CRYPTO_memcmp(buf1.data(), buf2.data(), buf1.size()) == 0); |
49 | 47 | } |
50 | 48 |
|
51 | | -bool FastTimingSafeEqual(Local<Value> receiver, |
52 | | - const FastApiTypedArray<uint8_t>& a, |
53 | | - const FastApiTypedArray<uint8_t>& b, |
54 | | - // NOLINTNEXTLINE(runtime/references) |
55 | | - FastApiCallbackOptions& options) { |
56 | | - uint8_t* data_a; |
57 | | - uint8_t* data_b; |
58 | | - if (a.length() != b.length() || !a.getStorageIfAligned(&data_a) || |
59 | | - !b.getStorageIfAligned(&data_b)) { |
60 | | - options.fallback = true; |
61 | | - return false; |
62 | | - } |
63 | | - |
64 | | - return CRYPTO_memcmp(data_a, data_b, a.length()) == 0; |
65 | | -} |
66 | | - |
67 | | -static v8::CFunction fast_equal(v8::CFunction::Make(FastTimingSafeEqual)); |
68 | | - |
69 | 49 | void Initialize(Environment* env, Local<Object> target) { |
70 | | - SetFastMethodNoSideEffect( |
71 | | - env->context(), target, "timingSafeEqual", TimingSafeEqual, &fast_equal); |
| 50 | + SetMethodNoSideEffect( |
| 51 | + env->context(), target, "timingSafeEqual", TimingSafeEqual); |
72 | 52 | } |
73 | 53 | void RegisterExternalReferences(ExternalReferenceRegistry* registry) { |
74 | 54 | registry->Register(TimingSafeEqual); |
75 | | - registry->Register(FastTimingSafeEqual); |
76 | | - registry->Register(fast_equal.GetTypeInfo()); |
77 | 55 | } |
78 | 56 | } // namespace Timing |
79 | 57 |
|
|
0 commit comments