From patchwork Sun Nov 15 16:14:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gstir X-Patchwork-Id: 7619181 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 803DC9F7CA for ; Sun, 15 Nov 2015 16:16:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE15F204E0 for ; Sun, 15 Nov 2015 16:16:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEAEE2050E for ; Sun, 15 Nov 2015 16:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbbKOQQy (ORCPT ); Sun, 15 Nov 2015 11:16:54 -0500 Received: from mail.sigma-star.at ([95.130.255.111]:45998 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751613AbbKOQQx (ORCPT ); Sun, 15 Nov 2015 11:16:53 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id 586F716B4CF7; Sun, 15 Nov 2015 17:16:51 +0100 (CET) X-Virus-Scanned: amavisd-new at mail.sigma-star.at Received: from spire-linux.lan (david.vpn.sigmapriv.at [10.3.0.113]) by mail.sigma-star.at (Postfix) with ESMTPSA id CA52316B4C67; Sun, 15 Nov 2015 17:16:50 +0100 (CET) From: David Gstir To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, David Gstir Subject: [PATCH 2/2] crypto: talitos - Fix timing leak in ESP ICV verification Date: Sun, 15 Nov 2015 17:14:42 +0100 Message-Id: <1447604082-1883-3-git-send-email-david@sigma-star.at> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447604082-1883-1-git-send-email-david@sigma-star.at> References: <1447604082-1883-1-git-send-email-david@sigma-star.at> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using non-constant time memcmp() makes the verification of the authentication tag in the decrypt path vulnerable to timing attacks. Fix this by using crypto_memneq() instead. Signed-off-by: David Gstir --- drivers/crypto/talitos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 46f531e19ccf..b6f9f42e2985 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -977,7 +977,7 @@ static void ipsec_esp_decrypt_swauth_done(struct device *dev, } else oicv = (char *)&edesc->link_tbl[0]; - err = memcmp(oicv, icv, authsize) ? -EBADMSG : 0; + err = crypto_memneq(oicv, icv, authsize) ? -EBADMSG : 0; } kfree(edesc);