1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/* global.h --- Global internal include file for libntlm.
* Copyright (C) 2004, 2005, 2006 Frediano Ziglio
*
* This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This file 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this file; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA
*
*/
/*
* Extracted from various source (mainly libmcrypt)
*/
#ifndef NTLM_GLOBAL_H_
#define NTLM_GLOBAL_H_
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_SYS_ENDIAN_H
# include <sys/endian.h>
#endif
#ifdef HAVE_MACHINE_ENDIAN_H
# include <machine/endian.h>
#endif
#ifdef HAVE_ENDIAN_H
# include <endian.h>
#endif
#ifdef HAVE_BYTESWAP_H
# include <byteswap.h>
#endif
#define rotl32(x,n) (((x) << ((uint32)(n))) | ((x) >> (32 - (uint32)(n))))
#define rotr32(x,n) (((x) >> ((uint32)(n))) | ((x) << (32 - (uint32)(n))))
#define rotl16(x,n) (((x) << ((uint16)(n))) | ((x) >> (16 - (uint16)(n))))
#define rotr16(x,n) (((x) >> ((uint16)(n))) | ((x) << (16 - (uint16)(n))))
/* Use hardware rotations.. when available */
#ifdef swap32
# define byteswap32(x) swap32(x)
#else
# ifdef swap_32
# define byteswap32(x) swap_32(x)
# else
# ifdef bswap_32
# define byteswap32(x) bswap_32(x)
# else
# define byteswap32(x) ((rotl32(x, 8) & 0x00ff00ff) | (rotr32(x, 8) & 0xff00ff00))
# endif
# endif
#endif
#ifdef swap16
# define byteswap16(x) swap16(x)
#else
# ifdef swap_16
# define byteswap16(x) swap_16(x)
# else
# ifdef bswap_16
# define byteswap16(x) bswap_16(x)
# else
# define byteswap16(x) ((rotl16(x, 8) & 0x00ff) | (rotr16(x, 8) & 0xff00))
# endif
# endif
#endif
#ifndef NTLM_STATIC
# define NTLM_STATIC
#endif
#include "ntlm.h"
#endif /* NTLM_GLOBAL_H_ */
|