diff options
author | dlg <> | 2019-01-22 00:59:21 +0000 |
---|---|---|
committer | dlg <> | 2019-01-22 00:59:21 +0000 |
commit | 314b0e719f69f4ef7811d81c9346e1b71bdef302 (patch) | |
tree | 87d28e1c4d3807293ec30dc5c24e43dccbe80302 /src/regress/lib/libcrypto/aead | |
parent | 6b5710cca200592904a2f0474264ab1e06d1d1dc (diff) | |
download | openbsd-314b0e719f69f4ef7811d81c9346e1b71bdef302.tar.gz openbsd-314b0e719f69f4ef7811d81c9346e1b71bdef302.tar.bz2 openbsd-314b0e719f69f4ef7811d81c9346e1b71bdef302.zip |
add support for xchacha20 and xchacha20-poly1305
xchacha is a chacha stream that allows for an extended nonce, which
in turn makes it feasible to use random nonces.
ok tb@
Diffstat (limited to 'src/regress/lib/libcrypto/aead')
-rw-r--r-- | src/regress/lib/libcrypto/aead/aeadtest.c | 11 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/aead/aeadtests.txt | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/aead/aeadtest.c b/src/regress/lib/libcrypto/aead/aeadtest.c index 4f0ab9fa3a..1b144c2615 100644 --- a/src/regress/lib/libcrypto/aead/aeadtest.c +++ b/src/regress/lib/libcrypto/aead/aeadtest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: aeadtest.c,v 1.11 2018/07/17 17:06:49 tb Exp $ */ | 1 | /* $OpenBSD: aeadtest.c,v 1.12 2019/01/22 00:59:21 dlg Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2011-2013 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -52,8 +52,11 @@ | |||
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | #include <string.h> | 53 | #include <string.h> |
54 | #include <stdint.h> | 54 | #include <stdint.h> |
55 | #include <unistd.h> | ||
56 | #include <ctype.h> | ||
55 | 57 | ||
56 | #include <openssl/evp.h> | 58 | #include <openssl/evp.h> |
59 | #include <openssl/err.h> | ||
57 | 60 | ||
58 | /* This program tests an AEAD against a series of test vectors from a file. The | 61 | /* This program tests an AEAD against a series of test vectors from a file. The |
59 | * test vector file consists of key-value lines where the key and value are | 62 | * test vector file consists of key-value lines where the key and value are |
@@ -135,6 +138,12 @@ aead_from_name(const EVP_AEAD **aead, const char *name) | |||
135 | #else | 138 | #else |
136 | fprintf(stderr, "No chacha20-poly1305 support.\n"); | 139 | fprintf(stderr, "No chacha20-poly1305 support.\n"); |
137 | #endif | 140 | #endif |
141 | } else if (strcmp(name, "xchacha20-poly1305") == 0) { | ||
142 | #if !defined(OPENSSL_NO_CHACHA) && !defined(OPENSSL_NO_POLY1305) | ||
143 | *aead = EVP_aead_xchacha20_poly1305(); | ||
144 | #else | ||
145 | fprintf(stderr, "No xchacha20-poly1305 support.\n"); | ||
146 | #endif | ||
138 | } else { | 147 | } else { |
139 | fprintf(stderr, "Unknown AEAD: %s\n", name); | 148 | fprintf(stderr, "Unknown AEAD: %s\n", name); |
140 | return -1; | 149 | return -1; |
diff --git a/src/regress/lib/libcrypto/aead/aeadtests.txt b/src/regress/lib/libcrypto/aead/aeadtests.txt index 18cee7e579..4ca47303b2 100644 --- a/src/regress/lib/libcrypto/aead/aeadtests.txt +++ b/src/regress/lib/libcrypto/aead/aeadtests.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: aeadtests.txt,v 1.7 2018/07/17 17:06:49 tb Exp $ | 1 | # $OpenBSD: aeadtests.txt,v 1.8 2019/01/22 00:59:21 dlg Exp $ |
2 | # | 2 | # |
3 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) | 3 | # MACsec GCM-AES Test Vectors (bn-randall-test-vectors-0511-v1.pdf) |
4 | # | 4 | # |
@@ -75,3 +75,12 @@ AD: c0c1c2c3c4c5c6c7d0d1d2d3d4d5d6d72e202500000000090000004529000029 | |||
75 | CT: 610394701f8d017f7c12924889 | 75 | CT: 610394701f8d017f7c12924889 |
76 | TAG: 6b71bfe25236efd7cdc67066906315b2 | 76 | TAG: 6b71bfe25236efd7cdc67066906315b2 |
77 | 77 | ||
78 | # Test vector from draft-arciszewski-xchacha-02 | ||
79 | AEAD: xchacha20-poly1305 | ||
80 | KEY: 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f | ||
81 | NONCE: 404142434445464748494a4b4c4d4e4f5051525354555657 | ||
82 | IN: 4c616469657320616e642047656e746c656d656e206f662074686520636c617373206f66202739393a204966204920636f756c64206f6666657220796f75206f6e6c79206f6e652074697020666f7220746865206675747572652c2073756e73637265656e20776f756c642062652069742e | ||
83 | AD: 50515253c0c1c2c3c4c5c6c7 | ||
84 | CT: bd6d179d3e83d43b9576579493c0e939572a1700252bfaccbed2902c21396cbb731c7f1b0b4aa6440bf3a82f4eda7e39ae64c6708c54c216cb96b72e1213b4522f8c9ba40db5d945b11b69b982c1bb9e3f3fac2bc369488f76b2383565d3fff921f9664c97637da9768812f615c68b13b52e | ||
85 | TAG: c0875924c1c7987947deafd8780acf49 | ||
86 | |||