diff options
Diffstat (limited to 'contrib/hostapd/eap_md5.c')
-rw-r--r-- | contrib/hostapd/eap_md5.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/hostapd/eap_md5.c b/contrib/hostapd/eap_md5.c index 5675c50..d776c8c 100644 --- a/contrib/hostapd/eap_md5.c +++ b/contrib/hostapd/eap_md5.c @@ -21,6 +21,7 @@ #include "common.h" #include "eap_i.h" #include "md5.h" +#include "crypto.h" #define CHALLENGE_LEN 16 @@ -122,7 +123,8 @@ static void eap_md5_process(struct eap_sm *sm, void *priv, struct eap_md5_data *data = priv; struct eap_hdr *resp; u8 *pos; - MD5_CTX context; + const u8 *addr[3]; + size_t len[3]; u8 hash[MD5_MAC_LEN]; if (sm->user == NULL || sm->user->password == NULL) { @@ -136,11 +138,13 @@ static void eap_md5_process(struct eap_sm *sm, void *priv, pos += 2; /* Skip type and len */ wpa_hexdump(MSG_MSGDUMP, "EAP-MD5: Response", pos, MD5_MAC_LEN); - MD5Init(&context); - MD5Update(&context, &resp->identifier, 1); - MD5Update(&context, sm->user->password, sm->user->password_len); - MD5Update(&context, data->challenge, CHALLENGE_LEN); - MD5Final(hash, &context); + addr[0] = &resp->identifier; + len[0] = 1; + addr[1] = sm->user->password; + len[1] = sm->user->password_len; + addr[2] = data->challenge; + len[2] = CHALLENGE_LEN; + md5_vector(3, addr, len, hash); if (memcmp(hash, pos, MD5_MAC_LEN) == 0) { wpa_printf(MSG_DEBUG, "EAP-MD5: Done - Success"); |