@@ -507,69 +507,6 @@ static int _clientServerSequentialTestConnectCb(void* context,
507507 connected );
508508}
509509
510- #if !defined(WOLFHSM_CFG_NO_CRYPTO )
511- #ifdef HAVE_AES_CBC
512- static int _testAesCbcRequestResponse (whClientContext * client ,
513- whServerContext * server )
514- {
515- Aes aes [1 ];
516- uint8_t key [AES_BLOCK_SIZE ] = {0xAA , 0xBB , 0xCC , 0xDD , 0xEE , 0xFF ,
517- 0x11 , 0x22 , 0x33 , 0x44 , 0x55 , 0x66 ,
518- 0x77 , 0x88 , 0x99 , 0x00 };
519- uint8_t iv [AES_BLOCK_SIZE ] = {0 };
520- uint8_t plainIn [AES_BLOCK_SIZE ] = {0x77 , 0x6F , 0x6C , 0x66 , 0x48 , 0x53 ,
521- 0x4D , 0x20 , 0x41 , 0x45 , 0x53 , 0x20 ,
522- 0x74 , 0x65 , 0x73 , 0x74 };
523- uint8_t cipherOut [AES_BLOCK_SIZE ] = {0 };
524- uint8_t plainOut [AES_BLOCK_SIZE ] = {0 };
525- uint32_t outSize = 0 ;
526- int rc ;
527-
528- WH_TEST_PRINT (" Testing AES CBC request/response...\n" );
529-
530- /* Encrypt */
531- WH_TEST_RETURN_ON_FAIL (wc_AesInit (aes , NULL , INVALID_DEVID ));
532- WH_TEST_RETURN_ON_FAIL (
533- wc_AesSetKey (aes , key , sizeof (key ), iv , AES_ENCRYPTION ));
534-
535- WH_TEST_RETURN_ON_FAIL (
536- wh_Client_AesCbcRequest (client , aes , 1 , plainIn , sizeof (plainIn )));
537-
538- /* Response should not be ready before server processes */
539- rc = wh_Client_AesCbcResponse (client , aes , cipherOut , & outSize );
540- WH_TEST_ASSERT_RETURN (rc == WH_ERROR_NOTREADY );
541-
542- /* Server processes the request */
543- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
544-
545- /* Now response should be available */
546- WH_TEST_RETURN_ON_FAIL (
547- wh_Client_AesCbcResponse (client , aes , cipherOut , & outSize ));
548- WH_TEST_ASSERT_RETURN (outSize == sizeof (plainIn ));
549- /* Ciphertext should differ from plaintext */
550- WH_TEST_ASSERT_RETURN (memcmp (cipherOut , plainIn , sizeof (plainIn )) != 0 );
551- wc_AesFree (aes );
552-
553- /* Decrypt */
554- WH_TEST_RETURN_ON_FAIL (wc_AesInit (aes , NULL , INVALID_DEVID ));
555- WH_TEST_RETURN_ON_FAIL (
556- wc_AesSetKey (aes , key , sizeof (key ), iv , AES_DECRYPTION ));
557-
558- WH_TEST_RETURN_ON_FAIL (
559- wh_Client_AesCbcRequest (client , aes , 0 , cipherOut , sizeof (cipherOut )));
560- WH_TEST_RETURN_ON_FAIL (wh_Server_HandleRequestMessage (server ));
561- WH_TEST_RETURN_ON_FAIL (
562- wh_Client_AesCbcResponse (client , aes , plainOut , & outSize ));
563- WH_TEST_ASSERT_RETURN (outSize == sizeof (cipherOut ));
564- /* Decrypted output should match original plaintext */
565- WH_TEST_ASSERT_RETURN (memcmp (plainOut , plainIn , sizeof (plainIn )) == 0 );
566- wc_AesFree (aes );
567-
568- return WH_ERROR_OK ;
569- }
570- #endif /* HAVE_AES_CBC */
571- #endif /* !WOLFHSM_CFG_NO_CRYPTO */
572-
573510static int _testOutOfBoundsNvmReads (whClientContext * client ,
574511 whServerContext * server , whNvmId id )
575512{
@@ -1171,11 +1108,6 @@ int whTest_ClientServerSequential(whTestNvmBackendType nvmType)
11711108 WH_TEST_RETURN_ON_FAIL (_testDma (server , client ));
11721109#endif /* WOLFHSM_CFG_DMA */
11731110
1174- #if !defined(WOLFHSM_CFG_NO_CRYPTO ) && defined(HAVE_AES_CBC )
1175- /* Test split AES CBC request/response */
1176- WH_TEST_RETURN_ON_FAIL (_testAesCbcRequestResponse (client , server ));
1177- #endif /* !WOLFHSM_CFG_NO_CRYPTO && HAVE_AES_CBC */
1178-
11791111 /* Check that we are still connected */
11801112 WH_TEST_RETURN_ON_FAIL (wh_Server_GetConnected (server , & server_connected ));
11811113 WH_TEST_ASSERT_RETURN (server_connected == WH_COMM_CONNECTED );
0 commit comments