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: 708492 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tlbGg1bL0z9t1L for ; Sat, 24 Dec 2016 04:38:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="veb2YzI8"; dkim-atps=neutral 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=yyza lIIgnu+Pgz0uEXyUvwzSbZ5MQcDq5x/+CpBu085tFJk3PpUkoHzmlNkVRnl+yifl 2s2ILcgNxz9Pwe5+TnAMXgDeRpc02uKpFAlmK8apqdNVtc7MVkSnU6SuPuvK7YV5 Es3JQ2zwjSfZqncnpnzt1nFwqbrurNACAOapKOM= 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=veb2YzI8gwNjCPzFQGtJNtCiFX9ZgdmmySlmPKwfDb yF6uuSopdsi9JnuZd+AVlO+8KDVeShhFY5npV+FjjQQ01qfABa/ZjutcYxFO8XKG Vy+jiWo7bZp+XrvcEdnVcv8Lx6dBrMFPwrLQVAXlKy0OhmBKqfaZQh/ARlvhdVa5 4= 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