mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-12-07 00:02:12 -05:00
Fix gcc 11 error for Kyber on arm64 (#1127)
* Set new version of Kyber ARM to use from PQClean * Result of running copy_from_upstream * Removed the need for pqclean aarch64 patches * Updating doc generation to be a little more careful about when required flags is an empty list Co-authored-by: Jason Goertzen <Martyrshot@gmail.com>
This commit is contained in:
parent
2c98b97fa4
commit
14d64d379d
@ -6,7 +6,7 @@
|
||||
- **Authors' website**: https://classic.mceliece.org
|
||||
- **Specification version**: SUPERCOP-20191221.
|
||||
- **Primary Source**<a name="primary-source"></a>:
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
- **Implementation license (SPDX-Identifier)**: Public domain
|
||||
, which takes it from:
|
||||
- SUPERCOP-20191221 "vec" and "avx" implementations
|
||||
|
||||
@ -369,4 +369,4 @@ parameter-sets:
|
||||
auxiliary-submitters: []
|
||||
primary-upstream:
|
||||
spdx-license-identifier: Public domain
|
||||
source: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
source: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- **Authors' website**: https://pqc-hqc.org/
|
||||
- **Specification version**: NIST Round 3 submission.
|
||||
- **Primary Source**<a name="primary-source"></a>:
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
- **Implementation license (SPDX-Identifier)**: Public domain
|
||||
, which takes it from:
|
||||
- https://github.com/jschanck/package-pqclean/tree/29f79e72/hqc, which takes it from:
|
||||
|
||||
@ -122,4 +122,4 @@ parameter-sets:
|
||||
upstream: primary-upstream
|
||||
primary-upstream:
|
||||
spdx-license-identifier: Public domain
|
||||
source: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
source: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
- **Implementation license (SPDX-Identifier)**: CC0-1.0
|
||||
- **Optimized Implementation sources**: https://github.com/pq-crystals/kyber/commit/faf5c3fe33e0b61c7c8a7888dd862bf5def17ad2 with copy_from_upstream patches
|
||||
- **pqclean-aarch64**:<a name="pqclean-aarch64"></a>
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8 with copy_from_upstream patches
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9 with copy_from_upstream patches
|
||||
- **Implementation license (SPDX-Identifier)**: CC0-1.0
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ primary-upstream:
|
||||
spdx-license-identifier: CC0-1.0
|
||||
optimized-upstreams:
|
||||
pqclean-aarch64:
|
||||
source: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
source: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
with copy_from_upstream patches
|
||||
spdx-license-identifier: CC0-1.0
|
||||
parameter-sets:
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
- **Authors' website**: https://ntru.org/
|
||||
- **Specification version**: NIST Round 3 submission.
|
||||
- **Primary Source**<a name="primary-source"></a>:
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
- **Implementation license (SPDX-Identifier)**: CC0-1.0
|
||||
, which takes it from:
|
||||
- https://github.com/jschanck/ntru/tree/a43a4457
|
||||
|
||||
@ -185,4 +185,4 @@ parameter-sets:
|
||||
upstream: primary-upstream
|
||||
primary-upstream:
|
||||
spdx-license-identifier: CC0-1.0
|
||||
source: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
source: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- **Authors' website**: https://ntruprime.cr.yp.to
|
||||
- **Specification version**: supercop-20200826.
|
||||
- **Primary Source**<a name="primary-source"></a>:
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
- **Implementation license (SPDX-Identifier)**: Public domain
|
||||
, which takes it from:
|
||||
- https://github.com/jschanck/package-pqclean/tree/4d9f08c3/ntruprime, which takes it from:
|
||||
|
||||
@ -285,4 +285,4 @@ parameter-sets:
|
||||
upstream: primary-upstream
|
||||
primary-upstream:
|
||||
spdx-license-identifier: Public domain
|
||||
source: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
source: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- **Authors' website**: https://www.esat.kuleuven.be/cosic/pqcrypto/saber/
|
||||
- **Specification version**: NIST Round 3 submission.
|
||||
- **Primary Source**<a name="primary-source"></a>:
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
- **Source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
- **Implementation license (SPDX-Identifier)**: Public domain
|
||||
, which takes it from:
|
||||
- https://github.com/jschanck/package-pqclean/tree/1ae84c3c/saber, which takes it from:
|
||||
|
||||
@ -108,4 +108,4 @@ parameter-sets:
|
||||
upstream: primary-upstream
|
||||
primary-upstream:
|
||||
spdx-license-identifier: Public domain
|
||||
source: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
source: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- **Auxiliary submitters**: Pierre-Alain Fouque, Jeffrey Hoffstein, Paul Kirchner, Vadim Lyubashevsky, Thomas Pornin, Thomas Ricosset, Gregor Seiler, William Whyte, Zhenfei Zhang.
|
||||
- **Authors' website**: https://falcon-sign.info
|
||||
- **Specification version**: v1.2.
|
||||
- **Implementation source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8, which takes it from:
|
||||
- **Implementation source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9, which takes it from:
|
||||
- https://github.com/jschanck/package-pqclean/tree/cea1fa5a/falcon, which takes it from:
|
||||
- supercop-20201018
|
||||
- **Implementation license (SPDX-Identifier)**: CC0-1.0.
|
||||
|
||||
@ -17,7 +17,7 @@ website: https://falcon-sign.info
|
||||
nist-round: 3
|
||||
spec-version: v1.2
|
||||
spdx-license-identifier: CC0-1.0
|
||||
upstream: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
upstream: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
upstream-ancestors:
|
||||
- https://github.com/jschanck/package-pqclean/tree/cea1fa5a/falcon
|
||||
- supercop-20201018
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- **Auxiliary submitters**: Ming-Shing Chen, Matthias Kannwischer, Jacques Patarin, Albrecht Petzoldt, Dieter Schmidt, Bo-Yin Yang.
|
||||
- **Authors' website**: https://www.pqcrainbow.org/
|
||||
- **Specification version**: NIST Round 3 submission.
|
||||
- **Implementation source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8, which takes it from:
|
||||
- **Implementation source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9, which takes it from:
|
||||
- https://github.com/fast-crypto-lab/rainbow-submission-round2/commit/173ada0e077e1b9dbd8e4a78994f87acc0c92263
|
||||
- **Implementation license (SPDX-Identifier)**: CC0-1.0.
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ website: https://www.pqcrainbow.org/
|
||||
nist-round: 3
|
||||
spec-version: NIST Round 3 submission
|
||||
spdx-license-identifier: CC0-1.0
|
||||
upstream: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
upstream: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
upstream-ancestors:
|
||||
- https://github.com/fast-crypto-lab/rainbow-submission-round2/commit/173ada0e077e1b9dbd8e4a78994f87acc0c92263
|
||||
parameter-sets:
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
- **Auxiliary submitters**: Jean-Philippe Aumasson, Daniel J. Bernstein,, Christoph Dobraunig, Maria Eichlseder, Scott Fluhrer, Stefan-Lukas Gazdag, Panos Kampanakis, Stefan Kölbl, Tanja Lange, Martin M. Lauridsen, Florian Mendel, Ruben Niederhagen, Christian Rechberger, Joost Rijneveld, Peter Schwabe.
|
||||
- **Authors' website**: https://sphincs.org/
|
||||
- **Specification version**: NIST Round 3 submission.
|
||||
- **Implementation source**: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8 with copy_from_upstream patches, which takes it from:
|
||||
- **Implementation source**: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9 with copy_from_upstream patches, which takes it from:
|
||||
- https://github.com/sphincs/sphincsplus
|
||||
- **Implementation license (SPDX-Identifier)**: CC0-1.0.
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ website: https://sphincs.org/
|
||||
nist-round: 3
|
||||
spec-version: NIST Round 3 submission
|
||||
spdx-license-identifier: CC0-1.0
|
||||
upstream: https://github.com/PQClean/PQClean/commit/e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
upstream: https://github.com/PQClean/PQClean/commit/f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
with copy_from_upstream patches
|
||||
upstream-ancestors:
|
||||
- https://github.com/sphincs/sphincsplus
|
||||
|
||||
@ -523,6 +523,8 @@ def process_families(instructions, basedir, with_kat, with_generator):
|
||||
req = impl['supported_platforms'][i]
|
||||
# if compiling for ARM64_V8 the asimd is implied and will cause errors
|
||||
# when provided to the compiler, so we need to remove it
|
||||
if req['architecture'] == 'arm_8':
|
||||
req['architecture'] = 'ARM64_V8'
|
||||
if req['architecture'] == 'ARM64_V8' and 'asimd' in req['required_flags']:
|
||||
req['required_flags'].remove('asimd')
|
||||
impl['required_flags'] = req['required_flags']
|
||||
|
||||
@ -3,13 +3,13 @@ upstreams:
|
||||
name: pqclean
|
||||
git_url: https://github.com/PQClean/PQClean.git
|
||||
git_branch: master
|
||||
git_commit: e2d82cc58dcbc75dcce9ecf70e91465a00c2a4d8
|
||||
git_commit: f365dcfe69f15325443ce65df9798e42816f78e9
|
||||
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}'
|
||||
ignore: ['pqclean_lightsaber_aarch64', 'pqclean_saber_aarch64', 'pqclean_firesaber_aarch64']
|
||||
patches: ['pqclean-sphincs.patch', 'pqclean-kyber-armneon-yml.patch', 'pqclean-kyber-armneon-shake.patch']
|
||||
patches: ['pqclean-sphincs.patch', 'pqclean-kyber-armneon-shake.patch']
|
||||
-
|
||||
name: pqcrystals-kyber
|
||||
git_url: https://github.com/pq-crystals/kyber.git
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
From acfeeed3a79552a1a7b42f9d44132833bcc08afa Mon Sep 17 00:00:00 2001
|
||||
From: Jason Goertzen <Martyrshot@gmail.com>
|
||||
Date: Tue, 9 Nov 2021 16:51:51 -0500
|
||||
Subject: [PATCH] Patching pqclean's META.yml files to match our arm
|
||||
architecture naming convention
|
||||
|
||||
---
|
||||
crypto_kem/kyber1024/META.yml | 2 +-
|
||||
crypto_kem/kyber512/META.yml | 2 +-
|
||||
crypto_kem/kyber768/META.yml | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/crypto_kem/kyber1024/META.yml b/crypto_kem/kyber1024/META.yml
|
||||
index 28e2014..56a4b5f 100644
|
||||
--- a/crypto_kem/kyber1024/META.yml
|
||||
+++ b/crypto_kem/kyber1024/META.yml
|
||||
@@ -37,7 +37,7 @@ implementations:
|
||||
- name: aarch64
|
||||
version: https://github.com/neon-ntt/neon-ntt/tree/b011eeff3515fb168aa4dbaa671d760009d98dbb
|
||||
supported_platforms:
|
||||
- - architecture: arm_8
|
||||
+ - architecture: ARM64_V8
|
||||
operating_systems:
|
||||
- Linux
|
||||
- Darwin
|
||||
diff --git a/crypto_kem/kyber512/META.yml b/crypto_kem/kyber512/META.yml
|
||||
index 3c4d1ee..33fe01d 100644
|
||||
--- a/crypto_kem/kyber512/META.yml
|
||||
+++ b/crypto_kem/kyber512/META.yml
|
||||
@@ -37,7 +37,7 @@ implementations:
|
||||
- name: aarch64
|
||||
version: https://github.com/neon-ntt/neon-ntt/tree/b011eeff3515fb168aa4dbaa671d760009d98dbb
|
||||
supported_platforms:
|
||||
- - architecture: arm_8
|
||||
+ - architecture: ARM64_V8
|
||||
operating_systems:
|
||||
- Linux
|
||||
- Darwin
|
||||
diff --git a/crypto_kem/kyber768/META.yml b/crypto_kem/kyber768/META.yml
|
||||
index 035cce6..98a0504 100644
|
||||
--- a/crypto_kem/kyber768/META.yml
|
||||
+++ b/crypto_kem/kyber768/META.yml
|
||||
@@ -37,7 +37,7 @@ implementations:
|
||||
- name: aarch64
|
||||
version: https://github.com/neon-ntt/neon-ntt/tree/b011eeff3515fb168aa4dbaa671d760009d98dbb
|
||||
supported_platforms:
|
||||
- - architecture: arm_8
|
||||
+ - architecture: ARM64_V8
|
||||
operating_systems:
|
||||
- Linux
|
||||
- Darwin
|
||||
--
|
||||
2.30.1 (Apple Git-130)
|
||||
|
||||
@ -185,15 +185,6 @@ def update_upstream_kem_alg_docs(liboqs_root, kems, upstream_info, write_changes
|
||||
# Logic to add Common_META.yml components
|
||||
|
||||
implementations = upstream_yaml['implementations']
|
||||
"""
|
||||
if 'arch_specific_upstream_locations' in kem and impl['upstream'] != 'primary-upstream':
|
||||
upstream_name = impl['upstream']
|
||||
meta_yaml_path_template = ouis[upstream_name]['kem_meta_path']
|
||||
opt_upstream_root = ouis[upstream_name]['upstream_root']
|
||||
upstream_meta_path = os.path.join(opt_upstream_root, meta_yaml_path_template.format_map(scheme))
|
||||
optimized_meta = load_yaml(upstream_meta_path)
|
||||
implementations = optimized_meta['implementations']
|
||||
"""
|
||||
uir = get_upstream_info(implementations, impl['upstream-id'])
|
||||
if (uir != None) and ('common_dep' in uir):
|
||||
upstream_common_path = upstream_meta_path.replace(scheme['pretty_name_full'], "Common")
|
||||
@ -201,17 +192,19 @@ def update_upstream_kem_alg_docs(liboqs_root, kems, upstream_info, write_changes
|
||||
for c in uir['common_dep'].split(' '):
|
||||
ur = get_upstream_info(upstream_common_yaml['commons'], c)
|
||||
if (ur != None) and ('supported_platforms' in ur):
|
||||
if 'required_flags' in ur['supported_platforms'][0].keys():
|
||||
upstream_impl['supported_platforms'][0]['required_flags']=list(set(upstream_impl['supported_platforms'][0]['required_flags']+ur['supported_platforms'][0]['required_flags']))
|
||||
upstream_impl['supported_platforms'][0]['required_flags'].sort()
|
||||
if 'required_flags' in ur['supported_platforms'][0] and not ur['supported_platforms'][0]['required_flags']:
|
||||
del ur['supported_platforms'][0]['required_flags']
|
||||
if 'required_flags' in ur['supported_platforms'][0].keys():
|
||||
upstream_impl['supported_platforms'][0]['required_flags']=list(set(upstream_impl['supported_platforms'][0]['required_flags']+ur['supported_platforms'][0]['required_flags']))
|
||||
upstream_impl['supported_platforms'][0]['required_flags'].sort()
|
||||
if 'supported_platforms' in upstream_impl:
|
||||
for i in range(len(upstream_impl['supported_platforms'])):
|
||||
if upstream_impl['supported_platforms'][i]['architecture'] == 'arm_8':
|
||||
upstream_impl['supported_platforms'][i]['architecture'] = 'ARM64_V8'
|
||||
if 'asimd' in upstream_impl['supported_platforms'][i]['required_flags']:
|
||||
upstream_impl['supported_platforms'][i]['required_flags'].remove('asimd')
|
||||
if not upstream_impl['supported_platforms'][i]['required_flags']:
|
||||
del upstream_impl['supported_platforms'][i]['required_flags']
|
||||
if not upstream_impl['supported_platforms'][i]['required_flags']:
|
||||
del upstream_impl['supported_platforms'][i]['required_flags']
|
||||
|
||||
impl['supported-platforms'] = rhs_if_not_equal(impl['supported-platforms'], upstream_impl['supported_platforms'], "supported-platforms")
|
||||
else:
|
||||
@ -290,9 +283,9 @@ def update_upstream_sig_alg_docs(liboqs_root, sigs, upstream_info, write_changes
|
||||
for c in uir['common_dep'].split(' '):
|
||||
ur = get_upstream_info(upstream_common_yaml['commons'], c)
|
||||
if (ur != None) and ('supported_platforms' in ur):
|
||||
if 'required_flags' in ur['supported_platforms'][0].keys():
|
||||
upstream_impl['supported_platforms'][0]['required_flags']=list(set(upstream_impl['supported_platforms'][0]['required_flags']+ur['supported_platforms'][0]['required_flags']))
|
||||
upstream_impl['supported_platforms'][0]['required_flags'].sort()
|
||||
if 'required_flags' in ur['supported_platforms'][0].keys():
|
||||
upstream_impl['supported_platforms'][0]['required_flags']=list(set(upstream_impl['supported_platforms'][0]['required_flags']+ur['supported_platforms'][0]['required_flags']))
|
||||
upstream_impl['supported_platforms'][0]['required_flags'].sort()
|
||||
|
||||
if 'supported_platforms' in upstream_impl:
|
||||
impl['supported-platforms'] = rhs_if_not_equal(impl['supported-platforms'], upstream_impl['supported_platforms'], "supported-platforms")
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
*
|
||||
* Returns 0 (success)
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER1024_AARCH64_crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES],
|
||||
uint8_t sk[KYBER_SECRETKEYBYTES]) {
|
||||
int PQCLEAN_KYBER1024_AARCH64_crypto_kem_keypair(uint8_t *pk,
|
||||
uint8_t *sk) {
|
||||
size_t i;
|
||||
indcpa_keypair(pk, sk);
|
||||
for (i = 0; i < KYBER_INDCPA_PUBLICKEYBYTES; i++) {
|
||||
@ -49,9 +49,9 @@ int PQCLEAN_KYBER1024_AARCH64_crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES
|
||||
*
|
||||
* Returns 0 (success)
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER1024_AARCH64_crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
uint8_t ss[KYBER_SSBYTES],
|
||||
const uint8_t pk[KYBER_PUBLICKEYBYTES]) {
|
||||
int PQCLEAN_KYBER1024_AARCH64_crypto_kem_enc(uint8_t *ct,
|
||||
uint8_t *ss,
|
||||
const uint8_t *pk) {
|
||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
||||
/* Will contain key, coins */
|
||||
uint8_t kr[2 * KYBER_SYMBYTES];
|
||||
@ -91,9 +91,9 @@ int PQCLEAN_KYBER1024_AARCH64_crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
*
|
||||
* On failure, ss will contain a pseudo-random value.
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER1024_AARCH64_crypto_kem_dec(uint8_t ss[KYBER_SSBYTES],
|
||||
const uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
const uint8_t sk[KYBER_SECRETKEYBYTES]) {
|
||||
int PQCLEAN_KYBER1024_AARCH64_crypto_kem_dec(uint8_t *ss,
|
||||
const uint8_t *ct,
|
||||
const uint8_t *sk) {
|
||||
size_t i;
|
||||
int fail;
|
||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* (of length KYBER_POLYCOMPRESSEDBYTES)
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t *a) {
|
||||
void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i, j;
|
||||
int16_t u;
|
||||
uint8_t t[8];
|
||||
@ -47,7 +47,7 @@ void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t *a) {
|
||||
* - const uint8_t *a: pointer to input byte array
|
||||
* (of length KYBER_POLYCOMPRESSEDBYTES bytes)
|
||||
**************************************************/
|
||||
void poly_decompress(int16_t *r, const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
void poly_decompress(int16_t r[KYBER_N], const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
unsigned int i;
|
||||
|
||||
unsigned int j;
|
||||
@ -78,7 +78,7 @@ void poly_decompress(int16_t *r, const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
* (needs space for KYBER_POLYBYTES bytes)
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t *a) {
|
||||
void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i;
|
||||
uint16_t t0, t1;
|
||||
|
||||
@ -104,7 +104,7 @@ void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t *a) {
|
||||
* - const uint8_t *a: pointer to input byte array
|
||||
* (of KYBER_POLYBYTES bytes)
|
||||
**************************************************/
|
||||
void poly_frombytes(int16_t *r, const uint8_t a[KYBER_POLYBYTES]) {
|
||||
void poly_frombytes(int16_t r[KYBER_N], const uint8_t a[KYBER_POLYBYTES]) {
|
||||
uint8x16x3_t neon_buf;
|
||||
uint16x8x4_t tmp;
|
||||
int16x8x4_t value;
|
||||
@ -148,7 +148,7 @@ void poly_frombytes(int16_t *r, const uint8_t a[KYBER_POLYBYTES]) {
|
||||
* Arguments: - poly *r: pointer to output polynomial
|
||||
* - const uint8_t *msg: pointer to input message
|
||||
**************************************************/
|
||||
void poly_frommsg(int16_t *r, const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
void poly_frommsg(int16_t r[KYBER_N], const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
unsigned int i, j;
|
||||
int16_t mask;
|
||||
|
||||
@ -169,7 +169,7 @@ void poly_frommsg(int16_t *r, const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
* Arguments: - uint8_t *msg: pointer to output message
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_tomsg(uint8_t msg[KYBER_INDCPA_MSGBYTES], const int16_t *a) {
|
||||
void poly_tomsg(uint8_t msg[KYBER_INDCPA_MSGBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i, j;
|
||||
uint16_t t;
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
*
|
||||
* Returns 0 (success)
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER512_AARCH64_crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES],
|
||||
uint8_t sk[KYBER_SECRETKEYBYTES]) {
|
||||
int PQCLEAN_KYBER512_AARCH64_crypto_kem_keypair(uint8_t *pk,
|
||||
uint8_t *sk) {
|
||||
size_t i;
|
||||
indcpa_keypair(pk, sk);
|
||||
for (i = 0; i < KYBER_INDCPA_PUBLICKEYBYTES; i++) {
|
||||
@ -49,9 +49,9 @@ int PQCLEAN_KYBER512_AARCH64_crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES]
|
||||
*
|
||||
* Returns 0 (success)
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER512_AARCH64_crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
uint8_t ss[KYBER_SSBYTES],
|
||||
const uint8_t pk[KYBER_PUBLICKEYBYTES]) {
|
||||
int PQCLEAN_KYBER512_AARCH64_crypto_kem_enc(uint8_t *ct,
|
||||
uint8_t *ss,
|
||||
const uint8_t *pk) {
|
||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
||||
/* Will contain key, coins */
|
||||
uint8_t kr[2 * KYBER_SYMBYTES];
|
||||
@ -91,9 +91,9 @@ int PQCLEAN_KYBER512_AARCH64_crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
*
|
||||
* On failure, ss will contain a pseudo-random value.
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER512_AARCH64_crypto_kem_dec(uint8_t ss[KYBER_SSBYTES],
|
||||
const uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
const uint8_t sk[KYBER_SECRETKEYBYTES]) {
|
||||
int PQCLEAN_KYBER512_AARCH64_crypto_kem_dec(uint8_t *ss,
|
||||
const uint8_t *ct,
|
||||
const uint8_t *sk) {
|
||||
size_t i;
|
||||
int fail;
|
||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* (of length KYBER_POLYCOMPRESSEDBYTES)
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t *a) {
|
||||
void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i, j;
|
||||
int16_t u;
|
||||
uint8_t t[8];
|
||||
@ -46,7 +46,7 @@ void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t *a) {
|
||||
* - const uint8_t *a: pointer to input byte array
|
||||
* (of length KYBER_POLYCOMPRESSEDBYTES bytes)
|
||||
**************************************************/
|
||||
void poly_decompress(int16_t *r, const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
void poly_decompress(int16_t r[KYBER_N], const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < KYBER_N / 2; i++) {
|
||||
@ -65,7 +65,7 @@ void poly_decompress(int16_t *r, const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
* (needs space for KYBER_POLYBYTES bytes)
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t *a) {
|
||||
void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i;
|
||||
uint16_t t0, t1;
|
||||
|
||||
@ -91,7 +91,7 @@ void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t *a) {
|
||||
* - const uint8_t *a: pointer to input byte array
|
||||
* (of KYBER_POLYBYTES bytes)
|
||||
**************************************************/
|
||||
void poly_frombytes(int16_t *r, const uint8_t a[KYBER_POLYBYTES]) {
|
||||
void poly_frombytes(int16_t r[KYBER_N], const uint8_t a[KYBER_POLYBYTES]) {
|
||||
uint8x16x3_t neon_buf;
|
||||
uint16x8x4_t tmp;
|
||||
int16x8x4_t value;
|
||||
@ -135,7 +135,7 @@ void poly_frombytes(int16_t *r, const uint8_t a[KYBER_POLYBYTES]) {
|
||||
* Arguments: - poly *r: pointer to output polynomial
|
||||
* - const uint8_t *msg: pointer to input message
|
||||
**************************************************/
|
||||
void poly_frommsg(int16_t *r, const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
void poly_frommsg(int16_t r[KYBER_N], const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
unsigned int i, j;
|
||||
int16_t mask;
|
||||
|
||||
@ -156,7 +156,7 @@ void poly_frommsg(int16_t *r, const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
* Arguments: - uint8_t *msg: pointer to output message
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_tomsg(uint8_t msg[KYBER_INDCPA_MSGBYTES], const int16_t *a) {
|
||||
void poly_tomsg(uint8_t msg[KYBER_INDCPA_MSGBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i, j;
|
||||
uint16_t t;
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
*
|
||||
* Returns 0 (success)
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER768_AARCH64_crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES],
|
||||
uint8_t sk[KYBER_SECRETKEYBYTES]) {
|
||||
int PQCLEAN_KYBER768_AARCH64_crypto_kem_keypair(uint8_t *pk,
|
||||
uint8_t *sk) {
|
||||
size_t i;
|
||||
indcpa_keypair(pk, sk);
|
||||
for (i = 0; i < KYBER_INDCPA_PUBLICKEYBYTES; i++) {
|
||||
@ -49,9 +49,9 @@ int PQCLEAN_KYBER768_AARCH64_crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES]
|
||||
*
|
||||
* Returns 0 (success)
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER768_AARCH64_crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
uint8_t ss[KYBER_SSBYTES],
|
||||
const uint8_t pk[KYBER_PUBLICKEYBYTES]) {
|
||||
int PQCLEAN_KYBER768_AARCH64_crypto_kem_enc(uint8_t *ct,
|
||||
uint8_t *ss,
|
||||
const uint8_t *pk) {
|
||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
||||
/* Will contain key, coins */
|
||||
uint8_t kr[2 * KYBER_SYMBYTES];
|
||||
@ -91,9 +91,9 @@ int PQCLEAN_KYBER768_AARCH64_crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
*
|
||||
* On failure, ss will contain a pseudo-random value.
|
||||
**************************************************/
|
||||
int PQCLEAN_KYBER768_AARCH64_crypto_kem_dec(uint8_t ss[KYBER_SSBYTES],
|
||||
const uint8_t ct[KYBER_CIPHERTEXTBYTES],
|
||||
const uint8_t sk[KYBER_SECRETKEYBYTES]) {
|
||||
int PQCLEAN_KYBER768_AARCH64_crypto_kem_dec(uint8_t *ss,
|
||||
const uint8_t *ct,
|
||||
const uint8_t *sk) {
|
||||
size_t i;
|
||||
int fail;
|
||||
uint8_t buf[2 * KYBER_SYMBYTES];
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* (of length KYBER_POLYCOMPRESSEDBYTES)
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t *a) {
|
||||
void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i, j;
|
||||
int16_t u;
|
||||
uint8_t t[8];
|
||||
@ -46,7 +46,7 @@ void poly_compress(uint8_t r[KYBER_POLYCOMPRESSEDBYTES], const int16_t *a) {
|
||||
* - const uint8_t *a: pointer to input byte array
|
||||
* (of length KYBER_POLYCOMPRESSEDBYTES bytes)
|
||||
**************************************************/
|
||||
void poly_decompress(int16_t *r, const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
void poly_decompress(int16_t r[KYBER_N], const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < KYBER_N / 2; i++) {
|
||||
@ -65,7 +65,7 @@ void poly_decompress(int16_t *r, const uint8_t a[KYBER_POLYCOMPRESSEDBYTES]) {
|
||||
* (needs space for KYBER_POLYBYTES bytes)
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t *a) {
|
||||
void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i;
|
||||
uint16_t t0, t1;
|
||||
|
||||
@ -91,7 +91,7 @@ void poly_tobytes(uint8_t r[KYBER_POLYBYTES], const int16_t *a) {
|
||||
* - const uint8_t *a: pointer to input byte array
|
||||
* (of KYBER_POLYBYTES bytes)
|
||||
**************************************************/
|
||||
void poly_frombytes(int16_t *r, const uint8_t a[KYBER_POLYBYTES]) {
|
||||
void poly_frombytes(int16_t r[KYBER_N], const uint8_t a[KYBER_POLYBYTES]) {
|
||||
uint8x16x3_t neon_buf;
|
||||
uint16x8x4_t tmp;
|
||||
int16x8x4_t value;
|
||||
@ -135,7 +135,7 @@ void poly_frombytes(int16_t *r, const uint8_t a[KYBER_POLYBYTES]) {
|
||||
* Arguments: - poly *r: pointer to output polynomial
|
||||
* - const uint8_t *msg: pointer to input message
|
||||
**************************************************/
|
||||
void poly_frommsg(int16_t *r, const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
void poly_frommsg(int16_t r[KYBER_N], const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
unsigned int i, j;
|
||||
int16_t mask;
|
||||
|
||||
@ -156,7 +156,7 @@ void poly_frommsg(int16_t *r, const uint8_t msg[KYBER_INDCPA_MSGBYTES]) {
|
||||
* Arguments: - uint8_t *msg: pointer to output message
|
||||
* - const poly *a: pointer to input polynomial
|
||||
**************************************************/
|
||||
void poly_tomsg(uint8_t msg[KYBER_INDCPA_MSGBYTES], const int16_t *a) {
|
||||
void poly_tomsg(uint8_t msg[KYBER_INDCPA_MSGBYTES], const int16_t a[KYBER_N]) {
|
||||
unsigned int i, j;
|
||||
uint16_t t;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user