Index: uspace/lib/crypto/crypto.c
===================================================================
--- uspace/lib/crypto/crypto.c	(revision d7dadcb4162ebe9a54c5014f67b20ba124ddd307)
+++ uspace/lib/crypto/crypto.c	(revision a931b7b2faca447e0708fd5fae0f85116e4c788d)
@@ -252,5 +252,5 @@
 
 /**
- * Hash-based message authentication code using SHA-1 algorithm.
+ * Hash-based message authentication code.
  * 
  * @param key Cryptographic key sequence.
@@ -308,5 +308,5 @@
  * Password-Based Key Derivation Function 2 as defined in RFC 2898,
  * using HMAC-SHA1 with 4096 iterations and 32 bytes key result used
- * for WPA2.
+ * for WPA/WPA2.
  * 
  * @param pass Password sequence.
@@ -315,5 +315,4 @@
  * @param salt_size Salt sequence length.
  * @param hash Output parameter for result hash (32 byte value).
- * @param hash_sel Hash function selector.
  * 
  * @return EINVAL when pass or salt not specified, ENOMEM when pointer for 
@@ -321,5 +320,5 @@
  */
 int pbkdf2(uint8_t *pass, size_t pass_size, uint8_t *salt, size_t salt_size, 
-	uint8_t *hash, hash_func_t hash_sel)
+	uint8_t *hash)
 {
 	if(!pass || !salt)
@@ -331,8 +330,8 @@
 	uint8_t work_salt[salt_size + sizeof(uint32_t)];
 	memcpy(work_salt, salt, salt_size);
-	uint8_t work_hmac[hash_sel];
-	uint8_t temp_hmac[hash_sel];
-	uint8_t xor_hmac[hash_sel];
-	uint8_t temp_hash[hash_sel*2];
+	uint8_t work_hmac[HASH_SHA1];
+	uint8_t temp_hmac[HASH_SHA1];
+	uint8_t xor_hmac[HASH_SHA1];
+	uint8_t temp_hash[HASH_SHA1*2];
 	
 	for(size_t i = 0; i < 2; i++) {
@@ -340,15 +339,15 @@
 		memcpy(work_salt + salt_size, &big_i, sizeof(uint32_t));
 		hmac(pass, pass_size, work_salt, salt_size + sizeof(uint32_t),
-			work_hmac, hash_sel);
-		memcpy(xor_hmac, work_hmac, hash_sel);
+			work_hmac, HASH_SHA1);
+		memcpy(xor_hmac, work_hmac, HASH_SHA1);
 		for(size_t k = 1; k < 4096; k++) {
-			memcpy(temp_hmac, work_hmac, hash_sel);
-			hmac(pass, pass_size, temp_hmac, hash_sel, 
-				work_hmac, hash_sel);
-			for(size_t t = 0; t < hash_sel; t++) {
+			memcpy(temp_hmac, work_hmac, HASH_SHA1);
+			hmac(pass, pass_size, temp_hmac, HASH_SHA1, 
+				work_hmac, HASH_SHA1);
+			for(size_t t = 0; t < HASH_SHA1; t++) {
 				xor_hmac[t] ^= work_hmac[t];
 			}
 		}
-		memcpy(temp_hash + i*hash_sel, xor_hmac, hash_sel);
+		memcpy(temp_hash + i*HASH_SHA1, xor_hmac, HASH_SHA1);
 	}
 	
Index: uspace/lib/crypto/crypto.h
===================================================================
--- uspace/lib/crypto/crypto.h	(revision d7dadcb4162ebe9a54c5014f67b20ba124ddd307)
+++ uspace/lib/crypto/crypto.h	(revision a931b7b2faca447e0708fd5fae0f85116e4c788d)
@@ -41,6 +41,6 @@
 } hash_func_t;
 
-extern int rc4(uint8_t *key, size_t key_size, uint8_t *input, 
-	size_t input_size, uint8_t *output);
+extern int rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size, 
+	size_t skip, uint8_t *output);
 extern int aes_encrypt(uint8_t *key, uint8_t *input, uint8_t *output);
 extern int aes_decrypt(uint8_t *key, uint8_t *input, uint8_t *output);
@@ -50,5 +50,5 @@
 	uint8_t *hash, hash_func_t hash_sel);
 extern int pbkdf2(uint8_t *pass, size_t pass_size, uint8_t *salt, 
-	size_t salt_size, uint8_t *hash, hash_func_t hash_sel);
+	size_t salt_size, uint8_t *hash);
 
 #endif
Index: uspace/lib/crypto/rc4.c
===================================================================
--- uspace/lib/crypto/rc4.c	(revision d7dadcb4162ebe9a54c5014f67b20ba124ddd307)
+++ uspace/lib/crypto/rc4.c	(revision a931b7b2faca447e0708fd5fae0f85116e4c788d)
@@ -82,4 +82,5 @@
  * @param input Input data sequence to be processed.
  * @param input_size Size of input data sequence.
+ * @param skip Number of bytes to be skipped from the beginning of key stream.
  * @param output Result data sequence.
  * 
@@ -88,5 +89,5 @@
  */
 int rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size, 
-	uint8_t *output)
+	size_t skip, uint8_t *output)
 {
 	if(!key || !input)
@@ -100,6 +101,14 @@
 	create_sbox(key, key_size, sbox);
 	
+	/* Skip first x bytes. */
+	uint8_t i = 0, j = 0;
+	for(size_t k = 0; k < skip; k++) {
+		i = i+1;
+		j = j + sbox[i];
+		swap(i, j, sbox);
+	}
+	
 	/* Processing loop. */
-	uint8_t i = 0, j = 0, val;
+	uint8_t val;
 	for(size_t k = 0; k < input_size; k++) {
 		i = i+1;
