commit 4c54ab84e9641eda3b1a7b1496a1e5f40df897c5
parent fd30af25215efe50da869375ccb62ec266a7f785
Author: sin <sin@2f30.org>
Date: Tue, 12 Apr 2016 17:34:17 +0100
fix openbsd compilation
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/crypto.c b/crypto.c
@@ -19,7 +19,11 @@ setcipher(char *name)
{ "aes-128-gcm", EVP_aead_aes_128_gcm },
{ "aes-256-gcm", EVP_aead_aes_256_gcm },
{ "chacha20-poly1305", EVP_aead_chacha20_poly1305 },
-#if 0 /* disable for now as OpenBSD 5.8 does not include this cipher */
+#if defined(__OpenBSD__)
+#if OpenBSD >= 201605
+ { "chacha20-poly1305-ietf", EVP_aead_chacha20_poly1305_ietf },
+#endif
+#elif
{ "chacha20-poly1305-ietf", EVP_aead_chacha20_poly1305_ietf },
#endif
{ NULL, NULL }
diff --git a/stun.c b/stun.c
@@ -139,9 +139,12 @@ main(int argc, char *argv[])
listenfd = serverinit(bindaddr, port);
revokeprivs();
#if defined(__OpenBSD__)
+#include <sys/param.h>
+#if OpenBSD >= 201605
if (pledge("stdio inet", NULL) < 0)
logerr("pledge failed");
#endif
+#endif
for (;;) {
if ((netfd = serveraccept(listenfd)) < 0) {
netreset();
@@ -155,9 +158,12 @@ main(int argc, char *argv[])
/* invoked as client */
revokeprivs();
#if defined(__OpenBSD__)
+#include <sys/param.h>
+#if OpenBSD >= 201605
if (pledge("stdio dns inet", NULL) < 0)
logerr("pledge failed");
#endif
+#endif
for (;;) {
if ((netfd = clientconnect(host, port)) < 0) {
netreset();