mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 23:48:58 +00:00
Fixed one cast (added appropriate parantheses)
This commit is contained in:
parent
8b8f27b003
commit
393c7a3cde
@ -52,10 +52,10 @@ void PQCLEAN_KYBER768_cbd(poly *r, const unsigned char *buf) {
|
|||||||
a[3] = (d >> 18) & 0x7;
|
a[3] = (d >> 18) & 0x7;
|
||||||
b[3] = (d >> 21);
|
b[3] = (d >> 21);
|
||||||
|
|
||||||
r->coeffs[4 * i + 0] = (uint16_t)a[0] + KYBER_Q - b[0];
|
r->coeffs[4 * i + 0] = (uint16_t)(a[0] + KYBER_Q - b[0]);
|
||||||
r->coeffs[4 * i + 1] = (uint16_t)a[1] + KYBER_Q - b[1];
|
r->coeffs[4 * i + 1] = (uint16_t)(a[1] + KYBER_Q - b[1]);
|
||||||
r->coeffs[4 * i + 2] = (uint16_t)a[2] + KYBER_Q - b[2];
|
r->coeffs[4 * i + 2] = (uint16_t)(a[2] + KYBER_Q - b[2]);
|
||||||
r->coeffs[4 * i + 3] = (uint16_t)a[3] + KYBER_Q - b[3];
|
r->coeffs[4 * i + 3] = (uint16_t)(a[3] + KYBER_Q - b[3]);
|
||||||
}
|
}
|
||||||
#elif KYBER_ETA == 4
|
#elif KYBER_ETA == 4
|
||||||
uint32_t t, d, a[4], b[4];
|
uint32_t t, d, a[4], b[4];
|
||||||
@ -77,10 +77,10 @@ void PQCLEAN_KYBER768_cbd(poly *r, const unsigned char *buf) {
|
|||||||
a[3] = (d >> 24) & 0xf;
|
a[3] = (d >> 24) & 0xf;
|
||||||
b[3] = (d >> 28);
|
b[3] = (d >> 28);
|
||||||
|
|
||||||
r->coeffs[4 * i + 0] = (uint16_t)a[0] + KYBER_Q - b[0];
|
r->coeffs[4 * i + 0] = (uint16_t)(a[0] + KYBER_Q - b[0]);
|
||||||
r->coeffs[4 * i + 1] = (uint16_t)a[1] + KYBER_Q - b[1];
|
r->coeffs[4 * i + 1] = (uint16_t)(a[1] + KYBER_Q - b[1]);
|
||||||
r->coeffs[4 * i + 2] = (uint16_t)a[2] + KYBER_Q - b[2];
|
r->coeffs[4 * i + 2] = (uint16_t)(a[2] + KYBER_Q - b[2]);
|
||||||
r->coeffs[4 * i + 3] = (uint16_t)a[3] + KYBER_Q - b[3];
|
r->coeffs[4 * i + 3] = (uint16_t)(a[3] + KYBER_Q - b[3]);
|
||||||
}
|
}
|
||||||
#elif KYBER_ETA == 5
|
#elif KYBER_ETA == 5
|
||||||
uint64_t t, d, a[4], b[4];
|
uint64_t t, d, a[4], b[4];
|
||||||
@ -102,10 +102,10 @@ void PQCLEAN_KYBER768_cbd(poly *r, const unsigned char *buf) {
|
|||||||
a[3] = (d >> 30) & 0x1f;
|
a[3] = (d >> 30) & 0x1f;
|
||||||
b[3] = (d >> 35);
|
b[3] = (d >> 35);
|
||||||
|
|
||||||
r->coeffs[4 * i + 0] = (uint16_t)a[0] + KYBER_Q - b[0];
|
r->coeffs[4 * i + 0] = (uint16_t)(a[0] + KYBER_Q - b[0]);
|
||||||
r->coeffs[4 * i + 1] = (uint16_t)a[1] + KYBER_Q - b[1];
|
r->coeffs[4 * i + 1] = (uint16_t)(a[1] + KYBER_Q - b[1]);
|
||||||
r->coeffs[4 * i + 2] = (uint16_t)a[2] + KYBER_Q - b[2];
|
r->coeffs[4 * i + 2] = (uint16_t)(a[2] + KYBER_Q - b[2]);
|
||||||
r->coeffs[4 * i + 3] = (uint16_t)a[3] + KYBER_Q - b[3];
|
r->coeffs[4 * i + 3] = (uint16_t)(a[3] + KYBER_Q - b[3]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error "poly_getnoise in poly.c only supports eta in {3,4,5}"
|
#error "poly_getnoise in poly.c only supports eta in {3,4,5}"
|
||||||
|
Loading…
Reference in New Issue
Block a user