From 6c04634ee1ea3ea6aedb5351a5d1e2fb27d15432 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 18 Jun 2017 19:50:43 -0400 Subject: [PATCH] Minor type cleanup ("unsigned char" -> "uint8_t"). --- otp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/otp.c b/otp.c index 828680d..a63c9f2 100644 --- a/otp.c +++ b/otp.c @@ -63,7 +63,7 @@ int totp(const char *base32_secret, char *dst, int dstlen) int decodedlen; uint64_t secs; uint8_t timebytes[8]; - unsigned char digest[SHA1_DIGEST_LENGTH]; + uint8_t digest[SHA1_DIGEST_LENGTH]; uint8_t *bytes; uint32_t val; @@ -79,7 +79,7 @@ int totp(const char *base32_secret, char *dst, int dstlen) SHA1Hmac(decoded, decodedlen, timebytes, 8, digest); - bytes = (uint8_t *) (digest + (digest[SHA1_DIGEST_LENGTH-1] & 0xF)); + bytes = digest + (digest[SHA1_DIGEST_LENGTH-1] & 0xF); val = (((uint32_t) bytes[0]) << 24) | (((uint32_t) bytes[1]) << 16) | (((uint32_t) bytes[2]) << 8) | (((uint32_t) bytes[3])); val &= 0x7FFFFFFF; /* drop most significant bit. */