#include "skpm_cmd_handler.h"

/**
 * Sem app name
 * Modify the app name to your specific app name
 */
char TZ_APP_NAME[] = {"skpm"};

/**
  @brief
    Data structure

  @param[in]   cmd_id      Requested command
  @param[in]   data        information (could be data or a pointer to the memory that holds the data
  @param[in]   len         if data is ptr to some buffer, len indicates length of the buffer
  @param[in]   test_buf_size  When running crypto test, this indicates the test packet size
*/
void tz_app_cmd_handler(void* cmd, uint32_t cmdlen, void* rsp, uint32_t rsplen) {
    /* Request-response buffers are allocated by non-secure side*/
    /* Add code to process requests and set response (if any)*/
    p_cmd_t pCmd;
    p_rsp_t pRsp;

    if ((cmd == NULL) || (rsp == NULL) || (cmdlen != sizeof(cmd_t)) || (rsplen != sizeof(rsp_t))) {
        LOGE("Invalid cmd or rsp");
        return;
    }

    pCmd = (p_cmd_t)cmd;
    pRsp = (p_rsp_t)rsp;

    cmdHandler(pCmd->cmd_id, pCmd, pRsp);
}

/**
  @brief
    Add any app specific initialization code here
    QSEE will call this function after secure app is loaded and
    authenticated
*/
void tz_app_init(void) {
    /*  App specific initialization code*/
}

/**
  @brief
    App specific shutdown
    App will be given a chance to shutdown gracefully
*/
void tz_app_shutdown(void) {
    /* app specific shutdown code*/
}
