diff options
author | T Karthik Reddy <t.karthik.reddy@xilinx.com> | 2019-03-12 20:20:21 +0530 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2019-04-16 11:51:34 +0200 |
commit | 958d1b18828d017623c2a48da312921437b86b93 (patch) | |
tree | 92fb32b3b25eb5f84011d7759561a4cbba409861 /board/xilinx/zynq | |
parent | be52372ff1bb52872e20543562b095424f040564 (diff) | |
download | u-boot-958d1b18828d017623c2a48da312921437b86b93.tar.gz u-boot-958d1b18828d017623c2a48da312921437b86b93.tar.bz2 u-boot-958d1b18828d017623c2a48da312921437b86b93.zip |
ARM: zynq: Check zynq aes & rsa command parameters count
This patch checks for zynq aes & rsa commands max parameters count. Also
checks minimum number of parameters count for aes command.
Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx/zynq')
-rw-r--r-- | board/xilinx/zynq/cmds.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c index 8b48ea3a03..27d44b760d 100644 --- a/board/xilinx/zynq/cmds.c +++ b/board/xilinx/zynq/cmds.c @@ -414,9 +414,13 @@ static int do_zynq_rsa(cmd_tbl_t *cmdtp, int flag, int argc, u32 src_ptr; char *endp; + if (argc != cmdtp->maxargs) + return CMD_RET_FAILURE; + src_ptr = simple_strtoul(argv[2], &endp, 16); if (*argv[2] == 0 || *endp != 0) return CMD_RET_USAGE; + if (zynq_verify_image(src_ptr)) return CMD_RET_FAILURE; @@ -432,6 +436,9 @@ static int zynq_decrypt_image(cmd_tbl_t *cmdtp, int flag, int argc, u32 srcaddr, srclen, dstaddr, dstlen; int status; + if (argc < 5 && argc > cmdtp->maxargs) + return CMD_RET_USAGE; + srcaddr = simple_strtoul(argv[2], &endp, 16); if (*argv[2] == 0 || *endp != 0) return CMD_RET_USAGE; @@ -485,7 +492,7 @@ static int do_zynq(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_USAGE; zynq_cmd = find_cmd_tbl(argv[1], zynq_commands, ARRAY_SIZE(zynq_commands)); - if (!zynq_cmd || argc != zynq_cmd->maxargs) + if (!zynq_cmd) return CMD_RET_USAGE; ret = zynq_cmd->cmd(zynq_cmd, flag, argc, argv); |