Mon Feb 4 08:23:53 2019 UTC ()
add fallthru comments.  i considered patching makefiles to ignore
these problems, but this code is dead upstream and likely will be
removed here rather than ever updated.


(mrg)
diff -r1.5 -r1.6 src/sys/crypto/blowfish/bf_locl.h
diff -r1.4 -r1.5 src/sys/crypto/des/des_locl.h

cvs diff -r1.5 -r1.6 src/sys/crypto/blowfish/bf_locl.h (expand / switch to unified diff)

--- src/sys/crypto/blowfish/bf_locl.h 2009/06/30 13:14:40 1.5
+++ src/sys/crypto/blowfish/bf_locl.h 2019/02/04 08:23:53 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bf_locl.h,v 1.5 2009/06/30 13:14:40 pooka Exp $ */ 1/* $NetBSD: bf_locl.h,v 1.6 2019/02/04 08:23:53 mrg Exp $ */
2/* $KAME: bf_locl.h,v 1.5 2000/08/31 06:03:48 itojun Exp $ */ 2/* $KAME: bf_locl.h,v 1.5 2000/08/31 06:03:48 itojun Exp $ */
3 3
4/* crypto/bf/bf_local.h */ 4/* crypto/bf/bf_local.h */
5/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au) 5/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This package is an SSL implementation written 8 * This package is an SSL implementation written
9 * by Eric Young (eay@mincom.oz.au). 9 * by Eric Young (eay@mincom.oz.au).
10 * The implementation was written so as to conform with Netscapes SSL. 10 * The implementation was written so as to conform with Netscapes SSL.
11 * 11 *
12 * This library is free for commercial and non-commercial use as long as 12 * This library is free for commercial and non-commercial use as long as
13 * the following conditions are aheared to. The following conditions 13 * the following conditions are aheared to. The following conditions
14 * apply to all code found in this distribution, be it the RC4, RSA, 14 * apply to all code found in this distribution, be it the RC4, RSA,
@@ -68,87 +68,87 @@ @@ -68,87 +68,87 @@
68 68
69#undef c2l 69#undef c2l
70#define c2l(c,l) (l =((BF_LONG)(*((c)++))) , \ 70#define c2l(c,l) (l =((BF_LONG)(*((c)++))) , \
71 l|=((BF_LONG)(*((c)++)))<< 8L, \ 71 l|=((BF_LONG)(*((c)++)))<< 8L, \
72 l|=((BF_LONG)(*((c)++)))<<16L, \ 72 l|=((BF_LONG)(*((c)++)))<<16L, \
73 l|=((BF_LONG)(*((c)++)))<<24L) 73 l|=((BF_LONG)(*((c)++)))<<24L)
74 74
75/* NOTE - c is not incremented as per c2l */ 75/* NOTE - c is not incremented as per c2l */
76#undef c2ln 76#undef c2ln
77#define c2ln(c,l1,l2,n) { \ 77#define c2ln(c,l1,l2,n) { \
78 c+=n; \ 78 c+=n; \
79 l1=l2=0; \ 79 l1=l2=0; \
80 switch (n) { \ 80 switch (n) { \
81 case 8: l2 =((BF_LONG)(*(--(c))))<<24L; \ 81 case 8: l2 =((BF_LONG)(*(--(c))))<<24L; /* FALLTHROUGH */ \
82 case 7: l2|=((BF_LONG)(*(--(c))))<<16L; \ 82 case 7: l2|=((BF_LONG)(*(--(c))))<<16L; /* FALLTHROUGH */ \
83 case 6: l2|=((BF_LONG)(*(--(c))))<< 8L; \ 83 case 6: l2|=((BF_LONG)(*(--(c))))<< 8L; /* FALLTHROUGH */ \
84 case 5: l2|=((BF_LONG)(*(--(c)))); \ 84 case 5: l2|=((BF_LONG)(*(--(c)))); /* FALLTHROUGH */ \
85 case 4: l1 =((BF_LONG)(*(--(c))))<<24L; \ 85 case 4: l1 =((BF_LONG)(*(--(c))))<<24L; /* FALLTHROUGH */ \
86 case 3: l1|=((BF_LONG)(*(--(c))))<<16L; \ 86 case 3: l1|=((BF_LONG)(*(--(c))))<<16L; /* FALLTHROUGH */ \
87 case 2: l1|=((BF_LONG)(*(--(c))))<< 8L; \ 87 case 2: l1|=((BF_LONG)(*(--(c))))<< 8L; /* FALLTHROUGH */ \
88 case 1: l1|=((BF_LONG)(*(--(c)))); \ 88 case 1: l1|=((BF_LONG)(*(--(c)))); /* FALLTHROUGH */ \
89 } \ 89 } \
90 } 90 }
91 91
92#undef l2c 92#undef l2c
93#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ 93#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
94 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ 94 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
95 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ 95 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
96 *((c)++)=(unsigned char)(((l)>>24L)&0xff)) 96 *((c)++)=(unsigned char)(((l)>>24L)&0xff))
97 97
98/* NOTE - c is not incremented as per l2c */ 98/* NOTE - c is not incremented as per l2c */
99#undef l2cn 99#undef l2cn
100#define l2cn(l1,l2,c,n) { \ 100#define l2cn(l1,l2,c,n) { \
101 c+=n; \ 101 c+=n; \
102 switch (n) { \ 102 switch (n) { \
103 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ 103 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); /* FALLTHROUGH */ \
104 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ 104 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); /* FALLTHROUGH */ \
105 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ 105 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); /* FALLTHROUGH */ \
106 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ 106 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); /* FALLTHROUGH */ \
107 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ 107 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); /* FALLTHROUGH */ \
108 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ 108 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); /* FALLTHROUGH */ \
109 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ 109 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); /* FALLTHROUGH */ \
110 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ 110 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); /* FALLTHROUGH */ \
111 } \ 111 } \
112 } 112 }
113 113
114/* NOTE - c is not incremented as per n2l */ 114/* NOTE - c is not incremented as per n2l */
115#define n2ln(c,l1,l2,n) { \ 115#define n2ln(c,l1,l2,n) { \
116 c+=n; \ 116 c+=n; \
117 l1=l2=0; \ 117 l1=l2=0; \
118 switch (n) { \ 118 switch (n) { \
119 case 8: l2 =((BF_LONG)(*(--(c)))) ; \ 119 case 8: l2 =((BF_LONG)(*(--(c)))) ; /* FALLTHROUGH */ \
120 case 7: l2|=((BF_LONG)(*(--(c))))<< 8; \ 120 case 7: l2|=((BF_LONG)(*(--(c))))<< 8; /* FALLTHROUGH */ \
121 case 6: l2|=((BF_LONG)(*(--(c))))<<16; \ 121 case 6: l2|=((BF_LONG)(*(--(c))))<<16; /* FALLTHROUGH */ \
122 case 5: l2|=((BF_LONG)(*(--(c))))<<24; \ 122 case 5: l2|=((BF_LONG)(*(--(c))))<<24; /* FALLTHROUGH */ \
123 case 4: l1 =((BF_LONG)(*(--(c)))) ; \ 123 case 4: l1 =((BF_LONG)(*(--(c)))) ; /* FALLTHROUGH */ \
124 case 3: l1|=((BF_LONG)(*(--(c))))<< 8; \ 124 case 3: l1|=((BF_LONG)(*(--(c))))<< 8; /* FALLTHROUGH */ \
125 case 2: l1|=((BF_LONG)(*(--(c))))<<16; \ 125 case 2: l1|=((BF_LONG)(*(--(c))))<<16; /* FALLTHROUGH */ \
126 case 1: l1|=((BF_LONG)(*(--(c))))<<24; \ 126 case 1: l1|=((BF_LONG)(*(--(c))))<<24; /* FALLTHROUGH */ \
127 } \ 127 } \
128 } 128 }
129 129
130/* NOTE - c is not incremented as per l2n */ 130/* NOTE - c is not incremented as per l2n */
131#define l2nn(l1,l2,c,n) { \ 131#define l2nn(l1,l2,c,n) { \
132 c+=n; \ 132 c+=n; \
133 switch (n) { \ 133 switch (n) { \
134 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ 134 case 8: *(--(c))=(unsigned char)(((l2) )&0xff); /* FALLTHROUGH */ \
135 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ 135 case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); /* FALLTHROUGH */ \
136 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ 136 case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); /* FALLTHROUGH */ \
137 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ 137 case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); /* FALLTHROUGH */ \
138 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ 138 case 4: *(--(c))=(unsigned char)(((l1) )&0xff); /* FALLTHROUGH */ \
139 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ 139 case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); /* FALLTHROUGH */ \
140 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ 140 case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); /* FALLTHROUGH */ \
141 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ 141 case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); /* FALLTHROUGH */ \
142 } \ 142 } \
143 } 143 }
144 144
145#undef n2l 145#undef n2l
146#define n2l(c,l) (l =((BF_LONG)(*((c)++)))<<24L, \ 146#define n2l(c,l) (l =((BF_LONG)(*((c)++)))<<24L, \
147 l|=((BF_LONG)(*((c)++)))<<16L, \ 147 l|=((BF_LONG)(*((c)++)))<<16L, \
148 l|=((BF_LONG)(*((c)++)))<< 8L, \ 148 l|=((BF_LONG)(*((c)++)))<< 8L, \
149 l|=((BF_LONG)(*((c)++)))) 149 l|=((BF_LONG)(*((c)++))))
150 150
151#undef l2n 151#undef l2n
152#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ 152#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
153 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ 153 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
154 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ 154 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \

cvs diff -r1.4 -r1.5 src/sys/crypto/des/des_locl.h (expand / switch to unified diff)

--- src/sys/crypto/des/des_locl.h 2001/09/09 11:01:02 1.4
+++ src/sys/crypto/des/des_locl.h 2019/02/04 08:23:53 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: des_locl.h,v 1.4 2001/09/09 11:01:02 tls Exp $ */ 1/* $NetBSD: des_locl.h,v 1.5 2019/02/04 08:23:53 mrg Exp $ */
2/* $KAME: des_locl.h,v 1.6 2000/11/06 13:58:09 itojun Exp $ */ 2/* $KAME: des_locl.h,v 1.6 2000/11/06 13:58:09 itojun Exp $ */
3 3
4/* crypto/des/des_locl.h */ 4/* crypto/des/des_locl.h */
5/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au) 5/* Copyright (C) 1995-1997 Eric Young (eay@mincom.oz.au)
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This file is part of an SSL implementation written 8 * This file is part of an SSL implementation written
9 * by Eric Young (eay@mincom.oz.au). 9 * by Eric Young (eay@mincom.oz.au).
10 * The implementation was written so as to conform with Netscapes SSL 10 * The implementation was written so as to conform with Netscapes SSL
11 * specification. This library and applications are 11 * specification. This library and applications are
12 * FREE FOR COMMERCIAL AND NON-COMMERCIAL USE 12 * FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
13 * as long as the following conditions are aheared to. 13 * as long as the following conditions are aheared to.
14 * 14 *
@@ -66,68 +66,68 @@ @@ -66,68 +66,68 @@
66#define MAXWRITE (1024*16) 66#define MAXWRITE (1024*16)
67#define BSIZE (MAXWRITE+4) 67#define BSIZE (MAXWRITE+4)
68 68
69#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ 69#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \
70 l|=((DES_LONG)(*((c)++)))<< 8L, \ 70 l|=((DES_LONG)(*((c)++)))<< 8L, \
71 l|=((DES_LONG)(*((c)++)))<<16L, \ 71 l|=((DES_LONG)(*((c)++)))<<16L, \
72 l|=((DES_LONG)(*((c)++)))<<24L) 72 l|=((DES_LONG)(*((c)++)))<<24L)
73 73
74/* NOTE - c is not incremented as per c2l */ 74/* NOTE - c is not incremented as per c2l */
75#define c2ln(c,l1,l2,n) { \ 75#define c2ln(c,l1,l2,n) { \
76 c+=n; \ 76 c+=n; \
77 l1=l2=0; \ 77 l1=l2=0; \
78 switch (n) { \ 78 switch (n) { \
79 case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ 79 case 8: l2 =((DES_LONG)(*(--(c))))<<24L; /* FALLTHROUGH */\
80 case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ 80 case 7: l2|=((DES_LONG)(*(--(c))))<<16L; /* FALLTHROUGH */\
81 case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ 81 case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; /* FALLTHROUGH */\
82 case 5: l2|=((DES_LONG)(*(--(c)))); \ 82 case 5: l2|=((DES_LONG)(*(--(c)))); /* FALLTHROUGH */\
83 case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ 83 case 4: l1 =((DES_LONG)(*(--(c))))<<24L; /* FALLTHROUGH */\
84 case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ 84 case 3: l1|=((DES_LONG)(*(--(c))))<<16L; /* FALLTHROUGH */\
85 case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ 85 case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; /* FALLTHROUGH */\
86 case 1: l1|=((DES_LONG)(*(--(c)))); \ 86 case 1: l1|=((DES_LONG)(*(--(c)))); /* FALLTHROUGH */\
87 } \ 87 } \
88 } 88 }
89 89
90#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ 90#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
91 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ 91 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
92 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ 92 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
93 *((c)++)=(unsigned char)(((l)>>24L)&0xff)) 93 *((c)++)=(unsigned char)(((l)>>24L)&0xff))
94 94
95/* replacements for htonl and ntohl since I have no idea what to do 95/* replacements for htonl and ntohl since I have no idea what to do
96 * when faced with machines with 8 byte longs. */ 96 * when faced with machines with 8 byte longs. */
97#define HDRSIZE 4 97#define HDRSIZE 4
98 98
99#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ 99#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \
100 l|=((DES_LONG)(*((c)++)))<<16L, \ 100 l|=((DES_LONG)(*((c)++)))<<16L, \
101 l|=((DES_LONG)(*((c)++)))<< 8L, \ 101 l|=((DES_LONG)(*((c)++)))<< 8L, \
102 l|=((DES_LONG)(*((c)++)))) 102 l|=((DES_LONG)(*((c)++))))
103 103
104#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ 104#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
105 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ 105 *((c)++)=(unsigned char)(((l)>>16L)&0xff), \
106 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ 106 *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
107 *((c)++)=(unsigned char)(((l) )&0xff)) 107 *((c)++)=(unsigned char)(((l) )&0xff))
108 108
109/* NOTE - c is not incremented as per l2c */ 109/* NOTE - c is not incremented as per l2c */
110#define l2cn(l1,l2,c,n) { \ 110#define l2cn(l1,l2,c,n) { \
111 c+=n; \ 111 c+=n; \
112 switch (n) { \ 112 switch (n) { \
113 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ 113 case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); /* FALLTHROUGH */\
114 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ 114 case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); /* FALLTHROUGH */\
115 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ 115 case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); /* FALLTHROUGH */\
116 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ 116 case 5: *(--(c))=(unsigned char)(((l2) )&0xff); /* FALLTHROUGH */\
117 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ 117 case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); /* FALLTHROUGH */\
118 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ 118 case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); /* FALLTHROUGH */\
119 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ 119 case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); /* FALLTHROUGH */\
120 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ 120 case 1: *(--(c))=(unsigned char)(((l1) )&0xff); /* FALLTHROUGH */\
121 } \ 121 } \
122 } 122 }
123 123
124#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) 124#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n))))
125 125
126#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) 126#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g)
127#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ 127#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \
128 u=R^s[S ]; \ 128 u=R^s[S ]; \
129 t=R^s[S+1] 129 t=R^s[S+1]
130 130
131/* The changes to this macro may help or hinder, depending on the 131/* The changes to this macro may help or hinder, depending on the
132 * compiler and the achitecture. gcc2 always seems to do well :-). 132 * compiler and the achitecture. gcc2 always seems to do well :-).
133 * Inspired by Dana How <how@isl.stanford.edu> 133 * Inspired by Dana How <how@isl.stanford.edu>