From patchwork Fri Dec 23 17:38:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 88962 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp3434686qgi; Fri, 23 Dec 2016 09:38:54 -0800 (PST) X-Received: by 10.98.133.207 with SMTP id m76mr15176287pfk.102.1482514734145; Fri, 23 Dec 2016 09:38:54 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o2si34717558pgd.34.2016.12.23.09.38.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Dec 2016 09:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-76295-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-76295-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-76295-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=robU ciPw8IBMXwhTwQtccZrUPnfBVatnPhyDK/hh4S9BuRQUz5ksUPHPsplqkKw22RtN SMqH4yR64khoKXE3TC7r0lyxoTcI1VPc9IFdFVFJloWAcN//cwtpEUfQeAQeahrO csJmydTXTF+AG9h7XBY/WLP14p0WPmeZnKJmcv0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=XVnFK4DjvH ujv0inyNJEzr4U0Lk=; b=F0C49SegVU3zUMbJwzTNTYGGX2RoZD2iGUt3ckTOFi zvVDv4z2Me1888EUuSBakbZt4NaGaEVdsV1ZOiwM8vCHJNwC73DmE2BZpw7C29B7 cQ1/XoMKcFOnDOSBM7ssb9UIXOLCCK1b+4C3AKP0pzT58OBsk/WbhiOCbbathCiP Q= Received: (qmail 83191 invoked by alias); 23 Dec 2016 17:38:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 83164 invoked by uid 89); 23 Dec 2016 17:38:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=overflows, randomness, __throw, __THROW X-HELO: mx1.redhat.com Subject: Re: getentropy for To: Paul Eggert , GNU C Library References: <3e61c6ab-ca86-bd2b-26b0-35854d5ce388@redhat.com> <71f5806c-4ea2-ee0f-94ec-778707976568@cs.ucla.edu> From: Florian Weimer Message-ID: Date: Fri, 23 Dec 2016 18:38:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <71f5806c-4ea2-ee0f-94ec-778707976568@cs.ucla.edu> On 12/23/2016 05:45 PM, Paul Eggert wrote: > Florian Weimer wrote: >> Should I depend on _GNU_SOURCE instead? > > Sounds good to me. It would work well with Gnulib-using apps, which > typically define _GNU_SOURCE at an early stage in 'configure'. Good. I plan to commit the attached patch. Thanks, Florian Declare getentropy in 2016-12-23 Florian Weimer * posix/unistd.h (getentropy): Declare. diff --git a/posix/unistd.h b/posix/unistd.h index 392dc0e..70b10c6 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -1157,6 +1157,11 @@ extern int pthread_atfork (void (*__prepare) (void), void (*__child) (void)) __THROW; #endif +#ifdef __USE_GNU +/* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on + success or -1 on error. */ +int getentropy (void *__buffer, size_t __length) __wur; +#endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function