crypto: Introduce ARIA symmetric cipher algorithm
Subsystems (2)
cover crypto: Introduce ARIA symmetric cipher algorithm
This patchset adds a new ARIA(RFC 5794) symmetric cipher algorithm.
Like SEED, the ARIA is a standard cipher algorithm in South Korea. Especially Government and Banking industry have been using this algorithm. So the implementation of ARIA will be useful for them and network vendors.
Usecases of this algorithm are TLS[1], and IPSec.
It would be very useful for them if it implements kTLS for ARIA.
It is tested in x86 and MIPS with the tcrypt module.
The first patch is an implementation of ARIA algorithm. The second patch adds tests for ARIA.
[1] https://datatracker.ietf.org/doc/html/rfc6209
Taehee Yoo (2):
crypto: Implement ARIA symmetric cipher algorithm
crypto: add ARIA testmgr tests
crypto/Kconfig | 15 + crypto/Makefile | 1 + crypto/aria.c | 288 +++++ crypto/tcrypt.c | 38 +- crypto/testmgr.c | 31 + crypto/testmgr.h | 2860 +++++++++++++++++++++++++++++++++++++++++ include/crypto/aria.h | 461 +++++++ 7 files changed, 3693 insertions(+), 1 deletion(-) create mode 100644 crypto/aria.c create mode 100644 include/crypto/aria.h
Signature · 1 line
2.17.1
PATCH 1/2 crypto: Implement ARIA symmetric cipher algorithm
ARIA(RFC 5794) is a symmetric block cipher algorithm.
This algorithm is being used widely in South Korea as a standard cipher algorithm.
This code is written based on the ARIA implementation of OpenSSL. The OpenSSL code is based on the distributed source code[1] by KISA.
ARIA has three key sizes and corresponding rounds.
ARIA128: 12 rounds.
ARIA192: 14 rounds.
ARIA245: 16 rounds.
[1] https://seed.kisa.or.kr/kisa/Board/19/detailView.do (Korean)
--- crypto/Kconfig | 15 ++ crypto/Makefile | 1 + crypto/aria.c | 288 ++++++++++++++++++++++++++ include/crypto/aria.h | 461 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 765 insertions(+) create mode 100644 crypto/aria.c create mode 100644 include/crypto/aria.h
crypto/Kconfig +15 -0
@@ -1489,6 +1489,21 @@ config CRYPTO_SEED See also: <http://www.kisa.or.kr/kisa/seed/jsp/seed_eng.jsp> +config CRYPTO_ARIA + tristate "ARIA cipher algorithm" + select CRYPTO_ALGAPI + help + ARIA cipher algorithm (RFC5794). + + ARIA is a standard encryption algorithm of the Republic of Korea. + The ARIA specifies three key sizes and rounds. + 128-bit: 12 rounds. + 192-bit: 14 rounds. + 256-bit: 16 rounds. + + See also: + <https://seed.kisa.or.kr/kisa/algorithm/EgovAriaInfo.do> + config CRYPTO_SERPENT tristate "Serpent cipher algorithm" select CRYPTO_ALGAPI
crypto/Makefile +1 -0
@@ -147,6 +147,7 @@ obj-$(CONFIG_CRYPTO_TEA) += tea.o obj-$(CONFIG_CRYPTO_KHAZAD) += khazad.o obj-$(CONFIG_CRYPTO_ANUBIS) += anubis.o obj-$(CONFIG_CRYPTO_SEED) += seed.o +obj-$(CONFIG_CRYPTO_ARIA) += aria.o obj-$(CONFIG_CRYPTO_CHACHA20) += chacha_generic.o obj-$(CONFIG_CRYPTO_POLY1305) += poly1305_generic.o obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
crypto/aria.c new file +288 -0
288 lines not on this page · raw message
include/crypto/aria.h new file +461 -0
461 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/2 crypto: add ARIA testmgr tests
In reply to Taehee YooIt contains ARIA ecb(aria), cbc(aria), cfb(aria), ctr(aria), and gcm(aria). ecb testvector is from RFC standard.
cbc, cfb, and ctr testvectors are from KISA[1], who developed ARIA algorithm.
gcm(aria) is from openssl test vector.
[1] https://seed.kisa.or.kr/kisa/kcmvp/EgovVerification.do (Korean)
--- crypto/tcrypt.c | 38 +- crypto/testmgr.c | 31 + crypto/testmgr.h | 2860 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2928 insertions(+), 1 deletion(-)
crypto/tcrypt.c +37 -1
@@ -71,7 +71,7 @@ static const char *check[] = {"blowfish" ,"twofish" ,"serpent" ,"sha384" ,"sha512" ,"md4" ,"aes" ,"cast6" ,"arc4" ,"michael_mic" ,"deflate" ,"crc32c" ,"tea" ,"xtea" ,"khazad" ,"wp512" ,"wp384" ,"wp256" ,"xeta" ,"fcrypt" , -"camellia" ,"seed" ,"rmd160" , +"camellia" ,"seed" ,"rmd160" ,"aria" ,"lzo" ,"lzo-rle" ,"cts" ,"sha3-224" ,"sha3-256" ,"sha3-384" ,"sha3-512" ,"streebog256" ,"streebog512" ,NULL
@@ -1729,6 +1729,10 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) ret +=tcrypt_test ("ccm(sm4)" );break ; +case 57 : + ret +=tcrypt_test ("gcm(aria)" ); +break ; +case 100 : ret +=tcrypt_test ("hmac(md5)" );break ;
@@ -1865,6 +1869,12 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) ret +=tcrypt_test ("cfb(sm4)" ); ret +=tcrypt_test ("ctr(sm4)" );break ; +case 192 : + ret +=tcrypt_test ("ecb(aria)" ); + ret +=tcrypt_test ("cbc(aria)" ); + ret +=tcrypt_test ("cfb(aria)" ); + ret +=tcrypt_test ("ctr(aria)" ); +break ;case 200 :test_cipher_speed ("ecb(aes)" ,ENCRYPT , sec,NULL ,0 , speed_template_16_24_32);
@@ -2186,6 +2196,32 @@ static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb) 16, 16, aead_speed_template_19, num_mb);break ; +case 226 : +test_cipher_speed ("ecb(aria)" ,ENCRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("ecb(aria)" ,DECRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("cbc(aria)" ,ENCRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("cbc(aria)" ,DECRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("cfb(aria)" ,ENCRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("cfb(aria)" ,DECRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("ctr(aria)" ,ENCRYPT , sec,NULL ,0 , + speed_template_16_24_32); +test_cipher_speed ("ctr(aria)" ,DECRYPT , sec,NULL ,0 , + speed_template_16_24_32); +break ; + +case 227 : +test_aead_speed ("gcm(aria)" ,ENCRYPT , sec, +NULL ,0 ,16 ,8 , speed_template_16_24_32); +test_aead_speed ("gcm(aria)" ,DECRYPT , sec, +NULL ,0 ,16 ,8 , speed_template_16_24_32); +break ; +case 300 :if (alg) {test_hash_speed (alg, sec, generic_hash_speed_template);
crypto/testmgr.c +31 -0
@@ -4412,6 +4412,12 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .cipher =__VECS (anubis_cbc_tv_template) }, + }, { + .alg = "cbc(aria)", + .test = alg_test_skcipher, + .suite = { + .cipher =__VECS (aria_cbc_tv_template) + }, }, { .alg = "cbc(blowfish)", .test = alg_test_skcipher,
@@ -4529,6 +4535,12 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .cipher =__VECS (aes_cfb_tv_template) }, + }, { + .alg = "cfb(aria)", + .test = alg_test_skcipher, + .suite = { + .cipher =__VECS (aria_cfb_tv_template) + }, }, { .alg = "cfb(sm4)", .test = alg_test_skcipher,
@@ -4598,6 +4610,12 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .cipher = __VECS(aes_ctr_tv_template) } + }, { + .alg = "ctr(aria)", + .test = alg_test_skcipher, + .suite = { + .cipher = __VECS(aria_ctr_tv_template) + } }, { .alg = "ctr(blowfish)", .test = alg_test_skcipher,
@@ -4858,6 +4876,12 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .cipher = __VECS(arc4_tv_template) } + }, { + .alg = "ecb(aria)", + .test = alg_test_skcipher, + .suite = { + .cipher = __VECS(aria_tv_template) + } }, { .alg = "ecb(blowfish)", .test = alg_test_skcipher,
@@ -5074,6 +5098,13 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .aead = __VECS(aes_gcm_tv_template) } + }, { + .alg = "gcm(aria)", + .generic_driver = "gcm_base(ctr(aria-generic),ghash-generic)", + .test = alg_test_aead, + .suite = { + .aead = __VECS(aria_gcm_tv_template) + } }, { .alg = "gcm(sm4)", .generic_driver = "gcm_base(ctr(sm4-generic),ghash-generic)",
crypto/testmgr.h +2860 -0
2,866 lines not on this page · raw message
Signature · 1 line
2.17.1
Herbert Xu
maintainerQuoted 8 lines · Taehee Yoo
This patchset adds a new ARIA(RFC 5794) symmetric cipher algorithm.
Like SEED, the ARIA is a standard cipher algorithm in South Korea. Especially Government and Banking industry have been using this algorithm. So the implementation of ARIA will be useful for them and network vendors.
Usecases of this algorithm are TLS[1], and IPSec.
It would be very useful for them if it implements kTLS for ARIA.
You haven't added any glue to use this for IPsec. Unless there is an in-kernel user we won't add any new algorithms.
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
On 6/30/22 15:39, Herbert Xu wrote:
Hi Herbert,
Thank you so much for your review!
Quoted 7 lines
Quoted 6 lines · Taehee Yoo
This patchset adds a new ARIA(RFC 5794) symmetric cipher algorithm.
Like SEED, the ARIA is a standard cipher algorithm in South Korea. Especially Government and Banking industry have been using this algorithm. So the implementation of ARIA will be useful for them and network vendors.
Quoted 7 lines
Quoted 2 lines
Usecases of this algorithm are TLS[1], and IPSec.
It would be very useful for them if it implements kTLS for ARIA.You haven't added any glue to use this for IPsec. Unless there is an in-kernel user we won't add any new algorithms.
Thanks,
Unfortunately, IPsec draft[1] is expired so I think adding the aria-IPsec feature is not our rule as far as I know even if there are already users in South Korea. So, my plan is to add the kTLS feature because aria-TLS[2] is now standard.
So, Is it okay to add the aria-kTLS feature into the v2 patch, instead of aria-IPsec?
[1] https://datatracker.ietf.org/doc/draft-nsri-ipsecme-aria-ipsec/
[2] https://datatracker.ietf.org/doc/html/rfc6209
Thanks,
Taehee Yoo
Herbert Xu
maintainerQuoted 4 lines · Taehee Yoo
So, my plan is to add the kTLS feature because aria-TLS[2] is now standard. So, Is it okay to add the aria-kTLS feature into the v2 patch, instead of aria-IPsec?
Sure. As long as the kTLS people are happy to add this then it's good to go.
Cheers,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Quoted 10 lines · Herbert Xu
Quoted 4 lines · Taehee Yoo
So, my plan is to add the kTLS feature because aria-TLS[2] is now standard. So, Is it okay to add the aria-kTLS feature into the v2 patch, instead of aria-IPsec?
Sure. As long as the kTLS people are happy to add this then it's good to go.
Cheers,
I will add aria-kTLS feature into the v2 patch and I will send it to both the crypto and netdev mailing list after some tests.
Thanks a lot!
Taehee Yoo