diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-30 22:42:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-30 22:42:04 +0000 |
commit | 416c2f5a713b93ba689a8cd1e038682a53e6bc17 (patch) | |
tree | 987f51d9edfddc02afe1524df5e1156b920c71d4 /src/util/test_crypto_ksk.c | |
parent | fceec98e767bce7ad2c24dde73cdcf8837e04013 (diff) | |
download | gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.tar.gz gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.zip |
-LRN: use FPRINTF -- #2051
Diffstat (limited to 'src/util/test_crypto_ksk.c')
-rw-r--r-- | src/util/test_crypto_ksk.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/util/test_crypto_ksk.c b/src/util/test_crypto_ksk.c index 2789f5edb..58c459547 100644 --- a/src/util/test_crypto_ksk.c +++ b/src/util/test_crypto_ksk.c | |||
@@ -46,7 +46,7 @@ testCorrectKey () | |||
46 | int i; | 46 | int i; |
47 | char out[3]; | 47 | char out[3]; |
48 | 48 | ||
49 | fprintf (stderr, "Testing KBlock key correctness"); | 49 | FPRINTF (stderr, "%s", "Testing KBlock key correctness"); |
50 | GNUNET_CRYPTO_hash ("X", strlen ("X"), &in); | 50 | GNUNET_CRYPTO_hash ("X", strlen ("X"), &in); |
51 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); | 51 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); |
52 | if (hostkey == NULL) | 52 | if (hostkey == NULL) |
@@ -66,12 +66,12 @@ testCorrectKey () | |||
66 | snprintf (out, sizeof (out), "%02x", ((unsigned char *) &pkey)[i]); | 66 | snprintf (out, sizeof (out), "%02x", ((unsigned char *) &pkey)[i]); |
67 | if (0 != strncmp (out, &want[i * 2], 2)) | 67 | if (0 != strncmp (out, &want[i * 2], 2)) |
68 | { | 68 | { |
69 | fprintf (stderr, " Failed! Wanted %.2s but got %2s at %d\n", &want[i * 2], | 69 | FPRINTF (stderr, " Failed! Wanted %.2s but got %2s at %d\n", &want[i * 2], |
70 | out, i); | 70 | out, i); |
71 | return GNUNET_SYSERR; | 71 | return GNUNET_SYSERR; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | fprintf (stderr, " OK\n"); | 74 | FPRINTF (stderr, "%s", " OK\n"); |
75 | return GNUNET_OK; | 75 | return GNUNET_OK; |
76 | } | 76 | } |
77 | 77 | ||
@@ -85,7 +85,7 @@ testMultiKey (const char *word) | |||
85 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey1; | 85 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey1; |
86 | int i; | 86 | int i; |
87 | 87 | ||
88 | fprintf (stderr, "Testing KBlock key uniqueness (%s) ", word); | 88 | FPRINTF (stderr, "Testing KBlock key uniqueness (%s) ", word); |
89 | GNUNET_CRYPTO_hash (word, strlen (word), &in); | 89 | GNUNET_CRYPTO_hash (word, strlen (word), &in); |
90 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); | 90 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); |
91 | if (hostkey == NULL) | 91 | if (hostkey == NULL) |
@@ -101,12 +101,12 @@ testMultiKey (const char *word) | |||
101 | GNUNET_CRYPTO_rsa_key_free (hostkey); | 101 | GNUNET_CRYPTO_rsa_key_free (hostkey); |
102 | for (i = 0; i < UNIQUE_ITER; i++) | 102 | for (i = 0; i < UNIQUE_ITER; i++) |
103 | { | 103 | { |
104 | fprintf (stderr, "."); | 104 | FPRINTF (stderr, "%s", "."); |
105 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); | 105 | hostkey = GNUNET_CRYPTO_rsa_key_create_from_hash (&in); |
106 | if (hostkey == NULL) | 106 | if (hostkey == NULL) |
107 | { | 107 | { |
108 | GNUNET_break (0); | 108 | GNUNET_break (0); |
109 | fprintf (stderr, " ERROR\n"); | 109 | FPRINTF (stderr, "%s", " ERROR\n"); |
110 | return GNUNET_SYSERR; | 110 | return GNUNET_SYSERR; |
111 | } | 111 | } |
112 | GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey1); | 112 | GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey1); |
@@ -116,11 +116,11 @@ testMultiKey (const char *word) | |||
116 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) | 116 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))) |
117 | { | 117 | { |
118 | GNUNET_break (0); | 118 | GNUNET_break (0); |
119 | fprintf (stderr, " ERROR\n"); | 119 | FPRINTF (stderr, "%s", " ERROR\n"); |
120 | return GNUNET_SYSERR; | 120 | return GNUNET_SYSERR; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | fprintf (stderr, " OK\n"); | 123 | FPRINTF (stderr, "%s", " OK\n"); |
124 | return GNUNET_OK; | 124 | return GNUNET_OK; |
125 | } | 125 | } |
126 | 126 | ||
@@ -135,19 +135,19 @@ testEncryptDecrypt (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey) | |||
135 | struct GNUNET_TIME_Absolute start; | 135 | struct GNUNET_TIME_Absolute start; |
136 | int ok; | 136 | int ok; |
137 | 137 | ||
138 | fprintf (stderr, "W"); | 138 | FPRINTF (stderr, "%s", "W"); |
139 | GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey); | 139 | GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey); |
140 | 140 | ||
141 | ok = 0; | 141 | ok = 0; |
142 | start = GNUNET_TIME_absolute_get (); | 142 | start = GNUNET_TIME_absolute_get (); |
143 | for (i = 0; i < ITER; i++) | 143 | for (i = 0; i < ITER; i++) |
144 | { | 144 | { |
145 | fprintf (stderr, "."); | 145 | FPRINTF (stderr, "%s", "."); |
146 | if (GNUNET_SYSERR == | 146 | if (GNUNET_SYSERR == |
147 | GNUNET_CRYPTO_rsa_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &pkey, | 147 | GNUNET_CRYPTO_rsa_encrypt (TESTSTRING, strlen (TESTSTRING) + 1, &pkey, |
148 | &target)) | 148 | &target)) |
149 | { | 149 | { |
150 | fprintf (stderr, "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n"); | 150 | FPRINTF (stderr, "%s", "GNUNET_CRYPTO_rsa_encrypt returned SYSERR\n"); |
151 | ok++; | 151 | ok++; |
152 | continue; | 152 | continue; |
153 | } | 153 | } |
@@ -155,7 +155,7 @@ testEncryptDecrypt (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey) | |||
155 | GNUNET_CRYPTO_rsa_decrypt (hostkey, &target, result, | 155 | GNUNET_CRYPTO_rsa_decrypt (hostkey, &target, result, |
156 | strlen (TESTSTRING) + 1)) | 156 | strlen (TESTSTRING) + 1)) |
157 | { | 157 | { |
158 | fprintf (stderr, "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n"); | 158 | FPRINTF (stderr, "%s", "GNUNET_CRYPTO_rsa_decrypt returned SYSERR\n"); |
159 | ok++; | 159 | ok++; |
160 | continue; | 160 | continue; |
161 | } | 161 | } |
@@ -186,17 +186,17 @@ testSignVerify (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey) | |||
186 | struct GNUNET_TIME_Absolute start; | 186 | struct GNUNET_TIME_Absolute start; |
187 | int ok = GNUNET_OK; | 187 | int ok = GNUNET_OK; |
188 | 188 | ||
189 | fprintf (stderr, "W"); | 189 | FPRINTF (stderr, "%s", "W"); |
190 | GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey); | 190 | GNUNET_CRYPTO_rsa_key_get_public (hostkey, &pkey); |
191 | start = GNUNET_TIME_absolute_get (); | 191 | start = GNUNET_TIME_absolute_get (); |
192 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose)); | 192 | purp.size = htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose)); |
193 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); | 193 | purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST); |
194 | for (i = 0; i < ITER; i++) | 194 | for (i = 0; i < ITER; i++) |
195 | { | 195 | { |
196 | fprintf (stderr, "."); | 196 | FPRINTF (stderr, "%s", "."); |
197 | if (GNUNET_SYSERR == GNUNET_CRYPTO_rsa_sign (hostkey, &purp, &sig)) | 197 | if (GNUNET_SYSERR == GNUNET_CRYPTO_rsa_sign (hostkey, &purp, &sig)) |
198 | { | 198 | { |
199 | fprintf (stderr, "GNUNET_CRYPTO_rsa_sign returned SYSERR\n"); | 199 | FPRINTF (stderr, "%s", "GNUNET_CRYPTO_rsa_sign returned SYSERR\n"); |
200 | ok = GNUNET_SYSERR; | 200 | ok = GNUNET_SYSERR; |
201 | continue; | 201 | continue; |
202 | } | 202 | } |