Helper: Prepare KX groups (ECDH curve) from context settings
(
&self,
vm: &VirtualMachine,
)
| 3080 | |
| 3081 | /// Helper: Prepare KX groups (ECDH curve) from context settings |
| 3082 | fn prepare_kx_groups( |
| 3083 | &self, |
| 3084 | vm: &VirtualMachine, |
| 3085 | ) -> PyResult<Option<Vec<&'static dyn SupportedKxGroup>>> { |
| 3086 | let ctx = self.context.read(); |
| 3087 | let ecdh_curve = ctx.ecdh_curve.read().clone(); |
| 3088 | drop(ctx); |
| 3089 | |
| 3090 | if let Some(ref curve_name) = ecdh_curve { |
| 3091 | match curve_name_to_kx_group(curve_name) { |
| 3092 | Ok(groups) => Ok(Some(groups)), |
| 3093 | Err(e) => Err(vm.new_value_error(format!("Failed to set ECDH curve: {e}"))), |
| 3094 | } |
| 3095 | } else { |
| 3096 | Ok(None) |
| 3097 | } |
| 3098 | } |
| 3099 | |
| 3100 | /// Helper: Prepare all common protocol settings (versions, KX groups, ciphers, ALPN) |
| 3101 | fn prepare_protocol_settings(&self, vm: &VirtualMachine) -> PyResult<ProtocolSettings> { |
no test coverage detected