Skip to content

Commit

Permalink
crypto: inside-secure - add support for arbitrary size hash/HMAC updates
Browse files Browse the repository at this point in the history
This patch fixes an issue with hash and HMAC operations that perform
"large" intermediate updates (i.e. combined size > 2 hash blocks) by
actually making use of the hardware's hash continue capabilities.
The original implementation would cache these updates in a buffer that
was 2 hash blocks in size and fail if all update calls combined would
overflow that buffer. Which caused the cryptomgr extra tests to fail.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Pascal van Leeuwen authored and Herbert Xu committed Jul 26, 2019
1 parent 85695b0 commit 41abed7
Show file tree
Hide file tree
Showing 2 changed files with 269 additions and 158 deletions.
4 changes: 3 additions & 1 deletion drivers/crypto/inside-secure/safexcel.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,16 @@ struct safexcel_context {
bool exit_inv;
};

#define HASH_CACHE_SIZE SHA512_BLOCK_SIZE

struct safexcel_ahash_export_state {
u64 len[2];
u64 processed[2];

u32 digest;

u32 state[SHA512_DIGEST_SIZE / sizeof(u32)];
u8 cache[SHA512_BLOCK_SIZE << 1];
u8 cache[HASH_CACHE_SIZE];
};

/*
Expand Down
Loading

0 comments on commit 41abed7

Please sign in to comment.