Commit aebe5bd7 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Herbert Xu

crypto: atmel-{aes,sha,tdes} - Group common alg type init in dedicated methods

Move common alg type init to dedicated methods.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7db15aad
...@@ -1288,12 +1288,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1288,12 +1288,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "ecb(aes)", .base.cra_name = "ecb(aes)",
.base.cra_driver_name = "atmel-ecb-aes", .base.cra_driver_name = "atmel-ecb-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_blocksize = AES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1305,12 +1301,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1305,12 +1301,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "cbc(aes)", .base.cra_name = "cbc(aes)",
.base.cra_driver_name = "atmel-cbc-aes", .base.cra_driver_name = "atmel-cbc-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_blocksize = AES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1323,12 +1315,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1323,12 +1315,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "ofb(aes)", .base.cra_name = "ofb(aes)",
.base.cra_driver_name = "atmel-ofb-aes", .base.cra_driver_name = "atmel-ofb-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_blocksize = AES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1341,12 +1329,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1341,12 +1329,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "cfb(aes)", .base.cra_name = "cfb(aes)",
.base.cra_driver_name = "atmel-cfb-aes", .base.cra_driver_name = "atmel-cfb-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_blocksize = AES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1359,12 +1343,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1359,12 +1343,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "cfb32(aes)", .base.cra_name = "cfb32(aes)",
.base.cra_driver_name = "atmel-cfb32-aes", .base.cra_driver_name = "atmel-cfb32-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB32_BLOCK_SIZE, .base.cra_blocksize = CFB32_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1377,12 +1357,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1377,12 +1357,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "cfb16(aes)", .base.cra_name = "cfb16(aes)",
.base.cra_driver_name = "atmel-cfb16-aes", .base.cra_driver_name = "atmel-cfb16-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB16_BLOCK_SIZE, .base.cra_blocksize = CFB16_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1395,12 +1371,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1395,12 +1371,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "cfb8(aes)", .base.cra_name = "cfb8(aes)",
.base.cra_driver_name = "atmel-cfb8-aes", .base.cra_driver_name = "atmel-cfb8-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB8_BLOCK_SIZE, .base.cra_blocksize = CFB8_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1413,12 +1385,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1413,12 +1385,8 @@ static struct skcipher_alg aes_algs[] = {
{ {
.base.cra_name = "ctr(aes)", .base.cra_name = "ctr(aes)",
.base.cra_driver_name = "atmel-ctr-aes", .base.cra_driver_name = "atmel-ctr-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = 1, .base.cra_blocksize = 1,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctr_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctr_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_ctr_init_tfm, .init = atmel_aes_ctr_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1433,12 +1401,8 @@ static struct skcipher_alg aes_algs[] = { ...@@ -1433,12 +1401,8 @@ static struct skcipher_alg aes_algs[] = {
static struct skcipher_alg aes_cfb64_alg = { static struct skcipher_alg aes_cfb64_alg = {
.base.cra_name = "cfb64(aes)", .base.cra_name = "cfb64(aes)",
.base.cra_driver_name = "atmel-cfb64-aes", .base.cra_driver_name = "atmel-cfb64-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB64_BLOCK_SIZE, .base.cra_blocksize = CFB64_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.init = atmel_aes_init_tfm, .init = atmel_aes_init_tfm,
.min_keysize = AES_MIN_KEY_SIZE, .min_keysize = AES_MIN_KEY_SIZE,
...@@ -1824,12 +1788,8 @@ static struct aead_alg aes_gcm_alg = { ...@@ -1824,12 +1788,8 @@ static struct aead_alg aes_gcm_alg = {
.base = { .base = {
.cra_name = "gcm(aes)", .cra_name = "gcm(aes)",
.cra_driver_name = "atmel-gcm-aes", .cra_driver_name = "atmel-gcm-aes",
.cra_priority = ATMEL_AES_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = 1, .cra_blocksize = 1,
.cra_ctxsize = sizeof(struct atmel_aes_gcm_ctx), .cra_ctxsize = sizeof(struct atmel_aes_gcm_ctx),
.cra_alignmask = 0xf,
.cra_module = THIS_MODULE,
}, },
}; };
...@@ -1946,12 +1906,8 @@ static int atmel_aes_xts_init_tfm(struct crypto_skcipher *tfm) ...@@ -1946,12 +1906,8 @@ static int atmel_aes_xts_init_tfm(struct crypto_skcipher *tfm)
static struct skcipher_alg aes_xts_alg = { static struct skcipher_alg aes_xts_alg = {
.base.cra_name = "xts(aes)", .base.cra_name = "xts(aes)",
.base.cra_driver_name = "atmel-xts-aes", .base.cra_driver_name = "atmel-xts-aes",
.base.cra_priority = ATMEL_AES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_blocksize = AES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_aes_xts_ctx), .base.cra_ctxsize = sizeof(struct atmel_aes_xts_ctx),
.base.cra_alignmask = 0xf,
.base.cra_module = THIS_MODULE,
.min_keysize = 2 * AES_MIN_KEY_SIZE, .min_keysize = 2 * AES_MIN_KEY_SIZE,
.max_keysize = 2 * AES_MAX_KEY_SIZE, .max_keysize = 2 * AES_MAX_KEY_SIZE,
...@@ -2251,12 +2207,8 @@ static struct aead_alg aes_authenc_algs[] = { ...@@ -2251,12 +2207,8 @@ static struct aead_alg aes_authenc_algs[] = {
.base = { .base = {
.cra_name = "authenc(hmac(sha1),cbc(aes))", .cra_name = "authenc(hmac(sha1),cbc(aes))",
.cra_driver_name = "atmel-authenc-hmac-sha1-cbc-aes", .cra_driver_name = "atmel-authenc-hmac-sha1-cbc-aes",
.cra_priority = ATMEL_AES_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = AES_BLOCK_SIZE, .cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx), .cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx),
.cra_alignmask = 0xf,
.cra_module = THIS_MODULE,
}, },
}, },
{ {
...@@ -2271,12 +2223,8 @@ static struct aead_alg aes_authenc_algs[] = { ...@@ -2271,12 +2223,8 @@ static struct aead_alg aes_authenc_algs[] = {
.base = { .base = {
.cra_name = "authenc(hmac(sha224),cbc(aes))", .cra_name = "authenc(hmac(sha224),cbc(aes))",
.cra_driver_name = "atmel-authenc-hmac-sha224-cbc-aes", .cra_driver_name = "atmel-authenc-hmac-sha224-cbc-aes",
.cra_priority = ATMEL_AES_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = AES_BLOCK_SIZE, .cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx), .cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx),
.cra_alignmask = 0xf,
.cra_module = THIS_MODULE,
}, },
}, },
{ {
...@@ -2291,12 +2239,8 @@ static struct aead_alg aes_authenc_algs[] = { ...@@ -2291,12 +2239,8 @@ static struct aead_alg aes_authenc_algs[] = {
.base = { .base = {
.cra_name = "authenc(hmac(sha256),cbc(aes))", .cra_name = "authenc(hmac(sha256),cbc(aes))",
.cra_driver_name = "atmel-authenc-hmac-sha256-cbc-aes", .cra_driver_name = "atmel-authenc-hmac-sha256-cbc-aes",
.cra_priority = ATMEL_AES_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = AES_BLOCK_SIZE, .cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx), .cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx),
.cra_alignmask = 0xf,
.cra_module = THIS_MODULE,
}, },
}, },
{ {
...@@ -2311,12 +2255,8 @@ static struct aead_alg aes_authenc_algs[] = { ...@@ -2311,12 +2255,8 @@ static struct aead_alg aes_authenc_algs[] = {
.base = { .base = {
.cra_name = "authenc(hmac(sha384),cbc(aes))", .cra_name = "authenc(hmac(sha384),cbc(aes))",
.cra_driver_name = "atmel-authenc-hmac-sha384-cbc-aes", .cra_driver_name = "atmel-authenc-hmac-sha384-cbc-aes",
.cra_priority = ATMEL_AES_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = AES_BLOCK_SIZE, .cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx), .cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx),
.cra_alignmask = 0xf,
.cra_module = THIS_MODULE,
}, },
}, },
{ {
...@@ -2331,12 +2271,8 @@ static struct aead_alg aes_authenc_algs[] = { ...@@ -2331,12 +2271,8 @@ static struct aead_alg aes_authenc_algs[] = {
.base = { .base = {
.cra_name = "authenc(hmac(sha512),cbc(aes))", .cra_name = "authenc(hmac(sha512),cbc(aes))",
.cra_driver_name = "atmel-authenc-hmac-sha512-cbc-aes", .cra_driver_name = "atmel-authenc-hmac-sha512-cbc-aes",
.cra_priority = ATMEL_AES_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC,
.cra_blocksize = AES_BLOCK_SIZE, .cra_blocksize = AES_BLOCK_SIZE,
.cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx), .cra_ctxsize = sizeof(struct atmel_aes_authenc_ctx),
.cra_alignmask = 0xf,
.cra_module = THIS_MODULE,
}, },
}, },
}; };
...@@ -2452,29 +2388,45 @@ static void atmel_aes_unregister_algs(struct atmel_aes_dev *dd) ...@@ -2452,29 +2388,45 @@ static void atmel_aes_unregister_algs(struct atmel_aes_dev *dd)
crypto_unregister_skcipher(&aes_algs[i]); crypto_unregister_skcipher(&aes_algs[i]);
} }
static void atmel_aes_crypto_alg_init(struct crypto_alg *alg)
{
alg->cra_flags = CRYPTO_ALG_ASYNC;
alg->cra_alignmask = 0xf;
alg->cra_priority = ATMEL_AES_PRIORITY;
alg->cra_module = THIS_MODULE;
}
static int atmel_aes_register_algs(struct atmel_aes_dev *dd) static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
{ {
int err, i, j; int err, i, j;
for (i = 0; i < ARRAY_SIZE(aes_algs); i++) { for (i = 0; i < ARRAY_SIZE(aes_algs); i++) {
atmel_aes_crypto_alg_init(&aes_algs[i].base);
err = crypto_register_skcipher(&aes_algs[i]); err = crypto_register_skcipher(&aes_algs[i]);
if (err) if (err)
goto err_aes_algs; goto err_aes_algs;
} }
if (dd->caps.has_cfb64) { if (dd->caps.has_cfb64) {
atmel_aes_crypto_alg_init(&aes_cfb64_alg.base);
err = crypto_register_skcipher(&aes_cfb64_alg); err = crypto_register_skcipher(&aes_cfb64_alg);
if (err) if (err)
goto err_aes_cfb64_alg; goto err_aes_cfb64_alg;
} }
if (dd->caps.has_gcm) { if (dd->caps.has_gcm) {
atmel_aes_crypto_alg_init(&aes_gcm_alg.base);
err = crypto_register_aead(&aes_gcm_alg); err = crypto_register_aead(&aes_gcm_alg);
if (err) if (err)
goto err_aes_gcm_alg; goto err_aes_gcm_alg;
} }
if (dd->caps.has_xts) { if (dd->caps.has_xts) {
atmel_aes_crypto_alg_init(&aes_xts_alg.base);
err = crypto_register_skcipher(&aes_xts_alg); err = crypto_register_skcipher(&aes_xts_alg);
if (err) if (err)
goto err_aes_xts_alg; goto err_aes_xts_alg;
...@@ -2483,6 +2435,8 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd) ...@@ -2483,6 +2435,8 @@ static int atmel_aes_register_algs(struct atmel_aes_dev *dd)
#if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC) #if IS_ENABLED(CONFIG_CRYPTO_DEV_ATMEL_AUTHENC)
if (dd->caps.has_authenc) { if (dd->caps.has_authenc) {
for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++) { for (i = 0; i < ARRAY_SIZE(aes_authenc_algs); i++) {
atmel_aes_crypto_alg_init(&aes_authenc_algs[i].base);
err = crypto_register_aead(&aes_authenc_algs[i]); err = crypto_register_aead(&aes_authenc_algs[i]);
if (err) if (err)
goto err_aes_authenc_alg; goto err_aes_authenc_alg;
......
This diff is collapsed.
...@@ -912,18 +912,23 @@ static int atmel_tdes_init_tfm(struct crypto_skcipher *tfm) ...@@ -912,18 +912,23 @@ static int atmel_tdes_init_tfm(struct crypto_skcipher *tfm)
return 0; return 0;
} }
static void atmel_tdes_skcipher_alg_init(struct skcipher_alg *alg)
{
alg->base.cra_priority = ATMEL_TDES_PRIORITY;
alg->base.cra_flags = CRYPTO_ALG_ASYNC;
alg->base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
alg->base.cra_module = THIS_MODULE;
alg->init = atmel_tdes_init_tfm;
}
static struct skcipher_alg tdes_algs[] = { static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ecb(des)", .base.cra_name = "ecb(des)",
.base.cra_driver_name = "atmel-ecb-des", .base.cra_driver_name = "atmel-ecb-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.setkey = atmel_des_setkey, .setkey = atmel_des_setkey,
...@@ -933,14 +938,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -933,14 +938,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cbc(des)", .base.cra_name = "cbc(des)",
.base.cra_driver_name = "atmel-cbc-des", .base.cra_driver_name = "atmel-cbc-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.ivsize = DES_BLOCK_SIZE, .ivsize = DES_BLOCK_SIZE,
...@@ -951,14 +951,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -951,14 +951,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb(des)", .base.cra_name = "cfb(des)",
.base.cra_driver_name = "atmel-cfb-des", .base.cra_driver_name = "atmel-cfb-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.ivsize = DES_BLOCK_SIZE, .ivsize = DES_BLOCK_SIZE,
...@@ -969,14 +964,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -969,14 +964,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb8(des)", .base.cra_name = "cfb8(des)",
.base.cra_driver_name = "atmel-cfb8-des", .base.cra_driver_name = "atmel-cfb8-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB8_BLOCK_SIZE, .base.cra_blocksize = CFB8_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0, .base.cra_alignmask = 0,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.ivsize = DES_BLOCK_SIZE, .ivsize = DES_BLOCK_SIZE,
...@@ -987,14 +977,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -987,14 +977,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb16(des)", .base.cra_name = "cfb16(des)",
.base.cra_driver_name = "atmel-cfb16-des", .base.cra_driver_name = "atmel-cfb16-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB16_BLOCK_SIZE, .base.cra_blocksize = CFB16_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x1, .base.cra_alignmask = 0x1,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.ivsize = DES_BLOCK_SIZE, .ivsize = DES_BLOCK_SIZE,
...@@ -1005,14 +990,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1005,14 +990,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cfb32(des)", .base.cra_name = "cfb32(des)",
.base.cra_driver_name = "atmel-cfb32-des", .base.cra_driver_name = "atmel-cfb32-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = CFB32_BLOCK_SIZE, .base.cra_blocksize = CFB32_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x3, .base.cra_alignmask = 0x3,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.ivsize = DES_BLOCK_SIZE, .ivsize = DES_BLOCK_SIZE,
...@@ -1023,14 +1003,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1023,14 +1003,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ofb(des)", .base.cra_name = "ofb(des)",
.base.cra_driver_name = "atmel-ofb-des", .base.cra_driver_name = "atmel-ofb-des",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES_KEY_SIZE, .min_keysize = DES_KEY_SIZE,
.max_keysize = DES_KEY_SIZE, .max_keysize = DES_KEY_SIZE,
.ivsize = DES_BLOCK_SIZE, .ivsize = DES_BLOCK_SIZE,
...@@ -1041,14 +1016,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1041,14 +1016,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ecb(des3_ede)", .base.cra_name = "ecb(des3_ede)",
.base.cra_driver_name = "atmel-ecb-tdes", .base.cra_driver_name = "atmel-ecb-tdes",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES3_EDE_KEY_SIZE, .min_keysize = DES3_EDE_KEY_SIZE,
.max_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE,
.setkey = atmel_tdes_setkey, .setkey = atmel_tdes_setkey,
...@@ -1058,14 +1028,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1058,14 +1028,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "cbc(des3_ede)", .base.cra_name = "cbc(des3_ede)",
.base.cra_driver_name = "atmel-cbc-tdes", .base.cra_driver_name = "atmel-cbc-tdes",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES3_EDE_KEY_SIZE, .min_keysize = DES3_EDE_KEY_SIZE,
.max_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE,
.setkey = atmel_tdes_setkey, .setkey = atmel_tdes_setkey,
...@@ -1076,14 +1041,9 @@ static struct skcipher_alg tdes_algs[] = { ...@@ -1076,14 +1041,9 @@ static struct skcipher_alg tdes_algs[] = {
{ {
.base.cra_name = "ofb(des3_ede)", .base.cra_name = "ofb(des3_ede)",
.base.cra_driver_name = "atmel-ofb-tdes", .base.cra_driver_name = "atmel-ofb-tdes",
.base.cra_priority = ATMEL_TDES_PRIORITY,
.base.cra_flags = CRYPTO_ALG_ASYNC,
.base.cra_blocksize = DES_BLOCK_SIZE, .base.cra_blocksize = DES_BLOCK_SIZE,
.base.cra_ctxsize = sizeof(struct atmel_tdes_ctx),
.base.cra_alignmask = 0x7, .base.cra_alignmask = 0x7,
.base.cra_module = THIS_MODULE,
.init = atmel_tdes_init_tfm,
.min_keysize = DES3_EDE_KEY_SIZE, .min_keysize = DES3_EDE_KEY_SIZE,
.max_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE,
.setkey = atmel_tdes_setkey, .setkey = atmel_tdes_setkey,
...@@ -1158,6 +1118,8 @@ static int atmel_tdes_register_algs(struct atmel_tdes_dev *dd) ...@@ -1158,6 +1118,8 @@ static int atmel_tdes_register_algs(struct atmel_tdes_dev *dd)
int err, i, j; int err, i, j;
for (i = 0; i < ARRAY_SIZE(tdes_algs); i++) { for (i = 0; i < ARRAY_SIZE(tdes_algs); i++) {
atmel_tdes_skcipher_alg_init(&tdes_algs[i]);
err = crypto_register_skcipher(&tdes_algs[i]); err = crypto_register_skcipher(&tdes_algs[i]);
if (err) if (err)
goto err_tdes_algs; goto err_tdes_algs;
......
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