2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include <gnutls_int.h>
29 #define rotl32(x,n) (((x) << ((uint16_t)(n))) | ((x) >> (32 - (uint16_t)(n))))
30 #define rotr32(x,n) (((x) >> ((uint16_t)(n))) | ((x) << (32 - (uint16_t)(n))))
31 #define rotl16(x,n) (((x) << ((uint16_t)(n))) | ((x) >> (16 - (uint16_t)(n))))
32 #define rotr16(x,n) (((x) >> ((uint16_t)(n))) | ((x) << (16 - (uint16_t)(n))))
34 #define byteswap16(x) ((rotl16(x, 8) & 0x00ff) | (rotr16(x, 8) & 0xff00))
35 #define byteswap32(x) ((rotl32(x, 8) & 0x00ff00ffUL) | (rotr32(x, 8) & 0xff00ff00UL))
37 uint32_t _gnutls_uint24touint32 (uint24 num
);
38 uint24
_gnutls_uint32touint24 (uint32_t num
);
39 uint32_t _gnutls_read_uint32 (const opaque
* data
);
40 uint16_t _gnutls_read_uint16 (const opaque
* data
);
41 uint32_t _gnutls_conv_uint32 (uint32_t data
);
42 uint16_t _gnutls_conv_uint16 (uint16_t data
);
43 uint32_t _gnutls_read_uint24 (const opaque
* data
);
44 void _gnutls_write_uint24 (uint32_t num
, opaque
* data
);
45 void _gnutls_write_uint32 (uint32_t num
, opaque
* data
);
46 void _gnutls_write_uint16 (uint16_t num
, opaque
* data
);
47 uint32_t _gnutls_uint64touint32 (const uint64
*);
49 int _gnutls_uint64pp (uint64
*);
50 # 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
51 # define UINT64DATA(x) x.i