i2d_RSAPublicKey(rsa, NULL)

This commit is contained in:
Takashi Kojo
2018-07-04 07:51:46 +09:00
committed by Go Hosohara
parent 52cee17668
commit 1e87eae3b7
2 changed files with 3 additions and 2 deletions

View File

@@ -28482,8 +28482,8 @@ int wolfSSL_i2d_RSAPublicKey(WOLFSSL_RSA *rsa, const unsigned char **pp)
XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return ret; return ret;
} }
if((pp != NULL) && (ret >= 0))
*pp = der; *pp = der;
return ret; return ret;
} }
#endif /* #if !defined(HAVE_FAST_RSA) */ #endif /* #if !defined(HAVE_FAST_RSA) */

View File

@@ -19180,6 +19180,7 @@ static void test_wolfSSL_RSA_DER(void)
{ {
AssertNotNull(d2i_RSAPublicKey(&rsa, &pub[i].der, pub[i].sz)); AssertNotNull(d2i_RSAPublicKey(&rsa, &pub[i].der, pub[i].sz));
AssertNotNull(rsa); AssertNotNull(rsa);
AssertIntEQ(i2d_RSAPublicKey(rsa, NULL), pub[i].sz);
buff = NULL; buff = NULL;
AssertIntEQ(i2d_RSAPublicKey(rsa, &buff), pub[i].sz); AssertIntEQ(i2d_RSAPublicKey(rsa, &buff), pub[i].sz);
AssertNotNull(buff); AssertNotNull(buff);