/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */
EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */
EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
{
  TLS_CONNECTION  *TlsConn;
  SSL_SESSION     *Session;
  TlsConn = (TLS_CONNECTION *)Tls;
  Session = NULL;
  if ((TlsConn == NULL) || (TlsConn->Ssl == NULL) || (SessionId == NULL)) {
    return EFI_INVALID_PARAMETER;
  }
  Session = SSL_get_session (TlsConn->Ssl);
  if (Session == NULL) {
    return EFI_UNSUPPORTED;
  }
  SSL_SESSION_set1_id (Session, (const unsigned char *)SessionId, SessionIdLen);
  return EFI_SUCCESS;
}