summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2016-04-13 13:18:05 +0000
committerjsing <jsing@openbsd.org>2016-04-13 13:18:05 +0000
commitae8558bbf8a0861204361ff9392777ee60d1ae98 (patch)
tree04e772d1c64dbfd50852179fbbdbfd3bdd1499d4
parentenable interrupts before attaching the scsibus (diff)
downloadwireguard-openbsd-ae8558bbf8a0861204361ff9392777ee60d1ae98.tar.xz
wireguard-openbsd-ae8558bbf8a0861204361ff9392777ee60d1ae98.zip
After opening an AEAD, ensure that the decrypted output matches the
plaintext for the regress test case.
-rw-r--r--regress/lib/libcrypto/aead/aeadtest.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/regress/lib/libcrypto/aead/aeadtest.c b/regress/lib/libcrypto/aead/aeadtest.c
index 72209f5caae..270d68666eb 100644
--- a/regress/lib/libcrypto/aead/aeadtest.c
+++ b/regress/lib/libcrypto/aead/aeadtest.c
@@ -199,6 +199,11 @@ run_test_case(const EVP_AEAD* aead, unsigned char bufs[NUM_TYPES][BUF_MAX],
return 0;
}
+ if (memcmp(out2, bufs[IN], out_len2) != 0) {
+ fprintf(stderr, "Plaintext mismatch on line %u\n", line_no);
+ return 0;
+ }
+
out[0] ^= 0x80;
if (EVP_AEAD_CTX_open(&ctx, out2, &out_len2, lengths[IN], bufs[NONCE],
lengths[NONCE], out, out_len, bufs[AD], lengths[AD])) {