From 4515315f61fbf79413e150fbd1d5f5a2435f2bc5 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Tue, 23 Dec 2014 13:01:33 +0200 Subject: hash: fix compiler warning on ARM * cipher/md.c (md_open, md_copy): Cast 'char *' to ctx through 'void *'. * cipher/md4.c (md4_final): Use buf_put_* helper instead of converting 'char *' to 'u32 *'. * cipher/md5.c (md5_final): Ditto. * cipher/rmd160.c (_gcry_rmd160_mixblock, rmd160_final): Ditto. * cipher/sha1.c (sha1_final): Ditto. * cipher/sha256.c (sha256_final): Ditto. * cipher/sha512.c (sha512_final): Ditto. * cipher/tiger.c (tiger_final): Ditto. -- Patch fixes 'cast increases required alignment' warnings seen on GCC: md.c: In function 'md_open': md.c:318:23: warning: cast increases required alignment of target type [-Wcast-align] hd->ctx = ctx = (struct gcry_md_context *) ((char *) hd + n); ^ md.c: In function 'md_copy': md.c:491:22: warning: cast increases required alignment of target type [-Wcast-align] bhd->ctx = b = (struct gcry_md_context *) ((char *) bhd + n); ^ md4.c: In function 'md4_final': md4.c:258:20: warning: cast increases required alignment of target type [-Wcast-align] #define X(a) do { *(u32*)p = le_bswap32((*hd).a) ; p += 4; } while(0) ^ md4.c:259:3: note: in expansion of macro 'X' X(A); ^ md4.c:258:20: warning: cast increases required alignment of target type [-Wcast-align] #define X(a) do { *(u32*)p = le_bswap32((*hd).a) ; p += 4; } while(0) ^ md4.c:260:3: note: in expansion of macro 'X' X(B); ^ [removed the rest] Signed-off-by: Jussi Kivilinna --- cipher/tiger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cipher/tiger.c') diff --git a/cipher/tiger.c b/cipher/tiger.c index 91db4e66..8a08953e 100644 --- a/cipher/tiger.c +++ b/cipher/tiger.c @@ -805,8 +805,8 @@ tiger_final( void *context ) _gcry_burn_stack (burn); p = hd->bctx.buf; -#define X(a) do { *(u64*)p = be_bswap64(hd->a); p += 8; } while(0) -#define Y(a) do { *(u64*)p = le_bswap64(hd->a); p += 8; } while(0) +#define X(a) do { buf_put_be64(p, hd->a); p += 8; } while(0) +#define Y(a) do { buf_put_le64(p, hd->a); p += 8; } while(0) if (hd->variant == 0) { X(a); -- cgit v1.2.1