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

Module. More...

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

Go to the source code of this file.

Macros

#define ordo_enc_stream_init
 
#define ordo_enc_stream_update
 
#define ordo_enc_stream_final
 
#define ordo_enc_stream_bsize
 

Functions

ORDO_PUBLIC size_t enc_stream_key_len (prim_t cipher, size_t key_len)
 

Detailed Description

Module.

Interface to encrypt plaintext and decrypt ciphertext with various stream ciphers.

Macro Definition Documentation

#define ordo_enc_stream_init

Initializes a stream encryption context.

Parameters
[in,out]ctxA stream encryption context.
[in]keyThe cryptographic key to use.
[in]key_sizeThe size, in bytes, of the key.
[in]paramsStream cipher specific parameters.
Returns
ORDO_SUCCESS on success, else an error code.
#define ordo_enc_stream_update

Encrypts or decrypts a data buffer.

Parameters
[in,out]ctxA stream encryption context.
[in,out]bufferThe plaintext or ciphertext buffer.
[in]lenNumber of bytes to read from the buffer.
Warning
By nature, stream ciphers encrypt and decrypt data the same way, in other words, if you encrypt data twice, you will get back the original data.
Remarks
Stream encryption is always done in place by design.
#define ordo_enc_stream_final

Finalizes a stream encryption context.

Parameters
[in,out]ctxA stream encryption context.
#define ordo_enc_stream_bsize

Gets the size in bytes of an ENC_STREAM_CTX.

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

Function Documentation

ORDO_PUBLIC size_t enc_stream_key_len ( prim_t  cipher,
size_t  key_len 
)

Queries a stream cipher for its key length.

Parameters
[in]cipherThe stream cipher to query.
[in]key_lenA suggested key length.
Returns
key_len if and only if key_len is a valid key length for this stream cipher. Otherwise, returns the nearest valid key length greater than key_len. However, if no such key length exists, it will return the largest key length admitted by the stream cipher.