xref: /rk3399_rockchip-uboot/include/write_keybox.h (revision cfcc706c901d603707657919484e4f65467be9ff)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
4  */
5 
6 #ifndef WRITE_KEYBOX_H_
7 #define	WRITE_KEYBOX_H_
8 
9 #include <common.h>
10 
11 #if defined CONFIG_ANDROID_WRITE_KEYBOX && defined CONFIG_ANDROID_KEYMASTER_CA
12 /*
13  * write_keybox_to_secure_storage
14  *
15  * @received_data:	the data received from usb
16  * @len:		size of received_data
17  *
18  * @return a negative number in case of error, or 0 on success.
19  */
20 uint32_t write_keybox_to_secure_storage(uint8_t *received_data, uint32_t len);
21 
22 /*
23  * read_raw_data_from_secure_storege
24  *
25  * @raw_data:	the data read from secure storage
26  * @data_size:	size of raw data
27  *
28  * @return size of raw_data in case of success, or 0 on fail
29  */
30 uint32_t read_raw_data_from_secure_storage(uint8_t *received_data,
31 					   uint32_t len);
32 #else
33 inline uint32_t write_keybox_to_secure_storage(uint8_t *raw_data,
34 					       uint32_t data_size)
35 {
36 	return -EPERM;
37 }
38 
39 inline uint32_t read_raw_data_from_secure_storage(uint8_t *received_data,
40 						  uint32_t len)
41 {
42 	return -EPERM;
43 }
44 #endif
45 #endif
46