diff options
Diffstat (limited to 'src/tools/config.c')
-rw-r--r-- | src/tools/config.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/tools/config.c b/src/tools/config.c index e95626c..8f75804 100644 --- a/src/tools/config.c +++ b/src/tools/config.c @@ -118,12 +118,10 @@ static inline bool parse_fwmark(uint32_t *fwmark, unsigned int *flags, const cha static inline bool parse_key(uint8_t key[static WG_KEY_LEN], const char *value) { - uint8_t tmp[WG_KEY_LEN + 1]; - if (strlen(value) != b64_len(WG_KEY_LEN) - 1 || b64_pton(value, tmp, WG_KEY_LEN + 1) != WG_KEY_LEN) { + if (!key_from_base64(key, value)) { fprintf(stderr, "Key is not the correct length or format: `%s`\n", value); return false; } - memcpy(key, tmp, WG_KEY_LEN); return true; } |