Commit 07849de2 authored by johan's avatar johan

Fix zrtp b256 patch for C89 compliance

parent 90ba818c
...@@ -1601,13 +1601,15 @@ static char * seperate_string_list(char **str) { ...@@ -1601,13 +1601,15 @@ static char * seperate_string_list(char **str) {
MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreement_suites(LinphoneCore *lc, MSZrtpKeyAgreement keyAgreements[MS_MAX_ZRTP_CRYPTO_TYPES]){ MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreement_suites(LinphoneCore *lc, MSZrtpKeyAgreement keyAgreements[MS_MAX_ZRTP_CRYPTO_TYPES]){
char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_key_agreements_suites", NULL); char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_key_agreements_suites", NULL);
if (zrtpConfig == NULL) MsZrtpCryptoTypesCount key_agreements_count = 0;
return 0; char * entry, * origPtr;
if (zrtpConfig == NULL) {
return 0;
}
MsZrtpCryptoTypesCount key_agreements_count = 0; origPtr = strdup(zrtpConfig);
char * entry, * origPtr = strdup(zrtpConfig); zrtpConfig = origPtr;
zrtpConfig = origPtr; while ((entry = seperate_string_list(&zrtpConfig))) {
while ((entry = seperate_string_list(&zrtpConfig))) {
const MSZrtpKeyAgreement agreement = ms_zrtp_key_agreement_from_string(entry); const MSZrtpKeyAgreement agreement = ms_zrtp_key_agreement_from_string(entry);
if (agreement != MS_ZRTP_KEY_AGREEMENT_INVALID) { if (agreement != MS_ZRTP_KEY_AGREEMENT_INVALID) {
ms_message("Configured zrtp key agreement: '%s'", ms_zrtp_key_agreement_to_string(agreement)); ms_message("Configured zrtp key agreement: '%s'", ms_zrtp_key_agreement_to_string(agreement));
...@@ -1615,18 +1617,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreement_suites(LinphoneCore ...@@ -1615,18 +1617,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreement_suites(LinphoneCore
} }
} }
free(origPtr); free(origPtr);
return key_agreements_count; return key_agreements_count;
} }
MsZrtpCryptoTypesCount linphone_core_get_zrtp_cipher_suites(LinphoneCore *lc, MSZrtpCipher ciphers[MS_MAX_ZRTP_CRYPTO_TYPES]){ MsZrtpCryptoTypesCount linphone_core_get_zrtp_cipher_suites(LinphoneCore *lc, MSZrtpCipher ciphers[MS_MAX_ZRTP_CRYPTO_TYPES]){
char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_cipher_suites", NULL); char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_cipher_suites", NULL);
if (zrtpConfig == NULL) MsZrtpCryptoTypesCount cipher_count = 0;
return 0; char * entry, * origPtr;
if (zrtpConfig == NULL) {
return 0;
}
MsZrtpCryptoTypesCount cipher_count = 0; origPtr = strdup(zrtpConfig);
char * entry, * origPtr = strdup(zrtpConfig); zrtpConfig = origPtr;
zrtpConfig = origPtr;
while ((entry = seperate_string_list(&zrtpConfig))) { while ((entry = seperate_string_list(&zrtpConfig))) {
const MSZrtpCipher cipher = ms_zrtp_cipher_from_string(entry); const MSZrtpCipher cipher = ms_zrtp_cipher_from_string(entry);
if (cipher != MS_ZRTP_CIPHER_INVALID) { if (cipher != MS_ZRTP_CIPHER_INVALID) {
...@@ -1635,18 +1639,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_cipher_suites(LinphoneCore *lc, MS ...@@ -1635,18 +1639,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_cipher_suites(LinphoneCore *lc, MS
} }
} }
free(origPtr); free(origPtr);
return cipher_count; return cipher_count;
} }
MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZrtpHash hashes[MS_MAX_ZRTP_CRYPTO_TYPES]){ MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZrtpHash hashes[MS_MAX_ZRTP_CRYPTO_TYPES]){
char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_hash_suites", NULL); char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_hash_suites", NULL);
if (zrtpConfig == NULL)
return 0;
MsZrtpCryptoTypesCount hash_count = 0; MsZrtpCryptoTypesCount hash_count = 0;
char * entry, * origPtr = strdup(zrtpConfig); char * entry, * origPtr;
zrtpConfig = origPtr; if (zrtpConfig == NULL) {
return 0;
}
origPtr = strdup(zrtpConfig);
zrtpConfig = origPtr;
while ((entry = seperate_string_list(&zrtpConfig))) { while ((entry = seperate_string_list(&zrtpConfig))) {
const MSZrtpHash hash = ms_zrtp_hash_from_string(entry); const MSZrtpHash hash = ms_zrtp_hash_from_string(entry);
if (hash != MS_ZRTP_HASH_INVALID) { if (hash != MS_ZRTP_HASH_INVALID) {
...@@ -1655,18 +1661,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZr ...@@ -1655,18 +1661,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZr
} }
} }
free(origPtr); free(origPtr);
return hash_count; return hash_count;
} }
MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MSZrtpAuthTag authTags[MS_MAX_ZRTP_CRYPTO_TYPES]){ MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MSZrtpAuthTag authTags[MS_MAX_ZRTP_CRYPTO_TYPES]){
char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_auth_suites", NULL); char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_auth_suites", NULL);
if (zrtpConfig == NULL)
return 0;
MsZrtpCryptoTypesCount auth_tag_count = 0; MsZrtpCryptoTypesCount auth_tag_count = 0;
char * entry, * origPtr = strdup(zrtpConfig); char * entry, * origPtr;
zrtpConfig = origPtr; if (zrtpConfig == NULL) {
return 0;
}
origPtr = strdup(zrtpConfig);
zrtpConfig = origPtr;
while ((entry = seperate_string_list(&zrtpConfig))) { while ((entry = seperate_string_list(&zrtpConfig))) {
const MSZrtpAuthTag authTag = ms_zrtp_auth_tag_from_string(entry); const MSZrtpAuthTag authTag = ms_zrtp_auth_tag_from_string(entry);
if (authTag != MS_ZRTP_AUTHTAG_INVALID) { if (authTag != MS_ZRTP_AUTHTAG_INVALID) {
...@@ -1675,18 +1683,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MSZr ...@@ -1675,18 +1683,20 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MSZr
} }
} }
free(origPtr); free(origPtr);
return auth_tag_count; return auth_tag_count;
} }
MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrtpSasType sasTypes[MS_MAX_ZRTP_CRYPTO_TYPES]){ MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrtpSasType sasTypes[MS_MAX_ZRTP_CRYPTO_TYPES]){
char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_sas_suites", NULL); char * zrtpConfig = (char*)lp_config_get_string(lc->config, "sip", "zrtp_sas_suites", NULL);
if (zrtpConfig == NULL)
return 0;
MsZrtpCryptoTypesCount sas_count = 0; MsZrtpCryptoTypesCount sas_count = 0;
char * entry, * origPtr = strdup(zrtpConfig); char * entry, * origPtr;
zrtpConfig = origPtr; if (zrtpConfig == NULL) {
return 0;
}
origPtr = strdup(zrtpConfig);
zrtpConfig = origPtr;
while ((entry = seperate_string_list(&zrtpConfig))) { while ((entry = seperate_string_list(&zrtpConfig))) {
const MSZrtpSasType type = ms_zrtp_sas_type_from_string(entry); const MSZrtpSasType type = ms_zrtp_sas_type_from_string(entry);
if (type != MS_ZRTP_SAS_INVALID) { if (type != MS_ZRTP_SAS_INVALID) {
...@@ -1695,7 +1705,7 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrt ...@@ -1695,7 +1705,7 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrt
} }
} }
free(origPtr); free(origPtr);
return sas_count; return sas_count;
} }
......
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