Hello,
I think there is an error in the file grain128aead.c at the root of the repository.
- The error is in the
next_z function at line 186,
- It causes a wrong initialization of the cipher because the key is no more re-added.
Here is the presumed faulty code :
if (grain_round == INIT) {
lfsr_out = shift(grain->lfsr, lfsr_fb ^ y);
shift(grain->nfsr, nfsr_fb ^ lfsr_out ^ y);
} else if (grain_round == NORMAL) {
lfsr_out = shift(grain->lfsr, lfsr_fb ^ y ^ keybit_64);
shift(grain->nfsr, nfsr_fb ^ lfsr_out ^ y ^ keybit);
} else if (grain_round == NORMAL) {
lfsr_out = shift(grain->lfsr, lfsr_fb);
shift(grain->nfsr, nfsr_fb ^ lfsr_out);
}
which should be replaced by :
if (grain_round == INIT) {
lfsr_out = shift(grain->lfsr, lfsr_fb ^ y);
shift(grain->nfsr, nfsr_fb ^ lfsr_out ^ y);
} else if (grain_round == ADDKEY) {
lfsr_out = shift(grain->lfsr, lfsr_fb ^ y ^ keybit_64);
shift(grain->nfsr, nfsr_fb ^ lfsr_out ^ y ^ keybit);
} else if (grain_round == NORMAL) {
lfsr_out = shift(grain->lfsr, lfsr_fb);
shift(grain->nfsr, nfsr_fb ^ lfsr_out);
}
Hello,
I think there is an error in the file
grain128aead.cat the root of the repository.next_zfunction at line 186,Here is the presumed faulty code :
which should be replaced by :