1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

* blowfish.c, md5.c, rmd160.c, sha1.c, sha256.c, sha512.c: Use '#if'

rather than '#ifdef' BIG_ENDIAN_HOST.  Harmless as we explicitly
define BIG_ENDIAN_HOST to 1 when we need it, but needed for OSX fat
builds when we define BIG_ENDIAN_HOST to another macro.
This commit is contained in:
David Shaw 2006-03-20 00:39:44 +00:00
parent f4547924cb
commit 0f4f660d5f
7 changed files with 21 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2006-03-19 David Shaw <dshaw@jabberwocky.com>
* blowfish.c, md5.c, rmd160.c, sha1.c, sha256.c, sha512.c: Use
'#if' rather than '#ifdef' BIG_ENDIAN_HOST. Harmless as we
explicitly define BIG_ENDIAN_HOST to 1 when we need it, but needed
for OSX fat builds when we define BIG_ENDIAN_HOST to another
macro.
2006-02-14 Werner Koch <wk@gnupg.org>
* random.c (lock_seed_file): Build even when not used.

View File

@ -251,7 +251,7 @@ function_F( BLOWFISH_context *bc, u32 x )
{
u16 a, b, c, d;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
a = ((byte*)&x)[0];
b = ((byte*)&x)[1];
c = ((byte*)&x)[2];
@ -267,7 +267,7 @@ function_F( BLOWFISH_context *bc, u32 x )
}
#endif
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
#define F(x) ((( s0[((byte*)&x)[0]] + s1[((byte*)&x)[1]]) \
^ s2[((byte*)&x)[2]]) + s3[((byte*)&x)[3]] )
#else
@ -528,7 +528,7 @@ do_bf_setkey( BLOWFISH_context *c, const byte *key, unsigned keylen )
}
for(i=j=0; i < BLOWFISH_ROUNDS+2; i++ ) {
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
((byte*)&data)[0] = key[j];
((byte*)&data)[1] = key[(j+1)%keylen];
((byte*)&data)[2] = key[(j+2)%keylen];

View File

@ -100,7 +100,7 @@ transform( MD5_CONTEXT *ctx, byte *data )
u32 D = ctx->D;
u32 *cwp = correct_words;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
{ int i;
byte *p2, *p1;
for(i=0, p1=data, p2=(byte*)correct_words; i < 16; i++, p2 += 4 ) {
@ -311,7 +311,7 @@ md5_final( MD5_CONTEXT *hd )
burn_stack (80+6*sizeof(void*));
p = hd->buf;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
#define X(a) do { *p++ = hd-> a ; *p++ = hd-> a >> 8; \
*p++ = hd-> a >> 16; *p++ = hd-> a >> 24; } while(0)
#else /* little endian */

View File

@ -176,7 +176,7 @@ static void
transform( RMD160_CONTEXT *hd, byte *data )
{
u32 a,b,c,d,e,aa,bb,cc,dd,ee,t;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
u32 x[16];
{ int i;
byte *p2, *p1;
@ -515,7 +515,7 @@ rmd160_final( RMD160_CONTEXT *hd )
burn_stack (108+5*sizeof(void*));
p = hd->buf;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
#define X(a) do { *p++ = hd->h##a ; *p++ = hd->h##a >> 8; \
*p++ = hd->h##a >> 16; *p++ = hd->h##a >> 24; } while(0)
#else /* little endian */

View File

@ -91,7 +91,7 @@ transform( SHA1_CONTEXT *hd, byte *data )
d = hd->h3;
e = hd->h4;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
memcpy( x, data, 64 );
#else
{ int i;
@ -305,7 +305,7 @@ sha1_final(SHA1_CONTEXT *hd)
burn_stack (88+4*sizeof(void*));
p = hd->buf;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
#define X(a) do { *(u32*)p = hd->h##a ; p += 4; } while(0)
#else /* little endian */
#define X(a) do { *p++ = hd->h##a >> 24; *p++ = hd->h##a >> 16; \

View File

@ -111,7 +111,7 @@ transform( SHA256_CONTEXT *hd, byte *data )
g = hd->h6;
h = hd->h7;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
memcpy( w, data, 64 );
#else
{
@ -257,7 +257,7 @@ sha256_final(SHA256_CONTEXT *hd)
burn_stack (328);
p = hd->buf;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
#define X(a) do { *(u32*)p = hd->h##a ; p += 4; } while(0)
#else /* little endian */
#define X(a) do { *p++ = hd->h##a >> 24; *p++ = hd->h##a >> 16; \

View File

@ -171,7 +171,7 @@ transform( SHA512_CONTEXT *hd, byte *data )
g = hd->h6;
h = hd->h7;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
memcpy( w, data, 128 );
#else
{
@ -332,7 +332,7 @@ sha512_final(SHA512_CONTEXT *hd)
burn_stack (768);
p = hd->buf;
#ifdef BIG_ENDIAN_HOST
#if BIG_ENDIAN_HOST
#define X(a) do { *(u64*)p = hd->h##a ; p += 8; } while(0)
#else /* little endian */
#define X(a) do { *p++ = hd->h##a >> 56; *p++ = hd->h##a >> 48; \