diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-08-20 22:04:25 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-08-20 22:04:25 +0200 |
commit | de3d878243988d150e496750595b3f6b08e17483 (patch) | |
tree | 22068b344d04a82ba1399062982800ca421b971b | |
parent | 9c1a1cfc44d5ce808e1d2128ab6404927331f3c5 (diff) |
Make the ‘b32toa’ dest a uint8_t*
-rw-r--r-- | b32.c | 4 | ||||
-rw-r--r-- | b32.h | 3 | ||||
-rw-r--r-- | main.c | 2 |
3 files changed, 5 insertions, 4 deletions
@@ -22,7 +22,7 @@ static const uint8_t ctov[] = { }; bool -b32toa(char *dst, const char *src, size_t len) +b32toa(uint8_t *dst, const char *src, size_t len) { char c; size_t pad = 0; @@ -37,7 +37,7 @@ b32toa(char *dst, const char *src, size_t len) for (size_t j = 0; j < 8; j++) { c = src[i + j]; vs[j] = ctov[(uint8_t)c]; - if (vs[j] == 255) { + if (vs[j] == (uint8_t)-1) { if (c == '=' && j >= 8 - pad) vs[j] = 0; else @@ -2,7 +2,8 @@ #define B32_B32_H #include <stdbool.h> +#include <stdint.h> -bool b32toa(char *, const char *, size_t); +bool b32toa(uint8_t *, const char *, size_t); #endif @@ -186,7 +186,7 @@ bool totp(struct totp_config conf, uint32_t *code) { int off; - char *key; + uint8_t *key; uchar *mac; time_t epoch; size_t keylen; |