diff options
author | Oren Novotny <oren@novotny.org> | 2017-07-14 10:30:28 -0400 |
---|---|---|
committer | Oren Novotny <oren@novotny.org> | 2017-07-14 10:30:28 -0400 |
commit | 03209e362f96ac100991923b99109173eda96fb1 (patch) | |
tree | d99808d1bb9394af37a881e770e2a68ba4e565ee /crypto | |
parent | Update deps (diff) | |
download | BouncyCastle.NET-ed25519-03209e362f96ac100991923b99109173eda96fb1.tar.xz |
Fix ups after merge from master
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/crypto.csproj | 2 | ||||
-rw-r--r-- | crypto/src/crypto/modes/KCcmBlockCipher.cs | 21 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/DSTU7564Test.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/DSTU7624Test.cs | 2 |
4 files changed, 21 insertions, 6 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(); diff --git a/crypto/test/src/crypto/test/DSTU7564Test.cs b/crypto/test/src/crypto/test/DSTU7564Test.cs index 98f0bbdea..21a3a91da 100644 --- a/crypto/test/src/crypto/test/DSTU7564Test.cs +++ b/crypto/test/src/crypto/test/DSTU7564Test.cs @@ -628,7 +628,7 @@ namespace Org.BouncyCastle.Crypto.Tests return new Dstu7564Digest((Dstu7564Digest)digest); } - public static void Main( + public static void MainOld( string[] args) { RunTest(new Dstu7564Test()); diff --git a/crypto/test/src/crypto/test/DSTU7624Test.cs b/crypto/test/src/crypto/test/DSTU7624Test.cs index 12ee46e5d..1040aa23b 100644 --- a/crypto/test/src/crypto/test/DSTU7624Test.cs +++ b/crypto/test/src/crypto/test/DSTU7624Test.cs @@ -719,7 +719,7 @@ namespace Org.BouncyCastle.Crypto.Tests get { return "Dstu7624"; } } - public static void Main( + public static void MainOld( string[] args) { Dstu7624Test test = new Dstu7624Test(); |