public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pierre Ossman <drzeus-list@drzeus.cx>
To: Anderson Lizardo <anderson.lizardo@gmail.com>
Cc: Anderson Briglia <anderson.briglia@indt.org.br>,
	Anderson Lizardo <anderson.lizardo@indt.org.br>,
	linux-omap-open-source@linux.omap.com,
	linux-kernel@vger.kernel.org,
	Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Tony Lindgren <tony@atomide.com>,
	David Brownell <david-b@pacbell.net>
Subject: Re: [patch 0/5] Add MMC password protection (lock/unlock) support
Date: Thu, 15 Dec 2005 07:49:40 +0100	[thread overview]
Message-ID: <43A11204.2070403@drzeus.cx> (raw)
In-Reply-To: <5b5833aa0512141551l638b2c05xcd4588a9370bfa51@mail.gmail.com>

Anderson Lizardo wrote:

>Probably using the entire 128-bit CID for the key description would
>waste too much space though, so we are thinking about using just some
>CID fields to build a smaller unique ID. The key retention service has
>quotas for how much space a keyring can use for payload and key
>description, so we should try to keep the description as short as
>possible. If a collision occurs and the password is wrong, we can
>simply invalidate the key and ask for the password again.
>
>  
>

For SD cards we can also use the RCA, which tends to be a bit random.
Perhaps a generic hash function so that we can extend and tweak this
algorithm in one place?

>I actually just did the following change to the OMAP code (drivers/mmc/omap.c):
>
>-
>-	block_size = 1 << data->blksz_bits;
>+	/*  password protection: we need to send the exact block size to the
>+	 *  card (password + 2), not a 2-exponent. */
>+	if (req->cmd->opcode == MMC_LOCK_UNLOCK)
>+		block_size = data->sg[0].length;
>+	else
>+		block_size = 1 << data->blksz_bits;
>
>Given that for the LOCK_UNLOCK command the sg_len will always be 1, we
>can get the block size directly from the first entry of the
>scatterlist. For other block operations, the blksz_bits value is used
>as usual.
>
>  
>

I can't say that I approve of this code. It's my firm belief that
drivers that are protocol aware are horribly broken.

>Maybe removing blksz_bits and using the block size directly would be
>better? Is there any host/card which expects to always receive a
>power-of-2 block size for block operations?
>  
>

Sounds like a much better solution. Hacking around problems instead of
solving them usually lead to even more problems.

I haven't studied all drivers in detail, but I believe all of them
should be able to handle the transistion.

Rgds
Pierre


  reply	other threads:[~2005-12-15  6:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20051213213208.303580000@localhost.localdomain>
2005-12-13 22:03 ` [patch 0/5] Add MMC password protection (lock/unlock) support David Brownell
2005-12-14 22:48   ` Anderson Lizardo
2005-12-27 18:48     ` Carlos Aguiar
2005-12-13 22:27 ` Anderson Briglia
2005-12-14  7:07   ` Pierre Ossman
2005-12-14 23:51     ` Anderson Lizardo
2005-12-15  6:49       ` Pierre Ossman [this message]
2005-12-15  9:12         ` Russell King
2005-12-15  9:27           ` Pierre Ossman
2005-12-15 10:06             ` Russell King
2005-12-15 13:44               ` Russell King
2005-12-15 16:01                 ` Pierre Ossman
2005-12-29 19:06                 ` Anderson Lizardo
2005-12-29 20:09                   ` Russell King
2005-12-29 21:23                     ` Anderson Lizardo
2005-12-29 21:37                       ` Russell King
2005-12-29 19:17                 ` Anderson Lizardo

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=43A11204.2070403@drzeus.cx \
    --to=drzeus-list@drzeus.cx \
    --cc=anderson.briglia@indt.org.br \
    --cc=anderson.lizardo@gmail.com \
    --cc=anderson.lizardo@indt.org.br \
    --cc=carlos.aguiar@indt.org.br \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap-open-source@linux.omap.com \
    --cc=linux@arm.linux.org.uk \
    --cc=tony@atomide.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox