Commit 485b05ec authored by Wolfram Sang's avatar Wolfram Sang Committed by Chris Ball
Browse files

use proper type for RPMB blocks_cnt



The JEDEC standard is confusing. The number of max blocks for reading
RPMB is determined by CMD23 which can hold an unsigned int and not only
u16. It is true that the current maximum is 64K of blocks, yet this may
be extended in the future. Let's not apply a limit here which should be
checked by the card.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent bd23a79e
......@@ -2070,7 +2070,12 @@ int do_rpmb_read_counter(int nargs, char **argv)
int do_rpmb_read_block(int nargs, char **argv)
{
int i, ret, dev_fd, data_fd, key_fd = -1;
uint16_t addr, blocks_cnt;
uint16_t addr;
/*
* for reading RPMB, number of blocks is set by CMD23 only, the packet
* frame field for that is set to 0. So, the type is not u16 but uint!
*/
unsigned int blocks_cnt;
unsigned char key[32];
struct rpmb_frame frame_in = {
.req_resp = htobe16(MMC_RPMB_READ),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment