Re: [CRYPTO] is it really optimized ?

From: Roland Dreier
Date: Tue Apr 17 2007 - 12:33:53 EST


> > I wonder if there's some way you can cache the last caller and reload
> > the key lazily (only when it changes).
>
> yes something that allows crypto drivers to detect if the key has
> changed would be good.

It seems trivial to keep the last key you were given and do a quick
memcmp in your setkey method to see if it's different from the last
key you pushed to hardware, and set a flag if it is. Then only do
your set_key() if you have a new key to pass to hardware.

I'm assuming the expense is in the aes_write() calls, and you could
avoid them if you know you're not writing something new.

- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/