Clear asserts under DEBUG builds

pull/867/head
Jeffrey Walton 2019-07-06 15:57:08 -04:00
parent fd7115fc8b
commit 2ffa70fbc6
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 3 additions and 2 deletions

View File

@ -405,8 +405,9 @@ RandomNumberGenerator & NullRNG()
bool HashTransformation::TruncatedVerify(const byte *digest, size_t digestLength) bool HashTransformation::TruncatedVerify(const byte *digest, size_t digestLength)
{ {
// Allocate at least 1 for calculated to avoid triggering diagnostics
ThrowIfInvalidTruncatedSize(digestLength); ThrowIfInvalidTruncatedSize(digestLength);
SecByteBlock calculated(digestLength); SecByteBlock calculated(digestLength ? digestLength : 1);
TruncatedFinal(calculated, digestLength); TruncatedFinal(calculated, digestLength);
return VerifyBufsEqual(calculated, digest, digestLength); return VerifyBufsEqual(calculated, digest, digestLength);
} }

View File

@ -41,7 +41,7 @@ bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough)
std::cout << (fail ? "FAILED " : "passed "); std::cout << (fail ? "FAILED " : "passed ");
std::cout << "cryptosystem key validation\n"; std::cout << "cryptosystem key validation\n";
const byte *message = (byte *)"test message"; const byte message[] = "test message";
const int messageLen = 12; const int messageLen = 12;
SecByteBlock ciphertext(priv.CiphertextLength(messageLen)); SecByteBlock ciphertext(priv.CiphertextLength(messageLen));
SecByteBlock plaintext(priv.MaxPlaintextLength(ciphertext.size())); SecByteBlock plaintext(priv.MaxPlaintextLength(ciphertext.size()));