Ordo
0.3.4
Symmetric Cryptography Library
|
Primitive. More...
#include "ordo/primitives/block_modes.h"
Go to the source code of this file.
Functions | |
ORDO_PUBLIC int | ofb_init (struct OFB_STATE *state, struct BLOCK_STATE *cipher_state, const void *iv, size_t iv_len, int dir, const void *params) |
ORDO_PUBLIC void | ofb_update (struct OFB_STATE *state, struct BLOCK_STATE *cipher_state, const void *in, size_t in_len, void *out, size_t *out_len) |
ORDO_PUBLIC int | ofb_final (struct OFB_STATE *state, struct BLOCK_STATE *cipher_state, void *out, size_t *out_len) |
ORDO_PUBLIC size_t | ofb_query (prim_t cipher, int query, size_t value) |
ORDO_PUBLIC size_t | ofb_bsize (void) |
Primitive.
The OFB mode generates a keystream by repeatedly encrypting an initialization vector, effectively turning a block cipher into a stream cipher. As such, OFB mode requires no padding, and outlen will always be equal to inlen.
Note that the OFB keystream is independent of the plaintext, so a key/iv pair must never be used for more than one message. This also means the block cipher's inverse permutation is never used.
ofb_final()
accepts 0 as an argument for out_len
since by design the OFB mode of operation does not produce any final data. However, if a valid pointer is passed, its value will be set to zero as expected.
ORDO_PUBLIC int ofb_init | ( | struct OFB_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
const void * | iv, | ||
size_t | iv_len, | ||
int | dir, | ||
const void * | params | ||
) |
block_mode_init()
ORDO_PUBLIC void ofb_update | ( | struct OFB_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
const void * | in, | ||
size_t | in_len, | ||
void * | out, | ||
size_t * | out_len | ||
) |
block_mode_update()
ORDO_PUBLIC int ofb_final | ( | struct OFB_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
void * | out, | ||
size_t * | out_len | ||
) |
block_mode_final()
ORDO_PUBLIC size_t ofb_query | ( | prim_t | cipher, |
int | query, | ||
size_t | value | ||
) |
block_mode_query()
ORDO_PUBLIC size_t ofb_bsize | ( | void | ) |
Gets the size in bytes of an OFB_STATE
.