From c9e3bd04dceeb8ea4975546783bf616c13dd401f Mon Sep 17 00:00:00 2001 From: Krzysztof Dynowski Date: Mon, 22 May 2017 13:27:41 +0200 Subject: [PATCH] add SetData/GetData exceptions, fix Flags InOut contsruction, no Exceptions for Dispose Change-Id: I64198c56feb1a7d23a703173c9ccf84537cc135d --- src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs b/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs index 9e3229a..0031276 100644 --- a/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs +++ b/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs @@ -94,7 +94,7 @@ namespace Tizen.Security.TEEC /// A flag indicates Shared Memory can be written. Output = 0x00000002, /// A flag indicates Shared Memory can be read and written. - InOut = 0x00000003, + InOut = Input | Output, } /// @@ -133,8 +133,10 @@ namespace Tizen.Security.TEEC /// 4 /// Source data buffer to copy data from /// Starting offset in source shared memory + /// The operation is invalid. public void SetData(byte[] data, int dstOffs) { + if ((shm.flags & (uint)SharedMemoryFlags.Output) == 0) throw new InvalidOperationException("No write access"); //TODO copy data into shared memory starting at given offset } /// @@ -144,8 +146,10 @@ namespace Tizen.Security.TEEC /// 4 /// Destination data buffer to copy data into /// Starting offset in destination shared memory + /// The operation is invalid. public void GetData(byte[] data, int srcOffs) { + if ((shm.flags & (uint)SharedMemoryFlags.Input) == 0) throw new InvalidOperationException("No read access"); //TODO copy data from shared memory starting at given offset } }; @@ -426,9 +430,6 @@ namespace Tizen.Security.TEEC /// http://tizen.org/privilege/tee.client /// partner /// http://tizen.org/feature/security.tee - /// Thrown when application does not have privilege to access this method. - /// The required feature is not supported. - /// The operation is invalid. public void Dispose() { Interop.Libteec.FinalizeContext(ref context); //context.imp = null; -- 2.7.4