summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2013-08-13 09:19:00 +0200
committerNiels Möller <nisse@lysator.liu.se>2013-08-13 09:19:00 +0200
commit7f0c28dc59e0f87f1132a8688760dc95ce51b203 (patch)
treeacf2d9274efbdbe892faa27ee42e1f308dc2b3bf
parent31a51477fd313ccafbc53afc5a105c9c1d01e8ed (diff)
downloadnettle-7f0c28dc59e0f87f1132a8688760dc95ce51b203.tar.gz
Adapted yarrow code to use new aes256 interface.aes-reorg
-rw-r--r--ChangeLog5
-rw-r--r--yarrow.h2
-rw-r--r--yarrow256.c10
3 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c3416a8..83bb2c74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-08-13 Niels Möller <nisse@lysator.liu.se>
+
+ * yarrow.h (struct yarrow256_ctx): Use aes256_ctx, not aes_ctx.
+ * yarrow256.c: Adapted to use new aes256 interface.
+
2013-08-07 Niels Möller <nisse@lysator.liu.se>
* umac.h (_UMAC_STATE): Use struct aes128_ctx, not aes_ctx.
diff --git a/yarrow.h b/yarrow.h
index fc6ccf9c..d54122df 100644
--- a/yarrow.h
+++ b/yarrow.h
@@ -72,7 +72,7 @@ struct yarrow256_ctx
int seeded;
/* The current key and counter block */
- struct aes_ctx key;
+ struct aes256_ctx key;
uint8_t counter[AES_BLOCK_SIZE];
/* The entropy sources */
diff --git a/yarrow256.c b/yarrow256.c
index 800e4fd6..270a36d9 100644
--- a/yarrow256.c
+++ b/yarrow256.c
@@ -118,7 +118,7 @@ yarrow_generate_block(struct yarrow256_ctx *ctx,
{
unsigned i;
- aes_encrypt(&ctx->key, sizeof(ctx->counter), block, ctx->counter);
+ aes256_encrypt(&ctx->key, sizeof(ctx->counter), block, ctx->counter);
/* Increment counter, treating it as a big-endian number. This is
* machine independent, and follows appendix B of the NIST
@@ -190,12 +190,12 @@ yarrow256_fast_reseed(struct yarrow256_ctx *ctx)
/* Iterate */
yarrow_iterate(digest);
- aes_set_encrypt_key(&ctx->key, sizeof(digest), digest);
+ aes256_set_encrypt_key(&ctx->key, digest);
ctx->seeded = 1;
/* Derive new counter value */
memset(ctx->counter, 0, sizeof(ctx->counter));
- aes_encrypt(&ctx->key, sizeof(ctx->counter), ctx->counter, ctx->counter);
+ aes256_encrypt(&ctx->key, sizeof(ctx->counter), ctx->counter, ctx->counter);
/* Reset estimates. */
for (i = 0; i<ctx->nsources; i++)
@@ -305,13 +305,13 @@ yarrow256_update(struct yarrow256_ctx *ctx,
static void
yarrow_gate(struct yarrow256_ctx *ctx)
{
- uint8_t key[AES_MAX_KEY_SIZE];
+ uint8_t key[AES256_KEY_SIZE];
unsigned i;
for (i = 0; i < sizeof(key); i+= AES_BLOCK_SIZE)
yarrow_generate_block(ctx, key + i);
- aes_set_encrypt_key(&ctx->key, sizeof(key), key);
+ aes256_set_encrypt_key(&ctx->key, key);
}
void