Skip to content

Unreachable code in poly_uniform #102

@abhinav-thales

Description

@abhinav-thales

A part of code to calculate pending elements(<256) of matrix in poly_uniform in the reference implementation is unreachable as 'buflen' is a multiple of 3(STREAM128_BLOCKBYTES=168) which makes 'off' always zero and the 'for' loop never executes.

Unreachable code:

  while(ctr < N) {
    off = buflen % 3;
    for(i = 0; i < off; ++i)
      buf[i] = buf[buflen - off + i];

    stream128_squeezeblocks(buf + off, 1, &state);
    buflen = STREAM128_BLOCKBYTES + off;
    ctr += rej_uniform(a->coeffs + ctr, N - ctr, buf, buflen);
  }

Possible Fix:

  while(ctr < N) {
    stream128_squeezeblocks(buf, 1, &state);
    ctr += rej_uniform(a->coeffs + ctr, N - ctr, buf, STREAM128_BLOCKBYTES);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions