Wasabi ExpressPlay SDK for Embedded Systems  1.23.0
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

◆ TS2_AES_BLOCK_SIZE

#define TS2_AES_BLOCK_SIZE   16

◆ TS2_AES_CBC_IV_SIZE

#define TS2_AES_CBC_IV_SIZE   16

◆ TS2_AES_KEY_LENGTH

#define TS2_AES_KEY_LENGTH   16

◆ TS2_SHA1_BLOCK_SIZE

#define TS2_SHA1_BLOCK_SIZE   64

◆ TS2_SHA1_DIGEST_SIZE

#define TS2_SHA1_DIGEST_SIZE   20

Typedef Documentation

◆ TS2_AesBlockCipher

◆ TS2_AesCbcDecrypter

◆ TS2_AesCbcEncrypter

◆ TS2_Digest

typedef struct TS2_Digest TS2_Digest

◆ TS2_Hmac

typedef struct TS2_Hmac TS2_Hmac

Enumeration Type Documentation

◆ TS2_BlockCipherDirection

Enumerator
TS2_CIPHER_DIRECTION_ENCRYPT 
TS2_CIPHER_DIRECTION_DECRYPT 

◆ TS2_DigestAlgorithm

Enumerator
TS2_DIGEST_SHA1 

Function Documentation

◆ TS2_AesBlockCipher_Create()

ATX_Result TS2_AesBlockCipher_Create ( const ATX_Byte *  key,
TS2_BlockCipherDirection  direction,
TS2_AesBlockCipher **  cipher 
)

◆ TS2_AesBlockCipher_Destroy()

void TS2_AesBlockCipher_Destroy ( TS2_AesBlockCipher self)

◆ TS2_AesBlockCipher_ProcessBlock()

ATX_Result TS2_AesBlockCipher_ProcessBlock ( TS2_AesBlockCipher self,
const ATX_Byte *  input,
ATX_Byte *  output 
)

◆ TS2_AesCbcDecrypt()

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

◆ TS2_AesCbcDecrypter_Create()

ATX_Result TS2_AesCbcDecrypter_Create ( const ATX_Byte *  key,
const ATX_Byte *  iv,
TS2_AesCbcDecrypter **  decrypter 
)

◆ TS2_AesCbcDecrypter_Decrypt()

ATX_Result TS2_AesCbcDecrypter_Decrypt ( TS2_AesCbcDecrypter self,
const ATX_Byte *  enc_data,
ATX_Size  data_size,
ATX_Byte *  dec_data 
)

◆ TS2_AesCbcDecrypter_Destroy()

void TS2_AesCbcDecrypter_Destroy ( TS2_AesCbcDecrypter self)

◆ TS2_AesCbcEncrypt()

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.

◆ TS2_AesCbcEncrypter_Create()

ATX_Result TS2_AesCbcEncrypter_Create ( const ATX_Byte *  key,
const ATX_Byte *  iv,
TS2_AesCbcEncrypter **  encrypter 
)

◆ TS2_AesCbcEncrypter_Destroy()

void TS2_AesCbcEncrypter_Destroy ( TS2_AesCbcEncrypter self)

◆ TS2_AesCbcEncrypter_Encrypt()

ATX_Result TS2_AesCbcEncrypter_Encrypt ( TS2_AesCbcEncrypter self,
const ATX_Byte *  data,
ATX_Size  data_size,
ATX_Byte *  enc_data 
)

◆ TS2_ComputeDigest()

ATX_Result TS2_ComputeDigest ( TS2_DigestAlgorithm  algorithm,
const ATX_Byte *  data,
ATX_Size  data_size,
ATX_Byte *  digest 
)

helper

◆ TS2_ComputeHmac()

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.

◆ TS2_Digest_Create()

ATX_Result TS2_Digest_Create ( TS2_DigestAlgorithm  algorithm,
TS2_Digest **  digest 
)

◆ TS2_Digest_Destroy()

void TS2_Digest_Destroy ( TS2_Digest self)

◆ TS2_Digest_Final()

ATX_Result TS2_Digest_Final ( TS2_Digest self,
ATX_Byte *  digest 
)

◆ TS2_Digest_GetBlockSize()

ATX_Size TS2_Digest_GetBlockSize ( const TS2_Digest self)

◆ TS2_Digest_GetDigestSize()

ATX_Size TS2_Digest_GetDigestSize ( const TS2_Digest self)

◆ TS2_Digest_Update()

ATX_Result TS2_Digest_Update ( TS2_Digest self,
const ATX_Byte *  data,
ATX_Size  data_size 
)

◆ TS2_GeneratePseudoRandom()

ATX_Result TS2_GeneratePseudoRandom ( ATX_Byte *  buffer,
ATX_Size  size 
)

◆ TS2_Hmac_Create()

ATX_Result TS2_Hmac_Create ( TS2_DigestAlgorithm  algorithm,
const ATX_Byte *  key,
ATX_Size  key_size,
TS2_Hmac **  hmac 
)

◆ TS2_Hmac_Destroy()

void TS2_Hmac_Destroy ( TS2_Hmac self)

◆ TS2_Hmac_Final()

ATX_Result TS2_Hmac_Final ( TS2_Hmac self,
ATX_Byte *  mac 
)

◆ TS2_Hmac_GetMacSize()

ATX_Size TS2_Hmac_GetMacSize ( TS2_Hmac self)

◆ TS2_Hmac_Update()

ATX_Result TS2_Hmac_Update ( TS2_Hmac self,
const ATX_Byte *  data,
ATX_Size  data_size 
)