|
|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Wed, 03 Oct 2007
HIFN driver addons and crypto stack issues.
I decided to rewrite crypto session setup in HIFN
driver to allow multiple scatter-gather lists (which are
now transformed into pages) in single crypto session
(even though with multiple descriptor slots being used).
Main goal for this step is to allow encryption
of buffers, which are split into number of pages,
where each chunk is not block size aligned (for example
one page contains 2 bytes and another one 14 for single
datablock of 16 bytes). Second revision of driver does not
support such blocks yet.
To simplify this I started to use generic linux crypto
helpers blkcipher_walk_* from block ciphers.
But they do not allow to be called in interrupt context,
although all allocations are performed like they happen
in atomic context.
Rougly code looks like this (error processing ommitted):
struct blkcipher_walk walk;
blkcipher_walk_init(&walk, dst, src, nbytes);
blkcipher_walk_virt(desc, &walk);
while ((nbytes = walk.nbytes)) {
u8 *iv = encrypt();
memcpy(walk.iv, iv, ivsize);
nbytes &= blocksize - 1;
err = blkcipher_walk_done(desc, &walk, nbytes);
}
Above struct blkcipher_walk contains source and destination
page addresses, appropriate sizes and offsets. Variable desc
is a struct blkcipher_desc pointer, which contains
original parameters of crypto request.
/devel/acrypto/hifn :: Link / Comments ()
|