unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip McGrath <philip.mcgrath@gmail.com>
To: Vagrant Cascadian <vagrant@reproducible-builds.org>,
	Arun Isaac <arunisaac@systemreboot.net>,
	Guix Devel <guix-devel@gnu.org>
Subject: Re: maradns reproducibility fixes and the merits of picking a random number
Date: Tue, 14 Jun 2022 13:16:44 -0400	[thread overview]
Message-ID: <5ee4b604-9921-7e50-b1c8-e0c7a63ffcda@gmail.com> (raw)
In-Reply-To: <87czfigaxb.fsf@contorta>

Hi,

On 6/8/22 16:25, Vagrant Cascadian wrote:
> On 2022-06-09, Arun Isaac wrote:
>> Hi Vagrant,
>>
>>> But there's one nervous-making issue this revealed; maradns embeds a
>>> random number at build time ... allegedly for systems that don't have
>>> /dev/urandom... see
>>> maradns-3.5.0020/deadwood-3.5.0020/src/Makefile.ubuntu2004:
>>>
>>>    # Since some systems may not have /dev/urandom (Windows, *cough* *cough*), we
>>>    # keep a randomly generated prime around
>>>
>>> So it's got some code to generate a random number at build time and
>>> embed it in the binary. Now, if there's anything I know about good
>>> practices about random numbers, this sort of thing is generally a very
>>> large red flag! It also makes the package build differently every
>>> time!
>>
>> Wow, great find! Has this issue been reported to maradns upstream? If
>> upstream fixes it or provides us a compile flag to disable this
>> "feature", it would be even better in the long run.
> 
> That does sound like the best long-term approach, definitely!
> 
> Will take the issue upstream...
> 

Not sure if this is useful—I've never used MaraDNS, and I know just 
barely enough about Windows to try to keep free software portable—but, 
on Windows XP and later, you can get cryptographic-quality randomness by 
dynamically loading SystemFunction036 from Advapi32.dll, sometimes known 
as RtlGenRandom. Racket uses this to implement crypto-random-bytes, 
which uses /dev/urandom on Unix-like systems. It's also apparently used 
by Chromium, Firefox, and many others.

Racket example: 
https://github.com/racket/racket/blob/master/racket/collects/racket/private/windows-rand.rkt

C example from Microsoft: 
http://web.archive.org/web/20180929235240/https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/

Documentation, such as it is: 
https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom

Mozilla thread explaining why the warnings in that documentation are 
irrelevant: https://bugzilla.mozilla.org/show_bug.cgi?id=504270#c4

-Philip


  reply	other threads:[~2022-06-15 11:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  1:49 maradns reproducibility fixes and the merits of picking a random number Vagrant Cascadian
2022-06-07  3:24 ` Felix Lechner
2022-06-07  5:20   ` Julien Lepiller
2022-06-07 12:11     ` Brian Cully via Development of GNU Guix and the GNU System distribution.
2022-06-08 11:48       ` Efraim Flashner
2022-06-08 14:09         ` Tobias Geerinckx-Rice
2022-06-08 11:47     ` Efraim Flashner
2022-06-08 20:33       ` Vagrant Cascadian
2022-06-23  2:05         ` Vagrant Cascadian
2022-06-28  1:31           ` Vagrant Cascadian
2022-06-28  9:30             ` Efraim Flashner
2022-06-28 15:39               ` Jack Hill
2022-06-28 16:04               ` Tobias Geerinckx-Rice
2022-06-28 16:18                 ` Gábor Boskovits
2022-06-28 16:33                   ` Vagrant Cascadian
2022-06-28 19:06                     ` Tobias Geerinckx-Rice
2022-06-28 19:15                       ` Tobias Geerinckx-Rice
2022-07-12  2:36                       ` Vagrant Cascadian
2022-07-12  2:41                         ` Vagrant Cascadian
2022-07-18 11:21                           ` Ludovic Courtès
2022-07-19 13:09                             ` Tobias Geerinckx-Rice
2022-06-07 15:15 ` Ludovic Courtès
2022-06-08 19:28 ` Arun Isaac
2022-06-08 20:25   ` Vagrant Cascadian
2022-06-14 17:16     ` Philip McGrath [this message]
2022-06-08 19:43 ` Liliana Marie Prikler
2022-06-08 20:23   ` Vagrant Cascadian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ee4b604-9921-7e50-b1c8-e0c7a63ffcda@gmail.com \
    --to=philip.mcgrath@gmail.com \
    --cc=arunisaac@systemreboot.net \
    --cc=guix-devel@gnu.org \
    --cc=vagrant@reproducible-builds.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).