mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
crypto: inside-secure - refrain from unneeded invalidations
The check to know if an invalidation is needed (i.e. when the context changes) is done even if the context does not exist yet. This happens when first setting a key for ciphers and/or hmac operations. This commits adds a check in the _setkey functions to only check if an invalidation is needed when a context exists, as there is no need to perform this check otherwise. Signed-off-by: Ofer Heifetz <oferh@marvell.com> [Antoine: commit message and added a comment and reworked one of the checks] Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
cc75f5ce82
commit
c4daf4cc9c
2 changed files with 22 additions and 12 deletions
|
@ -78,10 +78,12 @@ static int safexcel_aes_setkey(struct crypto_skcipher *ctfm, const u8 *key,
|
|||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < len / sizeof(u32); i++) {
|
||||
if (ctx->key[i] != cpu_to_le32(aes.key_enc[i])) {
|
||||
ctx->base.needs_inv = true;
|
||||
break;
|
||||
if (ctx->base.ctxr_dma) {
|
||||
for (i = 0; i < len / sizeof(u32); i++) {
|
||||
if (ctx->key[i] != cpu_to_le32(aes.key_enc[i])) {
|
||||
ctx->base.needs_inv = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue