| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -279,9 +279,6 @@ void Hash::Initialize(Environment* env, Local<Object> target) { | |||
| 279 | 279 | SetMethodNoSideEffect(context, target, "oneShotDigest", OneShotDigest); | |
| 280 | 280 | ||
| 281 | 281 | HashJob::Initialize(env, target); | |
| 282 | - | ||
| 283 | - SetMethodNoSideEffect( | ||
| 284 | - context, target, "internalVerifyIntegrity", InternalVerifyIntegrity); | ||
| 285 | 282 | } | |
| 286 | 283 | ||
| 287 | 284 | void Hash::RegisterExternalReferences(ExternalReferenceRegistry* registry) { | |
@@ -293,8 +290,6 @@ void Hash::RegisterExternalReferences(ExternalReferenceRegistry* registry) { | |||
| 293 | 290 | registry->Register(OneShotDigest); | |
| 294 | 291 | ||
| 295 | 292 | HashJob::RegisterExternalReferences(registry); | |
| 296 | - | ||
| 297 | - registry->Register(InternalVerifyIntegrity); | ||
| 298 | 293 | } | |
| 299 | 294 | ||
| 300 | 295 | // new Hash(algorithm, algorithmId, xofLen, algorithmCache) | |
@@ -504,44 +499,5 @@ bool HashTraits::DeriveBits(Environment* env, | |||
| 504 | 499 | return true; | |
| 505 | 500 | } | |
| 506 | 501 | ||
| 507 | - void InternalVerifyIntegrity(const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
| 508 | - Environment* env = Environment::GetCurrent(args); | ||
| 509 | - | ||
| 510 | - CHECK_EQ(args.Length(), 3); | ||
| 511 | - | ||
| 512 | - CHECK(args[0]->IsString()); | ||
| 513 | - Utf8Value algorithm(env->isolate(), args[0]); | ||
| 514 | - | ||
| 515 | - CHECK(args[1]->IsString() || IsAnyBufferSource(args[1])); | ||
| 516 | - ByteSource content = ByteSource::FromStringOrBuffer(env, args[1]); | ||
| 517 | - | ||
| 518 | - CHECK(args[2]->IsArrayBufferView()); | ||
| 519 | - ArrayBufferOrViewContents<unsigned char> expected(args[2]); | ||
| 520 | - | ||
| 521 | - const EVP_MD* md_type = ncrypto::getDigestByName(*algorithm); | ||
| 522 | - unsigned char digest[EVP_MAX_MD_SIZE]; | ||
| 523 | - unsigned int digest_size; | ||
| 524 | - if (md_type == nullptr || EVP_Digest(content.data(), | ||
| 525 | - content.size(), | ||
| 526 | - digest, | ||
| 527 | - &digest_size, | ||
| 528 | - md_type, | ||
| 529 | - nullptr) != 1) [[unlikely]] { | ||
| 530 | - return ThrowCryptoError( | ||
| 531 | - env, ERR_get_error(), "Digest method not supported"); | ||
| 532 | - } | ||
| 533 | - | ||
| 534 | - if (digest_size != expected.size() || | ||
| 535 | - CRYPTO_memcmp(digest, expected.data(), digest_size) != 0) { | ||
| 536 | - Local<Value> ret; | ||
| 537 | - if (StringBytes::Encode(env->isolate(), | ||
| 538 | - reinterpret_cast<const char*>(digest), | ||
| 539 | - digest_size, | ||
| 540 | - BASE64) | ||
| 541 | - .ToLocal(&ret)) { | ||
| 542 | - args.GetReturnValue().Set(ret); | ||
| 543 | - } | ||
| 544 | - } | ||
| 545 | - } | ||
| 546 | 502 | } // namespace crypto | |
| 547 | 503 | } // namespace node | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,8 +82,6 @@ struct HashTraits final { | |||
| 82 | 82 | ||
| 83 | 83 | using HashJob = DeriveBitsJob<HashTraits>; | |
| 84 | 84 | ||
| 85 | - void InternalVerifyIntegrity(const v8::FunctionCallbackInfo<v8::Value>& args); | ||
| 86 | - | ||
| 87 | 85 | } // namespace crypto | |
| 88 | 86 | } // namespace node | |
| 89 | 87 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments