aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_crypto_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-08 19:00:19 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-08 19:00:19 +0000
commitfe947a9704bed14c2fc74b2f2069596fe884cbad (patch)
tree644efdaa37d692b09f8e279bfe5e8b2ebe81448b /src/include/gnunet_crypto_lib.h
parenta8b0ab037820f6a9f405be3855ce8d3ebbd4399b (diff)
downloadgnunet-fe947a9704bed14c2fc74b2f2069596fe884cbad.tar.gz
gnunet-fe947a9704bed14c2fc74b2f2069596fe884cbad.zip
better comments
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r--src/include/gnunet_crypto_lib.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 9b795cc75..76d28ad57 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -228,8 +228,7 @@ uint32_t GNUNET_CRYPTO_random_u32 (enum GNUNET_CRYPTO_Quality mode,
228 228
229 229
230/** 230/**
231 * Random on unsigned 64-bit values. We break them down into signed 231 * Random on unsigned 64-bit values.
232 * 32-bit values and reassemble the 64-bit random value bit-wise.
233 * 232 *
234 * @param mode desired quality of the random number 233 * @param mode desired quality of the random number
235 * @param max value returned will be in range [0,max) (exclusive) 234 * @param max value returned will be in range [0,max) (exclusive)
@@ -278,7 +277,7 @@ int GNUNET_CRYPTO_aes_check_session_key (const struct
278 * @param sessionkey the key used to encrypt 277 * @param sessionkey the key used to encrypt
279 * @param iv the initialization vector to use, use INITVALUE 278 * @param iv the initialization vector to use, use INITVALUE
280 * for streams. 279 * for streams.
281 * @returns the size of the encrypted block, -1 for errors 280 * @return the size of the encrypted block, -1 for errors
282 */ 281 */
283ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block, 282ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block,
284 size_t len, 283 size_t len,
@@ -307,10 +306,10 @@ ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block,
307 306
308 307
309/** 308/**
310 * Convert GNUNET_CRYPTO_hash to ASCII encoding. 309 * Convert hash to ASCII encoding.
311 * @param block the GNUNET_CRYPTO_hash code 310 * @param block the hash code
312 * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsciiEncoded can be 311 * @param result where to store the encoding (struct GNUNET_CRYPTO_HashAsciiEncoded can be
313 * safely cast to char*, a '\0' termination is set). 312 * safely cast to char*, a '\\0' termination is set).
314 */ 313 */
315void GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, 314void GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block,
316 struct GNUNET_CRYPTO_HashAsciiEncoded 315 struct GNUNET_CRYPTO_HashAsciiEncoded
@@ -515,11 +514,11 @@ struct GNUNET_CRYPTO_RsaPrivateKey
515 * Deterministically (!) create a private key using only the 514 * Deterministically (!) create a private key using only the
516 * given HashCode as input to the PRNG. 515 * given HashCode as input to the PRNG.
517 * 516 *
518 * @param input "random" input to PRNG 517 * @param hc "random" input to PRNG
519 * @return some private key purely dependent on input 518 * @return some private key purely dependent on input
520 */ 519 */
521struct GNUNET_CRYPTO_RsaPrivateKey 520struct GNUNET_CRYPTO_RsaPrivateKey
522 *GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * input); 521 *GNUNET_CRYPTO_rsa_key_create_from_hash (const GNUNET_HashCode * hc);
523 522
524 523
525/** 524/**
@@ -550,7 +549,7 @@ void GNUNET_CRYPTO_rsa_key_get_public (const struct
550 * @param size the size of block 549 * @param size the size of block
551 * @param publicKey the encoded public key used to encrypt 550 * @param publicKey the encoded public key used to encrypt
552 * @param target where to store the encrypted block 551 * @param target where to store the encrypted block
553 * @returns GNUNET_SYSERR on error, GNUNET_OK if ok 552 * @return GNUNET_SYSERR on error, GNUNET_OK if ok
554 */ 553 */
555int GNUNET_CRYPTO_rsa_encrypt (const void *block, 554int GNUNET_CRYPTO_rsa_encrypt (const void *block,
556 size_t size, 555 size_t size,
@@ -566,14 +565,14 @@ int GNUNET_CRYPTO_rsa_encrypt (const void *block,
566 * @param key the key to use 565 * @param key the key to use
567 * @param block the data to decrypt, encoded as returned by encrypt, not consumed 566 * @param block the data to decrypt, encoded as returned by encrypt, not consumed
568 * @param result pointer to a location where the result can be stored 567 * @param result pointer to a location where the result can be stored
569 * @param size how many bytes of a result are expected? Must be exact. 568 * @param max how many bytes of a result are expected? Must be exact.
570 * @returns the size of the decrypted block (that is, size) or -1 on error 569 * @return the size of the decrypted block (that is, size) or -1 on error
571 */ 570 */
572ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *key, 571ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
573 const struct GNUNET_CRYPTO_RsaEncryptedData 572 const struct GNUNET_CRYPTO_RsaEncryptedData
574 *block, 573 *block,
575 void *result, 574 void *result,
576 size_t size); 575 size_t max);
577 576
578 577
579/** 578/**
@@ -581,13 +580,13 @@ ssize_t GNUNET_CRYPTO_rsa_decrypt (const struct GNUNET_CRYPTO_RsaPrivateKey *key
581 * 580 *
582 * @param key private key to use for the signing 581 * @param key private key to use for the signing
583 * @param purpose what to sign (size, purpose) 582 * @param purpose what to sign (size, purpose)
584 * @param result where to write the signature 583 * @param sig where to write the signature
585 * @return GNUNET_SYSERR on error, GNUNET_OK on success 584 * @return GNUNET_SYSERR on error, GNUNET_OK on success
586 */ 585 */
587int GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key, 586int GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
588 const struct GNUNET_CRYPTO_RsaSignaturePurpose 587 const struct GNUNET_CRYPTO_RsaSignaturePurpose
589 *purpose, 588 *purpose,
590 struct GNUNET_CRYPTO_RsaSignature *result); 589 struct GNUNET_CRYPTO_RsaSignature *sig);
591 590
592 591
593/** 592/**
@@ -598,7 +597,7 @@ int GNUNET_CRYPTO_rsa_sign (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
598 * @param validate block to validate (size, purpose, data) 597 * @param validate block to validate (size, purpose, data)
599 * @param sig signature that is being validated 598 * @param sig signature that is being validated
600 * @param publicKey public key of the signer 599 * @param publicKey public key of the signer
601 * @returns GNUNET_OK if ok, GNUNET_SYSERR if invalid 600 * @return GNUNET_OK if ok, GNUNET_SYSERR if invalid
602 */ 601 */
603int GNUNET_CRYPTO_rsa_verify (uint32_t purpose, 602int GNUNET_CRYPTO_rsa_verify (uint32_t purpose,
604 const struct GNUNET_CRYPTO_RsaSignaturePurpose 603 const struct GNUNET_CRYPTO_RsaSignaturePurpose