pq-crystals / dilithium

Other
374 stars 136 forks source link

Misleading / unnecessary masks in unpacking code #55

Open SWilson4 opened 2 years ago

SWilson4 commented 2 years ago

There are three unnecessary masks in the polyt0_unpack and polyz_unpack functions. These all occur when the last coefficient of a block of coefficients is being unpacked. There is no overflow on this last coefficient, so masking the leading bits has no effect.

This is misleading in the polyz_unpack function, where a copy-paste error seems to have slipped in. At first glance this appears to be a bug in the implementation, until it becomes apparent that masking is not needed for this coefficient.