diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libssl/src/crypto/des/des_locl.h | 21 | ||||
-rw-r--r-- | lib/libssl/src/crypto/rc5/rc5_locl.h | 38 |
2 files changed, 19 insertions, 40 deletions
diff --git a/lib/libssl/src/crypto/des/des_locl.h b/lib/libssl/src/crypto/des/des_locl.h index 477aeb60d92..9480d374894 100644 --- a/lib/libssl/src/crypto/des/des_locl.h +++ b/lib/libssl/src/crypto/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 <math.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -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 */ diff --git a/lib/libssl/src/crypto/rc5/rc5_locl.h b/lib/libssl/src/crypto/rc5/rc5_locl.h index 07671decaab..d4e0d30ecad 100644 --- a/lib/libssl/src/crypto/rc5/rc5_locl.h +++ b/lib/libssl/src/crypto/rc5/rc5_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rc5_locl.h,v 1.5 2014/07/10 22:45:57 jsing Exp $ */ +/* $OpenBSD: rc5_locl.h,v 1.6 2014/08/18 19:15:34 bcook Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include <stdint.h> #include <stdlib.h> #include <openssl/opensslconf.h> @@ -148,30 +149,17 @@ *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ *((c)++)=(unsigned char)(((l) )&0xff)) -#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_l32(a,n) ({ register unsigned int ret; \ - asm ("roll %%cl,%0" \ - : "=r"(ret) \ - : "c"(n),"0"((unsigned int)(a)) \ - : "cc"); \ - ret; \ - }) -# define ROTATE_r32(a,n) ({ register unsigned int ret; \ - asm ("rorl %%cl,%0" \ - : "=r"(ret) \ - : "c"(n),"0"((unsigned int)(a)) \ - : "cc"); \ - ret; \ - }) -# endif -#endif -#ifndef ROTATE_l32 -#define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) -#endif -#ifndef ROTATE_r32 -#define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) -#endif +static inline uint32_t ROTATE_l32(uint32_t a, uint32_t n) +{ + uint32_t amt = n & 0x1f; + return (a << amt) | (a >> (32 - amt)); +} + +static inline uint32_t ROTATE_r32(uint32_t a, uint32_t n) +{ + uint32_t amt = n & 0x1f; + return (a << (32 - amt)) | (a >> amt); +} #define RC5_32_MASK 0xffffffffL |