diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-02-11 23:50:40 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-02-11 23:50:40 +0100 |
commit | 8e80f91fa3e584d6b681bfbb4664e80a255af866 (patch) | |
tree | af4f13f6f0290ee72b33a0642aa7c03e4e5fcd1c /extra/yassl/taocrypt | |
parent | 63108dc9d2cc9f31ae9927817652be465a17f767 (diff) | |
parent | 3ee8aa216d55b858ba9e53874359dcac9a82933a (diff) | |
download | mariadb-git-8e80f91fa3e584d6b681bfbb4664e80a255af866.tar.gz |
Merge remote-tracking branch 'mysql/5.5' into bb-5.5-merge @ mysql-5.5.42
Diffstat (limited to 'extra/yassl/taocrypt')
-rw-r--r-- | extra/yassl/taocrypt/src/asn.cpp | 8 | ||||
-rw-r--r-- | extra/yassl/taocrypt/src/integer.cpp | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 544e9518da8..d521088d74a 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -672,7 +672,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; } @@ -1001,11 +1001,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); diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index b5262e543a4..d8510066d04 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -2605,18 +2605,20 @@ void Integer::Decode(Source& source) void Integer::Decode(const byte* input, unsigned int inputLen, Signedness s) { unsigned int idx(0); - byte b = input[idx++]; + byte b = 0; + if (inputLen>0) + b = input[idx]; // peek sign_ = ((s==SIGNED) && (b & 0x80)) ? NEGATIVE : POSITIVE; while (inputLen>0 && (sign_==POSITIVE ? b==0 : b==0xff)) { - inputLen--; - b = input[idx++]; + idx++; // skip + if (--inputLen>0) + b = input[idx]; // peek } reg_.CleanNew(RoundupSize(BytesToWords(inputLen))); - --idx; for (unsigned int i=inputLen; i > 0; i--) { b = input[idx++]; |