MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ktls_cleanup

Function ktls_cleanup

freebsd/kern/uipc_ktls.c:690–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688#endif
689
690static void
691ktls_cleanup(struct ktls_session *tls)
692{
693
694 counter_u64_add(ktls_offload_active, -1);
695 switch (tls->mode) {
696 case TCP_TLS_MODE_SW:
697 MPASS(tls->be != NULL);
698 switch (tls->params.cipher_algorithm) {
699 case CRYPTO_AES_CBC:
700 counter_u64_add(ktls_sw_cbc, -1);
701 break;
702 case CRYPTO_AES_NIST_GCM_16:
703 counter_u64_add(ktls_sw_gcm, -1);
704 break;
705 }
706 tls->free(tls);
707 break;
708 case TCP_TLS_MODE_IFNET:
709 switch (tls->params.cipher_algorithm) {
710 case CRYPTO_AES_CBC:
711 counter_u64_add(ktls_ifnet_cbc, -1);
712 break;
713 case CRYPTO_AES_NIST_GCM_16:
714 counter_u64_add(ktls_ifnet_gcm, -1);
715 break;
716 }
717 if (tls->snd_tag != NULL)
718 m_snd_tag_rele(tls->snd_tag);
719 break;
720#ifdef TCP_OFFLOAD
721 case TCP_TLS_MODE_TOE:
722 switch (tls->params.cipher_algorithm) {
723 case CRYPTO_AES_CBC:
724 counter_u64_add(ktls_toe_cbc, -1);
725 break;
726 case CRYPTO_AES_NIST_GCM_16:
727 counter_u64_add(ktls_toe_gcm, -1);
728 break;
729 }
730 break;
731#endif
732 }
733 if (tls->params.auth_key != NULL) {
734 zfree(tls->params.auth_key, M_KTLS);
735 tls->params.auth_key = NULL;
736 tls->params.auth_key_len = 0;
737 }
738 if (tls->params.cipher_key != NULL) {
739 zfree(tls->params.cipher_key, M_KTLS);
740 tls->params.cipher_key = NULL;
741 tls->params.cipher_key_len = 0;
742 }
743 explicit_bzero(tls->params.iv, sizeof(tls->params.iv));
744}
745
746#if defined(INET) || defined(INET6)
747

Callers 4

ktls_create_sessionFunction · 0.85
ktls_enable_rxFunction · 0.85
ktls_enable_txFunction · 0.85
ktls_destroyFunction · 0.85

Calls 4

explicit_bzeroFunction · 0.85
zfreeFunction · 0.70
counter_u64_addFunction · 0.50
m_snd_tag_releFunction · 0.50

Tested by

no test coverage detected