diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-09-29 23:04:23 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-09-29 23:04:23 +0200 |
commit | a16b1544ffb8d5a62fb06795abfd9490c6a4376c (patch) | |
tree | 33e88a6c35450bc38009c22de562e143ac5e3fef | |
parent | 58daaedd2a27aa8a5ff36e5e9f2943d8f1680881 (diff) | |
download | anastasis-a16b1544ffb8d5a62fb06795abfd9490c6a4376c.tar.gz anastasis-a16b1544ffb8d5a62fb06795abfd9490c6a4376c.zip |
-use 8 digits
-rw-r--r-- | src/authorization/anastasis_authorization_plugin_totp.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_totp.c b/src/authorization/anastasis_authorization_plugin_totp.c index 68e8def..0934910 100644 --- a/src/authorization/anastasis_authorization_plugin_totp.c +++ b/src/authorization/anastasis_authorization_plugin_totp.c | |||
@@ -191,17 +191,8 @@ compute_totp (int time_off, | |||
191 | for (int count = 0; count < 4; count++) | 191 | for (int count = 0; count < 4; count++) |
192 | code |= hmac[offset + 3 - count] << (8 * count); | 192 | code |= hmac[offset + 3 - count] << (8 * count); |
193 | code &= 0x7fffffff; | 193 | code &= 0x7fffffff; |
194 | 194 | /* always use 8 digits (maximum) */ | |
195 | #if VAR_DIGITS | 195 | code = code % 100000000; |
196 | if (digits == 6) | ||
197 | code = code % 1000000; | ||
198 | else if (digits == 7) | ||
199 | code = code % 10000000; | ||
200 | else if (digits == 8) | ||
201 | code = code % 100000000; | ||
202 | #else | ||
203 | code = code % 1000000; | ||
204 | #endif | ||
205 | return code; | 196 | return code; |
206 | } | 197 | } |
207 | } | 198 | } |
@@ -246,10 +237,6 @@ totp_start (void *cls, | |||
246 | want = compute_totp (i, | 237 | want = compute_totp (i, |
247 | data, | 238 | data, |
248 | data_length); | 239 | data_length); |
249 | fprintf (stderr, | ||
250 | "TOTP %d: %llu\n", | ||
251 | i, | ||
252 | (unsigned long long) want); | ||
253 | ANASTASIS_hash_answer (want, | 240 | ANASTASIS_hash_answer (want, |
254 | &as->valid_replies[off++]); | 241 | &as->valid_replies[off++]); |
255 | } | 242 | } |