1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019 HiSilicon Limited. */
4 #ifndef __HISI_SEC_V2_CRYPTO_H
5 #define __HISI_SEC_V2_CRYPTO_H
8 #define SEC_MAX_KEY_SIZE 64
9 #define SEC_COMM_SCENE 0
18 SEC_A_HMAC_SHA1
= 0x10,
19 SEC_A_HMAC_SHA256
= 0x11,
20 SEC_A_HMAC_SHA512
= 0x15,
24 SEC_HMAC_SHA1_MAC
= 20,
25 SEC_HMAC_SHA256_MAC
= 32,
26 SEC_HMAC_SHA512_MAC
= 64,
37 SEC_CKEY_128BIT
= 0x0,
38 SEC_CKEY_192BIT
= 0x1,
39 SEC_CKEY_256BIT
= 0x2,
40 SEC_CKEY_3DES_3KEY
= 0x1,
41 SEC_CKEY_3DES_2KEY
= 0x3,
66 struct sec_sqe_type2
{
70 * a_key_len: 5~10 bits
78 * c_key_len: 9~11 bits
89 * iv_offset_l: 24~31 bits
95 * iv_offset_h: 24~31 bits
99 __le16 auth_src_offset
;
100 __le16 cipher_src_offset
;
101 __le16 cs_ip_header_offset
;
102 __le16 cs_udp_header_offset
;
103 __le16 pass_word_len
;
114 * c_pad_type: 0~3 bits
115 * c_pad_len: 4~11 bits
116 * c_pad_data_type: 12~15 bits
120 /* c_pad_len_field: 0~1 bits */
121 __le16 c_pad_len_field
;
124 __le64 long_a_data_len
;
131 __le64 data_src_addr
;
132 __le64 data_dst_addr
;
139 * dif_check: 11~13 bits
161 __u8 type_cipher_auth
;
167 * src_addr_type: ~7 bit, with sdm_addr_type 0-1 bits
172 * src_addr_type: 0~1 bits, not used now,
173 * if support PRP, set this field, or set zero.
174 * dst_addr_type: 2~4 bits
175 * mac_addr_type: 5~7 bits
181 * nonce_len(type2): 0~3 bits
183 * key_s(type2): 5 bit
190 * a_pad(type2): 2~3 bits
191 * c_s(type2): 4~5 bits
197 * c_key_type: 1~2 bits
198 * a_key_type: 3~4 bits
199 * write_frame_len(type2): 5~7 bits
204 * cal_iv_addr_en(type2): 0 bit
205 * tls_up(type2): 1 bit
210 /* Just using type2 BD now */
211 struct sec_sqe_type2 type2
;
214 int sec_register_to_crypto(void);
215 void sec_unregister_from_crypto(void);