diff options
author | inoguchi <> | 2019-02-09 06:27:37 +0000 |
---|---|---|
committer | inoguchi <> | 2019-02-09 06:27:37 +0000 |
commit | 7a09aa52502e5c4598eda224db8dd8e132773449 (patch) | |
tree | 7a94d4b4e8a2db52f97ea7f9170c41a40ffacb17 | |
parent | 6126567f386c34c6cff5dc95e8e5072c34ba7b00 (diff) | |
download | openbsd-7a09aa52502e5c4598eda224db8dd8e132773449.tar.gz openbsd-7a09aa52502e5c4598eda224db8dd8e132773449.tar.bz2 openbsd-7a09aa52502e5c4598eda224db8dd8e132773449.zip |
Summarize the 4 same name functions and move it to apps.c
ok tb@ jsing@
-rw-r--r-- | src/usr.bin/openssl/apps.c | 14 | ||||
-rw-r--r-- | src/usr.bin/openssl/apps.h | 4 | ||||
-rw-r--r-- | src/usr.bin/openssl/dsa.c | 16 | ||||
-rw-r--r-- | src/usr.bin/openssl/ec.c | 16 | ||||
-rw-r--r-- | src/usr.bin/openssl/enc.c | 16 | ||||
-rw-r--r-- | src/usr.bin/openssl/pkey.c | 16 | ||||
-rw-r--r-- | src/usr.bin/openssl/rsa.c | 16 |
7 files changed, 26 insertions, 72 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index 3febc15d2b..d8d9256dc5 100644 --- a/src/usr.bin/openssl/apps.c +++ b/src/usr.bin/openssl/apps.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.c,v 1.49 2018/08/16 16:56:51 tb Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.50 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -2320,3 +2320,15 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed, | |||
2320 | fprintf(stderr, "unknown option '%s'\n", arg); | 2320 | fprintf(stderr, "unknown option '%s'\n", arg); |
2321 | return (1); | 2321 | return (1); |
2322 | } | 2322 | } |
2323 | |||
2324 | void | ||
2325 | show_cipher(const OBJ_NAME *name, void *arg) | ||
2326 | { | ||
2327 | static int n; | ||
2328 | |||
2329 | if (!islower((unsigned char)*name->name)) | ||
2330 | return; | ||
2331 | |||
2332 | fprintf(stderr, " -%-24s%s", name->name, (++n % 3 ? "" : "\n")); | ||
2333 | } | ||
2334 | |||
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index cfc6036ccf..bb2340a545 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.h,v 1.21 2018/07/13 18:36:56 cheloha Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.22 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -321,4 +321,6 @@ void options_usage(struct option *opts); | |||
321 | int options_parse(int argc, char **argv, struct option *opts, char **unnamed, | 321 | int options_parse(int argc, char **argv, struct option *opts, char **unnamed, |
322 | int *argsused); | 322 | int *argsused); |
323 | 323 | ||
324 | void show_cipher(const OBJ_NAME *name, void *arg); | ||
325 | |||
324 | #endif | 326 | #endif |
diff --git a/src/usr.bin/openssl/dsa.c b/src/usr.bin/openssl/dsa.c index 0b99dedca6..d2460a7aaa 100644 --- a/src/usr.bin/openssl/dsa.c +++ b/src/usr.bin/openssl/dsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa.c,v 1.11 2018/02/07 05:47:55 jsing Exp $ */ | 1 | /* $OpenBSD: dsa.c,v 1.12 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -58,7 +58,6 @@ | |||
58 | 58 | ||
59 | #include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */ | 59 | #include <openssl/opensslconf.h> /* for OPENSSL_NO_DSA */ |
60 | 60 | ||
61 | #include <ctype.h> | ||
62 | #include <stdio.h> | 61 | #include <stdio.h> |
63 | #include <stdlib.h> | 62 | #include <stdlib.h> |
64 | #include <time.h> | 63 | #include <time.h> |
@@ -205,17 +204,6 @@ static struct option dsa_options[] = { | |||
205 | }; | 204 | }; |
206 | 205 | ||
207 | static void | 206 | static void |
208 | show_ciphers(const OBJ_NAME *name, void *arg) | ||
209 | { | ||
210 | static int n; | ||
211 | |||
212 | if (!islower((unsigned char)*name->name)) | ||
213 | return; | ||
214 | |||
215 | fprintf(stderr, " -%-24s%s", name->name, (++n % 3 ? "" : "\n")); | ||
216 | } | ||
217 | |||
218 | static void | ||
219 | dsa_usage(void) | 207 | dsa_usage(void) |
220 | { | 208 | { |
221 | fprintf(stderr, | 209 | fprintf(stderr, |
@@ -227,7 +215,7 @@ dsa_usage(void) | |||
227 | fprintf(stderr, "\n"); | 215 | fprintf(stderr, "\n"); |
228 | 216 | ||
229 | fprintf(stderr, "Valid ciphername values:\n\n"); | 217 | fprintf(stderr, "Valid ciphername values:\n\n"); |
230 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_ciphers, NULL); | 218 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_cipher, NULL); |
231 | fprintf(stderr, "\n"); | 219 | fprintf(stderr, "\n"); |
232 | } | 220 | } |
233 | 221 | ||
diff --git a/src/usr.bin/openssl/ec.c b/src/usr.bin/openssl/ec.c index f2dad6dfef..917a7a15e5 100644 --- a/src/usr.bin/openssl/ec.c +++ b/src/usr.bin/openssl/ec.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec.c,v 1.11 2018/02/07 05:47:55 jsing Exp $ */ | 1 | /* $OpenBSD: ec.c,v 1.12 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -60,7 +60,6 @@ | |||
60 | 60 | ||
61 | #ifndef OPENSSL_NO_EC | 61 | #ifndef OPENSSL_NO_EC |
62 | 62 | ||
63 | #include <ctype.h> | ||
64 | #include <stdio.h> | 63 | #include <stdio.h> |
65 | #include <stdlib.h> | 64 | #include <stdlib.h> |
66 | #include <string.h> | 65 | #include <string.h> |
@@ -240,17 +239,6 @@ static struct option ec_options[] = { | |||
240 | }; | 239 | }; |
241 | 240 | ||
242 | static void | 241 | static void |
243 | show_ciphers(const OBJ_NAME *name, void *arg) | ||
244 | { | ||
245 | static int n; | ||
246 | |||
247 | if (!islower((unsigned char)*name->name)) | ||
248 | return; | ||
249 | |||
250 | fprintf(stderr, " -%-24s%s", name->name, (++n % 3 ? "" : "\n")); | ||
251 | } | ||
252 | |||
253 | static void | ||
254 | ec_usage(void) | 242 | ec_usage(void) |
255 | { | 243 | { |
256 | fprintf(stderr, | 244 | fprintf(stderr, |
@@ -263,7 +251,7 @@ ec_usage(void) | |||
263 | fprintf(stderr, "\n"); | 251 | fprintf(stderr, "\n"); |
264 | 252 | ||
265 | fprintf(stderr, "Valid ciphername values:\n\n"); | 253 | fprintf(stderr, "Valid ciphername values:\n\n"); |
266 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_ciphers, NULL); | 254 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_cipher, NULL); |
267 | fprintf(stderr, "\n"); | 255 | fprintf(stderr, "\n"); |
268 | } | 256 | } |
269 | 257 | ||
diff --git a/src/usr.bin/openssl/enc.c b/src/usr.bin/openssl/enc.c index 7daeafe9d7..863a048c12 100644 --- a/src/usr.bin/openssl/enc.c +++ b/src/usr.bin/openssl/enc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: enc.c,v 1.16 2019/01/18 22:47:34 naddy Exp $ */ | 1 | /* $OpenBSD: enc.c,v 1.17 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -56,7 +56,6 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <ctype.h> | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include <stdlib.h> | 60 | #include <stdlib.h> |
62 | #include <string.h> | 61 | #include <string.h> |
@@ -305,17 +304,6 @@ static struct option enc_options[] = { | |||
305 | }; | 304 | }; |
306 | 305 | ||
307 | static void | 306 | static void |
308 | show_ciphers(const OBJ_NAME *name, void *arg) | ||
309 | { | ||
310 | static int n; | ||
311 | |||
312 | if (!islower((unsigned char)*name->name)) | ||
313 | return; | ||
314 | |||
315 | fprintf(stderr, " -%-24s%s", name->name, (++n % 3 ? "" : "\n")); | ||
316 | } | ||
317 | |||
318 | static void | ||
319 | enc_usage(void) | 307 | enc_usage(void) |
320 | { | 308 | { |
321 | fprintf(stderr, "usage: enc -ciphername [-AadePp] [-base64] " | 309 | fprintf(stderr, "usage: enc -ciphername [-AadePp] [-base64] " |
@@ -328,7 +316,7 @@ enc_usage(void) | |||
328 | fprintf(stderr, "\n"); | 316 | fprintf(stderr, "\n"); |
329 | 317 | ||
330 | fprintf(stderr, "Valid ciphername values:\n\n"); | 318 | fprintf(stderr, "Valid ciphername values:\n\n"); |
331 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_ciphers, NULL); | 319 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_cipher, NULL); |
332 | fprintf(stderr, "\n"); | 320 | fprintf(stderr, "\n"); |
333 | } | 321 | } |
334 | 322 | ||
diff --git a/src/usr.bin/openssl/pkey.c b/src/usr.bin/openssl/pkey.c index a5ed21fc3b..f7e7e87e48 100644 --- a/src/usr.bin/openssl/pkey.c +++ b/src/usr.bin/openssl/pkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: pkey.c,v 1.12 2019/02/05 12:45:47 inoguchi Exp $ */ | 1 | /* $OpenBSD: pkey.c,v 1.13 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006 | 3 | * project 2006 |
4 | */ | 4 | */ |
@@ -56,7 +56,6 @@ | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include <ctype.h> | ||
60 | #include <stdio.h> | 59 | #include <stdio.h> |
61 | #include <string.h> | 60 | #include <string.h> |
62 | 61 | ||
@@ -182,17 +181,6 @@ static struct option pkey_options[] = { | |||
182 | }; | 181 | }; |
183 | 182 | ||
184 | static void | 183 | static void |
185 | show_ciphers(const OBJ_NAME *name, void *arg) | ||
186 | { | ||
187 | static int n; | ||
188 | |||
189 | if (!islower((unsigned char)*name->name)) | ||
190 | return; | ||
191 | |||
192 | fprintf(stderr, " -%-24s%s", name->name, (++n % 3 ? "" : "\n")); | ||
193 | } | ||
194 | |||
195 | static void | ||
196 | pkey_usage() | 184 | pkey_usage() |
197 | { | 185 | { |
198 | fprintf(stderr, | 186 | fprintf(stderr, |
@@ -205,7 +193,7 @@ pkey_usage() | |||
205 | fprintf(stderr, "\n"); | 193 | fprintf(stderr, "\n"); |
206 | 194 | ||
207 | fprintf(stderr, "Valid ciphername values:\n\n"); | 195 | fprintf(stderr, "Valid ciphername values:\n\n"); |
208 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_ciphers, NULL); | 196 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_cipher, NULL); |
209 | fprintf(stderr, "\n"); | 197 | fprintf(stderr, "\n"); |
210 | } | 198 | } |
211 | 199 | ||
diff --git a/src/usr.bin/openssl/rsa.c b/src/usr.bin/openssl/rsa.c index c6ab617ac8..49f67a3c17 100644 --- a/src/usr.bin/openssl/rsa.c +++ b/src/usr.bin/openssl/rsa.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa.c,v 1.11 2019/02/05 12:45:47 inoguchi Exp $ */ | 1 | /* $OpenBSD: rsa.c,v 1.12 2019/02/09 06:27:37 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -58,7 +58,6 @@ | |||
58 | 58 | ||
59 | #include <openssl/opensslconf.h> | 59 | #include <openssl/opensslconf.h> |
60 | 60 | ||
61 | #include <ctype.h> | ||
62 | #include <stdio.h> | 61 | #include <stdio.h> |
63 | #include <stdlib.h> | 62 | #include <stdlib.h> |
64 | #include <string.h> | 63 | #include <string.h> |
@@ -236,17 +235,6 @@ static struct option rsa_options[] = { | |||
236 | }; | 235 | }; |
237 | 236 | ||
238 | static void | 237 | static void |
239 | show_ciphers(const OBJ_NAME *name, void *arg) | ||
240 | { | ||
241 | static int n; | ||
242 | |||
243 | if (!islower((unsigned char)*name->name)) | ||
244 | return; | ||
245 | |||
246 | fprintf(stderr, " -%-24s%s", name->name, (++n % 3 ? "" : "\n")); | ||
247 | } | ||
248 | |||
249 | static void | ||
250 | rsa_usage() | 238 | rsa_usage() |
251 | { | 239 | { |
252 | fprintf(stderr, | 240 | fprintf(stderr, |
@@ -259,7 +247,7 @@ rsa_usage() | |||
259 | fprintf(stderr, "\n"); | 247 | fprintf(stderr, "\n"); |
260 | 248 | ||
261 | fprintf(stderr, "Valid ciphername values:\n\n"); | 249 | fprintf(stderr, "Valid ciphername values:\n\n"); |
262 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_ciphers, NULL); | 250 | OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, show_cipher, NULL); |
263 | fprintf(stderr, "\n"); | 251 | fprintf(stderr, "\n"); |
264 | } | 252 | } |
265 | 253 | ||