/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*

                       Authhat PAL Header for common function(s)

GENERAL DESCRIPTION
 Declares Platform Abstraction Layer(PAL) interface function(s) - common

*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/

#ifndef __sec_common_h_
#define __sec_common_h_

#define PAL_LOG_MSG_MAX   (512)    /* MAX Size of log messages */
#define DUMP_PER_LINE     (16)

#include "sec_templ.h"
/**
 * Allocates a block of size bytes from the heap.
 * If heap_ptr is NULL or size is 0, the NULL pointer will be silently returned.
 * @param [in]          size            the number of bytes to be allocated.
 * @return              pointer to the allocated space on success, NULL on other case.
 */
void* PAL_MemoryAlloc(size_t size);


/**
 * Frees a memory block allocated from a heap.
 * @param [in]          buffer            pointer to the block of memory to be freed.
 */
void PAL_MemoryFree(void* buffer);


/**
 * Logs formatted message.
 * @note If log message is too long, you can see "Log message is too long."
 * @param [in]          fmt             format control string.
 */
void PAL_DbgLog(const char* fmt, ...);

UINT32 PAL_get_uniqueKey(UINT32 tz_type, UINT8* unique_key);
UINT32 PAL_generate_randBytes(UINT8* rands, UINT32 rands_len);
UINT32 PAL_generate_HMAC(UINT8* in_msg, UINT32 msg_len, UINT8* key, UINT32 key_len, UINT8* out_digest);
UINT32 PAL_AES_CBC_encrypt(UINT8* in_ar, UINT8* out_ar, UINT32 in_ar_size, UINT8* iv, UINT8* key);

#endif /* __bio_subModule_pal_common_h_ */

