@@ -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)
@@ -21952,6 +21956,13 @@ static wc_test_ret_t rsa_keygen_test(WC_RNG* rng)
2195221956 int keySz = 2048;
2195321957#endif
2195421958
21959+ #ifdef WOLF_CRYPTO_CB_ONLY_RSA
21960+ if (devId == INVALID_DEVID) {
21961+ /* must call keygen with devId */
21962+ return 0;
21963+ }
21964+ #endif
21965+
2195521966#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
2195621967 if (! genKey)
2195721968 ERROR_OUT(WC_TEST_RET_ENC_EC(MEMORY_E), exit_rsa);
@@ -59624,6 +59635,7 @@ static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
5962459635
5962559636#ifdef WOLFSSL_KEY_GEN
5962659637 WC_RNG rng;
59638+ word32 keySz = 2048;
5962759639#endif
5962859640
5962959641#ifdef USE_CERT_BUFFERS_1024
@@ -59681,15 +59693,15 @@ static wc_test_ret_t rsa_onlycb_test(myCryptoDevCtx *ctx)
5968159693 * wc_MakeRsaKey(CBONLY_TEST_DEVID) expects to return 0(success)
5968259694 */
5968359695 ctx->exampleVar = 99;
59684- ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, rng);
59696+ ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, & rng);
5968559697 if (ret != 0)
5968659698 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5968759699 /* wc_MakeRsaKey() -> rsa cb ->
5968859700 * myCryptoDevCb -> wc_MakeRsaKey(INVALID_DEVID)
5968959701 * wc_MakeRsaKey(CBONLY_TEST_DEVID) expects to return NO_VALID_DEVID(failure)
5969059702 */
5969159703 ctx->exampleVar = 1;
59692- ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, rng);
59704+ ret = wc_MakeRsaKey(key, keySz, WC_RSA_EXPONENT, & rng);
5969359705 if (ret != WC_NO_ERR_TRACE(NO_VALID_DEVID)) {
5969459706 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), exit_onlycb);
5969559707 } else
0 commit comments