summaryrefslogtreecommitdiff
path: root/crypt.h
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-15 09:24:18 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-15 09:24:18 +0800
commit4a0e2af2fd22903fedb73ec9cfcc6a1dbe787442 (patch)
tree0b76aaf605b88ad3ae4b461a2efb8cb2fbd711bc /crypt.h
parent7989aa01ac4d48dbb5dda7a106a270fe381f2852 (diff)
Change crypt_getnonce char * argument type
Rename it to char buf[], to make it clearer how it should be used.
Diffstat (limited to 'crypt.h')
-rw-r--r--crypt.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypt.h b/crypt.h
index 5efe114..57d4689 100644
--- a/crypt.h
+++ b/crypt.h
@@ -24,12 +24,12 @@ static inline bool crypt_maccmp(const char *key, const char *query,
return !strcmp(hmac, hmacsha256_str);
}
-static inline void crypt_getnonce(char *string, const size_t string_len)
+static inline void crypt_getnonce(char buf[], const size_t buf_len)
{
- string[0] = '\0';
- const size_t nonce_len = string_len / 2;
+ buf[0] = '\0';
+ const size_t nonce_len = buf_len / 2;
unsigned char nonce[nonce_len + 1];
gcry_create_nonce(nonce, nonce_len);
for (int i = 0; i < nonce_len; i++)
- sprintf(string, "%s%02x", string, nonce[i]);
+ sprintf(buf, "%s%02x", buf, nonce[i]);
}