diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2020-06-22 02:08:44 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2020-06-22 02:08:44 +0000 |
commit | d5a1afe3e60711352ddb697670945546075878bc (patch) | |
tree | 75ae7df6ac9b19b180c73b663ccc03c2ef72ff3a /sbin/ifconfig/ifconfig.c | |
parent | 46e0741e2cb898759a4c3813e6e771a9f389d142 (diff) |
use (undocumented) base64 code in libc instead of libcrypto.
naddy gave me a pointer in the right direction
ok millert@ deraadt@
looks good to matt dunwoodie
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index eaa76c693cf..58b1fca7467 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.422 2020/06/21 12:20:06 dlg Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.423 2020/06/22 02:08:43 dlg Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -94,7 +94,6 @@ #include <net/if_vlan_var.h> #include <netmpls/mpls.h> -#include <openssl/evp.h> #include <ctype.h> #include <err.h> @@ -5673,14 +5672,12 @@ setifpriority(const char *id, int param) * space. */ #define WG_BASE64_KEY_LEN (4 * ((WG_KEY_LEN + 2) / 3)) -#define WG_TMP_KEY_LEN (WG_BASE64_KEY_LEN / 4 * 3) #define WG_LOAD_KEY(dst, src, fn_name) do { \ - uint8_t _tmp[WG_TMP_KEY_LEN]; \ + uint8_t _tmp[WG_KEY_LEN]; int _r; \ if (strlen(src) != WG_BASE64_KEY_LEN) \ errx(1, fn_name " (key): invalid length"); \ - if (EVP_DecodeBlock(_tmp, src, \ - WG_BASE64_KEY_LEN) != WG_TMP_KEY_LEN) \ - errx(1, fn_name " (key): invalid base64"); \ + if ((_r = b64_pton(src, _tmp, sizeof(_tmp))) != sizeof(_tmp)) \ + errx(1, fn_name " (key): invalid base64 %d/%zu", _r, sizeof(_tmp)); \ memcpy(dst, _tmp, WG_KEY_LEN); \ } while (0) @@ -5899,13 +5896,15 @@ wg_status(void) if (wg_interface->i_flags & WG_INTERFACE_HAS_RTABLE) printf("\twgrtable %d\n", wg_interface->i_rtable); if (wg_interface->i_flags & WG_INTERFACE_HAS_PUBLIC) { - EVP_EncodeBlock(key, wg_interface->i_public, WG_KEY_LEN); + b64_ntop(wg_interface->i_public, WG_KEY_LEN, + key, sizeof(key)); printf("\twgpubkey %s\n", key); } wg_peer = &wg_interface->i_peers[0]; for (i = 0; i < wg_interface->i_peers_count; i++) { - EVP_EncodeBlock(key, wg_peer->p_public, WG_KEY_LEN); + b64_ntop(wg_peer->p_public, WG_KEY_LEN, + key, sizeof(key)); printf("\twgpeer %s\n", key); if (wg_peer->p_flags & WG_PEER_HAS_PSK) |