Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1013110imm; Fri, 8 Jun 2018 08:39:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKYaJYF2WY/rovE9RXeQXZgBdH3IR8t70qNTfh/tZw1slVS3Wlye/M04QORUVSRzN2YdrZo X-Received: by 2002:a17:902:b683:: with SMTP id c3-v6mr7177596pls.158.1528472347346; Fri, 08 Jun 2018 08:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528472347; cv=none; d=google.com; s=arc-20160816; b=U9v9wrWbFlOYI2iYt9iAMF1VL5kp/9V0sOERwjumIEGQfw/HxtMfC84aJRUuhJJ5On EjDcY0DcPScqM6Oc+YkkKRwZei2JR9ytIQ2Sv0/GCfuD5mk9Ujua2gSgKeymYpZ0927p aloFlqyPRWQdj0YDaDHMICm6h+Q7gUeCXMkEsYP4FwoOic88LzuRQmi4FY864LdN4K8d 35Pox5SXGZRL0yZcA6UM1QuI6677VjsrfA1yxX3uixJ6IEyLS+e8y5IKRbzRCgXSNa2D mIlsi63u7iSGJjTL2mgeEz8NYZ3RIsjIjOg8rraZdr1StG7MdpZ0ro1o4XF3tg0ejLq0 dEGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=TIkIAtC0YpMq0vBQkn5b0Teo/FwzyjlTHQyoorDUhzY=; b=z6P0QsDjhMqs9j8omXWNOr8Xz6CopyZWJieEVBkP4VRqZVQtca8sVSzGsxG9wpQ0re n4qh2nWPJCRhprowsiOeJGJPSAMVut5W9mJoo+iRsUpWZ2EkCn7EGxCpLgn+9IobOGYb h9r7IJC0vhz2NrdMDuhkrbRiQLqHGwLJyYS2WazgEX1cH/YcpQgkCm2uGcQmGMwW0jIY E4SAfr3yDDs5PsWZFjB33O0NG1E7psFFuEVHHT3FHJSPs4oagAtR7+BAMJ9pTiIttx1t HcPFDw39MbGjTehj1ggh37eMmCfQixn27KHgbWEwwJhnJGLj6LDmzJV156CCHIflLUQA 5Rcg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q130-v6si19696975pgq.526.2018.06.08.08.38.39; Fri, 08 Jun 2018 08:39:07 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752598AbeFHPiE (ORCPT + 99 others); Fri, 8 Jun 2018 11:38:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50874 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751141AbeFHPiC (ORCPT ); Fri, 8 Jun 2018 11:38:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E23237D843; Fri, 8 Jun 2018 15:38:01 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-121-245.rdu2.redhat.com [10.10.121.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64C821C730; Fri, 8 Jun 2018 15:37:59 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20180607191201.97080-1-ebiggers3@gmail.com> References: <20180607191201.97080-1-ebiggers3@gmail.com> <0000000000009c221d056e0cf53a@google.com> To: Eric Biggers Cc: dhowells@redhat.com, James Morris , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Tycho Andersen , Kees Cook , Stephan Mueller , Eric Biggers Subject: Re: [PATCH] dh key: fix rounding up KDF output length MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17594.1528472278.1@warthog.procyon.org.uk> Date: Fri, 08 Jun 2018 16:37:58 +0100 Message-ID: <17595.1528472278@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 08 Jun 2018 15:38:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 08 Jun 2018 15:38:02 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Biggers wrote: > Commit 383203eff718 ("dh key: get rid of stack allocated array") changed > kdf_ctr() to assume that the length of key material to derive is a > multiple of the digest size. The length was supposed to be rounded up > accordingly. However, the round_up() macro was used which only gives > the correct result on power-of-2 arguments, whereas not all hash > algorithms have power-of-2 digest sizes. In some cases this resulted in > a write past the end of the 'outbuf' buffer. > > Fix it by switching to roundup(), which works for non-power-of-2 inputs. Applied.