[Help-gnutls] Why not?

Fran e_agf at yahoo.es
Tue Nov 1 21:24:03 CET 2005


In certool:

> /* 
> buffer[3] = serial & 0xff; 
> buffer[2] = (serial >> 8) & 0xff; 
> buffer[1] = (serial >> 16) & 0xff; 
> buffer[0] = 0; 
> */

Why not?

> #ifdef _32bit  /* Machine */
> #ifdef _32bit_serial 
> typedef union Raw_Int
> {
>   unsigned char str[sizeof(unsigned int)];
>   unsigned int integer;
> }RAW_INT;
> #endif 
> /* long int is same as unsigned int !??? */
> #ifdef _64bit_serial 
> ...
> #endif 
> #endif 
> 
> 
> 
> #ifdef _64bit 
> #ifdef _128bit 
> /* Only C99 */
> ...
> #endif 
> #endif 
> 
And :

int
gnutls_x509_crt_set_int64_serial (crt, unsigned long long int integer)
{
RAW_INT a;
signed int ret;

a.integer = integer;

  if ((ret = gnutls_x509_crt_set_serial (crt,a.str, sizeof(a.str))), ret < 0)
    {
      fprintf (stderr, "serial: %s\n", gnutls_strerror (ret));
      /*exit (1);*/ return (gnutls_strerror (ret));
    }
return ;
}

I think that can work.
Good thing or bad thing ?





More information about the Gnutls-help mailing list