diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-06 14:18:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-06 14:18:31 +0000 |
commit | fe76c075e315c0351e2fe465434ae39087daf014 (patch) | |
tree | 436887ccaf331932a3c13a8b9d2a2a710dad4be6 /src/include | |
parent | 7eb2835d8a494c83aedb720a2ac6f6e5ba23f22f (diff) | |
download | gnunet-fe76c075e315c0351e2fe465434ae39087daf014.tar.gz gnunet-fe76c075e315c0351e2fe465434ae39087daf014.zip |
moving to new, fixed-size encoding of public and private ECC keys everywhere, also improving ECC API to better support ECRS/GADS operations
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/block_dns.h | 2 | ||||
-rw-r--r-- | src/include/block_gns.h | 6 | ||||
-rw-r--r-- | src/include/block_regex.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_chat_service.h | 4 | ||||
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 146 | ||||
-rw-r--r-- | src/include/gnunet_fs_service.h | 18 | ||||
-rw-r--r-- | src/include/gnunet_hello_lib.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_identity_service.h | 41 | ||||
-rw-r--r-- | src/include/gnunet_namestore_plugin.h | 6 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_testing_lib.h | 7 |
11 files changed, 119 insertions, 129 deletions
diff --git a/src/include/block_dns.h b/src/include/block_dns.h index c7e1fbb55..198bba2c0 100644 --- a/src/include/block_dns.h +++ b/src/include/block_dns.h | |||
@@ -58,7 +58,7 @@ struct GNUNET_DNS_Record | |||
58 | /** | 58 | /** |
59 | * The peer providing this service | 59 | * The peer providing this service |
60 | */ | 60 | */ |
61 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded peer; | 61 | struct GNUNET_CRYPTO_EccPublicKey peer; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * The descriptor for the service | 64 | * The descriptor for the service |
diff --git a/src/include/block_gns.h b/src/include/block_gns.h index 2f864f4d3..21f0b097c 100644 --- a/src/include/block_gns.h +++ b/src/include/block_gns.h | |||
@@ -39,14 +39,16 @@ struct GNSNameRecordBlock | |||
39 | /** | 39 | /** |
40 | * The public key of the authority | 40 | * The public key of the authority |
41 | */ | 41 | */ |
42 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key; | 42 | struct GNUNET_CRYPTO_EccPublicKey public_key; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * GNUNET_RSA_Signature using RSA-key generated from the records. | 45 | * GNUNET_RSA_Signature using RSA-key generated from the records. |
46 | */ | 46 | */ |
47 | struct GNUNET_CRYPTO_EccSignature signature; | 47 | struct GNUNET_CRYPTO_EccSignature signature; |
48 | 48 | ||
49 | /* number of records that follow */ | 49 | /** |
50 | * number of records that follow | ||
51 | */ | ||
50 | uint32_t rd_count GNUNET_PACKED; | 52 | uint32_t rd_count GNUNET_PACKED; |
51 | 53 | ||
52 | /* 0-terminated name here */ | 54 | /* 0-terminated name here */ |
diff --git a/src/include/block_regex.h b/src/include/block_regex.h index bfaf411eb..5995f70a2 100644 --- a/src/include/block_regex.h +++ b/src/include/block_regex.h | |||
@@ -67,7 +67,7 @@ struct RegexAcceptBlock | |||
67 | /** | 67 | /** |
68 | * Public key of the peer signing. | 68 | * Public key of the peer signing. |
69 | */ | 69 | */ |
70 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded public_key; | 70 | struct GNUNET_CRYPTO_EccPublicKey public_key; |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * The signature. | 73 | * The signature. |
diff --git a/src/include/gnunet_chat_service.h b/src/include/gnunet_chat_service.h index 8e77f9b65..d539197a0 100644 --- a/src/include/gnunet_chat_service.h +++ b/src/include/gnunet_chat_service.h | |||
@@ -135,7 +135,7 @@ typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls, | |||
135 | GNUNET_CONTAINER_MetaData * | 135 | GNUNET_CONTAINER_MetaData * |
136 | member_info, | 136 | member_info, |
137 | const struct | 137 | const struct |
138 | GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded | 138 | GNUNET_CRYPTO_RsaPublicKey |
139 | * member_id, | 139 | * member_id, |
140 | enum GNUNET_CHAT_MsgOptions | 140 | enum GNUNET_CHAT_MsgOptions |
141 | options); | 141 | options); |
@@ -209,7 +209,7 @@ GNUNET_CHAT_join_room (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
209 | void | 209 | void |
210 | GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, const char *message, | 210 | GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, const char *message, |
211 | enum GNUNET_CHAT_MsgOptions options, | 211 | enum GNUNET_CHAT_MsgOptions options, |
212 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded | 212 | const struct GNUNET_CRYPTO_RsaPublicKey |
213 | *receiver, uint32_t * sequence_number); | 213 | *receiver, uint32_t * sequence_number); |
214 | 214 | ||
215 | 215 | ||
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index da2fe860e..5f209efea 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -43,6 +43,14 @@ extern "C" | |||
43 | #include "gnunet_common.h" | 43 | #include "gnunet_common.h" |
44 | #include "gnunet_scheduler_lib.h" | 44 | #include "gnunet_scheduler_lib.h" |
45 | 45 | ||
46 | |||
47 | /** | ||
48 | * Maximum length of an ECC signature. | ||
49 | * Note: round up to multiple of 8 minus 2 for alignment. | ||
50 | */ | ||
51 | #define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126 | ||
52 | |||
53 | |||
46 | /** | 54 | /** |
47 | * Desired quality level for cryptographic operations. | 55 | * Desired quality level for cryptographic operations. |
48 | */ | 56 | */ |
@@ -77,24 +85,6 @@ enum GNUNET_CRYPTO_Quality | |||
77 | #define GNUNET_CRYPTO_HASH_LENGTH (512/8) | 85 | #define GNUNET_CRYPTO_HASH_LENGTH (512/8) |
78 | 86 | ||
79 | /** | 87 | /** |
80 | * Maximum length of an ECC signature. | ||
81 | * Note: round up to multiple of 8 minus 2 for alignment. | ||
82 | */ | ||
83 | #define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 126 | ||
84 | |||
85 | /** | ||
86 | * Maximum length of the public key (q-point, Q = dP) when encoded. | ||
87 | */ | ||
88 | #define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 76 | ||
89 | |||
90 | |||
91 | /** | ||
92 | * The private information of an ECC private key. | ||
93 | */ | ||
94 | struct GNUNET_CRYPTO_EccPrivateKey; | ||
95 | |||
96 | |||
97 | /** | ||
98 | * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode. | 88 | * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode. |
99 | */ | 89 | */ |
100 | struct GNUNET_CRYPTO_HashAsciiEncoded | 90 | struct GNUNET_CRYPTO_HashAsciiEncoded |
@@ -112,7 +102,6 @@ struct GNUNET_CRYPTO_ShortHashAsciiEncoded | |||
112 | }; | 102 | }; |
113 | 103 | ||
114 | 104 | ||
115 | |||
116 | GNUNET_NETWORK_STRUCT_BEGIN | 105 | GNUNET_NETWORK_STRUCT_BEGIN |
117 | 106 | ||
118 | 107 | ||
@@ -146,54 +135,50 @@ struct GNUNET_CRYPTO_EccSignaturePurpose | |||
146 | */ | 135 | */ |
147 | struct GNUNET_CRYPTO_EccSignature | 136 | struct GNUNET_CRYPTO_EccSignature |
148 | { | 137 | { |
138 | |||
149 | /** | 139 | /** |
150 | * Overall size of the signature data. | 140 | * R value. |
151 | */ | 141 | */ |
152 | uint16_t size GNUNET_PACKED; | 142 | unsigned char r[256 / 8]; |
153 | 143 | ||
154 | /** | 144 | /** |
155 | * S-expression, padded with zeros. | 145 | * S value. |
156 | */ | 146 | */ |
157 | char sexpr[GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH]; | 147 | unsigned char s[256 / 8]; |
148 | |||
158 | }; | 149 | }; |
159 | 150 | ||
160 | 151 | ||
161 | /** | 152 | /** |
162 | * Public ECC key (always for NIST P-521) encoded in a format suitable | 153 | * Public ECC key (always for NIST P-521) encoded in a format suitable |
163 | * for network transmission as created using 'gcry_sexp_sprint'. | 154 | * for network transmission. |
164 | */ | 155 | */ |
165 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded | 156 | struct GNUNET_CRYPTO_EccPublicKey |
166 | { | 157 | { |
167 | /** | 158 | /** |
168 | * Size of the encoding, in network byte order. | 159 | * Q consists of an x- and a y-value, each mod p (256 bits), |
160 | * given here in affine coordinates. | ||
169 | */ | 161 | */ |
170 | uint16_t size GNUNET_PACKED; | 162 | unsigned char q_x[256 / 8]; |
171 | 163 | ||
172 | /** | 164 | /** |
173 | * Actual length of the q-point binary encoding. | 165 | * Q consists of an x- and a y-value, each mod p (256 bits), |
166 | * given here in affine coordinates. | ||
174 | */ | 167 | */ |
175 | uint16_t len GNUNET_PACKED; | 168 | unsigned char q_y[256 / 8]; |
176 | 169 | ||
177 | /** | ||
178 | * 0-padded q-point in binary encoding (GCRYPT_MPI_FMT_USG). | ||
179 | */ | ||
180 | unsigned char key[GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH]; | ||
181 | }; | 170 | }; |
182 | 171 | ||
183 | 172 | ||
184 | /** | 173 | /** |
185 | * Private ECC key encoded for transmission (with length prefix). | 174 | * Private ECC key encoded for transmission. |
186 | */ | 175 | */ |
187 | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded | 176 | struct GNUNET_CRYPTO_EccPrivateKey |
188 | { | 177 | { |
189 | /** | 178 | /** |
190 | * Overall size of the private key in network byte order. | 179 | * d is a value mod n, where n has at most 256 bits. |
191 | */ | 180 | */ |
192 | uint16_t size; | 181 | unsigned char d[256 / 8]; |
193 | |||
194 | /* followd by S-expression, opaque to applications */ | ||
195 | |||
196 | /* FIXME: consider defining padding to make this a fixed-size struct */ | ||
197 | 182 | ||
198 | }; | 183 | }; |
199 | 184 | ||
@@ -828,10 +813,10 @@ typedef void (*GNUNET_CRYPTO_EccKeyCallback)(void *cls, | |||
828 | /** | 813 | /** |
829 | * Free memory occupied by ECC key | 814 | * Free memory occupied by ECC key |
830 | * | 815 | * |
831 | * @param privatekey pointer to the memory to free | 816 | * @param priv pointer to the memory to free |
832 | */ | 817 | */ |
833 | void | 818 | void |
834 | GNUNET_CRYPTO_ecc_key_free (struct GNUNET_CRYPTO_EccPrivateKey *privatekey); | 819 | GNUNET_CRYPTO_ecc_key_free (struct GNUNET_CRYPTO_EccPrivateKey *priv); |
835 | 820 | ||
836 | 821 | ||
837 | /** | 822 | /** |
@@ -842,7 +827,7 @@ GNUNET_CRYPTO_ecc_key_free (struct GNUNET_CRYPTO_EccPrivateKey *privatekey); | |||
842 | */ | 827 | */ |
843 | void | 828 | void |
844 | GNUNET_CRYPTO_ecc_key_get_public (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | 829 | GNUNET_CRYPTO_ecc_key_get_public (const struct GNUNET_CRYPTO_EccPrivateKey *priv, |
845 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pub); | 830 | struct GNUNET_CRYPTO_EccPublicKey *pub); |
846 | 831 | ||
847 | 832 | ||
848 | /** | 833 | /** |
@@ -852,7 +837,7 @@ GNUNET_CRYPTO_ecc_key_get_public (const struct GNUNET_CRYPTO_EccPrivateKey *priv | |||
852 | * @return string representing 'pub' | 837 | * @return string representing 'pub' |
853 | */ | 838 | */ |
854 | char * | 839 | char * |
855 | GNUNET_CRYPTO_ecc_public_key_to_string (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pub); | 840 | GNUNET_CRYPTO_ecc_public_key_to_string (const struct GNUNET_CRYPTO_EccPublicKey *pub); |
856 | 841 | ||
857 | 842 | ||
858 | /** | 843 | /** |
@@ -866,36 +851,7 @@ GNUNET_CRYPTO_ecc_public_key_to_string (const struct GNUNET_CRYPTO_EccPublicKeyB | |||
866 | int | 851 | int |
867 | GNUNET_CRYPTO_ecc_public_key_from_string (const char *enc, | 852 | GNUNET_CRYPTO_ecc_public_key_from_string (const char *enc, |
868 | size_t enclen, | 853 | size_t enclen, |
869 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pub); | 854 | struct GNUNET_CRYPTO_EccPublicKey *pub); |
870 | |||
871 | |||
872 | /** | ||
873 | * Encode the private key in a format suitable for | ||
874 | * storing it into a file. | ||
875 | * | ||
876 | * @param key key to encode | ||
877 | * @return encoding of the private key. | ||
878 | * The first 4 bytes give the size of the array, as usual. | ||
879 | */ | ||
880 | struct GNUNET_CRYPTO_EccPrivateKeyBinaryEncoded * | ||
881 | GNUNET_CRYPTO_ecc_encode_key (const struct GNUNET_CRYPTO_EccPrivateKey *key); | ||
882 | |||
883 | |||
884 | /** | ||
885 | * Decode the private key from the file-format back | ||
886 | * to the "normal", internal format. | ||
887 | * | ||
888 | * @param buf the buffer where the private key data is stored | ||
889 | * @param len the length of the data in 'buffer' | ||
890 | * @param validate GNUNET_YES to validate that the key is well-formed, | ||
891 | * GNUNET_NO if the key comes from a totally trusted source | ||
892 | * and validation is considered too expensive | ||
893 | * @return NULL on error | ||
894 | */ | ||
895 | struct GNUNET_CRYPTO_EccPrivateKey * | ||
896 | GNUNET_CRYPTO_ecc_decode_key (const char *buf, | ||
897 | size_t len, | ||
898 | int validate); | ||
899 | 855 | ||
900 | 856 | ||
901 | /** | 857 | /** |
@@ -972,20 +928,20 @@ GNUNET_CRYPTO_get_host_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
972 | */ | 928 | */ |
973 | int | 929 | int |
974 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *key, | 930 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *key, |
975 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pub, | 931 | const struct GNUNET_CRYPTO_EccPublicKey *pub, |
976 | struct GNUNET_HashCode *key_material); | 932 | struct GNUNET_HashCode *key_material); |
977 | 933 | ||
978 | 934 | ||
979 | /** | 935 | /** |
980 | * Sign a given block. | 936 | * Sign a given block. |
981 | * | 937 | * |
982 | * @param key private key to use for the signing | 938 | * @param priv private key to use for the signing |
983 | * @param purpose what to sign (size, purpose) | 939 | * @param purpose what to sign (size, purpose) |
984 | * @param sig where to write the signature | 940 | * @param sig where to write the signature |
985 | * @return GNUNET_SYSERR on error, GNUNET_OK on success | 941 | * @return GNUNET_SYSERR on error, GNUNET_OK on success |
986 | */ | 942 | */ |
987 | int | 943 | int |
988 | GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *key, | 944 | GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, |
989 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 945 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
990 | struct GNUNET_CRYPTO_EccSignature *sig); | 946 | struct GNUNET_CRYPTO_EccSignature *sig); |
991 | 947 | ||
@@ -996,7 +952,7 @@ GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
996 | * @param purpose what is the purpose that the signature should have? | 952 | * @param purpose what is the purpose that the signature should have? |
997 | * @param validate block to validate (size, purpose, data) | 953 | * @param validate block to validate (size, purpose, data) |
998 | * @param sig signature that is being validated | 954 | * @param sig signature that is being validated |
999 | * @param publicKey public key of the signer | 955 | * @param pub public key of the signer |
1000 | * @returns GNUNET_OK if ok, GNUNET_SYSERR if invalid | 956 | * @returns GNUNET_OK if ok, GNUNET_SYSERR if invalid |
1001 | */ | 957 | */ |
1002 | int | 958 | int |
@@ -1004,8 +960,36 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, | |||
1004 | const struct GNUNET_CRYPTO_EccSignaturePurpose | 960 | const struct GNUNET_CRYPTO_EccSignaturePurpose |
1005 | *validate, | 961 | *validate, |
1006 | const struct GNUNET_CRYPTO_EccSignature *sig, | 962 | const struct GNUNET_CRYPTO_EccSignature *sig, |
1007 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded | 963 | const struct GNUNET_CRYPTO_EccPublicKey *pub); |
1008 | *publicKey); | 964 | |
965 | |||
966 | /** | ||
967 | * Derive a private key from a given private key and a label. | ||
968 | * Essentially calculates a private key 'h = H(l,P) * d mod n' | ||
969 | * where n is the size of the ECC group and P is the public | ||
970 | * key associated with the private key 'd'. | ||
971 | * | ||
972 | * @param priv original private key | ||
973 | * @param label label to use for key deriviation | ||
974 | * @return derived private key | ||
975 | */ | ||
976 | struct GNUNET_CRYPTO_EccPrivateKey * | ||
977 | GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | ||
978 | const char *label); | ||
979 | |||
980 | |||
981 | /** | ||
982 | * Derive a public key from a given public key and a label. | ||
983 | * Essentially calculates a public key 'V = H(l,P) * P'. | ||
984 | * | ||
985 | * @param pub original public key | ||
986 | * @param label label to use for key deriviation | ||
987 | * @param result where to write the derived public key | ||
988 | */ | ||
989 | void | ||
990 | GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicKey *pub, | ||
991 | const char *label, | ||
992 | struct GNUNET_CRYPTO_EccPublicKey *result); | ||
1009 | 993 | ||
1010 | 994 | ||
1011 | #if 0 /* keep Emacsens' auto-indent happy */ | 995 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index a1e2dca23..afe53b0e0 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -81,13 +81,9 @@ struct GNUNET_FS_Uri; | |||
81 | 81 | ||
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Identifier for a GNUnet pseudonym (the public key). Q-point, Q=dp. | 84 | * Identifier for a GNUnet pseudonym (the public key). Q-point, Q=dP. |
85 | * Note that we (ab)use an identifier of 'all zeros' to mean the | 85 | * Note that we (ab)use an identifier of 'Q=G=1P' to mean the |
86 | * 'anonymous' pseudonym, where the value is actually the point at | 86 | * 'anonymous' pseudonym. |
87 | * infinity; however, that value cannot be represented here. We do | ||
88 | * not handle the case where the actual q-Value of some pseudonym | ||
89 | * happens to be all zeros as well (as the chance of that is | ||
90 | * negligible). | ||
91 | */ | 87 | */ |
92 | struct GNUNET_FS_PseudonymIdentifier | 88 | struct GNUNET_FS_PseudonymIdentifier |
93 | { | 89 | { |
@@ -274,7 +270,7 @@ GNUNET_FS_pseudonym_verify (const struct GNUNET_FS_PseudonymSignaturePurpose *pu | |||
274 | */ | 270 | */ |
275 | void | 271 | void |
276 | GNUNET_FS_pseudonym_get_identifier (struct GNUNET_FS_PseudonymHandle *ph, | 272 | GNUNET_FS_pseudonym_get_identifier (struct GNUNET_FS_PseudonymHandle *ph, |
277 | struct GNUNET_FS_PseudonymIdentifier *pseudonym); | 273 | struct GNUNET_FS_PseudonymIdentifier *pseudonym); |
278 | 274 | ||
279 | 275 | ||
280 | 276 | ||
@@ -531,6 +527,7 @@ GNUNET_FS_uri_ksk_remove_keyword (struct GNUNET_FS_Uri *uri, | |||
531 | struct GNUNET_FS_Uri * | 527 | struct GNUNET_FS_Uri * |
532 | GNUNET_FS_uri_parse (const char *uri, char **emsg); | 528 | GNUNET_FS_uri_parse (const char *uri, char **emsg); |
533 | 529 | ||
530 | |||
534 | /** | 531 | /** |
535 | * Free URI. | 532 | * Free URI. |
536 | * | 533 | * |
@@ -2604,8 +2601,9 @@ GNUNET_FS_namespace_open_existing (struct GNUNET_FS_Handle *h, const char *name) | |||
2604 | * @return GNUNET_OK on success, GNUNET_SYSERR on error (see errno for details) | 2601 | * @return GNUNET_OK on success, GNUNET_SYSERR on error (see errno for details) |
2605 | */ | 2602 | */ |
2606 | int | 2603 | int |
2607 | GNUNET_FS_namespace_rename (struct GNUNET_FS_Handle *h, const char *old_name, | 2604 | GNUNET_FS_namespace_rename (struct GNUNET_FS_Handle *h, |
2608 | const char *new_name); | 2605 | const char *old_name, |
2606 | const char *new_name); | ||
2609 | 2607 | ||
2610 | 2608 | ||
2611 | /** | 2609 | /** |
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index b60353ee7..583a33f7d 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h | |||
@@ -199,8 +199,7 @@ typedef size_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, | |||
199 | * @return the hello message | 199 | * @return the hello message |
200 | */ | 200 | */ |
201 | struct GNUNET_HELLO_Message * | 201 | struct GNUNET_HELLO_Message * |
202 | GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded | 202 | GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKey *publicKey, |
203 | *publicKey, | ||
204 | GNUNET_HELLO_GenerateAddressListCallback addrgen, | 203 | GNUNET_HELLO_GenerateAddressListCallback addrgen, |
205 | void *addrgen_cls, | 204 | void *addrgen_cls, |
206 | int friend_only); | 205 | int friend_only); |
@@ -327,8 +326,7 @@ GNUNET_HELLO_iterate_new_addresses (const struct GNUNET_HELLO_Message | |||
327 | */ | 326 | */ |
328 | int | 327 | int |
329 | GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello, | 328 | GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello, |
330 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded | 329 | struct GNUNET_CRYPTO_EccPublicKey *publicKey); |
331 | *publicKey); | ||
332 | 330 | ||
333 | 331 | ||
334 | /** | 332 | /** |
@@ -381,7 +379,7 @@ GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello, | |||
381 | */ | 379 | */ |
382 | int | 380 | int |
383 | GNUNET_HELLO_parse_uri (const char *uri, | 381 | GNUNET_HELLO_parse_uri (const char *uri, |
384 | struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *pubkey, | 382 | struct GNUNET_CRYPTO_EccPublicKey *pubkey, |
385 | struct GNUNET_HELLO_Message **hello, | 383 | struct GNUNET_HELLO_Message **hello, |
386 | GNUNET_HELLO_TransportPluginsFind plugins_find); | 384 | GNUNET_HELLO_TransportPluginsFind plugins_find); |
387 | 385 | ||
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 1d67c568c..dfc643d22 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -74,7 +74,18 @@ struct GNUNET_IDENTITY_Operation; | |||
74 | * @return associated ECC key, valid as long as the ego is valid | 74 | * @return associated ECC key, valid as long as the ego is valid |
75 | */ | 75 | */ |
76 | const struct GNUNET_CRYPTO_EccPrivateKey * | 76 | const struct GNUNET_CRYPTO_EccPrivateKey * |
77 | GNUNET_IDENTITY_ego_get_key (struct GNUNET_IDENTITY_Ego *ego); | 77 | GNUNET_IDENTITY_ego_get_private_key (struct GNUNET_IDENTITY_Ego *ego); |
78 | |||
79 | |||
80 | /** | ||
81 | * Get the identifier (public key) of an ego. | ||
82 | * | ||
83 | * @param ego identity handle with the private key | ||
84 | * @param pk set to ego's public key | ||
85 | */ | ||
86 | void | ||
87 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, | ||
88 | struct GNUNET_CRYPTO_EccPublicKey *pk); | ||
78 | 89 | ||
79 | 90 | ||
80 | /** | 91 | /** |
@@ -83,7 +94,7 @@ GNUNET_IDENTITY_ego_get_key (struct GNUNET_IDENTITY_Ego *ego); | |||
83 | * | 94 | * |
84 | * When used with 'GNUNET_IDENTITY_connect', this function is | 95 | * When used with 'GNUNET_IDENTITY_connect', this function is |
85 | * initially called for all egos and then again whenever a | 96 | * initially called for all egos and then again whenever a |
86 | * ego's identifier changes or if it is deleted. At the end of | 97 | * ego's name changes or if it is deleted. At the end of |
87 | * the initial pass over all egos, the function is once called | 98 | * the initial pass over all egos, the function is once called |
88 | * with 'NULL' for 'ego'. That does NOT mean that the callback won't | 99 | * with 'NULL' for 'ego'. That does NOT mean that the callback won't |
89 | * be invoked in the future or that there was an error. | 100 | * be invoked in the future or that there was an error. |
@@ -97,10 +108,10 @@ GNUNET_IDENTITY_ego_get_key (struct GNUNET_IDENTITY_Ego *ego); | |||
97 | * that one was not NULL). | 108 | * that one was not NULL). |
98 | * | 109 | * |
99 | * When an identity is renamed, this function is called with the | 110 | * When an identity is renamed, this function is called with the |
100 | * (known) ego but the NEW identifier. | 111 | * (known) ego but the NEW name. |
101 | * | 112 | * |
102 | * When an identity is deleted, this function is called with the | 113 | * When an identity is deleted, this function is called with the |
103 | * (known) ego and "NULL" for the 'identifier'. In this case, | 114 | * (known) ego and "NULL" for the 'name'. In this case, |
104 | * the 'ego' is henceforth invalid (and the 'ctx' should also be | 115 | * the 'ego' is henceforth invalid (and the 'ctx' should also be |
105 | * cleaned up). | 116 | * cleaned up). |
106 | * | 117 | * |
@@ -108,14 +119,14 @@ GNUNET_IDENTITY_ego_get_key (struct GNUNET_IDENTITY_Ego *ego); | |||
108 | * @param ego ego handle | 119 | * @param ego ego handle |
109 | * @param ego_ctx context for application to store data for this ego | 120 | * @param ego_ctx context for application to store data for this ego |
110 | * (during the lifetime of this process, initially NULL) | 121 | * (during the lifetime of this process, initially NULL) |
111 | * @param identifier identifier assigned by the user for this ego, | 122 | * @param name name assigned by the user for this ego, |
112 | * NULL if the user just deleted the ego and it | 123 | * NULL if the user just deleted the ego and it |
113 | * must thus no longer be used | 124 | * must thus no longer be used |
114 | */ | 125 | */ |
115 | typedef void (*GNUNET_IDENTITY_Callback)(void *cls, | 126 | typedef void (*GNUNET_IDENTITY_Callback)(void *cls, |
116 | struct GNUNET_IDENTITY_Ego *ego, | 127 | struct GNUNET_IDENTITY_Ego *ego, |
117 | void **ctx, | 128 | void **ctx, |
118 | const char *identifier); | 129 | const char *name); |
119 | 130 | ||
120 | 131 | ||
121 | /** | 132 | /** |
@@ -188,17 +199,17 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); | |||
188 | 199 | ||
189 | 200 | ||
190 | /** | 201 | /** |
191 | * Create a new identity with the given identifier. | 202 | * Create a new identity with the given name. |
192 | * | 203 | * |
193 | * @param id identity service to use | 204 | * @param id identity service to use |
194 | * @param identifier desired identifier | 205 | * @param name desired name |
195 | * @param cont function to call with the result (will only be called once) | 206 | * @param cont function to call with the result (will only be called once) |
196 | * @param cont_cls closure for cont | 207 | * @param cont_cls closure for cont |
197 | * @return handle to abort the operation | 208 | * @return handle to abort the operation |
198 | */ | 209 | */ |
199 | struct GNUNET_IDENTITY_Operation * | 210 | struct GNUNET_IDENTITY_Operation * |
200 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, | 211 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, |
201 | const char *identifier, | 212 | const char *name, |
202 | GNUNET_IDENTITY_Continuation cont, | 213 | GNUNET_IDENTITY_Continuation cont, |
203 | void *cont_cls); | 214 | void *cont_cls); |
204 | 215 | ||
@@ -207,16 +218,16 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, | |||
207 | * Renames an existing identity. | 218 | * Renames an existing identity. |
208 | * | 219 | * |
209 | * @param id identity service to use | 220 | * @param id identity service to use |
210 | * @param old_identifier old identifier | 221 | * @param old_name old name |
211 | * @param new_identifier desired new identifier | 222 | * @param new_name desired new name |
212 | * @param cb function to call with the result (will only be called once) | 223 | * @param cb function to call with the result (will only be called once) |
213 | * @param cb_cls closure for cb | 224 | * @param cb_cls closure for cb |
214 | * @return handle to abort the operation | 225 | * @return handle to abort the operation |
215 | */ | 226 | */ |
216 | struct GNUNET_IDENTITY_Operation * | 227 | struct GNUNET_IDENTITY_Operation * |
217 | GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, | 228 | GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, |
218 | const char *old_identifier, | 229 | const char *old_name, |
219 | const char *new_identifier, | 230 | const char *new_name, |
220 | GNUNET_IDENTITY_Continuation cb, | 231 | GNUNET_IDENTITY_Continuation cb, |
221 | void *cb_cls); | 232 | void *cb_cls); |
222 | 233 | ||
@@ -225,14 +236,14 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *id, | |||
225 | * Delete an existing identity. | 236 | * Delete an existing identity. |
226 | * | 237 | * |
227 | * @param id identity service to use | 238 | * @param id identity service to use |
228 | * @param identifier identifier of the identity to delete | 239 | * @param name name of the identity to delete |
229 | * @param cb function to call with the result (will only be called once) | 240 | * @param cb function to call with the result (will only be called once) |
230 | * @param cb_cls closure for cb | 241 | * @param cb_cls closure for cb |
231 | * @return handle to abort the operation | 242 | * @return handle to abort the operation |
232 | */ | 243 | */ |
233 | struct GNUNET_IDENTITY_Operation * | 244 | struct GNUNET_IDENTITY_Operation * |
234 | GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, | 245 | GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, |
235 | const char *identifier, | 246 | const char *name, |
236 | GNUNET_IDENTITY_Continuation cb, | 247 | GNUNET_IDENTITY_Continuation cb, |
237 | void *cb_cls); | 248 | void *cb_cls); |
238 | 249 | ||
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index e969170e5..b4ffc257d 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -4,7 +4,7 @@ | |||
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 |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -53,7 +53,7 @@ extern "C" | |||
53 | * because the user queried for a particular record type only) | 53 | * because the user queried for a particular record type only) |
54 | */ | 54 | */ |
55 | typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, | 55 | typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, |
56 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 56 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
57 | struct GNUNET_TIME_Absolute expire, | 57 | struct GNUNET_TIME_Absolute expire, |
58 | const char *name, | 58 | const char *name, |
59 | unsigned int rd_len, | 59 | unsigned int rd_len, |
@@ -88,7 +88,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
88 | * @return GNUNET_OK on success, else GNUNET_SYSERR | 88 | * @return GNUNET_OK on success, else GNUNET_SYSERR |
89 | */ | 89 | */ |
90 | int (*put_records) (void *cls, | 90 | int (*put_records) (void *cls, |
91 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 91 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
92 | struct GNUNET_TIME_Absolute expire, | 92 | struct GNUNET_TIME_Absolute expire, |
93 | const char *name, | 93 | const char *name, |
94 | unsigned int rd_len, | 94 | unsigned int rd_len, |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 700122507..77da67312 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -247,7 +247,7 @@ struct GNUNET_NAMESTORE_RecordData | |||
247 | */ | 247 | */ |
248 | struct GNUNET_NAMESTORE_QueueEntry * | 248 | struct GNUNET_NAMESTORE_QueueEntry * |
249 | GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h, | 249 | GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h, |
250 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 250 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
251 | const char *name, | 251 | const char *name, |
252 | struct GNUNET_TIME_Absolute freshness, | 252 | struct GNUNET_TIME_Absolute freshness, |
253 | unsigned int rd_count, | 253 | unsigned int rd_count, |
@@ -270,7 +270,7 @@ GNUNET_NAMESTORE_record_put (struct GNUNET_NAMESTORE_Handle *h, | |||
270 | * @return GNUNET_OK if the signature is valid | 270 | * @return GNUNET_OK if the signature is valid |
271 | */ | 271 | */ |
272 | int | 272 | int |
273 | GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *public_key, | 273 | GNUNET_NAMESTORE_verify_signature (const struct GNUNET_CRYPTO_EccPublicKey *public_key, |
274 | const struct GNUNET_TIME_Absolute freshness, | 274 | const struct GNUNET_TIME_Absolute freshness, |
275 | const char *name, | 275 | const char *name, |
276 | unsigned int rd_count, | 276 | unsigned int rd_count, |
@@ -319,7 +319,7 @@ GNUNET_NAMESTORE_record_put_by_authority (struct GNUNET_NAMESTORE_Handle *h, | |||
319 | * because the user queried for a particular record type only) | 319 | * because the user queried for a particular record type only) |
320 | */ | 320 | */ |
321 | typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, | 321 | typedef void (*GNUNET_NAMESTORE_RecordProcessor) (void *cls, |
322 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 322 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
323 | struct GNUNET_TIME_Absolute freshness, | 323 | struct GNUNET_TIME_Absolute freshness, |
324 | const char *name, | 324 | const char *name, |
325 | unsigned int rd_count, | 325 | unsigned int rd_count, |
@@ -480,7 +480,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor; | |||
480 | * @param signature signature of the record block | 480 | * @param signature signature of the record block |
481 | */ | 481 | */ |
482 | typedef void (*GNUNET_NAMESTORE_RecordMonitor)(void *cls, | 482 | typedef void (*GNUNET_NAMESTORE_RecordMonitor)(void *cls, |
483 | const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key, | 483 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, |
484 | struct GNUNET_TIME_Absolute freshness, | 484 | struct GNUNET_TIME_Absolute freshness, |
485 | const char *name, | 485 | const char *name, |
486 | unsigned int rd_len, | 486 | unsigned int rd_len, |
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 6bb92e05d..3b6fabb6e 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -46,12 +46,9 @@ extern "C" | |||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Size of each hostkey in the hostkey file (in BYTES). This is the | 49 | * Size of each hostkey in the hostkey file (in BYTES). |
50 | * maximum length of the S-expressions generated by libgcrypt for the | ||
51 | * curves (rounded up to the next full KB to make IO nicer); it is NOT | ||
52 | * the number of bits in the key. | ||
53 | */ | 50 | */ |
54 | #define GNUNET_TESTING_HOSTKEYFILESIZE 1024 | 51 | #define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey) |
55 | 52 | ||
56 | /** | 53 | /** |
57 | * Handle for a system on which GNUnet peers are executed; | 54 | * Handle for a system on which GNUnet peers are executed; |