From patchwork Sat Mar 18 14:08:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Codarren Velvindron X-Patchwork-Id: 740608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vlkZr6VJnz9s1h for ; Sun, 19 Mar 2017 01:08:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 32BD488266; Sat, 18 Mar 2017 14:08:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GSadvE3H_BJQ; Sat, 18 Mar 2017 14:08:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7AC4288042; Sat, 18 Mar 2017 14:08:31 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A31041C0270 for ; Sat, 18 Mar 2017 14:08:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9D67B88042 for ; Sat, 18 Mar 2017 14:08:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7iDKrqkhfpKr for ; Sat, 18 Mar 2017 14:08:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from walmailout07.yourhostingaccount.com (walmailout07.yourhostingaccount.com [65.254.253.56]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E6FC388027 for ; Sat, 18 Mar 2017 14:08:27 +0000 (UTC) Received: from mailscan02.yourhostingaccount.com ([10.1.15.2] helo=walmailscan02.yourhostingaccount.com) by walmailout07.yourhostingaccount.com with esmtp (Exim) id 1cpF1u-0006e7-Hk for uclibc@uclibc.org; Sat, 18 Mar 2017 10:08:26 -0400 Received: from [10.114.3.31] (helo=walimpout11) by walmailscan02.yourhostingaccount.com with esmtp (Exim) id 1cpF1u-0006IO-G9 for uclibc@uclibc.org; Sat, 18 Mar 2017 10:08:26 -0400 Received: from walauthsmtp04.yourhostingaccount.com ([10.1.18.4]) by walimpout11 with id xS8P1u00705G96J01S8SFi; Sat, 18 Mar 2017 10:08:26 -0400 X-Authority-Analysis: v=2.1 cv=OoPBykPt c=1 sm=1 tr=0 a=ZyCNx9LFiA0kwLx3ZJIN5w==:117 a=brxZH7iTzWefYFBnd3IzhA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=6Iz7jQTuP9IA:10 a=6I5d2MoRAAAA:8 a=yIfbXyKrAAAA:8 a=Lnvr8diImjd9gF7Zh5sA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=gAZuYHTgtdx8AbkcJ_XD:22 Received: from [197.226.251.180] (port=39788 helo=codarren-MS-7758) by walauthsmtp04.yourhostingaccount.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim) id 1cpF1q-00046i-E0 for uclibc@uclibc.org; Sat, 18 Mar 2017 10:08:23 -0400 Date: Sat, 18 Mar 2017 18:08:13 +0400 From: codarrenvelvindron To: uclibc@uclibc.org Subject: [PATCH] Discard 3072 bytes instead of 256 bytes Message-ID: <20170318140813.GA8925@codarren-MS-7758> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-EN-UserInfo: 46212afd67d769afec2ba18ffd70b6dd:931c98230c6409dcc37fa7e93b490c27 X-EN-AuthUser: codarren@hackers.mu X-EN-OrigIP: 197.226.251.180 X-EN-OrigHost: unknown X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" As per the recommendations outlined in Network Operations Division Cryptographic Requirements published on Wikileaks on March 2017. We discard more bytes of the first keysteam to reduce the possibility of non-random bytes. Similar to a change in FreeBSD: https://svnweb.freebsd.org/base?view=revision&revision=315225 Signed-off-by: Codarren Velvindron --- libc/stdlib/arc4random.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c index 0013612..4801886 100644 --- a/libc/stdlib/arc4random.c +++ b/libc/stdlib/arc4random.c @@ -154,8 +154,11 @@ arc4_stir(struct arc4_stream *as) /* * Discard early keystream, as per recommendations in: * http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Rc4_ksa.ps + * As per the Network Operations Division, cryptographic requirements + * published on wikileaks on March 2017 */ - for (n = 0; n < 256; n++) + + for (n = 0; n < 3072; n++) (void)arc4_getbyte(as); arc4_count = 1600000; }