1f4854a5eSMatthias Ringwald /* 2f4854a5eSMatthias Ringwald * Copyright (C) 2017 BlueKitchen GmbH 3f4854a5eSMatthias Ringwald * 4f4854a5eSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5f4854a5eSMatthias Ringwald * modification, are permitted provided that the following conditions 6f4854a5eSMatthias Ringwald * are met: 7f4854a5eSMatthias Ringwald * 8f4854a5eSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9f4854a5eSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10f4854a5eSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11f4854a5eSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12f4854a5eSMatthias Ringwald * documentation and/or other materials provided with the distribution. 13f4854a5eSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14f4854a5eSMatthias Ringwald * contributors may be used to endorse or promote products derived 15f4854a5eSMatthias Ringwald * from this software without specific prior written permission. 16f4854a5eSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17f4854a5eSMatthias Ringwald * personal benefit and not for any commercial purpose or for 18f4854a5eSMatthias Ringwald * monetary gain. 19f4854a5eSMatthias Ringwald * 20f4854a5eSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21f4854a5eSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22f4854a5eSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23*2fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 24*2fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25f4854a5eSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26f4854a5eSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27f4854a5eSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28f4854a5eSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29f4854a5eSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30f4854a5eSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31f4854a5eSMatthias Ringwald * SUCH DAMAGE. 32f4854a5eSMatthias Ringwald * 33f4854a5eSMatthias Ringwald * Please inquire about commercial licensing options at 34f4854a5eSMatthias Ringwald * [email protected] 35f4854a5eSMatthias Ringwald * 36f4854a5eSMatthias Ringwald */ 37f4854a5eSMatthias Ringwald 38f4854a5eSMatthias Ringwald /* 39f4854a5eSMatthias Ringwald * provisioning.h 40f4854a5eSMatthias Ringwald */ 41f4854a5eSMatthias Ringwald 42f4854a5eSMatthias Ringwald #ifndef __PROVISIONING_H 43f4854a5eSMatthias Ringwald #define __PROVISIONING_H 44f4854a5eSMatthias Ringwald 45f4854a5eSMatthias Ringwald #include <stdint.h> 46f4854a5eSMatthias Ringwald 47f4854a5eSMatthias Ringwald #include "btstack_defines.h" 48f4854a5eSMatthias Ringwald #include "btstack_crypto.h" 49f4854a5eSMatthias Ringwald 50f4854a5eSMatthias Ringwald #include "mesh/mesh_keys.h" 51f4854a5eSMatthias Ringwald 52f4854a5eSMatthias Ringwald #ifdef __cplusplus 53f4854a5eSMatthias Ringwald extern "C" 54f4854a5eSMatthias Ringwald { 55f4854a5eSMatthias Ringwald #endif 56f4854a5eSMatthias Ringwald 57f4854a5eSMatthias Ringwald #define PROVISIONING_PROTOCOL_TIMEOUT_MS 60000 58f4854a5eSMatthias Ringwald #define MESH_PROV_MAX_PROXY_PDU 66 59f4854a5eSMatthias Ringwald #define MESH_PB_TRANSPORT_INVALID_CID 0xFFFF 60f4854a5eSMatthias Ringwald 61f4854a5eSMatthias Ringwald // Provisioning Bearer Control 62f4854a5eSMatthias Ringwald 63f4854a5eSMatthias Ringwald #define MESH_PROV_INVITE 0x00 64f4854a5eSMatthias Ringwald #define MESH_PROV_CAPABILITIES 0x01 65f4854a5eSMatthias Ringwald #define MESH_PROV_START 0x02 66f4854a5eSMatthias Ringwald #define MESH_PROV_PUB_KEY 0x03 67f4854a5eSMatthias Ringwald #define MESH_PROV_INPUT_COMPLETE 0x04 68f4854a5eSMatthias Ringwald #define MESH_PROV_CONFIRM 0x05 69f4854a5eSMatthias Ringwald #define MESH_PROV_RANDOM 0x06 70f4854a5eSMatthias Ringwald #define MESH_PROV_DATA 0x07 71f4854a5eSMatthias Ringwald #define MESH_PROV_COMPLETE 0x08 72f4854a5eSMatthias Ringwald #define MESH_PROV_FAILED 0x09 73f4854a5eSMatthias Ringwald 74f4854a5eSMatthias Ringwald // Provisioning Output OOB Actions 75f4854a5eSMatthias Ringwald #define MESH_OUTPUT_OOB_BLINK 0x01 76f4854a5eSMatthias Ringwald #define MESH_OUTPUT_OOB_BEEP 0x02 77f4854a5eSMatthias Ringwald #define MESH_OUTPUT_OOB_VIBRATE 0x04 78f4854a5eSMatthias Ringwald #define MESH_OUTPUT_OOB_NUMBER 0x08 79f4854a5eSMatthias Ringwald #define MESH_OUTPUT_OOB_STRING 0x10 80f4854a5eSMatthias Ringwald 81f4854a5eSMatthias Ringwald // Provisioning Input OOB Actions 82f4854a5eSMatthias Ringwald #define MESH_INPUT_OOB_PUSH 0x01 83f4854a5eSMatthias Ringwald #define MESH_INPUT_OOB_TWIST 0x02 84f4854a5eSMatthias Ringwald #define MESH_INPUT_OOB_NUMBER 0x04 85f4854a5eSMatthias Ringwald #define MESH_INPUT_OOB_STRING 0x08 86f4854a5eSMatthias Ringwald 87f4854a5eSMatthias Ringwald typedef enum { 8830a044b0SMilanka Ringwald MESH_PB_TYPE_ADV = 0, 8930a044b0SMilanka Ringwald MESH_PB_TYPE_GATT 9030a044b0SMilanka Ringwald } mesh_pb_type_t; 91f4854a5eSMatthias Ringwald 92f4854a5eSMatthias Ringwald typedef enum { 93f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_OTHER = 0, 94f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_ELECTRONIC_OR_URI, 95f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_2D_MACHINE_READABLE_CODE, 96f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_BAR_CODE, 97f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_NEAR_FIELD_COMMUNICATION, 98f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_NUMBER, 99f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_STRING, 100f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_RESERVED_7, 101f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_RESERVED_8, 102f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_RESERVED_9, 103f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_RESERVED_10, 104f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_ON_BOX, 105f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_INSIDE_BOX, 106f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_ON_PIECE_OF_PAPER, 107f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_INSIDE_MANUAL, 108f4854a5eSMatthias Ringwald MESH_OOB_INFORMATION_INDEX_ON_DEVICE 109f4854a5eSMatthias Ringwald } mesh_oob_information_index_t; 110f4854a5eSMatthias Ringwald 111f4854a5eSMatthias Ringwald typedef enum { 112f4854a5eSMatthias Ringwald MESH_MSG_SAR_FIELD_COMPLETE_MSG = 0, 113f4854a5eSMatthias Ringwald MESH_MSG_SAR_FIELD_FIRST_SEGMENT, 114f4854a5eSMatthias Ringwald MESH_MSG_SAR_FIELD_CONTINUE, 115f4854a5eSMatthias Ringwald MESH_MSG_SAR_FIELD_LAST_SEGMENT 116f4854a5eSMatthias Ringwald } mesh_msg_sar_field_t; // Message segmentation and reassembly information 117f4854a5eSMatthias Ringwald 118f4854a5eSMatthias Ringwald typedef enum { 119f4854a5eSMatthias Ringwald MESH_MSG_TYPE_NETWORK_PDU = 0, 120f4854a5eSMatthias Ringwald MESH_MSG_TYPE_BEACON, 121f4854a5eSMatthias Ringwald MESH_MSG_TYPE_PROXY_CONFIGURATION, 122f4854a5eSMatthias Ringwald MESH_MSG_TYPE_PROVISIONING_PDU 123f4854a5eSMatthias Ringwald } mesh_msg_type_t; 124f4854a5eSMatthias Ringwald 125f4854a5eSMatthias Ringwald typedef enum { 126f4854a5eSMatthias Ringwald MESH_IDENTIFICATION_NETWORK_ID_TYPE = 0, 127f4854a5eSMatthias Ringwald MESH_IDENTIFICATION_NODE_IDENTIFY_TYPE 128f4854a5eSMatthias Ringwald } mesh_identification_type_t; 129f4854a5eSMatthias Ringwald 130f4854a5eSMatthias Ringwald typedef struct { 131f4854a5eSMatthias Ringwald // DevKey = k1(ECDHSecret, ProvisioningSalt, “prdk”) 132f4854a5eSMatthias Ringwald uint8_t device_key[16]; 133f4854a5eSMatthias Ringwald 134f4854a5eSMatthias Ringwald // Unicast Address 135f4854a5eSMatthias Ringwald uint16_t unicast_address; 136f4854a5eSMatthias Ringwald 137f4854a5eSMatthias Ringwald // Key Refresh Phase 0 vs. 2, IV Update Active 138f4854a5eSMatthias Ringwald uint8_t flags; 139f4854a5eSMatthias Ringwald 140f4854a5eSMatthias Ringwald // IV Index 141f4854a5eSMatthias Ringwald uint32_t iv_index; 142f4854a5eSMatthias Ringwald 143f4854a5eSMatthias Ringwald // Network Key (pass by reference) 144f4854a5eSMatthias Ringwald mesh_network_key_t * network_key; 145f4854a5eSMatthias Ringwald 146f4854a5eSMatthias Ringwald } mesh_provisioning_data_t; 147f4854a5eSMatthias Ringwald 148f4854a5eSMatthias Ringwald #ifdef __cplusplus 149f4854a5eSMatthias Ringwald } /* end of extern "C" */ 150f4854a5eSMatthias Ringwald #endif 151f4854a5eSMatthias Ringwald 152f4854a5eSMatthias Ringwald #endif 153