|
|
@@ -10,19 +10,19 @@ void PQCLEAN_NTRUHRSS701_CLEAN_poly_Sq_tobytes(unsigned char *r, const poly *a) |
|
|
|
t[j] = a->coeffs[8 * i + j]; |
|
|
|
} |
|
|
|
|
|
|
|
r[13 * i + 0] = t[0] & 0xff; |
|
|
|
r[13 * i + 1] = (t[0] >> 8) | ((t[1] & 0x07) << 5); |
|
|
|
r[13 * i + 2] = (t[1] >> 3) & 0xff; |
|
|
|
r[13 * i + 3] = (t[1] >> 11) | ((t[2] & 0x3f) << 2); |
|
|
|
r[13 * i + 4] = (t[2] >> 6) | ((t[3] & 0x01) << 7); |
|
|
|
r[13 * i + 5] = (t[3] >> 1) & 0xff; |
|
|
|
r[13 * i + 6] = (t[3] >> 9) | ((t[4] & 0x0f) << 4); |
|
|
|
r[13 * i + 7] = (t[4] >> 4) & 0xff; |
|
|
|
r[13 * i + 8] = (t[4] >> 12) | ((t[5] & 0x7f) << 1); |
|
|
|
r[13 * i + 9] = (t[5] >> 7) | ((t[6] & 0x03) << 6); |
|
|
|
r[13 * i + 10] = (t[6] >> 2) & 0xff; |
|
|
|
r[13 * i + 11] = (t[6] >> 10) | ((t[7] & 0x1f) << 3); |
|
|
|
r[13 * i + 12] = (t[7] >> 5); |
|
|
|
r[13 * i + 0] = (unsigned char) ( t[0] & 0xff); |
|
|
|
r[13 * i + 1] = (unsigned char) ((t[0] >> 8) | ((t[1] & 0x07) << 5)); |
|
|
|
r[13 * i + 2] = (unsigned char) ((t[1] >> 3) & 0xff); |
|
|
|
r[13 * i + 3] = (unsigned char) ((t[1] >> 11) | ((t[2] & 0x3f) << 2)); |
|
|
|
r[13 * i + 4] = (unsigned char) ((t[2] >> 6) | ((t[3] & 0x01) << 7)); |
|
|
|
r[13 * i + 5] = (unsigned char) ((t[3] >> 1) & 0xff); |
|
|
|
r[13 * i + 6] = (unsigned char) ((t[3] >> 9) | ((t[4] & 0x0f) << 4)); |
|
|
|
r[13 * i + 7] = (unsigned char) ((t[4] >> 4) & 0xff); |
|
|
|
r[13 * i + 8] = (unsigned char) ((t[4] >> 12) | ((t[5] & 0x7f) << 1)); |
|
|
|
r[13 * i + 9] = (unsigned char) ((t[5] >> 7) | ((t[6] & 0x03) << 6)); |
|
|
|
r[13 * i + 10] = (unsigned char) ((t[6] >> 2) & 0xff); |
|
|
|
r[13 * i + 11] = (unsigned char) ((t[6] >> 10) | ((t[7] & 0x1f) << 3)); |
|
|
|
r[13 * i + 12] = (unsigned char) ((t[7] >> 5)); |
|
|
|
} |
|
|
|
|
|
|
|
for (j = 0; j < NTRU_PACK_DEG - 8 * i; j++) { |
|
|
@@ -34,20 +34,20 @@ void PQCLEAN_NTRUHRSS701_CLEAN_poly_Sq_tobytes(unsigned char *r, const poly *a) |
|
|
|
|
|
|
|
switch (NTRU_PACK_DEG - 8 * (NTRU_PACK_DEG / 8)) { |
|
|
|
case 6: |
|
|
|
r[13 * i + 9] = (t[5] >> 7) | ((t[6] & 0x03) << 6); |
|
|
|
r[13 * i + 8] = (t[4] >> 12) | ((t[5] & 0x7f) << 1); |
|
|
|
r[13 * i + 7] = (t[4] >> 4) & 0xff; |
|
|
|
r[13 * i + 9] = (unsigned char) ((t[5] >> 7) | ((t[6] & 0x03) << 6)); |
|
|
|
r[13 * i + 8] = (unsigned char) ((t[4] >> 12) | ((t[5] & 0x7f) << 1)); |
|
|
|
r[13 * i + 7] = (unsigned char) ((t[4] >> 4) & 0xff); |
|
|
|
// fallthrough |
|
|
|
case 4: |
|
|
|
r[13 * i + 6] = (t[3] >> 9) | ((t[4] & 0x0f) << 4); |
|
|
|
r[13 * i + 5] = (t[3] >> 1) & 0xff; |
|
|
|
r[13 * i + 4] = (t[2] >> 6) | ((t[3] & 0x01) << 7); |
|
|
|
r[13 * i + 6] = (unsigned char) ((t[3] >> 9) | ((t[4] & 0x0f) << 4)); |
|
|
|
r[13 * i + 5] = (unsigned char) ((t[3] >> 1) & 0xff); |
|
|
|
r[13 * i + 4] = (unsigned char) ((t[2] >> 6) | ((t[3] & 0x01) << 7)); |
|
|
|
// fallthrough |
|
|
|
case 2: |
|
|
|
r[13 * i + 3] = (t[1] >> 11) | ((t[2] & 0x3f) << 2); |
|
|
|
r[13 * i + 2] = (t[1] >> 3) & 0xff; |
|
|
|
r[13 * i + 1] = (t[0] >> 8) | ((t[1] & 0x07) << 5); |
|
|
|
r[13 * i + 0] = t[0] & 0xff; |
|
|
|
r[13 * i + 3] = (unsigned char) ((t[1] >> 11) | ((t[2] & 0x3f) << 2)); |
|
|
|
r[13 * i + 2] = (unsigned char) ((t[1] >> 3) & 0xff); |
|
|
|
r[13 * i + 1] = (unsigned char) ((t[0] >> 8) | ((t[1] & 0x07) << 5)); |
|
|
|
r[13 * i + 0] = (unsigned char) ( t[0] & 0xff); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|