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

Re: [PATCH] builtin/receive-pack: use constant-time comparison for HMAC value

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Apr 22, 2020, 10:27 UTC
Message-ID
<20200422102734.GA3063@szeder.dev>
In-Reply-To
<20200409233730.680612-1-sandals@crustytoothpaste.net>
On Thu, Apr 09, 2020 at 11:37:30PM +0000, brian m. carlson wrote:
Show 11 quoted lines
> +/*
> + * Return zero if a and b are equal up to n bytes and nonzero if they are not.
> + * This operation is guaranteed to run in constant time to avoid leaking data.
> + */
> +static int constant_memequal(const char *a, const char *b, size_t n)
> +{
> +	int res = 0;
> +	for (size_t i = 0; i < n; i++)
> +		res |= a[i] ^ b[i];
> +	return res;
> +}
    CC builtin/receive-pack.o
builtin/receive-pack.c: In function ‘constant_memequal’:
builtin/receive-pack.c:509:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for (size_t i = 0; i < n; i++)
  ^
Previous: brian m. carlsonNext: Junio C Hamano
Message 5 of 6 in “builtin/receive-pack: use constant-time comparison for HMAC value”
  1. builtin/receive-pack: use constant-time comparison for HMAC valuebrian m. carlson, Apr 9, 2020
  2. Junio C HamanoApr 10, 2020
  3. Junio C HamanoApr 10, 2020
  4. brian m. carlsonApr 10, 2020
  5. SZEDER GáborApr 22, 2020
  6. Junio C HamanoApr 22, 2020

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.