[Mono.Security]: Remove some unused `Mono.Security.Interface` classes. (#5509)
authorMartin Baulig <mabaul@microsoft.com>
Wed, 6 Sep 2017 18:56:11 +0000 (14:56 -0400)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 6 Sep 2017 18:56:11 +0000 (20:56 +0200)
* [Mono.Security]: Remove some unused `Mono.Security.Interface` classes.

* Mono.Security.Interface: removed `IBufferOffsetSize` and `BufferOffsetSize`
  (these were not general-purpose BOS APIs, but depend on the internal
  `SecretParameters` class).

* Mono.Security.Interface: removed `SecretParameters`, `SecureBuffer`,
  `IMonoTlsEventSink`, `TlsBuffer` and `TlsMultiBuffer`.

* Bump API snapshot submodule

external/api-snapshot
mcs/class/Mono.Security/Mono.Security-net_4_x.csproj
mcs/class/Mono.Security/Mono.Security.Interface/BufferOffsetSize.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/SecretParameters.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/SecureBuffer.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/TlsBuffer.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.Interface/TlsMultiBuffer.cs [deleted file]
mcs/class/Mono.Security/Mono.Security.dll.sources

index 4dfe97ec246b7ebd2f7b4af378817abf436cf102..08ec62bbd349c042a40f959f242db7a54412e916 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4dfe97ec246b7ebd2f7b4af378817abf436cf102
+Subproject commit 08ec62bbd349c042a40f959f242db7a54412e916
index 3aed1008318cb46e5a3c11fda95fe2bf9de252fb..307bfb4fd111765fbfea4a9d4d7ee4f34b414065 100644 (file)
@@ -90,7 +90,6 @@
     <Compile Include=".\Mono.Security.Cryptography\SymmetricTransform.cs" />\r
     <Compile Include=".\Mono.Security.Cryptography\TlsHMAC.cs" />\r
     <Compile Include=".\Mono.Security.Interface\Alert.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\BufferOffsetSize.cs" />\r
     <Compile Include=".\Mono.Security.Interface\CertificateValidationHelper.cs" />\r
     <Compile Include=".\Mono.Security.Interface\CipherAlgorithmType.cs" />\r
     <Compile Include=".\Mono.Security.Interface\CipherSuiteCode.cs" />\r
     <Compile Include=".\Mono.Security.Interface\HashAlgorithmType.cs" />\r
     <Compile Include=".\Mono.Security.Interface\IBufferOffsetSize.cs" />\r
     <Compile Include=".\Mono.Security.Interface\IMonoSslStream.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\IMonoTlsEventSink.cs" />\r
     <Compile Include=".\Mono.Security.Interface\MonoTlsConnectionInfo.cs" />\r
     <Compile Include=".\Mono.Security.Interface\MonoTlsProvider.cs" />\r
     <Compile Include=".\Mono.Security.Interface\MonoTlsProviderFactory.cs" />\r
     <Compile Include=".\Mono.Security.Interface\MonoTlsSettings.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\SecretParameters.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\SecureBuffer.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\TlsBuffer.cs" />\r
     <Compile Include=".\Mono.Security.Interface\TlsException.cs" />\r
-    <Compile Include=".\Mono.Security.Interface\TlsMultiBuffer.cs" />\r
     <Compile Include=".\Mono.Security.Interface\TlsProtocolCode.cs" />\r
     <Compile Include=".\Mono.Security.Interface\TlsProtocols.cs" />\r
     <Compile Include=".\Mono.Security.Protocol.Ntlm\ChallengeResponse.cs" />\r
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/BufferOffsetSize.cs b/mcs/class/Mono.Security/Mono.Security.Interface/BufferOffsetSize.cs
deleted file mode 100644 (file)
index 7138962..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// BufferOffsetSize.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-
-namespace Mono.Security.Interface
-{
-       public class BufferOffsetSize : SecretParameters, IBufferOffsetSize
-       {
-               public byte[] Buffer {
-                       get;
-                       private set;
-               }
-
-               public int Offset {
-                       get;
-                       internal set;
-               }
-
-               public int Size {
-                       get { return EndOffset - Offset; }
-               }
-
-               public int EndOffset {
-                       get;
-                       internal set;
-               }
-
-               public BufferOffsetSize (byte[] buffer, int offset, int size)
-               {
-                       Buffer = buffer;
-                       Offset = offset;
-                       EndOffset = offset + size;
-               }
-
-               public BufferOffsetSize (byte[] buffer)
-                       : this (buffer, 0, buffer.Length)
-               {
-               }
-
-               public BufferOffsetSize (int size)
-                       : this (new byte [size])
-               {
-               }
-
-               public byte[] GetBuffer ()
-               {
-                       var copy = new byte [Size];
-                       Array.Copy (Buffer, Offset, copy, 0, Size);
-                       return copy;
-               }
-
-               public void TruncateTo (int newSize)
-               {
-                       if (newSize > Size)
-                               throw new ArgumentException ("newSize");
-                       EndOffset = Offset + newSize;
-               }
-
-               protected void SetBuffer (byte[] buffer, int offset, int size)
-               {
-                       Buffer = buffer;
-                       Offset = offset;
-                       EndOffset = offset + size;
-               }
-
-               protected override void Clear ()
-               {
-                       Buffer = null;
-                       Offset = EndOffset = 0;
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs b/mcs/class/Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs
deleted file mode 100644 (file)
index 93b422c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// IBufferOffsetSize.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-namespace Mono.Security.Interface
-{
-       public interface IBufferOffsetSize
-       {
-               byte[] Buffer {
-                       get;
-               }
-
-               int Offset {
-                       get;
-               }
-
-               int Size {
-                       get;
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs b/mcs/class/Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs
deleted file mode 100644 (file)
index 3772930..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// IMonoTlsEventSink.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-
-namespace Mono.Security.Interface
-{
-       public interface IMonoTlsEventSink
-       {
-               void Error (Exception exception);
-
-               void ReceivedCloseNotify ();
-       }
-}
-
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/SecretParameters.cs b/mcs/class/Mono.Security/Mono.Security.Interface/SecretParameters.cs
deleted file mode 100644 (file)
index a225ba6..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-//
-// SecretParameters.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-
-namespace Mono.Security.Interface
-{
-       public abstract class SecretParameters : IDisposable
-       {
-               protected abstract void Clear ();
-
-               bool disposed;
-
-               protected void CheckDisposed ()
-               {
-                       if (disposed)
-                               throw new ObjectDisposedException (GetType ().Name);
-               }
-
-               protected static void Clear (byte[] array)
-               {
-                       Array.Clear (array, 0, array.Length);
-               }
-
-               public void Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
-
-               void Dispose (bool disposing)
-               {
-                       if (!disposed) {
-                               disposed = true;
-                               Clear ();
-                       }
-               }
-
-               ~SecretParameters ()
-               {
-                       Dispose (false);
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/SecureBuffer.cs b/mcs/class/Mono.Security/Mono.Security.Interface/SecureBuffer.cs
deleted file mode 100644 (file)
index fc05f7a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// SecureBuffer.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-
-namespace Mono.Security.Interface
-{
-       public class SecureBuffer : SecretParameters, IBufferOffsetSize
-       {
-               byte[] buffer;
-
-               public byte[] Buffer {
-                       get {
-                               CheckDisposed ();
-                               return buffer;
-                       }
-               }
-
-               public int Size {
-                       get {
-                               CheckDisposed ();
-                               return buffer != null ? buffer.Length : 0;
-                       }
-               }
-
-               int IBufferOffsetSize.Offset {
-                       get { return 0; }
-               }
-
-               public SecureBuffer (int size)
-               {
-                       buffer = new byte [size];
-               }
-
-               public SecureBuffer (byte[] buffer)
-               {
-                       this.buffer = buffer;
-               }
-
-               public byte[] StealBuffer ()
-               {
-                       CheckDisposed ();
-                       var retval = this.buffer;
-                       this.buffer = null;
-                       return retval;
-               }
-
-               public static SecureBuffer CreateCopy (byte[] buffer)
-               {
-                       var copy = new byte [buffer.Length];
-                       Array.Copy (buffer, copy, buffer.Length);
-                       return new SecureBuffer (copy);
-               }
-
-               protected override void Clear ()
-               {
-                       if (buffer != null) {
-                               Array.Clear (buffer, 0, buffer.Length);
-                               buffer = null;
-                       }
-               }
-       }
-}
-
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/TlsBuffer.cs b/mcs/class/Mono.Security/Mono.Security.Interface/TlsBuffer.cs
deleted file mode 100644 (file)
index be3c007..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-//
-// TlsBuffer.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-
-namespace Mono.Security.Interface
-{
-       public class TlsBuffer : SecretParameters
-       {
-               public int Position {
-                       get; set;
-               }
-
-               public int Remaining {
-                       get { return Size - (Position - Offset); }
-               }
-
-               public byte[] Buffer {
-                       get { return innerBuffer.Buffer; }
-               }
-
-               public int Offset {
-                       get { return innerBuffer.Offset; }
-               }
-
-               public int Size {
-                       get { return innerBuffer.Size; }
-               }
-
-               public int EndOffset {
-                       get { return Offset + Size; }
-               }
-
-               IBufferOffsetSize innerBuffer;
-
-               protected TlsBuffer ()
-                       : this (null, 0, 0)
-               {
-               }
-
-               public TlsBuffer (IBufferOffsetSize bos)
-               {
-                       innerBuffer = bos;
-                       Position = bos.Offset;
-               }
-
-               public TlsBuffer (byte[] buffer, int offset, int size)
-                       : this (new BufferOffsetSize (buffer, offset, size))
-               {
-               }
-
-               public TlsBuffer (byte[] buffer)
-                       : this (buffer, 0, buffer.Length)
-               {
-               }
-
-               public TlsBuffer (int size)
-                       : this (new byte [size], 0, size)
-               {
-               }
-
-               public byte ReadByte ()
-               {
-                       if (Position >= EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-                       return Buffer [Position++];
-               }
-
-               public short ReadInt16 ()
-               {
-                       if (Position + 1 >= EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-                       var retval = (short)(Buffer [Position] << 8 | Buffer [Position + 1]);
-                       Position += 2;
-                       return retval;
-               }
-
-               public int ReadInt24 ()
-               {
-                       if (Position + 2 >= EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-                       var retval = ((Buffer [Position] << 16) | (Buffer [Position+1] << 8) | Buffer [Position+2]);
-                       Position += 3;
-                       return retval;
-               }
-
-               public int ReadInt32 ()
-               {
-                       if (Position + 3 >= EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-                       var retval = ((Buffer [Position] << 24) | (Buffer [Position+1] << 16) | (Buffer [Position+2] << 8) | Buffer [Position+3]);
-                       Position += 4;
-                       return retval;
-               }
-
-               public TlsBuffer ReadBuffer (int length)
-               {
-                       if (Position + length > EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-                       var retval = new TlsBuffer (Buffer, Position, length);
-                       Position += length;
-                       return retval;
-               }
-
-               public IBufferOffsetSize GetRemaining ()
-               {
-                       return new BufferOffsetSize (Buffer, Position, Remaining);
-               }
-
-               protected virtual void MakeRoomInternal (int size)
-               {
-                       if (Position + size > EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-               }
-
-               public void Write (byte value)
-               {
-                       MakeRoomInternal (1);
-                       Buffer [Position++] = value;
-               }
-
-               public void Write (short value)
-               {
-                       MakeRoomInternal (2);
-                       WriteInt16 (Buffer, Position, value);
-                       Position += 2;
-               }
-
-               public static void WriteInt16 (byte[] buffer, int offset, short value)
-               {
-                       buffer[offset] = ((byte)(value >> 8));
-                       buffer[offset+1] = ((byte)value);
-               }
-
-               public void Write (int value)
-               {
-                       MakeRoomInternal (4);
-                       WriteInt32 (Buffer, Position, value);
-                       Position += 4;
-               }
-
-               public void WriteInt24 (int value)
-               {
-                       MakeRoomInternal (3);
-                       WriteInt24 (Buffer, Position, value);
-                       Position += 3;
-               }
-
-               #pragma warning disable 3001
-               public void Write (ulong value)
-               #pragma warning restore 3001
-               {
-                       MakeRoomInternal (8);
-                       WriteInt64 (Buffer, Position, value);
-                       Position += 8;
-               }
-
-               public static void WriteInt24 (byte[] buffer, int offset, int value)
-               {
-                       buffer[offset] = ((byte)(value >> 16));
-                       buffer[offset+1] = ((byte)(value >> 8));
-                       buffer[offset+2] = ((byte)value);
-               }
-
-               public static void WriteInt32 (byte[] buffer, int offset, int value)
-               {
-                       buffer[offset] = ((byte)(value >> 24));
-                       buffer[offset+1] = ((byte)(value >> 16));
-                       buffer[offset+2] = ((byte)(value >> 8));
-                       buffer[offset+3] = ((byte)value);
-               }
-
-               #pragma warning disable 3001
-               public static void WriteInt64 (byte[] buffer, int offset, ulong value)
-               #pragma warning restore 3001
-               {
-                       buffer[offset] = (byte) (value >> 56);
-                       buffer[offset+1] = (byte) (value >> 48);
-                       buffer[offset+2] = (byte) (value >> 40);
-                       buffer[offset+3] = (byte) (value >> 32);
-                       buffer[offset+4] = (byte) (value >> 24);
-                       buffer[offset+5] = (byte) (value >> 16);
-                       buffer[offset+6] = (byte) (value >> 8);
-                       buffer[offset+7] = (byte) value;
-               }
-
-               public void Write (byte[] buffer)
-               {
-                       Write (buffer, 0, buffer.Length);
-               }
-
-               public void Write (byte[] buffer, int offset, int size)
-               {
-                       MakeRoomInternal (size);
-                       Array.Copy (buffer, offset, Buffer, Position, size);
-                       Position += size;
-               }
-
-               public void Write (IBufferOffsetSize buffer)
-               {
-                       Write (buffer.Buffer, buffer.Offset, buffer.Size);
-               }
-
-               public SecureBuffer ReadSecureBuffer (int count)
-               {
-                       return new SecureBuffer (ReadBytes (count));
-               }
-
-               public byte[] ReadBytes (int count)
-               {
-                       if (Position + count > EndOffset)
-                               throw new TlsException (AlertDescription.DecodeError, "Buffer overflow");
-                       var retval = new byte [count];
-                       Array.Copy (Buffer, Position, retval, 0, count);
-                       Position += count;
-                       return retval;
-               }
-
-               internal static bool Compare (SecureBuffer buffer1, SecureBuffer buffer2)
-               {
-                       if (buffer1 == null || buffer2 == null)
-                               return false;
-
-                       if (buffer1.Size != buffer2.Size)
-                               return false;
-
-                       for (int i = 0; i < buffer1.Size; i++) {
-                               if (buffer1.Buffer [i] != buffer2.Buffer [i])
-                                       return false;
-                       }
-                       return true;
-               }
-
-               public static bool Compare (IBufferOffsetSize buffer1, IBufferOffsetSize buffer2)
-               {
-                       if (buffer1 == null || buffer2 == null)
-                               return false;
-
-                       if (buffer1.Size != buffer2.Size)
-                               return false;
-
-                       for (int i = 0; i < buffer1.Size; i++) {
-                               if (buffer1.Buffer [buffer1.Offset + i] != buffer2.Buffer [buffer2.Offset + i])
-                                       return false;
-                       }
-                       return true;
-               }
-
-               public static bool Compare (byte[] buffer1, byte[] buffer2)
-               {
-                       if (buffer1 == null || buffer2 == null)
-                               return false;
-
-                       return Compare (buffer1, 0, buffer1.Length, buffer2, 0, buffer2.Length);
-               }
-
-               public static bool Compare (byte[] buffer1, int offset1, int size1, byte[] buffer2, int offset2, int size2)
-               {
-                       if (buffer1 == null || buffer2 == null)
-                               return false;
-
-                       if (size1 != size2)
-                               return false;
-
-                       for (int i = 0; i < size1; i++) {
-                               if (buffer1 [offset1 + i] != buffer2 [offset2 + i])
-                                       return false;
-                       }
-                       return true;
-
-               }
-
-               public static int ConstantTimeCompare (byte[] buffer1, int offset1, int size1, byte[] buffer2, int offset2, int size2)
-               {
-                       int status = 0;
-                       int effectiveSize;
-                       if (size1 < size2) {
-                               status--;
-                               effectiveSize = size1;
-                       } else if (size2 < size1) {
-                               status--;
-                               effectiveSize = size2;
-                       } else {
-                               effectiveSize = size1;
-                       }
-
-                       for (int i = 0; i < effectiveSize; i++) {
-                               if (buffer1 [offset1 + i] != buffer2 [offset2 + i])
-                                       status--;
-                       }
-
-                       return status;
-               }
-
-               protected void SetBuffer (byte[] buffer, int offset, int size)
-               {
-                       innerBuffer = new BufferOffsetSize (buffer, offset, size);
-               }
-
-               protected override void Clear ()
-               {
-                       var disposable = innerBuffer as IDisposable;
-                       if (disposable != null)
-                               disposable.Dispose ();
-                       innerBuffer = null;
-                       Position = 0;
-               }
-
-               public static readonly byte[] EmptyArray = new byte [0];
-       }
-}
-
diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/TlsMultiBuffer.cs b/mcs/class/Mono.Security/Mono.Security.Interface/TlsMultiBuffer.cs
deleted file mode 100644 (file)
index de2975a..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// TlsMultiBuffer.cs
-//
-// Author:
-//       Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2014-2016 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System;
-
-namespace Mono.Security.Interface
-{
-       public class TlsMultiBuffer
-       {
-               MemoryChunk first, last;
-
-               private class MemoryChunk : BufferOffsetSize
-               {
-                       public MemoryChunk next;
-
-                       public MemoryChunk (byte[] buffer, int offset, int size)
-                               : base (buffer, offset, size)
-                       {
-                       }
-               }
-
-               public bool IsEmpty {
-                       get { return first == null; }
-               }
-
-               public bool IsSingle {
-                       get { return first != null && first.next == null; }
-               }
-
-               public void Add (TlsBuffer buffer)
-               {
-                       Add (buffer.Buffer, buffer.Offset, buffer.Size);
-               }
-
-               public void Add (byte[] buffer)
-               {
-                       Add (buffer, 0, buffer.Length);
-               }
-
-               public void Add (byte[] buffer, int offset, int size)
-               {
-                       var chunk = new MemoryChunk (buffer, offset, size);
-                       if (last == null)
-                               first = last = chunk;
-                       else {
-                               last.next = chunk;
-                               last = chunk;
-                       }
-               }
-
-               public BufferOffsetSize[] GetBufferArray ()
-               {
-                       int count = 0;
-                       for (var ptr = first; ptr != null; ptr = ptr.next)
-                               count++;
-                       var array = new BufferOffsetSize [count];
-                       count = 0;
-                       for (var ptr = first; ptr != null; ptr = ptr.next)
-                               array [count++] = ptr;
-                       return array;
-               }
-
-               public void Clear ()
-               {
-                       for (var ptr = first; ptr != null; ptr = ptr.next)
-                               ptr.Dispose ();
-                       first = last = null;
-               }
-
-               public BufferOffsetSize GetBuffer ()
-               {
-                       int totalSize = 0;
-                       for (var ptr = first; ptr != null; ptr = ptr.next)
-                               totalSize += ptr.Size;
-
-                       var outBuffer = new BufferOffsetSize (new byte [totalSize]);
-                       int offset = 0;
-                       for (var ptr = first; ptr != null; ptr = ptr.next) {
-                               Buffer.BlockCopy (ptr.Buffer, ptr.Offset, outBuffer.Buffer, offset, ptr.Size);
-                               offset += ptr.Size;
-                       }
-                       return outBuffer;
-               }
-
-               public BufferOffsetSize StealBuffer ()
-               {
-                       if (IsSingle) {
-                               var retval = first;
-                               first = last = null;
-                               return retval;
-                       }
-
-                       return GetBuffer ();
-               }
-       }
-}
-
index a270d5f75de9269a2f679b553f1b76a7b5256bbd..a3572f49478bec3f7628fa58c6d9dc8da9d7735c 100644 (file)
 ./Mono.Security.Interface/CipherSuiteCode.cs
 ./Mono.Security.Interface/ExchangeAlgorithmType.cs
 ./Mono.Security.Interface/HashAlgorithmType.cs
-./Mono.Security.Interface/IBufferOffsetSize.cs
-./Mono.Security.Interface/IMonoTlsEventSink.cs
 ./Mono.Security.Interface/IMonoSslStream.cs
 ./Mono.Security.Interface/MonoTlsConnectionInfo.cs
 ./Mono.Security.Interface/MonoTlsProvider.cs
 ./Mono.Security.Interface/TlsProtocolCode.cs
 ./Mono.Security.Interface/TlsProtocols.cs
 
-./Mono.Security.Interface/BufferOffsetSize.cs
-./Mono.Security.Interface/SecretParameters.cs
-./Mono.Security.Interface/SecureBuffer.cs
-./Mono.Security.Interface/TlsBuffer.cs
-./Mono.Security.Interface/TlsMultiBuffer.cs