39#pragma alloc_text(PAGE, DeviceHandleAacsReadMediaKeyBlock)
40#pragma alloc_text(PAGE, DeviceHandleAacsStartSession)
41#pragma alloc_text(PAGE, DeviceHandleAacsEndSession)
42#pragma alloc_text(PAGE, DeviceHandleAacsSendCertificate)
43#pragma alloc_text(PAGE, DeviceHandleAacsGetCertificate)
44#pragma alloc_text(PAGE, DeviceHandleAacsGetChallengeKey)
45#pragma alloc_text(PAGE, DeviceHandleAacsReadSerialNumber)
46#pragma alloc_text(PAGE, DeviceHandleAacsReadMediaId)
47#pragma alloc_text(PAGE, DeviceHandleAacsReadBindingNonce)
48#pragma alloc_text(PAGE, DeviceHandleAacsGenerateBindingNonce)
49#pragma alloc_text(PAGE, DeviceHandleReadVolumeId)
50#pragma alloc_text(PAGE, DeviceHandleSendChallengeKey)
56DeviceHandleAacsReadMediaKeyBlock(
100 (
PVOID*)&outputBuffer,
112 if (transferSize > DeviceExtension->ScratchContext.ScratchBufferSize)
121 UCHAR rmdBlockNumber = 0;
138 while (sendChangedCommand)
146 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, transferSize,
TRUE, &cdb, 12);
149 #ifdef ENABLE_AACS_TESTING
152 static const UCHAR results[] = { 0x80, 0x02, 0x00, 0x02 };
158 static const UCHAR results[] = { 0x80, 0x02, 0x00, 0x02 };
159 static const UCHAR defaultFill = 0x30;
160 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x8004, defaultFill);
177 "AACS: Device is reporting zero total packs (invalid)\n"));
188 if (otherPacks != thisPackNumber)
199 rmdBlockNumber = otherPacks;
207 sendChangedCommand =
TRUE;
229 *((
PULONG)outputBuffer) = totalSize;
234 sendChangedCommand =
FALSE;
253 size_t originalBufferSize;
275 whereToCopy = outputBuffer;
286 if (thisPackNumber != otherPacks)
307 sendChangedCommand =
TRUE;
313 sendChangedCommand =
FALSE;
325 sendChangedCommand =
FALSE;
337DeviceHandleAacsStartSession(
387 cdb.
REPORT_KEY.AllocationLength[0] = (
UCHAR)(dataTransferLength >> (8*1));
388 cdb.
REPORT_KEY.AllocationLength[1] = (
UCHAR)(dataTransferLength >> (8*0));
391 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
393#ifdef ENABLE_AACS_TESTING
394 static const UCHAR results[] = { 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0 };
415DeviceHandleAacsEndSession(
456 ULONG transferSize = 0;
468 currentSession = *sessionId;
469 limitSession = *sessionId;
483 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, transferSize,
FALSE, &cdb, 12);
488#ifdef ENABLE_AACS_TESTING
500DeviceHandleAacsSendCertificate(
549 ULONG tmp = dataTransferLength;
562 cdb.
SEND_KEY.ParameterListLength[0] = (
UCHAR)(dataTransferLength >> (8*1));
563 cdb.
SEND_KEY.ParameterListLength[1] = (
UCHAR)(dataTransferLength >> (8*0));
567 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
FALSE, &cdb, 12);
569#ifdef ENABLE_AACS_TESTING
585DeviceHandleAacsGetCertificate(
629 (
PVOID*)&outputBuffer,
644 cdb.
REPORT_KEY.AllocationLength[0] = (
UCHAR)(dataTransferLength >> (8*1));
645 cdb.
REPORT_KEY.AllocationLength[1] = (
UCHAR)(dataTransferLength >> (8*0));
649 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
651#ifdef ENABLE_AACS_TESTING
652 static const UCHAR results[] = { 0x00, 0x72, 0x00, 0x00 };
653 static const UCHAR defaultFill = 0x31;
654 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0074, defaultFill);
679 if (
header->Length != dataLengthToCopy)
702DeviceHandleAacsGetChallengeKey(
746 (
PVOID*)&outputBuffer,
761 cdb.
REPORT_KEY.AllocationLength[0] = (
UCHAR)(dataTransferLength >> (8*1));
762 cdb.
REPORT_KEY.AllocationLength[1] = (
UCHAR)(dataTransferLength >> (8*0));
766 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
768#ifdef ENABLE_AACS_TESTING
769 static const UCHAR results[] = { 0x00, 0x52, 0x00, 0x00 };
770 static const UCHAR defaultFill = 0x32;
771 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0054, defaultFill);
796 if (
header->Length != dataLengthToCopy)
819DeviceHandleSendChallengeKey(
868 ULONG tmp = dataTransferLength;
880 cdb.
SEND_KEY.ParameterListLength[0] = (
UCHAR)(dataTransferLength >> (8*1));
881 cdb.
SEND_KEY.ParameterListLength[1] = (
UCHAR)(dataTransferLength >> (8*0));
885 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
FALSE, &cdb, 12);
887#ifdef ENABLE_AACS_TESTING
903DeviceHandleReadVolumeId(
947 (
PVOID*)&outputBuffer,
966 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
968#ifdef ENABLE_AACS_TESTING
969 static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 };
970 static const UCHAR defaultFill = 0x33;
971 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill);
996 if (
header->Length != dataLengthToCopy)
1019DeviceHandleAacsReadSerialNumber(
1063 (
PVOID*)&outputBuffer,
1082 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
1084#ifdef ENABLE_AACS_TESTING
1085 static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 };
1086 static const UCHAR defaultFill = 0x34;
1087 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill);
1112 if (
header->Length != dataLengthToCopy)
1135DeviceHandleAacsReadMediaId(
1179 (
PVOID*)&outputBuffer,
1198 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
1200#ifdef ENABLE_AACS_TESTING
1201 static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 };
1202 static const UCHAR defaultFill = 0x35;
1203 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill);
1228 if (
header->Length != dataLengthToCopy)
1251DeviceHandleAacsReadBindingNonce(
1295 (
PVOID*)&outputBuffer,
1315 cdb.
REPORT_KEY.AllocationLength[0] = (
UCHAR)(dataTransferLength >> (8*1));
1316 cdb.
REPORT_KEY.AllocationLength[1] = (
UCHAR)(dataTransferLength >> (8*0));
1320 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
1322#ifdef ENABLE_AACS_TESTING
1323 static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 };
1324 static const UCHAR defaultFill = 0x36;
1325 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill);
1350 if (
header->Length != dataLengthToCopy)
1373DeviceHandleAacsGenerateBindingNonce(
1417 (
PVOID*)&outputBuffer,
1431 status = ScratchBuffer_ExecuteCdb(DeviceExtension,
Request, dataTransferLength,
TRUE, &cdb, 12);
1433#ifdef ENABLE_AACS_TESTING
1434 static const UCHAR results[] = { 0x00, 0x22, 0x00, 0x00 };
1435 static const UCHAR defaultFill = 0x37;
1436 RtlFillMemory(DeviceExtension->ScratchContext.ScratchBuffer, 0x0024, defaultFill);
1461 if (
header->Length != dataLengthToCopy)
static struct _test_info results[8]
#define AACS_MKB_PACK_SIZE
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
#define MAX_COPY_PROTECT_AGID
struct _CDVD_KEY_HEADER * PCDVD_KEY_HEADER
struct _CDVD_REPORT_AGID_DATA * PCDVD_REPORT_AGID_DATA
#define SCSIOP_REPORT_KEY
#define SCSIOP_READ_DVD_STRUCTURE
struct _CDVD_KEY_HEADER CDVD_KEY_HEADER
#define NT_SUCCESS(StatCode)
_In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_PARAMETERS RequestParameters
struct _DVD_DESCRIPTOR_HEADER DVD_DESCRIPTOR_HEADER
#define _IRQL_requires_max_(irql)
GLenum GLenum GLenum input
#define RtlFillMemory(Dest, Length, Fill)
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_INTERNAL_ERROR
#define IOCTL_AACS_READ_MEDIA_KEY_BLOCK
#define IOCTL_AACS_READ_MEDIA_KEY_BLOCK_SIZE
struct _AACS_SERIAL_NUMBER AACS_SERIAL_NUMBER
struct _AACS_BINDING_NONCE AACS_BINDING_NONCE
struct _AACS_MEDIA_ID AACS_MEDIA_ID
#define DVD_END_ALL_SESSIONS
struct _AACS_VOLUME_ID AACS_VOLUME_ID
struct _AACS_CERTIFICATE AACS_CERTIFICATE
struct _AACS_CHALLENGE_KEY AACS_CHALLENGE_KEY
VOID ScratchBuffer_ResetItems(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ BOOLEAN ResetRequestHistory)
FORCEINLINE VOID ScratchBuffer_EndUse(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension)
#define ScratchBuffer_BeginUse(context)
struct _READ_DVD_STRUCTURES_HEADER READ_DVD_STRUCTURES_HEADER
#define REVERSE_SHORT(Short)
#define DVD_INVALIDATE_AGID
#define STATUS_BUFFER_TOO_SMALL
#define TRACE_LEVEL_WARNING
union _WDF_REQUEST_PARAMETERS::@3882 Parameters
struct _WDF_REQUEST_PARAMETERS::@3882::@3886 DeviceIoControl
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_IO_DEVICE_ERROR
struct _CDB::_READ_DVD_STRUCTURE READ_DVD_STRUCTURE
struct _CDB::_SEND_KEY SEND_KEY
struct _CDB::_REPORT_KEY REPORT_KEY