Add Post quantum ZRTP support, encryption section to the call stats. Add zrtp_key_agreements_suites for post quantum in the factory rc

This commit is contained in:
QuentinArguillere 2022-08-18 11:48:01 +02:00
parent 2279a23db1
commit 2a54eae049
7 changed files with 74 additions and 7 deletions

View file

@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
@implementation LinphoneCoreSettingsStore
- (id)init {
@ -493,7 +494,7 @@
val = "None";
break;
}
[self setCString:val forKey:@"media_encryption_preference"];
[self setCString:val forKey:linphone_core_get_post_quantum_available() ? @"media_encryption_preference_pq_enabled" : @"media_encryption_preference"];
[self setInteger:linphone_core_get_upload_bandwidth(LC) forKey:@"upload_bandwidth_preference"];
[self setInteger:linphone_core_get_download_bandwidth(LC) forKey:@"download_bandwidth_preference"];
[self setBool:linphone_core_adaptive_rate_control_enabled(LC) forKey:@"adaptive_rate_control_preference"];
@ -1027,7 +1028,7 @@
[LinphoneCoreSettingsStore parsePortRange:video_port_preference minPort:&videoMinPort maxPort:&videoMaxPort];
linphone_core_set_video_port_range(LC, videoMinPort, videoMaxPort);
NSString *menc = [self stringForKey:@"media_encryption_preference"];
NSString *menc = [self stringForKey:linphone_core_get_post_quantum_available() ? @"media_encryption_preference_pq_enabled" : @"media_encryption_preference"];
if (menc && [menc compare:@"SRTP"] == NSOrderedSame)
linphone_core_set_media_encryption(LC, LinphoneMediaEncryptionSRTP);
else if (menc && [menc compare:@"ZRTP"] == NSOrderedSame)

View file

@ -48,6 +48,9 @@
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A.png"]] CGColor];
dialog.cancelButton.layer.borderColor =
[[UIColor colorWithPatternImage:[UIImage imageNamed:@"color_F.png"]] CGColor];
if (linphone_core_get_post_quantum_available()) {
[dialog.securityImage setImage:[UIImage imageNamed:@"post_quantum_secure.png"]];
}
return dialog;
}

View file

@ -555,11 +555,12 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
return [[IASKSpecifier alloc] initWithSpecifier:dict];
}
} else {
if ([[specifier key] isEqualToString:@"media_encryption_preference"]) {
BOOL pq_available = linphone_core_get_post_quantum_available();
if ([[specifier key] isEqualToString:pq_available ? @"media_encryption_preference_pq_enabled" : @"media_encryption_preference"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[specifier specifierDict]];
if (!linphone_core_media_encryption_supported(LC, LinphoneMediaEncryptionZRTP)) {
NSMutableArray *titles = [NSMutableArray arrayWithArray:[dict objectForKey:@"Titles"]];
[titles removeObject:@"ZRTP"];
[titles removeObject:pq_available ? @"ZRTP" : @"ZRTP Post Quantum"];
[dict setObject:titles forKey:@"Titles"];
NSMutableArray *values = [NSMutableArray arrayWithArray:[dict objectForKey:@"Values"]];
[values removeObject:@"ZRTP"];
@ -641,6 +642,13 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
}
if (!linphone_core_sip_transport_supported(LC, LinphoneTransportTls)) {
[hiddenKeys addObject:@"media_encryption_preference"];
[hiddenKeys addObject:@"media_encryption_preference_pq_enabled"];
} else {
if (linphone_core_get_post_quantum_available()) {
[hiddenKeys addObject:@"media_encryption_preference"];
} else {
[hiddenKeys addObject:@"media_encryption_preference_pq_enabled"];
}
}
if (!linphone_core_ldap_available(LC)) {

View file

@ -24,9 +24,9 @@ import linphonesw
// Layout constants
let side_margins = 10.0
let margin_top = 50
let margin_top = 25
let corner_radius = 20.0
let audio_video_margin = 20
let audio_video_margin = 13
init(superView:UIView, callData:CallData, marginTop:CGFloat, above:UIView, onDismissAction : @escaping ()->Void) {
super.init(frame:.zero)
@ -50,9 +50,20 @@ import linphonesw
let model = CallStatisticsData(call: callData.call)
let encryptionTitle = StyledLabel(VoipTheme.call_stats_font_title,NSLocalizedString("Encryption", comment: ""))
addSubview(encryptionTitle)
encryptionTitle.matchParentSideBorders().alignParentTop(withMargin: margin_top).done()
let encryptionStats = StyledLabel(VoipTheme.call_stats_font)
encryptionStats.numberOfLines = 0
addSubview(encryptionStats)
encryptionStats.matchParentSideBorders().alignUnder(view: encryptionTitle).done()
let audioTitle = StyledLabel(VoipTheme.call_stats_font_title,NSLocalizedString("Audio", comment: ""))
addSubview(audioTitle)
audioTitle.matchParentSideBorders().alignParentTop(withMargin: margin_top).done()
audioTitle.alignUnder(view: encryptionStats, withMargin:audio_video_margin).matchParentSideBorders().done()
let audioStats = StyledLabel(VoipTheme.call_stats_font)
@ -86,6 +97,25 @@ import linphonesw
stats += "\n\($0.getTypeTitle())\($0.value.value ?? "n/a")"
}
videoStats.text = stats
if let lc = model.call.core {
stats = ""
switch (lc.mediaEncryption) {
case MediaEncryption.None: stats += "\nNone"
case MediaEncryption.SRTP: stats += "\nSRTP"
case MediaEncryption.DTLS: stats += "\nDTLS"
case MediaEncryption.ZRTP:
if let callstats = model.call.audioStats {
stats += (model.call.audioStats?.isZrtpKeyAgreementAlgoPostQuantum ?? false) ?"\nZRTP" : "\nPost Quantum ZRTP"
stats += "\nCipher algorithm: \(callstats.zrtpCipherAlgo)"
stats += "\nKey agreement algorithm: \(callstats.zrtpKeyAgreementAlgo)"
stats += "\nHash algorithm: \(callstats.zrtpHashAlgo)"
stats += "\nAuth tag algorithm: \(callstats.zrtpAuthTagAlgo)"
stats += "\nSas algorithm: \(callstats.zrtpSasAlgo)"
}
}
encryptionStats.text = stats
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -31,6 +31,7 @@ accept_early_media=0
[sip]
deliver_imdn=1
linphone_specs=groupchat,lime
zrtp_key_agreements_suites=MS_ZRTP_KEY_AGREEMENT_K255_KYB512
[misc]
version_check_url_root=https://linphone.org/releases

View file

@ -142,6 +142,30 @@
<string>DTLS</string>
</array>
</dict>
<dict>
<key>DefaultValue</key>
<string>None</string>
<key>Key</key>
<string>media_encryption_preference_pq_enabled</string>
<key>Title</key>
<string>Media Encryption</string>
<key>Titles</key>
<array>
<string>None</string>
<string>SRTP</string>
<string>ZRTP Post Quantum</string>
<string>DTLS</string>
</array>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Values</key>
<array>
<string>None</string>
<string>SRTP</string>
<string>ZRTP</string>
<string>DTLS</string>
</array>
</dict>
<dict>
<key>DefaultValue</key>
<false/>