Merge pull request #530 from aaru-dps/fakeshemp/titlekeys-detection

Strengthen the detection of needing to dump DVD title keys
This commit is contained in:
2021-01-19 14:44:24 +00:00
committed by GitHub
2 changed files with 73 additions and 70 deletions

View File

@@ -105,9 +105,9 @@ namespace Aaru.Core.Devices.Dumping
if(!sense && if(!sense &&
!_dev.Error) !_dev.Error)
{ {
if(Settings.Settings.Current.EnableDecryption) if(Settings.Settings.Current.EnableDecryption &&
{ discKey != null &&
if(_titleKeys && discKey != null) _titleKeys)
{ {
for(ulong j = 0; j < blocksToRead; j++) for(ulong j = 0; j < blocksToRead; j++)
{ {
@@ -115,14 +115,14 @@ namespace Aaru.Core.Devices.Dumping
break; break;
if(!_resume.MissingTitleKeys.Contains(i + j)) if(!_resume.MissingTitleKeys.Contains(i + j))
// Key is already dumped. // Key is already dumped.
continue; continue;
byte[] tmpBuf; byte[] tmpBuf;
bool tmpSense = dvdDecrypt.ReadTitleKey(out tmpBuf, out _, bool tmpSense = dvdDecrypt.ReadTitleKey(out tmpBuf, out _, DvdCssKeyClass.DvdCssCppmOrCprm,
DvdCssKeyClass.DvdCssCppmOrCprm, i + j, i + j, _dev.Timeout, out _);
_dev.Timeout, out _);
if(!tmpSense) if(!tmpSense)
{ {
@@ -181,15 +181,16 @@ namespace Aaru.Core.Devices.Dumping
_outputPlugin.WriteSectorTag(tmpBuf, i + j, SectorTagType.DvdTitleKeyDecrypted); _outputPlugin.WriteSectorTag(tmpBuf, i + j, SectorTagType.DvdTitleKeyDecrypted);
} }
} }
}
if(!_storeEncrypted && _titleKeys) if(!_storeEncrypted)
// Todo: Flag in the _outputPlugin that a sector has been decrypted // Todo: Flag in the _outputPlugin that a sector has been decrypted
buffer = CSS.DecryptSector(buffer, buffer = CSS.DecryptSector(buffer,
_outputPlugin.ReadSectorsTag(i, blocksToRead, SectorTagType.DvdCmi),
_outputPlugin.ReadSectorsTag(i, blocksToRead, _outputPlugin.ReadSectorsTag(i, blocksToRead,
SectorTagType.DvdTitleKeyDecrypted), SectorTagType.DvdCmi),
blocksToRead, blockSize); _outputPlugin.ReadSectorsTag(i, blocksToRead,
SectorTagType.DvdTitleKeyDecrypted), blocksToRead,
blockSize);
} }
mhddLog.Write(i, cmdDuration); mhddLog.Write(i, cmdDuration);

View File

@@ -668,7 +668,9 @@ namespace Aaru.Core.Devices.Dumping
bool newTrim = false; bool newTrim = false;
if(Settings.Settings.Current.EnableDecryption && _titleKeys) if(Settings.Settings.Current.EnableDecryption &&
_titleKeys &&
dskType == MediaType.DVDROM)
{ {
UpdateStatus?.Invoke("Title keys dumping is enabled. This will be very slow."); UpdateStatus?.Invoke("Title keys dumping is enabled. This will be very slow.");
_resume.MissingTitleKeys ??= new List<ulong>(Enumerable.Range(0, (int)blocks).Select(n => (ulong)n)); _resume.MissingTitleKeys ??= new List<ulong>(Enumerable.Range(0, (int)blocks).Select(n => (ulong)n));