From 05e614831030c6a65786bde433ae448f6b36bf4f Mon Sep 17 00:00:00 2001 From: Aleksander Jan Bajkowski Date: Wed, 28 Jan 2026 01:00:59 +0100 Subject: [PATCH] kernel: backport crypto selftests for some ciphersuites FIPS 140-3 recommends that all crypto implementations should be tested before first use. Testmanager performs initial tests based on existing test vectors. Not all algorithms have defined test vectors, so to improve this situation, this commit backports recently added test vectors for following cipher suites: * authenc(hmac(md5),cbc(des)) * authenc(hmac(md5),cbc(aes)) * authenc(hmac(sha1),rfc3686(ctr(aes))) * authenc(hmac(sha224),rfc3686(ctr(aes))) * authenc(hmac(sha256),rfc3686(ctr(aes))) * authenc(hmac(sha384),rfc3686(ctr(aes))) * authenc(hmac(sha512),rfc3686(ctr(aes))) These vectors were calculated using a software implementation and then double-checked on Mediatek MT7981/MT7986 (safexcel) and NXP P2020 (talitos). Both platforms passed self-tests. Signed-off-by: Aleksander Jan Bajkowski Link: https://github.com/openwrt/openwrt/pull/22409 Signed-off-by: Hauke Mehrtens --- ...llow-authenc-sha224-rfc3686-variant-.patch | 31 ++ ...dd-test-vectors-for-authenc-hmac-md5.patch | 99 ++++++ ...dd-test-vectors-for-authenc-hmac-sha.patch | 264 ++++++++++++++ ...dd-test-vectors-for-authenc-hmac-sha.patch | 278 +++++++++++++++ ...dd-test-vectors-for-authenc-hmac-sha.patch | 278 +++++++++++++++ ...dd-test-vectors-for-authenc-hmac-sha.patch | 306 ++++++++++++++++ ...dd-test-vectors-for-authenc-hmac-sha.patch | 334 ++++++++++++++++++ ...dd-test-vectors-for-authenc-hmac-md5.patch | 297 ++++++++++++++++ 8 files changed, 1887 insertions(+) create mode 100644 target/linux/generic/backport-6.12/913-v7.0-crypto-testmgr-allow-authenc-sha224-rfc3686-variant-.patch create mode 100644 target/linux/generic/backport-6.12/914-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch create mode 100644 target/linux/generic/backport-6.12/915-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch create mode 100644 target/linux/generic/backport-6.12/916-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch create mode 100644 target/linux/generic/backport-6.12/917-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch create mode 100644 target/linux/generic/backport-6.12/918-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch create mode 100644 target/linux/generic/backport-6.12/919-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch create mode 100644 target/linux/generic/pending-6.12/910-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch diff --git a/target/linux/generic/backport-6.12/913-v7.0-crypto-testmgr-allow-authenc-sha224-rfc3686-variant-.patch b/target/linux/generic/backport-6.12/913-v7.0-crypto-testmgr-allow-authenc-sha224-rfc3686-variant-.patch new file mode 100644 index 0000000000..7ea115c3f6 --- /dev/null +++ b/target/linux/generic/backport-6.12/913-v7.0-crypto-testmgr-allow-authenc-sha224-rfc3686-variant-.patch @@ -0,0 +1,31 @@ +From e1dc530d0c082c903e74bf6e16d8a38843d3d1d7 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 1 Jan 2026 16:25:18 +0100 +Subject: [PATCH] crypto: testmgr - allow authenc(sha224,rfc3686) variant in + fips mode + +The remaining combinations of AES-CTR-RFC3686 and SHA* have already been +marked as allowed in 8888690ef5f7. This commit does the same for SHA224. + +rfc3686(ctr(aes)) is already marked fips compliant, +so these should be fine. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4440,6 +4440,10 @@ static const struct alg_test_desc alg_te + .aead = __VECS(hmac_sha224_des3_ede_cbc_tv_temp) + } + }, { ++ .alg = "authenc(hmac(sha224),rfc3686(ctr(aes)))", ++ .test = alg_test_null, ++ .fips_allowed = 1, ++ }, { + .alg = "authenc(hmac(sha256),cbc(aes))", + .test = alg_test_aead, + .fips_allowed = 1, diff --git a/target/linux/generic/backport-6.12/914-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch b/target/linux/generic/backport-6.12/914-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch new file mode 100644 index 0000000000..0c037504d0 --- /dev/null +++ b/target/linux/generic/backport-6.12/914-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch @@ -0,0 +1,99 @@ +From 404ba6b46b6e234384b962210a98931f7423f139 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sat, 7 Feb 2026 15:51:03 +0100 +Subject: [PATCH] crypto: testmgr - Add test vectors for + authenc(hmac(md5),cbc(des)) + +Test vector was generated using a software implementation and then double +checked on Mediatek MT7981 (safexcel) and NXP P2020 (talitos). Both +platforms pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 7 ++++++ + crypto/testmgr.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 64 insertions(+) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4375,6 +4375,13 @@ static const struct alg_test_desc alg_te + .cprng = __VECS(ansi_cprng_aes_tv_template) + } + }, { ++ .alg = "authenc(hmac(md5),cbc(des))", ++ .generic_driver = "authenc(hmac-md5-lib,cbc(des-generic))", ++ .test = alg_test_aead, ++ .suite = { ++ .aead = __VECS(hmac_md5_des_cbc_tv_temp) ++ } ++ }, { + .alg = "authenc(hmac(md5),cbc(des3_ede))", + .generic_driver = "authenc(hmac-md5-lib,cbc(des3_ede-generic))", + .test = alg_test_aead, +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -18708,6 +18708,63 @@ static const struct aead_testvec hmac_sh + }, + }; + ++static const struct aead_testvec hmac_md5_des_cbc_tv_temp[] = { ++ { /*Generated with cryptopp*/ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x08" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24", ++ .klen = 8 + 16 + 8, ++ .iv = "\x7D\x33\x88\x93\x0F\x93\xB2\x42", ++ .assoc = "\x00\x00\x43\x21\x00\x00\x00\x01" ++ "\x7D\x33\x88\x93\x0F\x93\xB2\x42", ++ .alen = 16, ++ .ptext = "\x6f\x54\x20\x6f\x61\x4d\x79\x6e" ++ "\x53\x20\x63\x65\x65\x72\x73\x74" ++ "\x54\x20\x6f\x6f\x4d\x20\x6e\x61" ++ "\x20\x79\x65\x53\x72\x63\x74\x65" ++ "\x20\x73\x6f\x54\x20\x6f\x61\x4d" ++ "\x79\x6e\x53\x20\x63\x65\x65\x72" ++ "\x73\x74\x54\x20\x6f\x6f\x4d\x20" ++ "\x6e\x61\x20\x79\x65\x53\x72\x63" ++ "\x74\x65\x20\x73\x6f\x54\x20\x6f" ++ "\x61\x4d\x79\x6e\x53\x20\x63\x65" ++ "\x65\x72\x73\x74\x54\x20\x6f\x6f" ++ "\x4d\x20\x6e\x61\x20\x79\x65\x53" ++ "\x72\x63\x74\x65\x20\x73\x6f\x54" ++ "\x20\x6f\x61\x4d\x79\x6e\x53\x20" ++ "\x63\x65\x65\x72\x73\x74\x54\x20" ++ "\x6f\x6f\x4d\x20\x6e\x61\x0a\x79", ++ .plen = 128, ++ .ctext = "\x70\xd6\xde\x64\x87\x17\xf1\xe8" ++ "\x54\x31\x85\x37\xed\x6b\x01\x8d" ++ "\xe3\xcc\xe0\x1d\x5e\xf3\xfe\xf1" ++ "\x41\xaa\x33\x91\xa7\x7d\x99\x88" ++ "\x4d\x85\x6e\x2f\xa3\x69\xf5\x82" ++ "\x3a\x6f\x25\xcb\x7d\x58\x1f\x9b" ++ "\xaa\x9c\x11\xd5\x76\x67\xce\xde" ++ "\x56\xd7\x5a\x80\x69\xea\x3a\x02" ++ "\xf0\xc7\x7c\xe3\xcb\x40\xe5\x52" ++ "\xd1\x10\x92\x78\x0b\x8e\x5b\xf1" ++ "\xe3\x26\x1f\xe1\x15\x41\xc7\xba" ++ "\x99\xdb\x08\x51\x1c\xd3\x01\xf4" ++ "\x87\x47\x39\xb8\xd2\xdd\xbd\xfb" ++ "\x66\x13\xdf\x1c\x01\x44\xf0\x7a" ++ "\x1a\x6b\x13\xf5\xd5\x0b\xb8\xba" ++ "\x53\xba\xe1\x76\xe3\x82\x07\x86" ++ "\x95\x9e\x7d\x37\x1e\x60\xaf\x7c" ++ "\x53\x12\x61\x68\xef\xb4\x47\xa6", ++ .clen = 128 + 16, ++ }, ++}; ++ + static const struct aead_testvec hmac_sha1_des_cbc_tv_temp[] = { + { /*Generated with cryptopp*/ + #ifdef __LITTLE_ENDIAN diff --git a/target/linux/generic/backport-6.12/915-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch b/target/linux/generic/backport-6.12/915-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch new file mode 100644 index 0000000000..c6018305d4 --- /dev/null +++ b/target/linux/generic/backport-6.12/915-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch @@ -0,0 +1,264 @@ +From 2a2468bf33d3fac5192429207a439d23e615173a Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 5 Mar 2026 21:08:20 +0100 +Subject: [PATCH 1/5] crypto: testmgr - Add test vectors for + authenc(hmac(sha1),rfc3686(ctr(aes))) + +Test vectors were generated starting from existing RFC3686(CTR(AES)) test +vectors and adding HMAC(SHA1) computed with software implementation. +Then, the results were double-checked on Mediatek MT7986 (safexcel). +Platform pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 6 +- + crypto/testmgr.h | 221 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 226 insertions(+), 1 deletion(-) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4425,8 +4425,12 @@ static const struct alg_test_desc alg_te + } + }, { + .alg = "authenc(hmac(sha1),rfc3686(ctr(aes)))", +- .test = alg_test_null, ++ .generic_driver = "authenc(hmac-sha1-lib,rfc3686(ctr(aes-lib)))", ++ .test = alg_test_aead, + .fips_allowed = 1, ++ .suite = { ++ .aead = __VECS(hmac_sha1_aes_ctr_rfc3686_tv_temp) ++ } + }, { + .alg = "authenc(hmac(sha224),cbc(aes))", + .generic_driver = "authenc(hmac-sha224-lib,cbc(aes-generic))", +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -17444,6 +17444,227 @@ static const struct aead_testvec hmac_sh + }, + }; + ++static const struct aead_testvec hmac_sha1_aes_ctr_rfc3686_tv_temp[] = { ++ { /* RFC 3686 Case 1 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00" ++ "\xae\x68\x52\xf8\x12\x10\x67\xcc" ++ "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" ++ "\x00\x00\x00\x30", ++ .klen = 8 + 20 + 20, ++ .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" ++ "\x2d\x61\x75\xa3\x26\x13\x11\xb8" ++ "\x70\xdc\x6b\x62\x43\xa1\x2f\x08" ++ "\xf1\xec\x93\x7d\x69\xb2\x8e\x1f" ++ "\x0a\x97\x39\x86", ++ .clen = 16 + 20, ++ }, { /* RFC 3686 Case 2 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33" ++ "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" ++ "\x43\xd6\xce\x1f\x32\x53\x91\x63" ++ "\x00\x6c\xb6\xdb", ++ .klen = 8 + 20 + 20, ++ .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" ++ "\x79\x0d\x41\xee\x8e\xda\xd3\x88" ++ "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" ++ "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" ++ "\x6b\x7b\x4d\x39\x36\x1c\x12\x5f" ++ "\x72\xd2\x88\xb2\x26\xa6\xa6\xb5" ++ "\x1d\x3a\x49\xa6", ++ .clen = 32 + 20, ++ }, { /* RFC 3686 Case 3 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x22\x33\x44\x55" ++ "\x76\x91\xbe\x03\x5e\x50\x20\xa8" ++ "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" ++ "\x00\xe0\x01\x7b", ++ .klen = 8 + 20 + 20, ++ .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" ++ "\x20\x21\x22\x23", ++ .plen = 36, ++ .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" ++ "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" ++ "\x45\x40\xa4\x2b\xde\x6d\x78\x36" ++ "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" ++ "\x25\xb2\x07\x2f" ++ "\x2c\x86\xa0\x90\x8e\xc1\x02\x1d" ++ "\x51\xdc\xd6\x21\xc7\x30\xcc\x32" ++ "\x38\x55\x47\x64", ++ .clen = 36 + 20, ++ }, { /* RFC 3686 Case 4 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00" ++ "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" ++ "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" ++ "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" ++ "\x00\x00\x00\x48", ++ .klen = 8 + 20 + 28, ++ .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" ++ "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" ++ "\xe9\x4e\x49\xf0\x6b\x8d\x58\x2b" ++ "\x26\x7f\xf3\xab\xeb\x2f\x74\x2f" ++ "\x45\x43\x64\xc1", ++ .clen = 16 + 20, ++ }, { /* RFC 3686 Case 5 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33" ++ "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" ++ "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" ++ "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" ++ "\x00\x96\xb0\x3b", ++ .klen = 8 + 20 + 28, ++ .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" ++ "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" ++ "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" ++ "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" ++ "\xab\xc4\xfa\x6d\x20\xe1\xce\x72" ++ "\x0e\x92\x4e\x97\xaa\x4d\x30\x84" ++ "\xb6\xd8\x4d\x3b", ++ .clen = 32 + 20, ++ }, { /* RFC 3686 Case 7 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00" ++ "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" ++ "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" ++ "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" ++ "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" ++ "\x00\x00\x00\x60", ++ .klen = 8 + 20 + 36, ++ .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" ++ "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" ++ "\x3d\x6c\x23\x27\xda\x0e\x7f\x29" ++ "\xfd\x8d\x3c\x1b\xf7\x7a\x63\xd9" ++ "\x7e\x0f\xe9\xf6", ++ .clen = 16 + 20, ++ }, { /* RFC 3686 Case 8 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33" ++ "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" ++ "\x07\x96\x36\x58\x79\xef\xf8\x86" ++ "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" ++ "\x4b\x50\x59\x0c\x87\xa2\x38\x84" ++ "\x00\xfa\xac\x24", ++ .klen = 8 + 20 + 36, ++ .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" ++ "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" ++ "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" ++ "\x55\x30\x83\x1d\x93\x44\xaf\x1c" ++ "\xe7\xee\x22\xa4\xdd\xbf\x5d\x44" ++ "\x3b\x43\x1c\x69\x55\x11\xd5\xad" ++ "\x14\x5f\x44\xa6", ++ .clen = 32 + 20, ++ }, ++}; ++ + static const struct aead_testvec hmac_sha1_ecb_cipher_null_tv_temp[] = { + { /* Input data from RFC 2410 Case 1 */ + #ifdef __LITTLE_ENDIAN diff --git a/target/linux/generic/backport-6.12/916-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch b/target/linux/generic/backport-6.12/916-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch new file mode 100644 index 0000000000..6999c91951 --- /dev/null +++ b/target/linux/generic/backport-6.12/916-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch @@ -0,0 +1,278 @@ +From 3f4d32aff1d4e06501f909b1e5037ec8caa76d01 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 5 Mar 2026 21:08:21 +0100 +Subject: [PATCH 2/5] crypto: testmgr - Add test vectors for + authenc(hmac(sha224),rfc3686(ctr(aes))) + +Test vectors were generated starting from existing RFC3686(CTR(AES)) test +vectors and adding HMAC(SHA224) computed with software implementation. +Then, the results were double-checked on Mediatek MT7986 (safexcel). +Platform pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 6 +- + crypto/testmgr.h | 235 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 240 insertions(+), 1 deletion(-) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4452,8 +4452,12 @@ static const struct alg_test_desc alg_te + } + }, { + .alg = "authenc(hmac(sha224),rfc3686(ctr(aes)))", +- .test = alg_test_null, ++ .generic_driver = "authenc(hmac-sha224-lib,rfc3686(ctr(aes-lib)))", ++ .test = alg_test_aead, + .fips_allowed = 1, ++ .suite = { ++ .aead = __VECS(hmac_sha224_aes_ctr_rfc3686_tv_temp) ++ } + }, { + .alg = "authenc(hmac(sha256),cbc(aes))", + .test = alg_test_aead, +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -17996,6 +17996,241 @@ static const struct aead_testvec hmac_sh + }, + }; + ++static const struct aead_testvec hmac_sha224_aes_ctr_rfc3686_tv_temp[] = { ++ { /* RFC 3686 Case 1 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00" ++ "\xae\x68\x52\xf8\x12\x10\x67\xcc" ++ "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" ++ "\x00\x00\x00\x30", ++ .klen = 8 + 28 + 20, ++ .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" ++ "\x2d\x61\x75\xa3\x26\x13\x11\xb8" ++ "\x36\xb4\x3b\x9c\x62\xed\xcf\x77" ++ "\xdc\x19\x27\x3f\x92\x80\x52\xce" ++ "\x8f\xad\x01\x0b\x79\xda\x04\x83" ++ "\xcb\x45\x1a\x52", ++ .clen = 16 + 28, ++ }, { /* RFC 3686 Case 2 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b" ++ "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" ++ "\x43\xd6\xce\x1f\x32\x53\x91\x63" ++ "\x00\x6c\xb6\xdb", ++ .klen = 8 + 28 + 20, ++ .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" ++ "\x79\x0d\x41\xee\x8e\xda\xd3\x88" ++ "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" ++ "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" ++ "\x7f\xe4\x8f\xa7\x06\x71\xe9\xe5" ++ "\x16\x79\xef\xf9\x7e\x5c\x93\x4d" ++ "\xa0\xf8\x3b\x3a\xaa\x1c\xc0\xd9" ++ "\x6b\x48\x49\x01", ++ .clen = 32 + 28, ++ }, { /* RFC 3686 Case 3 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x22\x33\x44\x55\x66\x77\x88\x99" ++ "\xaa\xbb\xcc\xdd" ++ "\x76\x91\xbe\x03\x5e\x50\x20\xa8" ++ "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" ++ "\x00\xe0\x01\x7b", ++ .klen = 8 + 28 + 20, ++ .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" ++ "\x20\x21\x22\x23", ++ .plen = 36, ++ .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" ++ "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" ++ "\x45\x40\xa4\x2b\xde\x6d\x78\x36" ++ "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" ++ "\x25\xb2\x07\x2f" ++ "\xb0\x19\x45\xee\xa7\x31\xd9\xd0" ++ "\x74\x6b\xb8\xb1\x67\x61\x2f\x8c" ++ "\x68\xde\xe3\xc9\x3b\x0c\x72\xda" ++ "\x48\xba\x1b\x51", ++ .clen = 36 + 28, ++ }, { /* RFC 3686 Case 4 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00" ++ "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" ++ "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" ++ "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" ++ "\x00\x00\x00\x48", ++ .klen = 8 + 28 + 28, ++ .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" ++ "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" ++ "\xfd\xf5\x35\x26\x50\x3d\xdf\x80" ++ "\x6e\xbe\xba\x8d\x56\xf3\x03\xb7" ++ "\x27\xb8\x13\xe8\x72\x8f\xc9\x52" ++ "\x4a\xb7\xc3\x3a", ++ .clen = 16 + 28, ++ }, { /* RFC 3686 Case 5 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b" ++ "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" ++ "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" ++ "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" ++ "\x00\x96\xb0\x3b", ++ .klen = 8 + 28 + 28, ++ .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" ++ "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" ++ "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" ++ "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" ++ "\x72\x89\xa8\x04\xa5\xac\x8f\x29" ++ "\xe6\xb8\x58\xe8\xcf\x6a\x91\x89" ++ "\xd3\x66\x3b\xdc\xce\x43\x23\xb7" ++ "\x6a\xdd\x9d\xbd", ++ .clen = 32 + 28, ++ }, { /* RFC 3686 Case 7 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00" ++ "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" ++ "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" ++ "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" ++ "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" ++ "\x00\x00\x00\x60", ++ .klen = 8 + 28 + 36, ++ .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" ++ "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" ++ "\xfe\xdf\x6f\x62\x8a\x79\xb5\x34" ++ "\xd0\x6f\x32\xaf\x31\x50\x5b\x1f" ++ "\xe0\x6d\x0b\xbc\x02\x25\xee\x74" ++ "\x7a\xdf\x97\x3c", ++ .clen = 16 + 28, ++ }, { /* RFC 3686 Case 8 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b" ++ "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" ++ "\x07\x96\x36\x58\x79\xef\xf8\x86" ++ "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" ++ "\x4b\x50\x59\x0c\x87\xa2\x38\x84" ++ "\x00\xfa\xac\x24", ++ .klen = 8 + 28 + 36, ++ .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" ++ "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" ++ "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" ++ "\x55\x30\x83\x1d\x93\x44\xaf\x1c" ++ "\x19\x1e\x9c\x2c\x6d\x4e\x21\xda" ++ "\x6c\x4d\x88\x90\xf8\x5f\xa5\x9d" ++ "\xb4\xd4\x40\xad\xfa\x67\x3f\x0e" ++ "\x11\x12\xd6\x10", ++ .clen = 32 + 28, ++ }, ++}; ++ + static const struct aead_testvec hmac_sha256_aes_cbc_tv_temp[] = { + { /* RFC 3602 Case 1 */ + #ifdef __LITTLE_ENDIAN diff --git a/target/linux/generic/backport-6.12/917-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch b/target/linux/generic/backport-6.12/917-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch new file mode 100644 index 0000000000..bd09c4cedf --- /dev/null +++ b/target/linux/generic/backport-6.12/917-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch @@ -0,0 +1,278 @@ +From 65af3a0bff7264ab84f9e1f2099c658601ca1b66 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 5 Mar 2026 21:08:22 +0100 +Subject: [PATCH 3/5] crypto: testmgr - Add test vectors for + authenc(hmac(sha256),rfc3686(ctr(aes))) + +Test vectors were generated starting from existing RFC3686(CTR(AES)) test +vectors and adding HMAC(SHA256) computed with software implementation. +Then, the results were double-checked on Mediatek MT7986 (safexcel). +Platform pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 6 +- + crypto/testmgr.h | 235 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 240 insertions(+), 1 deletion(-) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4483,8 +4483,12 @@ static const struct alg_test_desc alg_te + .fips_allowed = 1, + }, { + .alg = "authenc(hmac(sha256),rfc3686(ctr(aes)))", +- .test = alg_test_null, ++ .generic_driver = "authenc(hmac-sha256-lib,rfc3686(ctr(aes-lib)))", ++ .test = alg_test_aead, + .fips_allowed = 1, ++ .suite = { ++ .aead = __VECS(hmac_sha256_aes_ctr_rfc3686_tv_temp) ++ } + }, { + .alg = "authenc(hmac(sha384),cbc(aes))", + .generic_driver = "authenc(hmac-sha384-lib,cbc(aes-generic))", +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -18514,6 +18514,241 @@ static const struct aead_testvec hmac_sh + }, + }; + ++static const struct aead_testvec hmac_sha256_aes_ctr_rfc3686_tv_temp[] = { ++ { /* RFC 3686 Case 1 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\xae\x68\x52\xf8\x12\x10\x67\xcc" ++ "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" ++ "\x00\x00\x00\x30", ++ .klen = 8 + 32 + 20, ++ .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" ++ "\x2d\x61\x75\xa3\x26\x13\x11\xb8" ++ "\x9b\xa2\x34\x62\xe5\xb3\xe8\x2d" ++ "\x6d\xdb\x93\x64\xa5\x08\x2e\x77" ++ "\x72\x1f\x21\x94\xc7\xbe\x14\xa6" ++ "\xcd\xea\x96\xa1\x29\x8f\x30\xc3", ++ .clen = 16 + 32, ++ }, { /* RFC 3686 Case 2 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" ++ "\x43\xd6\xce\x1f\x32\x53\x91\x63" ++ "\x00\x6c\xb6\xdb", ++ .klen = 8 + 32 + 20, ++ .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" ++ "\x79\x0d\x41\xee\x8e\xda\xd3\x88" ++ "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" ++ "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" ++ "\x22\xf7\x95\xa8\xbb\xcd\x19\xf4" ++ "\x58\x16\x54\x28\x2b\xf4\x52\xe7" ++ "\x5c\x6c\xe1\x44\x0b\xd5\x10\x6e" ++ "\xe1\xf7\x04\xc4\x2c\xab\x93\xdd", ++ .clen = 32 + 32, ++ }, { /* RFC 3686 Case 3 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x22\x33\x44\x55\x66\x77\x88\x99" ++ "\xaa\xbb\xcc\xdd\xee\xff\x11\x22" ++ "\x76\x91\xbe\x03\x5e\x50\x20\xa8" ++ "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" ++ "\x00\xe0\x01\x7b", ++ .klen = 8 + 32 + 20, ++ .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" ++ "\x20\x21\x22\x23", ++ .plen = 36, ++ .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" ++ "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" ++ "\x45\x40\xa4\x2b\xde\x6d\x78\x36" ++ "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" ++ "\x25\xb2\x07\x2f" ++ "\x1d\x05\x5f\x77\x3b\x4f\x5c\x21" ++ "\x29\xea\xf1\xa8\x71\x49\x7b\x0b" ++ "\x66\x0d\xff\x18\x81\x63\xfc\xc3" ++ "\x91\xb6\x38\xc8\xcd\x2d\x39\x83", ++ .clen = 36 + 32, ++ }, { /* RFC 3686 Case 4 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" ++ "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" ++ "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" ++ "\x00\x00\x00\x48", ++ .klen = 8 + 32 + 28, ++ .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" ++ "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" ++ "\x8d\x03\x77\xb2\x1c\xc9\xe0\xac" ++ "\xde\x69\xbe\x8a\xef\x5b\x13\x74" ++ "\x1d\x39\xbc\xdc\x95\xa4\xbf\xc3" ++ "\xd5\xc6\xd1\xda\xda\x3b\xca\x78", ++ .clen = 16 + 32, ++ }, { /* RFC 3686 Case 5 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" ++ "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" ++ "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" ++ "\x00\x96\xb0\x3b", ++ .klen = 8 + 32 + 28, ++ .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" ++ "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" ++ "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" ++ "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" ++ "\x34\x06\x2b\x3d\xf1\xa8\x3d\xf1" ++ "\xa6\x5e\x5c\x1a\xdb\x0c\xb5\x1e" ++ "\x8f\xdb\xf4\xca\x7d\x09\x5e\x81" ++ "\xdb\x32\x07\x4a\x1d\x1c\x6d\x83", ++ .clen = 32 + 32, ++ }, { /* RFC 3686 Case 7 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" ++ "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" ++ "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" ++ "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" ++ "\x00\x00\x00\x60", ++ .klen = 8 + 32 + 36, ++ .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" ++ "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" ++ "\xc3\xb4\x5f\xb0\xbf\xf5\x1b\xff" ++ "\x7c\xf1\x79\x00\x63\x50\xdd\x77" ++ "\xc0\x4a\xba\xcd\xdc\x47\x05\x2a" ++ "\x5d\x85\x2d\x83\x44\xca\x79\x2c", ++ .clen = 16 + 32, ++ }, { /* RFC 3686 Case 8 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" ++ "\x07\x96\x36\x58\x79\xef\xf8\x86" ++ "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" ++ "\x4b\x50\x59\x0c\x87\xa2\x38\x84" ++ "\x00\xfa\xac\x24", ++ .klen = 8 + 32 + 36, ++ .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" ++ "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" ++ "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" ++ "\x55\x30\x83\x1d\x93\x44\xaf\x1c" ++ "\xc8\x59\x5d\xe1\xba\xac\x13\x82" ++ "\xfd\x21\x7c\x8c\x23\x31\x04\x02" ++ "\x9e\x69\x5b\x57\xa8\x13\xe7\x21" ++ "\x60\x0c\x24\xc2\x80\x4a\x93\x6e", ++ .clen = 32 + 32, ++ }, ++}; ++ + static const struct aead_testvec hmac_sha384_aes_cbc_tv_temp[] = { + { /* RFC 3602 Case 1 */ + #ifdef __LITTLE_ENDIAN diff --git a/target/linux/generic/backport-6.12/918-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch b/target/linux/generic/backport-6.12/918-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch new file mode 100644 index 0000000000..5283fcc028 --- /dev/null +++ b/target/linux/generic/backport-6.12/918-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch @@ -0,0 +1,306 @@ +From 07cbbf6f38e6a91a7fecab3d6f86485425748d3e Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 5 Mar 2026 21:08:23 +0100 +Subject: [PATCH 4/5] crypto: testmgr - Add test vectors for + authenc(hmac(sha384),rfc3686(ctr(aes))) + +Test vectors were generated starting from existing RFC3686(CTR(AES)) test +vectors and adding HMAC(SHA384) computed with software implementation. +Then, the results were double-checked on Mediatek MT7986 (safexcel). +Platform pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 6 +- + crypto/testmgr.h | 263 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 268 insertions(+), 1 deletion(-) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4514,8 +4514,12 @@ static const struct alg_test_desc alg_te + .fips_allowed = 1, + }, { + .alg = "authenc(hmac(sha384),rfc3686(ctr(aes)))", +- .test = alg_test_null, ++ .generic_driver = "authenc(hmac-sha384-lib,rfc3686(ctr(aes-lib)))", ++ .test = alg_test_aead, + .fips_allowed = 1, ++ .suite = { ++ .aead = __VECS(hmac_sha384_aes_ctr_rfc3686_tv_temp) ++ } + }, { + .alg = "authenc(hmac(sha512),cbc(aes))", + .fips_allowed = 1, +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -19060,6 +19060,269 @@ static const struct aead_testvec hmac_sh + }, + }; + ++static const struct aead_testvec hmac_sha384_aes_ctr_rfc3686_tv_temp[] = { ++ { /* RFC 3686 Case 1 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\xae\x68\x52\xf8\x12\x10\x67\xcc" ++ "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" ++ "\x00\x00\x00\x30", ++ .klen = 8 + 48 + 20, ++ .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" ++ "\x2d\x61\x75\xa3\x26\x13\x11\xb8" ++ "\x45\x51\x59\x72\x16\xd3\xc6\x15" ++ "\x25\x1e\xe8\x92\x2e\x47\x52\xcc" ++ "\x91\x9c\x24\xef\x11\xb2\x53\x00" ++ "\x10\x20\x43\x06\xe2\x35\x88\x9e" ++ "\x18\x32\x5a\x79\x7d\x73\x7e\x89" ++ "\xfe\xa1\xda\xa4\x86\xc4\x2a\x04", ++ .clen = 16 + 48, ++ }, { /* RFC 3686 Case 2 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x40\x41\x42\x43\x44\x45\x46\x47" ++ "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" ++ "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" ++ "\x43\xd6\xce\x1f\x32\x53\x91\x63" ++ "\x00\x6c\xb6\xdb", ++ .klen = 8 + 48 + 20, ++ .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" ++ "\x79\x0d\x41\xee\x8e\xda\xd3\x88" ++ "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" ++ "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" ++ "\x83\x65\x32\x1e\x6b\x60\xe6\x4a" ++ "\xe2\xab\x52\x2b\xa6\x70\x3a\xfa" ++ "\xd2\xec\x83\xe4\x31\x0c\x28\x40" ++ "\x9b\x5e\x18\xa4\xdc\x48\xb8\x56" ++ "\x33\xab\x7f\x2b\xaf\xe4\x3a\xe3" ++ "\x8a\x61\xf6\x22\xb4\x6b\xfe\x7d", ++ .clen = 32 + 48, ++ }, { /* RFC 3686 Case 3 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x22\x33\x44\x55\x66\x77\x88\x99" ++ "\xaa\xbb\xcc\xdd\xee\xff\x11\x22" ++ "\x33\x44\x55\x66\x77\x88\x99\xaa" ++ "\xbb\xcc\xdd\xee\xff\x11\x22\x33" ++ "\x76\x91\xbe\x03\x5e\x50\x20\xa8" ++ "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" ++ "\x00\xe0\x01\x7b", ++ .klen = 8 + 48 + 20, ++ .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" ++ "\x20\x21\x22\x23", ++ .plen = 36, ++ .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" ++ "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" ++ "\x45\x40\xa4\x2b\xde\x6d\x78\x36" ++ "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" ++ "\x25\xb2\x07\x2f" ++ "\x4a\xaa\xad\x3b\x3b\xb6\x9a\xba" ++ "\xa1\x7b\xc6\xce\x96\xc3\xff\x67" ++ "\xf3\x0c\x33\x57\xf0\x51\x24\x08" ++ "\xed\x4f\x6a\x9c\x22\x42\xbd\x18" ++ "\x97\x74\x68\x36\x00\xf1\x69\x3a" ++ "\x18\x77\x40\xf0\x56\xba\xba\xe0", ++ .clen = 36 + 48, ++ }, { /* RFC 3686 Case 4 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" ++ "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" ++ "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" ++ "\x00\x00\x00\x48", ++ .klen = 8 + 48 + 28, ++ .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" ++ "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" ++ "\x36\xd6\xc7\x55\xac\xb6\x0b\x14" ++ "\x95\x71\xf9\x86\x30\xe3\x96\xc3" ++ "\x76\x85\x6d\xa5\x06\xed\x6f\x34" ++ "\xcc\x1f\xcc\x2d\x88\x06\xb0\x1d" ++ "\xbe\xd9\xa2\xd3\x64\xf1\x33\x03" ++ "\x13\x50\x8f\xae\x61\x2d\x82\xb8", ++ .clen = 16 + 48, ++ }, { /* RFC 3686 Case 5 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x40\x41\x42\x43\x44\x45\x46\x47" ++ "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" ++ "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" ++ "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" ++ "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" ++ "\x00\x96\xb0\x3b", ++ .klen = 8 + 48 + 28, ++ .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" ++ "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" ++ "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" ++ "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" ++ "\x80\x12\x67\x22\xf2\x4d\x9b\xbf" ++ "\xdc\x38\xd3\xaa\x12\xc0\x58\x1a" ++ "\x9a\x62\x6e\x42\x3d\x44\x63\xdd" ++ "\xee\x7e\xe3\xa3\xdf\x2a\x65\x05" ++ "\xd0\xc1\xd2\x54\x55\x35\x5c\xc7" ++ "\xb0\xb5\xb1\x36\xe0\x0b\xaf\x72", ++ .clen = 32 + 48, ++ }, { /* RFC 3686 Case 7 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" ++ "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" ++ "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" ++ "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" ++ "\x00\x00\x00\x60", ++ .klen = 8 + 48 + 36, ++ .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" ++ "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" ++ "\xb1\x7b\xb1\xec\xca\x94\x55\xc4" ++ "\x3f\x2b\xb1\x70\x04\x91\xf5\x9d" ++ "\x1a\xc0\xe1\x2a\x93\x5f\x96\x2a" ++ "\x12\x85\x38\x36\xe1\xb2\xe9\xf0" ++ "\xf2\x6e\x5d\x81\xcc\x49\x07\x9c" ++ "\x5b\x88\xc8\xcc\xc4\x21\x4f\x32", ++ .clen = 16 + 48, ++ }, { /* RFC 3686 Case 8 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x40\x41\x42\x43\x44\x45\x46\x47" ++ "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" ++ "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" ++ "\x07\x96\x36\x58\x79\xef\xf8\x86" ++ "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" ++ "\x4b\x50\x59\x0c\x87\xa2\x38\x84" ++ "\x00\xfa\xac\x24", ++ .klen = 8 + 48 + 36, ++ .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" ++ "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" ++ "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" ++ "\x55\x30\x83\x1d\x93\x44\xaf\x1c" ++ "\xd6\x96\xbb\x12\x39\xc4\x4d\xe2" ++ "\x4c\x02\xe7\x1f\xdc\xb2\xb1\x57" ++ "\x38\x0d\xdd\x13\xb3\x89\x57\x9e" ++ "\x1f\xb5\x48\x32\xc4\xd3\x9d\x1f" ++ "\x68\xab\x8d\xc6\xa8\x05\x3a\xc2" ++ "\x87\xaf\x23\xb3\xe4\x1b\xde\xb3", ++ .clen = 32 + 48, ++ }, ++}; ++ + static const struct aead_testvec hmac_sha512_aes_cbc_tv_temp[] = { + { /* RFC 3602 Case 1 */ + #ifdef __LITTLE_ENDIAN diff --git a/target/linux/generic/backport-6.12/919-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch b/target/linux/generic/backport-6.12/919-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch new file mode 100644 index 0000000000..87949eb412 --- /dev/null +++ b/target/linux/generic/backport-6.12/919-v7.1-crypto-testmgr-Add-test-vectors-for-authenc-hmac-sha.patch @@ -0,0 +1,334 @@ +From 07f1bc80c478c7198065d3896ed3685428314a9c Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Thu, 5 Mar 2026 21:08:24 +0100 +Subject: [PATCH 5/5] crypto: testmgr - Add test vectors for + authenc(hmac(sha512),rfc3686(ctr(aes))) + +Test vectors were generated starting from existing RFC3686(CTR(AES)) test +vectors and adding HMAC(SHA512) computed with software implementation. +Then, the results were double-checked on Mediatek MT7986 (safexcel). +Platform pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +Signed-off-by: Herbert Xu +--- + crypto/testmgr.c | 6 +- + crypto/testmgr.h | 291 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 296 insertions(+), 1 deletion(-) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4545,8 +4545,12 @@ static const struct alg_test_desc alg_te + .fips_allowed = 1, + }, { + .alg = "authenc(hmac(sha512),rfc3686(ctr(aes)))", +- .test = alg_test_null, ++ .generic_driver = "authenc(hmac-sha512-lib,rfc3686(ctr(aes-lib)))", ++ .test = alg_test_aead, + .fips_allowed = 1, ++ .suite = { ++ .aead = __VECS(hmac_sha512_aes_ctr_rfc3686_tv_temp) ++ } + }, { + .alg = "blake2b-160", + .test = alg_test_hash, +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -19719,6 +19719,297 @@ static const struct aead_testvec hmac_md + }, + }; + ++static const struct aead_testvec hmac_sha512_aes_ctr_rfc3686_tv_temp[] = { ++ { /* RFC 3686 Case 1 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\xae\x68\x52\xf8\x12\x10\x67\xcc" ++ "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e" ++ "\x00\x00\x00\x30", ++ .klen = 8 + 64 + 20, ++ .iv = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .assoc = "\x00\x00\x00\x00\x00\x00\x00\x00", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79" ++ "\x2d\x61\x75\xa3\x26\x13\x11\xb8" ++ "\xa4\x45\x3a\x44\x9c\xe5\x1c\xd9" ++ "\x10\x43\x51\x2e\x76\x5e\xf8\x9d" ++ "\x03\x12\x1a\x31\x00\x33\x10\xb4" ++ "\x94\x4b\x70\x84\x6c\xda\xb1\x46" ++ "\x24\xb6\x3b\x2a\xec\xd5\x67\xb8" ++ "\x65\xa2\xbd\xac\x18\xe2\xf8\x55" ++ "\xc6\x91\xb0\x92\x84\x2d\x74\x44" ++ "\xa7\xee\xc3\x44\xa0\x07\x0e\x62", ++ .clen = 16 + 64, ++ }, { /* RFC 3686 Case 2 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x40\x41\x42\x43\x44\x45\x46\x47" ++ "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" ++ "\x50\x51\x52\x53\x54\x55\x56\x57" ++ "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" ++ "\x7e\x24\x06\x78\x17\xfa\xe0\xd7" ++ "\x43\xd6\xce\x1f\x32\x53\x91\x63" ++ "\x00\x6c\xb6\xdb", ++ .klen = 8 + 64 + 20, ++ .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .assoc = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x51\x04\xa1\x06\x16\x8a\x72\xd9" ++ "\x79\x0d\x41\xee\x8e\xda\xd3\x88" ++ "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8" ++ "\xfc\xe6\x30\xdf\x91\x41\xbe\x28" ++ "\xec\x67\x0d\xb3\xbd\x98\x13\x01" ++ "\x2b\x04\x9b\xe6\x06\x67\x3c\x76" ++ "\xcd\x41\xb7\xcc\x70\x6c\x7f\xc8" ++ "\x67\xbd\x22\x39\xb2\xaa\xe8\x88" ++ "\xe0\x4f\x81\x52\xdf\xc9\xc3\xd6" ++ "\x44\xf4\x66\x33\x87\x64\x61\x02" ++ "\x02\xa2\x64\x15\x2b\xe9\x0b\x3d" ++ "\x4c\xea\xa1\xa5\xa7\xc9\xd3\x1b", ++ .clen = 32 + 64, ++ }, { /* RFC 3686 Case 3 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x14" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x22\x33\x44\x55\x66\x77\x88\x99" ++ "\xaa\xbb\xcc\xdd\xee\xff\x11\x22" ++ "\x33\x44\x55\x66\x77\x88\x99\xaa" ++ "\xbb\xcc\xdd\xee\xff\x11\x22\x33" ++ "\x44\x55\x66\x77\x88\x99\xaa\xbb" ++ "\xcc\xdd\xee\xff\x11\x22\x33\x44" ++ "\x76\x91\xbe\x03\x5e\x50\x20\xa8" ++ "\xac\x6e\x61\x85\x29\xf9\xa0\xdc" ++ "\x00\xe0\x01\x7b", ++ .klen = 8 + 64 + 20, ++ .iv = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .assoc = "\x27\x77\x7f\x3f\x4a\x17\x86\xf0", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" ++ "\x20\x21\x22\x23", ++ .plen = 36, ++ .ctext = "\xc1\xcf\x48\xa8\x9f\x2f\xfd\xd9" ++ "\xcf\x46\x52\xe9\xef\xdb\x72\xd7" ++ "\x45\x40\xa4\x2b\xde\x6d\x78\x36" ++ "\xd5\x9a\x5c\xea\xae\xf3\x10\x53" ++ "\x25\xb2\x07\x2f" ++ "\x6f\x90\xb6\xa3\x35\x43\x59\xff" ++ "\x1e\x32\xd6\xfe\xfa\x33\xf9\xf0" ++ "\x31\x2f\x03\x2d\x88\x1d\xab\xbf" ++ "\x0e\x19\x16\xd9\xf3\x98\x3e\xdd" ++ "\x0c\xec\xfe\xe8\x89\x13\x91\x15" ++ "\xf6\x61\x65\x5c\x1b\x7d\xde\xc0" ++ "\xe4\xba\x6d\x27\xe2\x89\x23\x24" ++ "\x15\x82\x37\x3d\x48\xd3\xc9\x32", ++ .clen = 36 + 64, ++ }, { /* RFC 3686 Case 4 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79" ++ "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed" ++ "\x86\x3d\x06\xcc\xfd\xb7\x85\x15" ++ "\x00\x00\x00\x48", ++ .klen = 8 + 64 + 28, ++ .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .assoc = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8" ++ "\x4e\x79\x35\xa0\x03\xcb\xe9\x28" ++ "\x25\xea\xdc\xad\x52\xb8\x0f\x70" ++ "\xe7\x39\x83\x80\x10\x3f\x18\xc4" ++ "\xf8\x59\x14\x25\x5f\xba\x20\x87" ++ "\x0b\x04\x5e\xf7\xde\x41\x39\xff" ++ "\xa2\xee\x84\x3f\x9d\x38\xfd\x17" ++ "\xc0\x66\x5e\x74\x39\xe3\xd3\xd7" ++ "\x3d\xbc\xe3\x99\x2f\xe7\xef\x37" ++ "\x61\x03\xf3\x9e\x01\xaf\xba\x9d", ++ .clen = 16 + 64, ++ }, { /* RFC 3686 Case 5 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x1c" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x40\x41\x42\x43\x44\x45\x46\x47" ++ "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" ++ "\x50\x51\x52\x53\x54\x55\x56\x57" ++ "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" ++ "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c" ++ "\x19\xe7\x34\x08\x19\xe0\xf6\x9c" ++ "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a" ++ "\x00\x96\xb0\x3b", ++ .klen = 8 + 64 + 28, ++ .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .assoc = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\x45\x32\x43\xfc\x60\x9b\x23\x32" ++ "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f" ++ "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c" ++ "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00" ++ "\x51\xa3\xe6\x1d\x23\x7d\xd1\x18" ++ "\x55\x9c\x1c\x92\x2b\xc2\xcd\xfe" ++ "\x8a\xa8\xa5\x96\x65\x2e\x9d\xdb" ++ "\x06\xd2\x1c\x57\x2b\x76\xb5\x9c" ++ "\xd4\x3e\x8b\x61\x54\x2d\x08\xe5" ++ "\xb2\xf8\x88\x20\x0c\xad\xe8\x85" ++ "\x61\x8e\x5c\xa4\x96\x2c\xe2\x7d" ++ "\x4f\xb6\x1d\xb2\x8c\xd7\xe3\x38", ++ .clen = 32 + 64, ++ }, { /* RFC 3686 Case 7 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f" ++ "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c" ++ "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3" ++ "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04" ++ "\x00\x00\x00\x60", ++ .klen = 8 + 64 + 36, ++ .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .assoc = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2", ++ .alen = 8, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7" ++ "\x56\x08\x63\xdc\x71\xe3\xe0\xc0" ++ "\x6b\x68\x0b\x99\x9a\x4d\xc8\xb9" ++ "\x35\xea\xcd\x56\x3f\x40\xa2\xb6" ++ "\x68\xda\x59\xd8\xa0\x89\xcd\x52" ++ "\xb1\x6e\xed\xc1\x42\x10\xa5\x0f" ++ "\x88\x0b\x80\xce\xc4\x67\xf0\x45" ++ "\x5d\xb2\x9e\xde\x1c\x79\x52\x0d" ++ "\xff\x75\x36\xd5\x0f\x52\x8e\xe5" ++ "\x31\x85\xcf\x1d\x31\xf8\x62\x67", ++ .clen = 16 + 64, ++ }, { /* RFC 3686 Case 8 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x24" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f" ++ "\x40\x41\x42\x43\x44\x45\x46\x47" ++ "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f" ++ "\x50\x51\x52\x53\x54\x55\x56\x57" ++ "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f" ++ "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb" ++ "\x07\x96\x36\x58\x79\xef\xf8\x86" ++ "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74" ++ "\x4b\x50\x59\x0c\x87\xa2\x38\x84" ++ "\x00\xfa\xac\x24", ++ .klen = 8 + 64 + 36, ++ .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .assoc = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75", ++ .alen = 8, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c" ++ "\x49\xee\x00\x0b\x80\x4e\xb2\xa9" ++ "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a" ++ "\x55\x30\x83\x1d\x93\x44\xaf\x1c" ++ "\x9a\xac\x38\xbd\xf3\xcf\xd5\xd0" ++ "\x09\x07\xa6\xe1\x7f\xd6\x79\x98" ++ "\x4e\x90\x0e\xc0\x3d\xa0\xf2\x12" ++ "\x52\x79\x9c\x17\xff\xb9\xb8\xe3" ++ "\x2f\x31\xcb\xbd\x63\x70\x72\x7b" ++ "\x4e\x1e\xd1\xde\xb5\x6b\x7d\x54" ++ "\x68\x56\xdd\xe5\x53\xee\x29\xd2" ++ "\x85\xa1\x73\x61\x00\xa9\x26\x8f", ++ .clen = 32 + 64, ++ }, ++}; ++ + static const struct aead_testvec hmac_sha1_des_cbc_tv_temp[] = { + { /*Generated with cryptopp*/ + #ifdef __LITTLE_ENDIAN diff --git a/target/linux/generic/pending-6.12/910-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch b/target/linux/generic/pending-6.12/910-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch new file mode 100644 index 0000000000..2d33d2ad59 --- /dev/null +++ b/target/linux/generic/pending-6.12/910-crypto-testmgr-Add-test-vectors-for-authenc-hmac-md5.patch @@ -0,0 +1,297 @@ +From dd227f442774a570ffccdfbc9536fec3b4666305 Mon Sep 17 00:00:00 2001 +From: Aleksander Jan Bajkowski +Date: Sat, 31 Jan 2026 12:35:30 +0100 +Subject: [PATCH] crypto: testmgr - Add test vectors for + authenc(hmac(md5),cbc(aes)) + +Test vectors were generated starting from existing CBC(AES) test vectors +(RFC3602, NIST SP800-38A) and adding HMAC(MD5) computed with Python +script. Then, the results were double-checked on Mediatek MT7981 (safexcel) +and NXP P2020 (talitos). Both platforms pass self-tests. + +Signed-off-by: Aleksander Jan Bajkowski +--- + crypto/testmgr.c | 7 ++ + crypto/testmgr.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 262 insertions(+) + +--- a/crypto/testmgr.c ++++ b/crypto/testmgr.c +@@ -4375,6 +4375,13 @@ static const struct alg_test_desc alg_te + .cprng = __VECS(ansi_cprng_aes_tv_template) + } + }, { ++ .alg = "authenc(hmac(md5),cbc(aes))", ++ .generic_driver = "authenc(hmac-md5-lib,cbc(aes-generic))", ++ .test = alg_test_aead, ++ .suite = { ++ .aead = __VECS(hmac_md5_aes_cbc_tv_temp) ++ } ++ }, { + .alg = "authenc(hmac(md5),cbc(des))", + .generic_driver = "authenc(hmac-md5-lib,cbc(des-generic))", + .test = alg_test_aead, +--- a/crypto/testmgr.h ++++ b/crypto/testmgr.h +@@ -17133,6 +17133,261 @@ static const struct cipher_testvec aes_c + }, + }; + ++static const struct aead_testvec hmac_md5_aes_cbc_tv_temp[] = { ++ { /* RFC 3602 Case 1 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x10" /* enc key length */ ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" ++ "\x51\x2e\x03\xd5\x34\x12\x00\x06", ++ .klen = 8 + 16 + 16, ++ .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30" ++ "\xb4\x22\xda\x80\x2c\x9f\xac\x41", ++ .assoc = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30" ++ "\xb4\x22\xda\x80\x2c\x9f\xac\x41", ++ .alen = 16, ++ .ptext = "Single block msg", ++ .plen = 16, ++ .ctext = "\xe3\x53\x77\x9c\x10\x79\xae\xb8" ++ "\x27\x08\x94\x2d\xbe\x77\x18\x1a" ++ "\x22\x10\xf2\x25\x7f\xe9\x0d\x92" ++ "\xfc\x00\x55\xb1\xd0\xb5\x3a\x74", ++ .clen = 16 + 16, ++ }, { /* RFC 3602 Case 2 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x10" /* enc key length */ ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0" ++ "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a", ++ .klen = 8 + 16 + 16, ++ .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28" ++ "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", ++ .assoc = "\x56\x2e\x17\x99\x6d\x09\x3d\x28" ++ "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58", ++ .alen = 16, ++ .ptext = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", ++ .plen = 32, ++ .ctext = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a" ++ "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a" ++ "\x75\x86\x60\x2d\x25\x3c\xff\xf9" ++ "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1" ++ "\x31\xef\xd1\x5e\x2d\x83\xde\x59" ++ "\x5c\x63\x6c\xd6\x6e\x96\x8c\x5b", ++ .clen = 32 + 16, ++ }, { /* RFC 3602 Case 3 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x10" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x6c\x3e\xa0\x47\x76\x30\xce\x21" ++ "\xa2\xce\x33\x4a\xa7\x46\xc2\xcd", ++ .klen = 8 + 16 + 16, ++ .iv = "\xc7\x82\xdc\x4c\x09\x8c\x66\xcb" ++ "\xd9\xcd\x27\xd8\x25\x68\x2c\x81", ++ .assoc = "\xc7\x82\xdc\x4c\x09\x8c\x66\xcb" ++ "\xd9\xcd\x27\xd8\x25\x68\x2c\x81", ++ .alen = 16, ++ .ptext = "This is a 48-byte message (exactly 3 AES blocks)", ++ .plen = 48, ++ .ctext = "\xd0\xa0\x2b\x38\x36\x45\x17\x53" ++ "\xd4\x93\x66\x5d\x33\xf0\xe8\x86" ++ "\x2d\xea\x54\xcd\xb2\x93\xab\xc7" ++ "\x50\x69\x39\x27\x67\x72\xf8\xd5" ++ "\x02\x1c\x19\x21\x6b\xad\x52\x5c" ++ "\x85\x79\x69\x5d\x83\xba\x26\x84" ++ "\xa1\x9e\xc5\x65\x43\xc5\x51\x70" ++ "\xb5\xc8\x38\xce\xbb\x3b\xc6\x0f", ++ .clen = 48 + 16, ++ }, { /* RFC 3602 Case 4 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x10" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x56\xe4\x7a\x38\xc5\x59\x89\x74" ++ "\xbc\x46\x90\x3d\xba\x29\x03\x49", ++ .klen = 8 + 16 + 16, ++ .iv = "\x8c\xe8\x2e\xef\xbe\xa0\xda\x3c" ++ "\x44\x69\x9e\xd7\xdb\x51\xb7\xd9", ++ .assoc = "\x8c\xe8\x2e\xef\xbe\xa0\xda\x3c" ++ "\x44\x69\x9e\xd7\xdb\x51\xb7\xd9", ++ .alen = 16, ++ .ptext = "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7" ++ "\xa8\xa9\xaa\xab\xac\xad\xae\xaf" ++ "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7" ++ "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" ++ "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7" ++ "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" ++ "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7" ++ "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf", ++ .plen = 64, ++ .ctext = "\xc3\x0e\x32\xff\xed\xc0\x77\x4e" ++ "\x6a\xff\x6a\xf0\x86\x9f\x71\xaa" ++ "\x0f\x3a\xf0\x7a\x9a\x31\xa9\xc6" ++ "\x84\xdb\x20\x7e\xb0\xef\x8e\x4e" ++ "\x35\x90\x7a\xa6\x32\xc3\xff\xdf" ++ "\x86\x8b\xb7\xb2\x9d\x3d\x46\xad" ++ "\x83\xce\x9f\x9a\x10\x2e\xe9\x9d" ++ "\x49\xa5\x3e\x87\xf4\xc3\xda\x55" ++ "\x19\x90\xcc\x2c\x6d\x76\x0f\xd6" ++ "\x6c\x54\x09\xb1\x3e\x98\x0c\x11", ++ .clen = 64 + 16, ++ }, { /* RFC 3602 Case 5 */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x10" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x90\xd3\x82\xb4\x10\xee\xba\x7a" ++ "\xd9\x38\xc4\x6c\xec\x1a\x82\xbf", ++ .klen = 8 + 16 + 16, ++ .iv = "\xe9\x6e\x8c\x08\xab\x46\x57\x63" ++ "\xfd\x09\x8d\x45\xdd\x3f\xf8\x93", ++ .assoc = "\x00\x00\x43\x21\x00\x00\x00\x01" ++ "\xe9\x6e\x8c\x08\xab\x46\x57\x63" ++ "\xfd\x09\x8d\x45\xdd\x3f\xf8\x93", ++ .alen = 24, ++ .ptext = "\x08\x00\x0e\xbd\xa7\x0a\x00\x00" ++ "\x8e\x9c\x08\x3d\xb9\x5b\x07\x00" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" ++ "\x10\x11\x12\x13\x14\x15\x16\x17" ++ "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" ++ "\x20\x21\x22\x23\x24\x25\x26\x27" ++ "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f" ++ "\x30\x31\x32\x33\x34\x35\x36\x37" ++ "\x01\x02\x03\x04\x05\x06\x07\x08" ++ "\x09\x0a\x0b\x0c\x0d\x0e\x0e\x01", ++ .plen = 80, ++ .ctext = "\xf6\x63\xc2\x5d\x32\x5c\x18\xc6" ++ "\xa9\x45\x3e\x19\x4e\x12\x08\x49" ++ "\xa4\x87\x0b\x66\xcc\x6b\x99\x65" ++ "\x33\x00\x13\xb4\x89\x8d\xc8\x56" ++ "\xa4\x69\x9e\x52\x3a\x55\xdb\x08" ++ "\x0b\x59\xec\x3a\x8e\x4b\x7e\x52" ++ "\x77\x5b\x07\xd1\xdb\x34\xed\x9c" ++ "\x53\x8a\xb5\x0c\x55\x1b\x87\x4a" ++ "\xa2\x69\xad\xd0\x47\xad\x2d\x59" ++ "\x13\xac\x19\xb7\xcf\xba\xd4\xa6" ++ "\x9f\x6f\xa4\x85\x28\xf1\xc9\xea" ++ "\xe1\xd0\x7d\x30\x4a\xd0\x81\x12", ++ .clen = 80 + 16, ++ }, { /* NIST SP800-38A F.2.3 CBC-AES192.Encrypt */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x18" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x8e\x73\xb0\xf7\xda\x0e\x64\x52" ++ "\xc8\x10\xf3\x2b\x80\x90\x79\xe5" ++ "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b", ++ .klen = 8 + 16 + 24, ++ .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", ++ .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", ++ .alen = 16, ++ .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" ++ "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" ++ "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" ++ "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" ++ "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" ++ "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" ++ "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" ++ "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", ++ .plen = 64, ++ .ctext = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d" ++ "\x71\x78\x18\x3a\x9f\xa0\x71\xe8" ++ "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4" ++ "\xe5\xe7\x38\x76\x3f\x69\x14\x5a" ++ "\x57\x1b\x24\x20\x12\xfb\x7a\xe0" ++ "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0" ++ "\x08\xb0\xe2\x79\x88\x59\x88\x81" ++ "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd" ++ "\xc3\x46\xe5\x2c\x07\x27\x50\xca" ++ "\x50\x4a\x83\x5f\x72\xd9\x76\x8d", ++ .clen = 64 + 16, ++ }, { /* NIST SP800-38A F.2.5 CBC-AES256.Encrypt */ ++#ifdef __LITTLE_ENDIAN ++ .key = "\x08\x00" /* rta length */ ++ "\x01\x00" /* rta type */ ++#else ++ .key = "\x00\x08" /* rta length */ ++ "\x00\x01" /* rta type */ ++#endif ++ "\x00\x00\x00\x20" /* enc key length */ ++ "\x11\x22\x33\x44\x55\x66\x77\x88" ++ "\x99\xaa\xbb\xcc\xdd\xee\xff\x11" ++ "\x60\x3d\xeb\x10\x15\xca\x71\xbe" ++ "\x2b\x73\xae\xf0\x85\x7d\x77\x81" ++ "\x1f\x35\x2c\x07\x3b\x61\x08\xd7" ++ "\x2d\x98\x10\xa3\x09\x14\xdf\xf4", ++ .klen = 8 + 16 + 32, ++ .iv = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", ++ .assoc = "\x00\x01\x02\x03\x04\x05\x06\x07" ++ "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", ++ .alen = 16, ++ .ptext = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96" ++ "\xe9\x3d\x7e\x11\x73\x93\x17\x2a" ++ "\xae\x2d\x8a\x57\x1e\x03\xac\x9c" ++ "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51" ++ "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11" ++ "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef" ++ "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17" ++ "\xad\x2b\x41\x7b\xe6\x6c\x37\x10", ++ .plen = 64, ++ .ctext = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba" ++ "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6" ++ "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d" ++ "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d" ++ "\x39\xf2\x33\x69\xa9\xd9\xba\xcf" ++ "\xa5\x30\xe2\x63\x04\x23\x14\x61" ++ "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc" ++ "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b" ++ "\x59\x62\x06\x71\x57\xdf\x18\x15" ++ "\x32\x02\xfa\xce\x2c\xd2\x1a\x8d", ++ .clen = 64 + 16, ++ }, ++}; ++ + static const struct aead_testvec hmac_md5_ecb_cipher_null_tv_template[] = { + { /* Input data from RFC 2410 Case 1 */ + #ifdef __LITTLE_ENDIAN