aboutsummaryrefslogtreecommitdiff
path: root/src/authorization/anastasis_authorization_plugin_totp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/authorization/anastasis_authorization_plugin_totp.c')
-rw-r--r--src/authorization/anastasis_authorization_plugin_totp.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/authorization/anastasis_authorization_plugin_totp.c b/src/authorization/anastasis_authorization_plugin_totp.c
index b3d5bc0..74d7b7c 100644
--- a/src/authorization/anastasis_authorization_plugin_totp.c
+++ b/src/authorization/anastasis_authorization_plugin_totp.c
@@ -144,7 +144,6 @@ compute_totp (int time_off,
144 uint8_t hmac[20]; /* SHA1: 20 bytes */ 144 uint8_t hmac[20]; /* SHA1: 20 bytes */
145 145
146 now = GNUNET_TIME_absolute_get (); 146 now = GNUNET_TIME_absolute_get ();
147 (void) GNUNET_TIME_round_abs (&now);
148 while (time_off < 0) 147 while (time_off < 0)
149 { 148 {
150 now = GNUNET_TIME_absolute_subtract (now, 149 now = GNUNET_TIME_absolute_subtract (now,
@@ -300,10 +299,9 @@ totp_process (struct ANASTASIS_AUTHORIZATION_State *as,
300 /* Build HTTP response */ 299 /* Build HTTP response */
301 { 300 {
302 struct MHD_Response *resp; 301 struct MHD_Response *resp;
303 struct GNUNET_TIME_Absolute now; 302 struct GNUNET_TIME_Timestamp now;
304 303
305 now = GNUNET_TIME_absolute_get (); 304 now = GNUNET_TIME_timestamp_get ();
306 (void) GNUNET_TIME_round_abs (&now);
307 if (TALER_MHD_xmime_matches (mime, 305 if (TALER_MHD_xmime_matches (mime,
308 "application/json")) 306 "application/json"))
309 { 307 {
@@ -313,8 +311,8 @@ totp_process (struct ANASTASIS_AUTHORIZATION_State *as,
313 GNUNET_JSON_pack_string ("hint", 311 GNUNET_JSON_pack_string ("hint",
314 TALER_ErrorCode_get_hint ( 312 TALER_ErrorCode_get_hint (
315 TALER_EC_ANASTASIS_TRUTH_CHALLENGE_FAILED)), 313 TALER_EC_ANASTASIS_TRUTH_CHALLENGE_FAILED)),
316 GNUNET_JSON_pack_time_abs ("server_time", 314 GNUNET_JSON_pack_timestamp ("server_time",
317 now)); 315 now));
318 } 316 }
319 else 317 else
320 { 318 {
@@ -325,7 +323,7 @@ totp_process (struct ANASTASIS_AUTHORIZATION_State *as,
325 response_size 323 response_size
326 = GNUNET_asprintf (&response, 324 = GNUNET_asprintf (&response,
327 "Server time: %s", 325 "Server time: %s",
328 GNUNET_STRINGS_absolute_time_to_string (now)); 326 GNUNET_TIME_timestamp2s (now));
329 resp = MHD_create_response_from_buffer (response_size, 327 resp = MHD_create_response_from_buffer (response_size,
330 response, 328 response,
331 MHD_RESPMEM_MUST_COPY); 329 MHD_RESPMEM_MUST_COPY);