[Asterisk-code-review] chan_iax2: Add RSA encryption (asterisk[master])
N A
asteriskteam at digium.com
Mon May 24 13:05:30 CDT 2021
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15948 )
Change subject: chan_iax2: Add RSA encryption
......................................................................
chan_iax2: Add RSA encryption
Adds support for RSA encryption to IAX2.
Also prevents crashes if an IAX2 is initiated
to a switch requiring RSA encryption but
no secret is provided.
ASTERISK-29264
Change-Id: I18f1f9d7c59b4f9cffa00f3b94a4c875846efd40
---
M channels/chan_iax2.c
1 file changed, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/15948/1
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 4122c04..41e4097 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -8374,6 +8374,18 @@
res = 0;
}
}
+
+ if (pvt && !ast_strlen_zero(secret)) {
+ struct MD5Context md5;
+ unsigned char digest[16];
+
+ MD5Init(&md5);
+ MD5Update(&md5, (unsigned char *) challenge, strlen(challenge));
+ MD5Update(&md5, (unsigned char *) secret, strlen(secret));
+ MD5Final(digest, &md5);
+
+ build_encryption_keys(digest, pvt);
+ }
}
}
/* Fall back */
@@ -10942,8 +10954,8 @@
}
break;
}
- if (iaxs[fr->callno]->authmethods & IAX_AUTH_MD5)
- merge_encryption(iaxs[fr->callno],ies.encmethods);
+ if (iaxs[fr->callno]->authmethods & (IAX_AUTH_MD5 | IAX_AUTH_RSA))
+ merge_encryption(iaxs[fr->callno], ies.encmethods);
else
iaxs[fr->callno]->encmethods = 0;
if (!authenticate_request(fr->callno) && iaxs[fr->callno])
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15948
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I18f1f9d7c59b4f9cffa00f3b94a4c875846efd40
Gerrit-Change-Number: 15948
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210524/022d16a9/attachment.html>
More information about the asterisk-code-review
mailing list