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

Primitive. More...

#include "ordo/primitives/block_modes.h"
Include dependency graph for cfb.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)
 

Detailed Description

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.

Function Documentation

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  )

Gets the size in bytes of a CFB_STATE.

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