WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
nv_key.c 文件参考
#include "nv_key.h"
#include "string.h"
#include "nv_porting.h"
#include "uapi_crc.h"
#include "nv_nvregion.h"
#include "common_def.h"
nv_key.c 的引用(Include)关系图:

宏定义

#define KV_CLEARTEXT_PADDING_SIZE   (1UL << 2) /* Currently these both need to be a power of 2... */
 
#define KV_CIPHERTEXT_PADDING_SIZE   (1UL << 4) /* ...due to implementation of kv_padded_length */
 
#define kv_padded_length(d, s)   (((d) + ((s) - 1)) & ~((s) - 1))
 
#define kv_padded_cleartext_length(d)   kv_padded_length(d, KV_CLEARTEXT_PADDING_SIZE)
 
#define kv_padded_ciphertext_length(d)   kv_padded_length(d, KV_CIPHERTEXT_PADDING_SIZE)
 
#define KV_COPY_SIZE_ALIGN   32
 

函数

errcode_t kv_key_helper_copy_flash (uint32_t dest_location, uint32_t src_location, uint16_t length)
 
errcode_t kv_key_direct_write_flash (uint32_t dest, uint32_t length, const uint8_t *src)
 
errcode_t kv_key_direct_erase_flash (uint32_t dest, const uint32_t size)
 
errcode_t kv_key_write_flash (uint32_t dest, uint32_t length, const uint8_t *src)
 
errcode_t kv_key_erase_flash (uint32_t dest, const uint32_t size)
 
STATIC errcode_t kv_key_decode_flash (uintptr_t dest, const uintptr_t src, uint32_t length, uint32_t crypto_handle)
 
STATIC errcode_t kv_key_read_data_from_flash (uintptr_t dest, const uintptr_t src, uint32_t length, uint32_t crypto_handle)
 
errcode_t kv_key_read_data (kv_key_handle_t *key, uint8_t *dest_location)
 
STATIC errcode_t kv_helper_compare_key_data_chunks (const kv_key_handle_t *key, const uint8_t *compare_data, kv_helper_compare_key_data_info_t *info)
 
errcode_t kv_helper_compare_key_data (kv_key_handle_t *key, const uint8_t *compare_data, uint16_t compare_length)
 
bool kv_key_is_erased (const kv_key_handle_t *key)
 
bool kv_key_is_valid (kv_key_handle_t *key)
 
errcode_t kv_key_does_filter_match (kv_key_handle_t *key, kv_key_filter_t *search_filter)
 
STATIC bool kv_key_header_is_full_ff (kv_key_header_t *key_header, uint8_t len)
 
errcode_t kv_key_get_handle_from_location (kv_key_location key_location, kv_key_handle_t *key)
 
errcode_t kv_key_locations_in_same_page (kv_key_location first_key_location, kv_key_location second_key_location)
 
errcode_t kv_key_get_next_magic_position (kv_key_location key_location, kv_key_handle_t *key)
 
STATIC errcode_t kv_key_get_next_key_from_location (kv_key_location cur_key_loc, kv_key_location next_key_loc, kv_key_handle_t *key)
 
STATIC errcode_t kv_key_get_next_handle_with_corrupt_key (kv_key_handle_t *key, kv_key_validate_status_t key_status)
 
STATIC errcode_t kv_key_get_next_handle_direct (kv_key_handle_t *key)
 
errcode_t kv_key_get_next_handle (kv_key_handle_t *key, kv_key_validate_status_t key_status)
 
STATIC void kv_key_fix_header_for_validate (kv_key_header_t *key_header, bool ignor_invalid)
 
STATIC void kv_key_hash_crc_tag_start (const kv_key_handle_t *key, uint32_t *crc_ret)
 
STATIC void kv_key_hash_crc_tag_update (const kv_key_handle_t *key, uint8_t *data_chunk, uint32_t data_len, uint32_t *crc_ret)
 
STATIC void kv_key_hash_crc_tag_finish (const kv_key_handle_t *key, uint8_t *calculated_hash, uint32_t crc_value, uint32_t crypto_handle)
 
STATIC errcode_t kv_key_hash_crc_tag_verify (const kv_key_handle_t *key, uint8_t *read_hash_crc, uint8_t *cal_hash_crc, uint32_t crypto_handle, bool only_crc)
 
STATIC errcode_t kv_key_validate_hash_chunks (kv_key_handle_t *key, uint8_t *read_data_chunk, uint8_t *cal_hash_crc, uint32_t crypto_handle, bool ignor_invalid)
 
errcode_t kv_key_validate_integrity (kv_key_handle_t *key, bool ignor_invalid)
 
errcode_t kv_key_validation (kv_key_handle_t *key, bool ignor_invalid)
 
kv_attributes_t kv_key_attributes (const kv_key_handle_t *key)
 
uint16_t kv_key_padded_data_length (kv_attributes_t attributes, uint16_t unpadded_length)
 
uint16_t kv_key_flash_size (kv_key_handle_t *key)
 
void kv_key_build_from_new (kv_key_handle_t *key, const kv_key_details_t *new_key, kv_key_location key_location)
 
uint32_t kv_crc32_swap (uint32_t crc)
 

变量

uint8_t g_nv_header_magic = 0xA9
 

宏定义说明

◆ KV_CIPHERTEXT_PADDING_SIZE

#define KV_CIPHERTEXT_PADDING_SIZE   (1UL << 4) /* ...due to implementation of kv_padded_length */

◆ KV_CLEARTEXT_PADDING_SIZE

#define KV_CLEARTEXT_PADDING_SIZE   (1UL << 2) /* Currently these both need to be a power of 2... */

◆ KV_COPY_SIZE_ALIGN

#define KV_COPY_SIZE_ALIGN   32

◆ kv_padded_ciphertext_length

#define kv_padded_ciphertext_length (   d)    kv_padded_length(d, KV_CIPHERTEXT_PADDING_SIZE)

◆ kv_padded_cleartext_length

#define kv_padded_cleartext_length (   d)    kv_padded_length(d, KV_CLEARTEXT_PADDING_SIZE)

◆ kv_padded_length

#define kv_padded_length (   d,
 
)    (((d) + ((s) - 1)) & ~((s) - 1))

函数说明

◆ kv_crc32_swap()

uint32_t kv_crc32_swap ( uint32_t  crc)

◆ kv_helper_compare_key_data()

errcode_t kv_helper_compare_key_data ( kv_key_handle_t key,
const uint8_t *  compare_data,
uint16_t  compare_length 
)

◆ kv_helper_compare_key_data_chunks()

STATIC errcode_t kv_helper_compare_key_data_chunks ( const kv_key_handle_t key,
const uint8_t *  compare_data,
kv_helper_compare_key_data_info_t info 
)

◆ kv_key_attributes()

kv_attributes_t kv_key_attributes ( const kv_key_handle_t key)

◆ kv_key_build_from_new()

void kv_key_build_from_new ( kv_key_handle_t key,
const kv_key_details_t new_key,
kv_key_location  key_location 
)

◆ kv_key_decode_flash()

STATIC errcode_t kv_key_decode_flash ( uintptr_t  dest,
const uintptr_t  src,
uint32_t  length,
uint32_t  crypto_handle 
)

◆ kv_key_direct_erase_flash()

errcode_t kv_key_direct_erase_flash ( uint32_t  dest,
const uint32_t  size 
)

◆ kv_key_direct_write_flash()

errcode_t kv_key_direct_write_flash ( uint32_t  dest,
uint32_t  length,
const uint8_t *  src 
)

◆ kv_key_does_filter_match()

errcode_t kv_key_does_filter_match ( kv_key_handle_t key,
kv_key_filter_t search_filter 
)

◆ kv_key_erase_flash()

errcode_t kv_key_erase_flash ( uint32_t  dest,
const uint32_t  size 
)

◆ kv_key_fix_header_for_validate()

STATIC void kv_key_fix_header_for_validate ( kv_key_header_t key_header,
bool  ignor_invalid 
)

◆ kv_key_flash_size()

uint16_t kv_key_flash_size ( kv_key_handle_t key)

◆ kv_key_get_handle_from_location()

errcode_t kv_key_get_handle_from_location ( kv_key_location  key_location,
kv_key_handle_t key 
)

◆ kv_key_get_next_handle()

errcode_t kv_key_get_next_handle ( kv_key_handle_t key,
kv_key_validate_status_t  key_status 
)

◆ kv_key_get_next_handle_direct()

STATIC errcode_t kv_key_get_next_handle_direct ( kv_key_handle_t key)

◆ kv_key_get_next_handle_with_corrupt_key()

STATIC errcode_t kv_key_get_next_handle_with_corrupt_key ( kv_key_handle_t key,
kv_key_validate_status_t  key_status 
)

◆ kv_key_get_next_key_from_location()

STATIC errcode_t kv_key_get_next_key_from_location ( kv_key_location  cur_key_loc,
kv_key_location  next_key_loc,
kv_key_handle_t key 
)

◆ kv_key_get_next_magic_position()

errcode_t kv_key_get_next_magic_position ( kv_key_location  key_location,
kv_key_handle_t key 
)

◆ kv_key_hash_crc_tag_finish()

STATIC void kv_key_hash_crc_tag_finish ( const kv_key_handle_t key,
uint8_t *  calculated_hash,
uint32_t  crc_value,
uint32_t  crypto_handle 
)

◆ kv_key_hash_crc_tag_start()

STATIC void kv_key_hash_crc_tag_start ( const kv_key_handle_t key,
uint32_t *  crc_ret 
)

◆ kv_key_hash_crc_tag_update()

STATIC void kv_key_hash_crc_tag_update ( const kv_key_handle_t key,
uint8_t *  data_chunk,
uint32_t  data_len,
uint32_t *  crc_ret 
)

◆ kv_key_hash_crc_tag_verify()

STATIC errcode_t kv_key_hash_crc_tag_verify ( const kv_key_handle_t key,
uint8_t *  read_hash_crc,
uint8_t *  cal_hash_crc,
uint32_t  crypto_handle,
bool  only_crc 
)

◆ kv_key_header_is_full_ff()

STATIC bool kv_key_header_is_full_ff ( kv_key_header_t key_header,
uint8_t  len 
)

◆ kv_key_helper_copy_flash()

errcode_t kv_key_helper_copy_flash ( uint32_t  dest_location,
uint32_t  src_location,
uint16_t  length 
)

◆ kv_key_is_erased()

bool kv_key_is_erased ( const kv_key_handle_t key)

◆ kv_key_is_valid()

bool kv_key_is_valid ( kv_key_handle_t key)

◆ kv_key_locations_in_same_page()

errcode_t kv_key_locations_in_same_page ( kv_key_location  first_key_location,
kv_key_location  second_key_location 
)

◆ kv_key_padded_data_length()

uint16_t kv_key_padded_data_length ( kv_attributes_t  attributes,
uint16_t  unpadded_length 
)

◆ kv_key_read_data()

errcode_t kv_key_read_data ( kv_key_handle_t key,
uint8_t *  dest_location 
)

◆ kv_key_read_data_from_flash()

STATIC errcode_t kv_key_read_data_from_flash ( uintptr_t  dest,
const uintptr_t  src,
uint32_t  length,
uint32_t  crypto_handle 
)

◆ kv_key_validate_hash_chunks()

STATIC errcode_t kv_key_validate_hash_chunks ( kv_key_handle_t key,
uint8_t *  read_data_chunk,
uint8_t *  cal_hash_crc,
uint32_t  crypto_handle,
bool  ignor_invalid 
)

◆ kv_key_validate_integrity()

errcode_t kv_key_validate_integrity ( kv_key_handle_t key,
bool  ignor_invalid 
)

◆ kv_key_validation()

errcode_t kv_key_validation ( kv_key_handle_t key,
bool  ignor_invalid 
)

◆ kv_key_write_flash()

errcode_t kv_key_write_flash ( uint32_t  dest,
uint32_t  length,
const uint8_t *  src 
)

变量说明

◆ g_nv_header_magic

uint8_t g_nv_header_magic = 0xA9