Browse code

vcpkg-ports: restore trailing whitespaces in .patch files

Commit 36b9aa "contrib/vcpkg-ports: add pkcs11-helper port"
has trimmed trailing white space in .patch files and thus corrupted them.

Restore trailing whitespaces to "uncorrupt" patches.

** applied with git am --whitespace=nowarn **

Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-By: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210615104331.210-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22553.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Lev Stipakov authored on 2021/06/15 19:43:31
Showing 2 changed files
... ...
@@ -74,7 +74,7 @@ index 2edab39..b2ac746 100644
74 74
 +++ b/lib/Makefile.w32-vc
75 75
 @@ -60,9 +60,9 @@ OPENSSL_HOME = ..\..\openssl-0.9.8a
76 76
  !endif
77
-
77
+ 
78 78
  !ifdef OPENSSL
79 79
 -OPENSSL_STATIC = libeay32.lib
80 80
 +OPENSSL_STATIC = libcrypto.lib
... ...
@@ -82,7 +82,7 @@ index 2edab39..b2ac746 100644
82 82
 -OPENSSL_DYNAMIC = libeay32.lib
83 83
 +OPENSSL_DYNAMIC = libcrypto.lib
84 84
  #OPENSSL_DYNAMIC = libeay32d.lib
85
-
85
+ 
86 86
  OPENSSL_INC=$(OPENSSL_HOME)\include
87
+-- 
87 88
 2.23.0.windows.1
... ...
@@ -3,7 +3,7 @@ Author: David Woodhouse <David.Woodhouse@intel.com>
3 3
 Date:   Thu Apr 30 14:58:24 2015 +0100
4 4
 
5 5
     Serialize to RFC7512-compliant PKCS#11 URIs
6
-
6
+    
7 7
     Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
8 8
 
9 9
 commit 4d5280da8df591aab701dff4493d13a835a9b29c
... ...
@@ -11,9 +11,9 @@ Author: David Woodhouse <David.Woodhouse@intel.com>
11 11
 Date:   Wed Dec 10 14:00:21 2014 +0000
12 12
 
13 13
     Accept RFC7512-compliant PKCS#11 URIs as serialized token/certificate IDs
14
-
14
+    
15 15
     The old format is still accepted for compatibility.
16
-
16
+    
17 17
     Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
18 18
 
19 19
 commit 14e09211c3d50eb06825090c9765e4382cf52f19
... ...
@@ -21,21 +21,21 @@ Author: David Woodhouse <David.Woodhouse@intel.com>
21 21
 Date:   Sun Dec 14 19:42:18 2014 +0000
22 22
 
23 23
     Stop _pkcs11h_util_hexToBinary() checking for trailing NUL
24
-
24
+    
25 25
     We are going to want to use this for parsing %XX hex escapes in RFC7512
26 26
     PKCS#11 URIs, where we cannot expect a trailing NUL. Since there's only
27 27
     one existing caller at the moment, it's simple just to let the caller
28 28
     have responsibility for that check.
29
-
29
+    
30 30
     Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
31 31
 diff --git a/lib/pkcs11h-serialization.c b/lib/pkcs11h-serialization.c
32 32
 index ad275f8..1d077e4 100644
33 33
 --- a/lib/pkcs11h-serialization.c
34 34
 +++ b/lib/pkcs11h-serialization.c
35 35
 @@ -61,29 +61,127 @@
36
-
36
+ 
37 37
  #if defined(ENABLE_PKCS11H_TOKEN) || defined(ENABLE_PKCS11H_CERTIFICATE)
38
-
38
+ 
39 39
 +#define URI_SCHEME "pkcs11:"
40 40
 +
41 41
 +#define token_field_ofs(field) ((unsigned long)&(((struct pkcs11h_token_id_s *)0)->field))
... ...
@@ -147,19 +147,19 @@ index ad275f8..1d077e4 100644
147 147
 +
148 148
  CK_RV
149 149
  pkcs11h_token_serializeTokenId (
150
-	OUT char * const sz,
151
-	IN OUT size_t *max,
152
-	IN const pkcs11h_token_id_t token_id
150
+ 	OUT char * const sz,
151
+ 	IN OUT size_t *max,
152
+ 	IN const pkcs11h_token_id_t token_id
153 153
  ) {
154 154
 -	const char *sources[5];
155
-	CK_RV rv = CKR_FUNCTION_FAILED;
155
+ 	CK_RV rv = CKR_FUNCTION_FAILED;
156 156
 -	size_t n;
157 157
 -	int e;
158
-
159
-	/*_PKCS11H_ASSERT (sz!=NULL); Not required*/
160
-	_PKCS11H_ASSERT (max!=NULL);
161
-	_PKCS11H_ASSERT (token_id!=NULL);
162
-
158
+ 
159
+ 	/*_PKCS11H_ASSERT (sz!=NULL); Not required*/
160
+ 	_PKCS11H_ASSERT (max!=NULL);
161
+ 	_PKCS11H_ASSERT (token_id!=NULL);
162
+ 
163 163
 -	{ /* Must be after assert */
164 164
 -		sources[0] = token_id->manufacturerID;
165 165
 -		sources[1] = token_id->model;
... ...
@@ -168,13 +168,13 @@ index ad275f8..1d077e4 100644
168 168
 -		sources[4] = NULL;
169 169
 -	}
170 170
 -
171
-	_PKCS11H_DEBUG (
172
-		PKCS11H_LOG_DEBUG2,
173
-		"PKCS#11: pkcs11h_token_serializeTokenId entry sz=%p, *max="P_Z", token_id=%p",
171
+ 	_PKCS11H_DEBUG (
172
+ 		PKCS11H_LOG_DEBUG2,
173
+ 		"PKCS#11: pkcs11h_token_serializeTokenId entry sz=%p, *max="P_Z", token_id=%p",
174 174
 @@ -92,67 +190,161 @@ pkcs11h_token_serializeTokenId (
175
-		(void *)token_id
176
-	);
177
-
175
+ 		(void *)token_id
176
+ 	);
177
+ 
178 178
 -	n = 0;
179 179
 -	for (e=0;sources[e] != NULL;e++) {
180 180
 -		size_t t;
... ...
@@ -232,15 +232,15 @@ index ad275f8..1d077e4 100644
232 232
 +			urilen -= 2;
233 233
 +		} else {
234 234
 +			*tokstr = *uri;
235
-		}
235
+ 		}
236 236
 -		n+=t;
237 237
 +		tokstr++;
238 238
 +		uri++;
239 239
 +		toklen--;
240 240
 +		urilen--;
241 241
 +		tokstr[0] = 0;
242
-	}
243
-
242
+ 	}
243
+ 
244 244
 -	if (sz != NULL) {
245 245
 -		if (*max < n) {
246 246
 -			rv = CKR_ATTRIBUTE_VALUE_INVALID;
... ...
@@ -295,7 +295,7 @@ index ad275f8..1d077e4 100644
295 295
 +
296 296
 +				goto matched;
297 297
 +			}
298
-		}
298
+ 		}
299 299
 +		if (certificate_id && !strncmp(p, "id=", 3)) {
300 300
 +			p += 3;
301 301
 +
... ...
@@ -304,7 +304,7 @@ index ad275f8..1d077e4 100644
304 304
 +			if (rv != CKR_OK) {
305 305
 +				goto cleanup;
306 306
 +			}
307
-
307
+ 
308 308
 -		n = 0;
309 309
 -		for (e=0;sources[e] != NULL;e++) {
310 310
 -			size_t t = *max-n;
... ...
@@ -321,16 +321,16 @@ index ad275f8..1d077e4 100644
321 321
 +						     end - p + 1,
322 322
 +						     &certificate_id->attrCKA_ID_size);
323 323
 +			if (rv != CKR_OK) {
324
-				goto cleanup;
325
-			}
324
+ 				goto cleanup;
325
+ 			}
326 326
 -			n+=t;
327 327
 -			sz[n-1] = '/';
328 328
 +
329 329
 +			goto matched;
330
-		}
330
+ 		}
331 331
 -		sz[n-1] = '\x0';
332 332
 -	}
333
-
333
+ 
334 334
 -	*max = n;
335 335
 -	rv = CKR_OK;
336 336
 +		/* We don't parse object= because the match code doesn't support
... ...
@@ -338,7 +338,7 @@ index ad275f8..1d077e4 100644
338 338
 +
339 339
 +		/* Failed to parse PKCS#11 URI element. */
340 340
 +		return CKR_ATTRIBUTE_VALUE_INVALID;
341
-
341
+ 
342 342
 +		matched:
343 343
 +		    ;
344 344
 +	}
... ...
@@ -351,7 +351,7 @@ index ad275f8..1d077e4 100644
351 351
 +	    !token_id->manufacturerID[0] || !token_id->serialNumber[0]) {
352 352
 +		return CKR_ATTRIBUTE_VALUE_INVALID;
353 353
 +	}
354
-
354
+ 
355 355
 -	_PKCS11H_DEBUG (
356 356
 -		PKCS11H_LOG_DEBUG2,
357 357
 -		"PKCS#11: pkcs11h_token_serializeTokenId return rv=%lu-'%s', *max="P_Z", sz='%s'",
... ...
@@ -364,29 +364,29 @@ index ad275f8..1d077e4 100644
364 364
 +	if (certificate_id && !certificate_id->attrCKA_ID_size) {
365 365
 +		return CKR_ATTRIBUTE_VALUE_INVALID;
366 366
 +	}
367
-
368
-	return rv;
367
+ 
368
+ 	return rv;
369 369
  }
370
-
370
+ 
371 371
 +static
372 372
  CK_RV
373 373
 -pkcs11h_token_deserializeTokenId (
374 374
 -	OUT pkcs11h_token_id_t *p_token_id,
375 375
 +__pkcs11h_token_legacy_deserializeTokenId (
376 376
 +	OUT pkcs11h_token_id_t token_id,
377
-	IN const char * const sz
377
+ 	IN const char * const sz
378 378
  ) {
379 379
  #define __PKCS11H_TARGETS_NUMBER 4
380 380
 @@ -161,24 +353,11 @@ pkcs11h_token_deserializeTokenId (
381
-		size_t s;
382
-	} targets[__PKCS11H_TARGETS_NUMBER];
383
-
381
+ 		size_t s;
382
+ 	} targets[__PKCS11H_TARGETS_NUMBER];
383
+ 
384 384
 -	pkcs11h_token_id_t token_id = NULL;
385
-	char *p1 = NULL;
386
-	char *_sz = NULL;
387
-	int e;
388
-	CK_RV rv = CKR_FUNCTION_FAILED;
389
-
385
+ 	char *p1 = NULL;
386
+ 	char *_sz = NULL;
387
+ 	int e;
388
+ 	CK_RV rv = CKR_FUNCTION_FAILED;
389
+ 
390 390
 -	_PKCS11H_ASSERT (p_token_id!=NULL);
391 391
 -	_PKCS11H_ASSERT (sz!=NULL);
392 392
 -
... ...
@@ -399,24 +399,24 @@ index ad275f8..1d077e4 100644
399 399
 -
400 400
 -	*p_token_id = NULL;
401 401
 -
402
-	if (
403
-		(rv = _pkcs11h_mem_strdup (
404
-			(void *)&_sz,
402
+ 	if (
403
+ 		(rv = _pkcs11h_mem_strdup (
404
+ 			(void *)&_sz,
405 405
 @@ -190,10 +369,6 @@ pkcs11h_token_deserializeTokenId (
406
-
407
-	p1 = _sz;
408
-
406
+ 
407
+ 	p1 = _sz;
408
+ 
409 409
 -	if ((rv = _pkcs11h_token_newTokenId (&token_id)) != CKR_OK) {
410 410
 -		goto cleanup;
411 411
 -	}
412 412
 -
413
-	targets[0].p = token_id->manufacturerID;
414
-	targets[0].s = sizeof (token_id->manufacturerID);
415
-	targets[1].p = token_id->model;
413
+ 	targets[0].p = token_id->manufacturerID;
414
+ 	targets[0].s = sizeof (token_id->manufacturerID);
415
+ 	targets[1].p = token_id->model;
416 416
 @@ -252,6 +427,51 @@ pkcs11h_token_deserializeTokenId (
417
-		p1 = p2+1;
418
-	}
419
-
417
+ 		p1 = p2+1;
418
+ 	}
419
+ 
420 420
 +	rv = CKR_OK;
421 421
 +
422 422
 +cleanup:
... ...
@@ -462,43 +462,43 @@ index ad275f8..1d077e4 100644
462 462
 +		goto cleanup;
463 463
 +	}
464 464
 +
465
-	strncpy (
466
-		token_id->display,
467
-		token_id->label,
465
+ 	strncpy (
466
+ 		token_id->display,
467
+ 		token_id->label,
468 468
 @@ -264,11 +484,6 @@ pkcs11h_token_deserializeTokenId (
469
-	rv = CKR_OK;
470
-
469
+ 	rv = CKR_OK;
470
+ 
471 471
  cleanup:
472 472
 -
473 473
 -	if (_sz != NULL) {
474 474
 -		_pkcs11h_mem_free ((void *)&_sz);
475 475
 -	}
476 476
 -
477
-	if (token_id != NULL) {
478
-		pkcs11h_token_freeTokenId (token_id);
479
-	}
477
+ 	if (token_id != NULL) {
478
+ 		pkcs11h_token_freeTokenId (token_id);
479
+ 	}
480 480
 @@ -281,7 +496,6 @@ cleanup:
481
-	);
482
-
483
-	return rv;
481
+ 	);
482
+ 
483
+ 	return rv;
484 484
 -#undef __PKCS11H_TARGETS_NUMBER
485 485
  }
486
-
486
+ 
487 487
  #endif				/* ENABLE_PKCS11H_TOKEN || ENABLE_PKCS11H_CERTIFICATE */
488 488
 @@ -295,9 +509,6 @@ pkcs11h_certificate_serializeCertificateId (
489
-	IN const pkcs11h_certificate_id_t certificate_id
489
+ 	IN const pkcs11h_certificate_id_t certificate_id
490 490
  ) {
491
-	CK_RV rv = CKR_FUNCTION_FAILED;
491
+ 	CK_RV rv = CKR_FUNCTION_FAILED;
492 492
 -	size_t saved_max = 0;
493 493
 -	size_t n = 0;
494 494
 -	size_t _max = 0;
495
-
496
-	/*_PKCS11H_ASSERT (sz!=NULL); Not required */
497
-	_PKCS11H_ASSERT (max!=NULL);
495
+ 
496
+ 	/*_PKCS11H_ASSERT (sz!=NULL); Not required */
497
+ 	_PKCS11H_ASSERT (max!=NULL);
498 498
 @@ -311,42 +522,7 @@ pkcs11h_certificate_serializeCertificateId (
499
-		(void *)certificate_id
500
-	);
501
-
499
+ 		(void *)certificate_id
500
+ 	);
501
+ 
502 502
 -	if (sz != NULL) {
503 503
 -		saved_max = n = *max;
504 504
 -	}
... ...
@@ -536,25 +536,25 @@ index ad275f8..1d077e4 100644
536 536
 -
537 537
 -cleanup:
538 538
 +	rv = __generate_pkcs11_uri(sz, max, certificate_id, certificate_id->token_id);
539
-
540
-	_PKCS11H_DEBUG (
541
-		PKCS11H_LOG_DEBUG2,
539
+ 
540
+ 	_PKCS11H_DEBUG (
541
+ 		PKCS11H_LOG_DEBUG2,
542 542
 @@ -360,27 +536,16 @@ cleanup:
543
-	return rv;
543
+ 	return rv;
544 544
  }
545
-
545
+ 
546 546
 +static
547 547
  CK_RV
548 548
 -pkcs11h_certificate_deserializeCertificateId (
549 549
 -	OUT pkcs11h_certificate_id_t * const p_certificate_id,
550 550
 +__pkcs11h_certificate_legacy_deserializeCertificateId (
551 551
 +	OUT pkcs11h_certificate_id_t certificate_id,
552
-	IN const char * const sz
552
+ 	IN const char * const sz
553 553
  ) {
554 554
 -	pkcs11h_certificate_id_t certificate_id = NULL;
555
-	CK_RV rv = CKR_FUNCTION_FAILED;
556
-	char *p = NULL;
557
-	char *_sz = NULL;
555
+ 	CK_RV rv = CKR_FUNCTION_FAILED;
556
+ 	char *p = NULL;
557
+ 	char *_sz = NULL;
558 558
 -
559 559
 -	_PKCS11H_ASSERT (p_certificate_id!=NULL);
560 560
 -	_PKCS11H_ASSERT (sz!=NULL);
... ...
@@ -568,24 +568,24 @@ index ad275f8..1d077e4 100644
568 568
 -		sz
569 569
 -	);
570 570
 +	size_t id_hex_len;
571
-
572
-	if (
573
-		(rv = _pkcs11h_mem_strdup (
571
+ 
572
+ 	if (
573
+ 		(rv = _pkcs11h_mem_strdup (
574 574
 @@ -393,10 +558,6 @@ pkcs11h_certificate_deserializeCertificateId (
575
-
576
-	p = _sz;
577
-
575
+ 
576
+ 	p = _sz;
577
+ 
578 578
 -	if ((rv = _pkcs11h_certificate_newCertificateId (&certificate_id)) != CKR_OK) {
579 579
 -		goto cleanup;
580 580
 -	}
581 581
 -
582
-	if ((p = strrchr (_sz, '/')) == NULL) {
583
-		rv = CKR_ATTRIBUTE_VALUE_INVALID;
584
-		goto cleanup;
582
+ 	if ((p = strrchr (_sz, '/')) == NULL) {
583
+ 		rv = CKR_ATTRIBUTE_VALUE_INVALID;
584
+ 		goto cleanup;
585 585
 @@ -414,7 +575,12 @@ pkcs11h_certificate_deserializeCertificateId (
586
-		goto cleanup;
587
-	}
588
-
586
+ 		goto cleanup;
587
+ 	}
588
+ 
589 589
 -	certificate_id->attrCKA_ID_size = strlen (p)/2;
590 590
 +	id_hex_len = strlen (p);
591 591
 +	if (id_hex_len & 1) {
... ...
@@ -593,13 +593,13 @@ index ad275f8..1d077e4 100644
593 593
 +		goto cleanup;
594 594
 +	}
595 595
 +	certificate_id->attrCKA_ID_size = id_hex_len/2;
596
-
597
-	if (
598
-		(rv = _pkcs11h_mem_malloc (
596
+ 
597
+ 	if (
598
+ 		(rv = _pkcs11h_mem_malloc (
599 599
 @@ -430,21 +596,64 @@ pkcs11h_certificate_deserializeCertificateId (
600
-		goto cleanup;
601
-	}
602
-
600
+ 		goto cleanup;
601
+ 	}
602
+ 
603 603
 +	rv = CKR_OK;
604 604
 +
605 605
 +cleanup:
... ...
@@ -648,32 +648,32 @@ index ad275f8..1d077e4 100644
648 648
 +		goto cleanup;
649 649
 +	}
650 650
 +
651
-	*p_certificate_id = certificate_id;
652
-	certificate_id = NULL;
653
-	rv = CKR_OK;
654
-
651
+ 	*p_certificate_id = certificate_id;
652
+ 	certificate_id = NULL;
653
+ 	rv = CKR_OK;
654
+ 
655 655
  cleanup:
656 656
 -
657
-	if (certificate_id != NULL) {
658
-		pkcs11h_certificate_freeCertificateId (certificate_id);
659
-		certificate_id = NULL;
660
-	}
661
-
657
+ 	if (certificate_id != NULL) {
658
+ 		pkcs11h_certificate_freeCertificateId (certificate_id);
659
+ 		certificate_id = NULL;
660
+ 	}
661
+ 
662 662
 -	if (_sz != NULL) {
663 663
 -		_pkcs11h_mem_free ((void *)&_sz);
664 664
 -	}
665 665
 -
666
-	_PKCS11H_DEBUG (
667
-		PKCS11H_LOG_DEBUG2,
668
-		"PKCS#11: pkcs11h_certificate_deserializeCertificateId return rv=%lu-'%s'",
666
+ 	_PKCS11H_DEBUG (
667
+ 		PKCS11H_LOG_DEBUG2,
668
+ 		"PKCS#11: pkcs11h_certificate_deserializeCertificateId return rv=%lu-'%s'",
669 669
 diff --git a/lib/pkcs11h-util.c b/lib/pkcs11h-util.c
670 670
 index 0743fd1..f90e443 100644
671 671
 --- a/lib/pkcs11h-util.c
672 672
 +++ b/lib/pkcs11h-util.c
673 673
 @@ -110,12 +110,7 @@ _pkcs11h_util_hexToBinary (
674
-		p++;
675
-	}
676
-
674
+ 		p++;
675
+ 	}
676
+ 
677 677
 -	if (*p != '\x0') {
678 678
 -		return CKR_ATTRIBUTE_VALUE_INVALID;
679 679
 -	}
... ...
@@ -682,5 +682,5 @@ index 0743fd1..f90e443 100644
682 682
 -	}
683 683
 +	return CKR_OK;
684 684
  }
685
-
685
+ 
686 686
  CK_RV