From 9d7551ecd3e1b1b6f224eabecc1c7f91a41f259c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 26 Jul 2024 22:06:48 +0200 Subject: [PATCH] Simplify platform attribute for AesGcm and ChaCha20Poly1305 (#105547) Follow-up to https://github.com/dotnet/runtime/pull/105409, I verified the analyzer works correctly with just having the annotation for iOS. --- .../System.Security.Cryptography.Native.Apple/Interop.Aead.cs | 4 ---- .../ref/System.Security.Cryptography.cs | 2 -- .../src/System/Security/Cryptography/AesGcm.cs | 1 - .../src/System/Security/Cryptography/ChaCha20Poly1305.cs | 1 - 4 files changed, 8 deletions(-) diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Aead.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Aead.cs index 29d8877142c5ef..8d340797f444af 100644 --- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Aead.cs +++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Aead.cs @@ -32,7 +32,6 @@ private static ref readonly byte GetSwiftRef(ReadOnlySpan b) [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - [SupportedOSPlatform("maccatalyst")] internal static unsafe void ChaCha20Poly1305Encrypt( ReadOnlySpan key, ReadOnlySpan nonce, @@ -70,7 +69,6 @@ internal static unsafe void ChaCha20Poly1305Encrypt( [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - [SupportedOSPlatform("maccatalyst")] internal static unsafe void ChaCha20Poly1305Decrypt( ReadOnlySpan key, ReadOnlySpan nonce, @@ -115,7 +113,6 @@ internal static unsafe void ChaCha20Poly1305Decrypt( [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - [SupportedOSPlatform("maccatalyst")] internal static unsafe void AesGcmEncrypt( ReadOnlySpan key, ReadOnlySpan nonce, @@ -153,7 +150,6 @@ internal static unsafe void AesGcmEncrypt( [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - [SupportedOSPlatform("maccatalyst")] internal static unsafe void AesGcmDecrypt( ReadOnlySpan key, ReadOnlySpan nonce, diff --git a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs index 1442fb8fca3561..779b0d889164bb 100644 --- a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs +++ b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs @@ -123,7 +123,6 @@ public override void GenerateKey() { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.SupportedOSPlatform("ios13.0")] [System.Runtime.Versioning.SupportedOSPlatform("tvos13.0")] - [System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")] public sealed partial class AesGcm : System.IDisposable { [System.ObsoleteAttribute("AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.", DiagnosticId="SYSLIB0053", UrlFormat="https://aka.ms/dotnet-warnings/{0}")] @@ -289,7 +288,6 @@ public AuthenticationTagMismatchException(string? message, System.Exception? inn [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("tvos")] [System.Runtime.Versioning.SupportedOSPlatform("ios13.0")] [System.Runtime.Versioning.SupportedOSPlatform("tvos13.0")] - [System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")] public sealed partial class ChaCha20Poly1305 : System.IDisposable { public ChaCha20Poly1305(byte[] key) { } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs index 52aa45ebb6d1e9..6135892934140d 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.cs @@ -12,7 +12,6 @@ namespace System.Security.Cryptography [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - [SupportedOSPlatform("maccatalyst")] public sealed partial class AesGcm : IDisposable { private const int NonceSize = 12; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs index 8cbf36bd73b543..6d5f3ba76cd0c7 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ChaCha20Poly1305.cs @@ -11,7 +11,6 @@ namespace System.Security.Cryptography [UnsupportedOSPlatform("tvos")] [SupportedOSPlatform("ios13.0")] [SupportedOSPlatform("tvos13.0")] - [SupportedOSPlatform("maccatalyst")] public sealed partial class ChaCha20Poly1305 : IDisposable { // Per https://tools.ietf.org/html/rfc7539, ChaCha20Poly1305 AEAD requires a 256-bit key and 96-bit nonce,