aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-11-27 12:47:44 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-11-27 12:47:44 +0100
commitbb5def7be01569fe49b074e76e40cc5a7467c925 (patch)
treee1982498ad82c1ab960058e8ec186bce21b1b10c /src/util
parent04db860fbd8bbbfbcbb9043e673a2541f1734886 (diff)
downloadgnunet-bb5def7be01569fe49b074e76e40cc5a7467c925.tar.gz
gnunet-bb5def7be01569fe49b074e76e40cc5a7467c925.zip
kdf_mod_mpi: fix size and use nbo
Diffstat (limited to 'src/util')
-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 92b2cf5c2..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,
132 gcry_error_t rc; 132 gcry_error_t rc;
133 unsigned int nbits; 133 unsigned int nbits;
134 size_t rsize; 134 size_t rsize;
135 uint32_t ctr; 135 uint16_t ctr;
136 136
137 nbits = gcry_mpi_get_nbits (n); 137 nbits = gcry_mpi_get_nbits (n);
138 /* GNUNET_assert (nbits > 512); */ 138 /* GNUNET_assert (nbits > 512); */
@@ -143,12 +143,14 @@ GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r,
143 /* Ain't clear if n is always divisible by 8 */ 143 /* Ain't clear if n is always divisible by 8 */
144 uint8_t buf[ (nbits - 1) / 8 + 1 ]; 144 uint8_t buf[ (nbits - 1) / 8 + 1 ];
145 145
146 uint16_t ctr_nbo = htons (ctr);
147
146 rc = GNUNET_CRYPTO_kdf (buf, 148 rc = GNUNET_CRYPTO_kdf (buf,
147 sizeof(buf), 149 sizeof(buf),
148 xts, xts_len, 150 xts, xts_len,
149 skm, skm_len, 151 skm, skm_len,
150 ctx, strlen (ctx), 152 ctx, strlen (ctx),
151 &ctr, sizeof(ctr), 153 &ctr_nbo, sizeof(ctr_nbo),
152 NULL, 0); 154 NULL, 0);
153 GNUNET_assert (GNUNET_YES == rc); 155 GNUNET_assert (GNUNET_YES == rc);
154 156