From: Niels Möller Date: Tue, 20 Feb 2018 21:48:15 +0000 (+0100) Subject: Update CBC and CFB tests to use aes256_ctx, not the deprecated aes_ctx. X-Git-Tag: nettle_3.5rc1~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a14e981d88f77787c972c9a2b02e2a0162978f4;p=thirdparty%2Fnettle.git Update CBC and CFB tests to use aes256_ctx, not the deprecated aes_ctx. --- diff --git a/ChangeLog b/ChangeLog index 5623d5d4..35dff214 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,14 @@ 2018-02-20 Niels Möller - * examples/rsa-session.h (struct rsa_session): Use struct + * testsuite/cbc-test.c (test_cbc_bulk): Use struct aes256_ctx, instead of the deprecated struct aes_ctx. - + * testsuite/cfb-test.c (test_cfb_bulk): Likewise. + * examples/rsa-session.h (struct rsa_session): Likewise. * examples/rsa-encrypt.c (rsa_session_set_encrypt_key) (process_file): Use aes256_* functions. * examples/rsa-decrypt.c (rsa_session_set_decrypt_key) (process_file): Likewise. - 2018-02-19 Niels Möller * nettle-internal.h: Include sha3.h, needed for the definition of diff --git a/testsuite/cbc-test.c b/testsuite/cbc-test.c index 6b82e6dc..9394f1cb 100644 --- a/testsuite/cbc-test.c +++ b/testsuite/cbc-test.c @@ -22,7 +22,7 @@ test_cbc_bulk(void) const uint8_t *start_iv = H("11adbff119749103 207619cfa0e8d13a"); const uint8_t *end_iv = H("c7a42a569b421224 d0c23e52f46f97f5"); - struct CBC_CTX(struct aes_ctx, AES_BLOCK_SIZE) aes; + struct CBC_CTX(struct aes256_ctx, AES_BLOCK_SIZE) aes; knuth_lfib_init(&random, CBC_BULK_DATA); knuth_lfib_random(&random, CBC_BULK_DATA, clear); @@ -30,10 +30,10 @@ test_cbc_bulk(void) /* Byte that should not be overwritten */ cipher[CBC_BULK_DATA] = 17; - aes_set_encrypt_key(&aes.ctx, 32, key); + aes256_set_encrypt_key(&aes.ctx, key); CBC_SET_IV(&aes, start_iv); - CBC_ENCRYPT(&aes, aes_encrypt, CBC_BULK_DATA, cipher, clear); + CBC_ENCRYPT(&aes, aes256_encrypt, CBC_BULK_DATA, cipher, clear); ASSERT(cipher[CBC_BULK_DATA] == 17); @@ -47,9 +47,9 @@ test_cbc_bulk(void) ASSERT(MEMEQ(AES_BLOCK_SIZE, aes.iv, end_iv)); /* Decrypt, in place */ - aes_set_decrypt_key(&aes.ctx, 32, key); + aes256_set_decrypt_key(&aes.ctx, key); CBC_SET_IV(&aes, start_iv); - CBC_DECRYPT(&aes, aes_decrypt, CBC_BULK_DATA, cipher, cipher); + CBC_DECRYPT(&aes, aes256_decrypt, CBC_BULK_DATA, cipher, cipher); ASSERT(cipher[CBC_BULK_DATA] == 17); diff --git a/testsuite/cfb-test.c b/testsuite/cfb-test.c index b8323383..dbb24e8a 100644 --- a/testsuite/cfb-test.c +++ b/testsuite/cfb-test.c @@ -23,7 +23,7 @@ test_cfb_bulk(void) const uint8_t *start_iv = H("11adbff119749103 207619cfa0e8d13a"); const uint8_t *end_iv = H("1fd0a9189b8480b7 b06a2b36ef5943ba"); - struct CFB_CTX(struct aes_ctx, AES_BLOCK_SIZE) aes; + struct CFB_CTX(struct aes256_ctx, AES_BLOCK_SIZE) aes; knuth_lfib_init(&random, CFB_BULK_DATA); knuth_lfib_random(&random, CFB_BULK_DATA, clear); @@ -31,10 +31,10 @@ test_cfb_bulk(void) /* Byte that should not be overwritten */ cipher[CFB_BULK_DATA] = 17; - aes_set_encrypt_key(&aes.ctx, 32, key); + aes256_set_encrypt_key(&aes.ctx, key); CFB_SET_IV(&aes, start_iv); - CFB_ENCRYPT(&aes, aes_encrypt, CFB_BULK_DATA, cipher, clear); + CFB_ENCRYPT(&aes, aes256_encrypt, CFB_BULK_DATA, cipher, clear); ASSERT(cipher[CFB_BULK_DATA] == 17); @@ -48,9 +48,9 @@ test_cfb_bulk(void) ASSERT(MEMEQ(AES_BLOCK_SIZE, aes.iv, end_iv)); /* Decrypt, in place */ - aes_set_encrypt_key(&aes.ctx, 32, key); + aes256_set_encrypt_key(&aes.ctx, key); CFB_SET_IV(&aes, start_iv); - CFB_DECRYPT(&aes, aes_encrypt, CFB_BULK_DATA, cipher, cipher); + CFB_DECRYPT(&aes, aes256_encrypt, CFB_BULK_DATA, cipher, cipher); ASSERT(cipher[CFB_BULK_DATA] == 17); @@ -80,7 +80,7 @@ test_cfb8_bulk(void) const uint8_t *start_iv = H("11adbff119749103 207619cfa0e8d13a"); const uint8_t *end_iv = H("f84bfd48206f5803 6ef86f4e69e9aec0"); - struct CFB8_CTX(struct aes_ctx, AES_BLOCK_SIZE) aes; + struct CFB8_CTX(struct aes256_ctx, AES_BLOCK_SIZE) aes; knuth_lfib_init(&random, CFB8_BULK_DATA); knuth_lfib_random(&random, CFB8_BULK_DATA, clear); @@ -88,10 +88,10 @@ test_cfb8_bulk(void) /* Byte that should not be overwritten */ cipher[CFB8_BULK_DATA] = 17; - aes_set_encrypt_key(&aes.ctx, 32, key); + aes256_set_encrypt_key(&aes.ctx, key); CFB8_SET_IV(&aes, start_iv); - CFB8_ENCRYPT(&aes, aes_encrypt, CFB8_BULK_DATA, cipher, clear); + CFB8_ENCRYPT(&aes, aes256_encrypt, CFB8_BULK_DATA, cipher, clear); ASSERT(cipher[CFB8_BULK_DATA] == 17); @@ -105,9 +105,9 @@ test_cfb8_bulk(void) ASSERT(MEMEQ(AES_BLOCK_SIZE, aes.iv, end_iv)); /* Decrypt, in place */ - aes_set_encrypt_key(&aes.ctx, 32, key); + aes256_set_encrypt_key(&aes.ctx, key); CFB8_SET_IV(&aes, start_iv); - CFB8_DECRYPT(&aes, aes_encrypt, CFB8_BULK_DATA, cipher, cipher); + CFB8_DECRYPT(&aes, aes256_encrypt, CFB8_BULK_DATA, cipher, cipher); ASSERT(cipher[CFB8_BULK_DATA] == 17);