otp.c
changeset 57 4974e5368a29
parent 56 a573346e6f7b
--- a/otp.c	Sun Jun 18 19:40:30 2017 -0400
+++ b/otp.c	Sun Jun 18 19:50:43 2017 -0400
@@ -63,7 +63,7 @@
     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 @@
 
     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. */