From: Klas Lindfors Date: Wed, 8 Jan 2014 14:21:50 +0000 (+0100) Subject: set errno for errors in ykp_HMAC_key_from_hex() X-Git-Tag: v1.15.0~17 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41480bbf5476a96b6b7156afec9f3a9033fbec6b;p=yubikey-personalization set errno for errors in ykp_HMAC_key_from_hex() --- 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);