Repository: dotnet/runtime
File: src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.Apple.cs (C#)

Code before:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Win32.SafeHandles;

namespace System.Security.Cryptography
{
    public sealed partial class AesGcm
    {
        private FixedMemoryKeyBox _keyBox;

        // CryptoKit only supports 16 byte tags.
        private static readonly KeySizes s_tagByteSizes = new KeySizes(16, 16, 1);

        // CryptoKit added AES.GCM in macOS 10.15, which is lower than our minimum target for macOS/MacCatalyst. On iOS/tvOS, it was added in 13.0.
        public static partial bool IsSupported =>
            OperatingSystem.IsMacOS() ||
            OperatingSystem.IsMacCatalyst() ||
            OperatingSystem.IsIOSVersionAtLeast(13) ||
            OperatingSystem.IsTvOSVersionAtLeast(13);

        public static partial KeySizes TagByteSizes => s_tagByteSizes;

        [MemberNotNull(nameof(_keyBox))]
        private partial void ImportKey(ReadOnlySpan<byte> key)
        {
            // We should only be calling this in the constructor, so there shouldn't be a previous key.
            Debug.Assert(_keyBox is null);
            _keyBox = new FixedMemoryKeyBox(key);
        }

        private partial void EncryptCore(
            ReadOnlySpan<byte> nonce,
            ReadOnlySpan<byte> plaintext,
            Span<byte> ciphertext,
            Span<byte> tag,
            ReadOnlySpan<byte> associatedData)
        {
            bool acquired = false;


Review comment (suggestion):
The comment states that AES.GCM was added in macOS 10.15 and iOS/tvOS 13.0, but the property now unconditionally returns `true`. This suggests these are the minimum supported versions, but the comment should clarify that all currently supported OS versions meet this requirement. Consider updating the comment to indicate why `IsSupported` can now return `true` unconditionally, such as: "CryptoKit added AES.GCM in macOS 10.15 and iOS/tvOS 13.0. All currently supported OS versions meet this requirement."
```suggestion
        // CryptoKit added AES.GCM in macOS 10.15 and iOS/tvOS 13.0.
        // All currently supported OS versions meet this requirement, so IsSupported always returns true.
```

Code after:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Win32.SafeHandles;

namespace System.Security.Cryptography
{
    public sealed partial class AesGcm
    {
        private FixedMemoryKeyBox _keyBox;

        // CryptoKit only supports 16 byte tags.
        private static readonly KeySizes s_tagByteSizes = new KeySizes(16, 16, 1);

        // CryptoKit added AES.GCM in macOS 10.15, and iOS/tvOS in 13.0.
        public static partial bool IsSupported => true;

        public static partial KeySizes TagByteSizes => s_tagByteSizes;

        [MemberNotNull(nameof(_keyBox))]
        private partial void ImportKey(ReadOnlySpan<byte> key)
        {
            // We should only be calling this in the constructor, so there shouldn't be a previous key.
            Debug.Assert(_keyBox is null);
            _keyBox = new FixedMemoryKeyBox(key);
        }

        private partial void EncryptCore(
            ReadOnlySpan<byte> nonce,
            ReadOnlySpan<byte> plaintext,
            Span<byte> ciphertext,
            Span<byte> tag,
            ReadOnlySpan<byte> associatedData)
        {
            bool acquired = false;

            try
            {
                _keyBox.DangerousAddRef(ref acquired);
                Interop.AppleCrypto.AesGcmEncrypt(