Commit da38a83b authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Greg Kroah-Hartman

staging: ccree: remove last remnants of sblkcipher

The cipher code had some left overs of an attempt to support
synch. cipher API with the HW. Remove the code handling this.
Signed-off-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d3eff572
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#define MAX_ABLKCIPHER_SEQ_LEN 6 #define MAX_ABLKCIPHER_SEQ_LEN 6
#define template_ablkcipher template_u.ablkcipher #define template_ablkcipher template_u.ablkcipher
#define template_sblkcipher template_u.blkcipher
#define SSI_MIN_AES_XTS_SIZE 0x10 #define SSI_MIN_AES_XTS_SIZE 0x10
#define SSI_MAX_AES_XTS_SIZE 0x2000 #define SSI_MAX_AES_XTS_SIZE 0x2000
...@@ -886,69 +885,6 @@ static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __io ...@@ -886,69 +885,6 @@ static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __io
ivsize, areq, cc_base); ivsize, areq, cc_base);
} }
static int ssi_sblkcipher_init(struct crypto_tfm *tfm)
{
struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
/* Allocate sync ctx buffer */
ctx_p->sync_ctx = kmalloc(sizeof(struct blkcipher_req_ctx), GFP_KERNEL|GFP_DMA);
if (!ctx_p->sync_ctx) {
SSI_LOG_ERR("Allocating sync ctx buffer in context failed\n");
return -ENOMEM;
}
SSI_LOG_DEBUG("Allocated sync ctx buffer in context ctx_p->sync_ctx=@%p\n",
ctx_p->sync_ctx);
return ssi_blkcipher_init(tfm);
}
static void ssi_sblkcipher_exit(struct crypto_tfm *tfm)
{
struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
kfree(ctx_p->sync_ctx);
SSI_LOG_DEBUG("Free sync ctx buffer in context ctx_p->sync_ctx=@%p\n", ctx_p->sync_ctx);
ssi_blkcipher_exit(tfm);
}
#ifdef SYNC_ALGS
static int ssi_sblkcipher_encrypt(struct blkcipher_desc *desc,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes)
{
struct crypto_blkcipher *blk_tfm = desc->tfm;
struct crypto_tfm *tfm = crypto_blkcipher_tfm(blk_tfm);
struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
struct blkcipher_req_ctx *req_ctx = ctx_p->sync_ctx;
unsigned int ivsize = crypto_blkcipher_ivsize(blk_tfm);
req_ctx->backup_info = desc->info;
req_ctx->is_giv = false;
return ssi_blkcipher_process(tfm, req_ctx, dst, src, nbytes, desc->info, ivsize, NULL, DRV_CRYPTO_DIRECTION_ENCRYPT);
}
static int ssi_sblkcipher_decrypt(struct blkcipher_desc *desc,
struct scatterlist *dst, struct scatterlist *src,
unsigned int nbytes)
{
struct crypto_blkcipher *blk_tfm = desc->tfm;
struct crypto_tfm *tfm = crypto_blkcipher_tfm(blk_tfm);
struct ssi_ablkcipher_ctx *ctx_p = crypto_tfm_ctx(tfm);
struct blkcipher_req_ctx *req_ctx = ctx_p->sync_ctx;
unsigned int ivsize = crypto_blkcipher_ivsize(blk_tfm);
req_ctx->backup_info = desc->info;
req_ctx->is_giv = false;
return ssi_blkcipher_process(tfm, req_ctx, dst, src, nbytes, desc->info, ivsize, NULL, DRV_CRYPTO_DIRECTION_DECRYPT);
}
#endif
/* Async wrap functions */ /* Async wrap functions */
static int ssi_ablkcipher_init(struct crypto_tfm *tfm) static int ssi_ablkcipher_init(struct crypto_tfm *tfm)
...@@ -1014,7 +950,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1014,7 +950,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_XTS, .cipher_mode = DRV_CIPHER_XTS,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "xts(aes)", .name = "xts(aes)",
...@@ -1031,7 +966,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1031,7 +966,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_XTS, .cipher_mode = DRV_CIPHER_XTS,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "xts(aes)", .name = "xts(aes)",
...@@ -1048,7 +982,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1048,7 +982,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_XTS, .cipher_mode = DRV_CIPHER_XTS,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
#endif /*SSI_CC_HAS_AES_XTS*/ #endif /*SSI_CC_HAS_AES_XTS*/
#if SSI_CC_HAS_AES_ESSIV #if SSI_CC_HAS_AES_ESSIV
...@@ -1067,7 +1000,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1067,7 +1000,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_ESSIV, .cipher_mode = DRV_CIPHER_ESSIV,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "essiv(aes)", .name = "essiv(aes)",
...@@ -1084,7 +1016,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1084,7 +1016,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_ESSIV, .cipher_mode = DRV_CIPHER_ESSIV,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "essiv(aes)", .name = "essiv(aes)",
...@@ -1101,7 +1032,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1101,7 +1032,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_ESSIV, .cipher_mode = DRV_CIPHER_ESSIV,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
#endif /*SSI_CC_HAS_AES_ESSIV*/ #endif /*SSI_CC_HAS_AES_ESSIV*/
#if SSI_CC_HAS_AES_BITLOCKER #if SSI_CC_HAS_AES_BITLOCKER
...@@ -1120,7 +1050,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1120,7 +1050,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_BITLOCKER, .cipher_mode = DRV_CIPHER_BITLOCKER,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "bitlocker(aes)", .name = "bitlocker(aes)",
...@@ -1137,7 +1066,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1137,7 +1066,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_BITLOCKER, .cipher_mode = DRV_CIPHER_BITLOCKER,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "bitlocker(aes)", .name = "bitlocker(aes)",
...@@ -1154,7 +1082,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1154,7 +1082,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_BITLOCKER, .cipher_mode = DRV_CIPHER_BITLOCKER,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
#endif /*SSI_CC_HAS_AES_BITLOCKER*/ #endif /*SSI_CC_HAS_AES_BITLOCKER*/
{ {
...@@ -1172,7 +1099,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1172,7 +1099,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_ECB, .cipher_mode = DRV_CIPHER_ECB,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "cbc(aes)", .name = "cbc(aes)",
...@@ -1186,10 +1112,9 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1186,10 +1112,9 @@ static struct ssi_alg_template blkcipher_algs[] = {
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE, .max_keysize = AES_MAX_KEY_SIZE,
.ivsize = AES_BLOCK_SIZE, .ivsize = AES_BLOCK_SIZE,
}, },
.cipher_mode = DRV_CIPHER_CBC, .cipher_mode = DRV_CIPHER_CBC,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "ofb(aes)", .name = "ofb(aes)",
...@@ -1206,7 +1131,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1206,7 +1131,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_OFB, .cipher_mode = DRV_CIPHER_OFB,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
#if SSI_CC_HAS_AES_CTS #if SSI_CC_HAS_AES_CTS
{ {
...@@ -1224,7 +1148,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1224,7 +1148,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_CBC_CTS, .cipher_mode = DRV_CIPHER_CBC_CTS,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
#endif #endif
{ {
...@@ -1242,7 +1165,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1242,7 +1165,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_CTR, .cipher_mode = DRV_CIPHER_CTR,
.flow_mode = S_DIN_to_AES, .flow_mode = S_DIN_to_AES,
.synchronous = false,
}, },
{ {
.name = "cbc(des3_ede)", .name = "cbc(des3_ede)",
...@@ -1259,7 +1181,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1259,7 +1181,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_CBC, .cipher_mode = DRV_CIPHER_CBC,
.flow_mode = S_DIN_to_DES, .flow_mode = S_DIN_to_DES,
.synchronous = false,
}, },
{ {
.name = "ecb(des3_ede)", .name = "ecb(des3_ede)",
...@@ -1276,7 +1197,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1276,7 +1197,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_ECB, .cipher_mode = DRV_CIPHER_ECB,
.flow_mode = S_DIN_to_DES, .flow_mode = S_DIN_to_DES,
.synchronous = false,
}, },
{ {
.name = "cbc(des)", .name = "cbc(des)",
...@@ -1293,7 +1213,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1293,7 +1213,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_CBC, .cipher_mode = DRV_CIPHER_CBC,
.flow_mode = S_DIN_to_DES, .flow_mode = S_DIN_to_DES,
.synchronous = false,
}, },
{ {
.name = "ecb(des)", .name = "ecb(des)",
...@@ -1310,7 +1229,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1310,7 +1229,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_CIPHER_ECB, .cipher_mode = DRV_CIPHER_ECB,
.flow_mode = S_DIN_to_DES, .flow_mode = S_DIN_to_DES,
.synchronous = false,
}, },
#if SSI_CC_HAS_MULTI2 #if SSI_CC_HAS_MULTI2
{ {
...@@ -1328,7 +1246,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1328,7 +1246,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_MULTI2_CBC, .cipher_mode = DRV_MULTI2_CBC,
.flow_mode = S_DIN_to_MULTI2, .flow_mode = S_DIN_to_MULTI2,
.synchronous = false,
}, },
{ {
.name = "ofb(multi2)", .name = "ofb(multi2)",
...@@ -1345,7 +1262,6 @@ static struct ssi_alg_template blkcipher_algs[] = { ...@@ -1345,7 +1262,6 @@ static struct ssi_alg_template blkcipher_algs[] = {
}, },
.cipher_mode = DRV_MULTI2_OFB, .cipher_mode = DRV_MULTI2_OFB,
.flow_mode = S_DIN_to_MULTI2, .flow_mode = S_DIN_to_MULTI2,
.synchronous = false,
}, },
#endif /*SSI_CC_HAS_MULTI2*/ #endif /*SSI_CC_HAS_MULTI2*/
}; };
...@@ -1373,18 +1289,12 @@ struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *templa ...@@ -1373,18 +1289,12 @@ struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct ssi_alg_template *templa
alg->cra_alignmask = 0; alg->cra_alignmask = 0;
alg->cra_ctxsize = sizeof(struct ssi_ablkcipher_ctx); alg->cra_ctxsize = sizeof(struct ssi_ablkcipher_ctx);
alg->cra_init = template->synchronous? ssi_sblkcipher_init:ssi_ablkcipher_init; alg->cra_init = ssi_ablkcipher_init;
alg->cra_exit = template->synchronous? ssi_sblkcipher_exit:ssi_blkcipher_exit; alg->cra_exit = ssi_blkcipher_exit;
alg->cra_type = template->synchronous? &crypto_blkcipher_type:&crypto_ablkcipher_type; alg->cra_type = &crypto_ablkcipher_type;
if(template->synchronous) { alg->cra_ablkcipher = template->template_ablkcipher;
alg->cra_blkcipher = template->template_sblkcipher; alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY |
alg->cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY |
template->type;
} else {
alg->cra_ablkcipher = template->template_ablkcipher;
alg->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY |
template->type; template->type;
}
t_alg->cipher_mode = template->cipher_mode; t_alg->cipher_mode = template->cipher_mode;
t_alg->flow_mode = template->flow_mode; t_alg->flow_mode = template->flow_mode;
......
...@@ -176,7 +176,6 @@ struct ssi_alg_template { ...@@ -176,7 +176,6 @@ struct ssi_alg_template {
int cipher_mode; int cipher_mode;
int flow_mode; /* Note: currently, refers to the cipher mode only. */ int flow_mode; /* Note: currently, refers to the cipher mode only. */
int auth_mode; int auth_mode;
bool synchronous;
struct ssi_drvdata *drvdata; struct ssi_drvdata *drvdata;
}; };
......
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