Convert remaining SSID routines from char* to u8*
This makes it more explicit that the SSID is not a null terminated C string. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
771e2f7b33
commit
986de33d5c
15 changed files with 29 additions and 25 deletions
|
@ -136,7 +136,9 @@ static struct radius_msg * accounting_msg(struct hostapd_data *hapd,
|
|||
}
|
||||
|
||||
os_snprintf(buf, sizeof(buf), RADIUS_802_1X_ADDR_FORMAT ":%s",
|
||||
MAC2STR(hapd->own_addr), hapd->conf->ssid.ssid);
|
||||
MAC2STR(hapd->own_addr),
|
||||
wpa_ssid_txt(hapd->conf->ssid.ssid,
|
||||
hapd->conf->ssid.ssid_len));
|
||||
if (!hostapd_config_get_radius_attr(hapd->conf->radius_acct_req_attr,
|
||||
RADIUS_ATTR_CALLED_STATION_ID) &&
|
||||
!radius_msg_add_attr(msg, RADIUS_ATTR_CALLED_STATION_ID,
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef enum hostap_security_policy {
|
|||
} secpolicy;
|
||||
|
||||
struct hostapd_ssid {
|
||||
char ssid[HOSTAPD_MAX_SSID_LEN + 1];
|
||||
u8 ssid[HOSTAPD_MAX_SSID_LEN];
|
||||
size_t ssid_len;
|
||||
int ssid_set;
|
||||
|
||||
|
|
|
@ -653,7 +653,7 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
|
|||
params.dtim_period = hapd->conf->dtim_period;
|
||||
params.beacon_int = hapd->iconf->beacon_int;
|
||||
params.basic_rates = hapd->iconf->basic_rates;
|
||||
params.ssid = (u8 *) hapd->conf->ssid.ssid;
|
||||
params.ssid = hapd->conf->ssid.ssid;
|
||||
params.ssid_len = hapd->conf->ssid.ssid_len;
|
||||
params.pairwise_ciphers = hapd->conf->rsn_pairwise ?
|
||||
hapd->conf->rsn_pairwise : hapd->conf->wpa_pairwise;
|
||||
|
|
|
@ -98,7 +98,7 @@ static void hostapd_reload_bss(struct hostapd_data *hapd)
|
|||
hostapd_update_wps(hapd);
|
||||
|
||||
if (hapd->conf->ssid.ssid_set &&
|
||||
hostapd_set_ssid(hapd, (u8 *) hapd->conf->ssid.ssid,
|
||||
hostapd_set_ssid(hapd, hapd->conf->ssid.ssid,
|
||||
hapd->conf->ssid.ssid_len)) {
|
||||
wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver");
|
||||
/* try to continue */
|
||||
|
@ -679,14 +679,14 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
|
|||
set_ssid = 0;
|
||||
conf->ssid.ssid_len = ssid_len;
|
||||
os_memcpy(conf->ssid.ssid, ssid, conf->ssid.ssid_len);
|
||||
conf->ssid.ssid[conf->ssid.ssid_len] = '\0';
|
||||
}
|
||||
|
||||
if (!hostapd_drv_none(hapd)) {
|
||||
wpa_printf(MSG_ERROR, "Using interface %s with hwaddr " MACSTR
|
||||
" and ssid '%s'",
|
||||
" and ssid \"%s\"",
|
||||
hapd->conf->iface, MAC2STR(hapd->own_addr),
|
||||
hapd->conf->ssid.ssid);
|
||||
wpa_ssid_txt(hapd->conf->ssid.ssid,
|
||||
hapd->conf->ssid.ssid_len));
|
||||
}
|
||||
|
||||
if (hostapd_setup_wpa_psk(conf)) {
|
||||
|
@ -696,7 +696,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
|
|||
|
||||
/* Set SSID for the kernel driver (to be used in beacon and probe
|
||||
* response frames) */
|
||||
if (set_ssid && hostapd_set_ssid(hapd, (u8 *) conf->ssid.ssid,
|
||||
if (set_ssid && hostapd_set_ssid(hapd, conf->ssid.ssid,
|
||||
conf->ssid.ssid_len)) {
|
||||
wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver");
|
||||
return -1;
|
||||
|
|
|
@ -165,7 +165,9 @@ static int hostapd_radius_acl_query(struct hostapd_data *hapd, const u8 *addr,
|
|||
}
|
||||
|
||||
os_snprintf(buf, sizeof(buf), RADIUS_802_1X_ADDR_FORMAT ":%s",
|
||||
MAC2STR(hapd->own_addr), hapd->conf->ssid.ssid);
|
||||
MAC2STR(hapd->own_addr),
|
||||
wpa_ssid_txt(hapd->conf->ssid.ssid,
|
||||
hapd->conf->ssid.ssid_len));
|
||||
if (!radius_msg_add_attr(msg, RADIUS_ATTR_CALLED_STATION_ID,
|
||||
(u8 *) buf, os_strlen(buf))) {
|
||||
wpa_printf(MSG_DEBUG, "Could not add Called-Station-Id");
|
||||
|
|
|
@ -481,7 +481,9 @@ static void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd,
|
|||
}
|
||||
|
||||
os_snprintf(buf, sizeof(buf), RADIUS_802_1X_ADDR_FORMAT ":%s",
|
||||
MAC2STR(hapd->own_addr), hapd->conf->ssid.ssid);
|
||||
MAC2STR(hapd->own_addr),
|
||||
wpa_ssid_txt(hapd->conf->ssid.ssid,
|
||||
hapd->conf->ssid.ssid_len));
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
if (!hostapd_config_get_radius_attr(hapd->conf->radius_auth_req_attr,
|
||||
RADIUS_ATTR_CALLED_STATION_ID) &&
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "common.h"
|
||||
#include "sha1.h"
|
||||
|
||||
static int pbkdf2_sha1_f(const char *passphrase, const char *ssid,
|
||||
static int pbkdf2_sha1_f(const char *passphrase, const u8 *ssid,
|
||||
size_t ssid_len, int iterations, unsigned int count,
|
||||
u8 *digest)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ static int pbkdf2_sha1_f(const char *passphrase, const char *ssid,
|
|||
size_t len[2];
|
||||
size_t passphrase_len = os_strlen(passphrase);
|
||||
|
||||
addr[0] = (u8 *) ssid;
|
||||
addr[0] = ssid;
|
||||
len[0] = ssid_len;
|
||||
addr[1] = count_buf;
|
||||
len[1] = 4;
|
||||
|
@ -69,7 +69,7 @@ static int pbkdf2_sha1_f(const char *passphrase, const char *ssid,
|
|||
* iterations is set to 4096 and buflen to 32. This function is described in
|
||||
* IEEE Std 802.11-2004, Clause H.4. The main construction is from PKCS#5 v2.0.
|
||||
*/
|
||||
int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
|
||||
int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
|
||||
int iterations, u8 *buf, size_t buflen)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
|
|
|
@ -22,6 +22,6 @@ int sha1_t_prf(const u8 *key, size_t key_len, const char *label,
|
|||
int __must_check tls_prf_sha1_md5(const u8 *secret, size_t secret_len,
|
||||
const char *label, const u8 *seed,
|
||||
size_t seed_len, u8 *out, size_t outlen);
|
||||
int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
|
||||
int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
|
||||
int iterations, u8 *buf, size_t buflen);
|
||||
#endif /* SHA1_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue