#include <pthread.h>
#if HAVE_LIBGCRYPT
-# include <pthread.h>
# if defined __APPLE__
/* default xcode compiler throws warnings even when deprecated functionality
* is not used. -Werror breaks the build because of erroneous warnings.
#if HAVE_LIBGCRYPT
# if GCRYPT_VERSION_NUMBER < 0x010600
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ if (gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
+ return (0);
# endif
if (!gcry_check_version (GCRYPT_VERSION))
return (0);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
+ if (!gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0))
+ return (0);
+
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
result = 1;
value_t pkg_values[vl->values_len];
size_t offset;
- size_t i;
packet_len = sizeof (pkg_type) + sizeof (pkg_length)
+ sizeof (pkg_num_values)
pkg_length = htons ((uint16_t) packet_len);
pkg_num_values = htons ((uint16_t) vl->values_len);
- for (i = 0; i < vl->values_len; i++)
+ for (size_t i = 0; i < vl->values_len; i++)
{
pkg_values_types[i] = (uint8_t) vl->values_types[i];
switch (vl->values_types[i])
uint16_t pkg_type = htons (TYPE_ENCR_AES256);
uint16_t pkg_length = 0; /* Filled in in finalize. */
uint16_t pkg_user_len = htons ((uint16_t) username_length);
- char hash[20];
+ /* Filled in in finalize. */
+ char hash[20] = { 0 };
nb->encr_header_len = username_length;
nb->encr_header_len += PART_ENCRYPTION_AES256_SIZE;
gcry_randomize ((void *) &nb->encr_iv, sizeof (nb->encr_iv),
GCRY_STRONG_RANDOM);
- /* Filled in in finalize. */
- memset (hash, 0, sizeof (hash));
-
ADD_STATIC (nb, pkg_type);
ADD_STATIC (nb, pkg_length);
ADD_STATIC (nb, pkg_user_len);