summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--umac.c16
2 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index fd66fed6d..0bc5c6867 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
6 add ssh-agent(1) support to sshd(8); allows encrypted hostkeys, 6 add ssh-agent(1) support to sshd(8); allows encrypted hostkeys,
7 or hostkeys on smartcards; most of the work by Zev Weiss; bz #1974 7 or hostkeys on smartcards; most of the work by Zev Weiss; bz #1974
8 ok djm@ 8 ok djm@
9 - djm@cvs.openbsd.org 2013/07/20 01:43:46
10 [umac.c]
11 use a union to ensure correct alignment; ok deraadt
9 12
1020130718 1320130718
11 - (djm) OpenBSD CVS Sync 14 - (djm) OpenBSD CVS Sync
diff --git a/umac.c b/umac.c
index fb66b8097..60514a24f 100644
--- a/umac.c
+++ b/umac.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: umac.c,v 1.5 2013/05/17 00:13:14 djm Exp $ */ 1/* $OpenBSD: umac.c,v 1.6 2013/07/20 01:43:46 djm Exp $ */
2/* ----------------------------------------------------------------------- 2/* -----------------------------------------------------------------------
3 * 3 *
4 * umac.c -- C Implementation UMAC Message Authentication 4 * umac.c -- C Implementation UMAC Message Authentication
@@ -254,19 +254,21 @@ static void pdf_gen_xor(pdf_ctx *pc, UINT8 nonce[8], UINT8 buf[8])
254#elif (UMAC_OUTPUT_LEN > 8) 254#elif (UMAC_OUTPUT_LEN > 8)
255#define LOW_BIT_MASK 0 255#define LOW_BIT_MASK 0
256#endif 256#endif
257 257 union {
258 UINT8 tmp_nonce_lo[4]; 258 UINT8 tmp_nonce_lo[4];
259 UINT32 align;
260 } t;
259#if LOW_BIT_MASK != 0 261#if LOW_BIT_MASK != 0
260 int ndx = nonce[7] & LOW_BIT_MASK; 262 int ndx = nonce[7] & LOW_BIT_MASK;
261#endif 263#endif
262 *(UINT32 *)tmp_nonce_lo = ((UINT32 *)nonce)[1]; 264 *(UINT32 *)t.tmp_nonce_lo = ((UINT32 *)nonce)[1];
263 tmp_nonce_lo[3] &= ~LOW_BIT_MASK; /* zero last bit */ 265 t.tmp_nonce_lo[3] &= ~LOW_BIT_MASK; /* zero last bit */
264 266
265 if ( (((UINT32 *)tmp_nonce_lo)[0] != ((UINT32 *)pc->nonce)[1]) || 267 if ( (((UINT32 *)t.tmp_nonce_lo)[0] != ((UINT32 *)pc->nonce)[1]) ||
266 (((UINT32 *)nonce)[0] != ((UINT32 *)pc->nonce)[0]) ) 268 (((UINT32 *)nonce)[0] != ((UINT32 *)pc->nonce)[0]) )
267 { 269 {
268 ((UINT32 *)pc->nonce)[0] = ((UINT32 *)nonce)[0]; 270 ((UINT32 *)pc->nonce)[0] = ((UINT32 *)nonce)[0];
269 ((UINT32 *)pc->nonce)[1] = ((UINT32 *)tmp_nonce_lo)[0]; 271 ((UINT32 *)pc->nonce)[1] = ((UINT32 *)t.tmp_nonce_lo)[0];
270 aes_encryption(pc->nonce, pc->cache, pc->prf_key); 272 aes_encryption(pc->nonce, pc->cache, pc->prf_key);
271 } 273 }
272 274