| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Add timingsafe_bcmp(), for constant-time memory comparison |
| Date: | 2026-05-11 12:19:38 |
| Message-ID: | E1wMPbm-0002XF-16@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)jeltef(dot)nl>
Discussion: https://www.postgresql.org/message-id/7b86da3b-9356-4e50-aa1b-56570825e234@iki.fi
Security: CVE-2026-6478
Backpatch-through: 14
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/8e34acfda11595fdf2b1cfa96dc6949c34d34cd7
Author: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Modified Files
--------------
configure | 23 +++++++++++++++++++++++
configure.ac | 3 ++-
meson.build | 2 ++
src/include/pg_config.h.in | 7 +++++++
src/include/port.h | 4 ++++
src/port/meson.build | 1 +
src/port/timingsafe_bcmp.c | 43 +++++++++++++++++++++++++++++++++++++++++++
7 files changed, 82 insertions(+), 1 deletion(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-05-11 12:19:39 | pgsql: Check CREATE privilege on multirange type schema in CREATE TYPE. |
| Previous Message | Noah Misch | 2026-05-11 12:19:37 | pgsql: Harden our regex engine against integer overflow in size calcula |