Re: alignmask in the API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sebastian Siewior <linux-crypto@xxxxxxxxxxxxxxxx> wrote:
> The API allows to set an align mask. This mask is considered on the
> allocation of cipher's private ctx and the IV (for block cipher). This
> mask is ignored in the setkey function (what is fine with me). 
> encrypt() and decrypt() functions get their data through a scatterlist.
> Is my understanding correct that I can't assume any alignment of the
> input / output data? If so, is it fungible to modify the caller's code
> to respect the aligmask?

It's the API's responsibility to guarantee alignment.  So in principle
neither the user nor the algorithm need to worry about alignment.

However, for the sake of performance, the user should take care of
alignment where it is easy to do.  For instance, if you have to
allocate memory for an IV or src/dst as a crypto user, you should
try to get something that's aligned properly.

However, there is no point in doing an extra copy for the sake of
alignment since the crypto API will do it for you anyway.

Cheers,
-- 
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

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux