lib/util: Delegate constant time memcmp to gnutls_memcmp()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 8 Jun 2022 03:19:58 +0000 (15:19 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Jun 2022 22:49:29 +0000 (22:49 +0000)
commitaec2076fa79b853e26b1fe606570f1c4ae94c79b
treeeccee93de8e43c569228175d4254cfb002bcef85
parent222e1afc6f9a49e99ae767d7572dfd16c236148d
lib/util: Delegate constant time memcmp to gnutls_memcmp()

gnutls_memcmp() is mostly identical to our own implementation, except
that ours will not break if supplied with 4 GiB or more of data.
However, using an external function permits us to disclaim
responsibility if some CPU/compiler combination happens to invalidate
our constant-time guarantee.

For reference, gnutls_memcmp() implementation:
https://gitlab.com/gnutls/gnutls/-/blob/78d9820de0d2eb2f8088e359779ee7342f5f089e/lib/safe-memfuncs.c#L41-67

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/util/util.c
lib/util/wscript_build