DCMD_MMCSD_RPMB_RW_FRAME
QNX SDP8.0Devctl and Ioctl CommandsDeveloper
Read or write an RPMB frame
Synopsis:
#include <hw/dcmd_sim_mmcsd.h>
#define DCMD_MMCSD_RPMB_RW_FRAME __DIOTF(_DCMD_CAM, _SIM_MMCSD + 50, struct _mmcsd_rpmb_req)
Arguments to devctl():
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device |
dcmd | DCMD_MMCSD_RPMB_RW_FRAME |
dev_data_ptr | A pointer to a MMCSD_RPMB_REQ structure |
n_bytes | sizeof(MMCSD_RPMB_REQ) |
dev_info_ptr | NULL |
Description:
This command reads or writes an RPMB frame. The MMCSD_RPMB_REQ structure is defined as follows:
#define RPMB_KEY_MAC_FIELD_LEN 32
#define RPMB_DATA_FIELD_LEN 256
#define RPMB_HASH_DATA_LEN 32
#define RPMB_USABLE_DATA_LEN (RPMB_DATA_FIELD_LEN - RPMB_HASH_DATA_LEN)
#define RPMB_NONCE_FIELD_LEN 16
#define RPMB_ONE_BLK_MAC_LEN (RPMB_DATA_FIELD_LEN + RPMB_NONCE_FIELD_LEN + 4 + 2 + 2 + 2 + 2)
/*(write_cntr + address + block_cnt + result + req_resp) */
typedef struct _mmcsd_rpmb_frame {
uint8_t stuff[196];
uint8_t key_mac[RPMB_KEY_MAC_FIELD_LEN];
uint8_t data[RPMB_DATA_FIELD_LEN];
uint8_t nonce[RPMB_NONCE_FIELD_LEN];
uint32_t write_cntr;
uint16_t address;
uint16_t block_cnt;
uint16_t result;
uint16_t req_resp;
} MMCSD_RPMB_FRAME;
typedef struct _mmcsd_rpmb_req {
uint16_t req_type;
paddr64_t rpmb_frame_paddr; /* Pointer to an MMCSD_RPMB_FRAME */
} MMCSD_RPMB_REQ;
Input:
Set the req_type and req_resp members to one of the following:
- KEY_PROG_REQUEST — not used.
- READ_CNTR_REQUEST — get the number of writes made to the partition and store it in the write_cntr member.
- AUTH_WRITE_REQUEST — write an RMPB block. Set address to the address of the data that you want to write, block_cnt to the number of blocks to write, and write_cntr to the value obtained from a READ_CNTR_REQUEST made just before you make the write request.
- AUTH_READ_REQUEST — read an RPMB block. Set address to the address of a buffer where you want the data to be placed. If address is NULL, this request simply validates the key.
- STATUS_READ_REQUEST — not used.
- KEY_PROG_RESPONSE — not used.
- READ_CNTR_RESPONSE — not used.
- AUTH_WRITE_RESPONSE — not used.
- AUTH_READ_RESPONSE — not used.
Get a one-time key from the device before calling devctl(), and then store the key in the nonce member.
The stuff member is used for additional data, such as an initialization vector.
Output:
The result member is 0 for success; any other value indicates an error. The rest of the output depends on the type of request.
See also:
devctl() in the QNX OS C Library Reference
Page updated: