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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 09, 2020 at 11:37:30PM +0000, brian m. carlson wrote:
> +/*
> + * 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++)
  ^



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux