diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-08-04 14:49:21 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-08-06 17:47:14 +0200 |
commit | 13fac76a71f25631d7415ba457bdab267d0950d4 (patch) | |
tree | 76914bbdca93094302783c211f539ff5c6c1bdd0 /src/ipc-uapi.h | |
parent | pubkey: isblank is a subset of isspace (diff) | |
download | wireguard-tools-13fac76a71f25631d7415ba457bdab267d0950d4.tar.xz wireguard-tools-13fac76a71f25631d7415ba457bdab267d0950d4.zip |
ctype: use non-locale-specific ctype.h
We also make these constant time, even though we're never distinguishing
between bits of a secret using them. From that perspective, though, this
is markedly better than the locale-specific table lookups in glibc, even
though base64 characters span two cache lines and valid private keys
must hit both.
Co-authored-by: Samuel Neves <sneves@dei.uc.pt>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
Diffstat (limited to 'src/ipc-uapi.h')
-rw-r--r-- | src/ipc-uapi.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ipc-uapi.h b/src/ipc-uapi.h index 3b1fff3..f464be7 100644 --- a/src/ipc-uapi.h +++ b/src/ipc-uapi.h @@ -4,7 +4,6 @@ */ #include <arpa/inet.h> -#include <ctype.h> #include <errno.h> #include <net/if.h> #include <netdb.h> @@ -17,6 +16,7 @@ #include "containers.h" #include "curve25519.h" #include "encoding.h" +#include "ctype.h" #ifdef _WIN32 #include "ipc-uapi-windows.h" @@ -102,7 +102,7 @@ static int userspace_set_device(struct wgdevice *dev) #define NUM(max) ({ \ unsigned long long num; \ char *end; \ - if (!isdigit(value[0])) \ + if (!char_is_digit(value[0])) \ break; \ num = strtoull(value, &end, 10); \ if (*end || num > max) \ @@ -223,7 +223,7 @@ static int userspace_get_device(struct wgdevice **out, const char *iface) struct wgallowedip *new_allowedip; char *end, *mask = value, *ip = strsep(&mask, "/"); - if (!mask || !isdigit(mask[0])) + if (!mask || !char_is_digit(mask[0])) break; new_allowedip = calloc(1, sizeof(*new_allowedip)); if (!new_allowedip) { |