Browse code

strongswan : Update to version 5.5.2 and apply patches for CVE-2017-9022 and CVE-2017-9023

Change-Id: I90d93eaf5054f34728b697a4618e904e63cd4c4d
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5031
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>

Xiaolin Li authored on 2018/04/20 04:11:35
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,41 @@
0
+From 1bf67b900fb4955a0b09f3c1cbe1ce7177adbe2f Mon Sep 17 00:00:00 2001
1
+From: Tobias Brunner <tobias@strongswan.org>
2
+Date: Wed, 29 Mar 2017 11:26:24 +0200
3
+Subject: [PATCH] gmp: Make sure the modulus is odd and the exponent not zero
4
+
5
+Unlike mpz_powm() its secure replacement mpz_powm_sec() has the additional
6
+requirement that the exponent must be > 0 and the modulus has to be odd.
7
+Otherwise, it will crash with a floating-point exception.
8
+
9
+Fixes: CVE-2017-9022
10
+---
11
+ src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c | 7 ++++++-
12
+ 1 file changed, 6 insertions(+), 1 deletion(-)
13
+
14
+diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
15
+index 2b2c7f249590..32a72ac9600b 100644
16
+--- a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
17
+@@ -475,7 +475,7 @@ gmp_rsa_public_key_t *gmp_rsa_public_key_load(key_type_t type, va_list args)
18
+ 		}
19
+ 		break;
20
+ 	}
21
+-	if (!e.ptr || !n.ptr)
22
++	if (!e.len || !n.len || (n.ptr[n.len-1] & 0x01) == 0)
23
+ 	{
24
+ 		return NULL;
25
+ 	}
26
+@@ -506,5 +506,10 @@ gmp_rsa_public_key_t *gmp_rsa_public_key_load(key_type_t type, va_list args)
27
+ 
28
+ 	this->k = (mpz_sizeinbase(this->n, 2) + 7) / BITS_PER_BYTE;
29
+ 
30
++	if (!mpz_sgn(this->e))
31
++	{
32
++		destroy(this);
33
++		return NULL;
34
++	}
35
+ 	return &this->public;
36
+ }
37
+-- 
38
+1.9.1
39
+
0 40
new file mode 100644
... ...
@@ -0,0 +1,375 @@
0
+From e3d4fe2be3bda0d9acc985a6cd67efe249d8326c Mon Sep 17 00:00:00 2001
1
+From: Andreas Steffen <andreas.steffen@strongswan.org>
2
+Date: Fri, 5 May 2017 09:01:08 +0200
3
+Subject: [PATCH] asn1-parser: Fix CHOICE parsing
4
+
5
+Also fixes the application in the x509 plugin and the parsing of
6
+nameConstraints, which doesn't require a loop.
7
+
8
+Fixes: CVE-2017-9023
9
+---
10
+ src/libstrongswan/asn1/asn1_parser.c       |  70 +++++++++++++++---
11
+ src/libstrongswan/asn1/asn1_parser.h       |  27 +++----
12
+ src/libstrongswan/plugins/x509/x509_cert.c | 115 +++++++++++++++--------------
13
+ 3 files changed, 135 insertions(+), 77 deletions(-)
14
+
15
+diff --git a/src/libstrongswan/asn1/asn1_parser.c b/src/libstrongswan/asn1/asn1_parser.c
16
+index e7b7a428d9a2..4d5f799b73a9 100644
17
+--- a/src/libstrongswan/asn1/asn1_parser.c
18
+@@ -1,8 +1,7 @@
19
+ /*
20
+  * Copyright (C) 2006 Martin Will
21
+- * Copyright (C) 2000-2008 Andreas Steffen
22
+- *
23
+- * Hochschule fuer Technik Rapperswil
24
++ * Copyright (C) 2000-2017 Andreas Steffen
25
++ * HSR Hochschule fuer Technik Rapperswil
26
+  *
27
+  * This program is free software; you can redistribute it and/or modify it
28
+  * under the terms of the GNU General Public License as published by the
29
+@@ -76,12 +75,18 @@ struct private_asn1_parser_t {
30
+ 	 * Current parsing pointer for each level
31
+ 	 */
32
+ 	chunk_t blobs[ASN1_MAX_LEVEL + 2];
33
++
34
++	/**
35
++	 * Parsing a CHOICE on the current level ?
36
++	 */
37
++	bool choice[ASN1_MAX_LEVEL + 2];
38
++
39
+ };
40
+ 
41
+ METHOD(asn1_parser_t, iterate, bool,
42
+ 	private_asn1_parser_t *this, int *objectID, chunk_t *object)
43
+ {
44
+-	chunk_t *blob, *blob1;
45
++	chunk_t *blob, *blob1, blob_ori;
46
+ 	u_char *start_ptr;
47
+ 	u_int level;
48
+ 	asn1Object_t obj;
49
+@@ -97,7 +102,7 @@ METHOD(asn1_parser_t, iterate, bool,
50
+ 		return FALSE;
51
+ 	}
52
+ 
53
+-	if (obj.flags & ASN1_END)  /* end of loop or option found */
54
++	if (obj.flags & ASN1_END)  /* end of loop or choice or option found */
55
+ 	{
56
+ 		if (this->loopAddr[obj.level] && this->blobs[obj.level+1].len > 0)
57
+ 		{
58
+@@ -106,13 +111,42 @@ METHOD(asn1_parser_t, iterate, bool,
59
+ 		}
60
+ 		else
61
+ 		{
62
+-			this->loopAddr[obj.level] = 0;		 /* exit loop or option*/
63
++			this->loopAddr[obj.level] = 0;		 /* exit loop */
64
++
65
++			if (obj.flags & ASN1_CHOICE) /* end of choices */
66
++			{
67
++				if (this->choice[obj.level+1])
68
++				{
69
++					DBG1(DBG_ASN, "L%d - %s:  incorrect choice encoding",
70
++						this->level0 + obj.level, obj.name);
71
++					this->success = FALSE;
72
++					goto end;
73
++				}
74
++			}
75
++
76
++			if (obj.flags & ASN1_CH) /* end of choice */
77
++			{
78
++				/* parsed a valid choice */
79
++				this->choice[obj.level] = FALSE;
80
++
81
++				/* advance to end of choices */
82
++				do
83
++				{
84
++					this->line++;
85
++				}
86
++				while (!((this->objects[this->line].flags & ASN1_END) &&
87
++						 (this->objects[this->line].flags & ASN1_CHOICE) &&
88
++						 (this->objects[this->line].level == obj.level-1)));
89
++				this->line--;
90
++			}
91
++
92
+ 			goto end;
93
+ 		}
94
+ 	}
95
+ 
96
+ 	level = this->level0 + obj.level;
97
+ 	blob = this->blobs + obj.level;
98
++	blob_ori = *blob;
99
+ 	blob1 = blob + 1;
100
+ 	start_ptr = blob->ptr;
101
+ 
102
+@@ -129,7 +163,6 @@ METHOD(asn1_parser_t, iterate, bool,
103
+ 	}
104
+ 
105
+ 	/* handle ASN.1 options */
106
+-
107
+ 	if ((obj.flags & ASN1_OPT)
108
+ 			&& (blob->len == 0 || *start_ptr != obj.type))
109
+ 	{
110
+@@ -144,7 +177,6 @@ METHOD(asn1_parser_t, iterate, bool,
111
+ 	}
112
+ 
113
+ 	/* an ASN.1 object must possess at least a tag and length field */
114
+-
115
+ 	if (blob->len < 2)
116
+ 	{
117
+ 		DBG1(DBG_ASN, "L%d - %s:  ASN.1 object smaller than 2 octets",
118
+@@ -167,8 +199,16 @@ METHOD(asn1_parser_t, iterate, bool,
119
+ 	blob->ptr += blob1->len;
120
+ 	blob->len -= blob1->len;
121
+ 
122
+-	/* return raw ASN.1 object without prior type checking */
123
++	/* handle ASN.1 choice without explicit context encoding */
124
++	if ((obj.flags & ASN1_CHOICE) && obj.type == ASN1_EOC)
125
++	{
126
++		DBG2(DBG_ASN, "L%d - %s:", level, obj.name);
127
++		this->choice[obj.level+1] = TRUE;
128
++		*blob1 = blob_ori;
129
++		goto end;
130
++	}
131
+ 
132
++	/* return raw ASN.1 object without prior type checking */
133
+ 	if (obj.flags & ASN1_RAW)
134
+ 	{
135
+ 		DBG2(DBG_ASN, "L%d - %s:", level, obj.name);
136
+@@ -209,6 +249,18 @@ METHOD(asn1_parser_t, iterate, bool,
137
+ 		}
138
+ 	}
139
+ 
140
++	/* In case of a "CHOICE" start to scan for exactly one valid choice */
141
++	if (obj.flags & ASN1_CHOICE)
142
++	{
143
++		if (blob1->len == 0)
144
++		{
145
++			DBG1(DBG_ASN, "L%d - %s:  contains no choice", level, obj.name);
146
++			this->success = FALSE;
147
++			goto end;
148
++		}
149
++		this->choice[obj.level+1] = TRUE;
150
++	}
151
++
152
+ 	if (obj.flags & ASN1_OBJ)
153
+ 	{
154
+ 		object->ptr = start_ptr;
155
+diff --git a/src/libstrongswan/asn1/asn1_parser.h b/src/libstrongswan/asn1/asn1_parser.h
156
+index 0edc22c2378c..2ee1e892fc16 100644
157
+--- a/src/libstrongswan/asn1/asn1_parser.h
158
+@@ -1,8 +1,7 @@
159
+ /*
160
+  * Copyright (C) 2006 Martin Will
161
+- * Copyright (C) 2000-2008 Andreas Steffen
162
+- *
163
+- * Hochschule fuer Technik Rapperswil
164
++ * Copyright (C) 2000-2017 Andreas Steffen
165
++ * HSR Hochschule fuer Technik Rapperswil
166
+  *
167
+  * This program is free software; you can redistribute it and/or modify it
168
+  * under the terms of the GNU General Public License as published by the
169
+@@ -32,15 +31,17 @@
170
+ /**
171
+  * Definition of ASN.1 flags
172
+  */
173
+-#define ASN1_NONE	0x00
174
+-#define ASN1_DEF	0x01
175
+-#define ASN1_OPT	0x02
176
+-#define ASN1_LOOP	0x04
177
+-#define ASN1_END	0x08
178
+-#define ASN1_OBJ	0x10
179
+-#define ASN1_BODY	0x20
180
+-#define ASN1_RAW	0x40
181
+-#define ASN1_EXIT	0x80
182
++#define ASN1_NONE    0x0000
183
++#define ASN1_DEF     0x0001
184
++#define ASN1_OPT     0x0002
185
++#define ASN1_LOOP    0x0004
186
++#define ASN1_CHOICE  0x0008
187
++#define ASN1_CH      0x0010
188
++#define ASN1_END     0x0020
189
++#define ASN1_OBJ     0x0040
190
++#define ASN1_BODY    0x0080
191
++#define ASN1_RAW     0x0100
192
++#define ASN1_EXIT    0x0200
193
+ 
194
+ typedef struct asn1Object_t asn1Object_t;
195
+ 
196
+@@ -51,7 +52,7 @@ struct asn1Object_t{
197
+ 	u_int level;
198
+ 	const u_char *name;
199
+ 	asn1_t type;
200
+-	u_char flags;
201
++	uint16_t flags;
202
+ };
203
+ 
204
+ typedef struct asn1_parser_t asn1_parser_t;
205
+diff --git a/src/libstrongswan/plugins/x509/x509_cert.c b/src/libstrongswan/plugins/x509/x509_cert.c
206
+index b3d90c5f61ef..f9573e953cbf 100644
207
+--- a/src/libstrongswan/plugins/x509/x509_cert.c
208
+@@ -2,10 +2,10 @@
209
+  * Copyright (C) 2000 Andreas Hess, Patric Lichtsteiner, Roger Wegmann
210
+  * Copyright (C) 2001 Marco Bertossa, Andreas Schleiss
211
+  * Copyright (C) 2002 Mario Strasser
212
+- * Copyright (C) 2000-2006 Andreas Steffen
213
++ * Copyright (C) 2000-2017 Andreas Steffen
214
+  * Copyright (C) 2006-2009 Martin Willi
215
+  * Copyright (C) 2008 Tobias Brunner
216
+- * Hochschule fuer Technik Rapperswil
217
++ * HSR Hochschule fuer Technik Rapperswil
218
+  *
219
+  * This program is free software; you can redistribute it and/or modify it
220
+  * under the terms of the GNU General Public License as published by the
221
+@@ -789,20 +789,20 @@ static bool parse_extendedKeyUsage(chunk_t blob, int level0,
222
+  * ASN.1 definition of crlDistributionPoints
223
+  */
224
+ static const asn1Object_t crlDistributionPointsObjects[] = {
225
+-	{ 0, "crlDistributionPoints",	ASN1_SEQUENCE,		ASN1_LOOP			}, /*  0 */
226
+-	{ 1,   "DistributionPoint",		ASN1_SEQUENCE,		ASN1_NONE			}, /*  1 */
227
+-	{ 2,     "distributionPoint",	ASN1_CONTEXT_C_0,	ASN1_OPT|ASN1_LOOP	}, /*  2 */
228
+-	{ 3,       "fullName",			ASN1_CONTEXT_C_0,	ASN1_OPT|ASN1_OBJ	}, /*  3 */
229
+-	{ 3,       "end choice",		ASN1_EOC,			ASN1_END			}, /*  4 */
230
+-	{ 3,       "nameRelToCRLIssuer",ASN1_CONTEXT_C_1,	ASN1_OPT|ASN1_BODY	}, /*  5 */
231
+-	{ 3,       "end choice",		ASN1_EOC,			ASN1_END			}, /*  6 */
232
+-	{ 2,     "end opt",				ASN1_EOC,			ASN1_END			}, /*  7 */
233
+-	{ 2,     "reasons",				ASN1_CONTEXT_C_1,	ASN1_OPT|ASN1_BODY	}, /*  8 */
234
+-	{ 2,     "end opt",				ASN1_EOC,			ASN1_END			}, /*  9 */
235
+-	{ 2,     "crlIssuer",			ASN1_CONTEXT_C_2,	ASN1_OPT|ASN1_OBJ	}, /* 10 */
236
+-	{ 2,     "end opt",				ASN1_EOC,			ASN1_END			}, /* 11 */
237
+-	{ 0, "end loop",				ASN1_EOC,			ASN1_END			}, /* 12 */
238
+-	{ 0, "exit",					ASN1_EOC,			ASN1_EXIT			}
239
++	{ 0, "crlDistributionPoints",   ASN1_SEQUENCE,    ASN1_LOOP            }, /*  0 */
240
++	{ 1,   "DistributionPoint",     ASN1_SEQUENCE,    ASN1_NONE            }, /*  1 */
241
++	{ 2,     "distributionPoint",   ASN1_CONTEXT_C_0, ASN1_OPT|ASN1_CHOICE }, /*  2 */
242
++	{ 3,       "fullName",          ASN1_CONTEXT_C_0, ASN1_OPT|ASN1_OBJ    }, /*  3 */
243
++	{ 3,       "end choice",        ASN1_EOC,         ASN1_END|ASN1_CH     }, /*  4 */
244
++	{ 3,       "nameRelToCRLIssuer",ASN1_CONTEXT_C_1, ASN1_OPT|ASN1_BODY   }, /*  5 */
245
++	{ 3,       "end choice",        ASN1_EOC,         ASN1_END|ASN1_CH     }, /*  6 */
246
++	{ 2,     "end opt/choices",     ASN1_EOC,         ASN1_END|ASN1_CHOICE }, /*  7 */
247
++	{ 2,     "reasons",             ASN1_CONTEXT_C_1, ASN1_OPT|ASN1_BODY   }, /*  8 */
248
++	{ 2,     "end opt",             ASN1_EOC,         ASN1_END             }, /*  9 */
249
++	{ 2,     "crlIssuer",           ASN1_CONTEXT_C_2, ASN1_OPT|ASN1_OBJ    }, /* 10 */
250
++	{ 2,     "end opt",             ASN1_EOC,         ASN1_END             }, /* 11 */
251
++	{ 0, "end loop",                ASN1_EOC,         ASN1_END             }, /* 12 */
252
++	{ 0, "exit",                    ASN1_EOC,         ASN1_EXIT            }
253
+ };
254
+ #define CRL_DIST_POINTS				 1
255
+ #define CRL_DIST_POINTS_FULLNAME	 3
256
+@@ -910,14 +910,13 @@ end:
257
+  * ASN.1 definition of nameConstraints
258
+  */
259
+ static const asn1Object_t nameConstraintsObjects[] = {
260
+-	{ 0, "nameConstraints",			ASN1_SEQUENCE,		ASN1_LOOP			}, /*  0 */
261
++	{ 0, "nameConstraints",			ASN1_SEQUENCE,		ASN1_NONE			}, /*  0 */
262
+ 	{ 1,   "permittedSubtrees",		ASN1_CONTEXT_C_0,	ASN1_OPT|ASN1_LOOP	}, /*  1 */
263
+ 	{ 2,     "generalSubtree",		ASN1_SEQUENCE,		ASN1_BODY			}, /*  2 */
264
+ 	{ 1,   "end loop",				ASN1_EOC,			ASN1_END			}, /*  3 */
265
+ 	{ 1,   "excludedSubtrees",		ASN1_CONTEXT_C_1,	ASN1_OPT|ASN1_LOOP	}, /*  4 */
266
+ 	{ 2,     "generalSubtree",		ASN1_SEQUENCE,		ASN1_BODY			}, /*  5 */
267
+ 	{ 1,   "end loop",				ASN1_EOC,			ASN1_END			}, /*  6 */
268
+-	{ 0, "end loop",				ASN1_EOC,			ASN1_END			}, /*  7 */
269
+ 	{ 0, "exit",					ASN1_EOC,			ASN1_EXIT			}
270
+ };
271
+ #define NAME_CONSTRAINT_PERMITTED 2
272
+@@ -974,25 +973,27 @@ end:
273
+  * ASN.1 definition of a certificatePolicies extension
274
+  */
275
+ static const asn1Object_t certificatePoliciesObject[] = {
276
+-	{ 0, "certificatePolicies",		ASN1_SEQUENCE,	ASN1_LOOP			}, /*  0 */
277
+-	{ 1,   "policyInformation",		ASN1_SEQUENCE,	ASN1_NONE			}, /*  1 */
278
+-	{ 2,     "policyId",			ASN1_OID,		ASN1_BODY			}, /*  2 */
279
+-	{ 2,     "qualifiers",			ASN1_SEQUENCE,	ASN1_OPT|ASN1_LOOP	}, /*  3 */
280
+-	{ 3,       "qualifierInfo",		ASN1_SEQUENCE,	ASN1_NONE			}, /*  4 */
281
+-	{ 4,         "qualifierId",		ASN1_OID,		ASN1_BODY			}, /*  5 */
282
+-	{ 4,         "cPSuri",			ASN1_IA5STRING,	ASN1_OPT|ASN1_BODY	}, /*  6 */
283
+-	{ 4,         "end choice",		ASN1_EOC,		ASN1_END			}, /*  7 */
284
+-	{ 4,         "userNotice",		ASN1_SEQUENCE,	ASN1_OPT|ASN1_BODY	}, /*  8 */
285
+-	{ 5,           "explicitText",	ASN1_EOC,		ASN1_RAW			}, /*  9 */
286
+-	{ 4,         "end choice",		ASN1_EOC,		ASN1_END			}, /* 10 */
287
+-	{ 2,      "end opt/loop",		ASN1_EOC,		ASN1_END			}, /* 12 */
288
+-	{ 0, "end loop",				ASN1_EOC,		ASN1_END			}, /* 13 */
289
+-	{ 0, "exit",					ASN1_EOC,		ASN1_EXIT			}
290
++	{ 0, "certificatePolicies",      ASN1_SEQUENCE,  ASN1_LOOP            }, /*  0 */
291
++	{ 1,   "policyInformation",      ASN1_SEQUENCE,  ASN1_NONE            }, /*  1 */
292
++	{ 2,     "policyId",             ASN1_OID,       ASN1_BODY            }, /*  2 */
293
++	{ 2,     "qualifiers",           ASN1_SEQUENCE,  ASN1_OPT|ASN1_LOOP   }, /*  3 */
294
++	{ 3,       "qualifierInfo",      ASN1_SEQUENCE,  ASN1_NONE            }, /*  4 */
295
++	{ 4,         "qualifierId",      ASN1_OID,       ASN1_BODY            }, /*  5 */
296
++	{ 4,         "qualifier",        ASN1_EOC,       ASN1_CHOICE          }, /*  6 */
297
++	{ 5,           "cPSuri",         ASN1_IA5STRING, ASN1_OPT|ASN1_BODY   }, /*  7 */
298
++	{ 5,           "end choice",     ASN1_EOC,       ASN1_END|ASN1_CH     }, /*  8 */
299
++	{ 5,           "userNotice",     ASN1_SEQUENCE,  ASN1_OPT|ASN1_BODY   }, /*  9 */
300
++	{ 6,             "explicitText", ASN1_EOC,       ASN1_RAW             }, /* 10 */
301
++	{ 5,           "end choice",     ASN1_EOC,       ASN1_END|ASN1_CH     }, /* 11 */
302
++	{ 4,         "end choices",      ASN1_EOC,       ASN1_END|ASN1_CHOICE }, /* 12 */
303
++	{ 2,     "end opt/loop",         ASN1_EOC,       ASN1_END             }, /* 13 */
304
++	{ 0, "end loop",                 ASN1_EOC,       ASN1_END             }, /* 14 */
305
++	{ 0, "exit",                     ASN1_EOC,       ASN1_EXIT            }
306
+ };
307
+-#define CERT_POLICY_ID				2
308
+-#define CERT_POLICY_QUALIFIER_ID	5
309
+-#define CERT_POLICY_CPS_URI			6
310
+-#define CERT_POLICY_EXPLICIT_TEXT	9
311
++#define CERT_POLICY_ID              2
312
++#define CERT_POLICY_QUALIFIER_ID    5
313
++#define CERT_POLICY_CPS_URI         7
314
++#define CERT_POLICY_EXPLICIT_TEXT  10
315
+ 
316
+ /**
317
+  * Parse certificatePolicies
318
+@@ -1157,27 +1158,31 @@ static bool parse_policyConstraints(chunk_t blob, int level0,
319
+  * ASN.1 definition of ipAddrBlocks according to RFC 3779
320
+  */
321
+ static const asn1Object_t ipAddrBlocksObjects[] = {
322
+-	{ 0, "ipAddrBlocks",			ASN1_SEQUENCE,		ASN1_LOOP			}, /*  0 */
323
+-	{ 1,   "ipAddressFamily",		ASN1_SEQUENCE,		ASN1_NONE			}, /*  1 */
324
+-	{ 2,     "addressFamily",		ASN1_OCTET_STRING,	ASN1_BODY			}, /*  2 */
325
+-	{ 2,     "inherit",				ASN1_NULL,			ASN1_OPT|ASN1_NONE	}, /*  3 */
326
+-	{ 2,     "end choice",			ASN1_EOC,			ASN1_END			}, /*  4 */
327
+-	{ 2,     "addressesOrRanges",	ASN1_SEQUENCE,		ASN1_OPT|ASN1_LOOP	}, /*  5 */
328
+-	{ 3,       "addressPrefix",		ASN1_BIT_STRING,	ASN1_OPT|ASN1_BODY  }, /*  6 */
329
+-	{ 3,       "end choice",		ASN1_EOC,			ASN1_END			}, /*  7 */
330
+-	{ 3,       "addressRange",		ASN1_SEQUENCE,		ASN1_OPT|ASN1_NONE	}, /*  8 */
331
+-	{ 4,         "min",				ASN1_BIT_STRING,	ASN1_BODY			}, /*  9 */
332
+-	{ 4,         "max",				ASN1_BIT_STRING,	ASN1_BODY			}, /* 10 */
333
+-	{ 3,       "end choice",		ASN1_EOC,			ASN1_END			}, /* 11 */
334
+-	{ 2,     "end opt/loop",		ASN1_EOC,			ASN1_END			}, /* 12 */
335
+-	{ 0, "end loop",				ASN1_EOC,			ASN1_END			}, /* 13 */
336
+-	{ 0, "exit",					ASN1_EOC,			ASN1_EXIT			}
337
++	{ 0, "ipAddrBlocks",            ASN1_SEQUENCE,     ASN1_LOOP            }, /*  0 */
338
++	{ 1,   "ipAddressFamily",       ASN1_SEQUENCE,     ASN1_NONE            }, /*  1 */
339
++	{ 2,     "addressFamily",       ASN1_OCTET_STRING, ASN1_BODY            }, /*  2 */
340
++	{ 2,     "ipAddressChoice",     ASN1_EOC,          ASN1_CHOICE          }, /*  3 */
341
++	{ 3,       "inherit",           ASN1_NULL,         ASN1_OPT             }, /*  4 */
342
++	{ 3,       "end choice",        ASN1_EOC,          ASN1_END|ASN1_CH     }, /*  5 */
343
++	{ 3,       "addressesOrRanges", ASN1_SEQUENCE,     ASN1_OPT|ASN1_LOOP   }, /*  6 */
344
++	{ 4,         "addressOrRange",  ASN1_EOC,          ASN1_CHOICE          }, /*  7 */
345
++	{ 5,           "addressPrefix", ASN1_BIT_STRING,   ASN1_OPT|ASN1_BODY   }, /*  8 */
346
++	{ 5,           "end choice",    ASN1_EOC,          ASN1_END|ASN1_CH     }, /*  9 */
347
++	{ 5,           "addressRange",  ASN1_SEQUENCE,     ASN1_OPT             }, /* 10 */
348
++	{ 6,             "min",         ASN1_BIT_STRING,   ASN1_BODY            }, /* 11 */
349
++	{ 6,             "max",         ASN1_BIT_STRING,   ASN1_BODY            }, /* 12 */
350
++	{ 5,           "end choice",    ASN1_EOC,          ASN1_END|ASN1_CH     }, /* 13 */
351
++	{ 4,         "end choices",     ASN1_EOC,          ASN1_END|ASN1_CHOICE }, /* 14 */
352
++	{ 3,       "end loop/choice",   ASN1_EOC,          ASN1_END|ASN1_CH     }, /* 15 */
353
++	{ 2,     "end choices",         ASN1_EOC,          ASN1_END|ASN1_CHOICE }, /* 16 */
354
++	{ 0, "end loop",                ASN1_EOC,          ASN1_END             }, /* 17 */
355
++	{ 0, "exit",                    ASN1_EOC,          ASN1_EXIT            }
356
+ };
357
+ #define IP_ADDR_BLOCKS_FAMILY       2
358
+-#define IP_ADDR_BLOCKS_INHERIT      3
359
+-#define IP_ADDR_BLOCKS_PREFIX       6
360
+-#define IP_ADDR_BLOCKS_MIN          9
361
+-#define IP_ADDR_BLOCKS_MAX         10
362
++#define IP_ADDR_BLOCKS_INHERIT      4
363
++#define IP_ADDR_BLOCKS_PREFIX       8
364
++#define IP_ADDR_BLOCKS_MIN         11
365
++#define IP_ADDR_BLOCKS_MAX         12
366
+ 
367
+ static bool check_address_object(ts_type_t ts_type, chunk_t object)
368
+ {
369
+-- 
370
+1.9.1
371
+
... ...
@@ -1,15 +1,17 @@
1 1
 Summary:          The OpenSource IPsec-based VPN Solution
2 2
 Name:             strongswan
3
-Version:          5.5.1
4
-Release:          2%{?dist}
3
+Version:          5.5.2
4
+Release:          1%{?dist}
5 5
 License:          GPLv2+
6 6
 URL:              https://www.strongswan.org/
7 7
 Group:            System Environment/Security
8 8
 Vendor:           VMware, Inc.
9 9
 Distribution:     Photon
10
-Source0:          https://download.strongswan.org/strongswan-5.5.1.tar.bz2
11
-%define sha1      strongswan=7d400eb501ac9e41eb889199891457003baa284c
10
+Source0:          https://download.strongswan.org/%{name}-%{version}.tar.bz2
11
+%define sha1      strongswan=0f181715fd25a98a9e0d3227b594c6fc8ed429c2
12 12
 Patch0:           strongswan-CVE-2017-11185.patch
13
+Patch1:           strongswan-CVE-2017-9022.patch
14
+Patch2:           strongswan-CVE-2017-9023.patch
13 15
 BuildRequires:    autoconf
14 16
 
15 17
 %description
... ...
@@ -18,6 +20,8 @@ strongSwan is a complete IPsec implementation for Linux 2.6, 3.x, and 4.x kernel
18 18
 %prep
19 19
 %setup -q
20 20
 %patch0 -p1
21
+%patch1 -p1
22
+%patch2 -p1
21 23
 
22 24
 %build
23 25
 ./configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir}
... ...
@@ -50,6 +54,8 @@ rm -rf %{buildroot}/*
50 50
 
51 51
 
52 52
 %changelog
53
+*   Wed Apr 18 2018 Xiaolin Li <xiaolinl@vmware.com> 5.5.2-1
54
+-   Update to version 5.5.2 and apply patches for CVE-2017-9022 and CVE-2017-9023
53 55
 *   Thu Oct 19 2017 Xiaolin Li <xiaolinl@vmware.com> 5.5.1-2
54 56
 -   Fix CVE-2017-11185
55 57
 *   Wed Dec 21 2016 Xiaolin Li <xiaolinl@vmware.com>  5.5.1-1