From 41480bbf5476a96b6b7156afec9f3a9033fbec6b Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Wed, 8 Jan 2014 15:21:50 +0100 Subject: [PATCH] set errno for errors in ykp_HMAC_key_from_hex() --- ykpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ykpers.c b/ykpers.c index 4dafcea..e860419 100644 --- a/ykpers.c +++ b/ykpers.c @@ -280,12 +280,15 @@ int ykp_HMAC_key_from_hex(YKP_CONFIG *cfg, const char *hexkey) { /* Make sure that the hexkey is exactly 40 characters */ if (strlen(hexkey) != 40) { + ykp_errno = YKP_EINVAL; return 1; /* Bad HMAC 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)); i = sizeof(cfg->ykcore_config.key); -- 2.39.5