aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch')
-rw-r--r--target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch240
1 files changed, 120 insertions, 120 deletions
diff --git a/target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch b/target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch
index a2d64367c4..5cc6fa4c9b 100644
--- a/target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch
+++ b/target/linux/generic-2.6/patches-2.6.26/910-cryptodev_backport.patch
@@ -1,6 +1,6 @@
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
-@@ -65,6 +65,7 @@
+@@ -65,6 +65,7 @@ config CRYPTO_NULL
config CRYPTO_CRYPTD
tristate "Software async crypto daemon"
select CRYPTO_BLKCIPHER
@@ -8,7 +8,7 @@
select CRYPTO_MANAGER
help
This is a generic software asynchronous crypto daemon that
-@@ -212,7 +213,7 @@
+@@ -212,7 +213,7 @@ comment "Digest"
config CRYPTO_CRC32C
tristate "CRC32c CRC algorithm"
@@ -17,7 +17,7 @@
select LIBCRC32C
help
Castagnoli, et al Cyclic Redundancy-Check Algorithm. Used
-@@ -241,6 +242,57 @@
+@@ -241,6 +242,57 @@ config CRYPTO_MICHAEL_MIC
should not be used for other purposes because of the weakness
of the algorithm.
@@ -75,7 +75,7 @@
config CRYPTO_SHA1
tristate "SHA1 digest algorithm"
select CRYPTO_ALGAPI
-@@ -614,6 +666,15 @@
+@@ -614,6 +666,15 @@ config CRYPTO_LZO
help
This is the LZO algorithm.
@@ -93,7 +93,7 @@
endif # if CRYPTO
--- a/crypto/Makefile
+++ b/crypto/Makefile
-@@ -19,6 +19,7 @@
+@@ -19,6 +19,7 @@ obj-$(CONFIG_CRYPTO_BLKCIPHER) += crypto
obj-$(CONFIG_CRYPTO_SEQIV) += seqiv.o
crypto_hash-objs := hash.o
@@ -101,7 +101,7 @@
obj-$(CONFIG_CRYPTO_HASH) += crypto_hash.o
obj-$(CONFIG_CRYPTO_MANAGER) += cryptomgr.o
-@@ -27,6 +28,10 @@
+@@ -27,6 +28,10 @@ obj-$(CONFIG_CRYPTO_XCBC) += xcbc.o
obj-$(CONFIG_CRYPTO_NULL) += crypto_null.o
obj-$(CONFIG_CRYPTO_MD4) += md4.o
obj-$(CONFIG_CRYPTO_MD5) += md5.o
@@ -112,7 +112,7 @@
obj-$(CONFIG_CRYPTO_SHA1) += sha1_generic.o
obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
-@@ -64,7 +69,7 @@
+@@ -64,7 +69,7 @@ obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += mich
obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o
obj-$(CONFIG_CRYPTO_LZO) += lzo.o
@@ -320,7 +320,7 @@
+MODULE_DESCRIPTION("Asynchronous cryptographic hash type");
--- a/crypto/api.c
+++ b/crypto/api.c
-@@ -235,8 +235,12 @@
+@@ -235,8 +235,12 @@ static int crypto_init_ops(struct crypto
return crypto_init_cipher_ops(tfm);
case CRYPTO_ALG_TYPE_DIGEST:
@@ -346,7 +346,7 @@
static const u32 camellia_sp1110[256] = {
0x70707000,0x82828200,0x2c2c2c00,0xececec00,
-@@ -335,20 +337,6 @@
+@@ -335,20 +337,6 @@ static const u32 camellia_sp4404[256] =
/*
* macros
*/
@@ -367,7 +367,7 @@
#define ROLDQ(ll, lr, rl, rr, w0, w1, bits) \
do { \
w0 = ll; \
-@@ -383,7 +371,7 @@
+@@ -383,7 +371,7 @@ static const u32 camellia_sp4404[256] =
^ camellia_sp3033[(u8)(il >> 8)] \
^ camellia_sp4404[(u8)(il )]; \
yl ^= yr; \
@@ -376,7 +376,7 @@
yr ^= yl; \
} while(0)
-@@ -405,7 +393,7 @@
+@@ -405,7 +393,7 @@ static void camellia_setup_tail(u32 *sub
subL[7] ^= subL[1]; subR[7] ^= subR[1];
subL[1] ^= subR[1] & ~subR[9];
dw = subL[1] & subL[9],
@@ -385,7 +385,7 @@
/* round 8 */
subL[11] ^= subL[1]; subR[11] ^= subR[1];
/* round 10 */
-@@ -414,7 +402,7 @@
+@@ -414,7 +402,7 @@ static void camellia_setup_tail(u32 *sub
subL[15] ^= subL[1]; subR[15] ^= subR[1];
subL[1] ^= subR[1] & ~subR[17];
dw = subL[1] & subL[17],
@@ -394,7 +394,7 @@
/* round 14 */
subL[19] ^= subL[1]; subR[19] ^= subR[1];
/* round 16 */
-@@ -430,7 +418,7 @@
+@@ -430,7 +418,7 @@ static void camellia_setup_tail(u32 *sub
} else {
subL[1] ^= subR[1] & ~subR[25];
dw = subL[1] & subL[25],
@@ -403,7 +403,7 @@
/* round 20 */
subL[27] ^= subL[1]; subR[27] ^= subR[1];
/* round 22 */
-@@ -450,7 +438,7 @@
+@@ -450,7 +438,7 @@ static void camellia_setup_tail(u32 *sub
subL[26] ^= kw4l; subR[26] ^= kw4r;
kw4l ^= kw4r & ~subR[24];
dw = kw4l & subL[24],
@@ -412,7 +412,7 @@
}
/* round 17 */
subL[22] ^= kw4l; subR[22] ^= kw4r;
-@@ -460,7 +448,7 @@
+@@ -460,7 +448,7 @@ static void camellia_setup_tail(u32 *sub
subL[18] ^= kw4l; subR[18] ^= kw4r;
kw4l ^= kw4r & ~subR[16];
dw = kw4l & subL[16],
@@ -421,7 +421,7 @@
/* round 11 */
subL[14] ^= kw4l; subR[14] ^= kw4r;
/* round 9 */
-@@ -469,7 +457,7 @@
+@@ -469,7 +457,7 @@ static void camellia_setup_tail(u32 *sub
subL[10] ^= kw4l; subR[10] ^= kw4r;
kw4l ^= kw4r & ~subR[8];
dw = kw4l & subL[8],
@@ -430,7 +430,7 @@
/* round 5 */
subL[6] ^= kw4l; subR[6] ^= kw4r;
/* round 3 */
-@@ -494,7 +482,7 @@
+@@ -494,7 +482,7 @@ static void camellia_setup_tail(u32 *sub
SUBKEY_R(6) = subR[5] ^ subR[7];
tl = subL[10] ^ (subR[10] & ~subR[8]);
dw = tl & subL[8], /* FL(kl1) */
@@ -439,7 +439,7 @@
SUBKEY_L(7) = subL[6] ^ tl; /* round 6 */
SUBKEY_R(7) = subR[6] ^ tr;
SUBKEY_L(8) = subL[8]; /* FL(kl1) */
-@@ -503,7 +491,7 @@
+@@ -503,7 +491,7 @@ static void camellia_setup_tail(u32 *sub
SUBKEY_R(9) = subR[9];
tl = subL[7] ^ (subR[7] & ~subR[9]);
dw = tl & subL[9], /* FLinv(kl2) */
@@ -448,7 +448,7 @@
SUBKEY_L(10) = tl ^ subL[11]; /* round 7 */
SUBKEY_R(10) = tr ^ subR[11];
SUBKEY_L(11) = subL[10] ^ subL[12]; /* round 8 */
-@@ -516,7 +504,7 @@
+@@ -516,7 +504,7 @@ static void camellia_setup_tail(u32 *sub
SUBKEY_R(14) = subR[13] ^ subR[15];
tl = subL[18] ^ (subR[18] & ~subR[16]);
dw = tl & subL[16], /* FL(kl3) */
@@ -457,7 +457,7 @@
SUBKEY_L(15) = subL[14] ^ tl; /* round 12 */
SUBKEY_R(15) = subR[14] ^ tr;
SUBKEY_L(16) = subL[16]; /* FL(kl3) */
-@@ -525,7 +513,7 @@
+@@ -525,7 +513,7 @@ static void camellia_setup_tail(u32 *sub
SUBKEY_R(17) = subR[17];
tl = subL[15] ^ (subR[15] & ~subR[17]);
dw = tl & subL[17], /* FLinv(kl4) */
@@ -466,7 +466,7 @@
SUBKEY_L(18) = tl ^ subL[19]; /* round 13 */
SUBKEY_R(18) = tr ^ subR[19];
SUBKEY_L(19) = subL[18] ^ subL[20]; /* round 14 */
-@@ -544,7 +532,7 @@
+@@ -544,7 +532,7 @@ static void camellia_setup_tail(u32 *sub
} else {
tl = subL[26] ^ (subR[26] & ~subR[24]);
dw = tl & subL[24], /* FL(kl5) */
@@ -475,7 +475,7 @@
SUBKEY_L(23) = subL[22] ^ tl; /* round 18 */
SUBKEY_R(23) = subR[22] ^ tr;
SUBKEY_L(24) = subL[24]; /* FL(kl5) */
-@@ -553,7 +541,7 @@
+@@ -553,7 +541,7 @@ static void camellia_setup_tail(u32 *sub
SUBKEY_R(25) = subR[25];
tl = subL[23] ^ (subR[23] & ~subR[25]);
dw = tl & subL[25], /* FLinv(kl6) */
@@ -484,7 +484,7 @@
SUBKEY_L(26) = tl ^ subL[27]; /* round 19 */
SUBKEY_R(26) = tr ^ subR[27];
SUBKEY_L(27) = subL[26] ^ subL[28]; /* round 20 */
-@@ -573,17 +561,17 @@
+@@ -573,17 +561,17 @@ static void camellia_setup_tail(u32 *sub
/* apply the inverse of the last half of P-function */
i = 2;
do {
@@ -508,7 +508,7 @@
SUBKEY_R(i + 5) = SUBKEY_L(i + 5) ^ dw; SUBKEY_L(i + 5) = dw;
i += 8;
} while (i < max);
-@@ -599,10 +587,10 @@
+@@ -599,10 +587,10 @@ static void camellia_setup128(const unsi
/**
* k == kll || klr || krl || krr (|| is concatenation)
*/
@@ -523,7 +523,7 @@
/* generate KL dependent subkeys */
/* kw1 */
-@@ -707,14 +695,14 @@
+@@ -707,14 +695,14 @@ static void camellia_setup256(const unsi
* key = (kll || klr || krl || krr || krll || krlr || krrl || krrr)
* (|| is concatenation)
*/
@@ -546,7 +546,7 @@
/* generate KL dependent subkeys */
/* kw1 */
-@@ -870,13 +858,13 @@
+@@ -870,13 +858,13 @@ static void camellia_setup192(const unsi
t0 &= ll; \
t2 |= rr; \
rl ^= t2; \
@@ -562,7 +562,7 @@
} while(0)
#define CAMELLIA_ROUNDSM(xl, xr, kl, kr, yl, yr, il, ir) \
-@@ -892,7 +880,7 @@
+@@ -892,7 +880,7 @@ static void camellia_setup192(const unsi
il ^= kl; \
ir ^= il ^ kr; \
yl ^= ir; \
@@ -605,7 +605,7 @@
#define CHKSUM_DIGEST_SIZE 4
struct chksum_ctx {
-@@ -27,7 +30,7 @@
+@@ -27,7 +30,7 @@ struct chksum_ctx {
};
/*
@@ -614,7 +614,7 @@
* crc using table.
*/
-@@ -67,11 +70,11 @@
+@@ -67,11 +70,11 @@ static void chksum_update(struct crypto_
static void chksum_final(struct crypto_tfm *tfm, u8 *out)
{
struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
@@ -628,7 +628,7 @@
{
struct chksum_ctx *mctx = crypto_tfm_ctx(tfm);
-@@ -79,14 +82,14 @@
+@@ -79,14 +82,14 @@ static int crc32c_cra_init(struct crypto
return 0;
}
@@ -646,7 +646,7 @@
.cra_u = {
.digest = {
.dia_digestsize= CHKSUM_DIGEST_SIZE,
-@@ -98,14 +101,125 @@
+@@ -98,14 +101,125 @@ static struct crypto_alg alg = {
}
};
@@ -783,7 +783,7 @@
#include <linux/err.h>
#include <linux/init.h>
#include <linux/kernel.h>
-@@ -45,6 +46,13 @@
+@@ -45,6 +46,13 @@ struct cryptd_blkcipher_request_ctx {
crypto_completion_t complete;
};
@@ -797,7 +797,7 @@
static inline struct cryptd_state *cryptd_get_state(struct crypto_tfm *tfm)
{
-@@ -82,10 +90,8 @@
+@@ -82,10 +90,8 @@ static void cryptd_blkcipher_crypt(struc
rctx = ablkcipher_request_ctx(req);
@@ -810,7 +810,7 @@
desc.tfm = child;
desc.info = req->info;
-@@ -95,8 +101,9 @@
+@@ -95,8 +101,9 @@ static void cryptd_blkcipher_crypt(struc
req->base.complete = rctx->complete;
@@ -821,7 +821,7 @@
local_bh_enable();
}
-@@ -261,6 +268,240 @@
+@@ -261,6 +268,240 @@ out_put_alg:
return inst;
}
@@ -1062,7 +1062,7 @@
static struct cryptd_state state;
static struct crypto_instance *cryptd_alloc(struct rtattr **tb)
-@@ -274,6 +515,8 @@
+@@ -274,6 +515,8 @@ static struct crypto_instance *cryptd_al
switch (algt->type & algt->mask & CRYPTO_ALG_TYPE_MASK) {
case CRYPTO_ALG_TYPE_BLKCIPHER:
return cryptd_alloc_blkcipher(tb, &state);
@@ -1081,7 +1081,7 @@
#include <crypto/scatterwalk.h>
#include <linux/mm.h>
#include <linux/errno.h>
-@@ -141,7 +142,7 @@
+@@ -141,7 +142,7 @@ int crypto_init_digest_ops(struct crypto
struct hash_tfm *ops = &tfm->crt_hash;
struct digest_alg *dalg = &tfm->__crt_alg->cra_digest;
@@ -1090,7 +1090,7 @@
return -EINVAL;
ops->init = init;
-@@ -157,3 +158,83 @@
+@@ -157,3 +158,83 @@ int crypto_init_digest_ops(struct crypto
void crypto_exit_digest_ops(struct crypto_tfm *tfm)
{
}
@@ -1184,7 +1184,7 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
-@@ -59,24 +60,107 @@
+@@ -59,24 +60,107 @@ static int hash_setkey(struct crypto_has
return alg->setkey(crt, key, keylen);
}
@@ -1303,7 +1303,7 @@
static void crypto_hash_show(struct seq_file *m, struct crypto_alg *alg)
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
-@@ -226,6 +226,7 @@
+@@ -226,6 +226,7 @@ static struct crypto_instance *hmac_allo
struct crypto_instance *inst;
struct crypto_alg *alg;
int err;
@@ -1311,7 +1311,7 @@
err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_HASH);
if (err)
-@@ -236,6 +237,13 @@
+@@ -236,6 +237,13 @@ static struct crypto_instance *hmac_allo
if (IS_ERR(alg))
return ERR_CAST(alg);
@@ -1325,7 +1325,7 @@
inst = crypto_alloc_instance("hmac", alg);
if (IS_ERR(inst))
goto out_put_alg;
-@@ -246,14 +254,10 @@
+@@ -246,14 +254,10 @@ static struct crypto_instance *hmac_allo
inst->alg.cra_alignmask = alg->cra_alignmask;
inst->alg.cra_type = &crypto_hash_type;
@@ -1344,7 +1344,7 @@
inst->alg.cra_init = hmac_init_tfm;
--- a/crypto/internal.h
+++ b/crypto/internal.h
-@@ -86,6 +86,7 @@
+@@ -86,6 +86,7 @@ struct crypto_alg *__crypto_alg_lookup(c
struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask);
int crypto_init_digest_ops(struct crypto_tfm *tfm);
@@ -3329,7 +3329,7 @@
#define IDX2 32400
#define IDX3 1
#define IDX4 8193
-@@ -83,7 +76,8 @@
+@@ -83,7 +76,8 @@ static char *check[] = {
"blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes",
"cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
"khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt",
@@ -3339,7 +3339,7 @@
};
static void hexdump(unsigned char *buf, unsigned int len)
-@@ -110,22 +104,30 @@
+@@ -110,22 +104,30 @@ static void test_hash(char *algo, struct
unsigned int i, j, k, temp;
struct scatterlist sg[8];
char result[64];
@@ -3375,7 +3375,7 @@
for (i = 0; i < tcount; i++) {
printk("test %u:\n", i + 1);
-@@ -139,8 +141,9 @@
+@@ -139,8 +141,9 @@ static void test_hash(char *algo, struct
sg_init_one(&sg[0], hash_buff, template[i].psize);
if (template[i].ksize) {
@@ -3387,7 +3387,7 @@
if (ret) {
printk("setkey() failed ret=%d\n", ret);
kfree(hash_buff);
-@@ -148,17 +151,30 @@
+@@ -148,17 +151,30 @@ static void test_hash(char *algo, struct
}
}
@@ -3422,7 +3422,7 @@
"fail" : "pass");
kfree(hash_buff);
}
-@@ -187,8 +203,9 @@
+@@ -187,8 +203,9 @@ static void test_hash(char *algo, struct
}
if (template[i].ksize) {
@@ -3434,7 +3434,7 @@
if (ret) {
printk("setkey() failed ret=%d\n", ret);
-@@ -196,29 +213,44 @@
+@@ -196,29 +213,44 @@ static void test_hash(char *algo, struct
}
}
@@ -3486,7 +3486,7 @@
char *q;
struct crypto_aead *tfm;
char *key;
-@@ -344,13 +376,12 @@
+@@ -344,13 +376,12 @@ static void test_aead(char *algo, int en
goto next_one;
}
@@ -3501,7 +3501,7 @@
next_one:
if (!template[i].key)
kfree(key);
-@@ -360,7 +391,6 @@
+@@ -360,7 +391,6 @@ next_one:
}
printk(KERN_INFO "\ntesting %s %s across pages (chunking)\n", algo, e);
@@ -3509,7 +3509,7 @@
memset(axbuf, 0, XBUFSIZE);
for (i = 0, j = 0; i < tcount; i++) {
-@@ -388,6 +418,7 @@
+@@ -388,6 +418,7 @@ next_one:
goto out;
}
@@ -3517,7 +3517,7 @@
sg_init_table(sg, template[i].np);
for (k = 0, temp = 0; k < template[i].np; k++) {
memcpy(&xbuf[IDX[k]],
-@@ -450,7 +481,7 @@
+@@ -450,7 +481,7 @@ next_one:
for (k = 0, temp = 0; k < template[i].np; k++) {
printk(KERN_INFO "page %u\n", k);
@@ -3526,7 +3526,7 @@
hexdump(q, template[i].tap[k]);
printk(KERN_INFO "%s\n",
memcmp(q, template[i].result + temp,
-@@ -459,8 +490,15 @@
+@@ -459,8 +490,15 @@ next_one:
0 : authsize)) ?
"fail" : "pass");
@@ -3543,7 +3543,7 @@
}
}
}
-@@ -473,7 +511,7 @@
+@@ -473,7 +511,7 @@ out:
static void test_cipher(char *algo, int enc,
struct cipher_testvec *template, unsigned int tcount)
{
@@ -3552,7 +3552,7 @@
char *q;
struct crypto_ablkcipher *tfm;
struct ablkcipher_request *req;
-@@ -569,19 +607,17 @@
+@@ -569,19 +607,17 @@ static void test_cipher(char *algo, int
goto out;
}
@@ -3573,7 +3573,7 @@
j = 0;
for (i = 0; i < tcount; i++) {
-@@ -596,6 +632,7 @@
+@@ -596,6 +632,7 @@ static void test_cipher(char *algo, int
printk("test %u (%d bit key):\n",
j, template[i].klen * 8);
@@ -3581,7 +3581,7 @@
crypto_ablkcipher_clear_flags(tfm, ~0);
if (template[i].wk)
crypto_ablkcipher_set_flags(
-@@ -649,14 +686,21 @@
+@@ -649,14 +686,21 @@ static void test_cipher(char *algo, int
temp = 0;
for (k = 0; k < template[i].np; k++) {
printk("page %u\n", k);
@@ -3605,7 +3605,7 @@
}
}
}
-@@ -1172,6 +1216,14 @@
+@@ -1172,6 +1216,14 @@ static void do_test(void)
test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template,
DES3_EDE_DEC_TEST_VECTORS);
@@ -3620,7 +3620,7 @@
test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS);
-@@ -1382,6 +1434,14 @@
+@@ -1382,6 +1434,14 @@ static void do_test(void)
DES3_EDE_ENC_TEST_VECTORS);
test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template,
DES3_EDE_DEC_TEST_VECTORS);
@@ -3635,7 +3635,7 @@
break;
case 5:
-@@ -1550,7 +1610,7 @@
+@@ -1550,7 +1610,7 @@ static void do_test(void)
case 29:
test_hash("tgr128", tgr128_tv_template, TGR128_TEST_VECTORS);
break;
@@ -3644,7 +3644,7 @@
case 30:
test_cipher("ecb(xeta)", ENCRYPT, xeta_enc_tv_template,
XETA_ENC_TEST_VECTORS);
-@@ -1615,6 +1675,22 @@
+@@ -1615,6 +1675,22 @@ static void do_test(void)
CTS_MODE_DEC_TEST_VECTORS);
break;
@@ -3667,7 +3667,7 @@
case 100:
test_hash("hmac(md5)", hmac_md5_tv_template,
HMAC_MD5_TEST_VECTORS);
-@@ -1650,6 +1726,16 @@
+@@ -1650,6 +1726,16 @@ static void do_test(void)
XCBC_AES_TEST_VECTORS);
break;
@@ -3684,7 +3684,7 @@
case 200:
test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
speed_template_16_24_32);
-@@ -1788,6 +1874,22 @@
+@@ -1788,6 +1874,22 @@ static void do_test(void)
test_hash_speed("sha224", sec, generic_hash_speed_template);
if (mode > 300 && mode < 400) break;
@@ -3722,7 +3722,7 @@
*/
#ifndef _CRYPTO_TCRYPT_H
#define _CRYPTO_TCRYPT_H
-@@ -168,6 +162,271 @@
+@@ -168,6 +162,271 @@ static struct hash_testvec md5_tv_templa
.digest = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55"
"\xac\x49\xda\x2e\x21\x07\xb6\x7a",
}
@@ -3994,7 +3994,7 @@
};
/*
-@@ -817,6 +1076,168 @@
+@@ -817,6 +1076,168 @@ static struct hash_testvec hmac_md5_tv_t
};
/*
@@ -4163,7 +4163,7 @@
* HMAC-SHA1 test vectors from RFC2202
*/
#define HMAC_SHA1_TEST_VECTORS 7
-@@ -1442,6 +1863,8 @@
+@@ -1442,6 +1863,8 @@ static struct hash_testvec hmac_sha512_t
#define DES_CBC_DEC_TEST_VECTORS 4
#define DES3_EDE_ENC_TEST_VECTORS 3
#define DES3_EDE_DEC_TEST_VECTORS 3
@@ -4172,7 +4172,7 @@
static struct cipher_testvec des_enc_tv_template[] = {
{ /* From Applied Cryptography */
-@@ -1680,9 +2103,6 @@
+@@ -1680,9 +2103,6 @@ static struct cipher_testvec des_cbc_dec
},
};
@@ -4182,7 +4182,7 @@
static struct cipher_testvec des3_ede_enc_tv_template[] = {
{ /* These are from openssl */
.key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
-@@ -1745,6 +2165,94 @@
+@@ -1745,6 +2165,94 @@ static struct cipher_testvec des3_ede_de
},
};
@@ -4279,7 +4279,7 @@
*/
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
-@@ -174,4 +174,30 @@
+@@ -174,4 +174,30 @@ config CRYPTO_DEV_HIFN_795X_RNG
Select this option if you want to enable the random number generator
on the HIFN 795x crypto adapters.
@@ -4312,7 +4312,7 @@
endif # CRYPTO_HW
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
-@@ -2,3 +2,5 @@
+@@ -2,3 +2,5 @@ obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) +=
obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o
obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o
@@ -4328,7 +4328,7 @@
#include <linux/crypto.h>
#include <linux/hw_random.h>
#include <linux/ktime.h>
-@@ -369,7 +368,9 @@
+@@ -369,7 +368,9 @@ static atomic_t hifn_dev_number;
#define HIFN_D_DST_RSIZE 80*4
#define HIFN_D_RES_RSIZE 24*4
@@ -4339,7 +4339,7 @@
#define AES_MIN_KEY_SIZE 16
#define AES_MAX_KEY_SIZE 32
-@@ -535,10 +536,10 @@
+@@ -535,10 +536,10 @@ struct hifn_crypt_command
*/
struct hifn_mac_command
{
@@ -4354,7 +4354,7 @@
};
#define HIFN_MAC_CMD_ALG_MASK 0x0001
-@@ -564,10 +565,10 @@
+@@ -564,10 +565,10 @@ struct hifn_mac_command
struct hifn_comp_command
{
@@ -4369,7 +4369,7 @@
};
#define HIFN_COMP_CMD_SRCLEN_M 0xc000
-@@ -583,10 +584,10 @@
+@@ -583,10 +584,10 @@ struct hifn_comp_command
struct hifn_base_result
{
@@ -4384,7 +4384,7 @@
};
#define HIFN_BASE_RES_DSTOVERRUN 0x0200 /* destination overrun */
-@@ -597,8 +598,8 @@
+@@ -597,8 +598,8 @@ struct hifn_base_result
struct hifn_comp_result
{
@@ -4395,7 +4395,7 @@
};
#define HIFN_COMP_RES_LCB_M 0xff00 /* longitudinal check byte */
-@@ -609,8 +610,8 @@
+@@ -609,8 +610,8 @@ struct hifn_comp_result
struct hifn_mac_result
{
@@ -4406,7 +4406,7 @@
/* followed by 0, 6, 8, or 10 u16's of the MAC, then crypt */
};
-@@ -619,8 +620,8 @@
+@@ -619,8 +620,8 @@ struct hifn_mac_result
struct hifn_crypt_result
{
@@ -4417,7 +4417,7 @@
};
#define HIFN_CRYPT_RES_SRC_NOTZERO 0x0001 /* source expired */
-@@ -686,12 +687,12 @@
+@@ -686,12 +687,12 @@ static inline u32 hifn_read_1(struct hif
static inline void hifn_write_0(struct hifn_device *dev, u32 reg, u32 val)
{
@@ -4432,7 +4432,7 @@
}
static void hifn_wait_puc(struct hifn_device *dev)
-@@ -894,7 +895,7 @@
+@@ -894,7 +895,7 @@ static int hifn_enable_crypto(struct hif
char *offtbl = NULL;
int i;
@@ -4441,7 +4441,7 @@
if (pci2id[i].pci_vendor == dev->pdev->vendor &&
pci2id[i].pci_prod == dev->pdev->device) {
offtbl = pci2id[i].card_id;
-@@ -1037,14 +1038,14 @@
+@@ -1037,14 +1038,14 @@ static void hifn_init_registers(struct h
hifn_write_0(dev, HIFN_0_PUIER, HIFN_PUIER_DSTOVER);
/* write all 4 ring address registers */
@@ -4464,7 +4464,7 @@
mdelay(2);
#if 0
-@@ -1166,109 +1167,15 @@
+@@ -1166,109 +1167,15 @@ static int hifn_setup_crypto_command(str
return cmd_len;
}
@@ -4577,7 +4577,7 @@
buf_pos = buf = dma->command_bufs[dma->cmdi];
mask = 0;
-@@ -1370,16 +1277,113 @@
+@@ -1370,16 +1277,113 @@ static int hifn_setup_dma(struct hifn_de
hifn_write_1(dev, HIFN_1_DMA_CSR, HIFN_DMACSR_C_CTRL_ENA);
dev->flags |= HIFN_FLAG_CMD_BUSY;
}
@@ -4695,7 +4695,7 @@
static int ablkcipher_walk_init(struct ablkcipher_walk *w,
int num, gfp_t gfp_flags)
{
-@@ -1431,7 +1435,7 @@
+@@ -1431,7 +1435,7 @@ static int ablkcipher_add(void *daddr, u
return -EINVAL;
while (size) {
@@ -4704,7 +4704,7 @@
saddr = kmap_atomic(sg_page(src), KM_SOFTIRQ1);
memcpy(daddr, saddr + src->offset, copy);
-@@ -1458,10 +1462,6 @@
+@@ -1458,10 +1462,6 @@ static int ablkcipher_add(void *daddr, u
static int ablkcipher_walk(struct ablkcipher_request *req,
struct ablkcipher_walk *w)
{
@@ -4715,7 +4715,7 @@
struct scatterlist *src, *dst, *t;
void *daddr;
unsigned int nbytes = req->nbytes, offset, copy, diff;
-@@ -1477,16 +1477,14 @@
+@@ -1477,16 +1477,14 @@ static int ablkcipher_walk(struct ablkci
dst = &req->dst[idx];
dprintk("\n%s: slen: %u, dlen: %u, soff: %u, doff: %u, offset: %u, "
@@ -4738,7 +4738,7 @@
unsigned dlen = PAGE_SIZE;
t = &w->cache[idx];
-@@ -1498,8 +1496,8 @@
+@@ -1498,8 +1496,8 @@ static int ablkcipher_walk(struct ablkci
idx += err;
@@ -4749,7 +4749,7 @@
if (dlen < nbytes) {
/*
-@@ -1507,7 +1505,7 @@
+@@ -1507,7 +1505,7 @@ static int ablkcipher_walk(struct ablkci
* to put there additional blocksized chunk,
* so we mark that page as containing only
* blocksize aligned chunks:
@@ -4758,7 +4758,7 @@
* and increase number of bytes to be processed
* in next chunk:
* nbytes += diff;
-@@ -1544,7 +1542,7 @@
+@@ -1544,7 +1542,7 @@ static int ablkcipher_walk(struct ablkci
kunmap_atomic(daddr, KM_SOFTIRQ0);
} else {
@@ -4767,7 +4767,7 @@
idx++;
}
-@@ -1563,14 +1561,10 @@
+@@ -1563,14 +1561,10 @@ static int hifn_setup_session(struct abl
struct hifn_context *ctx = crypto_tfm_ctx(req->base.tfm);
struct hifn_device *dev = ctx->dev;
struct page *spage, *dpage;
@@ -4783,7 +4783,7 @@
if (ctx->iv && !ctx->ivsize && ctx->mode != ACRYPTO_MODE_ECB)
goto err_out_exit;
-@@ -1578,17 +1572,14 @@
+@@ -1578,17 +1572,14 @@ static int hifn_setup_session(struct abl
ctx->walk.flags = 0;
while (nbytes) {
@@ -4805,7 +4805,7 @@
idx++;
}
-@@ -1602,7 +1593,10 @@
+@@ -1602,7 +1593,10 @@ static int hifn_setup_session(struct abl
idx = 0;
sg_num = ablkcipher_walk(req, &ctx->walk);
@@ -4817,7 +4817,7 @@
atomic_set(&ctx->sg_num, sg_num);
spin_lock_irqsave(&dev->lock, flags);
-@@ -1640,7 +1634,7 @@
+@@ -1640,7 +1634,7 @@ static int hifn_setup_session(struct abl
if (err)
goto err_out;
@@ -4826,7 +4826,7 @@
}
dev->active = HIFN_DEFAULT_ACTIVE_NUM;
-@@ -1651,7 +1645,7 @@
+@@ -1651,7 +1645,7 @@ static int hifn_setup_session(struct abl
err_out:
spin_unlock_irqrestore(&dev->lock, flags);
err_out_exit:
@@ -4835,7 +4835,7 @@
dprintk("%s: iv: %p [%d], key: %p [%d], mode: %u, op: %u, "
"type: %u, err: %d.\n",
dev->name, ctx->iv, ctx->ivsize,
-@@ -1745,8 +1739,7 @@
+@@ -1745,8 +1739,7 @@ static int ablkcipher_get(void *saddr, u
return -EINVAL;
while (size) {
@@ -4845,7 +4845,7 @@
daddr = kmap_atomic(sg_page(dst), KM_IRQ0);
memcpy(daddr + dst->offset + offset, saddr, copy);
-@@ -1803,7 +1796,7 @@
+@@ -1803,7 +1796,7 @@ static void hifn_process_ready(struct ab
sg_page(dst), dst->length, nbytes);
if (!t->length) {
@@ -4854,7 +4854,7 @@
idx++;
continue;
}
-@@ -2202,9 +2195,9 @@
+@@ -2202,9 +2195,9 @@ static int hifn_setup_crypto(struct ablk
return err;
if (dev->started < HIFN_QUEUE_LENGTH && dev->queue.qlen)
@@ -4866,7 +4866,7 @@
}
/*
-@@ -2364,7 +2357,7 @@
+@@ -2364,7 +2357,7 @@ static struct hifn_alg_template hifn_alg
* 3DES ECB, CBC, CFB and OFB modes.
*/
{
@@ -4875,7 +4875,7 @@
.ablkcipher = {
.min_keysize = HIFN_3DES_KEY_LENGTH,
.max_keysize = HIFN_3DES_KEY_LENGTH,
-@@ -2374,7 +2367,7 @@
+@@ -2374,7 +2367,7 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4884,7 +4884,7 @@
.ablkcipher = {
.min_keysize = HIFN_3DES_KEY_LENGTH,
.max_keysize = HIFN_3DES_KEY_LENGTH,
-@@ -2384,8 +2377,9 @@
+@@ -2384,8 +2377,9 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4895,7 +4895,7 @@
.min_keysize = HIFN_3DES_KEY_LENGTH,
.max_keysize = HIFN_3DES_KEY_LENGTH,
.setkey = hifn_setkey,
-@@ -2394,7 +2388,7 @@
+@@ -2394,7 +2388,7 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4904,7 +4904,7 @@
.ablkcipher = {
.min_keysize = HIFN_3DES_KEY_LENGTH,
.max_keysize = HIFN_3DES_KEY_LENGTH,
-@@ -2408,7 +2402,7 @@
+@@ -2408,7 +2402,7 @@ static struct hifn_alg_template hifn_alg
* DES ECB, CBC, CFB and OFB modes.
*/
{
@@ -4913,7 +4913,7 @@
.ablkcipher = {
.min_keysize = HIFN_DES_KEY_LENGTH,
.max_keysize = HIFN_DES_KEY_LENGTH,
-@@ -2418,7 +2412,7 @@
+@@ -2418,7 +2412,7 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4922,7 +4922,7 @@
.ablkcipher = {
.min_keysize = HIFN_DES_KEY_LENGTH,
.max_keysize = HIFN_DES_KEY_LENGTH,
-@@ -2428,8 +2422,9 @@
+@@ -2428,8 +2422,9 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4933,7 +4933,7 @@
.min_keysize = HIFN_DES_KEY_LENGTH,
.max_keysize = HIFN_DES_KEY_LENGTH,
.setkey = hifn_setkey,
-@@ -2438,7 +2433,7 @@
+@@ -2438,7 +2433,7 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4942,7 +4942,7 @@
.ablkcipher = {
.min_keysize = HIFN_DES_KEY_LENGTH,
.max_keysize = HIFN_DES_KEY_LENGTH,
-@@ -2452,7 +2447,7 @@
+@@ -2452,7 +2447,7 @@ static struct hifn_alg_template hifn_alg
* AES ECB, CBC, CFB and OFB modes.
*/
{
@@ -4951,7 +4951,7 @@
.ablkcipher = {
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
-@@ -2462,8 +2457,9 @@
+@@ -2462,8 +2457,9 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4962,7 +4962,7 @@
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
.setkey = hifn_setkey,
-@@ -2472,7 +2468,7 @@
+@@ -2472,7 +2468,7 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4971,7 +4971,7 @@
.ablkcipher = {
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
-@@ -2482,7 +2478,7 @@
+@@ -2482,7 +2478,7 @@ static struct hifn_alg_template hifn_alg
},
},
{
@@ -4980,7 +4980,7 @@
.ablkcipher = {
.min_keysize = AES_MIN_KEY_SIZE,
.max_keysize = AES_MAX_KEY_SIZE,
-@@ -2514,15 +2510,14 @@
+@@ -2514,15 +2510,14 @@ static int hifn_alg_alloc(struct hifn_de
return -ENOMEM;
snprintf(alg->alg.cra_name, CRYPTO_MAX_ALG_NAME, "%s", t->name);
@@ -6510,7 +6510,7 @@
+
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
-@@ -411,12 +411,12 @@
+@@ -411,12 +411,12 @@ static int __init padlock_init(void)
int ret;
if (!cpu_has_xcrypt) {
@@ -6527,7 +6527,7 @@
--- a/drivers/crypto/padlock-sha.c
+++ b/drivers/crypto/padlock-sha.c
-@@ -263,12 +263,12 @@
+@@ -263,12 +263,12 @@ static int __init padlock_init(void)
int rc = -ENODEV;
if (!cpu_has_phe) {
@@ -8606,7 +8606,7 @@
#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
#define CRYPTO_ALG_LARVAL 0x00000010
-@@ -102,6 +104,7 @@
+@@ -102,6 +104,7 @@ struct crypto_async_request;
struct crypto_aead;
struct crypto_blkcipher;
struct crypto_hash;
@@ -8614,7 +8614,7 @@
struct crypto_tfm;
struct crypto_type;
struct aead_givcrypt_request;
-@@ -131,6 +134,16 @@
+@@ -131,6 +134,16 @@ struct ablkcipher_request {
void *__ctx[] CRYPTO_MINALIGN_ATTR;
};
@@ -8631,7 +8631,7 @@
/**
* struct aead_request - AEAD request
* @base: Common attributes for async crypto requests
-@@ -195,6 +208,17 @@
+@@ -195,6 +208,17 @@ struct ablkcipher_alg {
unsigned int ivsize;
};
@@ -8649,7 +8649,7 @@
struct aead_alg {
int (*setkey)(struct crypto_aead *tfm, const u8 *key,
unsigned int keylen);
-@@ -272,6 +296,7 @@
+@@ -272,6 +296,7 @@ struct compress_alg {
#define cra_cipher cra_u.cipher
#define cra_digest cra_u.digest
#define cra_hash cra_u.hash
@@ -8657,7 +8657,7 @@
#define cra_compress cra_u.compress
struct crypto_alg {
-@@ -298,6 +323,7 @@
+@@ -298,6 +323,7 @@ struct crypto_alg {
struct cipher_alg cipher;
struct digest_alg digest;
struct hash_alg hash;
@@ -8665,7 +8665,7 @@
struct compress_alg compress;
} cra_u;
-@@ -383,6 +409,18 @@
+@@ -383,6 +409,18 @@ struct hash_tfm {
unsigned int digestsize;
};
@@ -8684,7 +8684,7 @@
struct compress_tfm {
int (*cot_compress)(struct crypto_tfm *tfm,
const u8 *src, unsigned int slen,
-@@ -397,6 +435,7 @@
+@@ -397,6 +435,7 @@ struct compress_tfm {
#define crt_blkcipher crt_u.blkcipher
#define crt_cipher crt_u.cipher
#define crt_hash crt_u.hash
@@ -8692,7 +8692,7 @@
#define crt_compress crt_u.compress
struct crypto_tfm {
-@@ -409,6 +448,7 @@
+@@ -409,6 +448,7 @@ struct crypto_tfm {
struct blkcipher_tfm blkcipher;
struct cipher_tfm cipher;
struct hash_tfm hash;