@@ -20,7 +20,7 @@ static int wolfkdriv_test_aes_cbc_big(device_t dev, int crid)
2020 struct crypto_session_params csp ;
2121 struct cryptop * crp = NULL ;
2222 Aes * aes_encrypt = NULL ;
23- int error = 0 ;
23+ int error = -1 ;
2424 byte msg [] = {
2525 0x6e ,0x6f ,0x77 ,0x20 ,0x69 ,0x73 ,0x20 ,0x74 ,
2626 0x68 ,0x65 ,0x20 ,0x74 ,0x69 ,0x6d ,0x65 ,0x20 ,
@@ -50,7 +50,7 @@ static int wolfkdriv_test_aes_cbc_big(device_t dev, int crid)
5050
5151 error = wc_AesInit (aes_encrypt , NULL , INVALID_DEVID );
5252 if (error ) {
53- device_printf (dev , "error: newsession_cipher: aes init : %d\n" , error );
53+ device_printf (dev , "error: wc_AesInit : %d\n" , error );
5454 goto test_aes_cbc_big_out ;
5555 }
5656
@@ -72,14 +72,20 @@ static int wolfkdriv_test_aes_cbc_big(device_t dev, int crid)
7272 csp .csp_ivlen = WC_AES_BLOCK_SIZE ;
7373 csp .csp_cipher_key = key ;
7474 csp .csp_cipher_klen = WC_AES_BLOCK_SIZE ;
75+
76+ /* get crypto session handle */
7577 error = crypto_newsession (& session , & csp , crid );
7678 if (error || session == NULL ) {
79+ device_printf (dev , "error: test_aes: crypto_newsession: %d, %p\n" ,
80+ error , (void * )session );
81+ error = ENOMEM ;
7782 goto test_aes_cbc_big_out ;
7883 }
7984
8085 crp = crypto_getreq (session , M_WAITOK );
8186 if (crp == NULL ) {
8287 device_printf (dev , "error: test_aes: crypto_getreq failed\n" );
88+ error = ENOMEM ;
8389 goto test_aes_cbc_big_out ;
8490 }
8591
@@ -121,6 +127,7 @@ static int wolfkdriv_test_aes_cbc_big(device_t dev, int crid)
121127 goto test_aes_cbc_big_out ;
122128 }
123129
130+ device_printf (dev , "info: test_aes_cbc_big: passed\n" );
124131test_aes_cbc_big_out :
125132 #if defined(WOLFSSL_BSDKM_VERBOSE_DEBUG )
126133 device_printf (dev , "info: test_aes_cbc_big: error=%d, session=%p, crp=%p\n" ,
@@ -155,7 +162,7 @@ static int wolfkdriv_test_aes_gcm(device_t dev, int crid)
155162 struct crypto_session_params csp ;
156163 struct cryptop * crp = NULL ;
157164 Aes * enc = NULL ;
158- int error = 0 ;
165+ int error = -1 ;
159166
160167 WOLFSSL_SMALL_STACK_STATIC const byte p [] =
161168 {
@@ -226,6 +233,12 @@ static int wolfkdriv_test_aes_gcm(device_t dev, int crid)
226233 goto test_aes_gcm_out ;
227234 }
228235
236+ error = wc_AesInit (enc , NULL , INVALID_DEVID );
237+ if (error ) {
238+ device_printf (dev , "error: wc_AesInit: %d\n" , error );
239+ goto test_aes_gcm_out ;
240+ }
241+
229242 error = wc_AesGcmEncryptInit (enc , k1 , sizeof (k1 ), iv1 , sizeof (iv1 ));
230243 if (error ) { goto test_aes_gcm_out ; }
231244
@@ -259,13 +272,15 @@ static int wolfkdriv_test_aes_gcm(device_t dev, int crid)
259272 if (error || session == NULL ) {
260273 device_printf (dev , "error: test_aes: crypto_newsession: %d, %p\n" ,
261274 error , (void * )session );
275+ error = ENOMEM ;
262276 goto test_aes_gcm_out ;
263277 }
264278
265279 /* get a crypto op handle */
266280 crp = crypto_getreq (session , M_WAITOK );
267281 if (crp == NULL ) {
268282 device_printf (dev , "error: test_aes: crypto_getreq failed\n" );
283+ error = ENOMEM ;
269284 goto test_aes_gcm_out ;
270285 }
271286
@@ -309,6 +324,7 @@ static int wolfkdriv_test_aes_gcm(device_t dev, int crid)
309324 error = XMEMCMP (resultC2 , p , sizeof (p ));
310325 if (error ) { goto test_aes_gcm_out ; }
311326
327+ device_printf (dev , "info: test_aes_gcm: passed\n" );
312328test_aes_gcm_out :
313329 #if defined(WOLFSSL_BSDKM_VERBOSE_DEBUG )
314330 device_printf (dev , "info: test_aes_gcm: error=%d, session=%p, crp=%p\n" ,
0 commit comments