From d14825a7559c72ddb74232fd58f6e34dbee22f71 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Thu, 10 Aug 2023 13:43:23 -0400 Subject: [PATCH] Pull Falcon updates from PQClean (#1523) https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 --- docs/algorithms/kem/classic_mceliece.md | 2 +- docs/algorithms/kem/classic_mceliece.yml | 2 +- docs/algorithms/kem/hqc.md | 2 +- docs/algorithms/kem/hqc.yml | 2 +- docs/algorithms/kem/kyber.md | 2 +- docs/algorithms/kem/kyber.yml | 5 +++-- docs/algorithms/sig/dilithium.md | 2 +- docs/algorithms/sig/dilithium.yml | 5 +++-- docs/algorithms/sig/falcon.md | 2 +- docs/algorithms/sig/falcon.yml | 2 +- docs/algorithms/sig/sphincs.md | 2 +- docs/algorithms/sig/sphincs.yml | 2 +- scripts/copy_from_upstream/copy_from_upstream.yml | 2 +- src/sig/falcon/pqclean_falcon-1024_avx2/sign.c | 6 +++--- src/sig/falcon/pqclean_falcon-512_avx2/sign.c | 6 +++--- 15 files changed, 23 insertions(+), 21 deletions(-) diff --git a/docs/algorithms/kem/classic_mceliece.md b/docs/algorithms/kem/classic_mceliece.md index 046785337..2efd78ebd 100644 --- a/docs/algorithms/kem/classic_mceliece.md +++ b/docs/algorithms/kem/classic_mceliece.md @@ -6,7 +6,7 @@ - **Authors' website**: https://classic.mceliece.org - **Specification version**: SUPERCOP-20221025. - **Primary Source**: - - **Source**: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + - **Source**: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 - **Implementation license (SPDX-Identifier)**: Public domain - **Ancestors of primary source**: - SUPERCOP-20221025 "clean" and "avx2" implementations diff --git a/docs/algorithms/kem/classic_mceliece.yml b/docs/algorithms/kem/classic_mceliece.yml index 5f2ca928d..c09b364b1 100644 --- a/docs/algorithms/kem/classic_mceliece.yml +++ b/docs/algorithms/kem/classic_mceliece.yml @@ -375,4 +375,4 @@ parameter-sets: auxiliary-submitters: [] primary-upstream: spdx-license-identifier: Public domain - source: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + source: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 diff --git a/docs/algorithms/kem/hqc.md b/docs/algorithms/kem/hqc.md index f022eaffc..b03104303 100644 --- a/docs/algorithms/kem/hqc.md +++ b/docs/algorithms/kem/hqc.md @@ -6,7 +6,7 @@ - **Authors' website**: https://pqc-hqc.org/ - **Specification version**: NIST Round 3 submission. - **Primary Source**: - - **Source**: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + - **Source**: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 - **Implementation license (SPDX-Identifier)**: Public domain - **Ancestors of primary source**: - https://github.com/jschanck/package-pqclean/tree/29f79e72/hqc, which takes it from: diff --git a/docs/algorithms/kem/hqc.yml b/docs/algorithms/kem/hqc.yml index 227f24625..42767c444 100644 --- a/docs/algorithms/kem/hqc.yml +++ b/docs/algorithms/kem/hqc.yml @@ -125,4 +125,4 @@ parameter-sets: upstream: primary-upstream primary-upstream: spdx-license-identifier: Public domain - source: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + source: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 diff --git a/docs/algorithms/kem/kyber.md b/docs/algorithms/kem/kyber.md index 0e3650711..3f7d1b91e 100644 --- a/docs/algorithms/kem/kyber.md +++ b/docs/algorithms/kem/kyber.md @@ -11,7 +11,7 @@ - **Implementation license (SPDX-Identifier)**: CC0-1.0 or Apache-2.0 - **Optimized Implementation sources**: https://github.com/pq-crystals/kyber/commit/518de2414a85052bb91349bcbcc347f391292d5b with copy_from_upstream patches - **pqclean-aarch64**: - - **Source**: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e with copy_from_upstream patches + - **Source**: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 with copy_from_upstream patches - **Implementation license (SPDX-Identifier)**: CC0-1.0 and (CC0-1.0 or Apache-2.0) and (CC0-1.0 or MIT) and MIT diff --git a/docs/algorithms/kem/kyber.yml b/docs/algorithms/kem/kyber.yml index 36a938c81..f5edb82f9 100644 --- a/docs/algorithms/kem/kyber.yml +++ b/docs/algorithms/kem/kyber.yml @@ -22,9 +22,10 @@ primary-upstream: spdx-license-identifier: CC0-1.0 or Apache-2.0 optimized-upstreams: pqclean-aarch64: - source: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + source: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 with copy_from_upstream patches - spdx-license-identifier: CC0-1.0 and (CC0-1.0 or Apache-2.0) and (CC0-1.0 or MIT) and MIT + spdx-license-identifier: CC0-1.0 and (CC0-1.0 or Apache-2.0) and (CC0-1.0 or MIT) + and MIT parameter-sets: - name: Kyber512 claimed-nist-level: 1 diff --git a/docs/algorithms/sig/dilithium.md b/docs/algorithms/sig/dilithium.md index 7110a51de..93e1d8524 100644 --- a/docs/algorithms/sig/dilithium.md +++ b/docs/algorithms/sig/dilithium.md @@ -11,7 +11,7 @@ - **Implementation license (SPDX-Identifier)**: CC0-1.0 or Apache-2.0 - **Optimized Implementation sources**: https://github.com/pq-crystals/dilithium/commit/3e9b9f1412f6c7435dbeb4e10692ea58f181ee51 with copy_from_upstream patches - **pqclean-aarch64**: - - **Source**: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e with copy_from_upstream patches + - **Source**: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 with copy_from_upstream patches - **Implementation license (SPDX-Identifier)**: CC0-1.0 and (CC0-1.0 or Apache-2.0) and (CC0-1.0 or MIT) and MIT diff --git a/docs/algorithms/sig/dilithium.yml b/docs/algorithms/sig/dilithium.yml index 51282af13..7cec2ffbb 100644 --- a/docs/algorithms/sig/dilithium.yml +++ b/docs/algorithms/sig/dilithium.yml @@ -20,9 +20,10 @@ primary-upstream: spdx-license-identifier: CC0-1.0 or Apache-2.0 optimized-upstreams: pqclean-aarch64: - source: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + source: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 with copy_from_upstream patches - spdx-license-identifier: CC0-1.0 and (CC0-1.0 or Apache-2.0) and (CC0-1.0 or MIT) and MIT + spdx-license-identifier: CC0-1.0 and (CC0-1.0 or Apache-2.0) and (CC0-1.0 or MIT) + and MIT parameter-sets: - name: Dilithium2 oqs_alg: OQS_SIG_alg_dilithium_2 diff --git a/docs/algorithms/sig/falcon.md b/docs/algorithms/sig/falcon.md index 50fbd1028..3d51e9a6f 100644 --- a/docs/algorithms/sig/falcon.md +++ b/docs/algorithms/sig/falcon.md @@ -7,7 +7,7 @@ - **Authors' website**: https://falcon-sign.info - **Specification version**: 20211101. - **Primary Source**: - - **Source**: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + - **Source**: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 - **Implementation license (SPDX-Identifier)**: MIT diff --git a/docs/algorithms/sig/falcon.yml b/docs/algorithms/sig/falcon.yml index c5783948a..51685dde6 100644 --- a/docs/algorithms/sig/falcon.yml +++ b/docs/algorithms/sig/falcon.yml @@ -18,7 +18,7 @@ website: https://falcon-sign.info nist-round: 3 spec-version: 20211101 primary-upstream: - source: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e + source: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 spdx-license-identifier: MIT upstream-ancestors: - https://www.falcon-sign.info diff --git a/docs/algorithms/sig/sphincs.md b/docs/algorithms/sig/sphincs.md index 098ba0305..8cd31a71f 100644 --- a/docs/algorithms/sig/sphincs.md +++ b/docs/algorithms/sig/sphincs.md @@ -7,7 +7,7 @@ - **Authors' website**: https://sphincs.org/ - **Specification version**: NIST Round 3 submission, v3.1 (June 10, 2022). - **Primary Source**: - - **Source**: https://github.com/PQClean/PQClean/commit/66e50172055aaf1b9a16d8f35fe03b0807f2723e with copy_from_upstream patches + - **Source**: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 with copy_from_upstream patches - **Implementation license (SPDX-Identifier)**: CC0-1.0 diff --git a/docs/algorithms/sig/sphincs.yml b/docs/algorithms/sig/sphincs.yml index 90fc816b6..ede48ea09 100644 --- a/docs/algorithms/sig/sphincs.yml +++ b/docs/algorithms/sig/sphincs.yml @@ -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/66e50172055aaf1b9a16d8f35fe03b0807f2723e + source: https://github.com/PQClean/PQClean/commit/c3abebf4ab1ff516ffa71e6337f06d898952c299 with copy_from_upstream patches spdx-license-identifier: CC0-1.0 upstream-ancestors: diff --git a/scripts/copy_from_upstream/copy_from_upstream.yml b/scripts/copy_from_upstream/copy_from_upstream.yml index 47cd76f60..d1e61f58a 100644 --- a/scripts/copy_from_upstream/copy_from_upstream.yml +++ b/scripts/copy_from_upstream/copy_from_upstream.yml @@ -3,7 +3,7 @@ upstreams: name: pqclean git_url: https://github.com/PQClean/PQClean.git git_branch: master - git_commit: 66e50172055aaf1b9a16d8f35fe03b0807f2723e + git_commit: c3abebf4ab1ff516ffa71e6337f06d898952c299 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}' diff --git a/src/sig/falcon/pqclean_falcon-1024_avx2/sign.c b/src/sig/falcon/pqclean_falcon-1024_avx2/sign.c index c9c42b9ea..7525debd9 100644 --- a/src/sig/falcon/pqclean_falcon-1024_avx2/sign.c +++ b/src/sig/falcon/pqclean_falcon-1024_avx2/sign.c @@ -1030,9 +1030,9 @@ PQCLEAN_FALCON1024_AVX2_gaussian0_sampler(prng *p) { * On 32-bit systems, 'lo' really is two registers, requiring * some extra code. */ -#if defined(__x86_64__) || defined(_M_X64) + #if defined(__x86_64__) || defined(_M_X64) xlo = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(*(int64_t *)&lo)); -#else + #else { uint32_t e0, e1; int32_t f0, f1; @@ -1043,7 +1043,7 @@ PQCLEAN_FALCON1024_AVX2_gaussian0_sampler(prng *p) { f1 = *(int32_t *)&e1; xlo = _mm256_set_epi32(f1, f0, f1, f0, f1, f0, f1, f0); } -#endif + #endif gtlo0 = _mm256_cmpgt_epi64(_mm256_loadu_si256(&rlo57.ymm[0]), xlo); gtlo1 = _mm256_cmpgt_epi64(_mm256_loadu_si256(&rlo57.ymm[1]), xlo); gtlo2 = _mm256_cmpgt_epi64(_mm256_loadu_si256(&rlo57.ymm[2]), xlo); diff --git a/src/sig/falcon/pqclean_falcon-512_avx2/sign.c b/src/sig/falcon/pqclean_falcon-512_avx2/sign.c index 77ee5d3cc..aa3fb43be 100644 --- a/src/sig/falcon/pqclean_falcon-512_avx2/sign.c +++ b/src/sig/falcon/pqclean_falcon-512_avx2/sign.c @@ -1030,9 +1030,9 @@ PQCLEAN_FALCON512_AVX2_gaussian0_sampler(prng *p) { * On 32-bit systems, 'lo' really is two registers, requiring * some extra code. */ -#if defined(__x86_64__) || defined(_M_X64) + #if defined(__x86_64__) || defined(_M_X64) xlo = _mm256_broadcastq_epi64(_mm_cvtsi64_si128(*(int64_t *)&lo)); -#else + #else { uint32_t e0, e1; int32_t f0, f1; @@ -1043,7 +1043,7 @@ PQCLEAN_FALCON512_AVX2_gaussian0_sampler(prng *p) { f1 = *(int32_t *)&e1; xlo = _mm256_set_epi32(f1, f0, f1, f0, f1, f0, f1, f0); } -#endif + #endif gtlo0 = _mm256_cmpgt_epi64(_mm256_loadu_si256(&rlo57.ymm[0]), xlo); gtlo1 = _mm256_cmpgt_epi64(_mm256_loadu_si256(&rlo57.ymm[1]), xlo); gtlo2 = _mm256_cmpgt_epi64(_mm256_loadu_si256(&rlo57.ymm[2]), xlo);