Merge "res_srtp: Enable AES-256 and AES-GCM."

This commit is contained in:
zuul
2016-07-21 21:11:07 -05:00
committed by Gerrit Code Review
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">
@@ -13222,21 +13223,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;
}