diff options
author | ng0 <ng0@n0.is> | 2017-11-28 19:59:46 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2017-11-28 19:59:46 +0000 |
commit | 862e488e08ca71db56dedd59059c5bb1a8c130a5 (patch) | |
tree | a7fb48afb7115113cc0572bf432ef3247b237398 /src | |
parent | d387ba039e99d07a50b3d7ffffc7e8a2e1abd938 (diff) | |
parent | a2ce0b6a76788e5a5fe32086c6619ffc143e09eb (diff) | |
download | gnunet-862e488e08ca71db56dedd59059c5bb1a8c130a5.tar.gz gnunet-862e488e08ca71db56dedd59059c5bb1a8c130a5.zip |
Merge branch 'master' of gnunet.org:gnunet into doc/documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/gnunet-service-cadet_paths.c | 4 | ||||
-rw-r--r-- | src/datastore/datastore_api.c | 115 | ||||
-rw-r--r-- | src/fs/fs_misc.c | 8 | ||||
-rw-r--r-- | src/fs/fs_publish_ublock.c | 1 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 20 | ||||
-rw-r--r-- | src/include/gnunet_getopt_lib.h | 54 | ||||
-rw-r--r-- | src/include/gnunet_json_lib.h | 10 | ||||
-rw-r--r-- | src/json/json_generator.c | 13 | ||||
-rw-r--r-- | src/revocation/gnunet-service-revocation.c | 2 | ||||
-rw-r--r-- | src/social/social_api.c | 2 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.c | 10 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_ats.c | 3 | ||||
-rw-r--r-- | src/util/crypto_ecc.c | 45 | ||||
-rw-r--r-- | src/util/crypto_rsa.c | 2 | ||||
-rw-r--r-- | src/util/gnunet-ecc.c | 22 | ||||
-rw-r--r-- | src/util/resolver_api.c | 1 |
16 files changed, 196 insertions, 116 deletions
diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c index e75fd393c..79eed0dcc 100644 --- a/src/cadet/gnunet-service-cadet_paths.c +++ b/src/cadet/gnunet-service-cadet_paths.c | |||
@@ -498,8 +498,8 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path, | |||
498 | const struct GNUNET_PeerIdentity *pid; | 498 | const struct GNUNET_PeerIdentity *pid; |
499 | 499 | ||
500 | pid = (off < get_path_length) | 500 | pid = (off < get_path_length) |
501 | ? &get_path[get_path_length - off] | 501 | ? &get_path[get_path_length - off - 1] |
502 | : &put_path[get_path_length + put_path_length - off]; | 502 | : &put_path[get_path_length + put_path_length - off - 1]; |
503 | cpath[off - skip] = GCP_get (pid, | 503 | cpath[off - skip] = GCP_get (pid, |
504 | GNUNET_YES); | 504 | GNUNET_YES); |
505 | /* Check that no peer is twice on the path */ | 505 | /* Check that no peer is twice on the path */ |
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 31f7a997f..2ad864987 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -651,6 +651,46 @@ process_queue (struct GNUNET_DATASTORE_Handle *h) | |||
651 | } | 651 | } |
652 | 652 | ||
653 | 653 | ||
654 | /** | ||
655 | * Get the entry at the head of the message queue. | ||
656 | * | ||
657 | * @param h handle to the datastore | ||
658 | * @param response_type the expected response type | ||
659 | * @return the queue entry | ||
660 | */ | ||
661 | static struct GNUNET_DATASTORE_QueueEntry * | ||
662 | get_queue_head (struct GNUNET_DATASTORE_Handle *h, | ||
663 | uint16_t response_type) | ||
664 | { | ||
665 | struct GNUNET_DATASTORE_QueueEntry *qe; | ||
666 | |||
667 | if (h->skip_next_messages > 0) | ||
668 | { | ||
669 | h->skip_next_messages--; | ||
670 | process_queue (h); | ||
671 | return NULL; | ||
672 | } | ||
673 | qe = h->queue_head; | ||
674 | if (NULL == qe) | ||
675 | { | ||
676 | GNUNET_break (0); | ||
677 | do_disconnect (h); | ||
678 | return NULL; | ||
679 | } | ||
680 | if (NULL != qe->env) | ||
681 | { | ||
682 | GNUNET_break (0); | ||
683 | do_disconnect (h); | ||
684 | return NULL; | ||
685 | } | ||
686 | if (response_type != qe->response_type) | ||
687 | { | ||
688 | GNUNET_break (0); | ||
689 | do_disconnect (h); | ||
690 | return NULL; | ||
691 | } | ||
692 | return qe; | ||
693 | } | ||
654 | 694 | ||
655 | 695 | ||
656 | /** | 696 | /** |
@@ -702,30 +742,10 @@ handle_status (void *cls, | |||
702 | const char *emsg; | 742 | const char *emsg; |
703 | int32_t status = ntohl (sm->status); | 743 | int32_t status = ntohl (sm->status); |
704 | 744 | ||
705 | if (h->skip_next_messages > 0) | 745 | qe = get_queue_head (h, |
706 | { | 746 | GNUNET_MESSAGE_TYPE_DATASTORE_STATUS); |
707 | h->skip_next_messages--; | 747 | if (NULL == qe) |
708 | process_queue (h); | ||
709 | return; | ||
710 | } | ||
711 | if (NULL == (qe = h->queue_head)) | ||
712 | { | ||
713 | GNUNET_break (0); | ||
714 | do_disconnect (h); | ||
715 | return; | ||
716 | } | ||
717 | if (NULL != qe->env) | ||
718 | { | ||
719 | GNUNET_break (0); | ||
720 | do_disconnect (h); | ||
721 | return; | ||
722 | } | ||
723 | if (GNUNET_MESSAGE_TYPE_DATASTORE_STATUS != qe->response_type) | ||
724 | { | ||
725 | GNUNET_break (0); | ||
726 | do_disconnect (h); | ||
727 | return; | 748 | return; |
728 | } | ||
729 | rc = qe->qc.sc; | 749 | rc = qe->qc.sc; |
730 | free_queue_entry (qe); | 750 | free_queue_entry (qe); |
731 | if (ntohs (sm->header.size) > sizeof (struct StatusMessage)) | 751 | if (ntohs (sm->header.size) > sizeof (struct StatusMessage)) |
@@ -785,30 +805,10 @@ handle_data (void *cls, | |||
785 | struct GNUNET_DATASTORE_QueueEntry *qe; | 805 | struct GNUNET_DATASTORE_QueueEntry *qe; |
786 | struct ResultContext rc; | 806 | struct ResultContext rc; |
787 | 807 | ||
788 | if (h->skip_next_messages > 0) | 808 | qe = get_queue_head (h, |
789 | { | 809 | GNUNET_MESSAGE_TYPE_DATASTORE_DATA); |
790 | process_queue (h); | ||
791 | return; | ||
792 | } | ||
793 | qe = h->queue_head; | ||
794 | if (NULL == qe) | 810 | if (NULL == qe) |
795 | { | ||
796 | GNUNET_break (0); | ||
797 | do_disconnect (h); | ||
798 | return; | ||
799 | } | ||
800 | if (NULL != qe->env) | ||
801 | { | ||
802 | GNUNET_break (0); | ||
803 | do_disconnect (h); | ||
804 | return; | ||
805 | } | ||
806 | if (GNUNET_MESSAGE_TYPE_DATASTORE_DATA != qe->response_type) | ||
807 | { | ||
808 | GNUNET_break (0); | ||
809 | do_disconnect (h); | ||
810 | return; | 811 | return; |
811 | } | ||
812 | #if INSANE_STATISTICS | 812 | #if INSANE_STATISTICS |
813 | GNUNET_STATISTICS_update (h->stats, | 813 | GNUNET_STATISTICS_update (h->stats, |
814 | gettext_noop ("# Results received"), | 814 | gettext_noop ("# Results received"), |
@@ -854,31 +854,10 @@ handle_data_end (void *cls, | |||
854 | struct GNUNET_DATASTORE_QueueEntry *qe; | 854 | struct GNUNET_DATASTORE_QueueEntry *qe; |
855 | struct ResultContext rc; | 855 | struct ResultContext rc; |
856 | 856 | ||
857 | if (h->skip_next_messages > 0) | 857 | qe = get_queue_head (h, |
858 | { | 858 | GNUNET_MESSAGE_TYPE_DATASTORE_DATA); |
859 | h->skip_next_messages--; | ||
860 | process_queue (h); | ||
861 | return; | ||
862 | } | ||
863 | qe = h->queue_head; | ||
864 | if (NULL == qe) | 859 | if (NULL == qe) |
865 | { | ||
866 | GNUNET_break (0); | ||
867 | do_disconnect (h); | ||
868 | return; | 860 | return; |
869 | } | ||
870 | if (NULL != qe->env) | ||
871 | { | ||
872 | GNUNET_break (0); | ||
873 | do_disconnect (h); | ||
874 | return; | ||
875 | } | ||
876 | if (GNUNET_MESSAGE_TYPE_DATASTORE_DATA != qe->response_type) | ||
877 | { | ||
878 | GNUNET_break (0); | ||
879 | do_disconnect (h); | ||
880 | return; | ||
881 | } | ||
882 | rc = qe->qc.rc; | 861 | rc = qe->qc.rc; |
883 | free_queue_entry (qe); | 862 | free_queue_entry (qe); |
884 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 863 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/fs/fs_misc.c b/src/fs/fs_misc.c index bcb8620cf..b26de431c 100644 --- a/src/fs/fs_misc.c +++ b/src/fs/fs_misc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010, 2011 GNUnet e.V. | 3 | Copyright (C) 2010, 2011, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -43,6 +43,8 @@ GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData | |||
43 | {"application/gnunet-directory", ".gnd"}, | 43 | {"application/gnunet-directory", ".gnd"}, |
44 | {"application/java", ".class"}, | 44 | {"application/java", ".class"}, |
45 | {"application/msword", ".doc"}, | 45 | {"application/msword", ".doc"}, |
46 | {"application/nar", ".nar"}, | ||
47 | {"application/narinfo", ".narinfo"}, | ||
46 | {"application/ogg", ".ogg"}, | 48 | {"application/ogg", ".ogg"}, |
47 | {"application/pdf", ".pdf"}, | 49 | {"application/pdf", ".pdf"}, |
48 | {"application/pgp-keys", ".key"}, | 50 | {"application/pgp-keys", ".key"}, |
@@ -53,8 +55,8 @@ GNUNET_FS_meta_data_suggest_filename (const struct GNUNET_CONTAINER_MetaData | |||
53 | {"application/xml", ".xml"}, | 55 | {"application/xml", ".xml"}, |
54 | {"application/x-debian-package", ".deb"}, | 56 | {"application/x-debian-package", ".deb"}, |
55 | {"application/x-dvi", ".dvi"}, | 57 | {"application/x-dvi", ".dvi"}, |
56 | {"applixation/x-flac", ".flac"}, | 58 | {"application/x-flac", ".flac"}, |
57 | {"applixation/x-gzip", ".gz"}, | 59 | {"application/x-gzip", ".gz"}, |
58 | {"application/x-java-archive", ".jar"}, | 60 | {"application/x-java-archive", ".jar"}, |
59 | {"application/x-java-vm", ".class"}, | 61 | {"application/x-java-vm", ".class"}, |
60 | {"application/x-python-code", ".pyc"}, | 62 | {"application/x-python-code", ".pyc"}, |
diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c index e21443ccb..189a6909a 100644 --- a/src/fs/fs_publish_ublock.c +++ b/src/fs/fs_publish_ublock.c | |||
@@ -301,6 +301,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, | |||
301 | uc->task = GNUNET_SCHEDULER_add_now (&run_cont, | 301 | uc->task = GNUNET_SCHEDULER_add_now (&run_cont, |
302 | uc); | 302 | uc); |
303 | } | 303 | } |
304 | GNUNET_free (ub_enc); | ||
304 | return uc; | 305 | return uc; |
305 | } | 306 | } |
306 | 307 | ||
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 07cade0e3..e886a561c 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -1110,6 +1110,16 @@ GNUNET_CRYPTO_ecdsa_public_key_to_string (const struct GNUNET_CRYPTO_EcdsaPublic | |||
1110 | 1110 | ||
1111 | 1111 | ||
1112 | /** | 1112 | /** |
1113 | * Convert a private key to a string. | ||
1114 | * | ||
1115 | * @param priv key to convert | ||
1116 | * @return string representing @a pub | ||
1117 | */ | ||
1118 | char * | ||
1119 | GNUNET_CRYPTO_eddsa_private_key_to_string (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); | ||
1120 | |||
1121 | |||
1122 | /** | ||
1113 | * Convert a public key to a string. | 1123 | * Convert a public key to a string. |
1114 | * | 1124 | * |
1115 | * @param pub key to convert | 1125 | * @param pub key to convert |
@@ -2016,13 +2026,14 @@ GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, | |||
2016 | * @param pkey the public key of the signer | 2026 | * @param pkey the public key of the signer |
2017 | * @param[out] buf set to a buffer with the blinded message to be signed | 2027 | * @param[out] buf set to a buffer with the blinded message to be signed |
2018 | * @param[out] buf_size number of bytes stored in @a buf | 2028 | * @param[out] buf_size number of bytes stored in @a buf |
2019 | * @return GNUNET_YES if successful, GNUNET_NO if RSA key is malicious | 2029 | * @return #GNUNET_YES if successful, #GNUNET_NO if RSA key is malicious |
2020 | */ | 2030 | */ |
2021 | int | 2031 | int |
2022 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | 2032 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, |
2023 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, | 2033 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, |
2024 | struct GNUNET_CRYPTO_RsaPublicKey *pkey, | 2034 | struct GNUNET_CRYPTO_RsaPublicKey *pkey, |
2025 | char **buf, size_t *buf_size); | 2035 | char **buf, |
2036 | size_t *buf_size); | ||
2026 | 2037 | ||
2027 | 2038 | ||
2028 | /** | 2039 | /** |
@@ -2035,7 +2046,8 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | |||
2035 | */ | 2046 | */ |
2036 | struct GNUNET_CRYPTO_RsaSignature * | 2047 | struct GNUNET_CRYPTO_RsaSignature * |
2037 | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, | 2048 | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
2038 | const void *msg, size_t msg_len); | 2049 | const void *msg, |
2050 | size_t msg_len); | ||
2039 | 2051 | ||
2040 | 2052 | ||
2041 | /** | 2053 | /** |
@@ -2105,7 +2117,7 @@ GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig); | |||
2105 | * @return unblinded signature on success, NULL if RSA key is bad or malicious. | 2117 | * @return unblinded signature on success, NULL if RSA key is bad or malicious. |
2106 | */ | 2118 | */ |
2107 | struct GNUNET_CRYPTO_RsaSignature * | 2119 | struct GNUNET_CRYPTO_RsaSignature * |
2108 | GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, | 2120 | GNUNET_CRYPTO_rsa_unblind (const struct GNUNET_CRYPTO_RsaSignature *sig, |
2109 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, | 2121 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, |
2110 | struct GNUNET_CRYPTO_RsaPublicKey *pkey); | 2122 | struct GNUNET_CRYPTO_RsaPublicKey *pkey); |
2111 | 2123 | ||
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h index f707bb091..e38925f14 100644 --- a/src/include/gnunet_getopt_lib.h +++ b/src/include/gnunet_getopt_lib.h | |||
@@ -230,11 +230,11 @@ GNUNET_GETOPT_option_filename (char shortName, | |||
230 | */ | 230 | */ |
231 | struct GNUNET_GETOPT_CommandLineOption | 231 | struct GNUNET_GETOPT_CommandLineOption |
232 | GNUNET_GETOPT_option_base32_fixed_size (char shortName, | 232 | GNUNET_GETOPT_option_base32_fixed_size (char shortName, |
233 | const char *name, | 233 | const char *name, |
234 | const char *argumentHelp, | 234 | const char *argumentHelp, |
235 | const char *description, | 235 | const char *description, |
236 | void *val, | 236 | void *val, |
237 | size_t val_size); | 237 | size_t val_size); |
238 | 238 | ||
239 | 239 | ||
240 | /** | 240 | /** |
@@ -264,9 +264,9 @@ GNUNET_GETOPT_option_base32_fixed_size (char shortName, | |||
264 | */ | 264 | */ |
265 | struct GNUNET_GETOPT_CommandLineOption | 265 | struct GNUNET_GETOPT_CommandLineOption |
266 | GNUNET_GETOPT_option_flag (char shortName, | 266 | GNUNET_GETOPT_option_flag (char shortName, |
267 | const char *name, | 267 | const char *name, |
268 | const char *description, | 268 | const char *description, |
269 | int *val); | 269 | int *val); |
270 | 270 | ||
271 | 271 | ||
272 | /** | 272 | /** |
@@ -280,10 +280,10 @@ GNUNET_GETOPT_option_flag (char shortName, | |||
280 | */ | 280 | */ |
281 | struct GNUNET_GETOPT_CommandLineOption | 281 | struct GNUNET_GETOPT_CommandLineOption |
282 | GNUNET_GETOPT_option_uint (char shortName, | 282 | GNUNET_GETOPT_option_uint (char shortName, |
283 | const char *name, | 283 | const char *name, |
284 | const char *argumentHelp, | 284 | const char *argumentHelp, |
285 | const char *description, | 285 | const char *description, |
286 | unsigned int *val); | 286 | unsigned int *val); |
287 | 287 | ||
288 | 288 | ||
289 | /** | 289 | /** |
@@ -297,10 +297,10 @@ GNUNET_GETOPT_option_uint (char shortName, | |||
297 | */ | 297 | */ |
298 | struct GNUNET_GETOPT_CommandLineOption | 298 | struct GNUNET_GETOPT_CommandLineOption |
299 | GNUNET_GETOPT_option_ulong (char shortName, | 299 | GNUNET_GETOPT_option_ulong (char shortName, |
300 | const char *name, | 300 | const char *name, |
301 | const char *argumentHelp, | 301 | const char *argumentHelp, |
302 | const char *description, | 302 | const char *description, |
303 | unsigned long long *val); | 303 | unsigned long long *val); |
304 | 304 | ||
305 | 305 | ||
306 | /** | 306 | /** |
@@ -315,10 +315,10 @@ GNUNET_GETOPT_option_ulong (char shortName, | |||
315 | */ | 315 | */ |
316 | struct GNUNET_GETOPT_CommandLineOption | 316 | struct GNUNET_GETOPT_CommandLineOption |
317 | GNUNET_GETOPT_option_relative_time (char shortName, | 317 | GNUNET_GETOPT_option_relative_time (char shortName, |
318 | const char *name, | 318 | const char *name, |
319 | const char *argumentHelp, | 319 | const char *argumentHelp, |
320 | const char *description, | 320 | const char *description, |
321 | struct GNUNET_TIME_Relative *val); | 321 | struct GNUNET_TIME_Relative *val); |
322 | 322 | ||
323 | 323 | ||
324 | /** | 324 | /** |
@@ -333,10 +333,10 @@ GNUNET_GETOPT_option_relative_time (char shortName, | |||
333 | */ | 333 | */ |
334 | struct GNUNET_GETOPT_CommandLineOption | 334 | struct GNUNET_GETOPT_CommandLineOption |
335 | GNUNET_GETOPT_option_absolute_time (char shortName, | 335 | GNUNET_GETOPT_option_absolute_time (char shortName, |
336 | const char *name, | 336 | const char *name, |
337 | const char *argumentHelp, | 337 | const char *argumentHelp, |
338 | const char *description, | 338 | const char *description, |
339 | struct GNUNET_TIME_Absolute *val); | 339 | struct GNUNET_TIME_Absolute *val); |
340 | 340 | ||
341 | 341 | ||
342 | /** | 342 | /** |
@@ -350,9 +350,9 @@ GNUNET_GETOPT_option_absolute_time (char shortName, | |||
350 | */ | 350 | */ |
351 | struct GNUNET_GETOPT_CommandLineOption | 351 | struct GNUNET_GETOPT_CommandLineOption |
352 | GNUNET_GETOPT_option_increment_uint (char shortName, | 352 | GNUNET_GETOPT_option_increment_uint (char shortName, |
353 | const char *name, | 353 | const char *name, |
354 | const char *description, | 354 | const char *description, |
355 | unsigned int *val); | 355 | unsigned int *val); |
356 | 356 | ||
357 | 357 | ||
358 | /** | 358 | /** |
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h index f2682bea7..c12badcd9 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h | |||
@@ -343,6 +343,16 @@ GNUNET_JSON_from_time_abs (struct GNUNET_TIME_Absolute stamp); | |||
343 | 343 | ||
344 | 344 | ||
345 | /** | 345 | /** |
346 | * Convert absolute timestamp to a json string. | ||
347 | * | ||
348 | * @param stamp the time stamp | ||
349 | * @return a json string with the timestamp in @a stamp | ||
350 | */ | ||
351 | json_t * | ||
352 | GNUNET_JSON_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO stamp); | ||
353 | |||
354 | |||
355 | /** | ||
346 | * Convert relative timestamp to a json string. | 356 | * Convert relative timestamp to a json string. |
347 | * | 357 | * |
348 | * @param stamp the time stamp | 358 | * @param stamp the time stamp |
diff --git a/src/json/json_generator.c b/src/json/json_generator.c index e660e10c5..98f7163bc 100644 --- a/src/json/json_generator.c +++ b/src/json/json_generator.c | |||
@@ -73,6 +73,19 @@ GNUNET_JSON_from_time_abs (struct GNUNET_TIME_Absolute stamp) | |||
73 | 73 | ||
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Convert absolute timestamp to a json string. | ||
77 | * | ||
78 | * @param stamp the time stamp | ||
79 | * @return a json string with the timestamp in @a stamp | ||
80 | */ | ||
81 | json_t * | ||
82 | GNUNET_JSON_from_time_abs_nbo (struct GNUNET_TIME_AbsoluteNBO stamp) | ||
83 | { | ||
84 | return GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_ntoh (stamp)); | ||
85 | } | ||
86 | |||
87 | |||
88 | /** | ||
76 | * Convert relative timestamp to a json string. | 89 | * Convert relative timestamp to a json string. |
77 | * | 90 | * |
78 | * @param stamp the time stamp | 91 | * @param stamp the time stamp |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 9d077f874..8281e9a16 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -509,6 +509,7 @@ transmit_task_cb (void *cls) | |||
509 | "Starting set exchange with peer `%s'\n", | 509 | "Starting set exchange with peer `%s'\n", |
510 | GNUNET_i2s (&peer_entry->id)); | 510 | GNUNET_i2s (&peer_entry->id)); |
511 | peer_entry->transmit_task = NULL; | 511 | peer_entry->transmit_task = NULL; |
512 | GNUNET_assert (NULL == peer_entry->so); | ||
512 | peer_entry->so = GNUNET_SET_prepare (&peer_entry->id, | 513 | peer_entry->so = GNUNET_SET_prepare (&peer_entry->id, |
513 | &revocation_set_union_app_id, | 514 | &revocation_set_union_app_id, |
514 | NULL, | 515 | NULL, |
@@ -758,6 +759,7 @@ handle_revocation_union_request (void *cls, | |||
758 | { | 759 | { |
759 | peer_entry = new_peer_entry (other_peer); | 760 | peer_entry = new_peer_entry (other_peer); |
760 | } | 761 | } |
762 | GNUNET_assert (NULL == peer_entry->so); | ||
761 | peer_entry->so = GNUNET_SET_accept (request, | 763 | peer_entry->so = GNUNET_SET_accept (request, |
762 | GNUNET_SET_RESULT_ADDED, | 764 | GNUNET_SET_RESULT_ADDED, |
763 | (struct GNUNET_SET_Option[]) {{ 0 }}, | 765 | (struct GNUNET_SET_Option[]) {{ 0 }}, |
diff --git a/src/social/social_api.c b/src/social/social_api.c index af1d6e57e..d57d16cfb 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -2693,6 +2693,8 @@ GNUNET_SOCIAL_app_disconnect (struct GNUNET_SOCIAL_App *app, | |||
2693 | GNUNET_ContinuationCallback disconnect_cb, | 2693 | GNUNET_ContinuationCallback disconnect_cb, |
2694 | void *disconnect_cls) | 2694 | void *disconnect_cls) |
2695 | { | 2695 | { |
2696 | if (NULL == app) return; | ||
2697 | |||
2696 | app->disconnect_cb = disconnect_cb; | 2698 | app->disconnect_cb = disconnect_cb; |
2697 | app->disconnect_cls = disconnect_cls; | 2699 | app->disconnect_cls = disconnect_cls; |
2698 | 2700 | ||
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index ec4d82164..6b354df98 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -541,6 +541,13 @@ client_disconnect_cb (void *cls, | |||
541 | GNUNET_CONTAINER_multipeermap_iterate (active_stccs, | 541 | GNUNET_CONTAINER_multipeermap_iterate (active_stccs, |
542 | &mark_match_down, | 542 | &mark_match_down, |
543 | tc); | 543 | tc); |
544 | for (struct AddressToStringContext *cur = a2s_head; | ||
545 | NULL != cur; | ||
546 | cur = cur->next) | ||
547 | { | ||
548 | if (cur->tc == tc) | ||
549 | cur->tc = NULL; | ||
550 | } | ||
544 | GNUNET_CONTAINER_DLL_remove (clients_head, | 551 | GNUNET_CONTAINER_DLL_remove (clients_head, |
545 | clients_tail, | 552 | clients_tail, |
546 | tc); | 553 | tc); |
@@ -864,6 +871,8 @@ transmit_address_to_client (void *cls, | |||
864 | 871 | ||
865 | GNUNET_assert ( (GNUNET_OK == res) || | 872 | GNUNET_assert ( (GNUNET_OK == res) || |
866 | (GNUNET_SYSERR == res) ); | 873 | (GNUNET_SYSERR == res) ); |
874 | if (NULL == actx->tc) | ||
875 | return; | ||
867 | if (NULL == buf) | 876 | if (NULL == buf) |
868 | { | 877 | { |
869 | env = GNUNET_MQ_msg (atsm, | 878 | env = GNUNET_MQ_msg (atsm, |
@@ -878,6 +887,7 @@ transmit_address_to_client (void *cls, | |||
878 | GNUNET_CONTAINER_DLL_remove (a2s_head, | 887 | GNUNET_CONTAINER_DLL_remove (a2s_head, |
879 | a2s_tail, | 888 | a2s_tail, |
880 | actx); | 889 | actx); |
890 | GNUNET_free (actx); | ||
881 | return; | 891 | return; |
882 | } | 892 | } |
883 | if (GNUNET_SYSERR == res) | 893 | if (GNUNET_SYSERR == res) |
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index a20c998b3..c780f9a78 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c | |||
@@ -344,8 +344,7 @@ GST_ats_block_address (const struct GNUNET_HELLO_Address *address, | |||
344 | } | 344 | } |
345 | if (NULL == ai->ar) | 345 | if (NULL == ai->ar) |
346 | { | 346 | { |
347 | /* already blocked, how did it get used!? */ | 347 | /* already blocked but this might be a blacklist check callback */ |
348 | GNUNET_break (0); | ||
349 | return; | 348 | return; |
350 | } | 349 | } |
351 | ai->back_off = GNUNET_TIME_STD_BACKOFF (ai->back_off); | 350 | ai->back_off = GNUNET_TIME_STD_BACKOFF (ai->back_off); |
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index eaa49a991..7845932ee 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c | |||
@@ -354,6 +354,37 @@ GNUNET_CRYPTO_eddsa_public_key_to_string (const struct GNUNET_CRYPTO_EddsaPublic | |||
354 | 354 | ||
355 | 355 | ||
356 | /** | 356 | /** |
357 | * Convert a private key to a string. | ||
358 | * | ||
359 | * @param priv key to convert | ||
360 | * @return string representing @a pub | ||
361 | */ | ||
362 | char * | ||
363 | GNUNET_CRYPTO_eddsa_private_key_to_string (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) | ||
364 | { | ||
365 | char *privkeybuf; | ||
366 | size_t keylen = (sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)) * 8; | ||
367 | char *end; | ||
368 | |||
369 | if (keylen % 5 > 0) | ||
370 | keylen += 5 - keylen % 5; | ||
371 | keylen /= 5; | ||
372 | privkeybuf = GNUNET_malloc (keylen + 1); | ||
373 | end = GNUNET_STRINGS_data_to_string ((unsigned char *) priv, | ||
374 | sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey), | ||
375 | privkeybuf, | ||
376 | keylen); | ||
377 | if (NULL == end) | ||
378 | { | ||
379 | GNUNET_free (privkeybuf); | ||
380 | return NULL; | ||
381 | } | ||
382 | *end = '\0'; | ||
383 | return privkeybuf; | ||
384 | } | ||
385 | |||
386 | |||
387 | /** | ||
357 | * Convert a string representing a public key to a public key. | 388 | * Convert a string representing a public key to a public key. |
358 | * | 389 | * |
359 | * @param enc encoded public key | 390 | * @param enc encoded public key |
@@ -374,9 +405,10 @@ GNUNET_CRYPTO_ecdsa_public_key_from_string (const char *enc, | |||
374 | if (enclen != keylen) | 405 | if (enclen != keylen) |
375 | return GNUNET_SYSERR; | 406 | return GNUNET_SYSERR; |
376 | 407 | ||
377 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (enc, enclen, | 408 | if (GNUNET_OK != |
378 | pub, | 409 | GNUNET_STRINGS_string_to_data (enc, enclen, |
379 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | 410 | pub, |
411 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | ||
380 | return GNUNET_SYSERR; | 412 | return GNUNET_SYSERR; |
381 | return GNUNET_OK; | 413 | return GNUNET_OK; |
382 | } | 414 | } |
@@ -403,9 +435,10 @@ GNUNET_CRYPTO_eddsa_public_key_from_string (const char *enc, | |||
403 | if (enclen != keylen) | 435 | if (enclen != keylen) |
404 | return GNUNET_SYSERR; | 436 | return GNUNET_SYSERR; |
405 | 437 | ||
406 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (enc, enclen, | 438 | if (GNUNET_OK != |
407 | pub, | 439 | GNUNET_STRINGS_string_to_data (enc, enclen, |
408 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))) | 440 | pub, |
441 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))) | ||
409 | return GNUNET_SYSERR; | 442 | return GNUNET_SYSERR; |
410 | return GNUNET_OK; | 443 | return GNUNET_OK; |
411 | } | 444 | } |
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 7a108c21b..a985d8e59 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -1046,7 +1046,7 @@ GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key) | |||
1046 | * @return unblinded signature on success, NULL if RSA key is bad or malicious. | 1046 | * @return unblinded signature on success, NULL if RSA key is bad or malicious. |
1047 | */ | 1047 | */ |
1048 | struct GNUNET_CRYPTO_RsaSignature * | 1048 | struct GNUNET_CRYPTO_RsaSignature * |
1049 | GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, | 1049 | GNUNET_CRYPTO_rsa_unblind (const struct GNUNET_CRYPTO_RsaSignature *sig, |
1050 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, | 1050 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, |
1051 | struct GNUNET_CRYPTO_RsaPublicKey *pkey) | 1051 | struct GNUNET_CRYPTO_RsaPublicKey *pkey) |
1052 | { | 1052 | { |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 42ecc2101..66a4bd3e9 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -49,6 +49,11 @@ static unsigned int list_keys_count; | |||
49 | static int print_public_key; | 49 | static int print_public_key; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Flag for printing private key. | ||
53 | */ | ||
54 | static int print_private_key; | ||
55 | |||
56 | /** | ||
52 | * Flag for printing public key in hex. | 57 | * Flag for printing public key in hex. |
53 | */ | 58 | */ |
54 | static int print_public_key_hex; | 59 | static int print_public_key_hex; |
@@ -377,7 +382,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
377 | create_keys (args[0], args[1]); | 382 | create_keys (args[0], args[1]); |
378 | return; | 383 | return; |
379 | } | 384 | } |
380 | if (print_public_key || print_public_key_hex) | 385 | if (print_public_key || print_public_key_hex || print_private_key) |
381 | { | 386 | { |
382 | char *str; | 387 | char *str; |
383 | struct GNUNET_DISK_FileHandle *keyfile; | 388 | struct GNUNET_DISK_FileHandle *keyfile; |
@@ -388,19 +393,26 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
388 | GNUNET_DISK_PERM_NONE); | 393 | GNUNET_DISK_PERM_NONE); |
389 | if (NULL == keyfile) | 394 | if (NULL == keyfile) |
390 | return; | 395 | return; |
391 | while (sizeof (pk) == GNUNET_DISK_file_read (keyfile, &pk, sizeof (pk))) | 396 | while (sizeof (pk) == |
397 | GNUNET_DISK_file_read (keyfile, &pk, sizeof (pk))) | ||
392 | { | 398 | { |
393 | GNUNET_CRYPTO_eddsa_key_get_public (&pk, &pub); | 399 | GNUNET_CRYPTO_eddsa_key_get_public (&pk, &pub); |
394 | if (print_public_key_hex) | 400 | if (print_public_key_hex) |
395 | { | 401 | { |
396 | print_hex ("HEX:", &pub, sizeof (pub)); | 402 | print_hex ("HEX:", &pub, sizeof (pub)); |
397 | } | 403 | } |
398 | else | 404 | else if (print_public_key) |
399 | { | 405 | { |
400 | str = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub); | 406 | str = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub); |
401 | FPRINTF (stdout, "%s\n", str); | 407 | FPRINTF (stdout, "%s\n", str); |
402 | GNUNET_free (str); | 408 | GNUNET_free (str); |
403 | } | 409 | } |
410 | else if (print_private_key) | ||
411 | { | ||
412 | str = GNUNET_CRYPTO_eddsa_private_key_to_string (&pk); | ||
413 | FPRINTF (stdout, "%s\n", str); | ||
414 | GNUNET_free (str); | ||
415 | } | ||
404 | } | 416 | } |
405 | GNUNET_DISK_file_close (keyfile); | 417 | GNUNET_DISK_file_close (keyfile); |
406 | } | 418 | } |
@@ -438,6 +450,10 @@ main (int argc, | |||
438 | "print-public-key", | 450 | "print-public-key", |
439 | gettext_noop ("print the public key in ASCII format"), | 451 | gettext_noop ("print the public key in ASCII format"), |
440 | &print_public_key), | 452 | &print_public_key), |
453 | GNUNET_GETOPT_option_flag ('P', | ||
454 | "print-private-key", | ||
455 | gettext_noop ("print the private key in ASCII format"), | ||
456 | &print_private_key), | ||
441 | GNUNET_GETOPT_option_flag ('x', | 457 | GNUNET_GETOPT_option_flag ('x', |
442 | "print-hex", | 458 | "print-hex", |
443 | gettext_noop ("print the public key in HEX format"), | 459 | gettext_noop ("print the public key in HEX format"), |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 33a340729..11b8134d6 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -469,6 +469,7 @@ handle_response (void *cls, | |||
469 | uint16_t size; | 469 | uint16_t size; |
470 | char *nret; | 470 | char *nret; |
471 | 471 | ||
472 | GNUNET_assert (NULL != rh); | ||
472 | size = ntohs (msg->size); | 473 | size = ntohs (msg->size); |
473 | if (size == sizeof (struct GNUNET_MessageHeader)) | 474 | if (size == sizeof (struct GNUNET_MessageHeader)) |
474 | { | 475 | { |