rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2007 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * che_trick.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * CHE Trick define. |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * removed! |
| 67 | * |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * removed! |
| 71 | * |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * removed! |
| 75 | * |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * removed! |
| 79 | * |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * removed! |
| 83 | * |
| 84 | * removed! |
| 85 | * removed! |
| 86 | * removed! |
| 87 | * |
| 88 | * removed! |
| 89 | * removed! |
| 90 | * removed! |
| 91 | * |
| 92 | * removed! |
| 93 | * removed! |
| 94 | * removed! |
| 95 | * |
| 96 | * removed! |
| 97 | * removed! |
| 98 | * removed! |
| 99 | * |
| 100 | * removed! |
| 101 | * removed! |
| 102 | * removed! |
| 103 | * |
| 104 | * removed! |
| 105 | * removed! |
| 106 | * removed! |
| 107 | * |
| 108 | *------------------------------------------------------------------------------ |
| 109 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 110 | *============================================================================ |
| 111 | ****************************************************************************/ |
| 112 | |
| 113 | #ifndef __CHE_TRICK_H__ |
| 114 | #define __CHE_TRICK_H__ |
| 115 | |
| 116 | #define TRICK_CHE_MD5 1 |
| 117 | #define TRICK_CHE_SHA224 1 |
| 118 | #define TRICK_CHE_SHA256 1 |
| 119 | //#define TRICK_CHE_SHA1 1 |
| 120 | #define TRICK_CHE_DES 1 |
| 121 | #define TRICK_CHE_3DES 1 |
| 122 | #define TRICK_CHE_AES 1 |
| 123 | //#define TRICK_CHE_MD4 1 |
| 124 | #define TRICK_CHE_MAC_MD5 1 |
| 125 | //#define TRICK_CHE_MAC_SHA1 1 |
| 126 | #define TRICK_CHE_MAC_SHA224 1 |
| 127 | #define TRICK_CHE_MAC_SHA256 1 |
| 128 | #define TRICK_CHE_RC4 1 |
| 129 | //#define TRICK_CHE_RSA 1 |
| 130 | #define TRICK_CHE_DH 1 |
| 131 | #define TRICK_CHE_GEN_KEY 1 |
| 132 | #define TRICK_CHE_SET_KEY 1 |
| 133 | #define TRICK_CHE_SET_RC4_KEY 1 |
| 134 | #define TRICK_CHE_GET_KEY 1 |
| 135 | #define TRICK_CHE_DEL_KEY 1 |
| 136 | /*#define TRICK_CHE_GEN_RSA_KEY 1 |
| 137 | #define TRICK_CHE_DEL_RSA_KEY 1 |
| 138 | #define TRICK_CHE_SET_RSA_N 1 |
| 139 | #define TRICK_CHE_SET_RSA_E 1 |
| 140 | #define TRICK_CHE_SET_RSA_D 1 |
| 141 | #define TRICK_CHE_SET_RSA_P 1 |
| 142 | #define TRICK_CHE_SET_RSA_Q 1 |
| 143 | #define TRICK_CHE_SET_RSA_dModPm1 1 |
| 144 | #define TRICK_CHE_SET_RSA_dModQm1 1 |
| 145 | #define TRICK_CHE_SET_RSA_qInvModP 1 */ |
| 146 | #define TRICK_CHE_SET_DH_P 1 |
| 147 | #define TRICK_CHE_SET_DH_G 1 |
| 148 | #define TRICK_CHE_SET_DH_SELF_PUBLIC 1 |
| 149 | #define TRICK_CHE_SET_DH_PEER_PUBLIC 1 |
| 150 | #define TRICK_CHE_SET_DH_PRIVATE 1 |
| 151 | #define TRICK_CHE_GET_DH_SELF_PUBLIC_LEN 1 |
| 152 | #define TRICK_CHE_GET_DH_PRIVATE_LEN 1 |
| 153 | #define TRICK_CHE_GET_DH_SECRET_LEN 1 |
| 154 | #define TRICK_CHE_GET_DH_SELF_PUBLIC 1 |
| 155 | #define TRICK_CHE_GET_DH_PRIVATE 1 |
| 156 | #define TRICK_CHE_GET_DH_SECRET 1 |
| 157 | /*#define TRICK_CHE_GET_RSA_N 1 |
| 158 | #define TRICK_CHE_GET_RSA_N_LEN 1 |
| 159 | #define TRICK_CHE_GET_RSA_E 1 |
| 160 | #define TRICK_CHE_GET_RSA_E_LEN 1 |
| 161 | #define TRICK_CHE_GET_RSA_D 1 |
| 162 | #define TRICK_CHE_GET_RSA_D_LEN 1 |
| 163 | #define TRICK_CHE_GET_RSA_P 1 |
| 164 | #define TRICK_CHE_GET_RSA_P_LEN 1 |
| 165 | #define TRICK_CHE_GET_RSA_Q 1 |
| 166 | #define TRICK_CHE_GET_RSA_Q_LEN 1 |
| 167 | #define TRICK_CHE_GET_RSA_dModPm1 1 |
| 168 | #define TRICK_CHE_GET_RSA_dModPm1_LEN 1 |
| 169 | #define TRICK_CHE_GET_RSA_dModQm1 1 |
| 170 | #define TRICK_CHE_GET_RSA_dModQm1_LEN 1 |
| 171 | #define TRICK_CHE_GET_RSA_qInvModP 1 |
| 172 | #define TRICK_CHE_GET_RSA_qInvModP_LEN 1*/ |
| 173 | |
| 174 | /* check it before execute key action functions */ |
| 175 | extern void checkCHEKeyActionPerFix(STCHE *che_context, kal_uint8 *key); |
| 176 | |
| 177 | /* execute GEN_KEY action */ |
| 178 | extern void run_CHE_GEN_KEY_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 179 | |
| 180 | /* execute SET_KEY action */ |
| 181 | extern void run_CHE_SET_KEY_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 182 | |
| 183 | /* execute SET_RC4_KEY action */ |
| 184 | extern void run_CHE_SET_RC4_KEY_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 185 | |
| 186 | /* execute GET_KEY action */ |
| 187 | extern void run_CHE_GET_KEY_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 188 | |
| 189 | /* execute DEL_KEY action */ |
| 190 | extern void run_CHE_DEL_KEY_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 191 | |
| 192 | #if 0 |
| 193 | /* under construction !*/ |
| 194 | /* under construction !*/ |
| 195 | /* under construction !*/ |
| 196 | /* under construction !*/ |
| 197 | /* under construction !*/ |
| 198 | /* under construction !*/ |
| 199 | /* under construction !*/ |
| 200 | /* under construction !*/ |
| 201 | /* under construction !*/ |
| 202 | /* under construction !*/ |
| 203 | /* under construction !*/ |
| 204 | /* under construction !*/ |
| 205 | /* under construction !*/ |
| 206 | /* under construction !*/ |
| 207 | /* under construction !*/ |
| 208 | /* under construction !*/ |
| 209 | /* under construction !*/ |
| 210 | /* under construction !*/ |
| 211 | /* under construction !*/ |
| 212 | /* under construction !*/ |
| 213 | /* under construction !*/ |
| 214 | /* under construction !*/ |
| 215 | /* under construction !*/ |
| 216 | /* under construction !*/ |
| 217 | /* under construction !*/ |
| 218 | /* under construction !*/ |
| 219 | /* under construction !*/ |
| 220 | /* under construction !*/ |
| 221 | /* under construction !*/ |
| 222 | /* under construction !*/ |
| 223 | /* under construction !*/ |
| 224 | /* under construction !*/ |
| 225 | /* under construction !*/ |
| 226 | /* under construction !*/ |
| 227 | /* under construction !*/ |
| 228 | /* under construction !*/ |
| 229 | /* under construction !*/ |
| 230 | /* under construction !*/ |
| 231 | /* under construction !*/ |
| 232 | /* under construction !*/ |
| 233 | /* under construction !*/ |
| 234 | /* under construction !*/ |
| 235 | /* under construction !*/ |
| 236 | /* under construction !*/ |
| 237 | /* under construction !*/ |
| 238 | /* under construction !*/ |
| 239 | #endif |
| 240 | |
| 241 | /* execute SET_DH_P key action */ |
| 242 | extern void run_CHE_SET_DH_P_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 243 | |
| 244 | /* execute SET_DH_G key action */ |
| 245 | extern void run_CHE_SET_DH_G_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 246 | |
| 247 | /* execute SET_DH_SELF key action */ |
| 248 | extern void run_CHE_SET_DH_SELF_PUBLIC_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 249 | |
| 250 | /* execute SET_DH_PEER_PUBLIC key action */ |
| 251 | extern void run_CHE_SET_DH_PEER_PUBLIC_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 252 | |
| 253 | /* execute SET_DH_PRIVATE key action */ |
| 254 | extern void run_CHE_SET_DH_PRIVATE_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 255 | |
| 256 | /* execute GET_DH_SELF_PUBLIC_LEN key action */ |
| 257 | extern void run_CHE_GET_DH_SELF_PUBLIC_LEN_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 258 | |
| 259 | /* execute GET_DH_SELF_PUBLIC key action */ |
| 260 | extern void run_CHE_GET_DH_SELF_PUBLIC_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 261 | |
| 262 | /* execute GET_DH_PRIVATE_LEN action */ |
| 263 | extern void run_CHE_GET_DH_PRIVATE_LEN_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 264 | |
| 265 | /* execute CHE_GET_DH_PRIVATE key action */ |
| 266 | extern void run_CHE_GET_DH_PRIVATE_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 267 | |
| 268 | /* execute CHE_GET_DH_SECRET_LEN action */ |
| 269 | extern void run_CHE_GET_DH_SECRET_LEN_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 270 | |
| 271 | /* execute CHE_GET_DH_SECRET key action */ |
| 272 | extern void run_CHE_GET_DH_SECRET_process(STCHE *che_context, kal_uint8 *key, kal_int32 key_len); |
| 273 | |
| 274 | /* check it before execute cipher/hash functions */ |
| 275 | extern void checkCHEProcessPerFix(STCHE *che_context); |
| 276 | |
| 277 | /* check it after execute cipher/hash functions */ |
| 278 | extern void checkCHEProcessPostfix(STCHE *che_context, kal_bool last_block); |
| 279 | |
| 280 | /* execute DES cipher function */ |
| 281 | extern kal_bool run_CHE_DES_process( |
| 282 | STCHE *che_context, |
| 283 | CHE_TYPE type, |
| 284 | CHE_OPERATION_MODE mode, |
| 285 | CHE_ACTION act, |
| 286 | kal_uint8 *source, |
| 287 | kal_uint8 *dest, |
| 288 | kal_uint32 source_length, |
| 289 | kal_bool last_block, |
| 290 | STFSAL *pstFSAL); |
| 291 | |
| 292 | /* execute 3DES cipher function */ |
| 293 | extern kal_bool run_CHE_3DES_process( |
| 294 | STCHE *che_context, |
| 295 | CHE_TYPE type, |
| 296 | CHE_OPERATION_MODE mode, |
| 297 | CHE_ACTION act, |
| 298 | kal_uint8 *source, |
| 299 | kal_uint8 *dest, |
| 300 | kal_uint32 source_length, |
| 301 | kal_bool last_block, |
| 302 | STFSAL *pstFSAL); |
| 303 | |
| 304 | /* execute AES cipher function */ |
| 305 | extern kal_bool run_CHE_AES_process( |
| 306 | STCHE *che_context, |
| 307 | CHE_TYPE type, |
| 308 | CHE_OPERATION_MODE mode, |
| 309 | CHE_ACTION act, |
| 310 | kal_uint8 *source, |
| 311 | kal_uint8 *dest, |
| 312 | kal_uint32 source_length, |
| 313 | kal_bool last_block, |
| 314 | STFSAL *pstFSAL, |
| 315 | void *aes_param); |
| 316 | |
| 317 | /* execute MD5 hash function */ |
| 318 | extern kal_bool run_CHE_MD5_process( |
| 319 | STCHE *che_context, |
| 320 | CHE_TYPE type, |
| 321 | CHE_OPERATION_MODE mode, |
| 322 | CHE_ACTION act, |
| 323 | kal_uint8 *source, |
| 324 | kal_uint8 *dest, |
| 325 | kal_uint32 source_length, |
| 326 | kal_bool last_block, |
| 327 | STFSAL *pstFSAL); |
| 328 | |
| 329 | /* execute SHA1 hash function */ |
| 330 | /*extern kal_bool run_CHE_SHA1_process( |
| 331 | STCHE *che_context, |
| 332 | CHE_TYPE type, |
| 333 | CHE_OPERATION_MODE mode, |
| 334 | CHE_ACTION act, |
| 335 | kal_uint8 *source, |
| 336 | kal_uint8 *dest, |
| 337 | kal_uint32 source_length, |
| 338 | kal_bool last_block, |
| 339 | STFSAL *pstFSAL);*/ |
| 340 | |
| 341 | extern kal_bool run_CHE_SHA224_process( |
| 342 | STCHE *che_context, |
| 343 | CHE_TYPE type, |
| 344 | CHE_OPERATION_MODE mode, |
| 345 | CHE_ACTION act, |
| 346 | kal_uint8 *source, |
| 347 | kal_uint8 *dest, |
| 348 | kal_uint32 source_length, |
| 349 | kal_bool last_block, |
| 350 | STFSAL *pstFSAL); |
| 351 | |
| 352 | extern kal_bool run_CHE_SHA256_process( |
| 353 | STCHE *che_context, |
| 354 | CHE_TYPE type, |
| 355 | CHE_OPERATION_MODE mode, |
| 356 | CHE_ACTION act, |
| 357 | kal_uint8 *source, |
| 358 | kal_uint8 *dest, |
| 359 | kal_uint32 source_length, |
| 360 | kal_bool last_block, |
| 361 | STFSAL *pstFSAL); |
| 362 | |
| 363 | /* / execute RC4 cipher function */ |
| 364 | extern kal_bool run_CHE_RC4_process( |
| 365 | STCHE *che_context, |
| 366 | CHE_TYPE type, |
| 367 | CHE_OPERATION_MODE mode, |
| 368 | CHE_ACTION act, |
| 369 | kal_uint8 *source, |
| 370 | kal_uint8 *dest, |
| 371 | kal_uint32 source_length, |
| 372 | kal_bool last_block, |
| 373 | STFSAL *pstFSAL); |
| 374 | |
| 375 | /* execute MD4 hash function */ |
| 376 | /*extern kal_bool run_CHE_MD4_process( |
| 377 | STCHE *che_context, |
| 378 | CHE_TYPE type, |
| 379 | CHE_OPERATION_MODE mode, |
| 380 | CHE_ACTION act, |
| 381 | kal_uint8 *source, |
| 382 | kal_uint8 *dest, |
| 383 | kal_uint32 source_length, |
| 384 | kal_bool last_block, |
| 385 | STFSAL *pstFSAL);*/ |
| 386 | |
| 387 | /* / execute MAC_MD5 hash function */ |
| 388 | extern kal_bool run_CHE_MAC_MD5_process( |
| 389 | STCHE *che_context, |
| 390 | CHE_TYPE type, |
| 391 | CHE_OPERATION_MODE mode, |
| 392 | CHE_ACTION act, |
| 393 | kal_uint8 *source, |
| 394 | kal_uint8 *dest, |
| 395 | kal_uint32 source_length, |
| 396 | kal_bool last_block, |
| 397 | STFSAL *pstFSAL); |
| 398 | |
| 399 | /* execute MAC_SHA1 hash function */ |
| 400 | /*extern kal_bool run_CHE_MAC_SHA1_process( |
| 401 | STCHE *che_context, |
| 402 | CHE_TYPE type, |
| 403 | CHE_OPERATION_MODE mode, |
| 404 | CHE_ACTION act, |
| 405 | kal_uint8 *source, |
| 406 | kal_uint8 *dest, |
| 407 | kal_uint32 source_length, |
| 408 | kal_bool last_block, |
| 409 | STFSAL *pstFSAL);*/ |
| 410 | |
| 411 | extern kal_bool run_CHE_MAC_SHA256_process( |
| 412 | STCHE *che_context, |
| 413 | CHE_TYPE type, |
| 414 | CHE_OPERATION_MODE mode, |
| 415 | CHE_ACTION act, |
| 416 | kal_uint8 *source, |
| 417 | kal_uint8 *dest, |
| 418 | kal_uint32 source_length, |
| 419 | kal_bool last_block, |
| 420 | STFSAL *pstFSAL); |
| 421 | |
| 422 | extern kal_bool run_CHE_MAC_SHA224_process( |
| 423 | STCHE *che_context, |
| 424 | CHE_TYPE type, |
| 425 | CHE_OPERATION_MODE mode, |
| 426 | CHE_ACTION act, |
| 427 | kal_uint8 *source, |
| 428 | kal_uint8 *dest, |
| 429 | kal_uint32 source_length, |
| 430 | kal_bool last_block, |
| 431 | STFSAL *pstFSAL); |
| 432 | |
| 433 | /* execute DH cipher function */ |
| 434 | extern kal_bool run_CHE_DH_process( |
| 435 | STCHE *che_context, |
| 436 | CHE_TYPE type, |
| 437 | CHE_OPERATION_MODE mode, |
| 438 | CHE_ACTION act, |
| 439 | kal_uint8 *source, |
| 440 | kal_uint8 *dest, |
| 441 | kal_uint32 source_length, |
| 442 | kal_bool last_block, |
| 443 | STFSAL *pstFSAL); |
| 444 | |
| 445 | #endif /* __CHE_TRICK_H__ */ |
| 446 | |