From patchwork Sat Feb 4 16:08:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 9555657 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6DF65602B7 for ; Sat, 4 Feb 2017 16:09:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D62E2624B for ; Sat, 4 Feb 2017 16:09:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5214926E46; Sat, 4 Feb 2017 16:09:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23E6626BE9 for ; Sat, 4 Feb 2017 16:09:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751311AbdBDQJK (ORCPT ); Sat, 4 Feb 2017 11:09:10 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:1090 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbdBDQJJ (ORCPT ); Sat, 4 Feb 2017 11:09:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1486224549; x=1517760549; h=from:to:cc:subject:date:message-id:mime-version; bh=FNIIMsJft5f+tIpjqoiUihnWcCXkEe+Uo8Jc0REpc1I=; b=l1TNuHb/24/HJMOZXBQoSB2AHkwK+wfDcMp3+t4vaZd3KT50sPqTLKNs 0om/leJk4VX8pUkTwTrXDR/YIbIo5oQd2xyrWUKFkyRpzsOcnZMhEgs8y VkJGVX4mqU452oxcSUv9xOFREgR6sBHoDVZ5bd6egjIUQCJyoz34A58SF Q=; X-IronPort-AV: E=Sophos;i="5.33,334,1477983600"; d="scan'208";a="355719956" Received: from unknown (HELO Ironmsg03-L.qualcomm.com) ([10.53.140.110]) by wolverine02.qualcomm.com with ESMTP; 04 Feb 2017 08:09:07 -0800 X-IronPort-AV: E=McAfee;i="5800,7501,8429"; a="1307402958" Received: from nasanexm01a.na.qualcomm.com ([10.85.0.81]) by Ironmsg03-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 04 Feb 2017 08:09:07 -0800 Received: from eusanexr01e.eu.qualcomm.com (10.85.0.100) by nasanexm01a.na.qualcomm.com (10.85.0.81) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 4 Feb 2017 08:09:06 -0800 Received: from jouni.qca.qualcomm.com (10.80.80.8) by eusanexr01e.eu.qualcomm.com (10.85.0.100) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 4 Feb 2017 08:09:03 -0800 From: Jouni Malinen To: Johannes Berg CC: , Ard Biesheuvel , Jouni Malinen Subject: [PATCH] mac80211: Allocate a sync skcipher explicitly for FILS AEAD Date: Sat, 4 Feb 2017 18:08:42 +0200 Message-ID: <1486224522-26392-1-git-send-email-jouni@qca.qualcomm.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanexm01a.na.qualcomm.com (10.85.0.81) To eusanexr01e.eu.qualcomm.com (10.85.0.100) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The skcipher could have been of the async variant which may return from skcipher_encrypt() with -EINPROGRESS after having queued the request. The FILS AEAD implementation here does not have code for dealing with that possibility, so allocate a sync cipher explicitly to avoid potential issues with hardware accelerators. This is based on the patch sent out by Ard. Fixes: 39404feee691 ("mac80211: FILS AEAD protection for station mode association frames") Reported-by: Ard Biesheuvel Signed-off-by: Jouni Malinen --- net/mac80211/fils_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c index e3bbe24..912f3e2c 100644 --- a/net/mac80211/fils_aead.c +++ b/net/mac80211/fils_aead.c @@ -192,7 +192,7 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len, /* CTR */ - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm2)) { kfree(tmp); return PTR_ERR(tfm2); @@ -251,7 +251,7 @@ static int aes_siv_decrypt(const u8 *key, size_t key_len, /* CTR */ - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm2)) return PTR_ERR(tfm2); /* K2 for CTR */