diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/include/gnunet_crypto_lib.h | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 524 |
1 files changed, 272 insertions, 252 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 6e347c52b..507705e50 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -71,7 +71,8 @@ struct GNUNET_PeerIdentity; | |||
71 | * Desired quality level for random numbers. | 71 | * Desired quality level for random numbers. |
72 | * @ingroup crypto | 72 | * @ingroup crypto |
73 | */ | 73 | */ |
74 | enum GNUNET_CRYPTO_Quality { | 74 | enum GNUNET_CRYPTO_Quality |
75 | { | ||
75 | /** | 76 | /** |
76 | * No good quality of the operation is needed (i.e., | 77 | * No good quality of the operation is needed (i.e., |
77 | * random numbers can be pseudo-random). | 78 | * random numbers can be pseudo-random). |
@@ -112,7 +113,8 @@ enum GNUNET_CRYPTO_Quality { | |||
112 | /** | 113 | /** |
113 | * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode. | 114 | * @brief 0-terminated ASCII encoding of a struct GNUNET_HashCode. |
114 | */ | 115 | */ |
115 | struct GNUNET_CRYPTO_HashAsciiEncoded { | 116 | struct GNUNET_CRYPTO_HashAsciiEncoded |
117 | { | ||
116 | unsigned char encoding[104]; | 118 | unsigned char encoding[104]; |
117 | }; | 119 | }; |
118 | 120 | ||
@@ -125,7 +127,8 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
125 | * this must be followed by "size - 8" bytes of | 127 | * this must be followed by "size - 8" bytes of |
126 | * the actual signed data | 128 | * the actual signed data |
127 | */ | 129 | */ |
128 | struct GNUNET_CRYPTO_EccSignaturePurpose { | 130 | struct GNUNET_CRYPTO_EccSignaturePurpose |
131 | { | ||
129 | /** | 132 | /** |
130 | * How many bytes does this signature sign? | 133 | * How many bytes does this signature sign? |
131 | * (including this purpose header); in network | 134 | * (including this purpose header); in network |
@@ -147,7 +150,8 @@ struct GNUNET_CRYPTO_EccSignaturePurpose { | |||
147 | * @brief an ECC signature using EdDSA. | 150 | * @brief an ECC signature using EdDSA. |
148 | * See cr.yp.to/papers.html#ed25519 | 151 | * See cr.yp.to/papers.html#ed25519 |
149 | */ | 152 | */ |
150 | struct GNUNET_CRYPTO_EddsaSignature { | 153 | struct GNUNET_CRYPTO_EddsaSignature |
154 | { | ||
151 | /** | 155 | /** |
152 | * R value. | 156 | * R value. |
153 | */ | 157 | */ |
@@ -163,7 +167,8 @@ struct GNUNET_CRYPTO_EddsaSignature { | |||
163 | /** | 167 | /** |
164 | * @brief an ECC signature using ECDSA | 168 | * @brief an ECC signature using ECDSA |
165 | */ | 169 | */ |
166 | struct GNUNET_CRYPTO_EcdsaSignature { | 170 | struct GNUNET_CRYPTO_EcdsaSignature |
171 | { | ||
167 | /** | 172 | /** |
168 | * R value. | 173 | * R value. |
169 | */ | 174 | */ |
@@ -180,7 +185,8 @@ struct GNUNET_CRYPTO_EcdsaSignature { | |||
180 | * Public ECC key (always for curve Ed25519) encoded in a format | 185 | * Public ECC key (always for curve Ed25519) encoded in a format |
181 | * suitable for network transmission and EdDSA signatures. | 186 | * suitable for network transmission and EdDSA signatures. |
182 | */ | 187 | */ |
183 | struct GNUNET_CRYPTO_EddsaPublicKey { | 188 | struct GNUNET_CRYPTO_EddsaPublicKey |
189 | { | ||
184 | /** | 190 | /** |
185 | * Point Q consists of a y-value mod p (256 bits); the x-value is | 191 | * Point Q consists of a y-value mod p (256 bits); the x-value is |
186 | * always positive. The point is stored in Ed25519 standard | 192 | * always positive. The point is stored in Ed25519 standard |
@@ -194,7 +200,8 @@ struct GNUNET_CRYPTO_EddsaPublicKey { | |||
194 | * Public ECC key (always for Curve25519) encoded in a format suitable | 200 | * Public ECC key (always for Curve25519) encoded in a format suitable |
195 | * for network transmission and ECDSA signatures. | 201 | * for network transmission and ECDSA signatures. |
196 | */ | 202 | */ |
197 | struct GNUNET_CRYPTO_EcdsaPublicKey { | 203 | struct GNUNET_CRYPTO_EcdsaPublicKey |
204 | { | ||
198 | /** | 205 | /** |
199 | * Q consists of an x- and a y-value, each mod p (256 bits), given | 206 | * Q consists of an x- and a y-value, each mod p (256 bits), given |
200 | * here in affine coordinates and Ed25519 standard compact format. | 207 | * here in affine coordinates and Ed25519 standard compact format. |
@@ -206,7 +213,8 @@ struct GNUNET_CRYPTO_EcdsaPublicKey { | |||
206 | /** | 213 | /** |
207 | * The identity of the host (wraps the signing key of the peer). | 214 | * The identity of the host (wraps the signing key of the peer). |
208 | */ | 215 | */ |
209 | struct GNUNET_PeerIdentity { | 216 | struct GNUNET_PeerIdentity |
217 | { | ||
210 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; | 218 | struct GNUNET_CRYPTO_EddsaPublicKey public_key; |
211 | }; | 219 | }; |
212 | 220 | ||
@@ -216,7 +224,8 @@ struct GNUNET_PeerIdentity { | |||
216 | * for network transmission and encryption (ECDH), | 224 | * for network transmission and encryption (ECDH), |
217 | * See http://cr.yp.to/ecdh.html | 225 | * See http://cr.yp.to/ecdh.html |
218 | */ | 226 | */ |
219 | struct GNUNET_CRYPTO_EcdhePublicKey { | 227 | struct GNUNET_CRYPTO_EcdhePublicKey |
228 | { | ||
220 | /** | 229 | /** |
221 | * Q consists of an x- and a y-value, each mod p (256 bits), given | 230 | * Q consists of an x- and a y-value, each mod p (256 bits), given |
222 | * here in affine coordinates and Ed25519 standard compact format. | 231 | * here in affine coordinates and Ed25519 standard compact format. |
@@ -229,7 +238,8 @@ struct GNUNET_CRYPTO_EcdhePublicKey { | |||
229 | * Private ECC key encoded for transmission. To be used only for ECDH | 238 | * Private ECC key encoded for transmission. To be used only for ECDH |
230 | * key exchange (ECDHE to be precise). | 239 | * key exchange (ECDHE to be precise). |
231 | */ | 240 | */ |
232 | struct GNUNET_CRYPTO_EcdhePrivateKey { | 241 | struct GNUNET_CRYPTO_EcdhePrivateKey |
242 | { | ||
233 | /** | 243 | /** |
234 | * d is a value mod n, where n has at most 256 bits. | 244 | * d is a value mod n, where n has at most 256 bits. |
235 | */ | 245 | */ |
@@ -240,7 +250,8 @@ struct GNUNET_CRYPTO_EcdhePrivateKey { | |||
240 | * Private ECC key encoded for transmission. To be used only for ECDSA | 250 | * Private ECC key encoded for transmission. To be used only for ECDSA |
241 | * signatures. | 251 | * signatures. |
242 | */ | 252 | */ |
243 | struct GNUNET_CRYPTO_EcdsaPrivateKey { | 253 | struct GNUNET_CRYPTO_EcdsaPrivateKey |
254 | { | ||
244 | /** | 255 | /** |
245 | * d is a value mod n, where n has at most 256 bits. | 256 | * d is a value mod n, where n has at most 256 bits. |
246 | */ | 257 | */ |
@@ -251,7 +262,8 @@ struct GNUNET_CRYPTO_EcdsaPrivateKey { | |||
251 | * Private ECC key encoded for transmission. To be used only for EdDSA | 262 | * Private ECC key encoded for transmission. To be used only for EdDSA |
252 | * signatures. | 263 | * signatures. |
253 | */ | 264 | */ |
254 | struct GNUNET_CRYPTO_EddsaPrivateKey { | 265 | struct GNUNET_CRYPTO_EddsaPrivateKey |
266 | { | ||
255 | /** | 267 | /** |
256 | * d is a value mod n, where n has at most 256 bits. | 268 | * d is a value mod n, where n has at most 256 bits. |
257 | */ | 269 | */ |
@@ -262,7 +274,8 @@ struct GNUNET_CRYPTO_EddsaPrivateKey { | |||
262 | /** | 274 | /** |
263 | * @brief type for session keys | 275 | * @brief type for session keys |
264 | */ | 276 | */ |
265 | struct GNUNET_CRYPTO_SymmetricSessionKey { | 277 | struct GNUNET_CRYPTO_SymmetricSessionKey |
278 | { | ||
266 | /** | 279 | /** |
267 | * Actual key for AES. | 280 | * Actual key for AES. |
268 | */ | 281 | */ |
@@ -282,7 +295,8 @@ GNUNET_NETWORK_STRUCT_END | |||
282 | * NOTE: must be smaller (!) in size than the | 295 | * NOTE: must be smaller (!) in size than the |
283 | * `struct GNUNET_HashCode`. | 296 | * `struct GNUNET_HashCode`. |
284 | */ | 297 | */ |
285 | struct GNUNET_CRYPTO_SymmetricInitializationVector { | 298 | struct GNUNET_CRYPTO_SymmetricInitializationVector |
299 | { | ||
286 | unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; | 300 | unsigned char aes_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; |
287 | 301 | ||
288 | unsigned char twofish_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; | 302 | unsigned char twofish_iv[GNUNET_CRYPTO_AES_KEY_LENGTH / 2]; |
@@ -292,7 +306,8 @@ struct GNUNET_CRYPTO_SymmetricInitializationVector { | |||
292 | /** | 306 | /** |
293 | * @brief type for (message) authentication keys | 307 | * @brief type for (message) authentication keys |
294 | */ | 308 | */ |
295 | struct GNUNET_CRYPTO_AuthKey { | 309 | struct GNUNET_CRYPTO_AuthKey |
310 | { | ||
296 | unsigned char key[GNUNET_CRYPTO_HASH_LENGTH]; | 311 | unsigned char key[GNUNET_CRYPTO_HASH_LENGTH]; |
297 | }; | 312 | }; |
298 | 313 | ||
@@ -307,7 +322,8 @@ struct GNUNET_CRYPTO_AuthKey { | |||
307 | /** | 322 | /** |
308 | * Paillier public key. | 323 | * Paillier public key. |
309 | */ | 324 | */ |
310 | struct GNUNET_CRYPTO_PaillierPublicKey { | 325 | struct GNUNET_CRYPTO_PaillierPublicKey |
326 | { | ||
311 | /** | 327 | /** |
312 | * N value. | 328 | * N value. |
313 | */ | 329 | */ |
@@ -318,7 +334,8 @@ struct GNUNET_CRYPTO_PaillierPublicKey { | |||
318 | /** | 334 | /** |
319 | * Paillier private key. | 335 | * Paillier private key. |
320 | */ | 336 | */ |
321 | struct GNUNET_CRYPTO_PaillierPrivateKey { | 337 | struct GNUNET_CRYPTO_PaillierPrivateKey |
338 | { | ||
322 | /** | 339 | /** |
323 | * Lambda-component of the private key. | 340 | * Lambda-component of the private key. |
324 | */ | 341 | */ |
@@ -333,7 +350,8 @@ struct GNUNET_CRYPTO_PaillierPrivateKey { | |||
333 | /** | 350 | /** |
334 | * Paillier ciphertext. | 351 | * Paillier ciphertext. |
335 | */ | 352 | */ |
336 | struct GNUNET_CRYPTO_PaillierCiphertext { | 353 | struct GNUNET_CRYPTO_PaillierCiphertext |
354 | { | ||
337 | /** | 355 | /** |
338 | * Guaranteed minimum number of homomorphic operations with this ciphertext, | 356 | * Guaranteed minimum number of homomorphic operations with this ciphertext, |
339 | * in network byte order (NBO). | 357 | * in network byte order (NBO). |
@@ -357,7 +375,7 @@ struct GNUNET_CRYPTO_PaillierCiphertext { | |||
357 | * @param seed the seed to use | 375 | * @param seed the seed to use |
358 | */ | 376 | */ |
359 | void | 377 | void |
360 | GNUNET_CRYPTO_seed_weak_random(int32_t seed); | 378 | GNUNET_CRYPTO_seed_weak_random (int32_t seed); |
361 | 379 | ||
362 | 380 | ||
363 | /** | 381 | /** |
@@ -369,7 +387,7 @@ GNUNET_CRYPTO_seed_weak_random(int32_t seed); | |||
369 | * @return crc8 value | 387 | * @return crc8 value |
370 | */ | 388 | */ |
371 | uint8_t | 389 | uint8_t |
372 | GNUNET_CRYPTO_crc8_n(const void *buf, size_t len); | 390 | GNUNET_CRYPTO_crc8_n (const void *buf, size_t len); |
373 | 391 | ||
374 | 392 | ||
375 | /** | 393 | /** |
@@ -381,7 +399,7 @@ GNUNET_CRYPTO_crc8_n(const void *buf, size_t len); | |||
381 | * @return updated crc sum (must be subjected to #GNUNET_CRYPTO_crc16_finish to get actual crc16) | 399 | * @return updated crc sum (must be subjected to #GNUNET_CRYPTO_crc16_finish to get actual crc16) |
382 | */ | 400 | */ |
383 | uint32_t | 401 | uint32_t |
384 | GNUNET_CRYPTO_crc16_step(uint32_t sum, const void *buf, size_t len); | 402 | GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len); |
385 | 403 | ||
386 | 404 | ||
387 | /** | 405 | /** |
@@ -391,7 +409,7 @@ GNUNET_CRYPTO_crc16_step(uint32_t sum, const void *buf, size_t len); | |||
391 | * @return crc16 value | 409 | * @return crc16 value |
392 | */ | 410 | */ |
393 | uint16_t | 411 | uint16_t |
394 | GNUNET_CRYPTO_crc16_finish(uint32_t sum); | 412 | GNUNET_CRYPTO_crc16_finish (uint32_t sum); |
395 | 413 | ||
396 | 414 | ||
397 | /** | 415 | /** |
@@ -403,7 +421,7 @@ GNUNET_CRYPTO_crc16_finish(uint32_t sum); | |||
403 | * @return crc16 value | 421 | * @return crc16 value |
404 | */ | 422 | */ |
405 | uint16_t | 423 | uint16_t |
406 | GNUNET_CRYPTO_crc16_n(const void *buf, size_t len); | 424 | GNUNET_CRYPTO_crc16_n (const void *buf, size_t len); |
407 | 425 | ||
408 | 426 | ||
409 | /** | 427 | /** |
@@ -416,7 +434,7 @@ GNUNET_CRYPTO_crc16_n(const void *buf, size_t len); | |||
416 | * @return the resulting CRC32 checksum | 434 | * @return the resulting CRC32 checksum |
417 | */ | 435 | */ |
418 | int32_t | 436 | int32_t |
419 | GNUNET_CRYPTO_crc32_n(const void *buf, size_t len); | 437 | GNUNET_CRYPTO_crc32_n (const void *buf, size_t len); |
420 | 438 | ||
421 | /** | 439 | /** |
422 | * @ingroup crypto | 440 | * @ingroup crypto |
@@ -427,7 +445,7 @@ GNUNET_CRYPTO_crc32_n(const void *buf, size_t len); | |||
427 | * @param length buffer length | 445 | * @param length buffer length |
428 | */ | 446 | */ |
429 | void | 447 | void |
430 | GNUNET_CRYPTO_zero_keys(void *buffer, size_t length); | 448 | GNUNET_CRYPTO_zero_keys (void *buffer, size_t length); |
431 | 449 | ||
432 | 450 | ||
433 | /** | 451 | /** |
@@ -439,9 +457,9 @@ GNUNET_CRYPTO_zero_keys(void *buffer, size_t length); | |||
439 | * @param length buffer length | 457 | * @param length buffer length |
440 | */ | 458 | */ |
441 | void | 459 | void |
442 | GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, | 460 | GNUNET_CRYPTO_random_block (enum GNUNET_CRYPTO_Quality mode, |
443 | void *buffer, | 461 | void *buffer, |
444 | size_t length); | 462 | size_t length); |
445 | 463 | ||
446 | /** | 464 | /** |
447 | * @ingroup crypto | 465 | * @ingroup crypto |
@@ -452,7 +470,7 @@ GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, | |||
452 | * @return a random value in the interval [0,@a i) (exclusive). | 470 | * @return a random value in the interval [0,@a i) (exclusive). |
453 | */ | 471 | */ |
454 | uint32_t | 472 | uint32_t |
455 | GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i); | 473 | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i); |
456 | 474 | ||
457 | 475 | ||
458 | /** | 476 | /** |
@@ -464,7 +482,7 @@ GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i); | |||
464 | * @return random 64-bit number | 482 | * @return random 64-bit number |
465 | */ | 483 | */ |
466 | uint64_t | 484 | uint64_t |
467 | GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max); | 485 | GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max); |
468 | 486 | ||
469 | 487 | ||
470 | /** | 488 | /** |
@@ -477,7 +495,7 @@ GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max); | |||
477 | * @return the permutation array (allocated from heap) | 495 | * @return the permutation array (allocated from heap) |
478 | */ | 496 | */ |
479 | unsigned int * | 497 | unsigned int * |
480 | GNUNET_CRYPTO_random_permute(enum GNUNET_CRYPTO_Quality mode, unsigned int n); | 498 | GNUNET_CRYPTO_random_permute (enum GNUNET_CRYPTO_Quality mode, unsigned int n); |
481 | 499 | ||
482 | 500 | ||
483 | /** | 501 | /** |
@@ -487,7 +505,7 @@ GNUNET_CRYPTO_random_permute(enum GNUNET_CRYPTO_Quality mode, unsigned int n); | |||
487 | * @param key key to initialize | 505 | * @param key key to initialize |
488 | */ | 506 | */ |
489 | void | 507 | void |
490 | GNUNET_CRYPTO_symmetric_create_session_key( | 508 | GNUNET_CRYPTO_symmetric_create_session_key ( |
491 | struct GNUNET_CRYPTO_SymmetricSessionKey *key); | 509 | struct GNUNET_CRYPTO_SymmetricSessionKey *key); |
492 | 510 | ||
493 | 511 | ||
@@ -503,7 +521,7 @@ GNUNET_CRYPTO_symmetric_create_session_key( | |||
503 | * @return the size of the encrypted block, -1 for errors | 521 | * @return the size of the encrypted block, -1 for errors |
504 | */ | 522 | */ |
505 | ssize_t | 523 | ssize_t |
506 | GNUNET_CRYPTO_symmetric_encrypt( | 524 | GNUNET_CRYPTO_symmetric_encrypt ( |
507 | const void *block, | 525 | const void *block, |
508 | size_t size, | 526 | size_t size, |
509 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, | 527 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
@@ -523,7 +541,7 @@ GNUNET_CRYPTO_symmetric_encrypt( | |||
523 | * @return -1 on failure, size of decrypted block on success | 541 | * @return -1 on failure, size of decrypted block on success |
524 | */ | 542 | */ |
525 | ssize_t | 543 | ssize_t |
526 | GNUNET_CRYPTO_symmetric_decrypt( | 544 | GNUNET_CRYPTO_symmetric_decrypt ( |
527 | const void *block, | 545 | const void *block, |
528 | size_t size, | 546 | size_t size, |
529 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, | 547 | const struct GNUNET_CRYPTO_SymmetricSessionKey *sessionkey, |
@@ -541,7 +559,7 @@ GNUNET_CRYPTO_symmetric_decrypt( | |||
541 | * @param ... pairs of void * & size_t for context chunks, terminated by NULL | 559 | * @param ... pairs of void * & size_t for context chunks, terminated by NULL |
542 | */ | 560 | */ |
543 | void | 561 | void |
544 | GNUNET_CRYPTO_symmetric_derive_iv( | 562 | GNUNET_CRYPTO_symmetric_derive_iv ( |
545 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | 563 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
546 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, | 564 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
547 | const void *salt, | 565 | const void *salt, |
@@ -558,7 +576,7 @@ GNUNET_CRYPTO_symmetric_derive_iv( | |||
558 | * @param argp pairs of void * & size_t for context chunks, terminated by NULL | 576 | * @param argp pairs of void * & size_t for context chunks, terminated by NULL |
559 | */ | 577 | */ |
560 | void | 578 | void |
561 | GNUNET_CRYPTO_symmetric_derive_iv_v( | 579 | GNUNET_CRYPTO_symmetric_derive_iv_v ( |
562 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | 580 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
563 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, | 581 | const struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
564 | const void *salt, | 582 | const void *salt, |
@@ -574,8 +592,8 @@ GNUNET_CRYPTO_symmetric_derive_iv_v( | |||
574 | * safely cast to char*, a '\\0' termination is set). | 592 | * safely cast to char*, a '\\0' termination is set). |
575 | */ | 593 | */ |
576 | void | 594 | void |
577 | GNUNET_CRYPTO_hash_to_enc(const struct GNUNET_HashCode *block, | 595 | GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode *block, |
578 | struct GNUNET_CRYPTO_HashAsciiEncoded *result); | 596 | struct GNUNET_CRYPTO_HashAsciiEncoded *result); |
579 | 597 | ||
580 | 598 | ||
581 | /** | 599 | /** |
@@ -588,9 +606,9 @@ GNUNET_CRYPTO_hash_to_enc(const struct GNUNET_HashCode *block, | |||
588 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding | 606 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding |
589 | */ | 607 | */ |
590 | int | 608 | int |
591 | GNUNET_CRYPTO_hash_from_string2(const char *enc, | 609 | GNUNET_CRYPTO_hash_from_string2 (const char *enc, |
592 | size_t enclen, | 610 | size_t enclen, |
593 | struct GNUNET_HashCode *result); | 611 | struct GNUNET_HashCode *result); |
594 | 612 | ||
595 | 613 | ||
596 | /** | 614 | /** |
@@ -602,7 +620,7 @@ GNUNET_CRYPTO_hash_from_string2(const char *enc, | |||
602 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding | 620 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding |
603 | */ | 621 | */ |
604 | #define GNUNET_CRYPTO_hash_from_string(enc, result) \ | 622 | #define GNUNET_CRYPTO_hash_from_string(enc, result) \ |
605 | GNUNET_CRYPTO_hash_from_string2(enc, strlen(enc), result) | 623 | GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result) |
606 | 624 | ||
607 | 625 | ||
608 | /** | 626 | /** |
@@ -618,8 +636,8 @@ GNUNET_CRYPTO_hash_from_string2(const char *enc, | |||
618 | * @return number between 0 and UINT32_MAX | 636 | * @return number between 0 and UINT32_MAX |
619 | */ | 637 | */ |
620 | uint32_t | 638 | uint32_t |
621 | GNUNET_CRYPTO_hash_distance_u32(const struct GNUNET_HashCode *a, | 639 | GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode *a, |
622 | const struct GNUNET_HashCode *b); | 640 | const struct GNUNET_HashCode *b); |
623 | 641 | ||
624 | 642 | ||
625 | /** | 643 | /** |
@@ -631,9 +649,9 @@ GNUNET_CRYPTO_hash_distance_u32(const struct GNUNET_HashCode *a, | |||
631 | * @param ret pointer to where to write the hashcode | 649 | * @param ret pointer to where to write the hashcode |
632 | */ | 650 | */ |
633 | void | 651 | void |
634 | GNUNET_CRYPTO_hash(const void *block, | 652 | GNUNET_CRYPTO_hash (const void *block, |
635 | size_t size, | 653 | size_t size, |
636 | struct GNUNET_HashCode *ret); | 654 | struct GNUNET_HashCode *ret); |
637 | 655 | ||
638 | 656 | ||
639 | /** | 657 | /** |
@@ -648,7 +666,7 @@ struct GNUNET_HashContext; | |||
648 | * @return context for incremental hash computation | 666 | * @return context for incremental hash computation |
649 | */ | 667 | */ |
650 | struct GNUNET_HashContext * | 668 | struct GNUNET_HashContext * |
651 | GNUNET_CRYPTO_hash_context_start(void); | 669 | GNUNET_CRYPTO_hash_context_start (void); |
652 | 670 | ||
653 | 671 | ||
654 | /** | 672 | /** |
@@ -659,9 +677,9 @@ GNUNET_CRYPTO_hash_context_start(void); | |||
659 | * @param size number of bytes in @a buf | 677 | * @param size number of bytes in @a buf |
660 | */ | 678 | */ |
661 | void | 679 | void |
662 | GNUNET_CRYPTO_hash_context_read(struct GNUNET_HashContext *hc, | 680 | GNUNET_CRYPTO_hash_context_read (struct GNUNET_HashContext *hc, |
663 | const void *buf, | 681 | const void *buf, |
664 | size_t size); | 682 | size_t size); |
665 | 683 | ||
666 | 684 | ||
667 | /** | 685 | /** |
@@ -671,8 +689,8 @@ GNUNET_CRYPTO_hash_context_read(struct GNUNET_HashContext *hc, | |||
671 | * @param r_hash where to write the latest / final hash code | 689 | * @param r_hash where to write the latest / final hash code |
672 | */ | 690 | */ |
673 | void | 691 | void |
674 | GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, | 692 | GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc, |
675 | struct GNUNET_HashCode *r_hash); | 693 | struct GNUNET_HashCode *r_hash); |
676 | 694 | ||
677 | 695 | ||
678 | /** | 696 | /** |
@@ -681,7 +699,7 @@ GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, | |||
681 | * @param hc hash context to destroy | 699 | * @param hc hash context to destroy |
682 | */ | 700 | */ |
683 | void | 701 | void |
684 | GNUNET_CRYPTO_hash_context_abort(struct GNUNET_HashContext *hc); | 702 | GNUNET_CRYPTO_hash_context_abort (struct GNUNET_HashContext *hc); |
685 | 703 | ||
686 | 704 | ||
687 | /** | 705 | /** |
@@ -696,11 +714,11 @@ GNUNET_CRYPTO_hash_context_abort(struct GNUNET_HashContext *hc); | |||
696 | * @param hmac where to store the hmac | 714 | * @param hmac where to store the hmac |
697 | */ | 715 | */ |
698 | void | 716 | void |
699 | GNUNET_CRYPTO_hmac_raw(const void *key, | 717 | GNUNET_CRYPTO_hmac_raw (const void *key, |
700 | size_t key_len, | 718 | size_t key_len, |
701 | const void *plaintext, | 719 | const void *plaintext, |
702 | size_t plaintext_len, | 720 | size_t plaintext_len, |
703 | struct GNUNET_HashCode *hmac); | 721 | struct GNUNET_HashCode *hmac); |
704 | 722 | ||
705 | 723 | ||
706 | /** | 724 | /** |
@@ -713,10 +731,10 @@ GNUNET_CRYPTO_hmac_raw(const void *key, | |||
713 | * @param hmac where to store the hmac | 731 | * @param hmac where to store the hmac |
714 | */ | 732 | */ |
715 | void | 733 | void |
716 | GNUNET_CRYPTO_hmac(const struct GNUNET_CRYPTO_AuthKey *key, | 734 | GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, |
717 | const void *plaintext, | 735 | const void *plaintext, |
718 | size_t plaintext_len, | 736 | size_t plaintext_len, |
719 | struct GNUNET_HashCode *hmac); | 737 | struct GNUNET_HashCode *hmac); |
720 | 738 | ||
721 | 739 | ||
722 | /** | 740 | /** |
@@ -749,11 +767,11 @@ struct GNUNET_CRYPTO_FileHashContext; | |||
749 | * @return NULL on (immediate) errror | 767 | * @return NULL on (immediate) errror |
750 | */ | 768 | */ |
751 | struct GNUNET_CRYPTO_FileHashContext * | 769 | struct GNUNET_CRYPTO_FileHashContext * |
752 | GNUNET_CRYPTO_hash_file(enum GNUNET_SCHEDULER_Priority priority, | 770 | GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority priority, |
753 | const char *filename, | 771 | const char *filename, |
754 | size_t blocksize, | 772 | size_t blocksize, |
755 | GNUNET_CRYPTO_HashCompletedCallback callback, | 773 | GNUNET_CRYPTO_HashCompletedCallback callback, |
756 | void *callback_cls); | 774 | void *callback_cls); |
757 | 775 | ||
758 | 776 | ||
759 | /** | 777 | /** |
@@ -762,7 +780,7 @@ GNUNET_CRYPTO_hash_file(enum GNUNET_SCHEDULER_Priority priority, | |||
762 | * @param fhc operation to cancel (callback must not yet have been invoked) | 780 | * @param fhc operation to cancel (callback must not yet have been invoked) |
763 | */ | 781 | */ |
764 | void | 782 | void |
765 | GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc); | 783 | GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc); |
766 | 784 | ||
767 | 785 | ||
768 | /** | 786 | /** |
@@ -773,8 +791,8 @@ GNUNET_CRYPTO_hash_file_cancel(struct GNUNET_CRYPTO_FileHashContext *fhc); | |||
773 | * @param result hash code that is randomized | 791 | * @param result hash code that is randomized |
774 | */ | 792 | */ |
775 | void | 793 | void |
776 | GNUNET_CRYPTO_hash_create_random(enum GNUNET_CRYPTO_Quality mode, | 794 | GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, |
777 | struct GNUNET_HashCode *result); | 795 | struct GNUNET_HashCode *result); |
778 | 796 | ||
779 | 797 | ||
780 | /** | 798 | /** |
@@ -786,9 +804,9 @@ GNUNET_CRYPTO_hash_create_random(enum GNUNET_CRYPTO_Quality mode, | |||
786 | * @param result set to @a b - @a a | 804 | * @param result set to @a b - @a a |
787 | */ | 805 | */ |
788 | void | 806 | void |
789 | GNUNET_CRYPTO_hash_difference(const struct GNUNET_HashCode *a, | 807 | GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode *a, |
790 | const struct GNUNET_HashCode *b, | 808 | const struct GNUNET_HashCode *b, |
791 | struct GNUNET_HashCode *result); | 809 | struct GNUNET_HashCode *result); |
792 | 810 | ||
793 | 811 | ||
794 | /** | 812 | /** |
@@ -800,9 +818,9 @@ GNUNET_CRYPTO_hash_difference(const struct GNUNET_HashCode *a, | |||
800 | * @param result set to @a a + @a delta | 818 | * @param result set to @a a + @a delta |
801 | */ | 819 | */ |
802 | void | 820 | void |
803 | GNUNET_CRYPTO_hash_sum(const struct GNUNET_HashCode *a, | 821 | GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode *a, |
804 | const struct GNUNET_HashCode *delta, | 822 | const struct GNUNET_HashCode *delta, |
805 | struct GNUNET_HashCode *result); | 823 | struct GNUNET_HashCode *result); |
806 | 824 | ||
807 | 825 | ||
808 | /** | 826 | /** |
@@ -814,9 +832,9 @@ GNUNET_CRYPTO_hash_sum(const struct GNUNET_HashCode *a, | |||
814 | * @param result set to @a a ^ @a b | 832 | * @param result set to @a a ^ @a b |
815 | */ | 833 | */ |
816 | void | 834 | void |
817 | GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, | 835 | GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode *a, |
818 | const struct GNUNET_HashCode *b, | 836 | const struct GNUNET_HashCode *b, |
819 | struct GNUNET_HashCode *result); | 837 | struct GNUNET_HashCode *result); |
820 | 838 | ||
821 | 839 | ||
822 | /** | 840 | /** |
@@ -828,7 +846,7 @@ GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, | |||
828 | * @param iv set to a valid initialization vector | 846 | * @param iv set to a valid initialization vector |
829 | */ | 847 | */ |
830 | void | 848 | void |
831 | GNUNET_CRYPTO_hash_to_aes_key( | 849 | GNUNET_CRYPTO_hash_to_aes_key ( |
832 | const struct GNUNET_HashCode *hc, | 850 | const struct GNUNET_HashCode *hc, |
833 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, | 851 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
834 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv); | 852 | struct GNUNET_CRYPTO_SymmetricInitializationVector *iv); |
@@ -843,8 +861,8 @@ GNUNET_CRYPTO_hash_to_aes_key( | |||
843 | * @return Bit \a bit from hashcode \a code, -1 for invalid index | 861 | * @return Bit \a bit from hashcode \a code, -1 for invalid index |
844 | */ | 862 | */ |
845 | int | 863 | int |
846 | GNUNET_CRYPTO_hash_get_bit(const struct GNUNET_HashCode *code, | 864 | GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code, |
847 | unsigned int bit); | 865 | unsigned int bit); |
848 | 866 | ||
849 | 867 | ||
850 | /** | 868 | /** |
@@ -860,8 +878,8 @@ GNUNET_CRYPTO_hash_get_bit(const struct GNUNET_HashCode *code, | |||
860 | * @return the number of bits that match | 878 | * @return the number of bits that match |
861 | */ | 879 | */ |
862 | unsigned int | 880 | unsigned int |
863 | GNUNET_CRYPTO_hash_matching_bits(const struct GNUNET_HashCode *first, | 881 | GNUNET_CRYPTO_hash_matching_bits (const struct GNUNET_HashCode *first, |
864 | const struct GNUNET_HashCode *second); | 882 | const struct GNUNET_HashCode *second); |
865 | 883 | ||
866 | 884 | ||
867 | /** | 885 | /** |
@@ -874,8 +892,8 @@ GNUNET_CRYPTO_hash_matching_bits(const struct GNUNET_HashCode *first, | |||
874 | * @return 1 if @a h1 > @a h2, -1 if @a h1 < @a h2 and 0 if @a h1 == @a h2. | 892 | * @return 1 if @a h1 > @a h2, -1 if @a h1 < @a h2 and 0 if @a h1 == @a h2. |
875 | */ | 893 | */ |
876 | int | 894 | int |
877 | GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, | 895 | GNUNET_CRYPTO_hash_cmp (const struct GNUNET_HashCode *h1, |
878 | const struct GNUNET_HashCode *h2); | 896 | const struct GNUNET_HashCode *h2); |
879 | 897 | ||
880 | 898 | ||
881 | /** | 899 | /** |
@@ -889,9 +907,9 @@ GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, | |||
889 | * @return -1 if @a h1 is closer, 1 if @a h2 is closer and 0 if @a h1== @a h2. | 907 | * @return -1 if @a h1 is closer, 1 if @a h2 is closer and 0 if @a h1== @a h2. |
890 | */ | 908 | */ |
891 | int | 909 | int |
892 | GNUNET_CRYPTO_hash_xorcmp(const struct GNUNET_HashCode *h1, | 910 | GNUNET_CRYPTO_hash_xorcmp (const struct GNUNET_HashCode *h1, |
893 | const struct GNUNET_HashCode *h2, | 911 | const struct GNUNET_HashCode *h2, |
894 | const struct GNUNET_HashCode *target); | 912 | const struct GNUNET_HashCode *target); |
895 | 913 | ||
896 | 914 | ||
897 | /** | 915 | /** |
@@ -904,7 +922,7 @@ GNUNET_CRYPTO_hash_xorcmp(const struct GNUNET_HashCode *h1, | |||
904 | * @param argp pair of void * & size_t for context chunks, terminated by NULL | 922 | * @param argp pair of void * & size_t for context chunks, terminated by NULL |
905 | */ | 923 | */ |
906 | void | 924 | void |
907 | GNUNET_CRYPTO_hmac_derive_key_v( | 925 | GNUNET_CRYPTO_hmac_derive_key_v ( |
908 | struct GNUNET_CRYPTO_AuthKey *key, | 926 | struct GNUNET_CRYPTO_AuthKey *key, |
909 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, | 927 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, |
910 | const void *salt, | 928 | const void *salt, |
@@ -922,7 +940,7 @@ GNUNET_CRYPTO_hmac_derive_key_v( | |||
922 | * @param ... pair of void * & size_t for context chunks, terminated by NULL | 940 | * @param ... pair of void * & size_t for context chunks, terminated by NULL |
923 | */ | 941 | */ |
924 | void | 942 | void |
925 | GNUNET_CRYPTO_hmac_derive_key( | 943 | GNUNET_CRYPTO_hmac_derive_key ( |
926 | struct GNUNET_CRYPTO_AuthKey *key, | 944 | struct GNUNET_CRYPTO_AuthKey *key, |
927 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, | 945 | const struct GNUNET_CRYPTO_SymmetricSessionKey *rkey, |
928 | const void *salt, | 946 | const void *salt, |
@@ -945,15 +963,15 @@ GNUNET_CRYPTO_hmac_derive_key( | |||
945 | * @return #GNUNET_YES on success | 963 | * @return #GNUNET_YES on success |
946 | */ | 964 | */ |
947 | int | 965 | int |
948 | GNUNET_CRYPTO_hkdf(void *result, | 966 | GNUNET_CRYPTO_hkdf (void *result, |
949 | size_t out_len, | 967 | size_t out_len, |
950 | int xtr_algo, | 968 | int xtr_algo, |
951 | int prf_algo, | 969 | int prf_algo, |
952 | const void *xts, | 970 | const void *xts, |
953 | size_t xts_len, | 971 | size_t xts_len, |
954 | const void *skm, | 972 | const void *skm, |
955 | size_t skm_len, | 973 | size_t skm_len, |
956 | ...); | 974 | ...); |
957 | 975 | ||
958 | 976 | ||
959 | /** | 977 | /** |
@@ -971,15 +989,15 @@ GNUNET_CRYPTO_hkdf(void *result, | |||
971 | * @return #GNUNET_YES on success | 989 | * @return #GNUNET_YES on success |
972 | */ | 990 | */ |
973 | int | 991 | int |
974 | GNUNET_CRYPTO_hkdf_v(void *result, | 992 | GNUNET_CRYPTO_hkdf_v (void *result, |
975 | size_t out_len, | 993 | size_t out_len, |
976 | int xtr_algo, | 994 | int xtr_algo, |
977 | int prf_algo, | 995 | int prf_algo, |
978 | const void *xts, | 996 | const void *xts, |
979 | size_t xts_len, | 997 | size_t xts_len, |
980 | const void *skm, | 998 | const void *skm, |
981 | size_t skm_len, | 999 | size_t skm_len, |
982 | va_list argp); | 1000 | va_list argp); |
983 | 1001 | ||
984 | 1002 | ||
985 | /** | 1003 | /** |
@@ -994,13 +1012,13 @@ GNUNET_CRYPTO_hkdf_v(void *result, | |||
994 | * @return #GNUNET_YES on success | 1012 | * @return #GNUNET_YES on success |
995 | */ | 1013 | */ |
996 | int | 1014 | int |
997 | GNUNET_CRYPTO_kdf_v(void *result, | 1015 | GNUNET_CRYPTO_kdf_v (void *result, |
998 | size_t out_len, | 1016 | size_t out_len, |
999 | const void *xts, | 1017 | const void *xts, |
1000 | size_t xts_len, | 1018 | size_t xts_len, |
1001 | const void *skm, | 1019 | const void *skm, |
1002 | size_t skm_len, | 1020 | size_t skm_len, |
1003 | va_list argp); | 1021 | va_list argp); |
1004 | 1022 | ||
1005 | 1023 | ||
1006 | /** | 1024 | /** |
@@ -1016,13 +1034,13 @@ GNUNET_CRYPTO_kdf_v(void *result, | |||
1016 | * @param ctx context string | 1034 | * @param ctx context string |
1017 | */ | 1035 | */ |
1018 | void | 1036 | void |
1019 | GNUNET_CRYPTO_kdf_mod_mpi(gcry_mpi_t *r, | 1037 | GNUNET_CRYPTO_kdf_mod_mpi (gcry_mpi_t *r, |
1020 | gcry_mpi_t n, | 1038 | gcry_mpi_t n, |
1021 | const void *xts, | 1039 | const void *xts, |
1022 | size_t xts_len, | 1040 | size_t xts_len, |
1023 | const void *skm, | 1041 | const void *skm, |
1024 | size_t skm_len, | 1042 | size_t skm_len, |
1025 | const char *ctx); | 1043 | const char *ctx); |
1026 | 1044 | ||
1027 | 1045 | ||
1028 | /** | 1046 | /** |
@@ -1038,13 +1056,13 @@ GNUNET_CRYPTO_kdf_mod_mpi(gcry_mpi_t *r, | |||
1038 | * @return #GNUNET_YES on success | 1056 | * @return #GNUNET_YES on success |
1039 | */ | 1057 | */ |
1040 | int | 1058 | int |
1041 | GNUNET_CRYPTO_kdf(void *result, | 1059 | GNUNET_CRYPTO_kdf (void *result, |
1042 | size_t out_len, | 1060 | size_t out_len, |
1043 | const void *xts, | 1061 | const void *xts, |
1044 | size_t xts_len, | 1062 | size_t xts_len, |
1045 | const void *skm, | 1063 | const void *skm, |
1046 | size_t skm_len, | 1064 | size_t skm_len, |
1047 | ...); | 1065 | ...); |
1048 | 1066 | ||
1049 | 1067 | ||
1050 | /** | 1068 | /** |
@@ -1055,7 +1073,7 @@ GNUNET_CRYPTO_kdf(void *result, | |||
1055 | * @param pub where to write the public key | 1073 | * @param pub where to write the public key |
1056 | */ | 1074 | */ |
1057 | void | 1075 | void |
1058 | GNUNET_CRYPTO_ecdsa_key_get_public( | 1076 | GNUNET_CRYPTO_ecdsa_key_get_public ( |
1059 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1077 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, |
1060 | struct GNUNET_CRYPTO_EcdsaPublicKey *pub); | 1078 | struct GNUNET_CRYPTO_EcdsaPublicKey *pub); |
1061 | 1079 | ||
@@ -1067,7 +1085,7 @@ GNUNET_CRYPTO_ecdsa_key_get_public( | |||
1067 | * @param pub where to write the public key | 1085 | * @param pub where to write the public key |
1068 | */ | 1086 | */ |
1069 | void | 1087 | void |
1070 | GNUNET_CRYPTO_eddsa_key_get_public( | 1088 | GNUNET_CRYPTO_eddsa_key_get_public ( |
1071 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 1089 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
1072 | struct GNUNET_CRYPTO_EddsaPublicKey *pub); | 1090 | struct GNUNET_CRYPTO_EddsaPublicKey *pub); |
1073 | 1091 | ||
@@ -1080,7 +1098,7 @@ GNUNET_CRYPTO_eddsa_key_get_public( | |||
1080 | * @param pub where to write the public key | 1098 | * @param pub where to write the public key |
1081 | */ | 1099 | */ |
1082 | void | 1100 | void |
1083 | GNUNET_CRYPTO_ecdhe_key_get_public( | 1101 | GNUNET_CRYPTO_ecdhe_key_get_public ( |
1084 | const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1102 | const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1085 | struct GNUNET_CRYPTO_EcdhePublicKey *pub); | 1103 | struct GNUNET_CRYPTO_EcdhePublicKey *pub); |
1086 | 1104 | ||
@@ -1092,7 +1110,7 @@ GNUNET_CRYPTO_ecdhe_key_get_public( | |||
1092 | * @return string representing @a pub | 1110 | * @return string representing @a pub |
1093 | */ | 1111 | */ |
1094 | char * | 1112 | char * |
1095 | GNUNET_CRYPTO_ecdsa_public_key_to_string( | 1113 | GNUNET_CRYPTO_ecdsa_public_key_to_string ( |
1096 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub); | 1114 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub); |
1097 | 1115 | ||
1098 | /** | 1116 | /** |
@@ -1102,7 +1120,7 @@ GNUNET_CRYPTO_ecdsa_public_key_to_string( | |||
1102 | * @return string representing @a priv | 1120 | * @return string representing @a priv |
1103 | */ | 1121 | */ |
1104 | char * | 1122 | char * |
1105 | GNUNET_CRYPTO_ecdsa_private_key_to_string( | 1123 | GNUNET_CRYPTO_ecdsa_private_key_to_string ( |
1106 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv); | 1124 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv); |
1107 | 1125 | ||
1108 | 1126 | ||
@@ -1113,7 +1131,7 @@ GNUNET_CRYPTO_ecdsa_private_key_to_string( | |||
1113 | * @return string representing @a pub | 1131 | * @return string representing @a pub |
1114 | */ | 1132 | */ |
1115 | char * | 1133 | char * |
1116 | GNUNET_CRYPTO_eddsa_private_key_to_string( | 1134 | GNUNET_CRYPTO_eddsa_private_key_to_string ( |
1117 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); | 1135 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); |
1118 | 1136 | ||
1119 | 1137 | ||
@@ -1124,7 +1142,7 @@ GNUNET_CRYPTO_eddsa_private_key_to_string( | |||
1124 | * @return string representing @a pub | 1142 | * @return string representing @a pub |
1125 | */ | 1143 | */ |
1126 | char * | 1144 | char * |
1127 | GNUNET_CRYPTO_eddsa_public_key_to_string( | 1145 | GNUNET_CRYPTO_eddsa_public_key_to_string ( |
1128 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub); | 1146 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub); |
1129 | 1147 | ||
1130 | 1148 | ||
@@ -1137,7 +1155,7 @@ GNUNET_CRYPTO_eddsa_public_key_to_string( | |||
1137 | * @return #GNUNET_OK on success | 1155 | * @return #GNUNET_OK on success |
1138 | */ | 1156 | */ |
1139 | int | 1157 | int |
1140 | GNUNET_CRYPTO_ecdsa_public_key_from_string( | 1158 | GNUNET_CRYPTO_ecdsa_public_key_from_string ( |
1141 | const char *enc, | 1159 | const char *enc, |
1142 | size_t enclen, | 1160 | size_t enclen, |
1143 | struct GNUNET_CRYPTO_EcdsaPublicKey *pub); | 1161 | struct GNUNET_CRYPTO_EcdsaPublicKey *pub); |
@@ -1152,7 +1170,7 @@ GNUNET_CRYPTO_ecdsa_public_key_from_string( | |||
1152 | * @return #GNUNET_OK on success | 1170 | * @return #GNUNET_OK on success |
1153 | */ | 1171 | */ |
1154 | int | 1172 | int |
1155 | GNUNET_CRYPTO_eddsa_private_key_from_string( | 1173 | GNUNET_CRYPTO_eddsa_private_key_from_string ( |
1156 | const char *enc, | 1174 | const char *enc, |
1157 | size_t enclen, | 1175 | size_t enclen, |
1158 | struct GNUNET_CRYPTO_EddsaPrivateKey *pub); | 1176 | struct GNUNET_CRYPTO_EddsaPrivateKey *pub); |
@@ -1167,7 +1185,7 @@ GNUNET_CRYPTO_eddsa_private_key_from_string( | |||
1167 | * @return #GNUNET_OK on success | 1185 | * @return #GNUNET_OK on success |
1168 | */ | 1186 | */ |
1169 | int | 1187 | int |
1170 | GNUNET_CRYPTO_eddsa_public_key_from_string( | 1188 | GNUNET_CRYPTO_eddsa_public_key_from_string ( |
1171 | const char *enc, | 1189 | const char *enc, |
1172 | size_t enclen, | 1190 | size_t enclen, |
1173 | struct GNUNET_CRYPTO_EddsaPublicKey *pub); | 1191 | struct GNUNET_CRYPTO_EddsaPublicKey *pub); |
@@ -1189,7 +1207,7 @@ GNUNET_CRYPTO_eddsa_public_key_from_string( | |||
1189 | * permission denied); free using #GNUNET_free | 1207 | * permission denied); free using #GNUNET_free |
1190 | */ | 1208 | */ |
1191 | struct GNUNET_CRYPTO_EcdsaPrivateKey * | 1209 | struct GNUNET_CRYPTO_EcdsaPrivateKey * |
1192 | GNUNET_CRYPTO_ecdsa_key_create_from_file(const char *filename); | 1210 | GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename); |
1193 | 1211 | ||
1194 | 1212 | ||
1195 | /** | 1213 | /** |
@@ -1208,7 +1226,7 @@ GNUNET_CRYPTO_ecdsa_key_create_from_file(const char *filename); | |||
1208 | * permission denied); free using #GNUNET_free | 1226 | * permission denied); free using #GNUNET_free |
1209 | */ | 1227 | */ |
1210 | struct GNUNET_CRYPTO_EddsaPrivateKey * | 1228 | struct GNUNET_CRYPTO_EddsaPrivateKey * |
1211 | GNUNET_CRYPTO_eddsa_key_create_from_file(const char *filename); | 1229 | GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename); |
1212 | 1230 | ||
1213 | 1231 | ||
1214 | /** | 1232 | /** |
@@ -1227,7 +1245,7 @@ struct GNUNET_CONFIGURATION_Handle; | |||
1227 | * permission denied); free using #GNUNET_free | 1245 | * permission denied); free using #GNUNET_free |
1228 | */ | 1246 | */ |
1229 | struct GNUNET_CRYPTO_EddsaPrivateKey * | 1247 | struct GNUNET_CRYPTO_EddsaPrivateKey * |
1230 | GNUNET_CRYPTO_eddsa_key_create_from_configuration( | 1248 | GNUNET_CRYPTO_eddsa_key_create_from_configuration ( |
1231 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 1249 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
1232 | 1250 | ||
1233 | 1251 | ||
@@ -1238,7 +1256,7 @@ GNUNET_CRYPTO_eddsa_key_create_from_configuration( | |||
1238 | * @return fresh private key; free using #GNUNET_free | 1256 | * @return fresh private key; free using #GNUNET_free |
1239 | */ | 1257 | */ |
1240 | struct GNUNET_CRYPTO_EcdsaPrivateKey * | 1258 | struct GNUNET_CRYPTO_EcdsaPrivateKey * |
1241 | GNUNET_CRYPTO_ecdsa_key_create(void); | 1259 | GNUNET_CRYPTO_ecdsa_key_create (void); |
1242 | 1260 | ||
1243 | 1261 | ||
1244 | /** | 1262 | /** |
@@ -1248,7 +1266,7 @@ GNUNET_CRYPTO_ecdsa_key_create(void); | |||
1248 | * @return fresh private key; free using #GNUNET_free | 1266 | * @return fresh private key; free using #GNUNET_free |
1249 | */ | 1267 | */ |
1250 | struct GNUNET_CRYPTO_EddsaPrivateKey * | 1268 | struct GNUNET_CRYPTO_EddsaPrivateKey * |
1251 | GNUNET_CRYPTO_eddsa_key_create(void); | 1269 | GNUNET_CRYPTO_eddsa_key_create (void); |
1252 | 1270 | ||
1253 | 1271 | ||
1254 | /** | 1272 | /** |
@@ -1259,7 +1277,7 @@ GNUNET_CRYPTO_eddsa_key_create(void); | |||
1259 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 1277 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
1260 | */ | 1278 | */ |
1261 | int | 1279 | int |
1262 | GNUNET_CRYPTO_ecdhe_key_create2(struct GNUNET_CRYPTO_EcdhePrivateKey *pk); | 1280 | GNUNET_CRYPTO_ecdhe_key_create2 (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); |
1263 | 1281 | ||
1264 | 1282 | ||
1265 | /** | 1283 | /** |
@@ -1269,7 +1287,7 @@ GNUNET_CRYPTO_ecdhe_key_create2(struct GNUNET_CRYPTO_EcdhePrivateKey *pk); | |||
1269 | * @return fresh private key; free using #GNUNET_free | 1287 | * @return fresh private key; free using #GNUNET_free |
1270 | */ | 1288 | */ |
1271 | struct GNUNET_CRYPTO_EcdhePrivateKey * | 1289 | struct GNUNET_CRYPTO_EcdhePrivateKey * |
1272 | GNUNET_CRYPTO_ecdhe_key_create(void); | 1290 | GNUNET_CRYPTO_ecdhe_key_create (void); |
1273 | 1291 | ||
1274 | 1292 | ||
1275 | /** | 1293 | /** |
@@ -1279,7 +1297,7 @@ GNUNET_CRYPTO_ecdhe_key_create(void); | |||
1279 | * @param pk location of the key | 1297 | * @param pk location of the key |
1280 | */ | 1298 | */ |
1281 | void | 1299 | void |
1282 | GNUNET_CRYPTO_eddsa_key_clear(struct GNUNET_CRYPTO_EddsaPrivateKey *pk); | 1300 | GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk); |
1283 | 1301 | ||
1284 | 1302 | ||
1285 | /** | 1303 | /** |
@@ -1289,7 +1307,7 @@ GNUNET_CRYPTO_eddsa_key_clear(struct GNUNET_CRYPTO_EddsaPrivateKey *pk); | |||
1289 | * @param pk location of the key | 1307 | * @param pk location of the key |
1290 | */ | 1308 | */ |
1291 | void | 1309 | void |
1292 | GNUNET_CRYPTO_ecdsa_key_clear(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk); | 1310 | GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk); |
1293 | 1311 | ||
1294 | 1312 | ||
1295 | /** | 1313 | /** |
@@ -1299,7 +1317,7 @@ GNUNET_CRYPTO_ecdsa_key_clear(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk); | |||
1299 | * @param pk location of the key | 1317 | * @param pk location of the key |
1300 | */ | 1318 | */ |
1301 | void | 1319 | void |
1302 | GNUNET_CRYPTO_ecdhe_key_clear(struct GNUNET_CRYPTO_EcdhePrivateKey *pk); | 1320 | GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); |
1303 | 1321 | ||
1304 | 1322 | ||
1305 | /** | 1323 | /** |
@@ -1309,7 +1327,7 @@ GNUNET_CRYPTO_ecdhe_key_clear(struct GNUNET_CRYPTO_EcdhePrivateKey *pk); | |||
1309 | * @return "anonymous" private key; do not free | 1327 | * @return "anonymous" private key; do not free |
1310 | */ | 1328 | */ |
1311 | const struct GNUNET_CRYPTO_EcdsaPrivateKey * | 1329 | const struct GNUNET_CRYPTO_EcdsaPrivateKey * |
1312 | GNUNET_CRYPTO_ecdsa_key_get_anonymous(void); | 1330 | GNUNET_CRYPTO_ecdsa_key_get_anonymous (void); |
1313 | 1331 | ||
1314 | 1332 | ||
1315 | /** | 1333 | /** |
@@ -1322,7 +1340,7 @@ GNUNET_CRYPTO_ecdsa_key_get_anonymous(void); | |||
1322 | * @param cfg_name name of the configuration file to use | 1340 | * @param cfg_name name of the configuration file to use |
1323 | */ | 1341 | */ |
1324 | void | 1342 | void |
1325 | GNUNET_CRYPTO_eddsa_setup_hostkey(const char *cfg_name); | 1343 | GNUNET_CRYPTO_eddsa_setup_hostkey (const char *cfg_name); |
1326 | 1344 | ||
1327 | 1345 | ||
1328 | /** | 1346 | /** |
@@ -1335,8 +1353,8 @@ GNUNET_CRYPTO_eddsa_setup_hostkey(const char *cfg_name); | |||
1335 | * could not be retrieved | 1353 | * could not be retrieved |
1336 | */ | 1354 | */ |
1337 | int | 1355 | int |
1338 | GNUNET_CRYPTO_get_peer_identity(const struct GNUNET_CONFIGURATION_Handle *cfg, | 1356 | GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1339 | struct GNUNET_PeerIdentity *dst); | 1357 | struct GNUNET_PeerIdentity *dst); |
1340 | 1358 | ||
1341 | 1359 | ||
1342 | /** | 1360 | /** |
@@ -1349,7 +1367,8 @@ struct GNUNET_CRYPTO_EccDlogContext; | |||
1349 | * Point on a curve (always for Curve25519) encoded in a format suitable | 1367 | * Point on a curve (always for Curve25519) encoded in a format suitable |
1350 | * for network transmission (ECDH), see http://cr.yp.to/ecdh.html. | 1368 | * for network transmission (ECDH), see http://cr.yp.to/ecdh.html. |
1351 | */ | 1369 | */ |
1352 | struct GNUNET_CRYPTO_EccPoint { | 1370 | struct GNUNET_CRYPTO_EccPoint |
1371 | { | ||
1353 | /** | 1372 | /** |
1354 | * Q consists of an x- and a y-value, each mod p (256 bits), given | 1373 | * Q consists of an x- and a y-value, each mod p (256 bits), given |
1355 | * here in affine coordinates and Ed25519 standard compact format. | 1374 | * here in affine coordinates and Ed25519 standard compact format. |
@@ -1366,7 +1385,7 @@ struct GNUNET_CRYPTO_EccPoint { | |||
1366 | * @return NULL on error | 1385 | * @return NULL on error |
1367 | */ | 1386 | */ |
1368 | struct GNUNET_CRYPTO_EccDlogContext * | 1387 | struct GNUNET_CRYPTO_EccDlogContext * |
1369 | GNUNET_CRYPTO_ecc_dlog_prepare(unsigned int max, unsigned int mem); | 1388 | GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, unsigned int mem); |
1370 | 1389 | ||
1371 | 1390 | ||
1372 | /** | 1391 | /** |
@@ -1378,8 +1397,8 @@ GNUNET_CRYPTO_ecc_dlog_prepare(unsigned int max, unsigned int mem); | |||
1378 | * @return INT_MAX if dlog failed, otherwise the factor | 1397 | * @return INT_MAX if dlog failed, otherwise the factor |
1379 | */ | 1398 | */ |
1380 | int | 1399 | int |
1381 | GNUNET_CRYPTO_ecc_dlog(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1400 | GNUNET_CRYPTO_ecc_dlog (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1382 | gcry_mpi_point_t input); | 1401 | gcry_mpi_point_t input); |
1383 | 1402 | ||
1384 | 1403 | ||
1385 | /** | 1404 | /** |
@@ -1396,7 +1415,7 @@ GNUNET_CRYPTO_ecc_dlog(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1396 | * must be freed using #GNUNET_CRYPTO_ecc_free() | 1415 | * must be freed using #GNUNET_CRYPTO_ecc_free() |
1397 | */ | 1416 | */ |
1398 | gcry_mpi_point_t | 1417 | gcry_mpi_point_t |
1399 | GNUNET_CRYPTO_ecc_dexp(struct GNUNET_CRYPTO_EccDlogContext *edc, int val); | 1418 | GNUNET_CRYPTO_ecc_dexp (struct GNUNET_CRYPTO_EccDlogContext *edc, int val); |
1400 | 1419 | ||
1401 | 1420 | ||
1402 | /** | 1421 | /** |
@@ -1409,8 +1428,8 @@ GNUNET_CRYPTO_ecc_dexp(struct GNUNET_CRYPTO_EccDlogContext *edc, int val); | |||
1409 | * must be freed using #GNUNET_CRYPTO_ecc_free() | 1428 | * must be freed using #GNUNET_CRYPTO_ecc_free() |
1410 | */ | 1429 | */ |
1411 | gcry_mpi_point_t | 1430 | gcry_mpi_point_t |
1412 | GNUNET_CRYPTO_ecc_dexp_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1431 | GNUNET_CRYPTO_ecc_dexp_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1413 | gcry_mpi_t val); | 1432 | gcry_mpi_t val); |
1414 | 1433 | ||
1415 | 1434 | ||
1416 | /** | 1435 | /** |
@@ -1423,9 +1442,9 @@ GNUNET_CRYPTO_ecc_dexp_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1423 | * must be freed using #GNUNET_CRYPTO_ecc_free() | 1442 | * must be freed using #GNUNET_CRYPTO_ecc_free() |
1424 | */ | 1443 | */ |
1425 | gcry_mpi_point_t | 1444 | gcry_mpi_point_t |
1426 | GNUNET_CRYPTO_ecc_pmul_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1445 | GNUNET_CRYPTO_ecc_pmul_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1427 | gcry_mpi_point_t p, | 1446 | gcry_mpi_point_t p, |
1428 | gcry_mpi_t val); | 1447 | gcry_mpi_t val); |
1429 | 1448 | ||
1430 | 1449 | ||
1431 | /** | 1450 | /** |
@@ -1436,9 +1455,9 @@ GNUNET_CRYPTO_ecc_pmul_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1436 | * @param[out] bin binary point representation | 1455 | * @param[out] bin binary point representation |
1437 | */ | 1456 | */ |
1438 | void | 1457 | void |
1439 | GNUNET_CRYPTO_ecc_point_to_bin(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1458 | GNUNET_CRYPTO_ecc_point_to_bin (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1440 | gcry_mpi_point_t point, | 1459 | gcry_mpi_point_t point, |
1441 | struct GNUNET_CRYPTO_EccPoint *bin); | 1460 | struct GNUNET_CRYPTO_EccPoint *bin); |
1442 | 1461 | ||
1443 | 1462 | ||
1444 | /** | 1463 | /** |
@@ -1449,8 +1468,8 @@ GNUNET_CRYPTO_ecc_point_to_bin(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1449 | * @return computational representation | 1468 | * @return computational representation |
1450 | */ | 1469 | */ |
1451 | gcry_mpi_point_t | 1470 | gcry_mpi_point_t |
1452 | GNUNET_CRYPTO_ecc_bin_to_point(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1471 | GNUNET_CRYPTO_ecc_bin_to_point (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1453 | const struct GNUNET_CRYPTO_EccPoint *bin); | 1472 | const struct GNUNET_CRYPTO_EccPoint *bin); |
1454 | 1473 | ||
1455 | 1474 | ||
1456 | /** | 1475 | /** |
@@ -1462,9 +1481,9 @@ GNUNET_CRYPTO_ecc_bin_to_point(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1462 | * @return @a a + @a b, must be freed using #GNUNET_CRYPTO_ecc_free() | 1481 | * @return @a a + @a b, must be freed using #GNUNET_CRYPTO_ecc_free() |
1463 | */ | 1482 | */ |
1464 | gcry_mpi_point_t | 1483 | gcry_mpi_point_t |
1465 | GNUNET_CRYPTO_ecc_add(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1484 | GNUNET_CRYPTO_ecc_add (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1466 | gcry_mpi_point_t a, | 1485 | gcry_mpi_point_t a, |
1467 | gcry_mpi_point_t b); | 1486 | gcry_mpi_point_t b); |
1468 | 1487 | ||
1469 | 1488 | ||
1470 | /** | 1489 | /** |
@@ -1477,9 +1496,9 @@ GNUNET_CRYPTO_ecc_add(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1477 | * @param[out] r_inv set to the additive inverse of @a r | 1496 | * @param[out] r_inv set to the additive inverse of @a r |
1478 | */ | 1497 | */ |
1479 | void | 1498 | void |
1480 | GNUNET_CRYPTO_ecc_rnd(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1499 | GNUNET_CRYPTO_ecc_rnd (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1481 | gcry_mpi_point_t *r, | 1500 | gcry_mpi_point_t *r, |
1482 | gcry_mpi_point_t *r_inv); | 1501 | gcry_mpi_point_t *r_inv); |
1483 | 1502 | ||
1484 | 1503 | ||
1485 | /** | 1504 | /** |
@@ -1491,9 +1510,9 @@ GNUNET_CRYPTO_ecc_rnd(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1491 | * @param[out] r_inv set to the multiplicative inverse of @a r | 1510 | * @param[out] r_inv set to the multiplicative inverse of @a r |
1492 | */ | 1511 | */ |
1493 | void | 1512 | void |
1494 | GNUNET_CRYPTO_ecc_rnd_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, | 1513 | GNUNET_CRYPTO_ecc_rnd_mpi (struct GNUNET_CRYPTO_EccDlogContext *edc, |
1495 | gcry_mpi_t *r, | 1514 | gcry_mpi_t *r, |
1496 | gcry_mpi_t *r_inv); | 1515 | gcry_mpi_t *r_inv); |
1497 | 1516 | ||
1498 | 1517 | ||
1499 | /** | 1518 | /** |
@@ -1503,7 +1522,7 @@ GNUNET_CRYPTO_ecc_rnd_mpi(struct GNUNET_CRYPTO_EccDlogContext *edc, | |||
1503 | * @return random value mod n. | 1522 | * @return random value mod n. |
1504 | */ | 1523 | */ |
1505 | gcry_mpi_t | 1524 | gcry_mpi_t |
1506 | GNUNET_CRYPTO_ecc_random_mod_n(struct GNUNET_CRYPTO_EccDlogContext *edc); | 1525 | GNUNET_CRYPTO_ecc_random_mod_n (struct GNUNET_CRYPTO_EccDlogContext *edc); |
1507 | 1526 | ||
1508 | 1527 | ||
1509 | /** | 1528 | /** |
@@ -1512,7 +1531,7 @@ GNUNET_CRYPTO_ecc_random_mod_n(struct GNUNET_CRYPTO_EccDlogContext *edc); | |||
1512 | * @param p point to free | 1531 | * @param p point to free |
1513 | */ | 1532 | */ |
1514 | void | 1533 | void |
1515 | GNUNET_CRYPTO_ecc_free(gcry_mpi_point_t p); | 1534 | GNUNET_CRYPTO_ecc_free (gcry_mpi_point_t p); |
1516 | 1535 | ||
1517 | 1536 | ||
1518 | /** | 1537 | /** |
@@ -1521,7 +1540,7 @@ GNUNET_CRYPTO_ecc_free(gcry_mpi_point_t p); | |||
1521 | * @param dlc dlog context | 1540 | * @param dlc dlog context |
1522 | */ | 1541 | */ |
1523 | void | 1542 | void |
1524 | GNUNET_CRYPTO_ecc_dlog_release(struct GNUNET_CRYPTO_EccDlogContext *dlc); | 1543 | GNUNET_CRYPTO_ecc_dlog_release (struct GNUNET_CRYPTO_EccDlogContext *dlc); |
1525 | 1544 | ||
1526 | 1545 | ||
1527 | /** | 1546 | /** |
@@ -1534,9 +1553,9 @@ GNUNET_CRYPTO_ecc_dlog_release(struct GNUNET_CRYPTO_EccDlogContext *dlc); | |||
1534 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1553 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1535 | */ | 1554 | */ |
1536 | int | 1555 | int |
1537 | GNUNET_CRYPTO_ecc_ecdh(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1556 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1538 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, | 1557 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, |
1539 | struct GNUNET_HashCode *key_material); | 1558 | struct GNUNET_HashCode *key_material); |
1540 | 1559 | ||
1541 | 1560 | ||
1542 | /** | 1561 | /** |
@@ -1550,9 +1569,9 @@ GNUNET_CRYPTO_ecc_ecdh(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | |||
1550 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1569 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1551 | */ | 1570 | */ |
1552 | int | 1571 | int |
1553 | GNUNET_CRYPTO_eddsa_ecdh(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 1572 | GNUNET_CRYPTO_eddsa_ecdh (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
1554 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, | 1573 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, |
1555 | struct GNUNET_HashCode *key_material); | 1574 | struct GNUNET_HashCode *key_material); |
1556 | 1575 | ||
1557 | /** | 1576 | /** |
1558 | * @ingroup crypto | 1577 | * @ingroup crypto |
@@ -1565,9 +1584,9 @@ GNUNET_CRYPTO_eddsa_ecdh(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | |||
1565 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1584 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1566 | */ | 1585 | */ |
1567 | int | 1586 | int |
1568 | GNUNET_CRYPTO_ecdsa_ecdh(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1587 | GNUNET_CRYPTO_ecdsa_ecdh (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, |
1569 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, | 1588 | const struct GNUNET_CRYPTO_EcdhePublicKey *pub, |
1570 | struct GNUNET_HashCode *key_material); | 1589 | struct GNUNET_HashCode *key_material); |
1571 | 1590 | ||
1572 | 1591 | ||
1573 | /** | 1592 | /** |
@@ -1581,9 +1600,9 @@ GNUNET_CRYPTO_ecdsa_ecdh(const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | |||
1581 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1600 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1582 | */ | 1601 | */ |
1583 | int | 1602 | int |
1584 | GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1603 | GNUNET_CRYPTO_ecdh_eddsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1585 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub, | 1604 | const struct GNUNET_CRYPTO_EddsaPublicKey *pub, |
1586 | struct GNUNET_HashCode *key_material); | 1605 | struct GNUNET_HashCode *key_material); |
1587 | 1606 | ||
1588 | /** | 1607 | /** |
1589 | * @ingroup crypto | 1608 | * @ingroup crypto |
@@ -1596,9 +1615,9 @@ GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | |||
1596 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1615 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1597 | */ | 1616 | */ |
1598 | int | 1617 | int |
1599 | GNUNET_CRYPTO_ecdh_ecdsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | 1618 | GNUNET_CRYPTO_ecdh_ecdsa (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, |
1600 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, | 1619 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, |
1601 | struct GNUNET_HashCode *key_material); | 1620 | struct GNUNET_HashCode *key_material); |
1602 | 1621 | ||
1603 | 1622 | ||
1604 | /** | 1623 | /** |
@@ -1611,7 +1630,7 @@ GNUNET_CRYPTO_ecdh_ecdsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, | |||
1611 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1630 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1612 | */ | 1631 | */ |
1613 | int | 1632 | int |
1614 | GNUNET_CRYPTO_eddsa_sign( | 1633 | GNUNET_CRYPTO_eddsa_sign ( |
1615 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, | 1634 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, |
1616 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 1635 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
1617 | struct GNUNET_CRYPTO_EddsaSignature *sig); | 1636 | struct GNUNET_CRYPTO_EddsaSignature *sig); |
@@ -1627,7 +1646,7 @@ GNUNET_CRYPTO_eddsa_sign( | |||
1627 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success | 1646 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
1628 | */ | 1647 | */ |
1629 | int | 1648 | int |
1630 | GNUNET_CRYPTO_ecdsa_sign( | 1649 | GNUNET_CRYPTO_ecdsa_sign ( |
1631 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1650 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, |
1632 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, | 1651 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
1633 | struct GNUNET_CRYPTO_EcdsaSignature *sig); | 1652 | struct GNUNET_CRYPTO_EcdsaSignature *sig); |
@@ -1643,7 +1662,7 @@ GNUNET_CRYPTO_ecdsa_sign( | |||
1643 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid | 1662 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid |
1644 | */ | 1663 | */ |
1645 | int | 1664 | int |
1646 | GNUNET_CRYPTO_eddsa_verify( | 1665 | GNUNET_CRYPTO_eddsa_verify ( |
1647 | uint32_t purpose, | 1666 | uint32_t purpose, |
1648 | const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, | 1667 | const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, |
1649 | const struct GNUNET_CRYPTO_EddsaSignature *sig, | 1668 | const struct GNUNET_CRYPTO_EddsaSignature *sig, |
@@ -1661,7 +1680,7 @@ GNUNET_CRYPTO_eddsa_verify( | |||
1661 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid | 1680 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid |
1662 | */ | 1681 | */ |
1663 | int | 1682 | int |
1664 | GNUNET_CRYPTO_ecdsa_verify( | 1683 | GNUNET_CRYPTO_ecdsa_verify ( |
1665 | uint32_t purpose, | 1684 | uint32_t purpose, |
1666 | const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, | 1685 | const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, |
1667 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, | 1686 | const struct GNUNET_CRYPTO_EcdsaSignature *sig, |
@@ -1682,7 +1701,7 @@ GNUNET_CRYPTO_ecdsa_verify( | |||
1682 | * @return derived private key | 1701 | * @return derived private key |
1683 | */ | 1702 | */ |
1684 | struct GNUNET_CRYPTO_EcdsaPrivateKey * | 1703 | struct GNUNET_CRYPTO_EcdsaPrivateKey * |
1685 | GNUNET_CRYPTO_ecdsa_private_key_derive( | 1704 | GNUNET_CRYPTO_ecdsa_private_key_derive ( |
1686 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 1705 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, |
1687 | const char *label, | 1706 | const char *label, |
1688 | const char *context); | 1707 | const char *context); |
@@ -1700,7 +1719,7 @@ GNUNET_CRYPTO_ecdsa_private_key_derive( | |||
1700 | * @param result where to write the derived public key | 1719 | * @param result where to write the derived public key |
1701 | */ | 1720 | */ |
1702 | void | 1721 | void |
1703 | GNUNET_CRYPTO_ecdsa_public_key_derive( | 1722 | GNUNET_CRYPTO_ecdsa_public_key_derive ( |
1704 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, | 1723 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, |
1705 | const char *label, | 1724 | const char *label, |
1706 | const char *context, | 1725 | const char *context, |
@@ -1716,7 +1735,7 @@ GNUNET_CRYPTO_ecdsa_public_key_derive( | |||
1716 | * @param val value to write to @a buf | 1735 | * @param val value to write to @a buf |
1717 | */ | 1736 | */ |
1718 | void | 1737 | void |
1719 | GNUNET_CRYPTO_mpi_print_unsigned(void *buf, size_t size, gcry_mpi_t val); | 1738 | GNUNET_CRYPTO_mpi_print_unsigned (void *buf, size_t size, gcry_mpi_t val); |
1720 | 1739 | ||
1721 | 1740 | ||
1722 | /** | 1741 | /** |
@@ -1729,9 +1748,9 @@ GNUNET_CRYPTO_mpi_print_unsigned(void *buf, size_t size, gcry_mpi_t val); | |||
1729 | * @param size number of bytes in @a data | 1748 | * @param size number of bytes in @a data |
1730 | */ | 1749 | */ |
1731 | void | 1750 | void |
1732 | GNUNET_CRYPTO_mpi_scan_unsigned(gcry_mpi_t *result, | 1751 | GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result, |
1733 | const void *data, | 1752 | const void *data, |
1734 | size_t size); | 1753 | size_t size); |
1735 | 1754 | ||
1736 | 1755 | ||
1737 | /** | 1756 | /** |
@@ -1741,7 +1760,7 @@ GNUNET_CRYPTO_mpi_scan_unsigned(gcry_mpi_t *result, | |||
1741 | * @param[out] private_key Where to store the private key? | 1760 | * @param[out] private_key Where to store the private key? |
1742 | */ | 1761 | */ |
1743 | void | 1762 | void |
1744 | GNUNET_CRYPTO_paillier_create( | 1763 | GNUNET_CRYPTO_paillier_create ( |
1745 | struct GNUNET_CRYPTO_PaillierPublicKey *public_key, | 1764 | struct GNUNET_CRYPTO_PaillierPublicKey *public_key, |
1746 | struct GNUNET_CRYPTO_PaillierPrivateKey *private_key); | 1765 | struct GNUNET_CRYPTO_PaillierPrivateKey *private_key); |
1747 | 1766 | ||
@@ -1758,7 +1777,7 @@ GNUNET_CRYPTO_paillier_create( | |||
1758 | * or -1 if less than one homomorphic operation is possible | 1777 | * or -1 if less than one homomorphic operation is possible |
1759 | */ | 1778 | */ |
1760 | int | 1779 | int |
1761 | GNUNET_CRYPTO_paillier_encrypt( | 1780 | GNUNET_CRYPTO_paillier_encrypt ( |
1762 | const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, | 1781 | const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, |
1763 | const gcry_mpi_t m, | 1782 | const gcry_mpi_t m, |
1764 | int desired_ops, | 1783 | int desired_ops, |
@@ -1774,7 +1793,7 @@ GNUNET_CRYPTO_paillier_encrypt( | |||
1774 | * @param[out] m Decryption of @a ciphertext with @private_key. | 1793 | * @param[out] m Decryption of @a ciphertext with @private_key. |
1775 | */ | 1794 | */ |
1776 | void | 1795 | void |
1777 | GNUNET_CRYPTO_paillier_decrypt( | 1796 | GNUNET_CRYPTO_paillier_decrypt ( |
1778 | const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key, | 1797 | const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key, |
1779 | const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, | 1798 | const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, |
1780 | const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext, | 1799 | const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext, |
@@ -1795,7 +1814,7 @@ GNUNET_CRYPTO_paillier_decrypt( | |||
1795 | * #GNUNET_SYSERR if no more homomorphic operations are remaining. | 1814 | * #GNUNET_SYSERR if no more homomorphic operations are remaining. |
1796 | */ | 1815 | */ |
1797 | int | 1816 | int |
1798 | GNUNET_CRYPTO_paillier_hom_add( | 1817 | GNUNET_CRYPTO_paillier_hom_add ( |
1799 | const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, | 1818 | const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, |
1800 | const struct GNUNET_CRYPTO_PaillierCiphertext *c1, | 1819 | const struct GNUNET_CRYPTO_PaillierCiphertext *c1, |
1801 | const struct GNUNET_CRYPTO_PaillierCiphertext *c2, | 1820 | const struct GNUNET_CRYPTO_PaillierCiphertext *c2, |
@@ -1809,7 +1828,7 @@ GNUNET_CRYPTO_paillier_hom_add( | |||
1809 | * @return the number of remaining homomorphic operations | 1828 | * @return the number of remaining homomorphic operations |
1810 | */ | 1829 | */ |
1811 | int | 1830 | int |
1812 | GNUNET_CRYPTO_paillier_hom_get_remaining( | 1831 | GNUNET_CRYPTO_paillier_hom_get_remaining ( |
1813 | const struct GNUNET_CRYPTO_PaillierCiphertext *c); | 1832 | const struct GNUNET_CRYPTO_PaillierCiphertext *c); |
1814 | 1833 | ||
1815 | 1834 | ||
@@ -1829,7 +1848,8 @@ struct GNUNET_CRYPTO_RsaPublicKey; | |||
1829 | /** | 1848 | /** |
1830 | * Constant-size pre-secret for blinding key generation. | 1849 | * Constant-size pre-secret for blinding key generation. |
1831 | */ | 1850 | */ |
1832 | struct GNUNET_CRYPTO_RsaBlindingKeySecret { | 1851 | struct GNUNET_CRYPTO_RsaBlindingKeySecret |
1852 | { | ||
1833 | /** | 1853 | /** |
1834 | * Bits used to generate the blinding key. 256 bits | 1854 | * Bits used to generate the blinding key. 256 bits |
1835 | * of entropy is enough. | 1855 | * of entropy is enough. |
@@ -1850,7 +1870,7 @@ struct GNUNET_CRYPTO_RsaSignature; | |||
1850 | * @return fresh private key | 1870 | * @return fresh private key |
1851 | */ | 1871 | */ |
1852 | struct GNUNET_CRYPTO_RsaPrivateKey * | 1872 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1853 | GNUNET_CRYPTO_rsa_private_key_create(unsigned int len); | 1873 | GNUNET_CRYPTO_rsa_private_key_create (unsigned int len); |
1854 | 1874 | ||
1855 | 1875 | ||
1856 | /** | 1876 | /** |
@@ -1859,7 +1879,7 @@ GNUNET_CRYPTO_rsa_private_key_create(unsigned int len); | |||
1859 | * @param key pointer to the memory to free | 1879 | * @param key pointer to the memory to free |
1860 | */ | 1880 | */ |
1861 | void | 1881 | void |
1862 | GNUNET_CRYPTO_rsa_private_key_free(struct GNUNET_CRYPTO_RsaPrivateKey *key); | 1882 | GNUNET_CRYPTO_rsa_private_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key); |
1863 | 1883 | ||
1864 | 1884 | ||
1865 | /** | 1885 | /** |
@@ -1871,7 +1891,7 @@ GNUNET_CRYPTO_rsa_private_key_free(struct GNUNET_CRYPTO_RsaPrivateKey *key); | |||
1871 | * @return size of memory allocatedin @a buffer | 1891 | * @return size of memory allocatedin @a buffer |
1872 | */ | 1892 | */ |
1873 | size_t | 1893 | size_t |
1874 | GNUNET_CRYPTO_rsa_private_key_encode( | 1894 | GNUNET_CRYPTO_rsa_private_key_encode ( |
1875 | const struct GNUNET_CRYPTO_RsaPrivateKey *key, | 1895 | const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
1876 | char **buffer); | 1896 | char **buffer); |
1877 | 1897 | ||
@@ -1885,7 +1905,7 @@ GNUNET_CRYPTO_rsa_private_key_encode( | |||
1885 | * @return NULL on error | 1905 | * @return NULL on error |
1886 | */ | 1906 | */ |
1887 | struct GNUNET_CRYPTO_RsaPrivateKey * | 1907 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1888 | GNUNET_CRYPTO_rsa_private_key_decode(const char *buf, size_t len); | 1908 | GNUNET_CRYPTO_rsa_private_key_decode (const char *buf, size_t len); |
1889 | 1909 | ||
1890 | 1910 | ||
1891 | /** | 1911 | /** |
@@ -1895,7 +1915,7 @@ GNUNET_CRYPTO_rsa_private_key_decode(const char *buf, size_t len); | |||
1895 | * @return the duplicate key; NULL upon error | 1915 | * @return the duplicate key; NULL upon error |
1896 | */ | 1916 | */ |
1897 | struct GNUNET_CRYPTO_RsaPrivateKey * | 1917 | struct GNUNET_CRYPTO_RsaPrivateKey * |
1898 | GNUNET_CRYPTO_rsa_private_key_dup( | 1918 | GNUNET_CRYPTO_rsa_private_key_dup ( |
1899 | const struct GNUNET_CRYPTO_RsaPrivateKey *key); | 1919 | const struct GNUNET_CRYPTO_RsaPrivateKey *key); |
1900 | 1920 | ||
1901 | 1921 | ||
@@ -1906,7 +1926,7 @@ GNUNET_CRYPTO_rsa_private_key_dup( | |||
1906 | * @retur NULL on error, otherwise the public key | 1926 | * @retur NULL on error, otherwise the public key |
1907 | */ | 1927 | */ |
1908 | struct GNUNET_CRYPTO_RsaPublicKey * | 1928 | struct GNUNET_CRYPTO_RsaPublicKey * |
1909 | GNUNET_CRYPTO_rsa_private_key_get_public( | 1929 | GNUNET_CRYPTO_rsa_private_key_get_public ( |
1910 | const struct GNUNET_CRYPTO_RsaPrivateKey *priv); | 1930 | const struct GNUNET_CRYPTO_RsaPrivateKey *priv); |
1911 | 1931 | ||
1912 | 1932 | ||
@@ -1917,8 +1937,8 @@ GNUNET_CRYPTO_rsa_private_key_get_public( | |||
1917 | * @param hc where to store the hash code | 1937 | * @param hc where to store the hash code |
1918 | */ | 1938 | */ |
1919 | void | 1939 | void |
1920 | GNUNET_CRYPTO_rsa_public_key_hash(const struct GNUNET_CRYPTO_RsaPublicKey *key, | 1940 | GNUNET_CRYPTO_rsa_public_key_hash (const struct GNUNET_CRYPTO_RsaPublicKey *key, |
1921 | struct GNUNET_HashCode *hc); | 1941 | struct GNUNET_HashCode *hc); |
1922 | 1942 | ||
1923 | 1943 | ||
1924 | /** | 1944 | /** |
@@ -1928,7 +1948,7 @@ GNUNET_CRYPTO_rsa_public_key_hash(const struct GNUNET_CRYPTO_RsaPublicKey *key, | |||
1928 | * @return length of the key in bits | 1948 | * @return length of the key in bits |
1929 | */ | 1949 | */ |
1930 | unsigned int | 1950 | unsigned int |
1931 | GNUNET_CRYPTO_rsa_public_key_len(const struct GNUNET_CRYPTO_RsaPublicKey *key); | 1951 | GNUNET_CRYPTO_rsa_public_key_len (const struct GNUNET_CRYPTO_RsaPublicKey *key); |
1932 | 1952 | ||
1933 | 1953 | ||
1934 | /** | 1954 | /** |
@@ -1937,7 +1957,7 @@ GNUNET_CRYPTO_rsa_public_key_len(const struct GNUNET_CRYPTO_RsaPublicKey *key); | |||
1937 | * @param key pointer to the memory to free | 1957 | * @param key pointer to the memory to free |
1938 | */ | 1958 | */ |
1939 | void | 1959 | void |
1940 | GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key); | 1960 | GNUNET_CRYPTO_rsa_public_key_free (struct GNUNET_CRYPTO_RsaPublicKey *key); |
1941 | 1961 | ||
1942 | 1962 | ||
1943 | /** | 1963 | /** |
@@ -1949,7 +1969,7 @@ GNUNET_CRYPTO_rsa_public_key_free(struct GNUNET_CRYPTO_RsaPublicKey *key); | |||
1949 | * @return size of memory allocated in @a buffer | 1969 | * @return size of memory allocated in @a buffer |
1950 | */ | 1970 | */ |
1951 | size_t | 1971 | size_t |
1952 | GNUNET_CRYPTO_rsa_public_key_encode( | 1972 | GNUNET_CRYPTO_rsa_public_key_encode ( |
1953 | const struct GNUNET_CRYPTO_RsaPublicKey *key, | 1973 | const struct GNUNET_CRYPTO_RsaPublicKey *key, |
1954 | char **buffer); | 1974 | char **buffer); |
1955 | 1975 | ||
@@ -1963,7 +1983,7 @@ GNUNET_CRYPTO_rsa_public_key_encode( | |||
1963 | * @return NULL on error | 1983 | * @return NULL on error |
1964 | */ | 1984 | */ |
1965 | struct GNUNET_CRYPTO_RsaPublicKey * | 1985 | struct GNUNET_CRYPTO_RsaPublicKey * |
1966 | GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len); | 1986 | GNUNET_CRYPTO_rsa_public_key_decode (const char *buf, size_t len); |
1967 | 1987 | ||
1968 | 1988 | ||
1969 | /** | 1989 | /** |
@@ -1973,7 +1993,7 @@ GNUNET_CRYPTO_rsa_public_key_decode(const char *buf, size_t len); | |||
1973 | * @return the duplicate key; NULL upon error | 1993 | * @return the duplicate key; NULL upon error |
1974 | */ | 1994 | */ |
1975 | struct GNUNET_CRYPTO_RsaPublicKey * | 1995 | struct GNUNET_CRYPTO_RsaPublicKey * |
1976 | GNUNET_CRYPTO_rsa_public_key_dup(const struct GNUNET_CRYPTO_RsaPublicKey *key); | 1996 | GNUNET_CRYPTO_rsa_public_key_dup (const struct GNUNET_CRYPTO_RsaPublicKey *key); |
1977 | 1997 | ||
1978 | 1998 | ||
1979 | /** | 1999 | /** |
@@ -1984,8 +2004,8 @@ GNUNET_CRYPTO_rsa_public_key_dup(const struct GNUNET_CRYPTO_RsaPublicKey *key); | |||
1984 | * @return 0 if the two are equal | 2004 | * @return 0 if the two are equal |
1985 | */ | 2005 | */ |
1986 | int | 2006 | int |
1987 | GNUNET_CRYPTO_rsa_signature_cmp(struct GNUNET_CRYPTO_RsaSignature *s1, | 2007 | GNUNET_CRYPTO_rsa_signature_cmp (struct GNUNET_CRYPTO_RsaSignature *s1, |
1988 | struct GNUNET_CRYPTO_RsaSignature *s2); | 2008 | struct GNUNET_CRYPTO_RsaSignature *s2); |
1989 | 2009 | ||
1990 | /** | 2010 | /** |
1991 | * Compare the values of two private keys. | 2011 | * Compare the values of two private keys. |
@@ -1995,8 +2015,8 @@ GNUNET_CRYPTO_rsa_signature_cmp(struct GNUNET_CRYPTO_RsaSignature *s1, | |||
1995 | * @return 0 if the two are equal | 2015 | * @return 0 if the two are equal |
1996 | */ | 2016 | */ |
1997 | int | 2017 | int |
1998 | GNUNET_CRYPTO_rsa_private_key_cmp(struct GNUNET_CRYPTO_RsaPrivateKey *p1, | 2018 | GNUNET_CRYPTO_rsa_private_key_cmp (struct GNUNET_CRYPTO_RsaPrivateKey *p1, |
1999 | struct GNUNET_CRYPTO_RsaPrivateKey *p2); | 2019 | struct GNUNET_CRYPTO_RsaPrivateKey *p2); |
2000 | 2020 | ||
2001 | 2021 | ||
2002 | /** | 2022 | /** |
@@ -2007,8 +2027,8 @@ GNUNET_CRYPTO_rsa_private_key_cmp(struct GNUNET_CRYPTO_RsaPrivateKey *p1, | |||
2007 | * @return 0 if the two are equal | 2027 | * @return 0 if the two are equal |
2008 | */ | 2028 | */ |
2009 | int | 2029 | int |
2010 | GNUNET_CRYPTO_rsa_public_key_cmp(struct GNUNET_CRYPTO_RsaPublicKey *p1, | 2030 | GNUNET_CRYPTO_rsa_public_key_cmp (struct GNUNET_CRYPTO_RsaPublicKey *p1, |
2011 | struct GNUNET_CRYPTO_RsaPublicKey *p2); | 2031 | struct GNUNET_CRYPTO_RsaPublicKey *p2); |
2012 | 2032 | ||
2013 | 2033 | ||
2014 | /** | 2034 | /** |
@@ -2022,11 +2042,11 @@ GNUNET_CRYPTO_rsa_public_key_cmp(struct GNUNET_CRYPTO_RsaPublicKey *p1, | |||
2022 | * @return #GNUNET_YES if successful, #GNUNET_NO if RSA key is malicious | 2042 | * @return #GNUNET_YES if successful, #GNUNET_NO if RSA key is malicious |
2023 | */ | 2043 | */ |
2024 | int | 2044 | int |
2025 | GNUNET_CRYPTO_rsa_blind(const struct GNUNET_HashCode *hash, | 2045 | GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, |
2026 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, | 2046 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, |
2027 | struct GNUNET_CRYPTO_RsaPublicKey *pkey, | 2047 | struct GNUNET_CRYPTO_RsaPublicKey *pkey, |
2028 | char **buf, | 2048 | char **buf, |
2029 | size_t *buf_size); | 2049 | size_t *buf_size); |
2030 | 2050 | ||
2031 | 2051 | ||
2032 | /** | 2052 | /** |
@@ -2038,9 +2058,9 @@ GNUNET_CRYPTO_rsa_blind(const struct GNUNET_HashCode *hash, | |||
2038 | * @return NULL on error, signature on success | 2058 | * @return NULL on error, signature on success |
2039 | */ | 2059 | */ |
2040 | struct GNUNET_CRYPTO_RsaSignature * | 2060 | struct GNUNET_CRYPTO_RsaSignature * |
2041 | GNUNET_CRYPTO_rsa_sign_blinded(const struct GNUNET_CRYPTO_RsaPrivateKey *key, | 2061 | GNUNET_CRYPTO_rsa_sign_blinded (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
2042 | const void *msg, | 2062 | const void *msg, |
2043 | size_t msg_len); | 2063 | size_t msg_len); |
2044 | 2064 | ||
2045 | 2065 | ||
2046 | /** | 2066 | /** |
@@ -2051,8 +2071,8 @@ GNUNET_CRYPTO_rsa_sign_blinded(const struct GNUNET_CRYPTO_RsaPrivateKey *key, | |||
2051 | * @return NULL on error, including a malicious RSA key, signature on success | 2071 | * @return NULL on error, including a malicious RSA key, signature on success |
2052 | */ | 2072 | */ |
2053 | struct GNUNET_CRYPTO_RsaSignature * | 2073 | struct GNUNET_CRYPTO_RsaSignature * |
2054 | GNUNET_CRYPTO_rsa_sign_fdh(const struct GNUNET_CRYPTO_RsaPrivateKey *key, | 2074 | GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, |
2055 | const struct GNUNET_HashCode *hash); | 2075 | const struct GNUNET_HashCode *hash); |
2056 | 2076 | ||
2057 | 2077 | ||
2058 | /** | 2078 | /** |
@@ -2061,7 +2081,7 @@ GNUNET_CRYPTO_rsa_sign_fdh(const struct GNUNET_CRYPTO_RsaPrivateKey *key, | |||
2061 | * @param sig memory to free | 2081 | * @param sig memory to free |
2062 | */ | 2082 | */ |
2063 | void | 2083 | void |
2064 | GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig); | 2084 | GNUNET_CRYPTO_rsa_signature_free (struct GNUNET_CRYPTO_RsaSignature *sig); |
2065 | 2085 | ||
2066 | 2086 | ||
2067 | /** | 2087 | /** |
@@ -2072,7 +2092,7 @@ GNUNET_CRYPTO_rsa_signature_free(struct GNUNET_CRYPTO_RsaSignature *sig); | |||
2072 | * @return size of memory allocated in @a buffer | 2092 | * @return size of memory allocated in @a buffer |
2073 | */ | 2093 | */ |
2074 | size_t | 2094 | size_t |
2075 | GNUNET_CRYPTO_rsa_signature_encode( | 2095 | GNUNET_CRYPTO_rsa_signature_encode ( |
2076 | const struct GNUNET_CRYPTO_RsaSignature *sig, | 2096 | const struct GNUNET_CRYPTO_RsaSignature *sig, |
2077 | char **buffer); | 2097 | char **buffer); |
2078 | 2098 | ||
@@ -2086,7 +2106,7 @@ GNUNET_CRYPTO_rsa_signature_encode( | |||
2086 | * @return NULL on error | 2106 | * @return NULL on error |
2087 | */ | 2107 | */ |
2088 | struct GNUNET_CRYPTO_RsaSignature * | 2108 | struct GNUNET_CRYPTO_RsaSignature * |
2089 | GNUNET_CRYPTO_rsa_signature_decode(const char *buf, size_t len); | 2109 | GNUNET_CRYPTO_rsa_signature_decode (const char *buf, size_t len); |
2090 | 2110 | ||
2091 | 2111 | ||
2092 | /** | 2112 | /** |
@@ -2096,7 +2116,7 @@ GNUNET_CRYPTO_rsa_signature_decode(const char *buf, size_t len); | |||
2096 | * @return the duplicate key; NULL upon error | 2116 | * @return the duplicate key; NULL upon error |
2097 | */ | 2117 | */ |
2098 | struct GNUNET_CRYPTO_RsaSignature * | 2118 | struct GNUNET_CRYPTO_RsaSignature * |
2099 | GNUNET_CRYPTO_rsa_signature_dup(const struct GNUNET_CRYPTO_RsaSignature *sig); | 2119 | GNUNET_CRYPTO_rsa_signature_dup (const struct GNUNET_CRYPTO_RsaSignature *sig); |
2100 | 2120 | ||
2101 | 2121 | ||
2102 | /** | 2122 | /** |
@@ -2110,9 +2130,9 @@ GNUNET_CRYPTO_rsa_signature_dup(const struct GNUNET_CRYPTO_RsaSignature *sig); | |||
2110 | * @return unblinded signature on success, NULL if RSA key is bad or malicious. | 2130 | * @return unblinded signature on success, NULL if RSA key is bad or malicious. |
2111 | */ | 2131 | */ |
2112 | struct GNUNET_CRYPTO_RsaSignature * | 2132 | struct GNUNET_CRYPTO_RsaSignature * |
2113 | GNUNET_CRYPTO_rsa_unblind(const struct GNUNET_CRYPTO_RsaSignature *sig, | 2133 | GNUNET_CRYPTO_rsa_unblind (const struct GNUNET_CRYPTO_RsaSignature *sig, |
2114 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, | 2134 | const struct GNUNET_CRYPTO_RsaBlindingKeySecret *bks, |
2115 | struct GNUNET_CRYPTO_RsaPublicKey *pkey); | 2135 | struct GNUNET_CRYPTO_RsaPublicKey *pkey); |
2116 | 2136 | ||
2117 | 2137 | ||
2118 | /** | 2138 | /** |
@@ -2125,9 +2145,9 @@ GNUNET_CRYPTO_rsa_unblind(const struct GNUNET_CRYPTO_RsaSignature *sig, | |||
2125 | * @returns #GNUNET_YES if ok, #GNUNET_NO if RSA key is malicious, #GNUNET_SYSERR if signature | 2145 | * @returns #GNUNET_YES if ok, #GNUNET_NO if RSA key is malicious, #GNUNET_SYSERR if signature |
2126 | */ | 2146 | */ |
2127 | int | 2147 | int |
2128 | GNUNET_CRYPTO_rsa_verify(const struct GNUNET_HashCode *hash, | 2148 | GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, |
2129 | const struct GNUNET_CRYPTO_RsaSignature *sig, | 2149 | const struct GNUNET_CRYPTO_RsaSignature *sig, |
2130 | const struct GNUNET_CRYPTO_RsaPublicKey *public_key); | 2150 | const struct GNUNET_CRYPTO_RsaPublicKey *public_key); |
2131 | 2151 | ||
2132 | 2152 | ||
2133 | #if 0 /* keep Emacsens' auto-indent happy */ | 2153 | #if 0 /* keep Emacsens' auto-indent happy */ |