From 72a8cf8dccf6f8b86d1683205e032a94eaa86938 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 17 Jan 2016 20:53:51 -0700 Subject: Move all command code into its own directory There are a lot of unrelated files in common, including all of the commands. Moving them into their own directory makes them easier to find and is more logical. Some commands include non-command code, such as cmd_scsi.c. This should be sorted out at some point so that the function can be enabled with or without the associated command. Unfortunately, with m68k I get this error: m68k: + M5329AFEE +arch/m68k/cpu/mcf532x/start.o: In function `_start': +arch/m68k/cpu/mcf532x/start.S:159:(.text+0x452): relocation truncated to fit: R_68K_PC16 against symbol `board_init_f' defined in .text.board_init_f section in common/built-in.o I hope someone can shed some light on what this means. I hope it isn't depending on the position of code in the image. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Heiko Schocher Acked-by: Stefan Roese Acked-by: Przemyslaw Marczak --- common/cmd_aes.c | 89 -------------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 common/cmd_aes.c (limited to 'common/cmd_aes.c') diff --git a/common/cmd_aes.c b/common/cmd_aes.c deleted file mode 100644 index 76da3efffec..00000000000 --- a/common/cmd_aes.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2014 Marek Vasut - * - * Command for en/de-crypting block of memory with AES-128-CBC cipher. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include -#include -#include -#include -#include -#include -#include - -DECLARE_GLOBAL_DATA_PTR; - -/** - * do_aes() - Handle the "aes" command-line command - * @cmdtp: Command data struct pointer - * @flag: Command flag - * @argc: Command-line argument count - * @argv: Array of command-line arguments - * - * Returns zero on success, CMD_RET_USAGE in case of misuse and negative - * on error. - */ -static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) -{ - uint32_t key_addr, src_addr, dst_addr, len; - uint8_t *key_ptr, *src_ptr, *dst_ptr; - uint8_t key_exp[AES_EXPAND_KEY_LENGTH]; - uint32_t aes_blocks; - int enc; - - if (argc != 6) - return CMD_RET_USAGE; - - if (!strncmp(argv[1], "enc", 3)) - enc = 1; - else if (!strncmp(argv[1], "dec", 3)) - enc = 0; - else - return CMD_RET_USAGE; - - key_addr = simple_strtoul(argv[2], NULL, 16); - src_addr = simple_strtoul(argv[3], NULL, 16); - dst_addr = simple_strtoul(argv[4], NULL, 16); - len = simple_strtoul(argv[5], NULL, 16); - - key_ptr = (uint8_t *)key_addr; - src_ptr = (uint8_t *)src_addr; - dst_ptr = (uint8_t *)dst_addr; - - /* First we expand the key. */ - aes_expand_key(key_ptr, key_exp); - - /* Calculate the number of AES blocks to encrypt. */ - aes_blocks = DIV_ROUND_UP(len, AES_KEY_LENGTH); - - if (enc) - aes_cbc_encrypt_blocks(key_exp, src_ptr, dst_ptr, aes_blocks); - else - aes_cbc_decrypt_blocks(key_exp, src_ptr, dst_ptr, aes_blocks); - - return 0; -} - -/***************************************************/ -#ifdef CONFIG_SYS_LONGHELP -static char aes_help_text[] = - "enc key src dst len - Encrypt block of data $len bytes long\n" - " at address $src using a key at address\n" - " $key and store the result at address\n" - " $dst. The $len size must be multiple of\n" - " 16 bytes and $key must be 16 bytes long.\n" - "aes dec key src dst len - Decrypt block of data $len bytes long\n" - " at address $src using a key at address\n" - " $key and store the result at address\n" - " $dst. The $len size must be multiple of\n" - " 16 bytes and $key must be 16 bytes long."; -#endif - -U_BOOT_CMD( - aes, 6, 1, do_aes, - "AES 128 CBC encryption", - aes_help_text -); -- cgit v1.2.3