[CRYPTO] cipher: Set alignmask for multi-byte loads
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 7 Jan 2006 05:38:15 +0000 (16:38 +1100)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 9 Jan 2006 22:16:00 +0000 (14:16 -0800)
Many cipher implementations use 4-byte/8-byte loads/stores which require
alignment on some architectures.  This patch explicitly sets the alignment
requirements for them.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/aes.c
crypto/anubis.c
crypto/blowfish.c
crypto/cast5.c
crypto/cast6.c
crypto/des.c
crypto/khazad.c
crypto/serpent.c
crypto/tea.c
crypto/twofish.c

index b9b2afb427928cc7c4ae8f0e513282e701568ecc..0a6a5c14368684937bf8ca9b4bd866fea06d0e15 100644 (file)
@@ -423,6 +423,7 @@ static struct crypto_alg aes_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       AES_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof(struct aes_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(aes_alg.cra_list),
        .cra_u                  =       {
index 94c4b1f3e3a72399fd037884454f0db6e3cb266a..2c796bdb91a6e7f6e60f3bf302250fa6c70d668b 100644 (file)
@@ -677,6 +677,7 @@ static struct crypto_alg anubis_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       ANUBIS_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof (struct anubis_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(anubis_alg.cra_list),
        .cra_u                  =       { .cipher = {
index 99fc45950d5064c9a9049eba11995243274b59dd..7f710b201f2059cf66f8e2ffb4c2002cd8e14115 100644 (file)
@@ -453,6 +453,7 @@ static struct crypto_alg alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       BF_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof(struct bf_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(alg.cra_list),
        .cra_u                  =       { .cipher = {
index 282641c974a80538ca496a3da335b555f0b624de..8834c8580c04c0b3cf0f2931900bb2c28df6d606 100644 (file)
@@ -809,6 +809,7 @@ static struct crypto_alg alg = {
        .cra_flags      = CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize  = CAST5_BLOCK_SIZE,
        .cra_ctxsize    = sizeof(struct cast5_ctx),
+       .cra_alignmask  = 3,
        .cra_module     = THIS_MODULE,
        .cra_list       = LIST_HEAD_INIT(alg.cra_list),
        .cra_u          = {
index d317fff6ea103f8fee37804e946deba57049ec35..9e28740ba7753fe79fb6dc869cbc4c8b7f9e4d9e 100644 (file)
@@ -513,6 +513,7 @@ static struct crypto_alg alg = {
        .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize = CAST6_BLOCK_SIZE,
        .cra_ctxsize = sizeof(struct cast6_ctx),
+       .cra_alignmask = 3,
        .cra_module = THIS_MODULE,
        .cra_list = LIST_HEAD_INIT(alg.cra_list),
        .cra_u = {
index dae42981012cc620bfeab74e6331dbfe11ddbea2..7bb548653dc68752f8facabda96dc463c0c437a2 100644 (file)
@@ -949,6 +949,7 @@ static struct crypto_alg des_alg = {
        .cra_blocksize          =       DES_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof(struct des_ctx),
        .cra_module             =       THIS_MODULE,
+       .cra_alignmask          =       3,
        .cra_list               =       LIST_HEAD_INIT(des_alg.cra_list),
        .cra_u                  =       { .cipher = {
        .cia_min_keysize        =       DES_KEY_SIZE,
index 6809210362c1ee97a938be5b90beb30362094960..807f2bf4ea24fac9869a8aa5a91e0825fe6ed8fe 100644 (file)
@@ -857,6 +857,7 @@ static struct crypto_alg khazad_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       KHAZAD_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof (struct khazad_ctx),
+       .cra_alignmask          =       7,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(khazad_alg.cra_list),
        .cra_u                  =       { .cipher = {
index a950ff85f632a486e282472e1b0a89f7194ac6b4..52ad1a492620c09c5f0505f52285514fff68961b 100644 (file)
@@ -553,6 +553,7 @@ static struct crypto_alg tnepres_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       SERPENT_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof(struct serpent_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(serpent_alg.cra_list),
        .cra_u                  =       { .cipher = {
index e0077c72ec2aa3e78f1de2eaf541afc3c45b4ffc..a6a02b30e47072b76f41a695343709a82e21a4d3 100644 (file)
@@ -240,6 +240,7 @@ static struct crypto_alg tea_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       TEA_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof (struct tea_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(tea_alg.cra_list),
        .cra_u                  =       { .cipher = {
@@ -255,6 +256,7 @@ static struct crypto_alg xtea_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       XTEA_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof (struct xtea_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(xtea_alg.cra_list),
        .cra_u                  =       { .cipher = {
@@ -270,6 +272,7 @@ static struct crypto_alg xeta_alg = {
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       XTEA_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof (struct xtea_ctx),
+       .cra_alignmask          =       3,
        .cra_module             =       THIS_MODULE,
        .cra_list               =       LIST_HEAD_INIT(xtea_alg.cra_list),
        .cra_u                  =       { .cipher = {
index b501d5ab9c45d8660c9d43139729ba49aa306227..a26d885486fba45f65942055b8365091d988ec6e 100644 (file)
@@ -879,6 +879,7 @@ static struct crypto_alg alg = {
        .cra_flags          =   CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize      =   TF_BLOCK_SIZE,
        .cra_ctxsize        =   sizeof(struct twofish_ctx),
+       .cra_alignmask      =   3,
        .cra_module         =   THIS_MODULE,
        .cra_list           =   LIST_HEAD_INIT(alg.cra_list),
        .cra_u              =   { .cipher = {