From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 86102A0567; Tue, 28 Jun 2022 13:57:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E9F240691; Tue, 28 Jun 2022 13:57:32 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 12D7B400D7 for ; Tue, 28 Jun 2022 13:57:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656417450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pNh6dYfjx6Mqw7e7+w2isFkvq9VXNA9jrqV8sw34wd4=; b=G2tRl2uvemCAzs9+GwWk9JqSK9jrxDLhUjQ1ZwzzKtsmheDxwmmTHaZeURjcjXyH/zpvUs xlQ3evw6gaHcjH06LQBVqys4p8DBEo3d0Q2ZQzRfIZB9JWLWn/JYIQMqhRSYtaPI4jFGKy jwPpobXdNIZDE7ufE+ta2BNK3v8KsVo= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-jfOtV5icNwirRas3vgx_Vw-1; Tue, 28 Jun 2022 07:57:29 -0400 X-MC-Unique: jfOtV5icNwirRas3vgx_Vw-1 Received: by mail-lf1-f70.google.com with SMTP id r28-20020ac25c1c000000b004809e9d21e5so4868440lfp.18 for ; Tue, 28 Jun 2022 04:57:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pNh6dYfjx6Mqw7e7+w2isFkvq9VXNA9jrqV8sw34wd4=; b=roAiADhqU2V9KUAgLVlYKOcAPVC6vFkIJMYqhZKxVqigrrgnhyrFpz72JX/zH4K4T/ VbQ50o5cdFP5Xzr7BhEW4TV8122JYgqjAaaWp9wpd0Nga3hgPH4T/QMOEb3Mdju9zES1 qruvl6djF7zF5XAawSjqKPexokYySLodPmxzVKQBotg8n8A+yB8AOR8Vm1YGIrMlRnQc aIgBD/SQPqft2NwDDr6h+UZuRIOEyerLF1UGtmrzJXDu5Q+wkxllljKqcxaNniPNSNso fkdtksfXKStiMMBIsqZ47uHBEgQxebPc3MYHfG5q3lWgdTFAawHIMUtWyvFJEPWaqlr/ Rj3g== X-Gm-Message-State: AJIora/SW4FmaNJZPu0zMC9kKQia0AHO41aKLALGFxqPpWbQeVM5aH7U 36PHLSFsWLCcfm9idm574sDzPWUKgarC7wmFI9k7AxvG+4mkt3fXEC6YonBX4lmulDbesNpQeVX Xlt0Jlcl0a4iQVMgByKA= X-Received: by 2002:a2e:9941:0:b0:25b:c885:3143 with SMTP id r1-20020a2e9941000000b0025bc8853143mr4032643ljj.477.1656417447575; Tue, 28 Jun 2022 04:57:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ucZI4PqC7ShXBhvomI5DEhvKUZ/gzvuvvG/1QIawC3vp03UNe263YMNpr6CJZWja1PIwlL69zRujfTdG9YcZw= X-Received: by 2002:a2e:9941:0:b0:25b:c885:3143 with SMTP id r1-20020a2e9941000000b0025bc8853143mr4032632ljj.477.1656417447351; Tue, 28 Jun 2022 04:57:27 -0700 (PDT) MIME-Version: 1.0 References: <41b2b4d16799a311ea63536b3009052c0cf99d75.1656402995.git.gmuthukrishn@marvell.com> In-Reply-To: <41b2b4d16799a311ea63536b3009052c0cf99d75.1656402995.git.gmuthukrishn@marvell.com> From: David Marchand Date: Tue, 28 Jun 2022 13:57:16 +0200 Message-ID: Subject: Re: [PATCH v1] examples/fips_validation: add parsing for xts To: Gowrishankar Muthukrishnan Cc: dev , Fan Zhang , Brian Dooley , Anoob Joseph , Archana Muniganti , Jerin Jacob Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Jun 28, 2022 at 9:59 AM Gowrishankar Muthukrishnan wrote: > > Added function to parse algorithm for AES XTS test. > > Signed-off-by: Gowrishankar Muthukrishnan > --- > examples/fips_validation/fips_validation.c | 4 +- > examples/fips_validation/fips_validation.h | 17 ++- > .../fips_validation/fips_validation_xts.c | 126 ++++++++++++++++++ > examples/fips_validation/main.c | 5 + > 4 files changed, 150 insertions(+), 2 deletions(-) > > diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c > index 324abccb14..f181363ef7 100644 > --- a/examples/fips_validation/fips_validation.c > +++ b/examples/fips_validation/fips_validation.c > @@ -463,7 +463,9 @@ fips_test_parse_one_json_vector_set(void) > else if (strstr(algo_str, "CMAC")) > info.algo = FIPS_TEST_ALGO_AES_CMAC; > else if (strstr(algo_str, "AES-CBC")) > - info.algo = FIPS_TEST_ALGO_AES; > + info.algo = FIPS_TEST_ALGO_AES_CBC; Is this part related to adding xts support? It looks more like a fix. > + else if (strstr(algo_str, "AES-XTS")) > + info.algo = FIPS_TEST_ALGO_AES_XTS; > else > return -EINVAL; > > diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h > index 69d738b718..8ae849c46f 100644 > --- a/examples/fips_validation/fips_validation.h > +++ b/examples/fips_validation/fips_validation.h > @@ -34,13 +34,14 @@ > > enum fips_test_algorithms { > FIPS_TEST_ALGO_AES = 0, > + FIPS_TEST_ALGO_AES_CBC, > FIPS_TEST_ALGO_AES_GCM, > FIPS_TEST_ALGO_AES_CMAC, > FIPS_TEST_ALGO_AES_CCM, > + FIPS_TEST_ALGO_AES_XTS, > FIPS_TEST_ALGO_HMAC, > FIPS_TEST_ALGO_TDES, > FIPS_TEST_ALGO_SHA, > - FIPS_TEST_ALGO_AES_XTS, > FIPS_TEST_ALGO_MAX > }; > > @@ -170,7 +171,17 @@ struct gcm_interim_data { > uint8_t gen_iv; > }; > > + No need for another blank line. > #ifdef USE_JANSSON > +enum xts_tweak_modes { > + XTS_TWEAK_MODE_HEX = 0, > + XTS_TWEAK_MODE_NUMBER > +}; > + > +struct xts_interim_data { > + enum xts_tweak_modes tweak_mode; > +}; > + > struct fips_test_json_info { > /* Information used for reading from json */ > json_t *json_root; > @@ -207,6 +218,7 @@ struct fips_test_interim_info { > struct ccm_interim_data ccm_data; > struct sha_interim_data sha_data; > struct gcm_interim_data gcm_data; > + struct xts_interim_data xts_data; > } interim_info; > > enum fips_test_op op; > @@ -266,6 +278,9 @@ parse_test_cmac_json_init(void); > > int > parse_test_aes_json_init(void); > + > +int > +parse_test_xts_json_init(void); > #endif /* USE_JANSSON */ > > int > diff --git a/examples/fips_validation/fips_validation_xts.c b/examples/fips_validation/fips_validation_xts.c > index 5bb1966f6c..2de852c1fc 100644 > --- a/examples/fips_validation/fips_validation_xts.c > +++ b/examples/fips_validation/fips_validation_xts.c > @@ -24,6 +24,22 @@ > #define OP_ENC_STR "ENCRYPT" > #define OP_DEC_STR "DECRYPT" > > +#define ALGO_JSON_STR "algorithm" > +#define TESTTYPE_JSON_STR "testType" > +#define DIR_JSON_STR "direction" > +#define KEYLEN_JSON_STR "keyLen" > +#define TWEAKMODE_JSON_STR "tweakMode" > + > +#define KEY_JSON_STR "key" > +#define DATAUNITLEN_JSON_STR "dataUnitLen" > +#define PAYLOADLEN_JSON_STR "payloadLen" > +#define TWEAKVALUE_JSON_STR "tweakValue" > +#define PT_JSON_STR "pt" > +#define CT_JSON_STR "ct" > + > +#define OP_ENC_JSON_STR "encrypt" > +#define OP_DEC_JSON_STR "decrypt" > + > static int > parse_interim_xts_enc_dec(const char *key, > __rte_unused char *text, > @@ -62,6 +78,116 @@ struct fips_test_callback xts_writeback_callbacks[] = { > {NULL, NULL, NULL} /**< end pointer */ > }; > > +#ifdef RTE_HAS_JANSSON Code in examples can't rely on internal RTE_HAS_JANSSON. -- David Marchand