summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/md32_common.h
diff options
context:
space:
mode:
authorbcook <>2014-08-18 19:11:48 +0000
committerbcook <>2014-08-18 19:11:48 +0000
commit6ee9e8bd1dfefb2512d09447fa41d83947caba6c (patch)
tree1a0b420df1945872d5e272d78732e7436157f08d /src/lib/libcrypto/md32_common.h
parenta904076a7b693c8512f298bacec36b1e7e3ff538 (diff)
downloadopenbsd-6ee9e8bd1dfefb2512d09447fa41d83947caba6c.tar.gz
openbsd-6ee9e8bd1dfefb2512d09447fa41d83947caba6c.tar.bz2
openbsd-6ee9e8bd1dfefb2512d09447fa41d83947caba6c.zip
remove return value from HOST_c2l/l2c macros
These macros and asm inlines simulate a function returning a value, but nothing ever uses this return value. Remove the pseudo-returns and (void) casts discarding the unused values. This, maybe unsurprisingly, speeds things up a bit. It also removes the GCC 4.9 warnings about unused values. ok miod@ deraadt@
Diffstat (limited to 'src/lib/libcrypto/md32_common.h')
-rw-r--r--src/lib/libcrypto/md32_common.h64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/lib/libcrypto/md32_common.h b/src/lib/libcrypto/md32_common.h
index 59de5ee885..24d003e774 100644
--- a/src/lib/libcrypto/md32_common.h
+++ b/src/lib/libcrypto/md32_common.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: md32_common.h,v 1.17 2014/08/12 15:02:52 bcook Exp $ */ 1/* $OpenBSD: md32_common.h,v 1.18 2014/08/18 19:11:48 bcook Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -167,27 +167,27 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n)
167 (c)+=4; (l)=r; }) 167 (c)+=4; (l)=r; })
168# define HOST_l2c(l,c) ({ unsigned int r=(l); \ 168# define HOST_l2c(l,c) ({ unsigned int r=(l); \
169 asm ("bswapl %0":"=r"(r):"0"(r)); \ 169 asm ("bswapl %0":"=r"(r):"0"(r)); \
170 *((unsigned int *)(c))=r; (c)+=4; r; }) 170 *((unsigned int *)(c))=r; (c)+=4; })
171# endif 171# endif
172#endif 172#endif
173#if defined(__s390__) || defined(__s390x__) 173#if defined(__s390__) || defined(__s390x__)
174# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l)) 174# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4)
175# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l)) 175# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4)
176#endif 176#endif
177 177
178#ifndef HOST_c2l 178#ifndef HOST_c2l
179#define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ 179#define HOST_c2l(c,l) do {l =(((unsigned long)(*((c)++)))<<24); \
180 l|=(((unsigned long)(*((c)++)))<<16), \ 180 l|=(((unsigned long)(*((c)++)))<<16); \
181 l|=(((unsigned long)(*((c)++)))<< 8), \ 181 l|=(((unsigned long)(*((c)++)))<< 8); \
182 l|=(((unsigned long)(*((c)++))) ), \ 182 l|=(((unsigned long)(*((c)++))) ); \
183 l) 183 } while (0)
184#endif 184#endif
185#ifndef HOST_l2c 185#ifndef HOST_l2c
186#define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ 186#define HOST_l2c(l,c) do {*((c)++)=(unsigned char)(((l)>>24)&0xff); \
187 *((c)++)=(unsigned char)(((l)>>16)&0xff), \ 187 *((c)++)=(unsigned char)(((l)>>16)&0xff); \
188 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ 188 *((c)++)=(unsigned char)(((l)>> 8)&0xff); \
189 *((c)++)=(unsigned char)(((l) )&0xff), \ 189 *((c)++)=(unsigned char)(((l) )&0xff); \
190 l) 190 } while (0)
191#endif 191#endif
192 192
193#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) 193#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
@@ -196,30 +196,30 @@ static inline uint32_t ROTATE(uint32_t a, uint32_t n)
196# if defined(__s390x__) 196# if defined(__s390x__)
197# define HOST_c2l(c,l) ({ asm ("lrv %0,%1" \ 197# define HOST_c2l(c,l) ({ asm ("lrv %0,%1" \
198 :"=d"(l) :"m"(*(const unsigned int *)(c)));\ 198 :"=d"(l) :"m"(*(const unsigned int *)(c)));\
199 (c)+=4; (l); }) 199 (c)+=4; })
200# define HOST_l2c(l,c) ({ asm ("strv %1,%0" \ 200# define HOST_l2c(l,c) ({ asm ("strv %1,%0" \
201 :"=m"(*(unsigned int *)(c)) :"d"(l));\ 201 :"=m"(*(unsigned int *)(c)) :"d"(l));\
202 (c)+=4; (l); }) 202 (c)+=4; })
203# endif 203# endif
204#endif 204#endif
205#if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) 205#if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
206# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) 206# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4)
207# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) 207# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4)
208#endif 208#endif
209 209
210#ifndef HOST_c2l 210#ifndef HOST_c2l
211#define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ 211#define HOST_c2l(c,l) do {l =(((unsigned long)(*((c)++))) ); \
212 l|=(((unsigned long)(*((c)++)))<< 8), \ 212 l|=(((unsigned long)(*((c)++)))<< 8); \
213 l|=(((unsigned long)(*((c)++)))<<16), \ 213 l|=(((unsigned long)(*((c)++)))<<16); \
214 l|=(((unsigned long)(*((c)++)))<<24), \ 214 l|=(((unsigned long)(*((c)++)))<<24); \
215 l) 215 } while (0)
216#endif 216#endif
217#ifndef HOST_l2c 217#ifndef HOST_l2c
218#define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ 218#define HOST_l2c(l,c) do {*((c)++)=(unsigned char)(((l) )&0xff); \
219 *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ 219 *((c)++)=(unsigned char)(((l)>> 8)&0xff); \
220 *((c)++)=(unsigned char)(((l)>>16)&0xff), \ 220 *((c)++)=(unsigned char)(((l)>>16)&0xff); \
221 *((c)++)=(unsigned char)(((l)>>24)&0xff), \ 221 *((c)++)=(unsigned char)(((l)>>24)&0xff); \
222 l) 222 } while (0)
223#endif 223#endif
224 224
225#endif 225#endif
@@ -306,11 +306,11 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c)
306 306
307 p += HASH_CBLOCK - 8; 307 p += HASH_CBLOCK - 8;
308#if defined(DATA_ORDER_IS_BIG_ENDIAN) 308#if defined(DATA_ORDER_IS_BIG_ENDIAN)
309 (void)HOST_l2c(c->Nh, p); 309 HOST_l2c(c->Nh, p);
310 (void)HOST_l2c(c->Nl, p); 310 HOST_l2c(c->Nl, p);
311#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) 311#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
312 (void)HOST_l2c(c->Nl, p); 312 HOST_l2c(c->Nl, p);
313 (void)HOST_l2c(c->Nh, p); 313 HOST_l2c(c->Nh, p);
314#endif 314#endif
315 p -= HASH_CBLOCK; 315 p -= HASH_CBLOCK;
316 HASH_BLOCK_DATA_ORDER (c, p, 1); 316 HASH_BLOCK_DATA_ORDER (c, p, 1);