Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Christian Hohnstaedt <chohnstaedt@innominate.com>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Christian Hohnstaedt <chohnstaedt@innominate.com>,
	linux-crypto@vger.kernel.org
Subject: Re: [6 PATCHes] IXP4xx crypto driver fixes.
Date: Mon, 11 Jan 2010 10:07:12 +0100	[thread overview]
Message-ID: <20100111090712.GA3056@elara.bln.innominate.local> (raw)
In-Reply-To: <m3vdf93m0i.fsf@intrepid.localdomain>

On Sun, Jan 10, 2010 at 06:30:53PM +0100, Krzysztof Halasa wrote:
> IXP4xx: Fix ixp4xx_crypto little-endian operation.
> 
> Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Acked-by: Christian Hohnstaedt <chohnstaedt@innominate.com>

> 
> Fixes the following on IXP425 little-endian:
> 
> NPE-C: firmware functionality 0x5, revision 0x2:1
> alg: skcipher: Test 1 failed on encryption for ecb(des)-ixp4xx
> 00000000: 01 23 45 67 89 ab cd e7
> alg: skcipher: Test 1 failed on encryption for ecb(des3_ede)-ixp4xx
> 00000000: 73 6f 6d 65 64 61 74 61
> alg: skcipher: Test 1 failed on encryption for ecb(aes)-ixp4xx
> 00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff
> 
> diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
> index 6c6656d..cac026a 100644
> --- a/drivers/crypto/ixp4xx_crypto.c
> +++ b/drivers/crypto/ixp4xx_crypto.c
> @@ -96,8 +96,13 @@
>  
>  struct buffer_desc {
>  	u32 phys_next;
> +#ifdef __ARMEB__
>  	u16 buf_len;
>  	u16 pkt_len;
> +#else
> +	u16 pkt_len;
> +	u16 buf_len;
> +#endif
>  	u32 phys_addr;
>  	u32 __reserved[4];
>  	struct buffer_desc *next;
> @@ -105,17 +110,30 @@ struct buffer_desc {
>  };
>  
>  struct crypt_ctl {
> +#ifdef __ARMEB__
>  	u8 mode;		/* NPE_OP_*  operation mode */
>  	u8 init_len;
>  	u16 reserved;
> +#else
> +	u16 reserved;
> +	u8 init_len;
> +	u8 mode;		/* NPE_OP_*  operation mode */
> +#endif
>  	u8 iv[MAX_IVLEN];	/* IV for CBC mode or CTR IV for CTR mode */
>  	u32 icv_rev_aes;	/* icv or rev aes */
>  	u32 src_buf;
>  	u32 dst_buf;
> +#ifdef __ARMEB__
>  	u16 auth_offs;		/* Authentication start offset */
>  	u16 auth_len;		/* Authentication data length */
>  	u16 crypt_offs;		/* Cryption start offset */
>  	u16 crypt_len;		/* Cryption data length */
> +#else
> +	u16 auth_len;		/* Authentication data length */
> +	u16 auth_offs;		/* Authentication start offset */
> +	u16 crypt_len;		/* Cryption data length */
> +	u16 crypt_offs;		/* Cryption start offset */
> +#endif
>  	u32 aadAddr;		/* Additional Auth Data Addr for CCM mode */
>  	u32 crypto_ctx;		/* NPE Crypto Param structure address */
>  
> @@ -651,6 +669,9 @@ static int setup_auth(struct crypto_tfm *tfm, int encrypt, unsigned authsize,
>  
>  	/* write cfg word to cryptinfo */
>  	cfgword = algo->cfgword | ( authsize << 6); /* (authsize/4) << 8 */
> +#ifndef __ARMEB__
> +	cfgword ^= 0xAA000000; /* change the "byte swap" flags */
> +#endif
>  	*(u32*)cinfo = cpu_to_be32(cfgword);
>  	cinfo += sizeof(cfgword);
>  
Christian Hohnstaedt

-- 
Christian Hohnstaedt / Project Manager Hardware and Manufacturing

Innominate Security Technologies AG / protecting industrial networks
tel: +49.30.921028.208 / fax: +49.30.921028.020
Rudower Chaussee 13, D-12489 Berlin / http://www.innominate.com

Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald
Chairman of the Supervisory Board: Volker Bibelhausen
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-01-11  9:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-10 15:34 [6 PATCHes] IXP4xx crypto driver fixes Krzysztof Halasa
2010-01-10 17:30 ` Krzysztof Halasa
2010-01-11  9:07   ` Christian Hohnstaedt [this message]
2010-01-10 17:32 ` IXP4xx: Fix ixp4xx_crypto sparse warnings Krzysztof Halasa
2010-01-10 17:32 ` IXP4xx: Simplify get_crypt_desc() and get_crypt_desc_emerg() in ixp4xx_crypto Krzysztof Halasa
2010-01-10 17:33 ` IXP4xx: Fix whitespace problems " Krzysztof Halasa
2010-01-12 17:12   ` Christian Hohnstaedt
2010-01-12 18:09     ` Krzysztof Halasa
2010-01-10 17:37 ` ixp4xx_crypto: Fix possible NULL ptr dereference Krzysztof Halasa
2010-01-11 10:07   ` Christian Hohnstaedt
2010-01-10 17:37 ` ixp4xx_crypto: simplyfy the code a bit Krzysztof Halasa

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=20100111090712.GA3056@elara.bln.innominate.local \
    --to=chohnstaedt@innominate.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=khc@pm.waw.pl \
    --cc=linux-crypto@vger.kernel.org \
    /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