Subject: [RFC 0/6] small geode cleanup + fallback

Hello Herbert,

This patchset started in order to verify broken Geode driver [1] without
the actual hardware. [2] contains a version of the geode-aes driver where
the hardware routines are replaced with software because I assume that
the hardware is actually working (and this is the closest I get). I came
to the conclusion that the driver should work (I was able to mkfs,cp, sha1
files on the crypto partition).

This patch set contains a small "clean up" of the driver and a fallback
mode for keysize != 128. Hebert, if you like this way of fallback (patch 5)
than I would try to hook the s390 driver with something similar.

This way of fallback allocates a "fully working" driver within the actual
driver. Therefore if we request cbc(aes) with 192 bit key, than we have
1 fallback blkcipher and 1 fallback cipher (due to the chaining nature of
the crypto API).

[1][email protected]/msg01041.html
[2] git:// geode_nohw


Subject: [RFC 5/6] [crypto] geode add fallback for unsupported modes.

The Geode AES crypto engine supports only 128 bit long key. This
patch adds fallback for other key sizes which are required by the
AES standard.

Signed-off-by: Sebastian Siewior <[email protected]>
drivers/crypto/geode-aes.c | 188 +++++++++++++++++++++++++++++++++++++++-----
drivers/crypto/geode-aes.h | 6 ++
2 files changed, 173 insertions(+), 21 deletions(-)

06a8173b0f5ca56c5586ba6919f4be56f26546a2.diff (9.48 kB)
Subject: [RFC 2/6] [crypto] geode aes: consistent IV copy

It is enough if the IV is copied before and after the while loop.
With DM-Crypt is seems not be required to save the IV after encrytion
because a new IV is used in the request (dunno about other users).
It is not save to load the IV within while loop and not save afterwards
because we will end up with the wrong IV if the request consists of more
than one page.

Signed-off-by: Sebastian Siewior <[email protected]>
drivers/crypto/geode-aes.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

859476c38eb7658240d647df03ec0fd513e3bfa5.diff (1.45 kB)
Subject: [RFC 1/6] [crypto] AES: move common defines into a header file

This three defines are used in every AES related implementation.

Signed-off-by: Sebastian Siewior <[email protected]>
arch/i386/crypto/aes.c | 4 +---
arch/s390/crypto/aes_s390.c | 7 +------
arch/x86_64/crypto/aes.c | 6 +-----
crypto/aes.c | 6 +-----
drivers/crypto/geode-aes.c | 1 +
drivers/crypto/padlock-aes.c | 4 +---
include/crypto/aes.h | 15 +++++++++++++++
7 files changed, 21 insertions(+), 22 deletions(-)
create mode 100644 include/crypto/aes.h

d9f0e2329449a5bc2ec784dfd666ad09ae150f0e.diff (3.58 kB)
Subject: [RFC 3/6] [crypto] geode: relax in busy loop and care about return value

The code waits in a busy loop until the hardware finishes the encryption
or decryption process. This wants a cpu_relax() :)
The busy loop finishes either if the encryption is done or if the counter
is zero. If the latter is true than the hardware failed. Since this
should not happen, leave a BUG() statement to notice this.

Signed-off-by: Sebastian Siewior <[email protected]>
drivers/crypto/geode-aes.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

d1f8c3225b221c7a3efd0fd07ce6a7a3ff09f8e6.diff (1.03 kB)
Subject: [RFC 4/6] [crypto] geode: move defines into a headerfile

Signed-off-by: Sebastian Siewior <[email protected]>
drivers/crypto/geode-aes.c | 32 --------------------------------
drivers/crypto/geode-aes.h | 36 ++++++++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 34 deletions(-)

9d0ae577c2187fe914aab2f3f486036f2ded01b9.diff (2.35 kB)
Subject: [RFC 6/6] [crypto] geode: use proper defines

Use proper defines for constants even if they point to the same
- there is no min/max blocksize, there is one for AES.
- the size of the IV is the algorithm's block size in case of CBC.
- there is no key size for AES but three different :)

This is a nitpicker patch, no added value :)

Signed-off-by: Sebastian Siewior <[email protected]>
drivers/crypto/geode-aes.c | 44 ++++++++++++++++++++++----------------------
drivers/crypto/geode-aes.h | 9 +++------
2 files changed, 25 insertions(+), 28 deletions(-)

b743c412b4d75286c40fa054e53189eabdd4cf8c.diff (6.70 kB)
Subject: Re: [RFC 0/6] small geode cleanup + fallback

* [email protected] | 2007-10-12 17:21:01 [+0200]:

>Hello Herbert,

I saw you applied 1/6 to your cryptodev tree. What about 2-6 (especially
the fallback approach)?


2007-10-19 00:52:10

by Herbert Xu

[permalink] [raw]
Subject: Re: [RFC 0/6] small geode cleanup + fallback

On Thu, Oct 18, 2007 at 09:35:36PM +0200, Sebastian Siewior wrote:
> I saw you applied 1/6 to your cryptodev tree. What about 2-6 (especially
> the fallback approach)?

Could you please repost?

I think I deleted them because the first patch in the original
series didn't apply.

Visit Openswan at
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page:
PGP Key: