crypto: inside-secure - Move ipad/opad into safexcel_context

As both safexcel_ahash_ctx and safexcel_cipher_ctx contain ipad
and opad buffers this patch moves them into the common struct
safexcel_context.  It also adds a union so that they can be accessed
in the appropriate endian without crazy casts.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Herbert Xu
2020-09-14 14:22:14 +10:00
parent 18e5189535
commit 78cf1c8bfc
3 changed files with 72 additions and 63 deletions

View File

@@ -12,7 +12,9 @@
#include <crypto/algapi.h>
#include <crypto/internal/hash.h>
#include <crypto/sha.h>
#include <crypto/sha3.h>
#include <crypto/skcipher.h>
#include <linux/types.h>
#define EIP197_HIA_VERSION_BE 0xca35
#define EIP197_HIA_VERSION_LE 0x35ca
@@ -835,6 +837,13 @@ struct safexcel_context {
struct safexcel_crypto_priv *priv;
dma_addr_t ctxr_dma;
union {
__le32 le[SHA3_512_BLOCK_SIZE / 4];
__be32 be[SHA3_512_BLOCK_SIZE / 4];
u32 word[SHA3_512_BLOCK_SIZE / 4];
u8 byte[SHA3_512_BLOCK_SIZE];
} ipad, opad;
int ring;
bool needs_inv;
bool exit_inv;