Lines Matching refs:ctx

88 void X509_LOOKUP_free(X509_LOOKUP *ctx)
90 if (ctx == NULL)
92 if ((ctx->method != NULL) && (ctx->method->free != NULL))
93 (*ctx->method->free) (ctx);
94 OPENSSL_free(ctx);
97 int X509_LOOKUP_init(X509_LOOKUP *ctx)
99 if (ctx->method == NULL)
101 if (ctx->method->init != NULL)
102 return ctx->method->init(ctx);
107 int X509_LOOKUP_shutdown(X509_LOOKUP *ctx)
109 if (ctx->method == NULL)
111 if (ctx->method->shutdown != NULL)
112 return ctx->method->shutdown(ctx);
117 int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
120 if (ctx->method == NULL)
122 if (ctx->method->ctrl != NULL)
123 return ctx->method->ctrl(ctx, cmd, argc, argl, ret);
128 int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
131 if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
133 if (ctx->skip)
135 return ctx->method->get_by_subject(ctx, type, name, ret) > 0;
138 int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
141 if ((ctx->method == NULL) || (ctx->method->get_by_issuer_serial == NULL))
143 return ctx->method->get_by_issuer_serial(ctx, type, name, serial, ret) > 0;
146 int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
150 if ((ctx->method == NULL) || (ctx->method->get_by_fingerprint == NULL))
152 return ctx->method->get_by_fingerprint(ctx, type, bytes, len, ret) > 0;
155 int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
158 if ((ctx->method == NULL) || (ctx->method->get_by_alias == NULL))
160 return ctx->method->get_by_alias(ctx, type, str, len, ret) > 0;
301 X509_STORE *ctx = vs->ctx;
306 CRYPTO_MUTEX_lock_write(&ctx->objs_lock);
307 tmp = X509_OBJECT_retrieve_by_subject(ctx->objs, type, name);
308 CRYPTO_MUTEX_unlock_write(&ctx->objs_lock);
311 for (i = 0; i < (int)sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
312 lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);
334 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
349 CRYPTO_MUTEX_lock_write(&ctx->objs_lock);
353 if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
358 } else if (!sk_X509_OBJECT_push(ctx->objs, obj)) {
365 CRYPTO_MUTEX_unlock_write(&ctx->objs_lock);
370 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
385 CRYPTO_MUTEX_lock_write(&ctx->objs_lock);
389 if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
394 } else if (!sk_X509_OBJECT_push(ctx->objs, obj)) {
401 CRYPTO_MUTEX_unlock_write(&ctx->objs_lock);
406 void X509_STORE_set0_additional_untrusted(X509_STORE *ctx,
408 ctx->additional_untrusted = untrusted;
516 STACK_OF (X509) * X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
525 CRYPTO_MUTEX_lock_write(&ctx->ctx->objs_lock);
526 idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
533 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
534 if (!X509_STORE_get_by_subject(ctx, X509_LU_X509, nm, &xobj)) {
539 CRYPTO_MUTEX_lock_write(&ctx->ctx->objs_lock);
540 idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
542 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
548 obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
551 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
557 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
562 STACK_OF (X509_CRL) * X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)
573 if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj)) {
578 CRYPTO_MUTEX_lock_write(&ctx->ctx->objs_lock);
579 idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);
581 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
587 obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
591 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
597 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
636 int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)
643 if (!X509_STORE_get_by_subject(ctx, X509_LU_X509, xn, &obj))
646 if (ctx->check_issued(ctx, x, obj.data.x509)) {
654 CRYPTO_MUTEX_lock_write(&ctx->ctx->objs_lock);
655 idx = X509_OBJECT_idx_by_subject(ctx->ctx->objs, X509_LU_X509, xn);
659 for (i = idx; i < sk_X509_OBJECT_num(ctx->ctx->objs); i++) {
660 pobj = sk_X509_OBJECT_value(ctx->ctx->objs, i);
666 if (ctx->check_issued(ctx, x, pobj->data.x509)) {
674 CRYPTO_MUTEX_unlock_write(&ctx->ctx->objs_lock);
678 int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags)
680 return X509_VERIFY_PARAM_set_flags(ctx->param, flags);
683 int X509_STORE_set_depth(X509_STORE *ctx, int depth)
685 X509_VERIFY_PARAM_set_depth(ctx->param, depth);
689 int X509_STORE_set_purpose(X509_STORE *ctx, int purpose)
691 return X509_VERIFY_PARAM_set_purpose(ctx->param, purpose);
694 int X509_STORE_set_trust(X509_STORE *ctx, int trust)
696 return X509_VERIFY_PARAM_set_trust(ctx->param, trust);
699 int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *param)
701 return X509_VERIFY_PARAM_set1(ctx->param, param);
704 X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx)
706 return ctx->param;
709 void X509_STORE_set_verify_cb(X509_STORE *ctx,
712 ctx->verify_cb = verify_cb;
715 void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx,
717 (*cb) (X509_STORE_CTX *ctx, X509_NAME *nm))
719 ctx->lookup_crls = cb;
722 X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx)
724 return ctx->ctx;