Esempio n. 1
0
/*===========================================================================*
 *				hgfs_init				     *
 *===========================================================================*/
PUBLIC int hgfs_init()
{
/* Initialize the library. Return OK on success, or a negative error code
 * otherwise. If EAGAIN is returned, shared folders are disabled; in that
 * case, other operations may be tried (and possibly succeed).
 */

  time_init();

  return rpc_open();
}
Esempio n. 2
0
/*---------------------------------------------------------------------------*/
HG_TEST_RPC_CB(hg_test_rpc_open, handle)
{
    hg_return_t ret = HG_SUCCESS;

    rpc_open_in_t  in_struct;
    rpc_open_out_t out_struct;

    hg_const_string_t path;
    rpc_handle_t rpc_handle;
    int event_id;
    int open_ret;

    /* Get input buffer */
    ret = HG_Get_input(handle, &in_struct);
    if (ret != HG_SUCCESS) {
        fprintf(stderr, "Could not get input\n");
        return ret;
    }

    /* Get parameters */
    path = in_struct.path;
    rpc_handle = in_struct.handle;

    /* Call rpc_open */
    open_ret = rpc_open(path, rpc_handle, &event_id);

    /* Fill output structure */
    out_struct.event_id = event_id;
    out_struct.ret = open_ret;

    /* Send response back */
    ret = HG_Respond(handle, NULL, NULL, &out_struct);
    if (ret != HG_SUCCESS) {
        fprintf(stderr, "Could not respond\n");
        return ret;
    }

    HG_Free_input(handle, &in_struct);
    HG_Destroy(handle);

    return ret;
}
Esempio n. 3
0
/* Called when a command is invoked */
TEE_Result TA_InvokeCommandEntryPoint(void *pSessionContext,
				      uint32_t nCommandID, uint32_t nParamTypes,
				      TEE_Param pParams[4])
{
	(void)pSessionContext;

	switch (nCommandID) {
	case TA_RPC_CMD_CRYPT_SHA224:
		return rpc_sha224(false, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_SHA256:
		return rpc_sha256(false, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_AES256ECB_ENC:
		return rpc_aes256ecb_encrypt(false, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_AES256ECB_DEC:
		return rpc_aes256ecb_decrypt(false, nParamTypes, pParams);

	case TA_RPC_CMD_OPEN:
		return rpc_open(pSessionContext, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_PRIVMEM_SHA224:
		return rpc_sha224(true, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_PRIVMEM_SHA256:
		return rpc_sha256(true, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_PRIVMEM_AES256ECB_ENC:
		return rpc_aes256ecb_encrypt(true, nParamTypes, pParams);

	case TA_RPC_CMD_CRYPT_PRIVMEM_AES256ECB_DEC:
		return rpc_aes256ecb_decrypt(true, nParamTypes, pParams);

	default:
		return TEE_ERROR_BAD_PARAMETERS;
	}
}