JosiahWI commented on code in PR #13349:
URL: https://github.com/apache/trafficserver/pull/13349#discussion_r3494251495


##########
src/iocore/net/SSLKeyUtils.cc:
##########
@@ -0,0 +1,186 @@
+/** @file
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "SSLKeyUtils.h"
+#include "P_SSLUtils.h"
+
+#include <tscore/Diags.h>
+#ifdef OPENSSL_IS_OPENSSL3
+#include <tscore/ink_assert.h>
+#else
+#include <tscore/ink_config.h>
+#endif
+
+#ifdef OPENSSL_IS_OPENSSL3
+#include <openssl/evp.h>
+#include <openssl/decoder.h>
+#include <openssl/params.h>
+#include <openssl/ssl.h>
+#else
+#include <openssl/bio.h>
+#include <openssl/bn.h>
+#include <openssl/pem.h>
+#include <openssl/ssl.h>
+#endif
+
+#ifdef OPENSSL_IS_OPENSSL3
+
+EVP_PKEY *
+gen_dh_2048_256_pkey()
+{
+  scoped_PKEY_CTX pctx{EVP_PKEY_CTX_new_from_name(NULL, "DH", NULL)};
+  if (!pctx) {
+    Error("failed to create OpenSSL pkey context");
+    return nullptr;
+  }
+
+  if (EVP_PKEY_keygen_init(pctx.get()) <= 0) {
+    Error("failed to initialize OpenSSL keygen");
+    return nullptr;
+  }
+
+  char             prime_group[]{"dh_2048_256"};
+  OSSL_PARAM const params[]{OSSL_PARAM_utf8_string("group", prime_group, 
sizeof(prime_group) - 1), OSSL_PARAM_END};
+
+  if (!EVP_PKEY_CTX_set_params(pctx.get(), params)) {

Review Comment:
   This is where I want to use the `EVP_PKEY_CTX_set_dh_rfc5114` function 
instead of manually setting parameters.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to