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:
parent
ae230c9150
commit
54a3ffcd42
Notes:
sideshowbarker
2024-07-16 21:34:08 +09:00
Author: https://github.com/stelar7
Commit: 54a3ffcd42
Pull-request: https://github.com/SerenityOS/serenity/pull/23737
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
1 changed files with 5 additions and 0 deletions
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue