1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-02-01 01:52:17 +01:00

util.c: Check whether generate_random() was invoked successfully

This evaluates the return code from generate_random() within
write_chalresp_state() and returns immediately in case of an error.

This fixes #161.
This commit is contained in:
Karol Babioch 2018-05-17 16:03:21 +02:00
parent 3339cd2864
commit 0972986164

5
util.c
View File

@ -508,7 +508,10 @@ write_chalresp_state(FILE *f, CR_STATE *state)
iterations = state->iterations;
}
generate_random(salt, CR_SALT_SIZE);
if (generate_random(salt, CR_CHALLENGE_SIZE)) {
goto out;
}
yk_pbkdf2(response_hex, salt, CR_SALT_SIZE, iterations,
hash, CR_RESPONSE_SIZE, &prf_method);