diff options
author | Andreas Fenkart <andreas.fenkart@digitalstrom.com> | 2015-12-09 12:13:22 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-02-08 15:10:30 (GMT) |
commit | 8b27abd8ab1f9d04b8eb93a1759ff8dec7c9d576 (patch) | |
tree | 0164403bbc1b64b7fc30930f3cf0652ab4ab787e /tools/env/fw_env.c | |
parent | 167f52587173ad87aac7780058d59aa96422eed0 (diff) | |
download | u-boot-8b27abd8ab1f9d04b8eb93a1759ff8dec7c9d576.tar.xz |
tools: env: make parse_aes_key stateless
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
Diffstat (limited to 'tools/env/fw_env.c')
-rw-r--r-- | tools/env/fw_env.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 8c452a8..7f851e1 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -208,7 +208,7 @@ char *fw_getdefenv(char *name) return NULL; } -static int parse_aes_key(char *key) +static int parse_aes_key(char *key, uint8_t *bin_key) { char tmp[5] = { '0', 'x', 0, 0, 0 }; unsigned long ul; @@ -230,11 +230,9 @@ static int parse_aes_key(char *key) "## Error: '-a' option requires valid AES key\n"); return -1; } - aes_key[i] = ul & 0xff; + bin_key[i] = ul & 0xff; key += 2; } - aes_flag = 1; - return 0; } @@ -267,9 +265,10 @@ int fw_printenv (int argc, char *argv[]) "## Error: '-a' option requires AES key\n"); return -1; } - rc = parse_aes_key(argv[2]); + rc = parse_aes_key(argv[2], aes_key); if (rc) return rc; + aes_flag = 1; argv += 2; argc -= 2; } @@ -526,9 +525,10 @@ int fw_setenv(int argc, char *argv[]) "## Error: '-a' option requires AES key\n"); return -1; } - rc = parse_aes_key(argv[2]); + rc = parse_aes_key(argv[2], aes_key); if (rc) return rc; + aes_flag = 1; argv += 2; argc -= 2; } |