handshake: Add setter for vendor IEs

Some connections, like Hotspot require additional IEs to be used during
the Association.  These are now passed as 'extra_ies' when invoking
netdev_connect, however they are also needed during ReAssociation and FT
to such APs.

Additionally, it may be that Hotspot-enabled APs will start utilizing
FILS or SAE.  In these cases the extra_ies need to be accounted for
somehow, either by making a copy in handshake_state, netdev, or the
auth_proto itself.  Similarly, P2P which heavily uses vendor IEs can be
used over SAE in the future.

Since a copy of these IEs is needed, might as well store them in
handshake_state itself for easy book-keeping by network/station.
This commit is contained in:
Denis Kenzior 2021-08-04 11:08:09 -05:00
parent 8f9e6b3f76
commit f24cfa481b
2 changed files with 32 additions and 0 deletions

View File

@ -297,6 +297,33 @@ void handshake_state_set_fte(struct handshake_state *s, const uint8_t *fte)
replace_ie(&s->fte, fte);
}
void handshake_state_set_vendor_ies(struct handshake_state *s,
const struct iovec *iov,
size_t n_iovs)
{
size_t i;
size_t len;
l_free(s->vendor_ies);
s->vendor_ies = NULL;
if (n_iovs == 0) {
s->vendor_ies_len = 0;
return;
}
for (i = 0, len = 0; i < n_iovs; i++)
len += iov[i].iov_len;
s->vendor_ies_len = len;
s->vendor_ies = l_malloc(len);
for (i = 0, len = 0; i < n_iovs; i++) {
memcpy(s->vendor_ies + len, iov[i].iov_base, iov[i].iov_len);
len += iov[i].iov_len;
}
}
void handshake_state_set_kh_ids(struct handshake_state *s,
const uint8_t *r0khid, size_t r0khid_len,
const uint8_t *r1khid)

View File

@ -92,6 +92,8 @@ struct handshake_state {
uint8_t *supplicant_rsnxe;
uint8_t *mde;
uint8_t *fte;
uint8_t *vendor_ies;
size_t vendor_ies_len;
enum ie_rsn_cipher_suite pairwise_cipher;
enum ie_rsn_cipher_suite group_cipher;
enum ie_rsn_cipher_suite group_management_cipher;
@ -178,6 +180,9 @@ void handshake_state_set_ssid(struct handshake_state *s,
void handshake_state_set_mde(struct handshake_state *s,
const uint8_t *mde);
void handshake_state_set_fte(struct handshake_state *s, const uint8_t *fte);
void handshake_state_set_vendor_ies(struct handshake_state *s,
const struct iovec *iov,
size_t n_iovs);
void handshake_state_set_kh_ids(struct handshake_state *s,
const uint8_t *r0khid, size_t r0khid_len,