Clear plaintext when AesCcm authentication fails (dotnet/corefx#38899)
authorKrzysztof Wicher <mordotymoja@gmail.com>
Wed, 26 Jun 2019 15:49:50 +0000 (08:49 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Jun 2019 15:49:50 +0000 (08:49 -0700)
* Re-enable disabled AesCcm test cases

* Clear plaintext on failure

Commit migrated from https://github.com/dotnet/corefx/commit/b958f70b06826095c5b0e15bb566f300b96094ce

src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/AesCcm.Unix.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/AesCcmTests.cs

index 19fe668..81bc011 100644 (file)
@@ -109,6 +109,7 @@ namespace System.Security.Cryptography
 
                 if (!Interop.Crypto.EvpCipherUpdate(ctx, plaintext, out int plaintextBytesWritten, ciphertext))
                 {
+                    plaintext.Fill(0);
                     throw new CryptographicException(SR.Cryptography_AuthTagMismatch);
                 }
 
index b5bd565..db15801 100644 (file)
@@ -297,7 +297,6 @@ namespace System.Security.Cryptography.Algorithms.Tests
             }
         }
 
-        [ActiveIssue(32710, TestPlatforms.AnyUnix)] 
         [Fact]
         public static void InplaceEncryptTamperTagDecrypt()
         {
@@ -339,7 +338,6 @@ namespace System.Security.Cryptography.Algorithms.Tests
             }
         }
 
-        [ActiveIssue(32710, TestPlatforms.AnyUnix)] 
         [Theory]
         [MemberData(nameof(GetNistCcmTestCases))]
         public static void AesCcmNistTestsTamperTag(AEADTest testCase)
@@ -362,7 +360,6 @@ namespace System.Security.Cryptography.Algorithms.Tests
             }
         }
 
-        [ActiveIssue(32710, TestPlatforms.AnyUnix)] 
         [Theory]
         [MemberData(nameof(GetNistCcmTestCasesWithNonEmptyPT))]
         public static void AesCcmNistTestsTamperCiphertext(AEADTest testCase)