/* Shutdown the TLS connection without releasing the resources, meaning a new connection can be started without calling TlsNew() and without setting certificates etc. */
EFI_STATUS EFIAPI TlsShutdown(IN VOID *Tls)
/* Shutdown the TLS connection without releasing the resources, meaning a new connection can be started without calling TlsNew() and without setting certificates etc. */
EFI_STATUS EFIAPI TlsShutdown(IN VOID *Tls)
{
  TLS_CONNECTION  *TlsConn;
  TlsConn = (TLS_CONNECTION *)Tls;
  if ((TlsConn == NULL) || ((TlsConn->Ssl) == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  SSL_set_quiet_shutdown (TlsConn->Ssl, 1);
  SSL_shutdown (TlsConn->Ssl);
  return SSL_clear (TlsConn->Ssl) == 1 ? EFI_SUCCESS : EFI_PROTOCOL_ERROR;
}