#ifndef CRYPTO_APP_H
#define CRYPTO_APP_H

#include "Crypto_Types.h"
#include "Std_Types.h"

/* Maximum 3 jobs in the queue, so we will have 3 callbacks. */
#define MAX_CALLBACKS   3

/* The larger the job priority value, the higher the job??s priority. */
#define JOB_ID_1    10000
#define JOB_ID_2    20000
#define JOB_ID_3    30000
#define JOB_PRIO_1  100
#define JOB_PRIO_2  200
#define JOB_PRIO_3  300

/* Type of test jobs */
typedef enum
{
    TEST_ENCRYPT_AES_ECB = 0U,
    TEST_DECRYPT_AES_ECB,
    TEST_ENCRYPT_AES_CBC,
    TEST_DECRYPT_AES_CBC,
    TEST_ENCRYPT_AES_CTR,
    TEST_DECRYPT_AES_CTR,
    TEST_ENCRYPT_3DES,
    TEST_AEAD_ENCRYPT,
    TEST_RANDOM_GENERATE,
    TEST_CMAC_GENERATE,
    TEST_CMAC_VERIFY,
    TEST_HASH_GENERATE,
    TEST_MPC_GENERATE,
} CryptoTestJobType;

  
Std_ReturnType g_callbackResult[MAX_CALLBACKS] = {E_NOT_OK};
Crypto_JobType* g_callbackJob[MAX_CALLBACKS] = {NULL_PTR};
uint8 g_callbackCounter = 0;

Crypto_PrimitiveInfoType g_primAesEcbEncrypt = {
    .resultLength = 0,
    .service = CRYPTO_ENCRYPT,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_ECB
};

Crypto_PrimitiveInfoType g_primAesEcbDecrypt = {
    .resultLength = 0,
    .service = CRYPTO_DECRYPT,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_ECB
};

Crypto_PrimitiveInfoType g_primAesCbcEncrypt = {
    .resultLength = 0,
    .service = CRYPTO_ENCRYPT,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_CBC
};

Crypto_PrimitiveInfoType g_primAesCbcDecrypt = {
    .resultLength = 0,
    .service = CRYPTO_DECRYPT,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_CBC
};

Crypto_PrimitiveInfoType g_primAesCtrEncrypt = {
    .resultLength = 0,
    .service = CRYPTO_ENCRYPT,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_CTR
};

Crypto_PrimitiveInfoType g_primAesCtrDecrypt = {
    .resultLength = 0,
    .service = CRYPTO_DECRYPT,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_CTR
};

Crypto_PrimitiveInfoType g_primRandom = {
    .resultLength = 4,
    .service = CRYPTO_RANDOMGENERATE,
    .algorithm.family = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 0,
    .algorithm.mode = CRYPTO_ALGOMODE_TRNG
};

Crypto_PrimitiveInfoType g_primGenerateCmac = {
    .resultLength = 16, /* We need 16 bytes of the generated MAC */
    .service = CRYPTO_MACGENERATE,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_CMAC
};

Crypto_PrimitiveInfoType g_primVerifyCmac = {
    .resultLength = 0,
    .service = CRYPTO_MACVERIFY,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 16, /* AES-128(16 bytes), AES-192(24 bytes),AES-256(32 bytes) */
    .algorithm.mode = CRYPTO_ALGOMODE_CMAC
};

Crypto_PrimitiveInfoType g_primHash = {
    .resultLength = 32,
    .service = CRYPTO_HASH,
    .algorithm.family = CRYPTO_ALGOFAM_SHA2_256,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 0,
    .algorithm.mode = CRYPTO_ALGOMODE_SHA256
};

Crypto_PrimitiveInfoType g_primMpc = {
    .resultLength = 16,
    .service = CRYPTO_MPCMGENERATE,
    .algorithm.family = CRYPTO_ALGOFAM_AES,
    .algorithm.secondaryFamily = CRYPTO_ALGOFAM_NOT_SET,
    .algorithm.keyLength = 32,
    .algorithm.mode = CRYPTO_ALGOMODE_MPC
};

Crypto_JobPrimitiveInfoType g_jobPrimSync = {
    .callbackId = 1,
    .primitiveInfo = NULL_PTR,
    .secureCounterId = 1,
    .cryIfKeyId = 1,
    .processingType = CRYPTO_PROCESSING_SYNC,
    .callbackUpdateNotification = FALSE
};

Crypto_JobPrimitiveInfoType g_jobPrimAsync = {
    .callbackId = 1,
    .primitiveInfo = NULL_PTR,
    .secureCounterId = 1,
    .cryIfKeyId = 1,
    .processingType = CRYPTO_PROCESSING_ASYNC,
    .callbackUpdateNotification = FALSE
};

Crypto_JobInfoType g_jobInfo1 = {
    .jobId = JOB_ID_1,
    .jobPriority = JOB_PRIO_1
};

Crypto_JobType g_cryptoJob1 = {
    .jobId = JOB_ID_1,
    .jobState = CRYPTO_JOBSTATE_IDLE,
    .jobPrimitiveInputOutput = {
        .inputPtr = NULL_PTR,
        .inputLength = 0,
        .secondaryInputPtr = NULL_PTR,
        .secondaryInputLength = 0,
        .tertiaryInputPtr = NULL_PTR,
        .tertiaryInputLength = 0,
        .outputPtr = NULL_PTR,
        .outputLengthPtr = 0,
        .secondaryOutputPtr = NULL_PTR,
        .secondaryOutputLengthPtr = NULL_PTR,
        .input64 = 0,
        .verifyPtr = NULL_PTR,
        .output64Ptr = NULL_PTR,
        .mode = CRYPTO_OPERATIONMODE_SINGLECALL
    },
    .jobPrimitiveInfo = NULL_PTR,
    .jobInfo = &g_jobInfo1,
    .cryptoKeyId = 0
};

Crypto_JobInfoType g_jobInfo2 = {
    .jobId = JOB_ID_2,
    .jobPriority = JOB_PRIO_2
};

Crypto_JobType g_cryptoJob2 = {
    .jobId = JOB_ID_2,
    .jobState = CRYPTO_JOBSTATE_IDLE,
    .jobPrimitiveInputOutput = {
        .inputPtr = NULL_PTR,
        .inputLength = 0,
        .secondaryInputPtr = NULL_PTR,
        .secondaryInputLength = 0,
        .tertiaryInputPtr = NULL_PTR,
        .tertiaryInputLength = 0,
        .outputPtr = NULL_PTR,
        .outputLengthPtr = 0,
        .secondaryOutputPtr = NULL_PTR,
        .secondaryOutputLengthPtr = NULL_PTR,
        .input64 = 0,
        .verifyPtr = NULL_PTR,
        .output64Ptr = NULL_PTR,
        .mode = CRYPTO_OPERATIONMODE_SINGLECALL
    },
    .jobPrimitiveInfo = NULL_PTR,
    .jobInfo = &g_jobInfo2,
    .cryptoKeyId = 0
};

Crypto_JobInfoType g_jobInfo3 = {
    .jobId = JOB_ID_3,
    .jobPriority = JOB_PRIO_3
};

Crypto_JobType g_cryptoJob3 = {
    .jobId = JOB_ID_3,
    .jobState = CRYPTO_JOBSTATE_IDLE,
    .jobPrimitiveInputOutput = {
        .inputPtr = NULL_PTR,
        .inputLength = 0,
        .secondaryInputPtr = NULL_PTR,
        .secondaryInputLength = 0,
        .tertiaryInputPtr = NULL_PTR,
        .tertiaryInputLength = 0,
        .outputPtr = NULL_PTR,
        .outputLengthPtr = 0,
        .secondaryOutputPtr = NULL_PTR,
        .secondaryOutputLengthPtr = NULL_PTR,
        .input64 = 0,
        .verifyPtr = NULL_PTR,
        .output64Ptr = NULL_PTR,
        .mode = CRYPTO_OPERATIONMODE_SINGLECALL
    },
    .jobPrimitiveInfo = NULL_PTR,
    .jobInfo = &g_jobInfo3,
    .cryptoKeyId = 0
};
  
  
  
  




#endif /* CRYPTO_APP_H */









