diff options
author | jsing <> | 2014-05-15 15:41:44 +0000 |
---|---|---|
committer | jsing <> | 2014-05-15 15:41:44 +0000 |
commit | b88d7e72318b6af7739b0e0d5df6aa091234f44d (patch) | |
tree | a5e712e39791654d5c9b991a2728106d4b9cc0ff /src | |
parent | 58717fb038a81b7b57c09bf92e8a67e2c23377e2 (diff) | |
download | openbsd-b88d7e72318b6af7739b0e0d5df6aa091234f44d.tar.gz openbsd-b88d7e72318b6af7739b0e0d5df6aa091234f44d.tar.bz2 openbsd-b88d7e72318b6af7739b0e0d5df6aa091234f44d.zip |
Add chacha20-poly1305 test vector to regress.
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/aead/aeadtest.c | 11 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/aead/aeadtests.txt | 18 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/regress/lib/libcrypto/aead/aeadtest.c b/src/regress/lib/libcrypto/aead/aeadtest.c index 4d96ed6de4..4322194f82 100644 --- a/src/regress/lib/libcrypto/aead/aeadtest.c +++ b/src/regress/lib/libcrypto/aead/aeadtest.c | |||
@@ -73,7 +73,7 @@ | |||
73 | * TAG: 1d45758621762e061368e68868e2f929 | 73 | * TAG: 1d45758621762e061368e68868e2f929 |
74 | */ | 74 | */ |
75 | 75 | ||
76 | #define BUF_MAX 512 | 76 | #define BUF_MAX 1024 |
77 | 77 | ||
78 | /* These are the different types of line that are found in the input file. */ | 78 | /* These are the different types of line that are found in the input file. */ |
79 | enum { | 79 | enum { |
@@ -112,7 +112,8 @@ hex_digit(char h) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | int | 114 | int |
115 | aead_from_name(const EVP_AEAD **aead, const char *name){ | 115 | aead_from_name(const EVP_AEAD **aead, const char *name) |
116 | { | ||
116 | *aead = NULL; | 117 | *aead = NULL; |
117 | 118 | ||
118 | if (strcmp(name, "aes-128-gcm") == 0) { | 119 | if (strcmp(name, "aes-128-gcm") == 0) { |
@@ -127,6 +128,12 @@ aead_from_name(const EVP_AEAD **aead, const char *name){ | |||
127 | #else | 128 | #else |
128 | fprintf(stderr, "No AES support.\n"); | 129 | fprintf(stderr, "No AES support.\n"); |
129 | #endif | 130 | #endif |
131 | } else if (strcmp(name, "chacha20-poly1305") == 0) { | ||
132 | #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) | ||
133 | *aead = EVP_aead_chacha20_poly1305(); | ||
134 | #else | ||
135 | fprintf(stderr, "No chacha20-poly1305 support.\n"); | ||
136 | #endif | ||
130 | } else { | 137 | } else { |
131 | fprintf(stderr, "Unknown AEAD: %s\n", name); | 138 | fprintf(stderr, "Unknown AEAD: %s\n", name); |
132 | return -1; | 139 | return -1; |
diff --git a/src/regress/lib/libcrypto/aead/aeadtests.txt b/src/regress/lib/libcrypto/aead/aeadtests.txt index ec06430121..4748ffb654 100644 --- a/src/regress/lib/libcrypto/aead/aeadtests.txt +++ b/src/regress/lib/libcrypto/aead/aeadtests.txt | |||
@@ -1,4 +1,7 @@ | |||
1 | # | ||
1 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) | 2 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) |
3 | # | ||
4 | |||
2 | # 2.5.1 65-byte Packet Authentication Using GCM-AES-128 | 5 | # 2.5.1 65-byte Packet Authentication Using GCM-AES-128 |
3 | AEAD: aes-128-gcm | 6 | AEAD: aes-128-gcm |
4 | KEY: 013FE00B5F11BE7F866D0CBBC55A7A90 | 7 | KEY: 013FE00B5F11BE7F866D0CBBC55A7A90 |
@@ -8,7 +11,6 @@ AD: 84C5D513D2AAF6E5BBD2727788E523008932D6127CFDE9F9E33724C608000F10111213141516 | |||
8 | CT: | 11 | CT: |
9 | TAG: 217867E50C2DAD74C28C3B50ABDF695A | 12 | TAG: 217867E50C2DAD74C28C3B50ABDF695A |
10 | 13 | ||
11 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) | ||
12 | # 2.5.2 65-byte Packet Authentication Using GCM-AES-256 | 14 | # 2.5.2 65-byte Packet Authentication Using GCM-AES-256 |
13 | AEAD: aes-256-gcm | 15 | AEAD: aes-256-gcm |
14 | KEY: 83C093B58DE7FFE1C0DA926AC43FB3609AC1C80FEE1B624497EF942E2F79A823 | 16 | KEY: 83C093B58DE7FFE1C0DA926AC43FB3609AC1C80FEE1B624497EF942E2F79A823 |
@@ -18,7 +20,6 @@ AD: 84C5D513D2AAF6E5BBD2727788E523008932D6127CFDE9F9E33724C608000F10111213141516 | |||
18 | CT: | 20 | CT: |
19 | TAG: 6EE160E8FAECA4B36C86B234920CA975 | 21 | TAG: 6EE160E8FAECA4B36C86B234920CA975 |
20 | 22 | ||
21 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) | ||
22 | # 2.8.1 75-byte Packet Encryption Using GCM-AES-128 | 23 | # 2.8.1 75-byte Packet Encryption Using GCM-AES-128 |
23 | AEAD: aes-128-gcm | 24 | AEAD: aes-128-gcm |
24 | KEY: 88EE087FD95DA9FBF6725AA9D757B0CD | 25 | KEY: 88EE087FD95DA9FBF6725AA9D757B0CD |
@@ -28,7 +29,6 @@ AD: 68F2E77696CE7AE8E2CA4EC588E54D002E58495C | |||
28 | CT: C31F53D99E5687F7365119B832D2AAE70741D593F1F9E2AB3455779B078EB8FEACDFEC1F8E3E5277F8180B43361F6512ADB16D2E38548A2C719DBA7228D840 | 29 | CT: C31F53D99E5687F7365119B832D2AAE70741D593F1F9E2AB3455779B078EB8FEACDFEC1F8E3E5277F8180B43361F6512ADB16D2E38548A2C719DBA7228D840 |
29 | TAG: 88F8757ADB8AA788D8F65AD668BE70E7 | 30 | TAG: 88F8757ADB8AA788D8F65AD668BE70E7 |
30 | 31 | ||
31 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) | ||
32 | # 2.8.2 75-byte Packet Encryption Using GCM-AES-256 | 32 | # 2.8.2 75-byte Packet Encryption Using GCM-AES-256 |
33 | AEAD: aes-256-gcm | 33 | AEAD: aes-256-gcm |
34 | KEY: 4C973DBC7364621674F8B5B89E5C15511FCED9216490FB1C1A2CAA0FFE0407E5 | 34 | KEY: 4C973DBC7364621674F8B5B89E5C15511FCED9216490FB1C1A2CAA0FFE0407E5 |
@@ -37,3 +37,15 @@ IN: 08000F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132 | |||
37 | AD: 68F2E77696CE7AE8E2CA4EC588E54D002E58495C | 37 | AD: 68F2E77696CE7AE8E2CA4EC588E54D002E58495C |
38 | CT: BA8AE31BC506486D6873E4FCE460E7DC57591FF00611F31C3834FE1C04AD80B66803AFCF5B27E6333FA67C99DA47C2F0CED68D531BD741A943CFF7A6713BD0 | 38 | CT: BA8AE31BC506486D6873E4FCE460E7DC57591FF00611F31C3834FE1C04AD80B66803AFCF5B27E6333FA67C99DA47C2F0CED68D531BD741A943CFF7A6713BD0 |
39 | TAG: 2611CD7DAA01D61C5C886DC1A8170107 | 39 | TAG: 2611CD7DAA01D61C5C886DC1A8170107 |
40 | |||
41 | # | ||
42 | # Test vector from draft-agl-tls-chacha20poly1305-04 section 7. | ||
43 | # | ||
44 | AEAD: chacha20-poly1305 | ||
45 | KEY: 4290bcb154173531f314af57f3be3b5006da371ece272afa1b5dbdd1100a1007 | ||
46 | NONCE: cd7cf67be39c794a | ||
47 | IN: 86d09974840bded2a5ca | ||
48 | AD: 87e229d4500845a079c0 | ||
49 | CT: e3e446f7ede9a19b62a4677dabf4e3d24b876bb284753896e1d6 | ||
50 | TAG: | ||
51 | |||