From: Akhil Goyal <gakhil@marvell.com>
To: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: Anoob Joseph <anoobj@marvell.com>,
Fan Zhang <roy.fan.zhang@intel.com>,
Brian Dooley <brian.dooley@intel.com>,
Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: RE: [v2 3/7] examples/fips_validation: add function to calculate SHA hash size
Date: Fri, 7 Oct 2022 17:52:57 +0000 [thread overview]
Message-ID: <CO6PR18MB4484C12D8C1A0AC348E8BA24D85F9@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <dc3dd27ca48a2929bda27165d3f8fb0f04645a3b.1664263264.git.gmuthukrishn@marvell.com>
> Subject: [v2 3/7] examples/fips_validation: add function to calculate SHA hash
> size
>
> Add function to calculate hash size for a given SHA hash algorithm.
>
> Fixes: d5c247145c2 ("examples/fips_validation: add parsing for SHA")
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> Acked-by: Brian Dooley <brian.dooley@intel.com>
>
> ---
This patch caused a build failure for cross compile.
[713/820] Compiling C object 'examples/c590b3c@@dpdk-fips_validation@exe/fips_validation_fips_validation_sha.c.o'.
../examples/fips_validation/fips_validation_sha.c: In function 'parse_test_sha_hash_size':
../examples/fips_validation/fips_validation_sha.c:44:10: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
44 | ret = atoi(phsc[i].str);
| ^~~~
../examples/fips_validation/fips_validation_sha.c:44:10: error: nested extern declaration of 'atoi' [-Wnested-externs]
Added include file in fips_validation_sha.c
#include <stdlib.h>
> v2:
> - fixed include file
> ---
> examples/fips_validation/fips_validation.h | 1 +
> .../fips_validation/fips_validation_sha.c | 39 ++++++++++++-------
> 2 files changed, 25 insertions(+), 15 deletions(-)
>
> diff --git a/examples/fips_validation/fips_validation.h
> b/examples/fips_validation/fips_validation.h
> index a6288e17e5..6e5f2fce75 100644
> --- a/examples/fips_validation/fips_validation.h
> +++ b/examples/fips_validation/fips_validation.h
> @@ -374,4 +374,5 @@ int prepare_gcm_xform(struct rte_crypto_sym_xform
> *xform);
>
> int prepare_gmac_xform(struct rte_crypto_sym_xform *xform);
>
> +int parse_test_sha_hash_size(enum rte_crypto_auth_algorithm algo);
> #endif
> diff --git a/examples/fips_validation/fips_validation_sha.c
> b/examples/fips_validation/fips_validation_sha.c
> index 75b073c15d..cac2a25e6c 100644
> --- a/examples/fips_validation/fips_validation_sha.c
> +++ b/examples/fips_validation/fips_validation_sha.c
> @@ -33,6 +33,22 @@ struct plain_hash_size_conversion {
> {"64", RTE_CRYPTO_AUTH_SHA512},
> };
>
> +int
> +parse_test_sha_hash_size(enum rte_crypto_auth_algorithm algo)
> +{
> + int ret = -EINVAL;
> + uint8_t i;
> +
> + for (i = 0; i < RTE_DIM(phsc); i++) {
> + if (phsc[i].algo == algo) {
> + ret = atoi(phsc[i].str);
> + break;
> + }
> + }
> +
> + return ret;
> +}
> +
> static int
> parse_interim_algo(__rte_unused const char *key,
> char *text,
> @@ -212,6 +228,7 @@ parse_test_sha_json_algorithm(void)
> json_t *algorithm_object;
> const char *algorithm_str;
> uint32_t i;
> + int sz;
>
> algorithm_object = json_object_get(json_info.json_vector_set,
> "algorithm");
> algorithm_str = json_string_value(algorithm_object);
> @@ -226,23 +243,15 @@ parse_test_sha_json_algorithm(void)
> if (i == RTE_DIM(json_algorithms))
> return -1;
>
> - for (i = 0; i < RTE_DIM(phsc); i++) {
> - if (info.interim_info.sha_data.algo == phsc[i].algo) {
> - vec.cipher_auth.digest.len = atoi(phsc[i].str);
> - free(vec.cipher_auth.digest.val);
> - vec.cipher_auth.digest.val = calloc(1,
> vec.cipher_auth.digest.len);
> - if (vec.cipher_auth.digest.val == NULL)
> - return -1;
> -
> - break;
> - }
> - }
> + sz = parse_test_sha_hash_size(info.interim_info.sha_data.algo);
> + if (sz < 0)
> + return -1;
>
> - if (i == RTE_DIM(phsc)) {
> - free(vec.cipher_auth.digest.val);
> - vec.cipher_auth.digest.val = NULL;
> + free(vec.cipher_auth.digest.val);
> + vec.cipher_auth.digest.len = sz;
> + vec.cipher_auth.digest.val = calloc(1, sz);
> + if (vec.cipher_auth.digest.val == NULL)
> return -1;
> - }
>
> return 0;
> }
> --
> 2.25.1
next prev parent reply other threads:[~2022-10-07 17:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 11:57 [PATCH v1 0/5] FIPS asymmetric validation Gowrishankar Muthukrishnan
2022-08-12 11:57 ` [PATCH v1 1/5] examples/fips_validation: fix parsing test group info Gowrishankar Muthukrishnan
2022-08-12 11:57 ` [PATCH v1 2/5] examples/fips_validation: add interim parse writeback Gowrishankar Muthukrishnan
2022-08-12 11:57 ` [PATCH v1 3/5] examples/fips_validation: add function to calculate SHA hash size Gowrishankar Muthukrishnan
2022-08-12 11:57 ` [PATCH v1 4/5] examples/fips_validation: fix buffer size to parse JSON string Gowrishankar Muthukrishnan
2022-08-12 11:57 ` [PATCH v1 5/5] examples/fips_validation: add asymmetric validation Gowrishankar Muthukrishnan
2022-09-23 16:29 ` [PATCH v1 0/5] FIPS " Dooley, Brian
2022-09-27 7:26 ` [v2 0/7] " Gowrishankar Muthukrishnan
2022-09-27 7:26 ` [v2 1/7] examples/fips_validation: fix parsing test group info Gowrishankar Muthukrishnan
2022-09-27 7:26 ` [v2 2/7] examples/fips_validation: add interim parse writeback Gowrishankar Muthukrishnan
2022-09-27 7:26 ` [v2 3/7] examples/fips_validation: add function to calculate SHA hash size Gowrishankar Muthukrishnan
2022-10-07 17:52 ` Akhil Goyal [this message]
2022-09-27 7:26 ` [v2 4/7] examples/fips_validation: fix buffer size to parse JSON string Gowrishankar Muthukrishnan
2022-09-27 7:26 ` [v2 5/7] examples/fips_validation: add asymmetric validation Gowrishankar Muthukrishnan
2022-09-27 7:26 ` [v2 6/7] examples/fips_validation: encode digest with hash OID Gowrishankar Muthukrishnan
2022-09-27 7:26 ` [v2 7/7] examples/fips_validation: randomize message for conformance test Gowrishankar Muthukrishnan
2022-10-07 9:52 ` [v2 0/7] FIPS asymmetric validation Akhil Goyal
2022-10-11 9:26 ` [v3 0/3] " Gowrishankar Muthukrishnan
2022-10-11 9:26 ` [v3 1/3] examples/fips_validation: add " Gowrishankar Muthukrishnan
2022-10-11 9:26 ` [v3 2/3] examples/fips_validation: encode digest with hash OID Gowrishankar Muthukrishnan
2022-10-11 9:26 ` [v3 3/3] examples/fips_validation: randomize message for conformance test Gowrishankar Muthukrishnan
2022-10-11 15:37 ` [v3 0/3] FIPS asymmetric validation Akhil Goyal
2022-10-11 16:08 ` [v4 " Gowrishankar Muthukrishnan
2022-10-11 16:08 ` [v4 1/3] examples/fips_validation: add " Gowrishankar Muthukrishnan
2022-10-11 16:08 ` [v4 2/3] examples/fips_validation: encode digest with hash OID Gowrishankar Muthukrishnan
2022-10-11 16:08 ` [v4 3/3] examples/fips_validation: randomize message for conformance test Gowrishankar Muthukrishnan
2022-10-12 3:56 ` [v5 0/3] FIPS asymmetric validation Gowrishankar Muthukrishnan
2022-10-12 3:56 ` [v5 1/3] examples/fips_validation: add " Gowrishankar Muthukrishnan
2022-10-12 3:56 ` [v5 2/3] examples/fips_validation: encode digest with hash OID Gowrishankar Muthukrishnan
2022-10-12 3:56 ` [v5 3/3] examples/fips_validation: randomize message for conformance test Gowrishankar Muthukrishnan
2022-10-12 4:05 ` [v6 0/3] FIPS asymmetric validation Gowrishankar Muthukrishnan
2022-10-12 4:05 ` [v6 1/3] examples/fips_validation: add " Gowrishankar Muthukrishnan
2022-10-12 4:05 ` [v6 2/3] examples/fips_validation: encode digest with hash OID Gowrishankar Muthukrishnan
2022-10-12 4:05 ` [v6 3/3] examples/fips_validation: randomize message for conformance test Gowrishankar Muthukrishnan
2022-10-12 6:12 ` [v7 0/3] FIPS asymmetric validation Gowrishankar Muthukrishnan
2022-10-12 6:12 ` [v7 1/3] examples/fips_validation: add " Gowrishankar Muthukrishnan
2022-10-12 6:12 ` [v7 2/3] examples/fips_validation: encode digest with hash OID Gowrishankar Muthukrishnan
2022-10-12 6:12 ` [v7 3/3] examples/fips_validation: randomize message for conformance test Gowrishankar Muthukrishnan
2022-10-12 18:44 ` [v7 0/3] FIPS asymmetric validation Akhil Goyal
2022-09-27 6:00 [v2 1/7] examples/fips_validation: fix parsing test group info Gowrishankar Muthukrishnan
2022-09-27 6:00 ` [v2 3/7] examples/fips_validation: add function to calculate SHA hash size Gowrishankar Muthukrishnan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO6PR18MB4484C12D8C1A0AC348E8BA24D85F9@CO6PR18MB4484.namprd18.prod.outlook.com \
--to=gakhil@marvell.com \
--cc=anoobj@marvell.com \
--cc=brian.dooley@intel.com \
--cc=dev@dpdk.org \
--cc=gmuthukrishn@marvell.com \
--cc=jerinj@marvell.com \
--cc=roy.fan.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).