Fix user-rsa tests

This commit is contained in:
Juliusz Sosinowicz
2020-01-28 14:24:39 +01:00
parent 5c4d3df4f3
commit 1512485926

View File

@ -12285,11 +12285,12 @@ static int test_wc_RsaKeyToDer (void)
} }
} }
#ifndef HAVE_USER_RSA #ifndef HAVE_USER_RSA
/* Pass bad args. */ /* Pass good/bad args. */
if (ret == 0) { if (ret == 0) {
ret = wc_RsaKeyToDer(NULL, der, FOURK_BUF); ret = wc_RsaKeyToDer(NULL, der, FOURK_BUF);
if (ret == BAD_FUNC_ARG) { if (ret == BAD_FUNC_ARG) {
ret = wc_RsaKeyToDer(&genKey, NULL, FOURK_BUF); /* Get just the output length */
ret = wc_RsaKeyToDer(&genKey, NULL, 0);
} }
if (ret > 0) { if (ret > 0) {
/* Try Public Key. */ /* Try Public Key. */
@ -12303,13 +12304,14 @@ static int test_wc_RsaKeyToDer (void)
} }
} }
#else #else
/* Pass bad args. */ /* Pass good/bad args. */
if (ret == 0) { if (ret == 0) {
ret = wc_RsaKeyToDer(NULL, der, FOURK_BUF); ret = wc_RsaKeyToDer(NULL, der, FOURK_BUF);
if (ret == USER_CRYPTO_ERROR) { if (ret == USER_CRYPTO_ERROR) {
ret = wc_RsaKeyToDer(&genKey, NULL, FOURK_BUF); /* Get just the output length */
ret = wc_RsaKeyToDer(&genKey, NULL, 0);
} }
if (ret == USER_CRYPTO_ERROR) { if (ret > 0) {
/* Try Public Key. */ /* Try Public Key. */
genKey.type = 0; genKey.type = 0;
ret = wc_RsaKeyToDer(&genKey, der, FOURK_BUF); ret = wc_RsaKeyToDer(&genKey, der, FOURK_BUF);