Re: [PATCH] crypto: add alignment handling to digest layer

From: Herbert Xu
Date: Wed Apr 05 2006 - 14:12:37 EST


On Tue, Apr 04, 2006 at 12:04:07AM +0900, Atsushi Nemoto wrote:
>
> @@ -38,12 +39,24 @@ static void update(struct crypto_tfm *tf
> unsigned int bytes_from_page = min(l, ((unsigned int)
> (PAGE_SIZE)) -
> offset);
> - char *p = crypto_kmap(pg, 0) + offset;
> + char *src = crypto_kmap(pg, 0);
> + char *p = src + offset;
>
> + if (unlikely(offset & alignmask)) {
> + unsigned int bytes =
> + alignmask + 1 - (offset & alignmask);
> + bytes = min(bytes, bytes_from_page);
> + tfm->__crt_alg->cra_digest.dia_update
> + (crypto_tfm_ctx(tfm), p,
> + bytes);

Don't we need to copy this to an aligned buffer?

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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/