diff --git a/configure.ac b/configure.ac index 7c6384b42..db814ee53 100644 --- a/configure.ac +++ b/configure.ac @@ -3060,6 +3060,7 @@ then AM_CFLAGS="-DOPENSSL_ALL $AM_CFLAGS" fi AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASIO -DASIO_USE_WOLFSSL -DWOLFSSL_KEY_GEN" + AM_CFLAGS="$AM_CFLAGS -DBOOST_ASIO_USE_WOLFSSL" AM_CFLAGS="$AM_CFLAGS -DSSL_TXT_TLSV1_2 -DSSL_TXT_TLSV1_1" AM_CFLAGS="$AM_CFLAGS -DOPENSSL_NO_SSL2 -DOPENSSL_NO_SSL3" if test "$ENABLED_TLSV10" = "yes" diff --git a/src/ssl.c b/src/ssl.c index 7ff740783..ececd2c7e 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -28060,12 +28060,11 @@ WOLFSSL_RSA *wolfSSL_d2i_RSAPrivateKey(WOLFSSL_RSA **r, } #if !defined(HAVE_FAST_RSA) -#if defined(WOLFSSL_KEY_GEN) - /* Converts an internal rsa structure to der format. Returns size of der on success and WOLFSSL_FAILURE if error */ int wolfSSL_i2d_RSAPrivateKey(WOLFSSL_RSA *rsa, unsigned char **pp) { +#if defined(WOLFSSL_KEY_GEN) byte* der = NULL; int derMax; int ret; @@ -28113,8 +28112,13 @@ int wolfSSL_i2d_RSAPrivateKey(WOLFSSL_RSA *rsa, unsigned char **pp) XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER); return ret; /* returns size of der if successful */ -} +#else + (void)rsa; + (void)pp; + WOLFSSL_MSG("Error, WOLFSSL_KEY_GEN not defined"); + return WOLFSSL_FAILURE; #endif /* WOLFSSL_KEY_GEN */ +} int wolfSSL_i2d_RSAPublicKey(WOLFSSL_RSA *rsa, const unsigned char **pp) diff --git a/tests/api.c b/tests/api.c index acea3c1f4..e2b2f15c9 100644 --- a/tests/api.c +++ b/tests/api.c @@ -18215,8 +18215,12 @@ static void test_wolfSSL_d2i_PrivateKeys_bio(void) EVP_PKEY* pkey = NULL; RSA* rsa = NULL; WOLFSSL_CTX* ctx; + +#if defined(WOLFSSL_KEY_GEN) unsigned char buffer[4096]; unsigned char* bufPtr; + bufPtr = buffer; +#endif printf(testingFmt, "wolfSSL_d2i_PrivateKeys_bio()"); @@ -18288,7 +18292,7 @@ static void test_wolfSSL_d2i_PrivateKeys_bio(void) /* RSA not set yet, expecting to fail*/ AssertIntEQ(SSL_CTX_use_RSAPrivateKey(ctx, rsa), BAD_FUNC_ARG); -#if defined(USE_CERT_BUFFERS_2048) && !defined(NO_RSA) +#if defined(USE_CERT_BUFFERS_2048) && !defined(NO_RSA) && defined(WOLFSSL_KEY_GEN) /* set RSA using bio*/ AssertIntGT(BIO_write(bio, client_key_der_2048, sizeof_client_key_der_2048), 0); @@ -18297,7 +18301,6 @@ static void test_wolfSSL_d2i_PrivateKeys_bio(void) AssertIntEQ(SSL_CTX_use_RSAPrivateKey(ctx, rsa), WOLFSSL_SUCCESS); /*i2d RSAprivate key tests */ - bufPtr = buffer; AssertIntEQ(wolfSSL_i2d_RSAPrivateKey(NULL, NULL), BAD_FUNC_ARG); AssertIntEQ(wolfSSL_i2d_RSAPrivateKey(rsa, &bufPtr), sizeof_client_key_der_2048);