1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* Copyright (c) 2022-2024 HiSilicon Limited. */ 3 4 #ifndef __SEC_PBKDF2_H__ 5 #define __SEC_PBKDF2_H__ 6 7 #define SEC_MAX_SALT_LEN 1024 8 #define SEC_MAX_PASSWORD_LEN 128 9 #define SEC_MAX_DK_LEN 512 10 #define SEC_MAX_ITERATION_NUM 16777215 11 #define SEC_HMAC_SHA1 0x10 12 #define SEC_HMAC_SHA256 0x11 13 #define SEC_HMAC_SHA224 0x13 14 #define SEC_HMAC_SHA384 0x14 15 #define SEC_HMAC_SHA512 0x15 16 #define SEC_HMAC_SM3 0x26 17 #define SEC_HUK_ENABLE 0x1 18 #define SEC_IMG_ROTKEY_AP 0x6 19 #define SEC_CRITICAL_ITERATION_NUM 1000000 20 #define SEC_PER_BLOCK_TIME1_NS (3 * 48) 21 #define SEC_PER_BLOCK_TIME2_NS (3 * 68) 22 #define SEC_MAX_TIMEOUT_NS 4000000000 23 24 struct sec_pbkdf2_msg { 25 uint8_t salt[SEC_MAX_SALT_LEN]; 26 uint8_t base_key[SEC_MAX_PASSWORD_LEN]; 27 uint8_t out[SEC_MAX_DK_LEN]; 28 uintptr_t salt_dma; 29 uintptr_t key_dma; 30 uintptr_t out_dma; 31 uint32_t salt_len; 32 uint32_t key_len; 33 uint32_t out_len; 34 uint32_t c_num; 35 uint32_t derive_type; 36 }; 37 38 #endif 39