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; 25 26 /* load attestation key from misc partition. */ 27 atap_result load_attestation_key(struct blk_desc *dev_desc, 28 disk_partition_t *misc_partition); 29 atap_result read_key_data(uint8_t **key_buf, uint8_t *key_data, 30 uint32_t *key_data_length); 31 /* 32 * write attestation key to secure storage. 33 * @received_data: received data from usb 34 * @len: the size of received_data 35 * @return ATAP_RESULT_OK if ok, or ATAP_RESULT_ERROR_* on error 36 */ 37 atap_result write_attestation_key_to_secure_storage(uint8_t *received_data, 38 uint32_t len); 39 #endif //ATTESTATION_KEY_H_ 40