From: mar77i Date: Mon, 13 Jan 2020 14:24:17 +0000 (+0100) Subject: keep line breaks at <=80 columns. X-Git-Url: https://git.mar77i.info/?a=commitdiff_plain;h=a1e04eee2ffcff4f5314c9ebc4cd115336a66078;p=ga-cli keep line breaks at <=80 columns. --- diff --git a/totp.c b/totp.c index d2d53c9..3663d87 100644 --- a/totp.c +++ b/totp.c @@ -94,7 +94,8 @@ int b32_decode(unsigned char *buf, size_t *len) { return 0; } -static inline unsigned char *pack_be64(unsigned char data[], uint64_t value) { +static inline unsigned char *pack_be64(unsigned char data[], + uint64_t value) { size_t i; for(i = 0; i < sizeof value; i++) data[i] = (value >> ((sizeof value - 1 - i) * CHAR_BIT)) & 0xff; @@ -121,13 +122,16 @@ int calculate_totp(const char *line) { // fill data with the current time divided by INTERVAL_SECONDS pack_be64(data, time(NULL) / INTERVAL_SECONDS); - if(HMAC(EVP_sha1(), ptr, len, data, sizeof data, ptr, &hmac_len) == NULL) { + if(HMAC(EVP_sha1(), ptr, len, data, sizeof data, + ptr, &hmac_len) == NULL) { fprintf(stderr, "\nError: hmac.\n"); return -1; } 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); + printf("%06"PRIu32"\n", ( + ((ptr[i] & 0x7f) << 24) | (ptr[i + 1] << 16) | + (ptr[i + 2] << 8) | ptr[i + 3] + ) % 1000000); return 0; }