Lines Matching refs:ctx
60 static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
68 if (pkey_ctx_is_pss(ctx))
75 ctx->data = rctx;
76 ctx->keygen_info = rctx->gentmp;
77 ctx->keygen_info_count = 2;
110 static int setup_tbuf(RSA_PKEY_CTX *ctx, EVP_PKEY_CTX *pk)
112 if (ctx->tbuf != NULL)
114 if ((ctx->tbuf =
122 static void pkey_rsa_cleanup(EVP_PKEY_CTX *ctx)
124 RSA_PKEY_CTX *rctx = ctx->data;
133 static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig,
138 RSA_PKEY_CTX *rctx = ctx->data;
144 RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey);
166 if (!setup_tbuf(rctx, ctx)) {
182 if (!setup_tbuf(rctx, ctx))
203 static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx,
208 RSA_PKEY_CTX *rctx = ctx->data;
214 RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey);
218 if (!setup_tbuf(rctx, ctx))
255 static int pkey_rsa_verify(EVP_PKEY_CTX *ctx,
259 RSA_PKEY_CTX *rctx = ctx->data;
265 RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey);
277 if (pkey_rsa_verifyrecover(ctx, NULL, &rslen, sig, siglen) <= 0)
281 if (!setup_tbuf(rctx, ctx))
297 if (!setup_tbuf(rctx, ctx))
312 static int pkey_rsa_encrypt(EVP_PKEY_CTX *ctx,
317 RSA_PKEY_CTX *rctx = ctx->data;
323 RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey);
327 if (!setup_tbuf(rctx, ctx))
345 static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
350 RSA_PKEY_CTX *rctx = ctx->data;
356 RSA *rsa = (RSA *)EVP_PKEY_get0_RSA(ctx->pkey);
359 if (!setup_tbuf(rctx, ctx))
428 static int pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
430 RSA_PKEY_CTX *rctx = ctx->data;
438 if (!(ctx->operation &
443 } else if (pkey_ctx_is_pss(ctx)) {
447 if (!(ctx->operation & EVP_PKEY_OP_TYPE_CRYPT))
476 && ctx->operation == EVP_PKEY_OP_VERIFY) {
603 if (!pkey_ctx_is_pss(ctx))
616 static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx,
642 return EVP_PKEY_CTX_set_rsa_padding(ctx, pm);
656 return EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, saltlen);
662 return EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, nbits);
671 ret = EVP_PKEY_CTX_set1_rsa_keygen_pubexp(ctx, pubexp);
679 return EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, nprimes);
683 return EVP_PKEY_CTX_md(ctx,
687 if (pkey_ctx_is_pss(ctx)) {
690 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN,
694 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_KEYGEN,
700 return EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(ctx, saltlen);
705 return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_CRYPT,
716 ret = EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, lab, lablen);
726 static int rsa_set_pss_param(RSA *rsa, EVP_PKEY_CTX *ctx)
728 RSA_PKEY_CTX *rctx = ctx->data;
730 if (!pkey_ctx_is_pss(ctx))
743 static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
746 RSA_PKEY_CTX *rctx = ctx->data;
758 if (ctx->pkey_gencb) {
764 evp_pkey_set_cb_translate(pcb, ctx);
771 if (ret > 0 && !rsa_set_pss_param(rsa, ctx)) {
776 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, rsa);
827 static int pkey_pss_init(EVP_PKEY_CTX *ctx)
830 RSA_PKEY_CTX *rctx = ctx->data;
836 if (!pkey_ctx_is_pss(ctx))
838 rsa = EVP_PKEY_get0_RSA(ctx->pkey);