Skip to content

Commit

Permalink
Run copy_from_upstream.py
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Wilson <[email protected]>
  • Loading branch information
SWilson4 authored and ryjones committed Nov 21, 2024
1 parent 95f904b commit cce1bfd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/algorithms/kem/hqc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- **Authors' website**: https://pqc-hqc.org/
- **Specification version**: 2023-04-30.
- **Primary Source**<a name="primary-source"></a>:
- **Source**: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
- **Source**: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789 with copy_from_upstream patches
- **Implementation license (SPDX-Identifier)**: Public domain
- **Ancestors of primary source**:
- https://github.com/SWilson4/package-pqclean/tree/8db1b24b/hqc, which takes it from:
Expand Down
1 change: 1 addition & 0 deletions docs/algorithms/kem/hqc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ parameter-sets:
primary-upstream:
spdx-license-identifier: Public domain
source: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
with copy_from_upstream patches
6 changes: 3 additions & 3 deletions src/kem/hqc/pqclean_hqc-128_clean/kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int PQCLEAN_HQC128_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
uint8_t result;
uint64_t u[VEC_N_SIZE_64] = {0};
uint64_t v[VEC_N1N2_SIZE_64] = {0};
const uint8_t *pk = sk + SEED_BYTES;
const uint8_t *pk = sk + SEED_BYTES + VEC_K_SIZE_BYTES;
uint8_t sigma[VEC_K_SIZE_BYTES] = {0};
uint8_t theta[SHAKE256_512_BYTES] = {0};
uint64_t u2[VEC_N_SIZE_64] = {0};
Expand Down Expand Up @@ -115,7 +115,7 @@ int PQCLEAN_HQC128_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
result |= PQCLEAN_HQC128_CLEAN_vect_compare((uint8_t *)u, (uint8_t *)u2, VEC_N_SIZE_BYTES);
result |= PQCLEAN_HQC128_CLEAN_vect_compare((uint8_t *)v, (uint8_t *)v2, VEC_N1N2_SIZE_BYTES);

result = (uint8_t) (-((int16_t) result) >> 15);
result -= 1;

for (size_t i = 0; i < VEC_K_SIZE_BYTES; ++i) {
mc[i] = (m[i] & result) ^ (sigma[i] & ~result);
Expand All @@ -126,5 +126,5 @@ int PQCLEAN_HQC128_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
PQCLEAN_HQC128_CLEAN_store8_arr(mc + VEC_K_SIZE_BYTES + VEC_N_SIZE_BYTES, VEC_N1N2_SIZE_BYTES, v, VEC_N1N2_SIZE_64);
PQCLEAN_HQC128_CLEAN_shake256_512_ds(&shake256state, ss, mc, VEC_K_SIZE_BYTES + VEC_N_SIZE_BYTES + VEC_N1N2_SIZE_BYTES, K_FCT_DOMAIN);

return -(~result & 1);
return (result & 1) - 1;
}
6 changes: 3 additions & 3 deletions src/kem/hqc/pqclean_hqc-192_clean/kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int PQCLEAN_HQC192_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
uint8_t result;
uint64_t u[VEC_N_SIZE_64] = {0};
uint64_t v[VEC_N1N2_SIZE_64] = {0};
const uint8_t *pk = sk + SEED_BYTES;
const uint8_t *pk = sk + SEED_BYTES + VEC_K_SIZE_BYTES;
uint8_t sigma[VEC_K_SIZE_BYTES] = {0};
uint8_t theta[SHAKE256_512_BYTES] = {0};
uint64_t u2[VEC_N_SIZE_64] = {0};
Expand Down Expand Up @@ -115,7 +115,7 @@ int PQCLEAN_HQC192_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
result |= PQCLEAN_HQC192_CLEAN_vect_compare((uint8_t *)u, (uint8_t *)u2, VEC_N_SIZE_BYTES);
result |= PQCLEAN_HQC192_CLEAN_vect_compare((uint8_t *)v, (uint8_t *)v2, VEC_N1N2_SIZE_BYTES);

result = (uint8_t) (-((int16_t) result) >> 15);
result -= 1;

for (size_t i = 0; i < VEC_K_SIZE_BYTES; ++i) {
mc[i] = (m[i] & result) ^ (sigma[i] & ~result);
Expand All @@ -126,5 +126,5 @@ int PQCLEAN_HQC192_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
PQCLEAN_HQC192_CLEAN_store8_arr(mc + VEC_K_SIZE_BYTES + VEC_N_SIZE_BYTES, VEC_N1N2_SIZE_BYTES, v, VEC_N1N2_SIZE_64);
PQCLEAN_HQC192_CLEAN_shake256_512_ds(&shake256state, ss, mc, VEC_K_SIZE_BYTES + VEC_N_SIZE_BYTES + VEC_N1N2_SIZE_BYTES, K_FCT_DOMAIN);

return -(~result & 1);
return (result & 1) - 1;
}
6 changes: 3 additions & 3 deletions src/kem/hqc/pqclean_hqc-256_clean/kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int PQCLEAN_HQC256_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
uint8_t result;
uint64_t u[VEC_N_SIZE_64] = {0};
uint64_t v[VEC_N1N2_SIZE_64] = {0};
const uint8_t *pk = sk + SEED_BYTES;
const uint8_t *pk = sk + SEED_BYTES + VEC_K_SIZE_BYTES;
uint8_t sigma[VEC_K_SIZE_BYTES] = {0};
uint8_t theta[SHAKE256_512_BYTES] = {0};
uint64_t u2[VEC_N_SIZE_64] = {0};
Expand Down Expand Up @@ -115,7 +115,7 @@ int PQCLEAN_HQC256_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
result |= PQCLEAN_HQC256_CLEAN_vect_compare((uint8_t *)u, (uint8_t *)u2, VEC_N_SIZE_BYTES);
result |= PQCLEAN_HQC256_CLEAN_vect_compare((uint8_t *)v, (uint8_t *)v2, VEC_N1N2_SIZE_BYTES);

result = (uint8_t) (-((int16_t) result) >> 15);
result -= 1;

for (size_t i = 0; i < VEC_K_SIZE_BYTES; ++i) {
mc[i] = (m[i] & result) ^ (sigma[i] & ~result);
Expand All @@ -126,5 +126,5 @@ int PQCLEAN_HQC256_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const ui
PQCLEAN_HQC256_CLEAN_store8_arr(mc + VEC_K_SIZE_BYTES + VEC_N_SIZE_BYTES, VEC_N1N2_SIZE_BYTES, v, VEC_N1N2_SIZE_64);
PQCLEAN_HQC256_CLEAN_shake256_512_ds(&shake256state, ss, mc, VEC_K_SIZE_BYTES + VEC_N_SIZE_BYTES + VEC_N1N2_SIZE_BYTES, K_FCT_DOMAIN);

return -(~result & 1);
return (result & 1) - 1;
}

0 comments on commit cce1bfd

Please sign in to comment.