diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-14 23:05:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-14 23:05:42 +0000 |
commit | ca173048a26a418866163d14c9159b9ad712644b (patch) | |
tree | 7ec72935229086d494257d144dcb373b5ea858cd /src/include/gnunet_crypto_lib.h | |
parent | 17d1146c625092753e1b29b7ce6f0dfb603fbd09 (diff) | |
download | gnunet-ca173048a26a418866163d14c9159b9ad712644b.tar.gz gnunet-ca173048a26a418866163d14c9159b9ad712644b.zip |
-doxygen
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 4d4455af4..19813a693 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -220,7 +220,7 @@ struct GNUNET_CRYPTO_AuthKey | |||
220 | /* **************** Functions and Macros ************* */ | 220 | /* **************** Functions and Macros ************* */ |
221 | 221 | ||
222 | /** | 222 | /** |
223 | * Seed a weak random generator. Only GNUNET_CRYPTO_QUALITY_WEAK-mode generator | 223 | * Seed a weak random generator. Only #GNUNET_CRYPTO_QUALITY_WEAK-mode generator |
224 | * can be seeded. | 224 | * can be seeded. |
225 | * | 225 | * |
226 | * @param seed the seed to use | 226 | * @param seed the seed to use |
@@ -234,7 +234,7 @@ GNUNET_CRYPTO_seed_weak_random (int32_t seed); | |||
234 | * | 234 | * |
235 | * @param sum current sum, initially 0 | 235 | * @param sum current sum, initially 0 |
236 | * @param buf buffer to calculate CRC over (must be 16-bit aligned) | 236 | * @param buf buffer to calculate CRC over (must be 16-bit aligned) |
237 | * @param len number of bytes in hdr, must be multiple of 2 | 237 | * @param len number of bytes in @a buf, must be multiple of 2 |
238 | * @return updated crc sum (must be subjected to GNUNET_CRYPTO_crc16_finish to get actual crc16) | 238 | * @return updated crc sum (must be subjected to GNUNET_CRYPTO_crc16_finish to get actual crc16) |
239 | */ | 239 | */ |
240 | uint32_t | 240 | uint32_t |
@@ -254,8 +254,8 @@ GNUNET_CRYPTO_crc16_finish (uint32_t sum); | |||
254 | /** | 254 | /** |
255 | * Calculate the checksum of a buffer in one step. | 255 | * Calculate the checksum of a buffer in one step. |
256 | * | 256 | * |
257 | * @param buf buffer to calculate CRC over (must be 16-bit aligned) | 257 | * @param buf buffer to calculate CRC over (must be 16-bit aligned) |
258 | * @param len number of bytes in hdr, must be multiple of 2 | 258 | * @param len number of bytes in @a buf, must be multiple of 2 |
259 | * @return crc16 value | 259 | * @return crc16 value |
260 | */ | 260 | */ |
261 | uint16_t | 261 | uint16_t |
@@ -267,7 +267,7 @@ GNUNET_CRYPTO_crc16_n (const void *buf, size_t len); | |||
267 | * bytes of the buffer. | 267 | * bytes of the buffer. |
268 | * | 268 | * |
269 | * @param buf the data over which we're taking the CRC | 269 | * @param buf the data over which we're taking the CRC |
270 | * @param len the length of the buffer in bytes | 270 | * @param len the length of the buffer @buf in bytes |
271 | * @return the resulting CRC32 checksum | 271 | * @return the resulting CRC32 checksum |
272 | */ | 272 | */ |
273 | int32_t | 273 | int32_t |
@@ -279,7 +279,7 @@ GNUNET_CRYPTO_crc32_n (const void *buf, size_t len); | |||
279 | * | 279 | * |
280 | * @param mode desired quality of the random number | 280 | * @param mode desired quality of the random number |
281 | * @param i the upper limit (exclusive) for the random number | 281 | * @param i the upper limit (exclusive) for the random number |
282 | * @return a random value in the interval [0,i) (exclusive). | 282 | * @return a random value in the interval [0,@a i) (exclusive). |
283 | */ | 283 | */ |
284 | uint32_t | 284 | uint32_t |
285 | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i); | 285 | GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i); |
@@ -289,7 +289,7 @@ GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode, uint32_t i); | |||
289 | * Random on unsigned 64-bit values. | 289 | * Random on unsigned 64-bit values. |
290 | * | 290 | * |
291 | * @param mode desired quality of the random number | 291 | * @param mode desired quality of the random number |
292 | * @param max value returned will be in range [0,max) (exclusive) | 292 | * @param max value returned will be in range [0,@a max) (exclusive) |
293 | * @return random 64-bit number | 293 | * @return random 64-bit number |
294 | */ | 294 | */ |
295 | uint64_t | 295 | uint64_t |
@@ -299,7 +299,8 @@ GNUNET_CRYPTO_random_u64 (enum GNUNET_CRYPTO_Quality mode, uint64_t max); | |||
299 | /** | 299 | /** |
300 | * Get an array with a random permutation of the | 300 | * Get an array with a random permutation of the |
301 | * numbers 0...n-1. | 301 | * numbers 0...n-1. |
302 | * @param mode GNUNET_CRYPTO_QUALITY_STRONG if the strong (but expensive) PRNG should be used, GNUNET_CRYPTO_QUALITY_WEAK otherwise | 302 | * @param mode #GNUNET_CRYPTO_QUALITY_STRONG if the strong (but expensive) PRNG should be used, |
303 | * #GNUNET_CRYPTO_QUALITY_WEAK or #GNUNET_CRYPTO_QUALITY_NONCE otherwise | ||
303 | * @param n the size of the array | 304 | * @param n the size of the array |
304 | * @return the permutation array (allocated from heap) | 305 | * @return the permutation array (allocated from heap) |
305 | */ | 306 | */ |
@@ -406,22 +407,22 @@ GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode * bloc | |||
406 | * Convert ASCII encoding back to a 'struct GNUNET_HashCode' | 407 | * Convert ASCII encoding back to a 'struct GNUNET_HashCode' |
407 | * | 408 | * |
408 | * @param enc the encoding | 409 | * @param enc the encoding |
409 | * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing) | 410 | * @param enclen number of characters in @a enc (without 0-terminator, which can be missing) |
410 | * @param result where to store the GNUNET_CRYPTO_hash code | 411 | * @param result where to store the hash code |
411 | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding | 412 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding |
412 | */ | 413 | */ |
413 | int | 414 | int |
414 | GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | 415 | GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, |
415 | struct GNUNET_HashCode * result); | 416 | struct GNUNET_HashCode *result); |
416 | 417 | ||
417 | 418 | ||
418 | /** | 419 | /** |
419 | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | 420 | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' |
420 | * | 421 | * |
421 | * @param enc the encoding | 422 | * @param enc the encoding |
422 | * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing) | 423 | * @param enclen number of characters in @a enc (without 0-terminator, which can be missing) |
423 | * @param result where to store the GNUNET_CRYPTO_hash code | 424 | * @param result where to store the hash code |
424 | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding | 425 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding |
425 | */ | 426 | */ |
426 | int | 427 | int |
427 | GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | 428 | GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, |
@@ -444,7 +445,7 @@ GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | |||
444 | * | 445 | * |
445 | * @param enc the encoding | 446 | * @param enc the encoding |
446 | * @param result where to store the GNUNET_CRYPTO_ShortHash | 447 | * @param result where to store the GNUNET_CRYPTO_ShortHash |
447 | * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding | 448 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding |
448 | */ | 449 | */ |
449 | #define GNUNET_CRYPTO_short_hash_from_string(enc, result) \ | 450 | #define GNUNET_CRYPTO_short_hash_from_string(enc, result) \ |
450 | GNUNET_CRYPTO_short_hash_from_string2 (enc, strlen(enc), result) | 451 | GNUNET_CRYPTO_short_hash_from_string2 (enc, strlen(enc), result) |
@@ -482,7 +483,7 @@ GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode * a, | |||
482 | * Compute hash of a given block. | 483 | * Compute hash of a given block. |
483 | * | 484 | * |
484 | * @param block the data to hash | 485 | * @param block the data to hash |
485 | * @param size size of the block | 486 | * @param size size of the @a block |
486 | * @param ret pointer to where to write the hashcode | 487 | * @param ret pointer to where to write the hashcode |
487 | */ | 488 | */ |
488 | void | 489 | void |
@@ -493,7 +494,7 @@ GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret | |||
493 | * Compute short (256-bit) hash of a given block. | 494 | * Compute short (256-bit) hash of a given block. |
494 | * | 495 | * |
495 | * @param block the data to hash | 496 | * @param block the data to hash |
496 | * @param size size of the block | 497 | * @param size size of the @a block |
497 | * @param ret pointer to where to write the hashcode | 498 | * @param ret pointer to where to write the hashcode |
498 | */ | 499 | */ |
499 | void | 500 | void |
@@ -530,7 +531,7 @@ GNUNET_CRYPTO_short_hash_from_truncation (const struct GNUNET_HashCode *dh, | |||
530 | * | 531 | * |
531 | * @param key secret key | 532 | * @param key secret key |
532 | * @param plaintext input plaintext | 533 | * @param plaintext input plaintext |
533 | * @param plaintext_len length of plaintext | 534 | * @param plaintext_len length of @a plaintext |
534 | * @param hmac where to store the hmac | 535 | * @param hmac where to store the hmac |
535 | */ | 536 | */ |
536 | void | 537 | void |
@@ -598,7 +599,7 @@ GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode, | |||
598 | * | 599 | * |
599 | * @param a some hash code | 600 | * @param a some hash code |
600 | * @param b some hash code | 601 | * @param b some hash code |
601 | * @param result set to b - a | 602 | * @param result set to @a b - @a a |
602 | */ | 603 | */ |
603 | void | 604 | void |
604 | GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a, | 605 | GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a, |
@@ -611,7 +612,7 @@ GNUNET_CRYPTO_hash_difference (const struct GNUNET_HashCode * a, | |||
611 | * | 612 | * |
612 | * @param a some hash code | 613 | * @param a some hash code |
613 | * @param delta some hash code | 614 | * @param delta some hash code |
614 | * @param result set to a + delta | 615 | * @param result set to @a a + @a delta |
615 | */ | 616 | */ |
616 | void | 617 | void |
617 | GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a, | 618 | GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a, |
@@ -624,7 +625,7 @@ GNUNET_CRYPTO_hash_sum (const struct GNUNET_HashCode * a, | |||
624 | * | 625 | * |
625 | * @param a some hash code | 626 | * @param a some hash code |
626 | * @param b some hash code | 627 | * @param b some hash code |
627 | * @param result set to a ^ b | 628 | * @param result set to @a a ^ @a b |
628 | */ | 629 | */ |
629 | void | 630 | void |
630 | GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_HashCode * b, | 631 | GNUNET_CRYPTO_hash_xor (const struct GNUNET_HashCode * a, const struct GNUNET_HashCode * b, |
@@ -655,6 +656,7 @@ GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode * hc, | |||
655 | int | 656 | int |
656 | GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bit); | 657 | GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bit); |
657 | 658 | ||
659 | |||
658 | /** | 660 | /** |
659 | * Determine how many low order bits match in two | 661 | * Determine how many low order bits match in two |
660 | * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share | 662 | * struct GNUNET_HashCodes. i.e. - 010011 and 011111 share |
@@ -664,7 +666,6 @@ GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bi | |||
664 | * | 666 | * |
665 | * @param first the first hashcode | 667 | * @param first the first hashcode |
666 | * @param second the hashcode to compare first to | 668 | * @param second the hashcode to compare first to |
667 | * | ||
668 | * @return the number of bits that match | 669 | * @return the number of bits that match |
669 | */ | 670 | */ |
670 | unsigned int | 671 | unsigned int |
@@ -919,7 +920,7 @@ GNUNET_CRYPTO_ecc_setup_hostkey (const char *cfg_name); | |||
919 | * | 920 | * |
920 | * @param cfg configuration to use | 921 | * @param cfg configuration to use |
921 | * @param dst pointer to where to write the peer identity | 922 | * @param dst pointer to where to write the peer identity |
922 | * @return GNUNET_OK on success, GNUNET_SYSERR if the identity | 923 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the identity |
923 | * could not be retrieved | 924 | * could not be retrieved |
924 | */ | 925 | */ |
925 | int | 926 | int |
@@ -933,7 +934,7 @@ GNUNET_CRYPTO_get_host_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
933 | * @param priv private key to use for the ECDH (x) | 934 | * @param priv private key to use for the ECDH (x) |
934 | * @param pub public key to use for the ECDY (yG) | 935 | * @param pub public key to use for the ECDY (yG) |
935 | * @param key_material where to write the key material (xyG) | 936 | * @param key_material where to write the key material (xyG) |
936 | * @return GNUNET_SYSERR on error, GNUNET_OK on success | 937 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
937 | */ | 938 | */ |
938 | int | 939 | int |
939 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | 940 | GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, |
@@ -947,7 +948,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | |||
947 | * @param priv private key to use for the signing | 948 | * @param priv private key to use for the signing |
948 | * @param purpose what to sign (size, purpose) | 949 | * @param purpose what to sign (size, purpose) |
949 | * @param sig where to write the signature | 950 | * @param sig where to write the signature |
950 | * @return GNUNET_SYSERR on error, GNUNET_OK on success | 951 | * @return #GNUNET_SYSERR on error, #GNUNET_OK on success |
951 | */ | 952 | */ |
952 | int | 953 | int |
953 | GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | 954 | GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, |
@@ -962,7 +963,7 @@ GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, | |||
962 | * @param validate block to validate (size, purpose, data) | 963 | * @param validate block to validate (size, purpose, data) |
963 | * @param sig signature that is being validated | 964 | * @param sig signature that is being validated |
964 | * @param pub public key of the signer | 965 | * @param pub public key of the signer |
965 | * @returns GNUNET_OK if ok, GNUNET_SYSERR if invalid | 966 | * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid |
966 | */ | 967 | */ |
967 | int | 968 | int |
968 | GNUNET_CRYPTO_ecc_verify (uint32_t purpose, | 969 | GNUNET_CRYPTO_ecc_verify (uint32_t purpose, |