Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3768112ybv; Tue, 25 Feb 2020 07:01:15 -0800 (PST) X-Google-Smtp-Source: APXvYqx6RM66s96XbXyO+MhBGIATTE8RNUYLwqE8egemK0Utt48rLpDwV2Tec66yMyyh65qC6xXt X-Received: by 2002:aca:5150:: with SMTP id f77mr3777848oib.52.1582642874460; Tue, 25 Feb 2020 07:01:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582642874; cv=none; d=google.com; s=arc-20160816; b=Po5jUdXA5AUzauc2Xj2jyRyuaZ3kdlPLXX6z2dveFmiS/YDmhQSt+oJCsPHppmkEWC nFiazDiVhoe02vBaahck7NUKRZwl1LIqmukNx2kgESMxN4yhINrO40sDxZ+PZk4mEYP0 QsirRJ4Ww/7z2ft7BNTZep0lM93EKOmAito7OJaF0obY17KsupQQsXbXpYzaBQgb9l2t v/1XzVbYG7P/Vy7Ic8RClqp6Q5Ui5Veze3kMXm5RsCh4HlvK9R7ogcwWGQmJ3/K0X2LO RBcGb06uZx612n1qYDyIuFdjtse3x7Cj0xiP90ziVm1tSudFL1KIKiEk2VedJg8bVzSL z4EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject; bh=8XgVkR08p6PyG3odqrpd2f8/JtVPgArIL4wsPeE4eV0=; b=nB8j5FZs6mKtHwCFJxPWcdB3elYpnBVF8CuanSxTY4gPd07xQcXjSn8cp7SCNPXcQS eW8N0aaeLn/U7Bi0gyPyErglOe143eQ/jJuwLoLeAcQhBRkAf/A4TIXkzphFXWfrtjSR +WPxbksHX6bkqVGdxp/G4iaF2bV1ydyNjzC5PPIe4jjelfwFtxrcOpOt3XafGgf1O2Ll 3fjf2yYWIyKoRcgWvl41a0CNzQrHQ91TXE5vuKueQaxfvj06HHRvHfB/zmabjjmffON5 fMjurtL1fF2T7E8VkI6tMV9uN9eLait0d8z/hbn5yk37CDnfFLrioiRZHxhiziq13AN/ FG6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si8428217otq.21.2020.02.25.07.01.00; Tue, 25 Feb 2020 07:01:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730449AbgBYOkI (ORCPT + 99 others); Tue, 25 Feb 2020 09:40:08 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:16614 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729992AbgBYOkI (ORCPT ); Tue, 25 Feb 2020 09:40:08 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01PEa6aR006411 for ; Tue, 25 Feb 2020 09:40:05 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2yd41jkacs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 25 Feb 2020 09:40:00 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Feb 2020 14:39:52 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 25 Feb 2020 14:39:48 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01PEdl1F29884502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Feb 2020 14:39:47 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6230142045; Tue, 25 Feb 2020 14:39:47 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D04D4203F; Tue, 25 Feb 2020 14:39:46 +0000 (GMT) Received: from funtu.home (unknown [9.145.63.208]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 25 Feb 2020 14:39:46 +0000 (GMT) Subject: Re: s390 crypto: explicitly memzero stack key material in aes_s390.c To: Torsten Duwe Cc: Herbert Xu , "David S. Miller" , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200221165511.GB6928@lst.de> From: Harald Freudenberger Date: Tue, 25 Feb 2020 15:39:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200221165511.GB6928@lst.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 20022514-0008-0000-0000-000003564EB0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20022514-0009-0000-0000-00004A776AAC Message-Id: <5b185871-d94e-2f79-ff42-07b2a10c490c@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-25_05:2020-02-21,2020-02-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxscore=0 clxscore=1011 impostorscore=0 priorityscore=1501 bulkscore=0 phishscore=0 mlxlogscore=906 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002250114 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.02.20 17:55, Torsten Duwe wrote: > From: Torsten Duwe > > s390 crypto: explicitly memzero stack key material in aes_s390.c > > aes_s390.c has several functions which allocate space for key material on > the stack and leave the used keys there. It is considered good practice > to clean these locations before the function returns. > > Signed-off-by: Torsten Duwe > --- > This popped up during our FIPS certification. > It's obviously a good idea not to leave key material on the stack. > > --- a/arch/s390/crypto/aes_s390.c > +++ b/arch/s390/crypto/aes_s390.c > @@ -392,6 +392,7 @@ static int cbc_aes_crypt(struct blkciphe > ret = blkcipher_walk_done(desc, walk, nbytes - n); > } > memcpy(walk->iv, param.iv, AES_BLOCK_SIZE); > + memzero_explicit(¶m, sizeof(param)); > return ret; > } > > @@ -576,6 +577,8 @@ static int xts_aes_crypt(struct blkciphe > walk->dst.virt.addr, walk->src.virt.addr, n); > ret = blkcipher_walk_done(desc, walk, nbytes - n); > } > + memzero_explicit(&pcc_param, sizeof(pcc_param)); > + memzero_explicit(&xts_param, sizeof(xts_param)); > return ret; > } > > Thanks Torsten, I've picked this patch. It will go upstream via the s390 subsystem with the next kernel merge window. regards Harald Freudenberger