wickr-crypto-c

transport_root_key.h
1 /*
2 * Copyright © 2012-2020 Wickr Inc. All rights reserved.
3 *
4 * This code is being released for EDUCATIONAL, ACADEMIC, AND CODE REVIEW PURPOSES
5 * ONLY. COMMERCIAL USE OF THE CODE IS EXPRESSLY PROHIBITED. For additional details,
6 * please see LICENSE
7 *
8 * THE CODE IS MADE AVAILABLE "AS-IS" AND WITHOUT ANY EXPRESS OR
9 * IMPLIED GUARANTEES AS TO FITNESS, MERCHANTABILITY, NON-
10 * INFRINGEMENT OR OTHERWISE. IT IS NOT BEING PROVIDED IN TRADE BUT ON
11 * A VOLUNTARY BASIS ON BEHALF OF THE AUTHOR’S PART FOR THE BENEFIT
12 * OF THE LICENSEE AND IS NOT MADE AVAILABLE FOR CONSUMER USE OR ANY
13 * OTHER USE OUTSIDE THE TERMS OF THIS LICENSE. ANYONE ACCESSING THE
14 * CODE SHOULD HAVE THE REQUISITE EXPERTISE TO SECURE THEIR SYSTEM
15 * AND DEVICES AND TO ACCESS AND USE THE CODE FOR REVIEW PURPOSES
16 * ONLY. LICENSEE BEARS THE RISK OF ACCESSING AND USING THE CODE. IN
17 * PARTICULAR, AUTHOR BEARS NO LIABILITY FOR ANY INTERFERENCE WITH OR
18 * ADVERSE EFFECT THAT MAY OCCUR AS A RESULT OF THE LICENSEE
19 * ACCESSING AND/OR USING THE CODE ON LICENSEE’S SYSTEM.
20 */
21
22 #ifndef transport_root_key_h
23 #define transport_root_key_h
24
25 #include "buffer.h"
26 #include "stream_ctx.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
52 struct wickr_transport_root_key {
53 wickr_buffer_t *secret;
54 wickr_cipher_t cipher;
55 uint32_t packets_per_evo_send;
56 uint32_t packets_per_evo_recv;
57 };
58
59 typedef struct wickr_transport_root_key wickr_transport_root_key_t;
60
72 wickr_transport_root_key_t *wickr_transport_root_key_create_random(const wickr_crypto_engine_t *engine,
73 wickr_cipher_t cipher,
74 uint32_t packets_per_evo_send,
75 uint32_t packets_per_evo_recv);
76
88 wickr_transport_root_key_t *wickr_transport_root_key_create(wickr_buffer_t *secret,
89 wickr_cipher_t cipher,
90 uint32_t packets_per_evo_send,
91 uint32_t packets_per_evo_recv);
92
101 wickr_transport_root_key_t *wickr_transport_root_key_copy(const wickr_transport_root_key_t *root_key);
102
110 void wickr_transport_root_key_destroy(wickr_transport_root_key_t **root_key);
111
124 wickr_stream_key_t *wickr_transport_root_key_to_stream_key(const wickr_transport_root_key_t *root_key,
125 const wickr_crypto_engine_t *engine,
126 const wickr_buffer_t *salt,
127 const wickr_buffer_t *stream_id,
128 wickr_stream_direction direction);
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif /* transport_root_key_h */
wickr_transport_root_key_to_stream_key
wickr_stream_key_t * wickr_transport_root_key_to_stream_key(const wickr_transport_root_key_t *root_key, const wickr_crypto_engine_t *engine, const wickr_buffer_t *salt, const wickr_buffer_t *stream_id, wickr_stream_direction direction)
wickr_transport_root_key_create_random
wickr_transport_root_key_t * wickr_transport_root_key_create_random(const wickr_crypto_engine_t *engine, wickr_cipher_t cipher, uint32_t packets_per_evo_send, uint32_t packets_per_evo_recv)
wickr_transport_root_key_create
wickr_transport_root_key_t * wickr_transport_root_key_create(wickr_buffer_t *secret, wickr_cipher_t cipher, uint32_t packets_per_evo_send, uint32_t packets_per_evo_recv)
wickr_transport_root_key_copy
wickr_transport_root_key_t * wickr_transport_root_key_copy(const wickr_transport_root_key_t *root_key)
wickr_transport_root_key_destroy
void wickr_transport_root_key_destroy(wickr_transport_root_key_t **root_key)
wickr_buffer
Represents an array of bytes and the length of the allocation associated with those bytes.
Definition: buffer.h:51
wickr_cipher
Represents a cipher that can be used in the crypto_engine. This meta object holds parameters for the ...
Definition: cipher.h:56
wickr_crypto_engine
Interface to a set of cryptographic operations used throughout the library. Currently the default imp...
Definition: crypto_engine.h:53
wickr_stream_key
A data structure representing the stream encoding / decoding key material A stream key holds informat...
Definition: stream_key.h:56
wickr_transport_root_key
A root key for the wickr_transport_ctx that is used to communicate the master secret for the transpor...
Definition: transport_root_key.h:52
wickr_transport_root_key::cipher
wickr_cipher_t cipher
Definition: transport_root_key.h:54
wickr_transport_root_key::secret
wickr_buffer_t * secret
Definition: transport_root_key.h:53
wickr_transport_root_key::packets_per_evo_recv
uint32_t packets_per_evo_recv
Definition: transport_root_key.h:56
wickr_transport_root_key::packets_per_evo_send
uint32_t packets_per_evo_send
Definition: transport_root_key.h:55