https://github.com/mupq/pqm4
Revision 8970d37a8c3055d9579007e954449d926c3583b4 authored by Matthias J. Kannwischer on 22 September 2021, 09:09:56 UTC, committed by rpls on 26 September 2021, 17:25:47 UTC
Fixes two minor bugs in matacc. They did not actually result in wrong
outputs.

In the uniform sampling, we use 3 bytes to sample 2 coefficients. In
case the sampled coefficient is too large, we throw it away.
Once we sampled 256 coefficients it is possible that we still have one
coefficient left which needs to be discarded.
The check if we are at the end of a polynomial already was wrongly
implemented by checking for ctr < KYBER_Q/4 rather than ctr < KYBER_N/4
in two places.

Luckily, it has no effect in both cases.
In the first, ctr = KYBER_N/4 implies k=0 and hence the the code does
nothing.
In the second, an additional Keccak squeeze is triggered, but the output
is never used.
1 parent 844e7ca
Raw File
Tip revision: 8970d37a8c3055d9579007e954449d926c3583b4 authored by Matthias J. Kannwischer on 22 September 2021, 09:09:56 UTC
Fix two bugs in Kyber
Tip revision: 8970d37
benchmarks.py
#!/usr/bin/env python3
from mupq import mupq
from interface import parse_arguments, get_platform

if __name__ == "__main__":
    args, rest = parse_arguments()
    platform, settings = get_platform(args)
    with platform:
        schemes = [s for s in rest if s not in ['--nostack',
                                                '--nospeed',
                                                '--nohashing',
                                                '--nosize']]
        if "--nostack" not in rest:
            test = mupq.StackBenchmark(settings, platform)
            test.test_all(schemes)

        if "--nospeed" not in rest:
            test = mupq.SpeedBenchmark(settings, platform)
            test.test_all(schemes)

        if "--nohashing" not in rest:
            test = mupq.HashingBenchmark(settings, platform)
            test.test_all(schemes)

        if "--nosize" not in rest:
            test = mupq.SizeBenchmark(settings, platform)
            test.test_all(schemes)
back to top