Don't bother the case of crp->crp_buf == NULL in callbacks

This commit is contained in:
ozaki-r 2017-07-19 09:38:57 +00:00
parent 8f30e76653
commit 80807c7710
3 changed files with 8 additions and 49 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: xform_ah.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $ */
/* $NetBSD: xform_ah.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/xform_ah.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ah.c,v 1.63 2001/06/26 06:18:58 angelos Exp $ */
/*
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -845,14 +845,6 @@ ah_input_cb(struct cryptop *crp)
crp = NULL;
}
/* Shouldn't happen... */
if (m == NULL) {
AH_STATINC(AH_STAT_CRYPTO);
DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
error = EINVAL;
goto bad;
}
/* Figure out header size. */
rplen = HDRSIZE(sav);
authsize = AUTHSIZE(sav);
@ -1220,13 +1212,6 @@ ah_output_cb(struct cryptop *crp)
goto bad;
}
/* Shouldn't happen... */
if (m == NULL) {
AH_STATINC(AH_STAT_CRYPTO);
DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
error = EINVAL;
goto bad;
}
AH_STATINC(AH_STAT_HIST + ah_stats[sav->alg_auth]);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: xform_esp.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $ */
/* $NetBSD: xform_esp.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.63 2017/07/19 09:03:08 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.64 2017/07/19 09:38:57 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -554,13 +554,6 @@ esp_input_cb(struct cryptop *crp)
goto bad;
}
/* Shouldn't happen... */
if (m == NULL) {
ESP_STATINC(ESP_STAT_CRYPTO);
DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
error = EINVAL;
goto bad;
}
ESP_STATINC(ESP_STAT_HIST + esp_stats[sav->alg_enc]);
/* If authentication was performed, check now. */
@ -998,13 +991,6 @@ esp_output_cb(struct cryptop *crp)
goto bad;
}
/* Shouldn't happen... */
if (m == NULL) {
ESP_STATINC(ESP_STAT_CRYPTO);
DPRINTF(("%s: bogus returned buffer from crypto\n", __func__));
error = EINVAL;
goto bad;
}
ESP_STATINC(ESP_STAT_HIST + esp_stats[sav->alg_enc]);
if (sav->tdb_authalgxform != NULL)
AH_STATINC(AH_STAT_HIST + ah_stats[sav->alg_auth]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: xform_ipcomp.c,v 1.44 2017/07/19 09:03:08 ozaki-r Exp $ */
/* $NetBSD: xform_ipcomp.c,v 1.45 2017/07/19 09:38:57 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.44 2017/07/19 09:03:08 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.45 2017/07/19 09:38:57 ozaki-r Exp $");
/* IP payload compression protocol (IPComp), see RFC 2393 */
#if defined(_KERNEL_OPT)
@ -290,13 +290,7 @@ ipcomp_input_cb(struct cryptop *crp)
error = crp->crp_etype;
goto bad;
}
/* Shouldn't happen... */
if (m == NULL) {
IPCOMP_STATINC(IPCOMP_STAT_CRYPTO);
DPRINTF(("%s: null mbuf returned from crypto\n", __func__));
error = EINVAL;
goto bad;
}
IPCOMP_STATINC(IPCOMP_STAT_HIST + ipcomp_stats[sav->alg_comp]);
/* Update the counters */
@ -563,13 +557,7 @@ ipcomp_output_cb(struct cryptop *crp)
error = crp->crp_etype;
goto bad;
}
/* Shouldn't happen... */
if (m == NULL) {
IPCOMP_STATINC(IPCOMP_STAT_CRYPTO);
DPRINTF(("%s: bogus return buffer from crypto\n", __func__));
error = EINVAL;
goto bad;
}
IPCOMP_STATINC(IPCOMP_STAT_HIST + ipcomp_stats[sav->alg_comp]);
if (rlen > crp->crp_olen) {