From: Krzysztof Dynowski Date: Mon, 22 May 2017 11:27:41 +0000 (+0200) Subject: add SetData/GetData exceptions, fix Flags InOut contsruction, no Exceptions for Dispose X-Git-Tag: submit/tizen/20170522.142430^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15c72f6118e4d3958c0bb52e5f970d7a34c898da;p=platform%2Fcore%2Fcsapi%2Flibteec.git add SetData/GetData exceptions, fix Flags InOut contsruction, no Exceptions for Dispose Change-Id: I64198c56feb1a7d23a703173c9ccf84537cc135d --- diff --git a/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs b/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs index 9e3229a..0031276 100644 --- a/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs +++ b/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;