File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2785,6 +2785,17 @@ impl SslRef {
27852785 }
27862786 }
27872787
2788+ /// Returns the curve ID (aka group ID) used for this `SslRef`.
2789+ #[ corresponds( SSL_get_curve_id ) ]
2790+ #[ must_use]
2791+ pub fn curve ( & self ) -> Option < u16 > {
2792+ let curve_id = unsafe { ffi:: SSL_get_curve_id ( self . as_ptr ( ) ) } ;
2793+ if curve_id == 0 {
2794+ return None ;
2795+ }
2796+ Some ( curve_id)
2797+ }
2798+
27882799 /// Returns an `ErrorCode` value for the most recent operation on this `SslRef`.
27892800 #[ corresponds( SSL_get_error ) ]
27902801 #[ must_use]
Original file line number Diff line number Diff line change @@ -951,6 +951,15 @@ fn sni_callback_swapped_ctx() {
951951 assert ! ( CALLED_BACK . load( Ordering :: SeqCst ) ) ;
952952}
953953
954+ #[ test]
955+ fn get_curve ( ) {
956+ let server = Server :: builder ( ) . build ( ) ;
957+ let client = server. client_with_root_ca ( ) ;
958+ let client_stream = client. connect ( ) ;
959+ let curve = client_stream. ssl ( ) . curve ( ) ;
960+ assert ! ( curve. is_some( ) ) ;
961+ }
962+
954963#[ test]
955964fn test_get_ciphers ( ) {
956965 let ctx_builder = SslContext :: builder ( SslMethod :: tls ( ) ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments