From a5e3b1825236c9ca7f7c23c80195b788127c55eb Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Tue, 27 Nov 2018 08:47:15 -0800 Subject: [PATCH] exclude wolfSSL_EC_POINT_point2hex() in CAVP selftest build --- src/ssl.c | 5 +++++ tests/api.c | 5 +++++ wolfssl/openssl/ec.h | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ssl.c b/src/ssl.c index b1ab49f7a..16f95c1d9 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -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) diff --git a/tests/api.c b/tests/api.c index 33dfd45a8..f82c9ef2e 100644 --- a/tests/api.c +++ b/tests/api.c @@ -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); diff --git a/wolfssl/openssl/ec.h b/wolfssl/openssl/ec.h index 44d76706e..06bd81f5c 100644 --- a/wolfssl/openssl/ec.h +++ b/wolfssl/openssl/ec.h @@ -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