xref: /rk3399_rockchip-uboot/include/write_keybox.h (revision b8dc613cbc483a8abfcf4203e4fa0e18f60b1d27)
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 char *new_strstr(const char *s1, const char *s2, uint32_t l1);
33 #else
34 inline uint32_t write_keybox_to_secure_storage(uint8_t *raw_data,
35 					       uint32_t data_size)
36 {
37 	return -EPERM;
38 }
39 
40 inline uint32_t read_raw_data_from_secure_storage(uint8_t *received_data,
41 						  uint32_t len)
42 {
43 	return -EPERM;
44 }
45 #endif
46 #endif
47