eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 3a71cf458b8bab73d38b73f6d87d1c4a0020f8a0
parent c8f071c67c14d16fb12eca6553488ed8f2a19942
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date:   Thu, 10 Jan 2019 14:34:22 -0800

mschaputil: Move generator of the hash of the pwd hash

Diffstat:
Msrc/eap-mschapv2.c | 10++--------
Msrc/mschaputil.c | 24++++++++++++++++++++++++
Msrc/mschaputil.h | 2++
3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/eap-mschapv2.c b/src/eap-mschapv2.c @@ -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, diff --git a/src/mschaputil.c b/src/mschaputil.c @@ -202,6 +202,30 @@ bool mschapv2_generate_nt_response(const uint8_t password_hash[static 16], } /** + * 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: * https://tools.ietf.org/html/rfc2759 diff --git a/src/mschaputil.h b/src/mschaputil.h @@ -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],