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
cast.h
castsb.h
criov.c
crypto.c
cryptodev_if.m
cryptodev.c Fix cryptodev UIO creation. 2009-05-23 13:23:46 +00:00
cryptodev.h
cryptosoft.c Fix return type for detach routine (should be int) 2009-02-05 17:43:12 +00:00
cryptosoft.h
deflate.c
deflate.h
rmd160.c
rmd160.h
skipjack.c
skipjack.h
xform.c
xform.h