diff options
author | lloyd <[email protected]> | 2012-05-18 18:34:03 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-18 18:34:03 +0000 |
commit | e0070253386bfd39b2a782c66ccf0caf9ce87ca2 (patch) | |
tree | f1a7a75d00fdfd3f1f9690b4e377136840fc8bf8 /src/pk_pad | |
parent | 9cdff001953ce80cd15ff556a5ae08aaa98d2df5 (diff) |
NR_Verification_Operation::verify_mr would return false if the input
was not the right size for a signature (following DSA). This would
silently convert to an empty vector which we would treat as a valid
message on the return. However the EMSA checks will always fail so not
a huge problem.
While checking this out I noticed that an empty value for EMSA4 would
result in us reading memory we didn't own.
Diffstat (limited to 'src/pk_pad')
-rw-r--r-- | src/pk_pad/emsa4/emsa4.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pk_pad/emsa4/emsa4.cpp b/src/pk_pad/emsa4/emsa4.cpp index ef88e1953..194d934c1 100644 --- a/src/pk_pad/emsa4/emsa4.cpp +++ b/src/pk_pad/emsa4/emsa4.cpp @@ -74,10 +74,13 @@ bool EMSA4::verify(const MemoryRegion<byte>& const_coded, if(key_bits < 8*HASH_SIZE + 9) return false; + if(raw.size() != HASH_SIZE) return false; - if(const_coded.size() > KEY_BYTES) + + if(const_coded.size() > KEY_BYTES || const_coded.size() <= 1) return false; + if(const_coded[const_coded.size()-1] != 0xBC) return false; |