PostgreSQL Source Code  git master
scram.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * scram.h
4  * Interface to libpq/scram.c
5  *
6  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/libpq/scram.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PG_SCRAM_H
14 #define PG_SCRAM_H
15 
16 #include "common/cryptohash.h"
17 #include "lib/stringinfo.h"
18 #include "libpq/libpq-be.h"
19 #include "libpq/sasl.h"
20 
21 /* Number of iterations when generating new secrets */
23 
24 /* SASL implementation callbacks */
26 
27 /* Routines to handle and check SCRAM-SHA-256 secret */
28 extern char *pg_be_scram_build_secret(const char *password);
29 extern bool parse_scram_secret(const char *secret,
30  int *iterations,
31  pg_cryptohash_type *hash_type,
32  int *key_length, char **salt,
33  uint8 *stored_key, uint8 *server_key);
34 extern bool scram_verify_plain_password(const char *username,
35  const char *password, const char *secret);
36 
37 #endif /* PG_SCRAM_H */
#define PGDLLIMPORT
Definition: c.h:1274
uint8_t uint8
Definition: c.h:483
pg_cryptohash_type
Definition: cryptohash.h:20
static char * username
Definition: initdb.c:153
bool parse_scram_secret(const char *secret, int *iterations, pg_cryptohash_type *hash_type, int *key_length, char **salt, uint8 *stored_key, uint8 *server_key)
Definition: auth-scram.c:591
PGDLLIMPORT const pg_be_sasl_mech pg_be_scram_mech
Definition: auth-scram.c:113
PGDLLIMPORT int scram_sha_256_iterations
Definition: auth-scram.c:194
char * pg_be_scram_build_secret(const char *password)
Definition: auth-scram.c:474
bool scram_verify_plain_password(const char *username, const char *password, const char *secret)
Definition: auth-scram.c:514
static char * password
Definition: streamutil.c:52
int iterations
Definition: thread-thread.c:39