diff options
author | beck <> | 2017-01-29 17:49:23 +0000 |
---|---|---|
committer | beck <> | 2017-01-29 17:49:23 +0000 |
commit | 957b11334a7afb14537322f0e4795b2e368b3f59 (patch) | |
tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/x509/by_dir.c | |
parent | df96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff) | |
download | openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2 openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/x509/by_dir.c')
-rw-r--r-- | src/lib/libcrypto/x509/by_dir.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index 7b7d14a950..01a302b538 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: by_dir.c,v 1.37 2015/04/11 16:03:21 deraadt Exp $ */ | 1 | /* $OpenBSD: by_dir.c,v 1.38 2017/01/29 17:49:23 beck 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 | * |
@@ -133,7 +133,7 @@ dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, | |||
133 | ret = add_cert_dir(ld, X509_get_default_cert_dir(), | 133 | ret = add_cert_dir(ld, X509_get_default_cert_dir(), |
134 | X509_FILETYPE_PEM); | 134 | X509_FILETYPE_PEM); |
135 | if (!ret) { | 135 | if (!ret) { |
136 | X509err(X509_F_DIR_CTRL, X509_R_LOADING_CERT_DIR); | 136 | X509error(X509_R_LOADING_CERT_DIR); |
137 | } | 137 | } |
138 | } else | 138 | } else |
139 | ret = add_cert_dir(ld, argp, (int)argl); | 139 | ret = add_cert_dir(ld, argp, (int)argl); |
@@ -205,7 +205,7 @@ add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
205 | ptrdiff_t len; | 205 | ptrdiff_t len; |
206 | 206 | ||
207 | if (dir == NULL || !*dir) { | 207 | if (dir == NULL || !*dir) { |
208 | X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); | 208 | X509error(X509_R_INVALID_DIRECTORY); |
209 | return 0; | 209 | return 0; |
210 | } | 210 | } |
211 | 211 | ||
@@ -230,25 +230,25 @@ add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
230 | if (ctx->dirs == NULL) { | 230 | if (ctx->dirs == NULL) { |
231 | ctx->dirs = sk_BY_DIR_ENTRY_new_null(); | 231 | ctx->dirs = sk_BY_DIR_ENTRY_new_null(); |
232 | if (!ctx->dirs) { | 232 | if (!ctx->dirs) { |
233 | X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); | 233 | X509error(ERR_R_MALLOC_FAILURE); |
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | ent = malloc(sizeof(BY_DIR_ENTRY)); | 237 | ent = malloc(sizeof(BY_DIR_ENTRY)); |
238 | if (!ent) { | 238 | if (!ent) { |
239 | X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); | 239 | X509error(ERR_R_MALLOC_FAILURE); |
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | ent->dir_type = type; | 242 | ent->dir_type = type; |
243 | ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); | 243 | ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); |
244 | ent->dir = strndup(ss, (size_t)len); | 244 | ent->dir = strndup(ss, (size_t)len); |
245 | if (!ent->dir || !ent->hashes) { | 245 | if (!ent->dir || !ent->hashes) { |
246 | X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); | 246 | X509error(ERR_R_MALLOC_FAILURE); |
247 | by_dir_entry_free(ent); | 247 | by_dir_entry_free(ent); |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { | 250 | if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { |
251 | X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); | 251 | X509error(ERR_R_MALLOC_FAILURE); |
252 | by_dir_entry_free(ent); | 252 | by_dir_entry_free(ent); |
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
@@ -294,12 +294,12 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
294 | stmp.data.crl = &data.crl.st_crl; | 294 | stmp.data.crl = &data.crl.st_crl; |
295 | postfix="r"; | 295 | postfix="r"; |
296 | } else { | 296 | } else { |
297 | X509err(X509_F_GET_CERT_BY_SUBJECT, X509_R_WRONG_LOOKUP_TYPE); | 297 | X509error(X509_R_WRONG_LOOKUP_TYPE); |
298 | goto finish; | 298 | goto finish; |
299 | } | 299 | } |
300 | 300 | ||
301 | if ((b = BUF_MEM_new()) == NULL) { | 301 | if ((b = BUF_MEM_new()) == NULL) { |
302 | X509err(X509_F_GET_CERT_BY_SUBJECT, ERR_R_BUF_LIB); | 302 | X509error(ERR_R_BUF_LIB); |
303 | goto finish; | 303 | goto finish; |
304 | } | 304 | } |
305 | 305 | ||
@@ -313,7 +313,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
313 | ent = sk_BY_DIR_ENTRY_value(ctx->dirs, i); | 313 | ent = sk_BY_DIR_ENTRY_value(ctx->dirs, i); |
314 | j = strlen(ent->dir) + 1 + 8 + 6 + 1 + 1; | 314 | j = strlen(ent->dir) + 1 + 8 + 6 + 1 + 1; |
315 | if (!BUF_MEM_grow(b, j)) { | 315 | if (!BUF_MEM_grow(b, j)) { |
316 | X509err(X509_F_GET_CERT_BY_SUBJECT, ERR_R_MALLOC_FAILURE); | 316 | X509error(ERR_R_MALLOC_FAILURE); |
317 | goto finish; | 317 | goto finish; |
318 | } | 318 | } |
319 | if (type == X509_LU_CRL && ent->hashes) { | 319 | if (type == X509_LU_CRL && ent->hashes) { |
@@ -381,7 +381,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
381 | if (!hent) { | 381 | if (!hent) { |
382 | hent = malloc(sizeof(BY_DIR_HASH)); | 382 | hent = malloc(sizeof(BY_DIR_HASH)); |
383 | if (!hent) { | 383 | if (!hent) { |
384 | X509err(X509_F_GET_CERT_BY_SUBJECT, ERR_R_MALLOC_FAILURE); | 384 | X509error(ERR_R_MALLOC_FAILURE); |
385 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | 385 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); |
386 | ok = 0; | 386 | ok = 0; |
387 | goto finish; | 387 | goto finish; |
@@ -389,7 +389,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
389 | hent->hash = h; | 389 | hent->hash = h; |
390 | hent->suffix = k; | 390 | hent->suffix = k; |
391 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) { | 391 | if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) { |
392 | X509err(X509_F_GET_CERT_BY_SUBJECT, ERR_R_MALLOC_FAILURE); | 392 | X509error(ERR_R_MALLOC_FAILURE); |
393 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); | 393 | CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); |
394 | free(hent); | 394 | free(hent); |
395 | ok = 0; | 395 | ok = 0; |