mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
crypto: handle XOF output allocation failure
Return an operation error when XOF output allocation fails. Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/64851 Backport-PR-URL: https://github.com/nodejs/node/pull/65087 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
782ad5d5b0
commit
74b3023565
1 file changed
+8
-2
@@ -468,7 +468,10 @@ bool TurboShakeTraits::DeriveBits(Environment* env,
|
||||
ByteSource* out,
|
||||
CryptoJobMode mode) {
|
||||
CHECK_GT(params.output_length, 0);
|
||||
char* buf = MallocOpenSSL<char>(params.output_length);
|
||||
char* buf = static_cast<char*>(OPENSSL_malloc(params.output_length));
|
||||
if (buf == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint8_t* input = reinterpret_cast<const uint8_t*>(params.data.data());
|
||||
size_t input_len = params.data.size();
|
||||
@@ -592,7 +595,10 @@ bool KangarooTwelveTraits::DeriveBits(Environment* env,
|
||||
return false;
|
||||
}
|
||||
|
||||
char* buf = MallocOpenSSL<char>(params.output_length);
|
||||
char* buf = static_cast<char*>(OPENSSL_malloc(params.output_length));
|
||||
if (buf == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (params.variant) {
|
||||
case KangarooTwelveVariant::KT128:
|
||||
|
||||
Reference in new issue
Block a user