From: Arek Kusztal Date: Mon, 13 Jan 2020 10:43:47 +0000 (+0100) Subject: cryptodev: add Chacha20-Poly1305 AEAD algorithm X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6c9f3b347e21510aa46251d69ab4c809b3ec1261;p=dpdk.git cryptodev: add Chacha20-Poly1305 AEAD algorithm This patch adds Chacha20-Poly1305 AEAD algorithm to Cryptodev. Signed-off-by: Arek Kusztal Acked-by: Fiona Trahe Acked-by: Anoob Joseph Acked-by: Akhil Goyal --- diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini index b7f9a0a325..2a3ff48061 100644 --- a/doc/guides/cryptodevs/features/default.ini +++ b/doc/guides/cryptodevs/features/default.ini @@ -93,12 +93,13 @@ SHA3_512 HMAC = ; Supported AEAD algorithms of a default crypto driver. ; [AEAD] -AES GCM (128) = -AES GCM (192) = -AES GCM (256) = -AES CCM (128) = -AES CCM (192) = -AES CCM (256) = +AES GCM (128) = +AES GCM (192) = +AES GCM (256) = +AES CCM (128) = +AES CCM (192) = +AES CCM (256) = +CHACHA20-POLY1305 = ; ; Supported Asymmetric algorithms of a default crypto driver. ; diff --git a/doc/guides/rel_notes/release_20_02.rst b/doc/guides/rel_notes/release_20_02.rst index 9cc2571681..96a077515a 100644 --- a/doc/guides/rel_notes/release_20_02.rst +++ b/doc/guides/rel_notes/release_20_02.rst @@ -61,6 +61,10 @@ New Features A new API has been added to wait for a memory location to be updated with a 16-bit, 32-bit, 64-bit value. +* **Added algorithms to cryptodev API.** + + * Chacha20-Poly1305 AEAD algorithm can now be supported in cryptodev. + Removed Items ------------- diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index ffa038dc40..bc356f6ff0 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -348,6 +348,8 @@ enum rte_crypto_aead_algorithm { /**< AES algorithm in CCM mode. */ RTE_CRYPTO_AEAD_AES_GCM, /**< AES algorithm in GCM mode. */ + RTE_CRYPTO_AEAD_CHACHA20_POLY1305, + /**< Chacha20 cipher with poly1305 authenticator */ RTE_CRYPTO_AEAD_LIST_END }; @@ -391,6 +393,11 @@ struct rte_crypto_aead_xform { * be allocated, even though the length field will * have a value less than this. * + * - For Chacha20-Poly1305 it is 96-bit nonce. + * PMD sets initial counter for Poly1305 key generation + * part to 0 and for Chacha20 encryption to 1 as per + * rfc8439 2.8. AEAD construction. + * * For optimum performance, the data pointed to SHOULD * be 8-byte aligned. */ @@ -407,6 +414,8 @@ struct rte_crypto_aead_xform { * * - For CCM mode, this is the length of the nonce, * which can be in the range 7 to 13 inclusive. + * + * - For Chacha20-Poly1305 this field is always 12. */ } iv; /**< Initialisation vector parameters */ diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 89aa2ed3e2..410520f991 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -151,6 +151,7 @@ const char * rte_crypto_aead_algorithm_strings[] = { [RTE_CRYPTO_AEAD_AES_CCM] = "aes-ccm", [RTE_CRYPTO_AEAD_AES_GCM] = "aes-gcm", + [RTE_CRYPTO_AEAD_CHACHA20_POLY1305] = "chacha20-poly1305" }; /**