| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1cdccbc commit 6857ee8
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -674,22 +674,21 @@ CryptoJobMode GetCryptoJobMode(v8::Local<v8::Value> args) { | |||
| 674 | 674 | } | |
| 675 | 675 | ||
| 676 | 676 | namespace { | |
| 677 | - // SecureBuffer uses openssl to allocate a Uint8Array using | ||
| 678 | - // OPENSSL_secure_malloc. Because we do not yet actually | ||
| 679 | - // make use of secure heap, this has the same semantics as | ||
| 677 | + // SecureBuffer uses OPENSSL_secure_malloc to allocate a Uint8Array. | ||
| 678 | + // Without --secure-heap, OpenSSL's secure heap is disabled, | ||
| 679 | + // in which case this has the same semantics as | ||
| 680 | 680 | // using OPENSSL_malloc. However, if the secure heap is | |
| 681 | 681 | // initialized, SecureBuffer will automatically use it. | |
| 682 | 682 | void SecureBuffer(const FunctionCallbackInfo<Value>& args) { | |
| 683 | 683 | CHECK(args[0]->IsUint32()); | |
| 684 | 684 | Environment* env = Environment::GetCurrent(args); | |
| 685 | 685 | uint32_t len = args[0].As<Uint32>()->Value(); | |
| 686 | - char* data = static_cast<char*>(OPENSSL_secure_malloc(len)); | ||
| 686 | + void* data = OPENSSL_secure_zalloc(len); | ||
| 687 | 687 | if (data == nullptr) { | |
| 688 | 688 | // There's no memory available for the allocation. | |
| 689 | 689 | // Return nothing. | |
| 690 | 690 | return; | |
| 691 | 691 | } | |
| 692 | - memset(data, 0, len); | ||
| 693 | 692 | std::shared_ptr<BackingStore> store = | |
| 694 | 693 | ArrayBuffer::NewBackingStore( | |
| 695 | 694 | data, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments