diff options
Diffstat (limited to 'extra/yassl/taocrypt/src/asn.cpp')
-rw-r--r-- | extra/yassl/taocrypt/src/asn.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 15f8d81f5cc..624148bdac8 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -680,7 +680,7 @@ word32 CertDecoder::GetSignature() } sigLength_ = GetLength(source_); - if (sigLength_ == 0 || source_.IsLeft(sigLength_) == false) { + if (sigLength_ <= 1 || source_.IsLeft(sigLength_) == false) { source_.SetError(CONTENT_E); return 0; } @@ -1011,11 +1011,17 @@ bool CertDecoder::ConfirmSignature(Source& pub) RSA_PublicKey pubKey(pub); RSAES_Encryptor enc(pubKey); + if (pubKey.FixedCiphertextLength() != sigLength_) { + source_.SetError(SIG_LEN_E); + return false; + } + return enc.SSL_Verify(build.get_buffer(), build.size(), signature_); } else { // DSA // extract r and s from sequence byte seqDecoded[DSA_SIG_SZ]; + memset(seqDecoded, 0, sizeof(seqDecoded)); DecodeDSA_Signature(seqDecoded, signature_, sigLength_); DSA_PublicKey pubKey(pub); |