From 62e3beda4301a617f01350dba9fa095c7a03c05b Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 6 Jun 1996 19:54:22 +0000 Subject: [PATCH] Don't use htonl(); it doesn't exist under Windows. Instead do the test by casting a pointer to an integer to a char *. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8259 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/sha/ChangeLog | 6 ++++++ src/lib/crypto/sha/shs.c | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/crypto/sha/ChangeLog b/src/lib/crypto/sha/ChangeLog index 3ded41a01..6573f253c 100644 --- a/src/lib/crypto/sha/ChangeLog +++ b/src/lib/crypto/sha/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 6 15:43:26 1996 Theodore Y. Ts'o + + * shs.c (longReverse): Don't use htonl(); it doesn't exist under + Windows. Instead do the test by casting a pointer to an + integer to a char *. + Mon May 20 17:15:32 1996 Theodore Y. Ts'o * t_shs.c (main): Don't do timing tests; it takes too long! diff --git a/src/lib/crypto/sha/shs.c b/src/lib/crypto/sha/shs.c index 2b2f9bf97..1dc134c58 100644 --- a/src/lib/crypto/sha/shs.c +++ b/src/lib/crypto/sha/shs.c @@ -1,5 +1,5 @@ #include -#include +#include #include "shs.h" /* The SHS f()-functions. The f1 and f3 functions can be optimized to @@ -48,10 +48,11 @@ for this information */ #ifdef NEW_SHS -#define expand(W,i) ( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ i - 14 & 15 ] ^ \ - W[ i - 8 & 15 ] ^ W[ i - 3 & 15 ] ) ) ) +#define expand(W,i) ( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \ + W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ))) #else -#define expand(W,i) ( W[ i & 15 ] ^= W[ i - 14 & 15 ] ^ W[ i - 8 & 15 ] ^ W[ i - 3 & 15 ] ) +#define expand(W,i) ( W[ i & 15 ] ^= W[ (i - 14) & 15 ] ^ \ + W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) #endif /* NEW_SHS */ /* The prototype SHS sub-round. The fundamental sub-round is: @@ -214,10 +215,12 @@ void longReverse( LONG *buffer, int byteCount ) { LONG value; static int init = 0; + char *cp; switch (init) { case 0: - if (htonl(1) != 1) { + cp = (char *) &init; + if (*cp == 1) { init=2; break; } -- 2.26.2