projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-more libexec fixes for OpenSUSE
[oweals/gnunet.git]
/
src
/
util
/
test_crypto_hash.c
diff --git
a/src/util/test_crypto_hash.c
b/src/util/test_crypto_hash.c
index f793e3342319aa7eedc071d2dd9ed01fbe31d174..a8ef39a380f47c4912d7fecbc59e540d23ccf7b3 100644
(file)
--- a/
src/util/test_crypto_hash.c
+++ b/
src/util/test_crypto_hash.c
@@
-4,7
+4,7
@@
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version
2
, or (at your
+ by the Free Software Foundation; either version
3
, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
@@
-35,18
+35,18
@@
static char block[65536];
static int
test (int number)
{
static int
test (int number)
{
- GNUNET_HashCode h1;
- GNUNET_HashCode h2;
+
struct
GNUNET_HashCode h1;
+
struct
GNUNET_HashCode h2;
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
- memset (&h1, number, sizeof (GNUNET_HashCode));
+ memset (&h1, number, sizeof (
struct
GNUNET_HashCode));
GNUNET_CRYPTO_hash_to_enc (&h1, &enc);
if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char *) &enc, &h2))
GNUNET_CRYPTO_hash_to_enc (&h1, &enc);
if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string ((char *) &enc, &h2))
-
{
-
printf ("enc2hash failed!\n");
-
return 1;
-
}
- if (0 != memcmp (&h1, &h2, sizeof (GNUNET_HashCode)))
+ {
+ printf ("enc2hash failed!\n");
+ return 1;
+ }
+ if (0 != memcmp (&h1, &h2, sizeof (
struct
GNUNET_HashCode)))
return 1;
return 0;
}
return 1;
return 0;
}
@@
-55,6
+55,7
@@
static int
testEncoding ()
{
int i;
testEncoding ()
{
int i;
+
for (i = 0; i < 255; i++)
if (0 != test (i))
return 1;
for (i = 0; i < 255; i++)
if (0 != test (i))
return 1;
@@
-66,10
+67,10
@@
testArithmetic ()
{
static struct GNUNET_CRYPTO_AesSessionKey zskey;
static struct GNUNET_CRYPTO_AesInitializationVector ziv;
{
static struct GNUNET_CRYPTO_AesSessionKey zskey;
static struct GNUNET_CRYPTO_AesInitializationVector ziv;
- GNUNET_HashCode h1;
- GNUNET_HashCode h2;
- GNUNET_HashCode d;
- GNUNET_HashCode s;
+
struct
GNUNET_HashCode h1;
+
struct
GNUNET_HashCode h2;
+
struct
GNUNET_HashCode d;
+
struct
GNUNET_HashCode s;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
@@
-106,10
+107,10
@@
testArithmetic ()
}
static void
}
static void
-finished_task (void *cls, const GNUNET_HashCode * res)
+finished_task (void *cls, const
struct
GNUNET_HashCode * res)
{
int *ret = cls;
{
int *ret = cls;
- GNUNET_HashCode want;
+
struct
GNUNET_HashCode want;
GNUNET_CRYPTO_hash (block, sizeof (block), &want);
if (0 != memcmp (res, &want, sizeof (want)))
GNUNET_CRYPTO_hash (block, sizeof (block), &want);
if (0 != memcmp (res, &want, sizeof (want)))
@@
-123,10
+124,8
@@
static void
file_hasher (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_assert (NULL !=
file_hasher (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_assert (NULL !=
- GNUNET_CRYPTO_hash_file (tc->sched,
- GNUNET_SCHEDULER_PRIORITY_DEFAULT,
- FILENAME, 1024,
- &finished_task, cls));
+ GNUNET_CRYPTO_hash_file (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
+ FILENAME, 1024, &finished_task, cls));
}
}
@@
-138,9
+137,9
@@
testFileHash ()
memset (block, 42, sizeof (block) / 2);
memset (&block[sizeof (block) / 2], 43, sizeof (block) / 2);
memset (block, 42, sizeof (block) / 2);
memset (&block[sizeof (block) / 2], 43, sizeof (block) / 2);
- GNUNET_assert (NULL != (f =
fopen
(FILENAME, "w+")));
+ GNUNET_assert (NULL != (f =
FOPEN
(FILENAME, "w+")));
GNUNET_break (sizeof (block) == fwrite (block, 1, sizeof (block), f));
GNUNET_break (sizeof (block) == fwrite (block, 1, sizeof (block), f));
- GNUNET_break (0 ==
fclose
(f));
+ GNUNET_break (0 ==
FCLOSE
(f));
ret = 1;
GNUNET_SCHEDULER_run (&file_hasher, &ret);
GNUNET_break (0 == UNLINK (FILENAME));
ret = 1;
GNUNET_SCHEDULER_run (&file_hasher, &ret);
GNUNET_break (0 == UNLINK (FILENAME));