diff options
author | schwarze <> | 2021-11-10 09:19:25 +0000 |
---|---|---|
committer | schwarze <> | 2021-11-10 09:19:25 +0000 |
commit | 9b0d17c7e0c52e06c77513dcea41c96ddc84e6c5 (patch) | |
tree | ce982080efaa3a66f8af45a1374ef44b839e94be | |
parent | fcfbf0e95983e6e0275cfd365721b5a00a529cfd (diff) | |
download | openbsd-9b0d17c7e0c52e06c77513dcea41c96ddc84e6c5.tar.gz openbsd-9b0d17c7e0c52e06c77513dcea41c96ddc84e6c5.tar.bz2 openbsd-9b0d17c7e0c52e06c77513dcea41c96ddc84e6c5.zip |
Sync some code style improvements from the OpenSSL 1.1.1 branch,
which is still under a free license. No functional change.
- No need to #include <openssl/lhash.h> here.
- return is not a function.
- Do not use the pointless macro BIO_s_file_internal().
- No need to check for NULL before X509_CRL_free(3).
This includes parts of the following OpenSSL commits from
the 2015 to 2017 timeframe: 222561fe, 9982cbbb, f32b0abe, 26a7d938
OK tb@
-rw-r--r-- | src/lib/libcrypto/x509/by_file.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c index db66617d2b..a5a4342e88 100644 --- a/src/lib/libcrypto/x509/by_file.c +++ b/src/lib/libcrypto/x509/by_file.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: by_file.c,v 1.23 2021/11/10 09:00:21 schwarze Exp $ */ | 1 | /* $OpenBSD: by_file.c,v 1.24 2021/11/10 09:19:25 schwarze 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 | * |
@@ -64,7 +64,6 @@ | |||
64 | #include <openssl/buffer.h> | 64 | #include <openssl/buffer.h> |
65 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
66 | #include <openssl/pem.h> | 66 | #include <openssl/pem.h> |
67 | #include <openssl/lhash.h> | ||
68 | #include <openssl/x509.h> | 67 | #include <openssl/x509.h> |
69 | 68 | ||
70 | #include "x509_lcl.h" | 69 | #include "x509_lcl.h" |
@@ -88,7 +87,7 @@ static X509_LOOKUP_METHOD x509_file_lookup = { | |||
88 | X509_LOOKUP_METHOD * | 87 | X509_LOOKUP_METHOD * |
89 | X509_LOOKUP_file(void) | 88 | X509_LOOKUP_file(void) |
90 | { | 89 | { |
91 | return (&x509_file_lookup); | 90 | return &x509_file_lookup; |
92 | } | 91 | } |
93 | 92 | ||
94 | static int | 93 | static int |
@@ -116,7 +115,7 @@ by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, | |||
116 | } | 115 | } |
117 | break; | 116 | break; |
118 | } | 117 | } |
119 | return (ok); | 118 | return ok; |
120 | } | 119 | } |
121 | 120 | ||
122 | int | 121 | int |
@@ -127,7 +126,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
127 | int i, count = 0; | 126 | int i, count = 0; |
128 | X509 *x = NULL; | 127 | X509 *x = NULL; |
129 | 128 | ||
130 | in = BIO_new(BIO_s_file_internal()); | 129 | in = BIO_new(BIO_s_file()); |
131 | 130 | ||
132 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { | 131 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { |
133 | X509error(ERR_R_SYS_LIB); | 132 | X509error(ERR_R_SYS_LIB); |
@@ -172,7 +171,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
172 | err: | 171 | err: |
173 | X509_free(x); | 172 | X509_free(x); |
174 | BIO_free(in); | 173 | BIO_free(in); |
175 | return (ret); | 174 | return ret; |
176 | } | 175 | } |
177 | 176 | ||
178 | int | 177 | int |
@@ -183,7 +182,7 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
183 | int i, count = 0; | 182 | int i, count = 0; |
184 | X509_CRL *x = NULL; | 183 | X509_CRL *x = NULL; |
185 | 184 | ||
186 | in = BIO_new(BIO_s_file_internal()); | 185 | in = BIO_new(BIO_s_file()); |
187 | 186 | ||
188 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { | 187 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { |
189 | X509error(ERR_R_SYS_LIB); | 188 | X509error(ERR_R_SYS_LIB); |
@@ -226,10 +225,9 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
226 | goto err; | 225 | goto err; |
227 | } | 226 | } |
228 | err: | 227 | err: |
229 | if (x != NULL) | 228 | X509_CRL_free(x); |
230 | X509_CRL_free(x); | ||
231 | BIO_free(in); | 229 | BIO_free(in); |
232 | return (ret); | 230 | return ret; |
233 | } | 231 | } |
234 | 232 | ||
235 | int | 233 | int |
@@ -239,6 +237,7 @@ X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
239 | X509_INFO *itmp; | 237 | X509_INFO *itmp; |
240 | BIO *in; | 238 | BIO *in; |
241 | int i, count = 0; | 239 | int i, count = 0; |
240 | |||
242 | if (type != X509_FILETYPE_PEM) | 241 | if (type != X509_FILETYPE_PEM) |
243 | return X509_load_cert_file(ctx, file, type); | 242 | return X509_load_cert_file(ctx, file, type); |
244 | in = BIO_new_file(file, "r"); | 243 | in = BIO_new_file(file, "r"); |