diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-04-16 01:20:43 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-04-19 18:26:32 +0200 |
commit | 94273094f6607923f7e52b16717325f6ed7d9d46 (patch) | |
tree | f35a0bbd1d17ca66f857bc75b3434d59dddb7227 /src/tools/base64.h | |
parent | netns: cleanup and add diagram (diff) | |
download | wireguard-monolithic-historical-94273094f6607923f7e52b16717325f6ed7d9d46.tar.xz wireguard-monolithic-historical-94273094f6607923f7e52b16717325f6ed7d9d46.zip |
tools: side channel resistant base64
Diffstat (limited to 'src/tools/base64.h')
-rw-r--r-- | src/tools/base64.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/tools/base64.h b/src/tools/base64.h index 4ad0ac3..37cf1b9 100644 --- a/src/tools/base64.h +++ b/src/tools/base64.h @@ -3,18 +3,13 @@ #ifndef BASE64_H #define BASE64_H -#include <resolv.h> +#include <stdbool.h> +#include <stdint.h> +#include "../uapi.h" -#define b64_len(len) ((((len) + 2) / 3) * 4 + 1) +#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) -#ifndef b64_ntop -int b64_ntop(unsigned char const *, size_t, char *, size_t); -#define NEED_B64_NTOP -#endif - -#ifndef b64_pton -int b64_pton(char const *, unsigned char *, size_t); -#define NEED_B64_PTON -#endif +void key_to_base64(char base64[static WG_KEY_LEN_BASE64], const uint8_t key[static WG_KEY_LEN]); +bool key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64); #endif |