/* This function returns current cipher suite used by the specified TLS connection. */
EFI_STATUS EFIAPI TlsGetCurrentCipher(IN VOID *Tls, IN OUT UINT16 *CipherId)
/* This function returns current cipher suite used by the specified TLS connection. */
EFI_STATUS EFIAPI TlsGetCurrentCipher(IN VOID *Tls, IN OUT UINT16 *CipherId)
{
  TLS_CONNECTION    *TlsConn;
  CONST SSL_CIPHER  *Cipher;
  TlsConn = (TLS_CONNECTION *)Tls;
  Cipher  = NULL;
  if ((TlsConn == NULL) || (TlsConn->Ssl == NULL) || (CipherId == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Cipher = SSL_get_current_cipher (TlsConn->Ssl);
  if (Cipher == NULL) {
    return EFI_UNSUPPORTED;
  }
  *CipherId = (SSL_CIPHER_get_id (Cipher)) & 0xFFFF;
  return EFI_SUCCESS;
}