Module Name: src Committed By: ozaki-r Date: Thu Apr 13 01:32:57 UTC 2017
Modified Files: src/sys/netipsec: xform_ah.c xform_esp.c Log Message: Fix that ah_algorithm_lookup and esp_algorithm_lookup don't handle some algorithms Unrelated upper limit values, AH_ALG_MAX and ESP_ALG_MAX, prevented some algorithms from being looked up. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/netipsec/xform_ah.c cvs rdiff -u -r1.48 -r1.49 src/sys/netipsec/xform_esp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netipsec/xform_ah.c diff -u src/sys/netipsec/xform_ah.c:1.45 src/sys/netipsec/xform_ah.c:1.46 --- src/sys/netipsec/xform_ah.c:1.45 Thu Apr 6 09:20:07 2017 +++ src/sys/netipsec/xform_ah.c Thu Apr 13 01:32:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: xform_ah.c,v 1.45 2017/04/06 09:20:07 ozaki-r Exp $ */ +/* $NetBSD: xform_ah.c,v 1.46 2017/04/13 01:32: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.45 2017/04/06 09:20:07 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_ah.c,v 1.46 2017/04/13 01:32:57 ozaki-r Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -130,8 +130,7 @@ static int ah_output_cb(struct cryptop*) const struct auth_hash * ah_algorithm_lookup(int alg) { - if (alg >= AH_ALG_MAX) - return NULL; + switch (alg) { case SADB_X_AALG_NULL: return &auth_hash_null; Index: src/sys/netipsec/xform_esp.c diff -u src/sys/netipsec/xform_esp.c:1.48 src/sys/netipsec/xform_esp.c:1.49 --- src/sys/netipsec/xform_esp.c:1.48 Mon Apr 10 14:19:22 2017 +++ src/sys/netipsec/xform_esp.c Thu Apr 13 01:32:57 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: xform_esp.c,v 1.48 2017/04/10 14:19:22 christos Exp $ */ +/* $NetBSD: xform_esp.c,v 1.49 2017/04/13 01:32: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.48 2017/04/10 14:19:22 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.49 2017/04/13 01:32:57 ozaki-r Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -116,8 +116,7 @@ static int esp_output_cb(struct cryptop const struct enc_xform * esp_algorithm_lookup(int alg) { - if (alg >= ESP_ALG_MAX) - return NULL; + switch (alg) { case SADB_EALG_DESCBC: return &enc_xform_des;