diff -urN wolfssl-1.6.5/configure.in wolfssl-1.6.5-haiku/configure.in --- wolfssl-1.6.5/configure.in 2010-09-09 18:33:56.031195136 +0000 +++ wolfssl-1.6.5-haiku/configure.in 2010-12-17 11:54:47.000000000 +0000 @@ -99,6 +99,8 @@ CFLAGS="-DOPENSSL_EXTRA $CFLAGS" fi +AC_CHECK_LIB(network,socket) +AC_CHECK_LIBM # IPv6 Test Apps AC_ARG_ENABLE(ipv6, diff -urN wolfssl-1.6.5/ctaocrypt/include/integer.h wolfssl-1.6.5-haiku/ctaocrypt/include/integer.h --- wolfssl-1.6.5/ctaocrypt/include/integer.h 2010-08-06 22:11:46.057147392 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/include/integer.h 2010-12-17 09:50:41.000000000 +0000 @@ -195,10 +195,8 @@ /* ---> Basic Manipulations <--- */ #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) -#define mp_iseven(a) \ - (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO) -#define mp_isodd(a) \ - (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) +#define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO) +#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) /* number of primes */ @@ -208,8 +206,7 @@ #define PRIME_SIZE 256 #endif -#define mp_prime_random(a, t, size, bbs, cb, dat) \ - mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat) +#define mp_prime_random(a, t, size, bbs, cb, dat) mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat) #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) #define mp_raw_size(mp) mp_signed_bin_size(mp) diff -urN wolfssl-1.6.5/ctaocrypt/include/types.h wolfssl-1.6.5-haiku/ctaocrypt/include/types.h --- wolfssl-1.6.5/ctaocrypt/include/types.h 2010-08-25 21:07:45.058458112 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/include/types.h 2010-12-17 09:44:48.000000000 +0000 @@ -76,8 +76,7 @@ /* These platforms have 64-bit CPU registers. */ -#if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \ - defined(__mips64) || defined(__x86_64__)) +#if (defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__mips64) || defined(__x86_64__)) typedef word64 word; #else typedef word32 word; diff -urN wolfssl-1.6.5/ctaocrypt/src/hc128.c wolfssl-1.6.5-haiku/ctaocrypt/src/hc128.c --- wolfssl-1.6.5/ctaocrypt/src/hc128.c 2009-03-12 18:29:21.062914560 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/src/hc128.c 2010-12-17 10:10:13.000000000 +0000 @@ -34,44 +34,16 @@ /*h1 function*/ -#define h1(ctx, x, y) { \ - byte a,c; \ - a = (byte) (x); \ - c = (byte) ((x) >> 16); \ - y = (ctx->T[512+a])+(ctx->T[512+256+c]); \ -} +#define h1(ctx, x, y) { byte a,c; a = (byte) (x); c = (byte) ((x) >> 16); y = (ctx->T[512+a])+(ctx->T[512+256+c]);} /*h2 function*/ -#define h2(ctx, x, y) { \ - byte a,c; \ - a = (byte) (x); \ - c = (byte) ((x) >> 16); \ - y = (ctx->T[a])+(ctx->T[256+c]); \ -} +#define h2(ctx, x, y) { byte a,c; a = (byte) (x); c = (byte) ((x) >> 16); y = (ctx->T[a])+(ctx->T[256+c]); } /*one step of HC-128, update P and generate 32 bits keystream*/ -#define step_P(ctx,u,v,a,b,c,d,n){ \ - word32 tem0,tem1,tem2,tem3; \ - h1((ctx),(ctx->X[(d)]),tem3); \ - tem0 = rotrFixed((ctx->T[(v)]),23); \ - tem1 = rotrFixed((ctx->X[(c)]),10); \ - tem2 = rotrFixed((ctx->X[(b)]),8); \ - (ctx->T[(u)]) += tem2+(tem0 ^ tem1); \ - (ctx->X[(a)]) = (ctx->T[(u)]); \ - (n) = tem3 ^ (ctx->T[(u)]) ; \ -} +#define step_P(ctx,u,v,a,b,c,d,n){ word32 tem0,tem1,tem2,tem3; h1((ctx),(ctx->X[(d)]),tem3); tem0 = rotrFixed((ctx->T[(v)]),23); tem1 = rotrFixed((ctx->X[(c)]),10); tem2 = rotrFixed((ctx->X[(b)]),8); (ctx->T[(u)]) += tem2+(tem0 ^ tem1); (ctx->X[(a)]) = (ctx->T[(u)]); (n) = tem3 ^ (ctx->T[(u)]) ; } /*one step of HC-128, update Q and generate 32 bits keystream*/ -#define step_Q(ctx,u,v,a,b,c,d,n){ \ - word32 tem0,tem1,tem2,tem3; \ - h2((ctx),(ctx->Y[(d)]),tem3); \ - tem0 = rotrFixed((ctx->T[(v)]),(32-23)); \ - tem1 = rotrFixed((ctx->Y[(c)]),(32-10)); \ - tem2 = rotrFixed((ctx->Y[(b)]),(32-8)); \ - (ctx->T[(u)]) += tem2 + (tem0 ^ tem1); \ - (ctx->Y[(a)]) = (ctx->T[(u)]); \ - (n) = tem3 ^ (ctx->T[(u)]) ; \ -} +#define step_Q(ctx,u,v,a,b,c,d,n){ word32 tem0,tem1,tem2,tem3; h2((ctx),(ctx->Y[(d)]),tem3); tem0 = rotrFixed((ctx->T[(v)]),(32-23)); tem1 = rotrFixed((ctx->Y[(c)]),(32-10)); tem2 = rotrFixed((ctx->Y[(b)]),(32-8)); (ctx->T[(u)]) += tem2 + (tem0 ^ tem1); (ctx->Y[(a)]) = (ctx->T[(u)]); (n) = tem3 ^ (ctx->T[(u)]) ; } /*16 steps of HC-128, generate 512 bits keystream*/ static void generate_keystream(HC128* ctx, word32* keystream) @@ -128,26 +100,10 @@ #define f2(x) (rotrFixed((x),17) ^ rotrFixed((x),19) ^ ((x) >> 10)) /*update table P*/ -#define update_P(ctx,u,v,a,b,c,d){ \ - word32 tem0,tem1,tem2,tem3; \ - tem0 = rotrFixed((ctx->T[(v)]),23); \ - tem1 = rotrFixed((ctx->X[(c)]),10); \ - tem2 = rotrFixed((ctx->X[(b)]),8); \ - h1((ctx),(ctx->X[(d)]),tem3); \ - (ctx->T[(u)]) = ((ctx->T[(u)]) + tem2+(tem0^tem1)) ^ tem3; \ - (ctx->X[(a)]) = (ctx->T[(u)]); \ -} +#define update_P(ctx,u,v,a,b,c,d){ word32 tem0,tem1,tem2,tem3; tem0 = rotrFixed((ctx->T[(v)]),23); tem1 = rotrFixed((ctx->X[(c)]),10); tem2 = rotrFixed((ctx->X[(b)]),8); h1((ctx),(ctx->X[(d)]),tem3); (ctx->T[(u)]) = ((ctx->T[(u)]) + tem2+(tem0^tem1)) ^ tem3; (ctx->X[(a)]) = (ctx->T[(u)]); } /*update table Q*/ -#define update_Q(ctx,u,v,a,b,c,d){ \ - word32 tem0,tem1,tem2,tem3; \ - tem0 = rotrFixed((ctx->T[(v)]),(32-23)); \ - tem1 = rotrFixed((ctx->Y[(c)]),(32-10)); \ - tem2 = rotrFixed((ctx->Y[(b)]),(32-8)); \ - h2((ctx),(ctx->Y[(d)]),tem3); \ - (ctx->T[(u)]) = ((ctx->T[(u)]) + tem2+(tem0^tem1)) ^ tem3; \ - (ctx->Y[(a)]) = (ctx->T[(u)]); \ -} +#define update_Q(ctx,u,v,a,b,c,d){ word32 tem0,tem1,tem2,tem3; tem0 = rotrFixed((ctx->T[(v)]),(32-23)); tem1 = rotrFixed((ctx->Y[(c)]),(32-10)); tem2 = rotrFixed((ctx->Y[(b)]),(32-8)); h2((ctx),(ctx->Y[(d)]),tem3); (ctx->T[(u)]) = ((ctx->T[(u)]) + tem2+(tem0^tem1)) ^ tem3; (ctx->Y[(a)]) = (ctx->T[(u)]); } /*16 steps of HC-128, without generating keystream, */ /*but use the outputs to update P and Q*/ diff -urN wolfssl-1.6.5/ctaocrypt/src/integer.c wolfssl-1.6.5-haiku/ctaocrypt/src/integer.c --- wolfssl-1.6.5/ctaocrypt/src/integer.c 2010-08-10 00:04:37.063176704 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/src/integer.c 2010-12-17 10:30:49.571211776 +0000 @@ -718,8 +718,7 @@ } /* modified diminished radix reduction */ -#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && \ - defined(BN_S_MP_EXPTMOD_C) +#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C) if (mp_reduce_is_2k_l(P) == MP_YES) { return s_mp_exptmod(G, X, P, Y, 1); } diff -urN wolfssl-1.6.5/ctaocrypt/src/md4.c wolfssl-1.6.5-haiku/ctaocrypt/src/md4.c --- wolfssl-1.6.5/ctaocrypt/src/md4.c 2010-08-24 21:13:27.063438848 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/src/md4.c 2010-12-17 09:55:29.000000000 +0000 @@ -87,8 +87,7 @@ function(B,C,D,A,15,19); #undef function -#define function(a,b,c,d,k,s) \ - a=rotlFixed(a+G(b,c,d)+md4->buffer[k]+0x5a827999,s); +#define function(a,b,c,d,k,s) a=rotlFixed(a+G(b,c,d)+md4->buffer[k]+0x5a827999,s); function(A,B,C,D, 0, 3); function(D,A,B,C, 4, 5); @@ -108,8 +107,7 @@ function(B,C,D,A,15,13); #undef function -#define function(a,b,c,d,k,s) \ - a=rotlFixed(a+H(b,c,d)+md4->buffer[k]+0x6ed9eba1,s); +#define function(a,b,c,d,k,s) a=rotlFixed(a+H(b,c,d)+md4->buffer[k]+0x6ed9eba1,s); function(A,B,C,D, 0, 3); function(D,A,B,C, 8, 9); diff -urN wolfssl-1.6.5/ctaocrypt/src/md5.c wolfssl-1.6.5-haiku/ctaocrypt/src/md5.c --- wolfssl-1.6.5/ctaocrypt/src/md5.c 2010-08-24 21:13:58.063438848 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/src/md5.c 2010-12-17 09:54:20.000000000 +0000 @@ -61,8 +61,7 @@ #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) -#define MD5STEP(f, w, x, y, z, data, s) \ - w = rotlFixed(w + f(x, y, z) + data, s) + x +#define MD5STEP(f, w, x, y, z, data, s) w = rotlFixed(w + f(x, y, z) + data, s) + x /* Copy context->state[] to working vars */ word32 a = md5->digest[0]; diff -urN wolfssl-1.6.5/ctaocrypt/src/sha.c wolfssl-1.6.5-haiku/ctaocrypt/src/sha.c --- wolfssl-1.6.5/ctaocrypt/src/sha.c 2010-08-24 21:14:07.064225280 +0000 +++ wolfssl-1.6.5-haiku/ctaocrypt/src/sha.c 2010-12-17 09:56:55.000000000 +0000 @@ -54,8 +54,7 @@ } #define blk0(i) (W[i] = sha->buffer[i]) -#define blk1(i) (W[i&15] = \ - rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1)) +#define blk1(i) (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1)) #define f1(x,y,z) (z^(x &(y^z))) #define f2(x,y,z) (x^y^z) @@ -63,16 +62,11 @@ #define f4(x,y,z) (x^y^z) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define R0(v,w,x,y,z,i) z+= f1(w,x,y) + blk0(i) + 0x5A827999+ \ - rotlFixed(v,5); w = rotlFixed(w,30); -#define R1(v,w,x,y,z,i) z+= f1(w,x,y) + blk1(i) + 0x5A827999+ \ - rotlFixed(v,5); w = rotlFixed(w,30); -#define R2(v,w,x,y,z,i) z+= f2(w,x,y) + blk1(i) + 0x6ED9EBA1+ \ - rotlFixed(v,5); w = rotlFixed(w,30); -#define R3(v,w,x,y,z,i) z+= f3(w,x,y) + blk1(i) + 0x8F1BBCDC+ \ - rotlFixed(v,5); w = rotlFixed(w,30); -#define R4(v,w,x,y,z,i) z+= f4(w,x,y) + blk1(i) + 0xCA62C1D6+ \ - rotlFixed(v,5); w = rotlFixed(w,30); +#define R0(v,w,x,y,z,i) z+= f1(w,x,y) + blk0(i) + 0x5A827999+ rotlFixed(v,5); w = rotlFixed(w,30); +#define R1(v,w,x,y,z,i) z+= f1(w,x,y) + blk1(i) + 0x5A827999+ rotlFixed(v,5); w = rotlFixed(w,30); +#define R2(v,w,x,y,z,i) z+= f2(w,x,y) + blk1(i) + 0x6ED9EBA1+ rotlFixed(v,5); w = rotlFixed(w,30); +#define R3(v,w,x,y,z,i) z+= f3(w,x,y) + blk1(i) + 0x8F1BBCDC+ rotlFixed(v,5); w = rotlFixed(w,30); +#define R4(v,w,x,y,z,i) z+= f4(w,x,y) + blk1(i) + 0xCA62C1D6+ rotlFixed(v,5); w = rotlFixed(w,30); static void Transform(Sha* sha) diff -urN wolfssl-1.6.5/include/wolfssl_int.h wolfssl-1.6.5-haiku/include/wolfssl_int.h --- wolfssl-1.6.5/include/wolfssl_int.h 2010-07-30 19:36:45.002621440 +0000 +++ wolfssl-1.6.5-haiku/include/wolfssl_int.h 2010-12-17 09:52:55.000000000 +0000 @@ -120,8 +120,7 @@ -#if defined(BUILD_SSL_RSA_WITH_RC4_128_SHA) || \ - defined(BUILD_SSL_RSA_WITH_RC4_128_MD5) +#if defined(BUILD_SSL_RSA_WITH_RC4_128_SHA) || defined(BUILD_SSL_RSA_WITH_RC4_128_MD5) #define BUILD_ARC4 #endif @@ -129,13 +128,11 @@ #define BUILD_DES3 #endif -#if defined(BUILD_TLS_RSA_WITH_AES_128_CBC_SHA) || \ - defined(BUILD_TLS_RSA_WITH_AES_256_CBC_SHA) +#if defined(BUILD_TLS_RSA_WITH_AES_128_CBC_SHA) || defined(BUILD_TLS_RSA_WITH_AES_256_CBC_SHA) #define BUILD_AES #endif -#if defined(BUILD_TLS_RSA_WITH_HC_128_CBC_SHA) || \ - defined(BUILD_TLS_RSA_WITH_HC_128_CBC_MD5) +#if defined(BUILD_TLS_RSA_WITH_HC_128_CBC_SHA) || defined(BUILD_TLS_RSA_WITH_HC_128_CBC_MD5) #define BUILD_HC128 #endif @@ -389,8 +386,7 @@ The length (in bytes) of the following TLSPlaintext.fragment. The length should not exceed 2^14. */ -#define BUFFER16K_LEN RECORD_HEADER_SZ + MAX_RECORD_SIZE + \ - MAX_COMP_EXTRA + MAX_MTU + MAX_MSG_EXTRA +#define BUFFER16K_LEN RECORD_HEADER_SZ + MAX_RECORD_SIZE + MAX_COMP_EXTRA + MAX_MTU + MAX_MSG_EXTRA typedef struct { word32 length; word32 idx;