Exemplo n.º 1
0
Arquivo: main.c Projeto: turnage/Charl
/**
 *  Call module tests with verbose reporting.
 */
int test (void)
{
        int report, count = 0;

        printf("\nPerforming tests\n");
        printf("-----------------------------------------------------------\n");

        printf("Crypto module......................................");
        if (!(report = crypto_test()))
                printf("....[OK]\n");
        else {
                printf("[%6d]\n", report);
                count += 1;
        }

        printf("Client module......................................");
        if (!(report = client_test()))
                printf("....[OK]\n");
        else {
                printf("[%6d]\n", report);
                count += 1;
        }

        printf("Parser module......................................");
        if (!(report = parser_test()))
                printf("....[OK]\n");
        else {
                printf("[%6d]\n", report);
                count += 1;
        }

        printf("-----------------------------------------------------------\n");

        return count;
}
Exemplo n.º 2
0
void up_cryptoinitialize(void)
{
#if defined(CONFIG_CRYPTO_AES) || defined(CONFIG_CRYPTO_ALGTEST)
  int res;

#ifdef CONFIG_CRYPTO_AES
  res = up_aesinitialize();
  if (res)
    {
      return res;
    }
#endif

#if CONFIG_CRYPTO_ALGTEST
  res = crypto_test();
  if (res)
    {
      cryptlldbg("crypto test failed\n");
    }
  else
    {
      cryptllvdbg("crypto test OK\n");
    }
#endif

  return res;
#else
  return OK;
#endif
}
Exemplo n.º 3
0
TEE_Result TA_EXPORT TA_InvokeCommandEntryPoint(void *sessionContext,
						uint32_t commandID,
						uint32_t paramTypes,
						TEE_Param params[4])
{
	TEE_Result tee_rv = TEE_SUCCESS;

	/* Check session context */
	if (TEE_MemCompare(sessionContext, out_vector, SIZE_OF_VEC(out_vector))) {
		OT_LOG(LOG_ERR, "Not a correct session context");
		return TEE_ERROR_GENERIC;
	}

	if (!(commandID == INVOKE_CMD_ID_1 ||
	      commandID == INVOKE_CMD_ID_2)) {
		OT_LOG(LOG_ERR, "Not a valid command ID");
		return TEE_ERROR_BAD_PARAMETERS;
	}

	tee_rv = handle_params(paramTypes, params);
	if (tee_rv != TEE_SUCCESS)
		return tee_rv;

	if (storage_test(2))
		return TEE_ERROR_GENERIC;

	if (crypto_test(2))
		return TEE_ERROR_GENERIC;

	return TEE_SUCCESS;
}
Exemplo n.º 4
0
TEE_Result TA_EXPORT TA_OpenSessionEntryPoint(uint32_t paramTypes,
					      TEE_Param params[4],
					      void **sessionContext)
{
	TEE_Result tee_rv = TEE_SUCCESS;

	OT_LOG(LOG_INFO, "Calling the Open session entry point");

	tee_rv = handle_params(paramTypes, params);
	if (tee_rv != TEE_SUCCESS)
		return tee_rv;

	if (storage_test(2))
		return TEE_ERROR_GENERIC;

	if (crypto_test(2))
		return TEE_ERROR_GENERIC;

	if (*sessionContext != NULL) {
		OT_LOG(LOG_ERR, "Session context should be NULL");
		return TEE_ERROR_BAD_PARAMETERS;
	}

	*sessionContext = TEE_Malloc(SIZE_OF_VEC(out_vector), 0);
	if (*sessionContext == NULL) {
		OT_LOG(LOG_ERR, "Can not malloc space for session context");
		return TEE_ERROR_OUT_OF_MEMORY;
	}

	TEE_MemMove(*sessionContext, out_vector, SIZE_OF_VEC(out_vector));

	return tee_rv;
}
Exemplo n.º 5
0
void TA_EXPORT TA_DestroyEntryPoint(void)
{
	OT_LOG(LOG_INFO, "Calling the Destroy entry point");

	if (storage_test(2))
		TEE_Panic(TEE_ERROR_GENERIC);

	if (crypto_test(2))
		TEE_Panic(TEE_ERROR_GENERIC);
}
Exemplo n.º 6
0
TEE_Result TA_EXPORT TA_CreateEntryPoint(void)
{
	OT_LOG(LOG_INFO, "Calling the create entry point");

	if (storage_test(2))
		return TEE_ERROR_GENERIC;

	if (crypto_test(2))
		return TEE_ERROR_GENERIC;

	return TEE_SUCCESS;
}
Exemplo n.º 7
0
void TA_EXPORT TA_CloseSessionEntryPoint(void *sessionContext)
{
	OT_LOG(LOG_INFO, "Calling the Close session entry point");

	if (storage_test(2))
		TEE_Panic(TEE_ERROR_GENERIC);

	if (crypto_test(2))
		TEE_Panic(TEE_ERROR_GENERIC);

	/* Check session context */
	if (TEE_MemCompare(sessionContext, out_vector, SIZE_OF_VEC(out_vector))) {
		OT_LOG(LOG_ERR, "Not a correct session context");
		TEE_Panic(TEE_ERROR_GENERIC);
	}

	TEE_Free(sessionContext);
}