Hi Sebastian: On Fri, May 18, 2007 at 04:01:30PM +0200, Sebastian Siewior wrote: > setkey() in {cipher,blkcipher,ablkcipher,hash}.c does not respect the > requested alignment by the algorithm. This patch fixes it. The extra > memory is allocated by kmalloc() with GFP_KERNEL flag. I think we should stick with GFP_ATOMIC for now. Once all the atomic users have been fixed (if they can be), then we can start changing this interface. > Index: ps3-linux/crypto/cipher.c > =================================================================== > --- ps3-linux.orig/crypto/cipher.c > +++ ps3-linux/crypto/cipher.c > @@ -20,16 +20,43 @@ > #include <linux/string.h> > #include "internal.h" > > +static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen, > + unsigned long alignmask) Minor nit. Could you get rid of the alignmask parameter here and just read it again from tfm? This should make it easier for certain compiler/ arch combos to generate a tail call. > static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) > { > struct cipher_alg *cia = &tfm->__crt_alg->cra_cipher; > - > + unsigned long alignmask = crypto_tfm_alg_alignmask(tfm); > + > tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; > if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize) { > tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; > return -EINVAL; > - } else > - return cia->cia_setkey(tfm, key, keylen); > + } > + > + if ((unsigned long) key & alignmask) Please kill the space before key. Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html