diff --git a/src/ssl.c b/src/ssl.c index 989e9e685..2d7f6e85e 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -27520,21 +27520,20 @@ int wolfSSL_i2d_RSAPublicKey(WOLFSSL_RSA *rsa, const unsigned char **pp) if((ret = SetRsaInternal(rsa)) != WOLFSSL_SUCCESS) { WOLFSSL_MSG("SetRsaInternal Failed"); XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER); - return _REXT_OK; + return ret; } -#if 0 if((ret = wc_RsaKeyToPublicDer((RsaKey *)rsa->internal, der, derLen)) < 0){ WOLFSSL_MSG("RsaKeyToPublicDer failed"); XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER); return ret; } -#endif *pp = der; return ret; } + /* return WOLFSSL_SUCCESS if success, WOLFSSL_FATAL_ERROR if error */ int wolfSSL_RSA_LoadDer(WOLFSSL_RSA* rsa, const unsigned char* derBuf, int derSz) { diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 623a24eb4..939efce98 100755 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -8186,7 +8186,7 @@ int wc_PemPubKeyToDer(const char* fileName, #if !defined(NO_RSA) && (defined(WOLFSSL_CERT_GEN) || \ - (defined(WOLFSSL_KEY_GEN) && !defined(HAVE_USER_RSA))) + ((defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA)) && !defined(HAVE_USER_RSA))) /* USER RSA ifdef portions used instead of refactor in consideration for possible fips build */ /* Write a public RSA key to output */ @@ -8438,8 +8438,9 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen) return outLen; } +#endif - +#if (defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA)) && !defined(NO_RSA) && !defined(HAVE_USER_RSA) /* Convert Rsa Public key to DER format, write to output (inLen), return bytes written */ int wc_RsaKeyToPublicDer(RsaKey* key, byte* output, word32 inLen)