Lines Matching refs:ctx
730 int RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2)
733 if (ctx != NULL && ctx->pmeth != NULL
734 && ctx->pmeth->pkey_id != EVP_PKEY_RSA
735 && ctx->pmeth->pkey_id != EVP_PKEY_RSA_PSS)
737 return EVP_PKEY_CTX_ctrl(ctx, -1, optype, cmd, p1, p2);
878 static int int_set_rsa_md_name(EVP_PKEY_CTX *ctx,
887 if (ctx == NULL || mdname == NULL || (ctx->operation & optype) == 0) {
896 if (!EVP_PKEY_CTX_is_a(ctx, "RSA")
897 && !EVP_PKEY_CTX_is_a(ctx, "RSA-PSS"))
901 if (!EVP_PKEY_CTX_is_a(ctx, evp_pkey_type2name(keytype)))
908 if (evp_pkey_ctx_is_provided(ctx) && mdprops != NULL) {
914 return evp_pkey_ctx_set_params_strict(ctx, params);
918 static int int_get_rsa_md_name(EVP_PKEY_CTX *ctx,
927 if (ctx == NULL || mdname == NULL || (ctx->operation & optype) == 0) {
936 if (!EVP_PKEY_CTX_is_a(ctx, "RSA")
937 && !EVP_PKEY_CTX_is_a(ctx, "RSA-PSS"))
941 if (!EVP_PKEY_CTX_is_a(ctx, evp_pkey_type2name(keytype)))
950 return evp_pkey_ctx_get_params_strict(ctx, params);
957 int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad_mode)
959 return RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_RSA_PADDING,
967 int EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, int *pad_mode)
969 return RSA_pkey_ctx_ctrl(ctx, -1, EVP_PKEY_CTRL_GET_RSA_PADDING,
977 int EVP_PKEY_CTX_set_rsa_pss_keygen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
979 return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN,
983 int EVP_PKEY_CTX_set_rsa_pss_keygen_md_name(EVP_PKEY_CTX *ctx,
987 return int_set_rsa_md_name(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN,
996 int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
998 return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT,
1002 int EVP_PKEY_CTX_set_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, const char *mdname,
1006 int_set_rsa_md_name(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT,
1011 int EVP_PKEY_CTX_get_rsa_oaep_md_name(EVP_PKEY_CTX *ctx, char *name,
1014 return int_get_rsa_md_name(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT,
1023 int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md)
1025 return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT,
1033 int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
1035 return RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT,
1039 int EVP_PKEY_CTX_set_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, const char *mdname,
1042 return int_set_rsa_md_name(ctx, -1,
1048 int EVP_PKEY_CTX_get_rsa_mgf1_md_name(EVP_PKEY_CTX *ctx, char *name,
1051 return int_get_rsa_md_name(ctx, -1,
1060 int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
1062 return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN,
1066 int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name(EVP_PKEY_CTX *ctx,
1069 return int_set_rsa_md_name(ctx, EVP_PKEY_RSA_PSS, EVP_PKEY_OP_KEYGEN,
1078 int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md)
1080 return RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT,
1084 int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, void *label, int llen)
1089 if (ctx == NULL || !EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx)) {
1096 if (!EVP_PKEY_CTX_is_a(ctx, "RSA"))
1104 ret = evp_pkey_ctx_set_params_strict(ctx, rsa_params);
1113 int EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label)
1118 if (ctx == NULL || !EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx)) {
1125 if (!EVP_PKEY_CTX_is_a(ctx, "RSA"))
1132 if (!EVP_PKEY_CTX_get_params(ctx, rsa_params))
1146 int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int saltlen)
1158 return RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG,
1166 int EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int *saltlen)
1177 return RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_TYPE_SIG,
1181 int EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(EVP_PKEY_CTX *ctx, int saltlen)
1185 if (ctx == NULL || !EVP_PKEY_CTX_IS_GEN_OP(ctx)) {
1191 if (!EVP_PKEY_CTX_is_a(ctx, "RSA-PSS"))
1198 return evp_pkey_ctx_set_params_strict(ctx, pad_params);
1201 int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int bits)
1206 if (ctx == NULL || !EVP_PKEY_CTX_IS_GEN_OP(ctx)) {
1213 if (!EVP_PKEY_CTX_is_a(ctx, "RSA")
1214 && !EVP_PKEY_CTX_is_a(ctx, "RSA-PSS"))
1220 return evp_pkey_ctx_set_params_strict(ctx, params);
1223 int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp)
1225 int ret = RSA_pkey_ctx_ctrl(ctx, EVP_PKEY_OP_KEYGEN,
1233 if (ret > 0 && evp_pkey_ctx_is_provided(ctx)) {
1234 BN_free(ctx->rsa_pubexp);
1235 ctx->rsa_pubexp = pubexp;
1241 int EVP_PKEY_CTX_set1_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp)
1249 if (evp_pkey_ctx_is_legacy(ctx)) {
1254 ret = EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN,
1256 if (evp_pkey_ctx_is_legacy(ctx) && ret <= 0)
1261 int EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes)
1266 if (ctx == NULL || !EVP_PKEY_CTX_IS_GEN_OP(ctx)) {
1273 if (!EVP_PKEY_CTX_is_a(ctx, "RSA")
1274 && !EVP_PKEY_CTX_is_a(ctx, "RSA-PSS"))
1280 return evp_pkey_ctx_set_params_strict(ctx, params);