Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new storage type Replay Protected Memory Block is now defined in Windows 10 SDK (10563):
- //
- // IOCTL to send commands to the RPMB for a storage device.
- //
- #define IOCTL_STORAGE_RPMB_COMMAND CTL_CODE(IOCTL_STORAGE_BASE, 0x0726, METHOD_BUFFERED, FILE_ANY_ACCESS)
- typedef enum _STORAGE_PROPERTY_ID {
- StorageDeviceRpmbProperty,
- StorageDeviceAttributesProperty
- } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
- //
- // Output buffer for StorageDeviceRpmbProperty & PropertyStandardQuery
- //
- #define DEVICE_RPMB_DESCRIPTOR_VERSION_1 1
- typedef struct _DEVICE_RPMB_DESCRIPTOR {
- //
- // Keep compatible with STORAGE_DESCRIPTOR_HEADER
- // Shall be set to DEVICE_RPMB_DESCRIPTOR_VERSION_1
- //
- ULONG Version;
- //
- // Keep compatible with STORAGE_DESCRIPTOR_HEADER
- // Shall be set to sizeof(DEVICE_RPMB_DESCRIPTOR)
- //
- ULONG Size;
- //
- // 0 if not supported, RPMB size in bytes otherwise
- //
- ULONG SizeInBytes;
- //
- // 0 if not supported, minimum 512 bytes
- // For UFS, this is (bRPMB_ReadWriteSize * 256)
- //
- ULONG MaxReliableWriteSizeInBytes;
- } DEVICE_RPMB_DESCRIPTOR, *PDEVICE_RPMB_DESCRIPTOR;
- //
- // IOCTL_STORAGE_RPMB_COMMAND
- //
- // This IOCTL sends an RPMB command to the underlying storage device.
- //
- // Input buffer:
- // An array of STORAGE_DEVICE_RPMB_DATA_FRAME structures
- // * The number of frames included can be calculated by InputBufferLength / sizeof(STORAGE_DEVICE_RPMB_DATA_FRAME)
- //
- // Output buffer:
- // An array of STORAGE_DEVICE_RPMB_DATA_FRAME structures
- // * The number of frames included can be calculated by OutputBufferLength / sizeof(STORAGE_DEVICE_RPMB_DATA_FRAME)
- //
- // Ensure we are byte aligned
- #pragma pack(push)
- #pragma pack(1)
- //
- // This is the RPMB data frame used to compose all RPMB requests and responses.
- //
- typedef struct _STORAGE_DEVICE_RPMB_DATA_FRAME {
- //
- // Reserved
- //
- UCHAR Stuff[196];
- //
- // Either the key to be programmed or the MAC authenticating this frame or series of frames
- //
- UCHAR KeyOrMAC[32];
- //
- // The data input or output
- //
- UCHAR Data[256];
- //
- // Random 128-bit number generated by host
- //
- UCHAR Nonce[16];
- //
- // 32-bit counter
- //
- UCHAR WriteCounter[4];
- //
- // The half-sector address to operate on
- //
- UCHAR Address[2];
- //
- // The count of half-sector blocks to read/write
- //
- UCHAR BlockCount[2];
- //
- // The result of the operation
- //
- UCHAR OperationResult[2];
- //
- // The type of request or response
- //
- UCHAR RequestOrResponseType[2];
- } STORAGE_DEVICE_RPMB_DATA_FRAME, *PSTORAGE_DEVICE_RPMB_DATA_FRAME;
- //
- // RPMB RequestOrResponseType Values
- //
- typedef enum _STORAGE_DEVICE_RPMB_COMMAND {
- StorRpmbProgramAuthKey = 0x00000001,
- StorRpmbQueryWriteCounter = 0x00000002,
- StorRpmbAuthenticatedWrite = 0x00000003,
- StorRpmbAuthenticatedRead = 0x00000004,
- StorRpmbAuthenticatedDeviceConfigWrite = 0x00000006,
- StorRpmbAuthenticatedDeviceConfigRead = 0x00000007,
- } STORAGE_DEVICE_RPMB_COMMAND, *PSTORAGE_DEVICE_RPMB_COMMAND;
- #pragma pack(pop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement