AES block cipher (FIPS 197), on single blocks or in ECB mode.
More...
|
| int | pbl_aes_expandkey (struct pbl_aes_ctx *ctx, const uint8_t *key, size_t key_len) |
| | Expand a key.
|
| |
| void | pbl_aes_encrypt (const struct pbl_aes_ctx *ctx, uint8_t out[PBL_AES_BLOCK_SIZE], const uint8_t in[PBL_AES_BLOCK_SIZE]) |
| | Encrypt a block.
|
| |
| void | pbl_aes_decrypt (const struct pbl_aes_ctx *ctx, uint8_t out[PBL_AES_BLOCK_SIZE], const uint8_t in[PBL_AES_BLOCK_SIZE]) |
| | Decrypt a block.
|
| |
| int | pbl_aes_ecb_encrypt (const struct pbl_aes_ctx *ctx, uint8_t *out, const uint8_t *in, size_t len) |
| | Encrypt blocks in ECB mode.
|
| |
| int | pbl_aes_ecb_decrypt (const struct pbl_aes_ctx *ctx, uint8_t *out, const uint8_t *in, size_t len) |
| | Decrypt blocks in ECB mode.
|
| |
AES block cipher (FIPS 197), on single blocks or in ECB mode.
Runs of at least CONFIG_CRYPTO_AES_HW_MIN_LEN bytes are processed by a hardware accelerator when a driver provides one (see Crypto), the rest in software. Other modes of operation are built by the caller.
Expanded key.
Definition aes.h:41
int pbl_aes_ecb_encrypt(const struct pbl_aes_ctx *ctx, uint8_t *out, const uint8_t *in, size_t len)
Encrypt blocks in ECB mode.
#define PBL_AES_KEYSIZE_128
Size of an AES-128 key, in bytes.
Definition aes.h:31
int pbl_aes_expandkey(struct pbl_aes_ctx *ctx, const uint8_t *key, size_t key_len)
Expand a key.
◆ pbl_aes_ctx
◆ PBL_AES_BLOCK_SIZE
| #define PBL_AES_BLOCK_SIZE 16U |
Size of a block, in bytes.
◆ PBL_AES_KEYSIZE_128
| #define PBL_AES_KEYSIZE_128 16U |
Size of an AES-128 key, in bytes.
◆ PBL_AES_KEYSIZE_192
| #define PBL_AES_KEYSIZE_192 24U |
Size of an AES-192 key, in bytes.
◆ PBL_AES_KEYSIZE_256
| #define PBL_AES_KEYSIZE_256 32U |
Size of an AES-256 key, in bytes.
◆ PBL_AES_MAX_KEYLENGTH_U32
| #define PBL_AES_MAX_KEYLENGTH_U32 60U |
Most 32-bit words in a key schedule, for AES-256.
◆ pbl_aes_decrypt()
| void pbl_aes_decrypt |
( |
const struct pbl_aes_ctx * |
ctx, |
|
|
uint8_t |
out[PBL_AES_BLOCK_SIZE], |
|
|
const uint8_t |
in[PBL_AES_BLOCK_SIZE] |
|
) |
| |
Decrypt a block.
- Parameters
-
| ctx | Expanded key. |
| [out] | out | Plaintext, which may be in. |
| in | Ciphertext. |
◆ pbl_aes_ecb_decrypt()
| int pbl_aes_ecb_decrypt |
( |
const struct pbl_aes_ctx * |
ctx, |
|
|
uint8_t * |
out, |
|
|
const uint8_t * |
in, |
|
|
size_t |
len |
|
) |
| |
Decrypt blocks in ECB mode.
- Parameters
-
| ctx | Expanded key. |
| [out] | out | Plaintext, which may be in. |
| in | Ciphertext. |
| len | Length of in in bytes, a multiple of PBL_AES_BLOCK_SIZE. |
- Return values
-
◆ pbl_aes_ecb_encrypt()
| int pbl_aes_ecb_encrypt |
( |
const struct pbl_aes_ctx * |
ctx, |
|
|
uint8_t * |
out, |
|
|
const uint8_t * |
in, |
|
|
size_t |
len |
|
) |
| |
Encrypt blocks in ECB mode.
- Parameters
-
| ctx | Expanded key. |
| [out] | out | Ciphertext, which may be in. |
| in | Plaintext. |
| len | Length of in in bytes, a multiple of PBL_AES_BLOCK_SIZE. |
- Return values
-
◆ pbl_aes_encrypt()
| void pbl_aes_encrypt |
( |
const struct pbl_aes_ctx * |
ctx, |
|
|
uint8_t |
out[PBL_AES_BLOCK_SIZE], |
|
|
const uint8_t |
in[PBL_AES_BLOCK_SIZE] |
|
) |
| |
Encrypt a block.
- Parameters
-
| ctx | Expanded key. |
| [out] | out | Ciphertext, which may be in. |
| in | Plaintext. |
◆ pbl_aes_expandkey()
| int pbl_aes_expandkey |
( |
struct pbl_aes_ctx * |
ctx, |
|
|
const uint8_t * |
key, |
|
|
size_t |
key_len |
|
) |
| |
Expand a key.
- Parameters
-
- Return values
-
| 0 | on success. |
| -EINVAL | if key_len is not a valid key size. |