@@ -399,85 +399,6 @@ static int _testDma(whServerContext* server, whClientContext* client)
399399#endif /* WOLFHSM_CFG_DMA && WOLFHSM_CFG_ENABLE_CLIENT && \
400400 WOLFHSM_CFG_ENABLE_SERVER */
401401
402- #if defined(WOLFHSM_CFG_ENABLE_CLIENT ) && defined(WOLFHSM_CFG_ENABLE_SERVER ) && \
403- !defined(WOLFHSM_CFG_NO_CRYPTO )
404- /* Helper function to test crypto affinity switching. Client and server must be
405- * already initialized. The configDevId parameter indicates what devId was
406- * configured at server init time. */
407- static int _testCryptoAffinity (whServerContext * server , whClientContext * client )
408- {
409- int32_t server_rc = 0 ;
410- uint32_t affinity = 0 ;
411-
412- /* Test 1: Set SW affinity - should always succeed */
413- WH_TEST_RETURN_ON_FAIL (
414- wh_Client_SetCryptoAffinityRequest (client , WH_CRYPTO_AFFINITY_SW ));
415- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
416- WH_TEST_RETURN_ON_FAIL (
417- wh_Client_SetCryptoAffinityResponse (client , & server_rc , & affinity ));
418- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_OK );
419- WH_TEST_ASSERT_RETURN (affinity == WH_CRYPTO_AFFINITY_SW );
420-
421- /* Verify server devId is now INVALID_DEVID */
422- WH_TEST_ASSERT_RETURN (server -> crypto -> devId == INVALID_DEVID );
423-
424- /* Test 2: Set HW affinity */
425- WH_TEST_RETURN_ON_FAIL (
426- wh_Client_SetCryptoAffinityRequest (client , WH_CRYPTO_AFFINITY_HW ));
427- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
428- WH_TEST_RETURN_ON_FAIL (
429- wh_Client_SetCryptoAffinityResponse (client , & server_rc , & affinity ));
430-
431- if (server -> crypto -> configDevId != INVALID_DEVID ) {
432- /* HW was configured, should succeed */
433- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_OK );
434- WH_TEST_ASSERT_RETURN (affinity == WH_CRYPTO_AFFINITY_HW );
435- WH_TEST_ASSERT_RETURN (server -> crypto -> devId == server -> crypto -> configDevId );
436- }
437- else {
438- #ifdef WOLF_CRYPTO_CB
439- /* HW was not configured, should fail with BADCONFIG */
440- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_BADCONFIG );
441- #else
442- /* HW crypto was not enabled, should fail with NOTIMPL */
443- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_NOTIMPL );
444- #endif
445- WH_TEST_ASSERT_RETURN (affinity == WH_CRYPTO_AFFINITY_SW );
446- WH_TEST_ASSERT_RETURN (server -> crypto -> devId == INVALID_DEVID );
447- }
448-
449- /* Test 3: Invalid affinity value - should return BADARGS */
450- WH_TEST_RETURN_ON_FAIL (
451- wh_Client_SetCryptoAffinityRequest (client , 0xFF ));
452- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
453- WH_TEST_RETURN_ON_FAIL (
454- wh_Client_SetCryptoAffinityResponse (client , & server_rc , & affinity ));
455- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_BADARGS );
456-
457- /* Test 4: Switch back to SW */
458- WH_TEST_RETURN_ON_FAIL (
459- wh_Client_SetCryptoAffinityRequest (client , WH_CRYPTO_AFFINITY_SW ));
460- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
461- WH_TEST_RETURN_ON_FAIL (
462- wh_Client_SetCryptoAffinityResponse (client , & server_rc , & affinity ));
463- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_OK );
464- WH_TEST_ASSERT_RETURN (affinity == WH_CRYPTO_AFFINITY_SW );
465- WH_TEST_ASSERT_RETURN (server -> crypto -> devId == INVALID_DEVID );
466-
467- /* Test 5: Test blocking API */
468- WH_TEST_RETURN_ON_FAIL (wh_Client_SetCryptoAffinityRequest (client ,
469- WH_CRYPTO_AFFINITY_SW ));
470- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
471- WH_TEST_RETURN_ON_FAIL (wh_Client_SetCryptoAffinityResponse (client ,
472- & server_rc , & affinity ));
473- WH_TEST_ASSERT_RETURN (server_rc == WH_ERROR_OK );
474- WH_TEST_ASSERT_RETURN (affinity == WH_CRYPTO_AFFINITY_SW );
475-
476- return WH_ERROR_OK ;
477- }
478- #endif /* WOLFHSM_CFG_ENABLE_CLIENT && WOLFHSM_CFG_ENABLE_SERVER &&
479- !WOLFHSM_CFG_NO_CRYPTO */
480-
481402#ifdef WOLFHSM_CFG_ENABLE_CLIENT
482403static int _testClientCounter (whClientContext * client )
483404{
@@ -1205,11 +1126,6 @@ int whTest_ClientServerSequential(whTestNvmBackendType nvmType)
12051126 /* Test custom registered callbacks */
12061127 WH_TEST_RETURN_ON_FAIL (_testCallbacks (server , client ));
12071128
1208- #ifndef WOLFHSM_CFG_NO_CRYPTO
1209- /* Test crypto affinity switching */
1210- WH_TEST_RETURN_ON_FAIL (_testCryptoAffinity (server , client ));
1211- #endif /* !WOLFHSM_CFG_NO_CRYPTO */
1212-
12131129#ifdef WOLFHSM_CFG_DMA
12141130 /* Test DMA callbacks and address allowlisting */
12151131 WH_TEST_RETURN_ON_FAIL (_testDma (server , client ));
0 commit comments