1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Crypto acceleration support for Rockchip Crypto V1
4 *
5 * Copyright (c) 2022, Rockchip Electronics Co., Ltd
6 *
7 * Author: Lin Jinhan <troy.lin@rock-chips.com>
8 *
9 */
10 #include "rk_crypto_core.h"
11 #include "rk_crypto_v1.h"
12
13 static const char * const crypto_v1_rsts[] = {
14 "crypto-rst",
15 };
16
17 static struct rk_crypto_algt *crypto_v1_algs[] = {
18 &rk_v1_ecb_aes_alg, /* ecb(aes) */
19 &rk_v1_cbc_aes_alg, /* cbc(aes) */
20
21 &rk_v1_ecb_des_alg, /* ecb(des) */
22 &rk_v1_cbc_des_alg, /* cbc(des) */
23
24 &rk_v1_ecb_des3_ede_alg, /* ecb(des3_ede) */
25 &rk_v1_cbc_des3_ede_alg, /* cbc(des3_ede) */
26
27 &rk_v1_ahash_sha1, /* sha1 */
28 &rk_v1_ahash_sha256, /* sha256 */
29 &rk_v1_ahash_md5, /* md5 */
30 };
31
rk_hw_crypto_v1_init(struct device * dev,void * hw_info)32 int rk_hw_crypto_v1_init(struct device *dev, void *hw_info)
33 {
34 return 0;
35 }
36
rk_hw_crypto_v1_deinit(struct device * dev,void * hw_info)37 void rk_hw_crypto_v1_deinit(struct device *dev, void *hw_info)
38 {
39
40 }
41
rk_hw_crypto_v1_get_rsts(uint32_t * num)42 const char * const *rk_hw_crypto_v1_get_rsts(uint32_t *num)
43 {
44 *num = ARRAY_SIZE(crypto_v1_rsts);
45
46 return crypto_v1_rsts;
47 }
48
rk_hw_crypto_v1_get_algts(uint32_t * num)49 struct rk_crypto_algt **rk_hw_crypto_v1_get_algts(uint32_t *num)
50 {
51 *num = ARRAY_SIZE(crypto_v1_algs);
52
53 return crypto_v1_algs;
54 }
55
rk_hw_crypto_v1_algo_valid(struct rk_crypto_dev * rk_dev,struct rk_crypto_algt * aglt)56 bool rk_hw_crypto_v1_algo_valid(struct rk_crypto_dev *rk_dev, struct rk_crypto_algt *aglt)
57 {
58 return true;
59 }
60
61