From 306140ebb577180e7bc704714e82949f7b9d33cf Mon Sep 17 00:00:00 2001 From: Pravek Sharma Date: Fri, 13 Sep 2024 12:10:17 -0400 Subject: [PATCH] Patch Kyber to fix ASAN error on ARM64 (#1922) * Update oldpqclean kyber patches. Signed-off-by: Pravek Sharma * Run copy_from_upstream.py Signed-off-by: Pravek Sharma * Add co-authors. [skip ci] Co-Authored-By: Kyle Nekritz Co-Authored-By: Mingtao Yang Signed-off-by: Pravek Sharma --------- Signed-off-by: Pravek Sharma Co-authored-by: Kyle Nekritz Co-authored-by: Mingtao Yang --- .../copy_from_upstream/copy_from_upstream.yml | 3 +- .../patches/pqclean-kyber-armneon-asan.patch | 72 +++++++++++++++++++ .../neon_symmetric-shake.c | 6 +- .../neon_symmetric-shake.c | 6 +- .../neon_symmetric-shake.c | 6 +- 5 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 scripts/copy_from_upstream/patches/pqclean-kyber-armneon-asan.patch diff --git a/scripts/copy_from_upstream/copy_from_upstream.yml b/scripts/copy_from_upstream/copy_from_upstream.yml index a8d70af436..1362a407e3 100644 --- a/scripts/copy_from_upstream/copy_from_upstream.yml +++ b/scripts/copy_from_upstream/copy_from_upstream.yml @@ -8,7 +8,8 @@ upstreams: 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-dilithium-arm-randomized-signing.patch, pqclean-kyber-armneon-shake-fixes.patch, pqclean-kyber-armneon-768-1024-fixes.patch, pqclean-kyber-armneon-variable-timing-fix.patch] + patches: [pqclean-dilithium-arm-randomized-signing.patch, pqclean-kyber-armneon-shake-fixes.patch, pqclean-kyber-armneon-768-1024-fixes.patch, pqclean-kyber-armneon-variable-timing-fix.patch, + pqclean-kyber-armneon-asan.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 - name: pqclean diff --git a/scripts/copy_from_upstream/patches/pqclean-kyber-armneon-asan.patch b/scripts/copy_from_upstream/patches/pqclean-kyber-armneon-asan.patch new file mode 100644 index 0000000000..96f6419129 --- /dev/null +++ b/scripts/copy_from_upstream/patches/pqclean-kyber-armneon-asan.patch @@ -0,0 +1,72 @@ +diff --git a/crypto_kem/kyber1024/aarch64/neon_symmetric-shake.c b/crypto_kem/kyber1024/aarch64/neon_symmetric-shake.c +index 8aced5e4..364d9fdd 100644 +--- a/crypto_kem/kyber1024/aarch64/neon_symmetric-shake.c ++++ b/crypto_kem/kyber1024/aarch64/neon_symmetric-shake.c +@@ -56,8 +56,8 @@ void neon_kyber_shake128_absorb(keccakx2_state *state, + uint8_t y1, uint8_t y2) + { + unsigned int i; +- uint8_t extseed1[KYBER_SYMBYTES+2]; +- uint8_t extseed2[KYBER_SYMBYTES+2]; ++ uint8_t extseed1[KYBER_SYMBYTES+2+6]; ++ uint8_t extseed2[KYBER_SYMBYTES+2+6]; + + for(i=0;i