summaryrefslogtreecommitdiffstats
path: root/providers/implementations/serializers/serializer_dh_param.c
diff options
context:
space:
mode:
Diffstat (limited to 'providers/implementations/serializers/serializer_dh_param.c')
-rw-r--r--providers/implementations/serializers/serializer_dh_param.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/providers/implementations/serializers/serializer_dh_param.c b/providers/implementations/serializers/serializer_dh_param.c
index 5e06178590..4acf5caec6 100644
--- a/providers/implementations/serializers/serializer_dh_param.c
+++ b/providers/implementations/serializers/serializer_dh_param.c
@@ -21,6 +21,7 @@
#include "prov/bio.h"
#include "prov/implementations.h"
#include "prov/providercommonerr.h"
+#include "prov/provider_ctx.h"
#include "serializer_local.h"
static OSSL_OP_serializer_newctx_fn dh_param_newctx;
@@ -48,7 +49,8 @@ static void dh_param_freectx(void *ctx)
}
/* Public key : DER */
-static int dh_param_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
+static int dh_param_der_data(void *ctx, const OSSL_PARAM params[],
+ OSSL_CORE_BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
@@ -69,14 +71,23 @@ static int dh_param_der_data(void *ctx, const OSSL_PARAM params[], BIO *out,
return ok;
}
-static int dh_param_der(void *ctx, void *dh, BIO *out,
+static int dh_param_der(void *ctx, void *dh, OSSL_CORE_BIO *cout,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- return i2d_DHparams_bio(out, dh);
+ BIO *out = bio_new_from_core_bio(ctx, cout);
+ int ret;
+
+ if (out == NULL)
+ return 0;
+ ret = i2d_DHparams_bio(out, dh);
+ BIO_free(out);
+
+ return ret;
}
/* Public key : PEM */
-static int dh_param_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
+static int dh_param_pem_data(void *ctx, const OSSL_PARAM params[],
+ OSSL_CORE_BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
@@ -97,13 +108,23 @@ static int dh_param_pem_data(void *ctx, const OSSL_PARAM params[], BIO *out,
return ok;
}
-static int dh_param_pem(void *ctx, void *dh, BIO *out,
+static int dh_param_pem(void *ctx, void *dh, OSSL_CORE_BIO *cout,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- return PEM_write_bio_DHparams(out, dh);
+ BIO *out = bio_new_from_core_bio(ctx, cout);
+ int ret;
+
+ if (out == NULL)
+ return 0;
+
+ ret = PEM_write_bio_DHparams(out, dh);
+ BIO_free(out);
+
+ return ret;
}
-static int dh_param_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
+static int dh_param_print_data(void *ctx, const OSSL_PARAM params[],
+ OSSL_CORE_BIO *out,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
OSSL_OP_keymgmt_new_fn *dh_new = ossl_prov_get_keymgmt_dh_new();
@@ -124,10 +145,19 @@ static int dh_param_print_data(void *ctx, const OSSL_PARAM params[], BIO *out,
return ok;
}
-static int dh_param_print(void *ctx, void *dh, BIO *out,
+static int dh_param_print(void *ctx, void *dh, OSSL_CORE_BIO *cout,
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg)
{
- return ossl_prov_print_dh(out, dh, dh_print_params);
+ BIO *out = bio_new_from_core_bio(ctx, cout);
+ int ret;
+
+ if (out == NULL)
+ return 0;
+
+ ret = ossl_prov_print_dh(out, dh, dh_print_params);
+ BIO_free(out);
+
+ return ret;
}
const OSSL_DISPATCH dh_param_der_serializer_functions[] = {