]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Add timingsafe_bcmp(), for constant-time memory comparison
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 11 May 2026 12:13:49 +0000 (05:13 -0700)
committerNoah Misch <noah@leadboat.com>
Mon, 11 May 2026 12:13:49 +0000 (05:13 -0700)
commit1604939b2210b93e34572ee6df499d103849c53e
treec6663af7883e4c368556f20ede034a75569fd88a
parent5c1069c35b49227f955735ea5f2a2ee1c9c48a63
Add timingsafe_bcmp(), for constant-time memory comparison

timingsafe_bcmp() should be used instead of memcmp() or a naive
for-loop, when comparing passwords or secret tokens, to avoid leaking
information about the secret token by timing. This commit just
introduces the function but does not change any existing code to use
it yet.

This has been initially applied as of 09be39112654 in v18 and newer
versions, and will be used in all the stable branches for an upcoming
fix.

Co-authored-by: Jelte Fennema-Nio <github-tech@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/7b86da3b-9356-4e50-aa1b-56570825e234@iki.fi
Security: CVE-2026-6478
Backpatch-through: 14
configure
configure.ac
meson.build
src/include/pg_config.h.in
src/include/port.h
src/port/meson.build
src/port/timingsafe_bcmp.c [new file with mode: 0644]
src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/Solution.pm