My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Typedefs | Functions
crypto_task.h File Reference
#include <sw_types.h>
#include <secure_api.h>

Go to the source code of this file.

Classes

struct  crypto_global
 Global variables for the task should be defined as a member of the global structure. More...
 

Typedefs

typedef struct crypto_global crypto_global
 Global variables for the task should be defined as a member of the global structure. More...
 

Functions

void crypto_task (int task_id, sw_tls *tls)
 Crypto task entry point. More...
 
int crypto_task_init (sa_config_t *psa_config)
 : Crypto task init More...
 
int crypto_task_exit (void *data)
 Crypto task exit. More...
 
int process_otz_crypto_cmd (void *req_buf, u32 req_buf_len, void *res_buf, u32 res_buf_len, struct otzc_encode_meta *meta_data, u32 *ret_res_buf_len)
 Encrypts the data for the user supplied buffer. More...
 
int process_otz_crypto_svc (u32 svc_cmd_id, void *req_buf, u32 req_buf_len, void *resp_buf, u32 res_buf_len, struct otzc_encode_meta *meta_data, u32 *ret_res_buf_len)
 Process crypto service. More...
 
int process_otz_crypto_digest_cmd (void *req_buf, u32 req_buf_len, void *res_buf, u32 res_buf_len, struct otzc_encode_meta *meta_data, u32 *ret_res_buf_len, u32 svc_cmd_id)
 
void process_otz_crypto_load_libs ()
 Adds all digest and encryption algorithms to internal table. More...
 
void process_otz_crypto_unload_libs ()
 Removes all ciphers and digests from the table. More...
 
int process_otz_crypto_hmac_cmd (void *req_buf, u32 req_buf_len, void *res_buf, u32 res_buf_len, struct otzc_encode_meta *meta_data, u32 *ret_res_buf_len, u32 svc_cmd_id)
 
int process_otz_crypto_cipher_cmd (void *req_buf, u32 req_buf_len, void *res_buf, u32 res_buf_len, struct otzc_encode_meta *meta_data, u32 *ret_res_buf_len, u32 svc_cmd_id)
 

Typedef Documentation

typedef struct crypto_global crypto_global

Global variables for the task should be defined as a member of the global structure.

Function Documentation

void crypto_task ( int  task_id,
sw_tls tls 
)

Crypto task entry point.

This function implements the processing of crypto commands.

Parameters
task_id- task identifier
tls- Pointer to task local storage

Crypto task entry point.

Parameters
req_buf
req_buf_len
res_buf
res_buf_len
meta_data
ret_res_buf_len
svc_cmd_id
Returns
HMAC algorithm tests
Parameters
req_buf
req_buf_len
res_buf
res_buf_len
meta_data
ret_res_buf_len
svc_cmd_id
Returns
Cipher algorithm tests
Parameters
req_buf
req_buf_len
res_buf
res_buf_len
meta_data
ret_res_buf_len
svc_cmd_id
Returns
Process crypto service

This function process the crypto service commands

Parameters
svc_cmd_idCommand identifer to process the crypto service command
req_bufVirtual address of the request buffer
req_buf_lenRequest buffer length
resp_bufVirtual address of the response buffer
res_buf_lenResponse buffer length
meta_dataVirtual address of the meta data of the encoded data
ret_res_buf_lenReturn length of the response buffer
Returns
SMC return codes: SMC_SUCCESS: Crypto service command processed successfully.
SMC_*: An implementation-defined error code for any other error. Crypto task entry point

This function implements the processing of crypto commands

Parameters
task_id- task identifier
tls- Pointer to task local storage
int crypto_task_exit ( void *  data)

Crypto task exit.

This function gets called before the task deletion

Parameters
dataPrivate data which need to be freed.
Returns
otz_return_t: OTZ_OK
OTZ_FAIL
int crypto_task_init ( sa_config_t psa_config)

: Crypto task init

This function initializes crypto task parameters

Parameters
psa_configConfiguration parameter for the task and its get called before the task creation
Returns
otz_return_t: OTZ_OK
OTZ_* - An implementation-defined error code for any other error.
int process_otz_crypto_cipher_cmd ( void *  req_buf,
u32  req_buf_len,
void *  res_buf,
u32  res_buf_len,
struct otzc_encode_meta meta_data,
u32 *  ret_res_buf_len,
u32  svc_cmd_id 
)
Parameters
req_buf
req_buf_len
res_buf
res_buf_len
meta_data
ret_res_buf_len
svc_cmd_id
Returns
int process_otz_crypto_cmd ( void *  req_buf,
u32  req_buf_len,
void *  res_buf,
u32  res_buf_len,
struct otzc_encode_meta meta_data,
u32 *  ret_res_buf_len 
)

Encrypts the data for the user supplied buffer.

This function encrypts/decrypts the request buffer and response buffer will have encrypted/decrypted output.

Parameters
req_bufVirtual address of the request buffer
req_buf_lenRequest buffer length
res_bufVirtual address of the response buffer
res_buf_lenResponse buffer length
meta_dataVirtual address of the meta data of the encoded data
ret_res_buf_lenReturn length of the response buffer
Returns
SMC return codes: SMC_SUCCESS: API processed successfully.
SMC_*: An implementation-defined error code for any other error.
int process_otz_crypto_digest_cmd ( void *  req_buf,
u32  req_buf_len,
void *  res_buf,
u32  res_buf_len,
struct otzc_encode_meta meta_data,
u32 *  ret_res_buf_len,
u32  svc_cmd_id 
)
Parameters
req_buf
req_buf_len
res_buf
res_buf_len
meta_data
ret_res_buf_len
svc_cmd_id
Returns
int process_otz_crypto_hmac_cmd ( void *  req_buf,
u32  req_buf_len,
void *  res_buf,
u32  res_buf_len,
struct otzc_encode_meta meta_data,
u32 *  ret_res_buf_len,
u32  svc_cmd_id 
)
Parameters
req_buf
req_buf_len
res_buf
res_buf_len
meta_data
ret_res_buf_len
svc_cmd_id
Returns
void process_otz_crypto_load_libs ( )

Adds all digest and encryption algorithms to internal table.

int process_otz_crypto_svc ( u32  svc_cmd_id,
void *  req_buf,
u32  req_buf_len,
void *  resp_buf,
u32  res_buf_len,
struct otzc_encode_meta meta_data,
u32 *  ret_res_buf_len 
)

Process crypto service.

This function process the crypto service commands

Parameters
svc_cmd_idCommand identifer to process the crypto service command
req_bufVirtual address of the request buffer
req_buf_lenRequest buffer length
resp_bufVirtual address of the response buffer
res_buf_lenResponse buffer length
meta_dataVirtual address of the meta data of the encoded data
ret_res_buf_lenReturn length of the response buffer
Returns
SMC return codes: SMC_SUCCESS: Crypto service command processed successfully.
SMC_*: An implementation-defined error code for any other error.
void process_otz_crypto_unload_libs ( )

Removes all ciphers and digests from the table.