Fixed redundant memcpy of E-S1 and E-S2

This commit is contained in:
wiire-a 2017-11-16 14:43:27 +01:00
parent edd5d30b4c
commit 06ce5c870c

View File

@ -901,11 +901,11 @@ usage_err:
do {
i++;
glibc_seed(&glibc_prng, nonce_seed + i);
for (uint_fast8_t j = 0; j < GLIBC_MAX_GEN; j++) {
for (uint_fast8_t j = 0; j < 4; j++) {
uint32_t be = h32_to_be(glibc_rand(&glibc_prng));
memcpy(&(wps->e_s1[4 * j]), &be, sizeof(uint32_t));
memcpy(wps->e_s2, wps->e_s1, WPS_SECRET_NONCE_LEN); /* E-S1 = E-S2 != E-Nonce */
}
memcpy(wps->e_s2, wps->e_s1, WPS_SECRET_NONCE_LEN); /* E-S1 = E-S2 != E-Nonce */
s1_seed = nonce_seed + i;
s2_seed = nonce_seed + i;
@ -953,11 +953,11 @@ usage_err:
do {
i++;
glibc_seed(&glibc_prng, nonce_seed - i);
for (uint_fast8_t j = 0; j < GLIBC_MAX_GEN; j++) {
for (uint_fast8_t j = 0; j < 4; j++) {
uint32_t be = h32_to_be(glibc_rand(&glibc_prng));
memcpy(&(wps->e_s1[4 * j]), &be, sizeof(uint32_t));
memcpy(wps->e_s2, wps->e_s1, WPS_SECRET_NONCE_LEN); /* E-S1 = E-S2 != E-Nonce */
}
memcpy(wps->e_s2, wps->e_s1, WPS_SECRET_NONCE_LEN); /* E-S1 = E-S2 != E-Nonce */
s1_seed = nonce_seed - i;
s2_seed = nonce_seed - i;