mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
SP ARM: big-endian support
Handle reading and writing from big-endian byte array when compiling for big endian. Rework little endian to be more effiecient too.
This commit is contained in:
@ -93,7 +93,8 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -104,12 +105,20 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -18287,7 +18296,8 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -18298,12 +18308,20 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -45799,7 +45817,8 @@ static void sp_4096_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -45810,12 +45829,20 @@ static void sp_4096_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -76443,7 +76470,8 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -76454,12 +76482,20 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -94227,7 +94263,8 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -94238,12 +94275,20 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -122000,7 +122045,8 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -122011,12 +122057,20 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -156650,7 +156704,8 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -156661,12 +156716,20 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,8 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -104,12 +105,20 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -30275,7 +30284,8 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -30286,12 +30296,20 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -83360,7 +83378,8 @@ static void sp_4096_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -83371,12 +83390,20 @@ static void sp_4096_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -103895,7 +103922,8 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -103906,12 +103934,20 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -114795,7 +114831,8 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -114806,12 +114843,20 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -129028,7 +129073,8 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -129039,12 +129085,20 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -218462,7 +218516,8 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -218473,12 +218528,20 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,8 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -104,12 +105,20 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -9969,7 +9978,8 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -9980,12 +9990,20 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -22828,7 +22846,8 @@ static void sp_4096_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -22839,12 +22858,20 @@ static void sp_4096_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -39426,7 +39453,8 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -39437,12 +39465,20 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -49489,7 +49525,8 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -49500,12 +49537,20 @@ static void sp_384_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -62251,7 +62296,8 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -62262,12 +62308,20 @@ static void sp_521_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
@ -81790,7 +81844,8 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
int j;
|
||||
byte* d;
|
||||
|
||||
for (i = n - 1,j = 0; i >= 3; i -= 4) {
|
||||
j = 0;
|
||||
for (i = n - 1; i >= 3; i -= 4) {
|
||||
r[j] = ((sp_digit)a[i - 0] << 0) |
|
||||
((sp_digit)a[i - 1] << 8) |
|
||||
((sp_digit)a[i - 2] << 16) |
|
||||
@ -81801,12 +81856,20 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
|
||||
if (i >= 0) {
|
||||
r[j] = 0;
|
||||
|
||||
d = (byte*)r;
|
||||
d = (byte*)(r + j);
|
||||
#ifdef BIG_ENDIAN_ORDER
|
||||
switch (i) {
|
||||
case 2: d[n - 1 - 2] = a[2]; //fallthrough
|
||||
case 1: d[n - 1 - 1] = a[1]; //fallthrough
|
||||
case 0: d[n - 1 - 0] = a[0]; //fallthrough
|
||||
case 2: d[1] = *(a++); //fallthrough
|
||||
case 1: d[2] = *(a++); //fallthrough
|
||||
case 0: d[3] = *a ; //fallthrough
|
||||
}
|
||||
#else
|
||||
switch (i) {
|
||||
case 2: d[2] = a[2]; //fallthrough
|
||||
case 1: d[1] = a[1]; //fallthrough
|
||||
case 0: d[0] = a[0]; //fallthrough
|
||||
}
|
||||
#endif
|
||||
j++;
|
||||
}
|
||||
|
||||
|
@ -471,14 +471,16 @@ const char *wc_GetMathInfo(void)
|
||||
#elif defined(WOLFSSL_HAVE_SP_DH)
|
||||
" dh"
|
||||
#endif
|
||||
#ifndef WOLFSSL_SP_NO_2048
|
||||
" 2048"
|
||||
#endif
|
||||
#ifndef WOLFSSL_SP_NO_3072
|
||||
" 3072"
|
||||
#endif
|
||||
#ifdef WOLFSSL_SP_4096
|
||||
" 4096"
|
||||
#if defined(WOLFSSL_HAVE_SP_RSA) || defined(WOLFSSL_HAVE_SP_DH)
|
||||
#ifndef WOLFSSL_SP_NO_2048
|
||||
" 2048"
|
||||
#endif
|
||||
#ifndef WOLFSSL_SP_NO_3072
|
||||
" 3072"
|
||||
#endif
|
||||
#ifdef WOLFSSL_SP_4096
|
||||
" 4096"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_SP_ASM
|
||||
" asm"
|
||||
|
Reference in New Issue
Block a user