crypto: ccree - add support for older HW revs
Add support for the legacy CryptoCell 630 and 710 revs. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:

committed by
Herbert Xu

parent
9d3a45ea20
commit
27b3b22dd9
@@ -327,7 +327,7 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct cc_aead_ctx *ctx)
|
||||
/* Load the hash current length*/
|
||||
hw_desc_init(&desc[idx]);
|
||||
set_cipher_mode(&desc[idx], hash_mode);
|
||||
set_din_const(&desc[idx], 0, HASH_LEN_SIZE);
|
||||
set_din_const(&desc[idx], 0, ctx->drvdata->hash_len_sz);
|
||||
set_flow_mode(&desc[idx], S_DIN_to_HASH);
|
||||
set_setup_mode(&desc[idx], SETUP_LOAD_KEY0);
|
||||
idx++;
|
||||
@@ -465,7 +465,7 @@ static int cc_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key,
|
||||
/* Load the hash current length*/
|
||||
hw_desc_init(&desc[idx]);
|
||||
set_cipher_mode(&desc[idx], hashmode);
|
||||
set_din_const(&desc[idx], 0, HASH_LEN_SIZE);
|
||||
set_din_const(&desc[idx], 0, ctx->drvdata->hash_len_sz);
|
||||
set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED);
|
||||
set_flow_mode(&desc[idx], S_DIN_to_HASH);
|
||||
set_setup_mode(&desc[idx], SETUP_LOAD_KEY0);
|
||||
@@ -877,7 +877,7 @@ static void cc_proc_digest_desc(struct aead_request *req,
|
||||
set_setup_mode(&desc[idx], SETUP_WRITE_STATE0);
|
||||
set_dout_dlli(&desc[idx], req_ctx->icv_dma_addr, ctx->authsize,
|
||||
NS_BIT, 1);
|
||||
set_queue_last_ind(&desc[idx]);
|
||||
set_queue_last_ind(ctx->drvdata, &desc[idx]);
|
||||
if (ctx->auth_mode == DRV_HASH_XCBC_MAC) {
|
||||
set_aes_not_hash_mode(&desc[idx]);
|
||||
set_cipher_mode(&desc[idx], DRV_CIPHER_XCBC_MAC);
|
||||
@@ -893,7 +893,7 @@ static void cc_proc_digest_desc(struct aead_request *req,
|
||||
set_flow_mode(&desc[idx], S_HASH_to_DOUT);
|
||||
set_dout_dlli(&desc[idx], req_ctx->mac_buf_dma_addr,
|
||||
ctx->authsize, NS_BIT, 1);
|
||||
set_queue_last_ind(&desc[idx]);
|
||||
set_queue_last_ind(ctx->drvdata, &desc[idx]);
|
||||
set_cipher_config0(&desc[idx],
|
||||
HASH_DIGEST_RESULT_LITTLE_ENDIAN);
|
||||
set_cipher_config1(&desc[idx], HASH_PADDING_DISABLED);
|
||||
@@ -1001,7 +1001,7 @@ static void cc_set_hmac_desc(struct aead_request *req, struct cc_hw_desc desc[],
|
||||
hw_desc_init(&desc[idx]);
|
||||
set_cipher_mode(&desc[idx], hash_mode);
|
||||
set_din_sram(&desc[idx], cc_digest_len_addr(ctx->drvdata, hash_mode),
|
||||
HASH_LEN_SIZE);
|
||||
ctx->drvdata->hash_len_sz);
|
||||
set_flow_mode(&desc[idx], S_DIN_to_HASH);
|
||||
set_setup_mode(&desc[idx], SETUP_LOAD_KEY0);
|
||||
idx++;
|
||||
@@ -1098,7 +1098,7 @@ static void cc_proc_scheme_desc(struct aead_request *req,
|
||||
hw_desc_init(&desc[idx]);
|
||||
set_cipher_mode(&desc[idx], hash_mode);
|
||||
set_dout_sram(&desc[idx], aead_handle->sram_workspace_addr,
|
||||
HASH_LEN_SIZE);
|
||||
ctx->drvdata->hash_len_sz);
|
||||
set_flow_mode(&desc[idx], S_HASH_to_DOUT);
|
||||
set_setup_mode(&desc[idx], SETUP_WRITE_STATE1);
|
||||
set_cipher_do(&desc[idx], DO_PAD);
|
||||
@@ -1128,7 +1128,7 @@ static void cc_proc_scheme_desc(struct aead_request *req,
|
||||
hw_desc_init(&desc[idx]);
|
||||
set_cipher_mode(&desc[idx], hash_mode);
|
||||
set_din_sram(&desc[idx], cc_digest_len_addr(ctx->drvdata, hash_mode),
|
||||
HASH_LEN_SIZE);
|
||||
ctx->drvdata->hash_len_sz);
|
||||
set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED);
|
||||
set_flow_mode(&desc[idx], S_DIN_to_HASH);
|
||||
set_setup_mode(&desc[idx], SETUP_LOAD_KEY0);
|
||||
@@ -1509,7 +1509,7 @@ static int cc_ccm(struct aead_request *req, struct cc_hw_desc desc[],
|
||||
set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr,
|
||||
ctx->authsize, NS_BIT);
|
||||
set_dout_dlli(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1);
|
||||
set_queue_last_ind(&desc[idx]);
|
||||
set_queue_last_ind(ctx->drvdata, &desc[idx]);
|
||||
set_flow_mode(&desc[idx], DIN_AES_DOUT);
|
||||
idx++;
|
||||
|
||||
@@ -1772,7 +1772,7 @@ static void cc_proc_gcm_result(struct aead_request *req,
|
||||
set_din_type(&desc[idx], DMA_DLLI, req_ctx->mac_buf_dma_addr,
|
||||
AES_BLOCK_SIZE, NS_BIT);
|
||||
set_dout_dlli(&desc[idx], mac_result, ctx->authsize, NS_BIT, 1);
|
||||
set_queue_last_ind(&desc[idx]);
|
||||
set_queue_last_ind(ctx->drvdata, &desc[idx]);
|
||||
set_flow_mode(&desc[idx], DIN_AES_DOUT);
|
||||
idx++;
|
||||
|
||||
@@ -2358,6 +2358,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CBC,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_SHA1,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(hmac(sha1),cbc(des3_ede))",
|
||||
@@ -2377,6 +2378,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CBC,
|
||||
.flow_mode = S_DIN_to_DES,
|
||||
.auth_mode = DRV_HASH_SHA1,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(hmac(sha256),cbc(aes))",
|
||||
@@ -2396,6 +2398,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CBC,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_SHA256,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(hmac(sha256),cbc(des3_ede))",
|
||||
@@ -2415,6 +2418,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CBC,
|
||||
.flow_mode = S_DIN_to_DES,
|
||||
.auth_mode = DRV_HASH_SHA256,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(xcbc(aes),cbc(aes))",
|
||||
@@ -2434,6 +2438,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CBC,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_XCBC_MAC,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(hmac(sha1),rfc3686(ctr(aes)))",
|
||||
@@ -2453,6 +2458,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CTR,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_SHA1,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(hmac(sha256),rfc3686(ctr(aes)))",
|
||||
@@ -2472,6 +2478,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CTR,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_SHA256,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "authenc(xcbc(aes),rfc3686(ctr(aes)))",
|
||||
@@ -2491,6 +2498,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CTR,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_XCBC_MAC,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "ccm(aes)",
|
||||
@@ -2510,6 +2518,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CCM,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_NULL,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "rfc4309(ccm(aes))",
|
||||
@@ -2529,6 +2538,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_CCM,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_NULL,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "gcm(aes)",
|
||||
@@ -2548,6 +2558,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_GCTR,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_NULL,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "rfc4106(gcm(aes))",
|
||||
@@ -2567,6 +2578,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_GCTR,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_NULL,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
{
|
||||
.name = "rfc4543(gcm(aes))",
|
||||
@@ -2586,6 +2598,7 @@ static struct cc_alg_template aead_algs[] = {
|
||||
.cipher_mode = DRV_CIPHER_GCTR,
|
||||
.flow_mode = S_DIN_to_AES,
|
||||
.auth_mode = DRV_HASH_NULL,
|
||||
.min_hw_rev = CC_HW_REV_630,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2671,6 +2684,9 @@ int cc_aead_alloc(struct cc_drvdata *drvdata)
|
||||
|
||||
/* Linux crypto */
|
||||
for (alg = 0; alg < ARRAY_SIZE(aead_algs); alg++) {
|
||||
if (aead_algs[alg].min_hw_rev > drvdata->hw_rev)
|
||||
continue;
|
||||
|
||||
t_alg = cc_create_aead_alg(&aead_algs[alg], dev);
|
||||
if (IS_ERR(t_alg)) {
|
||||
rc = PTR_ERR(t_alg);
|
||||
|
Reference in New Issue
Block a user