summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorOren Novotny <oren@novotny.org>2017-07-14 10:30:28 -0400
committerOren Novotny <oren@novotny.org>2017-07-14 10:30:28 -0400
commit03209e362f96ac100991923b99109173eda96fb1 (patch)
treed99808d1bb9394af37a881e770e2a68ba4e565ee /crypto/src
parentUpdate deps (diff)
downloadBouncyCastle.NET-ed25519-03209e362f96ac100991923b99109173eda96fb1.tar.xz
Fix ups after merge from master
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto.csproj2
-rw-r--r--crypto/src/crypto/modes/KCcmBlockCipher.cs21
2 files changed, 19 insertions, 4 deletions
diff --git a/crypto/src/crypto.csproj b/crypto/src/crypto.csproj
index 05d2802d2..4d0b9e774 100644
--- a/crypto/src/crypto.csproj
+++ b/crypto/src/crypto.csproj
@@ -28,7 +28,7 @@
     <DefineConstants>$(DefineConstants);PORTABLE;NO_THREADS</DefineConstants>
   </PropertyGroup>
   <ItemGroup>
-    <Compile Include="..\bzip2\src\**\*.cs" />
+    <Compile Include="..\bzip2\src\**\*.cs" LinkBase="bzip2" />
     <None Include="..\..\BouncyCastle.snk" />
     <PackageReference Include="GitVersionTask" Version="4.0.0-beta0011" PrivateAssets="All" />
     <PackageReference Include="MSBuild.Sdk.Extras" Version="1.0.5" PrivateAssets="All" />
diff --git a/crypto/src/crypto/modes/KCcmBlockCipher.cs b/crypto/src/crypto/modes/KCcmBlockCipher.cs
index 1911ba53b..4cb11a784 100644
--- a/crypto/src/crypto/modes/KCcmBlockCipher.cs
+++ b/crypto/src/crypto/modes/KCcmBlockCipher.cs
@@ -252,13 +252,21 @@ namespace Org.BouncyCastle.Crypto.Modes
 
             if (associatedText.Length > 0)
             {
+
+#if PORTABLE
+                byte[] buf = associatedText.ToArray();
+                int bufLen = buf.Length;
+#else
+                byte[] buf = associatedText.GetBuffer();
+                int bufLen = (int)buf.Length;
+#endif
                 if (forEncryption)
                 {
-                    ProcessAAD(associatedText.GetBuffer(), 0, (int)associatedText.Length, (int)data.Length);
+                    ProcessAAD(buf, 0, bufLen, (int)data.Length);
                 }
                 else
                 {
-                    ProcessAAD(associatedText.GetBuffer(), 0, (int)associatedText.Length, (int)data.Length - macSize);
+                    ProcessAAD(buf, 0, bufLen, (int)data.Length - macSize);
                 }
             }
 
@@ -397,7 +405,14 @@ namespace Org.BouncyCastle.Crypto.Modes
 
         public virtual int DoFinal(byte[] output, int outOff)
         {
-            int len = ProcessPacket(data.GetBuffer(), 0, (int)data.Length, output, outOff);
+#if PORTABLE
+            byte[] buf = data.ToArray();
+            int bufLen = buf.Length;
+#else
+            byte[] buf = data.GetBuffer();
+            int bufLen = (int)buf.Length;
+#endif
+            int len = ProcessPacket(buf, 0, bufLen, output, outOff);
 
             Reset();