diff options
author | David Benjamin <davidben@chromium.org> | 2015-12-07 06:09:33 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-12-16 22:57:31 +0300 |
commit | 5a19d7dfa8abe611da91d3b90f3313611bc9b3c4 (patch) | |
tree | 82bc1b7a7411c3d4013cfce11669569df6ae25d6 /crypto/digest | |
parent | 78fefbf3bbb3ac6ddf537fc927b15b4c41db7f6c (diff) |
Use the straight-forward ROTATE macro.
I would hope any sensible compiler would recognize the rotation. (If
not, we should at least pull this into crypto/internal.h.) Confirmed
that clang at least produces the exact same instructions for
sha256_block_data_order for release + NO_ASM. This is also mostly moot
as SHA-1 and SHA-256 both have assembly versions on x86 that sidestep
most of this.
For the digests, take it out of md32_common.h since it doesn't use the
macro. md32_common.h isn't sure whether it's a multiply-included header
or not. It should be, but it has an #include guard (doesn't quite do
what you'd want) and will get HOST_c2l, etc., confused if one tries to
include it twice.
Change-Id: I1632801de6473ffd2c6557f3412521ec5d6b305c
Reviewed-on: https://boringssl-review.googlesource.com/6650
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/digest')
-rw-r--r-- | crypto/digest/md32_common.h | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/crypto/digest/md32_common.h b/crypto/digest/md32_common.h index b398a5ee..716e0290 100644 --- a/crypto/digest/md32_common.h +++ b/crypto/digest/md32_common.h @@ -140,27 +140,6 @@ extern "C" { #error "HASH_MAKE_STRING must be defined!" #endif -#undef ROTATE -#if defined(_MSC_VER) -#define ROTATE(a, n) _lrotl(a, n) -#elif defined(__ICC) -#define ROTATE(a, n) _rotl(a, n) -#elif defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) -#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64) -/* Note this macro requires |n| be a constant. */ -#define ROTATE(a, n) \ - ({ \ - register uint32_t ret; \ - asm("roll %1, %0" : "=r"(ret) : "I"(n), "0"((uint32_t)(a)) : "cc"); \ - ret; \ - }) -#endif /* OPENSSL_X86 || OPENSSL_X86_64 */ -#endif /* COMPILER */ - -#ifndef ROTATE -#define ROTATE(a, n) (((a) << (n)) | (((a)&0xffffffff) >> (32 - (n)))) -#endif - #if defined(DATA_ORDER_IS_BIG_ENDIAN) #if !defined(PEDANTIC) && defined(__GNUC__) && __GNUC__ >= 2 && \ |