Skip to content

Commit

Permalink
saber: remove unnecessary mod q ops
Browse files Browse the repository at this point in the history
  • Loading branch information
jschanck committed Nov 3, 2020
1 parent 1ae84c3 commit 1c3572c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions saber/patches/AVX_Implementation_KEM_SABER_indcpa.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- upstream/AVX_Implementation_KEM/SABER_indcpa.c
+++ upstream-patched/AVX_Implementation_KEM/SABER_indcpa.c
@@ -1,581 +1,130 @@
@@ -1,581 +1,128 @@
-#include <stdint.h>
-#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -256,7 +256,6 @@
+ for(j=0;j<SABER_N;j++) {
+ res[i].coeffs[j] += h1;
+ res[i].coeffs[j] >>= SABER_EQ-SABER_EP;
+ res[i].coeffs[j] &= SABER_Q-1;
}
}

Expand Down Expand Up @@ -422,7 +421,6 @@
+ for(j=0;j<SABER_N;j++){
+ res[i].coeffs[j] += h1;
+ res[i].coeffs[j] >>= SABER_EQ-SABER_EP;
+ res[i].coeffs[j] &= SABER_Q-1;
}
}
-
Expand Down
4 changes: 1 addition & 3 deletions saber/patches/Reference_Implementation_KEM_SABER_indcpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "rng.h"
#include "fips202.h"
#include "SABER_params.h"
@@ -13,90 +12,107 @@
@@ -13,90 +12,105 @@

void indcpa_kem_keypair(uint8_t pk[SABER_INDCPA_PUBLICKEYBYTES], uint8_t sk[SABER_INDCPA_SECRETKEYBYTES])
{
Expand Down Expand Up @@ -53,7 +53,6 @@
+ for(j=0;j<SABER_N;j++) {
+ res[i].coeffs[j] += h1;
+ res[i].coeffs[j] >>= SABER_EQ-SABER_EP;
+ res[i].coeffs[j] &= SABER_Q-1;
}
}

Expand Down Expand Up @@ -103,7 +102,6 @@
+ for(j=0;j<SABER_N;j++){
+ res[i].coeffs[j] += h1;
+ res[i].coeffs[j] >>= SABER_EQ-SABER_EP;
+ res[i].coeffs[j] &= SABER_Q-1;
}
}
+ POLVECp2BS(ciphertext, res);
Expand Down

0 comments on commit 1c3572c

Please sign in to comment.