wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Functions
radius.c File Reference

RADIUS message processing. More...

#include "utils/includes.h"
#include "utils/common.h"
#include "utils/wpabuf.h"
#include "crypto/md5.h"
#include "crypto/crypto.h"
#include "radius.h"

Data Structures

struct  radius_msg
 RADIUS message structure for new and parsed messages. More...
 
struct  radius_attr_type
 
struct  radius_tunnel_attrs
 

Macros

#define RADIUS_ATTRS   ARRAY_SIZE(radius_attrs)
 

Functions

struct radius_hdrradius_msg_get_hdr (struct radius_msg *msg)
 
struct wpabufradius_msg_get_buf (struct radius_msg *msg)
 
struct radius_msgradius_msg_new (u8 code, u8 identifier)
 Create a new RADIUS message. More...
 
void radius_msg_free (struct radius_msg *msg)
 Free a RADIUS message. More...
 
void radius_msg_dump (struct radius_msg *msg)
 
int radius_msg_finish (struct radius_msg *msg, const u8 *secret, size_t secret_len)
 
int radius_msg_finish_srv (struct radius_msg *msg, const u8 *secret, size_t secret_len, const u8 *req_authenticator)
 
int radius_msg_finish_das_resp (struct radius_msg *msg, const u8 *secret, size_t secret_len, const struct radius_hdr *req_hdr)
 
void radius_msg_finish_acct (struct radius_msg *msg, const u8 *secret, size_t secret_len)
 
void radius_msg_finish_acct_resp (struct radius_msg *msg, const u8 *secret, size_t secret_len, const u8 *req_authenticator)
 
int radius_msg_verify_acct_req (struct radius_msg *msg, const u8 *secret, size_t secret_len)
 
int radius_msg_verify_das_req (struct radius_msg *msg, const u8 *secret, size_t secret_len)
 
struct radius_attr_hdrradius_msg_add_attr (struct radius_msg *msg, u8 type, const u8 *data, size_t data_len)
 
struct radius_msgradius_msg_parse (const u8 *data, size_t len)
 Parse a RADIUS message. More...
 
int radius_msg_add_eap (struct radius_msg *msg, const u8 *data, size_t data_len)
 
struct wpabufradius_msg_get_eap (struct radius_msg *msg)
 
int radius_msg_verify_msg_auth (struct radius_msg *msg, const u8 *secret, size_t secret_len, const u8 *req_auth)
 
int radius_msg_verify (struct radius_msg *msg, const u8 *secret, size_t secret_len, struct radius_msg *sent_msg, int auth)
 
int radius_msg_copy_attr (struct radius_msg *dst, struct radius_msg *src, u8 type)
 
void radius_msg_make_authenticator (struct radius_msg *msg, const u8 *data, size_t len)
 
struct radius_ms_mppe_keysradius_msg_get_ms_keys (struct radius_msg *msg, struct radius_msg *sent_msg, const u8 *secret, size_t secret_len)
 
struct radius_ms_mppe_keysradius_msg_get_cisco_keys (struct radius_msg *msg, struct radius_msg *sent_msg, const u8 *secret, size_t secret_len)
 
int radius_msg_add_mppe_keys (struct radius_msg *msg, const u8 *req_authenticator, const u8 *secret, size_t secret_len, const u8 *send_key, size_t send_key_len, const u8 *recv_key, size_t recv_key_len)
 
int radius_msg_add_wfa (struct radius_msg *msg, u8 subtype, const u8 *data, size_t len)
 
int radius_user_password_hide (struct radius_msg *msg, const u8 *data, size_t data_len, const u8 *secret, size_t secret_len, u8 *buf, size_t buf_len)
 
struct radius_attr_hdrradius_msg_add_attr_user_password (struct radius_msg *msg, const u8 *data, size_t data_len, const u8 *secret, size_t secret_len)
 
int radius_msg_get_attr (struct radius_msg *msg, u8 type, u8 *buf, size_t len)
 
int radius_msg_get_attr_ptr (struct radius_msg *msg, u8 type, u8 **buf, size_t *len, const u8 *start)
 
int radius_msg_count_attr (struct radius_msg *msg, u8 type, int min_len)
 
int radius_msg_get_vlanid (struct radius_msg *msg)
 Parse RADIUS attributes for VLAN tunnel information. More...
 
char * radius_msg_get_tunnel_password (struct radius_msg *msg, int *keylen, const u8 *secret, size_t secret_len, struct radius_msg *sent_msg, size_t n)
 Parse RADIUS attribute Tunnel-Password. More...
 
void radius_free_class (struct radius_class_data *c)
 
int radius_copy_class (struct radius_class_data *dst, const struct radius_class_data *src)
 
u8 radius_msg_find_unlisted_attr (struct radius_msg *msg, u8 *attrs)
 

Detailed Description

RADIUS message processing.

Function Documentation

void radius_msg_free ( struct radius_msg msg)

Free a RADIUS message.

Parameters
msgRADIUS message from radius_msg_new() or radius_msg_parse()
char* radius_msg_get_tunnel_password ( struct radius_msg msg,
int *  keylen,
const u8 *  secret,
size_t  secret_len,
struct radius_msg sent_msg,
size_t  n 
)

Parse RADIUS attribute Tunnel-Password.

Parameters
msgReceived RADIUS message
keylenLength of returned password
secretRADIUS shared secret
secret_lenLength of secret
sent_msgSent RADIUS message
nNumber of password attribute to return (starting with 0)
Returns
Pointer to n-th password (free with os_free) or NULL
int radius_msg_get_vlanid ( struct radius_msg msg)

Parse RADIUS attributes for VLAN tunnel information.

Parameters
msgRADIUS message
Returns
VLAN ID for the first tunnel configuration or 0 if none is found
struct radius_msg* radius_msg_new ( u8  code,
u8  identifier 
)

Create a new RADIUS message.

Parameters
codeCode for RADIUS header
identifierIdentifier for RADIUS header
Returns
Context for RADIUS message or NULL on failure

The caller is responsible for freeing the returned data with radius_msg_free().

struct radius_msg* radius_msg_parse ( const u8 *  data,
size_t  len 
)

Parse a RADIUS message.

Parameters
dataRADIUS message to be parsed
lenLength of data buffer in octets
Returns
Parsed RADIUS message or NULL on failure

This parses a RADIUS message and makes a copy of its data. The caller is responsible for freeing the returned data with radius_msg_free().