]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move tls/utils functions into a new header
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 25 Aug 2021 16:44:24 +0000 (11:44 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 25 Aug 2021 17:18:56 +0000 (12:18 -0500)
src/lib/tls/base-h
src/lib/tls/ctx.c
src/lib/tls/log.c
src/lib/tls/pairs.c
src/lib/tls/utils.c
src/lib/tls/utils.h [new file with mode: 0644]
src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c

index 23fd8959fcb165b952e3806f8bae9cac2acad649..e14053ad39483458cb7ad43fc7ad718932522a47 100644 (file)
@@ -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
  */
index a71b601f5a4bb8355c4ce5752c6b8b4ee672ac87..6963d19bf9ea7b5988c0740fb108a6ffbf9bcc71 100644 (file)
@@ -40,6 +40,7 @@ USES_APPLE_DEPRECATED_API     /* OpenSSL API has been deprecated by Apple */
 #include <openssl/dh.h>
 
 #include "base.h"
+#include "utils.h"
 #include "log.h"
 #include "cert.h"
 
index 61a38f7341951ac505a94d5f1dc0bdc60e66072e..ff49a41d916a5254983d43aa2690807c2ebb209a 100644 (file)
@@ -33,6 +33,7 @@ USES_APPLE_DEPRECATED_API     /* OpenSSL API has been deprecated by Apple */
 #include <freeradius-devel/util/debug.h>
 
 #include "log.h"
+#include "utils.h"
 
 /** Holds the state of a log BIO
  *
index 0eb32e61b49e3409d13745784b81264965faf67e..7a13440c848d8a86f26d3ae6e0b9098bc4e5c261 100644 (file)
@@ -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 */
index 1b9c1ac405534fda1e7457491ed15e4d83b5d1f3..0692de52f01f337ab3fefc345b5d7273dcf10be0 100644 (file)
@@ -24,9 +24,7 @@
  */
 
 #include <openssl/ssl.h>
-#include <freeradius-devel/server/base.h>
-
-#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 (file)
index 0000000..af6d723
--- /dev/null
@@ -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 <openssl/ssl.h>
+
+#include <freeradius-devel/util/time.h>
+#include <freeradius-devel/server/request.h>
+
+#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 */
index 07e82677de5d8809929271e2af61755751edd6bb..e00723ebfb879a11b14686a3dd3fd2fbd2a54828 100644 (file)
@@ -28,9 +28,10 @@ RCSID("$Id$")
 
 #include "eap_fast.h"
 #include "eap_fast_crypto.h"
+#include <freeradius-devel/tls/utils.h>
 #include <freeradius-devel/util/sha1.h>
-#include <openssl/ssl.h>
 #include <openssl/rand.h>
+#include <openssl/ssl.h>
 
 #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)