aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_crypto_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r--src/include/gnunet_crypto_lib.h92
1 files changed, 39 insertions, 53 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index ec71a791b..30a7d9ee0 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -295,8 +295,7 @@ int GNUNET_CRYPTO_aes_check_session_key (const struct
295 * for streams. 295 * for streams.
296 * @return the size of the encrypted block, -1 for errors 296 * @return the size of the encrypted block, -1 for errors
297 */ 297 */
298ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block, 298ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block, size_t len,
299 size_t len,
300 const struct GNUNET_CRYPTO_AesSessionKey 299 const struct GNUNET_CRYPTO_AesSessionKey
301 *sessionkey, 300 *sessionkey,
302 const struct 301 const struct
@@ -314,8 +313,7 @@ ssize_t GNUNET_CRYPTO_aes_encrypt (const void *block,
314 * @param result address to store the result at 313 * @param result address to store the result at
315 * @return -1 on failure, size of decrypted block on success 314 * @return -1 on failure, size of decrypted block on success
316 */ 315 */
317ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block, 316ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block, size_t size,
318 size_t size,
319 const struct GNUNET_CRYPTO_AesSessionKey 317 const struct GNUNET_CRYPTO_AesSessionKey
320 *sessionkey, 318 *sessionkey,
321 const struct 319 const struct
@@ -331,10 +329,11 @@ ssize_t GNUNET_CRYPTO_aes_decrypt (const void *block,
331 * @param salt_len size of the salt 329 * @param salt_len size of the salt
332 * @param ... pairs of void * & size_t for context chunks, terminated by NULL 330 * @param ... pairs of void * & size_t for context chunks, terminated by NULL
333 */ 331 */
334void 332void GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector
335GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv, 333 *iv,
336 const struct GNUNET_CRYPTO_AesSessionKey *skey, 334 const struct GNUNET_CRYPTO_AesSessionKey
337 const void *salt, size_t salt_len, ...); 335 *skey, const void *salt, size_t salt_len,
336 ...);
338 337
339 338
340/** 339/**
@@ -345,10 +344,11 @@ GNUNET_CRYPTO_aes_derive_iv (struct GNUNET_CRYPTO_AesInitializationVector *iv,
345 * @param salt_len size of the salt 344 * @param salt_len size of the salt
346 * @param argp pairs of void * & size_t for context chunks, terminated by NULL 345 * @param argp pairs of void * & size_t for context chunks, terminated by NULL
347 */ 346 */
348void 347void GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector
349GNUNET_CRYPTO_aes_derive_iv_v (struct GNUNET_CRYPTO_AesInitializationVector *iv, 348 *iv,
350 const struct GNUNET_CRYPTO_AesSessionKey *skey, 349 const struct GNUNET_CRYPTO_AesSessionKey
351 const void *salt, size_t salt_len, va_list argp); 350 *skey, const void *salt, size_t salt_len,
351 va_list argp);
352 352
353 353
354/** 354/**
@@ -403,10 +403,9 @@ void GNUNET_CRYPTO_hash (const void *block, size_t size, GNUNET_HashCode * ret);
403 * @param plaintext_len length of plaintext 403 * @param plaintext_len length of plaintext
404 * @param hmac where to store the hmac 404 * @param hmac where to store the hmac
405 */ 405 */
406void 406void GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
407GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, 407 const void *plaintext, size_t plaintext_len,
408 const void *plaintext, 408 GNUNET_HashCode * hmac);
409 size_t plaintext_len, GNUNET_HashCode * hmac);
410 409
411 410
412/** 411/**
@@ -511,8 +510,8 @@ void GNUNET_CRYPTO_hash_xor (const GNUNET_HashCode * a,
511 */ 510 */
512void GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc, 511void GNUNET_CRYPTO_hash_to_aes_key (const GNUNET_HashCode * hc,
513 struct GNUNET_CRYPTO_AesSessionKey *skey, 512 struct GNUNET_CRYPTO_AesSessionKey *skey,
514 struct 513 struct GNUNET_CRYPTO_AesInitializationVector
515 GNUNET_CRYPTO_AesInitializationVector *iv); 514 *iv);
516 515
517 516
518/** 517/**
@@ -574,11 +573,10 @@ int GNUNET_CRYPTO_hash_xorcmp (const GNUNET_HashCode * h1,
574 * @param salt_len size of the salt 573 * @param salt_len size of the salt
575 * @param argp pair of void * & size_t for context chunks, terminated by NULL 574 * @param argp pair of void * & size_t for context chunks, terminated by NULL
576 */ 575 */
577void 576void GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key,
578GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key, 577 const struct GNUNET_CRYPTO_AesSessionKey
579 const struct GNUNET_CRYPTO_AesSessionKey *rkey, 578 *rkey, const void *salt, size_t salt_len,
580 const void *salt, 579 va_list argp);
581 size_t salt_len, va_list argp);
582 580
583 581
584/** 582/**
@@ -589,10 +587,10 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key,
589 * @param salt_len size of the salt 587 * @param salt_len size of the salt
590 * @param ... pair of void * & size_t for context chunks, terminated by NULL 588 * @param ... pair of void * & size_t for context chunks, terminated by NULL
591 */ 589 */
592void 590void GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key,
593GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, 591 const struct GNUNET_CRYPTO_AesSessionKey
594 const struct GNUNET_CRYPTO_AesSessionKey *rkey, 592 *rkey, const void *salt, size_t salt_len,
595 const void *salt, size_t salt_len, ...); 593 ...);
596 594
597/** 595/**
598 * @brief Derive key 596 * @brief Derive key
@@ -606,12 +604,9 @@ GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key,
606 * @param skm_len length of skm 604 * @param skm_len length of skm
607 * @return GNUNET_YES on success 605 * @return GNUNET_YES on success
608 */ 606 */
609int 607int GNUNET_CRYPTO_hkdf (void *result, size_t out_len, int xtr_algo,
610GNUNET_CRYPTO_hkdf (void *result, 608 int prf_algo, const void *xts, size_t xts_len,
611 size_t out_len, 609 const void *skm, size_t skm_len, ...);
612 int xtr_algo, int prf_algo,
613 const void *xts, size_t xts_len,
614 const void *skm, size_t skm_len, ...);
615 610
616 611
617/** 612/**
@@ -627,13 +622,9 @@ GNUNET_CRYPTO_hkdf (void *result,
627 * @param argp va_list of void * & size_t pairs for context chunks 622 * @param argp va_list of void * & size_t pairs for context chunks
628 * @return GNUNET_YES on success 623 * @return GNUNET_YES on success
629 */ 624 */
630int 625int GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo,
631GNUNET_CRYPTO_hkdf_v (void *result, 626 int prf_algo, const void *xts, size_t xts_len,
632 size_t out_len, 627 const void *skm, size_t skm_len, va_list argp);
633 int xtr_algo,
634 int prf_algo,
635 const void *xts, size_t xts_len,
636 const void *skm, size_t skm_len, va_list argp);
637 628
638 629
639/** 630/**
@@ -647,11 +638,9 @@ GNUNET_CRYPTO_hkdf_v (void *result,
647 * @param argp va_list of void * & size_t pairs for context chunks 638 * @param argp va_list of void * & size_t pairs for context chunks
648 * @return GNUNET_YES on success 639 * @return GNUNET_YES on success
649 */ 640 */
650int 641int GNUNET_CRYPTO_kdf_v (void *result, size_t out_len, const void *xts,
651GNUNET_CRYPTO_kdf_v (void *result, 642 size_t xts_len, const void *skm, size_t skm_len,
652 size_t out_len, 643 va_list argp);
653 const void *xts, size_t xts_len,
654 const void *skm, size_t skm_len, va_list argp);
655 644
656 645
657/** 646/**
@@ -665,10 +654,8 @@ GNUNET_CRYPTO_kdf_v (void *result,
665 * @param ... void * & size_t pairs for context chunks 654 * @param ... void * & size_t pairs for context chunks
666 * @return GNUNET_YES on success 655 * @return GNUNET_YES on success
667 */ 656 */
668int 657int GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts,
669GNUNET_CRYPTO_kdf (void *result, size_t out_len, 658 size_t xts_len, const void *skm, size_t skm_len, ...);
670 const void *xts, size_t xts_len, const void *skm,
671 size_t skm_len, ...);
672 659
673 660
674/** 661/**
@@ -731,8 +718,8 @@ void GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey);
731 * @param priv the private key 718 * @param priv the private key
732 * @param pub where to write the public key 719 * @param pub where to write the public key
733 */ 720 */
734void GNUNET_CRYPTO_rsa_key_get_public (const struct 721void GNUNET_CRYPTO_rsa_key_get_public (const struct GNUNET_CRYPTO_RsaPrivateKey
735 GNUNET_CRYPTO_RsaPrivateKey *priv, 722 *priv,
736 struct 723 struct
737 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded 724 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
738 *pub); 725 *pub);
@@ -748,8 +735,7 @@ void GNUNET_CRYPTO_rsa_key_get_public (const struct
748 * @param target where to store the encrypted block 735 * @param target where to store the encrypted block
749 * @return GNUNET_SYSERR on error, GNUNET_OK if ok 736 * @return GNUNET_SYSERR on error, GNUNET_OK if ok
750 */ 737 */
751int GNUNET_CRYPTO_rsa_encrypt (const void *block, 738int GNUNET_CRYPTO_rsa_encrypt (const void *block, size_t size,
752 size_t size,
753 const struct 739 const struct
754 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded 740 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
755 *publicKey, 741 *publicKey,