diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/crypto_aes.c | 13 | ||||
-rw-r--r-- | src/util/crypto_crc.c | 6 | ||||
-rw-r--r-- | src/util/crypto_hash.c | 51 | ||||
-rw-r--r-- | src/util/crypto_random.c | 26 | ||||
-rw-r--r-- | src/util/crypto_rsa.c | 7 | ||||
-rw-r--r-- | src/util/test_container_bloomfilter.c | 2 | ||||
-rw-r--r-- | src/util/test_crypto_hash.c | 4 | ||||
-rw-r--r-- | src/util/test_crypto_ksk.c | 2 | ||||
-rw-r--r-- | src/util/test_pseudonym.c | 4 |
9 files changed, 59 insertions, 56 deletions
diff --git a/src/util/crypto_aes.c b/src/util/crypto_aes.c index 8fa935d9f..6db932b5b 100644 --- a/src/util/crypto_aes.c +++ b/src/util/crypto_aes.c | |||
@@ -72,9 +72,9 @@ GNUNET_CRYPTO_aes_check_session_key (const struct GNUNET_CRYPTO_AesSessionKey | |||
72 | * @param result the output parameter in which to store the encrypted result | 72 | * @param result the output parameter in which to store the encrypted result |
73 | * @returns the size of the encrypted block, -1 for errors | 73 | * @returns the size of the encrypted block, -1 for errors |
74 | */ | 74 | */ |
75 | int | 75 | ssize_t |
76 | GNUNET_CRYPTO_aes_encrypt (const void *block, | 76 | GNUNET_CRYPTO_aes_encrypt (const void *block, |
77 | uint16_t len, | 77 | size_t len, |
78 | const struct GNUNET_CRYPTO_AesSessionKey | 78 | const struct GNUNET_CRYPTO_AesSessionKey |
79 | *sessionkey, | 79 | *sessionkey, |
80 | const struct GNUNET_CRYPTO_AesInitializationVector | 80 | const struct GNUNET_CRYPTO_AesInitializationVector |
@@ -88,7 +88,7 @@ GNUNET_CRYPTO_aes_encrypt (const void *block, | |||
88 | (sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH))) | 88 | (sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH))) |
89 | { | 89 | { |
90 | GNUNET_break (0); | 90 | GNUNET_break (0); |
91 | return GNUNET_SYSERR; | 91 | return -1; |
92 | } | 92 | } |
93 | GNUNET_assert (0 == gcry_cipher_open (&handle, | 93 | GNUNET_assert (0 == gcry_cipher_open (&handle, |
94 | GCRY_CIPHER_AES256, | 94 | GCRY_CIPHER_AES256, |
@@ -115,8 +115,9 @@ GNUNET_CRYPTO_aes_encrypt (const void *block, | |||
115 | * @param result address to store the result at | 115 | * @param result address to store the result at |
116 | * @return -1 on failure, size of decrypted block on success | 116 | * @return -1 on failure, size of decrypted block on success |
117 | */ | 117 | */ |
118 | int | 118 | ssize_t |
119 | GNUNET_CRYPTO_aes_decrypt (const void *block, uint16_t size, | 119 | GNUNET_CRYPTO_aes_decrypt (const void *block, |
120 | size_t size, | ||
120 | const struct GNUNET_CRYPTO_AesSessionKey | 121 | const struct GNUNET_CRYPTO_AesSessionKey |
121 | *sessionkey, | 122 | *sessionkey, |
122 | const struct GNUNET_CRYPTO_AesInitializationVector | 123 | const struct GNUNET_CRYPTO_AesInitializationVector |
@@ -130,7 +131,7 @@ GNUNET_CRYPTO_aes_decrypt (const void *block, uint16_t size, | |||
130 | (sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH))) | 131 | (sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH))) |
131 | { | 132 | { |
132 | GNUNET_break (0); | 133 | GNUNET_break (0); |
133 | return GNUNET_SYSERR; | 134 | return -1; |
134 | } | 135 | } |
135 | GNUNET_assert (0 == gcry_cipher_open (&handle, | 136 | GNUNET_assert (0 == gcry_cipher_open (&handle, |
136 | GCRY_CIPHER_AES256, | 137 | GCRY_CIPHER_AES256, |
diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c index 35d1e2576..a89b059c5 100644 --- a/src/util/crypto_crc.c +++ b/src/util/crypto_crc.c | |||
@@ -94,8 +94,8 @@ crc32 (uLong crc, const char *buf, size_t len) | |||
94 | * @param len the length of the buffer | 94 | * @param len the length of the buffer |
95 | * @return the resulting CRC32 checksum | 95 | * @return the resulting CRC32 checksum |
96 | */ | 96 | */ |
97 | int | 97 | int32_t |
98 | GNUNET_CRYPTO_crc32_n (const void *buf, unsigned int len) | 98 | GNUNET_CRYPTO_crc32_n (const void *buf, size_t len) |
99 | { | 99 | { |
100 | uLong crc; | 100 | uLong crc; |
101 | crc = crc32 (0L, Z_NULL, 0); | 101 | crc = crc32 (0L, Z_NULL, 0); |
@@ -103,4 +103,4 @@ GNUNET_CRYPTO_crc32_n (const void *buf, unsigned int len) | |||
103 | return crc; | 103 | return crc; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* end of crc32.c */ | 106 | /* end of crypto_crc.c */ |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index fce93ceaf..4f8482c4c 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -359,7 +359,8 @@ sha512_final (struct sha512_ctx *sctx, unsigned char *hash) | |||
359 | * @param ret pointer to where to write the hashcode | 359 | * @param ret pointer to where to write the hashcode |
360 | */ | 360 | */ |
361 | void | 361 | void |
362 | GNUNET_CRYPTO_hash (const void *block, unsigned int size, | 362 | GNUNET_CRYPTO_hash (const void *block, |
363 | size_t size, | ||
363 | GNUNET_HashCode * ret) | 364 | GNUNET_HashCode * ret) |
364 | { | 365 | { |
365 | struct sha512_ctx ctx; | 366 | struct sha512_ctx ctx; |
@@ -660,18 +661,18 @@ GNUNET_CRYPTO_hash_distance_u32 (const GNUNET_HashCode * a, | |||
660 | } | 661 | } |
661 | 662 | ||
662 | void | 663 | void |
663 | GNUNET_CRYPTO_hash_create_random (GNUNET_HashCode * result) | 664 | GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, GNUNET_HashCode * result) |
664 | { | 665 | { |
665 | int i; | 666 | int i; |
666 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; | 667 | for (i = (sizeof (GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0; |
667 | i--) | 668 | i--) |
668 | result->bits[i] = rand (); | 669 | result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, (uint32_t)-1); |
669 | } | 670 | } |
670 | 671 | ||
671 | void | 672 | void |
672 | GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a, | 673 | GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a, |
673 | const GNUNET_HashCode * b, | 674 | const GNUNET_HashCode * b, |
674 | GNUNET_HashCode * result) | 675 | GNUNET_HashCode * result) |
675 | { | 676 | { |
676 | int i; | 677 | int i; |
677 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; | 678 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; |
@@ -681,8 +682,8 @@ GNUNET_CRYPTO_hash_difference (const GNUNET_HashCode * a, | |||
681 | 682 | ||
682 | void | 683 | void |
683 | GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a, | 684 | GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a, |
684 | const GNUNET_HashCode * delta, | 685 | const GNUNET_HashCode * delta, |
685 | GNUNET_HashCode * result) | 686 | GNUNET_HashCode * result) |
686 | { | 687 | { |
687 | int i; | 688 | int i; |
688 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; | 689 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; |
@@ -692,7 +693,7 @@ GNUNET_CRYPTO_hash_sum (const GNUNET_HashCode * a, | |||
692 | 693 | ||
693 | void | 694 | void |
694 | GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, | 695 | GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, |
695 | const GNUNET_HashCode * b, GNUNET_HashCode * result) | 696 | const GNUNET_HashCode * b, GNUNET_HashCode * result) |
696 | { | 697 | { |
697 | int i; | 698 | int i; |
698 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; | 699 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; |
@@ -705,18 +706,18 @@ GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a, | |||
705 | */ | 706 | */ |
706 | void | 707 | void |
707 | GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, | 708 | GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, |
708 | struct GNUNET_CRYPTO_AesSessionKey *skey, | 709 | struct GNUNET_CRYPTO_AesSessionKey *skey, |
709 | struct GNUNET_CRYPTO_AesInitializationVector | 710 | struct GNUNET_CRYPTO_AesInitializationVector |
710 | *iv) | 711 | *iv) |
711 | { | 712 | { |
712 | GNUNET_assert (sizeof (GNUNET_HashCode) >= | 713 | GNUNET_assert (sizeof (GNUNET_HashCode) >= |
713 | GNUNET_CRYPTO_AES_KEY_LENGTH + | 714 | GNUNET_CRYPTO_AES_KEY_LENGTH + |
714 | sizeof (struct GNUNET_CRYPTO_AesInitializationVector)); | 715 | sizeof (struct GNUNET_CRYPTO_AesInitializationVector)); |
715 | memcpy (skey, hc, GNUNET_CRYPTO_AES_KEY_LENGTH); | 716 | memcpy (skey, hc, GNUNET_CRYPTO_AES_KEY_LENGTH); |
716 | skey->crc32 = | 717 | skey->crc32 = |
717 | htonl (GNUNET_CRYPTO_crc32_n (skey, GNUNET_CRYPTO_AES_KEY_LENGTH)); | 718 | htonl (GNUNET_CRYPTO_crc32_n (skey, GNUNET_CRYPTO_AES_KEY_LENGTH)); |
718 | memcpy (iv, &((char *) hc)[GNUNET_CRYPTO_AES_KEY_LENGTH], | 719 | memcpy (iv, &((char *) hc)[GNUNET_CRYPTO_AES_KEY_LENGTH], |
719 | sizeof (struct GNUNET_CRYPTO_AesInitializationVector)); | 720 | sizeof (struct GNUNET_CRYPTO_AesInitializationVector)); |
720 | } | 721 | } |
721 | 722 | ||
722 | /** | 723 | /** |
@@ -739,21 +740,21 @@ GNUNET_CRYPTO_hash_get_bit (const GNUNET_HashCode * code, unsigned int bit) | |||
739 | */ | 740 | */ |
740 | int | 741 | int |
741 | GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, | 742 | GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, |
742 | const GNUNET_HashCode * h2) | 743 | const GNUNET_HashCode * h2) |
743 | { | 744 | { |
744 | unsigned int *i1; | 745 | unsigned int *i1; |
745 | unsigned int *i2; | 746 | unsigned int *i2; |
746 | int i; | 747 | int i; |
747 | 748 | ||
748 | i1 = (unsigned int *) h1; | 749 | i1 = (unsigned int *) h1; |
749 | i2 = (unsigned int *) h2; | 750 | i2 = (unsigned int *) h2; |
750 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; | 751 | for (i = (sizeof (GNUNET_HashCode) / sizeof (unsigned int)) - 1; i >= 0; |
751 | i--) | 752 | i--) |
752 | { | 753 | { |
753 | if (i1[i] > i2[i]) | 754 | if (i1[i] > i2[i]) |
754 | return 1; | 755 | return 1; |
755 | if (i1[i] < i2[i]) | 756 | if (i1[i] < i2[i]) |
756 | return -1; | 757 | return -1; |
757 | } | 758 | } |
758 | return 0; | 759 | return 0; |
759 | } | 760 | } |
@@ -765,23 +766,23 @@ GNUNET_CRYPTO_hash_cmp (const GNUNET_HashCode * h1, | |||
765 | */ | 766 | */ |
766 | int | 767 | int |
767 | GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1, | 768 | GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1, |
768 | const GNUNET_HashCode * h2, | 769 | const GNUNET_HashCode * h2, |
769 | const GNUNET_HashCode * target) | 770 | const GNUNET_HashCode * target) |
770 | { | 771 | { |
771 | int i; | 772 | int i; |
772 | unsigned int d1; | 773 | unsigned int d1; |
773 | unsigned int d2; | 774 | unsigned int d2; |
774 | 775 | ||
775 | for (i = sizeof (GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--) | 776 | for (i = sizeof (GNUNET_HashCode) / sizeof (unsigned int) - 1; i >= 0; i--) |
776 | { | 777 | { |
777 | d1 = ((unsigned int *) h1)[i] ^ ((unsigned int *) target)[i]; | 778 | d1 = ((unsigned int *) h1)[i] ^ ((unsigned int *) target)[i]; |
778 | d2 = ((unsigned int *) h2)[i] ^ ((unsigned int *) target)[i]; | 779 | d2 = ((unsigned int *) h2)[i] ^ ((unsigned int *) target)[i]; |
779 | if (d1 > d2) | 780 | if (d1 > d2) |
780 | return 1; | 781 | return 1; |
781 | else if (d1 < d2) | 782 | else if (d1 < d2) |
782 | return -1; | 783 | return -1; |
783 | } | 784 | } |
784 | return 0; | 785 | return 0; |
785 | } | 786 | } |
786 | 787 | ||
787 | /* end of hashing.c */ | 788 | /* end of crypto_hash.c */ |
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index 3f7ac4dd3..0ad1364cb 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c | |||
@@ -32,13 +32,14 @@ | |||
32 | /** | 32 | /** |
33 | * @return a random value in the interval [0,i[. | 33 | * @return a random value in the interval [0,i[. |
34 | */ | 34 | */ |
35 | unsigned int | 35 | uint32_t |
36 | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, unsigned int i) | 36 | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, |
37 | uint32_t i) | ||
37 | { | 38 | { |
38 | #ifdef gcry_fast_random_poll | 39 | #ifdef gcry_fast_random_poll |
39 | static unsigned int invokeCount; | 40 | static unsigned int invokeCount; |
40 | #endif | 41 | #endif |
41 | unsigned int ret; | 42 | uint32_t ret; |
42 | 43 | ||
43 | GNUNET_assert (i > 0); | 44 | GNUNET_assert (i > 0); |
44 | 45 | ||
@@ -49,11 +50,9 @@ GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, unsigned int i) | |||
49 | if ((invokeCount++ % 256) == 0) | 50 | if ((invokeCount++ % 256) == 0) |
50 | gcry_fast_random_poll (); | 51 | gcry_fast_random_poll (); |
51 | #endif | 52 | #endif |
52 | ret = rand (); /* in case gcry_randomize fails, | ||
53 | we at least get a pseudo- | ||
54 | random number this way */ | ||
55 | gcry_randomize ((unsigned char *) &ret, | 53 | gcry_randomize ((unsigned char *) &ret, |
56 | sizeof (unsigned int), GCRY_STRONG_RANDOM); | 54 | sizeof (uint32_t), |
55 | GCRY_STRONG_RANDOM); | ||
57 | return ret % i; | 56 | return ret % i; |
58 | } | 57 | } |
59 | else | 58 | else |
@@ -80,10 +79,10 @@ GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n) | |||
80 | unsigned int *ret; | 79 | unsigned int *ret; |
81 | unsigned int i; | 80 | unsigned int i; |
82 | unsigned int tmp; | 81 | unsigned int tmp; |
83 | unsigned int x; | 82 | uint32_t x; |
84 | 83 | ||
85 | GNUNET_assert (n > 0); | 84 | GNUNET_assert (n > 0); |
86 | ret = GNUNET_malloc (n * sizeof (int)); | 85 | ret = GNUNET_malloc (n * sizeof (unsigned int)); |
87 | for (i = 0; i < n; i++) | 86 | for (i = 0; i < n; i++) |
88 | ret[i] = i; | 87 | ret[i] = i; |
89 | for (i = 0; i < n; i++) | 88 | for (i = 0; i < n; i++) |
@@ -99,17 +98,18 @@ GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n) | |||
99 | /** | 98 | /** |
100 | * Random on unsigned 64-bit values. | 99 | * Random on unsigned 64-bit values. |
101 | */ | 100 | */ |
102 | unsigned long long | 101 | uint64_t |
103 | GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, | 102 | GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, |
104 | unsigned long long u) | 103 | uint64_t u) |
105 | { | 104 | { |
106 | unsigned long long ret; | 105 | uint64_t ret; |
107 | 106 | ||
108 | GNUNET_assert (u > 0); | 107 | GNUNET_assert (u > 0); |
109 | if (mode == GNUNET_CRYPTO_QUALITY_STRONG) | 108 | if (mode == GNUNET_CRYPTO_QUALITY_STRONG) |
110 | { | 109 | { |
111 | gcry_randomize ((unsigned char *) &ret, | 110 | gcry_randomize ((unsigned char *) &ret, |
112 | sizeof (unsigned long long), GCRY_STRONG_RANDOM); | 111 | sizeof (uint64_t), |
112 | GCRY_STRONG_RANDOM); | ||
113 | return ret % u; | 113 | return ret % u; |
114 | } | 114 | } |
115 | else | 115 | else |
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index edf1b2bdf..bb14f36c9 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -751,7 +751,7 @@ GNUNET_CRYPTO_rsa_key_create_from_file (const char *filename) | |||
751 | */ | 751 | */ |
752 | int | 752 | int |
753 | GNUNET_CRYPTO_rsa_encrypt (const void *block, | 753 | GNUNET_CRYPTO_rsa_encrypt (const void *block, |
754 | uint16_t size, | 754 | size_t size, |
755 | const struct | 755 | const struct |
756 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey, | 756 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey, |
757 | struct GNUNET_CRYPTO_RsaEncryptedData *target) | 757 | struct GNUNET_CRYPTO_RsaEncryptedData *target) |
@@ -799,10 +799,11 @@ GNUNET_CRYPTO_rsa_encrypt (const void *block, | |||
799 | * the decrypted block is bigger, an error is returned | 799 | * the decrypted block is bigger, an error is returned |
800 | * @returns the size of the decrypted block, -1 on error | 800 | * @returns the size of the decrypted block, -1 on error |
801 | */ | 801 | */ |
802 | int | 802 | ssize_t |
803 | GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey, | 803 | GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey, |
804 | const struct GNUNET_CRYPTO_RsaEncryptedData *block, | 804 | const struct GNUNET_CRYPTO_RsaEncryptedData *block, |
805 | void *result, uint16_t max) | 805 | void *result, |
806 | size_t max) | ||
806 | { | 807 | { |
807 | gcry_sexp_t resultsexp; | 808 | gcry_sexp_t resultsexp; |
808 | gcry_sexp_t data; | 809 | gcry_sexp_t data; |
diff --git a/src/util/test_container_bloomfilter.c b/src/util/test_container_bloomfilter.c index ccaea45ae..012d3f954 100644 --- a/src/util/test_container_bloomfilter.c +++ b/src/util/test_container_bloomfilter.c | |||
@@ -38,7 +38,7 @@ | |||
38 | static void | 38 | static void |
39 | nextHC (GNUNET_HashCode * hc) | 39 | nextHC (GNUNET_HashCode * hc) |
40 | { | 40 | { |
41 | GNUNET_CRYPTO_hash_create_random (hc); | 41 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, hc); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int | 44 | static int |
diff --git a/src/util/test_crypto_hash.c b/src/util/test_crypto_hash.c index e10aee9b1..97ef4ec88 100644 --- a/src/util/test_crypto_hash.c +++ b/src/util/test_crypto_hash.c | |||
@@ -73,8 +73,8 @@ testArithmetic () | |||
73 | struct GNUNET_CRYPTO_AesSessionKey skey; | 73 | struct GNUNET_CRYPTO_AesSessionKey skey; |
74 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 74 | struct GNUNET_CRYPTO_AesInitializationVector iv; |
75 | 75 | ||
76 | GNUNET_CRYPTO_hash_create_random (&h1); | 76 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h1); |
77 | GNUNET_CRYPTO_hash_create_random (&h2); | 77 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &h2); |
78 | if (GNUNET_CRYPTO_hash_distance_u32 (&h1, &h2) != | 78 | if (GNUNET_CRYPTO_hash_distance_u32 (&h1, &h2) != |
79 | GNUNET_CRYPTO_hash_distance_u32 (&h2, &h1)) | 79 | GNUNET_CRYPTO_hash_distance_u32 (&h2, &h1)) |
80 | return 1; | 80 | return 1; |
diff --git a/src/util/test_crypto_ksk.c b/src/util/test_crypto_ksk.c index 8bcb105ea..943e9792b 100644 --- a/src/util/test_crypto_ksk.c +++ b/src/util/test_crypto_ksk.c | |||
@@ -193,7 +193,7 @@ main (int argc, char *argv[]) | |||
193 | struct GNUNET_CRYPTO_RsaPrivateKey *hostkey; | 193 | struct GNUNET_CRYPTO_RsaPrivateKey *hostkey; |
194 | 194 | ||
195 | GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL); | 195 | GNUNET_log_setup ("test-crypto-ksk", "WARNING", NULL); |
196 | GNUNET_CRYPTO_hash_create_random (&in); | 196 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &in); |
197 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); | 197 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); |
198 | if (hostkey == NULL) | 198 | if (hostkey == NULL) |
199 | { | 199 | { |
diff --git a/src/util/test_pseudonym.c b/src/util/test_pseudonym.c index d358c8210..daa4c3168 100644 --- a/src/util/test_pseudonym.c +++ b/src/util/test_pseudonym.c | |||
@@ -99,7 +99,7 @@ main (int argc, char *argv[]) | |||
99 | old = GNUNET_PSEUDONYM_list_all (cfg, NULL, NULL); | 99 | old = GNUNET_PSEUDONYM_list_all (cfg, NULL, NULL); |
100 | meta = GNUNET_CONTAINER_meta_data_create (); | 100 | meta = GNUNET_CONTAINER_meta_data_create (); |
101 | GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "test"); | 101 | GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "test"); |
102 | GNUNET_CRYPTO_hash_create_random (&id1); | 102 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &id1); |
103 | GNUNET_PSEUDONYM_add (cfg, &id1, meta); | 103 | GNUNET_PSEUDONYM_add (cfg, &id1, meta); |
104 | CHECK (notiCount == 1); | 104 | CHECK (notiCount == 1); |
105 | GNUNET_PSEUDONYM_add (cfg, &id1, meta); | 105 | GNUNET_PSEUDONYM_add (cfg, &id1, meta); |
@@ -107,7 +107,7 @@ main (int argc, char *argv[]) | |||
107 | newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok); | 107 | newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok); |
108 | CHECK (old < newVal); | 108 | CHECK (old < newVal); |
109 | old = newVal; | 109 | old = newVal; |
110 | GNUNET_CRYPTO_hash_create_random (&id2); | 110 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &id2); |
111 | GNUNET_PSEUDONYM_add (cfg, &id2, meta); | 111 | GNUNET_PSEUDONYM_add (cfg, &id2, meta); |
112 | CHECK (notiCount == 3); | 112 | CHECK (notiCount == 3); |
113 | newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok); | 113 | newVal = GNUNET_PSEUDONYM_list_all (cfg, &iter, &ok); |