mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
src: hide kMaxDigestMultiplier outside HKDF impl
There is no reason to expose this constant outside of the HKDF implementation, especially with such a generic name. PR-URL: https://github.com/nodejs/node/pull/46206 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
1 parent
44595b48f0
commit
bcc2d583a7
2 files changed
+4
-2
No files matched your search
@@ -87,6 +87,10 @@ Maybe<bool> HKDFTraits::AdditionalConfig(
|
||||
: info.ToByteSource();
|
||||
|
||||
params->length = args[offset + 4].As<Uint32>()->Value();
|
||||
// HKDF-Expand computes up to 255 HMAC blocks, each having as many bits as the
|
||||
// output of the hash function. 255 is a hard limit because HKDF appends an
|
||||
// 8-bit counter to each HMAC'd message, starting at 1.
|
||||
constexpr size_t kMaxDigestMultiplier = 255;
|
||||
size_t max_length = EVP_MD_size(params->digest) * kMaxDigestMultiplier;
|
||||
if (params->length > max_length) {
|
||||
THROW_ERR_CRYPTO_INVALID_KEYLEN(env);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace node {
|
||||
namespace crypto {
|
||||
static constexpr size_t kMaxDigestMultiplier = 255;
|
||||
|
||||
struct HKDFConfig final : public MemoryRetainer {
|
||||
CryptoJobMode mode;
|
||||
size_t length;
|
||||
|
||||
Reference in new issue
Block a user