summaryrefslogtreecommitdiff
path: root/include/amlogic/storagekey.h (plain)
blob: f258b82c95ce292b46dce863923715a85f5c420f
1#ifndef __STORAGEKEY_H__
2#define __STORAGEKEY_H__
3
4
5/* storage key interface */
6/**
7 *1.amlkey_init: init storage key
8 * return ok 0, fail not 0
9 */
10extern int32_t amlkey_init(uint8_t *seed, uint32_t len);
11
12/**
13 *2. amlkey_isexsit: query key, already programmed ?
14 * return: exsit 1, non 0
15 */
16extern int32_t amlkey_isexsit(const uint8_t * name);
17
18/**
19 * 3. query if the key is secure
20 * return secure 1, non 0;
21 */
22extern int32_t amlkey_issecure(const uint8_t * name);
23
24/**
25 * 4. amlkey_size: actual bytes of key value
26 * return actual size.
27 */
28extern ssize_t amlkey_size(const uint8_t *name);
29
30/**
31 *5. amlkey_read: read non-secure key in bytes.
32 * return actual size read back; 0 means read failed!
33 */
34extern ssize_t amlkey_read(const uint8_t *name,
35 uint8_t *buffer, uint32_t len);
36
37/**
38 * 6. amlkey_write: write secure/non-secure key in bytes.
39 * return actual size write down. 0 means write failed!
40 */
41extern ssize_t amlkey_write(const uint8_t *name,
42 uint8_t *buffer, uint32_t len, uint32_t secure);
43
44/**
45 * 7. get the hash value of programmed secure key | 32bytes length, sha256
46 * return success 0, fail -1
47 */
48extern int32_t amlkey_hash_4_secure(const uint8_t * name, uint8_t * hash);
49
50/**
51 * 8. amlkey_del: del key by name
52 * return success 0, fail non-0.
53 */
54extern int32_t amlkey_del(const uint8_t * name);
55
56
57#endif /* __STORAGEKEY_H__ */
58