mirror of
				https://git.kernel.org/pub/scm/network/wireless/iwd.git
				synced 2025-10-31 04:57:25 +01:00 
			
		
		
		
	mschaputil: Move generator of the hash of the pwd hash
This commit is contained in:
		
							parent
							
								
									c8f071c67c
								
							
						
					
					
						commit
						3a71cf458b
					
				| @ -331,18 +331,12 @@ static void eap_mschapv2_handle_success(struct eap_state *eap, | ||||
| 	uint8_t master_key[16]; | ||||
| 	uint8_t session_key[32]; | ||||
| 	char authenticator_resp[42]; | ||||
| 	struct l_checksum *check; | ||||
| 	bool ret; | ||||
| 
 | ||||
| 	uint8_t buffer[5 + 1]; | ||||
| 
 | ||||
| 	check = l_checksum_new(L_CHECKSUM_MD4); | ||||
| 	if (!check) | ||||
| 		goto err; | ||||
| 
 | ||||
| 	l_checksum_update(check, state->password_hash, 16); | ||||
| 	l_checksum_get_digest(check, password_hash_hash, 16); | ||||
| 	l_checksum_free(check); | ||||
| 	mschapv2_hash_nt_password_hash(state->password_hash, | ||||
| 							password_hash_hash); | ||||
| 
 | ||||
| 	ret = mschapv2_generate_nt_response(state->password_hash, | ||||
| 						state->peer_challenge, | ||||
|  | ||||
| @ -201,6 +201,30 @@ bool mschapv2_generate_nt_response(const uint8_t password_hash[static 16], | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * Generate the hash of the password hash | ||||
|  * | ||||
|  * @password_hash: The hash of the password | ||||
|  * @password_hash_hash: The MD4 hash of the password hash | ||||
|  * | ||||
|  * Returns: true on success, false if hash/encrypt couldn't be done | ||||
|  **/ | ||||
| bool mschapv2_hash_nt_password_hash(const uint8_t password_hash[static 16], | ||||
| 					uint8_t password_hash_hash[static 16]) | ||||
| { | ||||
| 	struct l_checksum *check; | ||||
| 
 | ||||
| 	check = l_checksum_new(L_CHECKSUM_MD4); | ||||
| 	if (!check) | ||||
| 		return false; | ||||
| 
 | ||||
| 	l_checksum_update(check, password_hash, 16); | ||||
| 	l_checksum_get_digest(check, password_hash_hash, 16); | ||||
| 	l_checksum_free(check); | ||||
| 
 | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * Generate the mschapv2 authenticator response for verifying authenticator | ||||
|  * This function is specified in: | ||||
|  | ||||
| @ -26,6 +26,8 @@ bool mschap_challenge_response(const uint8_t *challenge, | ||||
| 						const uint8_t *password_hash, | ||||
| 						uint8_t *response); | ||||
| bool mschap_nt_password_hash(const char *password, uint8_t *password_hash); | ||||
| bool mschapv2_hash_nt_password_hash(const uint8_t password_hash[static 16], | ||||
| 					uint8_t password_hash_hash[static 16]); | ||||
| 
 | ||||
| bool mschapv2_generate_nt_response(const uint8_t password_hash[static 16], | ||||
| 				const uint8_t peer_challenge[static 16], | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tim Kourt
						Tim Kourt