wickr-crypto-c

Data Structures | Functions
Wickr_dev_info

## Data Structures
struct | wickr_dev_info
| Device Information used to make a uniquely identifying set of data for each context running the Wickr Protocol. More...

## Functions
wickr_dev_info_t * | wickr_dev_info_create (wickr_buffer_t *dev_salt, wickr_buffer_t *system_salt, wickr_buffer_t *msg_proto_id, wickr_buffer_t *srv_comm_id)
wickr_dev_info_t * | wickr_dev_info_create_new (const wickr_crypto_engine_t *crypto, const wickr_buffer_t *system_id)
wickr_dev_info_t * | wickr_dev_info_derive (const wickr_crypto_engine_t *crypto, wickr_buffer_t *dev_salt, const wickr_buffer_t *system_id)
wickr_dev_info_t * | wickr_dev_info_copy (const wickr_dev_info_t *info)
void | wickr_dev_info_destroy (wickr_dev_info_t **info)

## Detailed Description

## Function Documentation

## ◆ wickr_dev_info_copy()

wickr_dev_info_t* wickr_dev_info_copy | ( | const wickr_dev_info_t * | info | ) |

Copy a device info set

Parameters

  info | the source info to copy

Returns
  a newly allocated device info set containing deep copies of the properties of 'info'

## ◆ wickr_dev_info_create()

wickr_dev_info_t* wickr_dev_info_create | ( | wickr_buffer_t * | dev_salt,
|  | wickr_buffer_t * | system_salt,
|  | wickr_buffer_t * | msg_proto_id,
|  | wickr_buffer_t * | srv_comm_id
| ) |  |

Create a device info set from components

Parameters

  dev_salt | random salt, see property declaration of 'wickr_dev_info'
  system_salt | system bound salt, see property declaration of 'wickr_dev_info'
  msg_proto_id | messaging protocol identifier, see property declaration of 'wickr_dev_info'
  srv_comm_id | server communication identifier, see property declaration of 'wickr_dev_info'

Returns
  a newly allocated device info set owning the properties passed in

## ◆ wickr_dev_info_create_new()

wickr_dev_info_t* wickr_dev_info_create_new | ( | const wickr_crypto_engine_t * | crypto,
|  | const wickr_buffer_t * | system_id
| ) |  |

Generate a new randomized device info set from a system identifier. This function uses crypto engine 'crypto' to generate a random 'dev_salt' value, and then calls 'wickr_dev_info_derive' with the resulting random 'dev_salt', crypto engine, and provided 'system_id' values

Parameters

  crypto | a crypto engine that supports a PRNG, SHA512, and SHA256 functions
  system_id | a buffer representing data optimally unique to your system. It is used as the basis of generating the 'system_salt' property. See property declaration of 'system_salt' in 'wickr_dev_info'

Returns
  the output of 'wickr_dev_info_derive' with a randomly generated 'dev_salt'

## ◆ wickr_dev_info_derive()

wickr_dev_info_t* wickr_dev_info_derive | ( | const wickr_crypto_engine_t * | crypto,
|  | wickr_buffer_t * | dev_salt,
|  | const wickr_buffer_t * | system_id
| ) |  |

Derive a set of salt values and identifiers. Creates 'system_salt' by taking a SHA256 hash of the system_id. Creates 'msg_proto_id', and 'srv_comm_id' properties by taking a SHA512 of of 'system_id' using 'dev_salt' as a salt, and then splits by using the first 32 bytes as 'msg_proto_id', and the last 32 bytes as 'srv_comm_id'

Parameters

  crypto | a crypto engine that supports a PRNG, SHA512, and SHA256 functions
  dev_salt | a randomly generated device salt to be used as input for generating identifiers
  system_id | a system level identifier to be used as input to generating a 'system_salt' value, as well as identifiers

Returns
  a newly allocated device info set owning the reference to dev_salt, and with newly generated values for 'system_salt', 'msg_proto_id', and 'srv_comm_id'. NULL if derivation fails

## ◆ wickr_dev_info_destroy()

void wickr_dev_info_destroy | ( | wickr_dev_info_t ** | info | ) |

Destroy a device info set

Parameters

  info | a pointer to a device info set to destroy. Properties of '*info' will also be destroyed