My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
otz_tee_crypto_api.c File Reference
#include <openssl/md5.h>
#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>
#include <openssl/aes.h>
#include <openssl/modes.h>
#include <modes_lcl.h>
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <otz_tee_crypto_api.h>
#include <sw_buddy.h>
#include <sw_mem_functions.h>

Functions

void TEE_Panic (TEE_Result panicCode)
 
TEEC_Result TEE_AllocateOperation (TEE_OperationHandle *operation, uint32_t algorithm, uint32_t mode, uint32_t maxKeySize)
 
void TEE_FreeOperation (TEE_OperationHandle operation)
 Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid. More...
 
void TEE_GetOperationInfo (TEE_OperationHandle operation, TEE_OperationInfo *operationInfo)
 Returns information about operation handle. More...
 
void TEE_ResetOperation (TEE_OperationHandle operation)
 Resets the operation state before initialization But after the key has been set. More...
 
TEEC_Result TEE_SetOperationKey (TEE_OperationHandle operation, TEE_ObjectHandle *key)
 Programs the key of an operation Associates an operation with a key. More...
 
TEEC_Result TEE_SetOperationKey2 (TEE_OperationHandle operation, TEE_ObjectHandle *key1, TEE_ObjectHandle *key2)
 Initializes an existing operation with two keys. This is used only for the algorithm TEE_ALG_AES_XTS. More...
 
void TEE_CopyOperation (TEE_OperationHandle dstOperation, TEE_OperationHandle srcOperation)
 copies an operation state from dstOperation to srcOperation More...
 
void TEE_DigestUpdate (TEE_OperationHandle operation, void *chunk, size_t chunkSize)
 This function is called to accumulate message data for hashing. More...
 
TEEC_Result TEE_DigestDoFinal (TEE_OperationHandle operation, void *chunk, size_t chunkLen, void *hash, size_t *hashLen)
 Finalizes the message digest operation and produces the message hash. More...
 
void TEE_CipherInit (TEE_OperationHandle operation, void *IV, size_t IVLen)
 This function is used to start the symmetric cipher operation. More...
 
TEEC_Result TEE_CipherUpdate (TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen)
 This function is used to encrypt or decrypt the input data. More...
 
TEEC_Result TEE_CipherDoFinal (TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen)
 Finalizes the cipher operation, processing data that has not been processed by previous calls to TEE_CipherUpdate as well as data supplied in srcData. More...
 
void TEE_MACInit (TEE_OperationHandle operation, void *IV, size_t IVLen)
 Initializes a MAC operation. More...
 
void TEE_MACUpdate (TEE_OperationHandle operation, void *chunk, size_t chunkSize)
 Accumulates data for a MAC calculation. More...
 
TEEC_Result TEE_MACComputeFinal (TEE_OperationHandle operation, void *message, size_t messageLen, void *mac, size_t *macLen)
 Finalizes the MAC operation with a last chunk of message and computes the MAC. More...
 
TEEC_Result TEE_MACCompareFinal (TEE_OperationHandle operation, void *message, size_t messageLen, void *mac, size_t *macLen)
 Finalizes the MAC operation and compares the MAC with the buffer passed to the function. More...
 
TEEC_Result TEE_AEInit (TEE_OperationHandle operation, void *nonce, size_t nonceLen, uint32_t tagLen, uint32_t AADLen, uint32_t payloadLen)
 Initializes an authentication encryption operation. More...
 
void TEE_AEUpdateAAD (TEE_OperationHandle operation, void *AADdata, size_t AADdataLen)
 Feeds a new chunk of Additional Authentication Data (AAD) to the AE operation. More...
 
TEEC_Result TEE_AEUpdate (TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen)
 Accumulates data for an Authentication Encryption Operation. More...
 
TEEC_Result TEE_AEEncryptFinal (TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen, void *tag, size_t *tagLen)
 Processes data that has not been processed by previous calls to TEE_AEUpdate as well as data supplied in srcData. More...
 
TEEC_Result TEE_AEDecryptFinal (TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen, void *tag, size_t tagLen)
 Processes data that has not been processed by previous calls to TEE_AEUpdate as well as data supplied in srcData. More...
 
TEEC_Result TEE_AsymmetricEncrypt (TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *srcData, size_t srcLen, void *destData, size_t *destLen)
 Encrypts a message with an asymmetric operation. More...
 
TEEC_Result TEE_AsymmetricDecrypt (TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *srcData, size_t srcLen, void *destData, size_t *destLen)
 Decrypts a message with an assymetric operation. More...
 
TEEC_Result TEE_AsymmetricSignDigest (TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *digest, size_t digestLen, void *signature, size_t *signatureLen)
 Signs a message digest signature with an asymmetric operation. More...
 
TEEC_Result TEE_AsymmetricVerifyDigest (TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, void *digest, size_t digestLen, void *signature, size_t signatureLen)
 Verifies a message digest signature with an asymmetric operation. More...
 
void TEE_DeriveKey (TEE_OperationHandle operation, TEE_Attribute *params, uint32_t paramCount, TEE_ObjectHandle *derivedKey)
 Can only be used with the algorithm TEE_ALG_DH_DERIVE_SHARED_SECRET. More...
 
void TEE_GenerateRandom (void *randomBuffer, size_t randomBufferLen)
 Generates random data. More...
 

Function Documentation

TEEC_Result TEE_AEDecryptFinal ( TEE_OperationHandle  operation,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen,
void *  tag,
size_t  tagLen 
)

Processes data that has not been processed by previous calls to TEE_AEUpdate as well as data supplied in srcData.

Parameters
operation
srcData
srcLen
destData
destLen
tag
tagLen
Returns
TEEC_Result TEE_AEEncryptFinal ( TEE_OperationHandle  operation,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen,
void *  tag,
size_t tagLen 
)

Processes data that has not been processed by previous calls to TEE_AEUpdate as well as data supplied in srcData.

Parameters
operation
srcData
srcLen
destData
destLen
tag
tagLen
Returns
TEEC_Result TEE_AEInit ( TEE_OperationHandle  operation,
void *  nonce,
size_t  nonceLen,
uint32_t  tagLen,
uint32_t  AADLen,
uint32_t  payloadLen 
)

Initializes an authentication encryption operation.

Parameters
operation
nonce
nonceLen
tagLen
AADLen
payloadLen
Returns
TEEC_Result TEE_AEUpdate ( TEE_OperationHandle  operation,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen 
)

Accumulates data for an Authentication Encryption Operation.

Parameters
operation
srcData
srcLen
destData
destLen
Returns
void TEE_AEUpdateAAD ( TEE_OperationHandle  operation,
void *  AADdata,
size_t  AADdataLen 
)

Feeds a new chunk of Additional Authentication Data (AAD) to the AE operation.

Parameters
operation
AADdata
AADdataLen
TEEC_Result TEE_AllocateOperation ( TEE_OperationHandle operation,
uint32_t  algorithm,
uint32_t  mode,
uint32_t  maxKeySize 
)
Parameters
operation
algorithm
mode
maxKeySize
Returns
TEEC_Result TEE_AsymmetricDecrypt ( TEE_OperationHandle  operation,
TEE_Attribute params,
uint32_t  paramCount,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen 
)

Decrypts a message with an assymetric operation.

Parameters
operation
params
paramCount
srcData
srcLen
destData
destLen
Returns
TEEC_Result TEE_AsymmetricEncrypt ( TEE_OperationHandle  operation,
TEE_Attribute params,
uint32_t  paramCount,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen 
)

Encrypts a message with an asymmetric operation.

Parameters
operation
params
paramCount
srcData
srcLen
destData
destLen
Returns
TEEC_Result TEE_AsymmetricSignDigest ( TEE_OperationHandle  operation,
TEE_Attribute params,
uint32_t  paramCount,
void *  digest,
size_t  digestLen,
void *  signature,
size_t signatureLen 
)

Signs a message digest signature with an asymmetric operation.

Parameters
operation
params
paramCount
digest
digestLen
signature
signatureLen
Returns
TEEC_Result TEE_AsymmetricVerifyDigest ( TEE_OperationHandle  operation,
TEE_Attribute params,
uint32_t  paramCount,
void *  digest,
size_t  digestLen,
void *  signature,
size_t  signatureLen 
)

Verifies a message digest signature with an asymmetric operation.

Parameters
operation
params
paramCount
digest
digestLen
signature
signatureLen
Returns
TEEC_Result TEE_CipherDoFinal ( TEE_OperationHandle  operation,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen 
)

Finalizes the cipher operation, processing data that has not been processed by previous calls to TEE_CipherUpdate as well as data supplied in srcData.

Parameters
operation
srcData
srcLen
destData
destLen
Returns
void TEE_CipherInit ( TEE_OperationHandle  operation,
void *  IV,
size_t  IVLen 
)

This function is used to start the symmetric cipher operation.

Parameters
operation
IV
IVLen
TEEC_Result TEE_CipherUpdate ( TEE_OperationHandle  operation,
void *  srcData,
size_t  srcLen,
void *  destData,
size_t destLen 
)

This function is used to encrypt or decrypt the input data.

Parameters
operation
srcData
srcLen
destData
destLen
Returns
void TEE_CopyOperation ( TEE_OperationHandle  dstOperation,
TEE_OperationHandle  srcOperation 
)

copies an operation state from dstOperation to srcOperation

Parameters
dstOperation
srcOperation
void TEE_DeriveKey ( TEE_OperationHandle  operation,
TEE_Attribute params,
uint32_t  paramCount,
TEE_ObjectHandle derivedKey 
)

Can only be used with the algorithm TEE_ALG_DH_DERIVE_SHARED_SECRET.

Parameters
operation
params
paramCount
derivedKey
TEEC_Result TEE_DigestDoFinal ( TEE_OperationHandle  operation,
void *  chunk,
size_t  chunkLen,
void *  hash,
size_t hashLen 
)

Finalizes the message digest operation and produces the message hash.

Parameters
operation
chunk
chunkLen
hash
hashLen
Returns
void TEE_DigestUpdate ( TEE_OperationHandle  operation,
void *  chunk,
size_t  chunkSize 
)

This function is called to accumulate message data for hashing.

Parameters
operation
chunk
chunkSize
void TEE_FreeOperation ( TEE_OperationHandle  operation)

Deallocates all resources associated with an operation handle. After this function is called, the operation handle is no longer valid.

Parameters
operation
void TEE_GenerateRandom ( void *  randomBuffer,
size_t  randomBufferLen 
)

Generates random data.

Parameters
randomBufferreference to generated random data
randomBufferLenbyte length of requested random data
void TEE_GetOperationInfo ( TEE_OperationHandle  operation,
TEE_OperationInfo operationInfo 
)

Returns information about operation handle.

Parameters
operation
operationInfo
TEEC_Result TEE_MACCompareFinal ( TEE_OperationHandle  operation,
void *  message,
size_t  messageLen,
void *  mac,
size_t macLen 
)

Finalizes the MAC operation and compares the MAC with the buffer passed to the function.

Parameters
operation
message
messageLen
mac
macLen
Returns
TEEC_Result TEE_MACComputeFinal ( TEE_OperationHandle  operation,
void *  message,
size_t  messageLen,
void *  mac,
size_t macLen 
)

Finalizes the MAC operation with a last chunk of message and computes the MAC.

Parameters
operation
message
messageLen
mac
macLen
Returns
void TEE_MACInit ( TEE_OperationHandle  operation,
void *  IV,
size_t  IVLen 
)

Initializes a MAC operation.

Parameters
operation
IV
IVLen
void TEE_MACUpdate ( TEE_OperationHandle  operation,
void *  chunk,
size_t  chunkSize 
)

Accumulates data for a MAC calculation.

Parameters
operation
chunk
chunkSize
void TEE_Panic ( TEE_Result  panicCode)
Parameters
panicCode
void TEE_ResetOperation ( TEE_OperationHandle  operation)

Resets the operation state before initialization But after the key has been set.

Parameters
operation
TEEC_Result TEE_SetOperationKey ( TEE_OperationHandle  operation,
TEE_ObjectHandle key 
)

Programs the key of an operation Associates an operation with a key.

Parameters
operation
key
Returns
TEEC_Result TEE_SetOperationKey2 ( TEE_OperationHandle  operation,
TEE_ObjectHandle key1,
TEE_ObjectHandle key2 
)

Initializes an existing operation with two keys. This is used only for the algorithm TEE_ALG_AES_XTS.

Parameters
operation
key1
key2
Returns