Skip to content

Commit

Permalink
HQC/avx2: align input to compute_syndromes
Browse files Browse the repository at this point in the history
  • Loading branch information
jschanck committed Mar 30, 2021
1 parent 80749c8 commit a55f514
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,20 @@
}
delta_counter += found;
}
@@ -469,23 +437,20 @@
@@ -469,23 +437,25 @@
* @param[out] msg Array of size VEC_K_SIZE_64 receiving the decoded message
* @param[in] cdw Array of size VEC_N1_SIZE_64 storing the received word
*/
-void reed_solomon_decode(uint64_t* msg, uint64_t* cdw) {
- uint8_t cdw_bytes[PARAM_N1] = {0};
- uint16_t syndromes[2 * PARAM_DELTA] = {0};
+void reed_solomon_decode(uint8_t* msg, uint8_t* cdw) {
uint16_t syndromes[2 * PARAM_DELTA] = {0};
+ union {
+ uint16_t arr16[16*CEIL_DIVIDE(2*PARAM_DELTA,16)];
+ __m256i dummy;
+ } syndromes_aligned = {0};
+ uint16_t *syndromes = syndromes_aligned.arr16;
+
uint16_t sigma[1 << PARAM_FFT] = {0};
uint8_t error[1 << PARAM_M] = {0};
uint16_t z[PARAM_N1] = {0};
Expand All @@ -385,7 +391,7 @@

// Compute the error polynomial error
compute_roots(error, sigma);
@@ -497,10 +462,10 @@
@@ -497,10 +467,10 @@
compute_error_values(error_values, z, error);

// Correct the errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,20 @@
}
delta_counter += found;
}
@@ -483,23 +447,20 @@
@@ -483,23 +447,25 @@
* @param[out] msg Array of size VEC_K_SIZE_64 receiving the decoded message
* @param[in] cdw Array of size VEC_N1_SIZE_64 storing the received word
*/
-void reed_solomon_decode(uint64_t* msg, uint64_t* cdw) {
- uint8_t cdw_bytes[PARAM_N1] = {0};
- uint16_t syndromes[2 * PARAM_DELTA] = {0};
+void reed_solomon_decode(uint8_t* msg, uint8_t* cdw) {
uint16_t syndromes[2 * PARAM_DELTA] = {0};
+ union {
+ uint16_t arr16[16*CEIL_DIVIDE(2*PARAM_DELTA,16)];
+ __m256i dummy;
+ } syndromes_aligned = {0};
+ uint16_t *syndromes = syndromes_aligned.arr16;
+
uint16_t sigma[1 << PARAM_FFT] = {0};
uint8_t error[1 << PARAM_M] = {0};
uint16_t z[PARAM_N1] = {0};
Expand All @@ -382,7 +388,7 @@

// Compute the error polynomial error
compute_roots(error, sigma);
@@ -511,10 +472,10 @@
@@ -511,10 +477,10 @@
compute_error_values(error_values, z, error);

// Correct the errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,20 @@
}
delta_counter += found;
}
@@ -747,23 +715,20 @@
@@ -747,23 +715,25 @@
* @param[out] msg Array of size VEC_K_SIZE_64 receiving the decoded message
* @param[in] cdw Array of size VEC_N1_SIZE_64 storing the received word
*/
-void reed_solomon_decode(uint64_t* msg, uint64_t* cdw) {
- uint8_t cdw_bytes[PARAM_N1] = {0};
- uint16_t syndromes[2 * PARAM_DELTA] = {0};
+void reed_solomon_decode(uint8_t* msg, uint8_t* cdw) {
uint16_t syndromes[2 * PARAM_DELTA] = {0};
+ union {
+ uint16_t arr16[16*CEIL_DIVIDE(2*PARAM_DELTA,16)];
+ __m256i dummy;
+ } syndromes_aligned = {0};
+ uint16_t *syndromes = syndromes_aligned.arr16;
+
uint16_t sigma[1 << PARAM_FFT] = {0};
uint8_t error[1 << PARAM_M] = {0};
uint16_t z[PARAM_N1] = {0};
Expand All @@ -393,7 +399,7 @@

// Compute the error polynomial error
compute_roots(error, sigma);
@@ -775,10 +740,10 @@
@@ -775,10 +745,10 @@
compute_error_values(error_values, z, error);

// Correct the errors
Expand Down
2 changes: 1 addition & 1 deletion hqc/update_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi
rm -rf ${PATCHES}
mkdir -p ${PATCHES}/tmp/

diff -ru --no-dereference ${V1} ${V2} > ${PATCHES}/tmp/p
diff -ruN --no-dereference ${V1} ${V2} > ${PATCHES}/tmp/p

( cd ${PATCHES}/tmp/
splitpatch ${PATCHES}/tmp/p
Expand Down

0 comments on commit a55f514

Please sign in to comment.