int zuluCryptOpenLuks_2( const open_struct_t * opts ) { /* * zuluCryptResolveDevicePath_0() is defined in resolve_path.c */ return zuluCryptResolveDevicePath_0( _open_luks_2,opts,2 ) ; }
int zuluCryptOpenPlain_2( const char * device,const char * mapper, const char * mode,const char * key,size_t key_len, const char * options ) { open_struct_t opt ; stringList_t stl ; int r ; char * const * e = NULL ; size_t n = 0 ; args s = { "/dev/urandom","aes","cbc-essiv:sha256","256","ripemd160","0" } ; memset( &opt,'\0',sizeof( open_struct_t ) ) ; opt.device = device ; opt.mapper_name = mapper ; opt.key = key ; opt.key_len = key_len ; opt.m_opts = mode ; opt.variables = &s ; stl = StringListSplit( options,'.' ) ; StringListStringArray_1( &e,&n,stl ) ; if( n == 6 ){ s.rng = *( e + 0 ) ; s.algo = *( e + 1 ) ; s.cipher = *( e + 2 ) ; s.keySize = *( e + 3 ) ; s.hash = *( e + 4 ) ; s.offset = *( e + 5 ) ; }else if( n == 5 ){ s.algo = *( e + 0 ) ; s.cipher = *( e + 1 ) ; s.keySize = *( e + 2 ) ; s.hash = *( e + 3 ) ; s.offset = *( e + 4 ) ; } /* * zuluCryptResolveDevicePath_0() is defined in resolve_path.c */ r = zuluCryptResolveDevicePath_0( _open_plain,&opt,2 ) ; StringListDelete( &stl ) ; StringFree( e ) ; return r ; }