Code restyle.

This commit is contained in:
2021-01-17 22:53:58 +00:00
parent 713658f2ab
commit b1e2fd4953
2 changed files with 26 additions and 59 deletions

View File

@@ -371,9 +371,8 @@ namespace Aaru.Decryption.DVD
}; };
/// <summary> /// <summary>
/// The disc key returned by the logical unit is encoded with the bus key /// The disc key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks.
/// to prevent man-in-the-middle attacks. This method returns a structure /// This method returns a structure with the decoded key included.
/// with the decoded key included.
/// </summary> /// </summary>
/// <param name="response">The encoded key from the logical unit.</param> /// <param name="response">The encoded key from the logical unit.</param>
/// <param name="busKey">The bus key from the logical unit.</param> /// <param name="busKey">The bus key from the logical unit.</param>
@@ -399,9 +398,8 @@ namespace Aaru.Decryption.DVD
} }
/// <summary> /// <summary>
/// The title key returned by the logical unit is encoded with the bus key /// The title key returned by the logical unit is encoded with the bus key to prevent man-in-the-middle attacks.
/// to prevent man-in-the-middle attacks. This method returns a structure /// This method returns a structure with the decoded key included.
/// with the decoded key included.
/// </summary> /// </summary>
/// <param name="response">The encoded key from the logical unit.</param> /// <param name="response">The encoded key from the logical unit.</param>
/// <param name="busKey">The bus key from the logical unit.</param> /// <param name="busKey">The bus key from the logical unit.</param>
@@ -429,9 +427,7 @@ namespace Aaru.Decryption.DVD
}; };
} }
/// <summary> /// <summary>Takes a challenge and a variant and encrypts it according to the key type.</summary>
/// Takes a challenge and a variant and encrypts it according to the key type.
/// </summary>
/// <param name="keyType">The type of key to encrypt.</param> /// <param name="keyType">The type of key to encrypt.</param>
/// <param name="variant"></param> /// <param name="variant"></param>
/// <param name="challenge">The challenge sent to the logical unit.</param> /// <param name="challenge">The challenge sent to the logical unit.</param>
@@ -547,9 +543,7 @@ namespace Aaru.Decryption.DVD
} }
} }
/// <summary> /// <summary>Takes an encrypted key and its crypto and returns the key decrypted.</summary>
/// Takes an encrypted key and its crypto and returns the key decrypted.
/// </summary>
/// <param name="invert"></param> /// <param name="invert"></param>
/// <param name="cryptoKey">The key used to encrypt the data.</param> /// <param name="cryptoKey">The key used to encrypt the data.</param>
/// <param name="encryptedKey">The encrypted data.</param> /// <param name="encryptedKey">The encrypted data.</param>
@@ -600,9 +594,7 @@ namespace Aaru.Decryption.DVD
DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) => DecryptTitleKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey) =>
DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey); DecryptKey(invert, cryptoKey, encryptedKey, out decryptedKey);
/// <summary> /// <summary>Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key.</summary>
/// Takes an bytearray of encrypted keys, decrypts them and returns the correctly decrypted key.
/// </summary>
/// <param name="encryptedKeys">Encrypted keys to try to decrypt.</param> /// <param name="encryptedKeys">Encrypted keys to try to decrypt.</param>
/// <param name="decryptedKey">The decrypted key if found.</param> /// <param name="decryptedKey">The decrypted key if found.</param>
public static void DecryptDiscKey(byte[] encryptedKeys, out byte[]? decryptedKey) public static void DecryptDiscKey(byte[] encryptedKeys, out byte[]? decryptedKey)
@@ -634,9 +626,7 @@ namespace Aaru.Decryption.DVD
decryptedKey = null; decryptedKey = null;
} }
/// <summary> /// <summary>Takes a sector and a decrypted title key and returns the decrypted sector.</summary>
/// Takes a sector and a decrypted title key and returns the decrypted sector.
/// </summary>
/// <param name="sectorData">Encrypted sector data.</param> /// <param name="sectorData">Encrypted sector data.</param>
/// <param name="cmiData">The Copyright Management Information.</param> /// <param name="cmiData">The Copyright Management Information.</param>
/// <param name="keyData">The encryption keys.</param> /// <param name="keyData">The encryption keys.</param>
@@ -702,9 +692,7 @@ namespace Aaru.Decryption.DVD
return decryptedBuffer; return decryptedBuffer;
} }
/// <summary> /// <summary>Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible.</summary>
/// Takes an RPC state from the drive and a CMI from a disc and checks if the regions are compatible.
/// </summary>
/// <param name="rpc">The <c>RegionalPlaybackControlState</c> from drive.</param> /// <param name="rpc">The <c>RegionalPlaybackControlState</c> from drive.</param>
/// <param name="cmi">The <c>LeadInCopyright</c> from disc.</param> /// <param name="cmi">The <c>LeadInCopyright</c> from disc.</param>
/// <returns><c>true</c> if the regions are compatible, else <c>false</c></returns> /// <returns><c>true</c> if the regions are compatible, else <c>false</c></returns>

View File

@@ -47,8 +47,6 @@ namespace Aaru.Decryption.DVD
const byte _keySize = 5; const byte _keySize = 5;
const byte _challengeSize = 2 * _keySize; const byte _challengeSize = 2 * _keySize;
readonly Device _dev; readonly Device _dev;
public byte Agid { get; private set; }
public byte[] BusKey { get; private set; }
public Dump(Device dev) public Dump(Device dev)
{ {
@@ -57,9 +55,10 @@ namespace Aaru.Decryption.DVD
Agid = 0; Agid = 0;
} }
/// <summary> public byte Agid { get; private set; }
/// Returns the Authentication Success Flag of the logical unit. public byte[] BusKey { get; private set; }
/// </summary>
/// <summary>Returns the Authentication Success Flag of the logical unit.</summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns> /// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
/// <param name="buffer">Buffer where the Authentication Success Flag will be stored.</param> /// <param name="buffer">Buffer where the Authentication Success Flag will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
@@ -89,9 +88,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Returns the Regional Playback Control State of the logical unit.</summary>
/// Returns the Regional Playback Control State of the logical unit.
/// </summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns> /// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
@@ -121,9 +118,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Invalidates an Authentication Grant ID.</summary>
/// Invalidates an Authentication Grant ID.
/// </summary>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>
@@ -153,9 +148,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Returns a valid Authentication Grant ID for CSS/CPPM.</summary>
/// Returns a valid Authentication Grant ID for CSS/CPPM.
/// </summary>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>
@@ -185,9 +178,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Returns KEY1 from the logical unit.</summary>
/// Returns KEY1 from the logical unit.
/// </summary>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>
@@ -217,9 +208,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Returns the challenge from the logical unit.</summary>
/// Returns the challenge from the logical unit.
/// </summary>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>
@@ -249,9 +238,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Send a challenge to the logical unit.</summary>
/// Send a challenge to the logical unit.
/// </summary>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>
@@ -294,9 +281,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Send KEY2 to the logical unit.</summary>
/// Send KEY2 to the logical unit.
/// </summary>
/// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param> /// <param name="buffer">Buffer where the Regional Playback Control State will be stored.</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>
@@ -334,9 +319,7 @@ namespace Aaru.Decryption.DVD
return sense; return sense;
} }
/// <summary> /// <summary>Returns the encrypted disc key of the MMC logical unit</summary>
/// Returns the encrypted disc key of the MMC logical unit
/// </summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns> /// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
/// <param name="buffer">Buffer where the bus key will be stored</param> /// <param name="buffer">Buffer where the bus key will be stored</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
@@ -359,12 +342,10 @@ namespace Aaru.Decryption.DVD
_dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, _dev.SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
out bool sense); out bool sense);
return (sense); return sense;
} }
/// <summary> /// <summary>Returns the bus key of the MMC logical unit</summary>
/// Returns the bus key of the MMC logical unit
/// </summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns> /// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
/// <param name="buffer">Buffer where the bus key will be stored</param> /// <param name="buffer">Buffer where the bus key will be stored</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
@@ -485,9 +466,7 @@ namespace Aaru.Decryption.DVD
return false; return false;
} }
/// <summary> /// <summary>Reads a title key for a sector on the disc.</summary>
/// Reads a title key for a sector on the disc.
/// </summary>
/// <param name="buffer">Buffer where the bus key will be stored</param> /// <param name="buffer">Buffer where the bus key will be stored</param>
/// <param name="senseBuffer">Sense buffer.</param> /// <param name="senseBuffer">Sense buffer.</param>
/// <param name="keyClass">Key class.</param> /// <param name="keyClass">Key class.</param>