Greenbone Vulnerability Management Libraries
22.8.0
passwordbasedauthentication.h
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2020-2023 Greenbone AG
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later
4
*/
5
6
#ifndef _GVM_PASSWORDBASEDAUTHENTICATION_H
7
#define _GVM_PASSWORDBASEDAUTHENTICATION_H
8
9
/* max amount of applied pepper */
10
#define MAX_PEPPER_SIZE 4
11
/* is used when count is 0 on init*/
12
#define COUNT_DEFAULT 20000
13
/* sha512 */
14
#define PREFIX_DEFAULT "$6$"
15
22
struct
PBASettings
23
{
24
char
pepper
[
MAX_PEPPER_SIZE
];
/* is statically applied to the random salt */
25
unsigned
int
count
;
/* controls the computational cost of the hash */
26
char
*
prefix
;
/* controls which hash function will be used */
27
};
40
struct
PBASettings
*
41
pba_init
(
const
char
*
pepper
,
unsigned
int
pepper_size,
unsigned
int
count
,
42
char
*
prefix
);
43
44
/* return values for pba pba_verify_hash */
45
enum
pba_rc
46
{
47
VALID
,
/* hash and password are correct */
48
UPDATE_RECOMMENDED
,
/* password is correct but in an outdated format*/
49
INVALID
,
/* password is incorrect */
50
ERR
,
/* unexpected error */
51
};
52
57
char
*
58
pba_hash
(
struct
PBASettings
*setting,
const
char
*password);
59
69
enum
pba_rc
70
pba_verify_hash
(
const
struct
PBASettings
*settings,
const
char
*hash,
71
const
char
*password);
72
73
void
74
pba_finalize
(
struct
PBASettings
*settings);
75
76
#endif
PBASettings::pepper
char pepper[MAX_PEPPER_SIZE]
Definition:
passwordbasedauthentication.h:24
pba_init
struct PBASettings * pba_init(const char *pepper, unsigned int pepper_size, unsigned int count, char *prefix)
Definition:
passwordbasedauthentication.c:133
ERR
@ ERR
Definition:
passwordbasedauthentication.h:50
MAX_PEPPER_SIZE
#define MAX_PEPPER_SIZE
Definition:
passwordbasedauthentication.h:10
UPDATE_RECOMMENDED
@ UPDATE_RECOMMENDED
Definition:
passwordbasedauthentication.h:48
pba_finalize
void pba_finalize(struct PBASettings *settings)
Definition:
passwordbasedauthentication.c:152
VALID
@ VALID
Definition:
passwordbasedauthentication.h:47
PBASettings
Definition:
passwordbasedauthentication.h:23
PBASettings::count
unsigned int count
Definition:
passwordbasedauthentication.h:25
pba_verify_hash
enum pba_rc pba_verify_hash(const struct PBASettings *settings, const char *hash, const char *password)
Definition:
passwordbasedauthentication.c:215
pba_rc
pba_rc
Definition:
passwordbasedauthentication.h:46
PBASettings::prefix
char * prefix
Definition:
passwordbasedauthentication.h:26
INVALID
@ INVALID
Definition:
passwordbasedauthentication.h:49
pba_hash
char * pba_hash(struct PBASettings *setting, const char *password)
Definition:
passwordbasedauthentication.c:168
util
passwordbasedauthentication.h
Generated on Wed Feb 7 2024 00:00:00 for Greenbone Vulnerability Management Libraries by
1.8.20