Index: defines.h =================================================================== RCS file: /cvs/gnutls/gnutls/lib/defines.h,v retrieving revision 2.22 diff -u -u -r2.22 defines.h --- defines.h 9 Jan 2003 21:52:41 -0000 2.22 +++ defines.h 4 Mar 2003 07:04:12 -0000 @@ -96,19 +96,12 @@ #define SIZEOF_UNSIGNED_LONG_INT SIZEOF_UNSIGNED_LONG -#if SIZEOF_UNSIGNED_LONG == 8 -# define HAVE_UINT64 -/* only used native uint64 in 64 bit machines */ -typedef unsigned long int uint64; -#else /* some systems had problems with long long int, thus, * it is not used. */ typedef struct { unsigned char i[8]; } uint64; -#endif - #if SIZEOF_UNSIGNED_LONG == 4 typedef unsigned long int uint32; Index: gnutls_cipher.c =================================================================== RCS file: /cvs/gnutls/gnutls/lib/gnutls_cipher.c,v retrieving revision 2.65 diff -u -u -r2.65 gnutls_cipher.c --- gnutls_cipher.c 3 Mar 2003 16:08:21 -0000 2.65 +++ gnutls_cipher.c 4 Mar 2003 07:04:13 -0000 @@ -241,7 +241,6 @@ uint8 MAC[MAX_HASH_SIZE]; uint16 c_length; uint8 pad; - uint64 seq_num; int length,ret; GNUTLS_MAC_HANDLE td; uint8 type = _type; @@ -271,11 +270,9 @@ } c_length = _gnutls_conv_uint16(compressed.size); - seq_num = - _gnutls_conv_uint64(&session->connection_state.write_sequence_number); if (td != GNUTLS_MAC_FAILED) { /* actually when the algorithm in not the NULL one */ - _gnutls_hmac(td, UINT64DATA(seq_num), 8); + _gnutls_hmac(td, UINT64DATA(session->connection_state.write_sequence_number), 8); _gnutls_hmac(td, &type, 1); if ( ver != GNUTLS_SSL3) { /* TLS 1.0 only */ @@ -332,7 +329,6 @@ uint8 MAC[MAX_HASH_SIZE]; uint16 c_length; uint8 pad; - uint64 seq_num; uint16 length; GNUTLS_MAC_HANDLE td; uint16 blocksize; @@ -431,13 +427,12 @@ c_length = _gnutls_conv_uint16((uint16) length); - seq_num = _gnutls_conv_uint64( &session->connection_state.read_sequence_number); /* Pass the type, version, length and compressed through * MAC. */ if (td != GNUTLS_MAC_FAILED) { - _gnutls_hmac(td, UINT64DATA(seq_num), 8); + _gnutls_hmac(td, UINT64DATA(session->connection_state.read_sequence_number), 8); _gnutls_hmac(td, &type, 1); if ( ver != GNUTLS_SSL3) { /* TLS 1.0 only */ Index: gnutls_constate.c =================================================================== RCS file: /cvs/gnutls/gnutls/lib/gnutls_constate.c,v retrieving revision 2.33 diff -u -u -r2.33 gnutls_constate.c --- gnutls_constate.c 20 Jan 2003 16:46:20 -0000 2.33 +++ gnutls_constate.c 4 Mar 2003 07:04:14 -0000 @@ -450,7 +450,7 @@ int mac_size; int rc; - _gnutls_uint64zero(&session->connection_state.read_sequence_number); + _gnutls_uint64zero(session->connection_state.read_sequence_number); /* Update internals from CipherSuite selected. * If we are resuming just copy the connection session @@ -632,7 +632,7 @@ int mac_size; int rc; - _gnutls_uint64zero(&session->connection_state.write_sequence_number); + _gnutls_uint64zero(session->connection_state.write_sequence_number); /* Update internals from CipherSuite selected. * If we are resuming just copy the connection session Index: gnutls_num.c =================================================================== RCS file: /cvs/gnutls/gnutls/lib/gnutls_num.c,v retrieving revision 2.13 diff -u -u -r2.13 gnutls_num.c --- gnutls_num.c 2 Dec 2002 07:13:35 -0000 2.13 +++ gnutls_num.c 4 Mar 2003 07:04:17 -0000 @@ -1,7 +1,7 @@ /* - * Copyright (C) 2000,2001,2002 Nikos Mavroyanopoulos + * Copyright (C) 2000,2001,2002,2003 Nikos Mavroyanopoulos * - * This file is part of GNUTLS. + * This file is part of GNUTLS. * * The GNUTLS library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,16 +27,8 @@ #include #include - -#ifndef HAVE_UINT64 - /* This function will set the uint64 x to zero */ -int _gnutls_uint64zero( uint64 *x) { - - memset( x->i, 0, 8); - return 0; -} /* This function will add one to uint64 x. * Returns 0 on success, or -1 if the uint64 max limit @@ -59,8 +51,6 @@ return 0; } -#endif /* HAVE_UINT64 */ - uint32 _gnutls_uint24touint32( uint24 num) { uint32 ret=0; @@ -163,34 +153,13 @@ #endif } -uint64 _gnutls_conv_uint64( const uint64* data) { -#ifdef HAVE_UINT64 -# ifndef WORDS_BIGENDIAN - return byteswap64(*data); -# else - return *data; -# endif /* WORDS_BIGENDIAN */ -#else - uint64 ret; - - memcpy( ret.i, data->i, 8); - return ret; -#endif /* HAVE_UINT64 */ -} - uint32 _gnutls_uint64touint32( const uint64* num) { uint32 ret; -#ifdef HAVE_UINT64 - ret = (uint32) *num; - -#else /* no native uint64 */ - memcpy( &ret, &num->i[4], 4); -# ifndef WORDS_BIGENDIAN +#ifndef WORDS_BIGENDIAN ret = byteswap32(ret); -# endif -#endif /* HAVE_UINT64 */ +#endif return ret; } Index: gnutls_num.h =================================================================== RCS file: /cvs/gnutls/gnutls/lib/gnutls_num.h,v retrieving revision 2.13 diff -u -u -r2.13 gnutls_num.h --- gnutls_num.h 8 Sep 2002 20:48:30 -0000 2.13 +++ gnutls_num.h 4 Mar 2003 07:04:17 -0000 @@ -1,21 +1,21 @@ /* - * Copyright (C) 2000 Nikos Mavroyanopoulos + * Copyright (C) 2000,2003 Nikos Mavroyanopoulos * - * This file is part of GNUTLS. + * This file is part of GNUTLS. * - * GNUTLS is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * GNUTLS is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * GNUTLS is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNUTLS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #include @@ -37,25 +37,12 @@ uint16 _gnutls_read_uint16( const opaque* data); uint32 _gnutls_conv_uint32( uint32 data); uint16 _gnutls_conv_uint16( uint16 data); -uint64 _gnutls_conv_uint64( const uint64 *data); uint32 _gnutls_read_uint24( const opaque* data); void _gnutls_write_uint24( uint32 num, opaque* data); void _gnutls_write_uint32( uint32 num, opaque* data); void _gnutls_write_uint16( uint16 num, opaque* data); uint32 _gnutls_uint64touint32( const uint64*); -#ifndef HAVE_UINT64 -int _gnutls_uint64zero( uint64 *); int _gnutls_uint64pp( uint64 *); +# define _gnutls_uint64zero(x) x.i[0] = x.i[1] = x.i[2] = x.i[3] = x.i[4] = x.i[5] = x.i[6] = x.i[7] = 0 # define UINT64DATA(x) x.i - -#else -# define UINT64DATA(x) &x -# define rotl64(x,n) (((x) << ((uint16)(n))) | ((x) >> (64 - (uint16)(n)))) -# define rotr64(x,n) (((x) >> ((uint16)(n))) | ((x) << (64 - (uint16)(n)))) -# define byteswap64(x) ((rotl64(x, 8) & 0x00ff00ff00ff00ffUL) | (rotr64(x, 8) & 0xff00ff00ff00ff00UL)) - -# define _gnutls_uint64pp(x) ((++(*x)==0) ? -1 : 0) -# define _gnutls_uint64zero(x) (*x) = 0 - -#endif