From 229d2f7194d46133192ab9f3aa3475fde4a753e3 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Wed, 8 Jan 2014 15:03:51 +0100 Subject: [PATCH] let ykp_AES_key_from_hex() return error --- ykpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ykpers.c b/ykpers.c index 18f4984..4dafcea 100644 --- a/ykpers.c +++ b/ykpers.c @@ -253,12 +253,15 @@ int ykp_AES_key_from_hex(YKP_CONFIG *cfg, const char *hexkey) { /* Make sure that the hexkey is exactly 32 characters */ if (strlen(hexkey) != 32) { + ykp_errno = YKP_EINVAL; return 1; /* Bad AES key */ } /* Make sure that the hexkey is made up of only [0-9a-f] */ - if (! yubikey_hex_p(hexkey)) + if (! yubikey_hex_p(hexkey)) { + ykp_errno = YKP_EINVAL; return 1; + } yubikey_hex_decode(aesbin, hexkey, sizeof(aesbin)); memcpy(cfg->ykcore_config.key, aesbin, sizeof(cfg->ykcore_config.key)); -- 2.39.5