Change totp to take a uint64_t instead of time_t
Let the application deal with converting time_t to uint64_t. For TOTP, it's just a counter. While there, rename 'granularity' to 'step', as it's used in RFC 6238.
This commit is contained in:
parent
9a5f0f724e
commit
22333c5d6e
4
otp.c
4
otp.c
@ -75,8 +75,8 @@ hotp(enum otp_hmac hmac, const void *key, size_t key_len, uint64_t counter,
|
||||
}
|
||||
|
||||
int32_t
|
||||
totp(enum otp_hmac hmac, const void *key, size_t key_len, time_t t,
|
||||
unsigned int granularity, unsigned int digits)
|
||||
totp(enum otp_hmac hmac, const void *key, size_t key_len, uint64_t t,
|
||||
unsigned int step, unsigned int digits)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
3
otp.h
3
otp.h
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
enum otp_hmac {
|
||||
OTP_HMAC_SHA1,
|
||||
@ -23,5 +22,5 @@ enum otp_hmac {
|
||||
};
|
||||
|
||||
int32_t hotp(enum otp_hmac, const void *, size_t, uint64_t, unsigned int);
|
||||
int32_t totp(enum otp_hmac, const void *, size_t, time_t, unsigned int,
|
||||
int32_t totp(enum otp_hmac, const void *, size_t, uint64_t, unsigned int,
|
||||
unsigned int);
|
||||
|
Loading…
Reference in New Issue
Block a user