| 1 | #ifndef _CRYPTO_AES_H_ |
| 2 | #define _CRYPTO_AES_H_ |
| 3 | |
| 4 | #include <stddef.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | /* Opaque structure. */ |
| 8 | struct crypto_aes_key; |
| 9 | |
| 10 | /** |
| 11 | * crypto_aes_key_expand(key, len): |
| 12 | * Expand the ${len}-byte AES key ${key} into a structure which can be passed |
| 13 | * to crypto_aes_encrypt_block. The length must be 16 or 32. |
| 14 | */ |
| 15 | struct crypto_aes_key * crypto_aes_key_expand(const uint8_t *, size_t); |
| 16 | |
| 17 | /** |
| 18 | * crypto_aes_encrypt_block(in, out, key): |
| 19 | * Using the expanded AES key ${key}, encrypt the block ${in} and write the |
| 20 | * resulting ciphertext to ${out}. |
| 21 | */ |
| 22 | void crypto_aes_encrypt_block(const uint8_t *, uint8_t *, |
| 23 | const struct crypto_aes_key *); |
| 24 | |
| 25 | /** |
| 26 | * crypto_aes_key_free(key): |
| 27 | * Free the expanded AES key ${key}. |
| 28 | */ |
| 29 | void crypto_aes_key_free(struct crypto_aes_key *); |
| 30 | |
| 31 | #endif /* !_CRYPTO_AES_H_ */ |