2013-04-16 Niels Möller <nisse@lysator.liu.se>
+ * umac32.c (umac32_digest): Fix nonce caching.
+ * umac64.c (umac64_digest): Likewise.
+
* testsuite/umac-test.c (test_incr): New function.
(test_main): Test nonce increment.
}
assert (ctx->count > 0);
if ( !(ctx->nonce_low & _UMAC_NONCE_CACHED))
- aes_encrypt (&ctx->pdf_key, AES_BLOCK_SIZE,
- (uint8_t *) ctx->pad_cache, ctx->nonce);
+ {
+ aes_encrypt (&ctx->pdf_key, AES_BLOCK_SIZE,
+ (uint8_t *) ctx->pad_cache, ctx->nonce);
+ ctx->nonce_low |= _UMAC_NONCE_CACHED;
+ }
pad = ctx->pad_cache[ctx->nonce_low & 3];
}
assert (ctx->count > 0);
if ( !(ctx->nonce_low & _UMAC_NONCE_CACHED))
- aes_encrypt (&ctx->pdf_key, AES_BLOCK_SIZE,
- (uint8_t *) ctx->pad_cache, ctx->nonce);
-
+ {
+ aes_encrypt (&ctx->pdf_key, AES_BLOCK_SIZE,
+ (uint8_t *) ctx->pad_cache, ctx->nonce);
+ ctx->nonce_low |= _UMAC_NONCE_CACHED;
+ }
pad = ctx->pad_cache + 2*(ctx->nonce_low & 1);
/* Increment nonce */