On Tue, Sep 26, 2017 at 12:36 PM, Christophe LEROY <christophe.leroy@xxxxxx> wrote: > Hello, > > Today, the talitos driver dma maps/unmaps context and keys at every single > request. > I'm looking at doing the dma mapping at hash init and doing unmapping at > final/finup/digest > > However, I'm wondering how to manage hash exports and imports. I was > initially thinking about doing a dma_sync_for_cpu() before any export and a > dma_sync_for_device() after any export, but that supposes that the dma area > is already mapped, which means that we have done the init and not yet done a > final/finup/digest. > > I'm a bit sceptic when reading the following text in include/crypto/hash.h : > > @export: Export partial state of the transformation. This function dumps the > * entire state of the ongoing transformation into a provided block > of > * data so it can be @import 'ed back later on. This is useful in > case > * you want to save partial result of the transformation after > * processing certain amount of data and reload this partial result > * multiple times later on for multiple re-use > > > Does it mean that import may be called in lieu of hash init, or is hash init > always called before doing an import ? > I believe import is called in lieu of init. See the example is testmgr.c here: http://elixir.free-electrons.com/linux/latest/source import is called on a freshly allocated request (save for set_crypt and set_callback), followed by a call to update. Gilad > Thanks > Christophe -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru