aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/encoding.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-09-22 04:04:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-09-24 23:10:15 +0200
commit6ddb4753c62fd08f4da71a5d1bd4222de492a331 (patch)
treedcba7d7df5c810a4476fabdfb83e73a0205aba12 /src/tools/encoding.h
parentconfig: do not reset device port (diff)
downloadwireguard-monolithic-historical-6ddb4753c62fd08f4da71a5d1bd4222de492a331.tar.xz
wireguard-monolithic-historical-6ddb4753c62fd08f4da71a5d1bd4222de492a331.zip
tools: use key_is_zero for comparing to zeros
Maybe an attacker on the system could use the infoleak in /proc to gauge how long a wg(8) process takes to complete and determine the number of leading zeros. This is somewhat ridiculous, but it's possible somebody somewhere might at somepoint care in the future, so alright.
Diffstat (limited to 'src/tools/encoding.h')
-rw-r--r--src/tools/encoding.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tools/encoding.h b/src/tools/encoding.h
index f4fe51e..9db4c6e 100644
--- a/src/tools/encoding.h
+++ b/src/tools/encoding.h
@@ -16,4 +16,6 @@ bool key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64);
void key_to_hex(char hex[static WG_KEY_LEN_HEX], const uint8_t key[static WG_KEY_LEN]);
bool key_from_hex(uint8_t key[static WG_KEY_LEN], const char *hex);
+bool key_is_zero(const uint8_t key[static WG_KEY_LEN]);
+
#endif