diff options
| author | Michael Brown | 2012-03-21 15:13:15 +0100 |
|---|---|---|
| committer | Michael Brown | 2012-03-21 17:27:12 +0100 |
| commit | c76afb36054669759dd7a876e80b9779dbc79120 (patch) | |
| tree | d906b9faed1adf020c8aa81d097cfca97832018c /src/crypto | |
| parent | [tls] Support sending a client certificate (diff) | |
| download | ipxe-c76afb36054669759dd7a876e80b9779dbc79120.tar.gz ipxe-c76afb36054669759dd7a876e80b9779dbc79120.tar.xz ipxe-c76afb36054669759dd7a876e80b9779dbc79120.zip | |
[crypto] Use standard bit-rotation functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
| -rw-r--r-- | src/crypto/md5.c | 12 | ||||
| -rw-r--r-- | src/crypto/sha1.c | 12 | ||||
| -rw-r--r-- | src/crypto/sha256.c | 12 |
3 files changed, 3 insertions, 33 deletions
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 <string.h> #include <byteswap.h> #include <assert.h> +#include <ipxe/rotate.h> #include <ipxe/crypto.h> #include <ipxe/md5.h> -/** - * 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 <string.h> #include <byteswap.h> #include <assert.h> +#include <ipxe/rotate.h> #include <ipxe/crypto.h> #include <ipxe/sha1.h> -/** - * 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 <string.h> #include <byteswap.h> #include <assert.h> +#include <ipxe/rotate.h> #include <ipxe/crypto.h> #include <ipxe/sha256.h> -/** - * 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, |
