Commit 4eb76faf authored by Pascal van Leeuwen's avatar Pascal van Leeuwen Committed by Herbert Xu

crypto: inside-secure - Added support for basic AES-CCM

This patch adds support for the basic AES-CCM AEAD cipher suite.
Signed-off-by: default avatarPascal van Leeuwen <pvanleeuwen@verimatrix.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 50485dfb
...@@ -715,8 +715,7 @@ inline int safexcel_rdesc_check_errors(struct safexcel_crypto_priv *priv, ...@@ -715,8 +715,7 @@ inline int safexcel_rdesc_check_errors(struct safexcel_crypto_priv *priv,
} else if (rdesc->result_data.error_code & BIT(9)) { } else if (rdesc->result_data.error_code & BIT(9)) {
/* Authentication failed */ /* Authentication failed */
return -EBADMSG; return -EBADMSG;
} else if (!rdesc->result_data.error_code) }
return 0;
/* All other non-fatal errors */ /* All other non-fatal errors */
return -EINVAL; return -EINVAL;
...@@ -1009,6 +1008,7 @@ static struct safexcel_alg_template *safexcel_algs[] = { ...@@ -1009,6 +1008,7 @@ static struct safexcel_alg_template *safexcel_algs[] = {
&safexcel_alg_authenc_hmac_sha512_ctr_aes, &safexcel_alg_authenc_hmac_sha512_ctr_aes,
&safexcel_alg_xts_aes, &safexcel_alg_xts_aes,
&safexcel_alg_gcm, &safexcel_alg_gcm,
&safexcel_alg_ccm,
}; };
static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv) static int safexcel_register_algorithms(struct safexcel_crypto_priv *priv)
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
/* Static configuration */ /* Static configuration */
#define EIP197_DEFAULT_RING_SIZE 400 #define EIP197_DEFAULT_RING_SIZE 400
#define EIP197_MAX_TOKENS 10 #define EIP197_MAX_TOKENS 18
#define EIP197_MAX_RINGS 4 #define EIP197_MAX_RINGS 4
#define EIP197_FETCH_COUNT 1 #define EIP197_FETCH_COUNT 1
#define EIP197_MAX_BATCH_SZ 64 #define EIP197_MAX_BATCH_SZ 64
...@@ -330,6 +330,9 @@ struct safexcel_context_record { ...@@ -330,6 +330,9 @@ struct safexcel_context_record {
#define CONTEXT_CONTROL_CRYPTO_ALG_SHA384 (0x6 << 23) #define CONTEXT_CONTROL_CRYPTO_ALG_SHA384 (0x6 << 23)
#define CONTEXT_CONTROL_CRYPTO_ALG_SHA512 (0x5 << 23) #define CONTEXT_CONTROL_CRYPTO_ALG_SHA512 (0x5 << 23)
#define CONTEXT_CONTROL_CRYPTO_ALG_GHASH (0x4 << 23) #define CONTEXT_CONTROL_CRYPTO_ALG_GHASH (0x4 << 23)
#define CONTEXT_CONTROL_CRYPTO_ALG_XCBC128 (0x1 << 23)
#define CONTEXT_CONTROL_CRYPTO_ALG_XCBC192 (0x2 << 23)
#define CONTEXT_CONTROL_CRYPTO_ALG_XCBC256 (0x3 << 23)
#define CONTEXT_CONTROL_INV_FR (0x5 << 24) #define CONTEXT_CONTROL_INV_FR (0x5 << 24)
#define CONTEXT_CONTROL_INV_TR (0x6 << 24) #define CONTEXT_CONTROL_INV_TR (0x6 << 24)
...@@ -350,6 +353,9 @@ struct safexcel_context_record { ...@@ -350,6 +353,9 @@ struct safexcel_context_record {
#define CONTEXT_CONTROL_CRYPTO_STORE BIT(12) #define CONTEXT_CONTROL_CRYPTO_STORE BIT(12)
#define CONTEXT_CONTROL_HASH_STORE BIT(19) #define CONTEXT_CONTROL_HASH_STORE BIT(19)
#define EIP197_XCM_MODE_GCM 1
#define EIP197_XCM_MODE_CCM 2
/* The hash counter given to the engine in the context has a granularity of /* The hash counter given to the engine in the context has a granularity of
* 64 bits. * 64 bits.
*/ */
...@@ -464,6 +470,7 @@ static inline void eip197_noop_token(struct safexcel_token *token) ...@@ -464,6 +470,7 @@ static inline void eip197_noop_token(struct safexcel_token *token)
/* Instructions */ /* Instructions */
#define EIP197_TOKEN_INS_INSERT_HASH_DIGEST 0x1c #define EIP197_TOKEN_INS_INSERT_HASH_DIGEST 0x1c
#define EIP197_TOKEN_INS_ORIGIN_IV0 0x14 #define EIP197_TOKEN_INS_ORIGIN_IV0 0x14
#define EIP197_TOKEN_INS_ORIGIN_TOKEN 0x1b
#define EIP197_TOKEN_INS_ORIGIN_LEN(x) ((x) << 5) #define EIP197_TOKEN_INS_ORIGIN_LEN(x) ((x) << 5)
#define EIP197_TOKEN_INS_TYPE_OUTPUT BIT(5) #define EIP197_TOKEN_INS_TYPE_OUTPUT BIT(5)
#define EIP197_TOKEN_INS_TYPE_HASH BIT(6) #define EIP197_TOKEN_INS_TYPE_HASH BIT(6)
...@@ -797,5 +804,6 @@ extern struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_ctr_aes; ...@@ -797,5 +804,6 @@ extern struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_ctr_aes;
extern struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_ctr_aes; extern struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_ctr_aes;
extern struct safexcel_alg_template safexcel_alg_xts_aes; extern struct safexcel_alg_template safexcel_alg_xts_aes;
extern struct safexcel_alg_template safexcel_alg_gcm; extern struct safexcel_alg_template safexcel_alg_gcm;
extern struct safexcel_alg_template safexcel_alg_ccm;
#endif #endif
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