#include "gnunet_crypto_lib.h"
#include <gcrypt.h>
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
/**
* Create a new SessionKey (for AES-256).
*/
* @returns the size of the encrypted block, -1 for errors
*/
ssize_t
-GNUNET_CRYPTO_aes_encrypt (const void *block,
- size_t len,
- const struct GNUNET_CRYPTO_AesSessionKey
- * sessionkey,
- const struct GNUNET_CRYPTO_AesInitializationVector
- * iv, void *result)
+GNUNET_CRYPTO_aes_encrypt (const void *block, size_t len,
+ const struct GNUNET_CRYPTO_AesSessionKey *
+ sessionkey,
+ const struct GNUNET_CRYPTO_AesInitializationVector *
+ iv, void *result)
{
gcry_cipher_hd_t handle;
int rc;
GNUNET_break (0);
return -1;
}
- GNUNET_assert (0 == gcry_cipher_open (&handle,
- GCRY_CIPHER_AES256,
- GCRY_CIPHER_MODE_CFB, 0));
+ GNUNET_assert (0 ==
+ gcry_cipher_open (&handle, GCRY_CIPHER_AES256,
+ GCRY_CIPHER_MODE_CFB, 0));
rc = gcry_cipher_setkey (handle, sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH);
GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
rc = gcry_cipher_setiv (handle, iv,
* @return -1 on failure, size of decrypted block on success
*/
ssize_t
-GNUNET_CRYPTO_aes_decrypt (const void *block,
- size_t size,
- const struct GNUNET_CRYPTO_AesSessionKey
- * sessionkey,
- const struct GNUNET_CRYPTO_AesInitializationVector
- * iv, void *result)
+GNUNET_CRYPTO_aes_decrypt (const void *block, size_t size,
+ const struct GNUNET_CRYPTO_AesSessionKey *
+ sessionkey,
+ const struct GNUNET_CRYPTO_AesInitializationVector *
+ iv, void *result)
{
gcry_cipher_hd_t handle;
int rc;
GNUNET_break (0);
return -1;
}
- GNUNET_assert (0 == gcry_cipher_open (&handle,
- GCRY_CIPHER_AES256,
- GCRY_CIPHER_MODE_CFB, 0));
+ GNUNET_assert (0 ==
+ gcry_cipher_open (&handle, GCRY_CIPHER_AES256,
+ GCRY_CIPHER_MODE_CFB, 0));
rc = gcry_cipher_setkey (handle, sessionkey, GNUNET_CRYPTO_AES_KEY_LENGTH);
GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY));
rc = gcry_cipher_setiv (handle, iv,