diff --git a/cryptlib.cpp b/cryptlib.cpp index c4463b0c..bf4577a9 100644 --- a/cryptlib.cpp +++ b/cryptlib.cpp @@ -405,8 +405,9 @@ RandomNumberGenerator & NullRNG() bool HashTransformation::TruncatedVerify(const byte *digest, size_t digestLength) { + // Allocate at least 1 for calculated to avoid triggering diagnostics ThrowIfInvalidTruncatedSize(digestLength); - SecByteBlock calculated(digestLength); + SecByteBlock calculated(digestLength ? digestLength : 1); TruncatedFinal(calculated, digestLength); return VerifyBufsEqual(calculated, digest, digestLength); } diff --git a/validat6.cpp b/validat6.cpp index 16df05ab..798554e6 100644 --- a/validat6.cpp +++ b/validat6.cpp @@ -41,7 +41,7 @@ bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough) std::cout << (fail ? "FAILED " : "passed "); std::cout << "cryptosystem key validation\n"; - const byte *message = (byte *)"test message"; + const byte message[] = "test message"; const int messageLen = 12; SecByteBlock ciphertext(priv.CiphertextLength(messageLen)); SecByteBlock plaintext(priv.MaxPlaintextLength(ciphertext.size()));