networkclient
Internal support functions.

Macros

#define return_NR_ERR(_x)   return -(NR_ERR_ ## _x)
 

Functions

ssize_t nr_password_encrypt (uint8_t *output, size_t outlen, const uint8_t *input, size_t inlen, const char *secret, const uint8_t *vector)
 
ssize_t nr_tunnelpw_encrypt (uint8_t *output, size_t outlen, const uint8_t *input, size_t inlen, const char *secret, const uint8_t *vector)
 
ssize_t nr_tunnelpw_decrypt (uint8_t *output, size_t outlen, const uint8_t *input, size_t inlen, const char *secret, const uint8_t *vector)
 
void nr_hmac_md5 (const uint8_t *data, size_t data_len, const uint8_t *key, size_t key_len, uint8_t digest[16])
 
int nr_tlv_ok (const uint8_t *data, size_t length, size_t dv_type, size_t dv_length)
 

Detailed Description

These functions are required to perform internal or "low-level" data manipulation. While they are exposed for completeness, they should not be called by any application.

Macro Definition Documentation

Function Documentation

void nr_hmac_md5 ( const uint8_t *  data,
size_t  data_len,
const uint8_t *  key,
size_t  key_len,
uint8_t  digest[16] 
)

Calculates an HMAC-MD5.

Parameters
[in]dataData to be hashed
[in]data_lenLength of data to be hashed
[in]keyKey for the HMAC
[in]key_lenLength of the key
[out]digest

References NR_MD5_CTX, nr_MD5Final, nr_MD5Init, and nr_MD5Update.

Referenced by nr_packet_sign().

ssize_t nr_password_encrypt ( uint8_t *  output,
size_t  outlen,
const uint8_t *  input,
size_t  inlen,
const char *  secret,
const uint8_t *  vector 
)

Encrypts or decrypts a User-Password attribute.

Attention
This structure should only be accessed by internal RADIUS library functions.
Parameters
[out]outputBuffer where the password is stored
[out]outlenSize of the output buffer
[in]inputInput buffer with password
[in]inlenLength of the input buffer
[in]secretThe shared secret
[in]vectorAuthentication vector
Returns
<0 on error, or the length of data in "output"

References NR_MD5_CTX, nr_MD5Final, nr_MD5Init, nr_MD5Update, and return_NR_ERR.

int nr_tlv_ok ( const uint8_t *  data,
size_t  length,
size_t  dv_type,
size_t  dv_length 
)

Checks if a TLV is properly formatted.

Attention
This structure should only be accessed by internal RADIUS library functions.
Parameters
[in]dataData to check
[in]lengthLength of the data field
[in]dv_typeLength of the TLV "type" field
[in]dv_lengthLength of the TLV "length" field
Returns
<0 on error, 0 for "TLV is OK"

References nr_debug_error, and return_NR_ERR.

Referenced by nr_attr2vp_vsa(), and nr_packet_walk().

ssize_t nr_tunnelpw_decrypt ( uint8_t *  output,
size_t  outlen,
const uint8_t *  input,
size_t  inlen,
const char *  secret,
const uint8_t *  vector 
)

Decrypts a Tunnel-Password attribute.

Attention
This structure should only be accessed by internal RADIUS library functions.
Parameters
[out]outputBuffer where the password is stored
[out]outlenSize of the output buffer
[in]inputInput buffer with password
[in]inlenLength of the input buffer
[in]secretThe shared secret
[in]vectorAuthentication vector
Returns
<0 on error, or the length of data in "output"

References NR_MD5_CTX, nr_MD5Final, nr_MD5Init, nr_MD5Update, and return_NR_ERR.

ssize_t nr_tunnelpw_encrypt ( uint8_t *  output,
size_t  outlen,
const uint8_t *  input,
size_t  inlen,
const char *  secret,
const uint8_t *  vector 
)

Encrypts a Tunnel-Password attribute.

Attention
This structure should only be accessed by internal RADIUS library functions.
Parameters
[out]outputBuffer where the password is stored
[out]outlenSize of the output buffer
[in]inputInput buffer with password
[in]inlenLength of the input buffer
[in]secretThe shared secret
[in]vectorAuthentication vector
Returns
<0 on error, or the length of data in "output"

References NR_MD5_CTX, nr_MD5Final, nr_MD5Init, nr_MD5Update, nr_rand(), and return_NR_ERR.

Here is the call graph for this function: