blob: abe5faee8e6116b28e9c90c186d57a2867b74103 [file] [log] [blame]
Matthew Shyu9f398f22023-07-12 04:08:27 -07001/* 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
12struct aes_block {
13 u8 b[AES_BLOCK_LENGTH];
14};
15
16int 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
21void crypto_accel_aes_make_dec_key(unsigned int round_count,
22 const struct aes_block *key_enc,
23 struct aes_block *key_dec);
24
25void crypto_accel_aes_ecb_enc(void *out, const void *in, const void *key,
26 unsigned int round_count,
27 unsigned int block_count);
28void crypto_accel_aes_ecb_dec(void *out, const void *in, const void *key,
29 unsigned int round_count,
30 unsigned int block_count);
31
32void 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);
35void 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
39void 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
43void 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);
47void 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*/