@@ -215,27 +215,31 @@ static int wolfkmod_cleanup(void)
215215 if (error != 0 ) {
216216 printf ("error: wolfCrypt_Cleanup failed: %s\n" ,
217217 wc_GetErrorString (error ));
218- return (ECANCELED );
218+ error = ECANCELED ;
219+ goto wolfkmod_cleanup_out ;
219220 }
220221 #else
221222 error = wolfSSL_Cleanup ();
222223 if (error != WOLFSSL_SUCCESS ) {
223224 printf ("error: wolfSSL_Cleanup failed: %s\n" ,
224225 wc_GetErrorString (error ));
225- return (ECANCELED );
226+ error = ECANCELED ;
227+ goto wolfkmod_cleanup_out ;
226228 }
227229 #endif /* WOLFCRYPT_ONLY */
228230
229231 #if defined(WOLFSSL_BSDKM_VERBOSE_DEBUG )
230232 printf ("info: libwolfssl " LIBWOLFSSL_VERSION_STRING
231233 " cleanup complete.\n" );
232234 #endif /* WOLFSSL_BSDKM_VERBOSE_DEBUG */
235+ error = 0 ;
233236
237+ wolfkmod_cleanup_out :
234238 #if defined(WOLFSSL_AESNI ) || defined(WOLFSSL_KERNEL_BENCHMARKS )
235239 wolfkmod_vecreg_exit ();
236240 #endif /* WOLFSSL_AESNI || WOLFSSL_KERNEL_BENCHMARKS*/
237241
238- return (0 );
242+ return (error );
239243}
240244
241245#if !defined(BSDKM_CRYPTO_REGISTER )
@@ -554,9 +558,9 @@ static int wolfkdriv_probesession(device_t dev,
554558 return (error );
555559}
556560
557- static int wolfkdriv_newsession_cipher (device_t dev ,
558- wolfkdriv_session_t * session ,
559- const struct crypto_session_params * csp )
561+ static int wolfkdriv_newsession_aes (device_t dev ,
562+ wolfkdriv_session_t * session ,
563+ const struct crypto_session_params * csp )
560564{
561565 int error = 0 ;
562566 int klen = csp -> csp_cipher_klen ; /* key len in bytes */
@@ -624,7 +628,7 @@ static int wolfkdriv_newsession(device_t dev, crypto_session_t cses,
624628 break ;
625629 case CSP_MODE_CIPHER :
626630 case CSP_MODE_AEAD :
627- error = wolfkdriv_newsession_cipher (dev , session , csp );
631+ error = wolfkdriv_newsession_aes (dev , session , csp );
628632 break ;
629633 default :
630634 __assert_unreachable ();
@@ -638,9 +642,6 @@ static int wolfkdriv_newsession(device_t dev, crypto_session_t cses,
638642 return (error );
639643}
640644
641- /*
642- *
643- */
644645static void
645646wolfkdriv_freesession (device_t dev , crypto_session_t cses )
646647{
@@ -659,9 +660,6 @@ wolfkdriv_freesession(device_t dev, crypto_session_t cses)
659660 return ;
660661}
661662
662- /*
663- *
664- */
665663static int wolfkdriv_cbc_work (device_t dev , wolfkdriv_session_t * session ,
666664 struct cryptop * crp ,
667665 const struct crypto_session_params * csp )
@@ -812,9 +810,6 @@ static int wolfkdriv_cbc_work(device_t dev, wolfkdriv_session_t * session,
812810 return (error );
813811}
814812
815- /*
816- * todo: skeleton implementation, finish.
817- */
818813static int wolfkdriv_gcm_work (device_t dev , wolfkdriv_session_t * session ,
819814 struct cryptop * crp ,
820815 const struct crypto_session_params * csp )
@@ -1056,7 +1051,7 @@ static driver_t wolfkdriv_driver = {
10561051 .size = sizeof (struct wolfkdriv_softc ),
10571052};
10581053
1059- /* note: on x86, software-only drivers usually attach to nexus bus. */
1054+ /* on x86, software-only drivers usually attach to nexus bus. */
10601055DRIVER_MODULE (libwolfssl , nexus , wolfkdriv_driver , NULL , NULL );
10611056#endif /* BSDKM_CRYPTO_REGISTER */
10621057
0 commit comments