jschanck/ntru

`package_pqclean.sh' produces bad output

Closed this issue · 2 comments

This is what it does on Mac to all the sed-edited files (e.g., file api.h):

#ifndef PQCLEAN_NTRU]]]]701_[]]2_API_H
#define PQCLEAN_NTRU]]]]701_[]]2_API_H

#include <stdint.h>

#define PQCLEAN_NTRU]]]]701_[]]2_CRYPTO_SECRETKEYBYTES 1450
#define PQCLEAN_NTRU]]]]701_[]]2_CRYPTO_PUBLICKEYBYTES 1138
#define PQCLEAN_NTRU]]]]701_[]]2_CRYPTO_CIPHERTEXTBYTES 1138
#define PQCLEAN_NTRU]]]]701_[]]2_CRYPTO_BYTES 32

This is what fixes the problem:

diff --git a/package_pqclean.sh b/package_pqclean.sh
index 2967141..c35c4b1 100755
--- a/package_pqclean.sh
+++ b/package_pqclean.sh
@@ -16,7 +16,7 @@ for PARAM in hrss701 hps2048509 hps2048677 hps4096821; do
   mkdir -p ${DIRNAME}/ntru${PARAM}/avx2
   mkdir -p ${DIRNAME}/ntru${PARAM}/clean
 
-  export NTRU_NAMESPACE=$(echo PQCLEAN_NTRU${PARAM}_AVX2_ | tr [:lower:] [:upper:])
+  export NTRU_NAMESPACE=$(echo "PQCLEAN_NTRU${PARAM}_AVX2_" | tr [:lower:] [:upper:])
   ( cd ${WORKDIR}/avx2-${PARAM} && make -B asm )
 
   ( cd ${WORKDIR}/ref-${PARAM}/
@@ -218,5 +218,5 # Manual namespacing
 # Manual namespacing
 for PARAM in hrss701 hps2048509 hps2048677 hps4096821; do
   for IMPL in clean avx2; do
     ( cd ${DIRNAME}/ntru${PARAM}/${IMPL}
-    NTRU_NAMESPACE=$(echo PQCLEAN_NTRU${PARAM}_${IMPL}_ | tr [:lower:] [:upper])
+    NTRU_NAMESPACE=$(echo "PQCLEAN_NTRU${PARAM}_${IMPL}_" | tr [:lower:] [:upper:])
     for X in $(grep CRYPTO_NAMESPACE *.{c,h} | cut -f2 -d' ' | sort -u); do

Could you please apply this fix?

Thanks!