forked from wolfSSL/wolfssl
Fixed typo with WOLFSSL_VALIDATE_ECC_IMPORT defined. Disable ECC-224 bit compressed key test since it isn't working. Cleanup in accel_fp_mul for KB_SIZE.
This commit is contained in:
@@ -2886,7 +2886,7 @@ static int ecc_check_privkey_gen_helper(ecc_key* key)
|
|||||||
|
|
||||||
err = mp_read_radix(&prime, (char*)key->dp->prime, 16);
|
err = mp_read_radix(&prime, (char*)key->dp->prime, 16);
|
||||||
|
|
||||||
if (err == MP_OKAY);
|
if (err == MP_OKAY)
|
||||||
err = ecc_check_privkey_gen(key, &prime);
|
err = ecc_check_privkey_gen(key, &prime);
|
||||||
|
|
||||||
mp_clear(&prime);
|
mp_clear(&prime);
|
||||||
@@ -4124,7 +4124,7 @@ static int accel_fp_mul(int idx, mp_int* k, ecc_point *R, mp_int* modulus,
|
|||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
unsigned char* kb;
|
unsigned char* kb;
|
||||||
#else
|
#else
|
||||||
unsigned char kb[128];
|
unsigned char kb[KB_SIZE];
|
||||||
#endif
|
#endif
|
||||||
int x;
|
int x;
|
||||||
unsigned y, z, err, bitlen, bitpos, lut_gap, first;
|
unsigned y, z, err, bitlen, bitpos, lut_gap, first;
|
||||||
@@ -4280,7 +4280,7 @@ static int accel_fp_mul2add(int idx1, int idx2,
|
|||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
unsigned char* kb[2];
|
unsigned char* kb[2];
|
||||||
#else
|
#else
|
||||||
unsigned char kb[2][128];
|
unsigned char kb[2][KB_SIZE];
|
||||||
#endif
|
#endif
|
||||||
int x;
|
int x;
|
||||||
unsigned y, z, err, bitlen, bitpos, lut_gap, first, zA, zB;
|
unsigned y, z, err, bitlen, bitpos, lut_gap, first, zA, zB;
|
||||||
|
@@ -6499,7 +6499,8 @@ static int ecc_test_key_gen(WC_RNG* rng, int keySize)
|
|||||||
}
|
}
|
||||||
#endif /* WOLFSSL_KEY_GEN */
|
#endif /* WOLFSSL_KEY_GEN */
|
||||||
|
|
||||||
static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount)
|
static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount,
|
||||||
|
int testCompressedKey)
|
||||||
{
|
{
|
||||||
#ifdef BENCH_EMBEDDED
|
#ifdef BENCH_EMBEDDED
|
||||||
byte sharedA[32];
|
byte sharedA[32];
|
||||||
@@ -6579,6 +6580,7 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount)
|
|||||||
return -1009;
|
return -1009;
|
||||||
#endif /* HAVE_ECC_DHE */
|
#endif /* HAVE_ECC_DHE */
|
||||||
|
|
||||||
|
if (testCompressedKey) {
|
||||||
#ifdef HAVE_COMP_KEY
|
#ifdef HAVE_COMP_KEY
|
||||||
/* try compressed export / import too */
|
/* try compressed export / import too */
|
||||||
x = sizeof(exportBuf);
|
x = sizeof(exportBuf);
|
||||||
@@ -6603,6 +6605,7 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount)
|
|||||||
return -1013;
|
return -1013;
|
||||||
#endif /* HAVE_ECC_DHE */
|
#endif /* HAVE_ECC_DHE */
|
||||||
#endif /* HAVE_COMP_KEY */
|
#endif /* HAVE_COMP_KEY */
|
||||||
|
}
|
||||||
#endif /* HAVE_ECC_KEY_IMPORT */
|
#endif /* HAVE_ECC_KEY_IMPORT */
|
||||||
#endif /* HAVE_ECC_KEY_EXPORT */
|
#endif /* HAVE_ECC_KEY_EXPORT */
|
||||||
|
|
||||||
@@ -6670,9 +6673,15 @@ static int ecc_test_curve_size(WC_RNG* rng, int keySize, int testVerifyCount)
|
|||||||
#define ECC_TEST_VERIFY_COUNT 2
|
#define ECC_TEST_VERIFY_COUNT 2
|
||||||
static int ecc_test_curve(WC_RNG* rng, int keySize)
|
static int ecc_test_curve(WC_RNG* rng, int keySize)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, testCompressedKey = 1;
|
||||||
|
|
||||||
ret = ecc_test_curve_size(rng, keySize, ECC_TEST_VERIFY_COUNT);
|
/* At this time, ECC 224-bit does not work with compressed key */
|
||||||
|
if (keySize == 28) {
|
||||||
|
testCompressedKey = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ecc_test_curve_size(rng, keySize, ECC_TEST_VERIFY_COUNT,
|
||||||
|
testCompressedKey);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user