From patchwork Mon Apr 25 14:38:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balakrishna Garapati X-Patchwork-Id: 66593 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1076881qge; Mon, 25 Apr 2016 07:42:22 -0700 (PDT) X-Received: by 10.141.43.193 with SMTP id u184mr36607583qhe.59.1461595342057; Mon, 25 Apr 2016 07:42:22 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u18si10727848qki.45.2016.04.25.07.42.21; Mon, 25 Apr 2016 07:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B000C61830; Mon, 25 Apr 2016 14:42:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C1375617EF; Mon, 25 Apr 2016 14:40:12 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E6E73617CF; Mon, 25 Apr 2016 14:40:09 +0000 (UTC) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by lists.linaro.org (Postfix) with ESMTPS id 831C061889 for ; Mon, 25 Apr 2016 14:38:45 +0000 (UTC) Received: by mail-lb0-f181.google.com with SMTP id jj5so27942448lbc.0 for ; Mon, 25 Apr 2016 07:38:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=fCyWWFcSzEtC6R8WEeMZUfL6Wj+Mpg1l99CzBTZUT4A=; b=KxjIooNX+nOyAqcgLu+M/FLVHS7gIge4n7GkEiLWDlp6ct4Nn+5DlKw+YNlY7kAj3w NEVSjMkW4xX8XW7dWGyYvSnlyyXs/j7lB6foUe/0SaNf9khI6hAQAbYkISlIKpyO2gxX Z3mBQwjxbdBIwzppIgS3+wiVK3NFi3mv9ytens1z1p12Ah42wPB/4wu3kFJOnIP/jaXT Xa+WhJRAs3TTn8BRWSCiswY4jvExyvbEX/PX2eOn3vwvTe04vv8qTURGrhJlXR8Asadr 8CNbM7D5UqQ3irgwTr0JVKoR2wI4AxEvz6uznowvlr/S1zTpIqLRk9c37sEE4HiKXcta SWAw== X-Gm-Message-State: AOPr4FVx799oks9yuRmc1rtIZyJyiY6YZ2+fA4Eh+lbIfxtfTRK/X/fL7YKcTExpkkOONIfJBgs= X-Received: by 10.112.158.135 with SMTP id wu7mr5061369lbb.2.1461595124027; Mon, 25 Apr 2016 07:38:44 -0700 (PDT) Received: from elxahtkds32.localdomain (host-95-192-62-168.mobileonline.telia.com. [95.192.62.168]) by smtp.gmail.com with ESMTPSA id f134sm4471415lff.26.2016.04.25.07.38.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Apr 2016 07:38:43 -0700 (PDT) From: Balakrishna Garapati To: lng-odp@lists.linaro.org Date: Mon, 25 Apr 2016 16:38:37 +0200 Message-Id: <1461595117-15338-1-git-send-email-balakrishna.garapati@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: crypto patch Subject: [lng-odp] [API-NEXT PATCHv2 2/2] validation: crypto: verify odp crypto capability X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" test update to verify the crypto capability functionality Signed-off-by: Balakrishna Garapati --- v2: Added the suport to verify if hw offload is supported test/validation/crypto/odp_crypto_test_inp.c | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) -- 1.9.1 diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c index fc125f7..393fd20 100644 --- a/test/validation/crypto/odp_crypto_test_inp.c +++ b/test/validation/crypto/odp_crypto_test_inp.c @@ -46,6 +46,7 @@ static void alg_test(odp_crypto_op_t op, ) { odp_crypto_session_t session; + odp_crypto_capability_t capability; int rc; odp_crypto_ses_create_err_t status; odp_bool_t posted; @@ -53,6 +54,54 @@ static void alg_test(odp_crypto_op_t op, odp_crypto_compl_t compl_event; odp_crypto_op_result_t result; + /* Initialize crypto capability structure */ + memset(&capability, 0, sizeof(odp_crypto_capability_t)); + + rc = odp_crypto_capability(&capability); + CU_ASSERT(!rc); + + if (capability.hw_ciphers.all_bits) { + if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC && + !(capability.hw_ciphers.bit.trides_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC && + !(capability.hw_ciphers.bit.aes128_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM && + !(capability.hw_ciphers.bit.aes128_gcm)) + rc = -1; + } else { + if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC && + !(capability.ciphers.bit.trides_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC && + !(capability.ciphers.bit.aes128_cbc)) + rc = -1; + if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM && + !(capability.ciphers.bit.aes128_gcm)) + rc = -1; + } + + CU_ASSERT(!rc); + + if (capability.hw_auths.all_bits) { + if (auth_alg == ODP_AUTH_ALG_AES128_GCM && + !(capability.hw_auths.bit.aes128_gcm)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_NULL && + !(capability.hw_auths.bit.null)) + rc = -1; + } else { + if (auth_alg == ODP_AUTH_ALG_AES128_GCM && + !(capability.auths.bit.aes128_gcm)) + rc = -1; + if (auth_alg == ODP_AUTH_ALG_NULL && + !(capability.auths.bit.null)) + rc = -1; + } + + CU_ASSERT(!rc); + /* Create a crypto session */ odp_crypto_session_params_t ses_params; memset(&ses_params, 0, sizeof(ses_params));