From a30e0001e4c44720681aa41b26e99b8d8e5e2413 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 3 Mar 2014 14:03:46 +0100 Subject: ikev1: Accept SPI size of any length <= 16 in ISAKMP proposal Fixes #533. --- src/libcharon/encoding/payloads/proposal_substructure.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/libcharon/encoding/payloads/proposal_substructure.c') diff --git a/src/libcharon/encoding/payloads/proposal_substructure.c b/src/libcharon/encoding/payloads/proposal_substructure.c index cb9b359b3..3e35b75c6 100644 --- a/src/libcharon/encoding/payloads/proposal_substructure.c +++ b/src/libcharon/encoding/payloads/proposal_substructure.c @@ -361,12 +361,20 @@ METHOD(payload_t, verify, status_t, } break; case PROTO_IKE: - if (this->spi.len != 0 && this->spi.len != 8) + if (this->type == PROPOSAL_SUBSTRUCTURE_V1) { - DBG1(DBG_ENC, "invalid SPI length in IKE proposal"); - return FAILED; + if (this->spi.len <= 16) + { /* according to RFC 2409, section 3.5 anything between + * 0 and 16 is fine */ + break; + } } - break; + else if (this->spi.len == 0 || this->spi.len == 8) + { + break; + } + DBG1(DBG_ENC, "invalid SPI length in IKE proposal"); + return FAILED; default: break; } -- cgit v1.2.3