exclude wolfSSL_EC_POINT_point2hex() in CAVP selftest build

pull/1939/head
Chris Conlon 2018-11-27 08:47:15 -08:00
parent 55bbffe3c6
commit a5e3b18252
3 changed files with 16 additions and 1 deletions

View File

@ -26974,6 +26974,9 @@ int wolfSSL_EC_KEY_set_public_key(WOLFSSL_EC_KEY *key,
/* End EC_KEY */
#ifndef HAVE_SELFTEST
/* ECC point compression types were not included in selftest ecc.h */
char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group,
const WOLFSSL_EC_POINT* point, int form,
WOLFSSL_BN_CTX* ctx)
@ -27031,6 +27034,8 @@ char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group,
return hex;
}
#endif /* HAVE_SELFTEST */
void wolfSSL_EC_POINT_dump(const char *msg, const WOLFSSL_EC_POINT *p)
{
#if defined(DEBUG_WOLFSSL)

View File

@ -1431,8 +1431,11 @@ static void test_wolfSSL_EC(void)
/* NISTP256R1 Gx/Gy */
const char* kGx = "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
const char* kGy = "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
#ifndef HAVE_SELFTEST
const char* uncompG = "046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
const char* compG = "036B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
#endif
AssertNotNull(ctx = BN_CTX_new());
AssertNotNull(group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1));
@ -1489,6 +1492,7 @@ static void test_wolfSSL_EC(void)
#endif
XFREE(hexStr, NULL, DYNAMIC_TYPE_ECC);
#ifndef HAVE_SELFTEST
hexStr = EC_POINT_point2hex(group, Gxy, POINT_CONVERSION_UNCOMPRESSED, ctx);
AssertStrEQ(hexStr, uncompG);
XFREE(hexStr, NULL, DYNAMIC_TYPE_ECC);
@ -1496,6 +1500,7 @@ static void test_wolfSSL_EC(void)
hexStr = EC_POINT_point2hex(group, Gxy, POINT_CONVERSION_COMPRESSED, ctx);
AssertStrEQ(hexStr, compG);
XFREE(hexStr, NULL, DYNAMIC_TYPE_ECC);
#endif
/* cleanup */
BN_free(X);

View File

@ -184,10 +184,12 @@ WOLFSSL_API
int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group,
const WOLFSSL_EC_POINT *a);
#ifndef HAVE_SELFTEST
WOLFSSL_API
char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group,
const WOLFSSL_EC_POINT* point, int form,
WOLFSSL_BN_CTX* ctx);
#endif
#define EC_KEY_new wolfSSL_EC_KEY_new
#define EC_KEY_free wolfSSL_EC_KEY_free
@ -218,7 +220,10 @@ char* wolfSSL_EC_POINT_point2hex(const WOLFSSL_EC_GROUP* group,
#define EC_POINT_cmp wolfSSL_EC_POINT_cmp
#define EC_POINT_is_at_infinity wolfSSL_EC_POINT_is_at_infinity
#define EC_POINT_point2hex wolfSSL_EC_POINT_point2hex
#ifndef HAVE_SELFTEST
#define EC_POINT_point2hex wolfSSL_EC_POINT_point2hex
#endif
#define EC_POINT_dump wolfSSL_EC_POINT_dump
#ifdef __cplusplus