mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
fixes for --enable-32bit CFLAGS=-m32 --enable-fips=v6 (fixes "#error ED448 requires SHAKE256").
This commit is contained in:
@@ -5363,7 +5363,7 @@ then
|
||||
fi
|
||||
|
||||
# Ed448
|
||||
if test "$ENABLED_ED448" != "no" && test "$ENABLED_32BIT" = "no"
|
||||
if test "$ENABLED_ED448" != "no"
|
||||
then
|
||||
if test "$ENABLED_ED448" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
|
||||
then
|
||||
@@ -5416,7 +5416,7 @@ fi
|
||||
AS_IF([test "x$ENABLED_FIPS" = "xyes" && test $HAVE_FIPS_VERSION -lt 6],
|
||||
[ENABLED_SHAKE128="no"])
|
||||
|
||||
if test "$ENABLED_SHAKE128" != "no" && test "$ENABLED_32BIT" = "no"
|
||||
if test "$ENABLED_SHAKE128" != "no"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE128"
|
||||
if test "$ENABLED_SHA3" = "no"
|
||||
@@ -5432,7 +5432,7 @@ fi
|
||||
AS_IF([test "x$ENABLED_FIPS" = "xyes" && test $HAVE_FIPS_VERSION -lt 6],
|
||||
[ENABLED_SHAKE256="no"])
|
||||
|
||||
if test "$ENABLED_SHAKE256" != "no" && test "$ENABLED_32BIT" = "no"
|
||||
if test "$ENABLED_SHAKE256" != "no"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHAKE256"
|
||||
if test "$ENABLED_SHA3" = "no"
|
||||
@@ -8667,7 +8667,7 @@ then
|
||||
ENABLED_OPENSSLEXTRA="yes"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_ED25519" != "no" && test "$ENABLED_32BIT" = "no"
|
||||
if test "$ENABLED_ED25519" != "no"
|
||||
then
|
||||
if test "$ENABLED_ED25519" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
|
||||
then
|
||||
|
@@ -1437,56 +1437,56 @@ void fe448_to_bytes(unsigned char* b, const sword32* a)
|
||||
b[ 0] = (byte)(in0 >> 0);
|
||||
b[ 1] = (byte)(in0 >> 8);
|
||||
b[ 2] = (byte)(in0 >> 16);
|
||||
b[ 3] = (byte)(in0 >> 24) + ((in1 >> 0) << 4);
|
||||
b[ 3] = (byte)((in0 >> 24) + ((in1 >> 0) << 4));
|
||||
b[ 4] = (byte)(in1 >> 4);
|
||||
b[ 5] = (byte)(in1 >> 12);
|
||||
b[ 6] = (byte)(in1 >> 20);
|
||||
b[ 7] = (byte)(in2 >> 0);
|
||||
b[ 8] = (byte)(in2 >> 8);
|
||||
b[ 9] = (byte)(in2 >> 16);
|
||||
b[10] = (byte)(in2 >> 24) + ((in3 >> 0) << 4);
|
||||
b[10] = (byte)((in2 >> 24) + ((in3 >> 0) << 4));
|
||||
b[11] = (byte)(in3 >> 4);
|
||||
b[12] = (byte)(in3 >> 12);
|
||||
b[13] = (byte)(in3 >> 20);
|
||||
b[14] = (byte)(in4 >> 0);
|
||||
b[15] = (byte)(in4 >> 8);
|
||||
b[16] = (byte)(in4 >> 16);
|
||||
b[17] = (byte)(in4 >> 24) + ((in5 >> 0) << 4);
|
||||
b[17] = (byte)((in4 >> 24) + ((in5 >> 0) << 4));
|
||||
b[18] = (byte)(in5 >> 4);
|
||||
b[19] = (byte)(in5 >> 12);
|
||||
b[20] = (byte)(in5 >> 20);
|
||||
b[21] = (byte)(in6 >> 0);
|
||||
b[22] = (byte)(in6 >> 8);
|
||||
b[23] = (byte)(in6 >> 16);
|
||||
b[24] = (byte)(in6 >> 24) + ((in7 >> 0) << 4);
|
||||
b[24] = (byte)((in6 >> 24) + ((in7 >> 0) << 4));
|
||||
b[25] = (byte)(in7 >> 4);
|
||||
b[26] = (byte)(in7 >> 12);
|
||||
b[27] = (byte)(in7 >> 20);
|
||||
b[28] = (byte)(in8 >> 0);
|
||||
b[29] = (byte)(in8 >> 8);
|
||||
b[30] = (byte)(in8 >> 16);
|
||||
b[31] = (byte)(in8 >> 24) + ((in9 >> 0) << 4);
|
||||
b[31] = (byte)((in8 >> 24) + ((in9 >> 0) << 4));
|
||||
b[32] = (byte)(in9 >> 4);
|
||||
b[33] = (byte)(in9 >> 12);
|
||||
b[34] = (byte)(in9 >> 20);
|
||||
b[35] = (byte)(in10 >> 0);
|
||||
b[36] = (byte)(in10 >> 8);
|
||||
b[37] = (byte)(in10 >> 16);
|
||||
b[38] = (byte)(in10 >> 24) + ((in11 >> 0) << 4);
|
||||
b[38] = (byte)((in10 >> 24) + ((in11 >> 0) << 4));
|
||||
b[39] = (byte)(in11 >> 4);
|
||||
b[40] = (byte)(in11 >> 12);
|
||||
b[41] = (byte)(in11 >> 20);
|
||||
b[42] = (byte)(in12 >> 0);
|
||||
b[43] = (byte)(in12 >> 8);
|
||||
b[44] = (byte)(in12 >> 16);
|
||||
b[45] = (byte)(in12 >> 24) + ((in13 >> 0) << 4);
|
||||
b[45] = (byte)((in12 >> 24) + ((in13 >> 0) << 4));
|
||||
b[46] = (byte)(in13 >> 4);
|
||||
b[47] = (byte)(in13 >> 12);
|
||||
b[48] = (byte)(in13 >> 20);
|
||||
b[49] = (byte)(in14 >> 0);
|
||||
b[50] = (byte)(in14 >> 8);
|
||||
b[51] = (byte)(in14 >> 16);
|
||||
b[52] = (byte)(in14 >> 24) + ((in15 >> 0) << 4);
|
||||
b[52] = (byte)((in14 >> 24) + ((in15 >> 0) << 4));
|
||||
b[53] = (byte)(in15 >> 4);
|
||||
b[54] = (byte)(in15 >> 12);
|
||||
b[55] = (byte)(in15 >> 20);
|
||||
|
@@ -58,24 +58,24 @@ t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
|
||||
Bounds on each t[i] vary depending on context.
|
||||
*/
|
||||
|
||||
word64 load_3(const unsigned char *in)
|
||||
sword64 load_3(const unsigned char *in)
|
||||
{
|
||||
word64 result;
|
||||
result = (word64) in[0];
|
||||
result |= ((word64) in[1]) << 8;
|
||||
result |= ((word64) in[2]) << 16;
|
||||
return result;
|
||||
return (sword64)result;
|
||||
}
|
||||
|
||||
|
||||
word64 load_4(const unsigned char *in)
|
||||
sword64 load_4(const unsigned char *in)
|
||||
{
|
||||
word64 result;
|
||||
result = (word64) in[0];
|
||||
result |= ((word64) in[1]) << 8;
|
||||
result |= ((word64) in[2]) << 16;
|
||||
result |= ((word64) in[3]) << 24;
|
||||
return result;
|
||||
return (sword64)result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -170,8 +170,8 @@ int curve25519(byte* q, const byte* n, const byte* p)
|
||||
#endif
|
||||
b &= 1;
|
||||
swap ^= b;
|
||||
fe_cswap(x2,x3,swap);
|
||||
fe_cswap(z2,z3,swap);
|
||||
fe_cswap(x2,x3,(int)swap);
|
||||
fe_cswap(z2,z3,(int)swap);
|
||||
swap = b;
|
||||
|
||||
/* montgomery */
|
||||
@@ -194,8 +194,8 @@ int curve25519(byte* q, const byte* n, const byte* p)
|
||||
fe_mul(z3,x1,z2);
|
||||
fe_mul(z2,tmp1,tmp0);
|
||||
}
|
||||
fe_cswap(x2,x3,swap);
|
||||
fe_cswap(z2,z3,swap);
|
||||
fe_cswap(x2,x3,(int)swap);
|
||||
fe_cswap(z2,z3,(int)swap);
|
||||
|
||||
fe_invert(z2,z2);
|
||||
fe_mul(x2,x2,z2);
|
||||
|
@@ -600,7 +600,7 @@ void fe_sq2(fe r, const fe a)
|
||||
* in An array of bytes.
|
||||
* returns a 64-bit word.
|
||||
*/
|
||||
word64 load_3(const unsigned char *in)
|
||||
sword64 load_3(const unsigned char *in)
|
||||
{
|
||||
word64 result;
|
||||
|
||||
@@ -608,7 +608,7 @@ word64 load_3(const unsigned char *in)
|
||||
(((word64)in[1]) << 8) |
|
||||
(((word64)in[2]) << 16));
|
||||
|
||||
return result;
|
||||
return (sword64)result;
|
||||
}
|
||||
|
||||
/* Load 4 little endian bytes into a 64-bit word.
|
||||
@@ -616,7 +616,7 @@ word64 load_3(const unsigned char *in)
|
||||
* in An array of bytes.
|
||||
* returns a 64-bit word.
|
||||
*/
|
||||
word64 load_4(const unsigned char *in)
|
||||
sword64 load_4(const unsigned char *in)
|
||||
{
|
||||
word64 result;
|
||||
|
||||
@@ -625,6 +625,6 @@ word64 load_4(const unsigned char *in)
|
||||
(((word64)in[2]) << 16) |
|
||||
(((word64)in[3]) << 24));
|
||||
|
||||
return result;
|
||||
return (sword64)result;
|
||||
}
|
||||
|
||||
|
@@ -5453,56 +5453,56 @@ void sc448_reduce(byte* b)
|
||||
b[ 0] = (byte)(d[0 ] >> 0);
|
||||
b[ 1] = (byte)(d[0 ] >> 8);
|
||||
b[ 2] = (byte)(d[0 ] >> 16);
|
||||
b[ 3] = (byte)(d[0 ] >> 24) + ((d[1 ] >> 0) << 4);
|
||||
b[ 3] = (byte)((d[0 ] >> 24) + ((d[1 ] >> 0) << 4));
|
||||
b[ 4] = (byte)(d[1 ] >> 4);
|
||||
b[ 5] = (byte)(d[1 ] >> 12);
|
||||
b[ 6] = (byte)(d[1 ] >> 20);
|
||||
b[ 7] = (byte)(d[2 ] >> 0);
|
||||
b[ 8] = (byte)(d[2 ] >> 8);
|
||||
b[ 9] = (byte)(d[2 ] >> 16);
|
||||
b[10] = (byte)(d[2 ] >> 24) + ((d[3 ] >> 0) << 4);
|
||||
b[10] = (byte)((d[2 ] >> 24) + ((d[3 ] >> 0) << 4));
|
||||
b[11] = (byte)(d[3 ] >> 4);
|
||||
b[12] = (byte)(d[3 ] >> 12);
|
||||
b[13] = (byte)(d[3 ] >> 20);
|
||||
b[14] = (byte)(d[4 ] >> 0);
|
||||
b[15] = (byte)(d[4 ] >> 8);
|
||||
b[16] = (byte)(d[4 ] >> 16);
|
||||
b[17] = (byte)(d[4 ] >> 24) + ((d[5 ] >> 0) << 4);
|
||||
b[17] = (byte)((d[4 ] >> 24) + ((d[5 ] >> 0) << 4));
|
||||
b[18] = (byte)(d[5 ] >> 4);
|
||||
b[19] = (byte)(d[5 ] >> 12);
|
||||
b[20] = (byte)(d[5 ] >> 20);
|
||||
b[21] = (byte)(d[6 ] >> 0);
|
||||
b[22] = (byte)(d[6 ] >> 8);
|
||||
b[23] = (byte)(d[6 ] >> 16);
|
||||
b[24] = (byte)(d[6 ] >> 24) + ((d[7 ] >> 0) << 4);
|
||||
b[24] = (byte)((d[6 ] >> 24) + ((d[7 ] >> 0) << 4));
|
||||
b[25] = (byte)(d[7 ] >> 4);
|
||||
b[26] = (byte)(d[7 ] >> 12);
|
||||
b[27] = (byte)(d[7 ] >> 20);
|
||||
b[28] = (byte)(d[8 ] >> 0);
|
||||
b[29] = (byte)(d[8 ] >> 8);
|
||||
b[30] = (byte)(d[8 ] >> 16);
|
||||
b[31] = (byte)(d[8 ] >> 24) + ((d[9 ] >> 0) << 4);
|
||||
b[31] = (byte)((d[8 ] >> 24) + ((d[9 ] >> 0) << 4));
|
||||
b[32] = (byte)(d[9 ] >> 4);
|
||||
b[33] = (byte)(d[9 ] >> 12);
|
||||
b[34] = (byte)(d[9 ] >> 20);
|
||||
b[35] = (byte)(d[10] >> 0);
|
||||
b[36] = (byte)(d[10] >> 8);
|
||||
b[37] = (byte)(d[10] >> 16);
|
||||
b[38] = (byte)(d[10] >> 24) + ((d[11] >> 0) << 4);
|
||||
b[38] = (byte)((d[10] >> 24) + ((d[11] >> 0) << 4));
|
||||
b[39] = (byte)(d[11] >> 4);
|
||||
b[40] = (byte)(d[11] >> 12);
|
||||
b[41] = (byte)(d[11] >> 20);
|
||||
b[42] = (byte)(d[12] >> 0);
|
||||
b[43] = (byte)(d[12] >> 8);
|
||||
b[44] = (byte)(d[12] >> 16);
|
||||
b[45] = (byte)(d[12] >> 24) + ((d[13] >> 0) << 4);
|
||||
b[45] = (byte)((d[12] >> 24) + ((d[13] >> 0) << 4));
|
||||
b[46] = (byte)(d[13] >> 4);
|
||||
b[47] = (byte)(d[13] >> 12);
|
||||
b[48] = (byte)(d[13] >> 20);
|
||||
b[49] = (byte)(d[14] >> 0);
|
||||
b[50] = (byte)(d[14] >> 8);
|
||||
b[51] = (byte)(d[14] >> 16);
|
||||
b[52] = (byte)(d[14] >> 24) + ((d[15] >> 0) << 4);
|
||||
b[52] = (byte)((d[14] >> 24) + ((d[15] >> 0) << 4));
|
||||
b[53] = (byte)(d[15] >> 4);
|
||||
b[54] = (byte)(d[15] >> 12);
|
||||
b[55] = (byte)(d[15] >> 20);
|
||||
@@ -6206,56 +6206,56 @@ void sc448_muladd(byte* r, const byte* a, const byte* b, const byte* d)
|
||||
r[ 0] = (byte)(rd[0 ] >> 0);
|
||||
r[ 1] = (byte)(rd[0 ] >> 8);
|
||||
r[ 2] = (byte)(rd[0 ] >> 16);
|
||||
r[ 3] = (byte)(rd[0 ] >> 24) + ((rd[1 ] >> 0) << 4);
|
||||
r[ 3] = (byte)((rd[0 ] >> 24) + ((rd[1 ] >> 0) << 4));
|
||||
r[ 4] = (byte)(rd[1 ] >> 4);
|
||||
r[ 5] = (byte)(rd[1 ] >> 12);
|
||||
r[ 6] = (byte)(rd[1 ] >> 20);
|
||||
r[ 7] = (byte)(rd[2 ] >> 0);
|
||||
r[ 8] = (byte)(rd[2 ] >> 8);
|
||||
r[ 9] = (byte)(rd[2 ] >> 16);
|
||||
r[10] = (byte)(rd[2 ] >> 24) + ((rd[3 ] >> 0) << 4);
|
||||
r[10] = (byte)((rd[2 ] >> 24) + ((rd[3 ] >> 0) << 4));
|
||||
r[11] = (byte)(rd[3 ] >> 4);
|
||||
r[12] = (byte)(rd[3 ] >> 12);
|
||||
r[13] = (byte)(rd[3 ] >> 20);
|
||||
r[14] = (byte)(rd[4 ] >> 0);
|
||||
r[15] = (byte)(rd[4 ] >> 8);
|
||||
r[16] = (byte)(rd[4 ] >> 16);
|
||||
r[17] = (byte)(rd[4 ] >> 24) + ((rd[5 ] >> 0) << 4);
|
||||
r[17] = (byte)((rd[4 ] >> 24) + ((rd[5 ] >> 0) << 4));
|
||||
r[18] = (byte)(rd[5 ] >> 4);
|
||||
r[19] = (byte)(rd[5 ] >> 12);
|
||||
r[20] = (byte)(rd[5 ] >> 20);
|
||||
r[21] = (byte)(rd[6 ] >> 0);
|
||||
r[22] = (byte)(rd[6 ] >> 8);
|
||||
r[23] = (byte)(rd[6 ] >> 16);
|
||||
r[24] = (byte)(rd[6 ] >> 24) + ((rd[7 ] >> 0) << 4);
|
||||
r[24] = (byte)((rd[6 ] >> 24) + ((rd[7 ] >> 0) << 4));
|
||||
r[25] = (byte)(rd[7 ] >> 4);
|
||||
r[26] = (byte)(rd[7 ] >> 12);
|
||||
r[27] = (byte)(rd[7 ] >> 20);
|
||||
r[28] = (byte)(rd[8 ] >> 0);
|
||||
r[29] = (byte)(rd[8 ] >> 8);
|
||||
r[30] = (byte)(rd[8 ] >> 16);
|
||||
r[31] = (byte)(rd[8 ] >> 24) + ((rd[9 ] >> 0) << 4);
|
||||
r[31] = (byte)((rd[8 ] >> 24) + ((rd[9 ] >> 0) << 4));
|
||||
r[32] = (byte)(rd[9 ] >> 4);
|
||||
r[33] = (byte)(rd[9 ] >> 12);
|
||||
r[34] = (byte)(rd[9 ] >> 20);
|
||||
r[35] = (byte)(rd[10] >> 0);
|
||||
r[36] = (byte)(rd[10] >> 8);
|
||||
r[37] = (byte)(rd[10] >> 16);
|
||||
r[38] = (byte)(rd[10] >> 24) + ((rd[11] >> 0) << 4);
|
||||
r[38] = (byte)((rd[10] >> 24) + ((rd[11] >> 0) << 4));
|
||||
r[39] = (byte)(rd[11] >> 4);
|
||||
r[40] = (byte)(rd[11] >> 12);
|
||||
r[41] = (byte)(rd[11] >> 20);
|
||||
r[42] = (byte)(rd[12] >> 0);
|
||||
r[43] = (byte)(rd[12] >> 8);
|
||||
r[44] = (byte)(rd[12] >> 16);
|
||||
r[45] = (byte)(rd[12] >> 24) + ((rd[13] >> 0) << 4);
|
||||
r[45] = (byte)((rd[12] >> 24) + ((rd[13] >> 0) << 4));
|
||||
r[46] = (byte)(rd[13] >> 4);
|
||||
r[47] = (byte)(rd[13] >> 12);
|
||||
r[48] = (byte)(rd[13] >> 20);
|
||||
r[49] = (byte)(rd[14] >> 0);
|
||||
r[50] = (byte)(rd[14] >> 8);
|
||||
r[51] = (byte)(rd[14] >> 16);
|
||||
r[52] = (byte)(rd[14] >> 24) + ((rd[15] >> 0) << 4);
|
||||
r[52] = (byte)((rd[14] >> 24) + ((rd[15] >> 0) << 4));
|
||||
r[53] = (byte)(rd[15] >> 4);
|
||||
r[54] = (byte)(rd[15] >> 12);
|
||||
r[55] = (byte)(rd[15] >> 20);
|
||||
|
@@ -116,8 +116,8 @@ WOLFSSL_LOCAL void fe_cmov(fe f, const fe g, int b);
|
||||
WOLFSSL_LOCAL void fe_pow22523(fe out,const fe z);
|
||||
|
||||
/* 64 type needed for SHA512 */
|
||||
WOLFSSL_LOCAL word64 load_3(const unsigned char *in);
|
||||
WOLFSSL_LOCAL word64 load_4(const unsigned char *in);
|
||||
WOLFSSL_LOCAL sword64 load_3(const unsigned char *in);
|
||||
WOLFSSL_LOCAL sword64 load_4(const unsigned char *in);
|
||||
|
||||
#ifdef CURVED25519_ASM
|
||||
WOLFSSL_LOCAL void fe_cmov_table(fe* r, fe* base, signed char b);
|
||||
|
Reference in New Issue
Block a user