The aes command used to segfault when accessing memory in sandbox.
The pointer accesses should be mapped.

Signed-off-by: Philippe Reynes <philippe.rey...@softathome.com>
---
 cmd/aes.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cmd/aes.c b/cmd/aes.c
index 7ff4a71..3db110c 100644
--- a/cmd/aes.c
+++ b/cmd/aes.c
@@ -11,6 +11,7 @@
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <linux/compiler.h>
+#include <mapmem.h>
 
 /**
  * do_aes() - Handle the "aes" command-line command
@@ -46,10 +47,10 @@ static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
        dst_addr = simple_strtoul(argv[5], NULL, 16);
        len = simple_strtoul(argv[6], NULL, 16);
 
-       key_ptr = (uint8_t *)key_addr;
-       iv_ptr = (uint8_t *)iv_addr;
-       src_ptr = (uint8_t *)src_addr;
-       dst_ptr = (uint8_t *)dst_addr;
+       key_ptr = (uint8_t *)map_sysmem(key_addr, 128 / 8);
+       iv_ptr = (uint8_t *)map_sysmem(iv_addr, 128 / 8);
+       src_ptr = (uint8_t *)map_sysmem(src_addr, len);
+       dst_ptr = (uint8_t *)map_sysmem(dst_addr, len);
 
        /* First we expand the key. */
        aes_expand_key(key_ptr, key_exp);
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to