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);
return ret;
}
*pp = der;
if((pp != NULL) && (ret >= 0))
*pp = der;
return ret;
}
#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(rsa);
AssertIntEQ(i2d_RSAPublicKey(rsa, NULL), pub[i].sz);
buff = NULL;
AssertIntEQ(i2d_RSAPublicKey(rsa, &buff), pub[i].sz);
AssertNotNull(buff);