From c11a1f4eca78a21a1673246ddd048e35c3a5afb9 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Thu, 6 Apr 2023 21:29:38 -0700 Subject: [PATCH] Update to .NET SDK 7.0.202 --- DotnetCliVersion.txt | 2 +- src/LibHac/Common/Keys/DefaultKeySet.cs | 17 ++++++++++++++--- src/LibHac/Common/Keys/KeySet.cs | 8 ++++++-- src/LibHac/Common/U8StringBuilder.cs | 4 ++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/DotnetCliVersion.txt b/DotnetCliVersion.txt index fb68a53f..a37a531c 100644 --- a/DotnetCliVersion.txt +++ b/DotnetCliVersion.txt @@ -1 +1 @@ -7.0.102 \ No newline at end of file +7.0.202 \ No newline at end of file diff --git a/src/LibHac/Common/Keys/DefaultKeySet.cs b/src/LibHac/Common/Keys/DefaultKeySet.cs index 32e9fca1..b20925c5 100644 --- a/src/LibHac/Common/Keys/DefaultKeySet.cs +++ b/src/LibHac/Common/Keys/DefaultKeySet.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using LibHac.Boot; +using System.Collections.Generic; using System.Runtime.CompilerServices; using static LibHac.Common.Keys.KeySet; using Type = LibHac.Common.Keys.KeyInfo.KeyType; @@ -131,9 +132,19 @@ internal static partial class DefaultKeySet keys.Add(new KeyInfo(60, Type.DeviceDrvd, "keyblob_mac_key", 0, UsedKeyBlobCount, (set, i) => set.KeyBlobMacKeys[i])); - keys.Add(new KeyInfo(70, Type.DeviceRoot, "encrypted_keyblob", 0, UsedKeyBlobCount, (set, i) => set.EncryptedKeyBlobs[i].Bytes)); + keys.Add(new KeyInfo(70, Type.DeviceRoot, "encrypted_keyblob", 0, 6, (set, i) => + { + // Todo: Remove local variable after Roslyn issue #67697 is fixed + ref EncryptedKeyBlob keySetKeyBlob = ref set.EncryptedKeyBlobs[i]; + return keySetKeyBlob.Bytes; + })); - keys.Add(new KeyInfo(80, Type.CommonRoot, "keyblob", 0, UsedKeyBlobCount, (set, i) => set.KeyBlobs[i].Bytes)); + keys.Add(new KeyInfo(80, Type.CommonRoot, "keyblob", 0, 6, (set, i) => + { + // Todo: Remove local variable after Roslyn issue #67697 is fixed + ref KeyBlob keySetKeyBlob = ref set.KeyBlobs[i]; + return keySetKeyBlob.Bytes; + })); keys.Add(new KeyInfo(90, Type.CommonSeed, "master_kek_source", UsedKeyBlobCount, KeyRevisionCount, (set, i) => set.MasterKekSources[i])); diff --git a/src/LibHac/Common/Keys/KeySet.cs b/src/LibHac/Common/Keys/KeySet.cs index a474305c..dbe4a686 100644 --- a/src/LibHac/Common/Keys/KeySet.cs +++ b/src/LibHac/Common/Keys/KeySet.cs @@ -145,7 +145,9 @@ public class KeySet keys.Value[1] = CreateRsaParameters(in NcaHeaderSigningKeys[1]); } - return keys.Value.Items; + // Todo: Remove local variable after Roslyn issue #67697 is fixed + ref Array2 array = ref keys.Value; + return array.Items; } } @@ -162,7 +164,9 @@ public class KeySet keys.Value[1] = CreateRsaParameters(in AcidSigningKeys[1]); } - return keys.Value.Items; + // Todo: Remove local variable after Roslyn issue #67697 is fixed + ref Array2 array = ref keys.Value; + return array.Items; } } diff --git a/src/LibHac/Common/U8StringBuilder.cs b/src/LibHac/Common/U8StringBuilder.cs index e07b9914..75bc5ad9 100644 --- a/src/LibHac/Common/U8StringBuilder.cs +++ b/src/LibHac/Common/U8StringBuilder.cs @@ -75,7 +75,7 @@ public ref struct U8StringBuilder // These functions are internal so they can be called by the extension methods // in U8StringBuilderExtensions. It's not an ideal setup, but it allows append // calls to be chained without accidentally creating a copy of the U8StringBuilder. - internal void AppendInternal(ReadOnlySpan value) + internal void AppendInternal(scoped ReadOnlySpan value) { // Once in the Overflowed state, nothing else is written to the buffer. if (Overflowed) return; @@ -443,7 +443,7 @@ public ref struct U8StringBuilder public static class U8StringBuilderExtensions { [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ref U8StringBuilder Append(this ref U8StringBuilder sb, ReadOnlySpan value) + public static ref U8StringBuilder Append(this ref U8StringBuilder sb, scoped ReadOnlySpan value) { sb.AppendInternal(value); return ref sb;