@@ -30,7 +30,7 @@ pub struct CryptParamsReencryptRef<'a> {
3030 #[ allow( dead_code) ]
3131 reference : & ' a CryptParamsReencrypt ,
3232 #[ allow( dead_code) ]
33- luks2_params : Box < CryptParamsLuks2Ref < ' a > > ,
33+ luks2_params : Option < Box < CryptParamsLuks2Ref < ' a > > > ,
3434 #[ allow( dead_code) ]
3535 resilience_cstring : CString ,
3636 #[ allow( dead_code) ]
@@ -60,7 +60,7 @@ pub struct CryptParamsReencrypt {
6060 /// Size of the device
6161 pub device_size : u64 ,
6262 /// LUKS2-specific parameters
63- pub luks2 : CryptParamsLuks2 ,
63+ pub luks2 : Option < CryptParamsLuks2 > ,
6464 /// Reencryption flags
6565 pub flags : CryptReencrypt ,
6666}
@@ -69,7 +69,10 @@ impl<'a> TryInto<CryptParamsReencryptRef<'a>> for &'a CryptParamsReencrypt {
6969 type Error = LibcryptErr ;
7070
7171 fn try_into ( self ) -> Result < CryptParamsReencryptRef < ' a > , Self :: Error > {
72- let mut luks2_params: Box < CryptParamsLuks2Ref < ' a > > = Box :: new ( ( & self . luks2 ) . try_into ( ) ?) ;
72+ let mut luks2_params: Option < Box < CryptParamsLuks2Ref < ' a > > > = match self . luks2 . as_ref ( ) {
73+ Some ( l) => Some ( Box :: new ( l. try_into ( ) ?) ) ,
74+ None => None ,
75+ } ;
7376
7477 let resilience_cstring = to_cstring ! ( self . resilience) ?;
7578 let hash_cstring = to_cstring ! ( self . hash) ?;
@@ -82,7 +85,10 @@ impl<'a> TryInto<CryptParamsReencryptRef<'a>> for &'a CryptParamsReencrypt {
8285 data_shift : self . data_shift ,
8386 max_hotzone_size : self . max_hotzone_size ,
8487 device_size : self . device_size ,
85- luks2 : luks2_params. as_ptr ( ) . cast ( ) ,
88+ luks2 : luks2_params
89+ . as_mut ( )
90+ . map ( |l| l. as_ptr ( ) . cast ( ) )
91+ . unwrap_or ( ptr:: null_mut ( ) ) ,
8692 flags : self . flags . bits ( ) ,
8793 } ;
8894 Ok ( CryptParamsReencryptRef {
0 commit comments