1 /* 2 * Copyright 2018, Rockchip Electronics Co., Ltd 3 * qiujian, <qiujian@rock-chips.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #ifndef ATTESTATION_KEY_H_ 9 #define ATTESTATION_KEY_H_ 10 11 #include <common.h> 12 13 typedef enum { 14 ATAP_RESULT_OK, 15 ATAP_RESULT_ERROR_DEVICE_NOT_FOUND, 16 ATAP_RESULT_ERROR_PARTITION_NOT_FOUND, 17 ATAP_RESULT_ERROR_BLOCK_READ, 18 ATAP_RESULT_ERROR_BLOCK_WRITE, 19 ATAP_RESULT_ERROR_INVALID_HEAD, 20 ATAP_RESULT_ERROR_INVALID_BLOCK_NUM, 21 ATAP_RESULT_ERROR_INVALID_DEVICE_ID, 22 ATAP_RESULT_ERROR_BUF_COPY, 23 ATAP_RESULT_ERROR_STORAGE, 24 ATAP_RESULT_ERROR_ALREADY_EXSIT, 25 } atap_result; 26 27 /* load attestation key from misc partition. */ 28 atap_result load_attestation_key(struct blk_desc *dev_desc, 29 disk_partition_t *misc_partition); 30 atap_result read_key_data(uint8_t **key_buf, uint8_t *key_data, 31 uint32_t *key_data_length); 32 /* 33 * write attestation key to secure storage. 34 * @received_data: received data from usb 35 * @len: the size of received_data 36 * @return ATAP_RESULT_OK if ok, or ATAP_RESULT_ERROR_* on error 37 */ 38 atap_result write_attestation_key_to_secure_storage(uint8_t *received_data, 39 uint32_t len); 40 #endif //ATTESTATION_KEY_H_ 41