@@ -2765,10 +2765,14 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
27652765
27662766#endif /* NO_MAIN_DRIVER */
27672767
2768+ #if defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLF_CRYPTO_CB_ONLY_RSA)
2769+ #undef NO_WRITE_TEMP_FILES
2770+ #define NO_WRITE_TEMP_FILES
2771+ #endif
2772+
27682773/* helper to save DER, convert to PEM and save PEM */
27692774#if !defined(NO_ASN) && (defined(HAVE_ECC) || !defined(NO_DSA) || \
2770- (!defined(NO_RSA) && (defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN)))) \
2771- && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
2775+ (!defined(NO_RSA) && (defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN))))
27722776
27732777#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
27742778#define SaveDerAndPem(d, dSz, fD, fP, pT) _SaveDerAndPem(d, dSz, fD, fP, pT, WC_TEST_RET_LN)
@@ -21956,6 +21960,13 @@ static wc_test_ret_t rsa_keygen_test(WC_RNG* rng)
2195621960 int keySz = 2048;
2195721961#endif
2195821962
21963+ #ifdef WOLF_CRYPTO_CB_ONLY_RSA
21964+ if (devId == INVALID_DEVID) {
21965+ /* must call keygen with devId */
21966+ return 0;
21967+ }
21968+ #endif
21969+
2195921970#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
2196021971 if (! genKey)
2196121972 ERROR_OUT(WC_TEST_RET_ENC_EC(MEMORY_E), exit_rsa);
@@ -59660,6 +59671,7 @@ static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
5966059671
5966159672#ifdef WOLFSSL_KEY_GEN
5966259673 WC_RNG rng;
59674+ word32 keySz = 2048;
5966359675#endif
5966459676
5966559677#ifdef USE_CERT_BUFFERS_1024
@@ -59717,15 +59729,15 @@ static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
5971759729 * wc_MakeRsaKey(CBONLY_TEST_DEVID) expects to return 0(success)
5971859730 */
5971959731 ctx->exampleVar = 99;
59720- ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, rng);
59732+ ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, & rng);
5972159733 if (ret != 0)
5972259734 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5972359735 /* wc_MakeRsaKey() -> rsa cb ->
5972459736 * myCryptoDevCb -> wc_MakeRsaKey(INVALID_DEVID)
5972559737 * wc_MakeRsaKey(CBONLY_TEST_DEVID) expects to return NO_VALID_DEVID(failure)
5972659738 */
5972759739 ctx->exampleVar = 1;
59728- ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, rng);
59740+ ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, & rng);
5972959741 if (ret != WC_NO_ERR_TRACE(NO_VALID_DEVID)) {
5973059742 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5973159743 } else
0 commit comments