[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#8235) compiler warnings in smbk5pwd.c with nettle

Full_Name: Ryan Tandy
Version: master
OS: Debian
Submission from: (NULL) (
Submitted by: ryan

smbk5pwd.c: In function 'lmhash':
smbk5pwd.c:206:21: warning: passing argument 2 of 'nettle_des_set_key' from
incompatible pointer type [-Wincompatible-pointer-types]
  des_set_key( &ctx, &key );
                     ^AIAIn file included from smbk5pwd.c:69:0:
/usr/include/nettle/des.h:76:1: note: expected 'const uint8_t * {aka const
unsigned char *}' but argument is of type 'unsigned char (*)[8]'
 des_set_key(struct des_ctx *ctx, const uint8_t *key);
(and several more)

The openssl and gcrypt versions both used "&key" as well. It's correct for
openssl, which takes a DES_cblock *. It's ambiguous for gcrypt, which takes a
void *. It's wrong for nettle, which expects an unsigned char *.

This is not a functional problem, since in all cases the pointer points at the
beginning of the array. Fixing the warning does not change the output.

smbk5pwd.c: In function 'nthash':
smbk5pwd.c:249:36: warning: pointer targets in passing argument 3 of
'nettle_md4_update' differ in signedness [-Wpointer-sign]
  md4_update( &ctx, passwd->bv_len, passwd->bv_val );
In file included from smbk5pwd.c:70:0:
/usr/include/nettle/md4.h:69:1: note: expected 'const uint8_t * {aka const
unsigned char *}' but argument is of type 'char *'
 md4_update(struct md4_ctx *ctx,

openssl and gcrypt both use void * here, nettle needs a cast (which should be

The remaining warnings are not nettle-specific.

smbk5pwd.c: In function 'smbk5pwd_cf_func':
smbk5pwd.c:915:14: warning: variable 'db' set but not used
    BackendDB db = *c->be;

Added in 29fab9c, apparently never used. Looks like cruft to me. Most likely
didn't generate a warning with gcc prior to 4.6, due to the assignment just

smbk5pwd.c: In function 'smbk5pwd_modules_init':
smbk5pwd.c:968:2: warning: variable 'dummy_ad' set but not used

The unused-but-set-variable warning is new in gcc 4.6 and there is a different
no-op trick to suppress it in a portable way.