From 017231a544756a9d375ec56c4df8664b3ffcb10b Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Mon, 7 Dec 2015 14:26:45 -0500 Subject: [PATCH] Remove asm __asm__ define. It's only used in one file. No sense in polluting the namespace here. Change-Id: Iaf3870a4be2d2cad950f4d080e25fe7f0d3929c7 Reviewed-on: https://boringssl-review.googlesource.com/6660 Reviewed-by: Adam Langley --- crypto/digest/md32_common.h | 2 -- crypto/sha/sha512.c | 62 ++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/crypto/digest/md32_common.h b/crypto/digest/md32_common.h index 4f1faf16..5baad405 100644 --- a/crypto/digest/md32_common.h +++ b/crypto/digest/md32_common.h @@ -58,8 +58,6 @@ extern "C" { #endif -#define asm __asm__ - /* This is a generic 32-bit "collector" for message digest algorithms. It * collects input character stream into chunks of 32-bit values and invokes the * block function that performs the actual hash calculations. To make use of diff --git a/crypto/sha/sha512.c b/crypto/sha/sha512.c index 15abc7c2..6ad8d40c 100644 --- a/crypto/sha/sha512.c +++ b/crypto/sha/sha512.c @@ -358,47 +358,47 @@ static const uint64_t K512[80] = { #if defined(__GNUC__) && __GNUC__ >= 2 && !defined(OPENSSL_NO_ASM) #if defined(__x86_64) || defined(__x86_64__) -#define ROTR(a, n) \ - ({ \ - uint64_t ret; \ - asm("rorq %1,%0" : "=r"(ret) : "J"(n), "0"(a) : "cc"); \ - ret; \ +#define ROTR(a, n) \ + ({ \ + uint64_t ret; \ + __asm__("rorq %1, %0" : "=r"(ret) : "J"(n), "0"(a) : "cc"); \ + ret; \ }) -#define PULL64(x) \ - ({ \ - uint64_t ret = *((const uint64_t *)(&(x))); \ - asm("bswapq %0" : "=r"(ret) : "0"(ret)); \ - ret; \ +#define PULL64(x) \ + ({ \ + uint64_t ret = *((const uint64_t *)(&(x))); \ + __asm__("bswapq %0" : "=r"(ret) : "0"(ret)); \ + ret; \ }) #elif(defined(__i386) || defined(__i386__)) -#define PULL64(x) \ - ({ \ - const unsigned int *p = (const unsigned int *)(&(x)); \ - unsigned int hi = p[0], lo = p[1]; \ - asm("bswapl %0; bswapl %1;" : "=r"(lo), "=r"(hi) : "0"(lo), "1"(hi)); \ - ((uint64_t)hi) << 32 | lo; \ +#define PULL64(x) \ + ({ \ + const unsigned int *p = (const unsigned int *)(&(x)); \ + unsigned int hi = p[0], lo = p[1]; \ + __asm__("bswapl %0; bswapl %1;" : "=r"(lo), "=r"(hi) : "0"(lo), "1"(hi)); \ + ((uint64_t)hi) << 32 | lo; \ }) #elif(defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64) -#define ROTR(a, n) \ - ({ \ - uint64_t ret; \ - asm("rotrdi %0,%1,%2" : "=r"(ret) : "r"(a), "K"(n)); \ - ret; \ +#define ROTR(a, n) \ + ({ \ + uint64_t ret; \ + __asm__("rotrdi %0, %1, %2" : "=r"(ret) : "r"(a), "K"(n)); \ + ret; \ }) #elif defined(__aarch64__) -#define ROTR(a, n) \ - ({ \ - uint64_t ret; \ - asm("ror %0,%1,%2" : "=r"(ret) : "r"(a), "I"(n)); \ - ret; \ +#define ROTR(a, n) \ + ({ \ + uint64_t ret; \ + __asm__("ror %0, %1, %2" : "=r"(ret) : "r"(a), "I"(n)); \ + ret; \ }) #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define PULL64(x) \ - ({ \ - uint64_t ret; \ - asm("rev %0,%1" : "=r"(ret) : "r"(*((const uint64_t *)(&(x))))); \ - ret; \ +#define PULL64(x) \ + ({ \ + uint64_t ret; \ + __asm__("rev %0, %1" : "=r"(ret) : "r"(*((const uint64_t *)(&(x))))); \ + ret; \ }) #endif #endif