document tweak

This commit is contained in:
Philippe Teuwen 2020-07-31 18:22:11 +02:00
commit e67526ee4d
2 changed files with 5 additions and 1 deletions

View file

@ -332,6 +332,8 @@ uint8_t lfsr_rollback_byte(struct Crypto1State *s, uint32_t in, int fb) {
uint32_t lfsr_rollback_word(struct Crypto1State *s, uint32_t in, int fb) {
uint32_t ret = 0;
// note: xor args have been swapped because some compilers emit a warning
// for 10^x and 2^x as possible misuses for exponentiation. No comment.
ret |= lfsr_rollback_bit(s, BEBIT(in, 31), fb) << (24 ^ 31);
ret |= lfsr_rollback_bit(s, BEBIT(in, 30), fb) << (24 ^ 30);
ret |= lfsr_rollback_bit(s, BEBIT(in, 29), fb) << (24 ^ 29);

View file

@ -103,6 +103,8 @@ uint8_t crypto1_byte(struct Crypto1State *s, uint8_t in, int is_encrypted) {
}
uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted) {
uint32_t ret = 0;
// note: xor args have been swapped because some compilers emit a warning
// for 10^x and 2^x as possible misuses for exponentiation. No comment.
ret |= crypto1_bit(s, BEBIT(in, 0), is_encrypted) << (24 ^ 0);
ret |= crypto1_bit(s, BEBIT(in, 1), is_encrypted) << (24 ^ 1);
ret |= crypto1_bit(s, BEBIT(in, 2), is_encrypted) << (24 ^ 2);
@ -137,7 +139,7 @@ uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted) {
ret |= crypto1_bit(s, BEBIT(in, 28), is_encrypted) << (24 ^ 28);
ret |= crypto1_bit(s, BEBIT(in, 29), is_encrypted) << (24 ^ 29);
ret |= crypto1_bit(s, BEBIT(in, 30), is_encrypted) << (24 ^ 30);
ret |= crypto1_bit(s, BEBIT(in, 31), is_encrypted) << (24^ 31);
ret |= crypto1_bit(s, BEBIT(in, 31), is_encrypted) << (24 ^ 31);
return ret;
}