From eb3e7d7ffe444652fe6f90808f95e08bc99cf5ae Mon Sep 17 00:00:00 2001 From: miod <> Date: Wed, 9 Jul 2014 16:06:14 +0000 Subject: Remove leading underscore from _BYTE_ORDER and _{LITTLE,BIG}_ENDIAN, to be more friendly to systems where the underscore flavours may be defined as empty. Found the hard way be bcook@; joint brainstrom with bcook beck and guenther --- src/lib/libcrypto/sha/sha256.c | 4 ++-- src/lib/libcrypto/sha/sha512.c | 8 ++++---- src/lib/libcrypto/sha/sha_locl.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/lib/libcrypto/sha') diff --git a/src/lib/libcrypto/sha/sha256.c b/src/lib/libcrypto/sha/sha256.c index b623893be4..6d7af561fc 100644 --- a/src/lib/libcrypto/sha/sha256.c +++ b/src/lib/libcrypto/sha/sha256.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha256.c,v 1.5 2014/07/09 11:10:51 bcook Exp $ */ +/* $OpenBSD: sha256.c,v 1.6 2014/07/09 16:06:13 miod Exp $ */ /* ==================================================================== * Copyright (c) 2004 The OpenSSL Project. All rights reserved * according to the OpenSSL license [found in ../../LICENSE]. @@ -211,7 +211,7 @@ static void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; - if (_BYTE_ORDER != _LITTLE_ENDIAN && + if (BYTE_ORDER != LITTLE_ENDIAN && sizeof(SHA_LONG)==4 && ((size_t)in%4)==0) { const SHA_LONG *W=(const SHA_LONG *)data; diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c index 08b1564363..01ec6a6cde 100644 --- a/src/lib/libcrypto/sha/sha512.c +++ b/src/lib/libcrypto/sha/sha512.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha512.c,v 1.10 2014/07/09 11:10:51 bcook Exp $ */ +/* $OpenBSD: sha512.c,v 1.11 2014/07/09 16:06:13 miod Exp $ */ /* ==================================================================== * Copyright (c) 2004 The OpenSSL Project. All rights reserved * according to the OpenSSL license [found in ../../LICENSE]. @@ -104,7 +104,7 @@ int SHA512_Final (unsigned char *md, SHA512_CTX *c) sha512_block_data_order (c,p,1); memset (p+n,0,sizeof(c->u)-16-n); -#if _BYTE_ORDER == _BIG_ENDIAN +#if BYTE_ORDER == BIG_ENDIAN c->u.d[SHA_LBLOCK-2] = c->Nh; c->u.d[SHA_LBLOCK-1] = c->Nl; #else @@ -431,7 +431,7 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num for (i=0;i<16;i++) { -#if _BYTE_ORDER == _BIG_ENDIAN +#if BYTE_ORDER == BIG_ENDIAN T1 = X[i] = W[i]; #else T1 = X[i] = PULL64(W[i]); @@ -486,7 +486,7 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; -#if _BYTE_ORDER == _BIG_ENDIAN +#if BYTE_ORDER == BIG_ENDIAN T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h); T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g); T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f); diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index e03b6453cb..e19b7e521b 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sha_locl.h,v 1.16 2014/06/12 15:49:30 deraadt Exp $ */ +/* $OpenBSD: sha_locl.h,v 1.17 2014/07/09 16:06:13 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -223,7 +223,7 @@ static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) for (;;) { - if (_BYTE_ORDER != _LITTLE_ENDIAN && + if (BYTE_ORDER != LITTLE_ENDIAN && sizeof(SHA_LONG)==4 && ((size_t)p%4)==0) { const SHA_LONG *W=(const SHA_LONG *)data; -- cgit v1.2.3-55-g6feb