Go to the documentation of this file.
60 #include <sys/types.h>
68 #if !defined(OPENSSL_TRUSTY)
70 #include "../internal.h"
100 "Load certs from files in a directory",
167 if ((*a)->hash > (*b)->hash)
169 if ((*a)->hash < (*b)->hash)
190 if (
a->buffer != NULL)
198 const char *s, *ss, *
p;
200 if (dir == NULL || !*dir) {
208 if ((*
p ==
':') || (*
p ==
'\0')) {
215 for (j = 0; j < sk_BY_DIR_ENTRY_num(
ctx->dirs); j++) {
216 ent = sk_BY_DIR_ENTRY_value(
ctx->dirs, j);
217 if (strlen(ent->
dir) ==
len &&
218 strncmp(ent->
dir, ss,
len) == 0)
221 if (j < sk_BY_DIR_ENTRY_num(
ctx->dirs))
223 if (
ctx->dirs == NULL) {
224 ctx->dirs = sk_BY_DIR_ENTRY_new_null();
236 if (!ent->
dir || !ent->hashes) {
241 if (!sk_BY_DIR_ENTRY_push(
ctx->dirs, ent)) {
246 }
while (*
p++ !=
'\0');
275 unsigned long hash_array[2];
279 const char *postfix =
"";
286 data.x509.st_x509.cert_info = &
data.x509.st_x509_cinf;
287 data.x509.st_x509_cinf.subject =
name;
291 data.crl.st_crl.crl = &
data.crl.st_crl_info;
309 for (hash_index = 0; hash_index < 2; ++hash_index) {
310 h = hash_array[hash_index];
311 for (
i = 0;
i < sk_BY_DIR_ENTRY_num(
ctx->dirs);
i++) {
315 ent = sk_BY_DIR_ENTRY_value(
ctx->dirs,
i);
316 j = strlen(ent->
dir) + 1 + 8 + 6 + 1 + 1;
324 if (sk_BY_DIR_HASH_find(ent->hashes, &
idx, &htmp)) {
325 hent = sk_BY_DIR_HASH_value(ent->hashes,
idx);
338 #ifdef OPENSSL_SYS_VMS
339 c = ent->
dir[strlen(ent->
dir) - 1];
340 if (
c !=
':' &&
c !=
'>' &&
c !=
']') {
359 "%s%08lx.%s%d", ent->
dir, h, postfix,
k);
362 "%s%c%08lx.%s%d", ent->
dir,
c, h,
365 #ifndef OPENSSL_NO_POSIX_IO
366 # if defined(_WIN32) && !defined(stat)
371 if (
stat(
b->data, &st) < 0)
393 sk_X509_OBJECT_sort(xl->
store_ctx->objs);
394 if (sk_X509_OBJECT_find(xl->
store_ctx->objs, &
idx, &stmp)) {
411 sk_BY_DIR_HASH_sort(ent->hashes);
412 if (sk_BY_DIR_HASH_find(ent->hashes, &
idx, &htmp))
413 hent = sk_BY_DIR_HASH_value(ent->hashes,
idx);
424 if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) {
430 sk_BY_DIR_HASH_sort(ent->hashes);
459 #endif // OPENSSL_TRUSTY
struct lookup_dir_entry_st BY_DIR_ENTRY
#define CRYPTO_STATIC_MUTEX_INIT
#define X509_R_INVALID_DIRECTORY
static X509_LOOKUP_METHOD x509_dir_lookup
X509_LOOKUP_METHOD * X509_LOOKUP_hash_dir(void)
static int by_dir_hash_cmp(const BY_DIR_HASH **a, const BY_DIR_HASH **b)
#define X509_get_default_cert_dir
static void by_dir_hash_free(BY_DIR_HASH *hash)
static int finish(struct hexdump_ctx *ctx)
#define CRYPTO_STATIC_MUTEX_unlock_write
#define OPENSSL_PUT_ERROR(library, reason)
static void free_dir(X509_LOOKUP *lu)
#define X509_NAME_hash_old
static struct test_ctx ctx
#define X509_FILETYPE_PEM
#define X509_R_WRONG_LOOKUP_TYPE
static void by_dir_entry_free(BY_DIR_ENTRY *ent)
#define CRYPTO_STATIC_MUTEX_unlock_read
#define CRYPTO_STATIC_MUTEX_lock_write
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
#define DEFINE_STACK_OF(type)
static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl, char **ret)
#define X509_R_LOADING_CERT_DIR
struct lookup_dir_hashes_st BY_DIR_HASH
struct lookup_dir_st BY_DIR
union x509_object_st::@359 data
static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, X509_OBJECT *ret)
#define X509_FILETYPE_DEFAULT
UniquePtr< SSL_SESSION > ret
#define CRYPTO_MUTEX_lock_write
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
#define X509_get_default_cert_dir_env
#define CRYPTO_STATIC_MUTEX_lock_read
#define X509_load_cert_file
#define X509_load_crl_file
static struct CRYPTO_STATIC_MUTEX g_ent_hashes_lock
#define CRYPTO_MUTEX_unlock_write
if(p->owned &&p->wrapped !=NULL)
static int new_dir(X509_LOOKUP *lu)
#define ERR_R_MALLOC_FAILURE
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:41