File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,10 @@ Maybe<bool> HKDFTraits::AdditionalConfig(
8787 : info.ToByteSource ();
8888
8989 params->length = args[offset + 4 ].As <Uint32>()->Value ();
90+ // HKDF-Expand computes up to 255 HMAC blocks, each having as many bits as the
91+ // output of the hash function. 255 is a hard limit because HKDF appends an
92+ // 8-bit counter to each HMAC'd message, starting at 1.
93+ constexpr size_t kMaxDigestMultiplier = 255 ;
9094 size_t max_length = EVP_MD_size (params->digest ) * kMaxDigestMultiplier ;
9195 if (params->length > max_length) {
9296 THROW_ERR_CRYPTO_INVALID_KEYLEN (env);
Original file line number Diff line number Diff line change 1111
1212namespace node {
1313namespace crypto {
14- static constexpr size_t kMaxDigestMultiplier = 255 ;
15-
1614struct HKDFConfig final : public MemoryRetainer {
1715 CryptoJobMode mode;
1816 size_t length;
You can’t perform that action at this time.
0 commit comments