aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_crypto_kdf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_crypto_kdf.c')
-rw-r--r--src/util/test_crypto_kdf.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/util/test_crypto_kdf.c b/src/util/test_crypto_kdf.c
index a5c9bba20..7c33e0ba8 100644
--- a/src/util/test_crypto_kdf.c
+++ b/src/util/test_crypto_kdf.c
@@ -33,39 +33,39 @@
33 33
34 34
35int 35int
36main() 36main ()
37{ 37{
38#define RND_BLK_SIZE 4096 38#define RND_BLK_SIZE 4096
39 unsigned char rnd_blk[RND_BLK_SIZE]; 39 unsigned char rnd_blk[RND_BLK_SIZE];
40 int i; 40 int i;
41 gcry_mpi_t r, n; 41 gcry_mpi_t r, n;
42 42
43 GNUNET_log_setup("test-crypto-kdf", "WARNING", NULL); 43 GNUNET_log_setup ("test-crypto-kdf", "WARNING", NULL);
44 44
45 GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, 45 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
46 rnd_blk, 46 rnd_blk,
47 RND_BLK_SIZE); 47 RND_BLK_SIZE);
48 48
49 /* test full domain hash size */ 49 /* test full domain hash size */
50 for (i = 0; i < 100; i++) 50 for (i = 0; i < 100; i++)
51 { 51 {
52 gcry_mpi_scan(&n, 52 gcry_mpi_scan (&n,
53 GCRYMPI_FMT_USG, 53 GCRYMPI_FMT_USG,
54 rnd_blk, RND_BLK_SIZE, 54 rnd_blk, RND_BLK_SIZE,
55 NULL); 55 NULL);
56 GNUNET_CRYPTO_kdf_mod_mpi(&r, n, 56 GNUNET_CRYPTO_kdf_mod_mpi (&r, n,
57 "", 0, 57 "", 0,
58 "", 0, 58 "", 0,
59 ""); 59 "");
60 GNUNET_assert(0 > gcry_mpi_cmp(r, n)); 60 GNUNET_assert (0 > gcry_mpi_cmp (r, n));
61 61
62 /* Is it worth checking that it's not too small? */ 62 /* Is it worth checking that it's not too small? */
63 /* GNUNET_assert (gcry_mpi_get_nbits(r) > 3*RND_BLK_SIZE/4); */ 63 /* GNUNET_assert (gcry_mpi_get_nbits(r) > 3*RND_BLK_SIZE/4); */
64 /* This test necessarily randomly fails with probability 2^(3 - RND_BLK_SIZE/4) */ 64 /* This test necessarily randomly fails with probability 2^(3 - RND_BLK_SIZE/4) */
65 65
66 gcry_mpi_release(n); 66 gcry_mpi_release (n);
67 gcry_mpi_release(r); 67 gcry_mpi_release (r);
68 } 68 }
69 69
70 return 0; 70 return 0;
71} 71}