X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=providers%2Fimplementations%2Fserializers%2Fserializer_dh.c;h=d8e85a5482b707bd6452c73021ed44356c034a6e;hb=7165593ce5a07a6860d4d408ad640ee707172936;hp=b2517ed947c17cbd5c0daa725a3bde15b7304420;hpb=b03ec3b5d62ee26bf8437556b9040d4141d5bdd8;p=openssl.git diff --git a/providers/implementations/serializers/serializer_dh.c b/providers/implementations/serializers/serializer_dh.c index b2517ed947..d8e85a5482 100644 --- a/providers/implementations/serializers/serializer_dh.c +++ b/providers/implementations/serializers/serializer_dh.c @@ -13,11 +13,12 @@ */ #include "internal/deprecated.h" -#include #include #include "prov/bio.h" /* ossl_prov_bio_printf() */ #include "prov/implementations.h" /* rsa_keymgmt_functions */ #include "prov/providercommonerr.h" /* PROV_R_BN_ERROR */ +#include "internal/ffc.h" +#include "crypto/dh.h" #include "serializer_local.h" OSSL_OP_keymgmt_new_fn *ossl_prov_get_keymgmt_dh_new(void) @@ -39,8 +40,7 @@ int ossl_prov_print_dh(BIO *out, DH *dh, enum dh_print_type type) { const char *type_label = NULL; const BIGNUM *priv_key = NULL, *pub_key = NULL; - const BIGNUM *p = NULL, *g = NULL; - + const BIGNUM *p = NULL; switch (type) { case dh_print_priv: @@ -67,35 +67,19 @@ int ossl_prov_print_dh(BIO *out, DH *dh, enum dh_print_type type) } p = DH_get0_p(dh); - g = DH_get0_g(dh); - if (p == NULL || g == NULL) + if (p == NULL) goto null_err; - /* - * TODO(3.0): add printing of: - * - * - q (label "subgroup order:") - * - j (label "subgroup factor:") - * - seed (label "seed:") - * - counter (label "counter:") - * - * This can happen as soon as there are DH_get0_ functions for them. - */ - if (ossl_prov_bio_printf(out, "%s: (%d bit)\n", type_label, BN_num_bits(p)) <= 0) goto err; if (priv_key != NULL - && !ossl_prov_print_labeled_bignum(out, " private-key:", priv_key)) + && !ossl_prov_print_labeled_bignum(out, "private-key:", priv_key)) goto err; if (pub_key != NULL - && !ossl_prov_print_labeled_bignum(out, " public-key:", pub_key)) - goto err; - if (p != NULL - && !ossl_prov_print_labeled_bignum(out, " prime:", p)) + && !ossl_prov_print_labeled_bignum(out, "public-key:", pub_key)) goto err; - if (g != NULL - && !ossl_prov_print_labeled_bignum(out, " generator:", g)) + if (!ffc_params_prov_print(out, dh_get0_params(dh))) goto err; return 1;