[gnutls-dev] size_t, int and 64 bit machines

Simon Josefsson simon at josefsson.org
Wed Mar 21 14:42:57 CET 2007


Deanna Phillips <deanna at sdf.lonestar.org> writes:

> Hello,
>
> I noticed some size_t and int mixing that causes the
> set_pkcs12_cred test to fail on OpenBSD/sparc64.

Hi!  Thanks for the report.

> Here, sizeof int is 4, and sizeof size_t is 8.  Several warnings
> such as this are produced:
>
> gnutls_x509.c:1897: warning: passing arg 2 of `read_binary_file' from incompatible pointer type
>
> The simple fix for that particular test was -
>
>    typedef struct
>    {
>      unsigned char *data;
> -    unsigned int size;
> +    size_t size;
>    } gnutls_datum_t;

I am aware of this one, but the problem is: it is part of gnutls.h and
thus part of the external API.  This is really problematic to change,
since it won't be backwards compatible.

However, can we get away by considering that GnuTLS doesn't work at
all on platforms with 8-byte size_t and just make the change?  We have
already some supported 64-bit platforms, e.g. amd64 and ia64, but do
they have 8-byte size_t?  I doubt this is a reasonable way forward...

Another alternative is to create a new type 'gnutls_buffer_t' with the
proper types, and create new APIs for all existing APIs that use the
type.  Which is rather difficult.

A further alternative is to combine the last solution with library
versioning, to avoid renaming functions, although this is not very
portable as far as I know (?).

> Also included here is a patch that allows the pcks1-padding test
> to run on systems that pad wc(1) output with spaces, and another
> to include netinet/in.h for struct sockaddr_in in the anonself
> test.

I have installed this.

Thanks,
Simon




More information about the Gnutls-devel mailing list