summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2015-11-16 07:10:42 +0000
committerae <ae@FreeBSD.org>2015-11-16 07:10:42 +0000
commit4a54e95cd79f25bad1d55f8ddbf1aecdd098869a (patch)
treec0b5fb4d85d387aee141d8b8fc3d47209f3c93cd /sys/netipsec
parentf169c1bc417d39cb0d22a49ceaa682f1a732e0d8 (diff)
downloadFreeBSD-src-4a54e95cd79f25bad1d55f8ddbf1aecdd098869a.zip
FreeBSD-src-4a54e95cd79f25bad1d55f8ddbf1aecdd098869a.tar.gz
Use explicitly specified ivsize instead of blocksize when we mean IV size.
Set zero ivsize for enc_xform_null and remove special handling from xform_esp.c. Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D1503
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/key.c2
-rw-r--r--sys/netipsec/xform_esp.c8
2 files changed, 2 insertions, 8 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 9927509..7af23cf6 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -6706,7 +6706,7 @@ key_register(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
continue;
alg = (struct sadb_alg *)(mtod(n, caddr_t) + off);
alg->sadb_alg_id = i;
- alg->sadb_alg_ivlen = ealgo->blocksize;
+ alg->sadb_alg_ivlen = ealgo->ivsize;
alg->sadb_alg_minbits = _BITS(ealgo->minkey);
alg->sadb_alg_maxbits = _BITS(ealgo->maxkey);
off += PFKEY_ALIGN8(sizeof(struct sadb_alg));
diff --git a/sys/netipsec/xform_esp.c b/sys/netipsec/xform_esp.c
index 9f645c0..c8b5f16 100644
--- a/sys/netipsec/xform_esp.c
+++ b/sys/netipsec/xform_esp.c
@@ -200,16 +200,10 @@ esp_init(struct secasvar *sav, struct xformsw *xsp)
return EINVAL;
}
- /*
- * NB: The null xform needs a non-zero blocksize to keep the
- * crypto code happy but if we use it to set ivlen then
- * the ESP header will be processed incorrectly. The
- * compromise is to force it to zero here.
- */
if (SAV_ISCTRORGCM(sav))
sav->ivlen = 8; /* RFC4106 3.1 and RFC3686 3.1 */
else
- sav->ivlen = (txform == &enc_xform_null ? 0 : txform->ivsize);
+ sav->ivlen = txform->ivsize;
/*
* Setup AH-related state.
OpenPOWER on IntegriCloud