ieee80211_crypto.c (fe267a559009cbf34f9341666fe4d88a92c02d5e) ieee80211_crypto.c (79e0962d4c3cf1f0acf359a9d69cb3ac68c414c4)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2001 Atsushi Onoe
5 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 648 unchanged lines hidden (view full) ---

657 m_copydata(m, hdrlen + IEEE80211_WEP_IVLEN, sizeof(keyid), &keyid);
658 if (IEEE80211_IS_MULTICAST(wh->i_addr1) ||
659 IEEE80211_KEY_UNDEFINED(&ni->ni_ucastkey))
660 k = &vap->iv_nw_keys[keyid >> 6];
661 else
662 k = &ni->ni_ucastkey;
663
664 /*
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2001 Atsushi Onoe
5 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 648 unchanged lines hidden (view full) ---

657 m_copydata(m, hdrlen + IEEE80211_WEP_IVLEN, sizeof(keyid), &keyid);
658 if (IEEE80211_IS_MULTICAST(wh->i_addr1) ||
659 IEEE80211_KEY_UNDEFINED(&ni->ni_ucastkey))
660 k = &vap->iv_nw_keys[keyid >> 6];
661 else
662 k = &ni->ni_ucastkey;
663
664 /*
665 * Insure crypto header is contiguous for all decap work.
665 * Insure crypto header is contiguous and long enough for all
666 * decap work.
666 */
667 cip = k->wk_cipher;
667 */
668 cip = k->wk_cipher;
668 if (m->m_len < hdrlen + cip->ic_header &&
669 (m = m_pullup(m, hdrlen + cip->ic_header)) == NULL) {
669 if (m->m_len < hdrlen + cip->ic_header) {
670 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2,
670 IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO, wh->i_addr2,
671 "unable to pullup %s header", cip->ic_name);
672 vap->iv_stats.is_rx_wepfail++; /* XXX */
671 "frame is too short (%d < %u) for crypto decap",
672 cip->ic_name, m->m_len, hdrlen + cip->ic_header);
673 vap->iv_stats.is_rx_tooshort++;
673 *key = NULL;
674 return (0);
675 }
676
677 /*
678 * Attempt decryption.
679 *
680 * If we fail then don't return the key - return NULL

--- 126 unchanged lines hidden ---
674 *key = NULL;
675 return (0);
676 }
677
678 /*
679 * Attempt decryption.
680 *
681 * If we fail then don't return the key - return NULL

--- 126 unchanged lines hidden ---