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: 18667 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