File: raw-port.h

package info (click to toggle)
nessus-libraries 1.0.10-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,536 kB
  • ctags: 12,585
  • sloc: ansic: 72,626; asm: 25,921; sh: 19,570; makefile: 1,974; cpp: 560; pascal: 536; yacc: 234; lex: 203; lisp: 186; perl: 76; fortran: 24
file content (128 lines) | stat: -rw-r--r-- 3,278 bytes parent folder | download
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 *          Copyright (c) mjh-EDV Beratung, 1996-1999
 *     mjh-EDV Beratung - 63263 Neu-Isenburg - Rosenstrasse 12
 *          Tel +49 6102 328279 - Fax +49 6102 328278
 *                Email info@mjh.teddy-net.com
 *
 *       Author: Jordan Hrycaj <jordan@mjh.teddy-net.com>
 *
 *   $Id: raw-port.h,v 1.1 2000/08/14 20:51:35 jordan Exp $
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Library General Public
 *   License as published by the Free Software Foundation; either
 *   version 2 of the License, or (at your option) any later version.
 *
 *   This library 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
 *   Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this library; if not, write to the Free
 *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef __RAW_PORT_H__
#define __RAW_PORT_H__

#include "common-stuff.h"
#include "cipher.h" /* enables modules */

#ifdef WORDS_BIGENDIAN
# define BIG_ENDIAN_HOST 1
#else
# define LITTLE_ENDIAN_HOST 1
#endif

#define DIM(x) (sizeof (x) / sizeof (x [0]))

#undef                byte  /* there might be a macro with this name */
typedef unsigned char byte;

/* NOTE: hardcoded into the cipher modules */
#define G10ERR_WEAK_KEY        43
#define G10ERR_WRONG_KEYLEN    44
#define G10ERR_SELFTEST_FAILED 50


/* bithelp.h  -  Some bit manipulation helpers
 *	Copyright (C) 1999 Free Software Foundation, Inc.
 ****************
 * Rotate a 32 bit integer by n bytes
 */
#if defined(__GNUC__) && defined(__i386__)
static inline u32
rol( u32 x, int n)
{
	__asm__("roll %%cl,%0"
		:"=r" (x)
		:"0" (x),"c" (n));
	return x;
}
#else
  #define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
#endif
/* bithelp.h  -  ends here */

#ifdef __BLOWFISH_C__
# ifndef CIPHER_BLOWFISH
#  define DONT_COMPILE
# else
   static void log_error (char *s) {fprintf (stderr, "PANIC: %s\n", s); \
                                    abort ();}
#  define log_bug(s) log_error (s)
#  undef  encrypt /* BSD uses that symbol */
#  define encrypt(x,y,z)  bf_encrypt(x,y,z)
# endif
#endif /* __BLOWFISH_C__ */

#ifdef __TWOFISH_C__
# ifndef CIPHER_TWOFISH
#  define DONT_COMPILE
# else
#  define log_fatal(x)  (fprintf(stderr,x), exit(3))
#  ifdef HAVE_ASSERT_H
#   include <assert.h>
#  else
#   define assert(x)
#  endif
# endif
#endif /* __TWOFISH_C__ */

#ifdef __DES_C__
# ifndef CIPHER_3DES
#  define DONT_COMPILE
# else
#  include "des.h"
#  define log_fatal(x,y)  (fprintf(stderr,x,y), exit(3))
#  undef  des_setkey /* BSD uses that symbol */
#  define des_setkey(x,y)  des_set_key(x,y)
# endif
#endif /* __DES_C__ */

#ifdef __MD5_C__
# ifndef MD5_FRAME
#  define DONT_COMPILE
# else
#  include "md5.h"
# endif
#endif /* __MD5_C__ */

#ifdef __RMD160_C__
# ifndef RMD_FRAME
#  define DONT_COMPILE
# else
#  include "rmd.h"
# endif
#endif /* __RMD160_C__ */

#ifdef __SHA1_C__
# ifndef SHA_FRAME
#  define DONT_COMPILE
# else
#  include "sha1.h"
# endif
#endif /* __SHA1_C__ */

#endif /* __RAW_PORT_H__ */