From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.saout.de ([127.0.0.1]) by localhost (mail.saout.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SdHrb5sA9DUA for ; Tue, 17 Jan 2012 09:44:36 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mail.saout.de (Postfix) with ESMTP for ; Tue, 17 Jan 2012 09:44:35 +0100 (CET) Message-ID: <4F1534F0.7010900@redhat.com> Date: Tue, 17 Jan 2012 09:44:32 +0100 From: Milan Broz MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dm-crypt] luksFormat library API doesnt seem to work with large keyfiles. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ".. ink .." Cc: dm-crypt@saout.de On 01/17/2012 09:05 AM, .. ink .. wrote: > using cryptsetup 1.4.1 > > test case below. (please also read examples in docs/examples) > key1 keyfile is a text file with 64 characters in it. > key.cr is a 4.3MB mp3 file. ... > status = crypt_keyslot_add_by_volume_key( cd,CRYPT_ANY_SLOT,NULL,32,c,strlen( c ) ); I guess strlen(c) is wrong, it will stop on the first zero (mp3 is binary data, not C string). What about use st.st_size here? About limits - there is default/compiled one but you can always override it through API, exactly as you did above. (Also see cryptsetup --help - "Default compiled-in keyfile parameters", you have to override keyfile size using --keyfile-size option if it is over compiled-in limit in CLI command.) Milan