diff --git a/libcperciva/POSIX/posix-restrict.c b/libcperciva/POSIX/posix-restrict.c index cad3e8f9..f158333e 100644 --- a/libcperciva/POSIX/posix-restrict.c +++ b/libcperciva/POSIX/posix-restrict.c @@ -1,5 +1,5 @@ static int -foo(char * restrict x, char * restrict y) +foo(const char * restrict x, const char * restrict y) { return (x == y); diff --git a/libcperciva/alg/sha256_arm.c b/libcperciva/alg/sha256_arm.c index 84302fe4..e3e5f6b1 100644 --- a/libcperciva/alg/sha256_arm.c +++ b/libcperciva/alg/sha256_arm.c @@ -36,13 +36,13 @@ static const uint32_t Krnd[64] = { /* Round computation. */ #define RND4(S, M, Kp) do { \ - uint32x4_t S0_step; \ - uint32x4_t Wk; \ - S0_step = S[0]; \ - Wk = vaddq_u32(M, vld1q_u32(Kp)); \ - S[0] = vsha256hq_u32(S[0], S[1], Wk); \ - S[1] = vsha256h2q_u32(S[1], S0_step, Wk); \ - } while (0) + uint32x4_t S0_step; \ + uint32x4_t Wk; \ + S0_step = S[0]; \ + Wk = vaddq_u32(M, vld1q_u32(Kp)); \ + S[0] = vsha256hq_u32(S[0], S[1], Wk); \ + S[1] = vsha256h2q_u32(S[1], S0_step, Wk); \ +} while (0) /* Message schedule computation */ #define MSG4(X0, X1, X2, X3) \ diff --git a/libcperciva/crypto/crypto_entropy.c b/libcperciva/crypto/crypto_entropy.c index 44c7117d..c9023c2c 100644 --- a/libcperciva/crypto/crypto_entropy.c +++ b/libcperciva/crypto/crypto_entropy.c @@ -35,7 +35,7 @@ static int instantiated = 0; #define GENERATE_MAXLEN 65536 static int instantiate(void); -static void update(uint8_t *, size_t); +static void update(const uint8_t *, size_t); static int reseed(void); static void generate(uint8_t *, size_t); @@ -93,7 +93,7 @@ instantiate(void) * Update the DRBG state using the provided data. (Section 10.1.2.2) */ static void -update(uint8_t * data, size_t datalen) +update(const uint8_t * data, size_t datalen) { HMAC_SHA256_CTX ctx; uint8_t K[32]; diff --git a/tests/shared_test_functions.sh b/tests/shared_test_functions.sh index ff4fa310..99924060 100644 --- a/tests/shared_test_functions.sh +++ b/tests/shared_test_functions.sh @@ -37,10 +37,12 @@ # and log files. # - s_val_basename: this is the basename for the scenario's # valgrind log files. -# - s_count: this is the count of the scenario's checks (so that -# each check can have distinct files). -# - s_count_str: ${s_count} expressed as a two-digit string. # - s_retval: this is the overall exit code of the scenario. +# - c_count_next: this is the count of the scenario's checks (so that +# each check can have distinct files). +# - c_count_str: the previous value of ${c_count_next}, expressed as a +# two-digit string. In other words, when we're working on the Nth +# check, ${c_count_next} is N, while ${c_count_str} is N-1. # - c_exitfile: this contains the exit code of each check. # - c_valgrind_min: this is the minimum value of USE_VALGRIND # which will enable valgrind checking for this check. @@ -152,7 +154,7 @@ wait_while() { ## setup_check_variables (description, check_prev=1): # Set up the "check" variables ${c_exitfile} and ${c_valgrind_cmd}, the # latter depending on the previously-defined ${c_valgrind_min}. -# Advances the number of checks ${s_count} so that the next call to this +# Advance the number of checks ${c_count_next} so that the next call to this # function will set up new filenames. Write ${description} into a # file. If ${check_prev} is non-zero, check that the previous # ${c_exitfile} exists. @@ -174,18 +176,18 @@ setup_check_variables() { fi # Set up the "exit" file. - s_count_str=$(printf "%02d" "${s_count}") - c_exitfile="${s_basename}-${s_count_str}.exit" + c_count_str=$(printf "%02d" "${c_count_next}") + c_exitfile="${s_basename}-${c_count_str}.exit" # Write the "description" file. printf "%s\n" "${description}" > \ - "${s_basename}-${s_count_str}.desc" + "${s_basename}-${c_count_str}.desc" # Set up the valgrind command (or an empty string). c_valgrind_cmd="$(valgrind_setup_cmd)" # Advances the number of checks. - s_count=$((s_count + 1)) + c_count_next=$((c_count_next + 1)) } ## expected_exitcode (expected, exitcode): @@ -286,7 +288,7 @@ scenario_runner() { # Initialize "scenario" and "check" variables. s_basename=${out}/${basename} s_val_basename=${out_valgrind}/${basename} - s_count=0 + c_count_next=0 c_exitfile="${NO_EXITFILE}" c_valgrind_min=9 c_valgrind_cmd="" diff --git a/tests/shared_valgrind_functions.sh b/tests/shared_valgrind_functions.sh index e4e9033b..0d8e5b99 100644 --- a/tests/shared_valgrind_functions.sh +++ b/tests/shared_valgrind_functions.sh @@ -230,7 +230,7 @@ valgrind_setup_cmd() { return fi - val_logfilename="${s_val_basename}-${s_count_str}-%p.log" + val_logfilename="${s_val_basename}-${c_count_str}-%p.log" c_valgrind_cmd="valgrind \ --log-file=${val_logfilename} \ --track-fds=yes \