Matthew Shyu | 9f398f2 | 2023-07-12 04:08:27 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
| 2 | /* |
| 3 | * Copyright (c) 2020, Linaro Limited |
| 4 | */ |
| 5 | |
| 6 | #ifndef __CRYPTO_CRYPTO_ACCEL_H |
| 7 | #define __CRYPTO_CRYPTO_ACCEL_H |
| 8 | |
| 9 | #include <linux/types.h> |
| 10 | #include <uboot_aes.h> |
| 11 | |
| 12 | struct aes_block { |
| 13 | u8 b[AES_BLOCK_LENGTH]; |
| 14 | }; |
| 15 | |
| 16 | int crypto_accel_aes_expand_keys(const void *key, size_t key_len, |
| 17 | void *enc_key, void *dec_key, |
| 18 | size_t expanded_key_len, |
| 19 | unsigned int *round_count); |
| 20 | |
| 21 | void crypto_accel_aes_make_dec_key(unsigned int round_count, |
| 22 | const struct aes_block *key_enc, |
| 23 | struct aes_block *key_dec); |
| 24 | |
| 25 | void crypto_accel_aes_ecb_enc(void *out, const void *in, const void *key, |
| 26 | unsigned int round_count, |
| 27 | unsigned int block_count); |
| 28 | void crypto_accel_aes_ecb_dec(void *out, const void *in, const void *key, |
| 29 | unsigned int round_count, |
| 30 | unsigned int block_count); |
| 31 | |
| 32 | void crypto_accel_aes_cbc_enc(void *out, const void *in, const void *key, |
| 33 | unsigned int round_count, |
| 34 | unsigned int block_count, void *iv); |
| 35 | void crypto_accel_aes_cbc_dec(void *out, const void *in, const void *key, |
| 36 | unsigned int round_count, |
| 37 | unsigned int block_count, void *iv); |
| 38 | |
| 39 | void crypto_accel_aes_ctr_be_enc(void *out, const void *in, const void *key, |
| 40 | unsigned int round_count, |
| 41 | unsigned int block_count, void *iv); |
| 42 | |
| 43 | void crypto_accel_aes_xts_enc(void *out, const void *in, const void *key1, |
| 44 | unsigned int round_count, |
| 45 | unsigned int block_count, const void *key2, |
| 46 | void *tweak); |
| 47 | void crypto_accel_aes_xts_dec(void *out, const void *in, const void *key1, |
| 48 | unsigned int round_count, |
| 49 | unsigned int block_count, const void *key2, |
| 50 | void *tweak); |
| 51 | #endif /*__CRYPTO_CRYPTO_ACCEL_H*/ |