Browse Source

Macro for loop length

master
Douglas Stebila 5 years ago
parent
commit
82fdce64a2
4 changed files with 4 additions and 4 deletions
  1. +1
    -1
      crypto_kem/newhope1024cca/clean/poly.c
  2. +1
    -1
      crypto_kem/newhope1024cpa/clean/poly.c
  3. +1
    -1
      crypto_kem/newhope512cca/clean/poly.c
  4. +1
    -1
      crypto_kem/newhope512cpa/clean/poly.c

+ 1
- 1
crypto_kem/newhope1024cca/clean/poly.c View File

@@ -151,7 +151,7 @@ void PQCLEAN_NEWHOPE1024CCA_CLEAN_poly_decompress(poly *r, const unsigned char *
**************************************************/
void PQCLEAN_NEWHOPE1024CCA_CLEAN_poly_frommsg(poly *r, const unsigned char *msg) {
unsigned int i, j, mask;
for (i = 0; i < 32; i++) { // XXX: MACRO for 32
for (i = 0; i < NEWHOPE_SYMBYTES; i++) {
for (j = 0; j < 8; j++) {
mask = -((msg[i] >> j) & 1);
r->coeffs[8 * i + j + 0] = mask & (NEWHOPE_Q / 2);


+ 1
- 1
crypto_kem/newhope1024cpa/clean/poly.c View File

@@ -151,7 +151,7 @@ void PQCLEAN_NEWHOPE1024CPA_CLEAN_poly_decompress(poly *r, const unsigned char *
**************************************************/
void PQCLEAN_NEWHOPE1024CPA_CLEAN_poly_frommsg(poly *r, const unsigned char *msg) {
unsigned int i, j, mask;
for (i = 0; i < 32; i++) { // XXX: MACRO for 32
for (i = 0; i < NEWHOPE_SYMBYTES; i++) {
for (j = 0; j < 8; j++) {
mask = -((msg[i] >> j) & 1);
r->coeffs[8 * i + j + 0] = mask & (NEWHOPE_Q / 2);


+ 1
- 1
crypto_kem/newhope512cca/clean/poly.c View File

@@ -151,7 +151,7 @@ void PQCLEAN_NEWHOPE512CCA_CLEAN_poly_decompress(poly *r, const unsigned char *a
**************************************************/
void PQCLEAN_NEWHOPE512CCA_CLEAN_poly_frommsg(poly *r, const unsigned char *msg) {
unsigned int i, j, mask;
for (i = 0; i < 32; i++) { // XXX: MACRO for 32
for (i = 0; i < NEWHOPE_SYMBYTES; i++) {
for (j = 0; j < 8; j++) {
mask = -((msg[i] >> j) & 1);
r->coeffs[8 * i + j + 0] = mask & (NEWHOPE_Q / 2);


+ 1
- 1
crypto_kem/newhope512cpa/clean/poly.c View File

@@ -151,7 +151,7 @@ void PQCLEAN_NEWHOPE512CPA_CLEAN_poly_decompress(poly *r, const unsigned char *a
**************************************************/
void PQCLEAN_NEWHOPE512CPA_CLEAN_poly_frommsg(poly *r, const unsigned char *msg) {
unsigned int i, j, mask;
for (i = 0; i < 32; i++) { // XXX: MACRO for 32
for (i = 0; i < NEWHOPE_SYMBYTES; i++) {
for (j = 0; j < 8; j++) {
mask = -((msg[i] >> j) & 1);
r->coeffs[8 * i + j + 0] = mask & (NEWHOPE_Q / 2);


Loading…
Cancel
Save