From patchwork Mon Jul 31 12:00:09 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: 108997 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp3563108obm; Mon, 31 Jul 2017 05:02:46 -0700 (PDT) X-Received: by 10.237.33.69 with SMTP id 63mr23027209qtc.11.1501502566270; Mon, 31 Jul 2017 05:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501502566; cv=none; d=google.com; s=arc-20160816; b=Mx1SuIz0kwrvdF/CRFLY41bGSYl15SyHkaGO19MbDR3apxOBJJg9WE2ZZiXr6qyrv9 5EQFhMHCSR1WYAGIr/DmBVGKeiAH+Und03CJbOvIk3SanUVYPnKbr2Jy7+m4nnCNWAL1 3p0zz/DxjwR4kLSONnKieF94fF7MLYBFgwi0lhvJjGjZ1YT+CBtBiz/Wx887zRKsMcuP zIKRjeglXM3e3LacilDTOaqZOkkSH/cytpA0sn5kKSSsjAa6YU/81De0PFeWl18F69rn ikCNK9P5AGBcagnRrgauVezr9Ys2lerugSxzn5imoNPb1DJ0vWU2kSrneKYBpZ5vW++G 5K1g== 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=hW1u6XZLjAYSGOnOsk1XeVvxMdVpKh1hkXpHeroNEmI=; b=tEGC/Fqr6LWL3xABccPzru1tWfwzbN08t+2v0A666Dbnuwm4mAsjtYbJoB06gBeB2b lB2UHqT9xh71rUvYm28d51h99VbTGirhaZ5QP5KHzbNIapYdlkQPbBoRgsfJVwdGjgA3 Ecfs0aYw7xn4ZvXV73R/1Hw9S63S+ip45oJS8AQ/m1pL7yQ0c+I817x96byXyTwzH2EY lmfBx3Od1Ezvc8O6fxqoLcou8OH1JKDgUZGSqyT2T0/Hhs6aYpy7dhcm9+R/2NgJwPhR GPStvI46q2VKuNGPoxQHTjWX6fK0LSOH85LeWkLfoNGrH+elQAaghI0T9rRjpI2CqDUF pegw== 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 o7si23088452qke.119.2017.07.31.05.02.45; Mon, 31 Jul 2017 05:02:46 -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 CE69B644BE; Mon, 31 Jul 2017 12:02:45 +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,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 63161608CE; Mon, 31 Jul 2017 12:01:39 +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 76F106448D; Mon, 31 Jul 2017 12:01:34 +0000 (UTC) Received: from forward1p.cmail.yandex.net (forward1p.cmail.yandex.net [77.88.31.16]) by lists.linaro.org (Postfix) with ESMTPS id 616E8644A3 for ; Mon, 31 Jul 2017 12:00:22 +0000 (UTC) Received: from smtp3m.mail.yandex.net (smtp3m.mail.yandex.net [77.88.61.130]) by forward1p.cmail.yandex.net (Yandex) with ESMTP id 9ED3E20733 for ; Mon, 31 Jul 2017 15:00:19 +0300 (MSK) Received: from smtp3m.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp3m.mail.yandex.net (Yandex) with ESMTP id 404172840EEB for ; Mon, 31 Jul 2017 15:00:18 +0300 (MSK) Received: by smtp3m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JkzBMvSJ5H-0HmmS4Oh; Mon, 31 Jul 2017 15:00:17 +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: Mon, 31 Jul 2017 15:00:09 +0300 Message-Id: <1501502409-30703-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501502409-30703-1-git-send-email-odpbot@yandex.ru> References: <1501502409-30703-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 92 Subject: [lng-odp] [PATCH v1 1/1] linux-gen: crypto: check packet length during operation 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 Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 92 (lumag:crypto-check-len) ** https://github.com/Linaro/odp/pull/92 ** Patch: https://github.com/Linaro/odp/pull/92.patch ** Base sha: 79336f5eaee25168a5e4ad7fc0aee07395d4ca1f ** Merge commit sha: 67c91fd6b963a3920d8f2cde5b56d76012213a99 **/ platform/linux-generic/odp_crypto.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 68fc5658..ab42132a 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -242,6 +242,8 @@ int internal_encrypt(EVP_CIPHER_CTX *ctx, odp_crypto_op_param_t *param) int cipher_len; int ret; + ODP_ASSERT(in_pos + in_len <= odp_packet_len(pkt)); + while (in_len > 0) { uint32_t seglen = 0; /* GCC */ uint8_t *insegaddr = odp_packet_offset(pkt, in_pos, @@ -297,6 +299,8 @@ int internal_decrypt(EVP_CIPHER_CTX *ctx, odp_crypto_op_param_t *param) int cipher_len; int ret; + ODP_ASSERT(in_pos + in_len <= odp_packet_len(pkt)); + while (in_len > 0) { uint32_t seglen = 0; /* GCC */ uint8_t *insegaddr = odp_packet_offset(pkt, in_pos,