From c014acf3c4ccf03109b0141d6b68d4f464464e19 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 10 May 2023 01:01:37 +0200 Subject: always use GNUNET_memcpy --- src/util/crypto_confirmation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/util/crypto_confirmation.c') diff --git a/src/util/crypto_confirmation.c b/src/util/crypto_confirmation.c index e52562e3..bbdf701e 100644 --- a/src/util/crypto_confirmation.c +++ b/src/util/crypto_confirmation.c @@ -90,9 +90,9 @@ compute_totp (struct GNUNET_TIME_Timestamp ts, mc = gcry_md_read (md, GCRY_MD_SHA1); GNUNET_assert (NULL != mc); - memcpy (hmac, - mc, - sizeof (hmac)); + GNUNET_memcpy (hmac, + mc, + sizeof (hmac)); gcry_md_close (md); } -- cgit v1.2.3 From cc34502ac11a0fc77eb68a469b037fe2e2ee6c20 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 10 May 2023 01:13:45 +0200 Subject: -fix TOTP calculation --- src/util/crypto_confirmation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/util/crypto_confirmation.c') diff --git a/src/util/crypto_confirmation.c b/src/util/crypto_confirmation.c index bbdf701e..a238d537 100644 --- a/src/util/crypto_confirmation.c +++ b/src/util/crypto_confirmation.c @@ -102,7 +102,7 @@ compute_totp (struct GNUNET_TIME_Timestamp ts, offset = hmac[sizeof (hmac) - 1] & 0x0f; for (int count = 0; count < 4; count++) - code |= hmac[offset + 3 - count] << (8 * count); + code |= ((uint32_t) hmac[offset + 3 - count]) << (8 * count); code &= 0x7fffffff; /* always use 8 digits (maximum) */ code = code % 100000000; -- cgit v1.2.3