Rename Crypto namespace

This commit is contained in:
Alex Barney 2019-11-18 18:31:06 -07:00
parent 488bd8e682
commit 2f4453404f
42 changed files with 92 additions and 94 deletions

View file

@ -20,7 +20,7 @@ namespace LibHac.Compatibility
SHA256 sha = SHA256.Create();
var message = new byte[rsaLen];
BigInteger decInt = BigInteger.ModPow(Crypto.GetBigInteger(signature), new BigInteger(65537), Crypto.GetBigInteger(modulus));
BigInteger decInt = BigInteger.ModPow(CryptoOld.GetBigInteger(signature), new BigInteger(65537), CryptoOld.GetBigInteger(modulus));
byte[] decBytes = decInt.ToByteArray();
if (decBytes[0] != 0xBC) return false;

View file

@ -1,13 +1,11 @@
// ReSharper disable AssignmentIsFullyDiscarded
using System;
using LibHac.Crypto.Detail;
#if HAS_INTRINSICS
using LibHac.Crypto2.Detail;
using AesNi = System.Runtime.Intrinsics.X86.Aes;
#endif
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public static class Aes
{

View file

@ -1,7 +1,7 @@
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesCbcEncryptor : ICipher
{

View file

@ -1,8 +1,8 @@
#if HAS_INTRINSICS
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public struct AesCbcEncryptorNi : ICipher
{

View file

@ -1,7 +1,7 @@
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesCtrCipher : ICipher
{

View file

@ -1,8 +1,8 @@
#if HAS_INTRINSICS
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesCtrCipherNi : ICipher
{

View file

@ -1,7 +1,7 @@
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesEcbEncryptor : ICipher
{

View file

@ -1,8 +1,8 @@
#if HAS_INTRINSICS
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesEcbEncryptorNi : ICipher
{

View file

@ -1,7 +1,7 @@
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesXtsEncryptor : ICipher
{

View file

@ -1,8 +1,8 @@
#if HAS_INTRINSICS
using System;
using LibHac.Crypto2.Detail;
using LibHac.Crypto.Detail;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public class AesXtsEncryptorNi : ICipher
{

View file

@ -1,7 +1,7 @@
using System;
using System.Security.Cryptography;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesCbcMode
{

View file

@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesCbcModeNi
{

View file

@ -3,7 +3,7 @@ using System.Diagnostics;
using System.Security.Cryptography;
using LibHac.Common;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesCore
{

View file

@ -8,7 +8,7 @@ using System.Runtime.Intrinsics.X86;
using AesNi = System.Runtime.Intrinsics.X86.Aes;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
[StructLayout(LayoutKind.Sequential, Size = RoundKeyCount * RoundKeySize)]
public struct AesCoreNi

View file

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography;
using LibHac.Common;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesCtrMode
{

View file

@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesCtrModeNi
{

View file

@ -1,7 +1,7 @@
using System;
using System.Security.Cryptography;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesEcbMode
{

View file

@ -1,7 +1,7 @@
#if HAS_INTRINSICS
using System;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesEcbModeNi
{

View file

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography;
using LibHac.Common;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesXtsMode
{

View file

@ -7,7 +7,7 @@ using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using LibHac.Common;
namespace LibHac.Crypto2.Detail
namespace LibHac.Crypto.Detail
{
public struct AesXtsModeNi
{

View file

@ -1,6 +1,6 @@
using System;
namespace LibHac.Crypto2
namespace LibHac.Crypto
{
public interface ICipher
{

View file

@ -6,7 +6,7 @@ using LibHac.FsSystem;
namespace LibHac
{
public static class Crypto
public static class CryptoOld
{
internal const int Aes128Size = 0x10;
internal const int Sha256DigestSize = 0x20;

View file

@ -78,14 +78,14 @@ namespace LibHac.FsSystem
private void DecryptKeys()
{
Crypto.DecryptEcb(Kek1, EncryptedKey1, DecryptedKey1, 0x10);
Crypto.DecryptEcb(Kek2, EncryptedKey2, DecryptedKey2, 0x10);
CryptoOld.DecryptEcb(Kek1, EncryptedKey1, DecryptedKey1, 0x10);
CryptoOld.DecryptEcb(Kek2, EncryptedKey2, DecryptedKey2, 0x10);
}
private void EncryptKeys()
{
Crypto.EncryptEcb(Kek1, DecryptedKey1, EncryptedKey1, 0x10);
Crypto.EncryptEcb(Kek2, DecryptedKey2, EncryptedKey2, 0x10);
CryptoOld.EncryptEcb(Kek1, DecryptedKey1, EncryptedKey1, 0x10);
CryptoOld.EncryptEcb(Kek2, DecryptedKey2, EncryptedKey2, 0x10);
}
private void GenerateKek(byte[] kekSeed, string path)

View file

@ -36,9 +36,9 @@ namespace LibHac.FsSystem.NcaUtils
}
byte[] encryptedKey = Header.GetEncryptedKey(index).ToArray();
var decryptedKey = new byte[Crypto.Aes128Size];
var decryptedKey = new byte[CryptoOld.Aes128Size];
Crypto.DecryptEcb(keyAreaKey, encryptedKey, decryptedKey, Crypto.Aes128Size);
CryptoOld.DecryptEcb(keyAreaKey, encryptedKey, decryptedKey, CryptoOld.Aes128Size);
return decryptedKey;
}
@ -60,9 +60,9 @@ namespace LibHac.FsSystem.NcaUtils
}
byte[] encryptedKey = accessKey.Value.ToArray();
var decryptedKey = new byte[Crypto.Aes128Size];
var decryptedKey = new byte[CryptoOld.Aes128Size];
Crypto.DecryptEcb(titleKek, encryptedKey, decryptedKey, Crypto.Aes128Size);
CryptoOld.DecryptEcb(titleKek, encryptedKey, decryptedKey, CryptoOld.Aes128Size);
return decryptedKey;
}

View file

@ -98,7 +98,7 @@ namespace LibHac.FsSystem.NcaUtils
var data = new byte[size];
storage.Read(offset, data).ThrowIfFailure();
byte[] actualHash = Crypto.ComputeSha256(data, 0, data.Length);
byte[] actualHash = CryptoOld.ComputeSha256(data, 0, data.Length);
if (Util.ArraysEqual(expectedHash, actualHash)) return Validity.Valid;

View file

@ -151,8 +151,8 @@ namespace LibHac.FsSystem.NcaUtils
throw new ArgumentOutOfRangeException($"Key index must be between 0 and 3. Actual: {index}");
}
int offset = NcaHeaderStruct.KeyAreaOffset + Crypto.Aes128Size * index;
return _header.Span.Slice(offset, Crypto.Aes128Size);
int offset = NcaHeaderStruct.KeyAreaOffset + CryptoOld.Aes128Size * index;
return _header.Span.Slice(offset, CryptoOld.Aes128Size);
}
public NcaFsHeader GetFsHeader(int index)
@ -163,7 +163,7 @@ namespace LibHac.FsSystem.NcaUtils
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
Memory<byte> headerData = _header.Slice(offset, NcaHeaderStruct.FsHeaderSize);
byte[] actualHash = Crypto.ComputeSha256(headerData.ToArray(), 0, NcaHeaderStruct.FsHeaderSize);
byte[] actualHash = CryptoOld.ComputeSha256(headerData.ToArray(), 0, NcaHeaderStruct.FsHeaderSize);
if (!Util.SpansEqual(expectedHash, actualHash))
{
@ -231,12 +231,12 @@ namespace LibHac.FsSystem.NcaUtils
public Validity VerifySignature1(byte[] modulus)
{
return Crypto.Rsa2048PssVerify(_header.Span.Slice(0x200, 0x200).ToArray(), Signature1.ToArray(), modulus);
return CryptoOld.Rsa2048PssVerify(_header.Span.Slice(0x200, 0x200).ToArray(), Signature1.ToArray(), modulus);
}
public Validity VerifySignature2(byte[] modulus)
{
return Crypto.Rsa2048PssVerify(_header.Span.Slice(0x200, 0x200).ToArray(), Signature2.ToArray(), modulus);
return CryptoOld.Rsa2048PssVerify(_header.Span.Slice(0x200, 0x200).ToArray(), Signature2.ToArray(), modulus);
}
[StructLayout(LayoutKind.Explicit, Size = 0xC00)]

View file

@ -164,7 +164,7 @@ namespace LibHac.FsSystem
{
HashedRegionSize = reader.ReadInt32();
HashedRegionOffset = reader.ReadInt64();
Hash = reader.ReadBytes(Crypto.Sha256DigestSize);
Hash = reader.ReadBytes(CryptoOld.Sha256DigestSize);
}
else
{

View file

@ -81,7 +81,7 @@ namespace LibHac.FsSystem.Save
MasterHash = storage.Slice(Layout.IvfcMasterHashOffsetA, Layout.IvfcMasterHashSize);
HeaderHashValidity = Crypto.CheckMemoryHashTable(Data, Layout.Hash, 0x300, 0x3d00);
HeaderHashValidity = CryptoOld.CheckMemoryHashTable(Data, Layout.Hash, 0x300, 0x3d00);
SignatureValidity = ValidateSignature(keyset);
}
@ -89,7 +89,7 @@ namespace LibHac.FsSystem.Save
{
var calculatedCmac = new byte[0x10];
Crypto.CalculateAesCmac(keyset.SaveMacKey, Data, 0x100, calculatedCmac, 0, 0x200);
CryptoOld.CalculateAesCmac(keyset.SaveMacKey, Data, 0x100, calculatedCmac, 0, 0x200);
return Util.ArraysEqual(calculatedCmac, Cmac) ? Validity.Valid : Validity.Invalid;
}

View file

@ -252,7 +252,7 @@ namespace LibHac.FsSystem.Save
headerStream.Position = 0x300;
headerStream.Read(hashData, 0, hashData.Length);
byte[] hash = Crypto.ComputeSha256(hashData, 0, hashData.Length);
byte[] hash = CryptoOld.ComputeSha256(hashData, 0, hashData.Length);
headerStream.Position = 0x108;
headerStream.Write(hash, 0, hash.Length);
@ -264,7 +264,7 @@ namespace LibHac.FsSystem.Save
headerStream.Position = 0x100;
headerStream.Read(cmacData, 0, 0x200);
Crypto.CalculateAesCmac(keyset.SaveMacKey, cmacData, 0, cmac, 0, 0x200);
CryptoOld.CalculateAesCmac(keyset.SaveMacKey, cmacData, 0, cmac, 0, 0x200);
headerStream.Position = 0;
headerStream.Write(cmac, 0, 0x10);

View file

@ -272,12 +272,12 @@ namespace LibHac
{
if (KeyblobKeySources[i].IsEmpty()) continue;
Crypto.DecryptEcb(TsecKey, KeyblobKeySources[i], temp, 0x10);
Crypto.DecryptEcb(SecureBootKey, temp, KeyblobKeys[i], 0x10);
CryptoOld.DecryptEcb(TsecKey, KeyblobKeySources[i], temp, 0x10);
CryptoOld.DecryptEcb(SecureBootKey, temp, KeyblobKeys[i], 0x10);
if (!haveKeyblobMacKeySource) continue;
Crypto.DecryptEcb(KeyblobKeys[i], KeyblobMacKeySource, KeyblobMacKeys[i], 0x10);
CryptoOld.DecryptEcb(KeyblobKeys[i], KeyblobMacKeySource, KeyblobMacKeys[i], 0x10);
}
}
@ -295,7 +295,7 @@ namespace LibHac
}
Array.Copy(EncryptedKeyblobs[i], expectedCmac, 0x10);
Crypto.CalculateAesCmac(KeyblobMacKeys[i], EncryptedKeyblobs[i], 0x10, cmac, 0, 0xa0);
CryptoOld.CalculateAesCmac(KeyblobMacKeys[i], EncryptedKeyblobs[i], 0x10, cmac, 0, 0xa0);
if (!Util.ArraysEqual(cmac, expectedCmac))
{
@ -329,7 +329,7 @@ namespace LibHac
{
if (TsecRootKeys[i - UsedKeyblobCount].IsEmpty() || MasterKekSources[i].IsEmpty()) continue;
Crypto.DecryptEcb(TsecRootKeys[i - UsedKeyblobCount], MasterKekSources[i], MasterKeks[i], 0x10);
CryptoOld.DecryptEcb(TsecRootKeys[i - UsedKeyblobCount], MasterKekSources[i], MasterKeks[i], 0x10);
}
}
@ -341,7 +341,7 @@ namespace LibHac
{
if (MasterKeks[i].IsEmpty()) continue;
Crypto.DecryptEcb(MasterKeks[i], MasterKeySource, MasterKeys[i], 0x10);
CryptoOld.DecryptEcb(MasterKeks[i], MasterKeySource, MasterKeys[i], 0x10);
}
}
@ -352,14 +352,14 @@ namespace LibHac
// Derive the device key
if (!PerConsoleKeySource.IsEmpty() && !KeyblobKeys[0].IsEmpty())
{
Crypto.DecryptEcb(KeyblobKeys[0], PerConsoleKeySource, DeviceKey, 0x10);
CryptoOld.DecryptEcb(KeyblobKeys[0], PerConsoleKeySource, DeviceKey, 0x10);
}
// Derive save key
if (!SaveMacKekSource.IsEmpty() && !SaveMacKeySource.IsEmpty() && !DeviceKey.IsEmpty())
{
Crypto.GenerateKek(DeviceKey, SaveMacKekSource, kek, AesKekGenerationSource, null);
Crypto.DecryptEcb(kek, SaveMacKeySource, SaveMacKey, 0x10);
CryptoOld.GenerateKek(DeviceKey, SaveMacKekSource, kek, AesKekGenerationSource, null);
CryptoOld.DecryptEcb(kek, SaveMacKeySource, SaveMacKey, 0x10);
}
// Derive BIS keys
@ -378,14 +378,14 @@ namespace LibHac
Array.Copy(BisKeySource[2], BisKeySource[3], 0x20);
}
Crypto.DecryptEcb(DeviceKey, RetailSpecificAesKeySource, kek, 0x10);
if (!BisKeySource[0].IsEmpty()) Crypto.DecryptEcb(kek, BisKeySource[0], BisKeys[0], 0x20);
CryptoOld.DecryptEcb(DeviceKey, RetailSpecificAesKeySource, kek, 0x10);
if (!BisKeySource[0].IsEmpty()) CryptoOld.DecryptEcb(kek, BisKeySource[0], BisKeys[0], 0x20);
Crypto.GenerateKek(DeviceKey, BisKekSource, kek, AesKekGenerationSource, AesKeyGenerationSource);
CryptoOld.GenerateKek(DeviceKey, BisKekSource, kek, AesKekGenerationSource, AesKeyGenerationSource);
for (int i = 1; i < 4; i++)
{
if (!BisKeySource[i].IsEmpty()) Crypto.DecryptEcb(kek, BisKeySource[i], BisKeys[i], 0x20);
if (!BisKeySource[i].IsEmpty()) CryptoOld.DecryptEcb(kek, BisKeySource[i], BisKeys[i], 0x20);
}
}
@ -406,30 +406,30 @@ namespace LibHac
if (haveKakSource0)
{
Crypto.GenerateKek(MasterKeys[i], KeyAreaKeyApplicationSource, KeyAreaKeys[i][0],
CryptoOld.GenerateKek(MasterKeys[i], KeyAreaKeyApplicationSource, KeyAreaKeys[i][0],
AesKekGenerationSource, AesKeyGenerationSource);
}
if (haveKakSource1)
{
Crypto.GenerateKek(MasterKeys[i], KeyAreaKeyOceanSource, KeyAreaKeys[i][1],
CryptoOld.GenerateKek(MasterKeys[i], KeyAreaKeyOceanSource, KeyAreaKeys[i][1],
AesKekGenerationSource, AesKeyGenerationSource);
}
if (haveKakSource2)
{
Crypto.GenerateKek(MasterKeys[i], KeyAreaKeySystemSource, KeyAreaKeys[i][2],
CryptoOld.GenerateKek(MasterKeys[i], KeyAreaKeySystemSource, KeyAreaKeys[i][2],
AesKekGenerationSource, AesKeyGenerationSource);
}
if (haveTitleKekSource)
{
Crypto.DecryptEcb(MasterKeys[i], TitleKekSource, TitleKeks[i], 0x10);
CryptoOld.DecryptEcb(MasterKeys[i], TitleKekSource, TitleKeks[i], 0x10);
}
if (havePackage2KeySource)
{
Crypto.DecryptEcb(MasterKeys[i], Package2KeySource, Package2Keys[i], 0x10);
CryptoOld.DecryptEcb(MasterKeys[i], Package2KeySource, Package2Keys[i], 0x10);
}
}
}
@ -440,15 +440,15 @@ namespace LibHac
var headerKek = new byte[0x10];
Crypto.GenerateKek(MasterKeys[0], HeaderKekSource, headerKek, AesKekGenerationSource,
CryptoOld.GenerateKek(MasterKeys[0], HeaderKekSource, headerKek, AesKekGenerationSource,
AesKeyGenerationSource);
Crypto.DecryptEcb(headerKek, HeaderKeySource, HeaderKey, 0x20);
CryptoOld.DecryptEcb(headerKek, HeaderKeySource, HeaderKey, 0x20);
}
public void DeriveSdCardKeys()
{
var sdKek = new byte[0x10];
Crypto.GenerateKek(MasterKeys[0], SdCardKekSource, sdKek, AesKekGenerationSource, AesKeyGenerationSource);
CryptoOld.GenerateKek(MasterKeys[0], SdCardKekSource, sdKek, AesKekGenerationSource, AesKeyGenerationSource);
for (int k = 0; k < SdCardKeyIdCount; k++)
{
@ -460,7 +460,7 @@ namespace LibHac
for (int k = 0; k < SdCardKeyIdCount; k++)
{
Crypto.DecryptEcb(sdKek, SdCardKeySourcesSpecific[k], SdCardKeys[k], 0x20);
CryptoOld.DecryptEcb(sdKek, SdCardKeySourcesSpecific[k], SdCardKeys[k], 0x20);
}
// Derive sd card save key
@ -473,8 +473,8 @@ namespace LibHac
keySource[i] = (byte)(SaveMacSdCardKeySource[i] ^ SdSeed[i]);
}
Crypto.GenerateKek(MasterKeys[0], SaveMacSdCardKekSource, sdKek, AesKekGenerationSource, null);
Crypto.DecryptEcb(sdKek, keySource, SaveMacSdCardKey, 0x10);
CryptoOld.GenerateKek(MasterKeys[0], SaveMacSdCardKekSource, sdKek, AesKekGenerationSource, null);
CryptoOld.DecryptEcb(sdKek, keySource, SaveMacSdCardKey, 0x10);
}
}

View file

@ -44,7 +44,7 @@ namespace LibHac.Npdm
{
reader.BaseStream.Position = offset + 0x100;
byte[] signatureData = reader.ReadBytes(Size);
SignatureValidity = Crypto.Rsa2048PssVerify(signatureData, Rsa2048Signature, keyset.AcidFixedKeyModulus);
SignatureValidity = CryptoOld.Rsa2048PssVerify(signatureData, Rsa2048Signature, keyset.AcidFixedKeyModulus);
}
reader.BaseStream.Position = offset + 0x208;

View file

@ -151,7 +151,7 @@ namespace LibHac
Signature = reader.ReadBytes(0x100);
byte[] sigData = reader.ReadBytes(0x100);
SignatureValidity = Crypto.Rsa2048PssVerify(sigData, Signature, keyset.Package2FixedKeyModulus);
SignatureValidity = CryptoOld.Rsa2048PssVerify(sigData, Signature, keyset.Package2FixedKeyModulus);
reader.BaseStream.Position -= 0x100;
Counter = reader.ReadBytes(0x10);

View file

@ -153,7 +153,7 @@ namespace LibHac
return commonKey;
}
return Crypto.DecryptTitleKey(TitleKeyBlock, keyset.EticketExtKeyRsa);
return CryptoOld.DecryptTitleKey(TitleKeyBlock, keyset.EticketExtKeyRsa);
}
}

View file

@ -83,7 +83,7 @@ namespace LibHac
byte[] sigData = reader.ReadBytes(SignatureSize);
reader.BaseStream.Position = SignatureSize + 4;
SignatureValidity = Crypto.Rsa2048Pkcs1Verify(sigData, Signature, _xciHeaderPubk);
SignatureValidity = CryptoOld.Rsa2048Pkcs1Verify(sigData, Signature, _xciHeaderPubk);
RomAreaStartPage = reader.ReadInt32();
BackupAreaStartPage = reader.ReadInt32();
@ -95,12 +95,12 @@ namespace LibHac
Flags = (GameCardAttribute)reader.ReadByte();
PackageId = reader.ReadUInt64();
ValidDataEndPage = reader.ReadInt64();
AesCbcIv = reader.ReadBytes(Crypto.Aes128Size);
AesCbcIv = reader.ReadBytes(CryptoOld.Aes128Size);
Array.Reverse(AesCbcIv);
RootPartitionOffset = reader.ReadInt64();
RootPartitionHeaderSize = reader.ReadInt64();
RootPartitionHeaderHash = reader.ReadBytes(Crypto.Sha256DigestSize);
InitialDataHash = reader.ReadBytes(Crypto.Sha256DigestSize);
RootPartitionHeaderHash = reader.ReadBytes(CryptoOld.Sha256DigestSize);
InitialDataHash = reader.ReadBytes(CryptoOld.Sha256DigestSize);
SelSec = reader.ReadInt32();
SelT1Key = reader.ReadInt32();
SelKey = reader.ReadInt32();
@ -110,7 +110,7 @@ namespace LibHac
{
byte[] encHeader = reader.ReadBytes(EncryptedHeaderSize);
var decHeader = new byte[EncryptedHeaderSize];
Crypto.DecryptCbc(keyset.XciHeaderKey, AesCbcIv, encHeader, decHeader, EncryptedHeaderSize);
CryptoOld.DecryptCbc(keyset.XciHeaderKey, AesCbcIv, encHeader, decHeader, EncryptedHeaderSize);
using (var decreader = new BinaryReader(new MemoryStream(decHeader)))
{
@ -128,10 +128,10 @@ namespace LibHac
}
}
ImageHash = Crypto.ComputeSha256(sigData, 0, sigData.Length);
ImageHash = CryptoOld.ComputeSha256(sigData, 0, sigData.Length);
reader.BaseStream.Position = RootPartitionOffset;
PartitionFsHeaderValidity = Crypto.CheckMemoryHashTable(reader.ReadBytes((int)RootPartitionHeaderSize), RootPartitionHeaderHash, 0, (int)RootPartitionHeaderSize);
PartitionFsHeaderValidity = CryptoOld.CheckMemoryHashTable(reader.ReadBytes((int)RootPartitionHeaderSize), RootPartitionHeaderHash, 0, (int)RootPartitionHeaderSize);
}
}
}

View file

@ -2,7 +2,7 @@
using System.Diagnostics;
using System.Linq;
using LibHac;
using LibHac.Crypto2;
using LibHac.Crypto;
using LibHac.Fs;
using LibHac.FsSystem;

View file

@ -57,7 +57,7 @@ namespace LibHac.Tests
{
var actual = new byte[0x10];
Crypto.CalculateAesCmac(data.Key, data.Message, data.Start, actual, 0, data.Length);
CryptoOld.CalculateAesCmac(data.Key, data.Message, data.Start, actual, 0, data.Length);
Assert.Equal(data.Expected, actual);
}

View file

@ -1,4 +1,4 @@
using LibHac.Crypto2;
using LibHac.Crypto;
using Xunit;
namespace LibHac.Tests.CryptoTests

View file

@ -1,4 +1,4 @@
using LibHac.Crypto2;
using LibHac.Crypto;
using Xunit;
namespace LibHac.Tests.CryptoTests

View file

@ -1,4 +1,4 @@
using LibHac.Crypto2;
using LibHac.Crypto;
using Xunit;
namespace LibHac.Tests.CryptoTests

View file

@ -1,4 +1,4 @@
using LibHac.Crypto2;
using LibHac.Crypto;
using Xunit;
namespace LibHac.Tests.CryptoTests

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using LibHac.Crypto2;
using LibHac.Crypto;
using Xunit;
namespace LibHac.Tests.CryptoTests

View file

@ -1,4 +1,4 @@
using LibHac.Crypto2;
using LibHac.Crypto;
using Xunit;
namespace LibHac.Tests.CryptoTests