From patchwork Tue Apr 26 05:44:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balakrishna Garapati X-Patchwork-Id: 66666 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1419575qge; Mon, 25 Apr 2016 22:44:41 -0700 (PDT) X-Received: by 10.140.88.111 with SMTP id s102mr482130qgd.63.1461649480841; Mon, 25 Apr 2016 22:44:40 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 21si12571899qki.187.2016.04.25.22.44.40; Mon, 25 Apr 2016 22:44:40 -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 85B2261638; Tue, 26 Apr 2016 05:44:40 +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 9ABD56163B; Tue, 26 Apr 2016 05:44:17 +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 BCCBD6162A; Tue, 26 Apr 2016 05:44:08 +0000 (UTC) Received: from mail-lf0-f41.google.com (mail-lf0-f41.google.com [209.85.215.41]) by lists.linaro.org (Postfix) with ESMTPS id 3F33B6162A for ; Tue, 26 Apr 2016 05:44:04 +0000 (UTC) Received: by mail-lf0-f41.google.com with SMTP id y84so4217251lfc.0 for ; Mon, 25 Apr 2016 22:44:04 -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=/sfX8bhqTpogQ0BoQQW/XgP6cl3kb68PPZT1fyqoHGk=; b=CNEui77lD1p8eFDABX3WhD+6ID15MgpF+jOzQjuBHfENB539eoMGsu76bUxbvPoKbl Hc99ffJg5C7Y7BNDpBBgNPvl+qLMKBjmeHFj5BiY/60Nma+TEfcTY7GOJGRoHePsjdLv c+6flSpJmy0SB+I5iN5RcX+0Z34wqhAGf1WzwpgNrG9ib8siwPsKdRmMlEVidpJjsyvH UkeO0wgKIB3zVkrJDo6co6PT/NXEimxVsKWJ0W5tgBO4WgBG7Ub6bbMZVZMUVU6sXGw5 eAjZtLqqyFrpMdB0Wyq6UorKxT2+b316Cceflnecu75+LB6kxHMXbd4yA6X/OyIYr31a 8T8Q== X-Gm-Message-State: AOPr4FUBJQtXH/C+gG5At98n2Q9Dx5suyRqDv+l1WhKBExv//DOE8JY8DcPXaMrSxONxwT4NZ5o= X-Received: by 10.112.17.98 with SMTP id n2mr369153lbd.47.1461649443192; Mon, 25 Apr 2016 22:44:03 -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 w125sm5190407lfa.10.2016.04.25.22.44.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Apr 2016 22:44:02 -0700 (PDT) From: Balakrishna Garapati To: lng-odp@lists.linaro.org Date: Tue, 26 Apr 2016 07:44:01 +0200 Message-Id: <1461649441-863-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 PATCHv3 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 v3: Move capability initialization to linux-generic (Bill) test/validation/crypto/odp_crypto_test_inp.c | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 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..0c5b110 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,51 @@ static void alg_test(odp_crypto_op_t op, odp_crypto_compl_t compl_event; odp_crypto_op_result_t result; + 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));