Ordo  0.3.4
Symmetric Cryptography Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
stream_ciphers.h File Reference

Abstraction Layer. More...

#include "ordo/primitives/stream_ciphers/stream_params.h"
Include dependency graph for stream_ciphers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ORDO_PUBLIC int stream_init (struct STREAM_STATE *state, const void *key, size_t key_len, prim_t primitive, const void *params)
 
ORDO_PUBLIC void stream_update (struct STREAM_STATE *state, void *buffer, size_t len)
 
ORDO_PUBLIC void stream_final (struct STREAM_STATE *state)
 
ORDO_PUBLIC size_t stream_query (prim_t primitive, int query, size_t value)
 
ORDO_PUBLIC size_t stream_bsize (void)
 

Detailed Description

Abstraction Layer.

This abstraction layer declares all the stream ciphers and also makes them available to higher level modules. This does not actually do encryption at all but simply abstracts the stream cipher primitives - encryption modules are in the enc folder: enc_stream.h.

Function Documentation

ORDO_PUBLIC int stream_init ( struct STREAM_STATE *  state,
const void *  key,
size_t  key_len,
prim_t  primitive,
const void *  params 
)

Initializes a stream cipher state.

Parameters
[in,out]stateA stream cipher state.
[in]keyThe cryptographic key to use.
[in]key_lenThe length, in bytes, of the key.
[in]primitiveA stream cipher primitive.
[in]paramsStream cipher specific parameters.
Returns
ORDO_SUCCESS on success, else an error code.
ORDO_PUBLIC void stream_update ( struct STREAM_STATE *  state,
void *  buffer,
size_t  len 
)

Encrypts or decrypts a buffer using a stream cipher state.

Parameters
[in,out]stateAn initialized stream cipher state.
[in,out]bufferThe buffer to encrypt or decrypt.
[in]lenThe length, in bytes, of the buffer.
Remarks
Encryption and decryption are equivalent, and are done in place.
This function is stateful and will update the passed state (by generating keystream material), unlike block ciphers, which are deterministic permutations.
ORDO_PUBLIC void stream_final ( struct STREAM_STATE *  state)

Finalizes a stream cipher state.

Parameters
[in,out]stateAn initialized stream cipher state.
ORDO_PUBLIC size_t stream_query ( prim_t  primitive,
int  query,
size_t  value 
)

Queries a stream cipher for suitable parameters.

Parameters
[in]primitiveA stream cipher primitive.
[in]queryA query code.
[in]valueA suggested value.
Returns
A suitable parameter of type query based on value.
See Also
query.h
ORDO_PUBLIC size_t stream_bsize ( void  )

Gets the size in bytes of a STREAM_STATE.

Returns
The size in bytes of the structure.
Remarks
Binary compatibility layer.