1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2021 Intel Corporation 3 */ 4 5 #ifndef _PMD_CHACHA_POLY_PRIV_H_ 6 #define _PMD_CHACHA_POLY_PRIV_H_ 7 8 #include "ipsec_mb_private.h" 9 10 #define CHACHA20_POLY1305_IV_LENGTH 12 11 #define CHACHA20_POLY1305_DIGEST_LENGTH 16 12 #define CHACHA20_POLY1305_KEY_SIZE 32 13 14 static const 15 struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = { 16 {/* CHACHA20-POLY1305 */ 17 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, 18 {.sym = { 19 .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD, 20 {.aead = { 21 .algo = RTE_CRYPTO_AEAD_CHACHA20_POLY1305, 22 .block_size = 64, 23 .key_size = { 24 .min = 32, 25 .max = 32, 26 .increment = 0}, 27 .digest_size = { 28 .min = 16, 29 .max = 16, 30 .increment = 0}, 31 .aad_size = { 32 .min = 0, 33 .max = 240, 34 .increment = 1}, 35 .iv_size = { 36 .min = 12, 37 .max = 12, 38 .increment = 0}, 39 }, 40 } 41 },} 42 }, 43 RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() 44 }; 45 46 uint8_t pmd_driver_id_chacha20_poly1305; 47 48 /** CHACHA20 POLY1305 private session structure */ 49 struct chacha20_poly1305_session { 50 struct { 51 uint16_t length; 52 uint16_t offset; 53 } iv; 54 /**< IV parameters */ 55 uint16_t aad_length; 56 /**< AAD length */ 57 uint16_t req_digest_length; 58 /**< Requested digest length */ 59 uint16_t gen_digest_length; 60 /**< Generated digest length */ 61 uint8_t key[CHACHA20_POLY1305_KEY_SIZE]; 62 enum ipsec_mb_operation op; 63 } __rte_cache_aligned; 64 65 struct chacha20_poly1305_qp_data { 66 struct chacha20_poly1305_context_data chacha20_poly1305_ctx_data; 67 uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH]; 68 /**< Buffer used to store the digest generated 69 * by the driver when verifying a digest provided 70 * by the user (using authentication verify operation) 71 */ 72 }; 73 74 #endif /* _PMD_CHACHA_POLY_PRIV_H_ */ 75