Fixes #823.
Fwiw, I considered to make this a constant-time function but didn’t do it in the end. Most constant-time memcmp
replacements are actually only inequality checks but we need a real memcmp
which outputs which one of the arguments is larger.
If you look at crypto libraries, there are a few candidates but I found this overkill for our use case https://github.com/jedisct1/libsodium/blob/a8fa837aacd310bc08fa72705a738fafc2513125/src/libsodium/sodium/utils.c#L239 https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/timingsafe_memcmp.c?rev=1.1&content-type=text/x-cvsweb-markup
If we need a constant-time function in the future, it’ll probably be only for equality/inequality, and then we can add the standard “OR of byte-wise XOR” implementation.