From: Patrick Steinhardt <ps@pks•im>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org, Evan Martin <evan.martin@gmail•com>,
Eli Schwartz <eschwartz@gentoo•org>
Subject: Re: [PATCH 7/9] meson: make the CSPRNG backend configurable
Date: Tue, 14 Jan 2025 10:13:26 +0100 [thread overview]
Message-ID: <Z4YqtlfxIh4p6qPx@pks.im> (raw)
In-Reply-To: <xmqqr0568uhy.fsf@gitster.g>
On Mon, Jan 13, 2025 at 09:59:53AM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks•im> writes:
> > +if csprng_backend in ['auto', 'arc4random'] and compiler.has_header_symbol('stdlib.h', 'arc4random_buf', required: csprng_backend == 'arc4random')
> > libgit_c_args += '-DHAVE_ARC4RANDOM'
> > -elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf')
> > + csprng_backend = 'arc4random'
> > +elif csprng_backend in ['auto', 'arc4random_bsd'] and compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf', required: csprng_backend == 'arc4random_bsd')
> > libgit_c_args += '-DHAVE_ARC4RANDOM_BSD'
> > -elif compiler.has_function('getrandom', prefix: '#include <sys/random.h>')
> > + csprng_backend = 'arc4random_bsd'
> > +elif csprng_backend in ['auto', 'getrandom'] and compiler.has_function('getrandom', prefix: '#include <sys/random.h>', required: csprng_backend == 'getrandom')
> > libgit_c_args += '-DHAVE_GETRANDOM'
> > -elif compiler.has_function('getentropy', prefix: '#include <unistd.h>')
> > + csprng_backend = 'getrandom'
> > +elif csprng_backend in ['auto', 'getentropy'] and compiler.has_function('getentropy', prefix: '#include <unistd.h>', required: csprng_backend == 'getentropy')
> > libgit_c_args += '-DHAVE_GETENTROPY'
> > -elif compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>')
> > + csprng_backend = 'getentropy'
> > +elif csprng_backend in ['auto', 'rtlgenrandom'] and compiler.has_function('RtlGenRandom', prefix: '#include <windows.h>\n#include <ntsecapi.h>', required: csprng_backend == 'rtlgenrandom')
> > libgit_c_args += '-DHAVE_RTLGENRANDOM'
> > -elif openssl.found()
> > + csprng_backend = 'rtlgenrandom'
> > +elif csprng_backend in ['auto', 'openssl'] and openssl.found()
> > libgit_c_args += '-DHAVE_OPENSSL_CSPRNG'
> > + csprng_backend = 'openssl'
> > +elif csprng_backend in ['auto', 'urandom']
> > + csprng_backend = 'urandom'
> > +else
> > + error('Unsupported CSPRNG backend: ' + csprng_backend)
> > endif
>
> IIRC, the precedence order of CPP macros related to csprng backends
> were chosen to reflect our preference for more secure and faster
> ones over the ones that are less so. Does the above list recreate
> the same order, and do we want to somehow make sure future
> developers would not break that order without knowing our intention,
> saying "when all things are equal, we should sort in alphabetical
> order" or something?
Yup, it's the exact same order as we have in our Makefile and as in
"wrapper.c". And yes, good idea, I'll add a comment.
Patrick
next prev parent reply other threads:[~2025-01-14 9:13 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 8:33 [PATCH 0/9] meson: a couple of additions Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 1/9] GIT-VERSION-GEN: simplify computing the dirty marker Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 2/9] GIT-VERSION-GEN: move default version into a separate file Patrick Steinhardt
2025-01-13 17:42 ` Junio C Hamano
2025-01-13 17:51 ` Eli Schwartz
2025-01-14 9:13 ` Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 3/9] meson: fix dependencies for generated headers Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 4/9] meson: wire up development environments Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 5/9] meson: wire up generation of distribution archive Patrick Steinhardt
2025-01-13 17:55 ` Junio C Hamano
2025-01-14 9:14 ` Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 6/9] meson: wire up fuzzers Patrick Steinhardt
2025-01-13 17:48 ` Junio C Hamano
2025-01-14 10:31 ` Patrick Steinhardt
2025-01-13 8:33 ` [PATCH 7/9] meson: make the CSPRNG backend configurable Patrick Steinhardt
2025-01-13 9:25 ` Patrick Steinhardt
2025-01-13 17:59 ` Junio C Hamano
2025-01-14 9:13 ` Patrick Steinhardt [this message]
2025-01-14 19:13 ` Junio C Hamano
2025-01-13 8:33 ` [PATCH 8/9] meson: fix compilation with Visual Studio Patrick Steinhardt
2025-01-13 21:12 ` M Hickford
2025-01-13 8:33 ` [PATCH 9/9] ci: wire up Visual Studio build with Meson Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 00/11] meson: a couple of additions Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 01/11] GIT-VERSION-GEN: simplify computing the dirty marker Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 02/11] GIT-VERSION-GEN: allow running without input and output files Patrick Steinhardt
2025-01-21 13:16 ` Toon Claes
2025-01-14 11:56 ` [PATCH v2 03/11] meson: populate project version via GIT-VERSION-GEN Patrick Steinhardt
2025-01-21 13:13 ` Toon Claes
2025-01-14 11:56 ` [PATCH v2 04/11] meson: fix dependencies for generated headers Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 05/11] meson: wire up development environments Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 06/11] meson: wire up generation of distribution archive Patrick Steinhardt
2025-01-21 12:37 ` Toon Claes
2025-01-22 12:05 ` Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 07/11] meson: wire up fuzzers Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 08/11] meson: make the CSPRNG backend configurable Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 09/11] meson: fix compilation with Visual Studio Patrick Steinhardt
2025-01-14 11:56 ` [PATCH v2 10/11] ci: raise error when Meson generates warnings Patrick Steinhardt
2025-01-21 12:59 ` Toon Claes
2025-01-14 11:56 ` [PATCH v2 11/11] ci: wire up Visual Studio build with Meson Patrick Steinhardt
2025-01-14 17:46 ` [PATCH v2 00/11] meson: a couple of additions Junio C Hamano
2025-01-22 12:05 ` [PATCH v3 " Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 01/11] GIT-VERSION-GEN: simplify computing the dirty marker Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 02/11] GIT-VERSION-GEN: allow running without input and output files Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 03/11] meson: populate project version via GIT-VERSION-GEN Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 04/11] meson: fix dependencies for generated headers Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 05/11] meson: wire up development environments Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 06/11] meson: wire up generation of distribution archive Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 07/11] meson: wire up fuzzers Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 08/11] meson: make the CSPRNG backend configurable Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 09/11] meson: fix compilation with Visual Studio Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 10/11] ci: raise error when Meson generates warnings Patrick Steinhardt
2025-01-22 12:05 ` [PATCH v3 11/11] ci: wire up Visual Studio build with Meson Patrick Steinhardt
2025-01-22 21:42 ` [PATCH v3 00/11] meson: a couple of additions Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z4YqtlfxIh4p6qPx@pks.im \
--to=ps@pks$(echo .)im \
--cc=eschwartz@gentoo$(echo .)org \
--cc=evan.martin@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox