if_ath.c (167ecdca8cf95e14128be2cf0e92b39f029fcfe6) | if_ath.c (91101a2af3c9382d2866dd6fc7cc9f0443b22785) |
---|---|
1/*- 2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1721 unchanged lines hidden (view full) --- 1730 * XXX 1731 * IV must not duplicate during the lifetime of the key. 1732 * But no mechanism to renew keys is defined in IEEE 802.11 1733 * WEP. And IV may be duplicated between other stations 1734 * because of the session key itself is shared. 1735 * So we use pseudo random IV for now, though it is not the 1736 * right way. 1737 */ | 1/*- 2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 1721 unchanged lines hidden (view full) --- 1730 * XXX 1731 * IV must not duplicate during the lifetime of the key. 1732 * But no mechanism to renew keys is defined in IEEE 802.11 1733 * WEP. And IV may be duplicated between other stations 1734 * because of the session key itself is shared. 1735 * So we use pseudo random IV for now, though it is not the 1736 * right way. 1737 */ |
1738 iv = arc4random(); | 1738 iv = ic->ic_iv; 1739 /* 1740 * Skip 'bad' IVs from Fluhrer/Mantin/Shamir: 1741 * (B, 255, N) with 3 <= B < 8 1742 */ 1743 if (iv >= 0x03ff00 && (iv & 0xf8ff00) == 0x00ff00) 1744 iv += 0x000100; 1745 ic->ic_iv = iv + 1; |
1739 for (i = 0; i < IEEE80211_WEP_IVLEN; i++) { 1740 ivp[i] = iv; 1741 iv >>= 8; 1742 } 1743 ivp[i] = sc->sc_ic.ic_wep_txkey << 6; /* Key ID and pad */ 1744 memcpy(mtod(m0, caddr_t), hdrbuf, sizeof(hdrbuf)); 1745 /* 1746 * The ICV length must be included into hdrlen and pktlen. --- 997 unchanged lines hidden --- | 1746 for (i = 0; i < IEEE80211_WEP_IVLEN; i++) { 1747 ivp[i] = iv; 1748 iv >>= 8; 1749 } 1750 ivp[i] = sc->sc_ic.ic_wep_txkey << 6; /* Key ID and pad */ 1751 memcpy(mtod(m0, caddr_t), hdrbuf, sizeof(hdrbuf)); 1752 /* 1753 * The ICV length must be included into hdrlen and pktlen. --- 997 unchanged lines hidden --- |