wickr-crypto-c
Data Structures | Functions
wickr_stream

Data Structures

struct  wickr_stream_ctx
 A context that is used for encrypting or decrypting a sequenced stream of data packets The stream context manages the state of stream operations including key evolution management based on the sequence number of the being encrypted / decrypted. The stream context is assigned a direction, and can only be used for encoding OR decoding of packets, and not both. More...
 

Functions

wickr_stream_ctx_twickr_stream_ctx_create (const wickr_crypto_engine_t engine, wickr_stream_key_t *stream_key, wickr_stream_direction direction)
 
wickr_stream_ctx_twickr_stream_ctx_copy (const wickr_stream_ctx_t *ctx)
 
wickr_cipher_result_twickr_stream_ctx_encode (wickr_stream_ctx_t *ctx, const wickr_buffer_t *data, const wickr_buffer_t *aad, uint64_t seq_num)
 
wickr_buffer_twickr_stream_ctx_decode (wickr_stream_ctx_t *ctx, const wickr_cipher_result_t *data, const wickr_buffer_t *aad, uint64_t seq_num)
 
void wickr_stream_ctx_destroy (wickr_stream_ctx_t **ctx)
 
bool wickr_stream_ctx_ref_up (wickr_stream_ctx_t *ctx)
 

Detailed Description

Function Documentation

◆ wickr_stream_ctx_copy()

wickr_stream_ctx_t* wickr_stream_ctx_copy ( const wickr_stream_ctx_t ctx)

Copy a stream context

Parameters
ctxthe stream context to copy
Returns
a newly allocated stream context holding a deep copy of properties from 'ctx'

◆ wickr_stream_ctx_create()

wickr_stream_ctx_t* wickr_stream_ctx_create ( const wickr_crypto_engine_t  engine,
wickr_stream_key_t stream_key,
wickr_stream_direction  direction 
)

Create a stream context

Parameters
enginesee wickr_stream_ctx documentation
stream_keysee wickr_stream_ctx documentation
directionsee wickr_stream_ctx documentation
Returns
a newly allocated stream context owning the properties passed in

◆ wickr_stream_ctx_decode()

wickr_buffer_t* wickr_stream_ctx_decode ( wickr_stream_ctx_t ctx,
const wickr_cipher_result_t data,
const wickr_buffer_t aad,
uint64_t  seq_num 
)

Encode a packet

Parameters
ctxcontext to use for decoding
datathe data to decode using the context's key
aadadditional data to authenticate with the ciphertext
seq_numthe sequence number assoiciated with 'data'
Returns
a buffer representing 'data' decrypted with 'ctx->key'

◆ wickr_stream_ctx_destroy()

void wickr_stream_ctx_destroy ( wickr_stream_ctx_t **  ctx)

Destroy a stream context

Parameters
ctxa pointer to the stream context to destroy. All properties of '*ctx' will also be destroyed

◆ wickr_stream_ctx_encode()

wickr_cipher_result_t* wickr_stream_ctx_encode ( wickr_stream_ctx_t ctx,
const wickr_buffer_t data,
const wickr_buffer_t aad,
uint64_t  seq_num 
)

Encode a packet

Parameters
ctxcontext to use for encoding
datathe data to encode using the context's key
aadadditional data to authenticate with the ciphertext
seq_numthe sequence number assoiciated with 'data'
Returns
a cipher result representing 'data' encrypted with 'ctx->key'

◆ wickr_stream_ctx_ref_up()

bool wickr_stream_ctx_ref_up ( wickr_stream_ctx_t ctx)

Increment the reference count of a stream

Parameters
ctxthe context to bump the reference count of