summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-11-08 17:21:22 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-11-08 17:21:22 +0700
commit4198486935e8b5b7f83734ea9347cb6fc00a9802 (patch)
tree0de15e0a7e9c3eca2f1fd707733a581c55333d34 /crypto
parentMerge branch 'master' of git.bouncycastle.org:bc-csharp (diff)
downloadBouncyCastle.NET-ed25519-4198486935e8b5b7f83734ea9347cb6fc00a9802.tar.xz
Some more PORTABLE updates
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/tls/DtlsReliableHandshake.cs10
-rw-r--r--crypto/src/crypto/tls/HeartbeatMessage.cs9
-rw-r--r--crypto/src/crypto/tls/TlsProtocol.cs11
3 files changed, 27 insertions, 3 deletions
diff --git a/crypto/src/crypto/tls/DtlsReliableHandshake.cs b/crypto/src/crypto/tls/DtlsReliableHandshake.cs
index 7f3f832a1..18a41769a 100644
--- a/crypto/src/crypto/tls/DtlsReliableHandshake.cs
+++ b/crypto/src/crypto/tls/DtlsReliableHandshake.cs
@@ -419,7 +419,15 @@ namespace Org.BouncyCastle.Crypto.Tls
 
             internal void SendToRecordLayer(DtlsRecordLayer recordLayer)
             {
-                recordLayer.Send(GetBuffer(), 0, (int)Length);
+#if PORTABLE
+                byte[] buf = ToArray();
+                int bufLen = buf.Length;
+#else
+                byte[] buf = GetBuffer();
+                int bufLen = (int)Length;
+#endif
+
+                recordLayer.Send(buf, 0, bufLen);
                 Platform.Dispose(this);
             }
         }
diff --git a/crypto/src/crypto/tls/HeartbeatMessage.cs b/crypto/src/crypto/tls/HeartbeatMessage.cs
index f64a7baa4..3f22f7e1d 100644
--- a/crypto/src/crypto/tls/HeartbeatMessage.cs
+++ b/crypto/src/crypto/tls/HeartbeatMessage.cs
@@ -95,7 +95,14 @@ namespace Org.BouncyCastle.Crypto.Tls
                 int minimumCount = payloadLength + 16;
                 if (Length < minimumCount)
                     return null;
-                return Arrays.CopyOf(GetBuffer(), payloadLength);
+
+#if PORTABLE
+                byte[] buf = ToArray();
+#else
+                byte[] buf = GetBuffer();
+#endif
+
+                return Arrays.CopyOf(buf, payloadLength);
             }
         }
     }
diff --git a/crypto/src/crypto/tls/TlsProtocol.cs b/crypto/src/crypto/tls/TlsProtocol.cs
index 51178a473..99168b883 100644
--- a/crypto/src/crypto/tls/TlsProtocol.cs
+++ b/crypto/src/crypto/tls/TlsProtocol.cs
@@ -1310,7 +1310,16 @@ namespace Org.BouncyCastle.Crypto.Tls
                 TlsUtilities.CheckUint24(length);
                 this.Position = 1;
                 TlsUtilities.WriteUint24((int)length, this);
-                protocol.WriteHandshakeMessage(GetBuffer(), 0, (int)Length);
+
+#if PORTABLE
+                byte[] buf = ToArray();
+                int bufLen = buf.Length;
+#else
+                byte[] buf = GetBuffer();
+                int bufLen = (int)Length;
+#endif
+
+                protocol.WriteHandshakeMessage(buf, 0, bufLen);
                 Platform.Dispose(this);
             }
         }