summaryrefslogtreecommitdiff
path: root/src/util/crypto_kdf.c
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-11-27 18:01:12 +0000
committerng0 <ng0@n0.is>2019-11-27 18:01:12 +0000
commit3ad52c948d69799351c4a98cd04294d470c49e66 (patch)
tree03c5ece9cbc5cafee21005f9a9a2148fd92943e7 /src/util/crypto_kdf.c
parente5e6aecd0edaf03472833c34fbca057d0aabdfd7 (diff)
parentbb5def7be01569fe49b074e76e40cc5a7467c925 (diff)
Merge branch 'master' of gnunet.org:gnunet
Diffstat (limited to 'src/util/crypto_kdf.c')
-rw-r--r--src/util/crypto_kdf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util/crypto_kdf.c b/src/util/crypto_kdf.c
index 43a9731ff..1b3bd686f 100644
--- a/src/util/crypto_kdf.c
+++ b/src/util/crypto_kdf.c
@@ -132,7 +132,7 @@ GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
gcry_error_t rc;
unsigned int nbits;
size_t rsize;
- unsigned int ctr;
+ uint16_t ctr;
nbits = gcry_mpi_get_nbits (n);
/* GNUNET_assert (nbits > 512); */
@@ -143,12 +143,14 @@ GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
/* Ain't clear if n is always divisible by 8 */
uint8_t buf[ (nbits - 1) / 8 + 1 ];
+ uint16_t ctr_nbo = htons (ctr);
+
rc = GNUNET_CRYPTO_kdf (buf,
sizeof(buf),
xts, xts_len,
skm, skm_len,
ctx, strlen (ctx),
- &ctr, sizeof(ctr),
+ &ctr_nbo, sizeof(ctr_nbo),
NULL, 0);
GNUNET_assert (GNUNET_YES == rc);