SAKKE: fix configurations

Fix position of sp_1024_norm_18 now that div requires it:
./configure --disable-shared --enable-sakke --disable-eccsi
--enable-sp
Fix missing '{' in sp_mulmod_table_1024:
./configure --disable-shared --enable-sakke --enable-eccsi
--enable-smallstack  --enable-sp
This commit is contained in:
Sean Parkinson
2021-06-24 14:01:27 +10:00
parent 92a4e30b69
commit 2fb6a9eacf
7 changed files with 63 additions and 63 deletions

View File

@ -59328,7 +59328,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {

View File

@ -73444,7 +73444,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {

View File

@ -40891,7 +40891,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {

View File

@ -27728,6 +27728,34 @@ static const sp_point_1024 p1024_base = {
0
};
/* Normalize the values in each word to 25.
*
* a Array of sp_digit to normalize.
*/
static void sp_1024_norm_42(sp_digit* a)
{
#ifdef WOLFSSL_SP_SMALL
int i;
for (i = 0; i < 41; i++) {
a[i+1] += a[i] >> 25;
a[i] &= 0x1ffffff;
}
#else
int i;
for (i = 0; i < 40; i += 8) {
a[i+1] += a[i+0] >> 25; a[i+0] &= 0x1ffffff;
a[i+2] += a[i+1] >> 25; a[i+1] &= 0x1ffffff;
a[i+3] += a[i+2] >> 25; a[i+2] &= 0x1ffffff;
a[i+4] += a[i+3] >> 25; a[i+3] &= 0x1ffffff;
a[i+5] += a[i+4] >> 25; a[i+4] &= 0x1ffffff;
a[i+6] += a[i+5] >> 25; a[i+5] &= 0x1ffffff;
a[i+7] += a[i+6] >> 25; a[i+6] &= 0x1ffffff;
a[i+8] += a[i+7] >> 25; a[i+7] &= 0x1ffffff;
}
a[40+1] += a[40] >> 25; a[40] &= 0x1ffffff;
#endif
}
/* Multiply a by scalar b into r. (r = a * b)
*
* r A single precision integer.
@ -28400,34 +28428,6 @@ SP_NOINLINE static void sp_1024_mul_add_42(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
/* Normalize the values in each word to 25.
*
* a Array of sp_digit to normalize.
*/
static void sp_1024_norm_42(sp_digit* a)
{
#ifdef WOLFSSL_SP_SMALL
int i;
for (i = 0; i < 41; i++) {
a[i+1] += a[i] >> 25;
a[i] &= 0x1ffffff;
}
#else
int i;
for (i = 0; i < 40; i += 8) {
a[i+1] += a[i+0] >> 25; a[i+0] &= 0x1ffffff;
a[i+2] += a[i+1] >> 25; a[i+1] &= 0x1ffffff;
a[i+3] += a[i+2] >> 25; a[i+2] &= 0x1ffffff;
a[i+4] += a[i+3] >> 25; a[i+3] &= 0x1ffffff;
a[i+5] += a[i+4] >> 25; a[i+4] &= 0x1ffffff;
a[i+6] += a[i+5] >> 25; a[i+5] &= 0x1ffffff;
a[i+7] += a[i+6] >> 25; a[i+6] &= 0x1ffffff;
a[i+8] += a[i+7] >> 25; a[i+7] &= 0x1ffffff;
}
a[40+1] += a[40] >> 25; a[40] &= 0x1ffffff;
#endif
}
/* Shift the result in the high 1024 bits down to the bottom.
*
* r A single precision number.
@ -34760,7 +34760,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {

View File

@ -26865,6 +26865,34 @@ static const sp_point_1024 p1024_base = {
0
};
/* Normalize the values in each word to 57.
*
* a Array of sp_digit to normalize.
*/
static void sp_1024_norm_18(sp_digit* a)
{
#ifdef WOLFSSL_SP_SMALL
int i;
for (i = 0; i < 17; i++) {
a[i+1] += a[i] >> 57;
a[i] &= 0x1ffffffffffffffL;
}
#else
int i;
for (i = 0; i < 16; i += 8) {
a[i+1] += a[i+0] >> 57; a[i+0] &= 0x1ffffffffffffffL;
a[i+2] += a[i+1] >> 57; a[i+1] &= 0x1ffffffffffffffL;
a[i+3] += a[i+2] >> 57; a[i+2] &= 0x1ffffffffffffffL;
a[i+4] += a[i+3] >> 57; a[i+3] &= 0x1ffffffffffffffL;
a[i+5] += a[i+4] >> 57; a[i+4] &= 0x1ffffffffffffffL;
a[i+6] += a[i+5] >> 57; a[i+5] &= 0x1ffffffffffffffL;
a[i+7] += a[i+6] >> 57; a[i+6] &= 0x1ffffffffffffffL;
a[i+8] += a[i+7] >> 57; a[i+7] &= 0x1ffffffffffffffL;
}
a[16+1] += a[16] >> 57; a[16] &= 0x1ffffffffffffffL;
#endif
}
/* Multiply a by scalar b into r. (r = a * b)
*
* r A single precision integer.
@ -27576,34 +27604,6 @@ SP_NOINLINE static void sp_1024_mul_add_18(sp_digit* r, const sp_digit* a,
#endif /* WOLFSSL_SP_SMALL */
}
/* Normalize the values in each word to 57.
*
* a Array of sp_digit to normalize.
*/
static void sp_1024_norm_18(sp_digit* a)
{
#ifdef WOLFSSL_SP_SMALL
int i;
for (i = 0; i < 17; i++) {
a[i+1] += a[i] >> 57;
a[i] &= 0x1ffffffffffffffL;
}
#else
int i;
for (i = 0; i < 16; i += 8) {
a[i+1] += a[i+0] >> 57; a[i+0] &= 0x1ffffffffffffffL;
a[i+2] += a[i+1] >> 57; a[i+1] &= 0x1ffffffffffffffL;
a[i+3] += a[i+2] >> 57; a[i+2] &= 0x1ffffffffffffffL;
a[i+4] += a[i+3] >> 57; a[i+3] &= 0x1ffffffffffffffL;
a[i+5] += a[i+4] >> 57; a[i+4] &= 0x1ffffffffffffffL;
a[i+6] += a[i+5] >> 57; a[i+5] &= 0x1ffffffffffffffL;
a[i+7] += a[i+6] >> 57; a[i+6] &= 0x1ffffffffffffffL;
a[i+8] += a[i+7] >> 57; a[i+7] &= 0x1ffffffffffffffL;
}
a[16+1] += a[16] >> 57; a[16] &= 0x1ffffffffffffffL;
#endif
}
/* Shift the result in the high 1024 bits down to the bottom.
*
* r A single precision number.
@ -33348,7 +33348,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {

View File

@ -38730,7 +38730,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {

View File

@ -56765,7 +56765,7 @@ int sp_ecc_mulmod_table_1024(const mp_int* km, const ecc_point* gm, byte* table,
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_SP_NO_MALLOC)
point = (sp_point_1024*)XMALLOC(sizeof(sp_point_1024), heap,
DYNAMIC_TYPE_ECC);
if (point == NULL)
if (point == NULL) {
err = MEMORY_E;
}
if (err == MP_OKAY) {