AACS model cleanup

This commit is contained in:
Matt Nadareski
2025-10-30 20:49:36 -04:00
parent eae75c5943
commit e8b7f33bf0
16 changed files with 36 additions and 35 deletions

View File

@@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.AACS
/// Null-terminated ASCII string representing the copyright
/// </summary>
[MarshalAs(UnmanagedType.LPStr)]
public string? Copyright;
public string Copyright;
}
}
}

View File

@@ -4,7 +4,7 @@ namespace SabreTools.Data.Models.AACS
/// A properly formatted type 3 or type 4 Media Key Block contains exactly
/// one Drive Revocation List Record. It follows the Host Revocation List
/// Record, although it may not immediately follow it.
///
///
/// The Drive Revocation List Record is identical to the Host Revocation
/// List Record, except it has type 2016, and it contains Drive Revocation
/// List Entries, not Host Revocation List Entries. The Drive Revocation List
@@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.AACS
/// <summary>
/// Revocation list entries
/// </summary>
public DriveRevocationSignatureBlock[]? SignatureBlocks { get; set; }
public DriveRevocationSignatureBlock[] SignatureBlocks { get; set; }
}
}
}

View File

@@ -12,6 +12,6 @@ namespace SabreTools.Data.Models.AACS
/// A list of 8-byte Host Drive List Entry fields, the length of this
/// list being equal to the number in the signature block.
/// </summary>
public DriveRevocationListEntry[]? EntryFields { get; set; }
public DriveRevocationListEntry[] EntryFields { get; set; }
}
}
}

View File

@@ -66,4 +66,4 @@ namespace SabreTools.Data.Models.AACS
VerifyMediaKey_AACS2 = 0x86,
EmptyRecord0xF8_AACS2 = 0xF8,
}
}
}

View File

@@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.AACS
/// <summary>
/// In this record, each subset-difference is encoded with 5 bytes.
/// </summary>
public SubsetDifference[]? SubsetDifferences { get; set; }
public SubsetDifference[] SubsetDifferences { get; set; }
}
}
}

View File

@@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.AACS
/// <summary>
/// Revocation list entries
/// </summary>
public HostRevocationSignatureBlock[]? SignatureBlocks { get; set; }
public HostRevocationSignatureBlock[] SignatureBlocks { get; set; }
}
}
}

View File

@@ -12,6 +12,6 @@ namespace SabreTools.Data.Models.AACS
/// A list of 8-byte Host Revocation List Entry fields, the length of this
/// list being equal to the number in the signature block.
/// </summary>
public HostRevocationListEntry[]? EntryFields { get; set; }
public HostRevocationListEntry[] EntryFields { get; set; }
}
}
}

View File

@@ -9,6 +9,6 @@ namespace SabreTools.Data.Models.AACS
/// <summary>
/// Records
/// </summary>
public Record[]? Records { get; set; }
public Record[] Records { get; set; }
}
}
}

View File

@@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.AACS
/// record. This 16 bytes is the ciphertext value C in the media
/// key calculation.
/// </summary>
public byte[][]? MediaKeyData { get; set; }
public byte[][] MediaKeyData { get; set; }
}
}
}

View File

@@ -2,8 +2,8 @@ namespace SabreTools.Data.Models.AACS
{
/// <summary>
/// Each Record begins with a one-byte Record Type field, followed by a
/// three-byte Record Length field.
///
/// three-byte Record Length field.
///
/// The following subsections describe the currently defined Record types,
/// and how a device processes each. All multi-byte integers, including
/// the length field, are “Big Endian”; in other words, the most significant
@@ -25,4 +25,4 @@ namespace SabreTools.Data.Models.AACS
// <remarks>UInt24 not UInt32</remarks>
public uint RecordLength { get; set; }
}
}
}

View File

@@ -20,4 +20,4 @@ namespace SabreTools.Data.Models.AACS
/// </summary>
public uint Number;
}
}
}

View File

@@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.AACS
/// Subset-Difference record, with 0 being the start of the record.
/// </summary>
// <remarks>UInt24 not UInt32</remarks>
public uint[]? Offsets { get; set; }
public uint[] Offsets { get; set; }
}
}
}

View File

@@ -29,4 +29,4 @@ namespace SabreTools.Data.Models.AACS
/// </summary>
public uint VersionNumber { get; set; }
}
}
}

View File

@@ -19,6 +19,7 @@ namespace SabreTools.Data.Models.AACS
/// where 0xXXXXXXXXXXXXXXXX is an arbitrary 8-byte value, and Km is
/// the correct final Media Key value.
/// </summary>
/// <remarks>0x10 bytes</remarks>
public byte[] CiphertextValue { get; set; } = new byte[0x10];
}
}

View File

@@ -21,11 +21,11 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.Records);
}
private static void Print(StringBuilder builder, Record[]? records)
private static void Print(StringBuilder builder, Record[] records)
{
builder.AppendLine(" Records Information:");
builder.AppendLine(" -------------------------");
if (records == null || records.Length == 0)
if (records.Length == 0)
{
builder.AppendLine(" No records");
builder.AppendLine();
@@ -94,7 +94,7 @@ namespace SabreTools.Serialization.Wrappers
{
builder.AppendLine(" Subset Differences:");
builder.AppendLine(" -------------------------");
if (record?.SubsetDifferences == null || record.SubsetDifferences.Length == 0)
if (record.SubsetDifferences.Length == 0)
{
builder.AppendLine(" No subset differences");
return;
@@ -114,7 +114,7 @@ namespace SabreTools.Serialization.Wrappers
{
builder.AppendLine(" Media Keys:");
builder.AppendLine(" -------------------------");
if (record?.MediaKeyData == null || record.MediaKeyData.Length == 0)
if (record.MediaKeyData.Length == 0)
{
builder.AppendLine(" No media keys");
return;
@@ -132,7 +132,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine($" Span: {record.Span} (0x{record.Span:X})");
builder.AppendLine(" Offsets:");
builder.AppendLine(" -------------------------");
if (record.Offsets == null || record.Offsets.Length == 0)
if (record.Offsets.Length == 0)
{
builder.AppendLine(" No offsets");
return;
@@ -156,7 +156,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(record.TotalNumberOfEntries, " Total number of entries");
builder.AppendLine(" Signature Blocks:");
builder.AppendLine(" -------------------------");
if (record.SignatureBlocks == null || record.SignatureBlocks.Length == 0)
if (record.SignatureBlocks.Length == 0)
{
builder.AppendLine(" No signature blocks");
return;
@@ -170,7 +170,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(block.NumberOfEntries, " Number of entries");
builder.AppendLine(" Entry Fields:");
builder.AppendLine(" -------------------------");
if (block.EntryFields == null || block.EntryFields.Length == 0)
if (block.EntryFields.Length == 0)
{
builder.AppendLine(" No entry fields");
continue;
@@ -192,7 +192,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine($" Total number of entries: {record.TotalNumberOfEntries} (0x{record.TotalNumberOfEntries:X})");
builder.AppendLine(" Signature Blocks:");
builder.AppendLine(" -------------------------");
if (record.SignatureBlocks == null || record.SignatureBlocks.Length == 0)
if (record.SignatureBlocks.Length == 0)
{
builder.AppendLine(" No signature blocks");
return;
@@ -206,7 +206,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(block.NumberOfEntries, " Number of entries");
builder.AppendLine(" Entry Fields:");
builder.AppendLine(" -------------------------");
if (block.EntryFields == null || block.EntryFields.Length == 0)
if (block.EntryFields.Length == 0)
{
builder.AppendLine(" No entry fields");
continue;

View File

@@ -18,7 +18,7 @@ namespace SabreTools.Serialization.Wrappers
/// <summary>
/// Media key block records
/// </summary>
public Record[] Records => Model.Records ?? [];
public Record[] Records => Model.Records;
/// <summary>
/// Reported version of the media key block