nRF5 SDK for Mesh v5.0.0
nrf_mesh_prov_types.h
1 /* Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form, except as embedded into a Nordic
11  * Semiconductor ASA integrated circuit in a product or a software update for
12  * such product, must reproduce the above copyright notice, this list of
13  * conditions and the following disclaimer in the documentation and/or other
14  * materials provided with the distribution.
15  *
16  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
17  * contributors may be used to endorse or promote products derived from this
18  * software without specific prior written permission.
19  *
20  * 4. This software, with or without modification, must only be used with a
21  * Nordic Semiconductor ASA integrated circuit.
22  *
23  * 5. Any software provided in binary form under this license must not be reverse
24  * engineered, decompiled, modified and/or disassembled.
25  *
26  * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
27  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
29  * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
30  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
32  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef NRF_MESH_PROV_TYPES_H_
39 #define NRF_MESH_PROV_TYPES_H_
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 
44 #include "nrf_mesh_defines.h"
45 
54 #define NRF_MESH_PROV_PUBKEY_SIZE 64
55 
56 #define NRF_MESH_PROV_PRIVKEY_SIZE 32
57 
58 #define NRF_MESH_PROV_ECDHSECRET_SIZE 32
59 
60 #define NRF_MESH_PROV_DATANONCE_SIZE 13
61 
63 #define NRF_MESH_PROV_OOB_SIZE_MAX 8
64 
66 #define PROV_RANDOM_LEN (16)
67 
68 #define PROV_CONFIRMATION_LEN (NRF_MESH_KEY_SIZE)
69 
70 #define PROV_AUTH_LEN (NRF_MESH_KEY_SIZE)
71 
72 #define PROV_SALT_LEN (NRF_MESH_KEY_SIZE)
73 
74 #define PROV_NONCE_LEN (13)
75 
76 #define PROV_CONFIRMATION_INPUT_LEN (17)
77 
89 #define NRF_MESH_PROV_ALGORITHM_FIPS_P256EC (1u << 0)
90 
95 #define NRF_MESH_PROV_OOB_PUBKEY_TYPE_INBAND (0)
96 
97 #define NRF_MESH_PROV_OOB_PUBKEY_TYPE_OOB (1u << 0)
98 
99 
101 #define NRF_MESH_PROV_OOB_STATIC_TYPE_SUPPORTED (1u << 0)
102 
104 #define NRF_MESH_PROV_OOB_OUTPUT_ACTION_BLINK (1u << 0)
105 
106 #define NRF_MESH_PROV_OOB_OUTPUT_ACTION_BEEP (1u << 1)
107 
108 #define NRF_MESH_PROV_OOB_OUTPUT_ACTION_VIBRATE (1u << 2)
109 
110 #define NRF_MESH_PROV_OOB_OUTPUT_ACTION_NUMERIC (1u << 3)
111 
112 #define NRF_MESH_PROV_OOB_OUTPUT_ACTION_ALPHANUMERIC (1u << 4)
113 
115 #define NRF_MESH_PROV_OOB_INPUT_ACTION_PUSH (1u << 0)
116 
117 #define NRF_MESH_PROV_OOB_INPUT_ACTION_TWIST (1u << 1)
118 
119 #define NRF_MESH_PROV_OOB_INPUT_ACTION_ENTER_NUMBER (1u << 2)
120 
121 #define NRF_MESH_PROV_OOB_INPUT_ACTION_ENTER_STRING (1u << 3)
122 
133 #define NRF_MESH_PROV_OOB_INFO_SOURCE_OTHER (1u << 0)
134 #define NRF_MESH_PROV_OOB_INFO_SOURCE_ELECTRONIC_OR_URI (1u << 1)
135 #define NRF_MESH_PROV_OOB_INFO_SOURCE_2D_MACHINE_READABLE_CODE (1u << 2)
136 #define NRF_MESH_PROV_OOB_INFO_SOURCE_BAR_CODE (1u << 3)
137 #define NRF_MESH_PROV_OOB_INFO_SOURCE_NFC (1u << 4)
138 #define NRF_MESH_PROV_OOB_INFO_SOURCE_NUMBER (1u << 5)
139 #define NRF_MESH_PROV_OOB_INFO_SOURCE_STRING (1u << 6)
140 #define NRF_MESH_PROV_OOB_INFO_SOURCE_ON_BOX (1u << 11)
141 #define NRF_MESH_PROV_OOB_INFO_SOURCE_INSIDE_BOX (1u << 12)
142 #define NRF_MESH_PROV_OOB_INFO_SOURCE_ON_PIECE_OF_PAPER (1u << 13)
143 #define NRF_MESH_PROV_OOB_INFO_SOURCE_INSIDE_MANUAL (1u << 14)
144 #define NRF_MESH_PROV_OOB_INFO_SOURCE_ON_DEVICE (1u << 15)
157 typedef enum
158 {
162 
166 typedef enum
167 {
172 
176  typedef enum
177  {
184 
188  typedef enum
189  {
196 
200  typedef enum
201  {
209 
213  typedef enum
214  {
224 
225 /*lint -align_max(push) -align_max(1) */
226 
232 typedef struct __attribute((packed))
233 {
234  uint8_t num_elements;
235  uint16_t algorithms;
236  uint8_t pubkey_type;
238  uint8_t oob_output_size;
240  uint8_t oob_input_size;
241  uint16_t oob_input_actions;
243 
248 typedef enum
249 {
273 
277 typedef struct __attribute((packed))
278 {
280  uint8_t netkey[NRF_MESH_KEY_SIZE];
282  uint16_t netkey_index;
284  uint32_t iv_index;
286  uint16_t address;
288  struct __attribute((packed)) {
290  uint8_t iv_update : 1;
292  uint8_t key_refresh : 1;
293  } flags;
295 
296 /*lint -align_max(pop) */
297 
299 typedef enum
300 {
304 
309 typedef struct nrf_mesh_prov_ctx nrf_mesh_prov_ctx_t;
310 
313 #endif /* NRF_MESH_PROV_TYPES_H__ */
The device should vibrate as output action.
Start value of reserved for the future range.
The device will act as a provisioner, distributing provisioning data.
Start value of prohibited range.
Waiting for a provisioning start message.
Start value of reserved for the future range.
uint8_t key_refresh
Key refresh in progress flag.
#define NRF_MESH_KEY_SIZE
Size (in octets) of an encryption key.
Provisioning failed state.
uint8_t pubkey_type
Supported public key types.
uint8_t oob_input_size
Input OOB data size.
No authentication method.
Waiting for the peer node to send its public key.
Static OOB authentication method.
uint16_t oob_input_actions
Supported input OOB actions.
uint16_t algorithms
Supported authentication algorithms.
Waiting for a provisioning random message.
Waiting for the public key to be received by the peer.
nrf_mesh_prov_algorithm_t
The algorithm used for provisioning.
Output OOB authentication method.
An incoming provisioning packet had an invalid format.
uint8_t iv_update
IV update in progress flag.
The user should enter a string into the device as input action.
Common provisioning context forward declaration.
Definition: nrf_mesh_prov.h:81
Waiting for the confirmation to be received by the peer.
The device should display a number as output action.
Waiting for a provisioning invitation message.
Waiting for an input complete message.
The user should enter a number into the device as input action.
nrf_mesh_prov_failure_code_t
Provisioning failure codes.
Waiting for the application to confirm the capabilities to use.
Idle state, no action is taken.
Input OOB authentication method.
The OOB authentication between provisioner and provisionee failed.
Waiting for static OOB data.
nrf_mesh_prov_role_t
Provisioning role.
The device should use blinking as output action.
Waiting for the message acknowledgement for the start message.
Waiting for a provisioning confirmation message.
nrf_mesh_prov_output_action_t
Enumeration for the OOB output actions.
The user should do a twist action as input action.
uint8_t num_elements
Number of elements in the device.
uint16_t netkey_index
Network key index.
The user should do a push action as input action.
Waiting for static OOB data, confirmation already received.
nrf_mesh_prov_input_action_t
Enumeration for the OOB input actions.
uint16_t oob_output_actions
Supported output OOB actions.
nrf_mesh_prov_oob_method_t
Out-of-band authentication methods for provisioning.
An invalid provisioning PDU was received.
Start value of prohibited range.
Provisioning authentication capabilities.
Waiting for a link to be established.
OOB Public Key is used.
Start value of reserved for the future range.
Consecutive unicast addresses could not be assigned.
uint8_t oob_output_size
Output OOB data size.
uint16_t address
Unicast address for the device.
The provisioning data could not be decrypted.
nrf_mesh_prov_state_t
Provisioning state machine states.
The device should display an alpha-numberic value as output action.
The incoming packet was a different packet type than what was expected.
Waiting for the OOB public key to be retrieved.
FIPS P-256 Elliptic Curve.
Waiting for a provisioning capabilities message.
uint8_t oob_static_types
Supported static OOB types.
Provisioning data to transmit to a device.
nrf_mesh_prov_public_key_usage_t
The Public Key kind of usage.
Waiting for the offloaded ECDH calculation to complete.
Waiting for the provisioning data message.
The device will act as a provisionee, receiving provisioning data.
No OOB Public Key is used.
Waiting for the provisioning complete message.
Provisioning complete state.
uint32_t iv_index
IV_index value for the device, in little endian format.
The device should use beeping as output action.
The device does not have enough resources (memory, CPU time) to complete the provisioning.

Documentation feedback | Developer Zone | Subscribe | Updated