mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 08:48:31 -05:00
Add documentation for RADIUS code and some minor cleanup
This commit is contained in:
parent
a9f92c487f
commit
d04a96b0d6
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* hostapd / RADIUS message processing
|
||||
* Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
|
||||
* RADIUS message processing
|
||||
* Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
@ -12,12 +12,15 @@
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "radius.h"
|
||||
#include "utils/common.h"
|
||||
#include "crypto/md5.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "radius.h"
|
||||
|
||||
|
||||
static int radius_msg_initialize(struct radius_msg *msg, size_t init_len);
|
||||
|
||||
|
||||
static struct radius_attr_hdr *
|
||||
@ -27,6 +30,13 @@ radius_get_attr_hdr(struct radius_msg *msg, int idx)
|
||||
}
|
||||
|
||||
|
||||
static void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier)
|
||||
{
|
||||
msg->hdr->code = code;
|
||||
msg->hdr->identifier = identifier;
|
||||
}
|
||||
|
||||
|
||||
struct radius_msg *radius_msg_new(u8 code, u8 identifier)
|
||||
{
|
||||
struct radius_msg *msg;
|
||||
@ -46,7 +56,7 @@ struct radius_msg *radius_msg_new(u8 code, u8 identifier)
|
||||
}
|
||||
|
||||
|
||||
int radius_msg_initialize(struct radius_msg *msg, size_t init_len)
|
||||
static int radius_msg_initialize(struct radius_msg *msg, size_t init_len)
|
||||
{
|
||||
if (msg == NULL || init_len < sizeof(struct radius_hdr))
|
||||
return -1;
|
||||
@ -76,13 +86,6 @@ int radius_msg_initialize(struct radius_msg *msg, size_t init_len)
|
||||
}
|
||||
|
||||
|
||||
void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier)
|
||||
{
|
||||
msg->hdr->code = code;
|
||||
msg->hdr->identifier = identifier;
|
||||
}
|
||||
|
||||
|
||||
void radius_msg_free(struct radius_msg *msg)
|
||||
{
|
||||
os_free(msg->buf);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* hostapd / RADIUS message processing
|
||||
* Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
|
||||
* RADIUS message processing
|
||||
* Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
@ -173,19 +173,47 @@ struct radius_ms_mppe_keys {
|
||||
};
|
||||
|
||||
|
||||
/* RADIUS message structure for new and parsed messages */
|
||||
/**
|
||||
* struct radius_msg - RADIUS message structure for new and parsed messages
|
||||
*/
|
||||
struct radius_msg {
|
||||
/**
|
||||
* buf - Allocated buffer for RADIUS message
|
||||
*/
|
||||
unsigned char *buf;
|
||||
size_t buf_size; /* total size allocated for buf */
|
||||
size_t buf_used; /* bytes used in buf */
|
||||
|
||||
/**
|
||||
* buf_size - Total size of the allocated buf in octets
|
||||
*/
|
||||
size_t buf_size;
|
||||
|
||||
/**
|
||||
* buf_used - bytes used in buf
|
||||
*/
|
||||
size_t buf_used;
|
||||
|
||||
/**
|
||||
* hdr - Pointer to the RADIUS header in buf
|
||||
*/
|
||||
struct radius_hdr *hdr;
|
||||
|
||||
size_t *attr_pos; /* array of indexes to attributes (number of bytes
|
||||
* from buf to the beginning of
|
||||
* struct radius_attr_hdr). */
|
||||
size_t attr_size; /* total size of the attribute pointer array */
|
||||
size_t attr_used; /* total number of attributes in the array */
|
||||
/**
|
||||
* attr_pos - Array of indexes to attributes
|
||||
*
|
||||
* The values are number of bytes from buf to the beginning of
|
||||
* struct radius_attr_hdr.
|
||||
*/
|
||||
size_t *attr_pos;
|
||||
|
||||
/**
|
||||
* attr_size - Total size of the attribute pointer array
|
||||
*/
|
||||
size_t attr_size;
|
||||
|
||||
/**
|
||||
* attr_used - Total number of attributes in the array
|
||||
*/
|
||||
size_t attr_used;
|
||||
};
|
||||
|
||||
|
||||
@ -203,8 +231,6 @@ struct radius_msg {
|
||||
#define RADIUS_ADDR_FORMAT "%02x%02x%02x%02x%02x%02x"
|
||||
|
||||
struct radius_msg *radius_msg_new(u8 code, u8 identifier);
|
||||
int radius_msg_initialize(struct radius_msg *msg, size_t init_len);
|
||||
void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier);
|
||||
void radius_msg_free(struct radius_msg *msg);
|
||||
void radius_msg_dump(struct radius_msg *msg);
|
||||
int radius_msg_finish(struct radius_msg *msg, const u8 *secret,
|
||||
|
Loading…
Reference in New Issue
Block a user