@@ -2761,10 +2761,14 @@ options: [-s max_relative_stack_bytes] [-m max_relative_heap_memory_bytes]\n\
27612761
27622762#endif /* NO_MAIN_DRIVER */
27632763
2764+ #if defined(WOLF_CRYPTO_CB_ONLY_ECC) || defined(WOLF_CRYPTO_CB_ONLY_RSA)
2765+ #undef NO_WRITE_TEMP_FILES
2766+ #define NO_WRITE_TEMP_FILES
2767+ #endif
2768+
27642769/* helper to save DER, convert to PEM and save PEM */
27652770#if !defined(NO_ASN) && (defined(HAVE_ECC) || !defined(NO_DSA) || \
2766- (!defined(NO_RSA) && (defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN)))) \
2767- && !defined(WOLF_CRYPTO_CB_ONLY_ECC)
2771+ (!defined(NO_RSA) && (defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN))))
27682772
27692773#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
27702774#define SaveDerAndPem(d, dSz, fD, fP, pT) _SaveDerAndPem(d, dSz, fD, fP, pT, WC_TEST_RET_LN)
@@ -21950,6 +21954,13 @@ static wc_test_ret_t rsa_keygen_test(WC_RNG* rng)
2195021954 int keySz = 2048;
2195121955#endif
2195221956
21957+ #ifdef WOLF_CRYPTO_CB_ONLY_RSA
21958+ if (devId == INVALID_DEVID) {
21959+ /* must call keygen with devId */
21960+ return 0;
21961+ }
21962+ #endif
21963+
2195321964#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
2195421965 if (! genKey)
2195521966 ERROR_OUT(WC_TEST_RET_ENC_EC(MEMORY_E), exit_rsa);
@@ -59617,6 +59628,7 @@ static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
5961759628
5961859629#ifdef WOLFSSL_KEY_GEN
5961959630 WC_RNG rng;
59631+ word32 keySz = 2048;
5962059632#endif
5962159633
5962259634#ifdef USE_CERT_BUFFERS_1024
@@ -59674,15 +59686,15 @@ static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
5967459686 * wc_MakeRsaKey(CBONLY_TEST_DEVID) expects to return 0(success)
5967559687 */
5967659688 ctx->exampleVar = 99;
59677- ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, rng);
59689+ ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, & rng);
5967859690 if (ret != 0)
5967959691 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5968059692 /* wc_MakeRsaKey() -> rsa cb ->
5968159693 * myCryptoDevCb -> wc_MakeRsaKey(INVALID_DEVID)
5968259694 * wc_MakeRsaKey(CBONLY_TEST_DEVID) expects to return NO_VALID_DEVID(failure)
5968359695 */
5968459696 ctx->exampleVar = 1;
59685- ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, rng);
59697+ ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, & rng);
5968659698 if (ret != WC_NO_ERR_TRACE(NO_VALID_DEVID)) {
5968759699 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5968859700 } else
0 commit comments