freebsd-dev/sys/opencrypto
Rafal Jaworowski ae184a6a7d Fix cryptodev UIO creation.
Cryptodev uses UIO structure do get data from userspace and pass it to
cryptographic engines. Initially UIO size is equal to size of data passed to
engine, but if UIO is prepared for hash calculation an additional small space
is created to hold result of operation.

While creating space for the result, UIO I/O vector size is correctly
extended, but uio_resid field in UIO structure is not modified.

As bus_dma code uses uio_resid field to determine size of UIO DMA mapping,
resulting mapping hasn't correct size. This leads to a crash if all the
following conditions are met:

     1. Hardware cryptographic accelerator writes result of hash operation
        using DMA.
     2. Size of input data is less or equal than (n * PAGE_SIZE),
     3. Size of input data plus size of hash result is grather than
        (n * PAGE_SIZE, where n is the same as in point 2.

This patch fixes this problem by adding size of the extenstion to uio_resid
field in UIO structure.

Submitted by:	Piotr Ziecik kosmo ! semihalf dot com
Reviewed by:	philip
Obtained from:	Semihalf
2009-05-23 13:23:46 +00:00
..
cast.c Quiet warnings. These do not appear to be actually used uninitialized, 2007-07-05 06:59:14 +00:00
cast.h
castsb.h
criov.c - Replace COPYDATA() and COPYBACK() macros with crypto_copydata() and 2006-06-04 22:15:13 +00:00
crypto.c Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
cryptodev_if.m add missing file from last commit that overhauls crypto/driver api's 2007-03-21 03:43:33 +00:00
cryptodev.c Fix cryptodev UIO creation. 2009-05-23 13:23:46 +00:00
cryptodev.h Integrate the Camellia Block Cipher. For more information see RFC 4132 2007-05-09 19:37:02 +00:00
cryptosoft.c Fix return type for detach routine (should be int) 2009-02-05 17:43:12 +00:00
cryptosoft.h Overhaul driver/subsystem api's: 2007-03-21 03:42:51 +00:00
deflate.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
deflate.h
rmd160.c
rmd160.h
skipjack.c
skipjack.h
xform.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
xform.h Integrate the Camellia Block Cipher. For more information see RFC 4132 2007-05-09 19:37:02 +00:00