res_srtp: Enable AES-256 and AES-GCM.

ASTERISK-26190 #close

Change-Id: I11326d80edd656524a51a19450e586c583aa0a0b
This commit is contained in:
Alexander Traud
2016-07-13 12:24:46 +02:00
parent c2a72e6aa6
commit 1d2173c7ae
9 changed files with 811 additions and 119 deletions

View File

@@ -284,6 +284,7 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/features_config.h"
#include "asterisk/http_websocket.h"
#include "asterisk/format_cache.h"
#include "asterisk/linkedlists.h" /* for AST_LIST_NEXT */
/*** DOCUMENTATION
<application name="SIPDtmfMode" language="en_US">
@@ -13220,21 +13221,34 @@ static void get_our_media_address(struct sip_pvt *p, int needvideo, int needtext
static char *crypto_get_attrib(struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32)
{
struct ast_sdp_srtp *tmp = srtp;
char *a_crypto;
const char *orig_crypto;
if (!srtp || dtls_enabled) {
if (!tmp || dtls_enabled) {
return NULL;
}
orig_crypto = ast_sdp_srtp_get_attrib(srtp, dtls_enabled, default_taglen_32);
if (ast_strlen_zero(orig_crypto)) {
a_crypto = ast_strdup("");
if (!a_crypto) {
return NULL;
}
if (ast_asprintf(&a_crypto, "a=crypto:%s\r\n", orig_crypto) == -1) {
return NULL;
}
do {
char *copy = a_crypto;
const char *orig_crypto = ast_sdp_srtp_get_attrib(tmp, dtls_enabled, default_taglen_32);
if (ast_strlen_zero(orig_crypto)) {
ast_free(copy);
return NULL;
}
if (ast_asprintf(&a_crypto, "%sa=crypto:%s\r\n", copy, orig_crypto) == -1) {
ast_free(copy);
return NULL;
}
ast_free(copy);
} while ((tmp = AST_LIST_NEXT(tmp, sdp_srtp_list)));
return a_crypto;
}