From 83e04f2023cb80366cf4f06a43f4df6ad2b5f08b Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 17 Sep 2007 16:11:01 +1000 Subject: - stevesk@cvs.openbsd.org 2007/09/12 19:39:19 [umac.c] use xmalloc() and xfree(); ok markus@ pvalchev@ --- umac.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'umac.c') diff --git a/umac.c b/umac.c index c2fdcf448..ca5e08b3e 100644 --- a/umac.c +++ b/umac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umac.c,v 1.1 2007/06/07 19:37:34 pvalchev Exp $ */ +/* $OpenBSD: umac.c,v 1.2 2007/09/12 19:39:19 stevesk Exp $ */ /* ----------------------------------------------------------------------- * * umac.c -- C Implementation UMAC Message Authentication @@ -66,6 +66,7 @@ #include "includes.h" #include +#include "xmalloc.h" #include "umac.h" #include #include @@ -1196,7 +1197,7 @@ int umac_delete(struct umac_ctx *ctx) if (ctx) { if (ALLOC_BOUNDARY) ctx = (struct umac_ctx *)ctx->free_ptr; - free(ctx); + xfree(ctx); } return (1); } @@ -1212,7 +1213,7 @@ struct umac_ctx *umac_new(u_char key[]) size_t bytes_to_add; aes_int_key prf_key; - octx = ctx = malloc(sizeof(*ctx) + ALLOC_BOUNDARY); + octx = ctx = xmalloc(sizeof(*ctx) + ALLOC_BOUNDARY); if (ctx) { if (ALLOC_BOUNDARY) { bytes_to_add = ALLOC_BOUNDARY - -- cgit v1.2.3 From 0f30c87c45030005ed79d0c83c176d7abc91265f Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 19 May 2008 16:07:45 +1000 Subject: - pvalchev@cvs.openbsd.org 2008/05/12 20:52:20 [umac.c] Ensure nh_result lies on a 64-bit boundary (fixes warnings observed on Itanium on Linux); from Dale Talcott (bug #1462); ok djm@ --- ChangeLog | 6 +++++- umac.c | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'umac.c') diff --git a/ChangeLog b/ChangeLog index 7d9b0f853..dceb42f2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -140,6 +140,10 @@ ignoring SIGPIPE by adding a new channel message (EOW) that signals the peer that we're not interested in any data it might send. fixes bz #85; discussion, debugging and ok djm@ + - pvalchev@cvs.openbsd.org 2008/05/12 20:52:20 + [umac.c] + Ensure nh_result lies on a 64-bit boundary (fixes warnings observed + on Itanium on Linux); from Dale Talcott (bug #1462); ok djm@ 20080403 - (djm) [openbsd-compat/bsd-poll.c] Include stdlib.h to avoid compile- @@ -4000,4 +4004,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4930 2008/05/19 06:06:47 djm Exp $ +$Id: ChangeLog,v 1.4931 2008/05/19 06:07:45 djm Exp $ diff --git a/umac.c b/umac.c index ca5e08b3e..6b5a00585 100644 --- a/umac.c +++ b/umac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umac.c,v 1.2 2007/09/12 19:39:19 stevesk Exp $ */ +/* $OpenBSD: umac.c,v 1.3 2008/05/12 20:52:20 pvalchev Exp $ */ /* ----------------------------------------------------------------------- * * umac.c -- C Implementation UMAC Message Authentication @@ -1043,7 +1043,8 @@ static int uhash_update(uhash_ctx_t ctx, u_char *input, long len) */ { UWORD bytes_hashed, bytes_remaining; - UINT8 nh_result[STREAMS*sizeof(UINT64)]; + UINT64 result_buf[STREAMS]; + UINT8 *nh_result = (UINT8 *)&result_buf; if (ctx->msg_len + len <= L1_KEY_LEN) { nh_update(&ctx->hash, (UINT8 *)input, len); @@ -1095,7 +1096,8 @@ static int uhash_update(uhash_ctx_t ctx, u_char *input, long len) static int uhash_final(uhash_ctx_t ctx, u_char *res) /* Incorporate any pending data, pad, and generate tag */ { - UINT8 nh_result[STREAMS*sizeof(UINT64)]; + UINT64 result_buf[STREAMS]; + UINT8 *nh_result = (UINT8 *)&result_buf; if (ctx->msg_len > L1_KEY_LEN) { if (ctx->msg_len % L1_KEY_LEN) { -- cgit v1.2.3 From 2c91b28a6da35f2e499414f8f6585f4f11410935 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 13 Jun 2008 12:40:55 +1000 Subject: - (dtucker) [umac.c] STORE_UINT32_REVERSED and endian_convert are never used on big endian machines, so ifdef them for little endian only to prevent unused function warnings. --- ChangeLog | 5 ++++- umac.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'umac.c') diff --git a/ChangeLog b/ChangeLog index 3f19923c8..91caab88f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -160,6 +160,9 @@ from Todd Vierling. - (dtucker) [auth-sia.c] Bug #1241: support password expiry on Tru64 SIA systems. Patch from R. Scott Bailey. + - (dtucker) [umac.c] STORE_UINT32_REVERSED and endian_convert are never used + on big endian machines, so ifdef them for little-endian only to prevent + unused function warnings on big-endians. 20080611 - (djm) [channels.c configure.ac] @@ -4322,4 +4325,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.4999 2008/06/13 01:13:13 dtucker Exp $ +$Id: ChangeLog,v 1.5000 2008/06/13 02:40:55 dtucker Exp $ diff --git a/umac.c b/umac.c index 6b5a00585..1eba663c0 100644 --- a/umac.c +++ b/umac.c @@ -136,12 +136,14 @@ static UINT32 LOAD_UINT32_REVERSED(void *ptr) return (UINT32)temp; } +# if (__LITTLE_ENDIAN__) static void STORE_UINT32_REVERSED(void *ptr, UINT32 x) { UINT32 i = (UINT32)x; *(UINT32 *)ptr = (i >> 24) | ((i & 0x00FF0000) >> 8 ) | ((i & 0x0000FF00) << 8 ) | (i << 24); } +# endif /* __LITTLE_ENDIAN */ #endif /* HAVE_SWAP32 */ /* The following definitions use the above reversal-primitives to do the right @@ -544,6 +546,7 @@ static void nh_transform(nh_ctx *hc, UINT8 *buf, UINT32 nbytes) /* ---------------------------------------------------------------------- */ +#if (__LITTLE_ENDIAN__) static void endian_convert(void *buf, UWORD bpw, UINT32 num_bytes) /* We endian convert the keys on little-endian computers to */ /* compensate for the lack of big-endian memory reads during hashing. */ @@ -566,7 +569,6 @@ static void endian_convert(void *buf, UWORD bpw, UINT32 num_bytes) } while (--iters); } } -#if (__LITTLE_ENDIAN__) #define endian_convert_if_le(x,y,z) endian_convert((x),(y),(z)) #else #define endian_convert_if_le(x,y,z) do{}while(0) /* Do nothing */ -- cgit v1.2.3 From 36d7056f4de36fa40cf9e16d7d21c64ae8763f80 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 14 Jul 2008 12:04:43 +1000 Subject: - (djm) [umac.c] Rename variable s/buffer_ptr/bufp/ to avoid clash; reported by cristian.ionescu-idbohrn AT axis.com --- ChangeLog | 4 +++- umac.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'umac.c') diff --git a/ChangeLog b/ChangeLog index b411bd77f..611e87342 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ cristian.ionescu-idbohrn AT axis.com - (djm) [openbsd-compat/rresvport.c] Add unistd.h for missing close() prototype; reported by cristian.ionescu-idbohrn AT axis.com + - (djm) [umac.c] Rename variable s/buffer_ptr/bufp/ to avoid clash; + reported by cristian.ionescu-idbohrn AT axis.com 20080712 - (djm) OpenBSD CVS Sync @@ -4656,4 +4658,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5080 2008/07/14 02:03:27 djm Exp $ +$Id: ChangeLog,v 1.5081 2008/07/14 02:04:43 djm Exp $ diff --git a/umac.c b/umac.c index 1eba663c0..92902bc09 100644 --- a/umac.c +++ b/umac.c @@ -181,14 +181,14 @@ typedef AES_KEY aes_int_key[1]; /* The user-supplied UMAC key is stretched using AES in a counter * mode to supply all random bits needed by UMAC. The kdf function takes * an AES internal key representation 'key' and writes a stream of - * 'nbytes' bytes to the memory pointed at by 'buffer_ptr'. Each distinct + * 'nbytes' bytes to the memory pointed at by 'bufp'. Each distinct * 'ndx' causes a distinct byte stream. */ -static void kdf(void *buffer_ptr, aes_int_key key, UINT8 ndx, int nbytes) +static void kdf(void *bufp, aes_int_key key, UINT8 ndx, int nbytes) { UINT8 in_buf[AES_BLOCK_LEN] = {0}; UINT8 out_buf[AES_BLOCK_LEN]; - UINT8 *dst_buf = (UINT8 *)buffer_ptr; + UINT8 *dst_buf = (UINT8 *)bufp; int i; /* Setup the initial value */ -- cgit v1.2.3