Lines Matching refs:ctx

88  * @param ctx returns a newly allocated revokation context.
96 hx509_revoke_init(hx509_context context, hx509_revoke_ctx *ctx)
98 *ctx = calloc(1, sizeof(**ctx));
99 if (*ctx == NULL)
102 (*ctx)->ref = 1;
103 (*ctx)->crls.len = 0;
104 (*ctx)->crls.val = NULL;
105 (*ctx)->ocsps.len = 0;
106 (*ctx)->ocsps.val = NULL;
112 _hx509_revoke_ref(hx509_revoke_ctx ctx)
114 if (ctx == NULL)
116 if (ctx->ref <= 0)
117 _hx509_abort("revoke ctx refcount <= 0");
118 ctx->ref++;
119 if (ctx->ref == 0)
120 _hx509_abort("revoke ctx refcount == 0");
121 return ctx;
136 * @param ctx context to be freed
142 hx509_revoke_free(hx509_revoke_ctx *ctx)
146 if (ctx == NULL || *ctx == NULL)
149 if ((*ctx)->ref <= 0)
150 _hx509_abort("revoke ctx refcount <= 0 on free");
151 if (--(*ctx)->ref > 0)
154 for (i = 0; i < (*ctx)->crls.len; i++) {
155 free((*ctx)->crls.val[i].path);
156 free_CRLCertificateList(&(*ctx)->crls.val[i].crl);
159 for (i = 0; i < (*ctx)->ocsps.len; i++)
160 free_ocsp(&(*ctx)->ocsps.val[i]);
161 free((*ctx)->ocsps.val);
163 free((*ctx)->crls.val);
165 memset(*ctx, 0, sizeof(**ctx));
166 free(*ctx);
167 *ctx = NULL;
389 * @param ctx hx509 revokation context
399 hx509_revoke_ctx ctx,
414 for (i = 0; i < ctx->ocsps.len; i++) {
415 if (strcmp(ctx->ocsps.val[0].path, path) == 0)
419 data = realloc(ctx->ocsps.val,
420 (ctx->ocsps.len + 1) * sizeof(ctx->ocsps.val[0]));
426 ctx->ocsps.val = data;
428 memset(&ctx->ocsps.val[ctx->ocsps.len], 0,
429 sizeof(ctx->ocsps.val[0]));
431 ctx->ocsps.val[ctx->ocsps.len].path = strdup(path);
432 if (ctx->ocsps.val[ctx->ocsps.len].path == NULL) {
437 ret = load_ocsp(context, &ctx->ocsps.val[ctx->ocsps.len]);
439 free(ctx->ocsps.val[ctx->ocsps.len].path);
442 ctx->ocsps.len++;
453 hx509_revoke_ctx ctx,
539 ctx,
593 * @param ctx hx509 revokation context
603 hx509_revoke_ctx ctx,
619 for (i = 0; i < ctx->crls.len; i++) {
620 if (strcmp(ctx->crls.val[0].path, path) == 0)
624 data = realloc(ctx->crls.val,
625 (ctx->crls.len + 1) * sizeof(ctx->crls.val[0]));
630 ctx->crls.val = data;
632 memset(&ctx->crls.val[ctx->crls.len], 0, sizeof(ctx->crls.val[0]));
634 ctx->crls.val[ctx->crls.len].path = strdup(path);
635 if (ctx->crls.val[ctx->crls.len].path == NULL) {
641 &ctx->crls.val[ctx->crls.len].last_modfied,
642 &ctx->crls.val[ctx->crls.len].crl);
644 free(ctx->crls.val[ctx->crls.len].path);
648 ctx->crls.len++;
659 * @param ctx hx509 revokation context
673 hx509_revoke_ctx ctx,
686 for (i = 0; i < ctx->ocsps.len; i++) {
687 struct revoke_ocsp *ocsp = &ctx->ocsps.val[i];
763 for (i = 0; i < ctx->crls.len; i++) {
764 struct revoke_crl *crl = &ctx->crls.val[i];
790 ret = verify_crl(context, ctx, &crl->crl, now, certs, parent_cert);
859 struct ocsp_add_ctx *ctx = ptr;
868 d = realloc(ctx->req->requestList.val,
869 sizeof(ctx->req->requestList.val[0]) *
870 (ctx->req->requestList.len + 1));
873 ctx->req->requestList.val = d;
875 one = &ctx->req->requestList.val[ctx->req->requestList.len];
883 ret = hx509_certs_find(context, ctx->certs, &q, &parent);
887 if (ctx->parent) {
888 if (hx509_cert_cmp(ctx->parent, parent) != 0) {
896 ctx->parent = hx509_cert_ref(parent);
900 ret = copy_AlgorithmIdentifier(ctx->digest, &one->reqCert.hashAlgorithm);
931 ctx->req->requestList.len++;
971 struct ocsp_add_ctx ctx;
979 ctx.req = &req.tbsRequest;
980 ctx.certs = pool;
981 ctx.digest = digest;
982 ctx.parent = NULL;
984 ret = hx509_certs_iter(context, reqcerts, add_to_req, &ctx);
985 hx509_cert_free(ctx.parent);
1364 add_revoked(hx509_context context, void *ctx, hx509_cert cert)
1366 TBSCRLCertList *c = ctx;