pgsql: Misc SCRAM code cleanups.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Misc SCRAM code cleanups.
Date: 2017-04-28 12:24:03
Message-ID: E1d44wN-0007jP-8Z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Misc SCRAM code cleanups.

* Move computation of SaltedPassword to a separate function from
scram_ClientOrServerKey(). This saves a lot of cycles in libpq, by
computing SaltedPassword only once per authentication. (Computing
SaltedPassword is expensive by design.)

* Split scram_ClientOrServerKey() into two functions. Improves
readability, by making the calling code less verbose.

* Rename "server proof" to "server signature", to better match the
nomenclature used in RFC 5802.

* Rename SCRAM_SALT_LEN to SCRAM_DEFAULT_SALT_LEN, to make it more clear
that the salt can be of any length, and the constant only specifies how
long a salt we use when we generate a new verifier. Also rename
SCRAM_ITERATIONS_DEFAULT to SCRAM_DEFAULT_ITERATIONS, for consistency.

These things caught my eye while working on other upcoming changes.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d981074c24d2f1e4f44bc6d80e967e523ce64f50

Modified Files
--------------
src/backend/libpq/auth-scram.c | 36 +++++++++++-----------
src/common/scram-common.c | 51 ++++++++++++++++++++-----------
src/include/common/scram-common.h | 15 ++++------
src/interfaces/libpq/fe-auth-scram.c | 58 +++++++++++++++++++-----------------
4 files changed, 89 insertions(+), 71 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-04-28 17:48:21 pgsql: Wait between tablesync worker restarts
Previous Message Thomas Munro 2017-04-28 05:10:42 Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders