Commit e2dbfd54 authored by Ben Sartor's avatar Ben Sartor Committed by johan

configfile now supports setting zrtps key agreements

Signed-off-by: johan's avatarJohan Pascal <johan.pascal@belledonne-communications.com>
parent cc8a3a9f
......@@ -2702,6 +2702,8 @@ static void setZrtpCryptoTypesParameters(MSZrtpParams *params, LinphoneCore *lc)
}
}
}
params->keyAgreementsCount = linphone_core_get_zrtp_key_agreements(lc, params->keyAgreements);
}
void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_muted, bool_t send_ringbacktone){
......
......@@ -1581,6 +1581,41 @@ const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc){
return result;
}
static char * seperate_string_list(char **str) {
char *ret;
if (str == NULL) return NULL;
if (*str == NULL) return NULL;
if (**str == '\0') return NULL;
ret = *str;
for ( ; **str!='\0' && **str!=' ' && **str!=','; (*str)++);
if (**str == '\0') {
return ret;
} else {
**str = '\0';
do { (*str)++; } while (**str!='\0' && (**str==' ' || **str==','));
return ret;
}
}
MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreements(LinphoneCore *lc, MSZrtpKeyAgreement keyAgreements[MS_MAX_ZRTP_CRYPTO_TYPES]){
char *config=strdup(lp_config_get_string(lc->config, "sip", "zrtp_key_agreements_suites", "MS_ZRTP_KEY_AGREEMENT_DH3K, MS_ZRTP_KEY_AGREEMENT_DH2K"));
char *entry;
MsZrtpCryptoTypesCount key_agreements_count = 0;
if (config == NULL) return 0;
while ((entry = seperate_string_list(&config))) {
const MSZrtpKeyAgreement agreement = ms_zrtp_key_agreement_from_string(entry);
if (agreement != MS_ZRTP_KEY_AGREEMENT_INVALID) {
ms_message("Configured zrtp key agreement: '%s'", ms_zrtp_key_agreement_to_string(agreement));
keyAgreements[key_agreements_count++] = agreement;
}
}
return key_agreements_count;
}
const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){
......
......@@ -1048,6 +1048,7 @@ static MS2_INLINE bool_t payload_type_enabled(const PayloadType *pt) {
bool_t is_payload_type_number_available(const MSList *l, int number, const PayloadType *ignore);
const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc);
MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreements(LinphoneCore *lc, MSZrtpKeyAgreement keyAgreements[MS_MAX_ZRTP_CRYPTO_TYPES]);
/** Belle Sip-based objects need unique ids
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment