From: Arran Cudbard-Bell Date: Wed, 25 Aug 2021 16:44:24 +0000 (-0500) Subject: Move tls/utils functions into a new header X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d4107e690149c6fcc533f5ab378446e64a15ed5;p=thirdparty%2Ffreeradius-server.git Move tls/utils functions into a new header --- diff --git a/src/lib/tls/base-h b/src/lib/tls/base-h index 23fd8959fcb..e14053ad394 100644 --- a/src/lib/tls/base-h +++ b/src/lib/tls/base-h @@ -182,15 +182,6 @@ void fr_openssl_free(void); int fr_tls_dict_init(void); -/* - * tls/utils.c - */ -char const *fr_tls_utils_x509_pkey_type(X509 *cert); - -int fr_tls_utils_keyblock_size_get(request_t *request, SSL *ssl); - -int fr_tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1); - /* * tls/virtual_server.c */ diff --git a/src/lib/tls/ctx.c b/src/lib/tls/ctx.c index a71b601f5a4..6963d19bf9e 100644 --- a/src/lib/tls/ctx.c +++ b/src/lib/tls/ctx.c @@ -40,6 +40,7 @@ USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */ #include #include "base.h" +#include "utils.h" #include "log.h" #include "cert.h" diff --git a/src/lib/tls/log.c b/src/lib/tls/log.c index 61a38f73419..ff49a41d916 100644 --- a/src/lib/tls/log.c +++ b/src/lib/tls/log.c @@ -33,6 +33,7 @@ USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */ #include #include "log.h" +#include "utils.h" /** Holds the state of a log BIO * diff --git a/src/lib/tls/pairs.c b/src/lib/tls/pairs.c index 0eb32e61b49..7a13440c848 100644 --- a/src/lib/tls/pairs.c +++ b/src/lib/tls/pairs.c @@ -40,6 +40,7 @@ USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */ #include "bio.h" #include "log.h" #include "session.h" +#include "utils.h" DIAG_OFF(DIAG_UNKNOWN_PRAGMAS) DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */ diff --git a/src/lib/tls/utils.c b/src/lib/tls/utils.c index 1b9c1ac4055..0692de52f01 100644 --- a/src/lib/tls/utils.c +++ b/src/lib/tls/utils.c @@ -24,9 +24,7 @@ */ #include -#include - -#include "base.h" +#include "utils.h" /** PKEY types (friendly names) * diff --git a/src/lib/tls/utils.h b/src/lib/tls/utils.h new file mode 100644 index 00000000000..af6d72334aa --- /dev/null +++ b/src/lib/tls/utils.h @@ -0,0 +1,46 @@ +#pragma once +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#ifdef WITH_TLS +/** + * $Id$ + * + * @file lib/tls/utils.h + * @brief Miscellaneous TLS utility functions + * + * @copyright 2021 Arran Cudbard-Bell (a.cudbardb@freeradius.org) + */ +RCSIDH(utils_h, "$Id$") + +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +char const *fr_tls_utils_x509_pkey_type(X509 *cert); + +int fr_tls_utils_keyblock_size_get(request_t *request, SSL *ssl); + +int fr_tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1); + +#ifdef __cplusplus +} +#endif +#endif /* WITH_TLS */ diff --git a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c index 07e82677de5..e00723ebfb8 100644 --- a/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c +++ b/src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c @@ -28,9 +28,10 @@ RCSID("$Id$") #include "eap_fast.h" #include "eap_fast_crypto.h" +#include #include -#include #include +#include #define RANDFILL(x) do { fr_assert(sizeof(x) % sizeof(uint32_t) == 0); for (size_t i = 0; i < sizeof(x); i += sizeof(uint32_t)) *((uint32_t *)&x[i]) = fr_rand(); } while(0)