diff --git a/tests/api.c b/tests/api.c index dafd06aeb..f5ebe1fdb 100644 --- a/tests/api.c +++ b/tests/api.c @@ -16859,8 +16859,6 @@ static int test_wc_RsaKeyToPublicDer (void) } } - #if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \ - (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION != 2))) if (ret == 0) { /* test getting size only */ ret = wc_RsaKeyToPublicDer_ex(&key, NULL, derLen, 0); @@ -16875,7 +16873,6 @@ static int test_wc_RsaKeyToPublicDer (void) ret = WOLFSSL_FATAL_ERROR; } } - #endif #ifndef HAVE_USER_RSA /* Pass in bad args. */ diff --git a/wolfssl/wolfcrypt/asn_public.h b/wolfssl/wolfcrypt/asn_public.h index 695d48c3d..e359bf1b6 100644 --- a/wolfssl/wolfcrypt/asn_public.h +++ b/wolfssl/wolfcrypt/asn_public.h @@ -521,8 +521,15 @@ WOLFSSL_API void wc_FreeDer(DerBuffer** pDer); #if !defined(HAVE_USER_RSA) WOLFSSL_API int wc_RsaPublicKeyDecode_ex(const byte* input, word32* inOutIdx, word32 inSz, const byte** n, word32* nSz, const byte** e, word32* eSz); + /* For FIPS v1/v2 and selftest this is in rsa.h */ + #if !defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || \ + (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION > 2))) + WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen); + #endif #endif WOLFSSL_API int wc_RsaPublicKeyDerSize(RsaKey* key, int with_header); + WOLFSSL_API int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen, + int with_header); #endif #ifndef NO_DSA diff --git a/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfcrypt/rsa.h index 0d724e0c0..c905e082f 100644 --- a/wolfssl/wolfcrypt/rsa.h +++ b/wolfssl/wolfcrypt/rsa.h @@ -214,7 +214,7 @@ struct RsaKey { #define WC_RSAKEY_TYPE_DEFINED #endif -#endif /*HAVE_FIPS */ +#endif /* HAVE_FIPS */ WOLFSSL_API int wc_InitRsaKey(RsaKey* key, void* heap); WOLFSSL_API int wc_InitRsaKey_ex(RsaKey* key, void* heap, int devId); @@ -355,10 +355,6 @@ WOLFSSL_API int wc_RsaExportKey(RsaKey* key, byte* p, word32* pSz, byte* q, word32* qSz); -WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen); -WOLFSSL_API int wc_RsaKeyToPublicDer_ex(RsaKey* key, byte* output, word32 inLen, - int with_header); - #ifdef WOLFSSL_KEY_GEN WOLFSSL_API int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng); WOLFSSL_API int wc_CheckProbablePrime_ex(const byte* p, word32 pSz,