From 5f60caa4028a8d0e42493df5c4b3777e8b1a68b3 Mon Sep 17 00:00:00 2001
From: Naveen Albert <asterisk@phreaknet.org>
Date: Mon, 4 Jul 2022 10:21:24 +0000
Subject: [PATCH] chan_iax2: Allow compiling without OpenSSL.

ASTERISK_30007 accidentally made OpenSSL a
required depdendency. This adds an ifdef so
the relevant code is compiled only if OpenSSL
is available, since it only needs to be executed
if OpenSSL is available anyways.

ASTERISK-30083 #close

Change-Id: Iad05c1a9a8bd2a48e7edf8d234eaa9f80779e34d
---
 channels/chan_iax2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 210c34417a..6ff1896a7e 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -6381,6 +6381,7 @@ static void build_rand_pad(unsigned char *buf, ssize_t len)
 
 static int invalid_key(ast_aes_decrypt_key *ecx)
 {
+#ifdef HAVE_OPENSSL
 	int i;
 	for (i = 0; i < 60; i++) {
 		if (ecx->rd_key[i]) {
@@ -6389,6 +6390,9 @@ static int invalid_key(ast_aes_decrypt_key *ecx)
 	}
 	/* if ast_aes_encrypt or ast_aes_decrypt is called, then we'll crash when calling AES_encrypt or AES_decrypt */
 	return -1;
+#else
+	return 0; /* Can't verify, but doesn't matter anyways */
+#endif
 }
 
 static void build_encryption_keys(const unsigned char *digest, struct chan_iax2_pvt *pvt)
-- 
GitLab