TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ltc_cipher_descriptor Struct Reference

#include <tomcrypt_cipher.h>

Public Attributes

char * name
 
unsigned char ID
 
int min_key_length
 
int max_key_length
 
int block_length
 
int default_rounds
 
int(* setup )(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 
int(* ecb_encrypt )(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
 
int(* ecb_decrypt )(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
 
int(* test )(void)
 
void(* done )(symmetric_key *skey)
 
int(* keysize )(int *keysize)
 
int(* accel_ecb_encrypt )(const unsigned char *pt, unsigned char *ct, unsigned long blocks, symmetric_key *skey)
 
int(* accel_ecb_decrypt )(const unsigned char *ct, unsigned char *pt, unsigned long blocks, symmetric_key *skey)
 
int(* accel_cbc_encrypt )(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, symmetric_key *skey)
 
int(* accel_cbc_decrypt )(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, symmetric_key *skey)
 
int(* accel_ctr_encrypt )(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, int mode, symmetric_key *skey)
 
int(* accel_lrw_encrypt )(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey)
 
int(* accel_lrw_decrypt )(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey)
 
int(* accel_ccm_memory )(const unsigned char *key, unsigned long keylen, symmetric_key *uskey, const unsigned char *nonce, unsigned long noncelen, const unsigned char *header, unsigned long headerlen, unsigned char *pt, unsigned long ptlen, unsigned char *ct, unsigned char *tag, unsigned long *taglen, int direction)
 
int(* accel_gcm_memory )(const unsigned char *key, unsigned long keylen, const unsigned char *IV, unsigned long IVlen, const unsigned char *adata, unsigned long adatalen, unsigned char *pt, unsigned long ptlen, unsigned char *ct, unsigned char *tag, unsigned long *taglen, int direction)
 
int(* omac_memory )(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
 
int(* xcbc_memory )(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
 
int(* f9_memory )(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
 

Detailed Description

cipher descriptor table, last entry has "name == NULL" to mark the end of table

Member Data Documentation

int(* ltc_cipher_descriptor::accel_cbc_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, symmetric_key *skey)

Accelerated CBC decryption

Parameters
ptPlaintext
ctCiphertext
blocksThe number of complete blocks to process
IVThe initial value (input/output)
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_cbc_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, symmetric_key *skey)

Accelerated CBC encryption

Parameters
ptPlaintext
ctCiphertext
blocksThe number of complete blocks to process
IVThe initial value (input/output)
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_ccm_memory)(const unsigned char *key, unsigned long keylen, symmetric_key *uskey, const unsigned char *nonce, unsigned long noncelen, const unsigned char *header, unsigned long headerlen, unsigned char *pt, unsigned long ptlen, unsigned char *ct, unsigned char *tag, unsigned long *taglen, int direction)

Accelerated CCM packet (one-shot)

Parameters
keyThe secret key to use
keylenThe length of the secret key (octets)
uskeyA previously scheduled key [optional can be NULL]
nonceThe session nonce [use once]
noncelenThe length of the nonce
headerThe header for the session
headerlenThe length of the header (octets)
pt[out] The plaintext
ptlenThe length of the plaintext (octets)
ct[out] The ciphertext
tag[out] The destination tag
taglen[in/out] The max size and resulting size of the authentication tag
directionEncrypt or Decrypt direction (0 or 1)
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_ctr_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, int mode, symmetric_key *skey)

Accelerated CTR encryption

Parameters
ptPlaintext
ctCiphertext
blocksThe number of complete blocks to process
IVThe initial value (input/output)
modelittle or big endian counter (mode=0 or mode=1)
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_ecb_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, symmetric_key *skey)

Accelerated ECB decryption

Parameters
ptPlaintext
ctCiphertext
blocksThe number of complete blocks to process
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_ecb_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, symmetric_key *skey)

Accelerators Accelerated ECB encryption

Parameters
ptPlaintext
ctCiphertext
blocksThe number of complete blocks to process
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_gcm_memory)(const unsigned char *key, unsigned long keylen, const unsigned char *IV, unsigned long IVlen, const unsigned char *adata, unsigned long adatalen, unsigned char *pt, unsigned long ptlen, unsigned char *ct, unsigned char *tag, unsigned long *taglen, int direction)

Accelerated GCM packet (one shot)

Parameters
keyThe secret key
keylenThe length of the secret key
IVThe initial vector
IVlenThe length of the initial vector
adataThe additional authentication data (header)
adatalenThe length of the adata
ptThe plaintext
ptlenThe length of the plaintext (ciphertext length is the same)
ctThe ciphertext
tag[out] The MAC tag
taglen[in/out] The MAC tag length
directionEncrypt or Decrypt mode (GCM_ENCRYPT or GCM_DECRYPT)
Returns
CRYPT_OK on success
int(* ltc_cipher_descriptor::accel_lrw_decrypt)(const unsigned char *ct, unsigned char *pt, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey)

Accelerated LRW

Parameters
ctCiphertext
ptPlaintext
blocksThe number of complete blocks to process
IVThe initial value (input/output)
tweakThe LRW tweak
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::accel_lrw_encrypt)(const unsigned char *pt, unsigned char *ct, unsigned long blocks, unsigned char *IV, const unsigned char *tweak, symmetric_key *skey)

Accelerated LRW

Parameters
ptPlaintext
ctCiphertext
blocksThe number of complete blocks to process
IVThe initial value (input/output)
tweakThe LRW tweak
skeyThe scheduled key context
Returns
CRYPT_OK if successful
int ltc_cipher_descriptor::block_length

block size (octets)

int ltc_cipher_descriptor::default_rounds

default number of rounds

void(* ltc_cipher_descriptor::done)(symmetric_key *skey)

Terminate the context

Parameters
skeyThe scheduled key
int(* ltc_cipher_descriptor::ecb_decrypt)(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)

Decrypt a block

Parameters
ctThe ciphertext
pt[out] The plaintext
skeyThe scheduled key
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::ecb_encrypt)(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)

Encrypt a block

Parameters
ptThe plaintext
ct[out] The ciphertext
skeyThe scheduled key
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::f9_memory)(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)

Accelerated one shot F9

Parameters
keyThe secret key
keylenThe key length (octets)
inThe message
inlenLength of message (octets)
out[out] Destination for tag
outlen[in/out] Initial and final size of out
Returns
CRYPT_OK on success
Remarks
Requires manual padding
unsigned char ltc_cipher_descriptor::ID

internal ID

int(* ltc_cipher_descriptor::keysize)(int *keysize)

Determine a key size

Parameters
keysize[in/out] The size of the key desired and the suggested size
Returns
CRYPT_OK if successful
int ltc_cipher_descriptor::max_key_length

max keysize (octets)

int ltc_cipher_descriptor::min_key_length

min keysize (octets)

char* ltc_cipher_descriptor::name

name of cipher

int(* ltc_cipher_descriptor::omac_memory)(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)

Accelerated one shot LTC_OMAC

Parameters
keyThe secret key
keylenThe key length (octets)
inThe message
inlenLength of message (octets)
out[out] Destination for tag
outlen[in/out] Initial and final size of out
Returns
CRYPT_OK on success
int(* ltc_cipher_descriptor::setup)(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)

Setup the cipher

Parameters
keyThe input symmetric key
keylenThe length of the input key (octets)
num_roundsThe requested number of rounds (0==default)
skey[out] The destination of the scheduled key
Returns
CRYPT_OK if successful
int(* ltc_cipher_descriptor::test)(void)

Test the block cipher

Returns
CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled
int(* ltc_cipher_descriptor::xcbc_memory)(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)

Accelerated one shot XCBC

Parameters
keyThe secret key
keylenThe key length (octets)
inThe message
inlenLength of message (octets)
out[out] Destination for tag
outlen[in/out] Initial and final size of out
Returns
CRYPT_OK on success

The documentation for this struct was generated from the following file: