1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __HI_CIPHER_COMPAT_H__ 20 #define __HI_CIPHER_COMPAT_H__ 21 22 #include "hi_types.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif /* __cplusplus */ 29 30 #define HI_CIPHER_DES_IV_SIZE_IN_WORD 2 31 #define HI_CIPHER_IV_SIZE_IN_WORD 4 32 #define HI_CIPHER_DES_KEY_SIZE_IN_WORD 2 33 #define HI_CIPHER_TDES_KEY_SIZE_IN_WORD 6 34 #define HI_CIPHER_AES_KEY_SIZE_IN_WORD 8 35 #define HI_CIPHER_SM1_KEY_SIZE_IN_WORD 4 36 #define HI_CIPHER_SM4_KEY_SIZE_IN_WORD 4 37 38 /* CIPHER set IV for first package */ 39 #define HI_CIPHER_IV_CHG_ONE_PACK 1 40 41 /* CIPHER set IV for first package */ 42 #define HI_CIPHER_IV_CHG_ALL_PACK 2 43 44 #define HI_ERR_CIPHER_INVALID_PARAM 0x804D0004 45 #define HI_ERR_CIPHER_INVALID_LEN 0x804D0018 46 47 /* enum typedef */ 48 /* Cipher work mode. */ 49 typedef enum { 50 HI_CIPHER_WORK_MODE_ECB = 0x0, /* Electronic codebook (ECB) mode, ECB has been considered insecure and it is 51 recommended not to use it. */ 52 HI_CIPHER_WORK_MODE_CBC, /* Cipher block chaining (CBC) mode. */ 53 HI_CIPHER_WORK_MODE_CFB, /* Cipher feedback (CFB) mode. */ 54 HI_CIPHER_WORK_MODE_OFB, /* Output feedback (OFB) mode. */ 55 HI_CIPHER_WORK_MODE_CTR, /* Counter (CTR) mode. */ 56 HI_CIPHER_WORK_MODE_CCM, /* Counter (CCM) mode. */ 57 HI_CIPHER_WORK_MODE_GCM, /* Counter (GCM) mode. */ 58 HI_CIPHER_WORK_MODE_CBC_CTS, /* Cipher block chaining CipherStealing mode. */ 59 HI_CIPHER_WORK_MODE_BUTT, 60 HI_CIPHER_WORK_MODE_INVALID = 0xffffffff, 61 } hi_cipher_work_mode; 62 63 /* Cipher algorithm. */ 64 typedef enum { 65 HI_CIPHER_ALG_DES = 0x0, /* Data encryption standard (DES) algorithm, DES has been considered 66 insecure and it is recommended not to use it. */ 67 HI_CIPHER_ALG_3DES = 0x1, /* 3DES algorithm. */ 68 HI_CIPHER_ALG_AES = 0x2, /* Advanced encryption standard (AES) algorithm. */ 69 HI_CIPHER_ALG_SM1 = 0x3, /* SM1 algorithm. */ 70 HI_CIPHER_ALG_SM4 = 0x4, /* SM4 algorithm. */ 71 HI_CIPHER_ALG_DMA = 0x5, /* DMA copy. */ 72 HI_CIPHER_ALG_BUTT = 0x6, 73 HI_CIPHER_ALG_INVALID = 0xffffffff, 74 } hi_cipher_alg; 75 76 /* Key length. */ 77 typedef enum { 78 HI_CIPHER_KEY_AES_128BIT = 0x0, /* 128-bit key for the AES algorithm. */ 79 HI_CIPHER_KEY_AES_192BIT = 0x1, /* 192-bit key for the AES algorithm. */ 80 HI_CIPHER_KEY_AES_256BIT = 0x2, /* 256-bit key for the AES algorithm. */ 81 HI_CIPHER_KEY_DES_3KEY = 0x2, /* Three keys for the DES algorithm. */ 82 HI_CIPHER_KEY_DES_2KEY = 0x3, /* Two keys for the DES algorithm. */ 83 HI_CIPHER_KEY_DEFAULT = 0x0, /* Default key length, DES-8, SM1-48, SM4-16. */ 84 HI_CIPHER_KEY_INVALID = 0xffffffff, 85 } hi_cipher_key_len; 86 87 /* Cipher bit width. */ 88 typedef enum { 89 HI_CIPHER_BIT_WIDTH_64BIT = 0x0, /* 64-bit width */ 90 HI_CIPHER_BIT_WIDTH_8BIT = 0x1, /* 8-bit width */ 91 HI_CIPHER_BIT_WIDTH_1BIT = 0x2, /* 1-bit width */ 92 HI_CIPHER_BIT_WIDTH_128BIT = 0x3, /* 128-bit width */ 93 HI_CIPHER_BIT_WIDTH_INVALID = 0xffffffff, 94 } hi_cipher_bit_width; 95 96 /* Key ladder selecting parameters. */ 97 typedef enum { 98 HI_CIPHER_KEY_SRC_USER = 0x0, /* User Key. */ 99 HI_CIPHER_KEY_SRC_KLAD_1, /* KLAD Key 1. */ 100 HI_CIPHER_KEY_SRC_KLAD_2, /* KLAD Key 2. */ 101 HI_CIPHER_KEY_SRC_KLAD_3, /* KLAD Key 3. */ 102 HI_CIPHER_KEY_SRC_BUTT, 103 HI_CIPHER_KEY_SRC_INVALID = 0xffffffff, 104 } hi_cipher_ca_type; 105 106 /** Klad target. */ 107 typedef enum { 108 HI_CIPHER_KLAD_TARGET_AES = 0x0, /* Klad for AES. */ 109 HI_CIPHER_KLAD_TARGET_RSA, /* Klad for RSA. */ 110 HI_CIPHER_KLAD_TARGET_BUTT, 111 } hi_cipher_klad_target; 112 113 /* Encryption/Decryption type selecting. */ 114 typedef enum { 115 HI_CIPHER_TYPE_NORMAL = 0x0, 116 HI_CIPHER_TYPE_COPY_AVOID, 117 HI_CIPHER_TYPE_BUTT, 118 HI_CIPHER_TYPE_INVALID = 0xffffffff, 119 } hi_cipher_type; 120 121 /* SM1 round config */ 122 typedef enum { 123 HI_CIPHER_SM1_ROUND_08 = 0x00, /* SM1 round 08. */ 124 HI_CIPHER_SM1_ROUND_10 = 0x01, /* SM1 round 10. */ 125 HI_CIPHER_SM1_ROUND_12 = 0x02, /* SM1 round 12. */ 126 HI_CIPHER_SM1_ROUND_14 = 0x03, /* SM1 round 14. */ 127 HI_CIPHER_SM1_ROUND_BUTT, 128 HI_CIPHER_SM1_ROUND_INVALID = 0xffffffff, 129 } hi_cipher_sm1_round; 130 131 /* Hash algorithm type. */ 132 typedef enum { 133 HI_CIPHER_HASH_TYPE_SHA1, 134 HI_CIPHER_HASH_TYPE_SHA224, 135 HI_CIPHER_HASH_TYPE_SHA256, 136 HI_CIPHER_HASH_TYPE_SHA384, 137 HI_CIPHER_HASH_TYPE_SHA512, 138 HI_CIPHER_HASH_TYPE_HMAC_SHA1, 139 HI_CIPHER_HASH_TYPE_HMAC_SHA224, 140 HI_CIPHER_HASH_TYPE_HMAC_SHA256, 141 HI_CIPHER_HASH_TYPE_HMAC_SHA384, 142 HI_CIPHER_HASH_TYPE_HMAC_SHA512, 143 HI_CIPHER_HASH_TYPE_SM3, 144 HI_CIPHER_HASH_TYPE_BUTT, 145 HI_CIPHER_HASH_TYPE_INVALID = 0xffffffff, 146 } hi_cipher_hash_type; 147 148 /* Rsa encrypt and decrypt scheme. */ 149 typedef enum { 150 HI_CIPHER_RSA_ENCRYPT_SCHEME_NO_PADDING = 0x00, /* without padding. */ 151 HI_CIPHER_RSA_ENCRYPT_SCHEME_BLOCK_TYPE_0, /* PKCS#1 block type 0 padding. */ 152 HI_CIPHER_RSA_ENCRYPT_SCHEME_BLOCK_TYPE_1, /* PKCS#1 block type 1padding. */ 153 HI_CIPHER_RSA_ENCRYPT_SCHEME_BLOCK_TYPE_2, /* PKCS#1 block type 2 padding. */ 154 HI_CIPHER_RSA_ENCRYPT_SCHEME_RSAES_OAEP_SHA1, /* PKCS#1 RSAES-OAEP-SHA1 padding. */ 155 HI_CIPHER_RSA_ENCRYPT_SCHEME_RSAES_OAEP_SHA224, /* PKCS#1 RSAES-OAEP-SHA224 padding. */ 156 HI_CIPHER_RSA_ENCRYPT_SCHEME_RSAES_OAEP_SHA256, /* PKCS#1 RSAES-OAEP-SHA256 padding. */ 157 HI_CIPHER_RSA_ENCRYPT_SCHEME_RSAES_OAEP_SHA384, /* PKCS#1 RSAES-OAEP-SHA384 padding. */ 158 HI_CIPHER_RSA_ENCRYPT_SCHEME_RSAES_OAEP_SHA512, /* PKCS#1 RSAES-OAEP-SHA512 padding. */ 159 HI_CIPHER_RSA_ENCRYPT_SCHEME_RSAES_PKCS1_V1_5, /* PKCS#1 RSAES-PKCS1_V1_5 padding. */ 160 HI_CIPHER_RSA_ENCRYPT_SCHEME_BUTT, 161 HI_CIPHER_RSA_ENCRYPT_SCHEME_INVALID = 0xffffffff, 162 } hi_cipher_rsa_encrypt_scheme; 163 164 /* Rsa sign and verify scheme. */ 165 typedef enum { 166 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA1 = 0x100, /* PKCS#1 RSASSA_PKCS1_V15_SHA1 signature. */ 167 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA224, /* PKCS#1 RSASSA_PKCS1_V15_SHA224 signature. */ 168 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA256, /* PKCS#1 RSASSA_PKCS1_V15_SHA256 signature. */ 169 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA384, /* PKCS#1 RSASSA_PKCS1_V15_SHA384 signature. */ 170 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_V15_SHA512, /* PKCS#1 RSASSA_PKCS1_V15_SHA512 signature. */ 171 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA1, /* PKCS#1 RSASSA_PKCS1_PSS_SHA1 signature. */ 172 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA224, /* PKCS#1 RSASSA_PKCS1_PSS_SHA224 signature. */ 173 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA256, /* PKCS#1 RSASSA_PKCS1_PSS_SHA256 signature. */ 174 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA384, /* PKCS#1 RSASSA_PKCS1_PSS_SHA1 signature. */ 175 HI_CIPHER_RSA_SIGN_SCHEME_RSASSA_PKCS1_PSS_SHA512, /* PKCS#1 RSASSA_PKCS1_PSS_SHA256 signature. */ 176 HI_CIPHER_RSA_SIGN_SCHEME_BUTT, 177 HI_CIPHER_RSA_SIGN_SCHEME_INVALID = 0xffffffff, 178 } hi_cipher_rsa_sign_scheme; 179 180 /* struct define. */ 181 /* Cipher control parameters. */ 182 typedef struct { 183 hi_u32 bits_iv : 2; /* Initial Vector change flag, 0-don't set, 1-set IV for first package, 2-set 184 IV for each package. */ 185 hi_u32 bits_resv : 30; /* Reserved. */ 186 } hi_cipher_ctrl_chg_flag; 187 188 /* Structure of the cipher type */ 189 typedef struct { 190 hi_cipher_type cipher_type; 191 } hi_cipher_attr; 192 193 /* Structure of the cipher control information */ 194 typedef struct { 195 hi_u32 key[HI_CIPHER_AES_KEY_SIZE_IN_WORD]; /* Key input */ 196 hi_u32 iv[HI_CIPHER_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 197 hi_bool key_by_ca; /* Encryption using advanced conditional access (CA) or decryption using keys */ 198 hi_cipher_ca_type ca_type; /* Select keyladder type when using advanced CA */ 199 hi_cipher_alg alg; /* Cipher algorithm */ 200 hi_cipher_bit_width bit_width; /* Bit width for encryption or decryption */ 201 hi_cipher_work_mode work_mode; /* Operating mode */ 202 hi_cipher_key_len key_len; /* Key length */ 203 hi_cipher_ctrl_chg_flag chg_flags; /* control information exchange choices, we default all would be change 204 except they have been in the choices */ 205 } hi_cipher_ctrl; 206 207 /* Structure of the cipher AES control information */ 208 typedef struct { 209 hi_u32 even_key[HI_CIPHER_AES_KEY_SIZE_IN_WORD]; /* Key input, default use this key. */ 210 hi_u32 odd_key[HI_CIPHER_AES_KEY_SIZE_IN_WORD]; /* Key input, only valid for Multi encrypt/decrypt. */ 211 hi_u32 iv[HI_CIPHER_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 212 hi_cipher_bit_width bit_width; /* Bit width for encryption or decryption */ 213 hi_cipher_key_len key_len; /* Key length */ 214 hi_cipher_ctrl_chg_flag chg_flags; /* control information exchange choices, we default all woulde be change 215 except they have been in the choices */ 216 } hi_cipher_ctrl_aes; 217 218 /* Structure of the cipher AES CCM/GCM control information */ 219 typedef struct { 220 hi_u32 key[HI_CIPHER_AES_KEY_SIZE_IN_WORD]; /* Key input */ 221 hi_u32 iv[HI_CIPHER_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 222 hi_cipher_key_len key_len; /* Key length */ 223 hi_u32 iv_len; /* IV length for CCM/GCM, which is an element of {7, 8, 9, 10, 11, 12, 13} 224 for CCM, and is an element of [1-16] for GCM. */ 225 hi_u32 tag_len; /* Tag length for CCM which is an element of {4,6,8,10,12,14,16}. */ 226 hi_u32 aad_len; /* Associated data for CCM and GCM. */ 227 hi_phys_addr_t aad_phys_addr; /* Physical address of Associated data for CCM and GCM. */ 228 } hi_cipher_ctrl_aes_ccm_gcm; 229 230 /* Structure of the cipher DES control information */ 231 typedef struct { 232 hi_u32 key[HI_CIPHER_DES_KEY_SIZE_IN_WORD]; /* Key input */ 233 hi_u32 iv[HI_CIPHER_DES_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 234 hi_cipher_bit_width bit_width; /* Bit width for encryption or decryption */ 235 hi_cipher_ctrl_chg_flag chg_flags; /* Control information exchange choices, we default all woulde be change 236 except they have been in the choices */ 237 } hi_cipher_ctrl_des; 238 239 /* Structure of the cipher 3DES control information */ 240 typedef struct { 241 hi_u32 key[HI_CIPHER_TDES_KEY_SIZE_IN_WORD]; 242 hi_u32 iv[HI_CIPHER_DES_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 243 hi_cipher_bit_width bit_width; /* Bit width for encryption or decryption */ 244 hi_cipher_key_len key_len; /* Key length */ 245 hi_cipher_ctrl_chg_flag chg_flags; /* control information exchange choices, we default all woulde be change 246 except they have been in the choices */ 247 } hi_cipher_ctrl_3des; 248 249 /* Structure of the cipher SM1 control information */ 250 typedef struct { 251 hi_u32 ek[HI_CIPHER_SM1_KEY_SIZE_IN_WORD]; /* Key of EK input */ 252 hi_u32 ak[HI_CIPHER_SM1_KEY_SIZE_IN_WORD]; /* Key of AK input */ 253 hi_u32 sk[HI_CIPHER_SM1_KEY_SIZE_IN_WORD]; /* Key of SK input */ 254 hi_u32 iv[HI_CIPHER_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 255 hi_cipher_bit_width bit_width; /* Bit width for encryption or decryption */ 256 hi_cipher_sm1_round sm1_round; /* SM1 round number, should be 8, 10, 12 or 14. */ 257 hi_cipher_ctrl_chg_flag chg_flags; /* control information exchange choices, we default all woulde be change 258 except they have been in the choices */ 259 } hi_cipher_ctrl_sm1; 260 261 /* Structure of the cipher SM4 control information */ 262 typedef struct { 263 hi_u32 key[HI_CIPHER_SM4_KEY_SIZE_IN_WORD]; /* Key input */ 264 hi_u32 iv[HI_CIPHER_IV_SIZE_IN_WORD]; /* Initialization vector (IV) */ 265 hi_cipher_ctrl_chg_flag chg_flags; /* control information exchange choices, we default all woulde be change 266 except they have been in the choices */ 267 } hi_cipher_ctrl_sm4; 268 269 /* Expand Structure of the cipher control information */ 270 typedef struct { 271 hi_cipher_alg alg; /* Cipher algorithm. */ 272 hi_cipher_work_mode work_mode; /* Operating mode. */ 273 hi_bool key_by_ca; /* Encryption using advanced conditional access (CA) or decryption using keys. */ 274 275 /* Parameter for special algorithm 276 * for AES, the pointer should point to hi_cipher_ctrl_aes; 277 * for AES_CCM or AES_GCM, the pointer should point to hi_cipher_ctrl_aes_ccm_gcm; 278 * for DES, the pointer should point to hi_cipher_ctrl_des; 279 * for 3DES, the pointer should point to hi_cipher_ctrl_3des; 280 * for SM1, the pointer should point to hi_cipher_ctrl_sm1; 281 * for SM4, the pointer should point to hi_cipher_ctrl_sm4; 282 */ 283 hi_void *param; 284 } hi_cipher_ctrl_ex; 285 286 /* Cipher data */ 287 typedef struct { 288 hi_phys_addr_t src_phys_addr; /* phy address of the original data. */ 289 hi_phys_addr_t dst_phys_addr; /* phy address of the purpose data. */ 290 hi_u32 byte_len; /* Cigher data length. */ 291 hi_bool odd_key; /* Use odd key or even key. */ 292 } hi_cipher_data; 293 294 /* Hash init struct input */ 295 typedef struct { 296 hi_u8 *hmac_key; 297 hi_u32 hmac_key_len; 298 hi_cipher_hash_type sha_type; 299 } hi_cipher_hash_attr; 300 301 /* RSA public key struct */ 302 typedef struct { 303 hi_u8 *n; /* Point to public modulus. */ 304 hi_u8 *e; /* Point to public exponent. */ 305 hi_u16 n_len; /* Length of public modulus, max value is 512Byte. */ 306 hi_u16 e_len; /* Length of public exponent, max value is 512Byte. */ 307 } hi_cipher_rsa_pub_key; 308 309 /* RSA private key struct */ 310 typedef struct { 311 hi_u8 *n; /* Public modulus N. */ 312 hi_u8 *e; /* Public exponent E. */ 313 hi_u8 *d; /* Private exponent D. */ 314 hi_u8 *p; /* 1st prime factor P. */ 315 hi_u8 *q; /* 2nd prime factor Q. */ 316 hi_u8 *dp; /* descript:d % (p - 1) is DP. */ 317 hi_u8 *dq; /* descript:d % (q - 1) is DQ. */ 318 hi_u8 *qp; /* descript:1 / (q % p) is QP. */ 319 hi_u16 n_len; /* Length of public modulus */ 320 hi_u16 e_len; /* Length of public exponent */ 321 hi_u16 d_len; /* Length of private exponent */ 322 hi_u16 p_len; /* Length of 1st prime factor,should be half of n_len */ 323 hi_u16 q_len; /* Length of 2nd prime factor,should be half of n_len */ 324 hi_u16 dp_len; /* Length of D % (P - 1),should be half of n_len */ 325 hi_u16 dq_len; /* Length of D % (Q - 1),should be half of n_len */ 326 hi_u16 qp_len; /* Length of 1 / (Q % P),should be half of n_len */ 327 } hi_cipher_rsa_private_key; 328 329 /* RSA public key encryption struct input */ 330 typedef struct { 331 hi_cipher_rsa_encrypt_scheme scheme; /* RSA encryption scheme */ 332 hi_cipher_rsa_pub_key pub_key; /* RSA public key struct */ 333 hi_cipher_ca_type ca_type; /* CA type. */ 334 } hi_cipher_rsa_pub_encrypt; 335 336 /* RSA private key decryption struct input */ 337 typedef struct { 338 hi_cipher_rsa_encrypt_scheme scheme; /* RSA encryption scheme */ 339 hi_cipher_rsa_private_key private_key; /* RSA private key struct */ 340 hi_cipher_ca_type ca_type; /* CA type. */ 341 } hi_cipher_rsa_private_encrypt; 342 343 /* RSA signature struct input */ 344 typedef struct { 345 hi_cipher_rsa_sign_scheme scheme; /* RSA signature scheme. */ 346 hi_cipher_rsa_private_key private_key; /* RSA private key struct */ 347 hi_cipher_ca_type ca_type; /* CA type. */ 348 } hi_cipher_rsa_sign; 349 350 /* RSA signature verify struct input */ 351 typedef struct { 352 hi_cipher_rsa_sign_scheme scheme; /* RSA signature scheme. */ 353 hi_cipher_rsa_pub_key pub_key; /* RSA public key struct */ 354 } hi_cipher_rsa_verify; 355 356 typedef struct { 357 const hi_u8 *in; /* Input data to be cryption. */ 358 hi_u32 in_len; /* Length of input data. */ 359 hi_u8 *out; /* Output data. */ 360 hi_u32 out_buf_len; /* Length of output buffer. */ 361 hi_u32 *out_len; /* Length of output valid data. */ 362 } hi_cipher_rsa_crypt; 363 364 typedef struct { 365 const hi_u8 *in; /* Input data to be cryption. */ 366 hi_u32 in_len; /* Length of input data. */ 367 const hi_u8 *hash_data; /* Hash data. */ 368 hi_u32 hash_data_len; /* Length of hash data. */ 369 hi_u8 *sign; /* Sign output data. */ 370 hi_u32 sign_buf_len; /* Length of sign output buffer. */ 371 hi_u32 *sign_len; /* Length of sign output valid data. */ 372 } hi_cipher_sign_data; 373 374 typedef struct { 375 const hi_u8 *in; /* Input data to be cryption. */ 376 hi_u32 in_len; /* Length of input data. */ 377 const hi_u8 *hash_data; /* Hash data. */ 378 hi_u32 hash_data_len; /* Length of hash data. */ 379 const hi_u8 *sign; /* Input sign data. */ 380 hi_u32 sign_len; /* Length of input sign data. */ 381 } hi_cipher_verify_data; 382 383 /* bignum modular exponentiation struct. */ 384 typedef struct { 385 const hi_u8 *n; /* RSA input N */ 386 const hi_u8 *k; /* RSA input E/D */ 387 const hi_u8 *in; /* RSA input data */ 388 hi_u8 *out; /* RSA output data */ 389 hi_u16 length; /* RSA N/E/D, input/output data length */ 390 } hi_cipher_bg_exp_mod; 391 392 #ifdef __cplusplus 393 #if __cplusplus 394 } 395 #endif 396 #endif /* __cplusplus */ 397 398 #endif /* __HI_CIPHER_COMPAT_H__ */ 399