diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-02-09 10:26:43 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-02-17 15:56:41 -0300 |
commit | 11053fd4245c5cc0dbd885122e0ef28d11b2db7e (patch) | |
tree | b3402a8d187d4fd7edb7da7248323def042b47ff /crypt/md5.c | |
parent | 609054152fd77c9b572bb04c4af2f8da1ed0c86e (diff) | |
download | glibc-11053fd4245c5cc0dbd885122e0ef28d11b2db7e.zip glibc-11053fd4245c5cc0dbd885122e0ef28d11b2db7e.tar.gz glibc-11053fd4245c5cc0dbd885122e0ef28d11b2db7e.tar.bz2 |
crypto: Remove _STRING_ARCH_unaligned usage
Assume unaligned inputs on all cases. The code is built and used only
in compat mode.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Diffstat (limited to 'crypt/md5.c')
-rw-r--r-- | crypt/md5.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/crypt/md5.c b/crypt/md5.c index c7a232a..03240a9 100644 --- a/crypt/md5.c +++ b/crypt/md5.c @@ -229,27 +229,11 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) /* Process available complete blocks. */ if (len >= 64) { -#if !_STRING_ARCH_unaligned -/* To check alignment gcc has an appropriate operator. Other - compilers don't. */ -# if __GNUC__ >= 2 -# define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0) -# else -# define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0) -# endif - if (UNALIGNED_P (buffer)) - while (len > 64) - { - __md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); - buffer = (const char *) buffer + 64; - len -= 64; - } - else -#endif + while (len > 64) { - __md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); - len &= 63; + __md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; } } |