Skip to content

Commit c3b84f1

Browse files
authored
src: remove INT_MAX asserts in SecretKeyGenTraits
Now that CSPRNG() does not silently fail when the length exceeds INT_MAX anymore, there is no need for the two relevant assertions in SecretKeyGenTraits anymore. Refs: #47515 PR-URL: #48053 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 6599cfe commit c3b84f1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/crypto/crypto_keygen.cc

+2-6
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,13 @@ Maybe<bool> SecretKeyGenTraits::AdditionalConfig(
6363
SecretKeyGenConfig* params) {
6464
CHECK(args[*offset]->IsUint32());
6565
uint32_t bits = args[*offset].As<Uint32>()->Value();
66-
static_assert(std::numeric_limits<decltype(bits)>::max() / CHAR_BIT <=
67-
INT_MAX);
6866
params->length = bits / CHAR_BIT;
6967
*offset += 1;
7068
return Just(true);
7169
}
7270

73-
KeyGenJobStatus SecretKeyGenTraits::DoKeyGen(
74-
Environment* env,
75-
SecretKeyGenConfig* params) {
76-
CHECK_LE(params->length, INT_MAX);
71+
KeyGenJobStatus SecretKeyGenTraits::DoKeyGen(Environment* env,
72+
SecretKeyGenConfig* params) {
7773
ByteSource::Builder bytes(params->length);
7874
if (CSPRNG(bytes.data<unsigned char>(), params->length).is_err())
7975
return KeyGenJobStatus::FAILED;

0 commit comments

Comments
 (0)