use hash.h; fixes for crays
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5693 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		@@ -42,15 +42,9 @@
 | 
				
			|||||||
RCSID("$Id$");
 | 
					RCSID("$Id$");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include "hash.h"
 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "md4.h"
 | 
					#include "md4.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef min
 | 
					 | 
				
			||||||
#define min(a,b) (((a)>(b))?(b):(a))
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define A m->counter[0]
 | 
					#define A m->counter[0]
 | 
				
			||||||
#define B m->counter[1]
 | 
					#define B m->counter[1]
 | 
				
			||||||
#define C m->counter[2]
 | 
					#define C m->counter[2]
 | 
				
			||||||
@@ -68,13 +62,7 @@ md4_init (struct md4 *m)
 | 
				
			|||||||
  A = 0x67452301;
 | 
					  A = 0x67452301;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline u_int32_t
 | 
					#define F(x,y,z) CRAYFIX((x & y) | (~x & z))
 | 
				
			||||||
cshift (u_int32_t x, unsigned int n)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return (x << n) | (x >> (32 - n));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define F(x,y,z) ((x & y) | (~x & z))
 | 
					 | 
				
			||||||
#define G(x,y,z) ((x & y) | (x & z) | (y & z))
 | 
					#define G(x,y,z) ((x & y) | (x & z) | (y & z))
 | 
				
			||||||
#define H(x,y,z) (x ^ y ^ z)
 | 
					#define H(x,y,z) (x ^ y ^ z)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -175,10 +163,9 @@ static inline u_int32_t
 | 
				
			|||||||
swap_u_int32_t (u_int32_t t)
 | 
					swap_u_int32_t (u_int32_t t)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if defined(WORDS_BIGENDIAN)
 | 
					#if defined(WORDS_BIGENDIAN)
 | 
				
			||||||
#define ROL(x,n) ((x)<<(n))|((x)>>(32-(n)))
 | 
					 | 
				
			||||||
  u_int32_t temp1, temp2;
 | 
					  u_int32_t temp1, temp2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  temp1   = ROL(t,16);
 | 
					  temp1   = cshift(t, 16);
 | 
				
			||||||
  temp2   = temp1 >> 8;
 | 
					  temp2   = temp1 >> 8;
 | 
				
			||||||
  temp1  &= 0x00ff00ff;
 | 
					  temp1  &= 0x00ff00ff;
 | 
				
			||||||
  temp2  &= 0x00ff00ff;
 | 
					  temp2  &= 0x00ff00ff;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,15 +42,9 @@
 | 
				
			|||||||
RCSID("$Id$");
 | 
					RCSID("$Id$");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include "hash.h"
 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "md5.h"
 | 
					#include "md5.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef min
 | 
					 | 
				
			||||||
#define min(a,b) (((a)>(b))?(b):(a))
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define A m->counter[0]
 | 
					#define A m->counter[0]
 | 
				
			||||||
#define B m->counter[1]
 | 
					#define B m->counter[1]
 | 
				
			||||||
#define C m->counter[2]
 | 
					#define C m->counter[2]
 | 
				
			||||||
@@ -68,16 +62,10 @@ md5_init (struct md5 *m)
 | 
				
			|||||||
  A = 0x67452301;
 | 
					  A = 0x67452301;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline u_int32_t
 | 
					#define F(x,y,z) CRAYFIX((x & y) | (~x & z))
 | 
				
			||||||
cshift (u_int32_t x, unsigned int n)
 | 
					#define G(x,y,z) CRAYFIX((x & z) | (y & ~z))
 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return (x << n) | (x >> (32 - n));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define F(x,y,z) ((x & y) | (~x & z))
 | 
					 | 
				
			||||||
#define G(x,y,z) ((x & z) | (y & ~z))
 | 
					 | 
				
			||||||
#define H(x,y,z) (x ^ y ^ z)
 | 
					#define H(x,y,z) (x ^ y ^ z)
 | 
				
			||||||
#define I(x,y,z) (y ^ (x | ~z))
 | 
					#define I(x,y,z) CRAYFIX(y ^ (x | ~z))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DOIT(a,b,c,d,k,s,i,OP) \
 | 
					#define DOIT(a,b,c,d,k,s,i,OP) \
 | 
				
			||||||
a = b + cshift(a + OP(b,c,d) + X[k] + (i), s)
 | 
					a = b + cshift(a + OP(b,c,d) + X[k] + (i), s)
 | 
				
			||||||
@@ -199,10 +187,9 @@ static inline u_int32_t
 | 
				
			|||||||
swap_u_int32_t (u_int32_t t)
 | 
					swap_u_int32_t (u_int32_t t)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#if defined(WORDS_BIGENDIAN)
 | 
					#if defined(WORDS_BIGENDIAN)
 | 
				
			||||||
#define ROL(x,n) ((x)<<(n))|((x)>>(32-(n)))
 | 
					 | 
				
			||||||
  u_int32_t temp1, temp2;
 | 
					  u_int32_t temp1, temp2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  temp1   = ROL(t,16);
 | 
					  temp1   = cshift(t, 16);
 | 
				
			||||||
  temp2   = temp1 >> 8;
 | 
					  temp2   = temp1 >> 8;
 | 
				
			||||||
  temp1  &= 0x00ff00ff;
 | 
					  temp1  &= 0x00ff00ff;
 | 
				
			||||||
  temp2  &= 0x00ff00ff;
 | 
					  temp2  &= 0x00ff00ff;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,15 +42,9 @@
 | 
				
			|||||||
RCSID("$Id$");
 | 
					RCSID("$Id$");
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include "hash.h"
 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "sha.h"
 | 
					#include "sha.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef min
 | 
					 | 
				
			||||||
#define min(a,b) (((a)>(b))?(b):(a))
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define A m->counter[0]
 | 
					#define A m->counter[0]
 | 
				
			||||||
#define B m->counter[1]
 | 
					#define B m->counter[1]
 | 
				
			||||||
#define C m->counter[2]
 | 
					#define C m->counter[2]
 | 
				
			||||||
@@ -70,13 +64,8 @@ sha_init (struct sha *m)
 | 
				
			|||||||
  E = 0xc3d2e1f0;
 | 
					  E = 0xc3d2e1f0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline u_int32_t
 | 
					 | 
				
			||||||
cshift (u_int32_t x, unsigned int n)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  return (x << n) | (x >> (32 - n));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define F0(x,y,z) ((x & y) | (~x & z))
 | 
					#define F0(x,y,z) CRAYFIX((x & y) | (~x & z))
 | 
				
			||||||
#define F1(x,y,z) (x ^ y ^ z)
 | 
					#define F1(x,y,z) (x ^ y ^ z)
 | 
				
			||||||
#define F2(x,y,z) ((x & y) | (x & z) | (y & z))
 | 
					#define F2(x,y,z) ((x & y) | (x & z) | (y & z))
 | 
				
			||||||
#define F3(x,y,z) F1(x,y,z)
 | 
					#define F3(x,y,z) F1(x,y,z)
 | 
				
			||||||
@@ -226,7 +215,7 @@ swap_u_int32_t (u_int32_t t)
 | 
				
			|||||||
#define ROL(x,n) ((x)<<(n))|((x)>>(32-(n)))
 | 
					#define ROL(x,n) ((x)<<(n))|((x)>>(32-(n)))
 | 
				
			||||||
  u_int32_t temp1, temp2;
 | 
					  u_int32_t temp1, temp2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  temp1   = ROL(t,16);
 | 
					  temp1   = cshift(t, 16);
 | 
				
			||||||
  temp2   = temp1 >> 8;
 | 
					  temp2   = temp1 >> 8;
 | 
				
			||||||
  temp1  &= 0x00ff00ff;
 | 
					  temp1  &= 0x00ff00ff;
 | 
				
			||||||
  temp2  &= 0x00ff00ff;
 | 
					  temp2  &= 0x00ff00ff;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user