Lines Matching refs:ctx

74 static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
75 static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x);
76 static int check_chain_extensions(X509_STORE_CTX *ctx);
77 static int check_trust(X509_STORE_CTX *ctx);
78 static int check_revocation(X509_STORE_CTX *ctx);
79 static int check_cert(X509_STORE_CTX *ctx);
80 static int check_policy(X509_STORE_CTX *ctx);
81 static int internal_verify(X509_STORE_CTX *ctx);
97 int X509_verify_cert(X509_STORE_CTX *ctx) in X509_verify_cert() argument
102 X509_VERIFY_PARAM *param = ctx->param; in X509_verify_cert()
107 if (ctx->cert == NULL) in X509_verify_cert()
113 cb=ctx->verify_cb; in X509_verify_cert()
117 if (ctx->chain == NULL) in X509_verify_cert()
119 if ( ((ctx->chain=sk_X509_new_null()) == NULL) || in X509_verify_cert()
120 (!sk_X509_push(ctx->chain,ctx->cert))) in X509_verify_cert()
125 CRYPTO_add(&ctx->cert->references,1,CRYPTO_LOCK_X509); in X509_verify_cert()
126 ctx->last_untrusted=1; in X509_verify_cert()
130 if (ctx->untrusted != NULL in X509_verify_cert()
131 && (sktmp=sk_X509_dup(ctx->untrusted)) == NULL) in X509_verify_cert()
137 num=sk_X509_num(ctx->chain); in X509_verify_cert()
138 x=sk_X509_value(ctx->chain,num-1); in X509_verify_cert()
153 if (ctx->check_issued(ctx, x,x)) break; in X509_verify_cert()
156 if (ctx->untrusted != NULL) in X509_verify_cert()
158 xtmp=find_issuer(ctx, sktmp,x); in X509_verify_cert()
161 if (!sk_X509_push(ctx->chain,xtmp)) in X509_verify_cert()
168 ctx->last_untrusted++; in X509_verify_cert()
187 i=sk_X509_num(ctx->chain); in X509_verify_cert()
188 x=sk_X509_value(ctx->chain,i-1); in X509_verify_cert()
190 if (ctx->check_issued(ctx, x, x)) in X509_verify_cert()
193 if (sk_X509_num(ctx->chain) == 1) in X509_verify_cert()
199 ok = ctx->get_issuer(&xtmp, ctx, x); in X509_verify_cert()
202 ctx->error=X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT; in X509_verify_cert()
203 ctx->current_cert=x; in X509_verify_cert()
204 ctx->error_depth=i-1; in X509_verify_cert()
207 ok=cb(0,ctx); in X509_verify_cert()
217 sk_X509_set(ctx->chain, i - 1, x); in X509_verify_cert()
218 ctx->last_untrusted=0; in X509_verify_cert()
224 chain_ss=sk_X509_pop(ctx->chain); in X509_verify_cert()
225 ctx->last_untrusted--; in X509_verify_cert()
227 x=sk_X509_value(ctx->chain,num-1); in X509_verify_cert()
239 if (ctx->check_issued(ctx,x,x)) break; in X509_verify_cert()
241 ok = ctx->get_issuer(&xtmp, ctx, x); in X509_verify_cert()
247 if (!sk_X509_push(ctx->chain,x)) in X509_verify_cert()
260 if (!ctx->check_issued(ctx,x,x)) in X509_verify_cert()
262 if ((chain_ss == NULL) || !ctx->check_issued(ctx, x, chain_ss)) in X509_verify_cert()
264 if (ctx->last_untrusted >= num) in X509_verify_cert()
265 ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; in X509_verify_cert()
267 ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT; in X509_verify_cert()
268 ctx->current_cert=x; in X509_verify_cert()
273 sk_X509_push(ctx->chain,chain_ss); in X509_verify_cert()
275 ctx->last_untrusted=num; in X509_verify_cert()
276 ctx->current_cert=chain_ss; in X509_verify_cert()
277 ctx->error=X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN; in X509_verify_cert()
281 ctx->error_depth=num-1; in X509_verify_cert()
283 ok=cb(0,ctx); in X509_verify_cert()
288 ok = check_chain_extensions(ctx); in X509_verify_cert()
294 if (param->trust > 0) ok = check_trust(ctx); in X509_verify_cert()
299 X509_get_pubkey_parameters(NULL,ctx->chain); in X509_verify_cert()
305 ok = ctx->check_revocation(ctx); in X509_verify_cert()
309 if (ctx->verify != NULL) in X509_verify_cert()
310 ok=ctx->verify(ctx); in X509_verify_cert()
312 ok=internal_verify(ctx); in X509_verify_cert()
316 if (!bad_chain && (ctx->param->flags & X509_V_FLAG_POLICY_CHECK)) in X509_verify_cert()
317 ok = ctx->check_policy(ctx); in X509_verify_cert()
322 X509_get_pubkey_parameters(NULL,ctx->chain); in X509_verify_cert()
333 static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x) in find_issuer() argument
340 if (ctx->check_issued(ctx, x, issuer)) in find_issuer()
348 static int check_issued(X509_STORE_CTX *ctx, X509 *x, X509 *issuer) in check_issued() argument
355 if (!(ctx->param->flags & X509_V_FLAG_CB_ISSUER_CHECK)) in check_issued()
358 ctx->error = ret; in check_issued()
359 ctx->current_cert = x; in check_issued()
360 ctx->current_issuer = issuer; in check_issued()
361 return ctx->verify_cb(0, ctx); in check_issued()
367 static int get_issuer_sk(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) in get_issuer_sk() argument
369 *issuer = find_issuer(ctx, ctx->other_ctx, x); in get_issuer_sk()
384 static int check_chain_extensions(X509_STORE_CTX *ctx) in check_chain_extensions() argument
394 !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); in check_chain_extensions()
395 cb=ctx->verify_cb; in check_chain_extensions()
413 for (i = 0; i < ctx->last_untrusted; i++) in check_chain_extensions()
416 x = sk_X509_value(ctx->chain, i); in check_chain_extensions()
417 if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) in check_chain_extensions()
420 ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; in check_chain_extensions()
421 ctx->error_depth = i; in check_chain_extensions()
422 ctx->current_cert = x; in check_chain_extensions()
423 ok=cb(0,ctx); in check_chain_extensions()
428 ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; in check_chain_extensions()
429 ctx->error_depth = i; in check_chain_extensions()
430 ctx->current_cert = x; in check_chain_extensions()
431 ok=cb(0,ctx); in check_chain_extensions()
438 if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) in check_chain_extensions()
442 ctx->error = X509_V_ERR_INVALID_CA; in check_chain_extensions()
451 ctx->error = X509_V_ERR_INVALID_NON_CA; in check_chain_extensions()
458 || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) in check_chain_extensions()
462 ctx->error = X509_V_ERR_INVALID_CA; in check_chain_extensions()
470 ctx->error_depth = i; in check_chain_extensions()
471 ctx->current_cert = x; in check_chain_extensions()
472 ok=cb(0,ctx); in check_chain_extensions()
475 if (ctx->param->purpose > 0) in check_chain_extensions()
477 ret = X509_check_purpose(x, ctx->param->purpose, in check_chain_extensions()
480 || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) in check_chain_extensions()
483 ctx->error = X509_V_ERR_INVALID_PURPOSE; in check_chain_extensions()
484 ctx->error_depth = i; in check_chain_extensions()
485 ctx->current_cert = x; in check_chain_extensions()
486 ok=cb(0,ctx); in check_chain_extensions()
494 ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; in check_chain_extensions()
495 ctx->error_depth = i; in check_chain_extensions()
496 ctx->current_cert = x; in check_chain_extensions()
497 ok=cb(0,ctx); in check_chain_extensions()
508 ctx->error = in check_chain_extensions()
510 ctx->error_depth = i; in check_chain_extensions()
511 ctx->current_cert = x; in check_chain_extensions()
512 ok=cb(0,ctx); in check_chain_extensions()
527 static int check_trust(X509_STORE_CTX *ctx) in check_trust() argument
535 cb=ctx->verify_cb; in check_trust()
537 i = sk_X509_num(ctx->chain) - 1; in check_trust()
538 x = sk_X509_value(ctx->chain, i); in check_trust()
539 ok = X509_check_trust(x, ctx->param->trust, 0); in check_trust()
542 ctx->error_depth = i; in check_trust()
543 ctx->current_cert = x; in check_trust()
545 ctx->error = X509_V_ERR_CERT_REJECTED; in check_trust()
547 ctx->error = X509_V_ERR_CERT_UNTRUSTED; in check_trust()
548 ok = cb(0, ctx); in check_trust()
553 static int check_revocation(X509_STORE_CTX *ctx) in check_revocation() argument
556 if (!(ctx->param->flags & X509_V_FLAG_CRL_CHECK)) in check_revocation()
558 if (ctx->param->flags & X509_V_FLAG_CRL_CHECK_ALL) in check_revocation()
559 last = sk_X509_num(ctx->chain) - 1; in check_revocation()
564 ctx->error_depth = i; in check_revocation()
565 ok = check_cert(ctx); in check_revocation()
571 static int check_cert(X509_STORE_CTX *ctx) in check_cert() argument
576 cnum = ctx->error_depth; in check_cert()
577 x = sk_X509_value(ctx->chain, cnum); in check_cert()
578 ctx->current_cert = x; in check_cert()
580 ok = ctx->get_crl(ctx, &crl, x); in check_cert()
586 ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; in check_cert()
587 ok = ctx->verify_cb(0, ctx); in check_cert()
590 ctx->current_crl = crl; in check_cert()
591 ok = ctx->check_crl(ctx, crl); in check_cert()
593 ok = ctx->cert_crl(ctx, crl, x); in check_cert()
595 ctx->current_crl = NULL; in check_cert()
603 static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) in check_crl_time() argument
607 ctx->current_crl = crl; in check_crl_time()
608 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) in check_crl_time()
609 ptime = &ctx->param->check_time; in check_crl_time()
616 ctx->error=X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD; in check_crl_time()
617 if (!notify || !ctx->verify_cb(0, ctx)) in check_crl_time()
623 ctx->error=X509_V_ERR_CRL_NOT_YET_VALID; in check_crl_time()
624 if (!notify || !ctx->verify_cb(0, ctx)) in check_crl_time()
634 ctx->error=X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD; in check_crl_time()
635 if (!notify || !ctx->verify_cb(0, ctx)) in check_crl_time()
641 ctx->error=X509_V_ERR_CRL_HAS_EXPIRED; in check_crl_time()
642 if (!notify || !ctx->verify_cb(0, ctx)) in check_crl_time()
647 ctx->current_crl = NULL; in check_crl_time()
659 static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, in get_crl_sk() argument
669 if (check_crl_time(ctx, crl, 0)) in get_crl_sk()
689 static int get_crl(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509 *x) in get_crl() argument
696 ok = get_crl_sk(ctx, &crl, nm, ctx->crls); in get_crl()
703 ok = X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj); in get_crl()
723 static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) in check_crl() argument
728 cnum = ctx->error_depth; in check_crl()
729 chnum = sk_X509_num(ctx->chain) - 1; in check_crl()
734 issuer = sk_X509_value(ctx->chain, cnum + 1); in check_crl()
737 issuer = sk_X509_value(ctx->chain, chnum); in check_crl()
739 if(!ctx->check_issued(ctx, issuer, issuer)) in check_crl()
741 ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER; in check_crl()
742 ok = ctx->verify_cb(0, ctx); in check_crl()
753 ctx->error = X509_V_ERR_KEYUSAGE_NO_CRL_SIGN; in check_crl()
754 ok = ctx->verify_cb(0, ctx); in check_crl()
763 ctx->error=X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY; in check_crl()
764 ok = ctx->verify_cb(0, ctx); in check_crl()
772 ctx->error=X509_V_ERR_CRL_SIGNATURE_FAILURE; in check_crl()
773 ok = ctx->verify_cb(0, ctx); in check_crl()
779 ok = check_crl_time(ctx, crl, 1); in check_crl()
791 static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) in cert_crl() argument
814 ctx->error = X509_V_ERR_CERT_REVOKED; in cert_crl()
815 ok = ctx->verify_cb(0, ctx); in cert_crl()
819 if (ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) in cert_crl()
836 ctx->error = in cert_crl()
838 ok = ctx->verify_cb(0, ctx); in cert_crl()
846 static int check_policy(X509_STORE_CTX *ctx) in check_policy() argument
849 ret = X509_policy_check(&ctx->tree, &ctx->explicit_policy, ctx->chain, in check_policy()
850 ctx->param->policies, ctx->param->flags); in check_policy()
864 for (i = 1; i < sk_X509_num(ctx->chain); i++) in check_policy()
866 x = sk_X509_value(ctx->chain, i); in check_policy()
869 ctx->current_cert = x; in check_policy()
870 ctx->error = X509_V_ERR_INVALID_POLICY_EXTENSION; in check_policy()
871 ret = ctx->verify_cb(0, ctx); in check_policy()
877 ctx->current_cert = NULL; in check_policy()
878 ctx->error = X509_V_ERR_NO_EXPLICIT_POLICY; in check_policy()
879 return ctx->verify_cb(0, ctx); in check_policy()
882 if (ctx->param->flags & X509_V_FLAG_NOTIFY_POLICY) in check_policy()
884 ctx->current_cert = NULL; in check_policy()
885 ctx->error = X509_V_OK; in check_policy()
886 if (!ctx->verify_cb(2, ctx)) in check_policy()
893 static int check_cert_time(X509_STORE_CTX *ctx, X509 *x) in check_cert_time() argument
898 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) in check_cert_time()
899 ptime = &ctx->param->check_time; in check_cert_time()
906 ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD; in check_cert_time()
907 ctx->current_cert=x; in check_cert_time()
908 if (!ctx->verify_cb(0, ctx)) in check_cert_time()
914 ctx->error=X509_V_ERR_CERT_NOT_YET_VALID; in check_cert_time()
915 ctx->current_cert=x; in check_cert_time()
916 if (!ctx->verify_cb(0, ctx)) in check_cert_time()
923 ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD; in check_cert_time()
924 ctx->current_cert=x; in check_cert_time()
925 if (!ctx->verify_cb(0, ctx)) in check_cert_time()
931 ctx->error=X509_V_ERR_CERT_HAS_EXPIRED; in check_cert_time()
932 ctx->current_cert=x; in check_cert_time()
933 if (!ctx->verify_cb(0, ctx)) in check_cert_time()
940 static int internal_verify(X509_STORE_CTX *ctx) in internal_verify() argument
947 cb=ctx->verify_cb; in internal_verify()
949 n=sk_X509_num(ctx->chain); in internal_verify()
950 ctx->error_depth=n-1; in internal_verify()
952 xi=sk_X509_value(ctx->chain,n); in internal_verify()
954 if (ctx->check_issued(ctx, xi, xi)) in internal_verify()
960 ctx->error=X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE; in internal_verify()
961 ctx->current_cert=xi; in internal_verify()
962 ok=cb(0,ctx); in internal_verify()
968 ctx->error_depth=n; in internal_verify()
969 xs=sk_X509_value(ctx->chain,n); in internal_verify()
976 ctx->error_depth=n; in internal_verify()
981 ctx->error=X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY; in internal_verify()
982 ctx->current_cert=xi; in internal_verify()
983 ok=(*cb)(0,ctx); in internal_verify()
995 ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE; in internal_verify()
996 ctx->current_cert=xs; in internal_verify()
997 ok=(*cb)(0,ctx); in internal_verify()
1010 ok = check_cert_time(ctx, xs); in internal_verify()
1015 ctx->current_issuer=xi; in internal_verify()
1016 ctx->current_cert=xs; in internal_verify()
1017 ok=(*cb)(1,ctx); in internal_verify()
1024 xs=sk_X509_value(ctx->chain,n); in internal_verify()
1186 int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data) in X509_STORE_CTX_set_ex_data() argument
1188 return CRYPTO_set_ex_data(&ctx->ex_data,idx,data); in X509_STORE_CTX_set_ex_data()
1191 void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx) in X509_STORE_CTX_get_ex_data() argument
1193 return CRYPTO_get_ex_data(&ctx->ex_data,idx); in X509_STORE_CTX_get_ex_data()
1196 int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx) in X509_STORE_CTX_get_error() argument
1198 return ctx->error; in X509_STORE_CTX_get_error()
1201 void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int err) in X509_STORE_CTX_set_error() argument
1203 ctx->error=err; in X509_STORE_CTX_set_error()
1206 int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx) in X509_STORE_CTX_get_error_depth() argument
1208 return ctx->error_depth; in X509_STORE_CTX_get_error_depth()
1211 X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) in X509_STORE_CTX_get_current_cert() argument
1213 return ctx->current_cert; in X509_STORE_CTX_get_current_cert()
1216 STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx) in STACK_OF()
1218 return ctx->chain; in STACK_OF()
1221 STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx) in STACK_OF()
1226 if (!ctx->chain || !(chain = sk_X509_dup(ctx->chain))) return NULL; in STACK_OF()
1235 void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x) in X509_STORE_CTX_set_cert() argument
1237 ctx->cert=x; in X509_STORE_CTX_set_cert()
1240 void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *sk) in X509_STORE_CTX_set_chain() argument
1242 ctx->untrusted=sk; in X509_STORE_CTX_set_chain()
1245 void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk) in X509_STORE_CTX_set0_crls() argument
1247 ctx->crls=sk; in X509_STORE_CTX_set0_crls()
1250 int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose) in X509_STORE_CTX_set_purpose() argument
1252 return X509_STORE_CTX_purpose_inherit(ctx, 0, purpose, 0); in X509_STORE_CTX_set_purpose()
1255 int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust) in X509_STORE_CTX_set_trust() argument
1257 return X509_STORE_CTX_purpose_inherit(ctx, 0, 0, trust); in X509_STORE_CTX_set_trust()
1270 int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, in X509_STORE_CTX_purpose_inherit() argument
1313 if (purpose && !ctx->param->purpose) ctx->param->purpose = purpose; in X509_STORE_CTX_purpose_inherit()
1314 if (trust && !ctx->param->trust) ctx->param->trust = trust; in X509_STORE_CTX_purpose_inherit()
1320 X509_STORE_CTX *ctx; in X509_STORE_CTX_new() local
1321 ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX)); in X509_STORE_CTX_new()
1322 if (!ctx) in X509_STORE_CTX_new()
1327 memset(ctx, 0, sizeof(X509_STORE_CTX)); in X509_STORE_CTX_new()
1328 return ctx; in X509_STORE_CTX_new()
1331 void X509_STORE_CTX_free(X509_STORE_CTX *ctx) in X509_STORE_CTX_free() argument
1333 X509_STORE_CTX_cleanup(ctx); in X509_STORE_CTX_free()
1334 OPENSSL_free(ctx); in X509_STORE_CTX_free()
1337 int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, in X509_STORE_CTX_init() argument
1341 ctx->ctx=store; in X509_STORE_CTX_init()
1342 ctx->current_method=0; in X509_STORE_CTX_init()
1343 ctx->cert=x509; in X509_STORE_CTX_init()
1344 ctx->untrusted=chain; in X509_STORE_CTX_init()
1345 ctx->crls = NULL; in X509_STORE_CTX_init()
1346 ctx->last_untrusted=0; in X509_STORE_CTX_init()
1347 ctx->other_ctx=NULL; in X509_STORE_CTX_init()
1348 ctx->valid=0; in X509_STORE_CTX_init()
1349 ctx->chain=NULL; in X509_STORE_CTX_init()
1350 ctx->error=0; in X509_STORE_CTX_init()
1351 ctx->explicit_policy=0; in X509_STORE_CTX_init()
1352 ctx->error_depth=0; in X509_STORE_CTX_init()
1353 ctx->current_cert=NULL; in X509_STORE_CTX_init()
1354 ctx->current_issuer=NULL; in X509_STORE_CTX_init()
1355 ctx->tree = NULL; in X509_STORE_CTX_init()
1357 ctx->param = X509_VERIFY_PARAM_new(); in X509_STORE_CTX_init()
1359 if (!ctx->param) in X509_STORE_CTX_init()
1371 ret = X509_VERIFY_PARAM_inherit(ctx->param, store->param); in X509_STORE_CTX_init()
1373 ctx->param->flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE; in X509_STORE_CTX_init()
1377 ctx->verify_cb = store->verify_cb; in X509_STORE_CTX_init()
1378 ctx->cleanup = store->cleanup; in X509_STORE_CTX_init()
1381 ctx->cleanup = 0; in X509_STORE_CTX_init()
1384 ret = X509_VERIFY_PARAM_inherit(ctx->param, in X509_STORE_CTX_init()
1394 ctx->check_issued = store->check_issued; in X509_STORE_CTX_init()
1396 ctx->check_issued = check_issued; in X509_STORE_CTX_init()
1399 ctx->get_issuer = store->get_issuer; in X509_STORE_CTX_init()
1401 ctx->get_issuer = X509_STORE_CTX_get1_issuer; in X509_STORE_CTX_init()
1404 ctx->verify_cb = store->verify_cb; in X509_STORE_CTX_init()
1406 ctx->verify_cb = null_callback; in X509_STORE_CTX_init()
1409 ctx->verify = store->verify; in X509_STORE_CTX_init()
1411 ctx->verify = internal_verify; in X509_STORE_CTX_init()
1414 ctx->check_revocation = store->check_revocation; in X509_STORE_CTX_init()
1416 ctx->check_revocation = check_revocation; in X509_STORE_CTX_init()
1419 ctx->get_crl = store->get_crl; in X509_STORE_CTX_init()
1421 ctx->get_crl = get_crl; in X509_STORE_CTX_init()
1424 ctx->check_crl = store->check_crl; in X509_STORE_CTX_init()
1426 ctx->check_crl = check_crl; in X509_STORE_CTX_init()
1429 ctx->cert_crl = store->cert_crl; in X509_STORE_CTX_init()
1431 ctx->cert_crl = cert_crl; in X509_STORE_CTX_init()
1433 ctx->check_policy = check_policy; in X509_STORE_CTX_init()
1440 if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, in X509_STORE_CTX_init()
1441 &(ctx->ex_data))) in X509_STORE_CTX_init()
1443 OPENSSL_free(ctx); in X509_STORE_CTX_init()
1454 void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk) in X509_STORE_CTX_trusted_stack() argument
1456 ctx->other_ctx = sk; in X509_STORE_CTX_trusted_stack()
1457 ctx->get_issuer = get_issuer_sk; in X509_STORE_CTX_trusted_stack()
1460 void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) in X509_STORE_CTX_cleanup() argument
1462 if (ctx->cleanup) ctx->cleanup(ctx); in X509_STORE_CTX_cleanup()
1463 X509_VERIFY_PARAM_free(ctx->param); in X509_STORE_CTX_cleanup()
1464 if (ctx->tree) in X509_STORE_CTX_cleanup()
1465 X509_policy_tree_free(ctx->tree); in X509_STORE_CTX_cleanup()
1466 if (ctx->chain != NULL) in X509_STORE_CTX_cleanup()
1468 sk_X509_pop_free(ctx->chain,X509_free); in X509_STORE_CTX_cleanup()
1469 ctx->chain=NULL; in X509_STORE_CTX_cleanup()
1471 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx, &(ctx->ex_data)); in X509_STORE_CTX_cleanup()
1472 memset(&ctx->ex_data,0,sizeof(CRYPTO_EX_DATA)); in X509_STORE_CTX_cleanup()
1475 void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth) in X509_STORE_CTX_set_depth() argument
1477 X509_VERIFY_PARAM_set_depth(ctx->param, depth); in X509_STORE_CTX_set_depth()
1480 void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags) in X509_STORE_CTX_set_flags() argument
1482 X509_VERIFY_PARAM_set_flags(ctx->param, flags); in X509_STORE_CTX_set_flags()
1485 void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, time_t t) in X509_STORE_CTX_set_time() argument
1487 X509_VERIFY_PARAM_set_time(ctx->param, t); in X509_STORE_CTX_set_time()
1490 void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, in X509_STORE_CTX_set_verify_cb() argument
1493 ctx->verify_cb=verify_cb; in X509_STORE_CTX_set_verify_cb()
1496 X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx) in X509_STORE_CTX_get0_policy_tree() argument
1498 return ctx->tree; in X509_STORE_CTX_get0_policy_tree()
1501 int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx) in X509_STORE_CTX_get_explicit_policy() argument
1503 return ctx->explicit_policy; in X509_STORE_CTX_get_explicit_policy()
1506 int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name) in X509_STORE_CTX_set_default() argument
1512 return X509_VERIFY_PARAM_inherit(ctx->param, param); in X509_STORE_CTX_set_default()
1515 X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx) in X509_STORE_CTX_get0_param() argument
1517 return ctx->param; in X509_STORE_CTX_get0_param()
1520 void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param) in X509_STORE_CTX_set0_param() argument
1522 if (ctx->param) in X509_STORE_CTX_set0_param()
1523 X509_VERIFY_PARAM_free(ctx->param); in X509_STORE_CTX_set0_param()
1524 ctx->param = param; in X509_STORE_CTX_set0_param()