|
Greenbone Vulnerability Management Libraries 22.32.0
|

Go to the source code of this file.
Data Structures | |
| struct | PBASettings |
Macros | |
| #define | MAX_PEPPER_SIZE 4 |
| #define | COUNT_DEFAULT 20000 |
| #define | PREFIX_DEFAULT "$6$" |
Enumerations | |
| enum | pba_rc { VALID , UPDATE_RECOMMENDED , INVALID , ERR } |
Functions | |
| struct PBASettings * | pba_init (const char *pepper, unsigned int pepper_size, unsigned int count, char *prefix) |
| Init PBA. | |
| char * | pba_hash (struct PBASettings *setting, const char *password) |
| Create a password hash. | |
| enum pba_rc | pba_verify_hash (const struct PBASettings *settings, const char *hash, const char *password) |
| Verify a password hash. | |
| void | pba_finalize (struct PBASettings *settings) |
| Cleanup PBA settings. | |
| #define COUNT_DEFAULT 20000 |
Definition at line 12 of file passwordbasedauthentication.h.
Referenced by pba_init().
| #define MAX_PEPPER_SIZE 4 |
Definition at line 10 of file passwordbasedauthentication.h.
Referenced by Ensure(), Ensure(), pba_hash(), pba_init(), and pba_verify_hash().
| #define PREFIX_DEFAULT "$6$" |
Definition at line 14 of file passwordbasedauthentication.h.
Referenced by crypt_gensalt_r(), is_prefix_supported(), and pba_init().
| enum pba_rc |
| Enumerator | |
|---|---|
| VALID | |
| UPDATE_RECOMMENDED | |
| INVALID | |
| ERR | |
Definition at line 45 of file passwordbasedauthentication.h.
| void pba_finalize | ( | struct PBASettings * | settings | ) |
Cleanup PBA settings.
| [in] | settings | PBA settings. |
Definition at line 189 of file passwordbasedauthentication.c.
Referenced by Ensure(), Ensure(), and Ensure().

| char * pba_hash | ( | struct PBASettings * | setting, |
| const char * | password ) |
Create a password hash.
pba_hash tries to create a hash based SETTING and PASSWORD. Returns a hash on success or a NULL pointer on failure
| [in] | setting | PBA settings. |
| [in] | password | Password. |
Definition at line 220 of file passwordbasedauthentication.c.
References PBASettings::count, CRYPT_GENSALT_OUTPUT_SIZE, crypt_gensalt_r(), CRYPT_OUTPUT_SIZE, is_prefix_supported(), MAX_PEPPER_SIZE, PBASettings::pepper, and PBASettings::prefix.
Referenced by Ensure(), Ensure(), Ensure(), and Ensure().


| struct PBASettings * pba_init | ( | const char * | pepper, |
| unsigned int | pepper_size, | ||
| unsigned int | count, | ||
| char * | prefix ) |
Init PBA.
Intitializes PBASettings with given PEPPER, PREFIX, COUNT.
PEPPER_SIZE must be lower or equal MAX_PEPPER_SIZE when PEPPER is set, when PEPPER is a NULL pointer, no pepper will be used and PEPPER_SIZE is ignored.
COUNT is set to COUNT_DEFAULT when it is 0, PREFIX is set to PREFIX_DEFAULT when prefix is a nullpointer.
Returns a pointer to PBASettings on success or NULL on failure.
| [in] | pepper | A static hidden addition to the randomly generated salt. |
| [in] | pepper_size | The size of pepper; it must not be larger than MAX_PEPPER_SIZE. |
| [in] | count | Number of rounds used to calculate the hash. 0 to use COUNT_DEFAULT. |
| [in] | prefix | The algorithm used, if NULL then the most secure available algorithm will be used. |
Definition at line 165 of file passwordbasedauthentication.c.
References PBASettings::count, COUNT_DEFAULT, is_prefix_supported(), MAX_PEPPER_SIZE, PBASettings::pepper, PBASettings::prefix, and PREFIX_DEFAULT.
Referenced by Ensure(), Ensure(), and Ensure().


| enum pba_rc pba_verify_hash | ( | const struct PBASettings * | setting, |
| const char * | hash, | ||
| const char * | password ) |
Verify a password hash.
pba_verify_hash tries to create hash based on PASSWORD and settings found via HASH and compares that with HASH.
Returns VALID if HASH and PASSWORD are correct; UPDATE_RECOMMENDED when the HASH and PASSWORD are correct but based on a deprecated algorithm; IVALID if HASH does not match PASSWORD; ERR if an unexpected error occurs.
| [in] | setting | PBA settings. |
| [in] | hash | Hash. |
| [in] | password | Password. |
Definition at line 276 of file passwordbasedauthentication.c.
References CRYPT_OUTPUT_SIZE, ERR, gvm_auth_init(), gvm_authenticate_classic(), initialized, INVALID, INVALID_HASH, is_prefix_supported(), MAX_PEPPER_SIZE, pba_is_phc_compliant(), PBASettings::pepper, PBASettings::prefix, UPDATE_RECOMMENDED, and VALID.
Referenced by Ensure(), Ensure(), and Ensure().

