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 65471A04FF; Fri, 29 Apr 2022 18:16:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1596642848; Fri, 29 Apr 2022 18:16:14 +0200 (CEST) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mails.dpdk.org (Postfix) with ESMTP id 1D97942834 for ; Fri, 29 Apr 2022 18:16:10 +0200 (CEST) Received: by mail-qt1-f170.google.com with SMTP id p4so5557654qtq.12 for ; Fri, 29 Apr 2022 09:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5Iscdf4HUPn4qo1v1LSs0EbMRcDmlYHAsnXH+s2EvAA=; b=MBu2R4iGgRt/k/KX67RknQQKdalZbdmM5eySCsPGSlDGh+e+Gibea890oey7aCwdzD gv+GppKwrvjD7ga+clEskGlVk3uPQZ9vvFhv/jbWZu55R7ZE58n+0G5LBQahNu1++qy9 rLm4493zBjHF4FA6Vv2T9oNkar6lTkCmxbPg8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Iscdf4HUPn4qo1v1LSs0EbMRcDmlYHAsnXH+s2EvAA=; b=GnxI+wO0FQVeNfPtMIORroSi1NbBH91oYSNLlECJsYEC3NxH6/MznxQ3bydge8mhlJ KCIAK77GWCkPGaMcZOB61SyuvlCdd1Fw9WcqMg22pqH8THKu0HCXLyzYGaXg3Slms3jB gjdalMR78qndAAw/sLb/vhfZYW1BiauOsH8SVOvuf5y7t3wLeOw0Yui5RE79QC1wu/Ie E1NOzrk6XIjg+b0zFN2Unw+zM/mkvw658ogJiIIhRer47nWABHJa8q7tjWOtQdmzxJ7I hBv2uhTFMqrtduKiUL0a41q08YqF4sCMQMFQEhBiF0Uza9R6RRGAptpeUyh5DQWPpUWS mGQA== X-Gm-Message-State: AOAM530NBlc9zHjLF5wrwcsqaP1zdOz6KvPUPR8dFRpx2Cx2ZZoiFPb1 nnREO/sQHbQRqdajqrrCOqVftg== X-Google-Smtp-Source: ABdhPJwLBN0vx/LbNwoT1mDJTyhnV1h0oj55huk9pV+UaUudpzW5MAAO3oAiyU/dc2W1bO7DyotxNg== X-Received: by 2002:a05:622a:1c5:b0:2f1:f99f:b74b with SMTP id t5-20020a05622a01c500b002f1f99fb74bmr147587qtw.602.1651248969516; Fri, 29 Apr 2022 09:16:09 -0700 (PDT) Received: from blo.iol.unh.edu ([2606:4100:3880:1270:ec49:26fa:daa6:229d]) by smtp.gmail.com with ESMTPSA id k20-20020a05622a03d400b002ec16d2694fsm2081188qtx.39.2022.04.29.09.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 09:16:09 -0700 (PDT) From: Brandon Lo To: roy.fan.zhang@intel.com, ciara.power@intel.com Cc: dev@dpdk.org, Brandon Lo Subject: [PATCH v4 8/8] examples/fips_validation: add parsing for cmac Date: Fri, 29 Apr 2022 12:15:59 -0400 Message-Id: <20220429161559.415645-9-blo@iol.unh.edu> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220429161559.415645-1-blo@iol.unh.edu> References: <20220129175514.746925-1-blo@iol.unh.edu> <20220429161559.415645-1-blo@iol.unh.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Added function to parse algorithm for CMAC test. Signed-off-by: Brandon Lo --- examples/fips_validation/fips_validation.c | 31 +++++++++++++++++++--- examples/fips_validation/main.c | 3 +++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 04dfb85262..8e0a55c624 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -460,6 +460,8 @@ fips_test_parse_one_json_vector_set(void) info.algo = FIPS_TEST_ALGO_AES_GCM; if (strstr(algo_str, "HMAC")) info.algo = FIPS_TEST_ALGO_HMAC; + if (strstr(algo_str, "CMAC")) + info.algo = FIPS_TEST_ALGO_AES_CMAC; else return -EINVAL; @@ -470,7 +472,6 @@ int fips_test_parse_one_json_group(void) { int ret, i; - json_int_t val; json_t *param; if (info.interim_callbacks) { @@ -478,8 +479,20 @@ fips_test_parse_one_json_group(void) for (i = 0; info.interim_callbacks[i].key != NULL; i++) { param = json_object_get(json_info.json_test_group, info.interim_callbacks[i].key); - val = json_integer_value(param); - snprintf(json_value, 255, "%"JSON_INTEGER_FORMAT, val); + switch (json_typeof(param)) { + case JSON_STRING: + snprintf(json_value, 256, "%s", json_string_value(param)); + break; + + case JSON_INTEGER: + snprintf(json_value, 255, "%"JSON_INTEGER_FORMAT, + json_integer_value(param)); + break; + + default: + return -EINVAL; + } + /* First argument is blank because the key * is not included in the string being parsed. */ @@ -673,6 +686,18 @@ parser_read_uint32_bit_val(const char *key, char *src, struct fips_val *val) return 0; } +int +parser_read_cmac_direction_str(__rte_unused const char *key, char *src, + __rte_unused struct fips_val *val) +{ + if (strcmp(src, "gen") == 0) + info.op = FIPS_TEST_ENC_AUTH_GEN; + else if (strcmp(src, "ver") == 0) + info.op = FIPS_TEST_DEC_AUTH_VERIF; + + return 0; +} + int writeback_hex_str(const char *key, char *dst, struct fips_val *val) { diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index de6dedaf75..aa8034c29f 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1946,6 +1946,9 @@ fips_test_one_test_group(void) case FIPS_TEST_ALGO_HMAC: ret = parse_test_hmac_json_init(); break; + case FIPS_TEST_ALGO_AES_CMAC: + ret = parse_test_cmac_json_init(); + break; default: return -EINVAL; } -- 2.25.1