Ordo
0.3.4
Symmetric Cryptography Library
|
Abstraction Layer. More...
Go to the source code of this file.
Functions | |
ORDO_PUBLIC int | block_mode_init (struct BLOCK_MODE_STATE *state, struct BLOCK_STATE *cipher_state, const void *iv, size_t iv_len, int direction, prim_t primitive, const void *params) |
ORDO_PUBLIC void | block_mode_update (struct BLOCK_MODE_STATE *state, struct BLOCK_STATE *cipher_state, const void *in, size_t in_len, void *out, size_t *out_len) |
ORDO_PUBLIC int | block_mode_final (struct BLOCK_MODE_STATE *state, struct BLOCK_STATE *cipher_state, void *out, size_t *out_len) |
ORDO_PUBLIC size_t | block_mode_query (prim_t mode, prim_t cipher, int query, size_t value) |
ORDO_PUBLIC size_t | block_mode_bsize (void) |
Abstraction Layer.
This abstraction layer declares all the block modes of operation in the library, making them available to higher level modules.
Note "block cipher mode of operation" is shortened to "block mode" in code and documentation to minimize noise and redundancy.
ORDO_PUBLIC int block_mode_init | ( | struct BLOCK_MODE_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
const void * | iv, | ||
size_t | iv_len, | ||
int | direction, | ||
prim_t | primitive, | ||
const void * | params | ||
) |
Initializes a block mode state.
[in,out] | state | A block mode state. |
[in] | cipher_state | A block cipher state. |
[in] | iv | The initialization vector to use. |
[in] | iv_len | The length, in bytes, of the IV. |
[in] | direction | 1 for encryption, 0 for decryption. |
[in] | primitive | A block mode primitive. |
[in] | params | Block mode specific parameters. |
ORDO_SUCCESS
on success, else an error code. ORDO_PUBLIC void block_mode_update | ( | struct BLOCK_MODE_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
const void * | in, | ||
size_t | in_len, | ||
void * | out, | ||
size_t * | out_len | ||
) |
Encrypts or decrypts a buffer.
[in,out] | state | A block mode state. |
[in] | cipher_state | A block cipher state. |
[in] | in | The input buffer. |
[in] | in_len | The length, in bytes, of the input. |
[out] | out | The output buffer. |
[out] | out_len | A pointer to an integer to which to write the number of output bytes that can be returned to the user. Remaining input data has not been ignored and should not be passed again. |
in
be the same buffer as out
) is always supported, however the buffers may not overlap. ORDO_PUBLIC int block_mode_final | ( | struct BLOCK_MODE_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
void * | out, | ||
size_t * | out_len | ||
) |
Finalizes a block mode state.
[in,out] | state | A block mode state. |
[in] | cipher_state | A block cipher state. |
[out] | out | The output buffer. |
[out] | out_len | A pointer to an integer to which to store the number of bytes written to out . |
ORDO_SUCCESS
on success, else an error code.block_mode_update()
(in the correct order). Queries a block mode for suitable parameters.
[in] | mode | A block mode primitive. |
[in] | cipher | A block cipher primitive. |
[in] | query | A query code. |
[in] | value | A suggested value. |
query
based on value
.ORDO_PUBLIC size_t block_mode_bsize | ( | void | ) |
Gets the size in bytes of a BLOCK_MODE_STATE
.