compilation error with gnutls 2.12.10 a,d mingw-w64

Simon Josefsson simon at josefsson.org
Mon Oct 10 14:21:34 CEST 2011


Nikos Mavrogiannopoulos <nmav at gnutls.org> writes:

> On Mon, Oct 10, 2011 at 11:25 AM, Simon Josefsson <simon at josefsson.org> wrote:
>
>> src/cli.c does not include stdint.h though.  Could it be that simple?
>> I've pushed a patch.  Vincent, please try adding '#include <stdint.h>'
>> at the top of src/cli.c after the '#include <config.h>' line.
>
> Indeed, but I saw no point to include it for only one occurrence.
> Using the uint*_t types is better though.

Looking more closely at this code made me change my mind though.  The
declaration is:

  uint8_t keyid[GNUTLS_OPENPGP_KEYID_SIZE];

and the variable is used like this:

      get_keyid (keyid, info.pgp_subkey);
...
        gnutls_pcert_import_openpgp_raw (&pgp_crt, &data, GNUTLS_OPENPGP_FMT_BASE64, info.pgp_subkey!=NULL?keyid:NULL, 0);
...
           gnutls_openpgp_privkey_set_preferred_key_id (tmp_pgp_key, keyid)

Those functions has prototypes like this:

int get_keyid (gnutls_openpgp_keyid_t keyid, const char *str)

int gnutls_pcert_import_openpgp_raw (gnutls_pcert_st *pcert,
	const gnutls_datum_t* cert, 
	gnutls_openpgp_crt_fmt_t format, 
	gnutls_openpgp_keyid_t keyid,
	unsigned int flags)

int
gnutls_openpgp_privkey_set_preferred_key_id (gnutls_openpgp_privkey_t key,
                                             const gnutls_openpgp_keyid_t
                                             keyid)

So the proper type to use seems to be gnutls_openpgp_keyid_t instead of
uint8_t/unsigned char.  It is declared like this:

#define GNUTLS_OPENPGP_KEYID_SIZE 8
  typedef unsigned char gnutls_openpgp_keyid_t[GNUTLS_OPENPGP_KEYID_SIZE];

I've made this change now...  (keeping stdint.h, it doesn't hurt that
much I think)

/Simon




More information about the Gnutls-devel mailing list