Commit 2dc53d00 authored by Keerthy's avatar Keerthy Committed by Herbert Xu

crypto: sa2ul - add sha1/sha256/sha512 support

Add support for sha1/sha256/sha512 sa2ul based hardware authentication.
With the hash update mechanism, we always use software fallback
mechanism for now, as there is no way to fetch the partial hash state
from the HW accelerator. HW accelerator is only used when digest is
called for a data chunk of known size.
Signed-off-by: default avatarKeerthy <j-keerthy@ti.com>
[t-kristo@ti.com: various bug fixes, major cleanups and refactoring of code]
Signed-off-by: default avatarTero Kristo <t-kristo@ti.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7694b6ca
This diff is collapsed.
...@@ -73,7 +73,6 @@ struct sa_tfm_ctx; ...@@ -73,7 +73,6 @@ struct sa_tfm_ctx;
#define SA_ENG_ID_AM1 4 /* Auth. engine with SHA1/MD5/SHA2 core */ #define SA_ENG_ID_AM1 4 /* Auth. engine with SHA1/MD5/SHA2 core */
#define SA_ENG_ID_AM2 5 /* Authentication engine for pass 2 */ #define SA_ENG_ID_AM2 5 /* Authentication engine for pass 2 */
#define SA_ENG_ID_OUTPORT2 20 /* Egress module 2 */ #define SA_ENG_ID_OUTPORT2 20 /* Egress module 2 */
#define SA_ENG_ID_NONE 0xff
/* /*
* Command Label Definitions * Command Label Definitions
...@@ -156,6 +155,13 @@ struct sa_tfm_ctx; ...@@ -156,6 +155,13 @@ struct sa_tfm_ctx;
#define SA_ALIGN_MASK (sizeof(u32) - 1) #define SA_ALIGN_MASK (sizeof(u32) - 1)
#define SA_ALIGNED __aligned(32) #define SA_ALIGNED __aligned(32)
#define SA_AUTH_SW_CTRL_MD5 1
#define SA_AUTH_SW_CTRL_SHA1 2
#define SA_AUTH_SW_CTRL_SHA224 3
#define SA_AUTH_SW_CTRL_SHA256 4
#define SA_AUTH_SW_CTRL_SHA384 5
#define SA_AUTH_SW_CTRL_SHA512 6
/* SA2UL can only handle maximum data size of 64KB */ /* SA2UL can only handle maximum data size of 64KB */
#define SA_MAX_DATA_SZ U16_MAX #define SA_MAX_DATA_SZ U16_MAX
...@@ -297,15 +303,31 @@ struct sa_tfm_ctx { ...@@ -297,15 +303,31 @@ struct sa_tfm_ctx {
struct sa_crypto_data *dev_data; struct sa_crypto_data *dev_data;
struct sa_ctx_info enc; struct sa_ctx_info enc;
struct sa_ctx_info dec; struct sa_ctx_info dec;
struct sa_ctx_info auth;
int keylen; int keylen;
int iv_idx; int iv_idx;
u32 key[AES_KEYSIZE_256 / sizeof(u32)]; u32 key[AES_KEYSIZE_256 / sizeof(u32)];
u8 authkey[SHA512_BLOCK_SIZE];
struct crypto_shash *shash;
/* for fallback */ /* for fallback */
union { union {
struct crypto_sync_skcipher *skcipher; struct crypto_sync_skcipher *skcipher;
struct crypto_ahash *ahash;
} fallback; } fallback;
}; };
/**
* struct sa_sha_req_ctx: Structure used for sha request
* @dev_data: struct sa_crypto_data pointer
* @cmdl: Complete command label with psdata and epib included
* @fallback_req: SW fallback request container
*/
struct sa_sha_req_ctx {
struct sa_crypto_data *dev_data;
u32 cmdl[SA_MAX_CMDL_WORDS + SA_PSDATA_CTX_WORDS];
struct ahash_request fallback_req;
};
enum sa_submode { enum sa_submode {
SA_MODE_GEN = 0, SA_MODE_GEN = 0,
SA_MODE_CCM, SA_MODE_CCM,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment