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 | cfb_init (struct CFB_STATE *state, struct BLOCK_STATE *cipher_state, const void *iv, size_t iv_len, int dir, const void *params) |
ORDO_PUBLIC void | cfb_update (struct CFB_STATE *state, struct BLOCK_STATE *cipher_state, const void *in, size_t in_len, void *out, size_t *out_len) |
ORDO_PUBLIC int | cfb_final (struct CFB_STATE *state, struct BLOCK_STATE *cipher_state, void *out, size_t *out_len) |
ORDO_PUBLIC size_t | cfb_query (prim_t cipher, int query, size_t value) |
ORDO_PUBLIC size_t | cfb_bsize (void) |
Primitive.
The CFB mode generates a keystream by repeatedly encrypting an initialization vector and mixing in the plaintext, effectively turning a block cipher into a stream cipher. As such, CFB mode requires no padding, and the ciphertext size will always be equal to the plaintext size.
Note that the CFB keystream depends on the plaintext fed into it, as opposed to OFB mode. This also means the block cipher's inverse permutation is never used.
cfb_final()
accepts 0 as an argument for out_len
since by design the CFB 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 cfb_init | ( | struct CFB_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 cfb_update | ( | struct CFB_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 cfb_final | ( | struct CFB_STATE * | state, |
struct BLOCK_STATE * | cipher_state, | ||
void * | out, | ||
size_t * | out_len | ||
) |
block_mode_final()
ORDO_PUBLIC size_t cfb_query | ( | prim_t | cipher, |
int | query, | ||
size_t | value | ||
) |
block_mode_query()
ORDO_PUBLIC size_t cfb_bsize | ( | void | ) |
Gets the size in bytes of a CFB_STATE
.