mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
mschaputil: Adapt mschapv2 to re-use mschap ops
In addition, it refactors code to use l_util_hexstring_upper
This commit is contained in:
parent
6ffa1cf58a
commit
5d9d00fac3
@ -172,13 +172,13 @@ bool mschapv2_generate_nt_response(const uint8_t password_hash[static 16],
|
|||||||
challenge))
|
challenge))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!mschapv2_des_encrypt(challenge, buffer + 0, response + 0))
|
if (!mschap_des_encrypt(challenge, buffer + 0, response + 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!mschapv2_des_encrypt(challenge, buffer + 7, response + 8))
|
if (!mschap_des_encrypt(challenge, buffer + 7, response + 8))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!mschapv2_des_encrypt(challenge, buffer + 14, response + 16))
|
if (!mschap_des_encrypt(challenge, buffer + 14, response + 16))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -223,7 +223,6 @@ bool mschapv2_generate_authenticator_response(
|
|||||||
uint8_t digest[20];
|
uint8_t digest[20];
|
||||||
uint8_t challenge[8];
|
uint8_t challenge[8];
|
||||||
char *ascii;
|
char *ascii;
|
||||||
int i;
|
|
||||||
struct l_checksum *check;
|
struct l_checksum *check;
|
||||||
|
|
||||||
check = l_checksum_new(L_CHECKSUM_SHA1);
|
check = l_checksum_new(L_CHECKSUM_SHA1);
|
||||||
@ -253,14 +252,11 @@ bool mschapv2_generate_authenticator_response(
|
|||||||
response[0] = 'S';
|
response[0] = 'S';
|
||||||
response[1] = '=';
|
response[1] = '=';
|
||||||
|
|
||||||
ascii = l_util_hexstring(digest, sizeof(digest));
|
ascii = l_util_hexstring_upper(digest, sizeof(digest));
|
||||||
if (!ascii)
|
if (!ascii)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (i = 0; i < 40; ++i) {
|
memcpy(response + 2, ascii, 40);
|
||||||
response[i + 2] = toupper(ascii[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
l_free(ascii);
|
l_free(ascii);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user