Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_crypto.c
| Show First 20 Lines • Show All 1,019 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| uint16_t aad_len; | uint16_t aad_len; | ||||
| memset(aad, 0, len); | memset(aad, 0, len); | ||||
| /* | /* | ||||
| * AAD for PV0 MPDUs: | * AAD for PV0 MPDUs: | ||||
| * | * | ||||
| * FC with bits 4..6 and 11..13 masked to zero; 14 is always one | * FC + data frame - mask bits 4..6 | ||||
| * FC 11..13 masked to zero; 14 is always one | |||||
| * A1 | A2 | A3 | * A1 | A2 | A3 | ||||
| * SC with bits 4..15 (seq#) masked to zero | * SC with bits 4..15 (seq#) masked to zero | ||||
| * A4 (if present) | * A4 (if present) | ||||
| * QC (if present) | * QC (if present) | ||||
| */ | */ | ||||
| aad[0] = 0; /* AAD length >> 8 */ | aad[0] = 0; /* AAD length >> 8 */ | ||||
| /* NB: aad[1] set below */ | /* NB: aad[1] set below */ | ||||
| aad[2] = wh->i_fc[0] & 0x8f; /* see above for bitfields */ | /* Only mask bits 4,5,6 if its a data frame */ | ||||
| aad[2] = wh->i_fc[0]; | |||||
| if (IEEE80211_IS_DATA(wh)) | |||||
| aad[2] &= 0x8f; /* see above for bitfields */ | |||||
| aad[3] = wh->i_fc[1] & 0xc7; /* see above for bitfields */ | aad[3] = wh->i_fc[1] & 0xc7; /* see above for bitfields */ | ||||
| /* mask aad[3] b7 if frame is data frame w/ QoS control field */ | /* mask aad[3] b7 if frame is data frame w/ QoS control field */ | ||||
| if (IEEE80211_IS_QOS_ANY(wh)) | if (IEEE80211_IS_QOS_ANY(wh)) | ||||
| aad[3] &= 0x7f; | aad[3] &= 0x7f; | ||||
| /* NB: we know 3 addresses are contiguous */ | /* NB: we know 3 addresses are contiguous */ | ||||
| memcpy(aad + 4, wh->i_addr1, 3 * IEEE80211_ADDR_LEN); | memcpy(aad + 4, wh->i_addr1, 3 * IEEE80211_ADDR_LEN); | ||||
| aad[22] = wh->i_seq[0] & IEEE80211_SEQ_FRAG_MASK; | aad[22] = wh->i_seq[0] & IEEE80211_SEQ_FRAG_MASK; | ||||
| Show All 39 Lines | |||||