1 /*!
2  * \file      se-identity.h
3  *
4  * \brief     Secure Element identity and keys
5  *
6  * \copyright Revised BSD License, see section \ref LICENSE.
7  *
8  * \code
9  *                ______                              _
10  *               / _____)             _              | |
11  *              ( (____  _____ ____ _| |_ _____  ____| |__
12  *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
13  *               _____) ) ____| | | || |_| ____( (___| | | |
14  *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
15  *              (C)2020 Semtech
16  *
17  *               ___ _____ _   ___ _  _____ ___  ___  ___ ___
18  *              / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
19  *              \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
20  *              |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
21  *              embedded.connectivity.solutions===============
22  *
23  * \endcode
24  *
25  */
26 #ifndef __SOFT_SE_IDENTITY_H__
27 #define __SOFT_SE_IDENTITY_H__
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*!
34  ******************************************************************************
35  ********************************** WARNING ***********************************
36  ******************************************************************************
37   The secure-element implementation supports both 1.0.x and 1.1.x LoRaWAN
38   versions of the specification.
39   Thus it has been decided to use the 1.1.x keys and EUI name definitions.
40   The below table shows the names equivalence between versions:
41                +---------------------+-------------------------+
42                |       1.0.x         |          1.1.x          |
43                +=====================+=========================+
44                | LORAWAN_DEVICE_EUI  | LORAWAN_DEVICE_EUI      |
45                +---------------------+-------------------------+
46                | LORAWAN_APP_EUI     | LORAWAN_JOIN_EUI        |
47                +---------------------+-------------------------+
48                | LORAWAN_GEN_APP_KEY | LORAWAN_APP_KEY         |
49                +---------------------+-------------------------+
50                | LORAWAN_APP_KEY     | LORAWAN_NWK_KEY         |
51                +---------------------+-------------------------+
52                | LORAWAN_NWK_S_KEY   | LORAWAN_F_NWK_S_INT_KEY |
53                +---------------------+-------------------------+
54                | LORAWAN_NWK_S_KEY   | LORAWAN_S_NWK_S_INT_KEY |
55                +---------------------+-------------------------+
56                | LORAWAN_NWK_S_KEY   | LORAWAN_NWK_S_ENC_KEY   |
57                +---------------------+-------------------------+
58                | LORAWAN_APP_S_KEY   | LORAWAN_APP_S_KEY       |
59                +---------------------+-------------------------+
60  ******************************************************************************
61  ******************************************************************************
62  ******************************************************************************
63  */
64 
65 /*!
66  * When set to 1 DevEui is LORAWAN_DEVICE_EUI
67  * When set to 0 DevEui is automatically set with a value provided by MCU platform
68  */
69 #define STATIC_DEVICE_EUI                                  0
70 
71 /*!
72  * end-device IEEE EUI (big endian)
73  */
74 #define LORAWAN_DEVICE_EUI                                 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
75 
76 /*!
77  * App/Join server IEEE EUI (big endian)
78  */
79 #define LORAWAN_JOIN_EUI                                   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
80 
81 /*!
82  * Secure-element pin
83  */
84 #define SECURE_ELEMENT_PIN                                 { 0x00, 0x00, 0x00, 0x00 }
85 
86 /*!
87  * When set to 1 DevAddr is LORAWAN_DEVICE_ADDRESS
88  * When set to 0 DevAddr is automatically set with a value provided by a pseudo
89  *      random generator seeded with a value provided by the MCU platform
90  */
91 #define STATIC_DEVICE_ADDRESS                              0
92 
93 /*!
94  * Device address on the network (big endian)
95  */
96 #define LORAWAN_DEVICE_ADDRESS                             ( uint32_t )0x00000000
97 
98 #define SOFT_SE_KEY_LIST                                                                                            \
99     {                                                                                                               \
100         {                                                                                                           \
101             /*!                                                                                                     \
102              * Application root key                                                                                 \
103              * WARNING: FOR 1.0.x DEVICES IT IS THE \ref LORAWAN_GEN_APP_KEY                                        \
104              */                                                                                                     \
105             .KeyID    = APP_KEY,                                                                                    \
106             .KeyValue = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, \
107                           0x3C },                                                                                   \
108         },                                                                                                          \
109         {                                                                                                           \
110             /*!                                                                                                     \
111              * Network root key                                                                                     \
112              * WARNING: FOR 1.0.x DEVICES IT IS THE \ref LORAWAN_APP_KEY                                            \
113              */                                                                                                     \
114             .KeyID    = NWK_KEY,                                                                                    \
115             .KeyValue = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, \
116                           0x3C },                                                                                   \
117         },                                                                                                          \
118         {                                                                                                           \
119             /*!                                                                                                     \
120              * Join session integrity key (Dynamically updated)                                                     \
121              * WARNING: NOT USED FOR 1.0.x DEVICES                                                                  \
122              */                                                                                                     \
123             .KeyID    = J_S_INT_KEY,                                                                                \
124             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
125                           0x00 },                                                                                   \
126         },                                                                                                          \
127         {                                                                                                           \
128             /*!                                                                                                     \
129              * Join session encryption key (Dynamically updated)                                                    \
130              * WARNING: NOT USED FOR 1.0.x DEVICES                                                                  \
131              */                                                                                                     \
132             .KeyID    = J_S_ENC_KEY,                                                                                \
133             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
134                           0x00 },                                                                                   \
135         },                                                                                                          \
136         {                                                                                                           \
137             /*!                                                                                                     \
138              * Forwarding Network session integrity key                                                             \
139              * WARNING: NWK_S_KEY FOR 1.0.x DEVICES                                                                 \
140              */                                                                                                     \
141             .KeyID    = F_NWK_S_INT_KEY,                                                                            \
142             .KeyValue = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, \
143                           0x3C },                                                                                   \
144         },                                                                                                          \
145         {                                                                                                           \
146             /*!                                                                                                     \
147              * Serving Network session integrity key                                                                \
148              * WARNING: NOT USED FOR 1.0.x DEVICES. MUST BE THE SAME AS \ref LORAWAN_F_NWK_S_INT_KEY                \
149              */                                                                                                     \
150             .KeyID    = S_NWK_S_INT_KEY,                                                                            \
151             .KeyValue = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, \
152                           0x3C },                                                                                   \
153         },                                                                                                          \
154         {                                                                                                           \
155             /*!                                                                                                     \
156              * Network session encryption key                                                                       \
157              * WARNING: NOT USED FOR 1.0.x DEVICES. MUST BE THE SAME AS \ref LORAWAN_F_NWK_S_INT_KEY                \
158              */                                                                                                     \
159             .KeyID    = NWK_S_ENC_KEY,                                                                              \
160             .KeyValue = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, \
161                           0x3C },                                                                                   \
162         },                                                                                                          \
163         {                                                                                                           \
164             /*!                                                                                                     \
165              * Application session key                                                                              \
166              */                                                                                                     \
167             .KeyID    = APP_S_KEY,                                                                                  \
168             .KeyValue = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, \
169                           0x3C },                                                                                   \
170         },                                                                                                          \
171         {                                                                                                           \
172             /*!                                                                                                     \
173              * Multicast root key (Dynamically updated)                                                             \
174              */                                                                                                     \
175             .KeyID    = MC_ROOT_KEY,                                                                                \
176             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
177                           0x00 },                                                                                   \
178         },                                                                                                          \
179         {                                                                                                           \
180             /*!                                                                                                     \
181              * Multicast key encryption key (Dynamically updated)                                                   \
182              */                                                                                                     \
183             .KeyID    = MC_KE_KEY,                                                                                  \
184             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
185                           0x00 },                                                                                   \
186         },                                                                                                          \
187         {                                                                                                           \
188             /*!                                                                                                     \
189              * Multicast group #0 root key (Dynamically updated)                                                    \
190              */                                                                                                     \
191             .KeyID    = MC_KEY_0,                                                                                   \
192             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
193                           0x00 },                                                                                   \
194         },                                                                                                          \
195         {                                                                                                           \
196             /*!                                                                                                     \
197              * Multicast group #0 application session key (Dynamically updated)                                     \
198              */                                                                                                     \
199             .KeyID    = MC_APP_S_KEY_0,                                                                             \
200             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
201                           0x00 },                                                                                   \
202         },                                                                                                          \
203         {                                                                                                           \
204             /*!                                                                                                     \
205              * Multicast group #0 network session key (Dynamically updated)                                         \
206              */                                                                                                     \
207             .KeyID    = MC_NWK_S_KEY_0,                                                                             \
208             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
209                           0x00 },                                                                                   \
210         },                                                                                                          \
211         {                                                                                                           \
212             /*!                                                                                                     \
213              * Multicast group #1 root key (Dynamically updated)                                                    \
214              */                                                                                                     \
215             .KeyID    = MC_KEY_1,                                                                                   \
216             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
217                           0x00 },                                                                                   \
218         },                                                                                                          \
219         {                                                                                                           \
220             /*!                                                                                                     \
221              * Multicast group #1 application session key (Dynamically updated)                                     \
222              */                                                                                                     \
223             .KeyID    = MC_APP_S_KEY_1,                                                                             \
224             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
225                           0x00 },                                                                                   \
226         },                                                                                                          \
227         {                                                                                                           \
228             /*!                                                                                                     \
229              * Multicast group #1 network session key (Dynamically updated)                                         \
230              */                                                                                                     \
231             .KeyID    = MC_NWK_S_KEY_1,                                                                             \
232             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
233                           0x00 },                                                                                   \
234         },                                                                                                          \
235         {                                                                                                           \
236             /*!                                                                                                     \
237              * Multicast group #2 root key (Dynamically updated)                                                    \
238              */                                                                                                     \
239             .KeyID    = MC_KEY_2,                                                                                   \
240             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
241                           0x00 },                                                                                   \
242         },                                                                                                          \
243         {                                                                                                           \
244             /*!                                                                                                     \
245              * Multicast group #2 application session key (Dynamically updated)                                     \
246              */                                                                                                     \
247             .KeyID    = MC_APP_S_KEY_2,                                                                             \
248             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
249                           0x00 },                                                                                   \
250         },                                                                                                          \
251         {                                                                                                           \
252             /*!                                                                                                     \
253              * Multicast group #2 network session key (Dynamically updated)                                         \
254              */                                                                                                     \
255             .KeyID    = MC_NWK_S_KEY_2,                                                                             \
256             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
257                           0x00 },                                                                                   \
258         },                                                                                                          \
259         {                                                                                                           \
260             /*!                                                                                                     \
261              * Multicast group #3 root key (Dynamically updated)                                                    \
262              */                                                                                                     \
263             .KeyID    = MC_KEY_3,                                                                                   \
264             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
265                           0x00 },                                                                                   \
266         },                                                                                                          \
267         {                                                                                                           \
268             /*!                                                                                                     \
269              * Multicast group #3 application session key (Dynamically updated)                                     \
270              */                                                                                                     \
271             .KeyID    = MC_APP_S_KEY_3,                                                                             \
272             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
273                           0x00 },                                                                                   \
274         },                                                                                                          \
275         {                                                                                                           \
276             /*!                                                                                                     \
277              * Multicast group #3 network session key (Dynamically updated)                                         \
278              */                                                                                                     \
279             .KeyID    = MC_NWK_S_KEY_3,                                                                             \
280             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
281                           0x00 },                                                                                   \
282         },                                                                                                          \
283         {                                                                                                           \
284             /*!                                                                                                     \
285              * All zeros key. (ClassB usage)(constant)                                                              \
286              */                                                                                                     \
287             .KeyID    = SLOT_RAND_ZERO_KEY,                                                                         \
288             .KeyValue = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
289                           0x00 },                                                                                   \
290         },                                                                                                          \
291     },
292 
293 #ifdef __cplusplus
294 }
295 #endif
296 
297 #endif  //  __SOFT_SE_IDENTITY_H__
298