/*
 * app_attestation.h
 */

#ifndef _TZ_ICCC_APP_ATTESTATION_H_
#define _TZ_ICCC_APP_ATTESTATION_H_

#include "app_main.h"

#include "icccOperations_v4.h"

/* Enhanced Attestation Value */
#define ICCC_ATN_BLOB_MAX_SIZE 4096
#define ICCC_ATN_RESULT_TYPE_SECTIMER_BASE      0x10
#define ICCC_ATN_RESULT_TYPE_SECTIMER_STATUS    0x11

typedef struct iccc_attestation_req_s {
    uint32_t cmd_id;
    uint8_t blob[ICCC_ATN_BLOB_MAX_SIZE];
    uint32_t blob_len;
} __attribute__ ((packed)) iccc_attestation_req_t;

typedef struct iccc_attestation_rsp_s {
    uint32_t cmd_id;
    int ret;
    uint8_t blob[ICCC_ATN_BLOB_MAX_SIZE];
    uint32_t blob_len;
} __attribute__ ((packed)) iccc_attestation_rsp_t;

typedef struct {
    union attestation_content_u {
        iccc_attestation_req_t iccc_req;
        iccc_attestation_rsp_t iccc_rsp;
    } __attribute__ ((packed)) content;
} __attribute__ ((packed)) tz_iccc_attestation_payload_t;

uint32_t ICCC_attestation(tz_iccc_attestation_payload_t *sendmsg, tz_iccc_attestation_payload_t *respmsg);

#endif // _TZ_ICCC_APP_ATTESTATION_H_
