From: mar77i Date: Wed, 23 Aug 2017 07:51:56 +0000 (+0200) Subject: cosmetic changes. I don't know why. X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=5a3fab7a02802a8aab4a697ba3f1e56f8cca62f0;p=ga-cli cosmetic changes. I don't know why. --- diff --git a/otp.c b/otp.c index 1584d30..97bf387 100644 --- a/otp.c +++ b/otp.c @@ -102,9 +102,9 @@ static inline unsigned char *pack_be64(unsigned char data[], uint64_t value) { } int calculate_otp(const char *line) { - size_t i, len = 0; + size_t len = 0; unsigned int hmac_len = 0; - unsigned char data[sizeof(uint64_t)], *ptr; + unsigned char data[sizeof(uint64_t)], *ptr, i; if(line == NULL) return -1; if(strlen(line) < 2) @@ -125,9 +125,9 @@ int calculate_otp(const char *line) { fprintf(stderr, "\nError: hmac.\n"); return -1; } - i = ptr[hmac_len - 1] & 0x0f; - printf("%06"PRIu32"\n", (((ptr[i + 0] & 0x7f) << 24) | (ptr[i + 1] << 16) | - (ptr[i + 2] << 8) | ptr[i + 3]) % 1000000); + i = ptr[hmac_len - 1] & 0xf; + printf("%06"PRIu32"\n", (((ptr[i] & 0x7f) << 24) | (ptr[i + 1] << 16) | + (ptr[i + 2] << 8) | ptr[i + 3]) % 1000000); return 0; }