File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3708,6 +3708,17 @@ impl SslRef {
37083708 pub fn ech_accepted ( & self ) -> bool {
37093709 unsafe { ffi:: SSL_ech_accepted ( self . as_ptr ( ) ) != 0 }
37103710 }
3711+
3712+ // Whether or not to enable ECH grease on `SSL`.
3713+ #[ cfg( not( feature = "fips" ) ) ]
3714+ #[ corresponds( SSL_set_enable_ech_grease ) ]
3715+ pub fn set_enable_ech_grease ( & self , enable : bool ) {
3716+ let enable = if enable { 1 } else { 0 } ;
3717+
3718+ unsafe {
3719+ ffi:: SSL_set_enable_ech_grease ( self . as_ptr ( ) , enable) ;
3720+ }
3721+ }
37113722}
37123723
37133724/// An SSL stream midway through the handshake process.
Original file line number Diff line number Diff line change @@ -58,3 +58,15 @@ fn ech_rejection() {
5858 assert ! ( failed_ssl_stream. ssl( ) . get_ech_retry_configs( ) . is_some( ) ) ;
5959 assert ! ( !failed_ssl_stream. ssl( ) . ech_accepted( ) )
6060}
61+
62+ #[ test]
63+ fn ech_grease ( ) {
64+ let server = Server :: builder ( ) . build ( ) ;
65+
66+ let mut client = server. client_with_root_ca ( ) . build ( ) . builder ( ) ;
67+ // Verified with a pcap locally that the ECH extension gets sent due to GREASE
68+ client. ssl ( ) . set_enable_ech_grease ( true ) ;
69+
70+ let ssl_stream = client. connect ( ) ;
71+ assert ! ( !ssl_stream. ssl( ) . ech_accepted( ) )
72+ }
You can’t perform that action at this time.
0 commit comments