@@ -511,6 +511,19 @@ s_no_extra_traits!{
511511 pub d_type: :: c_uchar,
512512 pub d_name: [ :: c_char; 256 ] ,
513513 }
514+
515+ pub struct sockaddr_alg {
516+ pub salg_family: :: sa_family_t,
517+ pub salg_type: [ :: c_uchar; 14 ] ,
518+ pub salg_feat: u32 ,
519+ pub salg_mask: u32 ,
520+ pub salg_name: [ :: c_uchar; 64 ] ,
521+ }
522+
523+ pub struct af_alg_iv {
524+ pub ivlen: u32 ,
525+ pub iv: [ :: c_uchar; 0 ] ,
526+ }
514527}
515528
516529cfg_if ! {
@@ -656,6 +669,81 @@ cfg_if! {
656669 self . size. hash( state) ;
657670 }
658671 }
672+
673+ impl PartialEq for sockaddr_alg {
674+ fn eq( & self , other: & sockaddr_alg) -> bool {
675+ self . salg_family == other. salg_family
676+ && self
677+ . salg_type
678+ . iter( )
679+ . zip( other. salg_type. iter( ) )
680+ . all( |( a, b) | a == b)
681+ && self . salg_feat == other. salg_feat
682+ && self . salg_mask == other. salg_mask
683+ && self
684+ . salg_name
685+ . iter( )
686+ . zip( other. salg_name. iter( ) )
687+ . all( |( a, b) | a == b)
688+ }
689+ }
690+
691+ impl Eq for sockaddr_alg { }
692+
693+ impl :: fmt:: Debug for sockaddr_alg {
694+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
695+ f. debug_struct( "sockaddr_alg" )
696+ . field( "salg_family" , & self . salg_family)
697+ . field( "salg_type" , & self . salg_type)
698+ . field( "salg_feat" , & self . salg_feat)
699+ . field( "salg_mask" , & self . salg_mask)
700+ . field( "salg_name" , &&self . salg_name[ ..] )
701+ . finish( )
702+ }
703+ }
704+
705+ impl :: hash:: Hash for sockaddr_alg {
706+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
707+ self . salg_family. hash( state) ;
708+ self . salg_type. hash( state) ;
709+ self . salg_feat. hash( state) ;
710+ self . salg_mask. hash( state) ;
711+ self . salg_name. hash( state) ;
712+ }
713+ }
714+
715+ impl af_alg_iv {
716+ fn as_slice( & self ) -> & [ u8 ] {
717+ unsafe {
718+ :: core:: slice:: from_raw_parts(
719+ self . iv. as_ptr( ) ,
720+ self . ivlen as usize
721+ )
722+ }
723+ }
724+ }
725+
726+ impl PartialEq for af_alg_iv {
727+ fn eq( & self , other: & af_alg_iv) -> bool {
728+ * self . as_slice( ) == * other. as_slice( )
729+ }
730+ }
731+
732+ impl Eq for af_alg_iv { }
733+
734+ impl :: fmt:: Debug for af_alg_iv {
735+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
736+ f. debug_struct( "af_alg_iv" )
737+ . field( "iv" , & self . as_slice( ) )
738+ . finish( )
739+ }
740+ }
741+
742+ impl :: hash:: Hash for af_alg_iv {
743+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
744+ self . as_slice( ) . hash( state) ;
745+ }
746+ }
659747 }
660748}
661749
@@ -1702,6 +1790,16 @@ pub const SOF_TIMESTAMPING_SOFTWARE: ::c_uint = 1 << 4;
17021790pub const SOF_TIMESTAMPING_SYS_HARDWARE : :: c_uint = 1 << 5 ;
17031791pub const SOF_TIMESTAMPING_RAW_HARDWARE : :: c_uint = 1 << 6 ;
17041792
1793+ // linux/if_alg.h
1794+ pub const ALG_SET_KEY : :: c_int = 1 ;
1795+ pub const ALG_SET_IV : :: c_int = 2 ;
1796+ pub const ALG_SET_OP : :: c_int = 3 ;
1797+ pub const ALG_SET_AEAD_ASSOCLEN : :: c_int = 4 ;
1798+ pub const ALG_SET_AEAD_AUTHSIZE : :: c_int = 5 ;
1799+
1800+ pub const ALG_OP_DECRYPT : :: c_int = 0 ;
1801+ pub const ALG_OP_ENCRYPT : :: c_int = 1 ;
1802+
17051803f ! {
17061804 pub fn CMSG_NXTHDR ( mhdr: * const msghdr,
17071805 cmsg: * const cmsghdr) -> * mut cmsghdr {
0 commit comments