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 NsdXmOfcsUz7 for ; Thu, 16 Aug 2012 12:52:12 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mail.saout.de (Postfix) with ESMTP for ; Thu, 16 Aug 2012 12:52:11 +0200 (CEST) Message-ID: <502CD0D7.2020100@redhat.com> Date: Thu, 16 Aug 2012 12:52:07 +0200 From: Milan Broz MIME-Version: 1.0 References: <502233EC.1030701@gmail.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------030004090708030300000906" Subject: Re: [dm-crypt] Building error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: demo demo Cc: dm-crypt@saout.de This is a multi-part message in MIME format. --------------030004090708030300000906 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/16/2012 08:43 AM, demo demo wrote: > At the end, the production box has CentOS 5.7 and all disk already > encrypted with cryptsetup-luks-1.0.3 ! > > I thought to upgrade it to one of more recent version but it's really > complex due to dependencies incompatibility. > > I also found that libcryptsetup.h v 1.0.3 has more differences > compared to libcryptsetup.h used by API example file. So this suggest > me that there is no way to use the example with very old library! I responded to mail where you mentioned CentOS 6. For RHEL5 no way, it has just old API. We backported many extension to RHEL5.8, so cryptsetup+kernel dmcrypt should be able to open all LUKS device formatted in recent versions but API library is obsolete anyway. > Also I tryied to figure out how to extract and use the old > crypt_luksOpen() function but it's hard form me to follow all the > #define present in the whole cryptsetup package. > > So can you provide me an example code that use the ancient > crypt_luksOpen() function and its relates gcc args used to compile > it? Isn't better to just use binary then? Your code will not work on recent distros (in RHEL6 there is still compatible library but not upstream anymore). Whatever, see file in attachment, it can be compiled both on RHEL5 and RHEL6 (but not upstream anymore), just with cc -o luks_test luks_test.c -g -O0 -lcryptsetup -lgcrypt -ldevmapper -luuid The #ifdef is the because of incompatible changes in header (and API/ABI), one of the reasons the old API was obsoleted. If you need anything else... read the source please (test/api-test.c in RHEL6 version source should give you more hints). Milan --------------030004090708030300000906 Content-Type: text/x-csrc; name="luks_test.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="luks_test.c" LyoKICogT0xEIE9CU09MRVRFIGxpYmNyeXB0c2V0dXAgQVBJIGV4YW1wbGUKICogRE8gTk9U IFVTRSBGT1IgTkVXIFBST0pFQ1RTLgogKi8KCiNpbmNsdWRlIDxzdGRpby5oPgojaW5jbHVk ZSA8c3RkbGliLmg+CiNpbmNsdWRlICJsaWJjcnlwdHNldHVwLmgiCgovKiBkZWZpbml0aW9u IHdhcyBpbnRyb2R1Y2VkIHRvZ2V0aGVyIHdpdGggbG9nICovCiNpZmRlZiBDUllQVF9MT0df Tk9STUFMCiNkZWZpbmUgSEFWRV9JQ0IKI2VuZGlmCgojaWZkZWYgSEFWRV9JQ0IKc3RhdGlj IGludCB5ZXNEaWFsb2coY2hhciAqbXNnKQp7CglwcmludGYoIllvdSBhcmUgc3VyZSwgSSBr bm93LlxuIik7CglyZXR1cm4gMTsKfQoKc3RhdGljIHZvaWQgY21kTGluZUxvZyhpbnQgY2xh c3MsIGNoYXIgKm1zZykKewoJZnB1dHMobXNnLCBzdGRvdXQpOwp9CgpzdGF0aWMgc3RydWN0 IGludGVyZmFjZV9jYWxsYmFja3MgY21kX2ljYiA9IHsKCS55ZXNEaWFsb2cgPSB5ZXNEaWFs b2csCgkubG9nID0gY21kTGluZUxvZywKfTsKI2VuZGlmCgppbnQgTHVrc09wZW4oY29uc3Qg Y2hhciAqZGV2aWNlLCBjb25zdCBjaGFyICpuYW1lKQp7CglzdHJ1Y3QgY3J5cHRfb3B0aW9u cyBjbyA9IHsKCQkuZGV2aWNlID0gZGV2aWNlLAoJCS5uYW1lID0gbmFtZSwKCQkvLyAua2V5 X2ZpbGUgPSAiLSIsIC8vIHN0YW5kYXJkIGlucHV0LCB5b3UgY2FuIGVjaG8gLW4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