hc
2024-05-09 b9d5c334faa47a75f1f28e72d203fc0334e8471d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
 */
 
#ifndef WRITE_KEYBOX_H_
#define    WRITE_KEYBOX_H_
 
#include <common.h>
#include <optee_include/tee_client_api.h>
 
#if defined CONFIG_ANDROID_WRITE_KEYBOX && defined CONFIG_ANDROID_KEYMASTER_CA
/*
 * write_keybox_to_secure_storage
 *
 * @received_data:    the data received from usb
 * @len:        size of received_data
 *
 * @return a negative number in case of error, or 0 on success.
 */
uint32_t write_keybox_to_secure_storage(uint8_t *received_data, uint32_t len);
 
/*
 * write_to_secure_storage
 *
 * @is_use_rpmb:    0, write data to security patition
 *            1, write data to rpmb
 * @filename:        the file name of data written to secure storage
 * @filename_size:    size of filename
 * @data:        the data want to write to secure storage
 * @data_size:        size of data
 *
 * @return a nonzero number in case of error, or 0 on success.
 */
TEEC_Result write_to_security_storage(uint8_t is_use_rpmb,
                     uint8_t *filename,
                     uint32_t filename_size,
                     uint8_t *data,
                     uint32_t data_size);
/*
 * read_raw_data_from_secure_storege
 *
 * @raw_data:    the data read from secure storage
 * @data_size:    size of raw data
 *
 * @return size of raw_data in case of success, or 0 on fail
 */
uint32_t read_raw_data_from_secure_storage(uint8_t *received_data,
                      uint32_t len);
char *new_strstr(const char *s1, const char *s2, uint32_t l1);
#else
inline uint32_t write_keybox_to_secure_storage(uint8_t *raw_data,
                          uint32_t data_size)
{
   return -EPERM;
}
 
inline uint32_t read_raw_data_from_secure_storage(uint8_t *received_data,
                         uint32_t len)
{
   return -EPERM;
}
#endif
#endif