networkclient
|
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) |
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.
#define return_NR_ERR | ( | _x | ) | return -(NR_ERR_ ## _x) |
Macro used to simplify debugging.
Referenced by nr_attr2data(), nr_attr2vp(), nr_attr2vp_raw(), nr_attr2vp_rfc(), nr_attr2vp_vsa(), nr_dict_attr_2struct(), nr_packet_attr_append(), nr_packet_can_encode(), nr_packet_decode(), nr_packet_encode(), nr_packet_init(), nr_packet_ok(), nr_packet_ok_raw(), nr_packet_response_ok(), nr_packet_sign(), nr_packet_verify(), nr_packet_vps_append(), nr_packet_walk(), nr_password_encrypt(), nr_socket_open(), nr_socket_recv(), nr_socket_recv_response(), nr_socket_send(), nr_socket_send_response(), nr_tlv_ok(), nr_track_id_alloc(), nr_track_id_close(), nr_track_id_init(), nr_track_id_packet_alloc(), nr_track_id_realloc(), nr_track_id_release(), nr_track_id_socket(), nr_transmit(), nr_transmit_init(), nr_tunnelpw_decrypt(), nr_tunnelpw_encrypt(), nr_vp2attr(), nr_vp2rfc(), nr_vp2vsa(), nr_vp_set_data(), nr_vp_set_raw_data(), nr_vp_snprintf_value(), nr_vp_sscanf(), and nr_vp_sscanf_value().
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.
[in] | data | Data to be hashed |
[in] | data_len | Length of data to be hashed |
[in] | key | Key for the HMAC |
[in] | key_len | Length 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.
[out] | output | Buffer where the password is stored |
[out] | outlen | Size of the output buffer |
[in] | input | Input buffer with password |
[in] | inlen | Length of the input buffer |
[in] | secret | The shared secret |
[in] | vector | Authentication vector |
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.
[in] | data | Data to check |
[in] | length | Length of the data field |
[in] | dv_type | Length of the TLV "type" field |
[in] | dv_length | Length of the TLV "length" field |
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.
[out] | output | Buffer where the password is stored |
[out] | outlen | Size of the output buffer |
[in] | input | Input buffer with password |
[in] | inlen | Length of the input buffer |
[in] | secret | The shared secret |
[in] | vector | Authentication vector |
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.
[out] | output | Buffer where the password is stored |
[out] | outlen | Size of the output buffer |
[in] | input | Input buffer with password |
[in] | inlen | Length of the input buffer |
[in] | secret | The shared secret |
[in] | vector | Authentication vector |
References NR_MD5_CTX, nr_MD5Final, nr_MD5Init, nr_MD5Update, nr_rand(), and return_NR_ERR.