Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
srp.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  SRP_NGType {
  SRP_NG_1024 , SRP_NG_2048 , SRP_NG_4096 , SRP_NG_8192 ,
  SRP_NG_CUSTOM
}
 
enum  SRP_HashAlgorithm { SRP_SHA256 }
 
enum  SRP_Result { SRP_ERR , SRP_OK }
 

Functions

SRP_Result srp_create_salted_verification_key (SRP_HashAlgorithm alg, SRP_NGType ng_type, const char *username_for_verifier, const unsigned char *password, size_t len_password, unsigned char **bytes_s, size_t *len_s, unsigned char **bytes_v, size_t *len_v, const char *n_hex, const char *g_hex)
 
struct SRPVerifiersrp_verifier_new (SRP_HashAlgorithm alg, SRP_NGType ng_type, const char *username, const unsigned char *bytes_s, size_t len_s, const unsigned char *bytes_v, size_t len_v, const unsigned char *bytes_A, size_t len_A, const unsigned char *bytes_b, size_t len_b, unsigned char **bytes_B, size_t *len_B, const char *n_hex, const char *g_hex)
 
void srp_verifier_delete (struct SRPVerifier *ver)
 
int srp_verifier_is_authenticated (struct SRPVerifier *ver)
 
const char * srp_verifier_get_username (struct SRPVerifier *ver)
 
const unsigned char * srp_verifier_get_session_key (struct SRPVerifier *ver, size_t *key_length)
 
size_t srp_verifier_get_session_key_length (struct SRPVerifier *ver)
 
void srp_verifier_verify_session (struct SRPVerifier *ver, const unsigned char *user_M, unsigned char **bytes_HAMK)
 
struct SRPUsersrp_user_new (SRP_HashAlgorithm alg, SRP_NGType ng_type, const char *username, const char *username_for_verifier, const unsigned char *bytes_password, size_t len_password, const char *n_hex, const char *g_hex)
 
void srp_user_delete (struct SRPUser *usr)
 
int srp_user_is_authenticated (struct SRPUser *usr)
 
const char * srp_user_get_username (struct SRPUser *usr)
 
const unsigned char * srp_user_get_session_key (struct SRPUser *usr, size_t *key_length)
 
size_t srp_user_get_session_key_length (struct SRPUser *usr)
 
SRP_Result srp_user_start_authentication (struct SRPUser *usr, char **username, const unsigned char *bytes_a, size_t len_a, unsigned char **bytes_A, size_t *len_A)
 
void srp_user_process_challenge (struct SRPUser *usr, const unsigned char *bytes_s, size_t len_s, const unsigned char *bytes_B, size_t len_B, unsigned char **bytes_M, size_t *len_M)
 
void srp_user_verify_session (struct SRPUser *usr, const unsigned char *bytes_HAMK)
 

Enumeration Type Documentation

◆ SRP_HashAlgorithm

Enumerator
SRP_SHA256 

◆ SRP_NGType

enum SRP_NGType
Enumerator
SRP_NG_1024 
SRP_NG_2048 
SRP_NG_4096 
SRP_NG_8192 
SRP_NG_CUSTOM 

◆ SRP_Result

enum SRP_Result
Enumerator
SRP_ERR 
SRP_OK 

Function Documentation

◆ srp_create_salted_verification_key()

SRP_Result srp_create_salted_verification_key ( SRP_HashAlgorithm alg,
SRP_NGType ng_type,
const char * username_for_verifier,
const unsigned char * password,
size_t len_password,
unsigned char ** bytes_s,
size_t * len_s,
unsigned char ** bytes_v,
size_t * len_v,
const char * n_hex,
const char * g_hex )

References calculate_x(), delete_ng(), NGConstant::g, mpz_num_bytes(), mpz_to_bin(), NGConstant::N, new_ng(), porting::secure_rand_fill_buf(), srp_dbg_num, SRP_ERR, and SRP_OK.

Referenced by gen_srp_v().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_user_delete()

void srp_user_delete ( struct SRPUser * usr)

References SRPUser::A, SRPUser::a, SRPUser::bytes_A, delete_ng(), SRPUser::ng, SRPUser::password, SRPUser::password_len, SRPUser::S, SRPUser::username, and SRPUser::username_verifier.

Referenced by Client::deleteAuthData(), and Client::handleCommand_Hello().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_user_get_session_key()

const unsigned char * srp_user_get_session_key ( struct SRPUser * usr,
size_t * key_length )

References SRPUser::hash_alg, hash_length(), and SRPUser::session_key.

+ Here is the call graph for this function:

◆ srp_user_get_session_key_length()

size_t srp_user_get_session_key_length ( struct SRPUser * usr)

References SRPUser::hash_alg, and hash_length().

+ Here is the call graph for this function:

◆ srp_user_get_username()

const char * srp_user_get_username ( struct SRPUser * usr)

References SRPUser::username.

◆ srp_user_is_authenticated()

int srp_user_is_authenticated ( struct SRPUser * usr)

◆ srp_user_new()

struct SRPUser * srp_user_new ( SRP_HashAlgorithm alg,
SRP_NGType ng_type,
const char * username,
const char * username_for_verifier,
const unsigned char * bytes_password,
size_t len_password,
const char * n_hex,
const char * g_hex )

References SRPUser::A, SRPUser::a, SRPUser::authenticated, SRPUser::bytes_A, delete_ng(), SRPUser::hash_alg, new_ng(), SRPUser::ng, SRPUser::password, SRPUser::password_len, SRPUser::S, SRPUser::username, and SRPUser::username_verifier.

Referenced by Client::startAuth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_user_process_challenge()

void srp_user_process_challenge ( struct SRPUser * usr,
const unsigned char * bytes_s,
size_t len_s,
const unsigned char * bytes_B,
size_t len_B,
unsigned char ** bytes_M,
size_t * len_M )

References SRPUser::A, SRPUser::a, calculate_H_AMK(), calculate_M(), calculate_x(), NGConstant::g, SRPUser::H_AMK, H_nn(), SRPUser::hash_alg, hash_length(), hash_num(), SRPUser::M, mpz_from_bin(), mpz_mulm(), mpz_subm(), NGConstant::N, SRPUser::ng, SRPUser::password, SRPUser::password_len, SRPUser::S, SRPUser::session_key, srp_dbg_num, SRPUser::username, and SRPUser::username_verifier.

Referenced by Client::handleCommand_SrpBytesSandB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_user_start_authentication()

SRP_Result srp_user_start_authentication ( struct SRPUser * usr,
char ** username,
const unsigned char * bytes_a,
size_t len_a,
unsigned char ** bytes_A,
size_t * len_A )

References SRPUser::A, SRPUser::a, SRPUser::bytes_A, NGConstant::g, mpz_fill_random(), mpz_from_bin(), mpz_num_bytes(), mpz_to_bin(), NGConstant::N, SRPUser::ng, SRP_ERR, SRP_OK, and SRPUser::username.

Referenced by Client::startAuth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_user_verify_session()

void srp_user_verify_session ( struct SRPUser * usr,
const unsigned char * bytes_HAMK )

References SRPUser::authenticated, SRPUser::H_AMK, SRPUser::hash_alg, and hash_length().

+ Here is the call graph for this function:

◆ srp_verifier_delete()

void srp_verifier_delete ( struct SRPVerifier * ver)

References SRPVerifier::bytes_B, delete_ng(), SRPVerifier::ng, and SRPVerifier::username.

Referenced by RemoteClient::resetChosenMech().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_verifier_get_session_key()

const unsigned char * srp_verifier_get_session_key ( struct SRPVerifier * ver,
size_t * key_length )

References SRPVerifier::hash_alg, hash_length(), and SRPVerifier::session_key.

+ Here is the call graph for this function:

◆ srp_verifier_get_session_key_length()

size_t srp_verifier_get_session_key_length ( struct SRPVerifier * ver)

References SRPVerifier::hash_alg, and hash_length().

Referenced by Server::handleCommand_SrpBytesM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_verifier_get_username()

const char * srp_verifier_get_username ( struct SRPVerifier * ver)

References SRPVerifier::username.

◆ srp_verifier_is_authenticated()

int srp_verifier_is_authenticated ( struct SRPVerifier * ver)

◆ srp_verifier_new()

struct SRPVerifier * srp_verifier_new ( SRP_HashAlgorithm alg,
SRP_NGType ng_type,
const char * username,
const unsigned char * bytes_s,
size_t len_s,
const unsigned char * bytes_v,
size_t len_v,
const unsigned char * bytes_A,
size_t len_A,
const unsigned char * bytes_b,
size_t len_b,
unsigned char ** bytes_B,
size_t * len_B,
const char * n_hex,
const char * g_hex )

References SRPVerifier::authenticated, SRPVerifier::bytes_B, calculate_H_AMK(), calculate_M(), NGConstant::g, SRPVerifier::H_AMK, H_nn(), SRPVerifier::hash_alg, hash_num(), SRPVerifier::M, mpz_addm(), mpz_fill_random(), mpz_from_bin(), mpz_mulm(), mpz_num_bytes(), mpz_to_bin(), NGConstant::N, new_ng(), SRPVerifier::ng, SRPVerifier::session_key, srp_dbg_num, and SRPVerifier::username.

Referenced by Server::handleCommand_SrpBytesA().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ srp_verifier_verify_session()

void srp_verifier_verify_session ( struct SRPVerifier * ver,
const unsigned char * user_M,
unsigned char ** bytes_HAMK )

References SRPVerifier::authenticated, SRPVerifier::H_AMK, SRPVerifier::hash_alg, hash_length(), and SRPVerifier::M.

Referenced by Server::handleCommand_SrpBytesM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: