Don't call otp if the hmac is unknown
This commit is contained in:
parent
4d2024128e
commit
dde97e45d0
14
otp.c
14
otp.c
@ -75,9 +75,17 @@ hotp(enum otp_hmac hmac, const void *key, size_t key_len, uint64_t counter,
|
||||
return -1;
|
||||
|
||||
switch (hmac) {
|
||||
case OTP_HMAC_SHA1: evp_md = EVP_sha1(); break;
|
||||
case OTP_HMAC_SHA256: evp_md = EVP_sha256(); break;
|
||||
case OTP_HMAC_SHA512: evp_md = EVP_sha512(); break;
|
||||
case OTP_HMAC_SHA1:
|
||||
evp_md = EVP_sha1();
|
||||
break;
|
||||
case OTP_HMAC_SHA256:
|
||||
evp_md = EVP_sha256();
|
||||
break;
|
||||
case OTP_HMAC_SHA512:
|
||||
evp_md = EVP_sha512();
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
return otp(evp_md, key, (int)key_len, counter, digits);
|
||||
|
Loading…
Reference in New Issue
Block a user