Fix some build failures with no-dh
authorMatt Caswell <matt@openssl.org>
Mon, 20 Apr 2020 13:05:23 +0000 (14:05 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 22 Apr 2020 09:32:47 +0000 (10:32 +0100)
Add some missing OPENSSL_NO_DH guards.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11582)

crypto/ffc/ffc_backend.c
crypto/ffc/ffc_params.c
providers/implementations/serializers/serializer_ffc_params.c

index d3661b1706fc174178cba07c7b6a23698e965ce1..d9b3e2e8af7973a8da338cba8f65abf375073ab0 100644 (file)
@@ -31,7 +31,13 @@ int ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[])
     if (prm != NULL) {
         if (prm->data_type != OSSL_PARAM_UTF8_STRING)
             goto err;
+#ifndef OPENSSL_NO_DH
+        /*
+         * In a no-dh build we just go straight to err because we have no
+         * support for this.
+         */
         if (!ffc_set_group_pqg(ffc, prm->data))
+#endif
             goto err;
     }
 
index 89550bedec4909cf6f2b9dca0657fd3388637c2a..63a8bb73b4106f5014b7db960fff2158f23a71a4 100644 (file)
@@ -215,6 +215,7 @@ int ffc_params_todata(const FFC_PARAMS *ffc, OSSL_PARAM_BLD *bld,
                                               ffc->seed, ffc->seedlen))
         return 0;
     if (ffc->nid != NID_undef) {
+#ifndef OPENSSL_NO_DH
         const char *name = ffc_named_group_from_uid(ffc->nid);
 
         if (name == NULL
@@ -222,6 +223,10 @@ int ffc_params_todata(const FFC_PARAMS *ffc, OSSL_PARAM_BLD *bld,
                                                  OSSL_PKEY_PARAM_FFC_GROUP,
                                                  name))
             return 0;
+#else
+        /* How could this be? We should not have a nid in a no-dh build. */
+        return 0;
+#endif
     }
     return 1;
 }
index 20cf4b3d243bbc4e15ab5448a7516b87f3c29d34..98c9886ce9e9c614e850a818b6448663544af793 100644 (file)
@@ -15,6 +15,7 @@
 int ffc_params_prov_print(BIO *out, const FFC_PARAMS *ffc)
 {
     if (ffc->nid != NID_undef) {
+#ifndef OPENSSL_NO_DH
         const char *name = ffc_named_group_from_uid(ffc->nid);
 
         if (name == NULL)
@@ -22,6 +23,10 @@ int ffc_params_prov_print(BIO *out, const FFC_PARAMS *ffc)
         if (ossl_prov_bio_printf(out, "GROUP: %s\n", name) <= 0)
             goto err;
         return 1;
+#else
+        /* How could this be? We should not have a nid in a no-dh build. */
+        goto err;
+#endif
     }
 
     if (!ossl_prov_print_labeled_bignum(out, "P:   ", ffc->p))