|
Greenbone Vulnerability Management Libraries 22.8.0
|
#include "passwordbasedauthentication.h"#include "authutils.c"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <crypt.h>

Go to the source code of this file.
Macros | |
| #define | __USE_GNU |
| #define | INVALID_HASH "1234567890$" |
| #define | CRYPT_GENSALT_OUTPUT_SIZE 192 |
| #define | CRYPT_OUTPUT_SIZE 384 |
Functions | |
| static int | is_prefix_supported (const char *id) |
| static int | get_random (char *buf, size_t buflen) |
| char * | crypt_gensalt_r (const char *prefix, unsigned long count, const char *rbytes, int nrbytes, char *output, int output_size) |
| struct PBASettings * | pba_init (const char *pepper, unsigned int pepper_size, unsigned int count, char *prefix) |
| void | pba_finalize (struct PBASettings *settings) |
| static int | pba_is_phc_compliant (const char *setting) |
| char * | pba_hash (struct PBASettings *setting, const char *password) |
| enum pba_rc | pba_verify_hash (const struct PBASettings *setting, const char *hash, const char *password) |
Variables | |
| const char | ascii64 [64] |
| #define __USE_GNU |
Definition at line 16 of file passwordbasedauthentication.c.
| #define CRYPT_GENSALT_OUTPUT_SIZE 192 |
Definition at line 24 of file passwordbasedauthentication.c.
| #define CRYPT_OUTPUT_SIZE 384 |
Definition at line 28 of file passwordbasedauthentication.c.
| #define INVALID_HASH "1234567890$" |
Definition at line 22 of file passwordbasedauthentication.c.
| char * crypt_gensalt_r | ( | const char * | prefix, |
| unsigned long | count, | ||
| const char * | rbytes, | ||
| int | nrbytes, | ||
| char * | output, | ||
| int | output_size | ||
| ) |
Definition at line 85 of file passwordbasedauthentication.c.
References ascii64, get_random(), is_prefix_supported(), and PREFIX_DEFAULT.
Referenced by pba_hash().


|
static |
Definition at line 49 of file passwordbasedauthentication.c.
Referenced by crypt_gensalt_r().

|
static |
Definition at line 32 of file passwordbasedauthentication.c.
References PREFIX_DEFAULT.
Referenced by crypt_gensalt_r(), pba_hash(), pba_init(), and pba_verify_hash().

| void pba_finalize | ( | struct PBASettings * | settings | ) |
Definition at line 152 of file passwordbasedauthentication.c.
Referenced by Ensure().

| char * pba_hash | ( | struct PBASettings * | setting, |
| const char * | password | ||
| ) |
pba_hash tries to create a hash based SETTING and PASSWORD. Returns a hash on success or a NULL pointer on failure
Definition at line 168 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().


| struct PBASettings * pba_init | ( | const char * | pepper, |
| unsigned int | pepper_size, | ||
| unsigned int | count, | ||
| char * | prefix | ||
| ) |
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.
Definition at line 133 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().


|
static |
Definition at line 158 of file passwordbasedauthentication.c.
Referenced by Ensure(), and pba_verify_hash().

| enum pba_rc pba_verify_hash | ( | const struct PBASettings * | settings, |
| const char * | hash, | ||
| const char * | password | ||
| ) |
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.
Definition at line 215 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().


| const char ascii64[64] |
Definition at line 44 of file passwordbasedauthentication.c.
Referenced by crypt_gensalt_r().