Greenbone Vulnerability Management Libraries
21.4.2
|
#include "passwordbasedauthentication.h"
#include "authutils.c"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <crypt.h>
Macros | |
#define | __USE_GNU |
#define | INVALID_HASH "1234567890$" |
#define | CRYPT_GENSALT_OUTPUT_SIZE 192 |
#define | CRYPT_OUTPUT_SIZE 384 |
Functions | |
int | is_prefix_supported (const char *id) |
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) |
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 |
#define CRYPT_GENSALT_OUTPUT_SIZE 192 |
#define CRYPT_OUTPUT_SIZE 384 |
#define INVALID_HASH "1234567890$" |
char* crypt_gensalt_r | ( | const char * | prefix, |
unsigned long | count, | ||
const char * | rbytes, | ||
int | nrbytes, | ||
char * | output, | ||
int | output_size | ||
) |
int get_random | ( | char * | buf, |
size_t | buflen | ||
) |
int is_prefix_supported | ( | const char * | id | ) |
void pba_finalize | ( | struct PBASettings * | settings | ) |
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
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.
int pba_is_phc_compliant | ( | const char * | setting | ) |
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.
const char ascii64[64] |