Small fix to rotation code.
This commit is contained in:
parent
26cfd32d24
commit
75b10acd6a
@ -297,7 +297,8 @@ static FORCE_INLINE uint8_t process_encrypt(crypt_state_t* const crypt_state, ui
|
||||
size_t i;
|
||||
for (i = 0U; i < 256U; ++i)
|
||||
{
|
||||
value = crypt_state->wheel_fwd[i][(value + crypt_state->rotation_fwd[i]) & 0xFF];
|
||||
const uint8_t rotation = crypt_state->rotation_fwd[i];
|
||||
value = (crypt_state->wheel_fwd[i][(value + rotation) & 0xFF] - rotation) & 0xFF;
|
||||
}
|
||||
++crypt_state->rotation_fwd[crypt_state->step_fwd[crypt_state->counter]];
|
||||
odometer_step(crypt_state->rotation_fwd, 0);
|
||||
@ -310,7 +311,8 @@ static FORCE_INLINE uint8_t process_decrypt(crypt_state_t* const crypt_state, ui
|
||||
size_t i;
|
||||
for (i = 0U; i < 256U; ++i)
|
||||
{
|
||||
value = (crypt_state->wheel_bwd[i][value] - crypt_state->rotation_bwd[i]) & 0xFF;
|
||||
const uint8_t rotation = crypt_state->rotation_bwd[i];
|
||||
value = (crypt_state->wheel_bwd[i][(value + rotation) & 0xFF] - rotation) & 0xFF;
|
||||
}
|
||||
++crypt_state->rotation_bwd[crypt_state->step_bwd[crypt_state->counter]];
|
||||
odometer_step(crypt_state->rotation_bwd, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user