Virgil IoT KIT
Data Structures | Macros | Typedefs | Enumerations
provision-structs.h File Reference

Provision interface structures. More...

#include <virgil/iot/status_code/status_code.h>
#include <trust_list-config.h>

Go to the source code of this file.

Data Structures

struct  vs_sign_t
 Signature type. More...
 
struct  vs_pubkey_t
 Public key type. More...
 
struct  vs_pubkey_dated_t
 Public key with date information. More...
 
struct  vs_file_version_t
 File version information. More...
 
struct  vs_file_info_t
 File information. More...
 
struct  vs_provision_tl_find_ctx_t
 Find context. More...
 
struct  vs_provision_events_t
 Container of pointers to callback functions for Provision Events. More...
 

Macros

#define HTONL_IN_COMPILE_TIME(val)
 
#define HTONS_IN_COMPILE_TIME(val)   (uint16_t)(((uint16_t)val & 0xFF) << 8 | ((uint16_t)val & 0xFF00) >> 8)
 
#define VS_START_EPOCH   (1420070400)
 The start time point for UNIX time format. More...
 
#define VS_DEVICE_SERIAL_SIZE   (32)
 Device serial ID size. More...
 
#define VS_DEVICE_MANUFACTURE_ID_SIZE   (16)
 Manufacture ID size. More...
 
#define VS_DEVICE_TYPE_SIZE   (4)
 Device type size. More...
 

Typedefs

typedef uint8_t vs_device_manufacture_id_t[VS_DEVICE_MANUFACTURE_ID_SIZE]
 Manufacture ID type. More...
 
typedef uint8_t vs_device_type_t[VS_DEVICE_TYPE_SIZE]
 Device type. More...
 
typedef uint8_t vs_device_serial_t[VS_DEVICE_SERIAL_SIZE]
 Device serial number type. More...
 
typedef void(* vs_file_ver_info_cb_t) (vs_file_version_t ver)
 Callback function to inform system about current version of file. More...
 

Enumerations

enum  vs_prvs_t { VS_PRVS_SERVICE_ID = HTONL_IN_COMPILE_TIME('PRVS') }
 PRVS SNAP service code. More...
 
enum  vs_snap_prvs_element_e {
  VS_PRVS_DNID = HTONL_IN_COMPILE_TIME('DNID'), VS_PRVS_SGNP = HTONL_IN_COMPILE_TIME('SGNP'), VS_PRVS_PBR1 = HTONL_IN_COMPILE_TIME('PBR1'), VS_PRVS_PBR2 = HTONL_IN_COMPILE_TIME('PBR2'),
  VS_PRVS_PBA1 = HTONL_IN_COMPILE_TIME('PBA1'), VS_PRVS_PBA2 = HTONL_IN_COMPILE_TIME('PBA2'), VS_PRVS_PBT1 = HTONL_IN_COMPILE_TIME('PBT1'), VS_PRVS_PBT2 = HTONL_IN_COMPILE_TIME('PBT2'),
  VS_PRVS_PBF1 = HTONL_IN_COMPILE_TIME('PBF1'), VS_PRVS_PBF2 = HTONL_IN_COMPILE_TIME('PBF2'), VS_PRVS_TLH = HTONL_IN_COMPILE_TIME('_TLH'), VS_PRVS_TLC = HTONL_IN_COMPILE_TIME('_TLC'),
  VS_PRVS_TLF = HTONL_IN_COMPILE_TIME('_TLF'), VS_PRVS_DEVI = HTONL_IN_COMPILE_TIME('DEVI'), VS_PRVS_ASAV = HTONL_IN_COMPILE_TIME('ASAV'), VS_PRVS_ASGN = HTONL_IN_COMPILE_TIME('ASGN')
}
 Provision operations. More...
 
enum  vs_provision_element_id_e {
  VS_PROVISION_SGNP = VS_PRVS_SGNP, VS_PROVISION_PBR1 = VS_PRVS_PBR1, VS_PROVISION_PBR2 = VS_PRVS_PBR2, VS_PROVISION_PBA1 = VS_PRVS_PBA1,
  VS_PROVISION_PBA2 = VS_PRVS_PBA2, VS_PROVISION_PBT1 = VS_PRVS_PBT1, VS_PROVISION_PBT2 = VS_PRVS_PBT2, VS_PROVISION_PBF1 = VS_PRVS_PBF1,
  VS_PROVISION_PBF2 = VS_PRVS_PBF2
}
 Element ID. More...
 
enum  vs_key_type_e {
  VS_KEY_RECOVERY = 0, VS_KEY_AUTH, VS_KEY_TRUSTLIST, VS_KEY_FIRMWARE,
  VS_KEY_FACTORY, VS_KEY_IOT_DEVICE, VS_KEY_USER_DEVICE, VS_KEY_FIRMWARE_INTERNAL,
  VS_KEY_AUTH_INTERNAL, VS_KEY_CLOUD, VS_KEY_UNSUPPORTED
}
 Key type. More...
 

Detailed Description

Provision interface structures.

Provision structures usage

See Provision Usage for Provision module initialization and call.

Device has 3 identifiers that are used by Cloud and Update interfaces : manufacture ID, device type and device serial number, vs_device_manufacture_id_t, vs_device_type_t and vs_device_serial_t respectively. They must be initialized before any Virgil IoT calls.

Manufacture ID initialization example provided below :

void
init_manufacture_id(vs_device_manufacture_id_t manufacture_id, void *src_data) {
size_t pos;
const uint8_t *raw_data = src_data;
memset(manufacture_id, 0, sizeof(vs_device_manufacture_id_t));
for (pos = 0; pos < sizeof(vs_device_manufacture_id_t) && raw_data[pos]; ++pos) {
manufacture_id[pos] = raw_data[pos];
}
}
// in main:
// MANUFACTURE_ID is the compile time ASCII constant provided by -D compilation parameter
init_manufacture_id(manufacture_id, MANUFACTURE_ID);

You can use function like this for device type filling and device serial number.

Macro Definition Documentation

◆ HTONL_IN_COMPILE_TIME

#define HTONL_IN_COMPILE_TIME (   val)
Value:
(uint32_t)(((uint32_t)val & 0xFF) << 24 | ((uint32_t)val & 0xFF00) << 8 | ((uint32_t)val & 0xFF0000) >> 8 | \
((uint32_t)val & 0xFF000000) >> 24)

◆ HTONS_IN_COMPILE_TIME

#define HTONS_IN_COMPILE_TIME (   val)    (uint16_t)(((uint16_t)val & 0xFF) << 8 | ((uint16_t)val & 0xFF00) >> 8)

◆ VS_DEVICE_MANUFACTURE_ID_SIZE

#define VS_DEVICE_MANUFACTURE_ID_SIZE   (16)

Manufacture ID size.

◆ VS_DEVICE_SERIAL_SIZE

#define VS_DEVICE_SERIAL_SIZE   (32)

Device serial ID size.

◆ VS_DEVICE_TYPE_SIZE

#define VS_DEVICE_TYPE_SIZE   (4)

Device type size.

◆ VS_START_EPOCH

#define VS_START_EPOCH   (1420070400)

The start time point for UNIX time format.

Timestamps are stored as seconds since January 1, 2015 UTC. This is constant for UNIX time conversions

Typedef Documentation

◆ vs_device_manufacture_id_t

typedef uint8_t vs_device_manufacture_id_t[VS_DEVICE_MANUFACTURE_ID_SIZE]

Manufacture ID type.

Manufacture identifier containing ASCII symbols and trailing zeroes.

◆ vs_device_serial_t

typedef uint8_t vs_device_serial_t[VS_DEVICE_SERIAL_SIZE]

Device serial number type.

Device serial number identifier contains ASCII symbols and trailing zeroes.

◆ vs_device_type_t

typedef uint8_t vs_device_type_t[VS_DEVICE_TYPE_SIZE]

Device type.

Device type identifier contains ASCII symbols and trailing zeroes.

◆ vs_file_ver_info_cb_t

typedef void(* vs_file_ver_info_cb_t) (vs_file_version_t ver)

Callback function to inform system about current version of file.

Parameters
[in]vervs_file_version_t Current version of file
Returns
VS_CODE_OK in case of success or error code.

Enumeration Type Documentation

◆ vs_key_type_e

Key type.

Enumerator
VS_KEY_RECOVERY 

Recovery key.

VS_KEY_AUTH 

Authentication key.

VS_KEY_TRUSTLIST 

Trust List key.

VS_KEY_FIRMWARE 

Firmware key.

VS_KEY_FACTORY 

Factory key.

VS_KEY_IOT_DEVICE 

Key of IoT device.

VS_KEY_USER_DEVICE 

Key ofr user device.

VS_KEY_FIRMWARE_INTERNAL 

Firmware internal key.

VS_KEY_AUTH_INTERNAL 

Authentication internal key.

VS_KEY_CLOUD 

Cloud key.

VS_KEY_UNSUPPORTED 

Unsupported key.

◆ vs_provision_element_id_e

Element ID.

Enumerator
VS_PROVISION_SGNP 
VS_PROVISION_PBR1 
VS_PROVISION_PBR2 
VS_PROVISION_PBA1 
VS_PROVISION_PBA2 
VS_PROVISION_PBT1 
VS_PROVISION_PBT2 
VS_PROVISION_PBF1 
VS_PROVISION_PBF2 

◆ vs_prvs_t

enum vs_prvs_t

PRVS SNAP service code.

Enumerator
VS_PRVS_SERVICE_ID 

◆ vs_snap_prvs_element_e

Provision operations.

Enumerator
VS_PRVS_DNID 

Discover Not Initialized Devices.

VS_PRVS_SGNP 

Signature of own public key (by private key VS_PRVS_PBDM)

VS_PRVS_PBR1 

Set Recovery Key 1.

VS_PRVS_PBR2 

Set Recovery Key 2.

VS_PRVS_PBA1 

Set Auth Key 1.

VS_PRVS_PBA2 

Set Auth Key 2.

VS_PRVS_PBT1 

Set Trust List Key 1.

VS_PRVS_PBT2 

Set Trust List 2.

VS_PRVS_PBF1 

Set Firmware Key 1.

VS_PRVS_PBF2 

Set Firmware Key 2.

VS_PRVS_TLH 

Set Trust List Header.

VS_PRVS_TLC 

Set Trust List Chunk.

VS_PRVS_TLF 

Set Trust List Footer.

VS_PRVS_DEVI 

Get DEVice Info.

VS_PRVS_ASAV 

Action SAVe provision.

VS_PRVS_ASGN 

Action SiGN data.

vs_device_manufacture_id_t
uint8_t vs_device_manufacture_id_t[VS_DEVICE_MANUFACTURE_ID_SIZE]
Manufacture ID type.
Definition: provision-structs.h:120