You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2023/03/30 15:34:58 UTC

[trafficserver] branch master updated: Define BIO macros in ink_ssl.h (#9557)

This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 710e9d7c8 Define BIO macros in ink_ssl.h (#9557)
710e9d7c8 is described below

commit 710e9d7c86f476e3022c6e95aefa523638abc7d5
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Thu Mar 30 09:34:50 2023 -0600

    Define BIO macros in ink_ssl.h (#9557)
    
    * Define BIO macros in ink_ssl.h
    
    * Add license header
---
 CMakeLists.txt                    |  6 +++++
 configure.ac                      | 19 +++++---------
 include/tscore/ink_ssl.h          | 54 +++++++++++++++++++++++++++++++++++++++
 iocore/eventsystem/CMakeLists.txt |  3 ++-
 iocore/net/BIO_fastopen.h         |  1 +
 iocore/net/CMakeLists.txt         |  7 ++---
 src/traffic_server/CMakeLists.txt |  3 +--
 7 files changed, 74 insertions(+), 19 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f47c199ea..86e6ab972 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,6 +121,12 @@ endif(HAVE_IOURING AND USE_IOURING)
 list(APPEND CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
 list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
 check_symbol_exists(BIO_meth_new "openssl/bio.h" HAVE_BIO_METH_NEW)
+check_symbol_exists(BIO_set_data "openssl/bio.h" HAVE_BIO_SET_DATA)
+check_symbol_exists(BIO_get_data "openssl/bio.h" HAVE_BIO_GET_DATA)
+check_symbol_exists(BIO_get_shutdown "openssl/bio.h" HAVE_BIO_GET_SHUTDOWN)
+check_symbol_exists(BIO_meth_get_ctrl "openssl/bio.h" HAVE_BIO_METH_GET_CTRL)
+check_symbol_exists(BIO_meth_get_create "openssl/bio.h" HAVE_BIO_METH_GET_CREATE)
+check_symbol_exists(BIO_meth_get_destroy "openssl/bio.h" HAVE_BIO_METH_GET_DESTROY)
 check_symbol_exists(DH_get_2048_256 "openssl/dh.h" TS_USE_GET_DH_2048_256)
 
 # Catch2 for tests
diff --git a/configure.ac b/configure.ac
index bd11a61e3..9d1e82e5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1325,6 +1325,12 @@ TS_ADDTO([LIBS], ["$OPENSSL_LIBS"])
 
 AC_CHECK_FUNCS([ \
   BIO_meth_new \
+  BIO_set_data \
+  BIO_get_data \
+  BIO_get_shutdown \
+  BIO_meth_get_ctrl \
+  BIO_meth_get_create \
+  BIO_meth_get_destroy \
   BIO_sock_non_fatal_error \
   CRYPTO_set_mem_functions \
   HMAC_CTX_new \
@@ -1339,19 +1345,6 @@ AC_CHECK_FUNCS([ \
 AC_CHECK_FUNC([ASN1_STRING_get0_data], [],
               [AC_DEFINE([ASN1_STRING_get0_data], [ASN1_STRING_data], [Added in OpenSSL 1.1])])
 
-AC_CHECK_FUNC([BIO_set_data], [],
-              [AC_DEFINE([BIO_set_data(a, _ptr)], [((a)->ptr = (_ptr))], [Added in OpenSSL 1.1])])
-AC_CHECK_FUNC([BIO_get_data], [],
-              [AC_DEFINE([BIO_get_data(a)], [((a)->ptr)], [Added in OpenSSL 1.1])])
-AC_CHECK_FUNC([BIO_get_shutdown], [],
-              [AC_DEFINE([BIO_get_shutdown(a)], [((a)->shutdown)], [Added in OpenSSL 1.1])])
-AC_CHECK_FUNC([BIO_meth_get_ctrl], [],
-              [AC_DEFINE([BIO_meth_get_ctrl(biom)], [((biom)->ctrl)], [Added in OpenSSL 1.1])])
-AC_CHECK_FUNC([BIO_meth_get_create], [],
-              [AC_DEFINE([BIO_meth_get_create(biom)], [((biom)->create)], [Added in OpenSSL 1.1])])
-AC_CHECK_FUNC([BIO_meth_get_destroy], [],
-              [AC_DEFINE([BIO_meth_get_destroy(biom)], [((biom)->destroy)], [Added in OpenSSL 1.1])])
-
 AC_CHECK_FUNC([EVP_MD_CTX_new], [],
               [AC_DEFINE([EVP_MD_CTX_new], [EVP_MD_CTX_create], [Renamed in OpenSSL 1.1])])
 AC_CHECK_FUNC([EVP_MD_CTX_reset], [],
diff --git a/include/tscore/ink_ssl.h b/include/tscore/ink_ssl.h
new file mode 100644
index 000000000..4032f5a86
--- /dev/null
+++ b/include/tscore/ink_ssl.h
@@ -0,0 +1,54 @@
+/** @file
+
+  A brief file description
+
+  @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.
+ */
+
+#pragma once
+
+#if HAVE_BIO_SET_DATA == 0
+#define HAVE_BIO_SET_DATA     1
+#define BIO_set_data(a, _ptr) ((a)->ptr = (_ptr))
+#endif
+
+#if HAVE_BIO_GET_DATA == 0
+#define HAVE_BIO_GET_DATA 1
+#define BIO_get_data(a)   ((a)->ptr)
+#endif
+
+#if HAVE_BIO_GET_SHUTDOWN == 0
+#define HAVE_BIO_GET_SHUTDOWN 1
+#define BIO_get_shutdown(a)   ((a)->shutdown)
+#endif
+
+#if HAVE_BIO_METH_GET_CTRL == 0
+#define HAVE_BIO_METH_GET_CTRL  1
+#define BIO_meth_get_ctrl(biom) ((biom)->ctrl)
+#endif
+
+#if HAVE_BIO_METH_GET_CREATE == 0
+#define HAVE_BIO_METH_GET_CREATE  1
+#define BIO_meth_get_create(biom) ((biom)->create)
+#endif
+
+#if HAVE_BIO_METH_GET_DESTROY == 0
+#define HAVE_BIO_METH_GET_DESTROY  1
+#define BIO_meth_get_destroy(biom) ((biom)->destroy)
+#endif
diff --git a/iocore/eventsystem/CMakeLists.txt b/iocore/eventsystem/CMakeLists.txt
index c9dd05500..0fc3a53a1 100644
--- a/iocore/eventsystem/CMakeLists.txt
+++ b/iocore/eventsystem/CMakeLists.txt
@@ -33,6 +33,7 @@ add_library(inkevent SHARED
         UnixEvent.cc
         UnixEventProcessor.cc
         ConfigProcessor.cc
-        RecRawStatsImpl.cc)
+        RecRawStatsImpl.cc
+        RecProcess.cc)
 target_include_directories(inkevent PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
 target_link_libraries(inkevent ${PCRE_LIBRARIES} ${OPENSSL_LIBRARIES} yaml-cpp::yaml-cpp tscpputil resolv libswoc tscore records_p)
\ No newline at end of file
diff --git a/iocore/net/BIO_fastopen.h b/iocore/net/BIO_fastopen.h
index 58e66d98e..ce42e3be4 100644
--- a/iocore/net/BIO_fastopen.h
+++ b/iocore/net/BIO_fastopen.h
@@ -24,6 +24,7 @@
 #pragma once
 
 #include <openssl/bio.h>
+#include "tscore/ink_ssl.h"
 
 // Return a BIO_METHOD for a socket BIO that implements TCP Fast Open.
 const BIO_METHOD *BIO_s_fastopen();
diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt
index 8cef67aab..d3d616175 100644
--- a/iocore/net/CMakeLists.txt
+++ b/iocore/net/CMakeLists.txt
@@ -46,6 +46,7 @@ add_library(inknet STATIC
         SSLUtils.cc
         OCSPStapling.cc
         TLSBasicSupport.cc
+        TLSCertSwitchSupport.cc
         TLSEarlyDataSupport.cc
         TLSKeyLogger.cc
         TLSSessionResumptionSupport.cc
@@ -61,8 +62,8 @@ add_library(inknet STATIC
         UnixUDPConnection.cc
         UnixUDPNet.cc
         SSLDynlock.cc
-	SNIActionPerformer.cc
-)
+        SNIActionPerformer.cc
+        )
 target_link_libraries(inknet inkevent records_p)
 target_compile_options(inknet PUBLIC -Wno-deprecated-declarations)
 target_include_directories(inknet PRIVATE
@@ -81,7 +82,7 @@ target_include_directories(inknet PRIVATE
         ${CMAKE_SOURCE_DIR}/mgmt/utils
         ${OPENSSL_INCLUDE_DIRS}
         ${YAML_INCLUDE_DIRS}
-)
+        )
 
 # Fails to link because of circular dep with proxy (ParentSelection)
 # add_executable(test_net unit_tests/test_ProxyProtocol.cc)
diff --git a/src/traffic_server/CMakeLists.txt b/src/traffic_server/CMakeLists.txt
index bb263b567..5c3839215 100644
--- a/src/traffic_server/CMakeLists.txt
+++ b/src/traffic_server/CMakeLists.txt
@@ -25,8 +25,7 @@ add_executable(traffic_server
         SocksProxy.cc
         traffic_server.cc
         RpcAdminPubHandlers.cc
-        ${CMAKE_SOURCE_DIR}/src/shared/overridable_txn_vars.cc
-        RecProcess.h)
+        ${CMAKE_SOURCE_DIR}/src/shared/overridable_txn_vars.cc)
 target_include_directories(traffic_server PRIVATE
         ${IOCORE_INCLUDE_DIRS}
         ${PROXY_INCLUDE_DIRS}