/*!
* @file tl_aes.h
* @brief Implementation of AES GCM
* @author Oleksandr Gabrilchuk (o.gabrilchuk@samsung.com)
* @version 1
* @date Created: Created: Tue Jul 24 10:20:53 2014
* @date Modified: Fri Aug  1 10:48:38 2014
* @copyright
* In Samsung Ukraine R&D Center (SURC under a contract between)
* @par
* LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
* @par
* Copyright (c) Samsung Electronics Co. Ltd 2013. All rights reserved.
*/
#ifndef __TL_AES_H__
#define __TL_AES_H__

#ifdef USE_QSEE
# ifdef CC_USE_FIPS
#  include "openssl/fipssyms.h"
# endif  // CC_USE_FIPS
# include "openssl/aes/aes.h"
# include "openssl/modes/modes_lcl.h"

#include <stdint.h>

typedef enum{
    SOFTSIM_CC_AES_ENCRYPT = 0,
    SOFTSIM_CC_AES_DECRYPT = 1,
}AES_MODE;

typedef struct Aes_ctx{
    AES_KEY key;
    GCM128_CONTEXT  stCipher;
    AES_MODE mode;
}aes_ctx_t;
int32_t softsim_aes_gcm_init(aes_ctx_t *ctx, const uint8_t *key, uint32_t keyLength, const uint8_t *IV, uint32_t IVLength, AES_MODE mode);
int32_t softsim_aes_gcm_add_aad(aes_ctx_t *ctx, const uint8_t *AAD, uint32_t AADLen);
int32_t softsim_aes_gcm_update(aes_ctx_t *ctx, const uint8_t *inDataBlock, uint32_t dataBlockLen, uint8_t *outDataBlock);
int32_t softsim_aes_gcm_finish(aes_ctx_t *ctx, uint8_t *AT, uint32_t ATLen);
#elif USE_MOBICORE

#error "TEE platform not implemented yet..."

#elif USE_BLOWFISH
#else
#error "TEE platform not defined"
#endif




#endif /* __TL_AES_H__ */
