From c76afb36054669759dd7a876e80b9779dbc79120 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 21 Mar 2012 14:13:15 +0000 Subject: [crypto] Use standard bit-rotation functions Signed-off-by: Michael Brown --- src/crypto/md5.c | 12 +----------- src/crypto/sha1.c | 12 +----------- src/crypto/sha256.c | 12 +----------- 3 files changed, 3 insertions(+), 33 deletions(-) (limited to 'src/crypto') diff --git a/src/crypto/md5.c b/src/crypto/md5.c index e6c688217..2d0d03d13 100644 --- a/src/crypto/md5.c +++ b/src/crypto/md5.c @@ -28,20 +28,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include #include -/** - * Rotate dword left - * - * @v dword Dword - * @v rotate Amount of rotation - */ -static inline __attribute__ (( always_inline )) uint32_t -rol32 ( uint32_t dword, unsigned int rotate ) { - return ( ( dword << rotate ) | ( dword >> ( 32 - rotate ) ) ); -} - /** MD5 variables */ struct md5_variables { /* This layout matches that of struct md5_digest_data, diff --git a/src/crypto/sha1.c b/src/crypto/sha1.c index 834d9a214..fd271a638 100644 --- a/src/crypto/sha1.c +++ b/src/crypto/sha1.c @@ -28,20 +28,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include #include -/** - * Rotate dword left - * - * @v dword Dword - * @v rotate Amount of rotation - */ -static inline __attribute__ (( always_inline )) uint32_t -rol32 ( uint32_t dword, unsigned int rotate ) { - return ( ( dword << rotate ) | ( dword >> ( 32 - rotate ) ) ); -} - /** SHA-1 variables */ struct sha1_variables { /* This layout matches that of struct sha1_digest_data, diff --git a/src/crypto/sha256.c b/src/crypto/sha256.c index 71683901b..6736a5773 100644 --- a/src/crypto/sha256.c +++ b/src/crypto/sha256.c @@ -28,20 +28,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include #include #include -/** - * Rotate dword right - * - * @v dword Dword - * @v rotate Amount of rotation - */ -static inline __attribute__ (( always_inline )) uint32_t -ror32 ( uint32_t dword, unsigned int rotate ) { - return ( ( dword >> rotate ) | ( dword << ( 32 - rotate ) ) ); -} - /** SHA-256 variables */ struct sha256_variables { /* This layout matches that of struct sha256_digest_data, -- cgit v1.2.3-55-g7522