aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-26 12:51:41 +0100
committerMattias Andrée <maandree@kth.se>2022-02-26 12:51:41 +0100
commitc67c4967f0938dc6c56bed57c4933d052f6a8c36 (patch)
treeddd5b337da2d90159b25fc06245bd1e97ccfd952
parentRemove useless restrict from internal functions (diff)
downloadlibkeccak-c67c4967f0938dc6c56bed57c4933d052f6a8c36.tar.gz
libkeccak-c67c4967f0938dc6c56bed57c4933d052f6a8c36.tar.bz2
libkeccak-c67c4967f0938dc6c56bed57c4933d052f6a8c36.tar.xz
Fix error in libkeccak_degeneralise_spec: spec->state_size was set to 1 rather than have_state_size
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--libkeccak_degeneralise_spec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libkeccak_degeneralise_spec.c b/libkeccak_degeneralise_spec.c
index d92fa61..7fc51aa 100644
--- a/libkeccak_degeneralise_spec.c
+++ b/libkeccak_degeneralise_spec.c
@@ -27,11 +27,11 @@ int
libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *restrict spec, struct libkeccak_spec *restrict output_spec)
{
long int state_size, word_size, capacity, bitrate, output;
- const int have_state_size = spec->state_size != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
- const int have_word_size = spec->word_size != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
- const int have_capacity = spec->capacity != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
- const int have_bitrate = spec->bitrate != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
- const int have_output = spec->output != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
+ int have_state_size = spec->state_size != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
+ int have_word_size = spec->word_size != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
+ int have_capacity = spec->capacity != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
+ int have_bitrate = spec->bitrate != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
+ int have_output = spec->output != LIBKECCAK_GENERALISED_SPEC_AUTOMATIC;
if (have_state_size) {
@@ -53,7 +53,7 @@ libkeccak_degeneralise_spec(struct libkeccak_generalised_spec *restrict spec, st
if (have_state_size && state_size != word_size * 25)
return LIBKECCAK_GENERALISED_SPEC_ERROR_STATE_WORD_INCOHERENCY;
else if (!have_state_size) {
- spec->state_size = 1;
+ have_state_size = 1;
state_size = word_size * 25;
}
}