Defines | |
#define | AES_NB 4 |
#define | ROTATE_RIGHT32(x, n) (((x) >> (n)) | ((x) << (32-(n)))) |
#define | LOAD32H(x, y) |
#define | STORE32H(x, y) |
#define | AES_FT0(x) AesForwardTable[x] |
#define | AES_FT1(x) ROTATE_RIGHT32(AesForwardTable[x], 8) |
#define | AES_FT2(x) ROTATE_RIGHT32(AesForwardTable[x], 16) |
#define | AES_FT3(x) ROTATE_RIGHT32(AesForwardTable[x], 24) |
Functions | |
EFI_STATUS EFIAPI | AesExpandKey (IN UINT8 *Key, IN UINTN KeyLenInBits, OUT AES_KEY *AesKey) |
EFI_STATUS EFIAPI | AesEncrypt (IN UINT8 *Key, IN UINT8 *InData, OUT UINT8 *OutData) |
Variables | |
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 | AesForwardTable [] |
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 | Rcon [] |
Copyright (c) 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define AES_FT0 | ( | x | ) | AesForwardTable[x] |
Referenced by AesEncrypt(), and AesExpandKey().
#define AES_FT1 | ( | x | ) | ROTATE_RIGHT32(AesForwardTable[x], 8) |
Referenced by AesEncrypt(), and AesExpandKey().
#define AES_FT2 | ( | x | ) | ROTATE_RIGHT32(AesForwardTable[x], 16) |
Referenced by AesEncrypt(), and AesExpandKey().
#define AES_FT3 | ( | x | ) | ROTATE_RIGHT32(AesForwardTable[x], 24) |
Referenced by AesEncrypt(), and AesExpandKey().
#define AES_NB 4 |
Referenced by AesEncrypt(), and AesExpandKey().
#define LOAD32H | ( | x, | |||
y | ) |
Value:
{ x = ((UINT32)((y)[0] & 0xFF) << 24) | ((UINT32)((y)[1] & 0xFF) << 16) | \ ((UINT32)((y)[2] & 0xFF) << 8) | ((UINT32)((y)[3] & 0xFF)); }
Referenced by AesEncrypt(), and AesExpandKey().
#define ROTATE_RIGHT32 | ( | x, | |||
n | ) | (((x) >> (n)) | ((x) << (32-(n)))) |
#define STORE32H | ( | x, | |||
y | ) |
Value:
{ (y)[0] = (UINT8)(((x) >> 24) & 0xFF); (y)[1] = (UINT8)(((x) >> 16) & 0xFF); \ (y)[2] = (UINT8)(((x) >> 8) & 0xFF); (y)[3] = (UINT8)((x) & 0xFF); }
Referenced by AesEncrypt().
EFI_STATUS EFIAPI AesEncrypt | ( | IN UINT8 * | Key, | |
IN UINT8 * | InData, | |||
OUT UINT8 * | OutData | |||
) |
Encrypts one single block data (128 bits) with AES algorithm.
[in] | Key | AES symmetric key buffer. |
[in] | InData | One block of input plaintext to be encrypted. |
[out] | OutData | Encrypted output ciphertext. |
EFI_SUCCESS | AES Block Encryption succeeded. | |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
References AES_FT0, AES_FT1, AES_FT2, AES_FT3, AES_NB, AesExpandKey(), LOAD32H, STORE32H, and UINTN().
Referenced by RdRandGetSeed128().
EFI_STATUS EFIAPI AesExpandKey | ( | IN UINT8 * | Key, | |
IN UINTN | KeyLenInBits, | |||
OUT AES_KEY * | AesKey | |||
) |
AES Key Expansion. This function expands the cipher key into encryption schedule.
[in] | Key | AES symmetric key buffer. |
[in] | KeyLenInBits | Key length in bits (128, 192, or 256). |
[out] | AesKey | Expanded AES Key schedule for encryption. |
EFI_SUCCESS | AES key expansion succeeded. | |
EFI_INVALID_PARAMETER | Unsupported key length. |
References AES_FT0, AES_FT1, AES_FT2, AES_FT3, AES_NB, LOAD32H, Rcon, and UINTN().
Referenced by AesEncrypt().
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 AesForwardTable[] |
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT32 Rcon[] |
Initial value:
{ 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000 }
Referenced by AesExpandKey().