dh_priv_text_serializer_functions },
{ "DH", "default=yes,format=text,type=public",
dh_pub_text_serializer_functions },
- { "DH", "default=yes,format=text,type=domainparams",
+ { "DH", "default=yes,format=text,type=parameters",
dh_param_text_serializer_functions },
{ "DH", "default=yes,format=der,type=private",
dh_priv_der_serializer_functions },
{ "DH", "default=yes,format=der,type=public",
dh_pub_der_serializer_functions },
- { "DH", "default=yes,format=der,type=domainparams",
+ { "DH", "default=yes,format=der,type=parameters",
dh_param_der_serializer_functions },
{ "DH", "default=yes,format=pem,type=private",
dh_priv_pem_serializer_functions },
{ "DH", "default=yes,format=pem,type=public",
dh_pub_pem_serializer_functions },
- { "DH", "default=yes,format=pem,type=domainparams",
+ { "DH", "default=yes,format=pem,type=parameters",
dh_param_pem_serializer_functions },
#endif
dsa_priv_text_serializer_functions },
{ "DSA", "default=yes,format=text,type=public",
dsa_pub_text_serializer_functions },
- { "DSA", "default=yes,format=text,type=domainparams",
+ { "DSA", "default=yes,format=text,type=parameters",
dsa_param_text_serializer_functions },
{ "DSA", "default=yes,format=der,type=private",
dsa_priv_der_serializer_functions },
{ "DSA", "default=yes,format=der,type=public",
dsa_pub_der_serializer_functions },
- { "DSA", "default=yes,format=der,type=domainparams",
+ { "DSA", "default=yes,format=der,type=parameters",
dsa_param_der_serializer_functions },
{ "DSA", "default=yes,format=pem,type=private",
dsa_priv_pem_serializer_functions },
{ "DSA", "default=yes,format=pem,type=public",
dsa_pub_pem_serializer_functions },
- { "DSA", "default=yes,format=pem,type=domainparams",
+ { "DSA", "default=yes,format=pem,type=parameters",
dsa_param_pem_serializer_functions },
#endif
return xpk;
}
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_importkey(const OSSL_DISPATCH *fns)
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_new(const OSSL_DISPATCH *fns)
{
/* Pilfer the keymgmt dispatch table */
for (; fns->function_id != 0; fns++)
- if (fns->function_id == OSSL_FUNC_KEYMGMT_IMPORTKEY)
- return OSSL_get_OP_keymgmt_importkey(fns);
+ if (fns->function_id == OSSL_FUNC_KEYMGMT_NEW)
+ return OSSL_get_OP_keymgmt_new(fns);
+
+ return NULL;
+}
+
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_free(const OSSL_DISPATCH *fns)
+{
+ /* Pilfer the keymgmt dispatch table */
+ for (; fns->function_id != 0; fns++)
+ if (fns->function_id == OSSL_FUNC_KEYMGMT_FREE)
+ return OSSL_get_OP_keymgmt_free(fns);
+
+ return NULL;
+}
+
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_import(const OSSL_DISPATCH *fns)
+{
+ /* Pilfer the keymgmt dispatch table */
+ for (; fns->function_id != 0; fns++)
+ if (fns->function_id == OSSL_FUNC_KEYMGMT_IMPORT)
+ return OSSL_get_OP_keymgmt_import(fns);
return NULL;
}
#include "prov/providercommonerr.h" /* PROV_R_BN_ERROR */
#include "serializer_local.h"
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_dh_importkey(void)
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_dh_new(void)
{
- return ossl_prov_get_importkey(dh_keymgmt_functions);
+ return ossl_prov_get_keymgmt_new(dh_keymgmt_functions);
+}
+
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_dh_free(void)
+{
+ return ossl_prov_get_keymgmt_free(dh_keymgmt_functions);
+}
+
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_dh_import(void)
+{
+ return ossl_prov_get_keymgmt_import(dh_keymgmt_functions);
}
int ossl_prov_print_dh(BIO *out, DH *dh, enum dh_print_type type)
}
p = DH_get0_p(dh);
- g = DH_get0_p(dh);
+ g = DH_get0_g(dh);
if (p == NULL || g == NULL)
goto null_err;
static int dh_param_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_param_der(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ /* ctx == provctx */
+ if ((dh = dh_new(ctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params)
+ && dh_param_der(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
/* Public key : PEM */
static int dh_param_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_param_pem(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ /* ctx == provctx */
+ if ((dh = dh_new(ctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params)
+ && dh_param_pem(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
}
static int dh_param_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_param_print(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ /* ctx == provctx */
+ if ((dh = dh_new(ctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params)
+ && dh_param_print(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
/* Private key : DER */
static int dh_priv_der_data(void *vctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct dh_priv_ctx_st *ctx = vctx;
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx->provctx, params);
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_priv_der(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ if ((dh = dh_new(ctx->provctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dh_priv_der(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
/* Private key : PEM */
static int dh_pem_priv_data(void *vctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct dh_priv_ctx_st *ctx = vctx;
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params);
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_pem_priv(ctx->provctx, dh, out, cb, cbarg);
- DH_free(dh);
+ if ((dh = dh_new(ctx->provctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dh_pem_priv(ctx->provctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
static int dh_pem_priv(void *vctx, void *dh, BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct dh_priv_ctx_st *ctx = vctx;
int ret;
{
}
-static int dh_priv_print_data(void *provctx, const OSSL_PARAM params[],
- BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+static int dh_priv_print_data(void *vctx, const OSSL_PARAM params[], BIO *out,
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ struct dh_priv_ctx_st *ctx = vctx;
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(provctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_priv_print(provctx, dh, out, cb, cbarg);
- DH_free(dh);
+ if ((dh = dh_new(ctx->provctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dh_priv_print(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
static int dh_priv_print(void *ctx, void *dh, BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
return ossl_prov_print_dh(out, dh, dh_print_priv);
}
static int dh_pub_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_pub_der(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ /* ctx == provctx */
+ if ((dh = dh_new(ctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dh_pub_der(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
static int dh_pub_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_pub_pem(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ /* ctx == provctx */
+ if ((dh = dh_new(ctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dh_pub_pem(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
static int dh_pub_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dh_importkey =
- ossl_prov_get_dh_importkey();
+ OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
+ OSSL_OP_keymgmt_free_fn *dh_free = ossl_prov_get_keymgmt_dh_free();
+ OSSL_OP_keymgmt_import_fn *dh_import = ossl_prov_get_keymgmt_dh_import();
int ok = 0;
- if (dh_importkey != NULL) {
- DH *dh = dh_importkey(ctx, params); /* ctx == provctx */
+ if (dh_import != NULL) {
+ DH *dh;
- ok = dh_pub_print(ctx, dh, out, cb, cbarg);
- DH_free(dh);
+ /* ctx == provctx */
+ if ((dh = dh_new(ctx)) != NULL
+ && dh_import(dh, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dh_pub_print(ctx, dh, out, cb, cbarg))
+ ok = 1;
+ dh_free(dh);
}
return ok;
}
#include "prov/providercommonerr.h" /* PROV_R_BN_ERROR */
#include "serializer_local.h"
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_dsa_importkey(void)
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_dsa_new(void)
{
- return ossl_prov_get_importkey(dsa_keymgmt_functions);
+ return ossl_prov_get_keymgmt_new(dsa_keymgmt_functions);
+}
+
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_dsa_free(void)
+{
+ return ossl_prov_get_keymgmt_free(dsa_keymgmt_functions);
+}
+
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_dsa_import(void)
+{
+ return ossl_prov_get_keymgmt_import(dsa_keymgmt_functions);
}
int ossl_prov_print_dsa(BIO *out, DSA *dsa, enum dsa_print_type type)
/* Public key : DER */
static int dsa_param_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_param_der(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ /* ctx == provctx */
+ if ((dsa = dsa_new(ctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params)
+ && dsa_param_der(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
static int dsa_param_der(void *ctx, void *dsa, BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
return i2d_DSAparams_bio(out, dsa);
}
/* Public key : PEM */
static int dsa_param_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_param_pem(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ /* ctx == provctx */
+ if ((dsa = dsa_new(ctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params)
+ && dsa_param_pem(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
static int dsa_param_pem(void *ctx, void *dsa, BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
return PEM_write_bio_DSAparams(out, dsa);
}
static int dsa_param_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_param_print(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ /* ctx == provctx */
+ if ((dsa = dsa_new(ctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_ALL_PARAMETERS, params)
+ && dsa_param_print(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
static int dsa_param_print(void *ctx, void *dsa, BIO *out,
- OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
+ OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
return ossl_prov_print_dsa(out, dsa, dsa_print_params);
}
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct dsa_priv_ctx_st *ctx = vctx;
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx->provctx, params);
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_priv_der(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ if ((dsa = dsa_new(ctx->provctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dsa_priv_der(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct dsa_priv_ctx_st *ctx = vctx;
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params);
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_pem_priv(ctx->provctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ if ((dsa = dsa_new(ctx->provctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dsa_pem_priv(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
{
}
-static int dsa_priv_print_data(void *provctx, const OSSL_PARAM params[],
+static int dsa_priv_print_data(void *vctx, const OSSL_PARAM params[],
BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ struct dsa_priv_ctx_st *ctx = vctx;
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(provctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_priv_print(provctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ if ((dsa = dsa_new(ctx->provctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dsa_priv_print(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
static int dsa_pub_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_pub_der(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ /* ctx == provctx */
+ if ((dsa = dsa_new(ctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dsa_pub_der(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
static int dsa_pub_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_pub_pem(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ /* ctx == provctx */
+ if ((dsa = dsa_new(ctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dsa_pub_pem(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
static int dsa_pub_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *dsa_importkey =
- ossl_prov_get_dsa_importkey();
+ OSSL_OP_keymgmt_new_fn *dsa_new = ossl_prov_get_keymgmt_dsa_new();
+ OSSL_OP_keymgmt_free_fn *dsa_free = ossl_prov_get_keymgmt_dsa_free();
+ OSSL_OP_keymgmt_import_fn *dsa_import = ossl_prov_get_keymgmt_dsa_import();
int ok = 0;
- if (dsa_importkey != NULL) {
- DSA *dsa = dsa_importkey(ctx, params); /* ctx == provctx */
+ if (dsa_import != NULL) {
+ DSA *dsa;
- ok = dsa_pub_print(ctx, dsa, out, cb, cbarg);
- DSA_free(dsa);
+ /* ctx == provctx */
+ if ((dsa = dsa_new(ctx)) != NULL
+ && dsa_import(dsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && dsa_pub_print(ctx, dsa, out, cb, cbarg))
+ ok = 1;
+ dsa_free(dsa);
}
return ok;
}
void *cbarg;
};
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_importkey(const OSSL_DISPATCH *fns);
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_new(const OSSL_DISPATCH *fns);
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_free(const OSSL_DISPATCH *fns);
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_import(const OSSL_DISPATCH *fns);
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_rsa_importkey(void);
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_dh_importkey(void);
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_dsa_importkey(void);
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_rsa_new(void);
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_rsa_free(void);
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_rsa_import(void);
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_dh_new(void);
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_dh_free(void);
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_dh_import(void);
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_dsa_new(void);
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_dsa_free(void);
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_dsa_import(void);
int ossl_prov_prepare_dh_params(const void *dh, int nid,
ASN1_STRING **pstr, int *pstrtype);
DEFINE_SPECIAL_STACK_OF_CONST(BIGNUM_const, BIGNUM)
-OSSL_OP_keymgmt_importkey_fn *ossl_prov_get_rsa_importkey(void)
+OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_rsa_new(void)
{
- return ossl_prov_get_importkey(rsa_keymgmt_functions);
+ return ossl_prov_get_keymgmt_new(rsa_keymgmt_functions);
+}
+
+OSSL_OP_keymgmt_free_fn *ossl_prov_get_keymgmt_rsa_free(void)
+{
+ return ossl_prov_get_keymgmt_free(rsa_keymgmt_functions);
+}
+
+OSSL_OP_keymgmt_import_fn *ossl_prov_get_keymgmt_rsa_import(void)
+{
+ return ossl_prov_get_keymgmt_import(rsa_keymgmt_functions);
}
int ossl_prov_print_rsa(BIO *out, RSA *rsa, int priv)
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct rsa_priv_ctx_st *ctx = vctx;
- OSSL_OP_keymgmt_importkey_fn *rsa_importkey =
- ossl_prov_get_rsa_importkey();
+ OSSL_OP_keymgmt_new_fn *rsa_new = ossl_prov_get_keymgmt_rsa_new();
+ OSSL_OP_keymgmt_free_fn *rsa_free = ossl_prov_get_keymgmt_rsa_free();
+ OSSL_OP_keymgmt_import_fn *rsa_import = ossl_prov_get_keymgmt_rsa_import();
int ok = 0;
- if (rsa_importkey != NULL) {
- RSA *rsa = rsa_importkey(ctx->provctx, params);
+ if (rsa_import != NULL) {
+ RSA *rsa;
- ok = rsa_priv_der(vctx, rsa, out, cb, cbarg);
- RSA_free(rsa);
+ if ((rsa = rsa_new(ctx->provctx)) != NULL
+ && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && rsa_priv_der(ctx, rsa, out, cb, cbarg))
+ ok = 1;
+ rsa_free(rsa);
}
return ok;
}
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
struct rsa_priv_ctx_st *ctx = vctx;
- OSSL_OP_keymgmt_importkey_fn *rsa_importkey =
- ossl_prov_get_rsa_importkey();
+ OSSL_OP_keymgmt_new_fn *rsa_new = ossl_prov_get_keymgmt_rsa_new();
+ OSSL_OP_keymgmt_free_fn *rsa_free = ossl_prov_get_keymgmt_rsa_free();
+ OSSL_OP_keymgmt_import_fn *rsa_import = ossl_prov_get_keymgmt_rsa_import();
int ok = 0;
- if (rsa_importkey != NULL) {
- RSA *rsa = rsa_importkey(ctx, params);
+ if (rsa_import != NULL) {
+ RSA *rsa;
- ok = rsa_pem_priv(vctx, rsa, out, cb, cbarg);
- RSA_free(rsa);
+ if ((rsa = rsa_new(ctx->provctx)) != NULL
+ && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && rsa_pem_priv(ctx, rsa, out, cb, cbarg))
+ ok = 1;
+ rsa_free(rsa);
}
return ok;
}
{
}
-static int rsa_priv_print_data(void *provctx, const OSSL_PARAM params[],
+static int rsa_priv_print_data(void *vctx, const OSSL_PARAM params[],
BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *rsa_importkey =
- ossl_prov_get_rsa_importkey();
+ struct rsa_priv_ctx_st *ctx = vctx;
+ OSSL_OP_keymgmt_new_fn *rsa_new = ossl_prov_get_keymgmt_rsa_new();
+ OSSL_OP_keymgmt_free_fn *rsa_free = ossl_prov_get_keymgmt_rsa_free();
+ OSSL_OP_keymgmt_import_fn *rsa_import = ossl_prov_get_keymgmt_rsa_import();
int ok = 0;
- if (rsa_importkey != NULL) {
- RSA *rsa = rsa_importkey(provctx, params); /* ctx == provctx */
+ if (rsa_import != NULL) {
+ RSA *rsa;
- ok = rsa_priv_print(provctx, rsa, out, cb, cbarg);
- RSA_free(rsa);
+ if ((rsa = rsa_new(ctx->provctx)) != NULL
+ && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && rsa_priv_print(ctx, rsa, out, cb, cbarg))
+ ok = 1;
+ rsa_free(rsa);
}
return ok;
}
static int rsa_pub_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *rsa_importkey =
- ossl_prov_get_rsa_importkey();
+ OSSL_OP_keymgmt_new_fn *rsa_new = ossl_prov_get_keymgmt_rsa_new();
+ OSSL_OP_keymgmt_free_fn *rsa_free = ossl_prov_get_keymgmt_rsa_free();
+ OSSL_OP_keymgmt_import_fn *rsa_import = ossl_prov_get_keymgmt_rsa_import();
int ok = 0;
- if (rsa_importkey != NULL) {
- RSA *rsa = rsa_importkey(ctx, params); /* ctx == provctx */
+ if (rsa_import != NULL) {
+ RSA *rsa;
- ok = rsa_pub_der(ctx, rsa, out, cb, cbarg);
- RSA_free(rsa);
+ /* ctx == provctx */
+ if ((rsa = rsa_new(ctx)) != NULL
+ && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && rsa_pub_der(ctx, rsa, out, cb, cbarg))
+ ok = 1;
+ rsa_free(rsa);
}
return ok;
}
static int rsa_pub_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *rsa_importkey =
- ossl_prov_get_rsa_importkey();
+ OSSL_OP_keymgmt_new_fn *rsa_new = ossl_prov_get_keymgmt_rsa_new();
+ OSSL_OP_keymgmt_free_fn *rsa_free = ossl_prov_get_keymgmt_rsa_free();
+ OSSL_OP_keymgmt_import_fn *rsa_import = ossl_prov_get_keymgmt_rsa_import();
int ok = 0;
- if (rsa_importkey != NULL) {
- RSA *rsa = rsa_importkey(ctx, params); /* ctx == provctx */
+ if (rsa_import != NULL) {
+ RSA *rsa;
- ok = rsa_pub_pem(ctx, rsa, out, cb, cbarg);
- RSA_free(rsa);
+ /* ctx == provctx */
+ if ((rsa = rsa_new(ctx)) != NULL
+ && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && rsa_pub_pem(ctx, rsa, out, cb, cbarg))
+ ok = 1;
+ rsa_free(rsa);
}
return ok;
}
static int rsa_pub_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- OSSL_OP_keymgmt_importkey_fn *rsa_importkey =
- ossl_prov_get_rsa_importkey();
+ OSSL_OP_keymgmt_new_fn *rsa_new = ossl_prov_get_keymgmt_rsa_new();
+ OSSL_OP_keymgmt_free_fn *rsa_free = ossl_prov_get_keymgmt_rsa_free();
+ OSSL_OP_keymgmt_import_fn *rsa_import = ossl_prov_get_keymgmt_rsa_import();
int ok = 0;
- if (rsa_importkey != NULL) {
- RSA *rsa = rsa_importkey(ctx, params); /* ctx == provctx */
+ if (rsa_import != NULL) {
+ RSA *rsa;
- ok = rsa_pub_print(ctx, rsa, out, cb, cbarg);
- RSA_free(rsa);
+ /* ctx == provctx */
+ if ((rsa = rsa_new(ctx)) != NULL
+ && rsa_import(rsa, OSSL_KEYMGMT_SELECT_KEYPAIR, params)
+ && rsa_pub_print(ctx, rsa, out, cb, cbarg))
+ ok = 1;
+ rsa_free(rsa);
}
return ok;
}