Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * sun4i-ss.h - hardware cryptographic accelerator for Allwinner A20 SoC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2013-2015 Corentin LABBE <clabbe.montjoie@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Support AES cipher with 128,192,256 bits keysize.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Support MD5 and SHA1 hash algorithms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Support DES and 3DES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * You could find the datasheet in Documentation/arm/sunxi.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/crypto.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/reset.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <crypto/scatterwalk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/scatterlist.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/pm_runtime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <crypto/md5.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <crypto/skcipher.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <crypto/sha.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <crypto/hash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <crypto/internal/hash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <crypto/internal/skcipher.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <crypto/aes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <crypto/internal/des.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <crypto/internal/rng.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <crypto/rng.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define SS_CTL            0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define SS_KEY0           0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define SS_KEY1           0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define SS_KEY2           0x0C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define SS_KEY3           0x10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define SS_KEY4           0x14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define SS_KEY5           0x18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define SS_KEY6           0x1C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define SS_KEY7           0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define SS_IV0            0x24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define SS_IV1            0x28
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define SS_IV2            0x2C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define SS_IV3            0x30
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define SS_FCSR           0x44
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define SS_MD0            0x4C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define SS_MD1            0x50
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define SS_MD2            0x54
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define SS_MD3            0x58
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define SS_MD4            0x5C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define SS_RXFIFO         0x200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define SS_TXFIFO         0x204
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) /* SS_CTL configuration values */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) /* PRNG generator mode - bit 15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define SS_PRNG_ONESHOT		(0 << 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define SS_PRNG_CONTINUE	(1 << 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) /* IV mode for hash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define SS_IV_ARBITRARY		(1 << 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) /* SS operation mode - bits 12-13 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define SS_ECB			(0 << 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) #define SS_CBC			(1 << 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #define SS_CTS			(3 << 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) /* Counter width for CNT mode - bits 10-11 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #define SS_CNT_16BITS		(0 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define SS_CNT_32BITS		(1 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #define SS_CNT_64BITS		(2 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) /* Key size for AES - bits 8-9 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define SS_AES_128BITS		(0 << 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define SS_AES_192BITS		(1 << 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #define SS_AES_256BITS		(2 << 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) /* Operation direction - bit 7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #define SS_ENCRYPTION		(0 << 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define SS_DECRYPTION		(1 << 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /* SS Method - bits 4-6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) #define SS_OP_AES		(0 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define SS_OP_DES		(1 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define SS_OP_3DES		(2 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define SS_OP_SHA1		(3 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define SS_OP_MD5		(4 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define SS_OP_PRNG		(5 << 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) /* Data end bit - bit 2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define SS_DATA_END		(1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /* PRNG start bit - bit 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define SS_PRNG_START		(1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* SS Enable bit - bit 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define SS_DISABLED		(0 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #define SS_ENABLED		(1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) /* SS_FCSR configuration values */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /* RX FIFO status - bit 30 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define SS_RXFIFO_FREE		(1 << 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /* RX FIFO empty spaces - bits 24-29 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define SS_RXFIFO_SPACES(val)	(((val) >> 24) & 0x3f)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* TX FIFO status - bit 22 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define SS_TXFIFO_AVAILABLE	(1 << 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /* TX FIFO available spaces - bits 16-21 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define SS_TXFIFO_SPACES(val)	(((val) >> 16) & 0x3f)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define SS_RX_MAX	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define SS_RX_DEFAULT	SS_RX_MAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define SS_TX_MAX	33
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define SS_RXFIFO_EMP_INT_PENDING	(1 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define SS_TXFIFO_AVA_INT_PENDING	(1 << 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define SS_RXFIFO_EMP_INT_ENABLE	(1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define SS_TXFIFO_AVA_INT_ENABLE	(1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define SS_SEED_LEN 192
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define SS_DATA_LEN 160
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * struct ss_variant - Describe SS hardware variant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * @sha1_in_be:		The SHA1 digest is given by SS in BE, and so need to be inverted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) struct ss_variant {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	bool sha1_in_be;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) struct sun4i_ss_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	const struct ss_variant *variant;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	void __iomem *base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	struct clk *busclk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	struct clk *ssclk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	struct reset_control *reset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	struct resource *res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	spinlock_t slock; /* control the use of the device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	u32 seed[SS_SEED_LEN / BITS_PER_LONG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct sun4i_ss_alg_template {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	u32 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	u32 mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		struct skcipher_alg crypto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		struct ahash_alg hash;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		struct rng_alg rng;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	} alg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	struct sun4i_ss_ctx *ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct sun4i_tfm_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	u32 key[AES_MAX_KEY_SIZE / 4];/* divided by sizeof(u32) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	u32 keylen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	u32 keymode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct sun4i_ss_ctx *ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	struct crypto_skcipher *fallback_tfm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct sun4i_cipher_req_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	u32 mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	struct skcipher_request fallback_req;   // keep at the end
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct sun4i_req_ctx {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	u32 mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	u64 byte_count; /* number of bytes "uploaded" to the device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	u32 hash[5]; /* for storing SS_IVx register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	char buf[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	unsigned int len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	int flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) int sun4i_hash_crainit(struct crypto_tfm *tfm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) void sun4i_hash_craexit(struct crypto_tfm *tfm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) int sun4i_hash_init(struct ahash_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) int sun4i_hash_update(struct ahash_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) int sun4i_hash_final(struct ahash_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) int sun4i_hash_finup(struct ahash_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) int sun4i_hash_digest(struct ahash_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) int sun4i_hash_export_md5(struct ahash_request *areq, void *out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int sun4i_hash_import_md5(struct ahash_request *areq, const void *in);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int sun4i_hash_export_sha1(struct ahash_request *areq, void *out);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) int sun4i_hash_import_sha1(struct ahash_request *areq, const void *in);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) int sun4i_ss_cbc_aes_encrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) int sun4i_ss_cbc_aes_decrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) int sun4i_ss_ecb_aes_encrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int sun4i_ss_ecb_aes_decrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) int sun4i_ss_cbc_des_encrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) int sun4i_ss_cbc_des_decrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) int sun4i_ss_ecb_des_encrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) int sun4i_ss_ecb_des_decrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) int sun4i_ss_cbc_des3_encrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) int sun4i_ss_cbc_des3_decrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) int sun4i_ss_ecb_des3_encrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int sun4i_ss_ecb_des3_decrypt(struct skcipher_request *areq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) int sun4i_ss_cipher_init(struct crypto_tfm *tfm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) void sun4i_ss_cipher_exit(struct crypto_tfm *tfm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) int sun4i_ss_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			unsigned int keylen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int sun4i_ss_des_setkey(struct crypto_skcipher *tfm, const u8 *key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 			unsigned int keylen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) int sun4i_ss_des3_setkey(struct crypto_skcipher *tfm, const u8 *key,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			 unsigned int keylen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) int sun4i_ss_prng_generate(struct crypto_rng *tfm, const u8 *src,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			   unsigned int slen, u8 *dst, unsigned int dlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int sun4i_ss_prng_seed(struct crypto_rng *tfm, const u8 *seed, unsigned int slen);