@@ -602,17 +602,17 @@ impl SslAlert {
602602
603603/// An error returned from an ALPN selection callback.
604604///
605- /// Requires OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
606- #[ cfg( any( ossl102, libressl261) ) ]
605+ /// Requires BoringSSL or OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
606+ #[ cfg( any( ossl102, libressl261, boringssl ) ) ]
607607#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
608608pub struct AlpnError ( c_int ) ;
609609
610- #[ cfg( any( ossl102, libressl261) ) ]
610+ #[ cfg( any( ossl102, libressl261, boringssl ) ) ]
611611impl AlpnError {
612612 /// Terminate the handshake with a fatal alert.
613613 ///
614- /// Requires OpenSSL 1.1.0 or newer.
615- #[ cfg( ossl110) ]
614+ /// Requires BoringSSL or OpenSSL 1.1.0 or newer.
615+ #[ cfg( any ( ossl110, boringssl ) ) ]
616616 pub const ALERT_FATAL : AlpnError = AlpnError ( ffi:: SSL_TLSEXT_ERR_ALERT_FATAL ) ;
617617
618618 /// Do not select a protocol, but continue the handshake.
@@ -1267,23 +1267,30 @@ impl SslContextBuilder {
12671267 /// of those protocols on success. The [`select_next_proto`] function implements the standard
12681268 /// protocol selection algorithm.
12691269 ///
1270- /// Requires OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
1270+ /// Requires BoringSSL or OpenSSL 1.0.2 or LibreSSL 2.6.1 or newer.
12711271 ///
12721272 /// [`SslContextBuilder::set_alpn_protos`]: struct.SslContextBuilder.html#method.set_alpn_protos
12731273 /// [`select_next_proto`]: fn.select_next_proto.html
12741274 #[ corresponds( SSL_CTX_set_alpn_select_cb ) ]
1275- #[ cfg( any( ossl102, libressl261) ) ]
1275+ #[ cfg( any( ossl102, libressl261, boringssl ) ) ]
12761276 pub fn set_alpn_select_callback < F > ( & mut self , callback : F )
12771277 where
12781278 F : for < ' a > Fn ( & mut SslRef , & ' a [ u8 ] ) -> Result < & ' a [ u8 ] , AlpnError > + ' static + Sync + Send ,
12791279 {
12801280 unsafe {
12811281 self . set_ex_data ( SslContext :: cached_ex_index :: < F > ( ) , callback) ;
1282+ #[ cfg( not( boringssl) ) ]
12821283 ffi:: SSL_CTX_set_alpn_select_cb__fixed_rust (
12831284 self . as_ptr ( ) ,
12841285 Some ( callbacks:: raw_alpn_select :: < F > ) ,
12851286 ptr:: null_mut ( ) ,
12861287 ) ;
1288+ #[ cfg( boringssl) ]
1289+ ffi:: SSL_CTX_set_alpn_select_cb (
1290+ self . as_ptr ( ) ,
1291+ Some ( callbacks:: raw_alpn_select :: < F > ) ,
1292+ ptr:: null_mut ( ) ,
1293+ ) ;
12871294 }
12881295 }
12891296
0 commit comments