diff options
Diffstat (limited to 'target/linux/layerscape/patches-4.9/804-crypto-support-layerscape.patch')
-rw-r--r-- | target/linux/layerscape/patches-4.9/804-crypto-support-layerscape.patch | 1503 |
1 files changed, 870 insertions, 633 deletions
diff --git a/target/linux/layerscape/patches-4.9/804-crypto-support-layerscape.patch b/target/linux/layerscape/patches-4.9/804-crypto-support-layerscape.patch index 79103a273b..6b6104dd05 100644 --- a/target/linux/layerscape/patches-4.9/804-crypto-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.9/804-crypto-support-layerscape.patch @@ -1,4 +1,4 @@ -From 0a5b97d1f524c1769b4059e3c7123b52755f7121 Mon Sep 17 00:00:00 2001 +From 9c9579d76ccd6e738ab98c9b4c73c168912cdb8a Mon Sep 17 00:00:00 2001 From: Yangbo Lu <yangbo.lu@nxp.com> Date: Wed, 27 Sep 2017 15:02:01 +0800 Subject: [PATCH] crypto: support layerscape @@ -54,7 +54,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> drivers/crypto/caam/compat.h | 1 + drivers/crypto/caam/ctrl.c | 356 +- drivers/crypto/caam/ctrl.h | 2 + - drivers/crypto/caam/desc.h | 52 +- + drivers/crypto/caam/desc.h | 55 +- drivers/crypto/caam/desc_constr.h | 139 +- drivers/crypto/caam/dpseci.c | 859 ++++ drivers/crypto/caam/dpseci.h | 395 ++ @@ -62,7 +62,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> drivers/crypto/caam/error.c | 127 +- drivers/crypto/caam/error.h | 10 +- drivers/crypto/caam/intern.h | 31 +- - drivers/crypto/caam/jr.c | 55 +- + drivers/crypto/caam/jr.c | 97 +- + drivers/crypto/caam/jr.h | 2 + drivers/crypto/caam/key_gen.c | 32 +- drivers/crypto/caam/key_gen.h | 36 +- drivers/crypto/caam/pdb.h | 62 + @@ -83,7 +84,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> include/uapi/linux/cryptouser.h | 5 + scripts/spelling.txt | 3 + sound/soc/amd/acp-pcm-dma.c | 2 +- - 54 files changed, 17263 insertions(+), 3955 deletions(-) + 55 files changed, 17310 insertions(+), 3955 deletions(-) create mode 100644 crypto/acompress.c create mode 100644 crypto/scompress.c create mode 100644 crypto/tls.c @@ -103,6 +104,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> create mode 100644 include/crypto/internal/acompress.h create mode 100644 include/crypto/internal/scompress.h +diff --git a/crypto/Kconfig b/crypto/Kconfig +index 17be110a..00e145e2 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -102,6 +102,15 @@ config CRYPTO_KPP @@ -156,6 +159,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> comment "Block modes" config CRYPTO_CBC +diff --git a/crypto/Makefile b/crypto/Makefile +index 9e52b3c5..936d2b73 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -51,6 +51,9 @@ rsa_generic-y += rsa_helper.o @@ -168,7 +173,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> cryptomgr-y := algboss.o testmgr.o obj-$(CONFIG_CRYPTO_MANAGER2) += cryptomgr.o -@@ -115,6 +118,7 @@ obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_ge +@@ -115,6 +118,7 @@ obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o @@ -176,6 +181,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> obj-$(CONFIG_CRYPTO_LZO) += lzo.o obj-$(CONFIG_CRYPTO_LZ4) += lz4.o obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o +diff --git a/crypto/acompress.c b/crypto/acompress.c +new file mode 100644 +index 00000000..887783d8 --- /dev/null +++ b/crypto/acompress.c @@ -0,0 +1,169 @@ @@ -348,9 +356,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Asynchronous compression type"); +diff --git a/crypto/algboss.c b/crypto/algboss.c +index 4bde25d6..ccb85e17 100644 --- a/crypto/algboss.c +++ b/crypto/algboss.c -@@ -247,17 +247,9 @@ static int cryptomgr_schedule_test(struc +@@ -247,17 +247,9 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg) memcpy(param->alg, alg->cra_name, sizeof(param->alg)); type = alg->cra_flags; @@ -370,9 +380,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> param->type = type; +diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c +index 1c570548..a90404a0 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c -@@ -112,6 +112,21 @@ nla_put_failure: +@@ -112,6 +112,21 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) return -EMSGSIZE; } @@ -394,7 +406,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) { struct crypto_report_akcipher rakcipher; -@@ -186,7 +201,11 @@ static int crypto_report_one(struct cryp +@@ -186,7 +201,11 @@ static int crypto_report_one(struct crypto_alg *alg, goto nla_put_failure; break; @@ -406,6 +418,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> case CRYPTO_ALG_TYPE_AKCIPHER: if (crypto_report_akcipher(skb, alg)) goto nla_put_failure; +diff --git a/crypto/scompress.c b/crypto/scompress.c +new file mode 100644 +index 00000000..35e396d1 --- /dev/null +++ b/crypto/scompress.c @@ -0,0 +1,356 @@ @@ -765,6 +780,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Synchronous compression type"); +diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c +index ae22f05d..bbb35eed 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -74,7 +74,7 @@ static char *check[] = { @@ -776,7 +793,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }; struct tcrypt_result { -@@ -1329,6 +1329,10 @@ static int do_test(const char *alg, u32 +@@ -1329,6 +1329,10 @@ static int do_test(const char *alg, u32 type, u32 mask, int m) ret += tcrypt_test("hmac(sha3-512)"); break; @@ -787,7 +804,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> case 150: ret += tcrypt_test("ansi_cprng"); break; -@@ -1390,6 +1394,9 @@ static int do_test(const char *alg, u32 +@@ -1390,6 +1394,9 @@ static int do_test(const char *alg, u32 type, u32 mask, int m) case 190: ret += tcrypt_test("authenc(hmac(sha512),cbc(des3_ede))"); break; @@ -797,7 +814,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> case 200: test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); -@@ -1404,9 +1411,9 @@ static int do_test(const char *alg, u32 +@@ -1404,9 +1411,9 @@ static int do_test(const char *alg, u32 type, u32 mask, int m) test_cipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, speed_template_32_40_48); test_cipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, @@ -809,7 +826,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> test_cipher_speed("cts(cbc(aes))", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_cipher_speed("cts(cbc(aes))", DECRYPT, sec, NULL, 0, -@@ -1837,9 +1844,9 @@ static int do_test(const char *alg, u32 +@@ -1837,9 +1844,9 @@ static int do_test(const char *alg, u32 type, u32 mask, int m) test_acipher_speed("lrw(aes)", DECRYPT, sec, NULL, 0, speed_template_32_40_48); test_acipher_speed("xts(aes)", ENCRYPT, sec, NULL, 0, @@ -821,6 +838,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> test_acipher_speed("cts(cbc(aes))", ENCRYPT, sec, NULL, 0, speed_template_16_24_32); test_acipher_speed("cts(cbc(aes))", DECRYPT, sec, NULL, 0, +diff --git a/crypto/testmgr.c b/crypto/testmgr.c +index 62dffa00..73d91fba 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -33,6 +33,7 @@ @@ -831,7 +850,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #include "internal.h" -@@ -62,7 +63,7 @@ int alg_test(const char *driver, const c +@@ -62,7 +63,7 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask) */ #define IDX1 32 #define IDX2 32400 @@ -919,7 +938,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static void hexdump(unsigned char *buf, unsigned int len) { -@@ -202,7 +212,7 @@ static int wait_async_op(struct tcrypt_r +@@ -202,7 +212,7 @@ static int wait_async_op(struct tcrypt_result *tr, int ret) } static int ahash_partial_update(struct ahash_request **preq, @@ -928,7 +947,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> void *hash_buff, int k, int temp, struct scatterlist *sg, const char *algo, char *result, struct tcrypt_result *tresult) { -@@ -259,11 +269,12 @@ out_nostate: +@@ -259,11 +269,12 @@ static int ahash_partial_update(struct ahash_request **preq, return ret; } @@ -944,7 +963,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int i, j, k, temp; struct scatterlist sg[8]; char *result; -@@ -274,7 +285,7 @@ static int __test_hash(struct crypto_aha +@@ -274,7 +285,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, char *xbuf[XBUFSIZE]; int ret = -ENOMEM; @@ -953,7 +972,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (!result) return ret; key = kmalloc(MAX_KEYLEN, GFP_KERNEL); -@@ -304,7 +315,7 @@ static int __test_hash(struct crypto_aha +@@ -304,7 +315,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, goto out; j++; @@ -962,7 +981,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> hash_buff = xbuf[0]; hash_buff += align_offset; -@@ -379,7 +390,7 @@ static int __test_hash(struct crypto_aha +@@ -379,7 +390,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, continue; j++; @@ -971,7 +990,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> temp = 0; sg_init_table(sg, template[i].np); -@@ -457,7 +468,7 @@ static int __test_hash(struct crypto_aha +@@ -457,7 +468,7 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, continue; j++; @@ -980,7 +999,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ret = -EINVAL; hash_buff = xbuf[0]; -@@ -536,7 +547,8 @@ out_nobuf: +@@ -536,7 +547,8 @@ static int __test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, return ret; } @@ -990,7 +1009,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int tcount, bool use_digest) { unsigned int alignmask; -@@ -564,7 +576,7 @@ static int test_hash(struct crypto_ahash +@@ -564,7 +576,7 @@ static int test_hash(struct crypto_ahash *tfm, struct hash_testvec *template, } static int __test_aead(struct crypto_aead *tfm, int enc, @@ -999,7 +1018,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> const bool diff_dst, const int align_offset) { const char *algo = crypto_tfm_alg_driver_name(crypto_aead_tfm(tfm)); -@@ -955,7 +967,7 @@ out_noxbuf: +@@ -955,7 +967,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc, } static int test_aead(struct crypto_aead *tfm, int enc, @@ -1008,7 +1027,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { unsigned int alignmask; int ret; -@@ -987,8 +999,236 @@ static int test_aead(struct crypto_aead +@@ -987,8 +999,236 @@ static int test_aead(struct crypto_aead *tfm, int enc, return 0; } @@ -1246,7 +1265,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { const char *algo = crypto_tfm_alg_driver_name(crypto_cipher_tfm(tfm)); unsigned int i, j, k; -@@ -1066,7 +1306,8 @@ out_nobuf: +@@ -1066,7 +1306,8 @@ static int test_cipher(struct crypto_cipher *tfm, int enc, } static int __test_skcipher(struct crypto_skcipher *tfm, int enc, @@ -1256,7 +1275,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> const bool diff_dst, const int align_offset) { const char *algo = -@@ -1330,7 +1571,8 @@ out_nobuf: +@@ -1330,7 +1571,8 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc, } static int test_skcipher(struct crypto_skcipher *tfm, int enc, @@ -1266,7 +1285,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { unsigned int alignmask; int ret; -@@ -1362,8 +1604,10 @@ static int test_skcipher(struct crypto_s +@@ -1362,8 +1604,10 @@ static int test_skcipher(struct crypto_skcipher *tfm, int enc, return 0; } @@ -1279,7 +1298,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { const char *algo = crypto_tfm_alg_driver_name(crypto_comp_tfm(tfm)); unsigned int i; -@@ -1442,7 +1686,154 @@ out: +@@ -1442,7 +1686,154 @@ static int test_comp(struct crypto_comp *tfm, struct comp_testvec *ctemplate, return ret; } @@ -1435,7 +1454,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int tcount) { const char *algo = crypto_tfm_alg_driver_name(crypto_rng_tfm(tfm)); -@@ -1509,7 +1900,7 @@ static int alg_test_aead(const struct al +@@ -1509,7 +1900,7 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver, struct crypto_aead *tfm; int err = 0; @@ -1444,7 +1463,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { printk(KERN_ERR "alg: aead: Failed to load transform for %s: " "%ld\n", driver, PTR_ERR(tfm)); -@@ -1538,7 +1929,7 @@ static int alg_test_cipher(const struct +@@ -1538,7 +1929,7 @@ static int alg_test_cipher(const struct alg_test_desc *desc, struct crypto_cipher *tfm; int err = 0; @@ -1453,7 +1472,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { printk(KERN_ERR "alg: cipher: Failed to load transform for " "%s: %ld\n", driver, PTR_ERR(tfm)); -@@ -1567,7 +1958,7 @@ static int alg_test_skcipher(const struc +@@ -1567,7 +1958,7 @@ static int alg_test_skcipher(const struct alg_test_desc *desc, struct crypto_skcipher *tfm; int err = 0; @@ -1462,7 +1481,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { printk(KERN_ERR "alg: skcipher: Failed to load transform for " "%s: %ld\n", driver, PTR_ERR(tfm)); -@@ -1593,22 +1984,38 @@ out: +@@ -1593,22 +1984,38 @@ static int alg_test_skcipher(const struct alg_test_desc *desc, static int alg_test_comp(const struct alg_test_desc *desc, const char *driver, u32 type, u32 mask) { @@ -1471,13 +1490,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + struct crypto_acomp *acomp; int err; + u32 algo_type = type & CRYPTO_ALG_TYPE_ACOMPRESS_MASK; - -- tfm = crypto_alloc_comp(driver, type, mask); -- if (IS_ERR(tfm)) { -- printk(KERN_ERR "alg: comp: Failed to load transform for %s: " -- "%ld\n", driver, PTR_ERR(tfm)); -- return PTR_ERR(tfm); -- } ++ + if (algo_type == CRYPTO_ALG_TYPE_ACOMPRESS) { + acomp = crypto_alloc_acomp(driver, type, mask); + if (IS_ERR(acomp)) { @@ -1498,6 +1511,13 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + return PTR_ERR(comp); + } +- tfm = crypto_alloc_comp(driver, type, mask); +- if (IS_ERR(tfm)) { +- printk(KERN_ERR "alg: comp: Failed to load transform for %s: " +- "%ld\n", driver, PTR_ERR(tfm)); +- return PTR_ERR(tfm); +- } +- - err = test_comp(tfm, desc->suite.comp.comp.vecs, - desc->suite.comp.decomp.vecs, - desc->suite.comp.comp.count, @@ -1513,7 +1533,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return err; } -@@ -1618,7 +2025,7 @@ static int alg_test_hash(const struct al +@@ -1618,7 +2025,7 @@ static int alg_test_hash(const struct alg_test_desc *desc, const char *driver, struct crypto_ahash *tfm; int err; @@ -1522,7 +1542,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { printk(KERN_ERR "alg: hash: Failed to load transform for %s: " "%ld\n", driver, PTR_ERR(tfm)); -@@ -1646,7 +2053,7 @@ static int alg_test_crc32c(const struct +@@ -1646,7 +2053,7 @@ static int alg_test_crc32c(const struct alg_test_desc *desc, if (err) goto out; @@ -1531,7 +1551,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { printk(KERN_ERR "alg: crc32c: Failed to load transform for %s: " "%ld\n", driver, PTR_ERR(tfm)); -@@ -1688,7 +2095,7 @@ static int alg_test_cprng(const struct a +@@ -1688,7 +2095,7 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver, struct crypto_rng *rng; int err; @@ -1540,7 +1560,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(rng)) { printk(KERN_ERR "alg: cprng: Failed to load transform for %s: " "%ld\n", driver, PTR_ERR(rng)); -@@ -1703,7 +2110,7 @@ static int alg_test_cprng(const struct a +@@ -1703,7 +2110,7 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver, } @@ -1549,7 +1569,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> const char *driver, u32 type, u32 mask) { int ret = -EAGAIN; -@@ -1715,7 +2122,7 @@ static int drbg_cavs_test(struct drbg_te +@@ -1715,7 +2122,7 @@ static int drbg_cavs_test(struct drbg_testvec *test, int pr, if (!buf) return -ENOMEM; @@ -1558,7 +1578,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(drng)) { printk(KERN_ERR "alg: drbg: could not allocate DRNG handle for " "%s\n", driver); -@@ -1777,7 +2184,7 @@ static int alg_test_drbg(const struct al +@@ -1777,7 +2184,7 @@ static int alg_test_drbg(const struct alg_test_desc *desc, const char *driver, int err = 0; int pr = 0; int i = 0; @@ -1567,7 +1587,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int tcount = desc->suite.drbg.count; if (0 == memcmp(driver, "drbg_pr_", 8)) -@@ -1796,7 +2203,7 @@ static int alg_test_drbg(const struct al +@@ -1796,7 +2203,7 @@ static int alg_test_drbg(const struct alg_test_desc *desc, const char *driver, } @@ -1576,7 +1596,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> const char *alg) { struct kpp_request *req; -@@ -1888,7 +2295,7 @@ free_req: +@@ -1888,7 +2295,7 @@ static int do_test_kpp(struct crypto_kpp *tfm, struct kpp_testvec *vec, } static int test_kpp(struct crypto_kpp *tfm, const char *alg, @@ -1585,7 +1605,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { int ret, i; -@@ -1909,7 +2316,7 @@ static int alg_test_kpp(const struct alg +@@ -1909,7 +2316,7 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver, struct crypto_kpp *tfm; int err = 0; @@ -1594,7 +1614,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { pr_err("alg: kpp: Failed to load tfm for %s: %ld\n", driver, PTR_ERR(tfm)); -@@ -1924,7 +2331,7 @@ static int alg_test_kpp(const struct alg +@@ -1924,7 +2331,7 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver, } static int test_akcipher_one(struct crypto_akcipher *tfm, @@ -1603,7 +1623,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { char *xbuf[XBUFSIZE]; struct akcipher_request *req; -@@ -2044,7 +2451,8 @@ free_xbuf: +@@ -2044,7 +2451,8 @@ static int test_akcipher_one(struct crypto_akcipher *tfm, } static int test_akcipher(struct crypto_akcipher *tfm, const char *alg, @@ -1613,7 +1633,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { const char *algo = crypto_tfm_alg_driver_name(crypto_akcipher_tfm(tfm)); -@@ -2068,7 +2476,7 @@ static int alg_test_akcipher(const struc +@@ -2068,7 +2476,7 @@ static int alg_test_akcipher(const struct alg_test_desc *desc, struct crypto_akcipher *tfm; int err = 0; @@ -1622,7 +1642,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (IS_ERR(tfm)) { pr_err("alg: akcipher: Failed to load tfm for %s: %ld\n", driver, PTR_ERR(tfm)); -@@ -2088,112 +2496,23 @@ static int alg_test_null(const struct al +@@ -2088,112 +2496,23 @@ static int alg_test_null(const struct alg_test_desc *desc, return 0; } @@ -1740,7 +1760,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2201,12 +2520,7 @@ static const struct alg_test_desc alg_te +@@ -2201,12 +2520,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1754,7 +1774,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2214,12 +2528,7 @@ static const struct alg_test_desc alg_te +@@ -2214,12 +2528,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1768,7 +1788,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2228,12 +2537,7 @@ static const struct alg_test_desc alg_te +@@ -2228,12 +2537,7 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -1782,7 +1802,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2245,18 +2549,8 @@ static const struct alg_test_desc alg_te +@@ -2245,18 +2549,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1803,7 +1823,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2268,12 +2562,7 @@ static const struct alg_test_desc alg_te +@@ -2268,12 +2562,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1817,7 +1837,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2282,12 +2571,7 @@ static const struct alg_test_desc alg_te +@@ -2282,12 +2571,7 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -1831,7 +1851,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2296,12 +2580,7 @@ static const struct alg_test_desc alg_te +@@ -2296,12 +2580,7 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -1845,7 +1865,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2309,12 +2588,7 @@ static const struct alg_test_desc alg_te +@@ -2309,12 +2588,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1859,7 +1879,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2323,12 +2597,7 @@ static const struct alg_test_desc alg_te +@@ -2323,12 +2597,7 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -1873,7 +1893,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2344,12 +2613,7 @@ static const struct alg_test_desc alg_te +@@ -2344,12 +2613,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1887,7 +1907,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2358,12 +2622,7 @@ static const struct alg_test_desc alg_te +@@ -2358,12 +2622,7 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -1901,7 +1921,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2380,12 +2639,7 @@ static const struct alg_test_desc alg_te +@@ -2380,12 +2639,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1915,7 +1935,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2393,12 +2647,7 @@ static const struct alg_test_desc alg_te +@@ -2393,12 +2647,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -1929,7 +1949,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2407,12 +2656,7 @@ static const struct alg_test_desc alg_te +@@ -2407,12 +2656,7 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -1943,7 +1963,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2429,14 +2673,8 @@ static const struct alg_test_desc alg_te +@@ -2429,14 +2673,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -1960,7 +1980,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2444,14 +2682,8 @@ static const struct alg_test_desc alg_te +@@ -2444,14 +2682,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -1977,7 +1997,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2459,14 +2691,8 @@ static const struct alg_test_desc alg_te +@@ -2459,14 +2691,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -1994,7 +2014,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2474,14 +2700,8 @@ static const struct alg_test_desc alg_te +@@ -2474,14 +2700,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2011,7 +2031,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2489,14 +2709,8 @@ static const struct alg_test_desc alg_te +@@ -2489,14 +2709,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2028,7 +2048,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2504,14 +2718,8 @@ static const struct alg_test_desc alg_te +@@ -2504,14 +2718,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2045,7 +2065,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2519,14 +2727,8 @@ static const struct alg_test_desc alg_te +@@ -2519,14 +2727,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2062,7 +2082,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2535,14 +2737,8 @@ static const struct alg_test_desc alg_te +@@ -2535,14 +2737,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -2079,7 +2099,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2550,14 +2746,8 @@ static const struct alg_test_desc alg_te +@@ -2550,14 +2746,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2096,7 +2116,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2565,30 +2755,25 @@ static const struct alg_test_desc alg_te +@@ -2565,30 +2755,25 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2112,14 +2132,14 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + .dec = __VECS(tf_cbc_dec_tv_template) } } - }, { ++ }, { + .alg = "cbcmac(aes)", + .fips_allowed = 1, + .test = alg_test_hash, + .suite = { + .hash = __VECS(aes_cbcmac_tv_template) + } -+ }, { + }, { .alg = "ccm(aes)", .test = alg_test_aead, .fips_allowed = 1, @@ -2138,7 +2158,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2596,14 +2781,8 @@ static const struct alg_test_desc alg_te +@@ -2596,14 +2781,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2155,7 +2175,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2611,20 +2790,14 @@ static const struct alg_test_desc alg_te +@@ -2611,20 +2790,14 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .test = alg_test_hash, .suite = { @@ -2178,7 +2198,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "compress_null", -@@ -2633,94 +2806,30 @@ static const struct alg_test_desc alg_te +@@ -2633,94 +2806,30 @@ static const struct alg_test_desc alg_test_descs[] = { .alg = "crc32", .test = alg_test_hash, .suite = { @@ -2210,7 +2230,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - } + .hash = __VECS(crct10dif_tv_template) } - }, { +- }, { - .alg = "cryptd(__driver-cbc-aes-aesni)", - .test = alg_test_null, - .fips_allowed = 1, @@ -2259,7 +2279,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - .alg = "cryptd(__ghash-pclmulqdqni)", - .test = alg_test_null, - .fips_allowed = 1, -- }, { + }, { .alg = "ctr(aes)", .test = alg_test_skcipher, .fips_allowed = 1, @@ -2278,7 +2298,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2728,14 +2837,8 @@ static const struct alg_test_desc alg_te +@@ -2728,14 +2837,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2295,7 +2315,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2743,14 +2846,8 @@ static const struct alg_test_desc alg_te +@@ -2743,14 +2846,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2312,7 +2332,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2758,14 +2855,8 @@ static const struct alg_test_desc alg_te +@@ -2758,14 +2855,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2329,7 +2349,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2773,14 +2864,8 @@ static const struct alg_test_desc alg_te +@@ -2773,14 +2864,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2346,7 +2366,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2788,29 +2873,18 @@ static const struct alg_test_desc alg_te +@@ -2788,29 +2873,18 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2381,7 +2401,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2818,14 +2892,8 @@ static const struct alg_test_desc alg_te +@@ -2818,14 +2892,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2398,7 +2418,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2833,14 +2901,8 @@ static const struct alg_test_desc alg_te +@@ -2833,14 +2901,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2415,7 +2435,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2848,14 +2910,8 @@ static const struct alg_test_desc alg_te +@@ -2848,14 +2910,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2432,7 +2452,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2864,14 +2920,8 @@ static const struct alg_test_desc alg_te +@@ -2864,14 +2920,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .comp = { @@ -2449,7 +2469,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -2879,10 +2929,7 @@ static const struct alg_test_desc alg_te +@@ -2879,10 +2929,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_kpp, .fips_allowed = 1, .suite = { @@ -2461,7 +2481,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "digest_null", -@@ -2892,30 +2939,21 @@ static const struct alg_test_desc alg_te +@@ -2892,30 +2939,21 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_drbg, .fips_allowed = 1, .suite = { @@ -2495,7 +2515,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { /* -@@ -2930,11 +2968,7 @@ static const struct alg_test_desc alg_te +@@ -2930,11 +2968,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_drbg, .fips_allowed = 1, .suite = { @@ -2508,7 +2528,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { /* covered by drbg_nopr_hmac_sha256 test */ -@@ -2954,10 +2988,7 @@ static const struct alg_test_desc alg_te +@@ -2954,10 +2988,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_drbg, .fips_allowed = 1, .suite = { @@ -2520,7 +2540,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { /* covered by drbg_nopr_sha256 test */ -@@ -2973,10 +3004,7 @@ static const struct alg_test_desc alg_te +@@ -2973,10 +3004,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_drbg, .fips_allowed = 1, .suite = { @@ -2532,7 +2552,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { /* covered by drbg_pr_ctr_aes128 test */ -@@ -2996,10 +3024,7 @@ static const struct alg_test_desc alg_te +@@ -2996,10 +3024,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_drbg, .fips_allowed = 1, .suite = { @@ -2544,7 +2564,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { /* covered by drbg_pr_hmac_sha256 test */ -@@ -3019,10 +3044,7 @@ static const struct alg_test_desc alg_te +@@ -3019,10 +3044,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_drbg, .fips_allowed = 1, .suite = { @@ -2556,14 +2576,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { /* covered by drbg_pr_sha256 test */ -@@ -3034,23 +3056,13 @@ static const struct alg_test_desc alg_te +@@ -3033,24 +3055,14 @@ static const struct alg_test_desc alg_test_descs[] = { + .alg = "drbg_pr_sha512", .fips_allowed = 1, .test = alg_test_null, - }, { +- }, { - .alg = "ecb(__aes-aesni)", - .test = alg_test_null, - .fips_allowed = 1, -- }, { + }, { .alg = "ecb(aes)", .test = alg_test_skcipher, .fips_allowed = 1, @@ -2582,7 +2603,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3058,14 +3070,8 @@ static const struct alg_test_desc alg_te +@@ -3058,14 +3070,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2599,7 +2620,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3073,14 +3079,8 @@ static const struct alg_test_desc alg_te +@@ -3073,14 +3079,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2616,7 +2637,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3088,14 +3088,8 @@ static const struct alg_test_desc alg_te +@@ -3088,14 +3088,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2633,7 +2654,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3103,14 +3097,8 @@ static const struct alg_test_desc alg_te +@@ -3103,14 +3097,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2650,7 +2671,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3118,14 +3106,8 @@ static const struct alg_test_desc alg_te +@@ -3118,14 +3106,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2667,7 +2688,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3133,14 +3115,8 @@ static const struct alg_test_desc alg_te +@@ -3133,14 +3115,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2684,7 +2705,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3151,14 +3127,8 @@ static const struct alg_test_desc alg_te +@@ -3151,14 +3127,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2701,7 +2722,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3167,14 +3137,8 @@ static const struct alg_test_desc alg_te +@@ -3167,14 +3137,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -2718,7 +2739,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3197,14 +3161,8 @@ static const struct alg_test_desc alg_te +@@ -3197,14 +3161,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2735,7 +2756,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3212,14 +3170,8 @@ static const struct alg_test_desc alg_te +@@ -3212,14 +3170,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2752,7 +2773,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3227,14 +3179,8 @@ static const struct alg_test_desc alg_te +@@ -3227,14 +3179,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2769,7 +2790,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3242,14 +3188,8 @@ static const struct alg_test_desc alg_te +@@ -3242,14 +3188,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2786,7 +2807,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3257,14 +3197,8 @@ static const struct alg_test_desc alg_te +@@ -3257,14 +3197,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2803,7 +2824,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3272,14 +3206,8 @@ static const struct alg_test_desc alg_te +@@ -3272,14 +3206,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2820,7 +2841,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3287,14 +3215,8 @@ static const struct alg_test_desc alg_te +@@ -3287,14 +3215,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2837,7 +2858,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3302,14 +3224,8 @@ static const struct alg_test_desc alg_te +@@ -3302,14 +3224,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -2854,7 +2875,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3317,10 +3233,7 @@ static const struct alg_test_desc alg_te +@@ -3317,10 +3233,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_kpp, .fips_allowed = 1, .suite = { @@ -2866,7 +2887,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "gcm(aes)", -@@ -3328,14 +3241,8 @@ static const struct alg_test_desc alg_te +@@ -3328,14 +3241,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -2883,7 +2904,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3343,136 +3250,94 @@ static const struct alg_test_desc alg_te +@@ -3343,136 +3250,94 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_hash, .fips_allowed = 1, .suite = { @@ -3034,7 +3055,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "jitterentropy_rng", -@@ -3484,14 +3349,8 @@ static const struct alg_test_desc alg_te +@@ -3484,14 +3349,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -3051,7 +3072,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3499,14 +3358,8 @@ static const struct alg_test_desc alg_te +@@ -3499,14 +3358,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3068,7 +3089,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3514,14 +3367,8 @@ static const struct alg_test_desc alg_te +@@ -3514,14 +3367,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3085,7 +3106,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3529,14 +3376,8 @@ static const struct alg_test_desc alg_te +@@ -3529,14 +3376,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3102,7 +3123,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3544,14 +3385,8 @@ static const struct alg_test_desc alg_te +@@ -3544,14 +3385,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3119,7 +3140,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3559,14 +3394,8 @@ static const struct alg_test_desc alg_te +@@ -3559,14 +3394,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3136,7 +3157,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3575,14 +3404,8 @@ static const struct alg_test_desc alg_te +@@ -3575,14 +3404,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .comp = { @@ -3153,7 +3174,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3591,14 +3414,8 @@ static const struct alg_test_desc alg_te +@@ -3591,14 +3414,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .comp = { @@ -3170,7 +3191,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3607,42 +3424,27 @@ static const struct alg_test_desc alg_te +@@ -3607,42 +3424,27 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .comp = { @@ -3218,7 +3239,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "ofb(aes)", -@@ -3650,14 +3452,8 @@ static const struct alg_test_desc alg_te +@@ -3650,14 +3452,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -3235,7 +3256,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3665,24 +3461,15 @@ static const struct alg_test_desc alg_te +@@ -3665,24 +3461,15 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3263,7 +3284,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "rfc3686(ctr(aes))", -@@ -3690,14 +3477,8 @@ static const struct alg_test_desc alg_te +@@ -3690,14 +3477,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -3280,7 +3301,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3706,14 +3487,8 @@ static const struct alg_test_desc alg_te +@@ -3706,14 +3487,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -3297,7 +3318,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3722,14 +3497,8 @@ static const struct alg_test_desc alg_te +@@ -3722,14 +3497,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .aead = { @@ -3314,7 +3335,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3737,14 +3506,8 @@ static const struct alg_test_desc alg_te +@@ -3737,14 +3506,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -3331,7 +3352,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3752,14 +3515,8 @@ static const struct alg_test_desc alg_te +@@ -3752,14 +3515,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -3348,7 +3369,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3767,71 +3524,47 @@ static const struct alg_test_desc alg_te +@@ -3767,71 +3524,47 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_aead, .suite = { .aead = { @@ -3428,7 +3449,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -3839,162 +3572,120 @@ static const struct alg_test_desc alg_te +@@ -3839,162 +3572,120 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_hash, .fips_allowed = 1, .suite = { @@ -3616,7 +3637,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { .alg = "xts(aes)", -@@ -4002,14 +3693,8 @@ static const struct alg_test_desc alg_te +@@ -4002,14 +3693,8 @@ static const struct alg_test_desc alg_test_descs[] = { .fips_allowed = 1, .suite = { .cipher = { @@ -3633,7 +3654,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -4017,14 +3702,8 @@ static const struct alg_test_desc alg_te +@@ -4017,14 +3702,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3650,7 +3671,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -4032,14 +3711,8 @@ static const struct alg_test_desc alg_te +@@ -4032,14 +3711,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3667,7 +3688,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -4047,14 +3720,8 @@ static const struct alg_test_desc alg_te +@@ -4047,14 +3720,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3684,7 +3705,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } }, { -@@ -4062,14 +3729,8 @@ static const struct alg_test_desc alg_te +@@ -4062,14 +3729,8 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_skcipher, .suite = { .cipher = { @@ -3701,6 +3722,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } } } +diff --git a/crypto/testmgr.h b/crypto/testmgr.h +index 9033088c..ce9f4334 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -34,9 +34,9 @@ @@ -3870,10 +3893,12 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +#ifdef __LITTLE_ENDIAN + .key = "\x08\x00" /* rta length */ + "\x01\x00" /* rta type */ -+#else + #else +-#define RSA_TEST_VECTORS 5 + .key = "\x00\x08" /* rta length */ + "\x00\x01" /* rta type */ -+#endif + #endif +-static struct akcipher_testvec rsa_tv_template[] = { + "\x00\x00\x00\x10" /* enc key length */ + "authenticationkey20benckeyis16_bytes", + .klen = 8 + 20 + 16, @@ -3971,12 +3996,10 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +#ifdef __LITTLE_ENDIAN + .key = "\x08\x00" /* rta length */ + "\x01\x00" /* rta type */ - #else --#define RSA_TEST_VECTORS 5 ++#else + .key = "\x00\x08" /* rta length */ + "\x00\x01" /* rta type */ - #endif --static struct akcipher_testvec rsa_tv_template[] = { ++#endif + "\x00\x00\x00\x10" /* enc key length */ + "authenticationkey20benckeyis16_bytes", + .klen = 8 + 20 + 16, @@ -4052,7 +4075,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { #ifndef CONFIG_CRYPTO_FIPS .key = -@@ -340,6 +554,7 @@ static struct akcipher_testvec rsa_tv_te +@@ -340,6 +554,7 @@ static struct akcipher_testvec rsa_tv_template[] = { .m_size = 8, .c_size = 256, .public_key_vec = true, @@ -4060,7 +4083,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, { .key = "\x30\x82\x09\x29" /* sequence of 2345 bytes */ -@@ -538,12 +753,11 @@ static struct akcipher_testvec rsa_tv_te +@@ -538,12 +753,11 @@ static struct akcipher_testvec rsa_tv_template[] = { .key_len = 2349, .m_size = 8, .c_size = 512, @@ -4089,7 +4112,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { #ifndef CONFIG_CRYPTO_FIPS .secret = -@@ -856,9 +1065,7 @@ struct kpp_testvec ecdh_tv_template[] = +@@ -856,9 +1065,7 @@ struct kpp_testvec ecdh_tv_template[] = { /* * MD4 test vectors from RFC1320 */ @@ -4100,7 +4123,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .digest = "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31" -@@ -899,8 +1106,7 @@ static struct hash_testvec md4_tv_templa +@@ -899,8 +1106,7 @@ static struct hash_testvec md4_tv_template [] = { }, }; @@ -4110,7 +4133,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .digest = "\x6b\x4e\x03\x42\x36\x67\xdb\xb7" -@@ -925,8 +1131,7 @@ static struct hash_testvec sha3_224_tv_t +@@ -925,8 +1131,7 @@ static struct hash_testvec sha3_224_tv_template[] = { }, }; @@ -4120,7 +4143,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .digest = "\xa7\xff\xc6\xf8\xbf\x1e\xd7\x66" -@@ -952,8 +1157,7 @@ static struct hash_testvec sha3_256_tv_t +@@ -952,8 +1157,7 @@ static struct hash_testvec sha3_256_tv_template[] = { }; @@ -4130,7 +4153,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .digest = "\x0c\x63\xa7\x5b\x84\x5e\x4f\x7d" -@@ -985,8 +1189,7 @@ static struct hash_testvec sha3_384_tv_t +@@ -985,8 +1189,7 @@ static struct hash_testvec sha3_384_tv_template[] = { }; @@ -4140,7 +4163,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .digest = "\xa6\x9f\x73\xcc\xa2\x3a\x9a\xc5" -@@ -1027,9 +1230,7 @@ static struct hash_testvec sha3_512_tv_t +@@ -1027,9 +1230,7 @@ static struct hash_testvec sha3_512_tv_template[] = { /* * MD5 test vectors from RFC1321 */ @@ -4151,7 +4174,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .digest = "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04" "\xe9\x80\x09\x98\xec\xf8\x42\x7e", -@@ -1073,9 +1274,7 @@ static struct hash_testvec md5_tv_templa +@@ -1073,9 +1274,7 @@ static struct hash_testvec md5_tv_template[] = { /* * RIPEMD-128 test vectors from ISO/IEC 10118-3:2004(E) */ @@ -4162,7 +4185,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .digest = "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e" "\xcb\x61\x0f\x18\xf6\xb3\x8b\x46", -@@ -1137,9 +1336,7 @@ static struct hash_testvec rmd128_tv_tem +@@ -1137,9 +1336,7 @@ static struct hash_testvec rmd128_tv_template[] = { /* * RIPEMD-160 test vectors from ISO/IEC 10118-3:2004(E) */ @@ -4173,7 +4196,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .digest = "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28" "\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31", -@@ -1201,9 +1398,7 @@ static struct hash_testvec rmd160_tv_tem +@@ -1201,9 +1398,7 @@ static struct hash_testvec rmd160_tv_template[] = { /* * RIPEMD-256 test vectors */ @@ -4184,7 +4207,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .digest = "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18" "\x77\xfc\x52\xd6\x4d\x30\xe3\x7a" -@@ -1269,9 +1464,7 @@ static struct hash_testvec rmd256_tv_tem +@@ -1269,9 +1464,7 @@ static struct hash_testvec rmd256_tv_template[] = { /* * RIPEMD-320 test vectors */ @@ -4195,7 +4218,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .digest = "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1" "\xfd\xf5\xc6\xde\x7b\x41\xb9\xf2\x73\x25" -@@ -1334,36 +1527,49 @@ static struct hash_testvec rmd320_tv_tem +@@ -1334,36 +1527,49 @@ static struct hash_testvec rmd320_tv_template[] = { } }; @@ -4274,7 +4297,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }; -@@ -1371,9 +1577,7 @@ static struct hash_testvec crct10dif_tv_ +@@ -1371,9 +1577,7 @@ static struct hash_testvec crct10dif_tv_template[] = { * SHA1 test vectors from from FIPS PUB 180-1 * Long vector from CAVS 5.0 */ @@ -4285,7 +4308,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -1563,9 +1767,7 @@ static struct hash_testvec sha1_tv_templ +@@ -1563,9 +1767,7 @@ static struct hash_testvec sha1_tv_template[] = { /* * SHA224 test vectors from from FIPS PUB 180-2 */ @@ -4296,7 +4319,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -1737,9 +1939,7 @@ static struct hash_testvec sha224_tv_tem +@@ -1737,9 +1939,7 @@ static struct hash_testvec sha224_tv_template[] = { /* * SHA256 test vectors from from NIST */ @@ -4307,7 +4330,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -1910,9 +2110,7 @@ static struct hash_testvec sha256_tv_tem +@@ -1910,9 +2110,7 @@ static struct hash_testvec sha256_tv_template[] = { /* * SHA384 test vectors from from NIST and kerneli */ @@ -4318,7 +4341,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2104,9 +2302,7 @@ static struct hash_testvec sha384_tv_tem +@@ -2104,9 +2302,7 @@ static struct hash_testvec sha384_tv_template[] = { /* * SHA512 test vectors from from NIST and kerneli */ @@ -4329,7 +4352,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2313,9 +2509,7 @@ static struct hash_testvec sha512_tv_tem +@@ -2313,9 +2509,7 @@ static struct hash_testvec sha512_tv_template[] = { * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE * submission */ @@ -4340,7 +4363,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2411,9 +2605,7 @@ static struct hash_testvec wp512_tv_temp +@@ -2411,9 +2605,7 @@ static struct hash_testvec wp512_tv_template[] = { }, }; @@ -4351,7 +4374,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2493,9 +2685,7 @@ static struct hash_testvec wp384_tv_temp +@@ -2493,9 +2685,7 @@ static struct hash_testvec wp384_tv_template[] = { }, }; @@ -4362,7 +4385,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2562,9 +2752,7 @@ static struct hash_testvec wp256_tv_temp +@@ -2562,9 +2752,7 @@ static struct hash_testvec wp256_tv_template[] = { /* * TIGER test vectors from Tiger website */ @@ -4373,7 +4396,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2607,9 +2795,7 @@ static struct hash_testvec tgr192_tv_tem +@@ -2607,9 +2795,7 @@ static struct hash_testvec tgr192_tv_template[] = { }, }; @@ -4384,7 +4407,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2652,9 +2838,7 @@ static struct hash_testvec tgr160_tv_tem +@@ -2652,9 +2838,7 @@ static struct hash_testvec tgr160_tv_template[] = { }, }; @@ -4395,7 +4418,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .plaintext = "", .psize = 0, -@@ -2691,9 +2875,7 @@ static struct hash_testvec tgr128_tv_tem +@@ -2691,9 +2875,7 @@ static struct hash_testvec tgr128_tv_template[] = { }, }; @@ -4406,7 +4429,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { { .key = "\xdf\xa6\xbf\x4d\xed\x81\xdb\x03" -@@ -2808,9 +2990,7 @@ static struct hash_testvec ghash_tv_temp +@@ -2808,9 +2990,7 @@ static struct hash_testvec ghash_tv_template[] = * HMAC-MD5 test vectors from RFC2202 * (These need to be fixed to not use strlen). */ @@ -4417,7 +4440,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", -@@ -2890,9 +3070,7 @@ static struct hash_testvec hmac_md5_tv_t +@@ -2890,9 +3070,7 @@ static struct hash_testvec hmac_md5_tv_template[] = /* * HMAC-RIPEMD128 test vectors from RFC2286 */ @@ -4428,7 +4451,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", .ksize = 16, -@@ -2971,9 +3149,7 @@ static struct hash_testvec hmac_rmd128_t +@@ -2971,9 +3149,7 @@ static struct hash_testvec hmac_rmd128_tv_template[] = { /* * HMAC-RIPEMD160 test vectors from RFC2286 */ @@ -4439,7 +4462,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", .ksize = 20, -@@ -3052,9 +3228,7 @@ static struct hash_testvec hmac_rmd160_t +@@ -3052,9 +3228,7 @@ static struct hash_testvec hmac_rmd160_tv_template[] = { /* * HMAC-SHA1 test vectors from RFC2202 */ @@ -4450,7 +4473,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", .ksize = 20, -@@ -3135,9 +3309,7 @@ static struct hash_testvec hmac_sha1_tv_ +@@ -3135,9 +3309,7 @@ static struct hash_testvec hmac_sha1_tv_template[] = { /* * SHA224 HMAC test vectors from RFC4231 */ @@ -4461,7 +4484,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -3250,9 +3422,7 @@ static struct hash_testvec hmac_sha224_t +@@ -3250,9 +3422,7 @@ static struct hash_testvec hmac_sha224_tv_template[] = { * HMAC-SHA256 test vectors from * draft-ietf-ipsec-ciph-sha-256-01.txt */ @@ -4472,7 +4495,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x02\x03\x04\x05\x06\x07\x08" "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" -@@ -3387,9 +3557,7 @@ static struct hash_testvec hmac_sha256_t +@@ -3387,9 +3557,7 @@ static struct hash_testvec hmac_sha256_tv_template[] = { }, }; @@ -4483,7 +4506,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From NIST Special Publication 800-38B, AES-128 */ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", -@@ -3464,9 +3632,67 @@ static struct hash_testvec aes_cmac128_t +@@ -3464,9 +3632,67 @@ static struct hash_testvec aes_cmac128_tv_template[] = { } }; @@ -4553,7 +4576,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * From NIST Special Publication 800-38B, Three Key TDEA * Corrected test vectors from: -@@ -3512,9 +3738,7 @@ static struct hash_testvec des3_ede_cmac +@@ -3512,9 +3738,7 @@ static struct hash_testvec des3_ede_cmac64_tv_template[] = { } }; @@ -4564,7 +4587,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", -@@ -3580,36 +3804,35 @@ static struct hash_testvec aes_xcbc128_t +@@ -3580,36 +3804,35 @@ static struct hash_testvec aes_xcbc128_tv_template[] = { } }; @@ -4596,6 +4619,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> -static char vmac_string6[129] = {'p', 't', '*', '7', 'l', - 'i', '!', '#', 'w', '0', - 'z', '/', '4', 'A', 'n'}; +- +-static struct hash_testvec aes_vmac128_tv_template[] = { +static const char vmac_string1[128] = {'\x01', '\x01', '\x01', '\x01', + '\x02', '\x03', '\x02', '\x02', + '\x02', '\x04', '\x01', '\x07', @@ -4623,13 +4648,12 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +static const char vmac_string6[129] = {'p', 't', '*', '7', 'l', + 'i', '!', '#', 'w', '0', + 'z', '/', '4', 'A', 'n'}; - --static struct hash_testvec aes_vmac128_tv_template[] = { ++ +static const struct hash_testvec aes_vmac128_tv_template[] = { { .key = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", -@@ -3687,9 +3910,7 @@ static struct hash_testvec aes_vmac128_t +@@ -3687,9 +3910,7 @@ static struct hash_testvec aes_vmac128_tv_template[] = { * SHA384 HMAC test vectors from RFC4231 */ @@ -4640,7 +4664,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -3787,9 +4008,7 @@ static struct hash_testvec hmac_sha384_t +@@ -3787,9 +4008,7 @@ static struct hash_testvec hmac_sha384_tv_template[] = { * SHA512 HMAC test vectors from RFC4231 */ @@ -4651,7 +4675,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -3894,9 +4113,7 @@ static struct hash_testvec hmac_sha512_t +@@ -3894,9 +4113,7 @@ static struct hash_testvec hmac_sha512_tv_template[] = { }, }; @@ -4662,7 +4686,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -3985,9 +4202,7 @@ static struct hash_testvec hmac_sha3_224 +@@ -3985,9 +4202,7 @@ static struct hash_testvec hmac_sha3_224_tv_template[] = { }, }; @@ -4673,7 +4697,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -4076,9 +4291,7 @@ static struct hash_testvec hmac_sha3_256 +@@ -4076,9 +4291,7 @@ static struct hash_testvec hmac_sha3_256_tv_template[] = { }, }; @@ -4684,7 +4708,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -4175,9 +4388,7 @@ static struct hash_testvec hmac_sha3_384 +@@ -4175,9 +4388,7 @@ static struct hash_testvec hmac_sha3_384_tv_template[] = { }, }; @@ -4695,7 +4719,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" -@@ -4286,9 +4497,7 @@ static struct hash_testvec hmac_sha3_512 +@@ -4286,9 +4497,7 @@ static struct hash_testvec hmac_sha3_512_tv_template[] = { * Poly1305 test vectors from RFC7539 A.3. */ @@ -4706,7 +4730,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Test Vector #1 */ .plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -4533,20 +4742,7 @@ static struct hash_testvec poly1305_tv_t +@@ -4533,20 +4742,7 @@ static struct hash_testvec poly1305_tv_template[] = { /* * DES test vectors. */ @@ -4728,7 +4752,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From Applied Cryptography */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", .klen = 8, -@@ -4720,7 +4916,7 @@ static struct cipher_testvec des_enc_tv_ +@@ -4720,7 +4916,7 @@ static struct cipher_testvec des_enc_tv_template[] = { }, }; @@ -4737,7 +4761,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From Applied Cryptography */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", .klen = 8, -@@ -4830,7 +5026,7 @@ static struct cipher_testvec des_dec_tv_ +@@ -4830,7 +5026,7 @@ static struct cipher_testvec des_dec_tv_template[] = { }, }; @@ -4746,7 +4770,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From OpenSSL */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", .klen = 8, -@@ -4956,7 +5152,7 @@ static struct cipher_testvec des_cbc_enc +@@ -4956,7 +5152,7 @@ static struct cipher_testvec des_cbc_enc_tv_template[] = { }, }; @@ -4755,7 +4779,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* FIPS Pub 81 */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", .klen = 8, -@@ -5065,7 +5261,7 @@ static struct cipher_testvec des_cbc_dec +@@ -5065,7 +5261,7 @@ static struct cipher_testvec des_cbc_dec_tv_template[] = { }, }; @@ -4764,7 +4788,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", .klen = 8, -@@ -5211,7 +5407,7 @@ static struct cipher_testvec des_ctr_enc +@@ -5211,7 +5407,7 @@ static struct cipher_testvec des_ctr_enc_tv_template[] = { }, }; @@ -4773,7 +4797,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\xC9\x83\xA6\xC9\xEC\x0F\x32\x55", .klen = 8, -@@ -5357,7 +5553,7 @@ static struct cipher_testvec des_ctr_dec +@@ -5357,7 +5553,7 @@ static struct cipher_testvec des_ctr_dec_tv_template[] = { }, }; @@ -4782,7 +4806,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* These are from openssl */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\x55\x55\x55\x55\x55\x55\x55\x55" -@@ -5522,7 +5718,7 @@ static struct cipher_testvec des3_ede_en +@@ -5522,7 +5718,7 @@ static struct cipher_testvec des3_ede_enc_tv_template[] = { }, }; @@ -4791,7 +4815,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* These are from openssl */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\x55\x55\x55\x55\x55\x55\x55\x55" -@@ -5687,7 +5883,7 @@ static struct cipher_testvec des3_ede_de +@@ -5687,7 +5883,7 @@ static struct cipher_testvec des3_ede_dec_tv_template[] = { }, }; @@ -4800,7 +4824,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from openssl */ .key = "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24" "\x44\x4D\x99\x5A\x12\xD6\x40\xC0" -@@ -5867,7 +6063,7 @@ static struct cipher_testvec des3_ede_cb +@@ -5867,7 +6063,7 @@ static struct cipher_testvec des3_ede_cbc_enc_tv_template[] = { }, }; @@ -4809,7 +4833,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from openssl */ .key = "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24" "\x44\x4D\x99\x5A\x12\xD6\x40\xC0" -@@ -6047,7 +6243,7 @@ static struct cipher_testvec des3_ede_cb +@@ -6047,7 +6243,7 @@ static struct cipher_testvec des3_ede_cbc_dec_tv_template[] = { }, }; @@ -4818,7 +4842,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x9C\xD6\xF3\x9C\xB9\x5A\x67\x00" "\x5A\x67\x00\x2D\xCE\xEB\x2D\xCE" -@@ -6325,7 +6521,7 @@ static struct cipher_testvec des3_ede_ct +@@ -6325,7 +6521,7 @@ static struct cipher_testvec des3_ede_ctr_enc_tv_template[] = { }, }; @@ -4827,7 +4851,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x9C\xD6\xF3\x9C\xB9\x5A\x67\x00" "\x5A\x67\x00\x2D\xCE\xEB\x2D\xCE" -@@ -6606,14 +6802,7 @@ static struct cipher_testvec des3_ede_ct +@@ -6606,14 +6802,7 @@ static struct cipher_testvec des3_ede_ctr_dec_tv_template[] = { /* * Blowfish test vectors. */ @@ -4843,7 +4867,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* DES test vectors from OpenSSL */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00", .klen = 8, -@@ -6805,7 +6994,7 @@ static struct cipher_testvec bf_enc_tv_t +@@ -6805,7 +6994,7 @@ static struct cipher_testvec bf_enc_tv_template[] = { }, }; @@ -4852,7 +4876,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* DES test vectors from OpenSSL */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00", .klen = 8, -@@ -6997,7 +7186,7 @@ static struct cipher_testvec bf_dec_tv_t +@@ -6997,7 +7186,7 @@ static struct cipher_testvec bf_dec_tv_template[] = { }, }; @@ -4861,7 +4885,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From OpenSSL */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87", -@@ -7154,7 +7343,7 @@ static struct cipher_testvec bf_cbc_enc_ +@@ -7154,7 +7343,7 @@ static struct cipher_testvec bf_cbc_enc_tv_template[] = { }, }; @@ -4870,7 +4894,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From OpenSSL */ .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87", -@@ -7311,7 +7500,7 @@ static struct cipher_testvec bf_cbc_dec_ +@@ -7311,7 +7500,7 @@ static struct cipher_testvec bf_cbc_dec_tv_template[] = { }, }; @@ -4879,7 +4903,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -7723,7 +7912,7 @@ static struct cipher_testvec bf_ctr_enc_ +@@ -7723,7 +7912,7 @@ static struct cipher_testvec bf_ctr_enc_tv_template[] = { }, }; @@ -4888,7 +4912,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -8138,18 +8327,7 @@ static struct cipher_testvec bf_ctr_dec_ +@@ -8138,18 +8327,7 @@ static struct cipher_testvec bf_ctr_dec_tv_template[] = { /* * Twofish test vectors. */ @@ -4908,7 +4932,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -8317,7 +8495,7 @@ static struct cipher_testvec tf_enc_tv_t +@@ -8317,7 +8495,7 @@ static struct cipher_testvec tf_enc_tv_template[] = { }, }; @@ -4917,7 +4941,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -8485,7 +8663,7 @@ static struct cipher_testvec tf_dec_tv_t +@@ -8485,7 +8663,7 @@ static struct cipher_testvec tf_dec_tv_template[] = { }, }; @@ -4926,7 +4950,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Nettle */ .key = zeroed_string, .klen = 16, -@@ -8668,7 +8846,7 @@ static struct cipher_testvec tf_cbc_enc_ +@@ -8668,7 +8846,7 @@ static struct cipher_testvec tf_cbc_enc_tv_template[] = { }, }; @@ -4935,7 +4959,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Reverse of the first four above */ .key = zeroed_string, .klen = 16, -@@ -8851,7 +9029,7 @@ static struct cipher_testvec tf_cbc_dec_ +@@ -8851,7 +9029,7 @@ static struct cipher_testvec tf_cbc_dec_tv_template[] = { }, }; @@ -4944,7 +4968,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -9262,7 +9440,7 @@ static struct cipher_testvec tf_ctr_enc_ +@@ -9262,7 +9440,7 @@ static struct cipher_testvec tf_ctr_enc_tv_template[] = { }, }; @@ -4953,7 +4977,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -9673,7 +9851,7 @@ static struct cipher_testvec tf_ctr_dec_ +@@ -9673,7 +9851,7 @@ static struct cipher_testvec tf_ctr_dec_tv_template[] = { }, }; @@ -4962,7 +4986,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-LRW test vectors */ { .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" -@@ -9925,7 +10103,7 @@ static struct cipher_testvec tf_lrw_enc_ +@@ -9925,7 +10103,7 @@ static struct cipher_testvec tf_lrw_enc_tv_template[] = { }, }; @@ -4971,7 +4995,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-LRW test vectors */ /* same as enc vectors with input and result reversed */ { -@@ -10178,7 +10356,7 @@ static struct cipher_testvec tf_lrw_dec_ +@@ -10178,7 +10356,7 @@ static struct cipher_testvec tf_lrw_dec_tv_template[] = { }, }; @@ -4980,7 +5004,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-XTS test vectors */ { .key = "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -10520,7 +10698,7 @@ static struct cipher_testvec tf_xts_enc_ +@@ -10520,7 +10698,7 @@ static struct cipher_testvec tf_xts_enc_tv_template[] = { }, }; @@ -4989,7 +5013,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-XTS test vectors */ /* same as enc vectors with input and result reversed */ { -@@ -10867,25 +11045,7 @@ static struct cipher_testvec tf_xts_dec_ +@@ -10867,25 +11045,7 @@ static struct cipher_testvec tf_xts_dec_tv_template[] = { * Serpent test vectors. These are backwards because Serpent writes * octet sequences in right-to-left mode. */ @@ -5016,7 +5040,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .input = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", -@@ -11061,7 +11221,7 @@ static struct cipher_testvec serpent_enc +@@ -11061,7 +11221,7 @@ static struct cipher_testvec serpent_enc_tv_template[] = { }, }; @@ -5025,7 +5049,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* KeySize=128, PT=0, I=1 */ .input = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", -@@ -11111,7 +11271,7 @@ static struct cipher_testvec tnepres_enc +@@ -11111,7 +11271,7 @@ static struct cipher_testvec tnepres_enc_tv_template[] = { }; @@ -5034,7 +5058,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .input = "\x12\x07\xfc\xce\x9b\xd0\xd6\x47" "\x6a\xe9\x8f\xbe\xd1\x43\xa0\xe2", -@@ -11287,7 +11447,7 @@ static struct cipher_testvec serpent_dec +@@ -11287,7 +11447,7 @@ static struct cipher_testvec serpent_dec_tv_template[] = { }, }; @@ -5043,7 +5067,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .input = "\x41\xcc\x6b\x31\x59\x31\x45\x97" "\x6d\x6f\xbb\x38\x4b\x37\x21\x28", -@@ -11328,7 +11488,7 @@ static struct cipher_testvec tnepres_dec +@@ -11328,7 +11488,7 @@ static struct cipher_testvec tnepres_dec_tv_template[] = { }, }; @@ -5052,7 +5076,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -11469,7 +11629,7 @@ static struct cipher_testvec serpent_cbc +@@ -11469,7 +11629,7 @@ static struct cipher_testvec serpent_cbc_enc_tv_template[] = { }, }; @@ -5061,7 +5085,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -11610,7 +11770,7 @@ static struct cipher_testvec serpent_cbc +@@ -11610,7 +11770,7 @@ static struct cipher_testvec serpent_cbc_dec_tv_template[] = { }, }; @@ -5070,7 +5094,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -12021,7 +12181,7 @@ static struct cipher_testvec serpent_ctr +@@ -12021,7 +12181,7 @@ static struct cipher_testvec serpent_ctr_enc_tv_template[] = { }, }; @@ -5079,7 +5103,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -12432,7 +12592,7 @@ static struct cipher_testvec serpent_ctr +@@ -12432,7 +12592,7 @@ static struct cipher_testvec serpent_ctr_dec_tv_template[] = { }, }; @@ -5088,7 +5112,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-LRW test vectors */ { .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" -@@ -12684,7 +12844,7 @@ static struct cipher_testvec serpent_lrw +@@ -12684,7 +12844,7 @@ static struct cipher_testvec serpent_lrw_enc_tv_template[] = { }, }; @@ -5097,7 +5121,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-LRW test vectors */ /* same as enc vectors with input and result reversed */ { -@@ -12937,7 +13097,7 @@ static struct cipher_testvec serpent_lrw +@@ -12937,7 +13097,7 @@ static struct cipher_testvec serpent_lrw_dec_tv_template[] = { }, }; @@ -5106,7 +5130,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-XTS test vectors */ { .key = "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -13279,7 +13439,7 @@ static struct cipher_testvec serpent_xts +@@ -13279,7 +13439,7 @@ static struct cipher_testvec serpent_xts_enc_tv_template[] = { }, }; @@ -5115,7 +5139,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-XTS test vectors */ /* same as enc vectors with input and result reversed */ { -@@ -13623,18 +13783,7 @@ static struct cipher_testvec serpent_xts +@@ -13623,18 +13783,7 @@ static struct cipher_testvec serpent_xts_dec_tv_template[] = { }; /* Cast6 test vectors from RFC 2612 */ @@ -5135,7 +5159,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d", -@@ -13805,7 +13954,7 @@ static struct cipher_testvec cast6_enc_t +@@ -13805,7 +13954,7 @@ static struct cipher_testvec cast6_enc_tv_template[] = { }, }; @@ -5144,7 +5168,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c" "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d", -@@ -13976,7 +14125,7 @@ static struct cipher_testvec cast6_dec_t +@@ -13976,7 +14125,7 @@ static struct cipher_testvec cast6_dec_tv_template[] = { }, }; @@ -5153,7 +5177,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -14117,7 +14266,7 @@ static struct cipher_testvec cast6_cbc_e +@@ -14117,7 +14266,7 @@ static struct cipher_testvec cast6_cbc_enc_tv_template[] = { }, }; @@ -5162,7 +5186,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -14258,7 +14407,7 @@ static struct cipher_testvec cast6_cbc_d +@@ -14258,7 +14407,7 @@ static struct cipher_testvec cast6_cbc_dec_tv_template[] = { }, }; @@ -5171,7 +5195,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -14415,7 +14564,7 @@ static struct cipher_testvec cast6_ctr_e +@@ -14415,7 +14564,7 @@ static struct cipher_testvec cast6_ctr_enc_tv_template[] = { }, }; @@ -5180,7 +5204,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -14572,7 +14721,7 @@ static struct cipher_testvec cast6_ctr_d +@@ -14572,7 +14721,7 @@ static struct cipher_testvec cast6_ctr_dec_tv_template[] = { }, }; @@ -5189,7 +5213,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" -@@ -14719,7 +14868,7 @@ static struct cipher_testvec cast6_lrw_e +@@ -14719,7 +14868,7 @@ static struct cipher_testvec cast6_lrw_enc_tv_template[] = { }, }; @@ -5198,7 +5222,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c" "\x23\x84\xcb\x1c\x77\xd6\x19\x5d" -@@ -14866,7 +15015,7 @@ static struct cipher_testvec cast6_lrw_d +@@ -14866,7 +15015,7 @@ static struct cipher_testvec cast6_lrw_dec_tv_template[] = { }, }; @@ -5207,7 +5231,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x27\x18\x28\x18\x28\x45\x90\x45" "\x23\x53\x60\x28\x74\x71\x35\x26" -@@ -15015,7 +15164,7 @@ static struct cipher_testvec cast6_xts_e +@@ -15015,7 +15164,7 @@ static struct cipher_testvec cast6_xts_enc_tv_template[] = { }, }; @@ -5216,7 +5240,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x27\x18\x28\x18\x28\x45\x90\x45" "\x23\x53\x60\x28\x74\x71\x35\x26" -@@ -15168,39 +15317,7 @@ static struct cipher_testvec cast6_xts_d +@@ -15168,39 +15317,7 @@ static struct cipher_testvec cast6_xts_dec_tv_template[] = { /* * AES test vectors. */ @@ -5257,7 +5281,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From FIPS-197 */ .key = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", -@@ -15372,7 +15489,7 @@ static struct cipher_testvec aes_enc_tv_ +@@ -15372,7 +15489,7 @@ static struct cipher_testvec aes_enc_tv_template[] = { }, }; @@ -5266,7 +5290,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From FIPS-197 */ .key = "\x00\x01\x02\x03\x04\x05\x06\x07" "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", -@@ -15544,7 +15661,7 @@ static struct cipher_testvec aes_dec_tv_ +@@ -15544,7 +15661,7 @@ static struct cipher_testvec aes_dec_tv_template[] = { }, }; @@ -5275,7 +5299,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From RFC 3602 */ .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" "\x51\x2e\x03\xd5\x34\x12\x00\x06", -@@ -15766,7 +15883,7 @@ static struct cipher_testvec aes_cbc_enc +@@ -15766,7 +15883,7 @@ static struct cipher_testvec aes_cbc_enc_tv_template[] = { }, }; @@ -5284,7 +5308,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From RFC 3602 */ .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" "\x51\x2e\x03\xd5\x34\x12\x00\x06", -@@ -15988,7 +16105,7 @@ static struct cipher_testvec aes_cbc_dec +@@ -15988,7 +16105,7 @@ static struct cipher_testvec aes_cbc_dec_tv_template[] = { }, }; @@ -5293,7 +5317,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Input data from RFC 2410 Case 1 */ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -16030,7 +16147,7 @@ static struct aead_testvec hmac_md5_ecb_ +@@ -16030,7 +16147,7 @@ static struct aead_testvec hmac_md5_ecb_cipher_null_enc_tv_template[] = { }, }; @@ -5302,7 +5326,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -16072,7 +16189,7 @@ static struct aead_testvec hmac_md5_ecb_ +@@ -16072,7 +16189,7 @@ static struct aead_testvec hmac_md5_ecb_cipher_null_dec_tv_template[] = { }, }; @@ -5311,7 +5335,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* RFC 3602 Case 1 */ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -16341,7 +16458,7 @@ static struct aead_testvec hmac_sha1_aes +@@ -16341,7 +16458,7 @@ static struct aead_testvec hmac_sha1_aes_cbc_enc_tv_temp[] = { }, }; @@ -5320,7 +5344,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Input data from RFC 2410 Case 1 */ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -16387,7 +16504,7 @@ static struct aead_testvec hmac_sha1_ecb +@@ -16387,7 +16504,7 @@ static struct aead_testvec hmac_sha1_ecb_cipher_null_enc_tv_temp[] = { }, }; @@ -5329,7 +5353,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -16433,7 +16550,7 @@ static struct aead_testvec hmac_sha1_ecb +@@ -16433,7 +16550,7 @@ static struct aead_testvec hmac_sha1_ecb_cipher_null_dec_tv_temp[] = { }, }; @@ -5338,7 +5362,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* RFC 3602 Case 1 */ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -16716,7 +16833,7 @@ static struct aead_testvec hmac_sha256_a +@@ -16716,7 +16833,7 @@ static struct aead_testvec hmac_sha256_aes_cbc_enc_tv_temp[] = { }, }; @@ -5347,7 +5371,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* RFC 3602 Case 1 */ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17055,9 +17172,7 @@ static struct aead_testvec hmac_sha512_a +@@ -17055,9 +17172,7 @@ static struct aead_testvec hmac_sha512_aes_cbc_enc_tv_temp[] = { }, }; @@ -5358,7 +5382,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17116,9 +17231,7 @@ static struct aead_testvec hmac_sha1_des +@@ -17116,9 +17231,7 @@ static struct aead_testvec hmac_sha1_des_cbc_enc_tv_temp[] = { }, }; @@ -5369,7 +5393,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17177,9 +17290,7 @@ static struct aead_testvec hmac_sha224_d +@@ -17177,9 +17290,7 @@ static struct aead_testvec hmac_sha224_des_cbc_enc_tv_temp[] = { }, }; @@ -5380,7 +5404,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17240,9 +17351,7 @@ static struct aead_testvec hmac_sha256_d +@@ -17240,9 +17351,7 @@ static struct aead_testvec hmac_sha256_des_cbc_enc_tv_temp[] = { }, }; @@ -5391,7 +5415,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17307,9 +17416,7 @@ static struct aead_testvec hmac_sha384_d +@@ -17307,9 +17416,7 @@ static struct aead_testvec hmac_sha384_des_cbc_enc_tv_temp[] = { }, }; @@ -5402,7 +5426,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17378,9 +17485,7 @@ static struct aead_testvec hmac_sha512_d +@@ -17378,9 +17485,7 @@ static struct aead_testvec hmac_sha512_des_cbc_enc_tv_temp[] = { }, }; @@ -5413,7 +5437,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17441,9 +17546,7 @@ static struct aead_testvec hmac_sha1_des +@@ -17441,9 +17546,7 @@ static struct aead_testvec hmac_sha1_des3_ede_cbc_enc_tv_temp[] = { }, }; @@ -5424,7 +5448,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17504,9 +17607,7 @@ static struct aead_testvec hmac_sha224_d +@@ -17504,9 +17607,7 @@ static struct aead_testvec hmac_sha224_des3_ede_cbc_enc_tv_temp[] = { }, }; @@ -5435,7 +5459,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17569,9 +17670,7 @@ static struct aead_testvec hmac_sha256_d +@@ -17569,9 +17670,7 @@ static struct aead_testvec hmac_sha256_des3_ede_cbc_enc_tv_temp[] = { }, }; @@ -5446,7 +5470,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17638,9 +17737,7 @@ static struct aead_testvec hmac_sha384_d +@@ -17638,9 +17737,7 @@ static struct aead_testvec hmac_sha384_des3_ede_cbc_enc_tv_temp[] = { }, }; @@ -5457,7 +5481,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /*Generated with cryptopp*/ #ifdef __LITTLE_ENDIAN .key = "\x08\x00" /* rta length */ -@@ -17711,7 +17808,7 @@ static struct aead_testvec hmac_sha512_d +@@ -17711,7 +17808,7 @@ static struct aead_testvec hmac_sha512_des3_ede_cbc_enc_tv_temp[] = { }, }; @@ -5466,7 +5490,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */ { /* LRW-32-AES 1 */ .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" -@@ -17964,7 +18061,7 @@ static struct cipher_testvec aes_lrw_enc +@@ -17964,7 +18061,7 @@ static struct cipher_testvec aes_lrw_enc_tv_template[] = { } }; @@ -5475,7 +5499,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */ /* same as enc vectors with input and result reversed */ { /* LRW-32-AES 1 */ -@@ -18218,7 +18315,7 @@ static struct cipher_testvec aes_lrw_dec +@@ -18218,7 +18315,7 @@ static struct cipher_testvec aes_lrw_dec_tv_template[] = { } }; @@ -5484,7 +5508,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* http://grouper.ieee.org/groups/1619/email/pdf00086.pdf */ { /* XTS-AES 1 */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -18561,7 +18658,7 @@ static struct cipher_testvec aes_xts_enc +@@ -18561,7 +18658,7 @@ static struct cipher_testvec aes_xts_enc_tv_template[] = { } }; @@ -5493,7 +5517,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* http://grouper.ieee.org/groups/1619/email/pdf00086.pdf */ { /* XTS-AES 1 */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -18905,7 +19002,7 @@ static struct cipher_testvec aes_xts_dec +@@ -18905,7 +19002,7 @@ static struct cipher_testvec aes_xts_dec_tv_template[] = { }; @@ -5502,7 +5526,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From NIST Special Publication 800-38A, Appendix F.5 */ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", -@@ -19260,7 +19357,7 @@ static struct cipher_testvec aes_ctr_enc +@@ -19260,7 +19357,7 @@ static struct cipher_testvec aes_ctr_enc_tv_template[] = { }, }; @@ -5511,7 +5535,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From NIST Special Publication 800-38A, Appendix F.5 */ .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" "\xab\xf7\x15\x88\x09\xcf\x4f\x3c", -@@ -19615,7 +19712,7 @@ static struct cipher_testvec aes_ctr_dec +@@ -19615,7 +19712,7 @@ static struct cipher_testvec aes_ctr_dec_tv_template[] = { }, }; @@ -5520,7 +5544,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From RFC 3686 */ .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc" "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" -@@ -20747,7 +20844,7 @@ static struct cipher_testvec aes_ctr_rfc +@@ -20747,7 +20844,7 @@ static struct cipher_testvec aes_ctr_rfc3686_enc_tv_template[] = { }, }; @@ -5529,7 +5553,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From RFC 3686 */ .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc" "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" -@@ -20838,7 +20935,7 @@ static struct cipher_testvec aes_ctr_rfc +@@ -20838,7 +20935,7 @@ static struct cipher_testvec aes_ctr_rfc3686_dec_tv_template[] = { }, }; @@ -5538,7 +5562,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* From NIST Special Publication 800-38A, Appendix F.5 */ { .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" -@@ -20867,7 +20964,7 @@ static struct cipher_testvec aes_ofb_enc +@@ -20867,7 +20964,7 @@ static struct cipher_testvec aes_ofb_enc_tv_template[] = { } }; @@ -5547,7 +5571,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* From NIST Special Publication 800-38A, Appendix F.5 */ { .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6" -@@ -20896,7 +20993,7 @@ static struct cipher_testvec aes_ofb_dec +@@ -20896,7 +20993,7 @@ static struct cipher_testvec aes_ofb_dec_tv_template[] = { } }; @@ -5556,7 +5580,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From McGrew & Viega - http://citeseer.ist.psu.edu/656989.html */ .key = zeroed_string, .klen = 16, -@@ -21056,7 +21153,7 @@ static struct aead_testvec aes_gcm_enc_t +@@ -21056,7 +21153,7 @@ static struct aead_testvec aes_gcm_enc_tv_template[] = { } }; @@ -5565,7 +5589,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From McGrew & Viega - http://citeseer.ist.psu.edu/656989.html */ .key = zeroed_string, .klen = 32, -@@ -21258,7 +21355,7 @@ static struct aead_testvec aes_gcm_dec_t +@@ -21258,7 +21355,7 @@ static struct aead_testvec aes_gcm_dec_tv_template[] = { } }; @@ -5574,7 +5598,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated using Crypto++ */ .key = zeroed_string, .klen = 20, -@@ -21871,7 +21968,7 @@ static struct aead_testvec aes_gcm_rfc41 +@@ -21871,7 +21968,7 @@ static struct aead_testvec aes_gcm_rfc4106_enc_tv_template[] = { } }; @@ -5583,7 +5607,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated using Crypto++ */ .key = zeroed_string, .klen = 20, -@@ -22485,7 +22582,7 @@ static struct aead_testvec aes_gcm_rfc41 +@@ -22485,7 +22582,7 @@ static struct aead_testvec aes_gcm_rfc4106_dec_tv_template[] = { } }; @@ -5592,7 +5616,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From draft-mcgrew-gcm-test-01 */ .key = "\x4c\x80\xcd\xef\xbb\x5d\x10\xda" "\x90\x6a\xc7\x3c\x36\x13\xa6\x34" -@@ -22516,7 +22613,7 @@ static struct aead_testvec aes_gcm_rfc45 +@@ -22516,7 +22613,7 @@ static struct aead_testvec aes_gcm_rfc4543_enc_tv_template[] = { } }; @@ -5601,7 +5625,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From draft-mcgrew-gcm-test-01 */ .key = "\x4c\x80\xcd\xef\xbb\x5d\x10\xda" "\x90\x6a\xc7\x3c\x36\x13\xa6\x34" -@@ -22575,7 +22672,7 @@ static struct aead_testvec aes_gcm_rfc45 +@@ -22575,7 +22672,7 @@ static struct aead_testvec aes_gcm_rfc4543_dec_tv_template[] = { }, }; @@ -5610,7 +5634,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From RFC 3610 */ .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", -@@ -22859,7 +22956,7 @@ static struct aead_testvec aes_ccm_enc_t +@@ -22859,7 +22956,7 @@ static struct aead_testvec aes_ccm_enc_tv_template[] = { } }; @@ -5619,7 +5643,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* From RFC 3610 */ .key = "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf", -@@ -23191,7 +23288,7 @@ static struct aead_testvec aes_ccm_dec_t +@@ -23191,7 +23288,7 @@ static struct aead_testvec aes_ccm_dec_tv_template[] = { * These vectors are copied/generated from the ones for rfc4106 with * the key truncated by one byte.. */ @@ -5628,7 +5652,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated using Crypto++ */ .key = zeroed_string, .klen = 19, -@@ -23804,7 +23901,7 @@ static struct aead_testvec aes_ccm_rfc43 +@@ -23804,7 +23901,7 @@ static struct aead_testvec aes_ccm_rfc4309_enc_tv_template[] = { } }; @@ -5637,7 +5661,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated using Crypto++ */ .key = zeroed_string, .klen = 19, -@@ -24420,9 +24517,7 @@ static struct aead_testvec aes_ccm_rfc43 +@@ -24420,9 +24517,7 @@ static struct aead_testvec aes_ccm_rfc4309_dec_tv_template[] = { /* * ChaCha20-Poly1305 AEAD test vectors from RFC7539 2.8.2./A.5. */ @@ -5648,7 +5672,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" -@@ -24554,7 +24649,7 @@ static struct aead_testvec rfc7539_enc_t +@@ -24554,7 +24649,7 @@ static struct aead_testvec rfc7539_enc_tv_template[] = { }, }; @@ -5657,7 +5681,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" -@@ -24689,9 +24784,7 @@ static struct aead_testvec rfc7539_dec_t +@@ -24689,9 +24784,7 @@ static struct aead_testvec rfc7539_dec_tv_template[] = { /* * draft-irtf-cfrg-chacha20-poly1305 */ @@ -5668,7 +5692,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" -@@ -24779,7 +24872,7 @@ static struct aead_testvec rfc7539esp_en +@@ -24779,7 +24872,7 @@ static struct aead_testvec rfc7539esp_enc_tv_template[] = { }, }; @@ -5677,7 +5701,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" -@@ -24875,7 +24968,7 @@ static struct aead_testvec rfc7539esp_de +@@ -24875,7 +24968,7 @@ static struct aead_testvec rfc7539esp_dec_tv_template[] = { * semiblock of the ciphertext from the test vector. For decryption, iv is * the first semiblock of the ciphertext. */ @@ -5686,7 +5710,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x75\x75\xda\x3a\x93\x60\x7c\xc2" "\xbf\xd8\xce\xc7\xaa\xdf\xd9\xa6", -@@ -24890,7 +24983,7 @@ static struct cipher_testvec aes_kw_enc_ +@@ -24890,7 +24983,7 @@ static struct cipher_testvec aes_kw_enc_tv_template[] = { }, }; @@ -5695,7 +5719,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x80\xaa\x99\x73\x27\xa4\x80\x6b" "\x6a\x7a\x41\xa5\x2b\x86\xc3\x71" -@@ -24913,9 +25006,7 @@ static struct cipher_testvec aes_kw_dec_ +@@ -24913,9 +25006,7 @@ static struct cipher_testvec aes_kw_dec_tv_template[] = { * http://csrc.nist.gov/groups/STM/cavp/documents/rng/RNGVS.pdf * Only AES-128 is supported at this time. */ @@ -5706,7 +5730,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\xf3\xb1\x66\x6d\x13\x60\x72\x42" "\xed\x06\x1c\xab\xb8\xd4\x62\x02", -@@ -25011,7 +25102,7 @@ static struct cprng_testvec ansi_cprng_a +@@ -25011,7 +25102,7 @@ static struct cprng_testvec ansi_cprng_aes_tv_template[] = { * (Hash, HMAC, CTR) are tested with all permutations of use cases (w/ and * w/o personalization string, w/ and w/o additional input string). */ @@ -5715,7 +5739,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\x72\x88\x4c\xcd\x6c\x85\x57\x70\xf7\x0b\x8b\x86" -@@ -25169,7 +25260,7 @@ static struct drbg_testvec drbg_pr_sha25 +@@ -25169,7 +25260,7 @@ static struct drbg_testvec drbg_pr_sha256_tv_template[] = { }, }; @@ -5724,7 +5748,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\x99\x69\xe5\x4b\x47\x03\xff\x31\x78\x5b\x87\x9a" -@@ -25327,7 +25418,7 @@ static struct drbg_testvec drbg_pr_hmac_ +@@ -25327,7 +25418,7 @@ static struct drbg_testvec drbg_pr_hmac_sha256_tv_template[] = { }, }; @@ -5733,7 +5757,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\xd1\x44\xc6\x61\x81\x6d\xca\x9d\x15\x28\x8a\x42" -@@ -25451,7 +25542,7 @@ static struct drbg_testvec drbg_pr_ctr_a +@@ -25451,7 +25542,7 @@ static struct drbg_testvec drbg_pr_ctr_aes128_tv_template[] = { * (Hash, HMAC, CTR) are tested with all permutations of use cases (w/ and * w/o personalization string, w/ and w/o additional input string). */ @@ -5742,7 +5766,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\xa6\x5a\xd0\xf3\x45\xdb\x4e\x0e\xff\xe8\x75\xc3" -@@ -25573,7 +25664,7 @@ static struct drbg_testvec drbg_nopr_sha +@@ -25573,7 +25664,7 @@ static struct drbg_testvec drbg_nopr_sha256_tv_template[] = { }, }; @@ -5751,7 +5775,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\xca\x85\x19\x11\x34\x93\x84\xbf\xfe\x89\xde\x1c" -@@ -25695,7 +25786,7 @@ static struct drbg_testvec drbg_nopr_hma +@@ -25695,7 +25786,7 @@ static struct drbg_testvec drbg_nopr_hmac_sha256_tv_template[] = { }, }; @@ -5760,7 +5784,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\xc3\x5c\x2f\xa2\xa8\x9d\x52\xa1\x1f\xa3\x2a\xa9" -@@ -25719,7 +25810,7 @@ static struct drbg_testvec drbg_nopr_ctr +@@ -25719,7 +25810,7 @@ static struct drbg_testvec drbg_nopr_ctr_aes192_tv_template[] = { }, }; @@ -5769,7 +5793,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\x36\x40\x19\x40\xfa\x8b\x1f\xba\x91\xa1\x66\x1f" -@@ -25743,7 +25834,7 @@ static struct drbg_testvec drbg_nopr_ctr +@@ -25743,7 +25834,7 @@ static struct drbg_testvec drbg_nopr_ctr_aes256_tv_template[] = { }, }; @@ -5778,7 +5802,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .entropy = (unsigned char *) "\x87\xe1\xc5\x32\x99\x7f\x57\xa3\x5c\x28\x6d\xe8" -@@ -25832,14 +25923,7 @@ static struct drbg_testvec drbg_nopr_ctr +@@ -25832,14 +25923,7 @@ static struct drbg_testvec drbg_nopr_ctr_aes128_tv_template[] = { }; /* Cast5 test vectors from RFC 2144 */ @@ -5794,7 +5818,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x23\x45\x67\x12\x34\x56\x78" "\x23\x45\x67\x89\x34\x56\x78\x9a", -@@ -26000,7 +26084,7 @@ static struct cipher_testvec cast5_enc_t +@@ -26000,7 +26084,7 @@ static struct cipher_testvec cast5_enc_tv_template[] = { }, }; @@ -5803,7 +5827,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x23\x45\x67\x12\x34\x56\x78" "\x23\x45\x67\x89\x34\x56\x78\x9a", -@@ -26161,7 +26245,7 @@ static struct cipher_testvec cast5_dec_t +@@ -26161,7 +26245,7 @@ static struct cipher_testvec cast5_dec_tv_template[] = { }, }; @@ -5812,7 +5836,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", -@@ -26299,7 +26383,7 @@ static struct cipher_testvec cast5_cbc_e +@@ -26299,7 +26383,7 @@ static struct cipher_testvec cast5_cbc_enc_tv_template[] = { }, }; @@ -5821,7 +5845,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", -@@ -26437,7 +26521,7 @@ static struct cipher_testvec cast5_cbc_d +@@ -26437,7 +26521,7 @@ static struct cipher_testvec cast5_cbc_dec_tv_template[] = { }, }; @@ -5830,7 +5854,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", -@@ -26588,7 +26672,7 @@ static struct cipher_testvec cast5_ctr_e +@@ -26588,7 +26672,7 @@ static struct cipher_testvec cast5_ctr_enc_tv_template[] = { }, }; @@ -5839,7 +5863,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated from TF test vectors */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A", -@@ -26742,10 +26826,7 @@ static struct cipher_testvec cast5_ctr_d +@@ -26742,10 +26826,7 @@ static struct cipher_testvec cast5_ctr_dec_tv_template[] = { /* * ARC4 test vectors from OpenSSL */ @@ -5851,7 +5875,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", .klen = 8, -@@ -26811,7 +26892,7 @@ static struct cipher_testvec arc4_enc_tv +@@ -26811,7 +26892,7 @@ static struct cipher_testvec arc4_enc_tv_template[] = { }, }; @@ -5860,7 +5884,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x23\x45\x67\x89\xab\xcd\xef", .klen = 8, -@@ -26880,10 +26961,7 @@ static struct cipher_testvec arc4_dec_tv +@@ -26880,10 +26961,7 @@ static struct cipher_testvec arc4_dec_tv_template[] = { /* * TEA test vectors */ @@ -5872,7 +5896,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -26926,7 +27004,7 @@ static struct cipher_testvec tea_enc_tv_ +@@ -26926,7 +27004,7 @@ static struct cipher_testvec tea_enc_tv_template[] = { } }; @@ -5881,7 +5905,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -26972,10 +27050,7 @@ static struct cipher_testvec tea_dec_tv_ +@@ -26972,10 +27050,7 @@ static struct cipher_testvec tea_dec_tv_template[] = { /* * XTEA test vectors */ @@ -5893,7 +5917,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -27018,7 +27093,7 @@ static struct cipher_testvec xtea_enc_tv +@@ -27018,7 +27093,7 @@ static struct cipher_testvec xtea_enc_tv_template[] = { } }; @@ -5902,7 +5926,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -27064,10 +27139,7 @@ static struct cipher_testvec xtea_dec_tv +@@ -27064,10 +27139,7 @@ static struct cipher_testvec xtea_dec_tv_template[] = { /* * KHAZAD test vectors. */ @@ -5914,7 +5938,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x80\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", -@@ -27113,7 +27185,7 @@ static struct cipher_testvec khazad_enc_ +@@ -27113,7 +27185,7 @@ static struct cipher_testvec khazad_enc_tv_template[] = { }, }; @@ -5923,7 +5947,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x80\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00", -@@ -27163,12 +27235,7 @@ static struct cipher_testvec khazad_dec_ +@@ -27163,12 +27235,7 @@ static struct cipher_testvec khazad_dec_tv_template[] = { * Anubis test vectors. */ @@ -5937,7 +5961,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe", -@@ -27231,7 +27298,7 @@ static struct cipher_testvec anubis_enc_ +@@ -27231,7 +27298,7 @@ static struct cipher_testvec anubis_enc_tv_template[] = { }, }; @@ -5946,7 +5970,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe", -@@ -27294,7 +27361,7 @@ static struct cipher_testvec anubis_dec_ +@@ -27294,7 +27361,7 @@ static struct cipher_testvec anubis_dec_tv_template[] = { }, }; @@ -5955,7 +5979,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe", -@@ -27329,7 +27396,7 @@ static struct cipher_testvec anubis_cbc_ +@@ -27329,7 +27396,7 @@ static struct cipher_testvec anubis_cbc_enc_tv_template[] = { }, }; @@ -5964,7 +5988,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe" "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe", -@@ -27367,10 +27434,7 @@ static struct cipher_testvec anubis_cbc_ +@@ -27367,10 +27434,7 @@ static struct cipher_testvec anubis_cbc_dec_tv_template[] = { /* * XETA test vectors */ @@ -5976,7 +6000,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -27413,7 +27477,7 @@ static struct cipher_testvec xeta_enc_tv +@@ -27413,7 +27477,7 @@ static struct cipher_testvec xeta_enc_tv_template[] = { } }; @@ -5985,7 +6009,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -27459,10 +27523,7 @@ static struct cipher_testvec xeta_dec_tv +@@ -27459,10 +27523,7 @@ static struct cipher_testvec xeta_dec_tv_template[] = { /* * FCrypt test vectors */ @@ -5997,7 +6021,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00", .klen = 8, -@@ -27523,7 +27584,7 @@ static struct cipher_testvec fcrypt_pcbc +@@ -27523,7 +27584,7 @@ static struct cipher_testvec fcrypt_pcbc_enc_tv_template[] = { } }; @@ -6006,7 +6030,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00", .klen = 8, -@@ -27587,18 +27648,7 @@ static struct cipher_testvec fcrypt_pcbc +@@ -27587,18 +27648,7 @@ static struct cipher_testvec fcrypt_pcbc_dec_tv_template[] = { /* * CAMELLIA test vectors. */ @@ -6026,7 +6050,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\xfe\xdc\xba\x98\x76\x54\x32\x10", -@@ -27898,7 +27948,7 @@ static struct cipher_testvec camellia_en +@@ -27898,7 +27948,7 @@ static struct cipher_testvec camellia_enc_tv_template[] = { }, }; @@ -6035,7 +6059,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" "\xfe\xdc\xba\x98\x76\x54\x32\x10", -@@ -28198,7 +28248,7 @@ static struct cipher_testvec camellia_de +@@ -28198,7 +28248,7 @@ static struct cipher_testvec camellia_dec_tv_template[] = { }, }; @@ -6044,7 +6068,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" "\x51\x2e\x03\xd5\x34\x12\x00\x06", -@@ -28494,7 +28544,7 @@ static struct cipher_testvec camellia_cb +@@ -28494,7 +28544,7 @@ static struct cipher_testvec camellia_cbc_enc_tv_template[] = { }, }; @@ -6053,7 +6077,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" "\x51\x2e\x03\xd5\x34\x12\x00\x06", -@@ -28790,7 +28840,7 @@ static struct cipher_testvec camellia_cb +@@ -28790,7 +28840,7 @@ static struct cipher_testvec camellia_cbc_dec_tv_template[] = { }, }; @@ -6062,7 +6086,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -29457,7 +29507,7 @@ static struct cipher_testvec camellia_ct +@@ -29457,7 +29507,7 @@ static struct cipher_testvec camellia_ctr_enc_tv_template[] = { }, }; @@ -6071,7 +6095,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* Generated with Crypto++ */ .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" -@@ -30124,7 +30174,7 @@ static struct cipher_testvec camellia_ct +@@ -30124,7 +30174,7 @@ static struct cipher_testvec camellia_ctr_dec_tv_template[] = { }, }; @@ -6080,7 +6104,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-LRW test vectors */ { .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d" -@@ -30376,7 +30426,7 @@ static struct cipher_testvec camellia_lr +@@ -30376,7 +30426,7 @@ static struct cipher_testvec camellia_lrw_enc_tv_template[] = { }, }; @@ -6089,7 +6113,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-LRW test vectors */ /* same as enc vectors with input and result reversed */ { -@@ -30629,7 +30679,7 @@ static struct cipher_testvec camellia_lr +@@ -30629,7 +30679,7 @@ static struct cipher_testvec camellia_lrw_dec_tv_template[] = { }, }; @@ -6098,7 +6122,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-XTS test vectors */ { .key = "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -30971,7 +31021,7 @@ static struct cipher_testvec camellia_xt +@@ -30971,7 +31021,7 @@ static struct cipher_testvec camellia_xts_enc_tv_template[] = { }, }; @@ -6107,7 +6131,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generated from AES-XTS test vectors */ /* same as enc vectors with input and result reversed */ { -@@ -31317,10 +31367,7 @@ static struct cipher_testvec camellia_xt +@@ -31317,10 +31367,7 @@ static struct cipher_testvec camellia_xts_dec_tv_template[] = { /* * SEED test vectors */ @@ -6119,7 +6143,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -31362,7 +31409,7 @@ static struct cipher_testvec seed_enc_tv +@@ -31362,7 +31409,7 @@ static struct cipher_testvec seed_enc_tv_template[] = { } }; @@ -6128,7 +6152,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = zeroed_string, .klen = 16, -@@ -31404,8 +31451,7 @@ static struct cipher_testvec seed_dec_tv +@@ -31404,8 +31451,7 @@ static struct cipher_testvec seed_dec_tv_template[] = { } }; @@ -6138,7 +6162,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * Testvectors from verified.test-vectors submitted to ECRYPT. * They are truncated to size 39, 64, 111, 129 to test a variety -@@ -32574,8 +32620,7 @@ static struct cipher_testvec salsa20_str +@@ -32574,8 +32620,7 @@ static struct cipher_testvec salsa20_stream_enc_tv_template[] = { }, }; @@ -6148,7 +6172,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* RFC7539 A.2. Test Vector #1 */ .key = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00" -@@ -33086,9 +33131,7 @@ static struct cipher_testvec chacha20_en +@@ -33086,9 +33131,7 @@ static struct cipher_testvec chacha20_enc_tv_template[] = { /* * CTS (Cipher Text Stealing) mode tests */ @@ -6159,7 +6183,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { /* from rfc3962 */ .klen = 16, .key = "\x63\x68\x69\x63\x6b\x65\x6e\x20" -@@ -33190,7 +33233,7 @@ static struct cipher_testvec cts_mode_en +@@ -33190,7 +33233,7 @@ static struct cipher_testvec cts_mode_enc_tv_template[] = { } }; @@ -6180,7 +6204,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .inlen = 70, .outlen = 38, -@@ -33347,7 +33387,7 @@ static struct comp_testvec deflate_comp_ +@@ -33347,7 +33387,7 @@ static struct comp_testvec deflate_comp_tv_template[] = { }, }; @@ -6189,7 +6213,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .inlen = 122, .outlen = 191, -@@ -33386,10 +33426,7 @@ static struct comp_testvec deflate_decom +@@ -33386,10 +33426,7 @@ static struct comp_testvec deflate_decomp_tv_template[] = { /* * LZO test vectors (null-terminated strings). */ @@ -6201,7 +6225,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .inlen = 70, .outlen = 57, -@@ -33429,7 +33466,7 @@ static struct comp_testvec lzo_comp_tv_t +@@ -33429,7 +33466,7 @@ static struct comp_testvec lzo_comp_tv_template[] = { }, }; @@ -6210,7 +6234,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .inlen = 133, .outlen = 159, -@@ -33472,7 +33509,7 @@ static struct comp_testvec lzo_decomp_tv +@@ -33472,7 +33509,7 @@ static struct comp_testvec lzo_decomp_tv_template[] = { */ #define MICHAEL_MIC_TEST_VECTORS 6 @@ -6219,7 +6243,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x00\x00\x00\x00\x00\x00\x00\x00", .ksize = 8, -@@ -33520,9 +33557,7 @@ static struct hash_testvec michael_mic_t +@@ -33520,9 +33557,7 @@ static struct hash_testvec michael_mic_tv_template[] = { /* * CRC32 test vectors */ @@ -6230,7 +6254,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .key = "\x87\xa9\xcb\xed", .ksize = 4, -@@ -33954,9 +33989,7 @@ static struct hash_testvec crc32_tv_temp +@@ -33954,9 +33989,7 @@ static struct hash_testvec crc32_tv_template[] = { /* * CRC32C test vectors */ @@ -6241,7 +6265,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .psize = 0, .digest = "\x00\x00\x00\x00", -@@ -34392,9 +34425,7 @@ static struct hash_testvec crc32c_tv_tem +@@ -34392,9 +34425,7 @@ static struct hash_testvec crc32c_tv_template[] = { /* * Blakcifn CRC test vectors */ @@ -6252,7 +6276,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .psize = 0, .digest = "\x00\x00\x00\x00", -@@ -34479,9 +34510,6 @@ static struct hash_testvec bfin_crc_tv_t +@@ -34479,9 +34510,6 @@ static struct hash_testvec bfin_crc_tv_template[] = { }; @@ -6262,7 +6286,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static struct comp_testvec lz4_comp_tv_template[] = { { .inlen = 70, -@@ -34512,9 +34540,6 @@ static struct comp_testvec lz4_decomp_tv +@@ -34512,9 +34540,6 @@ static struct comp_testvec lz4_decomp_tv_template[] = { }, }; @@ -6272,6 +6296,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static struct comp_testvec lz4hc_comp_tv_template[] = { { .inlen = 70, +diff --git a/crypto/tls.c b/crypto/tls.c +new file mode 100644 +index 00000000..377226f5 --- /dev/null +++ b/crypto/tls.c @@ -0,0 +1,607 @@ @@ -6882,6 +6909,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("TLS 1.0 record encryption"); +diff --git a/drivers/crypto/caam/Kconfig b/drivers/crypto/caam/Kconfig +index 64bf3024..3831a6f7 100644 --- a/drivers/crypto/caam/Kconfig +++ b/drivers/crypto/caam/Kconfig @@ -1,6 +1,11 @@ @@ -6935,7 +6964,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> help Enable the Job Ring's interrupt coalescing feature. -@@ -74,7 +86,6 @@ config CRYPTO_DEV_FSL_CAAM_INTC_TIME_THL +@@ -74,7 +86,6 @@ config CRYPTO_DEV_FSL_CAAM_INTC_TIME_THLD config CRYPTO_DEV_FSL_CAAM_CRYPTO_API tristate "Register algorithm implementations with the Crypto API" @@ -7022,9 +7051,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + def_tristate (CRYPTO_DEV_FSL_CAAM_CRYPTO_API || \ + CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI || \ + CRYPTO_DEV_FSL_DPAA2_CAAM) +diff --git a/drivers/crypto/caam/Makefile b/drivers/crypto/caam/Makefile +index 08bf5515..01f73a25 100644 --- a/drivers/crypto/caam/Makefile +++ b/drivers/crypto/caam/Makefile -@@ -5,13 +5,26 @@ ifeq ($(CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG +@@ -5,13 +5,26 @@ ifeq ($(CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG), y) ccflags-y := -DDEBUG endif @@ -7052,6 +7083,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +obj-$(CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM) += dpaa2_caam.o + +dpaa2_caam-y := caamalg_qi2.o dpseci.o +diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c +index 0d743c63..6480a01f 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -2,6 +2,7 @@ @@ -7495,7 +7528,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; } -@@ -470,11 +168,11 @@ static int aead_set_sh_desc(struct crypt +@@ -470,11 +168,11 @@ static int aead_set_sh_desc(struct crypto_aead *aead) unsigned int ivsize = crypto_aead_ivsize(aead); struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -7511,7 +7544,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> OP_ALG_AAI_CTR_MOD128); const bool is_rfc3686 = alg->caam.rfc3686; -@@ -482,7 +180,7 @@ static int aead_set_sh_desc(struct crypt +@@ -482,7 +180,7 @@ static int aead_set_sh_desc(struct crypto_aead *aead) return 0; /* NULL encryption / decryption */ @@ -7520,7 +7553,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return aead_null_set_sh_desc(aead); /* -@@ -497,8 +195,14 @@ static int aead_set_sh_desc(struct crypt +@@ -497,8 +195,14 @@ static int aead_set_sh_desc(struct crypto_aead *aead) * RFC3686 specific: * CONTEXT1[255:128] = {NONCE, IV, COUNTER} */ @@ -7536,7 +7569,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (alg->caam.geniv) goto skip_enc; -@@ -507,146 +211,64 @@ static int aead_set_sh_desc(struct crypt +@@ -507,146 +211,64 @@ static int aead_set_sh_desc(struct crypto_aead *aead) * Job Descriptor and Shared Descriptors * must all fit into the 64-word Descriptor h/w Buffer */ @@ -7661,7 +7694,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - - /* Skip assoc data */ - append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); -- ++ ctx->adata.key_dma = ctx->key_dma; + - /* read assoc before reading payload */ - append_seq_fifo_load(desc, 0, FIFOLD_CLASS_CLASS2 | FIFOLD_TYPE_MSG | - KEY_VLF); @@ -7680,8 +7714,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - LDST_SRCDST_BYTE_CONTEXT | - ((ctx1_iv_off + CTR_RFC3686_IV_SIZE) << - LDST_OFFSET_SHIFT)); -+ ctx->adata.key_dma = ctx->key_dma; - +- - /* Choose operation */ - if (ctr_mode) - append_operation(desc, ctx->class1_alg_type | @@ -7696,13 +7729,13 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - append_math_add(desc, VARSEQINLEN, SEQOUTLEN, REG0, CAAM_CMD_SZ); - append_math_add(desc, VARSEQOUTLEN, SEQOUTLEN, REG0, CAAM_CMD_SZ); - aead_append_src_dst(desc, FIFOLD_TYPE_MSG); -- -- /* Load ICV */ -- append_seq_fifo_load(desc, ctx->authsize, FIFOLD_CLASS_CLASS2 | -- FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV); + ctx->adata.key_inline = !!(inl_mask & 1); + ctx->cdata.key_inline = !!(inl_mask & 2); +- /* Load ICV */ +- append_seq_fifo_load(desc, ctx->authsize, FIFOLD_CLASS_CLASS2 | +- FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV); +- - ctx->sh_desc_dec_dma = dma_map_single(jrdev, desc, - desc_bytes(desc), - DMA_TO_DEVICE); @@ -7725,7 +7758,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (!alg->caam.geniv) goto skip_givenc; -@@ -655,107 +277,32 @@ skip_enc: +@@ -655,107 +277,32 @@ static int aead_set_sh_desc(struct crypto_aead *aead) * Job Descriptor and Shared Descriptors * must all fit into the 64-word Descriptor h/w Buffer */ @@ -7735,25 +7768,29 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - (is_rfc3686 ? DESC_AEAD_CTR_RFC3686_LEN : 0) <= - CAAM_DESC_BYTES_MAX) - keys_fit_inline = true; -- -- /* aead_givencrypt shared descriptor */ -- desc = ctx->sh_desc_enc; -- -- /* Note: Context registers are saved. */ -- init_sh_desc_key_aead(desc, ctx, keys_fit_inline, is_rfc3686); + if (desc_inline_query(DESC_AEAD_GIVENC_LEN + + (is_rfc3686 ? DESC_AEAD_CTR_RFC3686_LEN : 0), + AUTHENC_DESC_JOB_IO_LEN, data_len, &inl_mask, + ARRAY_SIZE(data_len)) < 0) + return -EINVAL; -- if (is_rfc3686) -- goto copy_iv; +- /* aead_givencrypt shared descriptor */ +- desc = ctx->sh_desc_enc; + if (inl_mask & 1) + ctx->adata.key_virt = ctx->key; + else + ctx->adata.key_dma = ctx->key_dma; +- /* Note: Context registers are saved. */ +- init_sh_desc_key_aead(desc, ctx, keys_fit_inline, is_rfc3686); ++ if (inl_mask & 2) ++ ctx->cdata.key_virt = ctx->key + ctx->adata.keylen_pad; ++ else ++ ctx->cdata.key_dma = ctx->key_dma + ctx->adata.keylen_pad; + +- if (is_rfc3686) +- goto copy_iv; +- - /* Generate IV */ - geniv = NFIFOENTRY_STYPE_PAD | NFIFOENTRY_DEST_DECO | - NFIFOENTRY_DTYPE_MSG | NFIFOENTRY_LC1 | @@ -7798,11 +7835,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - LDST_SRCDST_WORD_INFO_FIFO | LDST_IMM); - append_load_imm_u32(desc, ivsize, LDST_CLASS_2_CCB | - LDST_SRCDST_WORD_DATASZ_REG | LDST_IMM); -+ if (inl_mask & 2) -+ ctx->cdata.key_virt = ctx->key + ctx->adata.keylen_pad; -+ else -+ ctx->cdata.key_dma = ctx->key_dma + ctx->adata.keylen_pad; - +- - /* Load Counter into CONTEXT1 reg */ - if (is_rfc3686) - append_load_imm_be32(desc, 1, LDST_IMM | LDST_CLASS_1_CCB | @@ -7830,9 +7863,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - /* Write ICV */ - append_seq_store(desc, ctx->authsize, LDST_CLASS_2_CCB | - LDST_SRCDST_BYTE_CONTEXT); -+ ctx->adata.key_inline = !!(inl_mask & 1); -+ ctx->cdata.key_inline = !!(inl_mask & 2); - +- - ctx->sh_desc_enc_dma = dma_map_single(jrdev, desc, - desc_bytes(desc), - DMA_TO_DEVICE); @@ -7845,6 +7876,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - DUMP_PREFIX_ADDRESS, 16, 4, desc, - desc_bytes(desc), 1); -#endif ++ ctx->adata.key_inline = !!(inl_mask & 1); ++ ctx->cdata.key_inline = !!(inl_mask & 2); ++ + /* aead_givencrypt shared descriptor */ + desc = ctx->sh_desc_enc; + cnstr_shdsc_aead_givencap(desc, &ctx->cdata, &ctx->adata, ivsize, @@ -7855,7 +7889,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> skip_givenc: return 0; -@@ -776,12 +323,12 @@ static int gcm_set_sh_desc(struct crypto +@@ -776,12 +323,12 @@ static int gcm_set_sh_desc(struct crypto_aead *aead) { struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -7872,7 +7906,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; /* -@@ -789,175 +336,35 @@ static int gcm_set_sh_desc(struct crypto +@@ -789,175 +336,35 @@ static int gcm_set_sh_desc(struct crypto_aead *aead) * Job Descriptor and Shared Descriptor * must fit into the 64-word Descriptor h/w Buffer */ @@ -8068,7 +8102,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; } -@@ -976,11 +383,12 @@ static int rfc4106_set_sh_desc(struct cr +@@ -976,11 +383,12 @@ static int rfc4106_set_sh_desc(struct crypto_aead *aead) { struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -8084,7 +8118,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; /* -@@ -988,148 +396,37 @@ static int rfc4106_set_sh_desc(struct cr +@@ -988,148 +396,37 @@ static int rfc4106_set_sh_desc(struct crypto_aead *aead) * Job Descriptor and Shared Descriptor * must fit into the 64-word Descriptor h/w Buffer */ @@ -8255,7 +8289,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; } -@@ -1149,12 +446,12 @@ static int rfc4543_set_sh_desc(struct cr +@@ -1149,12 +446,12 @@ static int rfc4543_set_sh_desc(struct crypto_aead *aead) { struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -8272,22 +8306,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; /* -@@ -1162,151 +459,37 @@ static int rfc4543_set_sh_desc(struct cr +@@ -1162,151 +459,37 @@ static int rfc4543_set_sh_desc(struct crypto_aead *aead) * Job Descriptor and Shared Descriptor * must fit into the 64-word Descriptor h/w Buffer */ - if (DESC_RFC4543_ENC_LEN + GCM_DESC_JOB_IO_LEN + - ctx->enckeylen <= CAAM_DESC_BYTES_MAX) - keys_fit_inline = true; -+ if (rem_bytes >= DESC_RFC4543_ENC_LEN) { -+ ctx->cdata.key_inline = true; -+ ctx->cdata.key_virt = ctx->key; -+ } else { -+ ctx->cdata.key_inline = false; -+ ctx->cdata.key_dma = ctx->key_dma; -+ } - - desc = ctx->sh_desc_enc; +- +- desc = ctx->sh_desc_enc; - - init_sh_desc(desc, HDR_SHARE_SERIAL); - @@ -8344,12 +8371,20 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - if (dma_mapping_error(jrdev, ctx->sh_desc_enc_dma)) { - dev_err(jrdev, "unable to map shared descriptor\n"); - return -ENOMEM; -- } ++ if (rem_bytes >= DESC_RFC4543_ENC_LEN) { ++ ctx->cdata.key_inline = true; ++ ctx->cdata.key_virt = ctx->key; ++ } else { ++ ctx->cdata.key_inline = false; ++ ctx->cdata.key_dma = ctx->key_dma; + } -#ifdef DEBUG - print_hex_dump(KERN_ERR, "rfc4543 enc shdesc@"__stringify(__LINE__)": ", - DUMP_PREFIX_ADDRESS, 16, 4, desc, - desc_bytes(desc), 1); -#endif ++ ++ desc = ctx->sh_desc_enc; + cnstr_shdsc_rfc4543_encap(desc, &ctx->cdata, ivsize, ctx->authsize, + false); + dma_sync_single_for_device(jrdev, ctx->sh_desc_enc_dma, @@ -8446,7 +8481,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; } -@@ -1322,19 +505,9 @@ static int rfc4543_setauthsize(struct cr +@@ -1322,19 +505,9 @@ static int rfc4543_setauthsize(struct crypto_aead *authenc, return 0; } @@ -8466,7 +8501,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; struct crypto_authenc_keys keys; -@@ -1343,53 +516,32 @@ static int aead_setkey(struct crypto_aea +@@ -1343,53 +516,32 @@ static int aead_setkey(struct crypto_aead *aead, if (crypto_authenc_extractkeys(&keys, key, keylen) != 0) goto badkey; @@ -8529,7 +8564,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> badkey: crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN); return -EINVAL; -@@ -1400,7 +552,6 @@ static int gcm_setkey(struct crypto_aead +@@ -1400,7 +552,6 @@ static int gcm_setkey(struct crypto_aead *aead, { struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -8537,7 +8572,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #ifdef DEBUG print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ", -@@ -1408,21 +559,10 @@ static int gcm_setkey(struct crypto_aead +@@ -1408,21 +559,10 @@ static int gcm_setkey(struct crypto_aead *aead, #endif memcpy(ctx->key, key, keylen); @@ -8562,7 +8597,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } static int rfc4106_setkey(struct crypto_aead *aead, -@@ -1430,7 +570,6 @@ static int rfc4106_setkey(struct crypto_ +@@ -1430,7 +570,6 @@ static int rfc4106_setkey(struct crypto_aead *aead, { struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -8570,7 +8605,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (keylen < 4) return -EINVAL; -@@ -1446,22 +585,10 @@ static int rfc4106_setkey(struct crypto_ +@@ -1446,22 +585,10 @@ static int rfc4106_setkey(struct crypto_aead *aead, * The last four bytes of the key material are used as the salt value * in the nonce. Update the AES key length. */ @@ -8597,7 +8632,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } static int rfc4543_setkey(struct crypto_aead *aead, -@@ -1469,7 +596,6 @@ static int rfc4543_setkey(struct crypto_ +@@ -1469,7 +596,6 @@ static int rfc4543_setkey(struct crypto_aead *aead, { struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -8605,7 +8640,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (keylen < 4) return -EINVAL; -@@ -1485,43 +611,28 @@ static int rfc4543_setkey(struct crypto_ +@@ -1485,43 +611,28 @@ static int rfc4543_setkey(struct crypto_aead *aead, * The last four bytes of the key material are used as the salt value * in the nonce. Update the AES key length. */ @@ -8656,7 +8691,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #ifdef DEBUG print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1); -@@ -1544,215 +655,33 @@ static int ablkcipher_setkey(struct cryp +@@ -1544,215 +655,33 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, keylen -= CTR_RFC3686_NONCE_SIZE; } @@ -8699,15 +8734,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - } - - set_jump_tgt_here(desc, key_jump_cmd); -- -- /* Load iv */ -- append_seq_load(desc, crt->ivsize, LDST_SRCDST_BYTE_CONTEXT | -- LDST_CLASS_1_CCB | (ctx1_iv_off << LDST_OFFSET_SHIFT)); + cnstr_shdsc_ablkcipher_encap(desc, &ctx->cdata, ivsize, is_rfc3686, + ctx1_iv_off); + dma_sync_single_for_device(jrdev, ctx->sh_desc_enc_dma, + desc_bytes(desc), DMA_TO_DEVICE); +- /* Load iv */ +- append_seq_load(desc, crt->ivsize, LDST_SRCDST_BYTE_CONTEXT | +- LDST_CLASS_1_CCB | (ctx1_iv_off << LDST_OFFSET_SHIFT)); +- - /* Load counter into CONTEXT1 reg */ - if (is_rfc3686) - append_load_imm_be32(desc, 1, LDST_IMM | LDST_CLASS_1_CCB | @@ -8889,7 +8924,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } static int xts_ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, -@@ -1760,8 +689,7 @@ static int xts_ablkcipher_setkey(struct +@@ -1760,8 +689,7 @@ static int xts_ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, { struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher); struct device *jrdev = ctx->jrdev; @@ -8899,7 +8934,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (keylen != 2 * AES_MIN_KEY_SIZE && keylen != 2 * AES_MAX_KEY_SIZE) { crypto_ablkcipher_set_flags(ablkcipher, -@@ -1771,126 +699,38 @@ static int xts_ablkcipher_setkey(struct +@@ -1771,126 +699,38 @@ static int xts_ablkcipher_setkey(struct crypto_ablkcipher *ablkcipher, } memcpy(ctx->key, key, keylen); @@ -9055,7 +9090,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> * @hw_desc: the h/w job descriptor followed by any referenced link tables */ struct ablkcipher_edesc { -@@ -1924,10 +764,11 @@ static void caam_unmap(struct device *de +@@ -1924,10 +764,11 @@ static void caam_unmap(struct device *dev, struct scatterlist *src, int sec4_sg_bytes) { if (dst != src) { @@ -9070,7 +9105,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } if (iv_dma) -@@ -2021,8 +862,7 @@ static void ablkcipher_encrypt_done(stru +@@ -2021,8 +862,7 @@ static void ablkcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err, dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err); #endif @@ -9080,7 +9115,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (err) caam_jr_strstatus(jrdev, err); -@@ -2031,10 +871,10 @@ static void ablkcipher_encrypt_done(stru +@@ -2031,10 +871,10 @@ static void ablkcipher_encrypt_done(struct device *jrdev, u32 *desc, u32 err, print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, req->info, edesc->src_nents > 1 ? 100 : ivsize, 1); @@ -9094,7 +9129,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ablkcipher_unmap(jrdev, edesc, req); -@@ -2062,8 +902,7 @@ static void ablkcipher_decrypt_done(stru +@@ -2062,8 +902,7 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err, dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err); #endif @@ -9104,7 +9139,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (err) caam_jr_strstatus(jrdev, err); -@@ -2071,10 +910,10 @@ static void ablkcipher_decrypt_done(stru +@@ -2071,10 +910,10 @@ static void ablkcipher_decrypt_done(struct device *jrdev, u32 *desc, u32 err, print_hex_dump(KERN_ERR, "dstiv @"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, req->info, ivsize, 1); @@ -9118,7 +9153,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ablkcipher_unmap(jrdev, edesc, req); -@@ -2114,7 +953,7 @@ static void init_aead_job(struct aead_re +@@ -2114,7 +953,7 @@ static void init_aead_job(struct aead_request *req, init_job_desc_shared(desc, ptr, len, HDR_SHARE_DEFER | HDR_REVERSE); if (all_contig) { @@ -9127,7 +9162,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> in_options = 0; } else { src_dma = edesc->sec4_sg_dma; -@@ -2129,7 +968,7 @@ static void init_aead_job(struct aead_re +@@ -2129,7 +968,7 @@ static void init_aead_job(struct aead_request *req, out_options = in_options; if (unlikely(req->src != req->dst)) { @@ -9136,7 +9171,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> dst_dma = sg_dma_address(req->dst); } else { dst_dma = edesc->sec4_sg_dma + -@@ -2175,7 +1014,7 @@ static void init_gcm_job(struct aead_req +@@ -2175,7 +1014,7 @@ static void init_gcm_job(struct aead_request *req, FIFOLD_TYPE_IV | FIFOLD_TYPE_FLUSH1 | 12 | last); /* Append Salt */ if (!generic_gcm) @@ -9145,7 +9180,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Append IV */ append_data(desc, req->iv, ivsize); /* End of blank commands */ -@@ -2190,7 +1029,7 @@ static void init_authenc_job(struct aead +@@ -2190,7 +1029,7 @@ static void init_authenc_job(struct aead_request *req, struct caam_aead_alg, aead); unsigned int ivsize = crypto_aead_ivsize(aead); struct caam_ctx *ctx = crypto_aead_ctx(aead); @@ -9154,7 +9189,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> OP_ALG_AAI_CTR_MOD128); const bool is_rfc3686 = alg->caam.rfc3686; u32 *desc = edesc->hw_desc; -@@ -2236,16 +1075,15 @@ static void init_ablkcipher_job(u32 *sh_ +@@ -2236,16 +1075,15 @@ static void init_ablkcipher_job(u32 *sh_desc, dma_addr_t ptr, int len, sec4_sg_index = 0; #ifdef DEBUG @@ -9176,7 +9211,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> len = desc_len(sh_desc); init_job_desc_shared(desc, ptr, len, HDR_SHARE_DEFER | HDR_REVERSE); -@@ -2261,7 +1099,7 @@ static void init_ablkcipher_job(u32 *sh_ +@@ -2261,7 +1099,7 @@ static void init_ablkcipher_job(u32 *sh_desc, dma_addr_t ptr, append_seq_in_ptr(desc, src_dma, req->nbytes + ivsize, in_options); if (likely(req->src == req->dst)) { @@ -9185,7 +9220,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> dst_dma = sg_dma_address(req->src); } else { dst_dma = edesc->sec4_sg_dma + -@@ -2269,7 +1107,7 @@ static void init_ablkcipher_job(u32 *sh_ +@@ -2269,7 +1107,7 @@ static void init_ablkcipher_job(u32 *sh_desc, dma_addr_t ptr, out_options = LDST_SGF; } } else { @@ -9194,7 +9229,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> dst_dma = sg_dma_address(req->dst); } else { dst_dma = edesc->sec4_sg_dma + -@@ -2296,20 +1134,18 @@ static void init_ablkcipher_giv_job(u32 +@@ -2296,20 +1134,18 @@ static void init_ablkcipher_giv_job(u32 *sh_desc, dma_addr_t ptr, int len, sec4_sg_index = 0; #ifdef DEBUG @@ -9219,7 +9254,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> src_dma = sg_dma_address(req->src); in_options = 0; } else { -@@ -2340,87 +1176,100 @@ static struct aead_edesc *aead_edesc_all +@@ -2340,87 +1176,100 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req, struct crypto_aead *aead = crypto_aead_reqtfm(req); struct caam_ctx *ctx = crypto_aead_ctx(aead); struct device *jrdev = ctx->jrdev; @@ -9375,7 +9410,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> edesc->sec4_sg + sec4_sg_index, 0); } -@@ -2573,13 +1422,9 @@ static int aead_decrypt(struct aead_requ +@@ -2573,13 +1422,9 @@ static int aead_decrypt(struct aead_request *req) u32 *desc; int ret = 0; @@ -9392,7 +9427,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* allocate extended descriptor */ edesc = aead_edesc_alloc(req, AUTHENC_DESC_JOB_IO_LEN, -@@ -2619,51 +1464,80 @@ static struct ablkcipher_edesc *ablkciph +@@ -2619,51 +1464,80 @@ static struct ablkcipher_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request struct device *jrdev = ctx->jrdev; gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ? GFP_KERNEL : GFP_ATOMIC; @@ -9496,7 +9531,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return ERR_PTR(-ENOMEM); } -@@ -2673,23 +1547,24 @@ static struct ablkcipher_edesc *ablkciph +@@ -2673,23 +1547,24 @@ static struct ablkcipher_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) + desc_bytes; @@ -9528,7 +9563,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return ERR_PTR(-ENOMEM); } -@@ -2701,7 +1576,7 @@ static struct ablkcipher_edesc *ablkciph +@@ -2701,7 +1576,7 @@ static struct ablkcipher_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request sec4_sg_bytes, 1); #endif @@ -9537,7 +9572,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return edesc; } -@@ -2792,30 +1667,54 @@ static struct ablkcipher_edesc *ablkciph +@@ -2792,30 +1667,54 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc( struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req); struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher); struct device *jrdev = ctx->jrdev; @@ -9554,10 +9589,10 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + bool out_contig; int ivsize = crypto_ablkcipher_ivsize(ablkcipher); - int sec4_sg_index; -- -- src_nents = sg_count(req->src, req->nbytes); + int dst_sg_idx, sec4_sg_ents, sec4_sg_bytes; +- src_nents = sg_count(req->src, req->nbytes); +- - if (unlikely(req->dst != req->src)) - dst_nents = sg_count(req->dst, req->nbytes); + src_nents = sg_nents_for_len(req->src, req->nbytes); @@ -9608,7 +9643,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } /* -@@ -2825,21 +1724,29 @@ static struct ablkcipher_edesc *ablkciph +@@ -2825,21 +1724,29 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc( iv_dma = dma_map_single(jrdev, greq->giv, ivsize, DMA_TO_DEVICE); if (dma_mapping_error(jrdev, iv_dma)) { dev_err(jrdev, "unable to map IV\n"); @@ -9644,7 +9679,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return ERR_PTR(-ENOMEM); } -@@ -2849,24 +1756,24 @@ static struct ablkcipher_edesc *ablkciph +@@ -2849,24 +1756,24 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc( edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) + desc_bytes; @@ -9679,7 +9714,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return ERR_PTR(-ENOMEM); } edesc->iv_dma = iv_dma; -@@ -2878,7 +1785,7 @@ static struct ablkcipher_edesc *ablkciph +@@ -2878,7 +1785,7 @@ static struct ablkcipher_edesc *ablkcipher_giv_edesc_alloc( sec4_sg_bytes, 1); #endif @@ -9688,7 +9723,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return edesc; } -@@ -2889,7 +1796,7 @@ static int ablkcipher_givencrypt(struct +@@ -2889,7 +1796,7 @@ static int ablkcipher_givencrypt(struct skcipher_givcrypt_request *creq) struct crypto_ablkcipher *ablkcipher = crypto_ablkcipher_reqtfm(req); struct caam_ctx *ctx = crypto_ablkcipher_ctx(ablkcipher); struct device *jrdev = ctx->jrdev; @@ -9705,7 +9740,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }; static struct caam_alg_template driver_algs[] = { -@@ -3118,7 +2024,6 @@ static struct caam_aead_alg driver_aeads +@@ -3118,7 +2024,6 @@ static struct caam_aead_alg driver_aeads[] = { .caam = { .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9713,7 +9748,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3140,7 +2045,6 @@ static struct caam_aead_alg driver_aeads +@@ -3140,7 +2045,6 @@ static struct caam_aead_alg driver_aeads[] = { .caam = { .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9721,7 +9756,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3162,7 +2066,6 @@ static struct caam_aead_alg driver_aeads +@@ -3162,7 +2066,6 @@ static struct caam_aead_alg driver_aeads[] = { .caam = { .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9729,7 +9764,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3184,7 +2087,6 @@ static struct caam_aead_alg driver_aeads +@@ -3184,7 +2087,6 @@ static struct caam_aead_alg driver_aeads[] = { .caam = { .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9737,7 +9772,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3206,7 +2108,6 @@ static struct caam_aead_alg driver_aeads +@@ -3206,7 +2108,6 @@ static struct caam_aead_alg driver_aeads[] = { .caam = { .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9745,7 +9780,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3228,7 +2129,6 @@ static struct caam_aead_alg driver_aeads +@@ -3228,7 +2129,6 @@ static struct caam_aead_alg driver_aeads[] = { .caam = { .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9753,7 +9788,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3250,7 +2150,6 @@ static struct caam_aead_alg driver_aeads +@@ -3250,7 +2150,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9761,7 +9796,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3273,7 +2172,6 @@ static struct caam_aead_alg driver_aeads +@@ -3273,7 +2172,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9769,7 +9804,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3296,7 +2194,6 @@ static struct caam_aead_alg driver_aeads +@@ -3296,7 +2194,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9777,7 +9812,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3319,7 +2216,6 @@ static struct caam_aead_alg driver_aeads +@@ -3319,7 +2216,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9785,7 +9820,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3342,7 +2238,6 @@ static struct caam_aead_alg driver_aeads +@@ -3342,7 +2238,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9793,7 +9828,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3365,7 +2260,6 @@ static struct caam_aead_alg driver_aeads +@@ -3365,7 +2260,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9801,7 +9836,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3388,7 +2282,6 @@ static struct caam_aead_alg driver_aeads +@@ -3388,7 +2282,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9809,7 +9844,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3411,7 +2304,6 @@ static struct caam_aead_alg driver_aeads +@@ -3411,7 +2304,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9817,7 +9852,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3434,7 +2326,6 @@ static struct caam_aead_alg driver_aeads +@@ -3434,7 +2326,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9825,7 +9860,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3457,7 +2348,6 @@ static struct caam_aead_alg driver_aeads +@@ -3457,7 +2348,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9833,7 +9868,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3480,7 +2370,6 @@ static struct caam_aead_alg driver_aeads +@@ -3480,7 +2370,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9841,7 +9876,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3503,7 +2392,6 @@ static struct caam_aead_alg driver_aeads +@@ -3503,7 +2392,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_AES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9849,7 +9884,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3526,7 +2414,6 @@ static struct caam_aead_alg driver_aeads +@@ -3526,7 +2414,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9857,7 +9892,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } }, { -@@ -3549,7 +2436,6 @@ static struct caam_aead_alg driver_aeads +@@ -3549,7 +2436,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9865,7 +9900,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, } }, -@@ -3573,7 +2459,6 @@ static struct caam_aead_alg driver_aeads +@@ -3573,7 +2459,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9873,7 +9908,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3597,7 +2482,6 @@ static struct caam_aead_alg driver_aeads +@@ -3597,7 +2482,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9881,7 +9916,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3621,7 +2505,6 @@ static struct caam_aead_alg driver_aeads +@@ -3621,7 +2505,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9889,7 +9924,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3645,7 +2528,6 @@ static struct caam_aead_alg driver_aeads +@@ -3645,7 +2528,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9897,7 +9932,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3669,7 +2551,6 @@ static struct caam_aead_alg driver_aeads +@@ -3669,7 +2551,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9905,7 +9940,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3693,7 +2574,6 @@ static struct caam_aead_alg driver_aeads +@@ -3693,7 +2574,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9913,7 +9948,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3717,7 +2597,6 @@ static struct caam_aead_alg driver_aeads +@@ -3717,7 +2597,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9921,7 +9956,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3741,7 +2620,6 @@ static struct caam_aead_alg driver_aeads +@@ -3741,7 +2620,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9929,7 +9964,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3765,7 +2643,6 @@ static struct caam_aead_alg driver_aeads +@@ -3765,7 +2643,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9937,7 +9972,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3789,7 +2666,6 @@ static struct caam_aead_alg driver_aeads +@@ -3789,7 +2666,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_3DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9945,7 +9980,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3812,7 +2688,6 @@ static struct caam_aead_alg driver_aeads +@@ -3812,7 +2688,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9953,7 +9988,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3835,7 +2710,6 @@ static struct caam_aead_alg driver_aeads +@@ -3835,7 +2710,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9961,7 +9996,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3858,7 +2732,6 @@ static struct caam_aead_alg driver_aeads +@@ -3858,7 +2732,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9969,7 +10004,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3881,7 +2754,6 @@ static struct caam_aead_alg driver_aeads +@@ -3881,7 +2754,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9977,7 +10012,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3904,7 +2776,6 @@ static struct caam_aead_alg driver_aeads +@@ -3904,7 +2776,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9985,7 +10020,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3927,7 +2798,6 @@ static struct caam_aead_alg driver_aeads +@@ -3927,7 +2798,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -9993,7 +10028,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3950,7 +2820,6 @@ static struct caam_aead_alg driver_aeads +@@ -3950,7 +2820,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10001,7 +10036,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -3973,7 +2842,6 @@ static struct caam_aead_alg driver_aeads +@@ -3973,7 +2842,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10009,7 +10044,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -3996,7 +2864,6 @@ static struct caam_aead_alg driver_aeads +@@ -3996,7 +2864,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10017,7 +10052,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -4019,7 +2886,6 @@ static struct caam_aead_alg driver_aeads +@@ -4019,7 +2886,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10025,7 +10060,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -4042,7 +2908,6 @@ static struct caam_aead_alg driver_aeads +@@ -4042,7 +2908,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10033,7 +10068,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, }, { -@@ -4065,7 +2930,6 @@ static struct caam_aead_alg driver_aeads +@@ -4065,7 +2930,6 @@ static struct caam_aead_alg driver_aeads[] = { .class1_alg_type = OP_ALG_ALGSEL_DES | OP_ALG_AAI_CBC, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10041,7 +10076,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .geniv = true, }, }, -@@ -4090,7 +2954,6 @@ static struct caam_aead_alg driver_aeads +@@ -4090,7 +2954,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10049,7 +10084,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, }, }, -@@ -4115,7 +2978,6 @@ static struct caam_aead_alg driver_aeads +@@ -4115,7 +2978,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_MD5 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10057,7 +10092,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, .geniv = true, }, -@@ -4141,7 +3003,6 @@ static struct caam_aead_alg driver_aeads +@@ -4141,7 +3003,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10065,7 +10100,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, }, }, -@@ -4166,7 +3027,6 @@ static struct caam_aead_alg driver_aeads +@@ -4166,7 +3027,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA1 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10073,7 +10108,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, .geniv = true, }, -@@ -4192,7 +3052,6 @@ static struct caam_aead_alg driver_aeads +@@ -4192,7 +3052,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10081,7 +10116,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, }, }, -@@ -4217,7 +3076,6 @@ static struct caam_aead_alg driver_aeads +@@ -4217,7 +3076,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA224 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10089,7 +10124,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, .geniv = true, }, -@@ -4243,7 +3101,6 @@ static struct caam_aead_alg driver_aeads +@@ -4243,7 +3101,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10097,7 +10132,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, }, }, -@@ -4268,7 +3125,6 @@ static struct caam_aead_alg driver_aeads +@@ -4268,7 +3125,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA256 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10105,7 +10140,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, .geniv = true, }, -@@ -4294,7 +3150,6 @@ static struct caam_aead_alg driver_aeads +@@ -4294,7 +3150,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10113,7 +10148,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, }, }, -@@ -4319,7 +3174,6 @@ static struct caam_aead_alg driver_aeads +@@ -4319,7 +3174,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA384 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10121,7 +10156,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, .geniv = true, }, -@@ -4345,7 +3199,6 @@ static struct caam_aead_alg driver_aeads +@@ -4345,7 +3199,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10129,7 +10164,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> .rfc3686 = true, }, }, -@@ -4370,7 +3223,6 @@ static struct caam_aead_alg driver_aeads +@@ -4370,7 +3223,6 @@ static struct caam_aead_alg driver_aeads[] = { OP_ALG_AAI_CTR_MOD128, .class2_alg_type = OP_ALG_ALGSEL_SHA512 | OP_ALG_AAI_HMAC_PRECOMP, @@ -10175,7 +10210,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; } -@@ -4421,25 +3291,9 @@ static int caam_aead_init(struct crypto_ +@@ -4421,25 +3291,9 @@ static int caam_aead_init(struct crypto_aead *tfm) static void caam_exit_common(struct caam_ctx *ctx) { @@ -10204,7 +10239,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> caam_jr_free(ctx->jrdev); } -@@ -4515,7 +3369,6 @@ static struct caam_crypto_alg *caam_alg_ +@@ -4515,7 +3369,6 @@ static struct caam_crypto_alg *caam_alg_alloc(struct caam_alg_template t_alg->caam.class1_alg_type = template->class1_alg_type; t_alg->caam.class2_alg_type = template->class2_alg_type; @@ -10212,6 +10247,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return t_alg; } +diff --git a/drivers/crypto/caam/caamalg_desc.c b/drivers/crypto/caam/caamalg_desc.c +new file mode 100644 +index 00000000..d162120a --- /dev/null +++ b/drivers/crypto/caam/caamalg_desc.c @@ -0,0 +1,1913 @@ @@ -12128,6 +12166,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("FSL CAAM descriptor support"); +MODULE_AUTHOR("Freescale Semiconductor - NMG/STC"); +diff --git a/drivers/crypto/caam/caamalg_desc.h b/drivers/crypto/caam/caamalg_desc.h +new file mode 100644 +index 00000000..6b436f65 --- /dev/null +++ b/drivers/crypto/caam/caamalg_desc.h @@ -0,0 +1,127 @@ @@ -12258,6 +12299,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +void cnstr_shdsc_xts_ablkcipher_decap(u32 * const desc, struct alginfo *cdata); + +#endif /* _CAAMALG_DESC_H_ */ +diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c +new file mode 100644 +index 00000000..d6a9b0c5 --- /dev/null +++ b/drivers/crypto/caam/caamalg_qi.c @@ -0,0 +1,2877 @@ @@ -15138,6 +15182,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Support for crypto API using CAAM-QI backend"); +MODULE_AUTHOR("Freescale Semiconductor"); +diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c +new file mode 100644 +index 00000000..102b0841 --- /dev/null +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -0,0 +1,4428 @@ @@ -15259,9 +15306,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +} + +/* -+ * qi_cache_alloc - Allocate buffers from CAAM-QI cache ++ * qi_cache_zalloc - Allocate buffers from CAAM-QI cache + * -+ * Allocate data on the hotpath. Instead of using kmalloc, one can use the ++ * Allocate data on the hotpath. Instead of using kzalloc, one can use the + * services of the CAAM QI memory cache (backed by kmem_cache). The buffers + * will have a size of CAAM_QI_MEMCACHE_SIZE, which should be sufficient for + * hosting 16 SG entries. @@ -15270,15 +15317,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + * + * Returns a pointer to a retrieved buffer on success or NULL on failure. + */ -+static inline void *qi_cache_alloc(gfp_t flags) ++static inline void *qi_cache_zalloc(gfp_t flags) +{ -+ return kmem_cache_alloc(qi_cache, flags); ++ return kmem_cache_zalloc(qi_cache, flags); +} + +/* + * qi_cache_free - Frees buffers allocated from CAAM-QI cache + * -+ * @obj - buffer previously allocated by qi_cache_alloc ++ * @obj - buffer previously allocated by qi_cache_zalloc + * + * No checking is being done, the call is a passthrough call to + * kmem_cache_free(...) @@ -15690,7 +15737,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + enum optype op_type = encrypt ? ENCRYPT : DECRYPT; + + /* allocate space for base edesc and link tables */ -+ edesc = qi_cache_alloc(GFP_DMA | flags); ++ edesc = qi_cache_zalloc(GFP_DMA | flags); + if (unlikely(!edesc)) { + dev_err(dev, "could not allocate extended descriptor\n"); + return ERR_PTR(-ENOMEM); @@ -15895,7 +15942,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + } + + /* allocate space for base edesc and link tables */ -+ edesc = qi_cache_alloc(GFP_DMA | flags); ++ edesc = qi_cache_zalloc(GFP_DMA | flags); + if (unlikely(!edesc)) { + dev_err(dev, "could not allocate extended descriptor\n"); + return ERR_PTR(-ENOMEM); @@ -16761,7 +16808,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + } + + /* allocate space for base edesc and link tables */ -+ edesc = qi_cache_alloc(GFP_DMA | flags); ++ edesc = qi_cache_zalloc(GFP_DMA | flags); + if (unlikely(!edesc)) { + dev_err(dev, "could not allocate extended descriptor\n"); + caam_unmap(dev, req->src, req->dst, src_nents, dst_nents, @@ -16916,7 +16963,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + } + + /* allocate space for base edesc and link tables */ -+ edesc = qi_cache_alloc(GFP_DMA | flags); ++ edesc = qi_cache_zalloc(GFP_DMA | flags); + if (!edesc) { + dev_err(dev, "could not allocate extended descriptor\n"); + caam_unmap(dev, req->src, req->dst, src_nents, dst_nents, @@ -19569,6 +19616,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +MODULE_DESCRIPTION("Freescale DPAA2 CAAM Driver"); + +module_fsl_mc_driver(dpaa2_caam_driver); +diff --git a/drivers/crypto/caam/caamalg_qi2.h b/drivers/crypto/caam/caamalg_qi2.h +new file mode 100644 +index 00000000..2ba179db --- /dev/null +++ b/drivers/crypto/caam/caamalg_qi2.h @@ -0,0 +1,265 @@ @@ -19837,6 +19887,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +int dpaa2_caam_enqueue(struct device *dev, struct caam_request *req); + +#endif /* _CAAMALG_QI2_H_ */ +diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c +index 631337c2..698580b6 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c @@ -72,7 +72,7 @@ @@ -19902,7 +19954,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Common job descriptor seq in/out ptr routines */ /* Map state->caam_ctx, and append seq_out_ptr command that points to it */ -@@ -175,36 +194,27 @@ static inline dma_addr_t map_seq_out_ptr +@@ -175,36 +194,27 @@ static inline dma_addr_t map_seq_out_ptr_result(u32 *desc, struct device *jrdev, return dst_dma; } @@ -19948,14 +20000,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - buf_dma = buf_map_to_sec4_sg(jrdev, sec4_sg, buf, buflen); - else - buf_dma = 0; -+ dma_to_sec4_sg_one(sec4_sg, state->buf_dma, buflen, 0); - +- - return buf_dma; ++ dma_to_sec4_sg_one(sec4_sg, state->buf_dma, buflen, 0); ++ + return 0; } /* Map state->caam_ctx, and add it to link table */ -@@ -224,89 +234,54 @@ static inline int ctx_map_to_sec4_sg(u32 +@@ -224,89 +234,54 @@ static inline int ctx_map_to_sec4_sg(u32 *desc, struct device *jrdev, return 0; } @@ -20003,23 +20056,18 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { - /* Calculate remaining bytes to read */ - append_math_add(desc, VARSEQINLEN, SEQINLEN, REG0, CAAM_CMD_SZ); -+ u32 op = ctx->adata.algtype; -+ u32 *skip_key_load; - +- - /* Read remaining bytes */ - append_seq_fifo_load(desc, 0, FIFOLD_CLASS_CLASS2 | FIFOLD_TYPE_LAST2 | - FIFOLD_TYPE_MSG | KEY_VLF); -+ init_sh_desc(desc, HDR_SHARE_SERIAL); ++ u32 op = ctx->adata.algtype; ++ u32 *skip_key_load; - /* Store class2 context bytes */ - append_seq_store(desc, digestsize, LDST_CLASS_2_CCB | - LDST_SRCDST_BYTE_CONTEXT); -} -+ /* Append key if it has been set; ahash update excluded */ -+ if ((state != OP_ALG_AS_UPDATE) && (ctx->adata.keylen)) { -+ /* Skip key loading if already shared */ -+ skip_key_load = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | -+ JUMP_COND_SHRD); ++ init_sh_desc(desc, HDR_SHARE_SERIAL); -/* - * For ahash update, final and finup, import context, read and write to seqout @@ -20029,7 +20077,12 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - struct caam_hash_ctx *ctx) -{ - init_sh_desc_key_ahash(desc, ctx); -- ++ /* Append key if it has been set; ahash update excluded */ ++ if ((state != OP_ALG_AS_UPDATE) && (ctx->adata.keylen)) { ++ /* Skip key loading if already shared */ ++ skip_key_load = append_jump(desc, JUMP_JSL | JUMP_TEST_ALL | ++ JUMP_COND_SHRD); + - /* Import context from software */ - append_cmd(desc, CMD_SEQ_LOAD | LDST_SRCDST_BYTE_CONTEXT | - LDST_CLASS_2_CCB | ctx->ctx_len); @@ -20077,7 +20130,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } static int ahash_set_sh_desc(struct crypto_ahash *ahash) -@@ -314,34 +289,13 @@ static int ahash_set_sh_desc(struct cryp +@@ -314,34 +289,13 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); int digestsize = crypto_ahash_digestsize(ahash); struct device *jrdev = ctx->jrdev; @@ -20115,7 +20168,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #ifdef DEBUG print_hex_dump(KERN_ERR, "ahash update shdesc@"__stringify(__LINE__)": ", -@@ -350,17 +304,9 @@ static int ahash_set_sh_desc(struct cryp +@@ -350,17 +304,9 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash) /* ahash_update_first shared descriptor */ desc = ctx->sh_desc_update_first; @@ -20136,7 +20189,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #ifdef DEBUG print_hex_dump(KERN_ERR, "ahash update first shdesc@"__stringify(__LINE__)": ", -@@ -369,53 +315,20 @@ static int ahash_set_sh_desc(struct cryp +@@ -369,53 +315,20 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash) /* ahash_final shared descriptor */ desc = ctx->sh_desc_fin; @@ -20196,7 +20249,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #ifdef DEBUG print_hex_dump(KERN_ERR, "ahash digest shdesc@"__stringify(__LINE__)": ", -@@ -426,14 +339,6 @@ static int ahash_set_sh_desc(struct cryp +@@ -426,14 +339,6 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash) return 0; } @@ -20211,7 +20264,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Digest hash size if it is too large */ static int hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in, u32 *keylen, u8 *key_out, u32 digestsize) -@@ -469,7 +374,7 @@ static int hash_digest_key(struct caam_h +@@ -469,7 +374,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in, } /* Job descriptor to perform unkeyed hash on key_in */ @@ -20220,7 +20273,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> OP_ALG_AS_INITFINAL); append_seq_in_ptr(desc, src_dma, *keylen, 0); append_seq_fifo_load(desc, *keylen, FIFOLD_CLASS_CLASS2 | -@@ -513,10 +418,7 @@ static int hash_digest_key(struct caam_h +@@ -513,10 +418,7 @@ static int hash_digest_key(struct caam_hash_ctx *ctx, const u8 *key_in, static int ahash_setkey(struct crypto_ahash *ahash, const u8 *key, unsigned int keylen) { @@ -20231,7 +20284,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> int blocksize = crypto_tfm_alg_blocksize(&ahash->base); int digestsize = crypto_ahash_digestsize(ahash); int ret; -@@ -539,43 +441,19 @@ static int ahash_setkey(struct crypto_ah +@@ -539,43 +441,19 @@ static int ahash_setkey(struct crypto_ahash *ahash, key = hashed_key; } @@ -20279,7 +20332,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> bad_free_key: kfree(hashed_key); crypto_ahash_set_flags(ahash, CRYPTO_TFM_RES_BAD_KEY_LEN); -@@ -604,6 +482,8 @@ static inline void ahash_unmap(struct de +@@ -604,6 +482,8 @@ static inline void ahash_unmap(struct device *dev, struct ahash_edesc *edesc, struct ahash_request *req, int dst_len) { @@ -20288,7 +20341,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (edesc->src_nents) dma_unmap_sg(dev, req->src, edesc->src_nents, DMA_TO_DEVICE); if (edesc->dst_dma) -@@ -612,6 +492,12 @@ static inline void ahash_unmap(struct de +@@ -612,6 +492,12 @@ static inline void ahash_unmap(struct device *dev, if (edesc->sec4_sg_bytes) dma_unmap_single(dev, edesc->sec4_sg_dma, edesc->sec4_sg_bytes, DMA_TO_DEVICE); @@ -20301,7 +20354,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } static inline void ahash_unmap_ctx(struct device *dev, -@@ -643,8 +529,7 @@ static void ahash_done(struct device *jr +@@ -643,8 +529,7 @@ static void ahash_done(struct device *jrdev, u32 *desc, u32 err, dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err); #endif @@ -20311,7 +20364,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (err) caam_jr_strstatus(jrdev, err); -@@ -671,19 +556,19 @@ static void ahash_done_bi(struct device +@@ -671,19 +556,19 @@ static void ahash_done_bi(struct device *jrdev, u32 *desc, u32 err, struct ahash_edesc *edesc; struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); @@ -20334,7 +20387,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> kfree(edesc); #ifdef DEBUG -@@ -713,8 +598,7 @@ static void ahash_done_ctx_src(struct de +@@ -713,8 +598,7 @@ static void ahash_done_ctx_src(struct device *jrdev, u32 *desc, u32 err, dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err); #endif @@ -20344,7 +20397,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (err) caam_jr_strstatus(jrdev, err); -@@ -741,19 +625,19 @@ static void ahash_done_ctx_dst(struct de +@@ -741,19 +625,19 @@ static void ahash_done_ctx_dst(struct device *jrdev, u32 *desc, u32 err, struct ahash_edesc *edesc; struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); @@ -20367,7 +20420,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> kfree(edesc); #ifdef DEBUG -@@ -835,13 +719,12 @@ static int ahash_update_ctx(struct ahash +@@ -835,13 +719,12 @@ static int ahash_update_ctx(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20387,7 +20440,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> int in_len = *buflen + req->nbytes, to_hash; u32 *desc; int src_nents, mapped_nents, sec4_sg_bytes, sec4_sg_src_index; -@@ -895,10 +778,9 @@ static int ahash_update_ctx(struct ahash +@@ -895,10 +778,9 @@ static int ahash_update_ctx(struct ahash_request *req) if (ret) goto unmap_ctx; @@ -20401,7 +20454,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (mapped_nents) { sg_to_sec4_sg_last(req->src, mapped_nents, -@@ -909,12 +791,10 @@ static int ahash_update_ctx(struct ahash +@@ -909,12 +791,10 @@ static int ahash_update_ctx(struct ahash_request *req) to_hash - *buflen, *next_buflen, 0); } else { @@ -20416,7 +20469,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> desc = edesc->hw_desc; edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, -@@ -969,12 +849,9 @@ static int ahash_final_ctx(struct ahash_ +@@ -969,12 +849,9 @@ static int ahash_final_ctx(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20432,7 +20485,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> u32 *desc; int sec4_sg_bytes, sec4_sg_src_index; int digestsize = crypto_ahash_digestsize(ahash); -@@ -1001,11 +878,11 @@ static int ahash_final_ctx(struct ahash_ +@@ -1001,11 +878,11 @@ static int ahash_final_ctx(struct ahash_request *req) if (ret) goto unmap_ctx; @@ -20449,7 +20502,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, sec4_sg_bytes, DMA_TO_DEVICE); -@@ -1048,12 +925,9 @@ static int ahash_finup_ctx(struct ahash_ +@@ -1048,12 +925,9 @@ static int ahash_finup_ctx(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20465,7 +20518,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> u32 *desc; int sec4_sg_src_index; int src_nents, mapped_nents; -@@ -1082,7 +956,7 @@ static int ahash_finup_ctx(struct ahash_ +@@ -1082,7 +956,7 @@ static int ahash_finup_ctx(struct ahash_request *req) /* allocate space for base edesc and hw desc commands, link tables */ edesc = ahash_edesc_alloc(ctx, sec4_sg_src_index + mapped_nents, @@ -20474,7 +20527,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> flags); if (!edesc) { dma_unmap_sg(jrdev, req->src, src_nents, DMA_TO_DEVICE); -@@ -1098,9 +972,9 @@ static int ahash_finup_ctx(struct ahash_ +@@ -1098,9 +972,9 @@ static int ahash_finup_ctx(struct ahash_request *req) if (ret) goto unmap_ctx; @@ -20487,7 +20540,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ret = ahash_edesc_add_src(ctx, edesc, req, mapped_nents, sec4_sg_src_index, ctx->ctx_len + buflen, -@@ -1136,15 +1010,18 @@ static int ahash_digest(struct ahash_req +@@ -1136,15 +1010,18 @@ static int ahash_digest(struct ahash_request *req) { struct crypto_ahash *ahash = crypto_ahash_reqtfm(req); struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); @@ -20508,7 +20561,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> src_nents = sg_nents_for_len(req->src, req->nbytes); if (src_nents < 0) { dev_err(jrdev, "Invalid number of src SG.\n"); -@@ -1215,10 +1092,10 @@ static int ahash_final_no_ctx(struct aha +@@ -1215,10 +1092,10 @@ static int ahash_final_no_ctx(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20523,7 +20576,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> u32 *desc; int digestsize = crypto_ahash_digestsize(ahash); struct ahash_edesc *edesc; -@@ -1276,13 +1153,12 @@ static int ahash_update_no_ctx(struct ah +@@ -1276,13 +1153,12 @@ static int ahash_update_no_ctx(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20543,7 +20596,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> int in_len = *buflen + req->nbytes, to_hash; int sec4_sg_bytes, src_nents, mapped_nents; struct ahash_edesc *edesc; -@@ -1331,8 +1207,10 @@ static int ahash_update_no_ctx(struct ah +@@ -1331,8 +1207,10 @@ static int ahash_update_no_ctx(struct ahash_request *req) edesc->sec4_sg_bytes = sec4_sg_bytes; edesc->dst_dma = 0; @@ -20556,7 +20609,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> sg_to_sec4_sg_last(req->src, mapped_nents, edesc->sec4_sg + 1, 0); -@@ -1342,8 +1220,6 @@ static int ahash_update_no_ctx(struct ah +@@ -1342,8 +1220,6 @@ static int ahash_update_no_ctx(struct ahash_request *req) *next_buflen, 0); } @@ -20565,7 +20618,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> desc = edesc->hw_desc; edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, -@@ -1403,12 +1279,9 @@ static int ahash_finup_no_ctx(struct aha +@@ -1403,12 +1279,9 @@ static int ahash_finup_no_ctx(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20581,7 +20634,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> u32 *desc; int sec4_sg_bytes, sec4_sg_src_index, src_nents, mapped_nents; int digestsize = crypto_ahash_digestsize(ahash); -@@ -1450,9 +1323,9 @@ static int ahash_finup_no_ctx(struct aha +@@ -1450,9 +1323,9 @@ static int ahash_finup_no_ctx(struct ahash_request *req) edesc->src_nents = src_nents; edesc->sec4_sg_bytes = sec4_sg_bytes; @@ -20594,7 +20647,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ret = ahash_edesc_add_src(ctx, edesc, req, mapped_nents, 1, buflen, req->nbytes); -@@ -1496,11 +1369,10 @@ static int ahash_update_first(struct aha +@@ -1496,11 +1369,10 @@ static int ahash_update_first(struct ahash_request *req) struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash); struct caam_hash_state *state = ahash_request_ctx(req); struct device *jrdev = ctx->jrdev; @@ -20610,7 +20663,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> int to_hash; u32 *desc; int src_nents, mapped_nents; -@@ -1582,6 +1454,7 @@ static int ahash_update_first(struct aha +@@ -1582,6 +1454,7 @@ static int ahash_update_first(struct ahash_request *req) state->final = ahash_final_no_ctx; scatterwalk_map_and_copy(next_buf, req->src, 0, req->nbytes, 0); @@ -20626,7 +20679,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }; /* ahash descriptors */ -@@ -1714,7 +1586,6 @@ static struct caam_hash_template driver_ +@@ -1714,7 +1586,6 @@ static struct caam_hash_template driver_hash[] = { }, }, .alg_type = OP_ALG_ALGSEL_SHA1, @@ -20634,7 +20687,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, { .name = "sha224", .driver_name = "sha224-caam", -@@ -1736,7 +1607,6 @@ static struct caam_hash_template driver_ +@@ -1736,7 +1607,6 @@ static struct caam_hash_template driver_hash[] = { }, }, .alg_type = OP_ALG_ALGSEL_SHA224, @@ -20642,7 +20695,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, { .name = "sha256", .driver_name = "sha256-caam", -@@ -1758,7 +1628,6 @@ static struct caam_hash_template driver_ +@@ -1758,7 +1628,6 @@ static struct caam_hash_template driver_hash[] = { }, }, .alg_type = OP_ALG_ALGSEL_SHA256, @@ -20650,7 +20703,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, { .name = "sha384", .driver_name = "sha384-caam", -@@ -1780,7 +1649,6 @@ static struct caam_hash_template driver_ +@@ -1780,7 +1649,6 @@ static struct caam_hash_template driver_hash[] = { }, }, .alg_type = OP_ALG_ALGSEL_SHA384, @@ -20658,7 +20711,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, { .name = "sha512", .driver_name = "sha512-caam", -@@ -1802,7 +1670,6 @@ static struct caam_hash_template driver_ +@@ -1802,7 +1670,6 @@ static struct caam_hash_template driver_hash[] = { }, }, .alg_type = OP_ALG_ALGSEL_SHA512, @@ -20666,7 +20719,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> }, { .name = "md5", .driver_name = "md5-caam", -@@ -1824,14 +1691,12 @@ static struct caam_hash_template driver_ +@@ -1824,14 +1691,12 @@ static struct caam_hash_template driver_hash[] = { }, }, .alg_type = OP_ALG_ALGSEL_MD5, @@ -20681,7 +20734,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> struct ahash_alg ahash_alg; }; -@@ -1853,6 +1718,7 @@ static int caam_hash_cra_init(struct cry +@@ -1853,6 +1718,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) HASH_MSG_LEN + SHA256_DIGEST_SIZE, HASH_MSG_LEN + 64, HASH_MSG_LEN + SHA512_DIGEST_SIZE }; @@ -20689,7 +20742,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * Get a Job ring from Job Ring driver to ensure in-order -@@ -1863,11 +1729,31 @@ static int caam_hash_cra_init(struct cry +@@ -1863,11 +1729,31 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) pr_err("Job Ring Device allocation for transform failed\n"); return PTR_ERR(ctx->jrdev); } @@ -20724,7 +20777,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> OP_ALG_ALGSEL_SHIFT]; crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm), -@@ -1879,30 +1765,10 @@ static void caam_hash_cra_exit(struct cr +@@ -1879,30 +1765,10 @@ static void caam_hash_cra_exit(struct crypto_tfm *tfm) { struct caam_hash_ctx *ctx = crypto_tfm_ctx(tfm); @@ -20759,7 +20812,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> caam_jr_free(ctx->jrdev); } -@@ -1961,7 +1827,6 @@ caam_hash_alloc(struct caam_hash_templat +@@ -1961,7 +1827,6 @@ caam_hash_alloc(struct caam_hash_template *template, alg->cra_type = &crypto_ahash_type; t_alg->alg_type = template->alg_type; @@ -20767,6 +20820,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return t_alg; } +diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c +index 354a16ab..4fcb378e 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -18,6 +18,10 @@ @@ -20780,7 +20835,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static void rsa_io_unmap(struct device *dev, struct rsa_edesc *edesc, struct akcipher_request *req) -@@ -54,6 +58,42 @@ static void rsa_priv_f1_unmap(struct dev +@@ -54,6 +58,42 @@ static void rsa_priv_f1_unmap(struct device *dev, struct rsa_edesc *edesc, dma_unmap_single(dev, pdb->d_dma, key->d_sz, DMA_TO_DEVICE); } @@ -20823,7 +20878,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* RSA Job Completion handler */ static void rsa_pub_done(struct device *dev, u32 *desc, u32 err, void *context) { -@@ -90,6 +130,42 @@ static void rsa_priv_f1_done(struct devi +@@ -90,6 +130,42 @@ static void rsa_priv_f1_done(struct device *dev, u32 *desc, u32 err, akcipher_request_complete(req, err); } @@ -20866,7 +20921,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static struct rsa_edesc *rsa_edesc_alloc(struct akcipher_request *req, size_t desclen) { -@@ -97,8 +173,8 @@ static struct rsa_edesc *rsa_edesc_alloc +@@ -97,8 +173,8 @@ static struct rsa_edesc *rsa_edesc_alloc(struct akcipher_request *req, struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm); struct device *dev = ctx->dev; struct rsa_edesc *edesc; @@ -20877,7 +20932,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> int sgc; int sec4_sg_index, sec4_sg_len = 0, sec4_sg_bytes; int src_nents, dst_nents; -@@ -258,6 +334,172 @@ static int set_rsa_priv_f1_pdb(struct ak +@@ -258,6 +334,172 @@ static int set_rsa_priv_f1_pdb(struct akcipher_request *req, return 0; } @@ -21050,7 +21105,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static int caam_rsa_enc(struct akcipher_request *req) { struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); -@@ -301,24 +543,14 @@ init_fail: +@@ -301,24 +543,14 @@ static int caam_rsa_enc(struct akcipher_request *req) return ret; } @@ -21076,7 +21131,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Allocate extended descriptor */ edesc = rsa_edesc_alloc(req, DESC_RSA_PRIV_F1_LEN); if (IS_ERR(edesc)) -@@ -344,17 +576,147 @@ init_fail: +@@ -344,17 +576,147 @@ static int caam_rsa_dec(struct akcipher_request *req) return ret; } @@ -21230,7 +21285,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } /** -@@ -370,10 +732,9 @@ static inline u8 *caam_read_raw_data(con +@@ -370,10 +732,9 @@ static inline u8 *caam_read_raw_data(const u8 *buf, size_t *nbytes) { u8 *val; @@ -21244,7 +21299,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> val = kzalloc(*nbytes, GFP_DMA | GFP_KERNEL); if (!val) -@@ -395,7 +756,7 @@ static int caam_rsa_set_pub_key(struct c +@@ -395,7 +756,7 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key, unsigned int keylen) { struct caam_rsa_ctx *ctx = akcipher_tfm_ctx(tfm); @@ -21253,7 +21308,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> struct caam_rsa_key *rsa_key = &ctx->key; int ret; -@@ -437,11 +798,69 @@ err: +@@ -437,11 +798,69 @@ static int caam_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key, return -ENOMEM; } @@ -21324,7 +21379,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> struct caam_rsa_key *rsa_key = &ctx->key; int ret; -@@ -483,6 +902,8 @@ static int caam_rsa_set_priv_key(struct +@@ -483,6 +902,8 @@ static int caam_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key, memcpy(rsa_key->d, raw_key.d, raw_key.d_sz); memcpy(rsa_key->e, raw_key.e, raw_key.e_sz); @@ -21333,12 +21388,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; err: +diff --git a/drivers/crypto/caam/caampkc.h b/drivers/crypto/caam/caampkc.h +index f595d159..87ab75e9 100644 --- a/drivers/crypto/caam/caampkc.h +++ b/drivers/crypto/caam/caampkc.h -@@ -13,21 +13,75 @@ +@@ -12,22 +12,76 @@ + #include "compat.h" #include "pdb.h" - /** ++/** + * caam_priv_key_form - CAAM RSA private key representation + * CAAM RSA private key may have either of three forms. + * @@ -21370,7 +21428,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + FORM3 +}; + -+/** + /** * caam_rsa_key - CAAM RSA key structure. Keys are allocated in DMA zone. * @n : RSA modulus raw byte stream * @e : RSA public exponent raw byte stream @@ -21428,6 +21486,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +void init_rsa_priv_f3_desc(u32 *desc, struct rsa_priv_f3_pdb *pdb); #endif +diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c +index 9b92af2c..fde07d4f 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -52,7 +52,7 @@ @@ -21439,7 +21499,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Buffer, its dma address and lock */ struct buf_data { -@@ -100,8 +100,7 @@ static void rng_done(struct device *jrde +@@ -100,8 +100,7 @@ static void rng_done(struct device *jrdev, u32 *desc, u32 err, void *context) { struct buf_data *bd; @@ -21449,7 +21509,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (err) caam_jr_strstatus(jrdev, err); -@@ -196,9 +195,6 @@ static inline int rng_create_sh_desc(str +@@ -196,9 +195,6 @@ static inline int rng_create_sh_desc(struct caam_rng_ctx *ctx) init_sh_desc(desc, HDR_SHARE_SERIAL); @@ -21459,7 +21519,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Generate random bytes */ append_operation(desc, OP_ALG_ALGSEL_RNG | OP_TYPE_CLASS1_ALG); -@@ -289,11 +285,7 @@ static int caam_init_rng(struct caam_rng +@@ -289,11 +285,7 @@ static int caam_init_rng(struct caam_rng_ctx *ctx, struct device *jrdev) if (err) return err; @@ -21481,6 +21541,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (!rng_ctx) { err = -ENOMEM; goto free_caam_alloc; +diff --git a/drivers/crypto/caam/compat.h b/drivers/crypto/caam/compat.h +index 7149cd24..4e084f51 100644 --- a/drivers/crypto/caam/compat.h +++ b/drivers/crypto/caam/compat.h @@ -16,6 +16,7 @@ @@ -21491,6 +21553,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #include <linux/spinlock.h> #include <linux/rtnetlink.h> #include <linux/in.h> +diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c +index 98468b96..8f9642c6 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -2,40 +2,41 @@ @@ -21545,7 +21609,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * Descriptor to instantiate RNG State Handle 0 in normal mode and -@@ -270,7 +271,7 @@ static int deinstantiate_rng(struct devi +@@ -270,7 +271,7 @@ static int deinstantiate_rng(struct device *ctrldev, int state_handle_mask) /* * If the corresponding bit is set, then it means the state * handle was initialized by us, and thus it needs to be @@ -21554,7 +21618,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> */ if ((1 << sh_idx) & state_handle_mask) { /* -@@ -303,20 +304,24 @@ static int caam_remove(struct platform_d +@@ -303,20 +304,24 @@ static int caam_remove(struct platform_device *pdev) struct device *ctrldev; struct caam_drv_private *ctrlpriv; struct caam_ctrl __iomem *ctrl; @@ -21587,7 +21651,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> deinstantiate_rng(ctrldev, ctrlpriv->rng4_sh_init); /* Shut down debug views */ -@@ -331,8 +336,8 @@ static int caam_remove(struct platform_d +@@ -331,8 +336,8 @@ static int caam_remove(struct platform_device *pdev) clk_disable_unprepare(ctrlpriv->caam_ipg); clk_disable_unprepare(ctrlpriv->caam_mem); clk_disable_unprepare(ctrlpriv->caam_aclk); @@ -21598,7 +21662,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return 0; } -@@ -366,11 +371,8 @@ static void kick_trng(struct platform_de +@@ -366,11 +371,8 @@ static void kick_trng(struct platform_device *pdev, int ent_delay) */ val = (rd_reg32(&r4tst->rtsdctl) & RTSDCTL_ENT_DLY_MASK) >> RTSDCTL_ENT_DLY_SHIFT; @@ -21612,7 +21676,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> val = rd_reg32(&r4tst->rtsdctl); val = (val & ~RTSDCTL_ENT_DLY_MASK) | -@@ -382,15 +384,12 @@ static void kick_trng(struct platform_de +@@ -382,15 +384,12 @@ static void kick_trng(struct platform_device *pdev, int ent_delay) wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE); /* read the control register */ val = rd_reg32(&r4tst->rtmctl); @@ -21675,7 +21739,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> struct device *dev; struct device_node *nprop, *np; struct caam_ctrl __iomem *ctrl; -@@ -452,9 +449,10 @@ static int caam_probe(struct platform_de +@@ -452,9 +449,10 @@ static int caam_probe(struct platform_device *pdev) dev = &pdev->dev; dev_set_drvdata(dev, ctrlpriv); @@ -21687,7 +21751,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Enable clocking */ clk = caam_drv_identify_clk(&pdev->dev, "ipg"); if (IS_ERR(clk)) { -@@ -483,14 +481,16 @@ static int caam_probe(struct platform_de +@@ -483,14 +481,16 @@ static int caam_probe(struct platform_device *pdev) } ctrlpriv->caam_aclk = clk; @@ -21711,7 +21775,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ret = clk_prepare_enable(ctrlpriv->caam_ipg); if (ret < 0) { -@@ -511,11 +511,13 @@ static int caam_probe(struct platform_de +@@ -511,11 +511,13 @@ static int caam_probe(struct platform_device *pdev) goto disable_caam_mem; } @@ -21730,7 +21794,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } /* Get configuration properties from device tree */ -@@ -542,13 +544,13 @@ static int caam_probe(struct platform_de +@@ -542,13 +544,13 @@ static int caam_probe(struct platform_device *pdev) else BLOCK_OFFSET = PG_SIZE_64K; @@ -21749,7 +21813,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> BLOCK_OFFSET * DECO_BLOCK_NUMBER ); -@@ -557,12 +559,17 @@ static int caam_probe(struct platform_de +@@ -557,12 +559,17 @@ static int caam_probe(struct platform_device *pdev) /* * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel, @@ -21772,7 +21836,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * Read the Compile Time paramters and SCFGR to determine -@@ -590,64 +597,67 @@ static int caam_probe(struct platform_de +@@ -590,64 +597,67 @@ static int caam_probe(struct platform_device *pdev) JRSTART_JR1_START | JRSTART_JR2_START | JRSTART_JR3_START); @@ -21879,7 +21943,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } /* If no QI and no rings specified, quit and go home */ -@@ -662,8 +672,10 @@ static int caam_probe(struct platform_de +@@ -662,8 +672,10 @@ static int caam_probe(struct platform_device *pdev) /* * If SEC has RNG version >= 4 and RNG state handle has not been * already instantiated, do RNG instantiation @@ -21891,7 +21955,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ctrlpriv->rng4_sh_init = rd_reg32(&ctrl->r4tst[0].rdsta); /* -@@ -731,77 +743,46 @@ static int caam_probe(struct platform_de +@@ -731,77 +743,46 @@ static int caam_probe(struct platform_device *pdev) /* Report "alive" for developer to see */ dev_info(dev, "device ID = 0x%016llx (Era %d)\n", caam_id, caam_get_era()); @@ -22003,7 +22067,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32); ctrlpriv->ctl_kek = debugfs_create_blob("kek", S_IRUSR | -@@ -809,7 +790,7 @@ static int caam_probe(struct platform_de +@@ -809,7 +790,7 @@ static int caam_probe(struct platform_device *pdev) ctrlpriv->ctl, &ctrlpriv->ctl_kek_wrap); @@ -22012,7 +22076,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32); ctrlpriv->ctl_tkek = debugfs_create_blob("tkek", S_IRUSR | -@@ -817,7 +798,7 @@ static int caam_probe(struct platform_de +@@ -817,7 +798,7 @@ static int caam_probe(struct platform_device *pdev) ctrlpriv->ctl, &ctrlpriv->ctl_tkek_wrap); @@ -22021,7 +22085,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32); ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk", S_IRUSR | -@@ -828,13 +809,17 @@ static int caam_probe(struct platform_de +@@ -828,13 +809,17 @@ static int caam_probe(struct platform_device *pdev) return 0; caam_remove: @@ -22040,7 +22104,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> disable_caam_aclk: clk_disable_unprepare(ctrlpriv->caam_aclk); disable_caam_mem: -@@ -844,17 +829,6 @@ disable_caam_ipg: +@@ -844,17 +829,6 @@ static int caam_probe(struct platform_device *pdev) return ret; } @@ -22058,6 +22122,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static struct platform_driver caam_driver = { .driver = { .name = "caam", +diff --git a/drivers/crypto/caam/ctrl.h b/drivers/crypto/caam/ctrl.h +index cac5402a..7e7bf68c 100644 --- a/drivers/crypto/caam/ctrl.h +++ b/drivers/crypto/caam/ctrl.h @@ -10,4 +10,6 @@ @@ -22067,6 +22133,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +extern bool caam_dpaa2; + #endif /* CTRL_H */ +diff --git a/drivers/crypto/caam/desc.h b/drivers/crypto/caam/desc.h +index 513b6646..a8c3be73 100644 --- a/drivers/crypto/caam/desc.h +++ b/drivers/crypto/caam/desc.h @@ -22,12 +22,6 @@ @@ -22122,7 +22190,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define LDST_SRCDST_WORD_ALTDS_CLASS1 (0x0f << LDST_SRCDST_SHIFT) #define LDST_SRCDST_WORD_PKHA_A_SZ (0x10 << LDST_SRCDST_SHIFT) #define LDST_SRCDST_WORD_PKHA_B_SZ (0x11 << LDST_SRCDST_SHIFT) -@@ -400,7 +395,7 @@ struct sec4_sg_entry { +@@ -360,6 +355,7 @@ struct sec4_sg_entry { + #define FIFOLD_TYPE_PK_N (0x08 << FIFOLD_TYPE_SHIFT) + #define FIFOLD_TYPE_PK_A (0x0c << FIFOLD_TYPE_SHIFT) + #define FIFOLD_TYPE_PK_B (0x0d << FIFOLD_TYPE_SHIFT) ++#define FIFOLD_TYPE_IFIFO (0x0f << FIFOLD_TYPE_SHIFT) + + /* Other types. Need to OR in last/flush bits as desired */ + #define FIFOLD_TYPE_MSG_MASK (0x38 << FIFOLD_TYPE_SHIFT) +@@ -400,7 +396,7 @@ struct sec4_sg_entry { #define FIFOST_TYPE_PKHA_N (0x08 << FIFOST_TYPE_SHIFT) #define FIFOST_TYPE_PKHA_A (0x0c << FIFOST_TYPE_SHIFT) #define FIFOST_TYPE_PKHA_B (0x0d << FIFOST_TYPE_SHIFT) @@ -22131,7 +22207,15 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define FIFOST_TYPE_AF_SBOX_TKEK (0x21 << FIFOST_TYPE_SHIFT) #define FIFOST_TYPE_PKHA_E_JKEK (0x22 << FIFOST_TYPE_SHIFT) #define FIFOST_TYPE_PKHA_E_TKEK (0x23 << FIFOST_TYPE_SHIFT) -@@ -1107,8 +1102,8 @@ struct sec4_sg_entry { +@@ -413,6 +409,7 @@ struct sec4_sg_entry { + #define FIFOST_TYPE_MESSAGE_DATA (0x30 << FIFOST_TYPE_SHIFT) + #define FIFOST_TYPE_RNGSTORE (0x34 << FIFOST_TYPE_SHIFT) + #define FIFOST_TYPE_RNGFIFO (0x35 << FIFOST_TYPE_SHIFT) ++#define FIFOST_TYPE_METADATA (0x3e << FIFOST_TYPE_SHIFT) + #define FIFOST_TYPE_SKIP (0x3f << FIFOST_TYPE_SHIFT) + + /* +@@ -1107,8 +1104,8 @@ struct sec4_sg_entry { /* For non-protocol/alg-only op commands */ #define OP_ALG_TYPE_SHIFT 24 #define OP_ALG_TYPE_MASK (0x7 << OP_ALG_TYPE_SHIFT) @@ -22142,7 +22226,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define OP_ALG_ALGSEL_SHIFT 16 #define OP_ALG_ALGSEL_MASK (0xff << OP_ALG_ALGSEL_SHIFT) -@@ -1249,7 +1244,7 @@ struct sec4_sg_entry { +@@ -1249,7 +1246,7 @@ struct sec4_sg_entry { #define OP_ALG_PKMODE_MOD_PRIMALITY 0x00f /* PKHA mode copy-memory functions */ @@ -22151,7 +22235,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define OP_ALG_PKMODE_SRC_REG_MASK (7 << OP_ALG_PKMODE_SRC_REG_SHIFT) #define OP_ALG_PKMODE_DST_REG_SHIFT 10 #define OP_ALG_PKMODE_DST_REG_MASK (7 << OP_ALG_PKMODE_DST_REG_SHIFT) -@@ -1445,7 +1440,7 @@ struct sec4_sg_entry { +@@ -1445,10 +1442,11 @@ struct sec4_sg_entry { #define MATH_SRC1_REG2 (0x02 << MATH_SRC1_SHIFT) #define MATH_SRC1_REG3 (0x03 << MATH_SRC1_SHIFT) #define MATH_SRC1_IMM (0x04 << MATH_SRC1_SHIFT) @@ -22160,7 +22244,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define MATH_SRC1_INFIFO (0x0a << MATH_SRC1_SHIFT) #define MATH_SRC1_OUTFIFO (0x0b << MATH_SRC1_SHIFT) #define MATH_SRC1_ONE (0x0c << MATH_SRC1_SHIFT) -@@ -1629,4 +1624,31 @@ struct sec4_sg_entry { ++#define MATH_SRC1_ZERO (0x0f << MATH_SRC1_SHIFT) + + /* Destination selectors */ + #define MATH_DEST_SHIFT 8 +@@ -1629,4 +1627,31 @@ struct sec4_sg_entry { /* Frame Descriptor Command for Replacement Job Descriptor */ #define FD_CMD_REPLACE_JOB_DESC 0x20000000 @@ -22192,6 +22280,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +#define CCTRL_UNLOAD_SBOX 0x10000000 + #endif /* DESC_H */ +diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h +index a8cd8a78..2d9dbeca 100644 --- a/drivers/crypto/caam/desc_constr.h +++ b/drivers/crypto/caam/desc_constr.h @@ -4,6 +4,9 @@ @@ -22251,7 +22341,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { u32 pdb_len = (pdb_bytes + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ; -@@ -72,19 +76,20 @@ static inline void init_sh_desc_pdb(u32 +@@ -72,19 +76,20 @@ static inline void init_sh_desc_pdb(u32 *desc, u32 options, size_t pdb_bytes) options); } @@ -22275,7 +22365,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { dma_addr_t *offset = (dma_addr_t *)desc_end(desc); -@@ -94,8 +99,8 @@ static inline void append_ptr(u32 *desc, +@@ -94,8 +99,8 @@ static inline void append_ptr(u32 *desc, dma_addr_t ptr) CAAM_PTR_SZ / CAAM_CMD_SZ); } @@ -22286,7 +22376,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { PRINT_POS; init_job_desc(desc, HDR_SHARED | options | -@@ -103,7 +108,7 @@ static inline void init_job_desc_shared( +@@ -103,7 +108,7 @@ static inline void init_job_desc_shared(u32 *desc, dma_addr_t ptr, int len, append_ptr(desc, ptr); } @@ -22295,7 +22385,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { u32 *offset = desc_end(desc); -@@ -114,7 +119,7 @@ static inline void append_data(u32 *desc +@@ -114,7 +119,7 @@ static inline void append_data(u32 *desc, void *data, int len) (len + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ); } @@ -22304,7 +22394,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { u32 *cmd = desc_end(desc); -@@ -125,7 +130,7 @@ static inline void append_cmd(u32 *desc, +@@ -125,7 +130,7 @@ static inline void append_cmd(u32 *desc, u32 command) #define append_u32 append_cmd @@ -22313,7 +22403,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { u32 *offset = desc_end(desc); -@@ -142,14 +147,14 @@ static inline void append_u64(u32 *desc, +@@ -142,14 +147,14 @@ static inline void append_u64(u32 *desc, u64 data) } /* Write command without affecting header, and return pointer to next word */ @@ -22330,7 +22420,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> u32 command) { append_cmd(desc, command | len); -@@ -157,7 +162,7 @@ static inline void append_cmd_ptr(u32 *d +@@ -157,7 +162,7 @@ static inline void append_cmd_ptr(u32 *desc, dma_addr_t ptr, int len, } /* Write length after pointer, rather than inside command */ @@ -22339,7 +22429,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int len, u32 command) { append_cmd(desc, command); -@@ -166,7 +171,7 @@ static inline void append_cmd_ptr_extlen +@@ -166,7 +171,7 @@ static inline void append_cmd_ptr_extlen(u32 *desc, dma_addr_t ptr, append_cmd(desc, len); } @@ -22348,7 +22438,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> u32 command) { append_cmd(desc, command | IMMEDIATE | len); -@@ -174,7 +179,7 @@ static inline void append_cmd_data(u32 * +@@ -174,7 +179,7 @@ static inline void append_cmd_data(u32 *desc, void *data, int len, } #define APPEND_CMD_RET(cmd, op) \ @@ -22357,7 +22447,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { \ u32 *cmd = desc_end(desc); \ PRINT_POS; \ -@@ -183,14 +188,15 @@ static inline u32 *append_##cmd(u32 *des +@@ -183,14 +188,15 @@ static inline u32 *append_##cmd(u32 *desc, u32 options) \ } APPEND_CMD_RET(jump, JUMP) APPEND_CMD_RET(move, MOVE) @@ -22375,7 +22465,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { u32 val = caam32_to_cpu(*move_cmd); -@@ -200,7 +206,7 @@ static inline void set_move_tgt_here(u32 +@@ -200,7 +206,7 @@ static inline void set_move_tgt_here(u32 *desc, u32 *move_cmd) } #define APPEND_CMD(cmd, op) \ @@ -22384,7 +22474,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { \ PRINT_POS; \ append_cmd(desc, CMD_##op | options); \ -@@ -208,7 +214,8 @@ static inline void append_##cmd(u32 *des +@@ -208,7 +214,8 @@ static inline void append_##cmd(u32 *desc, u32 options) \ APPEND_CMD(operation, OPERATION) #define APPEND_CMD_LEN(cmd, op) \ @@ -22394,7 +22484,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { \ PRINT_POS; \ append_cmd(desc, CMD_##op | len | options); \ -@@ -220,8 +227,8 @@ APPEND_CMD_LEN(seq_fifo_load, SEQ_FIFO_L +@@ -220,8 +227,8 @@ APPEND_CMD_LEN(seq_fifo_load, SEQ_FIFO_LOAD) APPEND_CMD_LEN(seq_fifo_store, SEQ_FIFO_STORE) #define APPEND_CMD_PTR(cmd, op) \ @@ -22416,7 +22506,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { u32 cmd_src; -@@ -249,7 +256,8 @@ static inline void append_store(u32 *des +@@ -249,7 +256,8 @@ static inline void append_store(u32 *desc, dma_addr_t ptr, unsigned int len, } #define APPEND_SEQ_PTR_INTLEN(cmd, op) \ @@ -22444,7 +22534,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int len, u32 options) \ { \ PRINT_POS; \ -@@ -287,7 +295,7 @@ APPEND_CMD_PTR_EXTLEN(seq_out_ptr, SEQ_O +@@ -287,7 +295,7 @@ APPEND_CMD_PTR_EXTLEN(seq_out_ptr, SEQ_OUT_PTR) * the size of its type */ #define APPEND_CMD_PTR_LEN(cmd, op, type) \ @@ -22453,7 +22543,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> type len, u32 options) \ { \ PRINT_POS; \ -@@ -304,7 +312,7 @@ APPEND_CMD_PTR_LEN(seq_out_ptr, SEQ_OUT_ +@@ -304,7 +312,7 @@ APPEND_CMD_PTR_LEN(seq_out_ptr, SEQ_OUT_PTR, u32) * from length of immediate data provided, e.g., split keys */ #define APPEND_CMD_PTR_TO_IMM2(cmd, op) \ @@ -22462,7 +22552,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> unsigned int data_len, \ unsigned int len, u32 options) \ { \ -@@ -315,7 +323,7 @@ static inline void append_##cmd##_as_imm +@@ -315,7 +323,7 @@ static inline void append_##cmd##_as_imm(u32 *desc, void *data, \ APPEND_CMD_PTR_TO_IMM2(key, KEY); #define APPEND_CMD_RAW_IMM(cmd, op, type) \ @@ -22538,6 +22628,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +} + +#endif /* DESC_CONSTR_H */ +diff --git a/drivers/crypto/caam/dpseci.c b/drivers/crypto/caam/dpseci.c +new file mode 100644 +index 00000000..410cd790 --- /dev/null +++ b/drivers/crypto/caam/dpseci.c @@ -0,0 +1,859 @@ @@ -23400,6 +23493,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + + return 0; +} +diff --git a/drivers/crypto/caam/dpseci.h b/drivers/crypto/caam/dpseci.h +new file mode 100644 +index 00000000..d37489c6 --- /dev/null +++ b/drivers/crypto/caam/dpseci.h @@ -0,0 +1,395 @@ @@ -23798,6 +23894,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + u16 token, struct dpseci_congestion_notification_cfg *cfg); + +#endif /* _DPSECI_H_ */ +diff --git a/drivers/crypto/caam/dpseci_cmd.h b/drivers/crypto/caam/dpseci_cmd.h +new file mode 100644 +index 00000000..7624315e --- /dev/null +++ b/drivers/crypto/caam/dpseci_cmd.h @@ -0,0 +1,261 @@ @@ -24062,6 +24161,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +}; + +#endif /* _DPSECI_CMD_H_ */ +diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c +index 33e41ea8..31963397 100644 --- a/drivers/crypto/caam/error.c +++ b/drivers/crypto/caam/error.c @@ -6,11 +6,54 @@ @@ -24176,7 +24277,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static const char * const cha_id_list[] = { "", "AES", -@@ -146,10 +237,9 @@ static void report_ccb_status(struct dev +@@ -146,10 +237,9 @@ static void report_ccb_status(struct device *jrdev, const u32 status, strlen(rng_err_id_list[err_id])) { /* RNG-only error */ err_str = rng_err_id_list[err_id]; @@ -24189,7 +24290,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * CCB ICV check failures are part of normal operation life; -@@ -198,6 +288,27 @@ static void report_deco_status(struct de +@@ -198,6 +288,27 @@ static void report_deco_status(struct device *jrdev, const u32 status, status, error, idx_str, idx, err_str, err_err_code); } @@ -24217,7 +24318,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static void report_jr_status(struct device *jrdev, const u32 status, const char *error) { -@@ -212,7 +323,7 @@ static void report_cond_code_status(stru +@@ -212,7 +323,7 @@ static void report_cond_code_status(struct device *jrdev, const u32 status, status, error, __func__); } @@ -24226,7 +24327,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { static const struct stat_src { void (*report_ssed)(struct device *jrdev, const u32 status, -@@ -224,7 +335,7 @@ void caam_jr_strstatus(struct device *jr +@@ -224,7 +335,7 @@ void caam_jr_strstatus(struct device *jrdev, u32 status) { report_ccb_status, "CCB" }, { report_jump_status, "Jump" }, { report_deco_status, "DECO" }, @@ -24235,12 +24336,14 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { report_jr_status, "Job Ring" }, { report_cond_code_status, "Condition Code" }, { NULL, NULL }, -@@ -250,4 +361,4 @@ void caam_jr_strstatus(struct device *jr +@@ -250,4 +361,4 @@ void caam_jr_strstatus(struct device *jrdev, u32 status) else dev_err(jrdev, "%d: unknown error source\n", ssrc); } -EXPORT_SYMBOL(caam_jr_strstatus); +EXPORT_SYMBOL(caam_strstatus); +diff --git a/drivers/crypto/caam/error.h b/drivers/crypto/caam/error.h +index b6350b0d..751ddcac 100644 --- a/drivers/crypto/caam/error.h +++ b/drivers/crypto/caam/error.h @@ -7,5 +7,13 @@ @@ -24258,6 +24361,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + int rowsize, int groupsize, struct scatterlist *sg, + size_t tlen, bool ascii); #endif /* CAAM_ERROR_H */ +diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h +index 5d4c0507..a5236125 100644 --- a/drivers/crypto/caam/intern.h +++ b/drivers/crypto/caam/intern.h @@ -41,6 +41,7 @@ struct caam_drv_private_jr { @@ -24317,6 +24422,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +#endif + #endif /* INTERN_H */ +diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c +index 757c27f9..00e87094 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -9,6 +9,7 @@ @@ -24327,7 +24434,22 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #include "regs.h" #include "jr.h" #include "desc.h" -@@ -73,6 +74,8 @@ static int caam_jr_shutdown(struct devic +@@ -22,6 +23,14 @@ struct jr_driver_data { + + static struct jr_driver_data driver_data; + ++static int jr_driver_probed; ++ ++int caam_jr_driver_probed(void) ++{ ++ return jr_driver_probed; ++} ++EXPORT_SYMBOL(caam_jr_driver_probed); ++ + static int caam_reset_hw_jr(struct device *dev) + { + struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); +@@ -73,6 +82,8 @@ static int caam_jr_shutdown(struct device *dev) ret = caam_reset_hw_jr(dev); @@ -24336,7 +24458,16 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Release interrupt */ free_irq(jrp->irq, dev); -@@ -128,7 +131,7 @@ static irqreturn_t caam_jr_interrupt(int +@@ -116,6 +127,8 @@ static int caam_jr_remove(struct platform_device *pdev) + dev_err(jrdev, "Failed to shut down job ring\n"); + irq_dispose_mapping(jrpriv->irq); + ++ jr_driver_probed--; ++ + return ret; + } + +@@ -128,7 +141,7 @@ static irqreturn_t caam_jr_interrupt(int irq, void *st_dev) /* * Check the output ring for ready responses, kick @@ -24345,7 +24476,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> */ irqstate = rd_reg32(&jrp->rregs->jrintstatus); if (!irqstate) -@@ -150,13 +153,18 @@ static irqreturn_t caam_jr_interrupt(int +@@ -150,13 +163,18 @@ static irqreturn_t caam_jr_interrupt(int irq, void *st_dev) /* Have valid interrupt at this point, just ACK and trigger */ wr_reg32(&jrp->rregs->jrintstatus, irqstate); @@ -24367,7 +24498,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); void (*usercall)(struct device *dev, u32 *desc, u32 status, void *arg); u32 *userdesc, userstatus; -@@ -230,8 +238,6 @@ static irqreturn_t caam_jr_threadirq(int +@@ -230,8 +248,6 @@ static irqreturn_t caam_jr_threadirq(int irq, void *st_dev) /* reenable / unmask IRQs */ clrsetbits_32(&jrp->rregs->rconfig_lo, JRCFG_IMSK, 0); @@ -24376,7 +24507,44 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> } /** -@@ -389,10 +395,11 @@ static int caam_jr_init(struct device *d +@@ -274,6 +290,36 @@ struct device *caam_jr_alloc(void) + } + EXPORT_SYMBOL(caam_jr_alloc); + ++/** ++ * caam_jridx_alloc() - Alloc a specific job ring based on its index. ++ * ++ * returns : pointer to the newly allocated physical ++ * JobR dev can be written to if successful. ++ **/ ++struct device *caam_jridx_alloc(int idx) ++{ ++ struct caam_drv_private_jr *jrpriv; ++ struct device *dev = ERR_PTR(-ENODEV); ++ ++ spin_lock(&driver_data.jr_alloc_lock); ++ ++ if (list_empty(&driver_data.jr_list)) ++ goto end; ++ ++ list_for_each_entry(jrpriv, &driver_data.jr_list, list_node) { ++ if (jrpriv->ridx == idx) { ++ atomic_inc(&jrpriv->tfm_count); ++ dev = jrpriv->dev; ++ break; ++ } ++ } ++ ++end: ++ spin_unlock(&driver_data.jr_alloc_lock); ++ return dev; ++} ++EXPORT_SYMBOL(caam_jridx_alloc); ++ + /** + * caam_jr_free() - Free the Job Ring + * @rdev - points to the dev that identifies the Job ring to +@@ -389,10 +435,11 @@ static int caam_jr_init(struct device *dev) jrp = dev_get_drvdata(dev); @@ -24391,7 +24559,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (error) { dev_err(dev, "can't connect JobR %d interrupt (%d)\n", jrp->ridx, jrp->irq); -@@ -454,6 +461,7 @@ out_free_inpring: +@@ -454,6 +501,7 @@ static int caam_jr_init(struct device *dev) out_free_irq: free_irq(jrp->irq, dev); out_kill_deq: @@ -24399,7 +24567,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return error; } -@@ -489,15 +497,28 @@ static int caam_jr_probe(struct platform +@@ -489,15 +537,28 @@ static int caam_jr_probe(struct platform_device *pdev) return -ENOMEM; } @@ -24435,7 +24603,12 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* Identify the interrupt */ jrpriv->irq = irq_of_parse_and_map(nprop, 0); -@@ -520,7 +541,7 @@ static int caam_jr_probe(struct platform +@@ -517,10 +578,12 @@ static int caam_jr_probe(struct platform_device *pdev) + + atomic_set(&jrpriv->tfm_count, 0); + ++ jr_driver_probed++; ++ return 0; } @@ -24444,9 +24617,25 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> { .compatible = "fsl,sec-v4.0-job-ring", }, +diff --git a/drivers/crypto/caam/jr.h b/drivers/crypto/caam/jr.h +index 97113a6d..ee4d31c9 100644 +--- a/drivers/crypto/caam/jr.h ++++ b/drivers/crypto/caam/jr.h +@@ -8,7 +8,9 @@ + #define JR_H + + /* Prototypes for backend-level services exposed to APIs */ ++int caam_jr_driver_probed(void); + struct device *caam_jr_alloc(void); ++struct device *caam_jridx_alloc(int idx); + void caam_jr_free(struct device *rdev); + int caam_jr_enqueue(struct device *dev, u32 *desc, + void (*cbk)(struct device *dev, u32 *desc, u32 status, +diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c +index 3ce1d5cd..a523ed77 100644 --- a/drivers/crypto/caam/key_gen.c +++ b/drivers/crypto/caam/key_gen.c -@@ -41,15 +41,29 @@ Split key generation-------------------- +@@ -41,15 +41,29 @@ Split key generation----------------------------------------------- [06] 0x64260028 fifostr: class2 mdsplit-jdk len=40 @0xffe04000 */ @@ -24479,7 +24668,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); if (!desc) { dev_err(jrdev, "unable to allocate key input memory\n"); -@@ -63,7 +77,7 @@ int gen_split_key(struct device *jrdev, +@@ -63,7 +77,7 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, goto out_free; } @@ -24488,7 +24677,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> DMA_FROM_DEVICE); if (dma_mapping_error(jrdev, dma_addr_out)) { dev_err(jrdev, "unable to map key output memory\n"); -@@ -74,7 +88,9 @@ int gen_split_key(struct device *jrdev, +@@ -74,7 +88,9 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); /* Sets MDHA up into an HMAC-INIT */ @@ -24499,7 +24688,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * do a FIFO_LOAD of zero, this will trigger the internal key expansion -@@ -87,7 +103,7 @@ int gen_split_key(struct device *jrdev, +@@ -87,7 +103,7 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, * FIFO_STORE with the explicit split-key content store * (0x26 output type) */ @@ -24508,7 +24697,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); #ifdef DEBUG -@@ -108,11 +124,11 @@ int gen_split_key(struct device *jrdev, +@@ -108,11 +124,11 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, #ifdef DEBUG print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ", DUMP_PREFIX_ADDRESS, 16, 4, key_out, @@ -24522,6 +24711,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> DMA_FROM_DEVICE); out_unmap_in: dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); +diff --git a/drivers/crypto/caam/key_gen.h b/drivers/crypto/caam/key_gen.h +index c5588f6d..851a7c86 100644 --- a/drivers/crypto/caam/key_gen.h +++ b/drivers/crypto/caam/key_gen.h @@ -5,6 +5,36 @@ @@ -24571,6 +24762,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +int gen_split_key(struct device *jrdev, u8 *key_out, + struct alginfo * const adata, const u8 *key_in, u32 keylen, + int max_keylen); +diff --git a/drivers/crypto/caam/pdb.h b/drivers/crypto/caam/pdb.h +index aaa00dd1..31e59963 100644 --- a/drivers/crypto/caam/pdb.h +++ b/drivers/crypto/caam/pdb.h @@ -483,6 +483,8 @@ struct dsa_verify_pdb { @@ -24654,9 +24847,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +} __packed; + #endif +diff --git a/drivers/crypto/caam/pkc_desc.c b/drivers/crypto/caam/pkc_desc.c +index 4e4183e6..9e2ce6fe 100644 --- a/drivers/crypto/caam/pkc_desc.c +++ b/drivers/crypto/caam/pkc_desc.c -@@ -34,3 +34,39 @@ void init_rsa_priv_f1_desc(u32 *desc, st +@@ -34,3 +34,39 @@ void init_rsa_priv_f1_desc(u32 *desc, struct rsa_priv_f1_pdb *pdb) append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY | RSA_PRIV_KEY_FRM_1); } @@ -24696,6 +24891,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY | + RSA_PRIV_KEY_FRM_3); +} +diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c +new file mode 100644 +index 00000000..48185d55 --- /dev/null +++ b/drivers/crypto/caam/qi.c @@ -0,0 +1,797 @@ @@ -25496,6 +25694,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + dev_info(qidev, "Linux CAAM Queue I/F driver initialised\n"); + return 0; +} +diff --git a/drivers/crypto/caam/qi.h b/drivers/crypto/caam/qi.h +new file mode 100644 +index 00000000..0c2e68b3 --- /dev/null +++ b/drivers/crypto/caam/qi.h @@ -0,0 +1,204 @@ @@ -25703,6 +25904,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +void qi_cache_free(void *obj); + +#endif /* __QI_H__ */ +diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h +index 84d2f838..74eb8c6c 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -2,6 +2,7 @@ @@ -25721,7 +25924,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define caam_to_cpu(len) \ static inline u##len caam##len ## _to_cpu(u##len val) \ -@@ -154,13 +156,10 @@ static inline u64 rd_reg64(void __iomem +@@ -154,13 +156,10 @@ static inline u64 rd_reg64(void __iomem *reg) #else /* CONFIG_64BIT */ static inline void wr_reg64(void __iomem *reg, u64 data) { @@ -25737,7 +25940,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> wr_reg32((u32 __iomem *)(reg), data >> 32); wr_reg32((u32 __iomem *)(reg) + 1, data); } -@@ -168,41 +167,40 @@ static inline void wr_reg64(void __iomem +@@ -168,41 +167,40 @@ static inline void wr_reg64(void __iomem *reg, u64 data) static inline u64 rd_reg64(void __iomem *reg) { @@ -25821,6 +26024,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define JRSTA_CCBERR_JUMP 0x08000000 #define JRSTA_CCBERR_INDEX_MASK 0xff00 #define JRSTA_CCBERR_INDEX_SHIFT 8 +diff --git a/drivers/crypto/caam/sg_sw_qm.h b/drivers/crypto/caam/sg_sw_qm.h +new file mode 100644 +index 00000000..3b3cabc4 --- /dev/null +++ b/drivers/crypto/caam/sg_sw_qm.h @@ -0,0 +1,126 @@ @@ -25950,6 +26156,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +} + +#endif /* __SG_SW_QM_H */ +diff --git a/drivers/crypto/caam/sg_sw_qm2.h b/drivers/crypto/caam/sg_sw_qm2.h +new file mode 100644 +index 00000000..31b44075 --- /dev/null +++ b/drivers/crypto/caam/sg_sw_qm2.h @@ -0,0 +1,81 @@ @@ -26034,6 +26243,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +} + +#endif /* _SG_SW_QM2_H_ */ +diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h +index 41cd5a35..936b1b63 100644 --- a/drivers/crypto/caam/sg_sw_sec4.h +++ b/drivers/crypto/caam/sg_sw_sec4.h @@ -5,9 +5,19 @@ @@ -26076,7 +26287,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #ifdef DEBUG print_hex_dump(KERN_ERR, "sec4_sg_ptr@: ", DUMP_PREFIX_ADDRESS, 16, 4, sec4_sg_ptr, -@@ -43,6 +59,14 @@ sg_to_sec4_sg(struct scatterlist *sg, in +@@ -43,6 +59,14 @@ sg_to_sec4_sg(struct scatterlist *sg, int sg_count, return sec4_sg_ptr - 1; } @@ -26091,7 +26302,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> /* * convert scatterlist to h/w link table format * scatterlist must have been previously dma mapped -@@ -52,31 +76,7 @@ static inline void sg_to_sec4_sg_last(st +@@ -52,31 +76,7 @@ static inline void sg_to_sec4_sg_last(struct scatterlist *sg, int sg_count, u16 offset) { sec4_sg_ptr = sg_to_sec4_sg(sg, sg_count, sec4_sg_ptr, offset); @@ -26125,9 +26336,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> - return sg_nents; -} +#endif /* _SG_SW_SEC4_H_ */ +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c +index ef5d394f..cc8deece 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c -@@ -516,7 +516,7 @@ err: +@@ -516,7 +516,7 @@ static int rsi_probe(struct usb_interface *pfunction, /** * rsi_disconnect() - This function performs the reverse of the probe function, @@ -26136,9 +26349,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> * @pfunction: Pointer to the USB interface structure. * * Return: None. +diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c +index defffa75..ec88ed9c 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c -@@ -211,7 +211,7 @@ static void deinit_irq(struct net_device +@@ -211,7 +211,7 @@ static void deinit_irq(struct net_device *dev) vif = netdev_priv(dev); wilc = vif->wilc; @@ -26147,9 +26362,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> if (wilc->dev_irq_num) { free_irq(wilc->dev_irq_num, wilc); gpio_free(wilc->gpio); +diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +index 60d8b055..02d3e721 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c -@@ -2359,7 +2359,7 @@ int wilc_deinit_host_int(struct net_devi +@@ -2359,7 +2359,7 @@ int wilc_deinit_host_int(struct net_device *net) del_timer_sync(&wilc_during_ip_timer); if (s32Error) @@ -26158,6 +26375,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> return s32Error; } +diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h +new file mode 100644 +index 00000000..e328b524 --- /dev/null +++ b/include/crypto/acompress.h @@ -0,0 +1,269 @@ @@ -26430,6 +26650,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +} + +#endif +diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h +new file mode 100644 +index 00000000..1de2b5af --- /dev/null +++ b/include/crypto/internal/acompress.h @@ -0,0 +1,81 @@ @@ -26514,6 +26737,9 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +int crypto_unregister_acomp(struct acomp_alg *alg); + +#endif +diff --git a/include/crypto/internal/scompress.h b/include/crypto/internal/scompress.h +new file mode 100644 +index 00000000..3fda3c56 --- /dev/null +++ b/include/crypto/internal/scompress.h @@ -0,0 +1,136 @@ @@ -26653,6 +26879,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +int crypto_unregister_scomp(struct scomp_alg *alg); + +#endif +diff --git a/include/linux/crypto.h b/include/linux/crypto.h +index 7cee5551..8348d83d 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -50,6 +50,8 @@ @@ -26672,6 +26900,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> #define CRYPTO_ALG_LARVAL 0x00000010 #define CRYPTO_ALG_DEAD 0x00000020 +diff --git a/include/uapi/linux/cryptouser.h b/include/uapi/linux/cryptouser.h +index 79b5ded2..11d21fce 100644 --- a/include/uapi/linux/cryptouser.h +++ b/include/uapi/linux/cryptouser.h @@ -46,6 +46,7 @@ enum crypto_attr_type_t { @@ -26692,6 +26922,8 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> + #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \ sizeof(struct crypto_report_blkcipher)) +diff --git a/scripts/spelling.txt b/scripts/spelling.txt +index 163c720d..8392f89c 100644 --- a/scripts/spelling.txt +++ b/scripts/spelling.txt @@ -305,6 +305,9 @@ defintion||definition @@ -26704,9 +26936,11 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> deivce||device delared||declared delare||declare +diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c +index 504c7cd7..d8577374 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c -@@ -506,7 +506,7 @@ static int acp_init(void __iomem *acp_mm +@@ -506,7 +506,7 @@ static int acp_init(void __iomem *acp_mmio) return 0; } @@ -26715,3 +26949,6 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> static int acp_deinit(void __iomem *acp_mmio) { u32 val; +-- +2.14.1 + |