aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-aes.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-01-05 14:28:46 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-05 14:28:46 (GMT)
commit477f83131f2c0ccc2d946868154239fad2a2d741 (patch)
tree58771c1d629eae67f15a26b2b9bdfe5681cf904b /tests/test-aes.c
parente438fb0d3a99427ecbdbbf9f9173fabdc0b2411a (diff)
downloadhostap-477f83131f2c0ccc2d946868154239fad2a2d741.zip
hostap-477f83131f2c0ccc2d946868154239fad2a2d741.tar.gz
hostap-477f83131f2c0ccc2d946868154239fad2a2d741.tar.bz2
tests: Move AES-CBC test cases into hwsim framework
Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests/test-aes.c')
-rw-r--r--tests/test-aes.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/tests/test-aes.c b/tests/test-aes.c
index bc4e8a2..ab26179 100644
--- a/tests/test-aes.c
+++ b/tests/test-aes.c
@@ -51,71 +51,6 @@ static void test_aes_perf(void)
}
-static int test_cbc(void)
-{
- struct cbc_test_vector {
- u8 key[16];
- u8 iv[16];
- u8 plain[32];
- u8 cipher[32];
- size_t len;
- } vectors[] = {
- {
- { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
- 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
- { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
- 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
- "Single block msg",
- { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
- 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a },
- 16
- },
- {
- { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
- 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
- { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
- 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
- { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
- 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
- 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
- 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 },
- 32
- }
- };
- int ret = 0;
- u8 *buf;
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(vectors); i++) {
- struct cbc_test_vector *tv = &vectors[i];
- buf = malloc(tv->len);
- if (buf == NULL) {
- ret++;
- break;
- }
- memcpy(buf, tv->plain, tv->len);
- if (aes_128_cbc_encrypt(tv->key, tv->iv, buf, tv->len) ||
- memcmp(buf, tv->cipher, tv->len) != 0) {
- printf("AES-CBC encrypt %d failed\n", i);
- ret++;
- }
- memcpy(buf, tv->cipher, tv->len);
- if (aes_128_cbc_decrypt(tv->key, tv->iv, buf, tv->len) ||
- memcmp(buf, tv->plain, tv->len) != 0) {
- printf("AES-CBC decrypt %d failed\n", i);
- ret++;
- }
- free(buf);
- }
-
- return ret;
-}
-
-
/*
* GCM test vectors from
* http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf
@@ -934,8 +869,6 @@ int main(int argc, char *argv[])
test_aes_perf();
- ret += test_cbc();
-
ret += test_gcm();
if (ret)