git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/2] wrapper: add a helper to generate numbers from a CSPRNG

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 4, 2022, 21:39 UTC
Message-ID
<xmqqlezvb2p2.fsf@gitster.g>
In-Reply-To
<xmqqsfu3b4gw.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 28 quoted lines
>> +ifeq ($(strip $(CSPRNG_METHOD)),arc4random)
>> +	BASIC_CFLAGS += -DHAVE_ARC4RANDOM
>> +endif
>> +
>> +ifeq ($(strip $(CSPRNG_METHOD)),arc4random-libbsd)
>> +	BASIC_CFLAGS += -DHAVE_ARC4RANDOM_LIBBSD
>> +	EXTLIBS += -lbsd
>> +endif
>> +
>> +ifeq ($(strip $(CSPRNG_METHOD)),getrandom)
>> +	BASIC_CFLAGS += -DHAVE_GETRANDOM
>> +endif
>> +
>> +ifeq ($(strip $(CSPRNG_METHOD)),getentropy)
>> +	BASIC_CFLAGS += -DHAVE_GETENTROPY
>> +endif
>> +
>> +ifeq ($(strip $(CSPRNG_METHOD)),rtlgenrandom)
>> +	BASIC_CFLAGS += -DHAVE_RTLGENRANDOM
>> +endif
>> +
>> +ifeq ($(strip $(CSPRNG_METHOD)),openssl)
>> +	BASIC_CFLAGS += -DHAVE_OPENSSL_CSPRNG
>> +endif
>
> Use of $(strip ($VAR)) looks a bit different from what everybody
> else does with ifeq in this Makefile.  Was there a particular reason
> to use it that I am missing?

Another thought. As far as I can see on the C code side in the later part of the patch, we are prepared to see multiple HAVE_* for CSPRNG defined by the builders, and let us choose the best one for them. I wonder if it makes sense to allow

    make CSPRNG_METHOD='arc4random getentropy'

as a way to tell us that they have these two and want us to pick the best one for them.

It does not add much value for human builders, but I suspect that it would make it simpler when we need to add autoconf support.

If we do not allow multiple methods listed on the CSPRNG_METHOD variable, the configure script will be forced to pick one in some way when multiple methods are possible on the platform, either by detecting all and picking one, or detecting serially from most preferred and stopping at the first hit.

Previous: Junio C HamanoNext: brian m. carlson
Message 4 of 23 in “Generate temporary files using a CSPRNG”
  1. 0/2 Generate temporary files using a CSPRNGbrian m. carlson, Jan 4, 2022
  2. 1/2 wrapper: add a helper to generate numbers from a CSPRNGbrian m. carlson, Jan 4, 2022
  3. Junio C HamanoJan 4, 2022
  4. Junio C HamanoJan 4, 2022
  5. brian m. carlsonJan 4, 2022
  6. brian m. carlsonJan 4, 2022
  7. Junio C HamanoJan 4, 2022
  8. 2/2 wrapper: use a CSPRNG to generate random file namesbrian m. carlson, Jan 4, 2022
  9. Johannes SchindelinJan 4, 2022
  10. 0/2 Generate temporary files using a CSPRNGbrian m. carlson, Jan 17, 2022
  11. 2/2 wrapper: use a CSPRNG to generate random file namesbrian m. carlson, Jan 17, 2022
  12. Ævar Arnfjörð BjarmasonJan 18, 2022
  13. René ScharfeJan 18, 2022
  14. Ævar Arnfjörð BjarmasonJan 18, 2022
  15. René ScharfeJan 18, 2022
  16. Junio C HamanoJan 18, 2022
  17. René ScharfeJan 19, 2022
  18. René ScharfeJan 22, 2022
  19. Junio C HamanoJan 24, 2022
  20. brian m. carlsonJan 19, 2022
  21. 1/2 wrapper: add a helper to generate numbers from a CSPRNGbrian m. carlson, Jan 17, 2022
  22. Ævar Arnfjörð BjarmasonJan 18, 2022
  23. René ScharfeJan 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.