aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2023-10-18 15:02:34 +0200
committert3sserakt <t3ss@posteo.de>2023-10-18 15:04:18 +0200
commit3d595570d20045a97c909c02246f5cc754f7041e (patch)
tree01870fd72c39d36b0124ee6020b0e066dbc06ddb /src/include
parente0d28ef927d2e56bd185f5e2685acf8dccdc2826 (diff)
parent9ef4abad615bea12d13be542b8ae5fbeb2dfee32 (diff)
downloadgnunet-3d595570d20045a97c909c02246f5cc754f7041e.tar.gz
gnunet-3d595570d20045a97c909c02246f5cc754f7041e.zip
Merge branch 'master' of ssh://git.gnunet.org/gnunet. Undeleted src/hello/gnunet-hello.c, because it is still needed.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/gnunet_abd_service.h28
-rw-r--r--src/include/gnunet_conversation_service.h2
-rw-r--r--src/include/gnunet_crypto_lib.h566
-rw-r--r--src/include/gnunet_fragmentation_lib.h235
-rw-r--r--src/include/gnunet_friends_lib.h124
-rw-r--r--src/include/gnunet_gns_service.h4
-rw-r--r--src/include/gnunet_gnsrecord_lib.h28
-rw-r--r--src/include/gnunet_hello_lib.h2
-rw-r--r--src/include/gnunet_identity_service.h575
-rw-r--r--src/include/gnunet_json_lib.h24
-rw-r--r--src/include/gnunet_messenger_service.h12
-rw-r--r--src/include/gnunet_namestore_plugin.h14
-rw-r--r--src/include/gnunet_namestore_service.h28
-rw-r--r--src/include/gnunet_nt_lib.h5
-rw-r--r--src/include/gnunet_reclaim_service.h32
-rw-r--r--src/include/gnunet_revocation_service.h6
-rw-r--r--src/include/gnunet_service_lib.h110
-rw-r--r--src/include/gnunet_transport_application_service.h3
-rw-r--r--src/include/gnunet_transport_communication_service.h3
-rw-r--r--src/include/gnunet_util_lib.h1
-rw-r--r--src/include/meson.build2
22 files changed, 773 insertions, 1034 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 03983eaa0..e39f467b9 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -47,8 +47,6 @@ gnunetinclude_HEADERS = \
47 gnunet_dnsstub_lib.h \ 47 gnunet_dnsstub_lib.h \
48 gnunet_dns_service.h \ 48 gnunet_dns_service.h \
49 gnunet_error_codes.h \ 49 gnunet_error_codes.h \
50 gnunet_fragmentation_lib.h \
51 gnunet_friends_lib.h \
52 gnunet_fs_service.h \ 50 gnunet_fs_service.h \
53 gnunet_getopt_lib.h \ 51 gnunet_getopt_lib.h \
54 gnunet_gns_service.h \ 52 gnunet_gns_service.h \
@@ -121,6 +119,7 @@ gnunetinclude_HEADERS = \
121 gnunet_time_lib.h \ 119 gnunet_time_lib.h \
122 gnunet_transport_application_service.h \ 120 gnunet_transport_application_service.h \
123 gnunet_transport_communication_service.h \ 121 gnunet_transport_communication_service.h \
122 gnunet_transport_monitor_service.h \
124 gnunet_transport_core_service.h \ 123 gnunet_transport_core_service.h \
125 gnunet_transport_hello_service.h \ 124 gnunet_transport_hello_service.h \
126 gnunet_transport_testing_ng_lib.h \ 125 gnunet_transport_testing_ng_lib.h \
diff --git a/src/include/gnunet_abd_service.h b/src/include/gnunet_abd_service.h
index 75c1757ab..cb6e77256 100644
--- a/src/include/gnunet_abd_service.h
+++ b/src/include/gnunet_abd_service.h
@@ -107,7 +107,7 @@ struct GNUNET_ABD_DelegationRecordSet
107 /** 107 /**
108 * Public key of the subject this attribute was delegated to 108 * Public key of the subject this attribute was delegated to
109 */ 109 */
110 struct GNUNET_IDENTITY_PublicKey subject_key; 110 struct GNUNET_CRYPTO_PublicKey subject_key;
111 111
112 /** 112 /**
113 * Length of attribute, may be 0 113 * Length of attribute, may be 0
@@ -127,7 +127,7 @@ struct GNUNET_ABD_DelegationSet
127 /** 127 /**
128 * Public key of the subject this attribute was delegated to 128 * Public key of the subject this attribute was delegated to
129 */ 129 */
130 struct GNUNET_IDENTITY_PublicKey subject_key; 130 struct GNUNET_CRYPTO_PublicKey subject_key;
131 131
132 uint32_t subject_attribute_len; 132 uint32_t subject_attribute_len;
133 133
@@ -147,12 +147,12 @@ struct GNUNET_ABD_Delegation
147 /** 147 /**
148 * The issuer of the delegation 148 * The issuer of the delegation
149 */ 149 */
150 struct GNUNET_IDENTITY_PublicKey issuer_key; 150 struct GNUNET_CRYPTO_PublicKey issuer_key;
151 151
152 /** 152 /**
153 * Public key of the subject this attribute was delegated to 153 * Public key of the subject this attribute was delegated to
154 */ 154 */
155 struct GNUNET_IDENTITY_PublicKey subject_key; 155 struct GNUNET_CRYPTO_PublicKey subject_key;
156 156
157 /** 157 /**
158 * Length of the attribute 158 * Length of the attribute
@@ -185,17 +185,17 @@ struct GNUNET_ABD_Delegate
185 /** 185 /**
186 * The issuer of the credential 186 * The issuer of the credential
187 */ 187 */
188 struct GNUNET_IDENTITY_PublicKey issuer_key; 188 struct GNUNET_CRYPTO_PublicKey issuer_key;
189 189
190 /** 190 /**
191 * Public key of the subject this credential was issued to 191 * Public key of the subject this credential was issued to
192 */ 192 */
193 struct GNUNET_IDENTITY_PublicKey subject_key; 193 struct GNUNET_CRYPTO_PublicKey subject_key;
194 194
195 /** 195 /**
196 * Signature of this credential 196 * Signature of this credential
197 */ 197 */
198 struct GNUNET_IDENTITY_Signature signature; 198 struct GNUNET_CRYPTO_Signature signature;
199 199
200 /** 200 /**
201 * Expiration of this credential 201 * Expiration of this credential
@@ -322,9 +322,9 @@ typedef void (*GNUNET_ABD_RemoveDelegateResultProcessor) (void *cls,
322 */ 322 */
323struct GNUNET_ABD_Request* 323struct GNUNET_ABD_Request*
324 GNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle, 324 GNUNET_ABD_verify (struct GNUNET_ABD_Handle *handle,
325 const struct GNUNET_IDENTITY_PublicKey *issuer_key, 325 const struct GNUNET_CRYPTO_PublicKey *issuer_key,
326 const char *issuer_attribute, 326 const char *issuer_attribute,
327 const struct GNUNET_IDENTITY_PublicKey *subject_key, 327 const struct GNUNET_CRYPTO_PublicKey *subject_key,
328 uint32_t delegate_count, 328 uint32_t delegate_count,
329 const struct GNUNET_ABD_Delegate *delegates, 329 const struct GNUNET_ABD_Delegate *delegates,
330 enum GNUNET_ABD_AlgoDirectionFlags direction, 330 enum GNUNET_ABD_AlgoDirectionFlags direction,
@@ -335,9 +335,9 @@ struct GNUNET_ABD_Request*
335 335
336struct GNUNET_ABD_Request* 336struct GNUNET_ABD_Request*
337 GNUNET_ABD_collect (struct GNUNET_ABD_Handle *handle, 337 GNUNET_ABD_collect (struct GNUNET_ABD_Handle *handle,
338 const struct GNUNET_IDENTITY_PublicKey *issuer_key, 338 const struct GNUNET_CRYPTO_PublicKey *issuer_key,
339 const char *issuer_attribute, 339 const char *issuer_attribute,
340 const struct GNUNET_IDENTITY_PrivateKey *subject_key, 340 const struct GNUNET_CRYPTO_PrivateKey *subject_key,
341 enum GNUNET_ABD_AlgoDirectionFlags direction, 341 enum GNUNET_ABD_AlgoDirectionFlags direction,
342 GNUNET_ABD_CredentialResultProcessor proc, 342 GNUNET_ABD_CredentialResultProcessor proc,
343 void *proc_cls, 343 void *proc_cls,
@@ -360,7 +360,7 @@ struct GNUNET_ABD_Request *
360GNUNET_ABD_add_delegation (struct GNUNET_ABD_Handle *handle, 360GNUNET_ABD_add_delegation (struct GNUNET_ABD_Handle *handle,
361 struct GNUNET_IDENTITY_Ego *issuer, 361 struct GNUNET_IDENTITY_Ego *issuer,
362 const char *attribute, 362 const char *attribute,
363 struct GNUNET_IDENTITY_PublicKey *subject, 363 struct GNUNET_CRYPTO_PublicKey *subject,
364 const char *delegated_attribute, 364 const char *delegated_attribute,
365 GNUNET_ABD_DelegateResultProcessor proc, 365 GNUNET_ABD_DelegateResultProcessor proc,
366 void *proc_cls); 366 void *proc_cls);
@@ -393,8 +393,8 @@ GNUNET_ABD_remove_delegation (struct GNUNET_ABD_Handle *handle,
393 * @return handle to the queued request 393 * @return handle to the queued request
394 */ 394 */
395struct GNUNET_ABD_Delegate* 395struct GNUNET_ABD_Delegate*
396GNUNET_ABD_delegate_issue (const struct GNUNET_IDENTITY_PrivateKey *issuer, 396GNUNET_ABD_delegate_issue (const struct GNUNET_CRYPTO_PrivateKey *issuer,
397 struct GNUNET_IDENTITY_PublicKey *subject, 397 struct GNUNET_CRYPTO_PublicKey *subject,
398 const char *iss_attr, 398 const char *iss_attr,
399 const char *sub_attr, 399 const char *sub_attr,
400 struct GNUNET_TIME_Absolute *expiration); 400 struct GNUNET_TIME_Absolute *expiration);
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index 7d54914d1..7857a49cf 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -151,7 +151,7 @@ typedef void
151 struct GNUNET_CONVERSATION_Caller * 151 struct GNUNET_CONVERSATION_Caller *
152 caller, 152 caller,
153 const struct 153 const struct
154 GNUNET_IDENTITY_PublicKey *caller_id); 154 GNUNET_CRYPTO_PublicKey *caller_id);
155 155
156 156
157/** 157/**
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 44dfb4e44..ca51f586c 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -348,6 +348,105 @@ struct GNUNET_CRYPTO_Edx25519Signature
348 unsigned char s[256 / 8]; 348 unsigned char s[256 / 8];
349}; 349};
350 350
351/**
352 * Key type for the generic public key union
353 */
354enum GNUNET_CRYPTO_KeyType
355{
356 /**
357 * The identity type. The value is the same as the
358 * PKEY record type.
359 */
360 GNUNET_PUBLIC_KEY_TYPE_ECDSA = 65536,
361
362 /**
363 * EDDSA identity. The value is the same as the EDKEY
364 * record type.
365 */
366 GNUNET_PUBLIC_KEY_TYPE_EDDSA = 65556
367};
368
369/**
370 * A private key for an identity as per LSD0001.
371 * Note that these types are NOT packed and MUST NOT be used in RPC
372 * messages. Use the respective serialization functions.
373 */
374struct GNUNET_CRYPTO_PrivateKey
375{
376 /**
377 * Type of public key.
378 * Defined by the GNS zone type value.
379 * In NBO.
380 */
381 uint32_t type;
382
383 union
384 {
385 /**
386 * An ECDSA identity key.
387 */
388 struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key;
389
390 /**
391 * AN EdDSA identtiy key
392 */
393 struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key;
394 };
395};
396
397
398/**
399 * An identity key as per LSD0001.
400 */
401struct GNUNET_CRYPTO_PublicKey
402{
403 /**
404 * Type of public key.
405 * Defined by the GNS zone type value.
406 * In NBO.
407 */
408 uint32_t type;
409
410 union
411 {
412 /**
413 * An ECDSA identity key.
414 */
415 struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key;
416
417 /**
418 * AN EdDSA identtiy key
419 */
420 struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key;
421 };
422};
423
424
425/**
426 * An identity signature as per LSD0001.
427 */
428struct GNUNET_CRYPTO_Signature
429{
430 /**
431 * Type of signature.
432 * Defined by the GNS zone type value.
433 * In NBO.
434 */
435 uint32_t type;
436
437 union
438 {
439 /**
440 * An ECDSA signature
441 */
442 struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature;
443
444 /**
445 * AN EdDSA signature
446 */
447 struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
448 };
449};
351 450
352/** 451/**
353 * @brief type for session keys 452 * @brief type for session keys
@@ -3073,6 +3172,473 @@ GNUNET_CRYPTO_cs_verify (const struct GNUNET_CRYPTO_CsSignature *sig,
3073 size_t msg_len); 3172 size_t msg_len);
3074 3173
3075 3174
3175/**
3176 * Get the compacted length of a #GNUNET_CRYPTO_PublicKey.
3177 * Compacted means that it returns the minimum number of bytes this
3178 * key is long, as opposed to the union structure inside
3179 * #GNUNET_CRYPTO_PublicKey.
3180 * Useful for compact serializations.
3181 *
3182 * @param key the key.
3183 * @return -1 on error, else the compacted length of the key.
3184 */
3185ssize_t
3186GNUNET_CRYPTO_public_key_get_length (const struct
3187 GNUNET_CRYPTO_PublicKey *key);
3188
3189/**
3190 * Reads a #GNUNET_CRYPTO_PublicKey from a compact buffer.
3191 * The buffer has to contain at least the compacted length of
3192 * a #GNUNET_CRYPTO_PublicKey in bytes.
3193 * If the buffer is too small, the function returns -1 as error.
3194 * If the buffer does not contain a valid key, it returns -2 as error.
3195 *
3196 * @param buffer the buffer
3197 * @param len the length of buffer
3198 * @param key the key
3199 * @param the amount of bytes read from the buffer
3200 * @return #GNUNET_SYSERR on error
3201 */
3202enum GNUNET_GenericReturnValue
3203GNUNET_CRYPTO_read_public_key_from_buffer (
3204 const void *buffer,
3205 size_t len,
3206 struct GNUNET_CRYPTO_PublicKey *key,
3207 size_t *read);
3208
3209/**
3210 * Get the compacted length of a #GNUNET_CRYPTO_PrivateKey.
3211 * Compacted means that it returns the minimum number of bytes this
3212 * key is long, as opposed to the union structure inside
3213 * #GNUNET_CRYPTO_PrivateKey.
3214 * Useful for compact serializations.
3215 *
3216 * @param key the key.
3217 * @return -1 on error, else the compacted length of the key.
3218 */
3219ssize_t
3220GNUNET_CRYPTO_private_key_get_length (
3221 const struct GNUNET_CRYPTO_PrivateKey *key);
3222
3223
3224/**
3225 * Writes a #GNUNET_CRYPTO_PublicKey to a compact buffer.
3226 * The buffer requires space for at least the compacted length of
3227 * a #GNUNET_CRYPTO_PublicKey in bytes.
3228 * If the buffer is too small, the function returns -1 as error.
3229 * If the key is not valid, it returns -2 as error.
3230 *
3231 * @param key the key
3232 * @param buffer the buffer
3233 * @param len the length of buffer
3234 * @return -1 or -2 on error, else the amount of bytes written to the buffer
3235 */
3236ssize_t
3237GNUNET_CRYPTO_write_public_key_to_buffer (const struct
3238 GNUNET_CRYPTO_PublicKey *key,
3239 void*buffer,
3240 size_t len);
3241
3242
3243/**
3244 * Reads a #GNUNET_CRYPTO_PrivateKey from a compact buffer.
3245 * The buffer has to contain at least the compacted length of
3246 * a #GNUNET_CRYPTO_PrivateKey in bytes.
3247 * If the buffer is too small, the function returns GNUNET_SYSERR as error.
3248 *
3249 * @param buffer the buffer
3250 * @param len the length of buffer
3251 * @param key the key
3252 * @param the amount of bytes read from the buffer
3253 * @return #GNUNET_SYSERR on error
3254 */
3255enum GNUNET_GenericReturnValue
3256GNUNET_CRYPTO_read_private_key_from_buffer (
3257 const void*buffer,
3258 size_t len,
3259 struct GNUNET_CRYPTO_PrivateKey *key,
3260 size_t *read);
3261
3262
3263/**
3264 * Writes a #GNUNET_CRYPTO_PrivateKey to a compact buffer.
3265 * The buffer requires space for at least the compacted length of
3266 * a #GNUNET_CRYPTO_PrivateKey in bytes.
3267 * If the buffer is too small, the function returns -1 as error.
3268 * If the key is not valid, it returns -2 as error.
3269 *
3270 * @param key the key
3271 * @param buffer the buffer
3272 * @param len the length of buffer
3273 * @return -1 or -2 on error, else the amount of bytes written to the buffer
3274 */
3275ssize_t
3276GNUNET_CRYPTO_write_private_key_to_buffer (
3277 const struct GNUNET_CRYPTO_PrivateKey *key,
3278 void*buffer,
3279 size_t len);
3280
3281
3282/**
3283 * Get the compacted length of a #GNUNET_CRYPTO_Signature.
3284 * Compacted means that it returns the minimum number of bytes this
3285 * signature is long, as opposed to the union structure inside
3286 * #GNUNET_CRYPTO_Signature.
3287 * Useful for compact serializations.
3288 *
3289 * @param sig the signature.
3290 * @return -1 on error, else the compacted length of the signature.
3291 */
3292ssize_t
3293GNUNET_CRYPTO_signature_get_length (
3294 const struct GNUNET_CRYPTO_Signature *sig);
3295
3296
3297/**
3298 * Get the compacted length of a signature by type.
3299 * Compacted means that it returns the minimum number of bytes this
3300 * signature is long, as opposed to the union structure inside
3301 * #GNUNET_CRYPTO_Signature.
3302 * Useful for compact serializations.
3303 *
3304 * @param sig the signature.
3305 * @return -1 on error, else the compacted length of the signature.
3306 */
3307ssize_t
3308GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type);
3309
3310
3311/**
3312 * Reads a #GNUNET_CRYPTO_Signature from a compact buffer.
3313 * The buffer has to contain at least the compacted length of
3314 * a #GNUNET_CRYPTO_Signature in bytes.
3315 * If the buffer is too small, the function returns -1 as error.
3316 * If the buffer does not contain a valid key, it returns -2 as error.
3317 *
3318 * @param sig the signature
3319 * @param buffer the buffer
3320 * @param len the length of buffer
3321 * @return -1 or -2 on error, else the amount of bytes read from the buffer
3322 */
3323ssize_t
3324GNUNET_CRYPTO_read_signature_from_buffer (
3325 struct GNUNET_CRYPTO_Signature *sig,
3326 const void*buffer,
3327 size_t len);
3328
3329
3330/**
3331 * Writes a #GNUNET_CRYPTO_Signature to a compact buffer.
3332 * The buffer requires space for at least the compacted length of
3333 * a #GNUNET_CRYPTO_Signature in bytes.
3334 * If the buffer is too small, the function returns -1 as error.
3335 * If the key is not valid, it returns -2 as error.
3336 *
3337 * @param sig the signature
3338 * @param buffer the buffer
3339 * @param len the length of buffer
3340 * @return -1 or -2 on error, else the amount of bytes written to the buffer
3341 */
3342ssize_t
3343GNUNET_CRYPTO_write_signature_to_buffer (
3344 const struct GNUNET_CRYPTO_Signature *sig,
3345 void*buffer,
3346 size_t len);
3347
3348
3349/**
3350 * @brief Sign a given block.
3351 *
3352 * The @a purpose data is the beginning of the data of which the signature is
3353 * to be created. The `size` field in @a purpose must correctly indicate the
3354 * number of bytes of the data structure, including its header. If possible,
3355 * use #GNUNET_CRYPTO_sign() instead of this function.
3356 *
3357 * @param priv private key to use for the signing
3358 * @param purpose what to sign (size, purpose)
3359 * @param[out] sig where to write the signature
3360 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
3361 */
3362enum GNUNET_GenericReturnValue
3363GNUNET_CRYPTO_sign_ (
3364 const struct GNUNET_CRYPTO_PrivateKey *priv,
3365 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
3366 struct GNUNET_CRYPTO_Signature *sig);
3367
3368/**
3369 * @brief Sign a given block.
3370 *
3371 * The @a purpose data is the beginning of the data of which the signature is
3372 * to be created. The `size` field in @a purpose must correctly indicate the
3373 * number of bytes of the data structure, including its header.
3374 * The signature payload and length depends on the key type.
3375 *
3376 * @param priv private key to use for the signing
3377 * @param purpose what to sign (size, purpose)
3378 * @param[out] sig where to write the signature
3379 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
3380 */
3381enum GNUNET_GenericReturnValue
3382GNUNET_CRYPTO_sign_raw_ (
3383 const struct GNUNET_CRYPTO_PrivateKey *priv,
3384 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
3385 unsigned char *sig);
3386
3387
3388/**
3389 * @brief Sign a given block with #GNUNET_CRYPTO_PrivateKey.
3390 *
3391 * The @a ps data must be a fixed-size struct for which the signature is to be
3392 * created. The `size` field in @a ps->purpose must correctly indicate the
3393 * number of bytes of the data structure, including its header.
3394 *
3395 * @param priv private key to use for the signing
3396 * @param ps packed struct with what to sign, MUST begin with a purpose
3397 * @param[out] sig where to write the signature
3398 */
3399#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \
3400 /* check size is set correctly */ \
3401 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
3402 /* check 'ps' begins with the purpose */ \
3403 GNUNET_static_assert (((void*) (ps)) == \
3404 ((void*) &(ps)->purpose)); \
3405 GNUNET_assert (GNUNET_OK == \
3406 GNUNET_CRYPTO_sign_ (priv, \
3407 &(ps)->purpose, \
3408 sig)); \
3409} while (0)
3410
3411
3412/**
3413 * @brief Verify a given signature.
3414 *
3415 * The @a validate data is the beginning of the data of which the signature
3416 * is to be verified. The `size` field in @a validate must correctly indicate
3417 * the number of bytes of the data structure, including its header. If @a
3418 * purpose does not match the purpose given in @a validate (the latter must be
3419 * in big endian), signature verification fails. If possible,
3420 * use #GNUNET_CRYPTO_signature_verify() instead of this function (only if @a validate
3421 * is not fixed-size, you must use this function directly).
3422 *
3423 * @param purpose what is the purpose that the signature should have?
3424 * @param validate block to validate (size, purpose, data)
3425 * @param sig signature that is being validated
3426 * @param pub public key of the signer
3427 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
3428 */
3429enum GNUNET_GenericReturnValue
3430GNUNET_CRYPTO_signature_verify_ (
3431 uint32_t purpose,
3432 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
3433 const struct GNUNET_CRYPTO_Signature *sig,
3434 const struct GNUNET_CRYPTO_PublicKey *pub);
3435
3436/**
3437 * @brief Verify a given signature.
3438 *
3439 * The @a validate data is the beginning of the data of which the signature
3440 * is to be verified. The `size` field in @a validate must correctly indicate
3441 * the number of bytes of the data structure, including its header. If @a
3442 * purpose does not match the purpose given in @a validate (the latter must be
3443 * in big endian), signature verification fails.
3444 *
3445 * @param purpose what is the purpose that the signature should have?
3446 * @param validate block to validate (size, purpose, data)
3447 * @param sig signature that is being validated
3448 * @param pub public key of the signer
3449 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
3450 */
3451enum GNUNET_GenericReturnValue
3452GNUNET_CRYPTO_signature_verify_raw_ (
3453 uint32_t purpose,
3454 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
3455 const unsigned char *sig,
3456 const struct GNUNET_CRYPTO_PublicKey *pub);
3457
3458
3459/**
3460 * @brief Verify a given signature with #GNUNET_CRYPTO_PublicKey.
3461 *
3462 * The @a ps data must be a fixed-size struct for which the signature is to be
3463 * created. The `size` field in @a ps->purpose must correctly indicate the
3464 * number of bytes of the data structure, including its header.
3465 *
3466 * @param purp purpose of the signature, must match 'ps->purpose.purpose'
3467 * (except in host byte order)
3468 * @param ps packed struct with what to sign, MUST begin with a purpose
3469 * @param sig where to read the signature from
3470 * @param pub public key to use for the verifying
3471 */
3472#define GNUNET_CRYPTO_signature_verify(purp,ps,sig,pub) ({ \
3473 /* check size is set correctly */ \
3474 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
3475 /* check 'ps' begins with the purpose */ \
3476 GNUNET_static_assert (((void*) (ps)) == \
3477 ((void*) &(ps)->purpose)); \
3478 GNUNET_CRYPTO_signature_verify_ (purp, \
3479 &(ps)->purpose, \
3480 sig, \
3481 pub); \
3482 })
3483
3484
3485/**
3486 * Encrypt a block with #GNUNET_CRYPTO_PublicKey and derives a
3487 * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
3488 * using ecdh to derive a symmetric key.
3489 *
3490 * @param block the block to encrypt
3491 * @param size the size of the @a block
3492 * @param pub public key to use for ecdh
3493 * @param ecc where to write the ecc public key
3494 * @param result the output parameter in which to store the encrypted result
3495 * can be the same or overlap with @c block
3496 * @returns the size of the encrypted block, -1 for errors.
3497 * Due to the use of CFB and therefore an effective stream cipher,
3498 * this size should be the same as @c len.
3499 */
3500ssize_t
3501GNUNET_CRYPTO_encrypt_old (const void *block,
3502 size_t size,
3503 const struct GNUNET_CRYPTO_PublicKey *pub,
3504 struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
3505 void *result);
3506
3507
3508/**
3509 * Decrypt a given block with #GNUNET_CRYPTO_PrivateKey and a given
3510 * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
3511 *
3512 * @param block the data to decrypt, encoded as returned by encrypt
3513 * @param size the size of the @a block to decrypt
3514 * @param priv private key to use for ecdh
3515 * @param ecc the ecc public key
3516 * @param result address to store the result at
3517 * can be the same or overlap with @c block
3518 * @return -1 on failure, size of decrypted block on success.
3519 * Due to the use of CFB and therefore an effective stream cipher,
3520 * this size should be the same as @c size.
3521 */
3522ssize_t
3523GNUNET_CRYPTO_decrypt_old (
3524 const void *block,
3525 size_t size,
3526 const struct GNUNET_CRYPTO_PrivateKey *priv,
3527 const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
3528 void *result);
3529
3530#define GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \
3531 + sizeof (struct \
3532 GNUNET_CRYPTO_FoKemC))
3533
3534/**
3535 * Encrypt a block with #GNUNET_CRYPTO_PublicKey and derives a
3536 * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
3537 * using ecdh to derive a symmetric key.
3538 *
3539 * Note that the result buffer for the ciphertext must be the length of
3540 * the message to encrypt plus #GNUNET_CRYPTO_ENCRYPT_OVERHEAD_BYTES.
3541 *
3542 * @param block the block to encrypt
3543 * @param size the size of the @a block
3544 * @param pub public key to encrypt for
3545 * @param result the output parameter in which to store the encrypted result
3546 * can be the same or overlap with @c block
3547 * @returns GNUNET_OK on success.
3548 */
3549enum GNUNET_GenericReturnValue
3550GNUNET_CRYPTO_encrypt (const void *block,
3551 size_t size,
3552 const struct GNUNET_CRYPTO_PublicKey *pub,
3553 void *result,
3554 size_t result_size);
3555
3556
3557/**
3558 * Decrypt a given block with #GNUNET_CRYPTO_PrivateKey and a given
3559 * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
3560 *
3561 * @param block the data to decrypt, encoded as returned by encrypt
3562 * @param size the size of the @a block to decrypt
3563 * @param priv private key to use for ecdh
3564 * @param result address to store the result at
3565 * can be the same or overlap with @c block
3566 * @returns GNUNET_OK on success.
3567 */
3568enum GNUNET_GenericReturnValue
3569GNUNET_CRYPTO_decrypt (const void *block,
3570 size_t size,
3571 const struct GNUNET_CRYPTO_PrivateKey *priv,
3572 void *result,
3573 size_t result_size);
3574
3575
3576/**
3577 * Creates a (Base32) string representation of the public key.
3578 * The resulting string encodes a compacted representation of the key.
3579 * See also #GNUNET_CRYPTO_key_get_length.
3580 *
3581 * @param key the key.
3582 * @return the string representation of the key, or NULL on error.
3583 */
3584char *
3585GNUNET_CRYPTO_public_key_to_string (
3586 const struct GNUNET_CRYPTO_PublicKey *key);
3587
3588
3589/**
3590 * Creates a (Base32) string representation of the private key.
3591 * The resulting string encodes a compacted representation of the key.
3592 * See also #GNUNET_CRYPTO_key_get_length.
3593 *
3594 * @param key the key.
3595 * @return the string representation of the key, or NULL on error.
3596 */
3597char *
3598GNUNET_CRYPTO_private_key_to_string (
3599 const struct GNUNET_CRYPTO_PrivateKey *key);
3600
3601
3602/**
3603 * Parses a (Base32) string representation of the public key.
3604 * See also #GNUNET_CRYPTO_public_key_to_string.
3605 *
3606 * @param str the encoded key.
3607 * @param key where to write the key.
3608 * @return GNUNET_SYSERR on error.
3609 */
3610enum GNUNET_GenericReturnValue
3611GNUNET_CRYPTO_public_key_from_string (const char*str,
3612 struct GNUNET_CRYPTO_PublicKey *key);
3613
3614
3615/**
3616 * Parses a (Base32) string representation of the private key.
3617 * See also #GNUNET_CRYPTO_private_key_to_string.
3618 *
3619 * @param str the encoded key.
3620 * @param key where to write the key.
3621 * @return GNUNET_SYSERR on error.
3622 */
3623enum GNUNET_GenericReturnValue
3624GNUNET_CRYPTO_private_key_from_string (const char*str,
3625 struct GNUNET_CRYPTO_PrivateKey *key);
3626
3627
3628/**
3629 * Retrieves the public key representation of a private key.
3630 *
3631 * @param privkey the private key.
3632 * @param key the public key result.
3633 * @return GNUNET_SYSERR on error.
3634 */
3635enum GNUNET_GenericReturnValue
3636GNUNET_CRYPTO_key_get_public (const struct
3637 GNUNET_CRYPTO_PrivateKey *privkey,
3638 struct GNUNET_CRYPTO_PublicKey *key);
3639
3640
3641
3076#if 0 /* keep Emacsens' auto-indent happy */ 3642#if 0 /* keep Emacsens' auto-indent happy */
3077{ 3643{
3078#endif 3644#endif
diff --git a/src/include/gnunet_fragmentation_lib.h b/src/include/gnunet_fragmentation_lib.h
deleted file mode 100644
index c8e99826a..000000000
--- a/src/include/gnunet_fragmentation_lib.h
+++ /dev/null
@@ -1,235 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2009, 2011, 2015 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @addtogroup Backbone
22 * @{
23 *
24 * @author Christian Grothoff
25 *
26 * @file
27 * Library to help fragment messages
28 *
29 * @defgroup fragmentation Fragmentation library
30 * Library to help fragment messages
31 * @{
32 *
33 * @todo Consider additional flow-control for sending from
34 * fragmentation based on continuations.
35 */
36
37#ifndef GNUNET_FRAGMENTATION_LIB_H
38#define GNUNET_FRAGMENTATION_LIB_H
39
40
41#include "gnunet_util_lib.h"
42#include "gnunet_statistics_service.h"
43
44#ifdef __cplusplus
45extern "C"
46{
47#if 0 /* keep Emacsens' auto-indent happy */
48}
49#endif
50#endif
51
52
53/**
54 * Fragmentation context.
55 */
56struct GNUNET_FRAGMENT_Context;
57
58
59/**
60 * Function that is called with messages created by the fragmentation
61 * module. In the case of the 'proc' callback of the
62 * #GNUNET_FRAGMENT_context_create() function, this function must
63 * eventually call #GNUNET_FRAGMENT_context_transmission_done().
64 *
65 * @param cls closure
66 * @param msg the message that was created
67 */
68typedef void
69(*GNUNET_FRAGMENT_MessageProcessor) (void *cls,
70 const struct GNUNET_MessageHeader *msg);
71
72
73/**
74 * Create a fragmentation context for the given message.
75 * Fragments the message into fragments of size @a mtu or
76 * less. Calls @a proc on each un-acknowledged fragment,
77 * using both the expected @a msg_delay between messages and
78 * acknowledgements and the given @a tracker to guide the
79 * frequency of calls to @a proc.
80 *
81 * @param stats statistics context
82 * @param mtu the maximum message size for each fragment
83 * @param tracker bandwidth tracker to use for flow control (can be NULL)
84 * @param msg_delay initial delay to insert between fragment transmissions
85 * based on previous messages
86 * @param ack_delay expected delay between fragment transmission
87 * and ACK based on previous messages
88 * @param msg the message to fragment
89 * @param proc function to call for each fragment to transmit
90 * @param proc_cls closure for proc
91 * @return the fragmentation context
92 */
93struct GNUNET_FRAGMENT_Context *
94GNUNET_FRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
95 uint16_t mtu,
96 struct GNUNET_BANDWIDTH_Tracker *tracker,
97 struct GNUNET_TIME_Relative msg_delay,
98 struct GNUNET_TIME_Relative ack_delay,
99 const struct GNUNET_MessageHeader *msg,
100 GNUNET_FRAGMENT_MessageProcessor proc,
101 void *proc_cls);
102
103
104/**
105 * Continuation to call from the 'proc' function after the fragment
106 * has been transmitted (and hence the next fragment can now be
107 * given to proc).
108 *
109 * @param fc fragmentation context
110 */
111void
112GNUNET_FRAGMENT_context_transmission_done (struct GNUNET_FRAGMENT_Context *fc);
113
114
115/**
116 * Process an acknowledgement message we got from the other
117 * side (to control re-transmits).
118 *
119 * @param fc fragmentation context
120 * @param msg acknowledgement message we received
121 * @return #GNUNET_OK if this ack completes the work of the 'fc'
122 * (all fragments have been received);
123 * #GNUNET_NO if more messages are pending
124 * #GNUNET_SYSERR if this ack is not valid for this fc
125 */
126int
127GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc,
128 const struct GNUNET_MessageHeader *msg);
129
130
131/**
132 * Destroy the given fragmentation context (stop calling 'proc', free
133 * resources).
134 *
135 * @param fc fragmentation context
136 * @param msg_delay where to store average delay between individual message transmissions the
137 * last message (OUT only)
138 * @param ack_delay where to store average delay between transmission and ACK for the
139 * last message, set to FOREVER if the message was not fully transmitted (OUT only)
140 */
141void
142GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc,
143 struct GNUNET_TIME_Relative *msg_delay,
144 struct GNUNET_TIME_Relative *ack_delay);
145
146
147/**
148 * Convert an ACK message to a printable format suitable for logging.
149 *
150 * @param ack message to print
151 * @return ack in human-readable format
152 */
153const char *
154GNUNET_FRAGMENT_print_ack (const struct GNUNET_MessageHeader *ack);
155
156
157/**
158 * Defragmentation context (one per connection).
159 */
160struct GNUNET_DEFRAGMENT_Context;
161
162
163/**
164 * Function that is called with acknowledgement messages created by
165 * the fragmentation module. Acknowledgements are cumulative,
166 * so it is OK to only transmit the 'latest' ack message for the same
167 * message ID.
168 *
169 * @param cls closure
170 * @param id unique message ID (modulo collisions)
171 * @param msg the message that was created
172 */
173typedef void
174(*GNUNET_DEFRAGMENT_AckProcessor) (void *cls,
175 uint32_t id,
176 const struct GNUNET_MessageHeader *msg);
177
178
179/**
180 * Create a defragmentation context.
181 *
182 * @param stats statistics context
183 * @param mtu the maximum message size for each fragment
184 * @param num_msgs how many fragmented messages
185 * to we defragment at most at the same time?
186 * @param cls closure for @a proc and @a ackp
187 * @param proc function to call with defragmented messages
188 * @param ackp function to call with acknowledgements (to send
189 * back to the other side)
190 * @return the defragmentation context
191 */
192struct GNUNET_DEFRAGMENT_Context *
193GNUNET_DEFRAGMENT_context_create (struct GNUNET_STATISTICS_Handle *stats,
194 uint16_t mtu,
195 unsigned int num_msgs,
196 void *cls,
197 GNUNET_FRAGMENT_MessageProcessor proc,
198 GNUNET_DEFRAGMENT_AckProcessor ackp);
199
200
201/**
202 * Destroy the given defragmentation context.
203 *
204 * @param dc defragmentation context
205 */
206void
207GNUNET_DEFRAGMENT_context_destroy (struct GNUNET_DEFRAGMENT_Context *dc);
208
209
210/**
211 * We have received a fragment. Process it.
212 *
213 * @param dc the context
214 * @param msg the message that was received
215 * @return #GNUNET_OK on success,
216 * #GNUNET_NO if this was a duplicate,
217 * #GNUNET_SYSERR on error
218 */
219int
220GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
221 const struct GNUNET_MessageHeader *msg);
222
223
224#if 0 /* keep Emacsens' auto-indent happy */
225{
226#endif
227#ifdef __cplusplus
228}
229#endif
230
231#endif
232
233/** @} */ /* end of group */
234
235/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_friends_lib.h b/src/include/gnunet_friends_lib.h
deleted file mode 100644
index 4f4d5e88b..000000000
--- a/src/include/gnunet_friends_lib.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2013 Christian Grothoff
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @addtogroup Backbone
23 * @{
24 *
25 * @author Christian Grothoff
26 *
27 * @file
28 * Library to read and write the FRIENDS file
29 *
30 * @defgroup friends Friends library
31 * Library to read and write the FRIENDS file
32 * @{
33 */
34#ifndef GNUNET_FRIENDS_LIB_H
35#define GNUNET_FRIENDS_LIB_H
36
37#ifdef __cplusplus
38extern "C"
39{
40#if 0 /* keep Emacsens' auto-indent happy */
41}
42#endif
43#endif
44
45
46#include "gnunet_util_lib.h"
47
48
49/**
50 * Signature of a function called on each friend found.
51 *
52 * @param cls closure
53 * @param friend_id peer identity of the friend
54 */
55typedef void (*GNUNET_FRIENDS_Callback)(void *cls,
56 const struct
57 GNUNET_PeerIdentity *friend_id);
58
59
60/**
61 * Parse the FRIENDS file.
62 *
63 * @param cfg our configuration
64 * @param cb function to call on each friend found
65 * @param cb_cls closure for @a cb
66 * @return #GNUNET_OK on success, #GNUNET_SYSERR on parsing errors
67 */
68int
69GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg,
70 GNUNET_FRIENDS_Callback cb,
71 void *cb_cls);
72
73
74/**
75 * Handle for writing a friends file.
76 */
77struct GNUNET_FRIENDS_Writer;
78
79
80/**
81 * Start writing a fresh FRIENDS file. Will make a backup of the
82 * old one.
83 *
84 * @param cfg configuration to use.
85 * @return NULL on error
86 */
87struct GNUNET_FRIENDS_Writer *
88GNUNET_FRIENDS_write_start (const struct GNUNET_CONFIGURATION_Handle *cfg);
89
90
91/**
92 * Finish writing out the friends file.
93 *
94 * @param w write handle
95 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
96 */
97int
98GNUNET_FRIENDS_write_stop (struct GNUNET_FRIENDS_Writer *w);
99
100
101/**
102 * Add a friend to the friends file.
103 *
104 * @param w write handle
105 * @param friend_id friend to add
106 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
107 */
108int
109GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w,
110 const struct GNUNET_PeerIdentity *friend_id);
111
112
113#if 0 /* keep Emacsens' auto-indent happy */
114{
115#endif
116#ifdef __cplusplus
117}
118#endif
119
120#endif
121
122/** @} */ /* end of group */
123
124/** @} */ /* end of group addition to backbone */
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 1fcf7aa8b..1f19e58ac 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -137,7 +137,7 @@ enum GNUNET_GNS_LocalOptions
137struct GNUNET_GNS_LookupRequest * 137struct GNUNET_GNS_LookupRequest *
138GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, 138GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
139 const char *name, 139 const char *name,
140 const struct GNUNET_IDENTITY_PublicKey *zone, 140 const struct GNUNET_CRYPTO_PublicKey *zone,
141 uint32_t type, 141 uint32_t type,
142 enum GNUNET_GNS_LocalOptions options, 142 enum GNUNET_GNS_LocalOptions options,
143 GNUNET_GNS_LookupResultProcessor proc, 143 GNUNET_GNS_LookupResultProcessor proc,
@@ -161,7 +161,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
161struct GNUNET_GNS_LookupRequest * 161struct GNUNET_GNS_LookupRequest *
162GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, 162GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle,
163 const char *name, 163 const char *name,
164 const struct GNUNET_IDENTITY_PublicKey *zone, 164 const struct GNUNET_CRYPTO_PublicKey *zone,
165 uint32_t type, 165 uint32_t type,
166 enum GNUNET_GNS_LocalOptions options, 166 enum GNUNET_GNS_LocalOptions options,
167 uint16_t recursion_depth_limit, 167 uint16_t recursion_depth_limit,
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 338f22223..d78e637e8 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -339,7 +339,7 @@ struct GNUNET_GNSRECORD_ReverseRecord
339 /** 339 /**
340 * The public key of the namespace the is delegating to our namespace 340 * The public key of the namespace the is delegating to our namespace
341 */ 341 */
342 struct GNUNET_IDENTITY_PublicKey pkey; 342 struct GNUNET_CRYPTO_PublicKey pkey;
343 343
344 /** 344 /**
345 * The expiration time of the delegation 345 * The expiration time of the delegation
@@ -494,7 +494,7 @@ GNUNET_GNSRECORD_string_normalize (const char *src);
494 * #GNUNET_GNSRECORD_z2s. 494 * #GNUNET_GNSRECORD_z2s.
495 */ 495 */
496const char * 496const char *
497GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z); 497GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_PublicKey *z);
498 498
499 499
500/** 500/**
@@ -508,7 +508,7 @@ GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z);
508 * key in an encoding suitable for DNS labels. 508 * key in an encoding suitable for DNS labels.
509 */ 509 */
510const char * 510const char *
511GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey); 511GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_PublicKey *pkey);
512 512
513 513
514/** 514/**
@@ -522,7 +522,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey);
522 */ 522 */
523int 523int
524GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, 524GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
525 struct GNUNET_IDENTITY_PublicKey *pkey); 525 struct GNUNET_CRYPTO_PublicKey *pkey);
526 526
527 527
528/** 528/**
@@ -534,7 +534,7 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey,
534 */ 534 */
535void 535void
536GNUNET_GNSRECORD_query_from_private_key ( 536GNUNET_GNSRECORD_query_from_private_key (
537 const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, 537 const struct GNUNET_CRYPTO_PrivateKey *zone, const char *label,
538 struct GNUNET_HashCode *query); 538 struct GNUNET_HashCode *query);
539 539
540 540
@@ -548,7 +548,7 @@ GNUNET_GNSRECORD_query_from_private_key (
548 */ 548 */
549void 549void
550GNUNET_GNSRECORD_query_from_public_key ( 550GNUNET_GNSRECORD_query_from_public_key (
551 const struct GNUNET_IDENTITY_PublicKey *pub, const char *label, 551 const struct GNUNET_CRYPTO_PublicKey *pub, const char *label,
552 struct GNUNET_HashCode *query); 552 struct GNUNET_HashCode *query);
553 553
554 554
@@ -562,7 +562,7 @@ GNUNET_GNSRECORD_query_from_public_key (
562 */ 562 */
563ssize_t 563ssize_t
564GNUNET_GNSRECORD_block_calculate_size (const struct 564GNUNET_GNSRECORD_block_calculate_size (const struct
565 GNUNET_IDENTITY_PrivateKey *key, 565 GNUNET_CRYPTO_PrivateKey *key,
566 const struct GNUNET_GNSRECORD_Data *rd, 566 const struct GNUNET_GNSRECORD_Data *rd,
567 unsigned int rd_count); 567 unsigned int rd_count);
568 568
@@ -576,7 +576,7 @@ GNUNET_GNSRECORD_block_calculate_size (const struct
576 */ 576 */
577enum GNUNET_GenericReturnValue 577enum GNUNET_GenericReturnValue
578GNUNET_GNSRECORD_block_sign (const struct 578GNUNET_GNSRECORD_block_sign (const struct
579 GNUNET_IDENTITY_PrivateKey *key, 579 GNUNET_CRYPTO_PrivateKey *key,
580 const char *label, 580 const char *label,
581 struct GNUNET_GNSRECORD_Block *block); 581 struct GNUNET_GNSRECORD_Block *block);
582 582
@@ -592,7 +592,7 @@ GNUNET_GNSRECORD_block_sign (const struct
592 * @return GNUNET_OK on success 592 * @return GNUNET_OK on success
593 */ 593 */
594enum GNUNET_GenericReturnValue 594enum GNUNET_GenericReturnValue
595GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key, 595GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_PrivateKey *key,
596 struct GNUNET_TIME_Absolute expire, 596 struct GNUNET_TIME_Absolute expire,
597 const char *label, 597 const char *label,
598 const struct GNUNET_GNSRECORD_Data *rd, 598 const struct GNUNET_GNSRECORD_Data *rd,
@@ -617,7 +617,7 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key,
617 */ 617 */
618enum GNUNET_GenericReturnValue 618enum GNUNET_GenericReturnValue
619GNUNET_GNSRECORD_block_create_unsigned (const struct 619GNUNET_GNSRECORD_block_create_unsigned (const struct
620 GNUNET_IDENTITY_PrivateKey *key, 620 GNUNET_CRYPTO_PrivateKey *key,
621 struct GNUNET_TIME_Absolute expire, 621 struct GNUNET_TIME_Absolute expire,
622 const char *label, 622 const char *label,
623 const struct GNUNET_GNSRECORD_Data *rd, 623 const struct GNUNET_GNSRECORD_Data *rd,
@@ -639,7 +639,7 @@ GNUNET_GNSRECORD_block_create_unsigned (const struct
639 * @return GNUNET_OK on success. 639 * @return GNUNET_OK on success.
640 */ 640 */
641enum GNUNET_GenericReturnValue 641enum GNUNET_GenericReturnValue
642GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *key, 642GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_PrivateKey *key,
643 struct GNUNET_TIME_Absolute expire, 643 struct GNUNET_TIME_Absolute expire,
644 const char *label, 644 const char *label,
645 const struct GNUNET_GNSRECORD_Data *rd, 645 const struct GNUNET_GNSRECORD_Data *rd,
@@ -672,7 +672,7 @@ GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block);
672enum GNUNET_GenericReturnValue 672enum GNUNET_GenericReturnValue
673GNUNET_GNSRECORD_block_decrypt ( 673GNUNET_GNSRECORD_block_decrypt (
674 const struct GNUNET_GNSRECORD_Block *block, 674 const struct GNUNET_GNSRECORD_Block *block,
675 const struct GNUNET_IDENTITY_PublicKey *zone_key, const char *label, 675 const struct GNUNET_CRYPTO_PublicKey *zone_key, const char *label,
676 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); 676 GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls);
677 677
678 678
@@ -752,7 +752,7 @@ enum GNUNET_GenericReturnValue
752GNUNET_GNSRECORD_identity_from_data (const char *data, 752GNUNET_GNSRECORD_identity_from_data (const char *data,
753 size_t data_size, 753 size_t data_size,
754 uint32_t type, 754 uint32_t type,
755 struct GNUNET_IDENTITY_PublicKey *key); 755 struct GNUNET_CRYPTO_PublicKey *key);
756 756
757 757
758/** 758/**
@@ -766,7 +766,7 @@ GNUNET_GNSRECORD_identity_from_data (const char *data,
766 */ 766 */
767enum GNUNET_GenericReturnValue 767enum GNUNET_GenericReturnValue
768GNUNET_GNSRECORD_data_from_identity (const struct 768GNUNET_GNSRECORD_data_from_identity (const struct
769 GNUNET_IDENTITY_PublicKey *key, 769 GNUNET_CRYPTO_PublicKey *key,
770 char **data, 770 char **data,
771 size_t *data_size, 771 size_t *data_size,
772 uint32_t *type); 772 uint32_t *type);
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h
index 20a61cbfb..b57f48ac5 100644
--- a/src/include/gnunet_hello_lib.h
+++ b/src/include/gnunet_hello_lib.h
@@ -476,7 +476,7 @@ GNUNET_HELLO_parse_uri (const char *uri,
476 476
477 477
478/* NG API */ 478/* NG API */
479#include "gnunet_nt_lib.h" 479#include "gnunet_util_lib.h"
480 480
481 481
482/** 482/**
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h
index fd0458f62..4743dbf7e 100644
--- a/src/include/gnunet_identity_service.h
+++ b/src/include/gnunet_identity_service.h
@@ -62,20 +62,6 @@ extern "C" {
62 */ 62 */
63#define GNUNET_IDENTITY_VERSION 0x00000100 63#define GNUNET_IDENTITY_VERSION 0x00000100
64 64
65enum GNUNET_IDENTITY_KeyType
66{
67 /**
68 * The identity type. The value is the same as the
69 * PKEY record type.
70 */
71 GNUNET_IDENTITY_TYPE_ECDSA = 65536,
72
73 /**
74 * EDDSA identity. The value is the same as the EDKEY
75 * record type.
76 */
77 GNUNET_IDENTITY_TYPE_EDDSA = 65556
78};
79 65
80/** 66/**
81 * Handle to access the identity service. 67 * Handle to access the identity service.
@@ -88,89 +74,6 @@ struct GNUNET_IDENTITY_Handle;
88struct GNUNET_IDENTITY_Ego; 74struct GNUNET_IDENTITY_Ego;
89 75
90/** 76/**
91 * A private key for an identity as per LSD0001.
92 * Note that these types are NOT packed and MUST NOT be used in RPC
93 * messages. Use the respective serialization functions.
94 */
95struct GNUNET_IDENTITY_PrivateKey
96{
97 /**
98 * Type of public key.
99 * Defined by the GNS zone type value.
100 * In NBO.
101 */
102 uint32_t type;
103
104 union
105 {
106 /**
107 * An ECDSA identity key.
108 */
109 struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key;
110
111 /**
112 * AN EdDSA identtiy key
113 */
114 struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key;
115 };
116};
117
118
119/**
120 * An identity key as per LSD0001.
121 */
122struct GNUNET_IDENTITY_PublicKey
123{
124 /**
125 * Type of public key.
126 * Defined by the GNS zone type value.
127 * In NBO.
128 */
129 uint32_t type;
130
131 union
132 {
133 /**
134 * An ECDSA identity key.
135 */
136 struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key;
137
138 /**
139 * AN EdDSA identtiy key
140 */
141 struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key;
142 };
143};
144
145
146/**
147 * An identity signature as per LSD0001.
148 */
149struct GNUNET_IDENTITY_Signature
150{
151 /**
152 * Type of signature.
153 * Defined by the GNS zone type value.
154 * In NBO.
155 */
156 uint32_t type;
157
158 union
159 {
160 /**
161 * An ECDSA signature
162 */
163 struct GNUNET_CRYPTO_EcdsaSignature ecdsa_signature;
164
165 /**
166 * AN EdDSA signature
167 */
168 struct GNUNET_CRYPTO_EddsaSignature eddsa_signature;
169 };
170};
171
172
173/**
174 * Handle for an operation with the identity service. 77 * Handle for an operation with the identity service.
175 */ 78 */
176struct GNUNET_IDENTITY_Operation; 79struct GNUNET_IDENTITY_Operation;
@@ -182,7 +85,7 @@ struct GNUNET_IDENTITY_Operation;
182 * @param ego the ego 85 * @param ego the ego
183 * @return associated ECC key, valid as long as the ego is valid 86 * @return associated ECC key, valid as long as the ego is valid
184 */ 87 */
185const struct GNUNET_IDENTITY_PrivateKey * 88const struct GNUNET_CRYPTO_PrivateKey *
186GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); 89GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego);
187 90
188 91
@@ -203,7 +106,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void);
203 */ 106 */
204void 107void
205GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, 108GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
206 struct GNUNET_IDENTITY_PublicKey *pk); 109 struct GNUNET_CRYPTO_PublicKey *pk);
207 110
208 111
209/** 112/**
@@ -326,7 +229,7 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h);
326typedef void 229typedef void
327(*GNUNET_IDENTITY_CreateContinuation) ( 230(*GNUNET_IDENTITY_CreateContinuation) (
328 void *cls, 231 void *cls,
329 const struct GNUNET_IDENTITY_PrivateKey *pk, 232 const struct GNUNET_CRYPTO_PrivateKey *pk,
330 enum GNUNET_ErrorCode ec); 233 enum GNUNET_ErrorCode ec);
331 234
332 235
@@ -344,8 +247,8 @@ typedef void
344struct GNUNET_IDENTITY_Operation * 247struct GNUNET_IDENTITY_Operation *
345GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, 248GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id,
346 const char *name, 249 const char *name,
347 const struct GNUNET_IDENTITY_PrivateKey *privkey, 250 const struct GNUNET_CRYPTO_PrivateKey *privkey,
348 enum GNUNET_IDENTITY_KeyType ktype, 251 enum GNUNET_CRYPTO_KeyType ktype,
349 GNUNET_IDENTITY_CreateContinuation cont, 252 GNUNET_IDENTITY_CreateContinuation cont,
350 void *cont_cls); 253 void *cont_cls);
351 254
@@ -396,472 +299,6 @@ void
396GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); 299GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op);
397 300
398 301
399/**
400 * Get the compacted length of a #GNUNET_IDENTITY_PublicKey.
401 * Compacted means that it returns the minimum number of bytes this
402 * key is long, as opposed to the union structure inside
403 * #GNUNET_IDENTITY_PublicKey.
404 * Useful for compact serializations.
405 *
406 * @param key the key.
407 * @return -1 on error, else the compacted length of the key.
408 */
409ssize_t
410GNUNET_IDENTITY_public_key_get_length (const struct
411 GNUNET_IDENTITY_PublicKey *key);
412
413/**
414 * Reads a #GNUNET_IDENTITY_PublicKey from a compact buffer.
415 * The buffer has to contain at least the compacted length of
416 * a #GNUNET_IDENTITY_PublicKey in bytes.
417 * If the buffer is too small, the function returns -1 as error.
418 * If the buffer does not contain a valid key, it returns -2 as error.
419 *
420 * @param buffer the buffer
421 * @param len the length of buffer
422 * @param key the key
423 * @param the amount of bytes read from the buffer
424 * @return #GNUNET_SYSERR on error
425 */
426enum GNUNET_GenericReturnValue
427GNUNET_IDENTITY_read_public_key_from_buffer (
428 const void *buffer,
429 size_t len,
430 struct GNUNET_IDENTITY_PublicKey *key,
431 size_t *read);
432
433/**
434 * Get the compacted length of a #GNUNET_IDENTITY_PrivateKey.
435 * Compacted means that it returns the minimum number of bytes this
436 * key is long, as opposed to the union structure inside
437 * #GNUNET_IDENTITY_PrivateKey.
438 * Useful for compact serializations.
439 *
440 * @param key the key.
441 * @return -1 on error, else the compacted length of the key.
442 */
443ssize_t
444GNUNET_IDENTITY_private_key_get_length (
445 const struct GNUNET_IDENTITY_PrivateKey *key);
446
447
448/**
449 * Writes a #GNUNET_IDENTITY_PublicKey to a compact buffer.
450 * The buffer requires space for at least the compacted length of
451 * a #GNUNET_IDENTITY_PublicKey in bytes.
452 * If the buffer is too small, the function returns -1 as error.
453 * If the key is not valid, it returns -2 as error.
454 *
455 * @param key the key
456 * @param buffer the buffer
457 * @param len the length of buffer
458 * @return -1 or -2 on error, else the amount of bytes written to the buffer
459 */
460ssize_t
461GNUNET_IDENTITY_write_public_key_to_buffer (const struct
462 GNUNET_IDENTITY_PublicKey *key,
463 void*buffer,
464 size_t len);
465
466
467/**
468 * Reads a #GNUNET_IDENTITY_PrivateKey from a compact buffer.
469 * The buffer has to contain at least the compacted length of
470 * a #GNUNET_IDENTITY_PrivateKey in bytes.
471 * If the buffer is too small, the function returns GNUNET_SYSERR as error.
472 *
473 * @param buffer the buffer
474 * @param len the length of buffer
475 * @param key the key
476 * @param the amount of bytes read from the buffer
477 * @return #GNUNET_SYSERR on error
478 */
479enum GNUNET_GenericReturnValue
480GNUNET_IDENTITY_read_private_key_from_buffer (
481 const void*buffer,
482 size_t len,
483 struct GNUNET_IDENTITY_PrivateKey *key,
484 size_t *read);
485
486
487/**
488 * Writes a #GNUNET_IDENTITY_PrivateKey to a compact buffer.
489 * The buffer requires space for at least the compacted length of
490 * a #GNUNET_IDENTITY_PrivateKey in bytes.
491 * If the buffer is too small, the function returns -1 as error.
492 * If the key is not valid, it returns -2 as error.
493 *
494 * @param key the key
495 * @param buffer the buffer
496 * @param len the length of buffer
497 * @return -1 or -2 on error, else the amount of bytes written to the buffer
498 */
499ssize_t
500GNUNET_IDENTITY_write_private_key_to_buffer (
501 const struct GNUNET_IDENTITY_PrivateKey *key,
502 void*buffer,
503 size_t len);
504
505
506/**
507 * Get the compacted length of a #GNUNET_IDENTITY_Signature.
508 * Compacted means that it returns the minimum number of bytes this
509 * signature is long, as opposed to the union structure inside
510 * #GNUNET_IDENTITY_Signature.
511 * Useful for compact serializations.
512 *
513 * @param sig the signature.
514 * @return -1 on error, else the compacted length of the signature.
515 */
516ssize_t
517GNUNET_IDENTITY_signature_get_length (
518 const struct GNUNET_IDENTITY_Signature *sig);
519
520
521/**
522 * Get the compacted length of a signature by type.
523 * Compacted means that it returns the minimum number of bytes this
524 * signature is long, as opposed to the union structure inside
525 * #GNUNET_IDENTITY_Signature.
526 * Useful for compact serializations.
527 *
528 * @param sig the signature.
529 * @return -1 on error, else the compacted length of the signature.
530 */
531ssize_t
532GNUNET_IDENTITY_signature_get_raw_length_by_type (uint32_t type);
533
534
535/**
536 * Reads a #GNUNET_IDENTITY_Signature from a compact buffer.
537 * The buffer has to contain at least the compacted length of
538 * a #GNUNET_IDENTITY_Signature in bytes.
539 * If the buffer is too small, the function returns -1 as error.
540 * If the buffer does not contain a valid key, it returns -2 as error.
541 *
542 * @param sig the signature
543 * @param buffer the buffer
544 * @param len the length of buffer
545 * @return -1 or -2 on error, else the amount of bytes read from the buffer
546 */
547ssize_t
548GNUNET_IDENTITY_read_signature_from_buffer (
549 struct GNUNET_IDENTITY_Signature *sig,
550 const void*buffer,
551 size_t len);
552
553
554/**
555 * Writes a #GNUNET_IDENTITY_Signature to a compact buffer.
556 * The buffer requires space for at least the compacted length of
557 * a #GNUNET_IDENTITY_Signature in bytes.
558 * If the buffer is too small, the function returns -1 as error.
559 * If the key is not valid, it returns -2 as error.
560 *
561 * @param sig the signature
562 * @param buffer the buffer
563 * @param len the length of buffer
564 * @return -1 or -2 on error, else the amount of bytes written to the buffer
565 */
566ssize_t
567GNUNET_IDENTITY_write_signature_to_buffer (
568 const struct GNUNET_IDENTITY_Signature *sig,
569 void*buffer,
570 size_t len);
571
572
573/**
574 * @brief Sign a given block.
575 *
576 * The @a purpose data is the beginning of the data of which the signature is
577 * to be created. The `size` field in @a purpose must correctly indicate the
578 * number of bytes of the data structure, including its header. If possible,
579 * use #GNUNET_IDENTITY_sign() instead of this function.
580 *
581 * @param priv private key to use for the signing
582 * @param purpose what to sign (size, purpose)
583 * @param[out] sig where to write the signature
584 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
585 */
586enum GNUNET_GenericReturnValue
587GNUNET_IDENTITY_sign_ (
588 const struct GNUNET_IDENTITY_PrivateKey *priv,
589 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
590 struct GNUNET_IDENTITY_Signature *sig);
591
592/**
593 * @brief Sign a given block.
594 *
595 * The @a purpose data is the beginning of the data of which the signature is
596 * to be created. The `size` field in @a purpose must correctly indicate the
597 * number of bytes of the data structure, including its header.
598 * The signature payload and length depends on the key type.
599 *
600 * @param priv private key to use for the signing
601 * @param purpose what to sign (size, purpose)
602 * @param[out] sig where to write the signature
603 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
604 */
605enum GNUNET_GenericReturnValue
606GNUNET_IDENTITY_sign_raw_ (
607 const struct GNUNET_IDENTITY_PrivateKey *priv,
608 const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
609 unsigned char *sig);
610
611
612/**
613 * @brief Sign a given block with #GNUNET_IDENTITY_PrivateKey.
614 *
615 * The @a ps data must be a fixed-size struct for which the signature is to be
616 * created. The `size` field in @a ps->purpose must correctly indicate the
617 * number of bytes of the data structure, including its header.
618 *
619 * @param priv private key to use for the signing
620 * @param ps packed struct with what to sign, MUST begin with a purpose
621 * @param[out] sig where to write the signature
622 */
623#define GNUNET_IDENTITY_sign(priv,ps,sig) do { \
624 /* check size is set correctly */ \
625 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
626 /* check 'ps' begins with the purpose */ \
627 GNUNET_static_assert (((void*) (ps)) == \
628 ((void*) &(ps)->purpose)); \
629 GNUNET_assert (GNUNET_OK == \
630 GNUNET_IDENTITY_sign_ (priv, \
631 &(ps)->purpose, \
632 sig)); \
633} while (0)
634
635
636/**
637 * @brief Verify a given signature.
638 *
639 * The @a validate data is the beginning of the data of which the signature
640 * is to be verified. The `size` field in @a validate must correctly indicate
641 * the number of bytes of the data structure, including its header. If @a
642 * purpose does not match the purpose given in @a validate (the latter must be
643 * in big endian), signature verification fails. If possible,
644 * use #GNUNET_IDENTITY_signature_verify() instead of this function (only if @a validate
645 * is not fixed-size, you must use this function directly).
646 *
647 * @param purpose what is the purpose that the signature should have?
648 * @param validate block to validate (size, purpose, data)
649 * @param sig signature that is being validated
650 * @param pub public key of the signer
651 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
652 */
653enum GNUNET_GenericReturnValue
654GNUNET_IDENTITY_signature_verify_ (
655 uint32_t purpose,
656 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
657 const struct GNUNET_IDENTITY_Signature *sig,
658 const struct GNUNET_IDENTITY_PublicKey *pub);
659
660/**
661 * @brief Verify a given signature.
662 *
663 * The @a validate data is the beginning of the data of which the signature
664 * is to be verified. The `size` field in @a validate must correctly indicate
665 * the number of bytes of the data structure, including its header. If @a
666 * purpose does not match the purpose given in @a validate (the latter must be
667 * in big endian), signature verification fails.
668 *
669 * @param purpose what is the purpose that the signature should have?
670 * @param validate block to validate (size, purpose, data)
671 * @param sig signature that is being validated
672 * @param pub public key of the signer
673 * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid
674 */
675enum GNUNET_GenericReturnValue
676GNUNET_IDENTITY_signature_verify_raw_ (
677 uint32_t purpose,
678 const struct GNUNET_CRYPTO_EccSignaturePurpose *validate,
679 const unsigned char *sig,
680 const struct GNUNET_IDENTITY_PublicKey *pub);
681
682
683/**
684 * @brief Verify a given signature with #GNUNET_IDENTITY_PublicKey.
685 *
686 * The @a ps data must be a fixed-size struct for which the signature is to be
687 * created. The `size` field in @a ps->purpose must correctly indicate the
688 * number of bytes of the data structure, including its header.
689 *
690 * @param purp purpose of the signature, must match 'ps->purpose.purpose'
691 * (except in host byte order)
692 * @param ps packed struct with what to sign, MUST begin with a purpose
693 * @param sig where to read the signature from
694 * @param pub public key to use for the verifying
695 */
696#define GNUNET_IDENTITY_signature_verify(purp,ps,sig,pub) ({ \
697 /* check size is set correctly */ \
698 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
699 /* check 'ps' begins with the purpose */ \
700 GNUNET_static_assert (((void*) (ps)) == \
701 ((void*) &(ps)->purpose)); \
702 GNUNET_IDENTITY_signature_verify_ (purp, \
703 &(ps)->purpose, \
704 sig, \
705 pub); \
706 })
707
708
709/**
710 * Encrypt a block with #GNUNET_IDENTITY_PublicKey and derives a
711 * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
712 * using ecdh to derive a symmetric key.
713 *
714 * @param block the block to encrypt
715 * @param size the size of the @a block
716 * @param pub public key to use for ecdh
717 * @param ecc where to write the ecc public key
718 * @param result the output parameter in which to store the encrypted result
719 * can be the same or overlap with @c block
720 * @returns the size of the encrypted block, -1 for errors.
721 * Due to the use of CFB and therefore an effective stream cipher,
722 * this size should be the same as @c len.
723 */
724ssize_t
725GNUNET_IDENTITY_encrypt_old (const void *block,
726 size_t size,
727 const struct GNUNET_IDENTITY_PublicKey *pub,
728 struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
729 void *result);
730
731
732/**
733 * Decrypt a given block with #GNUNET_IDENTITY_PrivateKey and a given
734 * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
735 *
736 * @param block the data to decrypt, encoded as returned by encrypt
737 * @param size the size of the @a block to decrypt
738 * @param priv private key to use for ecdh
739 * @param ecc the ecc public key
740 * @param result address to store the result at
741 * can be the same or overlap with @c block
742 * @return -1 on failure, size of decrypted block on success.
743 * Due to the use of CFB and therefore an effective stream cipher,
744 * this size should be the same as @c size.
745 */
746ssize_t
747GNUNET_IDENTITY_decrypt_old (
748 const void *block,
749 size_t size,
750 const struct GNUNET_IDENTITY_PrivateKey *priv,
751 const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
752 void *result);
753
754#define GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES (crypto_secretbox_MACBYTES \
755 + sizeof (struct \
756 GNUNET_CRYPTO_FoKemC))
757
758/**
759 * Encrypt a block with #GNUNET_IDENTITY_PublicKey and derives a
760 * #GNUNET_CRYPTO_EcdhePublicKey which is required for decryption
761 * using ecdh to derive a symmetric key.
762 *
763 * Note that the result buffer for the ciphertext must be the length of
764 * the message to encrypt plus #GNUNET_IDENTITY_ENCRYPT_OVERHEAD_BYTES.
765 *
766 * @param block the block to encrypt
767 * @param size the size of the @a block
768 * @param pub public key to encrypt for
769 * @param result the output parameter in which to store the encrypted result
770 * can be the same or overlap with @c block
771 * @returns GNUNET_OK on success.
772 */
773enum GNUNET_GenericReturnValue
774GNUNET_IDENTITY_encrypt (const void *block,
775 size_t size,
776 const struct GNUNET_IDENTITY_PublicKey *pub,
777 void *result,
778 size_t result_size);
779
780
781/**
782 * Decrypt a given block with #GNUNET_IDENTITY_PrivateKey and a given
783 * #GNUNET_CRYPTO_EcdhePublicKey using ecdh to derive a symmetric key.
784 *
785 * @param block the data to decrypt, encoded as returned by encrypt
786 * @param size the size of the @a block to decrypt
787 * @param priv private key to use for ecdh
788 * @param result address to store the result at
789 * can be the same or overlap with @c block
790 * @returns GNUNET_OK on success.
791 */
792enum GNUNET_GenericReturnValue
793GNUNET_IDENTITY_decrypt (const void *block,
794 size_t size,
795 const struct GNUNET_IDENTITY_PrivateKey *priv,
796 void *result,
797 size_t result_size);
798
799
800/**
801 * Creates a (Base32) string representation of the public key.
802 * The resulting string encodes a compacted representation of the key.
803 * See also #GNUNET_IDENTITY_key_get_length.
804 *
805 * @param key the key.
806 * @return the string representation of the key, or NULL on error.
807 */
808char *
809GNUNET_IDENTITY_public_key_to_string (
810 const struct GNUNET_IDENTITY_PublicKey *key);
811
812
813/**
814 * Creates a (Base32) string representation of the private key.
815 * The resulting string encodes a compacted representation of the key.
816 * See also #GNUNET_IDENTITY_key_get_length.
817 *
818 * @param key the key.
819 * @return the string representation of the key, or NULL on error.
820 */
821char *
822GNUNET_IDENTITY_private_key_to_string (
823 const struct GNUNET_IDENTITY_PrivateKey *key);
824
825
826/**
827 * Parses a (Base32) string representation of the public key.
828 * See also #GNUNET_IDENTITY_public_key_to_string.
829 *
830 * @param str the encoded key.
831 * @param key where to write the key.
832 * @return GNUNET_SYSERR on error.
833 */
834enum GNUNET_GenericReturnValue
835GNUNET_IDENTITY_public_key_from_string (const char*str,
836 struct GNUNET_IDENTITY_PublicKey *key);
837
838
839/**
840 * Parses a (Base32) string representation of the private key.
841 * See also #GNUNET_IDENTITY_private_key_to_string.
842 *
843 * @param str the encoded key.
844 * @param key where to write the key.
845 * @return GNUNET_SYSERR on error.
846 */
847enum GNUNET_GenericReturnValue
848GNUNET_IDENTITY_private_key_from_string (const char*str,
849 struct GNUNET_IDENTITY_PrivateKey *key);
850
851
852/**
853 * Retrieves the public key representation of a private key.
854 *
855 * @param privkey the private key.
856 * @param key the public key result.
857 * @return GNUNET_SYSERR on error.
858 */
859enum GNUNET_GenericReturnValue
860GNUNET_IDENTITY_key_get_public (const struct
861 GNUNET_IDENTITY_PrivateKey *privkey,
862 struct GNUNET_IDENTITY_PublicKey *key);
863
864
865/* ************* convenience API to lookup an ego ***************** */ 302/* ************* convenience API to lookup an ego ***************** */
866 303
867/** 304/**
@@ -914,7 +351,7 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el);
914typedef void 351typedef void
915(*GNUNET_IDENTITY_EgoSuffixCallback) ( 352(*GNUNET_IDENTITY_EgoSuffixCallback) (
916 void *cls, 353 void *cls,
917 const struct GNUNET_IDENTITY_PrivateKey *priv, 354 const struct GNUNET_CRYPTO_PrivateKey *priv,
918 const char *ego_name); 355 const char *ego_name);
919 356
920 357
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 26c68fed3..c3204026b 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -291,6 +291,17 @@ GNUNET_JSON_spec_bool (const char *name,
291 291
292 292
293/** 293/**
294 * double.
295 *
296 * @param name name of the JSON field
297 * @param[out] f where to store the double found under @a name
298 */
299struct GNUNET_JSON_Specification
300GNUNET_JSON_spec_double (const char *name,
301 double *f);
302
303
304/**
294 * 8-bit integer. 305 * 8-bit integer.
295 * 306 *
296 * @param name name of the JSON field 307 * @param name name of the JSON field
@@ -704,6 +715,19 @@ GNUNET_JSON_pack_bool (const char *name,
704 715
705/** 716/**
706 * Generate packer instruction for a JSON field of type 717 * Generate packer instruction for a JSON field of type
718 * double.
719 *
720 * @param name name of the field to add to the object
721 * @param f double value
722 * @return json pack specification
723 */
724struct GNUNET_JSON_PackSpec
725GNUNET_JSON_pack_double (const char *name,
726 double f);
727
728
729/**
730 * Generate packer instruction for a JSON field of type
707 * string. 731 * string.
708 * 732 *
709 * @param name name of the field to add to the object 733 * @param name name of the field to add to the object
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index 5f4207d2f..90004826a 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -224,7 +224,7 @@ struct GNUNET_MESSENGER_MessageHeader
224 /** 224 /**
225 * The signature of the senders private key. 225 * The signature of the senders private key.
226 */ 226 */
227 struct GNUNET_IDENTITY_Signature signature; 227 struct GNUNET_CRYPTO_Signature signature;
228 228
229 /** 229 /**
230 * The timestamp of the message. 230 * The timestamp of the message.
@@ -258,7 +258,7 @@ struct GNUNET_MESSENGER_MessageInfo
258 /** 258 /**
259 * The senders key to verify its signatures. 259 * The senders key to verify its signatures.
260 */ 260 */
261 struct GNUNET_IDENTITY_PublicKey host_key; 261 struct GNUNET_CRYPTO_PublicKey host_key;
262 262
263 /** 263 /**
264 * The version of GNUnet Messenger API. 264 * The version of GNUnet Messenger API.
@@ -281,7 +281,7 @@ struct GNUNET_MESSENGER_MessageJoin
281 /** 281 /**
282 * The senders public key to verify its signatures. 282 * The senders public key to verify its signatures.
283 */ 283 */
284 struct GNUNET_IDENTITY_PublicKey key; 284 struct GNUNET_CRYPTO_PublicKey key;
285}; 285};
286 286
287/** 287/**
@@ -319,7 +319,7 @@ struct GNUNET_MESSENGER_MessageKey
319 /** 319 /**
320 * The new public key which replaces the current senders public key. 320 * The new public key which replaces the current senders public key.
321 */ 321 */
322 struct GNUNET_IDENTITY_PublicKey key; 322 struct GNUNET_CRYPTO_PublicKey key;
323}; 323};
324 324
325/** 325/**
@@ -671,7 +671,7 @@ GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle,
671 * @param[in] handle Messenger handle to use 671 * @param[in] handle Messenger handle to use
672 * @return Used ego's public key or NULL 672 * @return Used ego's public key or NULL
673 */ 673 */
674const struct GNUNET_IDENTITY_PublicKey* 674const struct GNUNET_CRYPTO_PublicKey*
675GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); 675GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle);
676 676
677/** 677/**
@@ -783,7 +783,7 @@ GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contac
783 * @param[in] contact Contact handle 783 * @param[in] contact Contact handle
784 * @return Public key of the ego used by <i>contact</i> or NULL 784 * @return Public key of the ego used by <i>contact</i> or NULL
785 */ 785 */
786const struct GNUNET_IDENTITY_PublicKey* 786const struct GNUNET_CRYPTO_PublicKey*
787GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact); 787GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact);
788 788
789/** 789/**
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h
index f2bdf7cc6..d8dde5af5 100644
--- a/src/include/gnunet_namestore_plugin.h
+++ b/src/include/gnunet_namestore_plugin.h
@@ -62,7 +62,7 @@ typedef void
62(*GNUNET_NAMESTORE_RecordIterator) (void *cls, 62(*GNUNET_NAMESTORE_RecordIterator) (void *cls,
63 uint64_t serial, 63 uint64_t serial,
64 const struct 64 const struct
65 GNUNET_IDENTITY_PrivateKey *private_key, 65 GNUNET_CRYPTO_PrivateKey *private_key,
66 const char *label, 66 const char *label,
67 unsigned int rd_count, 67 unsigned int rd_count,
68 const struct GNUNET_GNSRECORD_Data *rd); 68 const struct GNUNET_GNSRECORD_Data *rd);
@@ -91,7 +91,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
91 */ 91 */
92 enum GNUNET_GenericReturnValue 92 enum GNUNET_GenericReturnValue
93 (*store_records)(void *cls, 93 (*store_records)(void *cls,
94 const struct GNUNET_IDENTITY_PrivateKey *zone, 94 const struct GNUNET_CRYPTO_PrivateKey *zone,
95 const char *label, 95 const char *label,
96 unsigned int rd_count, 96 unsigned int rd_count,
97 const struct GNUNET_GNSRECORD_Data *rd); 97 const struct GNUNET_GNSRECORD_Data *rd);
@@ -108,7 +108,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
108 */ 108 */
109 enum GNUNET_GenericReturnValue 109 enum GNUNET_GenericReturnValue
110 (*lookup_records)(void *cls, 110 (*lookup_records)(void *cls,
111 const struct GNUNET_IDENTITY_PrivateKey *zone, 111 const struct GNUNET_CRYPTO_PrivateKey *zone,
112 const char *label, 112 const char *label,
113 GNUNET_NAMESTORE_RecordIterator iter, 113 GNUNET_NAMESTORE_RecordIterator iter,
114 void *iter_cls); 114 void *iter_cls);
@@ -130,7 +130,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
130 */ 130 */
131 enum GNUNET_GenericReturnValue 131 enum GNUNET_GenericReturnValue
132 (*iterate_records)(void *cls, 132 (*iterate_records)(void *cls,
133 const struct GNUNET_IDENTITY_PrivateKey *zone, 133 const struct GNUNET_CRYPTO_PrivateKey *zone,
134 uint64_t serial, 134 uint64_t serial,
135 uint64_t limit, 135 uint64_t limit,
136 GNUNET_NAMESTORE_RecordIterator iter, 136 GNUNET_NAMESTORE_RecordIterator iter,
@@ -150,8 +150,8 @@ struct GNUNET_NAMESTORE_PluginFunctions
150 */ 150 */
151 enum GNUNET_GenericReturnValue 151 enum GNUNET_GenericReturnValue
152 (*zone_to_name)(void *cls, 152 (*zone_to_name)(void *cls,
153 const struct GNUNET_IDENTITY_PrivateKey *zone, 153 const struct GNUNET_CRYPTO_PrivateKey *zone,
154 const struct GNUNET_IDENTITY_PublicKey *value_zone, 154 const struct GNUNET_CRYPTO_PublicKey *value_zone,
155 GNUNET_NAMESTORE_RecordIterator iter, 155 GNUNET_NAMESTORE_RecordIterator iter,
156 void *iter_cls); 156 void *iter_cls);
157 157
@@ -201,7 +201,7 @@ struct GNUNET_NAMESTORE_PluginFunctions
201 */ 201 */
202 enum GNUNET_GenericReturnValue 202 enum GNUNET_GenericReturnValue
203 (*edit_records)(void *cls, 203 (*edit_records)(void *cls,
204 const struct GNUNET_IDENTITY_PrivateKey *zone, 204 const struct GNUNET_CRYPTO_PrivateKey *zone,
205 const char *label, 205 const char *label,
206 GNUNET_NAMESTORE_RecordIterator iter, 206 GNUNET_NAMESTORE_RecordIterator iter,
207 void *iter_cls); 207 void *iter_cls);
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index b93a345c7..61691ff55 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -153,7 +153,7 @@ typedef void
153 */ 153 */
154struct GNUNET_NAMESTORE_QueueEntry * 154struct GNUNET_NAMESTORE_QueueEntry *
155GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, 155GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
156 const struct GNUNET_IDENTITY_PrivateKey *pkey, 156 const struct GNUNET_CRYPTO_PrivateKey *pkey,
157 const char *label, 157 const char *label,
158 unsigned int rd_count, 158 unsigned int rd_count,
159 const struct GNUNET_GNSRECORD_Data *rd, 159 const struct GNUNET_GNSRECORD_Data *rd,
@@ -187,7 +187,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
187struct GNUNET_NAMESTORE_QueueEntry * 187struct GNUNET_NAMESTORE_QueueEntry *
188GNUNET_NAMESTORE_records_store2 ( 188GNUNET_NAMESTORE_records_store2 (
189 struct GNUNET_NAMESTORE_Handle *h, 189 struct GNUNET_NAMESTORE_Handle *h,
190 const struct GNUNET_IDENTITY_PrivateKey *pkey, 190 const struct GNUNET_CRYPTO_PrivateKey *pkey,
191 unsigned int rd_set_count, 191 unsigned int rd_set_count,
192 const struct GNUNET_NAMESTORE_RecordInfo *record_info, 192 const struct GNUNET_NAMESTORE_RecordInfo *record_info,
193 unsigned int *rds_sent, 193 unsigned int *rds_sent,
@@ -217,7 +217,7 @@ GNUNET_NAMESTORE_records_store2 (
217 */ 217 */
218struct GNUNET_NAMESTORE_QueueEntry * 218struct GNUNET_NAMESTORE_QueueEntry *
219GNUNET_NAMESTORE_records_store_ (struct GNUNET_NAMESTORE_Handle *h, 219GNUNET_NAMESTORE_records_store_ (struct GNUNET_NAMESTORE_Handle *h,
220 const struct GNUNET_IDENTITY_PrivateKey *pkey, 220 const struct GNUNET_CRYPTO_PrivateKey *pkey,
221 const char *label, 221 const char *label,
222 unsigned int rd_count, 222 unsigned int rd_count,
223 const struct GNUNET_GNSRECORD_Data *rd, 223 const struct GNUNET_GNSRECORD_Data *rd,
@@ -240,7 +240,7 @@ GNUNET_NAMESTORE_records_store_ (struct GNUNET_NAMESTORE_Handle *h,
240typedef void 240typedef void
241(*GNUNET_NAMESTORE_RecordMonitor) (void *cls, 241(*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
242 const struct 242 const struct
243 GNUNET_IDENTITY_PrivateKey *zone, 243 GNUNET_CRYPTO_PrivateKey *zone,
244 const char *label, 244 const char *label,
245 unsigned int rd_count, 245 unsigned int rd_count,
246 const struct GNUNET_GNSRECORD_Data *rd); 246 const struct GNUNET_GNSRECORD_Data *rd);
@@ -260,7 +260,7 @@ typedef void
260typedef void 260typedef void
261(*GNUNET_NAMESTORE_RecordSetMonitor) (void *cls, 261(*GNUNET_NAMESTORE_RecordSetMonitor) (void *cls,
262 const struct 262 const struct
263 GNUNET_IDENTITY_PrivateKey *zone, 263 GNUNET_CRYPTO_PrivateKey *zone,
264 const char *label, 264 const char *label,
265 unsigned int rd_count, 265 unsigned int rd_count,
266 const struct GNUNET_GNSRECORD_Data *rd, 266 const struct GNUNET_GNSRECORD_Data *rd,
@@ -284,7 +284,7 @@ typedef void
284struct GNUNET_NAMESTORE_QueueEntry * 284struct GNUNET_NAMESTORE_QueueEntry *
285GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, 285GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
286 const struct 286 const struct
287 GNUNET_IDENTITY_PrivateKey *pkey, 287 GNUNET_CRYPTO_PrivateKey *pkey,
288 const char *label, 288 const char *label,
289 GNUNET_SCHEDULER_TaskCallback error_cb, 289 GNUNET_SCHEDULER_TaskCallback error_cb,
290 void *error_cb_cls, 290 void *error_cb_cls,
@@ -309,7 +309,7 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h,
309struct GNUNET_NAMESTORE_QueueEntry * 309struct GNUNET_NAMESTORE_QueueEntry *
310GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h, 310GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h,
311 const struct 311 const struct
312 GNUNET_IDENTITY_PrivateKey *pkey, 312 GNUNET_CRYPTO_PrivateKey *pkey,
313 const char *label, 313 const char *label,
314 GNUNET_SCHEDULER_TaskCallback error_cb, 314 GNUNET_SCHEDULER_TaskCallback error_cb,
315 void *error_cb_cls, 315 void *error_cb_cls,
@@ -338,9 +338,9 @@ GNUNET_NAMESTORE_records_lookup2 (struct GNUNET_NAMESTORE_Handle *h,
338 */ 338 */
339struct GNUNET_NAMESTORE_QueueEntry * 339struct GNUNET_NAMESTORE_QueueEntry *
340GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, 340GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
341 const struct GNUNET_IDENTITY_PrivateKey *zone, 341 const struct GNUNET_CRYPTO_PrivateKey *zone,
342 const struct 342 const struct
343 GNUNET_IDENTITY_PublicKey *value_zone, 343 GNUNET_CRYPTO_PublicKey *value_zone,
344 GNUNET_SCHEDULER_TaskCallback error_cb, 344 GNUNET_SCHEDULER_TaskCallback error_cb,
345 void *error_cb_cls, 345 void *error_cb_cls,
346 GNUNET_NAMESTORE_RecordMonitor proc, 346 GNUNET_NAMESTORE_RecordMonitor proc,
@@ -390,7 +390,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe);
390struct GNUNET_NAMESTORE_ZoneIterator * 390struct GNUNET_NAMESTORE_ZoneIterator *
391GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, 391GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
392 const struct 392 const struct
393 GNUNET_IDENTITY_PrivateKey *zone, 393 GNUNET_CRYPTO_PrivateKey *zone,
394 GNUNET_SCHEDULER_TaskCallback error_cb, 394 GNUNET_SCHEDULER_TaskCallback error_cb,
395 void *error_cb_cls, 395 void *error_cb_cls,
396 GNUNET_NAMESTORE_RecordMonitor proc, 396 GNUNET_NAMESTORE_RecordMonitor proc,
@@ -427,7 +427,7 @@ GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
427struct GNUNET_NAMESTORE_ZoneIterator * 427struct GNUNET_NAMESTORE_ZoneIterator *
428GNUNET_NAMESTORE_zone_iteration_start2 (struct GNUNET_NAMESTORE_Handle *h, 428GNUNET_NAMESTORE_zone_iteration_start2 (struct GNUNET_NAMESTORE_Handle *h,
429 const struct 429 const struct
430 GNUNET_IDENTITY_PrivateKey *zone, 430 GNUNET_CRYPTO_PrivateKey *zone,
431 GNUNET_SCHEDULER_TaskCallback error_cb, 431 GNUNET_SCHEDULER_TaskCallback error_cb,
432 void *error_cb_cls, 432 void *error_cb_cls,
433 GNUNET_NAMESTORE_RecordSetMonitor proc, 433 GNUNET_NAMESTORE_RecordSetMonitor proc,
@@ -501,7 +501,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor;
501struct GNUNET_NAMESTORE_ZoneMonitor * 501struct GNUNET_NAMESTORE_ZoneMonitor *
502GNUNET_NAMESTORE_zone_monitor_start ( 502GNUNET_NAMESTORE_zone_monitor_start (
503 const struct GNUNET_CONFIGURATION_Handle *cfg, 503 const struct GNUNET_CONFIGURATION_Handle *cfg,
504 const struct GNUNET_IDENTITY_PrivateKey *zone, 504 const struct GNUNET_CRYPTO_PrivateKey *zone,
505 int iterate_first, 505 int iterate_first,
506 GNUNET_SCHEDULER_TaskCallback error_cb, 506 GNUNET_SCHEDULER_TaskCallback error_cb,
507 void *error_cb_cls, 507 void *error_cb_cls,
@@ -541,7 +541,7 @@ GNUNET_NAMESTORE_zone_monitor_start (
541struct GNUNET_NAMESTORE_ZoneMonitor * 541struct GNUNET_NAMESTORE_ZoneMonitor *
542GNUNET_NAMESTORE_zone_monitor_start2 ( 542GNUNET_NAMESTORE_zone_monitor_start2 (
543 const struct GNUNET_CONFIGURATION_Handle *cfg, 543 const struct GNUNET_CONFIGURATION_Handle *cfg,
544 const struct GNUNET_IDENTITY_PrivateKey *zone, 544 const struct GNUNET_CRYPTO_PrivateKey *zone,
545 int iterate_first, 545 int iterate_first,
546 GNUNET_SCHEDULER_TaskCallback error_cb, 546 GNUNET_SCHEDULER_TaskCallback error_cb,
547 void *error_cb_cls, 547 void *error_cb_cls,
@@ -637,7 +637,7 @@ GNUNET_NAMESTORE_transaction_commit (struct GNUNET_NAMESTORE_Handle *h,
637struct GNUNET_NAMESTORE_QueueEntry * 637struct GNUNET_NAMESTORE_QueueEntry *
638GNUNET_NAMESTORE_records_edit ( 638GNUNET_NAMESTORE_records_edit (
639 struct GNUNET_NAMESTORE_Handle *h, 639 struct GNUNET_NAMESTORE_Handle *h,
640 const struct GNUNET_IDENTITY_PrivateKey *pkey, 640 const struct GNUNET_CRYPTO_PrivateKey *pkey,
641 const char *label, 641 const char *label,
642 GNUNET_SCHEDULER_TaskCallback error_cb, 642 GNUNET_SCHEDULER_TaskCallback error_cb,
643 void *error_cb_cls, 643 void *error_cb_cls,
diff --git a/src/include/gnunet_nt_lib.h b/src/include/gnunet_nt_lib.h
index 144a3daa3..014b4fbe0 100644
--- a/src/include/gnunet_nt_lib.h
+++ b/src/include/gnunet_nt_lib.h
@@ -17,6 +17,11 @@
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19 */ 19 */
20
21#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
22#error "Only <gnunet_util_lib.h> can be included directly."
23#endif
24
20/** 25/**
21 * @addtogroup Backbone 26 * @addtogroup Backbone
22 * @{ 27 * @{
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index 49a006e91..a8ab8776e 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -74,12 +74,12 @@ struct GNUNET_RECLAIM_Ticket
74 /** 74 /**
75 * The ticket issuer (= the user) 75 * The ticket issuer (= the user)
76 */ 76 */
77 struct GNUNET_IDENTITY_PublicKey identity; 77 struct GNUNET_CRYPTO_PublicKey identity;
78 78
79 /** 79 /**
80 * The ticket audience (= relying party) 80 * The ticket audience (= relying party)
81 */ 81 */
82 struct GNUNET_IDENTITY_PublicKey audience; 82 struct GNUNET_CRYPTO_PublicKey audience;
83 83
84 /** 84 /**
85 * The ticket random identifier 85 * The ticket random identifier
@@ -134,7 +134,7 @@ typedef void (*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
134 * @param attr The attribute 134 * @param attr The attribute
135 */ 135 */
136typedef void (*GNUNET_RECLAIM_AttributeResult) ( 136typedef void (*GNUNET_RECLAIM_AttributeResult) (
137 void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, 137 void *cls, const struct GNUNET_CRYPTO_PublicKey *identity,
138 const struct GNUNET_RECLAIM_Attribute *attr); 138 const struct GNUNET_RECLAIM_Attribute *attr);
139 139
140/** 140/**
@@ -146,7 +146,7 @@ typedef void (*GNUNET_RECLAIM_AttributeResult) (
146 * @param presentation The presentation for the credential (may be NULL) 146 * @param presentation The presentation for the credential (may be NULL)
147 */ 147 */
148typedef void (*GNUNET_RECLAIM_AttributeTicketResult) ( 148typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
149 void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, 149 void *cls, const struct GNUNET_CRYPTO_PublicKey *identity,
150 const struct GNUNET_RECLAIM_Attribute *attr, 150 const struct GNUNET_RECLAIM_Attribute *attr,
151 const struct GNUNET_RECLAIM_Presentation *presentation); 151 const struct GNUNET_RECLAIM_Presentation *presentation);
152 152
@@ -160,7 +160,7 @@ typedef void (*GNUNET_RECLAIM_AttributeTicketResult) (
160 * @param attributes the parsed attributes 160 * @param attributes the parsed attributes
161 */ 161 */
162typedef void (*GNUNET_RECLAIM_CredentialResult) ( 162typedef void (*GNUNET_RECLAIM_CredentialResult) (
163 void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, 163 void *cls, const struct GNUNET_CRYPTO_PublicKey *identity,
164 const struct GNUNET_RECLAIM_Credential *credential); 164 const struct GNUNET_RECLAIM_Credential *credential);
165 165
166 166
@@ -189,7 +189,7 @@ GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
189struct GNUNET_RECLAIM_Operation * 189struct GNUNET_RECLAIM_Operation *
190GNUNET_RECLAIM_attribute_store ( 190GNUNET_RECLAIM_attribute_store (
191 struct GNUNET_RECLAIM_Handle *h, 191 struct GNUNET_RECLAIM_Handle *h,
192 const struct GNUNET_IDENTITY_PrivateKey *pkey, 192 const struct GNUNET_CRYPTO_PrivateKey *pkey,
193 const struct GNUNET_RECLAIM_Attribute *attr, 193 const struct GNUNET_RECLAIM_Attribute *attr,
194 const struct GNUNET_TIME_Relative *exp_interval, 194 const struct GNUNET_TIME_Relative *exp_interval,
195 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 195 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
@@ -210,7 +210,7 @@ GNUNET_RECLAIM_attribute_store (
210struct GNUNET_RECLAIM_Operation * 210struct GNUNET_RECLAIM_Operation *
211GNUNET_RECLAIM_credential_store ( 211GNUNET_RECLAIM_credential_store (
212 struct GNUNET_RECLAIM_Handle *h, 212 struct GNUNET_RECLAIM_Handle *h,
213 const struct GNUNET_IDENTITY_PrivateKey *pkey, 213 const struct GNUNET_CRYPTO_PrivateKey *pkey,
214 const struct GNUNET_RECLAIM_Credential *credential, 214 const struct GNUNET_RECLAIM_Credential *credential,
215 const struct GNUNET_TIME_Relative *exp_interval, 215 const struct GNUNET_TIME_Relative *exp_interval,
216 GNUNET_RECLAIM_ContinuationWithStatus cont, 216 GNUNET_RECLAIM_ContinuationWithStatus cont,
@@ -231,7 +231,7 @@ GNUNET_RECLAIM_credential_store (
231struct GNUNET_RECLAIM_Operation * 231struct GNUNET_RECLAIM_Operation *
232GNUNET_RECLAIM_attribute_delete ( 232GNUNET_RECLAIM_attribute_delete (
233 struct GNUNET_RECLAIM_Handle *h, 233 struct GNUNET_RECLAIM_Handle *h,
234 const struct GNUNET_IDENTITY_PrivateKey *pkey, 234 const struct GNUNET_CRYPTO_PrivateKey *pkey,
235 const struct GNUNET_RECLAIM_Attribute *attr, 235 const struct GNUNET_RECLAIM_Attribute *attr,
236 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls); 236 GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls);
237 237
@@ -249,7 +249,7 @@ GNUNET_RECLAIM_attribute_delete (
249struct GNUNET_RECLAIM_Operation * 249struct GNUNET_RECLAIM_Operation *
250GNUNET_RECLAIM_credential_delete ( 250GNUNET_RECLAIM_credential_delete (
251 struct GNUNET_RECLAIM_Handle *h, 251 struct GNUNET_RECLAIM_Handle *h,
252 const struct GNUNET_IDENTITY_PrivateKey *pkey, 252 const struct GNUNET_CRYPTO_PrivateKey *pkey,
253 const struct GNUNET_RECLAIM_Credential *cred, 253 const struct GNUNET_RECLAIM_Credential *cred,
254 GNUNET_RECLAIM_ContinuationWithStatus cont, 254 GNUNET_RECLAIM_ContinuationWithStatus cont,
255 void *cont_cls); 255 void *cont_cls);
@@ -281,7 +281,7 @@ GNUNET_RECLAIM_credential_delete (
281struct GNUNET_RECLAIM_AttributeIterator * 281struct GNUNET_RECLAIM_AttributeIterator *
282GNUNET_RECLAIM_get_attributes_start ( 282GNUNET_RECLAIM_get_attributes_start (
283 struct GNUNET_RECLAIM_Handle *h, 283 struct GNUNET_RECLAIM_Handle *h,
284 const struct GNUNET_IDENTITY_PrivateKey *identity, 284 const struct GNUNET_CRYPTO_PrivateKey *identity,
285 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, 285 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
286 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, 286 GNUNET_RECLAIM_AttributeResult proc, void *proc_cls,
287 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); 287 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
@@ -337,7 +337,7 @@ GNUNET_RECLAIM_get_attributes_stop (
337struct GNUNET_RECLAIM_CredentialIterator * 337struct GNUNET_RECLAIM_CredentialIterator *
338GNUNET_RECLAIM_get_credentials_start ( 338GNUNET_RECLAIM_get_credentials_start (
339 struct GNUNET_RECLAIM_Handle *h, 339 struct GNUNET_RECLAIM_Handle *h,
340 const struct GNUNET_IDENTITY_PrivateKey *identity, 340 const struct GNUNET_CRYPTO_PrivateKey *identity,
341 GNUNET_SCHEDULER_TaskCallback error_cb, 341 GNUNET_SCHEDULER_TaskCallback error_cb,
342 void *error_cb_cls, 342 void *error_cb_cls,
343 GNUNET_RECLAIM_CredentialResult proc, 343 GNUNET_RECLAIM_CredentialResult proc,
@@ -385,8 +385,8 @@ GNUNET_RECLAIM_get_credentials_stop (
385struct GNUNET_RECLAIM_Operation * 385struct GNUNET_RECLAIM_Operation *
386GNUNET_RECLAIM_ticket_issue ( 386GNUNET_RECLAIM_ticket_issue (
387 struct GNUNET_RECLAIM_Handle *h, 387 struct GNUNET_RECLAIM_Handle *h,
388 const struct GNUNET_IDENTITY_PrivateKey *iss, 388 const struct GNUNET_CRYPTO_PrivateKey *iss,
389 const struct GNUNET_IDENTITY_PublicKey *rp, 389 const struct GNUNET_CRYPTO_PublicKey *rp,
390 const struct GNUNET_RECLAIM_AttributeList *attrs, 390 const struct GNUNET_RECLAIM_AttributeList *attrs,
391 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); 391 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls);
392 392
@@ -407,7 +407,7 @@ GNUNET_RECLAIM_ticket_issue (
407struct GNUNET_RECLAIM_Operation * 407struct GNUNET_RECLAIM_Operation *
408GNUNET_RECLAIM_ticket_revoke ( 408GNUNET_RECLAIM_ticket_revoke (
409 struct GNUNET_RECLAIM_Handle *h, 409 struct GNUNET_RECLAIM_Handle *h,
410 const struct GNUNET_IDENTITY_PrivateKey *identity, 410 const struct GNUNET_CRYPTO_PrivateKey *identity,
411 const struct GNUNET_RECLAIM_Ticket *ticket, 411 const struct GNUNET_RECLAIM_Ticket *ticket,
412 GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls); 412 GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls);
413 413
@@ -427,7 +427,7 @@ GNUNET_RECLAIM_ticket_revoke (
427struct GNUNET_RECLAIM_Operation * 427struct GNUNET_RECLAIM_Operation *
428GNUNET_RECLAIM_ticket_consume ( 428GNUNET_RECLAIM_ticket_consume (
429 struct GNUNET_RECLAIM_Handle *h, 429 struct GNUNET_RECLAIM_Handle *h,
430 const struct GNUNET_IDENTITY_PrivateKey *identity, 430 const struct GNUNET_CRYPTO_PrivateKey *identity,
431 const struct GNUNET_RECLAIM_Ticket *ticket, 431 const struct GNUNET_RECLAIM_Ticket *ticket,
432 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); 432 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls);
433 433
@@ -452,7 +452,7 @@ GNUNET_RECLAIM_ticket_consume (
452struct GNUNET_RECLAIM_TicketIterator * 452struct GNUNET_RECLAIM_TicketIterator *
453GNUNET_RECLAIM_ticket_iteration_start ( 453GNUNET_RECLAIM_ticket_iteration_start (
454 struct GNUNET_RECLAIM_Handle *h, 454 struct GNUNET_RECLAIM_Handle *h,
455 const struct GNUNET_IDENTITY_PrivateKey *identity, 455 const struct GNUNET_CRYPTO_PrivateKey *identity,
456 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, 456 GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls,
457 GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, 457 GNUNET_RECLAIM_TicketCallback proc, void *proc_cls,
458 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls); 458 GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls);
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h
index 81a90189b..de5eedbb9 100644
--- a/src/include/gnunet_revocation_service.h
+++ b/src/include/gnunet_revocation_service.h
@@ -60,7 +60,7 @@ extern "C"
60 * Maximum length of a revocation 60 * Maximum length of a revocation
61 */ 61 */
62#define GNUNET_REVOCATION_MAX_PROOF_SIZE sizeof(struct GNUNET_REVOCATION_PowP) +\ 62#define GNUNET_REVOCATION_MAX_PROOF_SIZE sizeof(struct GNUNET_REVOCATION_PowP) +\
63 sizeof(struct GNUNET_IDENTITY_PublicKey) +\ 63 sizeof(struct GNUNET_CRYPTO_PublicKey) +\
64 1024 //FIXME max sig_len 64 1024 //FIXME max sig_len
65 65
66/** 66/**
@@ -152,7 +152,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls,
152 */ 152 */
153struct GNUNET_REVOCATION_Query * 153struct GNUNET_REVOCATION_Query *
154GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, 154GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg,
155 const struct GNUNET_IDENTITY_PublicKey *key, 155 const struct GNUNET_CRYPTO_PublicKey *key,
156 GNUNET_REVOCATION_Callback func, void *func_cls); 156 GNUNET_REVOCATION_Callback func, void *func_cls);
157 157
158 158
@@ -219,7 +219,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
219 * @param pow the pow object to work with in the calculation. 219 * @param pow the pow object to work with in the calculation.
220 */ 220 */
221void 221void
222GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key, 222GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_PrivateKey *key,
223 struct GNUNET_REVOCATION_PowP *pow); 223 struct GNUNET_REVOCATION_PowP *pow);
224 224
225 225
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h
index 3ebfae581..0ad4fcc3c 100644
--- a/src/include/gnunet_service_lib.h
+++ b/src/include/gnunet_service_lib.h
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21 21
22#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) 22#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
23#error "Only <gnunet_util_lib.h> can be included directly." 23#error "Only <gnunet_util_lib.h> can be included directly."
24#endif 24#endif
25 25
@@ -203,7 +203,6 @@ GNUNET_SERVICE_start (const char *service_name,
203void 203void
204GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv); 204GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv);
205 205
206
207/** 206/**
208 * Creates the "main" function for a GNUnet service. You 207 * Creates the "main" function for a GNUnet service. You
209 * should almost always use the #GNUNET_SERVICE_MAIN macro 208 * should almost always use the #GNUNET_SERVICE_MAIN macro
@@ -258,6 +257,56 @@ GNUNET_SERVICE_run_ (int argc,
258 257
259 258
260/** 259/**
260 * Registers the GNUnet service to be scheduled as part of a monilithic
261 * libgnunet.
262 * You should almost always use the #GNUNET_SERVICE_MAIN macro
263 * instead of calling this function directly.
264 *
265 * The function will launch the service with the name @a service_name
266 * using the @a service_options to configure its shutdown
267 * behavior. Once the service is ready, the @a init_cb will be called
268 * for service-specific initialization. @a init_cb will be given the
269 * service handler which can be used to control the service's
270 * availability. When clients connect or disconnect, the respective
271 * @a connect_cb or @a disconnect_cb functions will be called. For
272 * messages received from the clients, the respective @a handlers will
273 * be invoked; for the closure of the handlers we use the return value
274 * from the @a connect_cb invocation of the respective client.
275 *
276 * Each handler MUST call #GNUNET_SERVICE_client_continue() after each
277 * message to receive further messages from this client. If
278 * #GNUNET_SERVICE_client_continue() is not called within a short
279 * time, a warning will be logged. If delays are expected, services
280 * should call #GNUNET_SERVICE_client_disable_continue_warning() to
281 * disable the warning.
282 *
283 * Clients sending invalid messages (based on @a handlers) will be
284 * dropped. Additionally, clients can be dropped at any time using
285 * #GNUNET_SERVICE_client_drop().
286 *
287 * @param service_name name of the service to run
288 * @param options options controlling shutdown of the service
289 * @param service_init_cb function to call once the service is ready
290 * @param connect_cb function to call whenever a client connects
291 * @param disconnect_cb function to call whenever a client disconnects
292 * @param cls closure argument for @a service_init_cb, @a connect_cb and @a disconnect_cb
293 * @param handlers NULL-terminated array of message handlers for the service,
294 * the closure will be set to the value returned by
295 * the @a connect_cb for the respective connection
296 * @return 0 on success, non-zero on error
297 */
298int
299GNUNET_SERVICE_register_ (
300 const char *service_name,
301 enum GNUNET_SERVICE_Options options,
302 GNUNET_SERVICE_InitCallback service_init_cb,
303 GNUNET_SERVICE_ConnectHandler connect_cb,
304 GNUNET_SERVICE_DisconnectHandler disconnect_cb,
305 void *cls,
306 const struct GNUNET_MQ_MessageHandler *handlers);
307
308
309/**
261 * Creates the "main" function for a GNUnet service. You 310 * Creates the "main" function for a GNUnet service. You
262 * MUST use this macro to define GNUnet services (except 311 * MUST use this macro to define GNUnet services (except
263 * for ARM, which MUST NOT use the macro). The reason is 312 * for ARM, which MUST NOT use the macro). The reason is
@@ -317,29 +366,50 @@ GNUNET_SERVICE_run_ (int argc,
317#ifndef HAVE_GNUNET_MONOLITH 366#ifndef HAVE_GNUNET_MONOLITH
318#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, \ 367#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, \
319 disconnect_cb, cls, ...) \ 368 disconnect_cb, cls, ...) \
320 int \ 369 int \
321 main (int argc, \ 370 main (int argc, \
322 char *const *argv) \ 371 char *const *argv) \
323 { \ 372 { \
324 struct GNUNET_MQ_MessageHandler mh[] = { \ 373 struct GNUNET_MQ_MessageHandler mh[] = { \
325 __VA_ARGS__ \ 374 __VA_ARGS__ \
326 }; \ 375 }; \
327 return GNUNET_SERVICE_run_ (argc, \ 376 return GNUNET_SERVICE_run_ (argc, \
328 argv, \ 377 argv, \
329 service_name, \ 378 service_name, \
330 service_options, \ 379 service_options, \
331 init_cb, \ 380 init_cb, \
332 connect_cb, \ 381 connect_cb, \
333 disconnect_cb, \ 382 disconnect_cb, \
334 cls, \ 383 cls, \
335 mh); \ 384 mh); \
336 } 385 }
337#else 386#else
338#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, \ 387#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, \
339 disconnect_cb, cls, ...) 388 disconnect_cb, cls, ...) \
389 static int __attribute__ ((constructor)) \
390 init (void) \
391 { \
392 struct GNUNET_MQ_MessageHandler mh[] = { \
393 __VA_ARGS__ \
394 }; \
395 return GNUNET_SERVICE_register_ (service_name, \
396 service_options, \
397 init_cb, \
398 connect_cb, \
399 disconnect_cb, \
400 cls, \
401 mh); \
402 }
340#endif 403#endif
341 404
342/** 405/**
406 * Run the mainloop in a monolithic libgnunet.
407 * Must be called such that services are actually launched.
408 */
409void
410GNUNET_SERVICE_main (int argc, char *const *argv);
411
412/**
343 * Suspend accepting connections from the listen socket temporarily. 413 * Suspend accepting connections from the listen socket temporarily.
344 * Resume activity using #GNUNET_SERVICE_resume. 414 * Resume activity using #GNUNET_SERVICE_resume.
345 * 415 *
diff --git a/src/include/gnunet_transport_application_service.h b/src/include/gnunet_transport_application_service.h
index 47f07a5f8..66512089a 100644
--- a/src/include/gnunet_transport_application_service.h
+++ b/src/include/gnunet_transport_application_service.h
@@ -19,7 +19,7 @@
19 */ 19 */
20/** 20/**
21 * @addtogroup Backbone 21 * @addtogroup Backbone
22 * @{ 22 * @{
23 * 23 *
24 * @file 24 * @file
25 * Bandwidth allocation API for applications to interact with 25 * Bandwidth allocation API for applications to interact with
@@ -36,7 +36,6 @@
36 36
37#include "gnunet_constants.h" 37#include "gnunet_constants.h"
38#include "gnunet_util_lib.h" 38#include "gnunet_util_lib.h"
39#include "gnunet_nt_lib.h"
40#include "gnunet_testing_lib.h" 39#include "gnunet_testing_lib.h"
41#include "gnunet_testing_ng_lib.h" 40#include "gnunet_testing_ng_lib.h"
42 41
diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h
index a705b1970..92facb0e0 100644
--- a/src/include/gnunet_transport_communication_service.h
+++ b/src/include/gnunet_transport_communication_service.h
@@ -47,7 +47,6 @@ extern "C" {
47 47
48 48
49#include "gnunet_util_lib.h" 49#include "gnunet_util_lib.h"
50#include "gnunet_nt_lib.h"
51 50
52/** 51/**
53 * Version number of the transport communication API. 52 * Version number of the transport communication API.
@@ -139,7 +138,7 @@ typedef void (*GNUNET_TRANSPORT_CommunicatorNotify) (
139 * Connect to the transport service. 138 * Connect to the transport service.
140 * 139 *
141 * @param cfg configuration to use 140 * @param cfg configuration to use
142 * @param config_section_name section of the configuration to use for 141 * @param config_section_name section of the configuration to use for
143 * options 142 * options
144 * @param addr_prefix address prefix for addresses supported by this 143 * @param addr_prefix address prefix for addresses supported by this
145 * communicator, could be NULL for incoming-only communicators 144 * communicator, could be NULL for incoming-only communicators
diff --git a/src/include/gnunet_util_lib.h b/src/include/gnunet_util_lib.h
index c8737dc60..ee850bc3c 100644
--- a/src/include/gnunet_util_lib.h
+++ b/src/include/gnunet_util_lib.h
@@ -77,6 +77,7 @@ extern "C"
77#include "gnunet_helper_lib.h" 77#include "gnunet_helper_lib.h"
78#include "gnunet_mst_lib.h" 78#include "gnunet_mst_lib.h"
79#include "gnunet_mq_lib.h" 79#include "gnunet_mq_lib.h"
80#include "gnunet_nt_lib.h"
80#include "gnunet_nc_lib.h" 81#include "gnunet_nc_lib.h"
81#include "gnunet_op_lib.h" 82#include "gnunet_op_lib.h"
82#include "gnunet_os_lib.h" 83#include "gnunet_os_lib.h"
diff --git a/src/include/meson.build b/src/include/meson.build
index bf1f46a54..9a2483db5 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -42,8 +42,6 @@ install_headers(
42 'gnunet_dnsstub_lib.h', 42 'gnunet_dnsstub_lib.h',
43 'gnunet_dns_service.h', 43 'gnunet_dns_service.h',
44 'gnunet_error_codes.h', 44 'gnunet_error_codes.h',
45 'gnunet_fragmentation_lib.h',
46 'gnunet_friends_lib.h',
47 'gnunet_fs_service.h', 45 'gnunet_fs_service.h',
48 'gnunet_getopt_lib.h', 46 'gnunet_getopt_lib.h',
49 'gnunet_gns_service.h', 47 'gnunet_gns_service.h',