make cryptodev aware of alignment constraints
commit19033b137d0ae6ed228639dd509587d3ca1598dc
authorPhil Sutter <phil.sutter@viprinet.com>
Thu, 4 Nov 2010 16:31:14 +0000 (4 17:31 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 4 Nov 2010 20:47:56 +0000 (4 21:47 +0100)
tree4e2b5e3782cbac3893b97eabbd46fda5926aefde
parent44cef43c93ed0a03acea078eb280fee901e7fc57
make cryptodev aware of alignment constraints

Certain hardware crypto engines need input data to be correctly aligned.
Due to copyless operation, data alignment has to be done in userspace.
To assist in that, find out the smallest possible alignment boundary
upon session creation, depending on the actual cipher/hash mode(s) being
selected (and the automatically chosen crypto backend, of course).

Since now the information is present internally, check directly used
(zero-copy) userspace buffers for correct alignment. Handling of
temporary, internal buffers is unclear for now. Maybe one should align
them to a high value (e.g. 64 bytes) to be sure. Allocating everything
dynamically instead is probably not a good alternative.

The only buffers userspace applications have to align are the 'src' and
'dst' fields of struct crypt_op. All other userspace buffers are copied
internally, since their small size doesn't justify the overhead of
mapping userspace pages for them.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
cryptodev.h
cryptodev_cipher.c
cryptodev_int.h
cryptodev_main.c