diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index b3f81f914..7f6bffecc 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -27,6 +27,7 @@ #include #include + @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) diff --git a/Classes/LinphoneUI/UIConfirmationDialog.m b/Classes/LinphoneUI/UIConfirmationDialog.m index 6c8be2e3b..43d4955d3 100644 --- a/Classes/LinphoneUI/UIConfirmationDialog.m +++ b/Classes/LinphoneUI/UIConfirmationDialog.m @@ -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; } diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 3cd70aa67..3698ea617 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -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)) { diff --git a/Classes/Swift/Voip/Views/Fragments/CallStatsView.swift b/Classes/Swift/Voip/Views/Fragments/CallStatsView.swift index 0c10ae3e1..eb3f47718 100644 --- a/Classes/Swift/Voip/Views/Fragments/CallStatsView.swift +++ b/Classes/Swift/Voip/Views/Fragments/CallStatsView.swift @@ -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 + } } } diff --git a/Resources/images/post_quantum_secure@3x.png b/Resources/images/post_quantum_secure@3x.png new file mode 100644 index 000000000..586933335 Binary files /dev/null and b/Resources/images/post_quantum_secure@3x.png differ diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory index fde4f8242..d1c8531d2 100644 --- a/Resources/linphonerc-factory +++ b/Resources/linphonerc-factory @@ -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 diff --git a/Settings/InAppSettings.bundle/Call.plist b/Settings/InAppSettings.bundle/Call.plist index 2ce526c4a..c3488da92 100644 --- a/Settings/InAppSettings.bundle/Call.plist +++ b/Settings/InAppSettings.bundle/Call.plist @@ -142,6 +142,30 @@ DTLS + + DefaultValue + None + Key + media_encryption_preference_pq_enabled + Title + Media Encryption + Titles + + None + SRTP + ZRTP Post Quantum + DTLS + + Type + PSMultiValueSpecifier + Values + + None + SRTP + ZRTP + DTLS + + DefaultValue