Mercurial > hg > freeDiameter
diff extensions/app_radgw/md5.c @ 1414:f6f12521c2aa
Fix strict-aliasing warnings with gcc 4.8
Rewrite IN6_ADDR_V4MAP() to not rely upon aliasing rules.
Add test for IN6_ADDR_V4MAP() and IN6_ADDR_V4UNMAP().
Rewrite MD5Final() to not rely upon aliasing rules. (Not tested)
author | Luke Mewburn <luke@mewburn.net> |
---|---|
date | Tue, 18 Feb 2020 19:01:49 +1100 |
parents | 0fa8207cc91a |
children |
line wrap: on
line diff
--- a/extensions/app_radgw/md5.c Tue Feb 18 18:38:00 2020 +1100 +++ b/extensions/app_radgw/md5.c Tue Feb 18 19:01:49 2020 +1100 @@ -286,8 +286,7 @@ byteReverse(ctx->in, 14); /* Append length in bits and transform */ - ((u32 *) ctx->in)[14] = ctx->bits[0]; - ((u32 *) ctx->in)[15] = ctx->bits[1]; + os_memcpy(&ctx->in[56], &ctx->bits[0], 8); MD5Transform(ctx->buf, (u32 *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4);