mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Test fixes
This commit is contained in:
26
src/ssl.c
26
src/ssl.c
@ -36359,7 +36359,9 @@ size_t wolfSSL_EC_POINT_point2oct(const WOLFSSL_EC_GROUP *group,
|
||||
byte *buf, size_t len, WOLFSSL_BN_CTX *ctx)
|
||||
{
|
||||
word32 min_len = (word32)len;
|
||||
#ifndef HAVE_SELFTEST
|
||||
int compressed = form == POINT_CONVERSION_COMPRESSED ? 1 : 0;
|
||||
#endif /* !HAVE_SELFTEST */
|
||||
|
||||
WOLFSSL_ENTER("EC_POINT_point2oct");
|
||||
|
||||
@ -36383,15 +36385,26 @@ size_t wolfSSL_EC_POINT_point2oct(const WOLFSSL_EC_GROUP *group,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (form != POINT_CONVERSION_UNCOMPRESSED && form != POINT_CONVERSION_COMPRESSED) {
|
||||
WOLFSSL_MSG("Only POINT_CONVERSION_UNCOMPRESSED or POINT_CONVERSION_COMPRESSED are supported");
|
||||
if (form != POINT_CONVERSION_UNCOMPRESSED
|
||||
#ifndef HAVE_SELFTEST
|
||||
&& form != POINT_CONVERSION_COMPRESSED
|
||||
#endif /* !HAVE_SELFTEST */
|
||||
) {
|
||||
WOLFSSL_MSG("Unsupported curve form");
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SELFTEST
|
||||
if (wc_ecc_export_point_der_ex(group->curve_idx, (ecc_point*)p->internal,
|
||||
buf, &min_len, compressed) != (buf ? MP_OKAY : LENGTH_ONLY_E)) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
#else
|
||||
if (wc_ecc_export_point_der(group->curve_idx, (ecc_point*)p->internal,
|
||||
buf, &min_len) != (buf ? MP_OKAY : LENGTH_ONLY_E)) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
#endif /* !HAVE_SELFTEST */
|
||||
|
||||
(void)ctx;
|
||||
|
||||
@ -36636,7 +36649,7 @@ int wolfSSL_EC_POINT_set_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group,
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
|
||||
#if !defined(WOLFSSL_ATECC508A) && defined(ECC_SHAMIR)
|
||||
#if !defined(WOLFSSL_ATECC508A) && defined(ECC_SHAMIR) && !defined(HAVE_SELFTEST)
|
||||
/* Calculate the value: generator * n + q * m
|
||||
* return code compliant with OpenSSL :
|
||||
* 1 if success, 0 if error
|
||||
@ -36740,7 +36753,8 @@ cleanup:
|
||||
wc_ecc_del_point(result);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* !defined(WOLFSSL_ATECC508A) && defined(ECC_SHAMIR) &&
|
||||
* !defined(HAVE_SELFTEST) */
|
||||
|
||||
void wolfSSL_EC_POINT_clear_free(WOLFSSL_EC_POINT *p)
|
||||
{
|
||||
@ -48868,7 +48882,7 @@ int wolfSSL_RSA_private_decrypt(int len, const unsigned char* fr,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(HAVE_FIPS)
|
||||
#if !defined(_WIN32) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)
|
||||
int wolfSSL_RSA_public_decrypt(int flen, const unsigned char* from,
|
||||
unsigned char* to, WOLFSSL_RSA* rsa, int padding)
|
||||
{
|
||||
@ -48920,7 +48934,7 @@ int wolfSSL_RSA_public_decrypt(int flen, const unsigned char* from,
|
||||
}
|
||||
return tlen;
|
||||
}
|
||||
#endif /* !defined(_WIN32) && !defined(HAVE_FIPS) */
|
||||
#endif /* !defined(_WIN32) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) */
|
||||
|
||||
/* RSA private encrypt calls wc_RsaSSL_Sign. Similar function set up as RSA
|
||||
* public decrypt.
|
||||
|
12
tests/api.c
12
tests/api.c
@ -1798,8 +1798,6 @@ static void test_wolfSSL_EC(void)
|
||||
BIGNUM *set_point_bn;
|
||||
char* hexStr;
|
||||
int group_bits;
|
||||
size_t bin_len;
|
||||
unsigned char* buf = NULL;
|
||||
|
||||
const char* kTest = "F4F8338AFCC562C5C3F3E1E46A7EFECD17AF381913FF7A96314EA47055EA0FD0";
|
||||
/* NISTP256R1 Gx/Gy */
|
||||
@ -1808,6 +1806,8 @@ static void test_wolfSSL_EC(void)
|
||||
|
||||
#ifndef HAVE_SELFTEST
|
||||
EC_POINT *tmp;
|
||||
size_t bin_len;
|
||||
unsigned char* buf = NULL;
|
||||
|
||||
const char* uncompG = "046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
|
||||
const unsigned char binUncompG[] = {
|
||||
@ -1850,11 +1850,15 @@ static void test_wolfSSL_EC(void)
|
||||
Gxy->Y = Gy;
|
||||
Gxy->Z = Gz;
|
||||
|
||||
#ifndef HAVE_SELFTEST
|
||||
/* perform point multiplication */
|
||||
AssertIntEQ(EC_POINT_mul(group, new_point, NULL, Gxy, k, ctx), WOLFSSL_SUCCESS);
|
||||
#else
|
||||
AssertIntEQ(EC_POINT_set_affine_coordinates_GFp(group, new_point, Gx, Gy, ctx), WOLFSSL_SUCCESS);
|
||||
#endif
|
||||
|
||||
/* check if point X coordinate is zero */
|
||||
AssertIntEQ(BN_is_zero(new_point->X), WOLFSSL_FAILURE);
|
||||
AssertIntEQ(BN_is_zero(new_point->X), 0);
|
||||
|
||||
/* Force non-affine coordinates */
|
||||
AssertIntEQ(BN_add(new_point->Z, (WOLFSSL_BIGNUM*)BN_value_one(),
|
||||
@ -29218,7 +29222,7 @@ static void test_wolfSSL_EVP_PKEY_encrypt(void)
|
||||
static void test_wolfSSL_EVP_PKEY_sign(void)
|
||||
{
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_RSA) && defined(WOLFSSL_KEY_GEN) && \
|
||||
!defined(HAVE_FAST_RSA)
|
||||
!defined(HAVE_FAST_RSA) && !defined(HAVE_SELFTEST)
|
||||
WOLFSSL_RSA* rsa = NULL;
|
||||
WOLFSSL_EVP_PKEY* pkey = NULL;
|
||||
WOLFSSL_EVP_PKEY_CTX* ctx = NULL;
|
||||
|
Reference in New Issue
Block a user