summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2005-08-05 12:16:13 +0000
committermarkus <markus@openbsd.org>2005-08-05 12:16:13 +0000
commitca1263b4151963b843cd2c80d7bd89a601c51f1d (patch)
tree092c314ea5b05f3ef43a2a23c4e51b4db1bd7c9b
parentsync (diff)
downloadwireguard-openbsd-ca1263b4151963b843cd2c80d7bd89a601c51f1d.tar.xz
wireguard-openbsd-ca1263b4151963b843cd2c80d7bd89a601c51f1d.zip
don't panic for SADB_ADD w/o enc/auth, with and ok hshoexer@
-rw-r--r--sys/netinet/ip_esp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index 494f9e37b9e..e21b373d14b 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.94 2005/08/02 10:51:47 djm Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.95 2005/08/05 12:16:13 markus Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -103,6 +103,12 @@ esp_init(struct tdb *tdbp, struct xformsw *xsp, struct ipsecinit *ii)
struct auth_hash *thash = NULL;
struct cryptoini cria, crie;
+ if (!ii->ii_encalg && !ii->ii_authalg) {
+ DPRINTF(("esp_init(): neither authentication nor encryption "
+ "algorithm given"));
+ return EINVAL;
+ }
+
if (ii->ii_encalg) {
switch (ii->ii_encalg) {
case SADB_EALG_NULL: