Merge pull request #1719 from MJSPollard/OpenSSLAllFix

Added boost define and openssl bug fix with WOLFSSL_KEY_GEN
pull/1740/head
David Garske 2018-08-02 15:20:27 -07:00 committed by GitHub
commit a43d4d16ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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);