/* If AesContext is NULL, then return FALSE. If Key is NULL, then return FALSE. If KeyLength is not valid, then return FALSE. */
BOOLEAN EFIAPI AesInit(OUT VOID *AesContext, IN CONST UINT8 *Key, IN UINTN KeyLength)
/* If AesContext is NULL, then return FALSE. If Key is NULL, then return FALSE. If KeyLength is not valid, then return FALSE. */
BOOLEAN EFIAPI AesInit(OUT VOID *AesContext, IN CONST UINT8 *Key, IN UINTN KeyLength)
{
  AES_KEY  *AesKey;
  if ((AesContext == NULL) || (Key == NULL) || ((KeyLength != 128) && (KeyLength != 192) && (KeyLength != 256))) {
    return FALSE;
  }
  AesKey = (AES_KEY *)AesContext;
  if (AES_set_encrypt_key (Key, (UINT32)KeyLength, AesKey) != 0) {
    return FALSE;
  }
  if (AES_set_decrypt_key (Key, (UINT32)KeyLength, AesKey + 1) != 0) {
    return FALSE;
  }
  return TRUE;
}