summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-05-15 15:41:44 +0000
committerjsing <jsing@openbsd.org>2014-05-15 15:41:44 +0000
commit0267a604ef4a62eeff2e557ccda76e943c9a4d5b (patch)
tree6e486eb0edb5ac0c46ad370c036d949b15eee44d
parentKNF. (diff)
downloadwireguard-openbsd-0267a604ef4a62eeff2e557ccda76e943c9a4d5b.tar.xz
wireguard-openbsd-0267a604ef4a62eeff2e557ccda76e943c9a4d5b.zip
Add chacha20-poly1305 test vector to regress.
-rw-r--r--regress/lib/libcrypto/aead/aeadtest.c11
-rw-r--r--regress/lib/libcrypto/aead/aeadtests.txt18
2 files changed, 24 insertions, 5 deletions
diff --git a/regress/lib/libcrypto/aead/aeadtest.c b/regress/lib/libcrypto/aead/aeadtest.c
index 4d96ed6de46..4322194f825 100644
--- a/regress/lib/libcrypto/aead/aeadtest.c
+++ b/regress/lib/libcrypto/aead/aeadtest.c
@@ -73,7 +73,7 @@
* TAG: 1d45758621762e061368e68868e2f929
*/
-#define BUF_MAX 512
+#define BUF_MAX 1024
/* These are the different types of line that are found in the input file. */
enum {
@@ -112,7 +112,8 @@ hex_digit(char h)
}
int
-aead_from_name(const EVP_AEAD **aead, const char *name){
+aead_from_name(const EVP_AEAD **aead, const char *name)
+{
*aead = NULL;
if (strcmp(name, "aes-128-gcm") == 0) {
@@ -127,6 +128,12 @@ aead_from_name(const EVP_AEAD **aead, const char *name){
#else
fprintf(stderr, "No AES support.\n");
#endif
+ } else if (strcmp(name, "chacha20-poly1305") == 0) {
+#if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305)
+ *aead = EVP_aead_chacha20_poly1305();
+#else
+ fprintf(stderr, "No chacha20-poly1305 support.\n");
+#endif
} else {
fprintf(stderr, "Unknown AEAD: %s\n", name);
return -1;
diff --git a/regress/lib/libcrypto/aead/aeadtests.txt b/regress/lib/libcrypto/aead/aeadtests.txt
index ec06430121e..4748ffb654f 100644
--- a/regress/lib/libcrypto/aead/aeadtests.txt
+++ b/regress/lib/libcrypto/aead/aeadtests.txt
@@ -1,4 +1,7 @@
+#
# MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf)
+#
+
# 2.5.1 65-byte Packet Authentication Using GCM-AES-128
AEAD: aes-128-gcm
KEY: 013FE00B5F11BE7F866D0CBBC55A7A90
@@ -8,7 +11,6 @@ AD: 84C5D513D2AAF6E5BBD2727788E523008932D6127CFDE9F9E33724C608000F10111213141516
CT:
TAG: 217867E50C2DAD74C28C3B50ABDF695A
-# MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf)
# 2.5.2 65-byte Packet Authentication Using GCM-AES-256
AEAD: aes-256-gcm
KEY: 83C093B58DE7FFE1C0DA926AC43FB3609AC1C80FEE1B624497EF942E2F79A823
@@ -18,7 +20,6 @@ AD: 84C5D513D2AAF6E5BBD2727788E523008932D6127CFDE9F9E33724C608000F10111213141516
CT:
TAG: 6EE160E8FAECA4B36C86B234920CA975
-# MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf)
# 2.8.1 75-byte Packet Encryption Using GCM-AES-128
AEAD: aes-128-gcm
KEY: 88EE087FD95DA9FBF6725AA9D757B0CD
@@ -28,7 +29,6 @@ AD: 68F2E77696CE7AE8E2CA4EC588E54D002E58495C
CT: C31F53D99E5687F7365119B832D2AAE70741D593F1F9E2AB3455779B078EB8FEACDFEC1F8E3E5277F8180B43361F6512ADB16D2E38548A2C719DBA7228D840
TAG: 88F8757ADB8AA788D8F65AD668BE70E7
-# MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf)
# 2.8.2 75-byte Packet Encryption Using GCM-AES-256
AEAD: aes-256-gcm
KEY: 4C973DBC7364621674F8B5B89E5C15511FCED9216490FB1C1A2CAA0FFE0407E5
@@ -37,3 +37,15 @@ IN: 08000F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132
AD: 68F2E77696CE7AE8E2CA4EC588E54D002E58495C
CT: BA8AE31BC506486D6873E4FCE460E7DC57591FF00611F31C3834FE1C04AD80B66803AFCF5B27E6333FA67C99DA47C2F0CED68D531BD741A943CFF7A6713BD0
TAG: 2611CD7DAA01D61C5C886DC1A8170107
+
+#
+# Test vector from draft-agl-tls-chacha20poly1305-04 section 7.
+#
+AEAD: chacha20-poly1305
+KEY: 4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd1100a1007
+NONCE: cd7cf67be39c794a
+IN: 86d09974840bded2a5ca
+AD: 87e229d4500845a079c0
+CT: e3e446f7ede9a19b62a4677dabf4e3d24b876bb284753896e1d6
+TAG:
+