All of lore.kernel.org
 help / color / mirror / Atom feed
From: dhvvcb@lavabit.com
To: dm-crypt@saout.de
Subject: [dm-crypt] Using dmsetup directly instead of cryptsetup
Date: Sun, 22 May 2011 00:40:36 +0600	[thread overview]
Message-ID: <1306003236.10131.75.camel@localhost> (raw)

Usually I run command

cryptsetup -d /path/to/key -c aes-cbc-essiv:sha256 -s 256 create
hdd2 /dev/sdc

and /dev/mapper/hdd2 is created.

I tried to follow the example given on home page
http://www.saout.de/misc/dm-crypt/

echo 0 <sector count> crypt <sector format> <key> <IV offset> <real
device> <sector offset> | dmsetup create name

where <key> is a hexadecimal representation of the binary key. As a
result, /dev/mapper/name should be created.

To create /dev/mapper/hdd2 corresponding to /dev/sdc I run the commands:

echo 0 $(blockdev --getsz /dev/sdc) crypt aes-cbc-essiv:sha256
"$(cat /path/to/key.hex)" 0 /dev/sdc 0 | dmsetup create hdd2

Here '/path/to/key.hex' is the hexadecimal representation of binary
'/path/to/key'. I converted 'key' to 'key.hex' with the help of hexdump.
Size of 'key.hex' file (65B) is twice as large as binary 'key' (32B)
because each binary symbol is determined by two hexadecimal numbers.

However this /dev/mapper/hdd2 can not be mounted. While /dev/mapper/hdd2
created with cryptsetup is mounted. So straightforward dmsetup usage and
cryptsetup create different /dev/mapper/hdd2, though key is the same.

The question is how to use dmsetup straightforward so as it would give
the same encrypted device as cryptsetup does.

             reply	other threads:[~2011-05-21 19:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21 18:40 dhvvcb [this message]
2011-05-21 19:33 ` [dm-crypt] Using dmsetup directly instead of cryptsetup Milan Broz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306003236.10131.75.camel@localhost \
    --to=dhvvcb@lavabit.com \
    --cc=dm-crypt@saout.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.