@@ -82,7 +82,7 @@ use crate::x509::store::{X509Store, X509StoreBuilderRef, X509StoreRef};
82
82
#[ cfg( any( ossl102, boringssl, libressl261) ) ]
83
83
use crate :: x509:: verify:: X509VerifyParamRef ;
84
84
use crate :: x509:: { X509Name , X509Ref , X509StoreContextRef , X509VerifyResult , X509 } ;
85
- use crate :: { cvt, cvt_n, cvt_p, init} ;
85
+ use crate :: { cvt, cvt_n, cvt_p, cvt_p_const , init} ;
86
86
use bitflags:: bitflags;
87
87
use cfg_if:: cfg_if;
88
88
use foreign_types:: { ForeignType , ForeignTypeRef , Opaque } ;
@@ -3484,6 +3484,47 @@ impl SslRef {
3484
3484
}
3485
3485
}
3486
3486
}
3487
+
3488
+ /// Returns the NID of the negotiated group used for the handshake key
3489
+ /// exchange process.
3490
+ /// For TLSv1.3 connections this typically reflects the state of the
3491
+ /// current connection, though in the case of PSK-only resumption, the
3492
+ /// returned value will be from a previous connection.
3493
+ /// For earlier TLS versions, when a session has been resumed, it always
3494
+ /// reflects the group used for key exchange during the initial handshake
3495
+ /// (otherwise it is from the current, non-resumption, connection).
3496
+ /// This can be called by either client or server.
3497
+ /// If the NID for the shared group is unknown then the value is set to the
3498
+ /// bitwise OR of TLSEXT_nid_unknown (0x1000000) and the id of the group.
3499
+ #[ corresponds( SSL_get_negotiated_group ) ]
3500
+ #[ cfg( ossl300) ]
3501
+ pub fn negotiated_group ( & self ) -> Result < c_int , ErrorStack > {
3502
+ unsafe { cvt ( ffi:: SSL_get_negotiated_group ( self . as_ptr ( ) ) ) }
3503
+ }
3504
+
3505
+ /// Return retrieve the TLS group name associated with a given TLS
3506
+ /// group ID, as registered via built-in or external providers and as
3507
+ /// returned by a call to SSL_get1_groups() or SSL_get_shared_group().
3508
+ ///
3509
+ /// If non-NULL, SSL_group_to_name() returns the TLS group name
3510
+ /// corresponding to the given id as a NUL-terminated string.
3511
+ /// If SSL_group_to_name() returns NULL, an error occurred; possibly no
3512
+ /// corresponding tlsname was registered during provider initialisation.
3513
+ ///
3514
+ /// Note that the return value is valid only during the lifetime of the
3515
+ /// SSL object ssl.
3516
+ #[ corresponds( SSL_group_to_name ) ]
3517
+ #[ cfg( ossl300) ]
3518
+ pub fn group_to_name < ' s > ( & ' s self , id : c_int ) -> Result < & ' s str , ErrorStack > {
3519
+ unsafe {
3520
+ match cvt_p_const ( ffi:: SSL_group_to_name ( self . as_ptr ( ) , id) ) {
3521
+ Ok ( constp) => Ok ( CStr :: from_ptr ( constp)
3522
+ . to_str ( )
3523
+ . expect ( "Invalid UTF8 in input" ) ) ,
3524
+ Err ( e) => Err ( e) ,
3525
+ }
3526
+ }
3527
+ }
3487
3528
}
3488
3529
3489
3530
/// An SSL stream midway through the handshake process.
0 commit comments