Fixed new PRNG false positive issue

This commit is contained in:
wiire-a 2017-11-18 23:33:09 +01:00
parent 7db5fd84f9
commit c21e8b061c
2 changed files with 6 additions and 5 deletions

View File

@ -104,7 +104,7 @@ static void crack_thread_rtl(struct crack_job *j) {
unsigned int i;
glibc_lazyseed(&glibc_lazyprng, seed);
if (glibc_rand1(&glibc_lazyprng) == job_control.randr_enonce[0]) {
if (!memcmp(glibc_randfill(&glibc_lazyprng, tmp), job_control.randr_enonce, 4)) {
if (!memcmp(glibc_randfill(&glibc_lazyprng, tmp), job_control.randr_enonce, WPS_NONCE_LEN)) {
job_control.nonce_seed = seed;
DEBUG_PRINT("Seed found %u", seed);
}

View File

@ -26,10 +26,11 @@ static unsigned int glibc_rand1(struct glibc_lazyprng *prng)
static int *glibc_randfill(struct glibc_lazyprng *prng, uint32_t *arr)
{
int *state = prng->state;
arr[0] = ((unsigned int)(state[344 - 31] + state[344 - 3])) >> 1;
arr[1] = ((unsigned int)(state[344 - 31 + 1] + state[344 - 3 + 1])) >> 1;
arr[2] = ((unsigned int)(state[344 - 31 + 2] + state[344 - 3 + 2])) >> 1;
arr[3] = ((unsigned int)(state[344 - 31 + 3] + arr[0])) >> 1;
int const first = state[344 - 31] + state[344 - 3];
arr[0] = ((unsigned int)first) >> 1;
arr[1] = ((unsigned int)(state[344 - 31 + 1] + state[342 - 31] + state[342 - 3])) >> 1;
arr[2] = ((unsigned int)(state[344 - 31 + 2] + state[343 - 31] + state[343 - 3])) >> 1;
arr[3] = ((unsigned int)(state[344 - 31 + 3] + first)) >> 1;
return arr;
}