1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibCrypto: Add early exit to SECP.verify if signature is invalid

This commit is contained in:
stelar7 2024-03-29 21:59:57 +01:00 committed by Andrew Kaster
parent ae230c9150
commit 54a3ffcd42
Notes: sideshowbarker 2024-07-16 21:34:08 +09:00

View file

@ -186,6 +186,11 @@ public:
auto r_bigint = TRY(asn1_decoder.read<Crypto::UnsignedBigInteger>(Crypto::ASN1::Class::Universal, Crypto::ASN1::Kind::Integer));
auto s_bigint = TRY(asn1_decoder.read<Crypto::UnsignedBigInteger>(Crypto::ASN1::Class::Universal, Crypto::ASN1::Kind::Integer));
size_t expected_word_count = KEY_BIT_SIZE / 32;
if (r_bigint.length() < expected_word_count || s_bigint.length() < expected_word_count) {
return false;
}
StorageType r = 0u;
StorageType s = 0u;
for (size_t i = 0; i < (KEY_BIT_SIZE / 32); i++) {