Commit 9a14e981 authored by Niels Möller's avatar Niels Möller

Update CBC and CFB tests to use aes256_ctx, not the deprecated aes_ctx.

parent 23ef6e35
2018-02-20 Niels Möller <nisse@lysator.liu.se>
* 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 <nisse@lysator.liu.se>
* nettle-internal.h: Include sha3.h, needed for the definition of
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment