2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
21 using System.Runtime.InteropServices;
23 internal static partial class Interop
25 [StructLayout(LayoutKind.Sequential)]
26 internal struct TEEC_Context
28 public readonly IntPtr imp;
31 [StructLayout(LayoutKind.Sequential)]
32 internal struct TEEC_Session
34 public readonly IntPtr imp;
37 [StructLayout(LayoutKind.Sequential)]
38 internal struct TEEC_UUID
40 public UInt32 timeLow;
41 public UInt16 timeMid;
42 public UInt16 timeHiAndVersion;
43 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
44 public byte[] clockSeqAndNode;
46 internal static TEEC_UUID ToTeecUuid(Guid guid)
48 TEEC_UUID uuid = new TEEC_UUID();
49 byte[] bin = guid.ToByteArray();
50 uuid.timeLow = BitConverter.ToUInt32(bin, 0);
51 uuid.timeMid = BitConverter.ToUInt16(bin, 4);
52 uuid.timeHiAndVersion = BitConverter.ToUInt16(bin, 6);
53 uuid.clockSeqAndNode = new byte[8];
54 Array.Copy(bin, 8, uuid.clockSeqAndNode, 0, 8);
59 [StructLayout(LayoutKind.Sequential)]
60 internal struct sTEEC_SharedMemoryImp
62 public IntPtr context;
63 public IntPtr context_imp;
68 [StructLayout(LayoutKind.Sequential)]
69 internal struct TEEC_SharedMemory
76 [StructLayout(LayoutKind.Sequential)]
77 internal struct TEEC_Parameter
83 [StructLayout(LayoutKind.Sequential)]
84 internal struct TEEC_Operation
86 public UInt32 started;
87 public UInt32 paramTypes;
88 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
89 public TEEC_Parameter[] paramlist;