]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
crypto: talitos - consolidate cra_type assignments
authorKim Phillips <kim.phillips@freescale.com>
Thu, 9 Aug 2012 01:32:00 +0000 (20:32 -0500)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 20 Aug 2012 08:40:00 +0000 (16:40 +0800)
lighten driver_algs[] by moving them to talitos_alg_alloc().

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/talitos.c

index 2c0754eb969ee867383289ba25e8388926d8c887..b7a69690839ecf7df03ffddb98e4f45a2da64cde 100644 (file)
@@ -1914,7 +1914,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha1-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -1940,7 +1939,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha1-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -1967,7 +1965,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha224-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -1993,7 +1990,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha224-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2020,7 +2016,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha256-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2046,7 +2041,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha256-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2073,7 +2067,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha384-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2099,7 +2092,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha384-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2126,7 +2118,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha512-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2152,7 +2143,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-sha512-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2179,7 +2169,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-md5-cbc-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2205,7 +2194,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_driver_name = "authenc-hmac-md5-cbc-3des-talitos",
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_aead_type,
                        .cra_aead = {
                                .setkey = aead_setkey,
                                .setauthsize = aead_setauthsize,
@@ -2234,7 +2222,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |
                                      CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_ablkcipher_type,
                        .cra_ablkcipher = {
                                .setkey = ablkcipher_setkey,
                                .encrypt = ablkcipher_encrypt,
@@ -2256,7 +2243,6 @@ static struct talitos_alg_template driver_algs[] = {
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |
                                      CRYPTO_ALG_ASYNC,
-                       .cra_type = &crypto_ablkcipher_type,
                        .cra_ablkcipher = {
                                .setkey = ablkcipher_setkey,
                                .encrypt = ablkcipher_encrypt,
@@ -2287,7 +2273,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = MD5_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2308,7 +2293,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA1_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2329,7 +2313,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA224_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2350,7 +2333,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA256_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2371,7 +2353,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA384_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2392,7 +2373,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA512_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2414,7 +2394,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = MD5_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2436,7 +2415,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA1_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2458,7 +2436,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA224_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2480,7 +2457,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA256_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2502,7 +2478,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA384_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2524,7 +2499,6 @@ static struct talitos_alg_template driver_algs[] = {
                                .cra_blocksize = SHA512_BLOCK_SIZE,
                                .cra_flags = CRYPTO_ALG_TYPE_AHASH |
                                             CRYPTO_ALG_ASYNC,
-                               .cra_type = &crypto_ahash_type
                        }
                },
                .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
@@ -2682,14 +2656,17 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
        case CRYPTO_ALG_TYPE_ABLKCIPHER:
                alg = &t_alg->algt.alg.crypto;
                alg->cra_init = talitos_cra_init;
+               alg->cra_type = &crypto_ablkcipher_type;
                break;
        case CRYPTO_ALG_TYPE_AEAD:
                alg = &t_alg->algt.alg.crypto;
                alg->cra_init = talitos_cra_init_aead;
+               alg->cra_type = &crypto_aead_type;
                break;
        case CRYPTO_ALG_TYPE_AHASH:
                alg = &t_alg->algt.alg.hash.halg.base;
                alg->cra_init = talitos_cra_init_ahash;
+               alg->cra_type = &crypto_ahash_type;
                if (!(priv->features & TALITOS_FTR_HMAC_OK) &&
                    !strncmp(alg->cra_name, "hmac", 4)) {
                        kfree(t_alg);