Package: gnupg2 / 2.0.26-6+deb8u2

0056-Use-inline-functions-to-convert-buffer-data-to-scala.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
From 3627123dc8fdc551caca1c7944713fbf01feccf6 Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Thu, 12 Feb 2015 20:34:44 +0100
Subject: [PATCH] Use inline functions to convert buffer data to scalars.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* include/host2net.h (buf16_to_ulong, buf16_to_uint): New.
(buf16_to_ushort, buf16_to_u16): New.
(buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New.
--

This fixes sign extension on shift problems.  Hanno Böck found a case
with an invalid read due to this problem.  To fix that almost all uses
of "<< 24" and "<< 8" are changed by this patch to use an inline
function from host2net.h.

(back ported from commit 2183683bd633818dd031b090b5530951de76f392)

Signed-off-by: Werner Koch <wk@gnupg.org>
---
 common/iobuf.c       |   3 +-
 g10/build-packet.c   |   6 ++--
 g10/getkey.c         |  17 ++++-----
 g10/keygen.c         |  14 ++++----
 g10/keyid.c          |  32 +++++++----------
 g10/main.h           |   1 -
 g10/misc.c           |  11 ------
 g10/parse-packet.c   |  39 ++++++++++----------
 g10/tdbio.c          |  20 +++++------
 g10/trustdb.c        |   2 +-
 include/host2net.h   | 100 +++++++++++++++++++++++++++++++++++++++++++--------
 kbx/keybox-dump.c    |  13 ++-----
 kbx/keybox-openpgp.c |   7 ++--
 kbx/keybox-search.c  |  13 ++-----
 kbx/keybox-update.c  |   9 +++--
 scd/apdu.c           |  39 +++++++++-----------
 scd/app-openpgp.c    |   3 +-
 scd/ccid-driver.c    |   3 +-
 scd/pcsc-wrapper.c   |   5 +--
 tools/ccidmon.c      |   2 +-
 20 files changed, 187 insertions(+), 152 deletions(-)

diff --git a/common/iobuf.c b/common/iobuf.c
index 4c6d5b5..ee0775c 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -42,6 +42,7 @@
 
 #include "util.h"
 #include "sysutils.h"
+#include "../include/host2net.h"
 #include "iobuf.h"
 
 /*-- Begin configurable part.  --*/
@@ -872,7 +873,7 @@ block_filter (void *opaque, int control, iobuf_t chain, byte * buffer,
 		    }
 		  else if (c == 255)
 		    {
-		      a->size = iobuf_get (chain) << 24;
+		      a->size = (size_t)iobuf_get (chain) << 24;
 		      a->size |= iobuf_get (chain) << 16;
 		      a->size |= iobuf_get (chain) << 8;
 		      if ((c = iobuf_get (chain)) == -1)
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 538f2fe..e986987 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -33,6 +33,7 @@
 #include "cipher.h"
 #include "i18n.h"
 #include "options.h"
+#include "../include/host2net.h"
 
 static int do_user_id( IOBUF out, int ctb, PKT_user_id *uid );
 static int do_public_key( IOBUF out, int ctb, PKT_public_key *pk );
@@ -632,8 +633,7 @@ delete_sig_subpkt (subpktarea_t *area, sigsubpkttype_t reqtype )
 	if( n == 255 ) {
 	    if( buflen < 4 )
 		break;
-	    n = (buffer[0] << 24) | (buffer[1] << 16)
-                | (buffer[2] << 8) | buffer[3];
+	    n = buf32_to_size_t (buffer);
 	    buffer += 4;
 	    buflen -= 4;
 	}
@@ -756,7 +756,7 @@ build_sig_subpkt (PKT_signature *sig, sigsubpkttype_t type,
 	/* This should never happen since we don't currently allow
 	   creating such a subpacket, but just in case... */
       case SIGSUBPKT_SIG_EXPIRE:
-	if(buffer_to_u32(buffer)+sig->timestamp<=make_timestamp())
+	if (buf32_to_u32 (buffer) + sig->timestamp <= make_timestamp())
 	  sig->flags.expired=1;
 	else
 	  sig->flags.expired=0;
diff --git a/g10/getkey.c b/g10/getkey.c
index c0184c2..8b3cf2d 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -35,6 +35,7 @@
 #include "trustdb.h"
 #include "i18n.h"
 #include "keyserver-internal.h"
+#include "../include/host2net.h"
 
 #define MAX_PK_CACHE_ENTRIES   PK_UID_CACHE_SIZE
 #define MAX_UID_CACHE_ENTRIES  PK_UID_CACHE_SIZE
@@ -1486,14 +1487,14 @@ merge_keys_and_selfsig( KBNODE keyblock )
 
 	    p = parse_sig_subpkt( sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL );
 	    if( pk ) {
-		ed = p? pk->timestamp + buffer_to_u32(p):0;
+		ed = p? pk->timestamp + buf32_to_u32(p):0;
 		if( sig->timestamp > sigdate ) {
 		    pk->expiredate = ed;
 		    sigdate = sig->timestamp;
 		}
 	    }
 	    else {
-		ed = p? sk->timestamp + buffer_to_u32(p):0;
+		ed = p? sk->timestamp + buf32_to_u32(p):0;
 		if( sig->timestamp > sigdate ) {
 		    sk->expiredate = ed;
 		    sigdate = sig->timestamp;
@@ -1618,8 +1619,8 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode, u32 keycreated )
 
     /* ditto for the key expiration */
     p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
-    if( p && buffer_to_u32(p) )
-      uid->help_key_expire = keycreated + buffer_to_u32(p);
+    if( p && buf32_to_u32 (p) )
+      uid->help_key_expire = keycreated + buf32_to_u32(p);
     else
       uid->help_key_expire = 0;
 
@@ -1833,9 +1834,9 @@ merge_selfsigs_main(KBNODE keyblock, int *r_revoked, struct revoke_info *rinfo)
 	key_usage=parse_key_usage(sig);
 
 	p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
-	if( p && buffer_to_u32(p) )
+	if( p && buf32_to_u32 (p) )
 	  {
-	    key_expire = keytimestamp + buffer_to_u32(p);
+	    key_expire = keytimestamp + buf32_to_u32 (p);
 	    key_expire_seen = 1;
 	  }
 
@@ -2257,8 +2258,8 @@ merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode )
     subpk->pubkey_usage = key_usage;
 
     p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
-    if ( p && buffer_to_u32(p) )
-        key_expire = keytimestamp + buffer_to_u32(p);
+    if ( p && buf32_to_u32 (p) )
+        key_expire = keytimestamp + buf32_to_u32 (p);
     else
         key_expire = 0;
     subpk->has_expired = key_expire >= curtime? 0 : key_expire;
diff --git a/g10/keygen.c b/g10/keygen.c
index 33c85b4..560480d 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -42,6 +42,7 @@
 #include "i18n.h"
 #include "keyserver-internal.h"
 #include "call-agent.h"
+#include "host2net.h"
 
 /* The default algorithms.  If you change them remember to change them
    also in gpg.c:gpgconf_list.  You should also check that the value
@@ -849,10 +850,7 @@ make_backsig (PKT_signature *sig,PKT_public_key *pk,
 		}
 	      else if(buf[1]==255)
 		{
-		  pktlen =buf[2] << 24;
-		  pktlen|=buf[3] << 16;
-		  pktlen|=buf[4] << 8;
-		  pktlen|=buf[5];
+                  pktlen = buf32_to_size_t (buf+2);
 		  buf+=6;
 		}
 	      else
@@ -869,14 +867,14 @@ make_backsig (PKT_signature *sig,PKT_public_key *pk,
 		  break;
 
 		case 2:
-		  pktlen =buf[mark++] << 24;
-		  pktlen|=buf[mark++] << 16;
+		  pktlen  = (size_t)buf[mark++] << 24;
+		  pktlen |= buf[mark++] << 16;
 
 		case 1:
-		  pktlen|=buf[mark++] << 8;
+		  pktlen |= buf[mark++] << 8;
 
 		case 0:
-		  pktlen|=buf[mark++];
+		  pktlen |= buf[mark++];
 		}
 
 	      buf+=mark;
diff --git a/g10/keyid.c b/g10/keyid.c
index 10eadef..6af0f48 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -34,6 +34,7 @@
 #include "keydb.h"
 #include "i18n.h"
 #include "rmd160.h"
+#include "host2net.h"
 
 int
 pubkey_letter( int algo )
@@ -175,9 +176,9 @@ v3_keyid (gcry_mpi_t a, u32 *ki)
   else
     {
       p = buffer + nbytes - 8;
-      ki[0] = (p[0] << 24) | (p[1] <<16) | (p[2] << 8) | p[3];
+      ki[0] = buf32_to_u32 (p);
       p += 4;
-      ki[1] = (p[0] << 24) | (p[1] <<16) | (p[2] << 8) | p[3];
+      ki[1] = buf32_to_u32 (p);
     }
   xfree (buffer);
   return ki[1];
@@ -271,15 +272,8 @@ keystr_from_desc(KEYDB_SEARCH_DESC *desc)
       {
 	u32 keyid[2];
 
-	keyid[0] = ((unsigned char)desc->u.fpr[12] << 24
-                    | (unsigned char)desc->u.fpr[13] << 16
-                    | (unsigned char)desc->u.fpr[14] << 8
-                    | (unsigned char)desc->u.fpr[15]);
-	keyid[1] = ((unsigned char)desc->u.fpr[16] << 24
-                    | (unsigned char)desc->u.fpr[17] << 16
-                    | (unsigned char)desc->u.fpr[18] << 8
-                    | (unsigned char)desc->u.fpr[19]);
-
+	keyid[0] = buf32_to_u32 (desc->u.fpr+12);
+	keyid[1] = buf32_to_u32 (desc->u.fpr+16);
 	return keystr(keyid);
       }
 
@@ -331,8 +325,8 @@ keyid_from_sk( PKT_secret_key *sk, u32 *keyid )
       if(md)
 	{
 	  dp = gcry_md_read (md, 0);
-	  keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ;
-	  keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ;
+	  keyid[0] = buf32_to_u32 (dp+12);
+	  keyid[1] = buf32_to_u32 (dp+16);
 	  lowbits = keyid[1];
 	  gcry_md_close (md);
 	  sk->keyid[0] = keyid[0];
@@ -386,8 +380,8 @@ keyid_from_pk( PKT_public_key *pk, u32 *keyid )
       if(md)
 	{
 	  dp = gcry_md_read ( md, 0 );
-	  keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ;
-	  keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ;
+	  keyid[0] = buf32_to_u32 (dp+12);
+	  keyid[1] = buf32_to_u32 (dp+16);
 	  lowbits = keyid[1];
 	  gcry_md_close (md);
 	  pk->keyid[0] = keyid[0];
@@ -430,8 +424,8 @@ keyid_from_fingerprint( const byte *fprint, size_t fprint_len, u32 *keyid )
     }
     else {
 	const byte *dp = fprint;
-	keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ;
-	keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ;
+	keyid[0] = buf32_to_u32 (dp+12);
+	keyid[1] = buf32_to_u32 (dp+16);
     }
 
     return keyid[1];
@@ -721,8 +715,8 @@ fingerprint_from_pk( PKT_public_key *pk, byte *array, size_t *ret_len )
       if (!array)
         array = xmalloc ( len );
       memcpy (array, dp, len );
-      pk->keyid[0] = dp[12] << 24 | dp[13] << 16 | dp[14] << 8 | dp[15] ;
-      pk->keyid[1] = dp[16] << 24 | dp[17] << 16 | dp[18] << 8 | dp[19] ;
+      pk->keyid[0] = buf32_to_u32 (dp+12);
+      pk->keyid[1] = buf32_to_u32 (dp+16);
       gcry_md_close( md);
     }
 
diff --git a/g10/main.h b/g10/main.h
index b55a184..7cd6756 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -77,7 +77,6 @@ int  is_secured_filename (const char *fname);
 u16 checksum_u16( unsigned n );
 u16 checksum( byte *p, unsigned n );
 u16 checksum_mpi( gcry_mpi_t a );
-u32 buffer_to_u32( const byte *buffer );
 const byte *get_session_marker( size_t *rlen );
 void print_pubkey_algo_note( int algo );
 void print_cipher_algo_note( int algo );
diff --git a/g10/misc.c b/g10/misc.c
index b20ab07..4df2488 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -276,17 +276,6 @@ checksum_mpi (gcry_mpi_t a)
   return csum;
 }
 
-u32
-buffer_to_u32( const byte *buffer )
-{
-    unsigned long a;
-    a =  *buffer << 24;
-    a |= buffer[1] << 16;
-    a |= buffer[2] << 8;
-    a |= buffer[3];
-    return a;
-}
-
 void
 print_pubkey_algo_note( int algo )
 {
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 7b379c1..5a98961 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -34,6 +34,7 @@
 #include "options.h"
 #include "main.h"
 #include "i18n.h"
+#include "host2net.h"
 
 
 /* Maximum length of packets to avoid excessive memory allocation.  */
@@ -90,7 +91,7 @@ static unsigned short
 read_16(IOBUF inp)
 {
     unsigned short a;
-    a = iobuf_get_noeof(inp) << 8;
+    a = (unsigned short)iobuf_get_noeof(inp) << 8;
     a |= iobuf_get_noeof(inp);
     return a;
 }
@@ -99,7 +100,7 @@ static unsigned long
 read_32(IOBUF inp)
 {
     unsigned long a;
-    a =  iobuf_get_noeof(inp) << 24;
+    a =  (unsigned long)iobuf_get_noeof(inp) << 24;
     a |= iobuf_get_noeof(inp) << 16;
     a |= iobuf_get_noeof(inp) << 8;
     a |= iobuf_get_noeof(inp);
@@ -457,7 +458,8 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
 	       }
              else if( c == 255 )
 	       {
-		 pktlen  = (hdr[hdrlen++] = iobuf_get_noeof(inp)) << 24;
+		 pktlen  =
+                   (unsigned long)(hdr[hdrlen++] = iobuf_get_noeof(inp)) << 24;
 		 pktlen |= (hdr[hdrlen++] = iobuf_get_noeof(inp)) << 16;
 		 pktlen |= (hdr[hdrlen++] = iobuf_get_noeof(inp)) << 8;
 		 if( (c = iobuf_get(inp)) == -1 )
@@ -954,14 +956,15 @@ dump_sig_subpkt( int hashed, int type, int critical,
     switch( type ) {
       case SIGSUBPKT_SIG_CREATED:
 	if( length >= 4 )
-	    fprintf (listfp, "sig created %s", strtimestamp( buffer_to_u32(buffer) ) );
+	    fprintf (listfp, "sig created %s",
+                     strtimestamp (buf32_to_u32(buffer)) );
 	break;
       case SIGSUBPKT_SIG_EXPIRE:
 	if( length >= 4 )
 	  {
-	    if(buffer_to_u32(buffer))
+	    if(buf32_to_u32(buffer))
 	      fprintf (listfp, "sig expires after %s",
-		       strtimevalue( buffer_to_u32(buffer) ) );
+		       strtimevalue( buf32_to_u32(buffer) ) );
 	    else
 	      fprintf (listfp, "sig does not expire");
 	  }
@@ -993,9 +996,9 @@ dump_sig_subpkt( int hashed, int type, int critical,
       case SIGSUBPKT_KEY_EXPIRE:
 	if( length >= 4 )
 	  {
-	    if(buffer_to_u32(buffer))
+	    if(buf32_to_u32(buffer))
 	      fprintf (listfp, "key expires after %s",
-		       strtimevalue( buffer_to_u32(buffer) ) );
+		       strtimevalue( buf32_to_u32(buffer) ) );
 	    else
 	      fprintf (listfp, "key does not expire");
 	  }
@@ -1018,8 +1021,8 @@ dump_sig_subpkt( int hashed, int type, int critical,
       case SIGSUBPKT_ISSUER:
 	if( length >= 8 )
 	    fprintf (listfp, "issuer key ID %08lX%08lX",
-		      (ulong)buffer_to_u32(buffer),
-		      (ulong)buffer_to_u32(buffer+4) );
+                     buf32_to_ulong (buffer),
+                     buf32_to_ulong (buffer+4));
 	break;
       case SIGSUBPKT_NOTATION:
 	{
@@ -1267,8 +1270,7 @@ enum_sig_subpkt( const subpktarea_t *pktbuf, sigsubpkttype_t reqtype,
 	if( n == 255 ) { /* 4 byte length header */
 	    if( buflen < 4 )
 		goto too_short;
-	    n = (buffer[0] << 24) | (buffer[1] << 16)
-                | (buffer[2] << 8) | buffer[3];
+            n = buf32_to_size_t (buffer);
 	    buffer += 4;
 	    buflen -= 4;
 	}
@@ -1491,7 +1493,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
 
 	p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_SIG_CREATED, NULL );
 	if(p)
-	  sig->timestamp = buffer_to_u32(p);
+	  sig->timestamp = buf32_to_u32 (p);
 	else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110)
 		&& opt.verbose)
 	  log_info ("signature packet without timestamp\n");
@@ -1499,16 +1501,16 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
 	p = parse_sig_subpkt2( sig, SIGSUBPKT_ISSUER, NULL );
 	if(p)
 	  {
-	    sig->keyid[0] = buffer_to_u32(p);
-	    sig->keyid[1] = buffer_to_u32(p+4);
+	    sig->keyid[0] = buf32_to_u32 (p);
+	    sig->keyid[1] = buf32_to_u32 (p+4);
 	  }
 	else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110)
 		&& opt.verbose)
 	  log_info ("signature packet without keyid\n");
 
 	p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_SIG_EXPIRE,NULL);
-	if(p && buffer_to_u32(p))
-	  sig->expiredate=sig->timestamp+buffer_to_u32(p);
+	if(p && buf32_to_u32 (p))
+	  sig->expiredate = sig->timestamp + buf32_to_u32 (p);
 	if(sig->expiredate && sig->expiredate<=make_timestamp())
 	  sig->flags.expired=1;
 
@@ -2109,8 +2111,7 @@ parse_attribute_subpkts(PKT_user_id *uid)
       if( n == 255 ) { /* 4 byte length header */
 	if( buflen < 4 )
 	  goto too_short;
-	n = (buffer[0] << 24) | (buffer[1] << 16)
-	  | (buffer[2] << 8) | buffer[3];
+        n = buf32_to_size_t (buffer);
 	buffer += 4;
 	buflen -= 4;
       }
diff --git a/g10/tdbio.c b/g10/tdbio.c
index c5f662c..6e26108 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -1223,13 +1223,13 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
 	rec->r.ver.trust_model = *p++;
 	rec->r.ver.min_cert_level = *p++;
 	p += 2;
-	rec->r.ver.created  = buftoulong(p); p += 4;
-	rec->r.ver.nextcheck = buftoulong(p); p += 4;
+	rec->r.ver.created  = buf32_to_ulong (p); p += 4;
+	rec->r.ver.nextcheck = buf32_to_ulong (p); p += 4;
 	p += 4;
 	p += 4;
-	rec->r.ver.firstfree =buftoulong(p); p += 4;
+	rec->r.ver.firstfree =buf32_to_ulong (p); p += 4;
 	p += 4;
-	rec->r.ver.trusthashtbl =buftoulong(p); p += 4;
+	rec->r.ver.trusthashtbl =buf32_to_ulong (p); p += 4;
 	if( recnum ) {
 	    log_error( _("%s: version record with recnum %lu\n"), db_name,
 							     (ulong)recnum );
@@ -1242,17 +1242,17 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
 	}
 	break;
       case RECTYPE_FREE:
-	rec->r.free.next  = buftoulong(p); p += 4;
+	rec->r.free.next  = buf32_to_ulong (p); p += 4;
 	break;
       case RECTYPE_HTBL:
 	for(i=0; i < ITEMS_PER_HTBL_RECORD; i++ ) {
-	    rec->r.htbl.item[i] = buftoulong(p); p += 4;
+	    rec->r.htbl.item[i] = buf32_to_ulong (p); p += 4;
 	}
 	break;
       case RECTYPE_HLST:
-	rec->r.hlst.next = buftoulong(p); p += 4;
+	rec->r.hlst.next = buf32_to_ulong (p); p += 4;
 	for(i=0; i < ITEMS_PER_HLST_RECORD; i++ ) {
-	    rec->r.hlst.rnum[i] = buftoulong(p); p += 4;
+	    rec->r.hlst.rnum[i] = buf32_to_ulong (p); p += 4;
 	}
 	break;
       case RECTYPE_TRUST:
@@ -1261,12 +1261,12 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
         rec->r.trust.depth = *p++;
         rec->r.trust.min_ownertrust = *p++;
         p++;
-	rec->r.trust.validlist = buftoulong(p); p += 4;
+	rec->r.trust.validlist = buf32_to_ulong (p); p += 4;
 	break;
       case RECTYPE_VALID:
 	memcpy( rec->r.valid.namehash, p, 20); p+=20;
         rec->r.valid.validity = *p++;
-	rec->r.valid.next = buftoulong(p); p += 4;
+	rec->r.valid.next = buf32_to_ulong (p); p += 4;
 	rec->r.valid.full_count = *p++;
 	rec->r.valid.marginal_count = *p++;
 	break;
diff --git a/g10/trustdb.c b/g10/trustdb.c
index 7bfef25..11b6a26 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -1629,7 +1629,7 @@ mark_usable_uid_certs (KBNODE keyblock, KBNODE uidnode,
           u32 expire;
 
           p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_SIG_EXPIRE, NULL );
-          expire = p? sig->timestamp + buffer_to_u32(p) : 0;
+          expire = p? sig->timestamp + buf32_to_u32 (p) : 0;
 
           if (expire==0 || expire > curtime )
             {
diff --git a/include/host2net.h b/include/host2net.h
index 50f4815..be5e520 100644
--- a/include/host2net.h
+++ b/include/host2net.h
@@ -1,14 +1,24 @@
-/* host2net.h - Some macros
- *	Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* host2net.h - Endian conversion macros
+ * Copyright (C) 1998, 2014, 2015  Werner Koch
  *
  * This file is part of GnuPG.
  *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either
  *
- * GnuPG is distributed in the hope that it will be useful,
+ *   - the GNU Lesser General Public License as published by the Free
+ *     Software Foundation; either version 3 of the License, or (at
+ *     your option) any later version.
+ *
+ * or
+ *
+ *   - the GNU General Public License as published by the Free
+ *     Software Foundation; either version 2 of the License, or (at
+ *     your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * This file is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
@@ -17,14 +27,11 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef G10_HOST2NET_H
-#define G10_HOST2NET_H
+#ifndef GNUPG_COMMON_HOST2NET_H
+#define GNUPG_COMMON_HOST2NET_H
 
 #include "types.h"
 
-#define buftoulong( p )  ((*(byte*)(p) << 24) | (*((byte*)(p)+1)<< 16) | \
-		       (*((byte*)(p)+2) << 8) | (*((byte*)(p)+3)))
-#define buftoushort( p )  ((*((byte*)(p)) << 8) | (*((byte*)(p)+1)))
 #define ulongtobuf( p, a ) do { 			  \
 			    ((byte*)p)[0] = a >> 24;	\
 			    ((byte*)p)[1] = a >> 16;	\
@@ -35,8 +42,71 @@
 			    ((byte*)p)[0] = a >>  8;	\
 			    ((byte*)p)[1] = a	   ;	\
 			} while(0)
-#define buftou32( p)	buftoulong( (p) )
-#define u32tobuf( p, a) ulongtobuf( (p), (a) )
 
 
-#endif /*G10_HOST2NET_H*/
+static inline unsigned long
+buf16_to_ulong (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((unsigned long)p[0] << 8) | p[1]);
+}
+
+static inline unsigned int
+buf16_to_uint (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((unsigned int)p[0] << 8) | p[1]);
+}
+
+static inline unsigned short
+buf16_to_ushort (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((unsigned short)p[0] << 8) | p[1]);
+}
+
+static inline u16
+buf16_to_u16 (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((u16)p[0] << 8) | p[1]);
+}
+
+static inline size_t
+buf32_to_size_t (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((size_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+}
+
+static inline unsigned long
+buf32_to_ulong (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((unsigned long)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+}
+
+static inline unsigned int
+buf32_to_uint (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((unsigned int)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+}
+
+static inline u32
+buf32_to_u32 (const void *buffer)
+{
+  const unsigned char *p = buffer;
+
+  return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+}
+
+
+#endif /*GNUPG_COMMON_HOST2NET_H*/
diff --git a/kbx/keybox-dump.c b/kbx/keybox-dump.c
index b671089..da716f3 100644
--- a/kbx/keybox-dump.c
+++ b/kbx/keybox-dump.c
@@ -25,6 +25,7 @@
 
 #include "keybox-defs.h"
 #include <gcrypt.h>
+#include "../include/host2net.h"
 
 /* Argg, we can't include ../common/util.h */
 char *bin2hexcolon (const void *buffer, size_t length, char *stringbuf);
@@ -33,21 +34,13 @@ char *bin2hexcolon (const void *buffer, size_t length, char *stringbuf);
 static ulong
 get32 (const byte *buffer)
 {
-  ulong a;
-  a =  *buffer << 24;
-  a |= buffer[1] << 16;
-  a |= buffer[2] << 8;
-  a |= buffer[3];
-  return a;
+  return buf32_to_ulong (buffer);
 }
 
 static ulong
 get16 (const byte *buffer)
 {
-  ulong a;
-  a =  *buffer << 8;
-  a |= buffer[1];
-  return a;
+  return buf16_to_ulong (buffer);
 }
 
 void
diff --git a/kbx/keybox-openpgp.c b/kbx/keybox-openpgp.c
index e5f9f33..ebeef51 100644
--- a/kbx/keybox-openpgp.c
+++ b/kbx/keybox-openpgp.c
@@ -34,6 +34,7 @@
 #include "keybox-defs.h"
 
 #include <gcrypt.h>
+#include "../include/host2net.h"
 
 
 enum packet_types
@@ -119,10 +120,8 @@ next_packet (unsigned char const **bufptr, size_t *buflen,
         {
           if (len <4 )
             return gpg_error (GPG_ERR_INV_PACKET); /* No length bytes. */
-          pktlen  = (*buf++) << 24;
-          pktlen |= (*buf++) << 16;
-          pktlen |= (*buf++) << 8;
-          pktlen |= (*buf++);
+          pktlen = buf32_to_ulong (buf);
+          buf += 4;
           len -= 4;
       }
       else /* Partial length encoding is not allowed for key packets. */
diff --git a/kbx/keybox-search.c b/kbx/keybox-search.c
index 1680dd7..4b013ce 100644
--- a/kbx/keybox-search.c
+++ b/kbx/keybox-search.c
@@ -25,6 +25,7 @@
 #include <errno.h>
 
 #include "../jnlib/stringhelp.h" /* ascii_xxxx() */
+#include "../include/host2net.h"
 
 #include "keybox-defs.h"
 #include <gcrypt.h>
@@ -45,21 +46,13 @@ struct sn_array_s {
 static inline ulong
 get32 (const byte *buffer)
 {
-  ulong a;
-  a =  *buffer << 24;
-  a |= buffer[1] << 16;
-  a |= buffer[2] << 8;
-  a |= buffer[3];
-  return a;
+  return buf32_to_ulong (buffer);
 }
 
 static inline ulong
 get16 (const byte *buffer)
 {
-  ulong a;
-  a =  *buffer << 8;
-  a |= buffer[1];
-  return a;
+  return buf16_to_ulong (buffer);
 }
 
 
diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c
index 410986c..75464cf 100644
--- a/kbx/keybox-update.c
+++ b/kbx/keybox-update.c
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #include "keybox-defs.h"
+#include "../include/host2net.h"
 
 #define EXTSEP_S "."
 
@@ -623,8 +624,7 @@ keybox_compress (KEYBOX_HANDLE hd)
       buffer = _keybox_get_blob_image (blob, &length);
       if (length > 4 && buffer[4] == BLOBTYPE_HEADER)
         {
-          u32 last_maint = ((buffer[20] << 24) | (buffer[20+1] << 16)
-                            | (buffer[20+2] << 8) | (buffer[20+3]));
+          u32 last_maint = buf32_to_u32 (buffer+20);
           
           if ( (last_maint + 3*3600) > time (NULL) )
             {
@@ -697,7 +697,7 @@ keybox_compress (KEYBOX_HANDLE hd)
           rc = gpg_error (GPG_ERR_BUG);
           break;
         }
-      blobflags = ((buffer[pos] << 8) | (buffer[pos+1]));
+      blobflags = buf16_to_uint (buffer+pos);
       if ((blobflags & KEYBOX_FLAG_BLOB_EPHEMERAL))
         {
           /* This is an ephemeral blob. */
@@ -706,8 +706,7 @@ keybox_compress (KEYBOX_HANDLE hd)
               || size != 4)
             created_at = 0; /* oops. */
           else
-            created_at = ((buffer[pos] << 24) | (buffer[pos+1] << 16)
-                          | (buffer[pos+2] << 8) | (buffer[pos+3]));
+            created_at = buf32_to_u32 (buffer+pos);
 
           if (created_at && created_at < cut_time)
             {
diff --git a/scd/apdu.c b/scd/apdu.c
index 9028120..5ce7f94 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -58,6 +58,7 @@
 #include "scdaemon.h"
 #include "exechelp.h"
 #endif /* GNUPG_MAJOR_VERSION != 1 */
+#include "../include/host2net.h"
 
 #include "iso7816.h"
 #include "apdu.h"
@@ -1013,15 +1014,14 @@ pcsc_get_status_wrapped (int slot, unsigned int *status)
                  i? strerror (errno) : "premature EOF");
       goto command_failed;
     }
-  len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4];
+  len = buf32_to_size_t (msgbuf+1);
   if (msgbuf[0] != 0x81 || len < 4)
     {
       log_error ("invalid response header from PC/SC received\n");
       goto command_failed;
     }
   len -= 4; /* Already read the error code. */
-  err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
-                       | (msgbuf[7] << 8 ) | msgbuf[8]);
+  err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5));
   if (err)
     {
       log_error ("pcsc_status failed: %s (0x%lx)\n",
@@ -1181,15 +1181,14 @@ pcsc_send_apdu_wrapped (int slot, unsigned char *apdu, size_t apdulen,
                  i? strerror (errno) : "premature EOF");
       goto command_failed;
     }
-  len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4];
+  len = buf32_to_size_t (msgbuf+1);
   if (msgbuf[0] != 0x81 || len < 4)
     {
       log_error ("invalid response header from PC/SC received\n");
       goto command_failed;
     }
   len -= 4; /* Already read the error code. */
-  err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
-                       | (msgbuf[7] << 8 ) | msgbuf[8]);
+  err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5));
   if (err)
     {
       log_error ("pcsc_transmit failed: %s (0x%lx)\n",
@@ -1321,15 +1320,14 @@ control_pcsc_wrapped (int slot, pcsc_dword_t ioctl_code,
                  i? strerror (errno) : "premature EOF");
       goto command_failed;
     }
-  len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4];
+  len = buf32_to_size_t (msgbuf+1);
   if (msgbuf[0] != 0x81 || len < 4)
     {
       log_error ("invalid response header from PC/SC received\n");
       goto command_failed;
     }
   len -= 4; /* Already read the error code. */
-  err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
-                       | (msgbuf[7] << 8 ) | msgbuf[8]);
+  err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5));
   if (err)
     {
       log_error ("pcsc_control failed: %s (0x%lx)\n",
@@ -1458,15 +1456,14 @@ close_pcsc_reader_wrapped (int slot)
                  i? strerror (errno) : "premature EOF");
       goto command_failed;
     }
-  len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4];
+  len = buf32_to_size_t (msgbuf+1);
   if (msgbuf[0] != 0x81 || len < 4)
     {
       log_error ("invalid response header from PC/SC received\n");
       goto command_failed;
     }
   len -= 4; /* Already read the error code. */
-  err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
-                       | (msgbuf[7] << 8 ) | msgbuf[8]);
+  err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5));
   if (err)
     log_error ("pcsc_close failed: %s (0x%lx)\n",
                pcsc_error_string (err), err);
@@ -1647,7 +1644,7 @@ reset_pcsc_reader_wrapped (int slot)
                  i? strerror (errno) : "premature EOF");
       goto command_failed;
     }
-  len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4];
+  len = buf32_to_size_t (msgbuf+1);
   if (msgbuf[0] != 0x81 || len < 4)
     {
       log_error ("invalid response header from PC/SC received\n");
@@ -1661,8 +1658,7 @@ reset_pcsc_reader_wrapped (int slot)
       sw = SW_HOST_GENERAL_ERROR;
       goto command_failed;
     }
-  err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
-                       | (msgbuf[7] << 8 ) | msgbuf[8]);
+  err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5));
   if (err)
     {
       log_error ("PC/SC RESET failed: %s (0x%lx)\n",
@@ -1753,9 +1749,9 @@ pcsc_vendor_specific_init (int slot)
           if (l == 1)
             v = p[0];
           else if (l == 2)
-            v = ((p[0] << 8) | p[1]);
+            v = buf16_to_uint (p);
           else if (l == 4)
-            v = ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+            v = buf32_to_uint (p);
 
           if (code == FEATURE_VERIFY_PIN_DIRECT)
             reader_table[slot].pcsc.verify_ioctl = v;
@@ -1814,9 +1810,9 @@ pcsc_vendor_specific_init (int slot)
       if (l == 1)
         v = p[0];
       else if (l == 2)
-        v = ((p[1] << 8) | p[0]);
+        v = (((unsigned int)p[1] << 8) | p[0]);
       else if (l == 4)
-        v = ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
+        v = (((unsigned int)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
 
       if (tag == PCSCv2_PART10_PROPERTY_bMinPINSize)
         reader_table[slot].pcsc.pinmin = v;
@@ -2112,7 +2108,7 @@ open_pcsc_reader_wrapped (const char *portstr)
                  i? strerror (errno) : "premature EOF");
       goto command_failed;
     }
-  len = (msgbuf[1] << 24) | (msgbuf[2] << 16) | (msgbuf[3] << 8 ) | msgbuf[4];
+  len = buf32_to_size_t (msgbuf+1);
   if (msgbuf[0] != 0x81 || len < 4)
     {
       log_error ("invalid response header from PC/SC received\n");
@@ -2125,8 +2121,7 @@ open_pcsc_reader_wrapped (const char *portstr)
                  (unsigned long)len);
       goto command_failed;
     }
-  err = PCSC_ERR_MASK ((msgbuf[5] << 24) | (msgbuf[6] << 16)
-                       | (msgbuf[7] << 8 ) | msgbuf[8]);
+  err = PCSC_ERR_MASK (buf32_to_ulong (msgbuf+5));
 
   if (err)
     {
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index fc69fdb..2e7a9fc 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -66,6 +66,7 @@
 #include "iso7816.h"
 #include "app-common.h"
 #include "tlv.h"
+#include "../include/host2net.h"
 
 
 /* A table describing the DOs of the card.  */
@@ -805,7 +806,7 @@ send_fprtime_if_not_null (ctrl_t ctrl, const char *keyword,
   char numbuf1[50], numbuf2[50];
   unsigned long value;
 
-  value = (stamp[0] << 24) | (stamp[1]<<16) | (stamp[2]<<8) | stamp[3];
+  value = buf32_to_ulong (stamp);
   if (!value)
     return;
   sprintf (numbuf1, "%d", number);
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index c4c0d9c..a179aa8 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -94,6 +94,7 @@
 #include "scdaemon.h"
 #include "iso7816.h"
 #include "ccid-driver.h"
+#include "../include/host2net.h"
 
 #define DRVNAME "ccid-driver: "
 
@@ -317,7 +318,7 @@ static int send_escape_cmd (ccid_driver_t handle, const unsigned char *data,
 static unsigned int
 convert_le_u32 (const unsigned char *buf)
 {
-  return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
+  return buf[0] | (buf[1] << 8) | (buf[2] << 16) | ((unsigned int)buf[3] << 24);
 }
 
 
diff --git a/scd/pcsc-wrapper.c b/scd/pcsc-wrapper.c
index 0d572d2..4dc44ee 100644
--- a/scd/pcsc-wrapper.c
+++ b/scd/pcsc-wrapper.c
@@ -273,7 +273,7 @@ read_32 (FILE *fp)
       fprintf (stderr, PGM ": premature EOF while parsing request\n");
       exit (1);
     }
-  return (c1 << 24) | (c2 << 16) | (c3 << 8) | c4;
+  return ((unsigned long)c1 << 24) | (c2 << 16) | (c3 << 8) | c4;
 }
 
 
@@ -760,7 +760,8 @@ handle_control (unsigned char *argbuf, size_t arglen)
   if (arglen < 4)
     bad_request ("CONTROL");
 
-  ioctl_code = (argbuf[0] << 24) | (argbuf[1] << 16) | (argbuf[2] << 8) | argbuf[3];
+  ioctl_code = (((pcsc_dword_t)argbuf[0] << 24)
+                | (argbuf[1] << 16) | (argbuf[2] << 8) | argbuf[3]);
   argbuf += 4;
   arglen -= 4;
 
diff --git a/tools/ccidmon.c b/tools/ccidmon.c
index b854640..81fd531 100644
--- a/tools/ccidmon.c
+++ b/tools/ccidmon.c
@@ -145,7 +145,7 @@
 static unsigned int 
 convert_le_u32 (const unsigned char *buf)
 {
-  return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); 
+  return buf[0] | (buf[1] << 8) | (buf[2] << 16) | ((unsigned int)buf[3] << 24);
 }
 
 
-- 
2.1.4