# Problems using CRYPTOAPI/CRYPTOLOOP

## feliperal

I'm having encrypting my filesystem or certain directories.  I followed the encryption HOWTO at this link:http://encryptionhowto.sourceforge.net/Encryption-HOWTO.html

Here are the commands I typed in: 

```

# dd if=/dev/random of=/file bs=1024k count=10

#losetup -e aes /dev/loop0 ~/.crypto

Available keysizes (bits): 128 192 256

Keysize:256

password:somepassword

The cipher does not exist, or a cipher module needs to be loaded into the kernelioctl: LOOP_SET_STATUS: Invalid argument

```

I know that I have compilled the ciphers and cryptodevice and loop directly into the kernel because /proc/crypto shows all the available ciphers and digests:

```

/proc/crypto/ciphers

3des-cbc  aes-cbc  blowfish-cbc  cast5-cbc  idea-cbc  mars-cbc  rc5-cbc  rc6-cbc  serpent-cbc  twofish-cbc

3des-cfb  aes-cfb  blowfish-cfb  cast5-cfb  idea-cfb  mars-cfb  rc5-cfb  rc6-cfb  serpent-cfb  twofish-cfb

3des-ctr  aes-ctr  blowfish-ctr  cast5-ctr  idea-ctr  mars-ctr  rc5-ctr  rc6-ctr  serpent-ctr  twofish-ctr

3des-ecb  aes-ecb  blowfish-ecb  cast5-ecb  idea-ecb  mars-ecb  rc5-ecb  rc6-ecb  serpent-ecb  twofish-ecb

3des-rtc  aes-rtc  blowfish-rtc  cast5-rtc  idea-rtc  mars-rtc  rc5-rtc  rc6-rtc  serpent-rtc  twofish-rtc

/proc/crypto/digests/

md5  ripemd160  sha1  sha256  sha384  sha512

```

Below is the specific crypto functions I chose:

```

<*> CryptoAPI support

<*> Crypto Devices

<*> Loop Crypto Support

```

I remerged util-linux to 2.11z-r7 with these flags:

```

USE="acpi acpi4linux curl dvd evo -apache2  faad flash gb gd gnomedb gtk2 icc \

     icc-pgo imap jikes libgda maildir mcal md5sum moznocompose moznoirc \

     moznomail odbc sasl sse tiff usb wmf xfs xml -apm -arts -kde"

                                                                                                                             CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer -mmmx -msse -msse2 -mfpmath=sse  -fforce-addr -funroll-loops -frerun-$                                                                                                                             

```

I don't know what else I should do.  I've tried everything, even one said one prayer to St. Linus and the Virgin Mary, and shouting some explicatives at my computer to no avail.  I'd appreciate in help or suggestions.

----------

## GentooBox

For your USE flags, try "ufed" (emerge ufed)

try compile the ciphers as modules instead of compiling it into the kernel.

----------

## feliperal

Well, you were right, for some reason the cryptoapi does not work properly when statically built into the kernel.  I just changed all the crypto options from statically compiled to compile as modules.  I know longer get the problems with losetup.

Thanks a million!

----------

## watersb

Glad that worked!

FYI: There are about ten pages of encrypted-filesystem-gentoo goodness on this thread

----------

