Wasabi ExpressPlay SDK for Embedded Systems  1.10
Macros | Typedefs | Enumerations | Functions
Ts2Crypto.h File Reference
#include "Atomix.h"

Go to the source code of this file.

Macros

#define TS2_AES_BLOCK_SIZE   16
 
#define TS2_AES_KEY_LENGTH   16
 
#define TS2_AES_CBC_IV_SIZE   16
 
#define TS2_SHA1_DIGEST_SIZE   20
 
#define TS2_SHA1_BLOCK_SIZE   64
 

Typedefs

typedef struct TS2_AesBlockCipher TS2_AesBlockCipher
 
typedef struct TS2_Hmac TS2_Hmac
 
typedef struct TS2_Digest TS2_Digest
 
typedef struct TS2_AesCbcEncrypter TS2_AesCbcEncrypter
 
typedef struct TS2_AesCbcDecrypter TS2_AesCbcDecrypter
 

Enumerations

enum  TS2_BlockCipherDirection {
  TS2_CIPHER_DIRECTION_ENCRYPT,
  TS2_CIPHER_DIRECTION_DECRYPT
}
 
enum  TS2_DigestAlgorithm { TS2_DIGEST_SHA1 }
 

Functions

ATX_Result TS2_AesBlockCipher_Create (const ATX_Byte *key, TS2_BlockCipherDirection direction, TS2_AesBlockCipher **cipher)
 
void TS2_AesBlockCipher_Destroy (TS2_AesBlockCipher *self)
 
ATX_Result TS2_AesBlockCipher_ProcessBlock (TS2_AesBlockCipher *self, const ATX_Byte *input, ATX_Byte *output)
 
ATX_Result TS2_Digest_Create (TS2_DigestAlgorithm algorithm, TS2_Digest **digest)
 
ATX_Result TS2_Digest_Update (TS2_Digest *self, const ATX_Byte *data, ATX_Size data_size)
 
ATX_Size TS2_Digest_GetDigestSize (const TS2_Digest *self)
 
ATX_Size TS2_Digest_GetBlockSize (const TS2_Digest *self)
 
ATX_Result TS2_Digest_Final (TS2_Digest *self, ATX_Byte *digest)
 
void TS2_Digest_Destroy (TS2_Digest *self)
 
ATX_Result TS2_ComputeDigest (TS2_DigestAlgorithm algorithm, const ATX_Byte *data, ATX_Size data_size, ATX_Byte *digest)
 helper More...
 
ATX_Result TS2_Hmac_Create (TS2_DigestAlgorithm algorithm, const ATX_Byte *key, ATX_Size key_size, TS2_Hmac **hmac)
 
ATX_Result TS2_Hmac_Update (TS2_Hmac *self, const ATX_Byte *data, ATX_Size data_size)
 
ATX_Size TS2_Hmac_GetMacSize (TS2_Hmac *self)
 
ATX_Result TS2_Hmac_Final (TS2_Hmac *self, ATX_Byte *mac)
 
void TS2_Hmac_Destroy (TS2_Hmac *self)
 
ATX_Result TS2_ComputeHmac (TS2_DigestAlgorithm algorithm, const ATX_Byte *key, ATX_Size key_size, const ATX_Byte *data, ATX_Size data_size, ATX_Byte *mac)
 helper More...
 
ATX_Result TS2_GeneratePseudoRandom (ATX_Byte *buffer, ATX_Size size)
 
ATX_Result TS2_AesCbcEncrypter_Create (const ATX_Byte *key, const ATX_Byte *iv, TS2_AesCbcEncrypter **encrypter)
 
ATX_Result TS2_AesCbcEncrypter_Encrypt (TS2_AesCbcEncrypter *self, const ATX_Byte *data, ATX_Size data_size, ATX_Byte *enc_data)
 
void TS2_AesCbcEncrypter_Destroy (TS2_AesCbcEncrypter *self)
 
ATX_Result TS2_AesCbcEncrypt (const ATX_Byte *key, const ATX_Byte *iv, const ATX_Byte *data, ATX_Size data_size, ATX_Byte *enc_data)
 helper More...
 
ATX_Result TS2_AesCbcDecrypter_Create (const ATX_Byte *key, const ATX_Byte *iv, TS2_AesCbcDecrypter **decrypter)
 
ATX_Result TS2_AesCbcDecrypter_Decrypt (TS2_AesCbcDecrypter *self, const ATX_Byte *enc_data, ATX_Size data_size, ATX_Byte *dec_data)
 
void TS2_AesCbcDecrypter_Destroy (TS2_AesCbcDecrypter *self)
 
ATX_Result TS2_AesCbcDecrypt (const ATX_Byte *key, const ATX_Byte *iv, const ATX_Byte *enc_data, ATX_Size data_size, ATX_Byte *dec_data)
 helper More...
 

Macro Definition Documentation

#define TS2_AES_BLOCK_SIZE   16
#define TS2_AES_CBC_IV_SIZE   16
#define TS2_AES_KEY_LENGTH   16
#define TS2_SHA1_BLOCK_SIZE   64
#define TS2_SHA1_DIGEST_SIZE   20

Typedef Documentation

typedef struct TS2_Digest TS2_Digest
typedef struct TS2_Hmac TS2_Hmac

Enumeration Type Documentation

Enumerator
TS2_CIPHER_DIRECTION_ENCRYPT 
TS2_CIPHER_DIRECTION_DECRYPT 
Enumerator
TS2_DIGEST_SHA1 

Function Documentation

ATX_Result TS2_AesBlockCipher_Create ( const ATX_Byte *  key,
TS2_BlockCipherDirection  direction,
TS2_AesBlockCipher **  cipher 
)
void TS2_AesBlockCipher_Destroy ( TS2_AesBlockCipher self)
ATX_Result TS2_AesBlockCipher_ProcessBlock ( TS2_AesBlockCipher self,
const ATX_Byte *  input,
ATX_Byte *  output 
)
ATX_Result TS2_AesCbcDecrypt ( const ATX_Byte *  key,
const ATX_Byte *  iv,
const ATX_Byte *  enc_data,
ATX_Size  data_size,
ATX_Byte *  dec_data 
)

helper

ATX_Result TS2_AesCbcDecrypter_Create ( const ATX_Byte *  key,
const ATX_Byte *  iv,
TS2_AesCbcDecrypter **  decrypter 
)
ATX_Result TS2_AesCbcDecrypter_Decrypt ( TS2_AesCbcDecrypter self,
const ATX_Byte *  enc_data,
ATX_Size  data_size,
ATX_Byte *  dec_data 
)
void TS2_AesCbcDecrypter_Destroy ( TS2_AesCbcDecrypter self)
ATX_Result TS2_AesCbcEncrypt ( const ATX_Byte *  key,
const ATX_Byte *  iv,
const ATX_Byte *  data,
ATX_Size  data_size,
ATX_Byte *  enc_data 
)

helper

Perform AES-128-CBC encryption with residual block termination.

Parameters
keyAES key, pointer to TS2_AES_KEY_LENGTH bytes of data.
ivAES IV, pointer to TS2_AES_CBC_IV_SIZE bytes of data.
datathe input data array.
data_sizethe size of the input array in bytes.
enc_datathe output array. Must have at least data_size bytes.
ATX_Result TS2_AesCbcEncrypter_Create ( const ATX_Byte *  key,
const ATX_Byte *  iv,
TS2_AesCbcEncrypter **  encrypter 
)
void TS2_AesCbcEncrypter_Destroy ( TS2_AesCbcEncrypter self)
ATX_Result TS2_AesCbcEncrypter_Encrypt ( TS2_AesCbcEncrypter self,
const ATX_Byte *  data,
ATX_Size  data_size,
ATX_Byte *  enc_data 
)
ATX_Result TS2_ComputeDigest ( TS2_DigestAlgorithm  algorithm,
const ATX_Byte *  data,
ATX_Size  data_size,
ATX_Byte *  digest 
)

helper

ATX_Result TS2_ComputeHmac ( TS2_DigestAlgorithm  algorithm,
const ATX_Byte *  key,
ATX_Size  key_size,
const ATX_Byte *  data,
ATX_Size  data_size,
ATX_Byte *  mac 
)

helper

Compute a message HMAC.

Parameters
algorithmthe digest algorithm to use.
keythe HMAC key address.
key_sizethe HMAC key size in bytes.
datathe message data address.
data_sizethe size of the data in bytes.
macaddress of the output array. There must be at least as much memory allocated for the mac array as is needed by the requested digest algorithm. For example, 20 bytes for SHA1, i.e. TS2_SHA1_DIGEST_SIZE bytes for algorithm equal to TS2_DIGEST_SHA1.
ATX_Result TS2_Digest_Create ( TS2_DigestAlgorithm  algorithm,
TS2_Digest **  digest 
)
void TS2_Digest_Destroy ( TS2_Digest self)
ATX_Result TS2_Digest_Final ( TS2_Digest self,
ATX_Byte *  digest 
)
ATX_Size TS2_Digest_GetBlockSize ( const TS2_Digest self)
ATX_Size TS2_Digest_GetDigestSize ( const TS2_Digest self)
ATX_Result TS2_Digest_Update ( TS2_Digest self,
const ATX_Byte *  data,
ATX_Size  data_size 
)
ATX_Result TS2_GeneratePseudoRandom ( ATX_Byte *  buffer,
ATX_Size  size 
)
ATX_Result TS2_Hmac_Create ( TS2_DigestAlgorithm  algorithm,
const ATX_Byte *  key,
ATX_Size  key_size,
TS2_Hmac **  hmac 
)
void TS2_Hmac_Destroy ( TS2_Hmac self)
ATX_Result TS2_Hmac_Final ( TS2_Hmac self,
ATX_Byte *  mac 
)
ATX_Size TS2_Hmac_GetMacSize ( TS2_Hmac self)
ATX_Result TS2_Hmac_Update ( TS2_Hmac self,
const ATX_Byte *  data,
ATX_Size  data_size 
)