From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752688AbcDXLa3 (ORCPT ); Sun, 24 Apr 2016 07:30:29 -0400 Received: from smtprelay0169.hostedemail.com ([216.40.44.169]:41036 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751770AbcDXLa2 (ORCPT ); Sun, 24 Apr 2016 07:30:28 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:560:599:967:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2525:2553:2560:2563:2682:2685:2737:2828:2859:2894:2915:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4362:5007:6117:6119:7808:7903:8599:9025:10004:10400:10848:11026:11232:11258:11473:11658:11783:11914:12043:12296:12438:12517:12519:12740:12776:13439:13894:14181:14651:14659:14721:21080:30012:30034:30054:30056:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: hand75_3de6879b68843 X-Filterd-Recvd-Size: 3193 Message-ID: <1461497424.2726.55.camel@perches.com> Subject: Re: [PATCH v2 3/6] crypto: Linux Random Number Generator From: Joe Perches To: Stephan Mueller , herbert@gondor.apana.org.au, Theodore Tso Cc: sandyinchina@gmail.com, Jason Cooper , John Denker , "H. Peter Anvin" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 24 Apr 2016 04:30:24 -0700 In-Reply-To: <4513249.IuhZztB3y6@positron.chronox.de> References: <1589319.WyasadRQQe@positron.chronox.de> <4513249.IuhZztB3y6@positron.chronox.de> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2016-04-24 at 12:40 +0200, Stephan Mueller wrote: > The LRNG with all its properties is documented in [1]. This > documentation covers the functional discussion as well as testing of all > aspects of entropy processing. In addition, the documentation explains > the conducted regression tests to verify that the LRNG is API and ABI > compatible with the legacy /dev/random implementation. > > [1] http://www.chronox.de/lrng.html Thanks. Links get stale. It may be better to put an ascii version of the pdf in Documentation/ and the test code in tools/ and some trivial notes: > diff --git a/crypto/lrng.c b/crypto/lrng.c [] > +/* debug macro */ > +#define DRIVER_NAME "lrng" Using #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt before any #include would be a lot more common. > +#if 0 > +#define dbg(fmt, ...) pr_info(DRIVER_NAME": " fmt, ##__VA_ARGS__) > +#else > +#define dbg(fmt, ...) > +#endif pr_debug or is there some interaction with dynamic_debug you want to avoid? And it's generally better to use something like #if 0 #define dbg(fmt, ...) pr_info(fmt, ##__VA_ARGS__) #else #define dbg(fmt, ...) no_printk(fmt, ##__VA_ARGS__) so that new dbg statements would not have format/argument mismatches and argument evaluation side-effects are still eliminated. > +static void lrng_pdrbg_init_ops(u32 entropy_bits) > +{ > + if (lrng_pdrbg.pdrbg_fully_seeded) > + return; > + > + BUILD_BUG_ON(LRNG_IRQ_MIN_NUM % LRNG_POOL_WORD_BITS); > + BUILD_BUG_ON((LRNG_MIN_SEED_ENTROPY_BITS * LRNG_IRQ_ENTROPY_BITS / > +      LRNG_DRBG_SECURITY_STRENGTH_BITS) > LRNG_IRQ_MIN_NUM); > + > + /* DRBG is seeded with full security strength */ > + if (entropy_bits >= LRNG_DRBG_SECURITY_STRENGTH_BITS) { > + lrng_pdrbg.pdrbg_fully_seeded = true; > + lrng_pdrbg.pdrbg_min_seeded = true; > + pr_info(DRIVER_NAME": primary DRBG fully seeded\n"); Using pr_fmt eliminates the need for these DRIVER_NAME ": " prefix inclusions in the format > +static int __init lrng_init(void) > +{ [] > + pr_info(DRIVER_NAME": deactivating initial RNG - %d bytes delivered", > + atomic_read(&lrng_initrng_bytes)); Should use \n to terminate the format.