From nobody Sun Mar 27 02:16:17 2022 X-Original-To: freebsd-security@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4E04D1A5155D for ; Sun, 27 Mar 2022 02:16:19 +0000 (UTC) (envelope-from grarpamp@gmail.com) Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [IPv6:2607:f8b0:4864:20::e31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KQzw2460Nz3HsK for ; Sun, 27 Mar 2022 02:16:18 +0000 (UTC) (envelope-from grarpamp@gmail.com) Received: by mail-vs1-xe31.google.com with SMTP id v206so12270018vsv.2 for ; Sat, 26 Mar 2022 19:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=GgAy+JsX8oqYVPhUK6cgjZf1cIQjA8VDl5zl5fXiSUI=; b=Nao4ZJSzmSADfeFhQhcC5ZVZc3w9FPKl1kKmWwJSxHO8DqMRfXClUqLsyoMkcfHhqh IaIMZN2ubZsmij67z3DOiL9yKiJvoGN4xOhlh8982bGAIF3SiWvlZBt9rfOBo+ZDNINO l9EjxJDibgHS3zq+L4jXmCYO31NB33TLqZ2vgOuAOkoN9F6DflgbNY98TUTKwP0WLTTl MtlVSvh9MCupNJQyvEL6ReMFwykETPXxZQI/Id6YzZY/PdjidI72YNHsD7+h7/a4SaHL +ukDGmM3087Yd8GwSTPzU1RAv91gnVKFftNoOvMhHSnzOB2bzLVyDlaWhHZ2dvKLJpTD oo5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=GgAy+JsX8oqYVPhUK6cgjZf1cIQjA8VDl5zl5fXiSUI=; b=5a11CsaAo0QMhwhly6e0YH1a8fPWlhB4EoIqQAICruE1nukNu+rJ2ZG0+sICmo53St FgyTtjcwYNvnGlywz9BlQIMOPUzlmT+v510nab4fCDXd5Wx8sURLZFDmCDOjOwE5YM5b WLJ80G3B+oqO8myHINK6C2nAWtP53QYF645I+wXjRanwT03I+7PRarRCsHq7NgGevocQ +WSN43Pn6wI3bX496T9L2+fQvhUXpMQFDc518WuqrSyeca6xNsf8ga2RFcRx6RjbRiyF wtAFxdy6uAT8d9GlIk71s5UUMQ4M8fJsGrCyB9g6SLgnWamDbGSYcmiCvoGbPkUMt5Rl Afkg== X-Gm-Message-State: AOAM530/aUaPjRM1adTF7t1F4xKmZHJpAij4qz9xGSJH7qS7dS8Yeyyj Un9OdIpCTvUrU3BjtMyiDys1tNaWeKS5JokzH7hjUkj0yaBanCla6Ak= X-Google-Smtp-Source: ABdhPJxo6yuhZ0DYTM7GSCB7HUzZe5Nt0QHZYol9/d50o2up8TMplJSiegK4Jn8mkXhIlxuqpB0hZrWgtyXyrs9atBA= X-Received: by 2002:a05:6102:3f8a:b0:325:557a:7817 with SMTP id o10-20020a0561023f8a00b00325557a7817mr8096878vsv.46.1648347377884; Sat, 26 Mar 2022 19:16:17 -0700 (PDT) List-Id: Security issues List-Archive: https://lists.freebsd.org/archives/freebsd-security List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-security@freebsd.org X-BeenThere: freebsd-security@freebsd.org MIME-Version: 1.0 Received: by 2002:a05:612c:14c1:b0:2a2:beee:4b76 with HTTP; Sat, 26 Mar 2022 19:16:17 -0700 (PDT) In-Reply-To: References: From: grarpamp Date: Sat, 26 Mar 2022 22:16:17 -0400 Message-ID: Subject: Re: Adding entropy from external source into random number generator - how? To: freebsd-security@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4KQzw2460Nz3HsK X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=Nao4ZJSz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of grarpamp@gmail.com designates 2607:f8b0:4864:20::e31 as permitted sender) smtp.mailfrom=grarpamp@gmail.com X-Spamd-Result: default: False [-2.97 / 15.00]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_NONE(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.973]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-security@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::e31:from]; MLMMJ_DEST(0.00)[freebsd-security]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 3/26/22, freebsd-lists@sensation.net.au wrote: > I think the best way to do it would be to call random_harvest_queue(...), > but what do I use as the source enum (see /usr/include/sys/random.h)? > ENTROPYSOURCE, I guess? Try search for use of that function in the source, and maybe look into how RNG cards attach even in /dev... random(4) random_harvest(9) random_fortuna kern.random.harvest.mask_symbolic crypto(4) crypto(9) rndtest(4) > I believe it's also possible to open /dev/random for write to inject entropy > but I cannot find any mention of that scenario in the man pages. Using serial port as entropy source (either as interrupt and/or data), even USB video audio radios environmentals, might already have a handbook or wiki page, if not then interested users could make one. If injecting that data isn't in random(4), a script example of that is in... /etc/rc.d/random Along with some entropy file parts mentioned in... loader.conf(5) rc.conf(5) The choice of 4096 bytes should be documented. Search also ports for RNG things. > whether ~45 kilobytes per second of > additional entropy is even useful in a typical situation? CSPRNGs often try not to break no matter how much output is read, accept a bit-equivalent amount of random seed (ie 256-bits), and are speed limited only by cpu system. If doing only this: "HWRNG_stream XOR plaintext_stream", then in that case you could only get ~45kB/s throughput. > All entropy is good entropy, right? At least one source must be good. Having more good sources monitored and feeding into things can serve as redundant coverage. Search: Claude Shannon, one time pad, XOR, CSPRNG, HWRNG, applications such as casinos bitcoin keygeneration fobs, fun sources to collect, etc.