[PATCHv3 03/11] crypto: omap-sham: implement context export/import APIs
From: Tero Kristo <hidden>
Date: 2016-08-29 14:12:14
Also in:
linux-crypto, linux-omap
On 09/08/16 13:06, Herbert Xu wrote:
On Thu, Aug 04, 2016 at 01:28:38PM +0300, Tero Kristo wrote:quoted
Context export/import are now required for ahash algorithms due to required support in algif_hash. Implement these for OMAP SHA driver, saving and restoring the internal state of the driver. Signed-off-by: Tero Kristo <redacted> --- drivers/crypto/omap-sham.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 6e53944..aa71e61 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c@@ -1379,6 +1379,27 @@ exit_unlock: return ret; } +static int omap_sham_export(struct ahash_request *req, void *out) +{ + struct omap_sham_reqctx *rctx = ahash_request_ctx(req); + + while (omap_sham_flush(req) == -EINPROGRESS) + msleep(10);Do we really need this? You must not call export until the previous operation has completed. Cheers,
Sorry about a late reply, I was out on vacation. For OMAP SHAM, this is actually needed, because the driver still has a very large internal buffer for performance reasons, and the whole buffer can't be exported. The flush functionality pushes out sufficient amount of data to the hardware, so that the rest of the buffer can be exported to the available space. This is pretty much related to the discussion we had previously here: https://patchwork.kernel.org/patch/9192881/ Basically I decided to keep the driver buffer the same size as previously, but flush out any extra data. -Tero