aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-08-16 16:57:50 (GMT)
committerJouni Malinen <j@w1.fi>2009-11-22 18:34:17 (GMT)
commit291a7d62f56059b6917d4e1148340341a55e1813 (patch)
tree7fbdbce205f95fd9777eadd65a6b3a44193693f8
parente0bbbb9c917278b44837a36b6ad6bb996c13b491 (diff)
downloadhostap-06-291a7d62f56059b6917d4e1148340341a55e1813.zip
hostap-06-291a7d62f56059b6917d4e1148340341a55e1813.tar.gz
hostap-06-291a7d62f56059b6917d4e1148340341a55e1813.tar.bz2
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. (cherry picked from commit 8ef168311557982dd6b88cfcf26453aeb4dad6ac)
-rw-r--r--hostapd/ieee802_11.c4
-rw-r--r--hostapd/ieee802_1x.c2
-rw-r--r--src/crypto/ms_funcs.c2
-rw-r--r--src/crypto/rc4.c16
-rw-r--r--src/crypto/rc4.h1
-rw-r--r--src/eapol_supp/eapol_supp_sm.c4
6 files changed, 6 insertions, 23 deletions
diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c
index 3ea0a2c..dfda956 100644
--- a/hostapd/ieee802_11.c
+++ b/hostapd/ieee802_11.c
@@ -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;
}
diff --git a/hostapd/ieee802_1x.c b/hostapd/ieee802_1x.c
index 9b096d4..7fd8028 100644
--- a/hostapd/ieee802_1x.c
+++ b/hostapd/ieee802_1x.c
@@ -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
diff --git a/src/crypto/ms_funcs.c b/src/crypto/ms_funcs.c
index c14af64..7e2f0fa 100644
--- a/src/crypto/ms_funcs.c
+++ b/src/crypto/ms_funcs.c
@@ -379,7 +379,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;
}
diff --git a/src/crypto/rc4.c b/src/crypto/rc4.c
index 8480cc5..70c790e 100644
--- a/src/crypto/rc4.c
+++ b/src/crypto/rc4.c
@@ -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);
-}
diff --git a/src/crypto/rc4.h b/src/crypto/rc4.h
index 01f1383..35c7e41 100644
--- a/src/crypto/rc4.h
+++ b/src/crypto/rc4.h
@@ -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 */
diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c
index 537f06d..d163049 100644
--- a/src/eapol_supp/eapol_supp_sm.c
+++ b/src/eapol_supp/eapol_supp_sm.c
@@ -742,8 +742,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) {