From 2b20026dd755706934f8f8e1a192bffdfc3d717c Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sun, 1 Jan 2017 20:48:05 +0100 Subject: imxtools/sbtools: rework cryptography It was a mess, a mix of crypto_* and cbc_mac calls. I made everything call crypto functions, and also separate key setup from cryptographic operations, this will be useful to speed up the code in the upcoming commits. Drop support for "usbotp" key, since the crypto code for that was never mainlined and we can always get the keys from a device as long as we have code execution (using the DCP debug registers). Change-Id: I7aa24d12207ffb744225d1b9cc7cb1dc7281dd22 --- utils/imxtools/sbtools/misc.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'utils/imxtools/sbtools/misc.c') diff --git a/utils/imxtools/sbtools/misc.c b/utils/imxtools/sbtools/misc.c index b36ab79..b3ca23c 100644 --- a/utils/imxtools/sbtools/misc.c +++ b/utils/imxtools/sbtools/misc.c @@ -118,7 +118,6 @@ bool parse_key(char **pstr, struct crypto_key_t *key) while(isspace(*str)) str++; /* CRYPTO_KEY: 32 hex characters - * CRYPTO_USBOTP: usbotp(vid:pid) where vid and pid are hex numbers * CRYPTO_XOR_KEY: 256 hex characters */ if(isxdigit(str[0]) && strlen(str) >= 256 && isxdigit(str[32])) { @@ -151,30 +150,7 @@ bool parse_key(char **pstr, struct crypto_key_t *key) return true; } else - { - const char *prefix = "usbotp("; - if(strlen(str) < strlen(prefix)) - return false; - if(strncmp(str, prefix, strlen(prefix)) != 0) - return false; - str += strlen(prefix); - /* vid */ - long vid = strtol(str, &str, 16); - if(vid < 0 || vid > 0xffff) - return false; - if(*str++ != ':') - return false; - /* pid */ - long pid = strtol(str, &str, 16); - if(pid < 0 || pid > 0xffff) - return false; - if(*str++ != ')') - return false; - *pstr = str; - key->method = CRYPTO_USBOTP; - key->u.vid_pid = vid << 16 | pid; - return true; - } + return false; } void add_keys(key_array_t ka, int kac) @@ -278,9 +254,6 @@ void print_key(void *user, misc_printf_t printf, struct crypto_key_t *key, bool case CRYPTO_KEY: print_hex(user, printf, key->u.key, 16, false); break; - case CRYPTO_USBOTP: - printf(user, "USB-OTP(%04x:%04x)", key->u.vid_pid >> 16, key->u.vid_pid & 0xffff); - break; case CRYPTO_NONE: printf(user, "none"); break; -- cgit v1.1