virtual void reset() = 0;\r
virtual bool getPropertyValue(PropertyValue&) = 0;\r
void setPropSet(uintptr_t propset) {\r
- this->propset = propset;\r
+ this->m_propset = propset;\r
};\r
- Property() : propset(0) {\r
+ Property() : m_propset(0) {\r
}\r
;\r
virtual ~Property() {\r
}\r
;\r
- uintptr_t propset;\r
+ uintptr_t m_propset;\r
};\r
\r
#endif /* PROPERTYACCESS_PROPERTY_H_ */\r
(PropertyEnumHandle*)propsetOrEnumerator;\r
if (enumHandle && enumHandle->property) {\r
targetProperty = enumHandle->property;\r
- return targetProperty->propset;\r
+ return targetProperty->m_propset;\r
}\r
}\r
return 0;\r
uint64_t clockSeq;\r
string clockSeqStr = tokensString[4] + tokensString[5] + tokensString[6]\r
+ tokensString[7];\r
- //TEST CODE: string clockSeqStr("0123456789ABCDEF");\r
clockSeq = std::stoll(clockSeqStr);\r
memcpy(uuid.clockSeqAndNode, &clockSeq, sizeof(uint64_t));\r
// Change endian-ness\r
*/
CommandCloseSession::CommandCloseSession(CloseTASessionData data) :
CommandBase(CLOSESESSION) {
- this->data = data;
+ this->m_data = data;
sessionID = data.sessionID;
}
*/
std::string CommandCloseSession::getCommandUID() const {
std::stringstream ss;
- ss << data.sessionID;
+ ss << m_data.sessionID;
ss << ":";
ss << "0";
return ss.str();
void CommandCloseSession::getSerializedData(unsigned char *data,
unsigned int &size) {
data[0] = command;
- memcpy(&data[1], (unsigned char*)&this->data, sizeof(CloseTASessionData));
+ memcpy(&data[1], (unsigned char*)&this->m_data, sizeof(CloseTASessionData));
size = sizeof(CloseTASessionData);
}
class CommandCloseSession:
public CommandBase {
public:
- CloseTASessionData data;
+ CloseTASessionData m_data;
void getSerializedData(unsigned char *data, unsigned int &size);
CommandCloseSession(CloseTASessionData data);
TEE_Result execute();
/*-----------------------------------------------------------------------------
* Member functions
*-----------------------------------------------------------------------------*/
-CommandCreateEntryPoint::CommandCreateEntryPoint(CreateTAEntryPointData data) :
+CommandCreateEntryPoint::CommandCreateEntryPoint(CreateTAEntryPointData _data) :
CommandBase(CREATE) {
- this->data = data;
- sessionID = data.sessionID;
+ this->data = _data;
+ sessionID = _data.sessionID;
}
/**
* @param data[out] serialized object data
* @param size[out] size in bytes
*/
-void CommandCreateEntryPoint::getSerializedData(unsigned char *data,
+void CommandCreateEntryPoint::getSerializedData(unsigned char *_data,
unsigned int &size) {
- data[0] = command;
- memcpy(&data[1], (unsigned char*)&this->data, sizeof(CreateTAEntryPointData));
+ _data[0] = command;
+ memcpy(&_data[1], (unsigned char*)&this->data, sizeof(CreateTAEntryPointData));
size = sizeof(CreateTAEntryPointData);
}
/*-----------------------------------------------------------------------------
* Member functions
*-----------------------------------------------------------------------------*/
-CommandDestroyEntryPoint::CommandDestroyEntryPoint(DestroyTAEntryPointData data) :
+CommandDestroyEntryPoint::CommandDestroyEntryPoint(DestroyTAEntryPointData _data) :
CommandBase(DESTROY) {
- this->data = data;
- sessionID = data.sessionID;
+ this->data = _data;
+ sessionID = _data.sessionID;
}
//TODO: Handle exit of TA instance in a clean way
* @param data[out] serialized object data
* @param size[out] size in bytes
*/
-void CommandDestroyEntryPoint::getSerializedData(unsigned char *data,
+void CommandDestroyEntryPoint::getSerializedData(unsigned char *_data,
unsigned int &size) {
- data[0] = command;
- memcpy(&data[1], (unsigned char*)&this->data,
+ _data[0] = command;
+ memcpy(&_data[1], (unsigned char*)&this->data,
sizeof(DestroyTAEntryPointData));
size = sizeof(DestroyTAEntryPointData);
}
OPEN_TA_SESSION,
INVOKE_TA_COMMAND,
CLOSE_TA_SESSION,
- CHECK_MEMORY,
PANIC
} TEE_CMD;
#endif /* __TEE_COMMAND_H__ */
case SSF_LIB:
return "SSF_LIB";
+ case OSA_LIB:
+ return "OSA_LIB";
+
default:
return "TA_SDK";
}
#define INOUT
#define OUT
-//#define _LOGGING
#ifdef _WIN
typedef int timer_t;
TEE_STUB = 0x08,
TEST = 0x10,
SSF_LIB = 0x11,
+ OSA_LIB = 0x12,
ALL_MODULES = 0xFFFFFFF,
} ModuleLevel;
${OSAL_PATH}/OsaTask.c
)
+INCLUDE_DIRECTORIES(
+ ${LOG_PATH}
+)
+
ADD_LIBRARY(${TARGET_TEF_SIMULATOR_OSAL} ${OSAL_SOURCES})
INSTALL(TARGETS ${TARGET_TEF_SIMULATOR_OSAL} DESTINATION ${LIB_DIR})
* Include files
*-----------------------------------------------------------------------------*/
#include "OsaLinuxUser.h"
+#include <log.h>
/*-----------------------------------------------------------------------------
* Globals
* Add SIGALRM in the list
*/
if (sigaddset(&(Action_t.sa_mask), SIGALRM) < 0) {
- //PrintError("In OsaTimerCreate() : Could Not Stop \n");
+ LOGE(OSA_LIB, "In OsaTimerCreate() : Could Not Stop \n");
return OSAL_ERROR;
}
* Unblock the SIGALRM,if it is blocked
*/
if (sigprocmask(SIG_UNBLOCK, &(Action_t.sa_mask), NULL) < 0) {
- //PrintError("In OsaTimerCreate() : Could not mask the Signal \n");
+ LOGE(OSA_LIB, "In OsaTimerCreate() : Could not mask the Signal \n");
return OSAL_ERROR;
}
/* The timer is started */
if (Timer_data_t.start_timer != TRUE) {
if (setitimer(ITIMER_REAL, &Timer_data_t.iTval_t, NULL) < 0) {
- //PrintError("In OsaTimerStart() : OsaTimerStart failed \n ");
+ LOGE(OSA_LIB, "In OsaTimerStart() : OsaTimerStart failed \n ");
return OSAL_ERROR;
}
*/
int OsaTimerStop(int iTimerId)
{
- //struct sigaction Action_t;
- //Action_t.sa_flags = 0;
struct itimerval trivial_it; /* OSAL_080918_1 */
if (Timer_data_t.start_timer == FALSE) {
- //PrintError("In OsaTimerStop() : Timer not yet started \n");
- return OSAL_ERROR;
- }
-
- /* OSAL_080920 : Don't block the alarm signal */
-#if 0
- /* OSAL_080918_2 : init signal set variable */
- sigemptyset(&(Action_t.sa_mask));
-
- /*
- * Add SIGALRM in the signal List
- */
- if (sigaddset(&(Action_t.sa_mask), SIGALRM) < 0) {
- PrintError("In OsaTimerStop() : Could Not Stop \n");
- return OSAL_ERROR;
- }
-
- /*
- * Block SIGALRM
- */
- if (sigprocmask(SIG_BLOCK, &(Action_t.sa_mask), NULL) < 0) {
- PrintError("In OsaTimerStop() : Could not mask the Signal \n");
return OSAL_ERROR;
}
-#endif
/* OSAL_080918_1 : stop interval timer after alarm signal blocked */
trivial_it.it_value.tv_sec = 0;
trivial_it.it_value.tv_usec = 0;
if (setitimer(ITIMER_REAL, &trivial_it, NULL) == -1) {
- //PrintError("OsaTimerStop failed\n ");
+ LOGE(OSA_LIB, "OsaTimerStop failed\n ");
return OSAL_ERROR;
}
//Action_t.sa_flags = 0;
if (Timer_data_t.start_timer == FALSE) {
- //PrintError("In OsaTimerDelete() : No timer present to be deleted \n");
+ LOGE(OSA_LIB, "In OsaTimerDelete() : No timer present to be deleted \n");
return OSAL_ERROR;
}
/* The Timer is deleted */
if (setitimer(ITIMER_REAL, &iTmpval_t, NULL) < 0) {
- //PrintError("In OsaTimerDelete() : pOsaTimerDelete failed \n");
+ LOGE(OSA_LIB, "In OsaTimerDelete() : pOsaTimerDelete failed \n");
return -1;
}
struct sigaction Action_t;
if (Timer_data_t.stop_timer == TRUE) {
- //PrintError("In OsaTimerRestart() : Has been stopped forever \n");
+ LOGE(OSA_LIB, "In OsaTimerRestart() : Has been stopped forever \n");
return OSAL_ERROR;
}
/* OSAL_080918_1 :
reset it_value to keep the first expiration after restart */
if (setitimer(ITIMER_REAL, &Timer_data_t.iTval_t, NULL) == -1) {
- //PrintError("OsaTimerRestart failed\n ");
+ LOGE(OSA_LIB, "OsaTimerRestart failed\n ");
return OSAL_ERROR;
}
Action_t.sa_flags = 0;
if (sigprocmask(SIG_UNBLOCK, &(Action_t.sa_mask), NULL) < 0) {
- //PrintError("In OsaTimerRestart() : Could Not Start Again \n");
+ LOGE(OSA_LIB, "In OsaTimerRestart() : Could Not Start Again \n");
return OSAL_ERROR;
}
* Include files
*-----------------------------------------------------------------------------*/
#include "OsaLinuxUser.h"
+#include <log.h>
key_t OsaGetKey(const char pcName[10])
{
memset(aName, 0x00, 10);
memcpy(aName, pcName, 9);
- uid = 1; //getuid();
+ uid = 1; // getuid was here
acc = 0;
len = strlen(aName);
return OSAL_ERROR;
if (shmdt(pShmAddr) == -1) {
- //PrintError("Error in Detaching");
+ LOGE(OSA_LIB, "Error in Detaching");
return OSAL_ERROR;
}
sem = (UlOsaSem_t *)malloc(sizeof(*sem));
if (!sem) {
- //PrintError ("UlOsaSemCreate, Out of memory!\n");
+ LOGE(OSA_LIB, "UlOsaSemCreate, Out of memory!\n");
return OSAL_ERROR;
}
if (semctl(sem->iSemId, 0, SETVAL, semUnion) == -1) {
semctl(sem->iSemId, 0, IPC_RMID, NULL);
free(sem);
- //PrintError ("UlOsaSemCreate, semctl Failed!\n");
+ LOGE(OSA_LIB, "UlOsaSemCreate, semctl Failed!\n");
return OSAL_ERROR;
}
} else {
iRetVal = OSAL_EXIST;
} else {
free(sem);
- //PrintError ("UlOsaSemCreate, semget Failed!\n");
+ LOGE(OSA_LIB, "UlOsaSemCreate, semget Failed!\n");
return OSAL_ERROR;
}
}
ret = semop(sem->iSemId, &semBuf, 1);
} else if (iTimeout == 0) {
/* wait _inifinite_ */
- //PrintDbg ("UlOsaSemGet-infinite(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet-infinite(%s).\n", sem->bName);
semBuf.sem_num = 0;
semBuf.sem_op = -1;
semBuf.sem_flg = SEM_UNDO;
ret = OSAL_FAILURE_RETRY(semop(sem->iSemId, &semBuf, 1));
} else {
/* with _timeout_ */
- //PrintDbg ("UlOsaSemGet-timeout(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet-timeout(%s).\n", sem->bName);
if (iTimeout < 0) {
- //PrintError ("UlOsaSemGet-timeout: invalid arg!\n");
+ LOGE(OSA_LIB, "UlOsaSemGet-timeout: invalid arg!\n");
return OSAL_ERROR;
}
/* result */
if (ret == 0) {
- //PrintDbg ("UlOsaSemGet(%s) success.\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet(%s) success.\n", sem->bName);
return OSAL_OK;
} else {
if (iFlags == OSAL_SEM_NOWAIT && errno == EAGAIN) {
- //PrintError ("UlOsaSemGet-nowait: now locked, failed to get.\n");
+ LOGE(OSA_LIB, "UlOsaSemGet-nowait: now locked, failed to get.\n");
return OSAL_ERROR;
} else if (iTimeout > 0 && errno == EAGAIN) {
- //PrintError ("UlOsaSemGet-timeout(%s): time-out\n", sem->bName);
+ LOGE(OSA_LIB, "UlOsaSemGet-timeout(%s): time-out\n", sem->bName);
return OSAL_ERR_TIMEOUT;
} else {
- //PrintError ("UlOsaSemGet error, errno=%d\n", errno);
+ LOGE(OSA_LIB, "UlOsaSemGet error, errno=%d\n", errno);
return OSAL_ERROR;
}
}
if (!sem)
return OSAL_ERROR;
- //PrintDbg ("UlOsaSemRelease(%s)\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemRelease(%s)\n", sem->bName);
semBuf.sem_num = 0;
semBuf.sem_op = 1;
semBuf.sem_flg = SEM_UNDO;
if (semop(sem->iSemId, &semBuf, 1) == -1) {
- //PrintError ("UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
+ LOGE(OSA_LIB, "UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
return OSAL_ERROR;
} else
return OSAL_OK;
if (!sem)
return OSAL_ERROR;
- //PrintDbg ("UlOsaSemReset(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemReset(%s).\n", sem->bName);
semUnion.val = sem->iCount;
if (semctl(sem->iSemId, 0, SETVAL, semUnion) == -1) {
- //PrintError ("UlOsaSemReset, semctl Failed!\n");
+ LOGE(OSA_LIB, "UlOsaSemReset, semctl Failed!\n");
return OSAL_ERROR;
}
n = semctl(sem->iSemId, 0, GETVAL, NULL);
if (n == -1) {
- //PrintError ("UlOsaSemGetval, semctl Failed!\n");
+ LOGE(OSA_LIB, "UlOsaSemGetval, semctl Failed!\n");
return OSAL_ERROR;
} else {
- //PrintDbg ("UlOsaSemGetval(%s): now %d\n", sem->bName, n);
+ LOGD(OSA_LIB, "UlOsaSemGetval(%s): now %d\n", sem->bName, n);
return (int)n;
}
}
return UlOsaNamedSemRelease(uiSmid);
}
-int OsaNamedSemDelete(void
- *uiSmid) // Deleting Semaphore : Never USE!!! - junhyeong.kim, sukki.min 12.04.20
+int OsaNamedSemDelete(void *uiSmid)
{
- //return UlOsaNamedSemDelete (uiSmid);
return -1;
}
* Include files
*-----------------------------------------------------------------------------*/
#include "OsaLinuxUser.h"
+#include <log.h>
/*-----------------------------------------------------------------------------
* Globals
mqd_t QuId;
if (puiQid == NULL) {
- PrintDbg("Null Argument(s) \n");
+ LOGD(OSA_LIB, "Null Argument(s) \n");
return OSAL_ERROR;
}
if (((int)*puiQid) == -1) { //IPC_CREATE
perror("In OsaQueueCreate() : msgget: msgget failed");
- //PrintError("In OsaQueueCreate() : Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
return ((int)errno);
}
/* Get the current value from the structure for the message queue and copy it in buf_t*/
if (msgctl((int)(*puiQid), IPC_STAT, &tSetMqAttr) == -1) {
perror("In OsaQueueCreate() : msgctl: msgctl failed");
- //PrintError("In OsaQueueCreate() : Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
return ((int)errno);
}
if (msgctl((int)(*puiQid), IPC_SET, &tSetMqAttr) == -1) {
perror("In OsaQueueCreate() : msgctl: msgctl failed");
- //PrintError("In OsaQueueCreate() : Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaQueueCreate() : Error no. : %d\n", errno);
return ((int)errno);
}
if (msgctl((int)uiQid, IPC_RMID, NULL) == -1) {
perror("In OsaQueueDelete(): msgctl: msgctl failed");
- //PrintError("In OsaQueueDelete(): Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaQueueDelete(): Error no. : %d\n", errno);
return ((int)errno);
}
tMqAttr.mq_flags = O_NONBLOCK;
if ((err_no = mq_setattr((mqd_t)uiQid, &tMqAttr, (struct mq_attr *)NULL)) < 0) {
- ////PrintError("mq_setattr(): mq_setattr() Failed errno=%d\n",err_no,0,0,0,0,0); //COMMON_071024_1
+ LOGE(OSA_LIB, "mq_setattr(): mq_setattr() Failed errno=%d\n", err_no, 0, 0, 0, 0, 0);
return (OSAL_ERROR);
}
}
- if ((err_no = mq_send((mqd_t)uiQid, (const char *)pvMsg_buf, uiMsgLen,
- uiPriority)) < 0) {
- ////PrintError("mq_send():Failed errno=%d qid=%x flag=%d\n",err_no,uiQid,uiFlags,0,0,0); //COMMON_071024_1
+ if ((err_no = mq_send((mqd_t)uiQid, (const char *)pvMsg_buf, uiMsgLen, uiPriority)) < 0) {
+ LOGE(OSA_LIB, "mq_send():Failed errno=%d qid=%x flag=%d\n", err_no, uiQid, uiFlags, 0, 0, 0);
return (OSAL_ERROR);
}
#else /*SYS5 MSG QUEUE*/
- /*
- uiFlags : IPC_NOWAIT , ZERO
- pMsgLen: len - sizeof(int);
- */
osaMsgBuf_t osaMsg;
int ret;
if (uiMsgLen > MAXML) {
- ////PrintError("Message length exceeds max limit of %d\n",MAXML); //COMMON_071024_1
+ LOGE(OSA_LIB, "Message length exceeds max limit of %d\n", MAXML);
return OSAL_ERROR;
}
if (ret != 0) {
//perror("In OsaQueueSend () : msgsnd failed"); //COMMON_071024_1
- ////PrintError("In OsaQueueSend() : Error no. : %d\n",errno); //COMMON_071024_1
+ LOGE(OSA_LIB, "In OsaQueueSend() : Error no. : %d\n", errno);
return ((int)errno);
}
{
#ifndef __NO_OS__
#ifdef POSIX_QUEUE
- /*
- uiFlags : IPC_NOWAIT , ZERO
- */
-#if 0
- struct timespec absTimeOut;
-#endif
struct mq_attr tMqAttr;
int uiMsgLen = 0;
else
tMqAttr.mq_flags = 0;
-#if 0
-
- if (ptTimeOut && (!(uiFlags & OSAL_Q_NOWAIT))) {
- absTimeOut.tv_sec = ptTimeOut->Sec;
- absTimeOut.tv_nsec = ptTimeOut->NanoSec;
- } else {
- absTimeOut.tv_sec = 0;
- absTimeOut.tv_nsec = 0;
- }
-
-#endif
-
if (mq_setattr((mqd_t)uiQid, &tMqAttr, (struct mq_attr *)NULL) < 0) {
perror("OsaQueueSend(): mq_setattr() Failed \n");
return ((int)errno);
// Update the received message length
*pMsgLen = uiMsgLen;
#else /*SYS5 MSG QUEUE*/
- /*
- uiFlags : IPC_NOWAIT, MSG_NOERROR
- buf_len : len - sizeof(int);
- */
int iRet = 0;
osaMsgBuf_t osaMsg;
if (errno != ENOMSG) {
perror("In OsaQueueReceive() : msgrcv failed");
- //PrintError("In OsaQueueReceive() : Msg id %d, Error no. : %d\n", uiQid, errno);
+ LOGE(OSA_LIB, "In OsaQueueReceive() : Msg id %d, Error no. : %d\n", uiQid, errno);
}
return ((int)errno);
struct mq_attr tMqAttr;
if (pvBuf == NULL) {
- //PrintError("Null Argument(s) \n");
+ LOGE(OSA_LIB, "Null Argument(s) \n");
return OSAL_ERROR;
}
if (msgctl((int)uiQid, IPC_STAT, &buf) < 0) {
perror("In OsaQueueGetinfo() : msgctl: msgctl failed");
- //PrintError("In OsaQueueGetinfo() : Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaQueueGetinfo() : Error no. : %d\n", errno);
return ((int)errno);
}
struct mq_attr tMqAttr;
if (pvBuf == NULL) {
- //PrintError("Null Argument(s) \n");
+ LOGE(OSA_LIB, "Null Argument(s) \n");
return OSAL_ERROR;
}
if (msgctl((int)uiQid, IPC_SET, &buf) < 0) {
perror("In OsaQueueGetinfo() : msgctl: msgctl failed");
- //PrintError("In OsaQueueGetinfo() : Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaQueueGetinfo() : Error no. : %d\n", errno);
return ((int)errno);
}
* Include files
*-----------------------------------------------------------------------------*/
#include "OsaLinuxUser.h"
+#include <log.h>
/*-----------------------------------------------------------------------------
* Globals
sem = (UlOsaSem_t *)malloc(sizeof(*sem));
if (!sem) {
- //PrintError ("UlOsaSemCreate, Out of memory!\n");
+ LOGE(OSA_LIB, "UlOsaSemCreate, Out of memory!\n");
return OSAL_ERROR;
}
if (sem_init(&sem->sem, 1, (unsigned int)iCount) < 0) {
- //PrintError ("UlOsaSemCreate, sem_init Failed!\n");
+ LOGE(OSA_LIB, "UlOsaSemCreate, sem_init Failed!\n");
free(sem);
return OSAL_ERROR;
}
if (iFlags == OSAL_SEM_NOWAIT) {
/* no wait */
- //PrintDbg ("UlOsaSemGet-nowait(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet-nowait(%s).\n", sem->bName);
ret = sem_trywait(&sem->sem);
} else if (iTimeout == 0) {
/* wait _inifinite_ */
- //PrintDbg ("UlOsaSemGet-infinite(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet-infinite(%s).\n", sem->bName);
ret = OSAL_FAILURE_RETRY(sem_wait(&sem->sem));
} else {
/* with _timeout_ */
- //PrintDbg ("UlOsaSemGet-timeout(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet-timeout(%s).\n", sem->bName);
if (iTimeout < 0) {
- //PrintError ("UlOsaSemGet-timeout: invalid arg!\n");
+ LOGE(OSA_LIB, "UlOsaSemGet-timeout: invalid arg!\n");
return OSAL_ERROR;
}
-
-#if 0
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- tv.tv_sec += iTimeout / 1000000;
- tv.tv_usec += iTimeout % 1000000;
-
- if (tv.tv_usec >= 1000000) {
- tv.tv_sec += tv.tv_usec / 1000000;
- tv.tv_usec %= 1000000;
- }
-
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
-
- ret = OSAL_FAILURE_RETRY(sem_timedwait(&sem->sem, &ts));
-#endif
-
do { // SoC_D00003324
ret = sem_trywait(&sem->sem);
/* result */
if (ret == 0) {
- //PrintDbg ("UlOsaSemGet(%s) success.\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemGet(%s) success.\n", sem->bName);
return OSAL_OK;
} else {
if (iFlags == OSAL_SEM_NOWAIT && errno == EAGAIN) {
- // PrintError ("UlOsaSemGet-nowait: now locked, failed to get.\n");
+ // LOGE(OSA_LIB, "UlOsaSemGet-nowait: now locked, failed to get.\n");
return OSAL_ERROR;
- } else if (iFlags == OSAL_SEM_WAIT &&
- iTimeout <= 0) {// Before : cond - (iTimeout > 0 && errno == ETIMEDOUT)
- //PrintError ("UlOsaSemGet-timeout(%s): time-out\n",sem->bName);
+ } else if (iFlags == OSAL_SEM_WAIT && iTimeout <= 0) {
+ LOGE(OSA_LIB, "UlOsaSemGet-timeout(%s): time-out\n", sem->bName);
return OSAL_ERR_TIMEOUT;
} else {
- //PrintError ("UlOsaSemGet error, errno=%d\n", errno);
+ LOGE(OSA_LIB, "UlOsaSemGet error, errno=%d\n", errno);
return OSAL_ERROR;
}
}
if (!sem)
return OSAL_ERROR;
- //PrintDbg ("UlOsaSemRelease(%s)\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemRelease(%s)\n", sem->bName);
if (sem_post(&sem->sem) != 0) {
- //PrintError ("UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
+ LOGE(OSA_LIB, "UlOsaSemRelease(%s) error! errno=%d.\n", sem->bName, errno);
return OSAL_ERROR;
} else
return OSAL_OK;
if (!sem)
return OSAL_ERROR;
- //PrintDbg ("UlOsaSemReset(%s).\n", sem->bName);
+ LOGD(OSA_LIB, "UlOsaSemReset(%s).\n", sem->bName);
/* For threads currently blocked, the effect of destroying is not defined in POSIX.
Currently, this will not release any blocked threads. */
if (sem_destroy(&sem->sem) < 0) {
- //PrintError ("UlOsaSemReset, sem_destroy errno=%d\n", errno);
+ LOGE(OSA_LIB, "UlOsaSemReset, sem_destroy errno=%d\n", errno);
return OSAL_ERROR;
}
return OSAL_ERROR;
if (sem_getvalue(&sem->sem, &n) != 0) {
- //PrintError ("UlOsaSemGetval(%s), sem_getvalue errno=%d\n", sem->bName, errno);
+ LOGE(OSA_LIB, "UlOsaSemGetval(%s), sem_getvalue errno=%d\n", sem->bName, errno);
return OSAL_ERROR;
} else {
- //PrintDbg ("UlOsaSemGetval(%s): now %d\n", sem->bName, n);
+ LOGD(OSA_LIB, "UlOsaSemGetval(%s): now %d\n", sem->bName, n);
return (int)n;
}
}
pthread_mutex_t *pmutex_t;
if (puiMutid == NULL) {
- //PrintError("In OsaMutCreate() : NULL PTR ERROR");
+ LOGE(OSA_LIB, "In OsaMutCreate() : NULL PTR ERROR");
return OSAL_ERROR;
}
pthread_mutexattr_destroy(&attr_t);
} else {
- //PrintError("In OsaMutCreate() : No memory");
+ LOGE(OSA_LIB, "In OsaMutCreate() : No memory");
return OSAL_ERROR;
}
if (iRet < 0) {
perror("In OsaMutDelete() : failed ");
- //PrintError("Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "Error no. : %d\n", errno);
return ((int)errno);
}
if (iRet < 0) {
perror("In OsaMutRelease() : failed ");
- //PrintError("Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "Error no. : %d\n", errno);
return ((int)errno);
}
if (iRet < 0) {
perror("In OsaMutGet() : failed ");
- //PrintError("Error no. : %d\n",errno);
+ LOGE(OSA_LIB, "Error no. : %d\n", errno);
return ((int)errno);
}
* Include files
*-----------------------------------------------------------------------------*/
#include "OsaLinuxUser.h"
+#include <log.h>
/*-----------------------------------------------------------------------------
* Functions
if (iRet) {
perror("SigProcMask: SigProcMask Failed ");
- //PrintError("Error No. : %d\n",errno);
+ LOGE(OSA_LIB, "Error No. : %d\n", errno);
return ((int)errno);
}
if (iRet) {
perror("SigSuspend: SigSuspend INTR ");
- //PrintError("Error No. : %d\n",errno);
+ LOGE(OSA_LIB, "Error No. : %d\n", errno);
return ((int)errno);
}
if (iRet) {
perror("TimeWait: TimeWait INTR ");
- //PrintError("Error No. : %d\n",errno);
+ LOGE(OSA_LIB, "Error No. : %d\n", errno);
return ((int)errno);
}
if (sigaddset(&(Action_t.sa_mask), iSigno) < 0) {
perror("sigaddset: sigaddset Failed ");
- //PrintError("Error No. : %d\n",errno);
+ LOGE(OSA_LIB, "Error No. : %d\n", errno);
return ((int)errno);
}
* Include files
*-----------------------------------------------------------------------------*/
#include "OsaLinuxUser.h"
+#include <log.h>
/*-----------------------------------------------------------------------------
* MACROS
if (iRet) {
perror("In OsaTaskSpawn() : prctl() Failed\n ");
- //PrintError("In OsaTaskSpawn() : prctl() error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : prctl() error no. : %d\n", iRet);
}
(*sThreadParam.pEntryFunc)(sThreadParam.pArg);
*puiTid = NULL;
free(pThreadParam);
perror("In OsaTaskSpawn() : pthread create Failed\n ");
- //PrintError("In OsaTaskSpawn() : error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
return ((int)iRet);
}
}
*puiTid = NULL;
free(pThreadParam);
perror("In OsaTaskSpawn() : pthread attr init Failed\n ");
- //PrintError("In OsaTaskSpawn() : error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
return ((int)iRet);
}
*puiTid = NULL;
free(pThreadParam);
perror("In OsaTaskSpawn() : pthread attr setstacksize Failed\n ");
- //PrintError("In OsaTaskSpawn() : error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
pthread_attr_destroy(&tattr_t);
return ((int)iRet);
}
*puiTid = NULL;
free(pThreadParam);
perror("In OsaTaskSpawn() : pthread create Failed\n ");
- //PrintError("In OsaTaskSpawn() : error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
pthread_attr_destroy(&tattr_t);
return ((int)iRet);
}
if (iRet) {
*puiTid = NULL;
perror("In OsaTaskSpawn() : pthread setschedparam Failed\n ");
- //PrintError("In OsaTaskSpawn() : error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : error no. : %d\n", iRet);
pthread_kill(createThread, 0);
return ((int)iRet);
}
if (iRet) {
*puiTid = NULL;
perror("In OsaTaskSpawn() : pthread_detach Failed\n ");
- //PrintError("In OsaTaskSpawn() : detach error no. : %d\n", iRet);
+ LOGE(OSA_LIB, "In OsaTaskSpawn() : detach error no. : %d\n", iRet);
pthread_kill(createThread, 0);
return ((int)iRet);
}
*puiTid = (void *)createThread;
- //PrintDbg("%s thread created policy: %d, priority %d\n", pName, createThreadPolicy, iPriority);
+ LOGD(OSA_LIB, "%s thread created policy: %d, priority %d\n", pName, createThreadPolicy, iPriority);
return OSAL_OK;
}
if (iRet) {
perror("In OsaTaskDelete() : TaskDelete Failed ");
- //PrintError("In OsaTaskDelete() : error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaTaskDelete() : error no. : %d\n",errno);
return ((int)errno);
}
if (iRet) {
perror("In OsaTaskSetPriority() : TaskSetPriority set Failed ");
- //PrintError("In OsaTaskSetPriority() : error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaTaskSetPriority() : error no. : %d\n",errno);
return ((int)errno);
}
if (iRet) {
piPriority = NULL;
perror("In OsaTaskGetPriority() : TaskGetPriority Failed ");
- //PrintError("In OsaTaskGetPriority() : error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaTaskGetPriority() : error no. : %d\n",errno);
return ((int)errno);
}
if (iRetval) {
perror("TaskNanoSleep: TaskNanoSleep Failed ");
- //PrintError("Error No. : %d\n",errno);
+ LOGE(OSA_LIB, "Error No. : %d\n",errno);
return ((int)errno);
}
if (iRetval) {
perror("In OsaTaskDelaymsecs() : TaskNanoSleep Failed ");
- //PrintError("In OsaTaskDelaymsecs() : error no. : %d\n",errno);
+ LOGE(OSA_LIB, "In OsaTaskDelaymsecs() : error no. : %d\n",errno);
return ((int)errno);
}
class SecurityContext {
private:
- int connFd;
+ int m_connFd;
static constexpr const size_t CYNARA_CACHE_SIZE = 100U;
size = sizeof(IntTACloseSessionData);
LOGD(SIM_DAEMON, "[TEEC] IntTACloseSessionData Size: %d", size);
break;
- case CHECK_MEMORY:
- // size = sizeof(CheckMemoryData);
- LOGD(SIM_DAEMON, "[TEEC] CheckMemoryData Size: %d", size);
- break;
case PANIC:
size = sizeof(IntTAPanicData);
LOGD(SIM_DAEMON, "[TEEC] PanicData Size: %d", size);
pthread_mutex_lock(&cynara_mutex);
char *label = nullptr;
- ret = cynara_creds_socket_get_client(connFd, CLIENT_METHOD_SMACK, &label);
+ ret = cynara_creds_socket_get_client(m_connFd, CLIENT_METHOD_SMACK, &label);
if (ret != CYNARA_API_SUCCESS) {
LOGE(SIM_DAEMON, "Couldn't get smack label of the client. Error code: %d", ret);
RETURN_UNLOCK(false, cynara_mutex);
p_char p_label(label, &free);
pid_t ca_pid = -1;
- ret = cynara_creds_socket_get_pid(connFd, &ca_pid);
+ ret = cynara_creds_socket_get_pid(m_connFd, &ca_pid);
if (ret != CYNARA_API_SUCCESS) {
LOGE(SIM_DAEMON, "Couldn't get pid of the client. Error code: %d", ret);
RETURN_UNLOCK(false, cynara_mutex);
p_char p_session(session, &free);
char *user = nullptr;
- ret = cynara_creds_socket_get_user(connFd, USER_METHOD_DEFAULT, &user);
+ ret = cynara_creds_socket_get_user(m_connFd, USER_METHOD_DEFAULT, &user);
if (ret != CYNARA_API_SUCCESS) {
LOGE(SIM_DAEMON, "Couldn't get user. Error code: %d", ret);
RETURN_UNLOCK(false, cynara_mutex);
SecurityContext::SecurityContext(int connFd):
- connFd(connFd) {
+ m_connFd(connFd) {
if (_cynara == nullptr) throw std::runtime_error("Cynara is not initialized");
}
properties.extension.appName = string(propertiesExtension->first_attribute("appName")->value());
properties.extension.appVersion = string(propertiesExtension->first_attribute("appVersion")->value());
- /*properties.extension.type = string(propertiesExtension->first_attribute("type")->value());
- properties.extension.zone = string(propertiesExtension->first_attribute("zone")->value());*/
properties.extension.sdkVersion = string(propertiesExtension->first_attribute("sdkVersion")->value());
- // Removed, taEncrypion flag used now
- //properties.extension.secret = string(propertiesExtension->first_attribute("secret")->value());
-
properties.extension.launchMode = string(propertiesExtension->first_attribute("launchMode")->value());
}
}
LOGE(SIM_DAEMON, "Read failed");
return -1;
}
- // fixHeaderEndianness(&packageHeader);
// 2. Verify header
if (SECURITY_HEADER_MAGIC1 == packageHeader.magic1 &&
SECURITY_HEADER_MAGIC2 == packageHeader.magic2) {
LOGE(SIM_DAEMON, "Read failed");
return -1;
}
- //manifest.write(manifestdump, sizeWithoutPadding(manifestdump, packageHeader.manifest_size));
manifest.write(manifestdump, packageHeader.manifest_size);
manifest.flush();
delete[] manifestdump;
pdDest[i] = (cc_u32)pdDigit2;
dTemp = pdDigit2 >> 32;
- /*SDRM_DIGIT_Mul(pdDigit, dMultiplier, pdSrc[i]);
- if ((dTemp += pdDigit[0]) < pdDigit[0])
- {
- pdDigit[1]++;
- }
-
- if ((pdDest[i] += dTemp) < dTemp)
- {
- pdDigit[1]++;
- }
- dTemp = pdDigit[1];*/
}
if (i == dDstLen)
dTemp = pdDigit2 >> 32;
- /*SDRM_DIGIT_Mul(pdDigit, pdSrc1[i], pdSrc2[j]);
- if ((dTemp += pdDigit[0]) < pdDigit[0])
- {
- pdDigit[1]++;
- }
- if ((pdDest[i + j] += dTemp) < dTemp)
- {
- pdDigit[1]++;
- }
-
- dTemp = pdDigit[1];*/
}
pdDest[i + j] = dTemp;
if (SDRM_BN_Cmp(temp_Dividend, temp_Divisor) < 0) {
if (BN_Remainder != NULL) {
SDRM_BN_Copy(BN_Remainder, temp_Dividend);
- //free(pbBuf);
- //return CRYPTO_SUCCESS; modify by Chalyi Aleksandr: it is not correct
}
if (BN_Quotient != NULL)
SDRM_BN_OPTIMIZE_LENGTH(Src1);
SDRM_BN_SHR(BN_Dst, Src1, (Mod_Len) * 32);
- //BN_Dst->Length = Src1->Length - ri;
- BN_Dst->Length = Src1->Length - ri - 1; //Added by yhhwang
+ BN_Dst->Length = Src1->Length - ri - 1;//Added by yhhwang
- //if (SDRM_BN_Cmp(BN_Dst, Mont->Mod) >= 0)
while (SDRM_BN_Cmp(BN_Dst, Mont->Mod) >= 0)
SDRM_BN_Sub(BN_Dst, BN_Dst, Mont->Mod);
{
int ret;
- /* Begin - Add to test input range by Yong Ho Hwang (20120809) */
- /*
- if (SDRM_BN_Cmp(BN_Src1, Mont->Mod) >= 0)
- {
- ret = SDRM_BN_ModRed(BN_Src1, BN_Src1, Mont->Mod);
- if (ret != CRYPTO_SUCCESS)
- {
- return ret;
- }
- } else if ( BN_Src1->sign == 1)
- {
- printf("Minus Value\n");
- ret = SDRM_BN_Add(BN_Src1, BN_Src1, Mont->Mod);
- if (BN_Src1->sign == 1)
- {
- printf("Value Fail.\n");
- return CRYPTO_ERROR;
- }
- }
-
- if (SDRM_BN_Cmp(BN_Src2, Mont->Mod) >= 0)
- {
- ret = SDRM_BN_ModRed(BN_Src2, BN_Src2, Mont->Mod);
- if (ret != CRYPTO_SUCCESS)
- {
- return ret;
- }
- } else if ( BN_Src2->sign == 1)
- {
- printf("Minus Value\n");
- ret = SDRM_BN_Add(BN_Src2, BN_Src2, Mont->Mod);
- if (BN_Src2->sign == 1)
- {
- printf("Value Fail.\n");
- return CRYPTO_ERROR;
- }
- }
- */
- /* End - Add to test input range by Yong Ho Hwang (20120809) */
ret = SDRM_BN_Mul(BN_Dst, BN_Src1, BN_Src2);
ret = SDRM_MONT_Rzn2zn(BN_Dst, BN_Dst, Mont);
- /* Begin - Add to test input range by Yong Ho Hwang (20120809) */
- /*
- if (SDRM_BN_Cmp(BN_Dst, Mont->Mod) >= 0)
- {
- printf("Output is bigger than Mod\n");
- } else if ( BN_Dst->sign == 1)
- {
- printf("Minus Value\n");
- }
- */
- /* End - Add to test input range by Yong Ho Hwang (20120809) */
return ret;
}
R = SDRM_BN_Alloc((cc_u8 *)Ri + dAllocSize, dSize);
temp = SDRM_BN_Alloc((cc_u8 *)R + dAllocSize, dSize);
- //++ 2012.08.20 - modified by yhhwang to apply R=2^(160+32)
- /* == DELETED ==
- SDRM_BN_Copy(Mont->Mod, BN_Modulus);
-
- Mont->ri = (SDRM_BN_num_bits(BN_Modulus) + (SDRM_BitsInDWORD - 1)) / SDRM_BitsInDWORD * SDRM_BitsInDWORD;
-
- SDRM_BN_SHL(R, BN_One, SDRM_BitsInDWORD);
-
- buf[0] = BN_Modulus->pData[0];
- buf[1] = 0;
- temp->pData[0] = buf[0];
- temp->Length = 1;
- temp->sign = BN_Modulus->sign;
-
- SDRM_BN_ModInv(Ri, R, temp);
- if (Ri == NULL)
- {
- free(pbBuf);
-
- return CRYPTO_INVERSE_NOT_EXIST;
- }
-
- SDRM_BN_SHL(Ri, Ri, SDRM_BitsInDWORD);
- SDRM_BN_Sub(Ri, Ri, BN_One);
- SDRM_BN_Div(Ri, NULL, Ri, temp);
- SDRM_BN_Copy(Mont->Inv_Mod, Ri);
- Mont->N0 = Ri->pData[0];
-
- SDRM_BN_SHL(Mont->R, BN_One, 2 * (32 + Mont->ri));
- SDRM_BN_ModRed(Mont->R, Mont->R, Mont->Mod);
- */
- // == NEW CODE ==
SDRM_BN_Copy(Mont->Mod, BN_Modulus);
Mont->Mod->pData[Mont->Mod->Length] = 0;
// Compute R and R^2 mod M
SDRM_BN_SHL(Rsquare, BN_One, r2Size);
SDRM_BN_ModRed(Mont->R, Rsquare, BN_Modulus);
- //-- 2012.08.20 - modified by yhhwang
free(pbBuf);
free(Rsquare);
//normalize length
if (n % SDRM_SIZE_BLOCK != 0)
- BN_Dst->Length += 1;
-
-#if 0 //fix prevent problem by guoxing.xu 20140826. move to before
-
- if (!BN_Dst)
- BN_Dst = SDRM_BN_Init(BN_Dst->Length * SDRM_SIZE_OF_DWORD * 8);
-
-#endif
+ BN_Dst->Length += 1;
- for (i = 0; i < BN_Dst->Length ; i++)
+ for (i = 0; i < BN_Dst->Length; i++)
BN_Dst->pData[i] = 0;
//full string: bufferHex mod Length = 0
while (!SDRM_BN_isZero(num)) {
SDRM_BN_Div(num, tempREM, num, d);
- //itoa(tempREM->pData[0], (char *)tempChar, 10);
- //sprintf((char*)tempChar, "%d", tempREM->pData[0]);
snprintf((char *)tempChar, sizeof(tempChar), "%d",
- tempREM->pData[0]); // fix prevnet 60199 by guoxing.xu
+ tempREM->pData[0]);
strDestTemp[(*numberBits)] = tempChar[0];
(*numberBits)++;
ptr = (cc_u8 *)BN_Buf + sizeof(SDRM_BIG_NUM *) * count;
for (i = 0; i < count; i++) {
- //add by guoxing.xu to avoid warning. 2/15/2014
tmp = ptr;
BN_Buf[i] = (SDRM_BIG_NUM *)tmp;
- //BN_Buf[i] = (SDRM_BIG_NUM*)ptr;
BN_Buf[i]->Size = dBufSize;
tmp = (ptr + sizeof(SDRM_BIG_NUM));
BN_Buf[i]->pData = (cc_u32 *)tmp;
- //BN_Buf[i]->pData = (cc_u32*)(ptr + sizeof(SDRM_BIG_NUM));
ptr += bnsiz;
}
// Precomputation data
for (i = 0; i < 2; i++) {
- // Pw[i] = (SDRM_EC_POINT **)malloc(sizeof(SDRM_EC_POINT *) * w2);
- // if (!Pw[i]) return CRYPTO_MEMORY_ALLOC_FAIL;
for (j = 0; j < 9; j++)
Pw[i][j] = SDRM_ECC_Init();
}
static unsigned char PADDING[64] = {0x80, 0,};
-/* F, G, H and I are basic MD5 functions.
- */
-//#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-//#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-//#define H(x, y, z) ((x) ^ (y) ^ (z))
-//#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
#define G(x, y, z) F(z, x, y)
#define H(x, y, z) ((x) ^ (y) ^ (z))
EM[emLen - sLen - hLen - 2] ^= 0x01;
- //memset(EM, 0x00, emLen - sLen - hLen - 2);
for (i = 0; i < sLen; i++)
EM[emLen - sLen - hLen - 1 + i] ^= salt[i];
i = 0xff;
if (((cc_u8 *)&i)[0] == 0xff) {
- // LOG4DRM_INFO(&CryptoLogCTX), "is Little Endian machine\n");
memcpy(ctx->s, RC4_S_VALUE_LITTLE, 256);
} else {
- // LOG4DRM_INFO(&CryptoLogCTX), "is Big Endian machine\n");
memcpy(ctx->s, RC4_S_VALUE_BIG, 256);
}
save one boolean operation each - thanks to Rich Schroeppel,
rcs@cs.arizona.edu for discovering this */
-/*#define SDRM_SHA1_f1(x,y,z) ((x & y) | (~x & z)) // Rounds 0-19 */
-#define SDRM_SHA1_f1(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) /* Rounds 0-19 */
-#define SDRM_SHA1_f2(x, y, z) ((x) ^ (y) ^ (z)) /* Rounds 20-39 */
-/*#define SDRM_SHA1_f3(x,y,z) ((x & y) | (x & z) | (y & z)) // Rounds 40-59 */
-#define SDRM_SHA1_f3(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) /* Rounds 40-59 */
-#define SDRM_SHA1_f4(x, y, z) ((x) ^ (y) ^ (z)) /* Rounds 60-79 */
+#define SDRM_SHA1_f1(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) /* Rounds 0-19 */
+#define SDRM_SHA1_f2(x, y, z) ((x) ^ (y) ^ (z)) /* Rounds 20-39 */
+#define SDRM_SHA1_f3(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) /* Rounds 40-59 */
+#define SDRM_SHA1_f4(x, y, z) ((x) ^ (y) ^ (z)) /* Rounds 60-79 */
/* The SHS Mysterious Constants */
}
-//unsigned char digest[20];
-//unsigned char message[3] = {'a', 'b', 'c' };
-//unsigned char *mess56 =
-// "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
-
-/* Correct solutions from FIPS PUB 180-1 */
-//char *dig1 = "A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D";
-//char *dig2 = "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1";
-//char *dig3 = "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F";
-
-/* Output should look like:-
- a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d
- A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D <= correct
- 84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1
- 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 <= correct
- 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f
- 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F <= correct
-*/
-
-//main()
-//{
-// SHA_CTX sha;
-// int i;
-// BYTE big[1000];
-//
-// SHAInit(&sha);
-// SHAUpdate(&sha, message, 3);
-// SHAFinal(digest, &sha);
-//
-// for (i = 0; i < 20; i++)
-// {
-// if ((i % 4) == 0) printf(" ");
-// printf("%02x", digest[i]);
-// }
-// printf("\n");
-// printf(" %s <= correct\n", dig1);
-//
-// SHAInit(&sha);
-// SHAUpdate(&sha, mess56, 56);
-// SHAFinal(digest, &sha);
-//
-// for (i = 0; i < 20; i++)
-// {
-// if ((i % 4) == 0) printf(" ");
-// printf("%02x", digest[i]);
-// }
-// printf("\n");
-// printf(" %s <= correct\n", dig2);
-//
-// /* Fill up big array */
-// for (i = 0; i < 1000; i++)
-// big[i] = 'a';
-//
-// SHAInit(&sha);
-// /* Digest 1 million x 'a' */
-// for (i = 0; i < 1000; i++)
-// SHAUpdate(&sha, big, 1000);
-// SHAFinal(digest, &sha);
-//
-// for (i = 0; i < 20; i++)
-// {
-// if ((i % 4) == 0) printf(" ");
-// printf("%02x", digest[i]);
-// }
-// printf("\n");
-// printf(" %s <= correct\n", dig3);
-//
-// return 0;
-//}
-
-/* endian.c */
void SDRM_endianTest(int *endian_ness)
{
BlockXor(K2, K2, R_b);
}
- // LOG4DRM_BUFFER(&CryptoLogCTX), LOG_DEBUG, "K1", K1, 16);
- // LOG4DRM_BUFFER(&CryptoLogCTX), LOG_DEBUG, "K2", K2, 16);
+
return CRYPTO_SUCCESS;
}
ptr += SDRM_AES_BLOCK_SIZ;
}
- // LOG4DRM_BUFFER(&CryptoLogCTX), LOG_DEBUG, "Block", crt->ctx->cmacctx->IV, 16);
+
memcpy(crt->ctx->cmacctx->Block, ptr, crt->ctx->cmacctx->BlockLen);
SDRM_BN_ModRed(v, temp3,
crt->ctx->dsactx->q); //v = (alpha^u1 x y^u2 mod p) mod q
- // SDRM_PrintBN("v : ", v);
- // SDRM_PrintBN("Hash : ", BNH_m);
+
if (SDRM_BN_Cmp(v, BN_r) == 0)
*result = CRYPTO_VALID_SIGN;
return res;
}
- //SDRM_PrintBN("kP->x", kP->x);
SDRM_BN_ModRed(BN_r, kP->x, ctx->ECC_n);
if (BN_r->Length > 0) // r = 0 �̸� k �ٽ� ����
// 3. k^{-1} mod n ���.
SDRM_BN_ModInv(BN_Tmp1, BN_k, ctx->ECC_n);
- //SDRM_PrintBN("BN_k", BN_k);
- //SDRM_PrintBN("ctx->ECC_n", ctx->ECC_n);
- //SDRM_PrintBN("BN_Tmp1 = k^{-1} mod n", BN_Tmp1);
// 4. s = k^{-1}(hash + dr) mod n ��� (d = private key). s = 0 �̸� 1������.
// BN_Tmp2 = dr
break;
}
- // (r, s) �������� ���.
- //SDRM_PrintBN("BN_r", BN_r);
- //SDRM_PrintBN("BN_s", BN_s);
+// (r, s) �������� ���.
SDRM_BN2OS(BN_r, ctx->uDimension / 8, sig);
SDRM_BN2OS(BN_s, ctx->uDimension / 8, sig + ctx->uDimension / 8);
SDRM_OS2BN(sig, ctx->uDimension / 8, pBN_r);
SDRM_OS2BN(sig + ctx->uDimension / 8, ctx->uDimension / 8, pBN_s);
- //SDRM_PrintBN("BN_r", pBN_r);
- //SDRM_PrintBN("BN_s", pBN_s);
// 1. r�� s�� ���� ����
SDRM_BN_Sub(BN_tmp, ctx->ECC_n, BN_One);
// 2. w = s^(-1) mod n, BN_hash ���
SDRM_OS2BN(hash, hashLen, BN_hash);
res = SDRM_BN_ModInv(BN_w, pBN_s, ctx->ECC_n);
- //SDRM_PrintBN("BN_w", BN_w);
if (res != CRYPTO_SUCCESS) {
free(pbBuf);
// 3. u1 = BN_hash *w mod n, u2 = rw mod n
SDRM_BN_ModMul(BN_u1, BN_hash, BN_w, ctx->ECC_n);
SDRM_BN_ModMul(BN_u2, pBN_r, BN_w, ctx->ECC_n);
- //SDRM_PrintBN("BN_u1", BN_u1);
- //SDRM_PrintBN("BN_u2", BN_u2);
+
// 4. (x0, y0) = u1P + u2Q, V = x0 mod n
res = SDRM_CTX_EC_2kP(ctx, EC_temp1, BN_u1, ctx->ECC_G, BN_u2, ctx->PUBLIC_KEY);
return res;
}
- // SDRM_PrintBN("EC_temp1->x", EC_temp1->x);
- // SDRM_PrintBN("ctx->ECC_n", ctx->ECC_n);
+
SDRM_BN_ModRed(BN_tmp, EC_temp1->x, ctx->ECC_n);
- // SDRM_PrintBN("BN_tmp", BN_tmp);
- // SDRM_PrintBN("pBN_r", pBN_r);
+
// 5. V = r�� ��� ���� ok
res = SDRM_BN_Cmp_sign(BN_tmp, pBN_r);
q->pData[q->Length - 1] |= (1L << t1);
} while (SDRM_BN_MILLER_RABIN(q, sp) != CRYPTO_ISPRIME);
- // SDRM_PrintBN("p", p);
- // SDRM_PrintBN("q", q);
//temp1 = (p - 1), temp2 = (q - 1)
SDRM_BN_Sub(temp1, p, BN_One);
q->pData[q->Length - 1] |= (1L << t1);
} while (SDRM_BN_MILLER_RABIN(q, sp) != CRYPTO_ISPRIME);
- // SDRM_PrintBN("p", p);
- // SDRM_PrintBN("q", q);
//temp1 = (p - 1), temp2 = (q - 1)
return CRYPTO_INVALID_ARGUMENT;
}
- // SDRM_PrintBN("ENPADDED Text : ", BN_pMsg);
if (retVal != CRYPTO_SUCCESS) {
free(pbBuf);
return CRYPTO_INVALID_ARGUMENT;
}
- // SDRM_PrintBN("OAEP Text : ", BN_dMsg);
SDRM_I2OSP(BN_dMsg, RSA_KeyByteLen, pbBuf);
//Msg Padding
switch (SDRM_LOW_HALF(crt->ctx->rsactx->pm)) {
case ID_RSASSA_PKCS15:
- retVal = SDRM_Enpad_Rsassa_pkcs15(pbBuf, RSA_KeyByteLen, hash, hashLen,
- SDRM_HIGH_HALF(crt->ctx->rsactx->pm));
+ retVal = SDRM_Enpad_Rsassa_pkcs15(pbBuf, RSA_KeyByteLen, hash, hashLen, SDRM_HIGH_HALF(crt->ctx->rsactx->pm));
break;
-
case ID_RSASSA_PSS:
SDRM_BN_GETBITLEN(crt->ctx->rsactx->n, nBits);
- retVal = SDRM_Enpad_Rsassa_pss(pbBuf, nBits, hash, hashLen, RSA_KeyByteLen,
- SDRM_HIGH_HALF(crt->ctx->rsactx->pm));
+ retVal = SDRM_Enpad_Rsassa_pss(pbBuf, nBits, hash, hashLen, RSA_KeyByteLen, SDRM_HIGH_HALF(crt->ctx->rsactx->pm));
break;
-
case ID_NO_PADDING:
memset(pbBuf, 0x00, RSA_KeyByteLen - hashLen);
- //memcpy(pbBuf + hashLen, hash, RSA_KeyByteLen);
- memcpy(pbBuf + RSA_KeyByteLen - hashLen, hash,
- hashLen);// fixed by guoxing.xu 20140919
+ memcpy(pbBuf + RSA_KeyByteLen - hashLen, hash, hashLen);// fixed by guoxing.xu 20140919
retVal = CRYPTO_SUCCESS;
break;
-
default:
free(pbBuf);
return CRYPTO_INVALID_ARGUMENT;
return retVal;
}
- // SDRM_PrintBN("ENPADDED Msg : ", BN_pMsg);
SDRM_OS2BN(pbBuf, RSA_KeyByteLen, BN_pMsg);
SDRM_RSA_BN_BUFSIZE);
SDRM_OS2BN(signature, signLen, BN_Sign);
- // SDRM_PrintBN("Generated Sign : ", BN_Sign);
//RSA Verification by modular exponent
#ifndef _OP64_NOTSUPPORTED
fflush(file);
- //sync(fileno(file)); // sync blocked
-
fclose(file);
return SS_RET_SUCCESS;
result = SS_RET_FAIL;
SLOGE("Failed to create folder %s.", folder);
}
- //sync();
} else if (!(S_ISDIR(st.st_mode))) {
result = SS_RET_FAIL;
}
#ifdef _SECOS_SIM_
#include "file_op.h"
-//#define SWD_SS_ROOT "/opt/usr/apps/tz_simulator/data/swdss/"
#define SWD_SS_ROOT "/tmp/tastore2/"
#endif
return SS_RET_INVALID_CREDENTIAL;
}
- // checking specific values
- //if (tmp_uuid[14] != '4' || (tmp_uuid[19] != '8' && tmp_uuid[19] != '9' && tmp_uuid[19] != 'a' && tmp_uuid[19] != 'b'))
- //{
- // return SS_RET_INVALID_CREDENTIAL;
- //}
- // checking that string contains only hexidecimal values
if (-1 == is_hex(tmp_uuid, '-')) {
return SS_RET_INVALID_CREDENTIAL;
}
return SS_RET_SUCCESS;
}
+ int remaining = SS_FULL_DATA_NAME_LEN;
+
memcpy(m_full_path, m_cred.uuid, SS_MAX_UUID_LEN);
- strcat(m_full_path, "/");
- strcat(m_full_path, m_data_name);
+ m_full_path[SS_MAX_UUID_LEN] = '\0';
+ remaining -= SS_MAX_UUID_LEN;
+
+ strncat(m_full_path, "/", 1);
+ remaining -= 1;
+
+ strncat(m_full_path, m_data_name, remaining - 1);
m_file_path_ready = true;
return SS_RET_SUCCESS;
#else
// obtain first part of our string
byte_to_hex(pFolderName, pHash, CCryptoEngine::Hash_Size);
memcpy(sTemp, pFolderName, 2 * CCryptoEngine::Hash_Size);
- //sTemp.assign((char*)pFolderName, 2*CCryptoEngine::Hash_Size);
// concatenate with UUID and Name
- //sTemp += sUUID_and_Name;
memcpy(sTemp + 2 * CCryptoEngine::Hash_Size,
sUUID_and_Name,
strlen(sUUID_and_Name));
CCryptoEngine::Hash(pHash, (CBT_OCTET*)sTemp, strlen(sTemp));
// we will use first 4 bytes of hash value
- // convert them into hex format
- //byte_to_hex(pFolderName, pHash, 4);
-
- // set folder name
- //sfolder.assign((char*)pFolderName, 8);
- //sfolder += "/";
-
- //m_full_path = sfolder;
memset(m_full_path, 0, SS_FULL_DATA_NAME_LEN);
memcpy(m_full_path, pHash, 4);
byte_to_hex(dir, pHash, 4);
SLOGI("Dir is %s.", (char*)dir);
- //m_full_path[8] = '/';
-
if (0 != strlen(m_data_name)) {
// computing file name
uint64_t data_id = transform_id_to_name(transform_name_to_id(m_data_name));
switch (FileStructureType(ptr)) {
case 0: {
- // [header][hash][data][key]
m_file_content.m_pFileHeader = ptr;
ptr += HEADER_SIZE;
m_file_content.m_pHashMaterial = ptr;
break;
}
case 1: {
- // [header][hash][key][data]
m_file_content.m_pFileHeader = ptr;
ptr += HEADER_SIZE;
m_file_content.m_pHashMaterial = ptr;
break;
}
case 2: {
- // [header][data][key][hash]
m_file_content.m_pFileHeader = ptr;
ptr += HEADER_SIZE;
m_file_content.m_pFileContent = ptr;
break;
}
case 3: {
- // [header][key][data][hash]
m_file_content.m_pFileHeader = ptr;
ptr += HEADER_SIZE;
m_file_content.m_pKeyMaterial = ptr;
break;
}
case 4: {
- // [header][key][hash][data]
m_file_content.m_pFileHeader = ptr;
ptr += HEADER_SIZE;
m_file_content.m_pKeyMaterial = ptr;
break;
}
case 5: {
- // [header][data][hash][key]
m_file_content.m_pFileHeader = ptr;
ptr += HEADER_SIZE;
m_file_content.m_pFileContent = ptr;
#ifdef _SECOS_SIM_
*buffer = (unsigned char*)OsaMalloc(m_write_data_size);
if (NULL == *buffer) {
- //SLOGE("fail to alloc memory for data.");
return SS_RET_MALLOC_FAILED;
}
unsigned char* ptr = data;
switch (FileStructureType(m_file_content.m_pFileHeader)) {
case 0: {
- // [header][hash][data][key]
memcpy(ptr, m_file_content.m_pFileHeader, HEADER_SIZE);
ptr += HEADER_SIZE;
memcpy(ptr, m_file_content.m_pHashMaterial, HASH_SIZE);
break;
}
case 1: {
- // [header][hash][key][data]
memcpy(ptr, m_file_content.m_pFileHeader, HEADER_SIZE);
ptr += HEADER_SIZE;
memcpy(ptr, m_file_content.m_pHashMaterial, HASH_SIZE);
break;
}
case 2: {
- // [header][data][key][hash]
memcpy(ptr, m_file_content.m_pFileHeader, HEADER_SIZE);
ptr += HEADER_SIZE;
memcpy(ptr,
break;
}
case 3: {
- // [header][key][data][hash]
memcpy(ptr, m_file_content.m_pFileHeader, HEADER_SIZE);
ptr += HEADER_SIZE;
memcpy(ptr, m_file_content.m_pKeyMaterial, KEY_MAT_SIZE);
break;
}
case 4: {
- // [header][key][hash][data]
memcpy(ptr, m_file_content.m_pFileHeader, HEADER_SIZE);
ptr += HEADER_SIZE;
memcpy(ptr, m_file_content.m_pKeyMaterial, KEY_MAT_SIZE);
break;
}
case 5: {
- // [header][data][hash][key]
memcpy(ptr, m_file_content.m_pFileHeader, HEADER_SIZE);
ptr += HEADER_SIZE;
memcpy(ptr,
*/
int CCryptoEngine::Encrypt(uint8_t* dest, uint8_t* src, unsigned long data_len,
const uint8_t* key, unsigned long key_type) {
- //memcpy(dest,src,data_len);
- //return data_len;
unsigned int cipherTextLen, t;
CryptoCoreContainer *crt = create_CryptoCoreContainer(ID_AES);
#include "uci_cryptocore.h"
#include "uci_internal.h"
#include "uci_hwcrypto.h"
-//#include "ae.h"
#include "CC_Context.h"
#include "uci_aes_xcbc_mac.h"
if (pctx->config != UCI_SW)
return UCI_INVALID_HANDLE;
- // ctr=(CryptoCoreContainer *)(pctx->imp);
- // ctr->MD_update(ctr,msg,msg_len);
ret = ((CryptoCoreContainer *)pctx->imp)->AE_decryptByCRT(
((CryptoCoreContainer *)pctx->imp), input, input_len, output, output_len);
else
memset(info->iv, 0x0, info->ivlen);
- pctx->handle = open("/dev/crypto", 0, 0); //return hndl;
-
- //TA_PRINT("hand = %d \n",pctx->handle);
+ pctx->handle = open("/dev/crypto", 0, 0);
if (pctx->handle < 0)
return UCI_ERROR;
uci_context_s *pctx = (uci_context_s *)oh;
unsigned int keytype;
unsigned int alg;
- //!AS current hw is not ready, so using SW pseduo way temproray.
+
unsigned char hwkey_master[32] = { 0xAB, 0x12, 0x45, 0x67, 0x3F, 0x80, 0x98, 0x35,
- 0x06, 0x4F, 0x33, 0x39, 0x72, 0x1C, 0xDF, 0x23,
- 0xAB, 0x12, 0x45, 0x67, 0x3F, 0x80, 0x98, 0x35,
- 0x06, 0x4F, 0x33, 0x39, 0x72, 0x1C, 0xDF, 0x23
- };
+ 0x06, 0x4F, 0x33, 0x39, 0x72, 0x1C, 0xDF, 0x23,
+ 0xAB, 0x12, 0x45, 0x67, 0x3F, 0x80, 0x98, 0x35,
+ 0x06, 0x4F, 0x33, 0x39, 0x72, 0x1C, 0xDF, 0x23
+ };
unsigned char hwiv_master[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
- 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
+ 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF
};
unsigned char hwkey_unique[32] = { 0xF0, 0x22, 0x34, 0x67, 0x66, 0x88, 0xAB, 0xCD,
- 0x12, 0x67, 0x89, 0x54, 0x32, 0x10, 0xCC, 0xFE,
- 0xAB, 0x12, 0x45, 0x67, 0x3F, 0x80, 0x98, 0x35,
- 0x06, 0x4F, 0x33, 0x39, 0x72, 0x1C, 0xDF, 0x23
- };
+ 0x12, 0x67, 0x89, 0x54, 0x32, 0x10, 0xCC, 0xFE,
+ 0xAB, 0x12, 0x45, 0x67, 0x3F, 0x80, 0x98, 0x35,
+ 0x06, 0x4F, 0x33, 0x39, 0x72, 0x1C, 0xDF, 0x23
+ };
unsigned char hwiv_unique[16] = { 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88,
- 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00
+ 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00
};
if (pctx == NULL)
oper.src_len = len;
oper.dst_addr = (char *)output;
oper.dst_len = output_len;
-
- //oper.final = 1;
if (ret = ioctl(hndl, IOCTL_CRYPTO_CRYPT, &oper)) {
TA_PRINT("error:ioctl(hndl, 1, &oper) returned %d\n", ret);
return UCI_ERROR;
}
padlen = output[input_len - 1];
-
- //PrintBYTE("padding",output,input_len);
- //PrintBYTE("input",input,input_len);
if (padlen < 1 || padlen > 16) {
*output_len = 0;
TA_PRINT("padding size{%d} is incorretc ", padlen);
#define TURST_APP_WRN(fmt, ...) if (g_app_svc_dbglvl >= TRUSTAPP_DEBUG_LEVEL_WRN) {APP_SVC_WRN(APP_MODULE_NAME, fmt, ##__VA_ARGS__)}\r
#define TURST_APP_DBG(fmt, ...) if (g_app_svc_dbglvl >= TRUSTAPP_DEBUG_LEVEL_DBG) {APP_SVC_DBG(APP_MODULE_NAME, fmt, ##__VA_ARGS__)}\r
#define TURST_APP_LOG(fmt, ...) if (g_app_svc_dbglvl >= TRUSTAPP_DEBUG_LEVEL_LOG) {APP_SVC_LOG(APP_MODULE_NAME, fmt, ##__VA_ARGS__)}\r
-//#define TURST_APP_LOG(fmt, ...) TURST_APP_LOG_TEST(fmt,##__VA_ARGS__)\r
\r
\r
\r
#include <string.h>\r
#include <app_debug.h>\r
\r
-//#define PRINT_LOG_TO_CONSOLE\r
#ifdef PRINT_LOG_TO_CONSOLE\r
#include <fcntl.h>\r
#define portname "/dev/ttyS0"\r
*-----------------------------------------------------------------------------*/
#define SOCKPATH "/tmp/simdaemon" //path to be updated
-//#define TEST
/*-----------------------------------------------------------------------------
* local functions
#include <error.h>
#include <log.h>
#include <permission.h>
+#include <array>
+#include <algorithm>
#include "CC_API.h"
#include "ssf_crypto_openssl.h"
key->rsa_exponent2.buffer, &key->rsa_exponent2.size,
key->rsa_coefficient.buffer, &key->rsa_coefficient.size);
- /*if(rc == (-ETIMEDOUT))
- {
- LOGE(SSF_LIB, "Algorithm - %X : TIMEOUT \n", operation->info.algorithm);
- rc = TEE_ERROR_TIMEOUT;
- }*/
-
memcpy(key->rsa_public.buffer, E, ELen);
key->rsa_public.size = ELen;
}
CRYPTO_PANIC;
}
// tagLen check
+ std::array<uint32_t, 5> values_GCM = {128, 120, 112, 104, 96};
+ std::array<uint32_t, 6> values_CCM = {128, 112, 96, 64, 48, 32};
switch (op->info.algorithm) {
case TEE_ALG_AES_GCM: {
- switch (tagLen) {
- case 128:
- case 120:
- case 112:
- case 104:
- case 96:
- break;
- default:
- LOGE(SSF_LIB, "Incorrect tag length %u", tagLen);
- return TEE_ERROR_NOT_SUPPORTED;
- };
- break;
+ if (std::find(values_GCM.begin(), values_GCM.end(), tagLen) == values_GCM.end()) {
+ LOGE(SSF_LIB, "Incorrect tag length %u", tagLen);
+ return TEE_ERROR_NOT_SUPPORTED;
+ }
}
case TEE_ALG_AES_CCM: {
- switch (tagLen) {
- case 128:
- case 112:
- case 96:
- case 64:
- case 48:
- case 32:
- break;
- default:
- LOGE(SSF_LIB, "Incorrect tag length %u", tagLen);
- return TEE_ERROR_NOT_SUPPORTED;
- };
- break;
+ if (std::find(values_CCM.begin(), values_CCM.end(), tagLen) == values_CCM.end()) {
+ LOGE(SSF_LIB, "Incorrect tag length %u", tagLen);
+ return TEE_ERROR_NOT_SUPPORTED;
+ }
}
default: {
LOGE(SSF_LIB, "Incorrect algorithm %x", op->info.algorithm);
//tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_DES:
- //if (maxObjectSize != 64) {
- // return TEE_ERROR_NOT_SUPPORTED;
- //}
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_DES3:
if (maxObjectSize != 128 && maxObjectSize != 192)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_HMAC_MD5:
if (maxObjectSize < 64 || maxObjectSize > 512 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_HMAC_SHA1:
if (maxObjectSize < 80 || maxObjectSize > 512 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_HMAC_SHA224:
if (maxObjectSize < 112 || maxObjectSize > 512 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_HMAC_SHA256:
if (maxObjectSize < 192 || maxObjectSize > 1024 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_HMAC_SHA384:
if (maxObjectSize < 256 || maxObjectSize > 1024 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_HMAC_SHA512:
if (maxObjectSize < 256 || maxObjectSize > 1024 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
case TEE_TYPE_RSA_PUBLIC_KEY:
case TEE_TYPE_RSA_KEYPAIR:
if (maxObjectSize < 256 || maxObjectSize > 4096 || maxObjectSize % 64)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = sizeof(rsa_context);
break;
case TEE_TYPE_DSA_PUBLIC_KEY:
case TEE_TYPE_DSA_KEYPAIR:
if (maxObjectSize < 512 || maxObjectSize > 1024 || maxObjectSize % 64)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = sizeof(dsa_context);
break;
case TEE_TYPE_DH_KEYPAIR:
if (maxObjectSize < 256 || maxObjectSize > 2048)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = sizeof(dh_context);
break;
case TEE_TYPE_GENERIC_SECRET:
if (maxObjectSize > 4096 || maxObjectSize % 8)
return TEE_ERROR_NOT_SUPPORTED;
- //tr->attr.buf_len = (maxObjectSize + 7)>>3;
break;
default:
return TEE_ERROR_NOT_SUPPORTED;
tr->info.objectType = objectType;
tr->info.objectSize = 0;
tr->info.maxObjectSize = maxObjectSize;
- //tr->info.dataSize = 0;
- //tr->info.dataPosition = 0;
- //tr->info.handleFlags = 0;
tr->info.objectUsage = 0xffffffff;
return TEE_SUCCESS;
}
g_po_list.next = &po->po_list;
}
MSG("=====PO %s added=====", po->po_file.file_name);
- //debug_list();
}
void rem_from_po_list(persistent_object* po) {
return;
}
MSG("=====To remove PO %s=====", po->po_file.file_name);
- //debug_list();
if (po->po_list.prev) {
po->po_list.prev->next = po->po_list.next;
}
po->po_list.next->prev = po->po_list.prev;
}
MSG("======PO removed=====");
- //debug_list();
}
po_user* get_po_user_from_po_list(uint32_t storageID, const void* objectID,