/*
 * =====================================================================================
 *
 *       Filename:  logEncryptor.h
 *
 *    Description:  log encryption using RSA and AES. 
 *
 *        Version:  1.0
 *        Created:  08/26/2016 06:27:03 AM
 *       Compiler:  armcc
 *
 *         Author:  Dongwook Shim (), dw.shim@samsung.com
 *        Company:  Samsung Electronics
 *
 *        Copyright (c) 2016 by Samsung Electronics, All rights reserved. 
 *
 * =====================================================================================
 */

#ifndef __LOG_ENCRYPTOR_H__
#define __LOG_ENCRYPTOR_H__

#include "aes/aes.h"
#include "rsa/rsa.h"

// Common definition.
#define MAGIC_CODE             "SMSTRAON"
#define AES256KEY_SIZE         32
#define ENCRYPTED_KEY_SIZE     256

typedef struct {
	char *magicCode;
	uint32_t *logLength;
	uint8_t *logData;
	uint8_t *encryptedKey;
} __attribute__((packed)) DrkLogData;

typedef struct {
	uint8_t aesRawKey[AES256KEY_SIZE];
	uint8_t iv[AES_BLOCK_SIZE];
} __attribute__((packed)) AesKeyData;

int32_t logEncrypt(uint8_t *cipherText, uint32_t cipherTextLen);
#endif	// __LOG_ENCRYPTOR_H__
