From 46a0547f9f2a07169c7285e098539ccc7c003dcc Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Mon, 17 Jul 2017 09:29:52 +0100 Subject: [PATCH] cryptodev: rename ADD field Additional Authenticated Data (AAD) is called "aad" in most places of cryptodev, but it was called "add_auth_data" in the AEAD transform transform (aead_xform). This field is renamed to "aad_length" in order to keep consistency. Signed-off-by: Pablo de Lara Acked-by: Fiona Trahe --- app/test-crypto-perf/cperf_ops.c | 2 +- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 2 +- drivers/crypto/qat/qat_adf/qat_algs.h | 2 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 8 ++++---- drivers/crypto/qat/qat_crypto.c | 4 ++-- examples/ipsec-secgw/sa.c | 4 ++-- examples/l2fwd-crypto/main.c | 4 ++-- lib/librte_cryptodev/rte_crypto_sym.h | 2 +- test/test/test_cryptodev.c | 4 ++-- test/test/test_cryptodev_perf.c | 4 ++-- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c index a5bf09be94..88fb97258f 100644 --- a/app/test-crypto-perf/cperf_ops.c +++ b/app/test-crypto-perf/cperf_ops.c @@ -509,7 +509,7 @@ cperf_create_session(struct rte_mempool *sess_mp, aead_xform.aead.iv.length = test_vector->aead_iv.length; aead_xform.aead.digest_length = options->digest_sz; - aead_xform.aead.add_auth_data_length = + aead_xform.aead.aad_length = options->aead_aad_sz; /* Create crypto session */ diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index 91c3801c2b..e051624243 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -102,7 +102,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops, key_length = aead_xform->aead.key.length; key = aead_xform->aead.key.data; - sess->aad_length = aead_xform->aead.add_auth_data_length; + sess->aad_length = aead_xform->aead.aad_length; digest_length = aead_xform->aead.digest_length; } else { GCM_LOG_ERR("Wrong xform type, has to be AEAD or authentication"); diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 9f2c0d9de5..f4229376de 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1193,7 +1193,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev, session->digest_length = aead_xform->digest_length; session->aead_key.length = aead_xform->key.length; - ctxt->auth_only_len = aead_xform->add_auth_data_length; + ctxt->auth_only_len = aead_xform->aad_length; aeaddata.key = (uint64_t)session->aead_key.data; aeaddata.keylen = session->aead_key.length; diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index d943d72bbc..c7c520f17f 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -458,7 +458,7 @@ openssl_set_session_aead_parameters(struct openssl_session *sess, return -EINVAL; } - sess->auth.aad_length = xform->aead.add_auth_data_length; + sess->auth.aad_length = xform->aead.aad_length; sess->auth.digest_length = xform->aead.digest_length; return 0; diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index c2803255f0..2c8e03c0a2 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -150,7 +150,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cd, int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, uint8_t *authkey, uint32_t authkeylen, - uint32_t add_auth_data_length, + uint32_t aad_length, uint32_t digestsize, unsigned int operation); diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 7c753e4f57..2d16c9e209 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -665,7 +665,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, uint8_t *authkey, uint32_t authkeylen, - uint32_t add_auth_data_length, + uint32_t aad_length, uint32_t digestsize, unsigned int operation) { @@ -814,14 +814,14 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, * in big-endian format. This field is 8 bytes */ auth_param->u2.aad_sz = - RTE_ALIGN_CEIL(add_auth_data_length, 16); + RTE_ALIGN_CEIL(aad_length, 16); auth_param->hash_state_sz = (auth_param->u2.aad_sz) >> 3; aad_len = (uint32_t *)(cdesc->cd_cur_ptr + ICP_QAT_HW_GALOIS_128_STATE1_SZ + ICP_QAT_HW_GALOIS_H_SZ); - *aad_len = rte_bswap32(add_auth_data_length); - cdesc->aad_len = add_auth_data_length; + *aad_len = rte_bswap32(aad_length); + cdesc->aad_len = aad_length; break; case ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2: qat_proto_flag = QAT_CRYPTO_PROTO_FLAG_SNOW3G; diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 9c5e08ce9c..ec481ae04b 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -744,7 +744,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform, if (qat_alg_aead_session_create_content_desc_auth(session, aead_xform->key.data, aead_xform->key.length, - aead_xform->add_auth_data_length, + aead_xform->aad_length, aead_xform->digest_length, RTE_CRYPTO_AUTH_OP_GENERATE)) goto error_out; @@ -757,7 +757,7 @@ qat_crypto_sym_configure_session_aead(struct rte_crypto_sym_xform *xform, if (qat_alg_aead_session_create_content_desc_auth(session, aead_xform->key.data, aead_xform->key.length, - aead_xform->add_auth_data_length, + aead_xform->aad_length, aead_xform->digest_length, RTE_CRYPTO_AUTH_OP_VERIFY)) goto error_out; diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index c6fca93a7c..7be0e62840 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -720,7 +720,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], sa_ctx->xf[idx].a.next = NULL; sa_ctx->xf[idx].a.aead.iv.offset = IV_OFFSET; sa_ctx->xf[idx].a.aead.iv.length = iv_length; - sa_ctx->xf[idx].a.aead.add_auth_data_length = + sa_ctx->xf[idx].a.aead.aad_length = sa->aad_len; sa_ctx->xf[idx].a.aead.digest_length = sa->digest_len; @@ -735,7 +735,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], sa_ctx->xf[idx].a.next = NULL; sa_ctx->xf[idx].a.aead.iv.offset = IV_OFFSET; sa_ctx->xf[idx].a.aead.iv.length = iv_length; - sa_ctx->xf[idx].a.aead.add_auth_data_length = + sa_ctx->xf[idx].a.aead.aad_length = sa->aad_len; sa_ctx->xf[idx].a.aead.digest_length = sa->digest_len; diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 71cb1337bf..84b727bc0c 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -765,7 +765,7 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) port_cparams[i].aead_algo = options->aead_xform.aead.algo; port_cparams[i].digest_length = options->aead_xform.aead.digest_length; - if (options->aead_xform.aead.add_auth_data_length) { + if (options->aead_xform.aead.aad_length) { port_cparams[i].aad.data = options->aad.data; port_cparams[i].aad.phys_addr = options->aad.phys_addr; port_cparams[i].aad.length = options->aad.length; @@ -2082,7 +2082,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports, } else options->aad.length = cap->sym.auth.aad_size.min; - options->aead_xform.aead.add_auth_data_length = + options->aead_xform.aead.aad_length = options->aad.length; /* Check if digest size is supported by the algorithm. */ diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index 27439af7e7..ea58cef79e 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -426,7 +426,7 @@ struct rte_crypto_aead_xform { uint16_t digest_length; - uint16_t add_auth_data_length; + uint16_t aad_length; /**< The length of the additional authenticated data (AAD) in bytes. */ }; diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index d998cdd0ab..32d65ce944 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -4810,7 +4810,7 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_aead_operation op, ut_params->aead_xform.aead.iv.offset = IV_OFFSET; ut_params->aead_xform.aead.iv.length = iv_len; ut_params->aead_xform.aead.digest_length = auth_len; - ut_params->aead_xform.aead.add_auth_data_length = aad_len; + ut_params->aead_xform.aead.aad_length = aad_len; TEST_HEXDUMP(stdout, "key:", key, key_len); @@ -4848,7 +4848,7 @@ create_gcm_xforms(struct rte_crypto_op *op, sym_op->xform->aead.iv.offset = IV_OFFSET; sym_op->xform->aead.iv.length = iv_len; sym_op->xform->aead.digest_length = auth_len; - sym_op->xform->aead.add_auth_data_length = aad_len; + sym_op->xform->aead.aad_length = aad_len; TEST_HEXDUMP(stdout, "key:", key, key_len); diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c index 8febd1a203..3b57e6d017 100644 --- a/test/test/test_cryptodev_perf.c +++ b/test/test/test_cryptodev_perf.c @@ -2881,7 +2881,7 @@ test_perf_create_openssl_session(uint8_t dev_id, enum chain_mode chain, case RTE_CRYPTO_AEAD_AES_GCM: aead_xform.aead.key.data = aes_key; aead_xform.aead.iv.length = AES_CIPHER_IV_LENGTH; - aead_xform.aead.add_auth_data_length = AES_GCM_AAD_LENGTH; + aead_xform.aead.aad_length = AES_GCM_AAD_LENGTH; aead_xform.aead.digest_length = get_aead_digest_length(aead_algo); break; default: @@ -4267,7 +4267,7 @@ test_perf_create_session(uint8_t dev_id, struct perf_test_params *pparams) aead_xform.aead.key.length = pparams->session_attrs->key_aead_len; aead_xform.aead.iv.length = pparams->session_attrs->iv_len; aead_xform.aead.iv.offset = IV_OFFSET; - aead_xform.aead.add_auth_data_length = pparams->session_attrs->aad_len; + aead_xform.aead.aad_length = pparams->session_attrs->aad_len; aead_xform.aead.digest_length = pparams->session_attrs->digest_len; test_crypto_session = rte_cryptodev_sym_session_create(ts_params->sess_mp); -- 2.20.1