Lines Matching refs:pctx

39 static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
64 if (ctx->pctx == NULL) {
67 ctx->pctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, props);
69 ctx->pctx = EVP_PKEY_CTX_new(pkey, e);
71 if (ctx->pctx == NULL)
74 locpctx = ctx->pctx;
213 if (pctx != NULL)
214 *pctx = locpctx;
304 if (ctx->pctx->pmeth == NULL) {
309 if (!(ctx->pctx->pmeth->flags & EVP_PKEY_FLAG_SIGCTX_CUSTOM)) {
324 if (ctx->pctx->pmeth->verifyctx_init) {
325 if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, ctx) <= 0)
327 ctx->pctx->operation = EVP_PKEY_OP_VERIFYCTX;
328 } else if (ctx->pctx->pmeth->digestverify != 0) {
329 ctx->pctx->operation = EVP_PKEY_OP_VERIFY;
331 } else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) {
335 if (ctx->pctx->pmeth->signctx_init) {
336 if (ctx->pctx->pmeth->signctx_init(ctx->pctx, ctx) <= 0)
338 ctx->pctx->operation = EVP_PKEY_OP_SIGNCTX;
339 } else if (ctx->pctx->pmeth->digestsign != 0) {
340 ctx->pctx->operation = EVP_PKEY_OP_SIGN;
342 } else if (EVP_PKEY_sign_init(ctx->pctx) <= 0) {
346 if (EVP_PKEY_CTX_set_signature_md(ctx->pctx, type) <= 0)
348 if (pctx)
349 *pctx = ctx->pctx;
350 if (ctx->pctx->pmeth->flags & EVP_PKEY_FLAG_SIGCTX_CUSTOM)
358 ctx->pctx->flag_call_digest_custom = 0;
359 if (ctx->pctx->pmeth->digest_custom != NULL)
360 ctx->pctx->flag_call_digest_custom = 1;
374 int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
379 return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 0,
383 int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
386 return do_sigver_init(ctx, pctx, type, NULL, NULL, NULL, e, pkey, 0,
390 int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
395 return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 1,
399 int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
402 return do_sigver_init(ctx, pctx, type, NULL, NULL, NULL, e, pkey, 1,
409 EVP_PKEY_CTX *pctx = ctx->pctx;
411 if (pctx == NULL
412 || pctx->operation != EVP_PKEY_OP_SIGNCTX
413 || pctx->op.sig.algctx == NULL
414 || pctx->op.sig.signature == NULL)
417 if (pctx->op.sig.signature->digest_sign_update == NULL) {
422 return pctx->op.sig.signature->digest_sign_update(pctx->op.sig.algctx,
426 if (pctx != NULL) {
428 if (pctx->flag_call_digest_custom
429 && !ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx))
431 pctx->flag_call_digest_custom = 0;
439 EVP_PKEY_CTX *pctx = ctx->pctx;
441 if (pctx == NULL
442 || pctx->operation != EVP_PKEY_OP_VERIFYCTX
443 || pctx->op.sig.algctx == NULL
444 || pctx->op.sig.signature == NULL)
447 if (pctx->op.sig.signature->digest_verify_update == NULL) {
452 return pctx->op.sig.signature->digest_verify_update(pctx->op.sig.algctx,
456 if (pctx != NULL) {
458 if (pctx->flag_call_digest_custom
459 && !ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx))
461 pctx->flag_call_digest_custom = 0;
472 EVP_PKEY_CTX *dctx, *pctx = ctx->pctx;
474 if (pctx == NULL
475 || pctx->operation != EVP_PKEY_OP_SIGNCTX
476 || pctx->op.sig.algctx == NULL
477 || pctx->op.sig.signature == NULL)
481 return pctx->op.sig.signature->digest_sign_final(pctx->op.sig.algctx,
484 dctx = EVP_PKEY_CTX_dup(pctx);
495 if (pctx == NULL || pctx->pmeth == NULL) {
501 if (pctx->flag_call_digest_custom
502 && !ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx))
504 pctx->flag_call_digest_custom = 0;
506 if (pctx->pmeth->flags & EVP_PKEY_FLAG_SIGCTX_CUSTOM) {
508 return pctx->pmeth->signctx(pctx, sigret, siglen, ctx);
510 r = pctx->pmeth->signctx(pctx, sigret, siglen, ctx);
512 dctx = EVP_PKEY_CTX_dup(pctx);
520 if (pctx->pmeth->signctx != NULL)
530 r = pctx->pmeth->signctx(pctx, sigret, siglen, ctx);
543 r = tmp_ctx->pctx->pmeth->signctx(tmp_ctx->pctx,
551 if (EVP_PKEY_sign(pctx, sigret, siglen, md, mdlen) <= 0)
555 if (pctx->pmeth->signctx(pctx, sigret, siglen, ctx) <= 0)
560 if (s < 0 || EVP_PKEY_sign(pctx, sigret, siglen, NULL, s) <= 0)
570 EVP_PKEY_CTX *pctx = ctx->pctx;
572 if (pctx != NULL
573 && pctx->operation == EVP_PKEY_OP_SIGNCTX
574 && pctx->op.sig.algctx != NULL
575 && pctx->op.sig.signature != NULL) {
576 if (pctx->op.sig.signature->digest_sign != NULL)
577 return pctx->op.sig.signature->digest_sign(pctx->op.sig.algctx,
583 if (ctx->pctx->pmeth != NULL && ctx->pctx->pmeth->digestsign != NULL)
584 return ctx->pctx->pmeth->digestsign(ctx, sigret, siglen, tbs, tbslen);
599 EVP_PKEY_CTX *dctx, *pctx = ctx->pctx;
601 if (pctx == NULL
602 || pctx->operation != EVP_PKEY_OP_VERIFYCTX
603 || pctx->op.sig.algctx == NULL
604 || pctx->op.sig.signature == NULL)
608 return pctx->op.sig.signature->digest_verify_final(pctx->op.sig.algctx,
610 dctx = EVP_PKEY_CTX_dup(pctx);
620 if (pctx == NULL || pctx->pmeth == NULL) {
626 if (pctx->flag_call_digest_custom
627 && !ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx))
629 pctx->flag_call_digest_custom = 0;
631 if (pctx->pmeth->verifyctx != NULL)
637 r = pctx->pmeth->verifyctx(pctx, sig, siglen, ctx);
649 r = tmp_ctx->pctx->pmeth->verifyctx(tmp_ctx->pctx,
657 return EVP_PKEY_verify(pctx, sig, siglen, md, mdlen);
663 EVP_PKEY_CTX *pctx = ctx->pctx;
665 if (pctx != NULL
666 && pctx->operation == EVP_PKEY_OP_VERIFYCTX
667 && pctx->op.sig.algctx != NULL
668 && pctx->op.sig.signature != NULL) {
669 if (pctx->op.sig.signature->digest_verify != NULL)
670 return pctx->op.sig.signature->digest_verify(pctx->op.sig.algctx,
675 if (ctx->pctx->pmeth != NULL && ctx->pctx->pmeth->digestverify != NULL)
676 return ctx->pctx->pmeth->digestverify(ctx, sigret, siglen, tbs, tbslen);