From 22333c5d6e48f4ef87c4b5aca2d852eaf5bdfb28 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 14 Jun 2020 16:48:14 +0000 Subject: [PATCH] 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. --- otp.c | 4 ++-- otp.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/otp.c b/otp.c index 87c3b0c..472cb0a 100644 --- a/otp.c +++ b/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; } diff --git a/otp.h b/otp.h index 812009e..adaccd5 100644 --- a/otp.h +++ b/otp.h @@ -14,7 +14,6 @@ */ #include -#include 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);