summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2018-12-08 00:51:03 -0500
committerChris Ball <chris@printf.net>2018-12-08 00:51:37 -0500
commit485b05ec40031a06077db9c84ae75a36ebd3db25 (patch)
treebcd0afb95e24ef3b9495e8f296cda6e3fe9de43b
parentbd23a79e34ec7f058426027fbcc1b493f960da90 (diff)
downloadmmc-utils-old-485b05ec40031a06077db9c84ae75a36ebd3db25.tar.gz
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: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Chris Ball <chris@printf.net>
-rw-r--r--mmc_cmds.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mmc_cmds.c b/mmc_cmds.c
index 44623fe..69485e9 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -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),