-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatecc608_handler.h
More file actions
90 lines (87 loc) · 2.52 KB
/
atecc608_handler.h
File metadata and controls
90 lines (87 loc) · 2.52 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <iostream>
#include <vector>
#include <bitset>
// Exemple of configuration for ATECC608A. Look at page 8 on the datasheet for ATECC608A-TFLXTLS
const uint8_t ECCX08_DEFAULT_CONFIGURATION_VALS[112] = {
// Read only - end
// I2C_Address
0xC0,
// Reserved
0x00,
// OTPmode
0x55,
// ChipMode
0x00,
// SlotConfig
0x83, 0x60,
0x87, 0x60,
0x8F, 0x60,
0x83, 0x60,
0x83, 0x60,
0x8F, 0x8F,
0x9F, 0x8F,
0xAF, 0x8F,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0xAF, 0x8F,
// Counter[0]
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
// Counter[1]
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
// LastKeyUse
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
// Write via commands only - start
// UserExtra
0x00,
// Selector
0x00,
// LockValue
0x55,
// LockConfig
0x55,
// SlotLocked
0xFF, 0xFF,
// Write via commands only - end
// RFU
0x00, 0x00,
// X509format
0x00, 0x00, 0x00, 0x00,
// KeyConfig
0x33, 0x00, // Private | Public | P256 NIST ECC key, Default: 0x33, 0x00,
0x33, 0x00, // Private | Public | P256 NIST ECC key, Default: 0x33, 0x00,
0x33, 0x00, // Private | Public | P256 NIST ECC key, Default: 0x33, 0x00,
0x1C, 0x00, // Private | Public | P256 NIST ECC key, Default: 0x1C, 0x00,
0x33, 0x00, // Private | Public | P256 NIST ECC key, Default: 0x1C, 0x00,
0x1C, 0x00,
0x1C, 0x00,
0x1C, 0x00,
0x00, 0x00,
0x00, 0x00,
0x3C, 0x00,
0x3C, 0x00,
0x3C, 0x00,
0x3C, 0x00,
0x3C, 0x00,
0x1C, 0x00
};
extern "C" int atecc_handler_write_configuration(const uint8_t *config, size_t len);
extern "C" int atecc_handle_write_default_configuration();
extern "C" int atecc_handler_lock_zone(uint8_t zone);
extern "C" int atecc_handler_init(int i2cAddr, int bus);
extern "C" int atecc_handler_read_configuration(uint8_t *config_data);
extern "C" int atecc_handler_inject_priv_key(int slot, uint8_t * priv_key);
extern "C" int atecc_handler_get_public_key(int slot, uint8_t * pub_key);
extern "C" int atecc_handler_sign(int slot, const uint8_t * msg, uint8_t * signature);
extern "C" int atecc_handler_verify(int slot, const uint8_t * msg, const uint8_t * signature, const uint8_t * pub_key);
extern "C" int atecc_handler_genkey(int slot, uint8_t * pub_key);
extern "C" int atecc_handler_lock_slot(int slot);
extern "C" int atecc_handler_write_data(int slot, uint8_t* data, size_t data_len);
extern "C" int atecc_handler_read_data(int slot, uint8_t* data, size_t data_len);