summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsthen <>2014-04-17 22:08:45 +0000
committersthen <>2014-04-17 22:08:45 +0000
commit3fbba362e154ace094eb41ea34b5924c17dc46ed (patch)
tree4d2db38f958eaa8813fe52825669016e84eb600d /src
parent8fc27bf172fd1c8101bec2ec91eb1c82b66064fd (diff)
downloadopenbsd-3fbba362e154ace094eb41ea34b5924c17dc46ed.tar.gz
openbsd-3fbba362e154ace094eb41ea34b5924c17dc46ed.tar.bz2
openbsd-3fbba362e154ace094eb41ea34b5924c17dc46ed.zip
no need for a variable which is hardcoded and only used in an snprintf,
ok giovanni@. tidy comments nearby while there.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/x509/by_dir.c22
-rw-r--r--src/lib/libssl/src/crypto/x509/by_dir.c22
2 files changed, 18 insertions, 26 deletions
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c
index 9795b63620..749323be1e 100644
--- a/src/lib/libcrypto/x509/by_dir.c
+++ b/src/lib/libcrypto/x509/by_dir.c
@@ -336,11 +336,8 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
336 hent = NULL; 336 hent = NULL;
337 } 337 }
338 for (;;) { 338 for (;;) {
339 char c = '/'; 339 (void) snprintf(b->data, b->max, "%s/%08lx.%s%d",
340 340 ent->dir, h, postfix, k);
341 (void) snprintf(b->data, b->max,
342 "%s%c%08lx.%s%d", ent->dir, c, h,
343 postfix, k);
344 341
345#ifndef OPENSSL_NO_POSIX_IO 342#ifndef OPENSSL_NO_POSIX_IO
346 { 343 {
@@ -363,8 +360,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
363 k++; 360 k++;
364 } 361 }
365 362
366 /* we have added it to the cache so now pull 363 /* we have added it to the cache so now pull it out again */
367 * it out again */
368 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 364 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
369 j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp); 365 j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp);
370 if (j != -1) 366 if (j != -1)
@@ -372,12 +368,11 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
372 else tmp = NULL; 368 else tmp = NULL;
373 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); 369 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
374 370
375
376 /* If a CRL, update the last file suffix added for this */ 371 /* If a CRL, update the last file suffix added for this */
377
378 if (type == X509_LU_CRL) { 372 if (type == X509_LU_CRL) {
379 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 373 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
380 /* Look for entry again in case another thread added 374 /*
375 * Look for entry again in case another thread added
381 * an entry first. 376 * an entry first.
382 */ 377 */
383 if (!hent) { 378 if (!hent) {
@@ -408,9 +403,10 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
408 ok = 1; 403 ok = 1;
409 ret->type = tmp->type; 404 ret->type = tmp->type;
410 memcpy(&ret->data, &tmp->data, sizeof(ret->data)); 405 memcpy(&ret->data, &tmp->data, sizeof(ret->data));
411 /* If we were going to up the reference count, 406 /*
412 * we would need to do it on a perl 'type' 407 * If we were going to up the reference count,
413 * basis */ 408 * we would need to do it on a perl 'type' basis
409 */
414 /* CRYPTO_add(&tmp->data.x509->references,1, 410 /* CRYPTO_add(&tmp->data.x509->references,1,
415 CRYPTO_LOCK_X509);*/ 411 CRYPTO_LOCK_X509);*/
416 goto finish; 412 goto finish;
diff --git a/src/lib/libssl/src/crypto/x509/by_dir.c b/src/lib/libssl/src/crypto/x509/by_dir.c
index 9795b63620..749323be1e 100644
--- a/src/lib/libssl/src/crypto/x509/by_dir.c
+++ b/src/lib/libssl/src/crypto/x509/by_dir.c
@@ -336,11 +336,8 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
336 hent = NULL; 336 hent = NULL;
337 } 337 }
338 for (;;) { 338 for (;;) {
339 char c = '/'; 339 (void) snprintf(b->data, b->max, "%s/%08lx.%s%d",
340 340 ent->dir, h, postfix, k);
341 (void) snprintf(b->data, b->max,
342 "%s%c%08lx.%s%d", ent->dir, c, h,
343 postfix, k);
344 341
345#ifndef OPENSSL_NO_POSIX_IO 342#ifndef OPENSSL_NO_POSIX_IO
346 { 343 {
@@ -363,8 +360,7 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
363 k++; 360 k++;
364 } 361 }
365 362
366 /* we have added it to the cache so now pull 363 /* we have added it to the cache so now pull it out again */
367 * it out again */
368 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 364 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
369 j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp); 365 j = sk_X509_OBJECT_find(xl->store_ctx->objs, &stmp);
370 if (j != -1) 366 if (j != -1)
@@ -372,12 +368,11 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
372 else tmp = NULL; 368 else tmp = NULL;
373 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE); 369 CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
374 370
375
376 /* If a CRL, update the last file suffix added for this */ 371 /* If a CRL, update the last file suffix added for this */
377
378 if (type == X509_LU_CRL) { 372 if (type == X509_LU_CRL) {
379 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE); 373 CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
380 /* Look for entry again in case another thread added 374 /*
375 * Look for entry again in case another thread added
381 * an entry first. 376 * an entry first.
382 */ 377 */
383 if (!hent) { 378 if (!hent) {
@@ -408,9 +403,10 @@ get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
408 ok = 1; 403 ok = 1;
409 ret->type = tmp->type; 404 ret->type = tmp->type;
410 memcpy(&ret->data, &tmp->data, sizeof(ret->data)); 405 memcpy(&ret->data, &tmp->data, sizeof(ret->data));
411 /* If we were going to up the reference count, 406 /*
412 * we would need to do it on a perl 'type' 407 * If we were going to up the reference count,
413 * basis */ 408 * we would need to do it on a perl 'type' basis
409 */
414 /* CRYPTO_add(&tmp->data.x509->references,1, 410 /* CRYPTO_add(&tmp->data.x509->references,1,
415 CRYPTO_LOCK_X509);*/ 411 CRYPTO_LOCK_X509);*/
416 goto finish; 412 goto finish;