mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 11:14:18 +01:00
adf3764857
git-subtree-dir: contrib/wireguard-tools git-subtree-mainline:9142a2a37b
git-subtree-split:7e00bf8773
25 lines
744 B
C
25 lines
744 B
C
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
|
|
/*
|
|
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
|
|
*/
|
|
|
|
#ifndef ENCODING_H
|
|
#define ENCODING_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "containers.h"
|
|
|
|
#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1)
|
|
#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1)
|
|
|
|
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);
|
|
|
|
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
|