Posted by: Wildan Maulana | September 5, 2007

my effort to port cryptsetup to avr32 platform == still failed ..

I hope some one who read this .., can help me to solve the problem .. ^_^

———–
Dear Clemens,

First let me introduce my self, my name is Wildan from Indonesia, i’m
a linux newbie .., C beginner.

I’m trying to port cryptsetup to avr32 arch.
There are several issues i found when trying to porting cryptsetup to
the avr32 platform.

I think, it’s usefull to show you where the issue is.
The following is the command i use to test cryptsetup on avr32 arch
(i’m using NGW100 board …)

bash-3.2#dd if=/dev/urandom of=/home/secret bs=1M count=20
bash-3.2#losetup /dev/loop0 rahasia
bash-3.2# cryptsetup -y –cipher plain luksFormat /dev/loop0

WARNING!
========
This will overwrite data on /dev/loop0 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase:
Verify passphrase:
device-mapper: table: 254:0: zero-length target
Failed to setup dm-crypt key mapping.
Check kernel for support for the plain-cbc-plain cipher spec and
verify that /dev/loop0 contains at least 133 sectors.
Failed to write to key storage.
Command failed.bash-3.2#

Or, using cryptsetup 1.0.5 :

bash-3.2# cryptsetup -y –cipher plain luksFormat /dev/mmcblk0p2

WARNING!

========

This will overwrite data on /dev/mmcblk0p2 irrevocably.

Are you sure? (Type uppercase yes): YES

Enter LUKS passphrase:

Verify passphrase:

Unable to obtain sector size for /dev/mmcblk0p2Failed to setup dm-crypt key mapping.

Check kernel for support for the plain-cbc-plain cipher spec and verify that /dev/mmcblk0p2 contains at least 133 sectors.

Failed to write to key storage.

Command failed.

it’s said that cryptsetup cannot read the sector length of the target ..

But, when i check it with the fdisk utility, it can read the sector
length of the target :

Command failed.bash-3.2# fdisk /dev/loop0
Device contains neither a valid DOS partition table, nor Sun, SGI or
OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that the previous content
won’t be recoverable.

Warning: invalid flag 0x00,0x00 of partition table 4 will be corrected
by w(rite)

Command (m for help): p

Disk /dev/loop0: 20 MB, 20971520 bytes
255 heads, 63 sectors/track, 2 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help):

For you information, compile e2fsprogs without enabling devmapper
support (without using –enable-blkid-devmapper options), it’s the
root cause of problems ?

Besides that, there are differences in shared libraries used by
cryptsetup on my ubuntu box vs on my NGW100 board .., here is the
differences :

On Ubuntu :
==========
$ ldd /sbin/cryptsetup
linux-gate.so.1 => (0xffffe000)
libpopt.so.0 => /lib/libpopt.so.0 (0xb7f13000)
libdevmapper.so.1.02 => /lib/libdevmapper.so.1.02 (0xb7f01000)
libuuid.so.1 => /lib/libuuid.so.1 (0xb7efd000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7dbc000)
/lib/ld-linux.so.2 (0xb7f2b000)

On NGW100 (AVR32) :
===================
bash-3.2# ldd /usr/sbin/cryptsetup
libpopt.so.0 => /usr/lib/libpopt.so.0 (0x2aab3000)
libcryptsetup.so.0 => /usr/lib/libcryptsetup.so.0 (0x2aab9000)
libdevmapper.so.1.02 => /usr/lib/libdevmapper.so.1.02 (0x2aac3000)
libc.so.0 => /lib/libc.so.0 (0x2aad0000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaab000)

Ok .., now to the source code, after reading, the crytpsetup source
code (i’m using the older version cryptsetup-luks-1.0.3, when using
1.0.5 i encounter the same problem ..) :

There is one function which i cannot found where it’s declared .. (as
I already mention , i’m a C newbie .. ^_^), the function is : job(arg,
backend, options);

Which is located in cryptsetup-luks-1.0.3/lib/setup.c file, you can
see it at crypt_job() function ..

That’s for now, I hope with this information You can give me a hint
why cryptsetup failed when i’m trying to porting it to the AVR32 arch
..

Thanks in advance …

Best Regards
Wildan


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: