From patchwork Fri May 5 03:00:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 98593 Delivered-To: patch@linaro.org Received: by 10.140.89.200 with SMTP id v66csp79132qgd; Thu, 4 May 2017 20:01:44 -0700 (PDT) X-Received: by 10.55.168.86 with SMTP id r83mr10134764qke.97.1493953304790; Thu, 04 May 2017 20:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1493953304; cv=none; d=google.com; s=arc-20160816; b=ZSRtifH9dThgnSQ2TseSgREUNWmJN9Doz9TEOFv0jHCWMIefwJAeUrjxklaJDWv20C 1mcu/Mh6tDwbAC/L3VCbaQ5HAYhdtDXLKGEZGKrFLFAojrzkc7shgjpP2NwP19B+XfVt SxKdAtUcZcSsr1IdIaVFaTPlBAb3MqXfQSlaMAoBhh3a/feWOo9+b9xDJ8sHt+PJuAo5 9SzWwkjtBCpfHpUeMUKoiyRIDyW95tEHmczvc+NvTmUpSvRxqqG4W3cgKVSsdRjNcOaX cTb/OHp2BlXgSssDn1b78764N2dZUpigcx6ysYkOSQPdickirbEEgaqceBFFCIBrxRs9 p/fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=NuKqQrcUZBhTJBgUxY5XxGE2v7SXf87zdP7z9nWVAlA=; b=CNGiNcZSnOZoYMvPVIhUbDzCyP0YtV8eslah2ZzPUcFAwnvKvzEeeIFpSk9164JINe 84ubRqoQeI4J1m4MgUL+Q0FHoL5u1vqq3VeLIz+2n/1048O3tobAgQDeA08VOpv2W50b kO1nWBSrOTZpaK482asYYe9m3BhOMeKotwbs9KPej/7xBSpKOVjAkbOzgow6hUY46Jpw 5D76ECim71J9Uy6hgxFZgkzIn3jBdI+CLw/JMBvmDCDU8yFtzXrVaQwSwnfK8MSeHaX/ T0dFxCgUM+DBCgm/5GALdESH2mwWqAPZYK7EQ+Ck1DgZy07AIw0Qs2t0DBH2ubw4UMnJ lqFQ== ARC-Authentication-Results: i=1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q20si3244857qka.137.2017.05.04.20.01.44; Thu, 04 May 2017 20:01:44 -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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 6A8C860AD3; Fri, 5 May 2017 03:01:44 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 EB7A160656; Fri, 5 May 2017 03:00:35 +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 86D9560A0A; Fri, 5 May 2017 03:00:29 +0000 (UTC) Received: from forward1j.cmail.yandex.net (forward1j.cmail.yandex.net [5.255.227.19]) by lists.linaro.org (Postfix) with ESMTPS id B46C1608E2 for ; Fri, 5 May 2017 03:00:27 +0000 (UTC) Received: from smtp1h.mail.yandex.net (smtp1h.mail.yandex.net [84.201.187.144]) by forward1j.cmail.yandex.net (Yandex) with ESMTP id 3671020EB8 for ; Fri, 5 May 2017 06:00:26 +0300 (MSK) Received: from smtp1h.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1h.mail.yandex.net (Yandex) with ESMTP id 079E68C0ED5 for ; Fri, 5 May 2017 06:00:25 +0300 (MSK) Received: by smtp1h.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id KREUQHFfBO-0OiqFuLn; Fri, 05 May 2017 06:00:24 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 5 May 2017 06:00:02 +0300 Message-Id: <1493953207-9115-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493953207-9115-1-git-send-email-odpbot@yandex.ru> References: <1493953207-9115-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 24 Subject: [lng-odp] [PATCH API-NEXT v1 2/7] linux: crypto: fix checking of GCM tags 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Currently odp_crypto code will happily accept wrong tags, because the check for EVP_DecryptFinal_ex return code is incorrect. This function returns 0 if tag is incorrect, not < 0. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 24 (lumag:crypto-dal) ** https://github.com/Linaro/odp/pull/24 ** Patch: https://github.com/Linaro/odp/pull/24.patch ** Base sha: 540490ddf3a1b3da4b80ed15fc874ccdfc49b60c ** Merge commit sha: d097dfa56ce6abf579ef39d07f3ac39d6badbc92 **/ platform/linux-generic/odp_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index a0f3f7e..78c3ac2 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -384,7 +384,7 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_crypto_op_param_t *param, auth_len - (aad_tail - aad_head)); } - if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, &plain_len) < 0) + if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, &plain_len) <= 0) return ODP_CRYPTO_ALG_ERR_ICV_CHECK; return ODP_CRYPTO_ALG_ERR_NONE;