mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-05 13:24:12 +02:00
Minimal implementation of MP when using SP.
--enable-sp-math to include minimal implementation of MP (only with --enable-sp.) Add futher functionality for ECC (conditionally compiled): - check key - is point on curve - API to add and double projective points - API to map from project to affine - Uncompress point (including sqrt) Some configuration options will not work with SP math - configure.ac detects this and errors out. Change test code to better support SP sizes only.
This commit is contained in:
@@ -9640,6 +9640,7 @@ static int dh_generate_test(WC_RNG *rng)
|
||||
DhKey smallKey;
|
||||
byte p[2] = { 0, 5 };
|
||||
byte g[2] = { 0, 2 };
|
||||
#ifndef WOLFSSL_SP_MATH
|
||||
#ifdef WOLFSSL_DH_CONST
|
||||
/* the table for constant DH lookup will round to the lowest byte size 21 */
|
||||
byte priv[21];
|
||||
@@ -9650,6 +9651,7 @@ static int dh_generate_test(WC_RNG *rng)
|
||||
#endif
|
||||
word32 privSz = sizeof(priv);
|
||||
word32 pubSz = sizeof(pub);
|
||||
#endif
|
||||
|
||||
ret = wc_InitDhKey_ex(&smallKey, HEAP_HINT, devId);
|
||||
if (ret != 0)
|
||||
@@ -9681,6 +9683,7 @@ static int dh_generate_test(WC_RNG *rng)
|
||||
ERROR_OUT(-5706, exit_gen_test);
|
||||
}
|
||||
|
||||
#ifndef WOLFSSL_SP_MATH
|
||||
/* Use API. */
|
||||
ret = wc_DhGenerateKeyPair(&smallKey, rng, priv, &privSz, pub, &pubSz);
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
@@ -9689,6 +9692,10 @@ static int dh_generate_test(WC_RNG *rng)
|
||||
if (ret != 0) {
|
||||
ret = -5707;
|
||||
}
|
||||
#else
|
||||
(void)rng;
|
||||
ret = 0;
|
||||
#endif
|
||||
|
||||
exit_gen_test:
|
||||
wc_FreeDhKey(&smallKey);
|
||||
@@ -14087,7 +14094,9 @@ static int ecc_test_cert_gen(WC_RNG* rng)
|
||||
}
|
||||
bytes = fread(der, 1, FOURK_BUF, file);
|
||||
fclose(file);
|
||||
#ifdef ENABLE_ECC384_CERT_GEN_TEST
|
||||
(void)eccCaKey384File;
|
||||
#endif
|
||||
#endif /* USE_CERT_BUFFERS_256 */
|
||||
#endif /* ENABLE_ECC384_CERT_GEN_TEST */
|
||||
|
||||
@@ -14165,8 +14174,10 @@ static int ecc_test_cert_gen(WC_RNG* rng)
|
||||
sizeof_ca_ecc_cert_der_256);
|
||||
#else
|
||||
ret = wc_SetIssuer(&myCert, eccCaCertFile);
|
||||
#ifdef ENABLE_ECC384_CERT_GEN_TEST
|
||||
(void)eccCaCert384File;
|
||||
#endif
|
||||
#endif
|
||||
#endif /* ENABLE_ECC384_CERT_GEN_TEST */
|
||||
if (ret < 0) {
|
||||
ERROR_OUT(-6731, exit);
|
||||
|
||||
Reference in New Issue
Block a user