[Asterisk-code-review] tcptls.h: Repair ./configure --with-ssl=PATH. (asterisk[master])
George Joseph
asteriskteam at digium.com
Tue Jun 5 14:21:16 CDT 2018
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/9057 )
Change subject: tcptls.h: Repair ./configure --with-ssl=PATH.
......................................................................
tcptls.h: Repair ./configure --with-ssl=PATH.
asterisk/tcptls.h was included (explicitly, implicitly, or transitively). Those
inclusions got replaced by forward declarations. As side effect, the inclusions
got completed.
ASTERISK-27878
Change-Id: I9d102728e30336d6522e5e4ae9e964013a0835f7
---
M include/asterisk/iostream.h
M include/asterisk/tcptls.h
M main/Makefile
M main/iostream.c
M main/tcptls.c
5 files changed, 71 insertions(+), 42 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/include/asterisk/iostream.h b/include/asterisk/iostream.h
index b4cdeb2..17376ea 100644
--- a/include/asterisk/iostream.h
+++ b/include/asterisk/iostream.h
@@ -25,21 +25,19 @@
* \brief Generic abstraction for input/output streams.
*/
+#include "asterisk.h" /* for size_t, ssize_t, HAVE_OPENSSL */
+
#if defined(HAVE_OPENSSL)
#define DO_SSL /* comment in/out if you want to support ssl */
#endif
-#ifdef DO_SSL
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-#include <openssl/x509v3.h>
-#else
-/* declare dummy types so we can define a pointer to them */
-typedef struct {} SSL;
-typedef struct {} SSL_CTX;
-#endif /* DO_SSL */
+struct ssl_st; /* forward declaration */
+struct ssl_ctx_st; /* forward declaration */
+struct timeval; /* forward declaration */
+typedef struct ssl_st SSL;
+typedef struct ssl_ctx_st SSL_CTX;
-struct ast_iostream;
+struct ast_iostream; /* forward declaration */
/*!
* \brief Disable the iostream timeout timer.
diff --git a/include/asterisk/tcptls.h b/include/asterisk/tcptls.h
index 9cf9fd6..0a6e25e 100644
--- a/include/asterisk/tcptls.h
+++ b/include/asterisk/tcptls.h
@@ -46,18 +46,20 @@
* be run earlier in the startup process so modules have it available.
*
* \ref AstTlsOverview
- *
- * \todo For SIP, the SubjectAltNames should be checked on verification
- * of the certificate. (Check RFC 5922)
- *
*/
#ifndef _ASTERISK_TCPTLS_H
#define _ASTERISK_TCPTLS_H
-#include "asterisk/netsock2.h"
-#include "asterisk/utils.h"
+#include <pthread.h> /* for pthread_t */
+#include <sys/param.h> /* for MAXHOSTNAMELEN */
+
#include "asterisk/iostream.h"
+#include "asterisk/netsock2.h" /* for ast_sockaddr */
+#include "asterisk/utils.h" /* for ast_flags */
+
+struct ssl_ctx_st; /* forward declaration */
+typedef struct ssl_ctx_st SSL_CTX;
/*! SSL support */
#define AST_CERTFILE "asterisk.pem"
diff --git a/main/Makefile b/main/Makefile
index 393ad1a..5f02937 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -306,6 +306,7 @@
endif
+iostream.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE)
tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) -Wno-deprecated-declarations
$(MAIN_TGT): $(OBJS) $(MOD_OBJS) $(ASTSSL_LIB) $(ASTPJ_LIB)
diff --git a/main/iostream.c b/main/iostream.c
index 4cddd43..58c7f1e 100644
--- a/main/iostream.c
+++ b/main/iostream.c
@@ -18,12 +18,23 @@
#include "asterisk.h"
-#include <fcntl.h>
-#include <stdarg.h>
+#include "asterisk/iostream.h" /* for DO_SSL */
-#include "asterisk/utils.h"
-#include "asterisk/astobj2.h"
-#include "asterisk/iostream.h"
+#include <fcntl.h> /* for O_NONBLOCK */
+#ifdef DO_SSL
+#include <openssl/err.h> /* for ERR_error_string */
+#include <openssl/opensslv.h> /* for OPENSSL_VERSION_NUMBER */
+#include <openssl/ssl.h> /* for SSL_get_error, SSL_free, SSL_... */
+#endif
+#include <sys/socket.h> /* for shutdown, SHUT_RDWR */
+#include <sys/time.h> /* for timeval */
+
+#include "asterisk/astobj2.h" /* for ao2_alloc_options, ao2_alloc_... */
+#include "asterisk/logger.h" /* for ast_debug, ast_log, LOG_ERROR */
+#include "asterisk/strings.h" /* for asterisk/threadstorage.h */
+#include "asterisk/threadstorage.h" /* for ast_threadstorage_get, AST_TH... */
+#include "asterisk/time.h" /* for ast_remaining_ms, ast_tvnow */
+#include "asterisk/utils.h" /* for ast_wait_for_input, ast_wait_... */
struct ast_iostream {
SSL *ssl;
diff --git a/main/tcptls.c b/main/tcptls.c
index 8ffeabb..8507391 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
@@ -25,31 +25,48 @@
* \author Brett Bryant <brettbryant at gmail.com>
*/
-/*** MODULEINFO
- <use type="external">openssl</use>
- <support_level>core</support_level>
- ***/
-
#include "asterisk.h"
+#include "asterisk/tcptls.h" /* for ast_tls_config, ast_tcptls_se... */
+#include "asterisk/iostream.h" /* for DO_SSL, ast_iostream_close, a... */
+
#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
+#include <fcntl.h> /* for O_NONBLOCK */
+#endif /* HAVE_FCNTL_H */
+#include <netinet/in.h> /* for IPPROTO_TCP */
+#ifdef DO_SSL
+#include <openssl/asn1.h> /* for ASN1_STRING_to_UTF8 */
+#include <openssl/crypto.h> /* for OPENSSL_free */
+#include <openssl/opensslconf.h> /* for OPENSSL_NO_SSL3_METHOD, OPENS... */
+#include <openssl/opensslv.h> /* for OPENSSL_VERSION_NUMBER */
+#include <openssl/safestack.h> /* for STACK_OF */
+#include <openssl/ssl.h> /* for SSL_CTX_free, SSL_get_error, ... */
+#include <openssl/x509.h> /* for X509_free, X509_NAME_ENTRY_ge... */
+#include <openssl/x509v3.h> /* for GENERAL_NAME, sk_GENERAL_NAME... */
+#ifndef OPENSSL_NO_DH
+#include <openssl/bio.h> /* for BIO_free, BIO_new_file */
+#include <openssl/dh.h> /* for DH_free */
+#include <openssl/pem.h> /* for PEM_read_bio_DHparams */
+#endif /* OPENSSL_NO_DH */
+#ifndef OPENSSL_NO_EC
+#include <openssl/ec.h> /* for EC_KEY_free, EC_KEY_new_by_cu... */
+#endif /* OPENSSL_NO_EC */
+#endif /* DO_SSL */
+#include <pthread.h> /* for pthread_cancel, pthread_join */
+#include <signal.h> /* for pthread_kill, SIGURG */
+#include <sys/socket.h> /* for setsockopt, shutdown, socket */
+#include <sys/stat.h> /* for stat */
-#include <signal.h>
-#include <sys/stat.h>
-
-#include "asterisk/compat.h"
-#include "asterisk/tcptls.h"
-#include "asterisk/io.h"
-#include "asterisk/http.h"
-#include "asterisk/utils.h"
-#include "asterisk/strings.h"
-#include "asterisk/options.h"
-#include "asterisk/manager.h"
-#include "asterisk/astobj2.h"
-#include "asterisk/pbx.h"
-#include "asterisk/app.h"
+#include "asterisk/app.h" /* for ast_read_textfile */
+#include "asterisk/astobj2.h" /* for ao2_ref, ao2_t_ref, ao2_alloc */
+#include "asterisk/compat.h" /* for strcasecmp */
+#include "asterisk/config.h" /* for ast_parse_arg, ast_parse_flag... */
+#include "asterisk/io.h" /* for ast_sd_get_fd */
+#include "asterisk/lock.h" /* for AST_PTHREADT_NULL */
+#include "asterisk/logger.h" /* for ast_log, LOG_ERROR, ast_debug */
+#include "asterisk/netsock2.h" /* for ast_sockaddr_copy, ast_sockad... */
+#include "asterisk/pbx.h" /* for ast_thread_inhibit_escalations */
+#include "asterisk/utils.h" /* for ast_true, ast_free, ast_wait_... */
static void session_instance_destructor(void *obj)
{
--
To view, visit https://gerrit.asterisk.org/9057
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I9d102728e30336d6522e5e4ae9e964013a0835f7
Gerrit-Change-Number: 9057
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180605/0769a098/attachment-0001.html>
More information about the asterisk-code-review
mailing list