summaryrefslogtreecommitdiff
path: root/umac.c
diff options
context:
space:
mode:
Diffstat (limited to 'umac.c')
-rw-r--r--umac.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/umac.c b/umac.c
index 6eb55b26e..9f2187c9a 100644
--- a/umac.c
+++ b/umac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: umac.c,v 1.11 2014/07/22 07:13:42 guenther Exp $ */ 1/* $OpenBSD: umac.c,v 1.12 2017/05/31 08:09:45 markus Exp $ */
2/* ----------------------------------------------------------------------- 2/* -----------------------------------------------------------------------
3 * 3 *
4 * umac.c -- C Implementation UMAC Message Authentication 4 * umac.c -- C Implementation UMAC Message Authentication
@@ -203,6 +203,8 @@ static void kdf(void *bufp, aes_int_key key, UINT8 ndx, int nbytes)
203 aes_encryption(in_buf, out_buf, key); 203 aes_encryption(in_buf, out_buf, key);
204 memcpy(dst_buf,out_buf,nbytes); 204 memcpy(dst_buf,out_buf,nbytes);
205 } 205 }
206 explicit_bzero(in_buf, sizeof(in_buf));
207 explicit_bzero(out_buf, sizeof(out_buf));
206} 208}
207 209
208/* The final UHASH result is XOR'd with the output of a pseudorandom 210/* The final UHASH result is XOR'd with the output of a pseudorandom
@@ -227,6 +229,7 @@ static void pdf_init(pdf_ctx *pc, aes_int_key prf_key)
227 /* Initialize pdf and cache */ 229 /* Initialize pdf and cache */
228 memset(pc->nonce, 0, sizeof(pc->nonce)); 230 memset(pc->nonce, 0, sizeof(pc->nonce));
229 aes_encryption(pc->nonce, pc->cache, pc->prf_key); 231 aes_encryption(pc->nonce, pc->cache, pc->prf_key);
232 explicit_bzero(buf, sizeof(buf));
230} 233}
231 234
232static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8]) 235static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8])
@@ -991,6 +994,7 @@ static void uhash_init(uhash_ctx_t ahc, aes_int_key prf_key)
991 kdf(ahc->ip_trans, prf_key, 4, STREAMS * sizeof(UINT32)); 994 kdf(ahc->ip_trans, prf_key, 4, STREAMS * sizeof(UINT32));
992 endian_convert_if_le(ahc->ip_trans, sizeof(UINT32), 995 endian_convert_if_le(ahc->ip_trans, sizeof(UINT32),
993 STREAMS * sizeof(UINT32)); 996 STREAMS * sizeof(UINT32));
997 explicit_bzero(buf, sizeof(buf));
994} 998}
995 999
996/* ---------------------------------------------------------------------- */ 1000/* ---------------------------------------------------------------------- */
@@ -1200,6 +1204,7 @@ int umac_delete(struct umac_ctx *ctx)
1200 if (ctx) { 1204 if (ctx) {
1201 if (ALLOC_BOUNDARY) 1205 if (ALLOC_BOUNDARY)
1202 ctx = (struct umac_ctx *)ctx->free_ptr; 1206 ctx = (struct umac_ctx *)ctx->free_ptr;
1207 explicit_bzero(ctx, sizeof(*ctx) + ALLOC_BOUNDARY);
1203 free(ctx); 1208 free(ctx);
1204 } 1209 }
1205 return (1); 1210 return (1);
@@ -1227,6 +1232,7 @@ struct umac_ctx *umac_new(const u_char key[])
1227 aes_key_setup(key, prf_key); 1232 aes_key_setup(key, prf_key);
1228 pdf_init(&ctx->pdf, prf_key); 1233 pdf_init(&ctx->pdf, prf_key);
1229 uhash_init(&ctx->hash, prf_key); 1234 uhash_init(&ctx->hash, prf_key);
1235 explicit_bzero(prf_key, sizeof(prf_key));
1230 } 1236 }
1231 1237
1232 return (ctx); 1238 return (ctx);