My Project
Functions
Algorithms - Camellia

Functions

int wc_CamelliaSetKey (Camellia *cam, const byte *key, word32 len, const byte *iv)
 This function sets the key and initialization vector for a camellia object, initializing it for use as a cipher. More...
 
int wc_CamelliaSetIV (Camellia *cam, const byte *iv)
 This function sets the initialization vector for a camellia object. More...
 
int wc_CamelliaEncryptDirect (Camellia *cam, byte *out, const byte *in)
 This function does a one-block encrypt using the provided camellia object. It parses the first 16 byte block from the buffer in and stores the encrypted result in the buffer out. Before using this function, one should initialize the camellia object using wc_CamelliaSetKey. More...
 
int wc_CamelliaDecryptDirect (Camellia *cam, byte *out, const byte *in)
 This function does a one-block decrypt using the provided camellia object. It parses the first 16 byte block from the buffer in, decrypts it, and stores the result in the buffer out. Before using this function, one should initialize the camellia object using wc_CamelliaSetKey. More...
 
int wc_CamelliaCbcEncrypt (Camellia *cam, byte *out, const byte *in, word32 sz)
 This function encrypts the plaintext from the buffer in and stores the output in the buffer out. It performs this encryption using Camellia with Cipher Block Chaining (CBC). More...
 
int wc_CamelliaCbcDecrypt (Camellia *cam, byte *out, const byte *in, word32 sz)
 This function decrypts the ciphertext from the buffer in and stores the output in the buffer out. It performs this decryption using Camellia with Cipher Block Chaining (CBC). More...
 

Detailed Description

Function Documentation

◆ wc_CamelliaCbcDecrypt()

int wc_CamelliaCbcDecrypt ( Camellia *  cam,
byte *  out,
const byte *  in,
word32  sz 
)

This function decrypts the ciphertext from the buffer in and stores the output in the buffer out. It performs this decryption using Camellia with Cipher Block Chaining (CBC).

Returns
none No returns.
Parameters
campointer to the camellia structure to use for encryption
outpointer to the buffer in which to store the decrypted message
inpointer to the buffer containing the encrypted ciphertext
szthe size of the message to encrypt

Example

Camellia cam;
// initialize cam structure with key and iv
byte cipher[] = { // initialize with encrypted message to decrypt };
byte decrypted[sizeof(cipher)];
wc_CamelliaCbcDecrypt(&cam, decrypted, cipher, sizeof(cipher));
See also
wc_CamelliaCbcEncrypt

◆ wc_CamelliaCbcEncrypt()

int wc_CamelliaCbcEncrypt ( Camellia *  cam,
byte *  out,
const byte *  in,
word32  sz 
)

This function encrypts the plaintext from the buffer in and stores the output in the buffer out. It performs this encryption using Camellia with Cipher Block Chaining (CBC).

Returns
none No returns.
Parameters
campointer to the camellia structure to use for encryption
outpointer to the buffer in which to store the encrypted ciphertext
inpointer to the buffer containing the plaintext to encrypt
szthe size of the message to encrypt

Example

Camellia cam;
// initialize cam structure with key and iv
byte plain[] = { // initialize with encrypted message to decrypt };
byte cipher[sizeof(plain)];
wc_CamelliaCbcEncrypt(&cam, cipher, plain, sizeof(plain));
See also
wc_CamelliaCbcDecrypt

◆ wc_CamelliaDecryptDirect()

int wc_CamelliaDecryptDirect ( Camellia *  cam,
byte *  out,
const byte *  in 
)

This function does a one-block decrypt using the provided camellia object. It parses the first 16 byte block from the buffer in, decrypts it, and stores the result in the buffer out. Before using this function, one should initialize the camellia object using wc_CamelliaSetKey.

Returns
none No returns.
Parameters
campointer to the camellia structure to use for encryption
outpointer to the buffer in which to store the decrypted plaintext block
inpointer to the buffer containing the ciphertext block to decrypt

Example

Camellia cam;
// initialize cam structure with key and iv
byte cipher[] = { // initialize with encrypted message to decrypt };
byte decrypted[16];
wc_CamelliaDecryptDirect(&cam, decrypted, cipher);
See also
wc_CamelliaEncryptDirect

◆ wc_CamelliaEncryptDirect()

int wc_CamelliaEncryptDirect ( Camellia *  cam,
byte *  out,
const byte *  in 
)

This function does a one-block encrypt using the provided camellia object. It parses the first 16 byte block from the buffer in and stores the encrypted result in the buffer out. Before using this function, one should initialize the camellia object using wc_CamelliaSetKey.

Returns
none No returns.
Parameters
campointer to the camellia structure to use for encryption
outpointer to the buffer in which to store the encrypted block
inpointer to the buffer containing the plaintext block to encrypt

Example

Camellia cam;
// initialize cam structure with key and iv
byte plain[] = { // initialize with message to encrypt };
byte cipher[16];
wc_CamelliaEncryptDirect(&ca, cipher, plain);
See also
wc_CamelliaDecryptDirect

◆ wc_CamelliaSetIV()

int wc_CamelliaSetIV ( Camellia *  cam,
const byte *  iv 
)

This function sets the initialization vector for a camellia object.

Returns
0 Returned upon successfully setting the key and initialization vector
BAD_FUNC_ARG returned if there is an error processing one of the input arguments
Parameters
campointer to the camellia structure on which to set the iv
ivpointer to the buffer containing the 16 byte initialization vector for use with this camellia structure

Example

Camellia cam;
byte iv[16];
// initialize iv
if( wc_CamelliaSetIV(&cam, iv) != 0) {
// error initializing camellia structure
}
See also
wc_CamelliaSetKey

◆ wc_CamelliaSetKey()

int wc_CamelliaSetKey ( Camellia *  cam,
const byte *  key,
word32  len,
const byte *  iv 
)

This function sets the key and initialization vector for a camellia object, initializing it for use as a cipher.

Returns
0 Returned upon successfully setting the key and initialization vector
BAD_FUNC_ARG returned if there is an error processing one of the input arguments
MEMORY_E returned if there is an error allocating memory with XMALLOC
Parameters
campointer to the camellia structure on which to set the key and iv
keypointer to the buffer containing the 16, 24, or 32 byte key to use for encryption and decryption
lenlength of the key passed in
ivpointer to the buffer containing the 16 byte initialization vector for use with this camellia structure

Example

Camellia cam;
byte key[32];
// initialize key
byte iv[16];
// initialize iv
if( wc_CamelliaSetKey(&cam, key, sizeof(key), iv) != 0) {
// error initializing camellia structure
}
See also
wc_CamelliaEncryptDirect
wc_CamelliaDecryptDirect
wc_CamelliaCbcEncrypt
wc_CamelliaCbcDecrypt
wc_CamelliaCbcEncrypt
int wc_CamelliaCbcEncrypt(Camellia *cam, byte *out, const byte *in, word32 sz)
This function encrypts the plaintext from the buffer in and stores the output in the buffer out....
wc_CamelliaEncryptDirect
int wc_CamelliaEncryptDirect(Camellia *cam, byte *out, const byte *in)
This function does a one-block encrypt using the provided camellia object. It parses the first 16 byt...
wc_CamelliaCbcDecrypt
int wc_CamelliaCbcDecrypt(Camellia *cam, byte *out, const byte *in, word32 sz)
This function decrypts the ciphertext from the buffer in and stores the output in the buffer out....
wc_CamelliaSetIV
int wc_CamelliaSetIV(Camellia *cam, const byte *iv)
This function sets the initialization vector for a camellia object.
wc_CamelliaDecryptDirect
int wc_CamelliaDecryptDirect(Camellia *cam, byte *out, const byte *in)
This function does a one-block decrypt using the provided camellia object. It parses the first 16 byt...
wc_CamelliaSetKey
int wc_CamelliaSetKey(Camellia *cam, const byte *key, word32 len, const byte *iv)
This function sets the key and initialization vector for a camellia object, initializing it for use a...