ms_funcs: Merge similar return cases
There is no need to have separate return statements for these corner cases that are unlikely to be hit in practice. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
359636170f
commit
786722763d
1 changed files with 7 additions and 13 deletions
|
@ -174,9 +174,8 @@ int generate_nt_response(const u8 *auth_challenge, const u8 *peer_challenge,
|
||||||
u8 password_hash[16];
|
u8 password_hash[16];
|
||||||
|
|
||||||
if (challenge_hash(peer_challenge, auth_challenge, username,
|
if (challenge_hash(peer_challenge, auth_challenge, username,
|
||||||
username_len, challenge))
|
username_len, challenge) ||
|
||||||
return -1;
|
nt_password_hash(password, password_len, password_hash))
|
||||||
if (nt_password_hash(password, password_len, password_hash))
|
|
||||||
return -1;
|
return -1;
|
||||||
challenge_response(challenge, password_hash, response);
|
challenge_response(challenge, password_hash, response);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -256,12 +255,9 @@ int generate_authenticator_response_pwhash(
|
||||||
addr2[1] = challenge;
|
addr2[1] = challenge;
|
||||||
addr2[2] = magic2;
|
addr2[2] = magic2;
|
||||||
|
|
||||||
if (hash_nt_password_hash(password_hash, password_hash_hash))
|
if (hash_nt_password_hash(password_hash, password_hash_hash) ||
|
||||||
return -1;
|
sha1_vector(3, addr1, len1, response) ||
|
||||||
if (sha1_vector(3, addr1, len1, response))
|
challenge_hash(peer_challenge, auth_challenge, username,
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (challenge_hash(peer_challenge, auth_challenge, username,
|
|
||||||
username_len, challenge))
|
username_len, challenge))
|
||||||
return -1;
|
return -1;
|
||||||
return sha1_vector(3, addr2, len2, response);
|
return sha1_vector(3, addr2, len2, response);
|
||||||
|
@ -435,10 +431,8 @@ int encrypt_pw_block_with_password_hash(
|
||||||
|
|
||||||
os_memset(pw_block, 0, PWBLOCK_LEN);
|
os_memset(pw_block, 0, PWBLOCK_LEN);
|
||||||
|
|
||||||
if (utf8_to_ucs2(password, password_len, pw_block, 512, &ucs2_len) < 0)
|
if (utf8_to_ucs2(password, password_len, pw_block, 512, &ucs2_len) < 0
|
||||||
return -1;
|
|| ucs2_len > 256)
|
||||||
|
|
||||||
if (ucs2_len > 256)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
offset = (256 - ucs2_len) * 2;
|
offset = (256 - ucs2_len) * 2;
|
||||||
|
|
Loading…
Reference in a new issue