void TEE_StartPropertyEnumerator(TEE_PropSetHandle enumerator,\r
TEE_PropSetHandle propSet) {\r
PropertyEnumHandle *newEnumHandle = (PropertyEnumHandle*)enumerator;\r
- switch ((uint32_t)propSet) {\r
+ switch ((intptr_t)propSet) {\r
case TEE_PROPSET_CURRENT_TA: {\r
newEnumHandle->property = new TAProperty(\r
string(TEE_TASTORE_ROOT) + thisTAUUIDGlobal + "-ext/"\r
\r
Property* _GetTargetProperty(TEE_PropSetHandle propsetOrEnumerator) {\r
Property *targetProperty = NULL;\r
- switch ((uint32_t)propsetOrEnumerator) {\r
+ switch ((intptr_t)propsetOrEnumerator) {\r
case TEE_PROPSET_TEE_IMPLEMENTATION: {\r
targetProperty = teeProperty;\r
break;\r
Package=$2
TOOLCHAIN=$3
+CA_SIMULATOR_LIB=$Package/CA/simulator/usr/lib/
+TA_SIMULATOR_LIB=$Package/TA/simulator/usr/lib/
+
#check error case
check_make_error()
{
make TOOLCHAIN=$TOOLCHAIN
check_make_error
echo "Copying libteec.so in Package"
-cp libteec2.so $Package/CA/simulator/usr/lib/
+mkdir -p $CA_SIMULATOR_LIB
+cp libteec2.so $CA_SIMULATOR_LIB
check_make_error
cd $DIR
}
make TOOLCHAIN=$TOOLCHAIN
check_make_error
echo "Copying libssflib.so in Package"
-cp libssflib.so $Package/TA/simulator/usr/lib/
+mkdir -p $TA_SIMULATOR_LIB
+cp libssflib.so $TA_SIMULATOR_LIB
check_make_error
cd $DIR
}
make TOOLCHAIN=$TOOLCHAIN
check_make_error
echo "Copying libTEEStub.a in Package"
-cp libTEEStub.a $Package/TA/simulator/usr/lib/
+mkdir -p $TA_SIMULATOR_LIB
+cp libTEEStub.a $TA_SIMULATOR_LIB
check_make_error
cd $DIR
}
make TOOLCHAIN=$TOOLCHAIN
check_make_error
echo "Copying SimulatorDaemon in Package"
-cp SimulatorDaemon $Package/CA/simulator/usr/lib/
+mkdir -p $CA_SIMULATOR_LIB
+cp SimulatorDaemon $CA_SIMULATOR_LIB
check_make_error
cd $DIR
}
./dep/cryptocore/source/base/cc_sha2.d \
./dep/cryptocore/source/base/cc_snow2.d
+C_FLAGS += -fPIC
# Each subdirectory must supply rules for building sources it contributes
dep/cryptocore/source/base/%.o: $(SSFLIB_SOURCE)/dep/cryptocore/source/base/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
./dep/cryptocore/source/middle/cc_symmetric.d \
./dep/cryptocore/source/middle/cc_tdes.d
+C_FLAGS += -fPIC
# Each subdirectory must supply rules for building sources it contributes
dep/cryptocore/source/middle/%.o: $(SSFLIB_SOURCE)/dep/cryptocore/source/middle/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
C_DEPS += \
./dep/cryptocore/source/CC_API.d
+C_FLAGS += -fPIC
+
# Each subdirectory must supply rules for building sources it contributes
dep/cryptocore/source/%.o: $(SSFLIB_SOURCE)/dep/cryptocore/source/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
./dep/swdss/source/ss_misc.d \
./dep/swdss/source/ss_temp_store.d
+C_FLAGS += -fPIC
# Each subdirectory must supply rules for building sources it contributes
dep/swdss/source/%.o: $(SSFLIB_SOURCE)/dep/swdss/source/%.cpp
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
CPP_DEPS += \
./dep/time/ssf_time.d
+C_FLAGS += -fPIC
# Each subdirectory must supply rules for building sources it contributes
dep/time/%.o: $(SSFLIB_SOURCE)/dep/time/%.cpp
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
./dep/uci/source/uci_cryptocore.d \
./dep/uci/source/uci_hwcrypto.d
+C_FLAGS += -fPIC
# Each subdirectory must supply rules for building sources it contributes
dep/uci/source/%.o: $(SSFLIB_SOURCE)/dep/uci/source/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
./src/ssf_taentrypoint.d \
./src/app_debug.d
+C_FLAGS += -fPIC
+
# Each subdirectory must supply rules for building sources it contributes
src/%.o: $(SSFLIB_SOURCE)/src/%.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
- $(TOOLCHAIN)g++ -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
+ $(TOOLCHAIN)g++ $(C_FLAGS) -D_SECOS_SIM_ -D__DEBUG__ -I"$(HOME)/ssflib/dep/cryptocore/include" -I"$(HOME)/log" -I"$(HOME)/osal" -I"$(HOME)/include/include" -I"$(HOME)/ssflib/dep/cryptocore/include/base" -I"$(HOME)/ssflib/dep/cryptocore/include/middle" -I"$(HOME)/ssflib/dep/swdss/include" -I"$(HOME)/ssflib/dep/uci/include" -I"$(HOME)/ssflib/inc" -I$(INCLUDE) -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
#ifndef _CC_TYPE_H_
#define _CC_TYPE_H_
+#include <stdint.h>
/*! @brief 1-byte data type */
-typedef unsigned char cc_u8;
+typedef uint8_t cc_u8;
/*! @brief 2-byte data type */
-typedef unsigned short cc_u16;
+typedef uint16_t cc_u16;
/*! @brief 4-byte data type */
-typedef unsigned int cc_u32;
+typedef uint32_t cc_u32;
#ifndef _OP64_NOTSUPPORTED
#ifdef _WIN32
typedef unsigned __int64 cc_u64;
#else
- typedef unsigned long long cc_u64;
+ typedef uint64_t cc_u64;
#endif //_WIN32
#endif //_OP64_NOTSUPPORTED
#endif //_CC_TYPE_H_
-/***************************** End of File *****************************/
\ No newline at end of file
+/***************************** End of File *****************************/
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
+typedef unsigned long uint64_t;
typedef uint8_t CBT_OCTET;
typedef uint8_t* CBT_OCTET_PTR;
typedef uint32_t CBT_UINT32;
int xcbc_init(aes_xcbc_state *xcbc, unsigned char *key, unsigned int keylen);
int xcbc_process(aes_xcbc_state *xcbc, unsigned char *in, unsigned int inlen);
-int xcbc_done(aes_xcbc_state *xcbc, unsigned char *out, unsigned int *outlen);
+int xcbc_done(aes_xcbc_state *xcbc, unsigned char *out, size_t *outlen);
#ifdef __cplusplus
}
* @retval UCI_ERROR if output is NULL.
*/
int uci_mac_final(UCI_HANDLE oh, unsigned char *output,
- unsigned int *output_len);
+ size_t *output_len);
/**
* @brief generate c-mac code
* @retval UCI_ERROR input or output is NULL..
*/
int uci_ae_encrypt(UCI_HANDLE oh, unsigned char * input, unsigned int input_len,
- unsigned char * output, unsigned int* output_len);
+ unsigned char * output, size_t* output_len);
/**
* @brief RSA Decryption
* @retval UCI_ERROR input or output is NULL.
*/
int uci_ae_decrypt(UCI_HANDLE oh, unsigned char * input, unsigned int input_len,
- unsigned char * output, unsigned int* output_len);
+ unsigned char * output, size_t* output_len);
/**
* @brief RSA Decryption using CRT
* @retval UCI_ERROR if hash or signature is NULL.
*/
int uci_ds_sign(UCI_HANDLE oh, unsigned char * hash, unsigned int hash_len,
- unsigned char * signature, unsigned int* sign_len);
+ unsigned char * signature, size_t* sign_len);
/**
* @brief generate signature for given value
int uci_authcrypt_update_aad(UCI_HANDLE oh, unsigned char *aad,
unsigned int aad_len);
int uci_authcrypt_update(UCI_HANDLE oh, unsigned char *src,
- unsigned int src_len, unsigned char *dest, unsigned int *dest_len);
+ unsigned int src_len, unsigned char *dest, size_t *dest_len);
int uci_authcrypt_encryptfinal(UCI_HANDLE oh, unsigned char *src,
- unsigned int src_len, unsigned char *dest, unsigned int *dest_len,
- unsigned char *tag, unsigned int *tag_len);
+ unsigned int src_len, unsigned char *dest, size_t *dest_len,
+ unsigned char *tag, size_t *tag_len);
int uci_authcrypt_decryptfinal(UCI_HANDLE oh, unsigned char *src,
- unsigned int src_len, unsigned char *dest, unsigned int *dest_len,
+ unsigned int src_len, unsigned char *dest, size_t *dest_len,
unsigned char *tag, unsigned int tag_len);
/**
*/
int cryptocore_mac_final(UCI_HANDLE oh, unsigned char *output,
- unsigned int *output_len);
+ size_t *output_len);
/**
* @brief generate c-mac code
*/
int cryptocore_ae_encrypt(UCI_HANDLE oh, unsigned char * input,
- unsigned int input_len, unsigned char * output, unsigned int* output_len);
+ unsigned int input_len, unsigned char * output, size_t* output_len);
/**
* @brief RSA Decryption
* @retval UCI_ERROR other error occured.
*/
int cryptocore_ae_decrypt(UCI_HANDLE oh, unsigned char * input,
- unsigned int input_len, unsigned char * output, unsigned int* output_len);
+ unsigned int input_len, unsigned char * output, size_t* output_len);
/**
* @brief RSA Decryption using CRT
* @retvla UCI_ERROR other error occured.
*/
int cryptocore_ae_decryptbycrt(UCI_HANDLE oh, unsigned char * input,
- unsigned int input_len, unsigned char * output, unsigned int* output_len);
+ unsigned int input_len, unsigned char * output, size_t* output_len);
/**
* @brief generate signature for given value
* @retval UCI_ERROR other error occured.
*/
int cryptocore_ds_sign(UCI_HANDLE oh, unsigned char * hash,
- unsigned int hash_len, unsigned char * signature, unsigned int* sign_len);
+ unsigned int hash_len, unsigned char * signature, size_t* sign_len);
/**
* @brief generate signature for given value
* @brief UCI handle.
*
*/
-typedef int UCI_HANDLE;
+typedef intptr_t UCI_HANDLE;
/**
* @brief UCI return error type.
*
}
return 1;
}
-int xcbc_done(aes_xcbc_state *xcbc, unsigned char *out, unsigned int *outlen) {
+int xcbc_done(aes_xcbc_state *xcbc, unsigned char *out, size_t *outlen) {
unsigned int x;
if (xcbc == NULL || out == NULL) {
return 0;
ctx = (uci_context_s*)OsaMalloc(sizeof(uci_context_s));
ctx->imp = (aes_xcbc_state *)OsaMalloc(sizeof(aes_xcbc_state));
ctx->alg = ID_UCI_XCBCMAC;
- return (int)ctx;
+ return (UCI_HANDLE)ctx;
}
if (conf == UCI_SW_CRYPTOCORE) {
return cryptocore_context_alloc(algorithm);
}
int uci_mac_final(UCI_HANDLE oh, unsigned char *output,
- unsigned int *output_len) {
+ size_t *output_len) {
int ret = 0;
uci_context_s *pctx = (uci_context_s*)oh;
if (pctx->alg == ID_UCI_XCBCMAC) {
int uci_mac_get_mac(UCI_HANDLE oh, unsigned char *key, unsigned int key_len,
unsigned char *msg, unsigned int msg_len, unsigned char *output,
- unsigned int *output_len) {
- //int ret = 0;
+ size_t *output_len) {
+ int ret = 0;
uci_context_s *pctx = (uci_context_s*)oh;
if (pctx->alg == ID_UCI_XCBCMAC) {
if (xcbc_init((aes_xcbc_state *)(pctx->imp), key, key_len) != 1) {
return UCI_SUCCESS;
}
- return cryptocore_mac_getmac(oh, key, key_len, msg, msg_len, output,
- output_len);
+ unsigned int uioutput_len = (unsigned int)(*output_len);
+ ret = cryptocore_mac_getmac(oh, key, key_len, msg, msg_len, output,
+ &uioutput_len);
+ *output_len = (size_t)uioutput_len;
+ return ret;
}
int uci_se_init(UCI_HANDLE oh, unsigned int mode, unsigned padding,
}
int uci_ae_encrypt(UCI_HANDLE oh, unsigned char *input, unsigned int input_len,
- unsigned char *output, unsigned int *output_len) {
+ unsigned char *output, size_t *output_len) {
return cryptocore_ae_encrypt(oh, input, input_len, output, output_len);
}
int uci_ae_decrypt(UCI_HANDLE oh, unsigned char *input, unsigned int input_len,
- unsigned char *output, unsigned int *output_len) {
+ unsigned char *output, size_t *output_len) {
return cryptocore_ae_decrypt(oh, input, input_len, output, output_len);
}
int uci_ae_decryptbycrt(UCI_HANDLE oh, unsigned char *input,
- unsigned int input_len, unsigned char *output, unsigned int *output_len) {
+ unsigned int input_len, unsigned char *output, size_t *output_len) {
return cryptocore_ae_decryptbycrt(oh, input, input_len, output, output_len);
}
}
int uci_ds_sign(UCI_HANDLE oh, unsigned char *hash, unsigned int hash_len,
- unsigned char *signature, unsigned int *sign_len) {
+ unsigned char *signature, size_t *sign_len) {
return cryptocore_ds_sign(oh, hash, hash_len, signature, sign_len);
}
return UCI_ERROR;
}
int uci_authcrypt_update(UCI_HANDLE oh, unsigned char *src,
- unsigned int src_len, unsigned char *dest, unsigned int *dest_len) {
+ unsigned int src_len, unsigned char *dest, size_t *dest_len) {
#if 0
uci_context_s *pctx = (uci_context_s*)oh;
gcm_context *gctx;
return UCI_ERROR;
}
int uci_authcrypt_encryptfinal(UCI_HANDLE oh, unsigned char *src,
- unsigned int src_len, unsigned char *dest, unsigned int *dest_len,
- unsigned char *tag, unsigned int *tag_len) {
+ unsigned int src_len, unsigned char *dest, size_t *dest_len,
+ unsigned char *tag, size_t *tag_len) {
#if 0
uci_context_s *pctx = (uci_context_s*)oh;
gcm_context *gctx = NULL;
return UCI_ERROR;
}
int uci_authcrypt_decryptfinal(UCI_HANDLE oh, unsigned char *src,
- unsigned int src_len, unsigned char *dest, unsigned int *dest_len,
+ unsigned int src_len, unsigned char *dest, size_t *dest_len,
unsigned char *tag, unsigned int tag_len) {
#if 0
uci_context_s *pctx = (uci_context_s*)oh;
}
int cryptocore_mac_final(UCI_HANDLE oh, unsigned char *output,
- unsigned int *output_len) {
+ size_t *output_len) {
int ret;
uci_context_s *pctx = (uci_context_s*)oh;
if (pctx == NULL) {
return UCI_INVALID_HANDLE;
}
+ cc_u32 output_len32 = (cc_u32)(*output_len);
ret = ((CryptoCoreContainer *)pctx->imp)->MAC_final(
- (CryptoCoreContainer*)(pctx->imp), output, output_len);
+ (CryptoCoreContainer*)(pctx->imp), output, &output_len32);
+ *output_len = (size_t)output_len32;
+
if (ret != CRYPTO_SUCCESS) {
return UCI_ERROR;
}
}
int cryptocore_ae_encrypt(UCI_HANDLE oh, unsigned char *input,
- unsigned int input_len, unsigned char *output, unsigned int *output_len) {
+ unsigned int input_len, unsigned char *output, size_t *output_len) {
int ret;
uci_context_s *pctx = (uci_context_s*)oh;
if (pctx->alg < ID_UCI_RSA || pctx->alg > ID_UCI_RSA512) {
return UCI_INVALID_HANDLE;
}
+
+ cc_u32 output_len32 = (cc_u32)(*output_len);
ret = ((CryptoCoreContainer *)pctx->imp)->AE_encrypt(
- ((CryptoCoreContainer*)pctx->imp), input, input_len, output, output_len);
+ ((CryptoCoreContainer*)pctx->imp), input, input_len, output, &output_len32);
+ *output_len = (size_t)output_len32;
if (ret == CRYPTO_MSG_TOO_LONG) {
return UCI_MSG_TOO_LONG;
}
}
int cryptocore_ae_decrypt(UCI_HANDLE oh, unsigned char *input,
- unsigned int input_len, unsigned char *output, unsigned int *output_len) {
+ unsigned int input_len, unsigned char *output, size_t *output_len) {
int ret;
uci_context_s *pctx = (uci_context_s*)oh;
if (pctx->alg < ID_UCI_RSA || pctx->alg > ID_UCI_RSA512) {
return UCI_INVALID_HANDLE;
}
+
+ cc_u32 output_len32 = (cc_u32)(*output_len);
ret = ((CryptoCoreContainer *)pctx->imp)->AE_decrypt(
- ((CryptoCoreContainer*)pctx->imp), input, input_len, output, output_len);
+ ((CryptoCoreContainer*)pctx->imp), input, input_len, output, &output_len32);
+ *output_len = (size_t)output_len32;
+
if (ret == CRYPTO_MSG_TOO_LONG) {
return UCI_MSG_TOO_LONG;
}
}
int cryptocore_ds_sign(UCI_HANDLE oh, unsigned char *hash,
- unsigned int hash_len, unsigned char *signature, unsigned int *sign_len) {
+ unsigned int hash_len, unsigned char *signature, size_t *sign_len) {
int ret;
uci_context_s *pctx = (uci_context_s*)oh;
return UCI_INVALID_HANDLE;
}
+ cc_u32 sign_len32 = (cc_u32)(*sign_len);
ret = ((CryptoCoreContainer *)pctx->imp)->DS_sign(
- ((CryptoCoreContainer*)pctx->imp), hash, hash_len, signature, sign_len);
+ ((CryptoCoreContainer*)pctx->imp), hash, hash_len, signature, &sign_len32);
+ *sign_len = (size_t)sign_len32;
if (ret == CRYPTO_MSG_TOO_LONG) {
return UCI_MSG_TOO_LONG;
}
unsigned char pub[384];
unsigned char priv[384];
unsigned char module[384];
- unsigned int pubLen = 384;
- unsigned int privLen = 384;
- unsigned int moduleLen = 384;
+ size_t pubLen = 384;
+ size_t privLen = 384;
+ size_t moduleLen = 384;
unsigned int alg;
memset(&ucikey, 0, sizeof(uci_key_s));
memset(&uciparam, 0, sizeof(uci_param_s));
uciparam.ucip_rsa_padding = ID_UCI_NO_PADDING;
break;
}
+ size_t obj_size = (size_t)(key->info.objectSize);
switch (key->info.objectType) {
case TEE_TYPE_RSA_PUBLIC_KEY:
case TEE_TYPE_RSA_KEYPAIR:
uciparam.ucip_dsa_g_len = key->info.objectSize;
uciparam.ucip_dsa_q_len = key->info.objectSize;
rc = TEE_GetObjectBufferAttribute(key, TEE_ATTR_DSA_PRIME,
- uciparam.ucip_dsa_p, &uciparam.ucip_dsa_p_len);
+ uciparam.ucip_dsa_p, &obj_size);
if (rc != TEE_SUCCESS) {
OsaFree(uciparam.ucip_dsa_p);
OsaFree(uciparam.ucip_dsa_q);
return rc;
}
rc = TEE_GetObjectBufferAttribute(key, TEE_ATTR_DSA_BASE,
- uciparam.ucip_dsa_g, &uciparam.ucip_dsa_g_len);
+ uciparam.ucip_dsa_g, &obj_size);
if (rc != TEE_SUCCESS) {
OsaFree(uciparam.ucip_dsa_p);
OsaFree(uciparam.ucip_dsa_q);
return rc;
}
rc = TEE_GetObjectBufferAttribute(key, TEE_ATTR_DSA_SUBPRIME,
- uciparam.ucip_dsa_q, &uciparam.ucip_dsa_q_len);
+ uciparam.ucip_dsa_q, &obj_size);
if (rc != TEE_SUCCESS) {
OsaFree(uciparam.ucip_dsa_p);
OsaFree(uciparam.ucip_dsa_q);
key->info.objectSize);
uciparam.ucip_dh_len = key->info.objectSize;
rc = TEE_GetObjectBufferAttribute(key, TEE_ATTR_DH_PRIME,
- uciparam.ucip_dh_prime, &uciparam.ucip_dh_len);
+ uciparam.ucip_dh_prime, &obj_size);
if (rc != TEE_SUCCESS) {
OsaFree(uciparam.ucip_dh_prime);
OsaFree(uciparam.ucip_dh_generator);
return rc;
}
rc = TEE_GetObjectBufferAttribute(key, TEE_ATTR_DH_BASE,
- uciparam.ucip_dh_generator, &uciparam.ucip_dh_len);
+ uciparam.ucip_dh_generator, &obj_size);
if (rc != TEE_SUCCESS) {
OsaFree(uciparam.ucip_dh_prime);
OsaFree(uciparam.ucip_dh_generator);
unsigned int mode;
unsigned char key1[32] = {0x0, };
//unsigned char key2[32] = {0x0, };
- unsigned int key_len1 = sizeof(key1);
+ size_t key_len1 = sizeof(key1);
//unsigned int key_len2 = sizeof(key2);
- unsigned int uci_alg;
+ size_t uci_alg;
TEE_Result rc;
struct TEE_Operation * op = (struct TEE_Operation*)operation;
unsigned char authkey[512];
unsigned char privkey[512];
unsigned char *pubkey = NULL;
- unsigned int pubkey_len = 0;
- unsigned int privkey_len = sizeof(privkey);
+ size_t pubkey_len = 0;
+ size_t privkey_len = sizeof(privkey);
TEE_Attribute attrs[1];
TEE_Result rc;
struct TEE_Operation * op = (struct TEE_Operation*)operation;