Functions
Algorithms - Rabbit

Functions

WOLFSSL_API int wc_RabbitProcess (Rabbit *, byte *, const byte *, word32)
 This function encrypts or decrypts a message of any size, storing the result in output. It requires that the Rabbit ctx structure be initialized with a key and an iv before encryption. More...
 
WOLFSSL_API int wc_RabbitSetKey (Rabbit *, const byte *key, const byte *iv)
 This function initializes a Rabbit context for use with encryption or decryption by setting its iv and key. More...
 

Detailed Description

Function Documentation

◆ wc_RabbitProcess()

WOLFSSL_API int wc_RabbitProcess ( Rabbit *  ,
byte *  ,
const byte *  ,
word32   
)

This function encrypts or decrypts a message of any size, storing the result in output. It requires that the Rabbit ctx structure be initialized with a key and an iv before encryption.

Returns
0 Returned on successfully encrypting/decrypting input
BAD_ALIGN_E Returned if the input message is not 4-byte aligned but is required to be by XSTREAM_ALIGN, but NO_WOLFSSL_ALLOC_ALIGN is defined
MEMORY_E Returned if there is an error allocating memory to align the message, if NO_WOLFSSL_ALLOC_ALIGN is not defined
Parameters
ctxpointer to the Rabbit structure to use for encryption/decryption
outputpointer to the buffer in which to store the processed message. Should be at least msglen long
inputpointer to the buffer containing the message to process
msglenthe length of the message to process

Example

int ret;
Rabbit enc;
byte key[] = { }; // initialize with 16 byte key
byte iv[] = { }; // initialize with 8 byte iv
wc_RabbitSetKey(&enc, key, iv);
byte message[] = { }; // initialize with plaintext message
byte ciphertext[sizeof(message)];
wc_RabbitProcess(enc, ciphertext, message, sizeof(message));
See also
wc_RabbitSetKey

◆ wc_RabbitSetKey()

WOLFSSL_API int wc_RabbitSetKey ( Rabbit *  ,
const byte *  key,
const byte *  iv 
)

This function initializes a Rabbit context for use with encryption or decryption by setting its iv and key.

Returns
0 Returned on successfully setting the key and iv
Parameters
ctxpointer to the Rabbit structure to initialize
keypointer to the buffer containing the 16 byte key to use for encryption/decryption
ivpointer to the buffer containing the 8 byte iv with which to initialize the Rabbit structure

Example

int ret;
Rabbit enc;
byte key[] = { }; // initialize with 16 byte key
byte iv[] = { }; // initialize with 8 byte iv
wc_RabbitSetKey(&enc, key, iv)
See also
wc_RabbitProcess