From 14d7e512f02ca19b08bb321eadc6d6490ae21f11 Mon Sep 17 00:00:00 2001 From: bcook <> Date: Mon, 18 Aug 2014 19:15:34 +0000 Subject: replace more ROTATE macros with plain-old C code. Let the compiler optimize these. Even older versions of gcc generate equal or better quality code than the inline asm. ok miod@ --- src/lib/libcrypto/des/des_locl.h | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/lib/libcrypto/des') diff --git a/src/lib/libcrypto/des/des_locl.h b/src/lib/libcrypto/des/des_locl.h index 477aeb60d9..9480d37489 100644 --- a/src/lib/libcrypto/des/des_locl.h +++ b/src/lib/libcrypto/des/des_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: des_locl.h,v 1.16 2014/07/10 22:45:56 jsing Exp $ */ +/* $OpenBSD: des_locl.h,v 1.17 2014/08/18 19:15:34 bcook Exp $ */ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -60,6 +60,7 @@ #define HEADER_DES_LOCL_H #include +#include #include #include #include @@ -131,20 +132,10 @@ } \ } -#if defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) -# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) -# define ROTATE(a,n) ({ register unsigned int ret; \ - asm ("rorl %1,%0" \ - : "=r"(ret) \ - : "I"(n),"0"(a) \ - : "cc"); \ - ret; \ - }) -# endif -#endif -#ifndef ROTATE -#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) -#endif +static inline uint32_t ROTATE(uint32_t a, uint32_t n) +{ + return (a>>n)+(a<<(32-n)); +} /* Don't worry about the LOAD_DATA() stuff, that is used by * fcrypt() to add it's little bit to the front */ -- cgit v1.2.3-55-g6feb