| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent edcd4fc commit 3ce39bb
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,6 +87,10 @@ Maybe<bool> HKDFTraits::AdditionalConfig( | |||
| 87 | 87 | : info.ToByteSource(); | |
| 88 | 88 | ||
| 89 | 89 | 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; | ||
| 90 | 94 | size_t max_length = EVP_MD_size(params->digest) * kMaxDigestMultiplier; | |
| 91 | 95 | if (params->length > max_length) { | |
| 92 | 96 | THROW_ERR_CRYPTO_INVALID_KEYLEN(env); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,8 +11,6 @@ | |||
| 11 | 11 | ||
| 12 | 12 | namespace node { | |
| 13 | 13 | namespace crypto { | |
| 14 | - static constexpr size_t kMaxDigestMultiplier = 255; | ||
| 15 | - | ||
| 16 | 14 | struct HKDFConfig final : public MemoryRetainer { | |
| 17 | 15 | CryptoJobMode mode; | |
| 18 | 16 | size_t length; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments