aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-01-05 13:48:17 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-05 13:50:53 (GMT)
commit942b75468db873d1194d6ceecb2cf5015eadb29f (patch)
tree4125768c3510091b63e25140930425d61350cfa3 /tests
parentf6ebbcf62a7801a029e0b94c8e436b36720d27bd (diff)
downloadhostap-942b75468db873d1194d6ceecb2cf5015eadb29f.zip
hostap-942b75468db873d1194d6ceecb2cf5015eadb29f.tar.gz
hostap-942b75468db873d1194d6ceecb2cf5015eadb29f.tar.bz2
tests: Add module tests for AES-SIV
This moves the AES-SIV test case from tests/test-aes.c to be part of wpa_supplicant module testing framework with a new src/crypto/crypto_module_tests.c component. In addition, the second test vector from RFC 5297 is also included for additional coverage. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-aes.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/tests/test-aes.c b/tests/test-aes.c
index e8c0908..20d4b5d 100644
--- a/tests/test-aes.c
+++ b/tests/test-aes.c
@@ -11,7 +11,6 @@
#include "common.h"
#include "crypto/crypto.h"
#include "crypto/aes_wrap.h"
-#include "crypto/aes_siv.h"
#define BLOCK_SIZE 16
@@ -439,61 +438,6 @@ static int test_gcm(void)
}
-static int test_siv(void)
-{
- u8 key[] = {
- 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
- 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
- };
- u8 ad[] = {
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27
- };
- u8 plaintext[] = {
- 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
- 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee
- };
- u8 iv_c[] = {
- 0x85, 0x63, 0x2d, 0x07, 0xc6, 0xe8, 0xf3, 0x7f,
- 0x95, 0x0a, 0xcd, 0x32, 0x0a, 0x2e, 0xcc, 0x93,
- 0x40, 0xc0, 0x2b, 0x96, 0x90, 0xc4, 0xdc, 0x04,
- 0xda, 0xef, 0x7f, 0x6a, 0xfe, 0x5c
- };
- u8 out[2 * BLOCK_SIZE + sizeof(plaintext)];
- const u8 *addr[1];
- size_t len[1];
-
- addr[0] = ad;
- len[0] = sizeof(ad);
-
- if (aes_siv_encrypt(key, plaintext, sizeof(plaintext),
- 1, addr, len, out)) {
- printf("AES-SIV mode encryption failed\n");
- return 1;
- }
- if (memcmp(out, iv_c, sizeof(iv_c)) != 0) {
- printf("AES-SIV mode encryption returned invalid cipher "
- "text\n");
- return 1;
- }
-
- if (aes_siv_decrypt(key, iv_c, sizeof(iv_c), 1, addr, len, out)) {
- printf("AES-SIV mode decryption failed\n");
- return 1;
- }
- if (memcmp(out, plaintext, sizeof(plaintext)) != 0) {
- printf("AES-SIV mode decryption returned invalid plain text\n");
- return 1;
- }
- printf("AES-SIV test passed\n");
-
- return 0;
-}
-
-
/* OMAC1 AES-128 test vectors from
* http://csrc.nist.gov/CryptoToolkit/modes/proposedmodes/omac/omac-ad.pdf
* which are same as the examples from NIST SP800-38B
@@ -1132,8 +1076,6 @@ int main(int argc, char *argv[])
ret += test_gcm();
- ret += test_siv();
-
if (ret)
printf("FAILED!\n");