Exemple #1
0
        /// <summary>
        /// This function allocates a new block of memory as a block of shared memory within the scope of the
        /// specified context, in accordance with the parameters.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="size">The size of shared memory.</param>
        /// <param name="flags">The flags describing access modes (Input and/or Output).</param>
        /// <returns>Returns the Shared Memory handler.</returns>
        /// <privilege>http://tizen.org/privilege/tee.client</privilege>
        /// <privlevel>partner</privlevel>
        /// <feature>http://tizen.org/feature/security.tee</feature>
        /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
        /// <exception cref="InvalidOperationException">The operation is invalid.</exception>
        public SharedMemory AllocateSharedMemory(UInt32 size, SharedMemoryFlags flags)
        {
            SharedMemory sharedmem = new SharedMemory(this);

            Interop.TEEC_SharedMemory shm = new Interop.TEEC_SharedMemory();
            shm.size  = (UIntPtr)size;
            shm.flags = (UInt32)flags;
            int ret = Interop.Libteec.AllocateSharedMemory(context_imp, ref shm);

            Interop.CheckNThrowException(ret, "AllocateSharedMemory");
            sharedmem.setShm(ref shm);
            return(sharedmem);
        }
Exemple #2
0
        /// <summary>
        /// This function registers a block of the existing client application memory as a block of shared memory within
        /// the scope of the specified context, in accordance with the parameters.
        /// The input <paramref name="memaddr"/> must point to the shared memory region to register.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="memaddr">The address of the shared memory.</param>
        /// <param name="size">The size of the shared memory.</param>
        /// <param name="flags">The flags describing the access modes (Input and/or Output).</param>
        /// <returns>Returns the SharedMemory handler.</returns>
        /// <privilege>http://tizen.org/privilege/tee.client</privilege>
        /// <privlevel>partner</privlevel>
        /// <feature>http://tizen.org/feature/security.tee</feature>
        /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
        /// <exception cref="InvalidOperationException">The operation is invalid.</exception>
        /// <exception cref="ArgumentException">The argument <paramref name="memaddr"/> is wrong.</exception>
        public SharedMemory RegisterSharedMemory(IntPtr memaddr, UInt32 size, SharedMemoryFlags flags)
        {
            SharedMemory sharedmem = new SharedMemory(this);

            Interop.TEEC_SharedMemory shm = new Interop.TEEC_SharedMemory();
            shm.buffer = memaddr;
            shm.size   = (UIntPtr)size;
            shm.flags  = (UInt32)flags;
            int ret = Interop.Libteec.RegisterSharedMemory(context_imp, ref shm);

            Interop.CheckNThrowException(ret, "RegisterSharedMemory");
            sharedmem.setShm(ref shm);
            return(sharedmem);
        }