Remove rc4() wrapper

This is not really of that much use since rc4_skip() can be used as
easily. In addition, rc4 has caused some symbol conflicts in the past,
so it is easier to live without that as an exported symbol.
This commit is contained in:
Jouni Malinen 2009-08-16 19:57:50 +03:00
parent 1d5ed36e7c
commit 8ef1683115
6 changed files with 6 additions and 23 deletions

View file

@ -384,8 +384,8 @@ static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta,
r = random();
os_memcpy(key, &now, 4);
os_memcpy(key + 4, &r, 4);
rc4(sta->challenge, WLAN_AUTH_CHALLENGE_LEN,
key, sizeof(key));
rc4_skip(key, sizeof(key), 0,
sta->challenge, WLAN_AUTH_CHALLENGE_LEN);
}
return 0;
}

View file

@ -164,7 +164,7 @@ static void ieee802_1x_tx_key_one(struct hostapd_data *hapd,
}
os_memcpy(ekey, key->key_iv, sizeof(key->key_iv));
os_memcpy(ekey + sizeof(key->key_iv), sm->eap_if->eapKeyData, 32);
rc4((u8 *) (key + 1), key_len, ekey, ekey_len);
rc4_skip(ekey, ekey_len, 0, (u8 *) (key + 1), key_len);
os_free(ekey);
/* This header is needed here for HMAC-MD5, but it will be regenerated

View file

@ -404,7 +404,7 @@ int encrypt_pw_block_with_password_hash(
*/
pos = &pw_block[2 * 256];
WPA_PUT_LE16(pos, password_len * 2);
rc4(pw_block, PWBLOCK_LEN, password_hash, 16);
rc4_skip(password_hash, 16, 0, pw_block, PWBLOCK_LEN);
return 0;
}

View file

@ -68,19 +68,3 @@ void rc4_skip(const u8 *key, size_t keylen, size_t skip,
*pos++ ^= S[(S[i] + S[j]) & 0xff];
}
}
/**
* rc4 - XOR RC4 stream to given data
* @buf: data to be XOR'ed with RC4 stream
* @len: buf length
* @key: RC4 key
* @key_len: RC4 key length
*
* Generate RC4 pseudo random stream for the given key and XOR this with the
* data buffer to perform RC4 encryption/decryption.
*/
void rc4(u8 *buf, size_t len, const u8 *key, size_t key_len)
{
rc4_skip(key, key_len, 0, buf, len);
}

View file

@ -17,6 +17,5 @@
void rc4_skip(const u8 *key, size_t keylen, size_t skip,
u8 *data, size_t data_len);
void rc4(u8 *buf, size_t len, const u8 *key, size_t key_len);
#endif /* RC4_H */

View file

@ -750,8 +750,8 @@ static void eapol_sm_processKey(struct eapol_sm *sm)
os_memcpy(ekey + IEEE8021X_KEY_IV_LEN, keydata.encr_key,
encr_key_len);
os_memcpy(datakey, key + 1, key_len);
rc4(datakey, key_len, ekey,
IEEE8021X_KEY_IV_LEN + encr_key_len);
rc4_skip(ekey, IEEE8021X_KEY_IV_LEN + encr_key_len, 0,
datakey, key_len);
wpa_hexdump_key(MSG_DEBUG, "EAPOL: Decrypted(RC4) key",
datakey, key_len);
} else if (key_len == 0) {