Skip to content

Commit

Permalink
Update PQClean commit and delete patch for HQC (#2026)
Browse files Browse the repository at this point in the history
* Update script info

Signed-off-by: Spencer Wilson <[email protected]>

* Run copy_from_upstream

Signed-off-by: Spencer Wilson <[email protected]>

---------

Signed-off-by: Spencer Wilson <[email protected]>
  • Loading branch information
SWilson4 authored Dec 22, 2024
1 parent d35017e commit af78b87
Show file tree
Hide file tree
Showing 91 changed files with 404 additions and 103 deletions.
2 changes: 1 addition & 1 deletion docs/algorithms/kem/classic_mceliece.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- **Authors' website**: https://classic.mceliece.org
- **Specification version**: SUPERCOP-20221025.
- **Primary Source**<a name="primary-source"></a>:
- **Source**: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
- **Source**: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
- **Implementation license (SPDX-Identifier)**: Public domain
- **Ancestors of primary source**:
- SUPERCOP-20221025 "clean" and "avx2" implementations
Expand Down
2 changes: 1 addition & 1 deletion docs/algorithms/kem/classic_mceliece.yml
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,4 @@ parameter-sets:
auxiliary-submitters: []
primary-upstream:
spdx-license-identifier: Public domain
source: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
source: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
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 with copy_from_upstream patches
- **Source**: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
- **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
3 changes: 1 addition & 2 deletions docs/algorithms/kem/hqc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ parameter-sets:
upstream: primary-upstream
primary-upstream:
spdx-license-identifier: Public domain
source: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
with copy_from_upstream patches
source: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
4 changes: 2 additions & 2 deletions docs/algorithms/sig/falcon.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
- **Authors' website**: https://falcon-sign.info
- **Specification version**: 20211101.
- **Primary Source**<a name="primary-source"></a>:
- **Source**: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
- **Source**: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
- **Implementation license (SPDX-Identifier)**: MIT
- **Optimized Implementation sources**: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
- **Optimized Implementation sources**: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
- **pqclean-aarch64**:<a name="pqclean-aarch64"></a>
- **Source**: https://github.com/PQClean/PQClean/commit/7707d1bcc8ae7f9ffd296dd13b1d76d2767d14f8
- **Implementation license (SPDX-Identifier)**: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion docs/algorithms/sig/falcon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ website: https://falcon-sign.info
nist-round: 3
spec-version: 20211101
primary-upstream:
source: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
source: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
spdx-license-identifier: MIT
upstream-ancestors:
- https://www.falcon-sign.info
Expand Down
2 changes: 1 addition & 1 deletion docs/algorithms/sig/sphincs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- **Authors' website**: https://sphincs.org/
- **Specification version**: NIST Round 3 submission, v3.1 (June 10, 2022).
- **Primary Source**<a name="primary-source"></a>:
- **Source**: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789 with copy_from_upstream patches
- **Source**: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181 with copy_from_upstream patches
- **Implementation license (SPDX-Identifier)**: CC0-1.0


Expand Down
2 changes: 1 addition & 1 deletion docs/algorithms/sig/sphincs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ nist-round: 3
spec-version: NIST Round 3 submission, v3.1 (June 10, 2022)
spdx-license-identifier: CC0-1.0
primary-upstream:
source: https://github.com/PQClean/PQClean/commit/8e221ae797b229858a0b0d784577a8cb149d5789
source: https://github.com/PQClean/PQClean/commit/1eacfdafc15ddc5d5759d0b85b4cef26627df181
with copy_from_upstream patches
spdx-license-identifier: CC0-1.0
upstream-ancestors:
Expand Down
4 changes: 2 additions & 2 deletions scripts/copy_from_upstream/copy_from_upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ upstreams:
name: pqclean
git_url: https://github.com/PQClean/PQClean.git
git_branch: master
git_commit: 8e221ae797b229858a0b0d784577a8cb149d5789
git_commit: 1eacfdafc15ddc5d5759d0b85b4cef26627df181
kem_meta_path: 'crypto_kem/{pqclean_scheme}/META.yml'
sig_meta_path: 'crypto_sign/{pqclean_scheme}/META.yml'
kem_scheme_path: 'crypto_kem/{pqclean_scheme}'
sig_scheme_path: 'crypto_sign/{pqclean_scheme}'
patches: [pqclean-sphincs.patch, pqclean-hqc-decaps.patch]
patches: [pqclean-sphincs.patch]
ignore: pqclean_sphincs-shake-256s-simple_aarch64, pqclean_sphincs-shake-256s-simple_aarch64, pqclean_sphincs-shake-256f-simple_aarch64, pqclean_sphincs-shake-192s-simple_aarch64, pqclean_sphincs-shake-192f-simple_aarch64, pqclean_sphincs-shake-128s-simple_aarch64, pqclean_sphincs-shake-128f-simple_aarch64, pqclean_kyber512_aarch64, pqclean_kyber1024_aarch64, pqclean_kyber768_aarch64, pqclean_dilithium2_aarch64, pqclean_dilithium3_aarch64, pqclean_dilithium5_aarch64
-
name: pqcrystals-kyber
Expand Down
88 changes: 0 additions & 88 deletions scripts/copy_from_upstream/patches/pqclean-hqc-decaps.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/kem/hqc/kem_hqc_128.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OQS_KEM *OQS_KEM_hqc_128_new(void) {
return NULL;
}
kem->method_name = OQS_KEM_alg_hqc_128;
kem->alg_version = "hqc-submission_2023-04-30 via https://github.com/SWilson4/package-pqclean/tree/8db1b24b/hqc";
kem->alg_version = "hqc-submission_2023-04-30 via https://github.com/SWilson4/package-pqclean/tree/9b509aa7/hqc";

kem->claimed_nist_level = 1;
kem->ind_cca = true;
Expand Down
2 changes: 1 addition & 1 deletion src/kem/hqc/kem_hqc_192.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OQS_KEM *OQS_KEM_hqc_192_new(void) {
return NULL;
}
kem->method_name = OQS_KEM_alg_hqc_192;
kem->alg_version = "hqc-submission_2023-04-30 via https://github.com/SWilson4/package-pqclean/tree/8db1b24b/hqc";
kem->alg_version = "hqc-submission_2023-04-30 via https://github.com/SWilson4/package-pqclean/tree/9b509aa7/hqc";

kem->claimed_nist_level = 3;
kem->ind_cca = true;
Expand Down
2 changes: 1 addition & 1 deletion src/kem/hqc/kem_hqc_256.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OQS_KEM *OQS_KEM_hqc_256_new(void) {
return NULL;
}
kem->method_name = OQS_KEM_alg_hqc_256;
kem->alg_version = "hqc-submission_2023-04-30 via https://github.com/SWilson4/package-pqclean/tree/8db1b24b/hqc";
kem->alg_version = "hqc-submission_2023-04-30 via https://github.com/SWilson4/package-pqclean/tree/9b509aa7/hqc";

kem->claimed_nist_level = 5;
kem->ind_cca = true;
Expand Down
1 change: 1 addition & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ int PQCLEAN_HQC128_CLEAN_crypto_kem_enc(uint8_t *ct, uint8_t *ss, const uint8_t

int PQCLEAN_HQC128_CLEAN_crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);


#endif
5 changes: 5 additions & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @brief Implementation of concatenated code
*/



/**
*
* @brief Encoding the message m to a code word em using the concatenated code
Expand All @@ -26,6 +28,8 @@ void PQCLEAN_HQC128_CLEAN_code_encode(uint64_t *em, const uint8_t *m) {

}



/**
* @brief Decoding the code word em to a message m using the concatenated code
*
Expand All @@ -38,4 +42,5 @@ void PQCLEAN_HQC128_CLEAN_code_decode(uint8_t *m, const uint64_t *em) {
PQCLEAN_HQC128_CLEAN_reed_muller_decode(tmp, em);
PQCLEAN_HQC128_CLEAN_reed_solomon_decode(m, tmp);


}
2 changes: 2 additions & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/code.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef CODE_H
#define CODE_H


/**
* @file code.h
* @brief Header file of code.c
Expand All @@ -12,4 +13,5 @@ void PQCLEAN_HQC128_CLEAN_code_encode(uint64_t *em, const uint8_t *message);

void PQCLEAN_HQC128_CLEAN_code_decode(uint8_t *m, const uint64_t *em);


#endif
2 changes: 2 additions & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/domains.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#ifndef DOMAINS_H
#define DOMAINS_H


/**
* @file domains.h
* @brief SHAKE-256 domains separation header grouping all domains to avoid collisions
*/


#define PRNG_DOMAIN 1
#define SEEDEXPANDER_DOMAIN 2
#define G_FCT_DOMAIN 3
Expand Down
11 changes: 11 additions & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* https://binary.cr.yp.to/mcbits-20130616.pdf
*/


static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_f);

/**
Expand All @@ -28,6 +29,8 @@ static void compute_fft_betas(uint16_t *betas) {
}
}



/**
* @brief Computes the subset sums of the given set
*
Expand All @@ -49,6 +52,8 @@ static void compute_subset_sums(uint16_t *subset_sums, const uint16_t *set, uint
}
}



/**
* @brief Computes the radix conversion of a polynomial f in GF(2^m)[x]
*
Expand Down Expand Up @@ -143,6 +148,8 @@ static void radix_big(uint16_t *f0, uint16_t *f1, const uint16_t *f, uint32_t m_
memcpy(f1 + n, Q1, 2 * n);
}



/**
* @brief Evaluates f at all subset sums of a given set
*
Expand Down Expand Up @@ -236,6 +243,8 @@ static void fft_rec(uint16_t *w, uint16_t *f, size_t f_coeffs, uint8_t m, uint32
}
}



/**
* @brief Evaluates f on all fields elements using an additive FFT algorithm
*
Expand Down Expand Up @@ -305,6 +314,8 @@ void PQCLEAN_HQC128_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs) {
}
}



/**
* @brief Retrieves the error polynomial error from the evaluations w of the ELP (Error Locator Polynomial) on all field elements.
*
Expand Down
2 changes: 2 additions & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/fft.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef FFT_H
#define FFT_H


/**
* @file fft.h
* @brief Header file of fft.c
Expand All @@ -13,4 +14,5 @@ void PQCLEAN_HQC128_CLEAN_fft(uint16_t *w, const uint16_t *f, size_t f_coeffs);

void PQCLEAN_HQC128_CLEAN_fft_retrieve_error_poly(uint8_t *error, const uint16_t *w);


#endif
11 changes: 11 additions & 0 deletions src/kem/hqc/pqclean_hqc-128_clean/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @brief Galois field implementation
*/


/**
* @brief Computes the number of trailing zero bits.
*
Expand All @@ -23,6 +24,8 @@ static uint16_t trailing_zero_bits_count(uint16_t a) {
return tmp;
}



/**
* Reduces polynomial x modulo primitive polynomial GF_POLY.
* @returns x mod GF_POLY
Expand Down Expand Up @@ -57,6 +60,8 @@ static uint16_t gf_reduce(uint64_t x, size_t deg_x) {
return (uint16_t)x;
}



/**
* Carryless multiplication of two polynomials a and b.
*
Expand Down Expand Up @@ -105,6 +110,8 @@ static void gf_carryless_mul(uint8_t c[2], uint8_t a, uint8_t b) {
c[1] = (uint8_t)h;
}



/**
* Multiplies two elements of GF(2^GF_M).
* @returns the product a*b
Expand All @@ -118,6 +125,8 @@ uint16_t PQCLEAN_HQC128_CLEAN_gf_mul(uint16_t a, uint16_t b) {
return gf_reduce(tmp, 2 * (PARAM_M - 1));
}



/**
* @brief Squares an element of GF(2^PARAM_M).
* @returns a^2
Expand All @@ -134,6 +143,8 @@ uint16_t PQCLEAN_HQC128_CLEAN_gf_square(uint16_t a) {
return gf_reduce(s, 2 * (PARAM_M - 1));
}



/**
* @brief Computes the inverse of an element of GF(2^PARAM_M),
* using the addition chain 1 2 3 4 7 11 15 30 60 120 127 254
Expand Down
Loading

0 comments on commit af78b87

Please sign in to comment.