Index: trunk/include/CuTest.h
===================================================================
--- trunk/include/CuTest.h	(revision 591)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*******************
-
-LICENSE
-
-Copyright (c) 2003 Asim Jalis
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-claim that you wrote the original software. If you use this software in
-a product, an acknowledgment in the product documentation would be
-appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and must not
-be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
-**********************/
-
-#ifndef CU_TEST_H
-#define CU_TEST_H
-
-#include <setjmp.h>
-#include <stdarg.h>
-
-/* CuString */
-
-char* CuStrAlloc(int size);
-char* CuStrCopy(const char* old);
-
-#define CU_ALLOC(TYPE)		((TYPE*) malloc(sizeof(TYPE)))
-
-#define HUGE_STRING_LEN	8192
-#define STRING_MAX		256
-#define STRING_INC		256
-
-typedef struct
-{
-	int length;
-	int size;
-	char* buffer;
-} CuString;
-
-void CuStringInit(CuString* str);
-CuString* CuStringNew(void);
-void CuStringRead(CuString* str, const char* path);
-void CuStringAppend(CuString* str, const char* text);
-void CuStringAppendChar(CuString* str, char ch);
-void CuStringAppendFormat(CuString* str, const char* format, ...);
-void CuStringInsert(CuString* str, const char* text, int pos);
-void CuStringResize(CuString* str, int newSize);
-
-/* CuTest */
-
-typedef struct CuTest CuTest;
-
-typedef void (*TestFunction)(CuTest *);
-
-struct CuTest
-{
-	const char* name;
-	TestFunction function;
-	int failed;
-	int ran;
-	const char* message;
-	jmp_buf *jumpBuf;
-};
-
-void CuTestInit(CuTest* t, const char* name, TestFunction function);
-CuTest* CuTestNew(const char* name, TestFunction function);
-void CuTestRun(CuTest* tc);
-
-/* Internal versions of assert functions -- use the public versions */
-void CuFail_Line(CuTest* tc, const char* file, int line, const char* message2, const char* message);
-void CuAssert_Line(CuTest* tc, const char* file, int line, const char* message, int condition);
-void CuAssertStrEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	const char* expected, const char* actual);
-void CuAssertIntEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	int expected, int actual);
-void CuAssertDblEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	double expected, double actual, double delta);
-void CuAssertPtrEquals_LineMsg(CuTest* tc, 
-	const char* file, int line, const char* message, 
-	void* expected, void* actual);
-
-/* public assert functions */
-
-#define CuFail(tc, ms)                        CuFail_Line(  (tc), __FILE__, __LINE__, NULL, (ms))
-#define CuAssert(tc, ms, cond)                CuAssert_Line((tc), __FILE__, __LINE__, (ms), (cond))
-#define CuAssertTrue(tc, cond)                CuAssert_Line((tc), __FILE__, __LINE__, "assert failed", (cond))
-
-#define CuAssertStrEquals(tc,ex,ac)           CuAssertStrEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
-#define CuAssertStrEquals_Msg(tc,ms,ex,ac)    CuAssertStrEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
-#define CuAssertIntEquals(tc,ex,ac)           CuAssertIntEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
-#define CuAssertIntEquals_Msg(tc,ms,ex,ac)    CuAssertIntEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
-#define CuAssertDblEquals(tc,ex,ac,dl)        CuAssertDblEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac),(dl))
-#define CuAssertDblEquals_Msg(tc,ms,ex,ac,dl) CuAssertDblEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac),(dl))
-#define CuAssertPtrEquals(tc,ex,ac)           CuAssertPtrEquals_LineMsg((tc),__FILE__,__LINE__,NULL,(ex),(ac))
-#define CuAssertPtrEquals_Msg(tc,ms,ex,ac)    CuAssertPtrEquals_LineMsg((tc),__FILE__,__LINE__,(ms),(ex),(ac))
-
-#define CuAssertPtrNotNull(tc,p)        CuAssert_Line((tc),__FILE__,__LINE__,"null pointer unexpected",(p != NULL))
-#define CuAssertPtrNotNullMsg(tc,msg,p) CuAssert_Line((tc),__FILE__,__LINE__,(msg),(p != NULL))
-
-/* CuSuite */
-
-#define MAX_TEST_CASES	1024
-
-#define SUITE_ADD_TEST(SUITE,TEST)	CuSuiteAdd(SUITE, CuTestNew(#TEST, TEST))
-
-typedef struct
-{
-	int count;
-	CuTest* list[MAX_TEST_CASES];
-	int failCount;
-
-} CuSuite;
-
-
-void CuSuiteInit(CuSuite* testSuite);
-CuSuite* CuSuiteNew(void);
-void CuSuiteAdd(CuSuite* testSuite, CuTest *testCase);
-void CuSuiteAddSuite(CuSuite* testSuite, CuSuite* testSuite2);
-void CuSuiteRun(CuSuite* testSuite);
-void CuSuiteSummary(CuSuite* testSuite, CuString* summary);
-void CuSuiteDetails(CuSuite* testSuite, CuString* details);
-
-#endif /* CU_TEST_H */
Index: trunk/include/kern_head.h
===================================================================
--- trunk/include/kern_head.h	(revision 1)
+++ trunk/include/kern_head.h	(revision 1)
@@ -0,0 +1,1382 @@
+
+
+/* i386 sys_call_table for kernel 2.4.x
+ */
+char * callz_2p4[] = {
+    "sys_ni_syscall",    /* 0 - old setup() system call*/
+    "sys_exit",
+    "sys_fork",
+    "sys_read",
+    "sys_write",
+    "sys_open",        /* 5 */
+    "sys_close",
+    "sys_waitpid",
+    "sys_creat",
+    "sys_link",
+    "sys_unlink",        /* 10 */
+    "sys_execve",
+    "sys_chdir",
+    "sys_time",
+    "sys_mknod",
+    "sys_chmod",        /* 15 */
+    "sys_lchown16",
+    "sys_ni_syscall",                /* old break syscall holder */
+    "sys_stat",
+    "sys_lseek",
+    "sys_getpid",        /* 20 */
+    "sys_mount",
+    "sys_oldumount",
+    "sys_setuid16",
+    "sys_getuid16",
+    "sys_stime",        /* 25 */
+    "sys_ptrace",
+    "sys_alarm",
+    "sys_fstat",
+    "sys_pause",
+    "sys_utime",        /* 30 */
+    "sys_ni_syscall",                /* old stty syscall holder */
+    "sys_ni_syscall",                /* old gtty syscall holder */
+    "sys_access",
+    "sys_nice",
+    "sys_ni_syscall",    /* 35 */        /* old ftime syscall holder */
+    "sys_sync",
+    "sys_kill",
+    "sys_rename",
+    "sys_mkdir",
+    "sys_rmdir",        /* 40 */
+    "sys_dup",
+    "sys_pipe",
+    "sys_times",
+    "sys_ni_syscall",                /* old prof syscall holder */
+    "sys_brk",        /* 45 */
+    "sys_setgid16",
+    "sys_getgid16",
+    "sys_signal",
+    "sys_geteuid16",
+    "sys_getegid16",    /* 50 */
+    "sys_acct",
+    "sys_umount",                    /* recycled never used  phys() */
+    "sys_ni_syscall",                /* old lock syscall holder */
+    "sys_ioctl",
+    "sys_fcntl",        /* 55 */
+    "sys_ni_syscall",                /* old mpx syscall holder */
+    "sys_setpgid",
+    "sys_ni_syscall",                /* old ulimit syscall holder */
+    "sys_olduname",
+    "sys_umask",        /* 60 */
+    "sys_chroot",
+    "sys_ustat",
+    "sys_dup2",
+    "sys_getppid",
+    "sys_getpgrp",        /* 65 */
+    "sys_setsid",
+    "sys_sigaction",
+    "sys_sgetmask",
+    "sys_ssetmask",
+    "sys_setreuid16",    /* 70 */
+    "sys_setregid16",
+    "sys_sigsuspend",
+    "sys_sigpending",
+    "sys_sethostname",
+    "sys_setrlimit",    /* 75 */
+    "sys_old_getrlimit",
+    "sys_getrusage",
+    "sys_gettimeofday",
+    "sys_settimeofday",
+    "sys_getgroups16",    /* 80 */
+    "sys_setgroups16",
+    "old_select",
+    "sys_symlink",
+    "sys_lstat",
+    "sys_readlink",        /* 85 */
+    "sys_uselib",
+    "sys_swapon",
+    "sys_reboot",
+    "old_readdir",
+    "old_mmap",        /* 90 */
+    "sys_munmap",
+    "sys_truncate",
+    "sys_ftruncate",
+    "sys_fchmod",
+    "sys_fchown16",        /* 95 */
+    "sys_getpriority",
+    "sys_setpriority",
+    "sys_ni_syscall",                /* old profil syscall holder */
+    "sys_statfs",
+    "sys_fstatfs",        /* 100 */
+    "sys_ioperm",
+    "sys_socketcall",
+    "sys_syslog",
+    "sys_setitimer",
+    "sys_getitimer",    /* 105 */
+    "sys_newstat",
+    "sys_newlstat",
+    "sys_newfstat",
+    "sys_uname",
+    "sys_iopl",        /* 110 */
+    "sys_vhangup",
+    "sys_ni_syscall",    /* old idle system call */
+    "sys_vm86old",
+    "sys_wait4",
+    "sys_swapoff",        /* 115 */
+    "sys_sysinfo",
+    "sys_ipc",
+    "sys_fsync",
+    "sys_sigreturn",
+    "sys_clone",        /* 120 */
+    "sys_setdomainname",
+    "sys_newuname",
+    "sys_modify_ldt",
+    "sys_adjtimex",
+    "sys_mprotect",        /* 125 */
+    "sys_sigprocmask",
+    "sys_create_module",
+    "sys_init_module",
+    "sys_delete_module",
+    "sys_get_kernel_syms",    /* 130 */
+    "sys_quotactl",
+    "sys_getpgid",
+    "sys_fchdir",
+    "sys_bdflush",
+    "sys_sysfs",        /* 135 */
+    "sys_personality",
+    "sys_ni_syscall",    /* for afs_syscall */
+    "sys_setfsuid16",
+    "sys_setfsgid16",
+    "sys_llseek",        /* 140 */
+    "sys_getdents",
+    "sys_select",
+    "sys_flock",
+    "sys_msync",
+    "sys_readv",        /* 145 */
+    "sys_writev",
+    "sys_getsid",
+    "sys_fdatasync",
+    "sys_sysctl",
+    "sys_mlock",        /* 150 */
+    "sys_munlock",
+    "sys_mlockall",
+    "sys_munlockall",
+    "sys_sched_setparam",
+    "sys_sched_getparam",  /* 155 */
+    "sys_sched_setscheduler",
+    "sys_sched_getscheduler",
+    "sys_sched_yield",
+    "sys_sched_get_priority_max",
+    "sys_sched_get_priority_min", /* 160 */
+    "sys_sched_rr_get_interval",
+    "sys_nanosleep",
+    "sys_mremap",
+    "sys_setresuid16",
+    "sys_getresuid16",    /* 165 */
+    "sys_vm86",
+    "sys_query_module",
+    "sys_poll",
+    "sys_nfsservctl",
+    "sys_setresgid16",    /* 170 */
+    "sys_getresgid16",
+    "sys_prctl",
+    "sys_rt_sigreturn",
+    "sys_rt_sigaction",
+    "sys_rt_sigprocmask",    /* 175 */
+    "sys_rt_sigpending",
+    "sys_rt_sigtimedwait",
+    "sys_rt_sigqueueinfo",
+    "sys_rt_sigsuspend",
+    "sys_pread",        /* 180 */
+    "sys_pwrite",
+    "sys_chown16",
+    "sys_getcwd",
+    "sys_capget",
+    "sys_capset",      /* 185 */
+    "sys_sigaltstack",
+    "sys_sendfile",
+    "sys_getpmsg",        /* streams1 */
+    "sys_putpmsg",        /* streams2 */
+    "sys_vfork",      /* 190 */
+    "sys_getrlimit",
+    "sys_mmap2",
+    "sys_truncate64",
+    "sys_ftruncate64",
+    "sys_stat64",        /* 195 */
+    "sys_lstat64",
+    "sys_fstat64",
+    "sys_lchown",
+    "sys_getuid",
+    "sys_getgid",        /* 200 */
+    "sys_geteuid",
+    "sys_getegid",
+    "sys_setreuid",
+    "sys_setregid",
+    "sys_getgroups",    /* 205 */
+    "sys_setgroups",
+    "sys_fchown",
+    "sys_setresuid",
+    "sys_getresuid",
+    "sys_setresgid",    /* 210 */
+    "sys_getresgid",
+    "sys_chown",
+    "sys_setuid",
+    "sys_setgid",
+    "sys_setfsuid",        /* 215 */
+    "sys_setfsgid",
+    "sys_pivot_root",
+    "sys_mincore",
+    "sys_madvise",
+    "sys_getdents64",    /* 220 */
+    "sys_fcntl64",
+    "sys_tux",     /* reserved for TUX */
+    "sys_security",
+    "sys_gettid",
+    "sys_readahead",     /* 225 */
+    "sys_setxattr",
+    "sys_lsetxattr",
+    "sys_fsetxattr",
+    "sys_getxattr",
+    "sys_lgetxattr",     /* 230 */
+    "sys_fgetxattr",
+    "sys_listxattr",
+    "sys_llistxattr",
+    "sys_flistxattr",
+    "sys_removexattr",   /* 235 */
+    "sys_lremovexattr",
+    "sys_fremovexattr",
+    "sys_tkill",
+    "sys_sendfile64",
+    "sys_futex",         /* 240 */
+    "sys_sched_setaffinity",
+    "sys_sched_getaffinity",
+    "sys_set_thread_area",
+    "sys_get_thread_area",   
+    "sys_io_setup",           /* 245 */
+    "sys_io_destroy",         
+    "sys_io_getevents",       
+    "sys_io_submit",          
+    "sys_io_cancel",          
+    "sys_alloc_hugepages",    /* 250 */
+    "sys_free_hugepages",     
+    "sys_exit_group",         
+    "sys_lookup_dcookie",     /* 2.6 */
+    "sys_epoll_create",
+    "sys_epoll_ctl",          /* 255 */
+    "sys_epoll_wait",
+    "sys_remap_file_pages",
+    "sys_set_tid_address",
+    "sys_timer_create",
+    "sys_timer_settime",      /* 260 */
+    "sys_timer_gettime",
+    "sys_timer_getoverrun",
+    "sys_timer_delete",
+    "sys_clock_settime",
+    "sys_clock_gettime",      /* 265 */
+    "sys_clock_getres",
+    "sys_clock_nanosleep",
+    "sys_statfs64",
+    "sys_fstatfs64",
+    "sys_tgkill",             /* 270 */
+    "sys_utimes",
+    "sys_fadvise64_64",
+    "sys_vserver",
+    NULL
+};
+
+
+
+/* i386 sys_call_table for kernel 2.2.x
+ */
+char * callz_2p2[]={
+  "sys_ni_syscall",        /* 0 */
+  "sys_exit",
+  "sys_fork",
+  "sys_read",
+  "sys_write",
+  "sys_open",              /* 5 */
+  "sys_close",
+  "sys_waitpid", 
+  "sys_creat",
+  "sys_link",
+  "sys_unlink",              /* 10 */
+  "sys_execve",
+  "sys_chdir",
+  "sys_time",
+  "sys_mknod",
+  "sys_chmod",              /* 15 */
+  "sys_lchown",
+  "sys_ni_syscall",
+  "sys_stat",
+  "sys_lseek",
+  "sys_getpid",              /* 20 */
+  "sys_mount",
+  "sys_oldumount", 
+  "sys_setuid",
+  "sys_getuid",
+  "sys_stime",              /* 25 */
+  "sys_ptrace",
+  "sys_alarm",
+  "sys_fstat",
+  "sys_pause",
+  "sys_utime",              /* 30 */
+  "sys_ni_syscall",
+  "sys_ni_syscall",
+  "sys_access",
+  "sys_nice",
+  "sys_ni_syscall",              /* 35 */
+  "sys_sync",
+  "sys_kill",
+  "sys_rename",
+  "sys_mkdir",
+  "sys_rmdir",              /* 40 */
+  "sys_dup",
+  "sys_pipe",
+  "sys_times",
+  "sys_ni_syscall",
+  "sys_brk",              /* 45 */
+  "sys_setgid",
+  "sys_getgid",
+  "sys_signal",
+  "sys_geteuid",
+  "sys_getegid",              /* 50 */
+  "sys_acct",
+  "sys_umount",
+  "sys_ni_syscall",
+  "sys_ioctl",
+  "sys_fcntl",              /* 55 */
+  "sys_ni_syscall",
+  "sys_setpgid",
+  "sys_ni_syscall",
+  "sys_olduname",
+  "sys_umask",              /* 60 */
+  "sys_chroot",
+  "sys_ustat",
+  "sys_dup2",
+  "sys_getppid",
+  "sys_getpgrp",              /* 65 */
+  "sys_setsid",
+  "sys_sigaction",
+  "sys_sgetmask",
+  "sys_ssetmask",
+  "sys_setreuid",              /* 70 */
+  "sys_setregid",
+  "sys_sigsuspend",
+  "sys_sigpending",
+  "sys_sethostname",
+  "sys_setrlimit",              /* 75 */
+  "sys_getrlimit",
+  "sys_getrusage",
+  "sys_gettimeofday",
+  "sys_settimeofday",
+  "sys_getgroups",              /* 80 */
+  "sys_setgroups",
+  "old_select",
+  "sys_symlink",
+  "sys_lstat",
+  "sys_readlink",              /* 85 */
+  "sys_uselib",
+  "sys_swapon",
+  "sys_reboot",
+  "old_readdir",
+  "old_mmap",              /* 90 */
+  "sys_munmap",
+  "sys_truncate",
+  "sys_ftruncate",
+  "sys_fchmod",
+  "sys_fchown",              /* 95 */
+  "sys_getpriority",
+  "sys_setpriority",
+  "sys_ni_syscall",
+  "sys_statfs",
+  "sys_fstatfs",              /* 100 */
+  "sys_ioperm",
+  "sys_socketcall",
+  "sys_syslog",
+  "sys_setitimer",
+  "sys_getitimer",              /* 105 */
+  "sys_newstat",
+  "sys_newlstat",
+  "sys_newfstat",
+  "sys_uname",
+  "sys_iopl",              /* 110 */
+  "sys_vhangup",
+  "sys_idle",
+  "sys_vm86old",
+  "sys_wait4",
+  "sys_swapoff",              /* 115 */
+  "sys_sysinfo",
+  "sys_ipc",
+  "sys_fsync",
+  "sys_sigreturn",
+  "sys_clone",              /* 120 */
+  "sys_setdomainname",
+  "sys_newuname",
+  "sys_modify_ldt",
+  "sys_adjtimex",
+  "sys_mprotect",              /* 125 */
+  "sys_sigprocmask",
+  "sys_create_module",
+  "sys_init_module",
+  "sys_delete_module",
+  "sys_get_kernel_syms", /* 130 */
+  "sys_quotactl",
+  "sys_getpgid",
+  "sys_fchdir",
+  "sys_bdflush",
+  "sys_sysfs",              /* 135 */
+  "sys_personality",
+  "sys_ni_syscall",
+  "sys_setfsuid",
+  "sys_setfsgid",
+  "sys_llseek",              /* 140 */
+  "sys_getdents",
+  "sys_select",
+  "sys_flock",
+  "sys_msync",
+  "sys_readv",              /* 145 */
+  "sys_writev",
+  "sys_getsid",
+  "sys_fdatasync",
+  "sys_sysctl",
+  "sys_mlock",              /* 150 */
+  "sys_munlock",
+  "sys_mlockall",
+  "sys_munlockall",
+  "sys_sched_setparam", 
+  "sys_sched_getparam",  /* 155 */
+  "sys_sched_setscheduler",
+  "sys_sched_getscheduler",
+  "sys_sched_yield",
+  "sys_sched_get_priority_max",
+  "sys_sched_get_priority_min", /* 160 */
+  "sys_sched_rr_get_interval",
+  "sys_nanosleep",
+  "sys_mremap",
+  "sys_setresuid",
+  "sys_getresuid",              /* 165 */
+  "sys_vm86",
+  "sys_query_module",
+  "sys_poll",
+  "sys_nfsservctl", 
+  "sys_setresgid",              /* 170 */
+  "sys_getresgid",
+  "sys_prctl",
+  "sys_rt_sigreturn",
+  "sys_rt_sigaction",
+  "sys_rt_sigprocmask", /* 175 */
+  "sys_rt_sigpending",
+  "sys_rt_sigtimedwait",
+  "sys_rt_sigqueueinfo",
+  "sys_rt_sigsuspend",
+  "sys_pread",              /* 180 */
+  "sys_pwrite",
+  "sys_chown",
+  "sys_getcwd",
+  "sys_capget",
+  "sys_capset",              /* 185 */
+  "sys_sigaltstack",
+  "sys_sendfile",
+  "sys_ni_syscall",
+  "sys_ni_syscall",
+  "sys_vfork",              /* 190 */
+  NULL
+};
+
+#if 0
+/* i386 sys_call_table for freebsd
+ */
+char * callz_fbsd[]={
+  "_sysent",          /*   0 */
+  "sys_exit",
+  "_fork",
+  "_read",
+  "_write",
+  "_open",            /*   5 */
+  "_close",
+  "_link",
+  "_unlink",
+  "_chdir",
+  "_fchdir",          /*  10 */
+  "_mknod",
+  "_chmod",
+  "_chown",
+  "_getpid",       
+  "_mount",           /*  15 */
+  "_unmount",
+  "_setuid",
+  "_getuid",
+  "_geteuid",
+  "_ioctl",           /*  20 */
+  "_fcntl",
+  "_setsockopt",
+  "_getsockopt",
+  "_getdirentries",
+  "_getdents",        /*  25 */
+  "_seteuid",
+  "_setegid",
+  "_modstat",
+  "_fstat",
+  "_modfind",         /*  30 */
+  "_getsid",
+  "_setsid",
+  "_kldload",
+  "_kldunload",
+  "_kldfind",         /*  35 */
+  "_kldnext",
+  "_kldstat",
+  "_kldfirstmod",
+  "_kldsym",
+  "___sysctl",	      /*  40 */
+  NULL
+};
+#endif
+
+
+/* i386 sys_call_table for freebsd
+ */
+char * callz_fbsd[]={
+  "_syscall",  /*	 0 */
+  "sys_exit",  /*	 1 */
+  "_fork",     /*	 2 */
+  "_read",     /*	 3 */
+  "_write",    /*	 4 */
+  "_open",     /*	 5 */
+  "_close",    /*	 6 */
+  "_wait4",    /*	 7 */
+  "_nosys",			/* 8 is old creat */
+  "_link",     /*	 9 */
+  "_unlink",   /*	10 */
+  "_nosys",			/* 11 is obsolete execv */
+  "_chdir",    /*	12 */
+  "_fchdir",   /*	13 */
+  "_mknod",    /*	14 */
+  "_chmod",    /*	15 */
+  "_chown",    /*	16 */
+  "_break",    /*	17 */
+  "_getfsstat",/*	18 */
+  "_nosys",	        	/* 19 is old lseek */
+  "_getpid",   /*	20 */
+  "_mount",    /*	21 */
+  "_unmount",  /*	22 */
+  "_setuid",   /*	23 */
+  "_getuid",   /*	24 */
+  "_geteuid",  /*	25 */
+  "_ptrace",   /*	26 */
+  "_recvmsg",  /*	27 */
+  "_sendmsg",  /*	28 */
+  "_recvfrom", /*	29 */
+  "_accept",   /*	30 */
+  "_getpeername", /*	31 */
+  "_getsockname", /*	32 */
+  "_access",   /*	33 */
+  "_chflags",  /*	34 */
+  "_fchflags", /*	35 */
+  "_sync",     /*	36 */
+  "_kill",     /*	37 */
+  "_nosys",			/* 38 is old stat */
+  "_getppid",  /*	39 */
+  "_nosys",		        /* 40 is old lstat */
+  "_dup",      /*	41 */
+  "_pipe",     /*	42 */
+  "_getegid",  /*	43 */
+  "_profil",   /*	44 */
+  "_ktrace",   /*	45 */
+  "_nosys",			/* 46 is old sigaction */
+  "_getgid",   /*	47 */
+  "_nosys",			/* 48 is old sigprocmask */
+  "_getlogin", /*	49 */
+  "_setlogin", /*	50 */
+  "_acct",     /*	51 */
+  "_nosys",			/* 52 is old sigpending */
+  "_sigaltstack", /*	53 */
+  "_ioctl",    /*	54 */
+  "_reboot",   /*	55 */
+  "_revoke",   /*	56 */
+  "_symlink",  /*	57 */
+  "_readlink", /*	58 */
+  "_execve",   /*	59 */
+  "_umask",    /*	60 */
+  "_chroot",   /*	61 */
+  "_nosys",			/* 62 is old fstat */
+  "_nosys",			/* 63 is old getkerninfo */
+  "_nosys",			/* 64 is old getpagesize */
+  "_msync",    /*	65 */
+  "_vfork",    /*	66 */
+  "_nosys",			/* 67 is obsolete vread */
+  "_nosys",			/* 68 is obsolete vwrite */
+  "_sbrk",     /*	69 */
+  "_sstk",     /*	70 */
+  "_nosys",			/* 71 is old mmap */
+  "_vadvise",  /*	72 */
+  "_munmap",   /*	73 */
+  "_mprotect", /*	74 */
+  "_madvise",  /*	75 */
+  "_nosys",			/* 76 is obsolete vhangup */
+  "_nosys",			/* 77 is obsolete vlimit */
+  "_mincore",  /*	78 */
+  "_getgroups",/*	79 */
+  "_setgroups",/*	80 */
+  "_getpgrp",  /*	81 */
+  "_setpgid",  /*	82 */
+  "_setitimer",/*	83 */
+  "_nosys",			/* 84 is old wait */
+  "_swapon",   /*	85 */
+  "_getitimer",/*	86 */
+  "_nosys",			/* 87 is old gethostname */
+  "_nosys",			/* 88 is old sethostname */
+  "_getdtablesize", /*	89 */
+  "_dup2",     /*	90 */
+  "_nosys",			/* 91 is ??? */
+  "_fcntl",    /*	92 */
+  "_select",   /*	93 */
+  "_nosys",			/* 94 is ??? */
+  "_fsync",    /*	95 */
+  "_setpriority", /*	96 */
+  "_socket",   /*	97 */
+  "_connect",  /*	98 */
+  "_nosys",			/* 99 is old accept */
+  "_getpriority", /*	100 */
+  "_nosys",			/* 101 is old send */
+  "_nosys",			/* 102 is old recv */
+  "_nosys",			/* 103 is old sigreturn */
+  "_bind",    /*	104 */
+  "_setsockopt", /*	105 */
+  "_listen",  /*	106 */
+  "_nosys",			/* 107 is obsolete vtimes */
+  "_nosys",			/* 108 is old sigvec */
+  "_nosys",			/* 109 is old sigblock */
+  "_nosys",			/* 110 is old sigsetmask */
+  "_nosys",			/* 111 is old sigsuspend */
+  "_nosys",			/* 112 is old sigstack */
+  "_nosys",			/* 113 is old recvmsg */
+  "_nosys",			/* 114 is old sendmsg */
+  "_nosys",			/* 115 is obsolete vtrace */
+  "_gettimeofday", /*	116 */ 
+  "_getrusage",    /*	117 */
+  "_getsockopt",   /*	118 */
+  "_nosys",			/* 119 is ??? */
+  "_readv",        /*	120 */
+  "_writev",       /*	121 */
+  "_settimeofday", /*	122 */
+  "_fchown",       /*	123 */
+  "_fchmod",       /*	124 */
+  "_nosys",			/* 125 is old recvfrom */
+  "_setreuid",     /*	126 */
+  "_setregid",     /*	127 */
+  "_rename",       /*	128 */
+  "_nosys",			/* 129 is old truncate */
+  "_nosys",			/* 130 is old ftruncate */
+  "_flock",        /*	131 */
+  "_mkfifo",       /*	132 */
+  "_sendto",       /*	133 */
+  "_shutdown",     /*	134 */
+  "_socketpair",   /*	135 */
+  "_mkdir",        /*	136 */
+  "_rmdir",        /*	137 */
+  "_utimes",       /*	138 */
+  "_nosys",			/* 139 is obsolete 4.2 sigreturn */
+  "_adjtime",      /*	140 */
+  "_nosys",			/* 141 is old getpeername */
+  "_nosys",			/* 142 is old gethostid */
+  "_nosys",			/* 143 is old sethostid */
+  "_nosys",			/* 144 is old getrlimit */
+  "_nosys",			/* 145 is old setrlimit */
+  "_nosys",			/* 146 is old killpg */
+  "_setsid",       /*	147 */
+  "_quotactl",     /*	148 */
+  "_nosys",			/* 149 is old quota */
+  "_nosys",			/* 150 is old getsockname */
+  "_nosys",			/* 151 is ??? */
+  "_nosys",			/* 152 is ??? */
+  "_nosys",			/* 153 is ??? */
+  "_nosys",			/* 154 is ??? */
+  "_nfssvc",       /*	155 */
+  "_nosys",		        /* 156 is old getdirentries */
+  "_statfs",       /*	157 */
+  "_fstatfs",      /*	158 */
+  "_nosys",			/* 159 is ??? */
+  "_nosys",			/* 160 is ??? */
+  "_getfh",        /*	161 */
+  "_getdomainname", /*	162 */
+  "_setdomainname", /*	163 */
+  "_uname",        /*	164 */
+  "_sysarch",      /*	165 */
+  "_rtprio",       /*	166 */
+  "_nosys",			/* 167 is ??? */
+  "_nosys",			/* 168 is ??? */
+  "_semsys",       /*	169 */
+  "_msgsys",       /*	170 */
+  "_shmsys",       /*	171 */
+  "_nosys",			/* 172 is ??? */
+  "_pread",        /*	173 */
+  "_pwrite",       /*	174 */
+  "_nosys",			/* 175 is ??? */
+  "_ntp_adjtime",  /*	176 */
+  "_nosys",			/* 177 is ??? */
+  "_nosys",			/* 178 is ??? */
+  "_nosys",			/* 179 is ??? */
+  "_nosys",			/* 180 is ??? */
+  "_setgid",       /*	181 */
+  "_setegid",      /*	182 */
+  "_seteuid",      /*	183 */
+  "_nosys",			/* 184 is ??? */
+  "_nosys",			/* 185 is ??? */
+  "_nosys",			/* 186 is ??? */
+  "_nosys",			/* 187 is ??? */
+  "_stat",         /*	188 */
+  "_fstat",        /*	189 */
+  "_lstat",        /*	190 */
+  "_pathconf",     /*	191 */
+  "_fpathconf",    /*	192 */
+  "_nosys",			/* 193 is ??? */
+  "_getrlimit",    /*	194 */
+  "_setrlimit",    /*	195 */
+  "_getdirentries", /*	196 */
+  "_mmap",         /*	197 */
+  "___syscall",    /*	198 */
+  "_lseek",        /*	199 */
+  "_truncate",     /*	200 */
+  "_ftruncate",    /*	201 */
+  "___sysctl",     /*	202 */
+  "_mlock",        /*	203 */
+  "_munlock",      /*	204 */
+  "_undelete",     /*	205 */
+  "_futimes",      /*	206 */
+  "_getpgid",      /*	207 */
+  "_nosys",			/* 208 is ??? */
+  "_poll",         /*	209 */
+  "_nosys",			/* 210 is ??? */
+  "_nosys",			/* 211 is ??? */
+  "_nosys",			/* 212 is ??? */
+  "_nosys",			/* 213 is ??? */
+  "_nosys",			/* 214 is ??? */
+  "_nosys",			/* 215 is ??? */
+  "_nosys",			/* 216 is ??? */
+  "_nosys",			/* 217 is ??? */
+  "_nosys",			/* 218 is ??? */
+  "_nosys",			/* 219 is ??? */
+  "___semctl",     /*	220 */
+  "_semget",       /*	221 */
+  "_semop",        /*	222 */
+  "_nosys",			/* 223 is ??? */
+  "_msgctl",       /*	224 */
+  "_msgget",       /*	225 */
+  "_msgsnd",       /*	226 */
+  "_msgrcv",       /*	227 */
+  "_shmat",        /*	228 */
+  "_shmctl",       /*	229 */
+  "_shmdt",        /*	230 */
+  "_shmget",       /*	231 */
+  "_clock_gettime", /*	232 */
+  "_clock_settime", /*	233 */
+  "_clock_getres", /*	234 */
+  "_nosys",			/* 235 is ??? */
+  "_nosys",			/* 236 is ??? */
+  "_nosys",			/* 237 is ??? */
+  "_nosys",			/* 238 is ??? */
+  "_nosys",			/* 239 is ??? */
+  "_nanosleep",    /*	240 */
+  "_nosys",			/* 241 is ??? */
+  "_nosys",			/* 242 is ??? */
+  "_nosys",			/* 243 is ??? */
+  "_nosys",			/* 244 is ??? */
+  "_nosys",			/* 245 is ??? */
+  "_nosys",			/* 246 is ??? */
+  "_nosys",			/* 247 is ??? */
+  "_nosys",			/* 248 is ??? */
+  "_nosys",			/* 249 is ??? */
+  "_minherit",     /*	250 */
+  "_rfork",        /*	251 */
+  "_openbsd_poll", /*	252 */
+  "_issetugid",    /*	253 */
+  "_lchown",       /*	254 */
+  "_nosys",			/* 255 is ??? */
+  "_nosys",			/* 256 is ??? */
+  "_nosys",			/* 257 is ??? */
+  "_nosys",			/* 258 is ??? */
+  "_nosys",			/* 259 is ??? */
+  "_nosys",			/* 260 is ??? */
+  "_nosys",			/* 261 is ??? */
+  "_nosys",			/* 262 is ??? */
+  "_nosys",			/* 263 is ??? */
+  "_nosys",			/* 264 is ??? */
+  "_nosys",			/* 265 is ??? */
+  "_nosys",			/* 266 is ??? */
+  "_nosys",			/* 267 is ??? */
+  "_nosys",			/* 268 is ??? */
+  "_nosys",			/* 269 is ??? */
+  "_nosys",			/* 270 is ??? */
+  "_nosys",			/* 271 is ??? */
+  "_getdents",     /*	272 */
+  "_nosys",			/* 273 is ??? */
+  "_lchmod",       /*	274 */
+  "_netbsd_lchown", /*	275 */
+  "_lutimes",      /*	276 */
+  "_netbsd_msync", /*	277 */
+  "_nstat",        /*	278 */
+  "_nfstat",       /*	279 */
+  "_nlstat",       /*	280 */
+  "_nosys",			/* 281 is ??? */
+  "_nosys",			/* 282 is ??? */
+  "_nosys",			/* 283 is ??? */
+  "_nosys",			/* 284 is ??? */
+  "_nosys",			/* 285 is ??? */
+  "_nosys",			/* 286 is ??? */
+  "_nosys",			/* 287 is ??? */
+  "_nosys",			/* 288 is ??? */
+  "_nosys",			/* 289 is ??? */
+  "_nosys",			/* 290 is ??? */
+  "_nosys",			/* 291 is ??? */
+  "_nosys",			/* 292 is ??? */
+  "_nosys",			/* 293 is ??? */
+  "_nosys",			/* 294 is ??? */
+  "_nosys",			/* 295 is ??? */
+  "_nosys",			/* 296 is ??? */
+  "_fhstatfs",     /*	297 */
+  "_fhopen",       /*	298 */
+  "_fhstat",       /*	299 */
+  "_modnext",      /*	300 */
+  "_modstat",      /*	301 */
+  "_modfnext",     /*	302 */
+  "_modfind",      /*	303 */
+  "_kldload",      /*	304 */
+  "_kldunload",    /*	305 */
+  "_kldfind",      /*	306 */
+  "_kldnext",      /*	307 */
+  "_kldstat",      /*	308 */
+  "_kldfirstmod",  /*	309 */
+  "_getsid",       /*	310 */
+  "_setresuid",    /*	311 */
+  "_setresgid",    /*	312 */
+  "_nosys",			/* 313 is obsolete signanosleep */
+  "_aio_return",   /*	314 */
+  "_aio_suspend",  /*	315 */
+  "_aio_cancel",   /*	316 */
+  "_aio_error",    /*	317 */
+  "_aio_read",     /*	318 */
+  "_aio_write",    /*	319 */
+  "_lio_listio",   /*	320 */
+  "_yield",        /*	321 */
+  "_thr_sleep",    /*	322 */
+  "_thr_wakeup",   /*	323 */
+  "_mlockall",     /*	324 */
+  "_munlockall",   /*	325 */
+  "___getcwd",     /*	326 */
+  "_sched_setparam", /*	327 */
+  "_sched_getparam", /*	328 */
+  "_sched_setscheduler", /*	329 */
+  "_sched_getscheduler", /*	330 */
+  "_sched_yield",  /*	331 */
+  "_sched_get_priority_max", /*	332 */
+  "_sched_get_priority_min", /*	333 */
+  "_sched_rr_get_interval", /*	334 */
+  "_utrace",       /*	335 */
+  "_sendfile",     /*	336 */
+  "_kldsym",       /*	337 */
+  "_jail",         /*	338 */
+  "_nosys",			/* 339 is ??? */
+  "_sigprocmask",  /*	340 */
+  "_sigsuspend",   /*	341 */
+  "_sigaction",    /*	342 */
+  "_sigpending",   /*	343 */
+  "_sigreturn",    /*	344 */
+  "_nosys",			/* 345 is ??? */
+  "_nosys",			/* 346 is ??? */
+  "___acl_get_file", /*	347 */
+  "___acl_set_file", /*	348 */
+  "___acl_get_fd", /*	349 */
+  "___acl_set_fd", /*	350 */
+  "___acl_delete_file", /*	351 */
+  "___acl_delete_fd",   /*	352 */
+  "___acl_aclcheck_file", /*	353 */
+  "___acl_aclcheck_fd", /*	354 */
+  "_extattrctl",   /*	355 */
+  "_extattr_set_file", /*	356 */
+  "_extattr_get_file", /*	357 */
+  "_extattr_delete_file", /*	358 */
+  "_aio_waitcomplete", /*	359 */
+  "_getresuid",    /*	360 */
+  "_getresgid",    /*	361 */
+  "_kqueue",       /*	362 */
+  "_kevent",       /*	363 */
+  "_nosys",			/* 364 is ??? */
+  "_nosys",			/* 365 is ??? */
+  "_nosys",			/* 366 is ??? */
+  "_nosys",			/* 367 is ??? */
+  "_nosys",			/* 368 is ??? */
+  "_nosys",			/* 369 is ??? */
+  "_nosys",			/* 370 is ??? */
+  "_nosys",			/* 371 is ??? */
+  "_nosys",			/* 372 is ??? */
+  "_nosys",			/* 373 is ??? */
+  "_nosys",			/* 374 is ??? */
+  "_nosys",			/* 375 is ??? */
+  "_nosys",			/* 376 is ??? */
+  "_nosys",			/* 377 is ??? */
+  "_nosys",			/* 378 is ??? */
+  "_nosys",			/* 379 is ??? */
+  "_nosys",			/* 380 is ??? */
+  "_nosys",			/* 381 is ??? */
+  "_nosys",			/* 382 is ??? */
+  "_nosys",			/* 383 is ??? */
+  "_nosys",			/* 384 is ??? */
+  "_nosys",			/* 385 is ??? */
+  "_nosys",			/* 386 is ??? */
+  "_nosys",			/* 387 is ??? */
+  "_nosys",			/* 388 is ??? */
+  "_nosys",			/* 389 is ??? */
+  "_nosys",			/* 390 is ??? */
+  "_nosys",			/* 391 is ??? */
+  "_nosys",			/* 392 is ??? */
+  "_sendfile",	/* 393 */
+  NULL
+};
+
+/* i386 sys_call_table for freebsd
+ */
+char * callz_fbsd5[]={
+  "_syscall",  /*	 0 */
+  "sys_exit",  /*	 1 */
+  "_fork",     /*	 2 */
+  "_read",     /*	 3 */
+  "_write",    /*	 4 */
+  "_open",     /*	 5 */
+  "_close",    /*	 6 */
+  "_wait4",    /*	 7 */
+  "_nosys",			/* 8 is old creat */
+  "_link",     /*	 9 */
+  "_unlink",   /*	10 */
+  "_nosys",			/* 11 is obsolete execv */
+  "_chdir",    /*	12 */
+  "_fchdir",   /*	13 */
+  "_mknod",    /*	14 */
+  "_chmod",    /*	15 */
+  "_chown",    /*	16 */
+  "_break",    /*	17 */
+  "_nosys",                     /* 18 is old getfsstat */
+  "_nosys",	        	/* 19 is old lseek */
+  "_getpid",   /*	20 */
+  "_mount",    /*	21 */
+  "_unmount",  /*	22 */
+  "_setuid",   /*	23 */
+  "_getuid",   /*	24 */
+  "_geteuid",  /*	25 */
+  "_ptrace",   /*	26 */
+  "_recvmsg",  /*	27 */
+  "_sendmsg",  /*	28 */
+  "_recvfrom", /*	29 */
+  "_accept",   /*	30 */
+  "_getpeername", /*	31 */
+  "_getsockname", /*	32 */
+  "_access",   /*	33 */
+  "_chflags",  /*	34 */
+  "_fchflags", /*	35 */
+  "_sync",     /*	36 */
+  "_kill",     /*	37 */
+  "_nosys",			/* 38 is old stat */
+  "_getppid",  /*	39 */
+  "_nosys",		        /* 40 is old lstat */
+  "_dup",      /*	41 */
+  "_pipe",     /*	42 */
+  "_getegid",  /*	43 */
+  "_profil",   /*	44 */
+  "_ktrace",   /*	45 */
+  "_nosys",			/* 46 is old sigaction */
+  "_getgid",   /*	47 */
+  "_nosys",			/* 48 is old sigprocmask */
+  "_getlogin", /*	49 */
+  "_setlogin", /*	50 */
+  "_acct",     /*	51 */
+  "_nosys",			/* 52 is old sigpending */
+  "_sigaltstack", /*	53 */
+  "_ioctl",    /*	54 */
+  "_reboot",   /*	55 */
+  "_revoke",   /*	56 */
+  "_symlink",  /*	57 */
+  "_readlink", /*	58 */
+  "_execve",   /*	59 */
+  "_umask",    /*	60 */
+  "_chroot",   /*	61 */
+  "_nosys",			/* 62 is old fstat */
+  "_nosys",			/* 63 is old getkerninfo */
+  "_nosys",			/* 64 is old getpagesize */
+  "_msync",    /*	65 */
+  "_vfork",    /*	66 */
+  "_nosys",			/* 67 is obsolete vread */
+  "_nosys",			/* 68 is obsolete vwrite */
+  "_sbrk",     /*	69 */
+  "_sstk",     /*	70 */
+  "_nosys",			/* 71 is old mmap */
+  "_vadvise",  /*	72 */
+  "_munmap",   /*	73 */
+  "_mprotect", /*	74 */
+  "_madvise",  /*	75 */
+  "_nosys",			/* 76 is obsolete vhangup */
+  "_nosys",			/* 77 is obsolete vlimit */
+  "_mincore",  /*	78 */
+  "_getgroups",/*	79 */
+  "_setgroups",/*	80 */
+  "_getpgrp",  /*	81 */
+  "_setpgid",  /*	82 */
+  "_setitimer",/*	83 */
+  "_nosys",			/* 84 is old wait */
+  "_swapon",   /*	85 */
+  "_getitimer",/*	86 */
+  "_nosys",			/* 87 is old gethostname */
+  "_nosys",			/* 88 is old sethostname */
+  "_getdtablesize", /*	89 */
+  "_dup2",     /*	90 */
+  "_nosys",			/* 91 is ??? */
+  "_fcntl",    /*	92 */
+  "_select",   /*	93 */
+  "_nosys",			/* 94 is ??? */
+  "_fsync",    /*	95 */
+  "_setpriority", /*	96 */
+  "_socket",   /*	97 */
+  "_connect",  /*	98 */
+  "_nosys",			/* 99 is old accept */
+  "_getpriority", /*	100 */
+  "_nosys",			/* 101 is old send */
+  "_nosys",			/* 102 is old recv */
+  "_nosys",			/* 103 is old sigreturn */
+  "_bind",    /*	104 */
+  "_setsockopt", /*	105 */
+  "_listen",  /*	106 */
+  "_nosys",			/* 107 is obsolete vtimes */
+  "_nosys",			/* 108 is old sigvec */
+  "_nosys",			/* 109 is old sigblock */
+  "_nosys",			/* 110 is old sigsetmask */
+  "_nosys",			/* 111 is old sigsuspend */
+  "_nosys",			/* 112 is old sigstack */
+  "_nosys",			/* 113 is old recvmsg */
+  "_nosys",			/* 114 is old sendmsg */
+  "_nosys",			/* 115 is obsolete vtrace */
+  "_gettimeofday", /*	116 */ 
+  "_getrusage",    /*	117 */
+  "_getsockopt",   /*	118 */
+  "_nosys",			/* 119 is ??? */
+  "_readv",        /*	120 */
+  "_writev",       /*	121 */
+  "_settimeofday", /*	122 */
+  "_fchown",       /*	123 */
+  "_fchmod",       /*	124 */
+  "_nosys",			/* 125 is old recvfrom */
+  "_setreuid",     /*	126 */
+  "_setregid",     /*	127 */
+  "_rename",       /*	128 */
+  "_nosys",			/* 129 is old truncate */
+  "_nosys",			/* 130 is old ftruncate */
+  "_flock",        /*	131 */
+  "_mkfifo",       /*	132 */
+  "_sendto",       /*	133 */
+  "_shutdown",     /*	134 */
+  "_socketpair",   /*	135 */
+  "_mkdir",        /*	136 */
+  "_rmdir",        /*	137 */
+  "_utimes",       /*	138 */
+  "_nosys",			/* 139 is obsolete 4.2 sigreturn */
+  "_adjtime",      /*	140 */
+  "_nosys",			/* 141 is old getpeername */
+  "_nosys",			/* 142 is old gethostid */
+  "_nosys",			/* 143 is old sethostid */
+  "_nosys",			/* 144 is old getrlimit */
+  "_nosys",			/* 145 is old setrlimit */
+  "_nosys",			/* 146 is old killpg */
+  "_setsid",       /*	147 */
+  "_quotactl",     /*	148 */
+  "_nosys",			/* 149 is old quota */
+  "_nosys",			/* 150 is old getsockname */
+  "_nosys",			/* 151 is ??? */
+  "_nosys",			/* 152 is ??? */
+  "_nosys",			/* 153 is ??? */
+  "_nosys",			/* 154 is ??? */
+  "_nfssvc",       /*	155 */
+  "_nosys",		        /* 156 is old getdirentries */
+  "_nosys",                     /* 157 is old statfs */
+  "_nosys",                     /* 158 is old fstatfs */
+  "_nosys",			/* 159 is ??? */
+  "_lgetfh",       /*   160 */
+  "_getfh",        /*	161 */
+  "_getdomainname", /*	162 */
+  "_setdomainname", /*	163 */
+  "_uname",        /*	164 */
+  "_sysarch",      /*	165 */
+  "_rtprio",       /*	166 */
+  "_nosys",			/* 167 is ??? */
+  "_nosys",			/* 168 is ??? */
+  "_semsys",       /*	169 */
+  "_msgsys",       /*	170 */
+  "_shmsys",       /*	171 */
+  "_nosys",			/* 172 is ??? */
+  "_pread",        /*	173 */
+  "_pwrite",       /*	174 */
+  "_nosys",			/* 175 is ??? */
+  "_ntp_adjtime",  /*	176 */
+  "_nosys",			/* 177 is ??? */
+  "_nosys",			/* 178 is ??? */
+  "_nosys",			/* 179 is ??? */
+  "_nosys",			/* 180 is ??? */
+  "_setgid",       /*	181 */
+  "_setegid",      /*	182 */
+  "_seteuid",      /*	183 */
+  "_nosys",			/* 184 is ??? */
+  "_nosys",			/* 185 is ??? */
+  "_nosys",			/* 186 is ??? */
+  "_nosys",			/* 187 is ??? */
+  "_stat",         /*	188 */
+  "_fstat",        /*	189 */
+  "_lstat",        /*	190 */
+  "_pathconf",     /*	191 */
+  "_fpathconf",    /*	192 */
+  "_nosys",			/* 193 is ??? */
+  "_getrlimit",    /*	194 */
+  "_setrlimit",    /*	195 */
+  "_getdirentries", /*	196 */
+  "_mmap",         /*	197 */
+  "___syscall",    /*	198 */
+  "_lseek",        /*	199 */
+  "_truncate",     /*	200 */
+  "_ftruncate",    /*	201 */
+  "___sysctl",     /*	202 */
+  "_mlock",        /*	203 */
+  "_munlock",      /*	204 */
+  "_undelete",     /*	205 */
+  "_futimes",      /*	206 */
+  "_getpgid",      /*	207 */
+  "_nosys",			/* 208 is ??? */
+  "_poll",         /*	209 */
+  "_nosys",			/* 210 is ??? */
+  "_nosys",			/* 211 is ??? */
+  "_nosys",			/* 212 is ??? */
+  "_nosys",			/* 213 is ??? */
+  "_nosys",			/* 214 is ??? */
+  "_nosys",			/* 215 is ??? */
+  "_nosys",			/* 216 is ??? */
+  "_nosys",			/* 217 is ??? */
+  "_nosys",			/* 218 is ??? */
+  "_nosys",			/* 219 is ??? */
+  "___semctl",     /*	220 */
+  "_semget",       /*	221 */
+  "_semop",        /*	222 */
+  "_nosys",			/* 223 is ??? */
+  "_msgctl",       /*	224 */
+  "_msgget",       /*	225 */
+  "_msgsnd",       /*	226 */
+  "_msgrcv",       /*	227 */
+  "_shmat",        /*	228 */
+  "_shmctl",       /*	229 */
+  "_shmdt",        /*	230 */
+  "_shmget",       /*	231 */
+  "_clock_gettime", /*	232 */
+  "_clock_settime", /*	233 */
+  "_clock_getres", /*	234 */
+  "_nosys",			/* 235 is ??? */
+  "_nosys",			/* 236 is ??? */
+  "_nosys",			/* 237 is ??? */
+  "_nosys",			/* 238 is ??? */
+  "_nosys",			/* 239 is ??? */
+  "_nanosleep",    /*	240 */
+  "_nosys",			/* 241 is ??? */
+  "_nosys",			/* 242 is ??? */
+  "_nosys",			/* 243 is ??? */
+  "_nosys",			/* 244 is ??? */
+  "_nosys",			/* 245 is ??? */
+  "_nosys",			/* 246 is ??? */
+  "_nosys",			/* 247 is ??? */
+  "_nosys",			/* 248 is ??? */
+  "_nosys",			/* 249 is ??? */
+  "_minherit",     /*	250 */
+  "_rfork",        /*	251 */
+  "_openbsd_poll", /*	252 */
+  "_issetugid",    /*	253 */
+  "_lchown",       /*	254 */
+  "_nosys",			/* 255 is ??? */
+  "_nosys",			/* 256 is ??? */
+  "_nosys",			/* 257 is ??? */
+  "_nosys",			/* 258 is ??? */
+  "_nosys",			/* 259 is ??? */
+  "_nosys",			/* 260 is ??? */
+  "_nosys",			/* 261 is ??? */
+  "_nosys",			/* 262 is ??? */
+  "_nosys",			/* 263 is ??? */
+  "_nosys",			/* 264 is ??? */
+  "_nosys",			/* 265 is ??? */
+  "_nosys",			/* 266 is ??? */
+  "_nosys",			/* 267 is ??? */
+  "_nosys",			/* 268 is ??? */
+  "_nosys",			/* 269 is ??? */
+  "_nosys",			/* 270 is ??? */
+  "_nosys",			/* 271 is ??? */
+  "_getdents",     /*	272 */
+  "_nosys",			/* 273 is ??? */
+  "_lchmod",       /*	274 */
+  "_netbsd_lchown", /*	275 */
+  "_lutimes",      /*	276 */
+  "_netbsd_msync", /*	277 */
+  "_nstat",        /*	278 */
+  "_nfstat",       /*	279 */
+  "_nlstat",       /*	280 */
+  "_nosys",			/* 281 is ??? */
+  "_nosys",			/* 282 is ??? */
+  "_nosys",			/* 283 is ??? */
+  "_nosys",			/* 284 is ??? */
+  "_nosys",			/* 285 is ??? */
+  "_nosys",			/* 286 is ??? */
+  "_nosys",			/* 287 is ??? */
+  "_nosys",			/* 288 is ??? */
+  "_nosys",			/* 289 is ??? */
+  "_nosys",			/* 290 is ??? */
+  "_nosys",			/* 291 is ??? */
+  "_nosys",			/* 292 is ??? */
+  "_nosys",			/* 293 is ??? */
+  "_nosys",			/* 294 is ??? */
+  "_nosys",			/* 295 is ??? */
+  "_nosys",			/* 296 is ??? */
+  "_nosys",                     /* 297 is old fhstatfs */
+  "_fhopen",       /*	298 */
+  "_fhstat",       /*	299 */
+  "_modnext",      /*	300 */
+  "_modstat",      /*	301 */
+  "_modfnext",     /*	302 */
+  "_modfind",      /*	303 */
+  "_kldload",      /*	304 */
+  "_kldunload",    /*	305 */
+  "_kldfind",      /*	306 */
+  "_kldnext",      /*	307 */
+  "_kldstat",      /*	308 */
+  "_kldfirstmod",  /*	309 */
+  "_getsid",       /*	310 */
+  "_setresuid",    /*	311 */
+  "_setresgid",    /*	312 */
+  "_nosys",			/* 313 is obsolete signanosleep */
+  "_aio_return",   /*	314 */
+  "_aio_suspend",  /*	315 */
+  "_aio_cancel",   /*	316 */
+  "_aio_error",    /*	317 */
+  "_aio_read",     /*	318 */
+  "_aio_write",    /*	319 */
+  "_lio_listio",   /*	320 */
+  "_yield",        /*	321 */
+  "_thr_sleep",    /*	322 */
+  "_thr_wakeup",   /*	323 */
+  "_mlockall",     /*	324 */
+  "_munlockall",   /*	325 */
+  "___getcwd",     /*	326 */
+  "_sched_setparam", /*	327 */
+  "_sched_getparam", /*	328 */
+  "_sched_setscheduler", /*	329 */
+  "_sched_getscheduler", /*	330 */
+  "_sched_yield",  /*	331 */
+  "_sched_get_priority_max", /*	332 */
+  "_sched_get_priority_min", /*	333 */
+  "_sched_rr_get_interval", /*	334 */
+  "_utrace",       /*	335 */
+  "_nosys",                  /* 336 is old sendfile */
+  "_kldsym",       /*	337 */
+  "_jail",         /*	338 */
+  "_nosys",			/* 339 is ??? */
+  "_sigprocmask",  /*	340 */
+  "_sigsuspend",   /*	341 */
+  "_nosys",                     /* 342 is old sigaction */
+  "_sigpending",   /*	343 */
+  "_nosys",                     /* 344 is old sigreturn */
+  "_sigtimedwait", /*   345 */
+  "_sigwaitinfo",  /*   346 */
+  "___acl_get_file", /*	347 */
+  "___acl_set_file", /*	348 */
+  "___acl_get_fd", /*	349 */
+  "___acl_set_fd", /*	350 */
+  "___acl_delete_file", /*	351 */
+  "___acl_delete_fd",   /*	352 */
+  "___acl_aclcheck_file", /*	353 */
+  "___acl_aclcheck_fd", /*	354 */
+  "_extattrctl",   /*	355 */
+  "_extattr_set_file", /*	356 */
+  "_extattr_get_file", /*	357 */
+  "_extattr_delete_file", /*	358 */
+  "_aio_waitcomplete", /*	359 */
+  "_getresuid",    /*	360 */
+  "_getresgid",    /*	361 */
+  "_kqueue",       /*	362 */
+  "_kevent",       /*	363 */
+  "_nosys",			/* 364 is ??? */
+  "_nosys",			/* 365 is ??? */
+  "_nosys",			/* 366 is ??? */
+  "_nosys",			/* 367 is ??? */
+  "_nosys",			/* 368 is ??? */
+  "_nosys",			/* 369 is ??? */
+  "_nosys",			/* 370 is ??? */
+  "_extattr_set_fd",            /* 371 */
+  "_extattr_get_fd",            /* 372 */
+  "_extattr_delete_fd",         /* 373 */
+  "___setugid",                 /* 374 */
+  "_nfsclnt",                   /* 375 */
+  "_eaccess",                   /* 376 */
+  "_nosys",			/* 377 is ??? */
+  "_nmount",                    /* 378 */
+  "_kse_exit",                  /* 379 */
+  "_kse_wakeup",                /* 380 */
+  "_kse_create",                /* 381 */
+  "_kse_thr_interrupt",         /* 382 */
+  "_kse_release",               /* 383 */
+  "___mac_get_proc",            /* 384 */
+  "___mac_set_proc",            /* 385 */
+  "___mac_get_fd",              /* 386 */
+  "___mac_get_file",            /* 387 */
+  "___mac_set_fd",              /* 388 */
+  "___mac_set_file",            /* 389 */
+  "_kenv",			/* 390 */
+  "_lchflags",                  /* 391 */
+  "_uuidgen",                   /* 392 */
+  "_sendfile",	  /* 393 */
+  "_mac_syscall",	  /* 394 */
+  "_getfsstat",	  /* 395 */
+  "_statfs",	  /* 396 */
+  "_fstatfs",	  /* 397 */
+  "_fhstatfs",	  /* 398 */
+  "_nosys",	  /* 399 */
+  "_ksem_close",  /* 400 */
+  "_ksem_post",	  /* 401 */
+  "_ksem_wait",	  /* 402 */
+  "_ksem_trywait",	  /* 403 */
+  "_ksem_init",	  /* 404 */
+  "_ksem_open",	  /* 405 */
+  "_ksem_unlink",	  /* 406 */
+  "_ksem_getvalue",	  /* 407 */
+  "_ksem_destroy",	  /* 408 */
+  "___mac_get_pid",	  /* 409 */
+  "___mac_get_link",	  /* 410 */
+  "___mac_set_link",	  /* 411 */
+  "_extattr_set_link",	  /* 412 */
+  "_extattr_get_link",	  /* 413 */
+  "_extattr_delete_link",	  /* 414 */
+  "___mac_execve",	  /* 415 */
+  "_sigaction",	  /* 416 */
+  "_sigreturn",	  /* 417 */
+  "_nosys",	  /* 418 */
+  "_nosys",	  /* 419 */
+  "_nosys",	  /* 420 */
+  "_getcontext",	  /* 421 */
+  "_setcontext",	  /* 422 */
+  "_swapcontext",	  /* 423 */
+  "_swapoff",	  /* 424 */
+  "___acl_get_link",	  /* 425 */
+  "___acl_set_link",	  /* 426 */
+  "___acl_delete_link",	  /* 427 */
+  "___acl_aclcheck_link",	  /* 428 */
+  "_sigwait",	  /* 429 */
+  "_thr_create",	  /* 430 */
+  "_thr_exit",	  /* 431 */
+  "_thr_self",	  /* 432 */
+  "_thr_kill",	  /* 433 */
+  "__umtx_lock",	  /* 434 */
+  "__umtx_unlock",	  /* 435 */
+  "_jail_attach",	  /* 436 */
+  "_extattr_list_fd",	  /* 437 */
+  "_extattr_list_file",	  /* 438 */
+  "_extattr_list_link",	  /* 439 */
+  "_kse_switchin",        /* 440 */
+  "_ksem_timedwait",      /* 441 */
+  "_thr_suspend",         /* 442 */
+  "_thr_wake",            /* 443 */
+  "_kldunloadf",          /* 444 */
+  NULL
+};
+
Index: trunk/include/rijndael-alg-fst.h
===================================================================
--- trunk/include/rijndael-alg-fst.h	(revision 591)
+++ trunk/include/rijndael-alg-fst.h	(revision 1)
@@ -1,44 +1,41 @@
-/*	$NetBSD: rijndael-alg-fst.h,v 1.4 2005/12/11 12:20:52 christos Exp $	*/
-/*	$KAME: rijndael-alg-fst.h,v 1.5 2003/07/15 10:47:16 itojun Exp $	*/
-/**
- * rijndael-alg-fst.h
+/*
+ * rijndael-alg-fst.h   v2.3   April '2000
  *
- * @version 3.0 (December 2000)
+ * Optimised ANSI C code
  *
- * Optimised ANSI C code for the Rijndael cipher (now AES)
- *
- * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
- * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
- * @author Paulo Barreto <paulo.barreto@terra.com.br>
- *
- * This code is hereby placed in the public domain.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
+/*@-fixedformalarray@*/
+
 #ifndef __RIJNDAEL_ALG_FST_H
 #define __RIJNDAEL_ALG_FST_H
 
-#define RIJNDAEL_MAXKC	(256/32)
-#define RIJNDAEL_MAXKB	(256/8)
-#define RIJNDAEL_MAXNR	14
+#define MAXKC			(256/32)
+#define MAXROUNDS		14
+
+/* USUAL_TYPES */
+#ifndef USUAL_TYPES
+#define USUAL_TYPES
+typedef unsigned char	byte;
+typedef unsigned char	word8;	
+typedef unsigned short	word16;	
+typedef unsigned int	word32;
+#endif 
 
 #ifdef SH_ENCRYPT
 
-int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);
-int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);
-void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]);
-void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[16]);
+int rijndaelKeySched(word8 k[MAXKC][4], word8 rk[MAXROUNDS+1][4][4], int ROUNDS);
+
+int rijndaelKeyEncToDec(word8 W[MAXROUNDS+1][4][4], int ROUNDS);
+
+int rijndaelEncrypt(word8 a[16], word8 b[16], word8 rk[MAXROUNDS+1][4][4], int ROUNDS);
+
+
+int rijndaelDecrypt(word8 a[16], word8 b[16], word8 rk[MAXROUNDS+1][4][4], int ROUNDS);
 
 /* SH_ENCRYPT */
 #endif
-#endif /* __RIJNDAEL_ALG_FST_H */
+
+/* __RIJNDAEL_ALG_FST_H */
+#endif 
+
Index: trunk/include/rijndael-api-fst.h
===================================================================
--- trunk/include/rijndael-api-fst.h	(revision 591)
+++ trunk/include/rijndael-api-fst.h	(revision 1)
@@ -1,39 +1,7 @@
-/*	$NetBSD: rijndael-api-fst.h,v 1.8 2007/01/21 23:00:08 cbiere Exp $	*/
-
-/**
- * rijndael-api-fst.h
+/*
+ * rijndael-api-fst.h   v2.3   April '2000
  *
- * @version 2.9 (December 2000)
+ * Optimised ANSI C code
  *
- * Optimised ANSI C code for the Rijndael cipher (now AES)
- *
- * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
- * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
- * @author Paulo Barreto <paulo.barreto@terra.com.br>
- *
- * This code is hereby placed in the public domain.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Acknowledgements:
- *
- * We are deeply indebted to the following people for their bug reports,
- * fixes, and improvement suggestions to this implementation. Though we
- * tried to list all contributions, we apologise in advance for any
- * missing reference.
- *
- * Andrew Bales <Andrew.Bales@Honeywell.com>
- * Markus Friedl <markus.friedl@informatik.uni-erlangen.de>
- * John Skodon <skodonj@webquill.com>
  */
 
@@ -41,30 +9,15 @@
 #define __RIJNDAEL_API_FST_H
 
-/* Blocksize: 16 * 8 = 128; 128 * 1 = 128 */
-#define     B_SIZ    16
-#define     BNUM      1
+#include "rijndael-alg-fst.h"
+
+/*  Defines:
+    Add any additional defines you need
+*/
+
+#define     BNUM                  1
+#define     B_SIZ                 16
+#define     STRICT_ALIGN          1 /*  For safety          */
 
 
-#if defined(UINT32)
-typedef unsigned char u8;
-typedef UINT32 u32;
-#else
-
-typedef unsigned char u8;
-#if defined(HAVE_INT_32)
-typedef unsigned int u32;
-#elif defined(HAVE_LONG_32)
-typedef unsigned long u32;
-#elif defined(HAVE_SHORT_32)
-typedef unsigned short u32;
-#else
-#error "No 32 bit integer type found"
-#endif
-
-#endif
-
-#include "rijndael-alg-fst.h"
-
-/*  Generic Defines  */
 #define     DIR_ENCRYPT           0 /*  Are we encrpyting?  */
 #define     DIR_DECRYPT           1 /*  Are we decrpyting?  */
@@ -72,13 +25,10 @@
 #define     MODE_CBC              2 /*  Are we ciphering in CBC mode?   */
 #define     MODE_CFB1             3 /*  Are we ciphering in 1-bit CFB mode? */
-#ifndef     TRUE
 #define     TRUE                  1
-#endif
-#ifndef     FALSE
 #define     FALSE                 0
-#endif
 #define     BITSPERBLOCK        128 /* Default number of bits in a cipher block */
 
-/*  Error Codes  */
+/*  Error Codes - CHANGE POSSIBLE: inclusion of additional error codes  */
+
 #define     BAD_KEY_DIR          -1 /*  Key direction is invalid, e.g., unknown value */
 #define     BAD_KEY_MAT          -2 /*  Key material not of correct length */
@@ -91,46 +41,59 @@
 #define     BAD_OTHER            -9 /*  Unknown error */
 
-/*  Algorithm-specific Defines  */
-#define     RIJNDAEL_MAX_KEY_SIZE         64 /* # of ASCII char's needed to represent a key */
-#define     RIJNDAEL_MAX_IV_SIZE          16 /* # bytes needed to represent an IV  */
+/*  CHANGE POSSIBLE:  inclusion of algorithm specific defines  */
+#define     MAX_KEY_SIZE         64 /* # of ASCII char's needed to represent a key */
+#define     MAX_IV_SIZE          16 /* # bytes needed to represent an IV  */
 
 #ifdef SH_ENCRYPT
 
-/*  Typedefs  */
+/*  Typedefs:
 
-typedef unsigned char   BYTE;
+	Typedef'ed data storage elements.  Add any algorithm specific 
+parameters at the bottom of the structs as appropriate.
+*/
+
+typedef unsigned char   RIJ_BYTE;
 
 /*  The structure for key information */
 typedef struct {
-  u32   rk[4*(RIJNDAEL_MAXNR + 1)];        /* key schedule */
-  u32   ek[4*(RIJNDAEL_MAXNR + 1)];        /* CFB1 key schedule (encryption only) */
-  BYTE  direction;                /* Key used for encrypting or decrypting? */
-  int   keyLen;                   /* Length of the key  */
-  char  keyMaterial[RIJNDAEL_MAX_KEY_SIZE+1];  /* Raw key data in ASCII, e.g., user input or KAT values */
-  int   Nr;                       /* key-length-dependent number of rounds */
+    RIJ_BYTE  direction;                /* Key used for encrypting or decrypting? */
+    int   keyLen;                   /* Length of the key  */
+    char  keyMaterial[MAX_KEY_SIZE+1];  /* Raw key data in ASCII, e.g., user input or KAT values */
+        /*  The following parameters are algorithm dependent, replace or add as necessary  */
+	int   ROUNDS;                   /* key-length-dependent number of rounds */
+    int   blockLen;                 /* block length */
+    word8 keySched[MAXROUNDS+1][4][4];	/* key schedule		*/
 } keyInstance;
 
 /*  The structure for cipher information */
 typedef struct {                    /* changed order of the components */
-    u32  IV[RIJNDAEL_MAX_IV_SIZE / sizeof(u32)];
-			/* A possible Initialization Vector for ciphering */
-    BYTE  mode;                     /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
+    RIJ_BYTE  mode;                     /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
+    RIJ_BYTE  IV[MAX_IV_SIZE];          /* A possible Initialization Vector for ciphering */
+        /*  Add any algorithm specific parameters needed here  */
+    int   blockLen;                 /* Sample: Handles non-128 bit block sizes (if available) */
 } cipherInstance;
 
 /*  Function prototypes  */
+/*  CHANGED: nothing
+	TODO: implement the following extensions to setup 192-bit and 256-bit block lengths:
+        makeKeyEx():    parameter blockLen added
+                        -- this parameter is absolutely necessary if you want to
+                        setup the round keys in a variable block length setting 
+	    cipherInitEx(): parameter blockLen added (for obvious reasons)		
+ */
 
-int rijndael_makeKey(keyInstance *, BYTE, int, const char *);
+int makeKey(keyInstance *key, RIJ_BYTE direction, int keyLen, char *keyMaterial);
 
-int rijndael_cipherInit(cipherInstance *, BYTE, const char *);
+int cipherInit(cipherInstance *cipher, RIJ_BYTE mode, char *IV);
 
-int rijndael_blockEncrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *);
+int blockEncrypt(cipherInstance *cipher, keyInstance *key,
+		 RIJ_BYTE *input, int inputLen, RIJ_BYTE *outBuffer);
 
-int rijndael_padEncrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *);
-
-int rijndael_blockDecrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *);
-
-int rijndael_padDecrypt(cipherInstance *, keyInstance *, const BYTE *, int, BYTE *);
+int blockDecrypt(cipherInstance *cipher, keyInstance *key,
+		 RIJ_BYTE *input, int inputLen, RIJ_BYTE *outBuffer);
 
 /* SH_ENCRYPT */
 #endif
-#endif /* __RIJNDAEL_API_FST_H */
+
+/*  __RIJNDAEL_API_FST_H */
+#endif 
Index: trunk/include/rijndael-boxes-fst.h
===================================================================
--- trunk/include/rijndael-boxes-fst.h	(revision 1)
+++ trunk/include/rijndael-boxes-fst.h	(revision 1)
@@ -0,0 +1,914 @@
+word8 S[256] = {
+ 99, 124, 119, 123, 242, 107, 111, 197,  48,   1, 103,  43, 254, 215, 171, 118, 
+202, 130, 201, 125, 250,  89,  71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 
+183, 253, 147,  38,  54,  63, 247, 204,  52, 165, 229, 241, 113, 216,  49,  21, 
+  4, 199,  35, 195,  24, 150,   5, 154,   7,  18, 128, 226, 235,  39, 178, 117, 
+  9, 131,  44,  26,  27, 110,  90, 160,  82,  59, 214, 179,  41, 227,  47, 132, 
+ 83, 209,   0, 237,  32, 252, 177,  91, 106, 203, 190,  57,  74,  76,  88, 207, 
+208, 239, 170, 251,  67,  77,  51, 133,  69, 249,   2, 127,  80,  60, 159, 168, 
+ 81, 163,  64, 143, 146, 157,  56, 245, 188, 182, 218,  33,  16, 255, 243, 210, 
+205,  12,  19, 236,  95, 151,  68,  23, 196, 167, 126,  61, 100,  93,  25, 115, 
+ 96, 129,  79, 220,  34,  42, 144, 136,  70, 238, 184,  20, 222,  94,  11, 219, 
+224,  50,  58,  10,  73,   6,  36,  92, 194, 211, 172,  98, 145, 149, 228, 121, 
+231, 200,  55, 109, 141, 213,  78, 169, 108,  86, 244, 234, 101, 122, 174,   8, 
+186, 120,  37,  46,  28, 166, 180, 198, 232, 221, 116,  31,  75, 189, 139, 138, 
+112,  62, 181, 102,  72,   3, 246,  14,  97,  53,  87, 185, 134, 193,  29, 158, 
+225, 248, 152,  17, 105, 217, 142, 148, 155,  30, 135, 233, 206,  85,  40, 223, 
+140, 161, 137,  13, 191, 230,  66, 104,  65, 153,  45,  15, 176,  84, 187,  22
+};
+
+#ifdef INTERMEDIATE_VALUE_KAT
+word8 Si[256] = {
+ 82,   9, 106, 213,  48,  54, 165,  56, 191,  64, 163, 158, 129, 243, 215, 251, 
+124, 227,  57, 130, 155,  47, 255, 135,  52, 142,  67,  68, 196, 222, 233, 203, 
+ 84, 123, 148,  50, 166, 194,  35,  61, 238,  76, 149,  11,  66, 250, 195,  78, 
+  8,  46, 161, 102,  40, 217,  36, 178, 118,  91, 162,  73, 109, 139, 209,  37, 
+114, 248, 246, 100, 134, 104, 152,  22, 212, 164,  92, 204,  93, 101, 182, 146, 
+108, 112,  72,  80, 253, 237, 185, 218,  94,  21,  70,  87, 167, 141, 157, 132, 
+144, 216, 171,   0, 140, 188, 211,  10, 247, 228,  88,   5, 184, 179,  69,   6, 
+208,  44,  30, 143, 202,  63,  15,   2, 193, 175, 189,   3,   1,  19, 138, 107, 
+ 58, 145,  17,  65,  79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 
+150, 172, 116,  34, 231, 173,  53, 133, 226, 249,  55, 232,  28, 117, 223, 110, 
+ 71, 241,  26, 113,  29,  41, 197, 137, 111, 183,  98,  14, 170,  24, 190,  27, 
+252,  86,  62,  75, 198, 210, 121,  32, 154, 219, 192, 254, 120, 205,  90, 244, 
+ 31, 221, 168,  51, 136,   7, 199,  49, 177,  18,  16,  89,  39, 128, 236,  95, 
+ 96,  81, 127, 169,  25, 181,  74,  13,  45, 229, 122, 159, 147, 201, 156, 239, 
+160, 224,  59,  77, 174,  42, 245, 176, 200, 235, 187,  60, 131,  83, 153,  97, 
+ 23,  43,   4, 126, 186, 119, 214,  38, 225, 105,  20,  99,  85,  33,  12, 125
+};
+#endif /* INTERMEDIATE_VALUE_KAT */
+
+word8 T1[256][4] = {
+{ 0xc6,0x63,0x63,0xa5},{  0xf8,0x7c,0x7c,0x84},{  0xee,0x77,0x77,0x99},{  0xf6,0x7b,0x7b,0x8d}, 
+{ 0xff,0xf2,0xf2,0x0d},{  0xd6,0x6b,0x6b,0xbd},{  0xde,0x6f,0x6f,0xb1},{  0x91,0xc5,0xc5,0x54}, 
+{ 0x60,0x30,0x30,0x50},{  0x02,0x01,0x01,0x03},{  0xce,0x67,0x67,0xa9},{  0x56,0x2b,0x2b,0x7d}, 
+{ 0xe7,0xfe,0xfe,0x19},{  0xb5,0xd7,0xd7,0x62},{  0x4d,0xab,0xab,0xe6},{  0xec,0x76,0x76,0x9a}, 
+{ 0x8f,0xca,0xca,0x45},{  0x1f,0x82,0x82,0x9d},{  0x89,0xc9,0xc9,0x40},{  0xfa,0x7d,0x7d,0x87}, 
+{ 0xef,0xfa,0xfa,0x15},{  0xb2,0x59,0x59,0xeb},{  0x8e,0x47,0x47,0xc9},{  0xfb,0xf0,0xf0,0x0b}, 
+{ 0x41,0xad,0xad,0xec},{  0xb3,0xd4,0xd4,0x67},{  0x5f,0xa2,0xa2,0xfd},{  0x45,0xaf,0xaf,0xea}, 
+{ 0x23,0x9c,0x9c,0xbf},{  0x53,0xa4,0xa4,0xf7},{  0xe4,0x72,0x72,0x96},{  0x9b,0xc0,0xc0,0x5b}, 
+{ 0x75,0xb7,0xb7,0xc2},{  0xe1,0xfd,0xfd,0x1c},{  0x3d,0x93,0x93,0xae},{  0x4c,0x26,0x26,0x6a}, 
+{ 0x6c,0x36,0x36,0x5a},{  0x7e,0x3f,0x3f,0x41},{  0xf5,0xf7,0xf7,0x02},{  0x83,0xcc,0xcc,0x4f}, 
+{ 0x68,0x34,0x34,0x5c},{  0x51,0xa5,0xa5,0xf4},{  0xd1,0xe5,0xe5,0x34},{  0xf9,0xf1,0xf1,0x08}, 
+{ 0xe2,0x71,0x71,0x93},{  0xab,0xd8,0xd8,0x73},{  0x62,0x31,0x31,0x53},{  0x2a,0x15,0x15,0x3f}, 
+{ 0x08,0x04,0x04,0x0c},{  0x95,0xc7,0xc7,0x52},{  0x46,0x23,0x23,0x65},{  0x9d,0xc3,0xc3,0x5e}, 
+{ 0x30,0x18,0x18,0x28},{  0x37,0x96,0x96,0xa1},{  0x0a,0x05,0x05,0x0f},{  0x2f,0x9a,0x9a,0xb5}, 
+{ 0x0e,0x07,0x07,0x09},{  0x24,0x12,0x12,0x36},{  0x1b,0x80,0x80,0x9b},{  0xdf,0xe2,0xe2,0x3d}, 
+{ 0xcd,0xeb,0xeb,0x26},{  0x4e,0x27,0x27,0x69},{  0x7f,0xb2,0xb2,0xcd},{  0xea,0x75,0x75,0x9f}, 
+{ 0x12,0x09,0x09,0x1b},{  0x1d,0x83,0x83,0x9e},{  0x58,0x2c,0x2c,0x74},{  0x34,0x1a,0x1a,0x2e}, 
+{ 0x36,0x1b,0x1b,0x2d},{  0xdc,0x6e,0x6e,0xb2},{  0xb4,0x5a,0x5a,0xee},{  0x5b,0xa0,0xa0,0xfb}, 
+{ 0xa4,0x52,0x52,0xf6},{  0x76,0x3b,0x3b,0x4d},{  0xb7,0xd6,0xd6,0x61},{  0x7d,0xb3,0xb3,0xce}, 
+{ 0x52,0x29,0x29,0x7b},{  0xdd,0xe3,0xe3,0x3e},{  0x5e,0x2f,0x2f,0x71},{  0x13,0x84,0x84,0x97}, 
+{ 0xa6,0x53,0x53,0xf5},{  0xb9,0xd1,0xd1,0x68},{  0x00,0x00,0x00,0x00},{  0xc1,0xed,0xed,0x2c}, 
+{ 0x40,0x20,0x20,0x60},{  0xe3,0xfc,0xfc,0x1f},{  0x79,0xb1,0xb1,0xc8},{  0xb6,0x5b,0x5b,0xed}, 
+{ 0xd4,0x6a,0x6a,0xbe},{  0x8d,0xcb,0xcb,0x46},{  0x67,0xbe,0xbe,0xd9},{  0x72,0x39,0x39,0x4b}, 
+{ 0x94,0x4a,0x4a,0xde},{  0x98,0x4c,0x4c,0xd4},{  0xb0,0x58,0x58,0xe8},{  0x85,0xcf,0xcf,0x4a}, 
+{ 0xbb,0xd0,0xd0,0x6b},{  0xc5,0xef,0xef,0x2a},{  0x4f,0xaa,0xaa,0xe5},{  0xed,0xfb,0xfb,0x16}, 
+{ 0x86,0x43,0x43,0xc5},{  0x9a,0x4d,0x4d,0xd7},{  0x66,0x33,0x33,0x55},{  0x11,0x85,0x85,0x94}, 
+{ 0x8a,0x45,0x45,0xcf},{  0xe9,0xf9,0xf9,0x10},{  0x04,0x02,0x02,0x06},{  0xfe,0x7f,0x7f,0x81}, 
+{ 0xa0,0x50,0x50,0xf0},{  0x78,0x3c,0x3c,0x44},{  0x25,0x9f,0x9f,0xba},{  0x4b,0xa8,0xa8,0xe3}, 
+{ 0xa2,0x51,0x51,0xf3},{  0x5d,0xa3,0xa3,0xfe},{  0x80,0x40,0x40,0xc0},{  0x05,0x8f,0x8f,0x8a}, 
+{ 0x3f,0x92,0x92,0xad},{  0x21,0x9d,0x9d,0xbc},{  0x70,0x38,0x38,0x48},{  0xf1,0xf5,0xf5,0x04}, 
+{ 0x63,0xbc,0xbc,0xdf},{  0x77,0xb6,0xb6,0xc1},{  0xaf,0xda,0xda,0x75},{  0x42,0x21,0x21,0x63}, 
+{ 0x20,0x10,0x10,0x30},{  0xe5,0xff,0xff,0x1a},{  0xfd,0xf3,0xf3,0x0e},{  0xbf,0xd2,0xd2,0x6d}, 
+{ 0x81,0xcd,0xcd,0x4c},{  0x18,0x0c,0x0c,0x14},{  0x26,0x13,0x13,0x35},{  0xc3,0xec,0xec,0x2f}, 
+{ 0xbe,0x5f,0x5f,0xe1},{  0x35,0x97,0x97,0xa2},{  0x88,0x44,0x44,0xcc},{  0x2e,0x17,0x17,0x39}, 
+{ 0x93,0xc4,0xc4,0x57},{  0x55,0xa7,0xa7,0xf2},{  0xfc,0x7e,0x7e,0x82},{  0x7a,0x3d,0x3d,0x47}, 
+{ 0xc8,0x64,0x64,0xac},{  0xba,0x5d,0x5d,0xe7},{  0x32,0x19,0x19,0x2b},{  0xe6,0x73,0x73,0x95}, 
+{ 0xc0,0x60,0x60,0xa0},{  0x19,0x81,0x81,0x98},{  0x9e,0x4f,0x4f,0xd1},{  0xa3,0xdc,0xdc,0x7f}, 
+{ 0x44,0x22,0x22,0x66},{  0x54,0x2a,0x2a,0x7e},{  0x3b,0x90,0x90,0xab},{  0x0b,0x88,0x88,0x83}, 
+{ 0x8c,0x46,0x46,0xca},{  0xc7,0xee,0xee,0x29},{  0x6b,0xb8,0xb8,0xd3},{  0x28,0x14,0x14,0x3c}, 
+{ 0xa7,0xde,0xde,0x79},{  0xbc,0x5e,0x5e,0xe2},{  0x16,0x0b,0x0b,0x1d},{  0xad,0xdb,0xdb,0x76}, 
+{ 0xdb,0xe0,0xe0,0x3b},{  0x64,0x32,0x32,0x56},{  0x74,0x3a,0x3a,0x4e},{  0x14,0x0a,0x0a,0x1e}, 
+{ 0x92,0x49,0x49,0xdb},{  0x0c,0x06,0x06,0x0a},{  0x48,0x24,0x24,0x6c},{  0xb8,0x5c,0x5c,0xe4}, 
+{ 0x9f,0xc2,0xc2,0x5d},{  0xbd,0xd3,0xd3,0x6e},{  0x43,0xac,0xac,0xef},{  0xc4,0x62,0x62,0xa6}, 
+{ 0x39,0x91,0x91,0xa8},{  0x31,0x95,0x95,0xa4},{  0xd3,0xe4,0xe4,0x37},{  0xf2,0x79,0x79,0x8b}, 
+{ 0xd5,0xe7,0xe7,0x32},{  0x8b,0xc8,0xc8,0x43},{  0x6e,0x37,0x37,0x59},{  0xda,0x6d,0x6d,0xb7}, 
+{ 0x01,0x8d,0x8d,0x8c},{  0xb1,0xd5,0xd5,0x64},{  0x9c,0x4e,0x4e,0xd2},{  0x49,0xa9,0xa9,0xe0}, 
+{ 0xd8,0x6c,0x6c,0xb4},{  0xac,0x56,0x56,0xfa},{  0xf3,0xf4,0xf4,0x07},{  0xcf,0xea,0xea,0x25}, 
+{ 0xca,0x65,0x65,0xaf},{  0xf4,0x7a,0x7a,0x8e},{  0x47,0xae,0xae,0xe9},{  0x10,0x08,0x08,0x18}, 
+{ 0x6f,0xba,0xba,0xd5},{  0xf0,0x78,0x78,0x88},{  0x4a,0x25,0x25,0x6f},{  0x5c,0x2e,0x2e,0x72}, 
+{ 0x38,0x1c,0x1c,0x24},{  0x57,0xa6,0xa6,0xf1},{  0x73,0xb4,0xb4,0xc7},{  0x97,0xc6,0xc6,0x51}, 
+{ 0xcb,0xe8,0xe8,0x23},{  0xa1,0xdd,0xdd,0x7c},{  0xe8,0x74,0x74,0x9c},{  0x3e,0x1f,0x1f,0x21}, 
+{ 0x96,0x4b,0x4b,0xdd},{  0x61,0xbd,0xbd,0xdc},{  0x0d,0x8b,0x8b,0x86},{  0x0f,0x8a,0x8a,0x85}, 
+{ 0xe0,0x70,0x70,0x90},{  0x7c,0x3e,0x3e,0x42},{  0x71,0xb5,0xb5,0xc4},{  0xcc,0x66,0x66,0xaa}, 
+{ 0x90,0x48,0x48,0xd8},{  0x06,0x03,0x03,0x05},{  0xf7,0xf6,0xf6,0x01},{  0x1c,0x0e,0x0e,0x12}, 
+{ 0xc2,0x61,0x61,0xa3},{  0x6a,0x35,0x35,0x5f},{  0xae,0x57,0x57,0xf9},{  0x69,0xb9,0xb9,0xd0}, 
+{ 0x17,0x86,0x86,0x91},{  0x99,0xc1,0xc1,0x58},{  0x3a,0x1d,0x1d,0x27},{  0x27,0x9e,0x9e,0xb9}, 
+{ 0xd9,0xe1,0xe1,0x38},{  0xeb,0xf8,0xf8,0x13},{  0x2b,0x98,0x98,0xb3},{  0x22,0x11,0x11,0x33}, 
+{ 0xd2,0x69,0x69,0xbb},{  0xa9,0xd9,0xd9,0x70},{  0x07,0x8e,0x8e,0x89},{  0x33,0x94,0x94,0xa7}, 
+{ 0x2d,0x9b,0x9b,0xb6},{  0x3c,0x1e,0x1e,0x22},{  0x15,0x87,0x87,0x92},{  0xc9,0xe9,0xe9,0x20}, 
+{ 0x87,0xce,0xce,0x49},{  0xaa,0x55,0x55,0xff},{  0x50,0x28,0x28,0x78},{  0xa5,0xdf,0xdf,0x7a}, 
+{ 0x03,0x8c,0x8c,0x8f},{  0x59,0xa1,0xa1,0xf8},{  0x09,0x89,0x89,0x80},{  0x1a,0x0d,0x0d,0x17}, 
+{ 0x65,0xbf,0xbf,0xda},{  0xd7,0xe6,0xe6,0x31},{  0x84,0x42,0x42,0xc6},{  0xd0,0x68,0x68,0xb8}, 
+{ 0x82,0x41,0x41,0xc3},{  0x29,0x99,0x99,0xb0},{  0x5a,0x2d,0x2d,0x77},{  0x1e,0x0f,0x0f,0x11}, 
+{ 0x7b,0xb0,0xb0,0xcb},{  0xa8,0x54,0x54,0xfc},{  0x6d,0xbb,0xbb,0xd6},{  0x2c,0x16,0x16,0x3a } 
+};
+
+word8 T2[256][4] = {
+{ 0xa5,0xc6,0x63,0x63},{  0x84,0xf8,0x7c,0x7c},{  0x99,0xee,0x77,0x77},{  0x8d,0xf6,0x7b,0x7b}, 
+{ 0x0d,0xff,0xf2,0xf2},{  0xbd,0xd6,0x6b,0x6b},{  0xb1,0xde,0x6f,0x6f},{  0x54,0x91,0xc5,0xc5}, 
+{ 0x50,0x60,0x30,0x30},{  0x03,0x02,0x01,0x01},{  0xa9,0xce,0x67,0x67},{  0x7d,0x56,0x2b,0x2b}, 
+{ 0x19,0xe7,0xfe,0xfe},{  0x62,0xb5,0xd7,0xd7},{  0xe6,0x4d,0xab,0xab},{  0x9a,0xec,0x76,0x76}, 
+{ 0x45,0x8f,0xca,0xca},{  0x9d,0x1f,0x82,0x82},{  0x40,0x89,0xc9,0xc9},{  0x87,0xfa,0x7d,0x7d}, 
+{ 0x15,0xef,0xfa,0xfa},{  0xeb,0xb2,0x59,0x59},{  0xc9,0x8e,0x47,0x47},{  0x0b,0xfb,0xf0,0xf0}, 
+{ 0xec,0x41,0xad,0xad},{  0x67,0xb3,0xd4,0xd4},{  0xfd,0x5f,0xa2,0xa2},{  0xea,0x45,0xaf,0xaf}, 
+{ 0xbf,0x23,0x9c,0x9c},{  0xf7,0x53,0xa4,0xa4},{  0x96,0xe4,0x72,0x72},{  0x5b,0x9b,0xc0,0xc0}, 
+{ 0xc2,0x75,0xb7,0xb7},{  0x1c,0xe1,0xfd,0xfd},{  0xae,0x3d,0x93,0x93},{  0x6a,0x4c,0x26,0x26}, 
+{ 0x5a,0x6c,0x36,0x36},{  0x41,0x7e,0x3f,0x3f},{  0x02,0xf5,0xf7,0xf7},{  0x4f,0x83,0xcc,0xcc}, 
+{ 0x5c,0x68,0x34,0x34},{  0xf4,0x51,0xa5,0xa5},{  0x34,0xd1,0xe5,0xe5},{  0x08,0xf9,0xf1,0xf1}, 
+{ 0x93,0xe2,0x71,0x71},{  0x73,0xab,0xd8,0xd8},{  0x53,0x62,0x31,0x31},{  0x3f,0x2a,0x15,0x15}, 
+{ 0x0c,0x08,0x04,0x04},{  0x52,0x95,0xc7,0xc7},{  0x65,0x46,0x23,0x23},{  0x5e,0x9d,0xc3,0xc3}, 
+{ 0x28,0x30,0x18,0x18},{  0xa1,0x37,0x96,0x96},{  0x0f,0x0a,0x05,0x05},{  0xb5,0x2f,0x9a,0x9a}, 
+{ 0x09,0x0e,0x07,0x07},{  0x36,0x24,0x12,0x12},{  0x9b,0x1b,0x80,0x80},{  0x3d,0xdf,0xe2,0xe2}, 
+{ 0x26,0xcd,0xeb,0xeb},{  0x69,0x4e,0x27,0x27},{  0xcd,0x7f,0xb2,0xb2},{  0x9f,0xea,0x75,0x75}, 
+{ 0x1b,0x12,0x09,0x09},{  0x9e,0x1d,0x83,0x83},{  0x74,0x58,0x2c,0x2c},{  0x2e,0x34,0x1a,0x1a}, 
+{ 0x2d,0x36,0x1b,0x1b},{  0xb2,0xdc,0x6e,0x6e},{  0xee,0xb4,0x5a,0x5a},{  0xfb,0x5b,0xa0,0xa0}, 
+{ 0xf6,0xa4,0x52,0x52},{  0x4d,0x76,0x3b,0x3b},{  0x61,0xb7,0xd6,0xd6},{  0xce,0x7d,0xb3,0xb3}, 
+{ 0x7b,0x52,0x29,0x29},{  0x3e,0xdd,0xe3,0xe3},{  0x71,0x5e,0x2f,0x2f},{  0x97,0x13,0x84,0x84}, 
+{ 0xf5,0xa6,0x53,0x53},{  0x68,0xb9,0xd1,0xd1},{  0x00,0x00,0x00,0x00},{  0x2c,0xc1,0xed,0xed}, 
+{ 0x60,0x40,0x20,0x20},{  0x1f,0xe3,0xfc,0xfc},{  0xc8,0x79,0xb1,0xb1},{  0xed,0xb6,0x5b,0x5b}, 
+{ 0xbe,0xd4,0x6a,0x6a},{  0x46,0x8d,0xcb,0xcb},{  0xd9,0x67,0xbe,0xbe},{  0x4b,0x72,0x39,0x39}, 
+{ 0xde,0x94,0x4a,0x4a},{  0xd4,0x98,0x4c,0x4c},{  0xe8,0xb0,0x58,0x58},{  0x4a,0x85,0xcf,0xcf}, 
+{ 0x6b,0xbb,0xd0,0xd0},{  0x2a,0xc5,0xef,0xef},{  0xe5,0x4f,0xaa,0xaa},{  0x16,0xed,0xfb,0xfb}, 
+{ 0xc5,0x86,0x43,0x43},{  0xd7,0x9a,0x4d,0x4d},{  0x55,0x66,0x33,0x33},{  0x94,0x11,0x85,0x85}, 
+{ 0xcf,0x8a,0x45,0x45},{  0x10,0xe9,0xf9,0xf9},{  0x06,0x04,0x02,0x02},{  0x81,0xfe,0x7f,0x7f}, 
+{ 0xf0,0xa0,0x50,0x50},{  0x44,0x78,0x3c,0x3c},{  0xba,0x25,0x9f,0x9f},{  0xe3,0x4b,0xa8,0xa8}, 
+{ 0xf3,0xa2,0x51,0x51},{  0xfe,0x5d,0xa3,0xa3},{  0xc0,0x80,0x40,0x40},{  0x8a,0x05,0x8f,0x8f}, 
+{ 0xad,0x3f,0x92,0x92},{  0xbc,0x21,0x9d,0x9d},{  0x48,0x70,0x38,0x38},{  0x04,0xf1,0xf5,0xf5}, 
+{ 0xdf,0x63,0xbc,0xbc},{  0xc1,0x77,0xb6,0xb6},{  0x75,0xaf,0xda,0xda},{  0x63,0x42,0x21,0x21}, 
+{ 0x30,0x20,0x10,0x10},{  0x1a,0xe5,0xff,0xff},{  0x0e,0xfd,0xf3,0xf3},{  0x6d,0xbf,0xd2,0xd2}, 
+{ 0x4c,0x81,0xcd,0xcd},{  0x14,0x18,0x0c,0x0c},{  0x35,0x26,0x13,0x13},{  0x2f,0xc3,0xec,0xec}, 
+{ 0xe1,0xbe,0x5f,0x5f},{  0xa2,0x35,0x97,0x97},{  0xcc,0x88,0x44,0x44},{  0x39,0x2e,0x17,0x17}, 
+{ 0x57,0x93,0xc4,0xc4},{  0xf2,0x55,0xa7,0xa7},{  0x82,0xfc,0x7e,0x7e},{  0x47,0x7a,0x3d,0x3d}, 
+{ 0xac,0xc8,0x64,0x64},{  0xe7,0xba,0x5d,0x5d},{  0x2b,0x32,0x19,0x19},{  0x95,0xe6,0x73,0x73}, 
+{ 0xa0,0xc0,0x60,0x60},{  0x98,0x19,0x81,0x81},{  0xd1,0x9e,0x4f,0x4f},{  0x7f,0xa3,0xdc,0xdc}, 
+{ 0x66,0x44,0x22,0x22},{  0x7e,0x54,0x2a,0x2a},{  0xab,0x3b,0x90,0x90},{  0x83,0x0b,0x88,0x88}, 
+{ 0xca,0x8c,0x46,0x46},{  0x29,0xc7,0xee,0xee},{  0xd3,0x6b,0xb8,0xb8},{  0x3c,0x28,0x14,0x14}, 
+{ 0x79,0xa7,0xde,0xde},{  0xe2,0xbc,0x5e,0x5e},{  0x1d,0x16,0x0b,0x0b},{  0x76,0xad,0xdb,0xdb}, 
+{ 0x3b,0xdb,0xe0,0xe0},{  0x56,0x64,0x32,0x32},{  0x4e,0x74,0x3a,0x3a},{  0x1e,0x14,0x0a,0x0a}, 
+{ 0xdb,0x92,0x49,0x49},{  0x0a,0x0c,0x06,0x06},{  0x6c,0x48,0x24,0x24},{  0xe4,0xb8,0x5c,0x5c}, 
+{ 0x5d,0x9f,0xc2,0xc2},{  0x6e,0xbd,0xd3,0xd3},{  0xef,0x43,0xac,0xac},{  0xa6,0xc4,0x62,0x62}, 
+{ 0xa8,0x39,0x91,0x91},{  0xa4,0x31,0x95,0x95},{  0x37,0xd3,0xe4,0xe4},{  0x8b,0xf2,0x79,0x79}, 
+{ 0x32,0xd5,0xe7,0xe7},{  0x43,0x8b,0xc8,0xc8},{  0x59,0x6e,0x37,0x37},{  0xb7,0xda,0x6d,0x6d}, 
+{ 0x8c,0x01,0x8d,0x8d},{  0x64,0xb1,0xd5,0xd5},{  0xd2,0x9c,0x4e,0x4e},{  0xe0,0x49,0xa9,0xa9}, 
+{ 0xb4,0xd8,0x6c,0x6c},{  0xfa,0xac,0x56,0x56},{  0x07,0xf3,0xf4,0xf4},{  0x25,0xcf,0xea,0xea}, 
+{ 0xaf,0xca,0x65,0x65},{  0x8e,0xf4,0x7a,0x7a},{  0xe9,0x47,0xae,0xae},{  0x18,0x10,0x08,0x08}, 
+{ 0xd5,0x6f,0xba,0xba},{  0x88,0xf0,0x78,0x78},{  0x6f,0x4a,0x25,0x25},{  0x72,0x5c,0x2e,0x2e}, 
+{ 0x24,0x38,0x1c,0x1c},{  0xf1,0x57,0xa6,0xa6},{  0xc7,0x73,0xb4,0xb4},{  0x51,0x97,0xc6,0xc6}, 
+{ 0x23,0xcb,0xe8,0xe8},{  0x7c,0xa1,0xdd,0xdd},{  0x9c,0xe8,0x74,0x74},{  0x21,0x3e,0x1f,0x1f}, 
+{ 0xdd,0x96,0x4b,0x4b},{  0xdc,0x61,0xbd,0xbd},{  0x86,0x0d,0x8b,0x8b},{  0x85,0x0f,0x8a,0x8a}, 
+{ 0x90,0xe0,0x70,0x70},{  0x42,0x7c,0x3e,0x3e},{  0xc4,0x71,0xb5,0xb5},{  0xaa,0xcc,0x66,0x66}, 
+{ 0xd8,0x90,0x48,0x48},{  0x05,0x06,0x03,0x03},{  0x01,0xf7,0xf6,0xf6},{  0x12,0x1c,0x0e,0x0e}, 
+{ 0xa3,0xc2,0x61,0x61},{  0x5f,0x6a,0x35,0x35},{  0xf9,0xae,0x57,0x57},{  0xd0,0x69,0xb9,0xb9}, 
+{ 0x91,0x17,0x86,0x86},{  0x58,0x99,0xc1,0xc1},{  0x27,0x3a,0x1d,0x1d},{  0xb9,0x27,0x9e,0x9e}, 
+{ 0x38,0xd9,0xe1,0xe1},{  0x13,0xeb,0xf8,0xf8},{  0xb3,0x2b,0x98,0x98},{  0x33,0x22,0x11,0x11}, 
+{ 0xbb,0xd2,0x69,0x69},{  0x70,0xa9,0xd9,0xd9},{  0x89,0x07,0x8e,0x8e},{  0xa7,0x33,0x94,0x94}, 
+{ 0xb6,0x2d,0x9b,0x9b},{  0x22,0x3c,0x1e,0x1e},{  0x92,0x15,0x87,0x87},{  0x20,0xc9,0xe9,0xe9}, 
+{ 0x49,0x87,0xce,0xce},{  0xff,0xaa,0x55,0x55},{  0x78,0x50,0x28,0x28},{  0x7a,0xa5,0xdf,0xdf}, 
+{ 0x8f,0x03,0x8c,0x8c},{  0xf8,0x59,0xa1,0xa1},{  0x80,0x09,0x89,0x89},{  0x17,0x1a,0x0d,0x0d}, 
+{ 0xda,0x65,0xbf,0xbf},{  0x31,0xd7,0xe6,0xe6},{  0xc6,0x84,0x42,0x42},{  0xb8,0xd0,0x68,0x68}, 
+{ 0xc3,0x82,0x41,0x41},{  0xb0,0x29,0x99,0x99},{  0x77,0x5a,0x2d,0x2d},{  0x11,0x1e,0x0f,0x0f}, 
+{ 0xcb,0x7b,0xb0,0xb0},{  0xfc,0xa8,0x54,0x54},{  0xd6,0x6d,0xbb,0xbb},{  0x3a,0x2c,0x16,0x16 } 
+};
+
+word8 T3[256][4] = {
+{ 0x63,0xa5,0xc6,0x63},{  0x7c,0x84,0xf8,0x7c},{  0x77,0x99,0xee,0x77},{  0x7b,0x8d,0xf6,0x7b}, 
+{ 0xf2,0x0d,0xff,0xf2},{  0x6b,0xbd,0xd6,0x6b},{  0x6f,0xb1,0xde,0x6f},{  0xc5,0x54,0x91,0xc5}, 
+{ 0x30,0x50,0x60,0x30},{  0x01,0x03,0x02,0x01},{  0x67,0xa9,0xce,0x67},{  0x2b,0x7d,0x56,0x2b}, 
+{ 0xfe,0x19,0xe7,0xfe},{  0xd7,0x62,0xb5,0xd7},{  0xab,0xe6,0x4d,0xab},{  0x76,0x9a,0xec,0x76}, 
+{ 0xca,0x45,0x8f,0xca},{  0x82,0x9d,0x1f,0x82},{  0xc9,0x40,0x89,0xc9},{  0x7d,0x87,0xfa,0x7d}, 
+{ 0xfa,0x15,0xef,0xfa},{  0x59,0xeb,0xb2,0x59},{  0x47,0xc9,0x8e,0x47},{  0xf0,0x0b,0xfb,0xf0}, 
+{ 0xad,0xec,0x41,0xad},{  0xd4,0x67,0xb3,0xd4},{  0xa2,0xfd,0x5f,0xa2},{  0xaf,0xea,0x45,0xaf}, 
+{ 0x9c,0xbf,0x23,0x9c},{  0xa4,0xf7,0x53,0xa4},{  0x72,0x96,0xe4,0x72},{  0xc0,0x5b,0x9b,0xc0}, 
+{ 0xb7,0xc2,0x75,0xb7},{  0xfd,0x1c,0xe1,0xfd},{  0x93,0xae,0x3d,0x93},{  0x26,0x6a,0x4c,0x26}, 
+{ 0x36,0x5a,0x6c,0x36},{  0x3f,0x41,0x7e,0x3f},{  0xf7,0x02,0xf5,0xf7},{  0xcc,0x4f,0x83,0xcc}, 
+{ 0x34,0x5c,0x68,0x34},{  0xa5,0xf4,0x51,0xa5},{  0xe5,0x34,0xd1,0xe5},{  0xf1,0x08,0xf9,0xf1}, 
+{ 0x71,0x93,0xe2,0x71},{  0xd8,0x73,0xab,0xd8},{  0x31,0x53,0x62,0x31},{  0x15,0x3f,0x2a,0x15}, 
+{ 0x04,0x0c,0x08,0x04},{  0xc7,0x52,0x95,0xc7},{  0x23,0x65,0x46,0x23},{  0xc3,0x5e,0x9d,0xc3}, 
+{ 0x18,0x28,0x30,0x18},{  0x96,0xa1,0x37,0x96},{  0x05,0x0f,0x0a,0x05},{  0x9a,0xb5,0x2f,0x9a}, 
+{ 0x07,0x09,0x0e,0x07},{  0x12,0x36,0x24,0x12},{  0x80,0x9b,0x1b,0x80},{  0xe2,0x3d,0xdf,0xe2}, 
+{ 0xeb,0x26,0xcd,0xeb},{  0x27,0x69,0x4e,0x27},{  0xb2,0xcd,0x7f,0xb2},{  0x75,0x9f,0xea,0x75}, 
+{ 0x09,0x1b,0x12,0x09},{  0x83,0x9e,0x1d,0x83},{  0x2c,0x74,0x58,0x2c},{  0x1a,0x2e,0x34,0x1a}, 
+{ 0x1b,0x2d,0x36,0x1b},{  0x6e,0xb2,0xdc,0x6e},{  0x5a,0xee,0xb4,0x5a},{  0xa0,0xfb,0x5b,0xa0}, 
+{ 0x52,0xf6,0xa4,0x52},{  0x3b,0x4d,0x76,0x3b},{  0xd6,0x61,0xb7,0xd6},{  0xb3,0xce,0x7d,0xb3}, 
+{ 0x29,0x7b,0x52,0x29},{  0xe3,0x3e,0xdd,0xe3},{  0x2f,0x71,0x5e,0x2f},{  0x84,0x97,0x13,0x84}, 
+{ 0x53,0xf5,0xa6,0x53},{  0xd1,0x68,0xb9,0xd1},{  0x00,0x00,0x00,0x00},{  0xed,0x2c,0xc1,0xed}, 
+{ 0x20,0x60,0x40,0x20},{  0xfc,0x1f,0xe3,0xfc},{  0xb1,0xc8,0x79,0xb1},{  0x5b,0xed,0xb6,0x5b}, 
+{ 0x6a,0xbe,0xd4,0x6a},{  0xcb,0x46,0x8d,0xcb},{  0xbe,0xd9,0x67,0xbe},{  0x39,0x4b,0x72,0x39}, 
+{ 0x4a,0xde,0x94,0x4a},{  0x4c,0xd4,0x98,0x4c},{  0x58,0xe8,0xb0,0x58},{  0xcf,0x4a,0x85,0xcf}, 
+{ 0xd0,0x6b,0xbb,0xd0},{  0xef,0x2a,0xc5,0xef},{  0xaa,0xe5,0x4f,0xaa},{  0xfb,0x16,0xed,0xfb}, 
+{ 0x43,0xc5,0x86,0x43},{  0x4d,0xd7,0x9a,0x4d},{  0x33,0x55,0x66,0x33},{  0x85,0x94,0x11,0x85}, 
+{ 0x45,0xcf,0x8a,0x45},{  0xf9,0x10,0xe9,0xf9},{  0x02,0x06,0x04,0x02},{  0x7f,0x81,0xfe,0x7f}, 
+{ 0x50,0xf0,0xa0,0x50},{  0x3c,0x44,0x78,0x3c},{  0x9f,0xba,0x25,0x9f},{  0xa8,0xe3,0x4b,0xa8}, 
+{ 0x51,0xf3,0xa2,0x51},{  0xa3,0xfe,0x5d,0xa3},{  0x40,0xc0,0x80,0x40},{  0x8f,0x8a,0x05,0x8f}, 
+{ 0x92,0xad,0x3f,0x92},{  0x9d,0xbc,0x21,0x9d},{  0x38,0x48,0x70,0x38},{  0xf5,0x04,0xf1,0xf5}, 
+{ 0xbc,0xdf,0x63,0xbc},{  0xb6,0xc1,0x77,0xb6},{  0xda,0x75,0xaf,0xda},{  0x21,0x63,0x42,0x21}, 
+{ 0x10,0x30,0x20,0x10},{  0xff,0x1a,0xe5,0xff},{  0xf3,0x0e,0xfd,0xf3},{  0xd2,0x6d,0xbf,0xd2}, 
+{ 0xcd,0x4c,0x81,0xcd},{  0x0c,0x14,0x18,0x0c},{  0x13,0x35,0x26,0x13},{  0xec,0x2f,0xc3,0xec}, 
+{ 0x5f,0xe1,0xbe,0x5f},{  0x97,0xa2,0x35,0x97},{  0x44,0xcc,0x88,0x44},{  0x17,0x39,0x2e,0x17}, 
+{ 0xc4,0x57,0x93,0xc4},{  0xa7,0xf2,0x55,0xa7},{  0x7e,0x82,0xfc,0x7e},{  0x3d,0x47,0x7a,0x3d}, 
+{ 0x64,0xac,0xc8,0x64},{  0x5d,0xe7,0xba,0x5d},{  0x19,0x2b,0x32,0x19},{  0x73,0x95,0xe6,0x73}, 
+{ 0x60,0xa0,0xc0,0x60},{  0x81,0x98,0x19,0x81},{  0x4f,0xd1,0x9e,0x4f},{  0xdc,0x7f,0xa3,0xdc}, 
+{ 0x22,0x66,0x44,0x22},{  0x2a,0x7e,0x54,0x2a},{  0x90,0xab,0x3b,0x90},{  0x88,0x83,0x0b,0x88}, 
+{ 0x46,0xca,0x8c,0x46},{  0xee,0x29,0xc7,0xee},{  0xb8,0xd3,0x6b,0xb8},{  0x14,0x3c,0x28,0x14}, 
+{ 0xde,0x79,0xa7,0xde},{  0x5e,0xe2,0xbc,0x5e},{  0x0b,0x1d,0x16,0x0b},{  0xdb,0x76,0xad,0xdb}, 
+{ 0xe0,0x3b,0xdb,0xe0},{  0x32,0x56,0x64,0x32},{  0x3a,0x4e,0x74,0x3a},{  0x0a,0x1e,0x14,0x0a}, 
+{ 0x49,0xdb,0x92,0x49},{  0x06,0x0a,0x0c,0x06},{  0x24,0x6c,0x48,0x24},{  0x5c,0xe4,0xb8,0x5c}, 
+{ 0xc2,0x5d,0x9f,0xc2},{  0xd3,0x6e,0xbd,0xd3},{  0xac,0xef,0x43,0xac},{  0x62,0xa6,0xc4,0x62}, 
+{ 0x91,0xa8,0x39,0x91},{  0x95,0xa4,0x31,0x95},{  0xe4,0x37,0xd3,0xe4},{  0x79,0x8b,0xf2,0x79}, 
+{ 0xe7,0x32,0xd5,0xe7},{  0xc8,0x43,0x8b,0xc8},{  0x37,0x59,0x6e,0x37},{  0x6d,0xb7,0xda,0x6d}, 
+{ 0x8d,0x8c,0x01,0x8d},{  0xd5,0x64,0xb1,0xd5},{  0x4e,0xd2,0x9c,0x4e},{  0xa9,0xe0,0x49,0xa9}, 
+{ 0x6c,0xb4,0xd8,0x6c},{  0x56,0xfa,0xac,0x56},{  0xf4,0x07,0xf3,0xf4},{  0xea,0x25,0xcf,0xea}, 
+{ 0x65,0xaf,0xca,0x65},{  0x7a,0x8e,0xf4,0x7a},{  0xae,0xe9,0x47,0xae},{  0x08,0x18,0x10,0x08}, 
+{ 0xba,0xd5,0x6f,0xba},{  0x78,0x88,0xf0,0x78},{  0x25,0x6f,0x4a,0x25},{  0x2e,0x72,0x5c,0x2e}, 
+{ 0x1c,0x24,0x38,0x1c},{  0xa6,0xf1,0x57,0xa6},{  0xb4,0xc7,0x73,0xb4},{  0xc6,0x51,0x97,0xc6}, 
+{ 0xe8,0x23,0xcb,0xe8},{  0xdd,0x7c,0xa1,0xdd},{  0x74,0x9c,0xe8,0x74},{  0x1f,0x21,0x3e,0x1f}, 
+{ 0x4b,0xdd,0x96,0x4b},{  0xbd,0xdc,0x61,0xbd},{  0x8b,0x86,0x0d,0x8b},{  0x8a,0x85,0x0f,0x8a}, 
+{ 0x70,0x90,0xe0,0x70},{  0x3e,0x42,0x7c,0x3e},{  0xb5,0xc4,0x71,0xb5},{  0x66,0xaa,0xcc,0x66}, 
+{ 0x48,0xd8,0x90,0x48},{  0x03,0x05,0x06,0x03},{  0xf6,0x01,0xf7,0xf6},{  0x0e,0x12,0x1c,0x0e}, 
+{ 0x61,0xa3,0xc2,0x61},{  0x35,0x5f,0x6a,0x35},{  0x57,0xf9,0xae,0x57},{  0xb9,0xd0,0x69,0xb9}, 
+{ 0x86,0x91,0x17,0x86},{  0xc1,0x58,0x99,0xc1},{  0x1d,0x27,0x3a,0x1d},{  0x9e,0xb9,0x27,0x9e}, 
+{ 0xe1,0x38,0xd9,0xe1},{  0xf8,0x13,0xeb,0xf8},{  0x98,0xb3,0x2b,0x98},{  0x11,0x33,0x22,0x11}, 
+{ 0x69,0xbb,0xd2,0x69},{  0xd9,0x70,0xa9,0xd9},{  0x8e,0x89,0x07,0x8e},{  0x94,0xa7,0x33,0x94}, 
+{ 0x9b,0xb6,0x2d,0x9b},{  0x1e,0x22,0x3c,0x1e},{  0x87,0x92,0x15,0x87},{  0xe9,0x20,0xc9,0xe9}, 
+{ 0xce,0x49,0x87,0xce},{  0x55,0xff,0xaa,0x55},{  0x28,0x78,0x50,0x28},{  0xdf,0x7a,0xa5,0xdf}, 
+{ 0x8c,0x8f,0x03,0x8c},{  0xa1,0xf8,0x59,0xa1},{  0x89,0x80,0x09,0x89},{  0x0d,0x17,0x1a,0x0d}, 
+{ 0xbf,0xda,0x65,0xbf},{  0xe6,0x31,0xd7,0xe6},{  0x42,0xc6,0x84,0x42},{  0x68,0xb8,0xd0,0x68}, 
+{ 0x41,0xc3,0x82,0x41},{  0x99,0xb0,0x29,0x99},{  0x2d,0x77,0x5a,0x2d},{  0x0f,0x11,0x1e,0x0f}, 
+{ 0xb0,0xcb,0x7b,0xb0},{  0x54,0xfc,0xa8,0x54},{  0xbb,0xd6,0x6d,0xbb},{  0x16,0x3a,0x2c,0x16 } 
+};
+
+word8 T4[256][4] = {
+{ 0x63,0x63,0xa5,0xc6},{  0x7c,0x7c,0x84,0xf8},{  0x77,0x77,0x99,0xee},{  0x7b,0x7b,0x8d,0xf6}, 
+{ 0xf2,0xf2,0x0d,0xff},{  0x6b,0x6b,0xbd,0xd6},{  0x6f,0x6f,0xb1,0xde},{  0xc5,0xc5,0x54,0x91}, 
+{ 0x30,0x30,0x50,0x60},{  0x01,0x01,0x03,0x02},{  0x67,0x67,0xa9,0xce},{  0x2b,0x2b,0x7d,0x56}, 
+{ 0xfe,0xfe,0x19,0xe7},{  0xd7,0xd7,0x62,0xb5},{  0xab,0xab,0xe6,0x4d},{  0x76,0x76,0x9a,0xec}, 
+{ 0xca,0xca,0x45,0x8f},{  0x82,0x82,0x9d,0x1f},{  0xc9,0xc9,0x40,0x89},{  0x7d,0x7d,0x87,0xfa}, 
+{ 0xfa,0xfa,0x15,0xef},{  0x59,0x59,0xeb,0xb2},{  0x47,0x47,0xc9,0x8e},{  0xf0,0xf0,0x0b,0xfb}, 
+{ 0xad,0xad,0xec,0x41},{  0xd4,0xd4,0x67,0xb3},{  0xa2,0xa2,0xfd,0x5f},{  0xaf,0xaf,0xea,0x45}, 
+{ 0x9c,0x9c,0xbf,0x23},{  0xa4,0xa4,0xf7,0x53},{  0x72,0x72,0x96,0xe4},{  0xc0,0xc0,0x5b,0x9b}, 
+{ 0xb7,0xb7,0xc2,0x75},{  0xfd,0xfd,0x1c,0xe1},{  0x93,0x93,0xae,0x3d},{  0x26,0x26,0x6a,0x4c}, 
+{ 0x36,0x36,0x5a,0x6c},{  0x3f,0x3f,0x41,0x7e},{  0xf7,0xf7,0x02,0xf5},{  0xcc,0xcc,0x4f,0x83}, 
+{ 0x34,0x34,0x5c,0x68},{  0xa5,0xa5,0xf4,0x51},{  0xe5,0xe5,0x34,0xd1},{  0xf1,0xf1,0x08,0xf9}, 
+{ 0x71,0x71,0x93,0xe2},{  0xd8,0xd8,0x73,0xab},{  0x31,0x31,0x53,0x62},{  0x15,0x15,0x3f,0x2a}, 
+{ 0x04,0x04,0x0c,0x08},{  0xc7,0xc7,0x52,0x95},{  0x23,0x23,0x65,0x46},{  0xc3,0xc3,0x5e,0x9d}, 
+{ 0x18,0x18,0x28,0x30},{  0x96,0x96,0xa1,0x37},{  0x05,0x05,0x0f,0x0a},{  0x9a,0x9a,0xb5,0x2f}, 
+{ 0x07,0x07,0x09,0x0e},{  0x12,0x12,0x36,0x24},{  0x80,0x80,0x9b,0x1b},{  0xe2,0xe2,0x3d,0xdf}, 
+{ 0xeb,0xeb,0x26,0xcd},{  0x27,0x27,0x69,0x4e},{  0xb2,0xb2,0xcd,0x7f},{  0x75,0x75,0x9f,0xea}, 
+{ 0x09,0x09,0x1b,0x12},{  0x83,0x83,0x9e,0x1d},{  0x2c,0x2c,0x74,0x58},{  0x1a,0x1a,0x2e,0x34}, 
+{ 0x1b,0x1b,0x2d,0x36},{  0x6e,0x6e,0xb2,0xdc},{  0x5a,0x5a,0xee,0xb4},{  0xa0,0xa0,0xfb,0x5b}, 
+{ 0x52,0x52,0xf6,0xa4},{  0x3b,0x3b,0x4d,0x76},{  0xd6,0xd6,0x61,0xb7},{  0xb3,0xb3,0xce,0x7d}, 
+{ 0x29,0x29,0x7b,0x52},{  0xe3,0xe3,0x3e,0xdd},{  0x2f,0x2f,0x71,0x5e},{  0x84,0x84,0x97,0x13}, 
+{ 0x53,0x53,0xf5,0xa6},{  0xd1,0xd1,0x68,0xb9},{  0x00,0x00,0x00,0x00},{  0xed,0xed,0x2c,0xc1}, 
+{ 0x20,0x20,0x60,0x40},{  0xfc,0xfc,0x1f,0xe3},{  0xb1,0xb1,0xc8,0x79},{  0x5b,0x5b,0xed,0xb6}, 
+{ 0x6a,0x6a,0xbe,0xd4},{  0xcb,0xcb,0x46,0x8d},{  0xbe,0xbe,0xd9,0x67},{  0x39,0x39,0x4b,0x72}, 
+{ 0x4a,0x4a,0xde,0x94},{  0x4c,0x4c,0xd4,0x98},{  0x58,0x58,0xe8,0xb0},{  0xcf,0xcf,0x4a,0x85}, 
+{ 0xd0,0xd0,0x6b,0xbb},{  0xef,0xef,0x2a,0xc5},{  0xaa,0xaa,0xe5,0x4f},{  0xfb,0xfb,0x16,0xed}, 
+{ 0x43,0x43,0xc5,0x86},{  0x4d,0x4d,0xd7,0x9a},{  0x33,0x33,0x55,0x66},{  0x85,0x85,0x94,0x11}, 
+{ 0x45,0x45,0xcf,0x8a},{  0xf9,0xf9,0x10,0xe9},{  0x02,0x02,0x06,0x04},{  0x7f,0x7f,0x81,0xfe}, 
+{ 0x50,0x50,0xf0,0xa0},{  0x3c,0x3c,0x44,0x78},{  0x9f,0x9f,0xba,0x25},{  0xa8,0xa8,0xe3,0x4b}, 
+{ 0x51,0x51,0xf3,0xa2},{  0xa3,0xa3,0xfe,0x5d},{  0x40,0x40,0xc0,0x80},{  0x8f,0x8f,0x8a,0x05}, 
+{ 0x92,0x92,0xad,0x3f},{  0x9d,0x9d,0xbc,0x21},{  0x38,0x38,0x48,0x70},{  0xf5,0xf5,0x04,0xf1}, 
+{ 0xbc,0xbc,0xdf,0x63},{  0xb6,0xb6,0xc1,0x77},{  0xda,0xda,0x75,0xaf},{  0x21,0x21,0x63,0x42}, 
+{ 0x10,0x10,0x30,0x20},{  0xff,0xff,0x1a,0xe5},{  0xf3,0xf3,0x0e,0xfd},{  0xd2,0xd2,0x6d,0xbf}, 
+{ 0xcd,0xcd,0x4c,0x81},{  0x0c,0x0c,0x14,0x18},{  0x13,0x13,0x35,0x26},{  0xec,0xec,0x2f,0xc3}, 
+{ 0x5f,0x5f,0xe1,0xbe},{  0x97,0x97,0xa2,0x35},{  0x44,0x44,0xcc,0x88},{  0x17,0x17,0x39,0x2e}, 
+{ 0xc4,0xc4,0x57,0x93},{  0xa7,0xa7,0xf2,0x55},{  0x7e,0x7e,0x82,0xfc},{  0x3d,0x3d,0x47,0x7a}, 
+{ 0x64,0x64,0xac,0xc8},{  0x5d,0x5d,0xe7,0xba},{  0x19,0x19,0x2b,0x32},{  0x73,0x73,0x95,0xe6}, 
+{ 0x60,0x60,0xa0,0xc0},{  0x81,0x81,0x98,0x19},{  0x4f,0x4f,0xd1,0x9e},{  0xdc,0xdc,0x7f,0xa3}, 
+{ 0x22,0x22,0x66,0x44},{  0x2a,0x2a,0x7e,0x54},{  0x90,0x90,0xab,0x3b},{  0x88,0x88,0x83,0x0b}, 
+{ 0x46,0x46,0xca,0x8c},{  0xee,0xee,0x29,0xc7},{  0xb8,0xb8,0xd3,0x6b},{  0x14,0x14,0x3c,0x28}, 
+{ 0xde,0xde,0x79,0xa7},{  0x5e,0x5e,0xe2,0xbc},{  0x0b,0x0b,0x1d,0x16},{  0xdb,0xdb,0x76,0xad}, 
+{ 0xe0,0xe0,0x3b,0xdb},{  0x32,0x32,0x56,0x64},{  0x3a,0x3a,0x4e,0x74},{  0x0a,0x0a,0x1e,0x14}, 
+{ 0x49,0x49,0xdb,0x92},{  0x06,0x06,0x0a,0x0c},{  0x24,0x24,0x6c,0x48},{  0x5c,0x5c,0xe4,0xb8}, 
+{ 0xc2,0xc2,0x5d,0x9f},{  0xd3,0xd3,0x6e,0xbd},{  0xac,0xac,0xef,0x43},{  0x62,0x62,0xa6,0xc4}, 
+{ 0x91,0x91,0xa8,0x39},{  0x95,0x95,0xa4,0x31},{  0xe4,0xe4,0x37,0xd3},{  0x79,0x79,0x8b,0xf2}, 
+{ 0xe7,0xe7,0x32,0xd5},{  0xc8,0xc8,0x43,0x8b},{  0x37,0x37,0x59,0x6e},{  0x6d,0x6d,0xb7,0xda}, 
+{ 0x8d,0x8d,0x8c,0x01},{  0xd5,0xd5,0x64,0xb1},{  0x4e,0x4e,0xd2,0x9c},{  0xa9,0xa9,0xe0,0x49}, 
+{ 0x6c,0x6c,0xb4,0xd8},{  0x56,0x56,0xfa,0xac},{  0xf4,0xf4,0x07,0xf3},{  0xea,0xea,0x25,0xcf}, 
+{ 0x65,0x65,0xaf,0xca},{  0x7a,0x7a,0x8e,0xf4},{  0xae,0xae,0xe9,0x47},{  0x08,0x08,0x18,0x10}, 
+{ 0xba,0xba,0xd5,0x6f},{  0x78,0x78,0x88,0xf0},{  0x25,0x25,0x6f,0x4a},{  0x2e,0x2e,0x72,0x5c}, 
+{ 0x1c,0x1c,0x24,0x38},{  0xa6,0xa6,0xf1,0x57},{  0xb4,0xb4,0xc7,0x73},{  0xc6,0xc6,0x51,0x97}, 
+{ 0xe8,0xe8,0x23,0xcb},{  0xdd,0xdd,0x7c,0xa1},{  0x74,0x74,0x9c,0xe8},{  0x1f,0x1f,0x21,0x3e}, 
+{ 0x4b,0x4b,0xdd,0x96},{  0xbd,0xbd,0xdc,0x61},{  0x8b,0x8b,0x86,0x0d},{  0x8a,0x8a,0x85,0x0f}, 
+{ 0x70,0x70,0x90,0xe0},{  0x3e,0x3e,0x42,0x7c},{  0xb5,0xb5,0xc4,0x71},{  0x66,0x66,0xaa,0xcc}, 
+{ 0x48,0x48,0xd8,0x90},{  0x03,0x03,0x05,0x06},{  0xf6,0xf6,0x01,0xf7},{  0x0e,0x0e,0x12,0x1c}, 
+{ 0x61,0x61,0xa3,0xc2},{  0x35,0x35,0x5f,0x6a},{  0x57,0x57,0xf9,0xae},{  0xb9,0xb9,0xd0,0x69}, 
+{ 0x86,0x86,0x91,0x17},{  0xc1,0xc1,0x58,0x99},{  0x1d,0x1d,0x27,0x3a},{  0x9e,0x9e,0xb9,0x27}, 
+{ 0xe1,0xe1,0x38,0xd9},{  0xf8,0xf8,0x13,0xeb},{  0x98,0x98,0xb3,0x2b},{  0x11,0x11,0x33,0x22}, 
+{ 0x69,0x69,0xbb,0xd2},{  0xd9,0xd9,0x70,0xa9},{  0x8e,0x8e,0x89,0x07},{  0x94,0x94,0xa7,0x33}, 
+{ 0x9b,0x9b,0xb6,0x2d},{  0x1e,0x1e,0x22,0x3c},{  0x87,0x87,0x92,0x15},{  0xe9,0xe9,0x20,0xc9}, 
+{ 0xce,0xce,0x49,0x87},{  0x55,0x55,0xff,0xaa},{  0x28,0x28,0x78,0x50},{  0xdf,0xdf,0x7a,0xa5}, 
+{ 0x8c,0x8c,0x8f,0x03},{  0xa1,0xa1,0xf8,0x59},{  0x89,0x89,0x80,0x09},{  0x0d,0x0d,0x17,0x1a}, 
+{ 0xbf,0xbf,0xda,0x65},{  0xe6,0xe6,0x31,0xd7},{  0x42,0x42,0xc6,0x84},{  0x68,0x68,0xb8,0xd0}, 
+{ 0x41,0x41,0xc3,0x82},{  0x99,0x99,0xb0,0x29},{  0x2d,0x2d,0x77,0x5a},{  0x0f,0x0f,0x11,0x1e}, 
+{ 0xb0,0xb0,0xcb,0x7b},{  0x54,0x54,0xfc,0xa8},{  0xbb,0xbb,0xd6,0x6d},{  0x16,0x16,0x3a,0x2c } 
+};
+
+word8 T5[256][4] = {
+{ 0x51,0xf4,0xa7,0x50},{  0x7e,0x41,0x65,0x53},{  0x1a,0x17,0xa4,0xc3},{  0x3a,0x27,0x5e,0x96}, 
+{ 0x3b,0xab,0x6b,0xcb},{  0x1f,0x9d,0x45,0xf1},{  0xac,0xfa,0x58,0xab},{  0x4b,0xe3,0x03,0x93}, 
+{ 0x20,0x30,0xfa,0x55},{  0xad,0x76,0x6d,0xf6},{  0x88,0xcc,0x76,0x91},{  0xf5,0x02,0x4c,0x25}, 
+{ 0x4f,0xe5,0xd7,0xfc},{  0xc5,0x2a,0xcb,0xd7},{  0x26,0x35,0x44,0x80},{  0xb5,0x62,0xa3,0x8f}, 
+{ 0xde,0xb1,0x5a,0x49},{  0x25,0xba,0x1b,0x67},{  0x45,0xea,0x0e,0x98},{  0x5d,0xfe,0xc0,0xe1}, 
+{ 0xc3,0x2f,0x75,0x02},{  0x81,0x4c,0xf0,0x12},{  0x8d,0x46,0x97,0xa3},{  0x6b,0xd3,0xf9,0xc6}, 
+{ 0x03,0x8f,0x5f,0xe7},{  0x15,0x92,0x9c,0x95},{  0xbf,0x6d,0x7a,0xeb},{  0x95,0x52,0x59,0xda}, 
+{ 0xd4,0xbe,0x83,0x2d},{  0x58,0x74,0x21,0xd3},{  0x49,0xe0,0x69,0x29},{  0x8e,0xc9,0xc8,0x44}, 
+{ 0x75,0xc2,0x89,0x6a},{  0xf4,0x8e,0x79,0x78},{  0x99,0x58,0x3e,0x6b},{  0x27,0xb9,0x71,0xdd}, 
+{ 0xbe,0xe1,0x4f,0xb6},{  0xf0,0x88,0xad,0x17},{  0xc9,0x20,0xac,0x66},{  0x7d,0xce,0x3a,0xb4}, 
+{ 0x63,0xdf,0x4a,0x18},{  0xe5,0x1a,0x31,0x82},{  0x97,0x51,0x33,0x60},{  0x62,0x53,0x7f,0x45}, 
+{ 0xb1,0x64,0x77,0xe0},{  0xbb,0x6b,0xae,0x84},{  0xfe,0x81,0xa0,0x1c},{  0xf9,0x08,0x2b,0x94}, 
+{ 0x70,0x48,0x68,0x58},{  0x8f,0x45,0xfd,0x19},{  0x94,0xde,0x6c,0x87},{  0x52,0x7b,0xf8,0xb7}, 
+{ 0xab,0x73,0xd3,0x23},{  0x72,0x4b,0x02,0xe2},{  0xe3,0x1f,0x8f,0x57},{  0x66,0x55,0xab,0x2a}, 
+{ 0xb2,0xeb,0x28,0x07},{  0x2f,0xb5,0xc2,0x03},{  0x86,0xc5,0x7b,0x9a},{  0xd3,0x37,0x08,0xa5}, 
+{ 0x30,0x28,0x87,0xf2},{  0x23,0xbf,0xa5,0xb2},{  0x02,0x03,0x6a,0xba},{  0xed,0x16,0x82,0x5c}, 
+{ 0x8a,0xcf,0x1c,0x2b},{  0xa7,0x79,0xb4,0x92},{  0xf3,0x07,0xf2,0xf0},{  0x4e,0x69,0xe2,0xa1}, 
+{ 0x65,0xda,0xf4,0xcd},{  0x06,0x05,0xbe,0xd5},{  0xd1,0x34,0x62,0x1f},{  0xc4,0xa6,0xfe,0x8a}, 
+{ 0x34,0x2e,0x53,0x9d},{  0xa2,0xf3,0x55,0xa0},{  0x05,0x8a,0xe1,0x32},{  0xa4,0xf6,0xeb,0x75}, 
+{ 0x0b,0x83,0xec,0x39},{  0x40,0x60,0xef,0xaa},{  0x5e,0x71,0x9f,0x06},{  0xbd,0x6e,0x10,0x51}, 
+{ 0x3e,0x21,0x8a,0xf9},{  0x96,0xdd,0x06,0x3d},{  0xdd,0x3e,0x05,0xae},{  0x4d,0xe6,0xbd,0x46}, 
+{ 0x91,0x54,0x8d,0xb5},{  0x71,0xc4,0x5d,0x05},{  0x04,0x06,0xd4,0x6f},{  0x60,0x50,0x15,0xff}, 
+{ 0x19,0x98,0xfb,0x24},{  0xd6,0xbd,0xe9,0x97},{  0x89,0x40,0x43,0xcc},{  0x67,0xd9,0x9e,0x77}, 
+{ 0xb0,0xe8,0x42,0xbd},{  0x07,0x89,0x8b,0x88},{  0xe7,0x19,0x5b,0x38},{  0x79,0xc8,0xee,0xdb}, 
+{ 0xa1,0x7c,0x0a,0x47},{  0x7c,0x42,0x0f,0xe9},{  0xf8,0x84,0x1e,0xc9},{  0x00,0x00,0x00,0x00}, 
+{ 0x09,0x80,0x86,0x83},{  0x32,0x2b,0xed,0x48},{  0x1e,0x11,0x70,0xac},{  0x6c,0x5a,0x72,0x4e}, 
+{ 0xfd,0x0e,0xff,0xfb},{  0x0f,0x85,0x38,0x56},{  0x3d,0xae,0xd5,0x1e},{  0x36,0x2d,0x39,0x27}, 
+{ 0x0a,0x0f,0xd9,0x64},{  0x68,0x5c,0xa6,0x21},{  0x9b,0x5b,0x54,0xd1},{  0x24,0x36,0x2e,0x3a}, 
+{ 0x0c,0x0a,0x67,0xb1},{  0x93,0x57,0xe7,0x0f},{  0xb4,0xee,0x96,0xd2},{  0x1b,0x9b,0x91,0x9e}, 
+{ 0x80,0xc0,0xc5,0x4f},{  0x61,0xdc,0x20,0xa2},{  0x5a,0x77,0x4b,0x69},{  0x1c,0x12,0x1a,0x16}, 
+{ 0xe2,0x93,0xba,0x0a},{  0xc0,0xa0,0x2a,0xe5},{  0x3c,0x22,0xe0,0x43},{  0x12,0x1b,0x17,0x1d}, 
+{ 0x0e,0x09,0x0d,0x0b},{  0xf2,0x8b,0xc7,0xad},{  0x2d,0xb6,0xa8,0xb9},{  0x14,0x1e,0xa9,0xc8}, 
+{ 0x57,0xf1,0x19,0x85},{  0xaf,0x75,0x07,0x4c},{  0xee,0x99,0xdd,0xbb},{  0xa3,0x7f,0x60,0xfd}, 
+{ 0xf7,0x01,0x26,0x9f},{  0x5c,0x72,0xf5,0xbc},{  0x44,0x66,0x3b,0xc5},{  0x5b,0xfb,0x7e,0x34}, 
+{ 0x8b,0x43,0x29,0x76},{  0xcb,0x23,0xc6,0xdc},{  0xb6,0xed,0xfc,0x68},{  0xb8,0xe4,0xf1,0x63}, 
+{ 0xd7,0x31,0xdc,0xca},{  0x42,0x63,0x85,0x10},{  0x13,0x97,0x22,0x40},{  0x84,0xc6,0x11,0x20}, 
+{ 0x85,0x4a,0x24,0x7d},{  0xd2,0xbb,0x3d,0xf8},{  0xae,0xf9,0x32,0x11},{  0xc7,0x29,0xa1,0x6d}, 
+{ 0x1d,0x9e,0x2f,0x4b},{  0xdc,0xb2,0x30,0xf3},{  0x0d,0x86,0x52,0xec},{  0x77,0xc1,0xe3,0xd0}, 
+{ 0x2b,0xb3,0x16,0x6c},{  0xa9,0x70,0xb9,0x99},{  0x11,0x94,0x48,0xfa},{  0x47,0xe9,0x64,0x22}, 
+{ 0xa8,0xfc,0x8c,0xc4},{  0xa0,0xf0,0x3f,0x1a},{  0x56,0x7d,0x2c,0xd8},{  0x22,0x33,0x90,0xef}, 
+{ 0x87,0x49,0x4e,0xc7},{  0xd9,0x38,0xd1,0xc1},{  0x8c,0xca,0xa2,0xfe},{  0x98,0xd4,0x0b,0x36}, 
+{ 0xa6,0xf5,0x81,0xcf},{  0xa5,0x7a,0xde,0x28},{  0xda,0xb7,0x8e,0x26},{  0x3f,0xad,0xbf,0xa4}, 
+{ 0x2c,0x3a,0x9d,0xe4},{  0x50,0x78,0x92,0x0d},{  0x6a,0x5f,0xcc,0x9b},{  0x54,0x7e,0x46,0x62}, 
+{ 0xf6,0x8d,0x13,0xc2},{  0x90,0xd8,0xb8,0xe8},{  0x2e,0x39,0xf7,0x5e},{  0x82,0xc3,0xaf,0xf5}, 
+{ 0x9f,0x5d,0x80,0xbe},{  0x69,0xd0,0x93,0x7c},{  0x6f,0xd5,0x2d,0xa9},{  0xcf,0x25,0x12,0xb3}, 
+{ 0xc8,0xac,0x99,0x3b},{  0x10,0x18,0x7d,0xa7},{  0xe8,0x9c,0x63,0x6e},{  0xdb,0x3b,0xbb,0x7b}, 
+{ 0xcd,0x26,0x78,0x09},{  0x6e,0x59,0x18,0xf4},{  0xec,0x9a,0xb7,0x01},{  0x83,0x4f,0x9a,0xa8}, 
+{ 0xe6,0x95,0x6e,0x65},{  0xaa,0xff,0xe6,0x7e},{  0x21,0xbc,0xcf,0x08},{  0xef,0x15,0xe8,0xe6}, 
+{ 0xba,0xe7,0x9b,0xd9},{  0x4a,0x6f,0x36,0xce},{  0xea,0x9f,0x09,0xd4},{  0x29,0xb0,0x7c,0xd6}, 
+{ 0x31,0xa4,0xb2,0xaf},{  0x2a,0x3f,0x23,0x31},{  0xc6,0xa5,0x94,0x30},{  0x35,0xa2,0x66,0xc0}, 
+{ 0x74,0x4e,0xbc,0x37},{  0xfc,0x82,0xca,0xa6},{  0xe0,0x90,0xd0,0xb0},{  0x33,0xa7,0xd8,0x15}, 
+{ 0xf1,0x04,0x98,0x4a},{  0x41,0xec,0xda,0xf7},{  0x7f,0xcd,0x50,0x0e},{  0x17,0x91,0xf6,0x2f}, 
+{ 0x76,0x4d,0xd6,0x8d},{  0x43,0xef,0xb0,0x4d},{  0xcc,0xaa,0x4d,0x54},{  0xe4,0x96,0x04,0xdf}, 
+{ 0x9e,0xd1,0xb5,0xe3},{  0x4c,0x6a,0x88,0x1b},{  0xc1,0x2c,0x1f,0xb8},{  0x46,0x65,0x51,0x7f}, 
+{ 0x9d,0x5e,0xea,0x04},{  0x01,0x8c,0x35,0x5d},{  0xfa,0x87,0x74,0x73},{  0xfb,0x0b,0x41,0x2e}, 
+{ 0xb3,0x67,0x1d,0x5a},{  0x92,0xdb,0xd2,0x52},{  0xe9,0x10,0x56,0x33},{  0x6d,0xd6,0x47,0x13}, 
+{ 0x9a,0xd7,0x61,0x8c},{  0x37,0xa1,0x0c,0x7a},{  0x59,0xf8,0x14,0x8e},{  0xeb,0x13,0x3c,0x89}, 
+{ 0xce,0xa9,0x27,0xee},{  0xb7,0x61,0xc9,0x35},{  0xe1,0x1c,0xe5,0xed},{  0x7a,0x47,0xb1,0x3c}, 
+{ 0x9c,0xd2,0xdf,0x59},{  0x55,0xf2,0x73,0x3f},{  0x18,0x14,0xce,0x79},{  0x73,0xc7,0x37,0xbf}, 
+{ 0x53,0xf7,0xcd,0xea},{  0x5f,0xfd,0xaa,0x5b},{  0xdf,0x3d,0x6f,0x14},{  0x78,0x44,0xdb,0x86}, 
+{ 0xca,0xaf,0xf3,0x81},{  0xb9,0x68,0xc4,0x3e},{  0x38,0x24,0x34,0x2c},{  0xc2,0xa3,0x40,0x5f}, 
+{ 0x16,0x1d,0xc3,0x72},{  0xbc,0xe2,0x25,0x0c},{  0x28,0x3c,0x49,0x8b},{  0xff,0x0d,0x95,0x41}, 
+{ 0x39,0xa8,0x01,0x71},{  0x08,0x0c,0xb3,0xde},{  0xd8,0xb4,0xe4,0x9c},{  0x64,0x56,0xc1,0x90}, 
+{ 0x7b,0xcb,0x84,0x61},{  0xd5,0x32,0xb6,0x70},{  0x48,0x6c,0x5c,0x74},{  0xd0,0xb8,0x57,0x42 } 
+};
+
+word8 T6[256][4] = {
+{ 0x50,0x51,0xf4,0xa7},{  0x53,0x7e,0x41,0x65},{  0xc3,0x1a,0x17,0xa4},{  0x96,0x3a,0x27,0x5e}, 
+{ 0xcb,0x3b,0xab,0x6b},{  0xf1,0x1f,0x9d,0x45},{  0xab,0xac,0xfa,0x58},{  0x93,0x4b,0xe3,0x03}, 
+{ 0x55,0x20,0x30,0xfa},{  0xf6,0xad,0x76,0x6d},{  0x91,0x88,0xcc,0x76},{  0x25,0xf5,0x02,0x4c}, 
+{ 0xfc,0x4f,0xe5,0xd7},{  0xd7,0xc5,0x2a,0xcb},{  0x80,0x26,0x35,0x44},{  0x8f,0xb5,0x62,0xa3}, 
+{ 0x49,0xde,0xb1,0x5a},{  0x67,0x25,0xba,0x1b},{  0x98,0x45,0xea,0x0e},{  0xe1,0x5d,0xfe,0xc0}, 
+{ 0x02,0xc3,0x2f,0x75},{  0x12,0x81,0x4c,0xf0},{  0xa3,0x8d,0x46,0x97},{  0xc6,0x6b,0xd3,0xf9}, 
+{ 0xe7,0x03,0x8f,0x5f},{  0x95,0x15,0x92,0x9c},{  0xeb,0xbf,0x6d,0x7a},{  0xda,0x95,0x52,0x59}, 
+{ 0x2d,0xd4,0xbe,0x83},{  0xd3,0x58,0x74,0x21},{  0x29,0x49,0xe0,0x69},{  0x44,0x8e,0xc9,0xc8}, 
+{ 0x6a,0x75,0xc2,0x89},{  0x78,0xf4,0x8e,0x79},{  0x6b,0x99,0x58,0x3e},{  0xdd,0x27,0xb9,0x71}, 
+{ 0xb6,0xbe,0xe1,0x4f},{  0x17,0xf0,0x88,0xad},{  0x66,0xc9,0x20,0xac},{  0xb4,0x7d,0xce,0x3a}, 
+{ 0x18,0x63,0xdf,0x4a},{  0x82,0xe5,0x1a,0x31},{  0x60,0x97,0x51,0x33},{  0x45,0x62,0x53,0x7f}, 
+{ 0xe0,0xb1,0x64,0x77},{  0x84,0xbb,0x6b,0xae},{  0x1c,0xfe,0x81,0xa0},{  0x94,0xf9,0x08,0x2b}, 
+{ 0x58,0x70,0x48,0x68},{  0x19,0x8f,0x45,0xfd},{  0x87,0x94,0xde,0x6c},{  0xb7,0x52,0x7b,0xf8}, 
+{ 0x23,0xab,0x73,0xd3},{  0xe2,0x72,0x4b,0x02},{  0x57,0xe3,0x1f,0x8f},{  0x2a,0x66,0x55,0xab}, 
+{ 0x07,0xb2,0xeb,0x28},{  0x03,0x2f,0xb5,0xc2},{  0x9a,0x86,0xc5,0x7b},{  0xa5,0xd3,0x37,0x08}, 
+{ 0xf2,0x30,0x28,0x87},{  0xb2,0x23,0xbf,0xa5},{  0xba,0x02,0x03,0x6a},{  0x5c,0xed,0x16,0x82}, 
+{ 0x2b,0x8a,0xcf,0x1c},{  0x92,0xa7,0x79,0xb4},{  0xf0,0xf3,0x07,0xf2},{  0xa1,0x4e,0x69,0xe2}, 
+{ 0xcd,0x65,0xda,0xf4},{  0xd5,0x06,0x05,0xbe},{  0x1f,0xd1,0x34,0x62},{  0x8a,0xc4,0xa6,0xfe}, 
+{ 0x9d,0x34,0x2e,0x53},{  0xa0,0xa2,0xf3,0x55},{  0x32,0x05,0x8a,0xe1},{  0x75,0xa4,0xf6,0xeb}, 
+{ 0x39,0x0b,0x83,0xec},{  0xaa,0x40,0x60,0xef},{  0x06,0x5e,0x71,0x9f},{  0x51,0xbd,0x6e,0x10}, 
+{ 0xf9,0x3e,0x21,0x8a},{  0x3d,0x96,0xdd,0x06},{  0xae,0xdd,0x3e,0x05},{  0x46,0x4d,0xe6,0xbd}, 
+{ 0xb5,0x91,0x54,0x8d},{  0x05,0x71,0xc4,0x5d},{  0x6f,0x04,0x06,0xd4},{  0xff,0x60,0x50,0x15}, 
+{ 0x24,0x19,0x98,0xfb},{  0x97,0xd6,0xbd,0xe9},{  0xcc,0x89,0x40,0x43},{  0x77,0x67,0xd9,0x9e}, 
+{ 0xbd,0xb0,0xe8,0x42},{  0x88,0x07,0x89,0x8b},{  0x38,0xe7,0x19,0x5b},{  0xdb,0x79,0xc8,0xee}, 
+{ 0x47,0xa1,0x7c,0x0a},{  0xe9,0x7c,0x42,0x0f},{  0xc9,0xf8,0x84,0x1e},{  0x00,0x00,0x00,0x00}, 
+{ 0x83,0x09,0x80,0x86},{  0x48,0x32,0x2b,0xed},{  0xac,0x1e,0x11,0x70},{  0x4e,0x6c,0x5a,0x72}, 
+{ 0xfb,0xfd,0x0e,0xff},{  0x56,0x0f,0x85,0x38},{  0x1e,0x3d,0xae,0xd5},{  0x27,0x36,0x2d,0x39}, 
+{ 0x64,0x0a,0x0f,0xd9},{  0x21,0x68,0x5c,0xa6},{  0xd1,0x9b,0x5b,0x54},{  0x3a,0x24,0x36,0x2e}, 
+{ 0xb1,0x0c,0x0a,0x67},{  0x0f,0x93,0x57,0xe7},{  0xd2,0xb4,0xee,0x96},{  0x9e,0x1b,0x9b,0x91}, 
+{ 0x4f,0x80,0xc0,0xc5},{  0xa2,0x61,0xdc,0x20},{  0x69,0x5a,0x77,0x4b},{  0x16,0x1c,0x12,0x1a}, 
+{ 0x0a,0xe2,0x93,0xba},{  0xe5,0xc0,0xa0,0x2a},{  0x43,0x3c,0x22,0xe0},{  0x1d,0x12,0x1b,0x17}, 
+{ 0x0b,0x0e,0x09,0x0d},{  0xad,0xf2,0x8b,0xc7},{  0xb9,0x2d,0xb6,0xa8},{  0xc8,0x14,0x1e,0xa9}, 
+{ 0x85,0x57,0xf1,0x19},{  0x4c,0xaf,0x75,0x07},{  0xbb,0xee,0x99,0xdd},{  0xfd,0xa3,0x7f,0x60}, 
+{ 0x9f,0xf7,0x01,0x26},{  0xbc,0x5c,0x72,0xf5},{  0xc5,0x44,0x66,0x3b},{  0x34,0x5b,0xfb,0x7e}, 
+{ 0x76,0x8b,0x43,0x29},{  0xdc,0xcb,0x23,0xc6},{  0x68,0xb6,0xed,0xfc},{  0x63,0xb8,0xe4,0xf1}, 
+{ 0xca,0xd7,0x31,0xdc},{  0x10,0x42,0x63,0x85},{  0x40,0x13,0x97,0x22},{  0x20,0x84,0xc6,0x11}, 
+{ 0x7d,0x85,0x4a,0x24},{  0xf8,0xd2,0xbb,0x3d},{  0x11,0xae,0xf9,0x32},{  0x6d,0xc7,0x29,0xa1}, 
+{ 0x4b,0x1d,0x9e,0x2f},{  0xf3,0xdc,0xb2,0x30},{  0xec,0x0d,0x86,0x52},{  0xd0,0x77,0xc1,0xe3}, 
+{ 0x6c,0x2b,0xb3,0x16},{  0x99,0xa9,0x70,0xb9},{  0xfa,0x11,0x94,0x48},{  0x22,0x47,0xe9,0x64}, 
+{ 0xc4,0xa8,0xfc,0x8c},{  0x1a,0xa0,0xf0,0x3f},{  0xd8,0x56,0x7d,0x2c},{  0xef,0x22,0x33,0x90}, 
+{ 0xc7,0x87,0x49,0x4e},{  0xc1,0xd9,0x38,0xd1},{  0xfe,0x8c,0xca,0xa2},{  0x36,0x98,0xd4,0x0b}, 
+{ 0xcf,0xa6,0xf5,0x81},{  0x28,0xa5,0x7a,0xde},{  0x26,0xda,0xb7,0x8e},{  0xa4,0x3f,0xad,0xbf}, 
+{ 0xe4,0x2c,0x3a,0x9d},{  0x0d,0x50,0x78,0x92},{  0x9b,0x6a,0x5f,0xcc},{  0x62,0x54,0x7e,0x46}, 
+{ 0xc2,0xf6,0x8d,0x13},{  0xe8,0x90,0xd8,0xb8},{  0x5e,0x2e,0x39,0xf7},{  0xf5,0x82,0xc3,0xaf}, 
+{ 0xbe,0x9f,0x5d,0x80},{  0x7c,0x69,0xd0,0x93},{  0xa9,0x6f,0xd5,0x2d},{  0xb3,0xcf,0x25,0x12}, 
+{ 0x3b,0xc8,0xac,0x99},{  0xa7,0x10,0x18,0x7d},{  0x6e,0xe8,0x9c,0x63},{  0x7b,0xdb,0x3b,0xbb}, 
+{ 0x09,0xcd,0x26,0x78},{  0xf4,0x6e,0x59,0x18},{  0x01,0xec,0x9a,0xb7},{  0xa8,0x83,0x4f,0x9a}, 
+{ 0x65,0xe6,0x95,0x6e},{  0x7e,0xaa,0xff,0xe6},{  0x08,0x21,0xbc,0xcf},{  0xe6,0xef,0x15,0xe8}, 
+{ 0xd9,0xba,0xe7,0x9b},{  0xce,0x4a,0x6f,0x36},{  0xd4,0xea,0x9f,0x09},{  0xd6,0x29,0xb0,0x7c}, 
+{ 0xaf,0x31,0xa4,0xb2},{  0x31,0x2a,0x3f,0x23},{  0x30,0xc6,0xa5,0x94},{  0xc0,0x35,0xa2,0x66}, 
+{ 0x37,0x74,0x4e,0xbc},{  0xa6,0xfc,0x82,0xca},{  0xb0,0xe0,0x90,0xd0},{  0x15,0x33,0xa7,0xd8}, 
+{ 0x4a,0xf1,0x04,0x98},{  0xf7,0x41,0xec,0xda},{  0x0e,0x7f,0xcd,0x50},{  0x2f,0x17,0x91,0xf6}, 
+{ 0x8d,0x76,0x4d,0xd6},{  0x4d,0x43,0xef,0xb0},{  0x54,0xcc,0xaa,0x4d},{  0xdf,0xe4,0x96,0x04}, 
+{ 0xe3,0x9e,0xd1,0xb5},{  0x1b,0x4c,0x6a,0x88},{  0xb8,0xc1,0x2c,0x1f},{  0x7f,0x46,0x65,0x51}, 
+{ 0x04,0x9d,0x5e,0xea},{  0x5d,0x01,0x8c,0x35},{  0x73,0xfa,0x87,0x74},{  0x2e,0xfb,0x0b,0x41}, 
+{ 0x5a,0xb3,0x67,0x1d},{  0x52,0x92,0xdb,0xd2},{  0x33,0xe9,0x10,0x56},{  0x13,0x6d,0xd6,0x47}, 
+{ 0x8c,0x9a,0xd7,0x61},{  0x7a,0x37,0xa1,0x0c},{  0x8e,0x59,0xf8,0x14},{  0x89,0xeb,0x13,0x3c}, 
+{ 0xee,0xce,0xa9,0x27},{  0x35,0xb7,0x61,0xc9},{  0xed,0xe1,0x1c,0xe5},{  0x3c,0x7a,0x47,0xb1}, 
+{ 0x59,0x9c,0xd2,0xdf},{  0x3f,0x55,0xf2,0x73},{  0x79,0x18,0x14,0xce},{  0xbf,0x73,0xc7,0x37}, 
+{ 0xea,0x53,0xf7,0xcd},{  0x5b,0x5f,0xfd,0xaa},{  0x14,0xdf,0x3d,0x6f},{  0x86,0x78,0x44,0xdb}, 
+{ 0x81,0xca,0xaf,0xf3},{  0x3e,0xb9,0x68,0xc4},{  0x2c,0x38,0x24,0x34},{  0x5f,0xc2,0xa3,0x40}, 
+{ 0x72,0x16,0x1d,0xc3},{  0x0c,0xbc,0xe2,0x25},{  0x8b,0x28,0x3c,0x49},{  0x41,0xff,0x0d,0x95}, 
+{ 0x71,0x39,0xa8,0x01},{  0xde,0x08,0x0c,0xb3},{  0x9c,0xd8,0xb4,0xe4},{  0x90,0x64,0x56,0xc1}, 
+{ 0x61,0x7b,0xcb,0x84},{  0x70,0xd5,0x32,0xb6},{  0x74,0x48,0x6c,0x5c},{  0x42,0xd0,0xb8,0x57 } 
+};
+
+word8 T7[256][4] = {
+{ 0xa7,0x50,0x51,0xf4},{  0x65,0x53,0x7e,0x41},{  0xa4,0xc3,0x1a,0x17},{  0x5e,0x96,0x3a,0x27}, 
+{ 0x6b,0xcb,0x3b,0xab},{  0x45,0xf1,0x1f,0x9d},{  0x58,0xab,0xac,0xfa},{  0x03,0x93,0x4b,0xe3}, 
+{ 0xfa,0x55,0x20,0x30},{  0x6d,0xf6,0xad,0x76},{  0x76,0x91,0x88,0xcc},{  0x4c,0x25,0xf5,0x02}, 
+{ 0xd7,0xfc,0x4f,0xe5},{  0xcb,0xd7,0xc5,0x2a},{  0x44,0x80,0x26,0x35},{  0xa3,0x8f,0xb5,0x62}, 
+{ 0x5a,0x49,0xde,0xb1},{  0x1b,0x67,0x25,0xba},{  0x0e,0x98,0x45,0xea},{  0xc0,0xe1,0x5d,0xfe}, 
+{ 0x75,0x02,0xc3,0x2f},{  0xf0,0x12,0x81,0x4c},{  0x97,0xa3,0x8d,0x46},{  0xf9,0xc6,0x6b,0xd3}, 
+{ 0x5f,0xe7,0x03,0x8f},{  0x9c,0x95,0x15,0x92},{  0x7a,0xeb,0xbf,0x6d},{  0x59,0xda,0x95,0x52}, 
+{ 0x83,0x2d,0xd4,0xbe},{  0x21,0xd3,0x58,0x74},{  0x69,0x29,0x49,0xe0},{  0xc8,0x44,0x8e,0xc9}, 
+{ 0x89,0x6a,0x75,0xc2},{  0x79,0x78,0xf4,0x8e},{  0x3e,0x6b,0x99,0x58},{  0x71,0xdd,0x27,0xb9}, 
+{ 0x4f,0xb6,0xbe,0xe1},{  0xad,0x17,0xf0,0x88},{  0xac,0x66,0xc9,0x20},{  0x3a,0xb4,0x7d,0xce}, 
+{ 0x4a,0x18,0x63,0xdf},{  0x31,0x82,0xe5,0x1a},{  0x33,0x60,0x97,0x51},{  0x7f,0x45,0x62,0x53}, 
+{ 0x77,0xe0,0xb1,0x64},{  0xae,0x84,0xbb,0x6b},{  0xa0,0x1c,0xfe,0x81},{  0x2b,0x94,0xf9,0x08}, 
+{ 0x68,0x58,0x70,0x48},{  0xfd,0x19,0x8f,0x45},{  0x6c,0x87,0x94,0xde},{  0xf8,0xb7,0x52,0x7b}, 
+{ 0xd3,0x23,0xab,0x73},{  0x02,0xe2,0x72,0x4b},{  0x8f,0x57,0xe3,0x1f},{  0xab,0x2a,0x66,0x55}, 
+{ 0x28,0x07,0xb2,0xeb},{  0xc2,0x03,0x2f,0xb5},{  0x7b,0x9a,0x86,0xc5},{  0x08,0xa5,0xd3,0x37}, 
+{ 0x87,0xf2,0x30,0x28},{  0xa5,0xb2,0x23,0xbf},{  0x6a,0xba,0x02,0x03},{  0x82,0x5c,0xed,0x16}, 
+{ 0x1c,0x2b,0x8a,0xcf},{  0xb4,0x92,0xa7,0x79},{  0xf2,0xf0,0xf3,0x07},{  0xe2,0xa1,0x4e,0x69}, 
+{ 0xf4,0xcd,0x65,0xda},{  0xbe,0xd5,0x06,0x05},{  0x62,0x1f,0xd1,0x34},{  0xfe,0x8a,0xc4,0xa6}, 
+{ 0x53,0x9d,0x34,0x2e},{  0x55,0xa0,0xa2,0xf3},{  0xe1,0x32,0x05,0x8a},{  0xeb,0x75,0xa4,0xf6}, 
+{ 0xec,0x39,0x0b,0x83},{  0xef,0xaa,0x40,0x60},{  0x9f,0x06,0x5e,0x71},{  0x10,0x51,0xbd,0x6e}, 
+{ 0x8a,0xf9,0x3e,0x21},{  0x06,0x3d,0x96,0xdd},{  0x05,0xae,0xdd,0x3e},{  0xbd,0x46,0x4d,0xe6}, 
+{ 0x8d,0xb5,0x91,0x54},{  0x5d,0x05,0x71,0xc4},{  0xd4,0x6f,0x04,0x06},{  0x15,0xff,0x60,0x50}, 
+{ 0xfb,0x24,0x19,0x98},{  0xe9,0x97,0xd6,0xbd},{  0x43,0xcc,0x89,0x40},{  0x9e,0x77,0x67,0xd9}, 
+{ 0x42,0xbd,0xb0,0xe8},{  0x8b,0x88,0x07,0x89},{  0x5b,0x38,0xe7,0x19},{  0xee,0xdb,0x79,0xc8}, 
+{ 0x0a,0x47,0xa1,0x7c},{  0x0f,0xe9,0x7c,0x42},{  0x1e,0xc9,0xf8,0x84},{  0x00,0x00,0x00,0x00}, 
+{ 0x86,0x83,0x09,0x80},{  0xed,0x48,0x32,0x2b},{  0x70,0xac,0x1e,0x11},{  0x72,0x4e,0x6c,0x5a}, 
+{ 0xff,0xfb,0xfd,0x0e},{  0x38,0x56,0x0f,0x85},{  0xd5,0x1e,0x3d,0xae},{  0x39,0x27,0x36,0x2d}, 
+{ 0xd9,0x64,0x0a,0x0f},{  0xa6,0x21,0x68,0x5c},{  0x54,0xd1,0x9b,0x5b},{  0x2e,0x3a,0x24,0x36}, 
+{ 0x67,0xb1,0x0c,0x0a},{  0xe7,0x0f,0x93,0x57},{  0x96,0xd2,0xb4,0xee},{  0x91,0x9e,0x1b,0x9b}, 
+{ 0xc5,0x4f,0x80,0xc0},{  0x20,0xa2,0x61,0xdc},{  0x4b,0x69,0x5a,0x77},{  0x1a,0x16,0x1c,0x12}, 
+{ 0xba,0x0a,0xe2,0x93},{  0x2a,0xe5,0xc0,0xa0},{  0xe0,0x43,0x3c,0x22},{  0x17,0x1d,0x12,0x1b}, 
+{ 0x0d,0x0b,0x0e,0x09},{  0xc7,0xad,0xf2,0x8b},{  0xa8,0xb9,0x2d,0xb6},{  0xa9,0xc8,0x14,0x1e}, 
+{ 0x19,0x85,0x57,0xf1},{  0x07,0x4c,0xaf,0x75},{  0xdd,0xbb,0xee,0x99},{  0x60,0xfd,0xa3,0x7f}, 
+{ 0x26,0x9f,0xf7,0x01},{  0xf5,0xbc,0x5c,0x72},{  0x3b,0xc5,0x44,0x66},{  0x7e,0x34,0x5b,0xfb}, 
+{ 0x29,0x76,0x8b,0x43},{  0xc6,0xdc,0xcb,0x23},{  0xfc,0x68,0xb6,0xed},{  0xf1,0x63,0xb8,0xe4}, 
+{ 0xdc,0xca,0xd7,0x31},{  0x85,0x10,0x42,0x63},{  0x22,0x40,0x13,0x97},{  0x11,0x20,0x84,0xc6}, 
+{ 0x24,0x7d,0x85,0x4a},{  0x3d,0xf8,0xd2,0xbb},{  0x32,0x11,0xae,0xf9},{  0xa1,0x6d,0xc7,0x29}, 
+{ 0x2f,0x4b,0x1d,0x9e},{  0x30,0xf3,0xdc,0xb2},{  0x52,0xec,0x0d,0x86},{  0xe3,0xd0,0x77,0xc1}, 
+{ 0x16,0x6c,0x2b,0xb3},{  0xb9,0x99,0xa9,0x70},{  0x48,0xfa,0x11,0x94},{  0x64,0x22,0x47,0xe9}, 
+{ 0x8c,0xc4,0xa8,0xfc},{  0x3f,0x1a,0xa0,0xf0},{  0x2c,0xd8,0x56,0x7d},{  0x90,0xef,0x22,0x33}, 
+{ 0x4e,0xc7,0x87,0x49},{  0xd1,0xc1,0xd9,0x38},{  0xa2,0xfe,0x8c,0xca},{  0x0b,0x36,0x98,0xd4}, 
+{ 0x81,0xcf,0xa6,0xf5},{  0xde,0x28,0xa5,0x7a},{  0x8e,0x26,0xda,0xb7},{  0xbf,0xa4,0x3f,0xad}, 
+{ 0x9d,0xe4,0x2c,0x3a},{  0x92,0x0d,0x50,0x78},{  0xcc,0x9b,0x6a,0x5f},{  0x46,0x62,0x54,0x7e}, 
+{ 0x13,0xc2,0xf6,0x8d},{  0xb8,0xe8,0x90,0xd8},{  0xf7,0x5e,0x2e,0x39},{  0xaf,0xf5,0x82,0xc3}, 
+{ 0x80,0xbe,0x9f,0x5d},{  0x93,0x7c,0x69,0xd0},{  0x2d,0xa9,0x6f,0xd5},{  0x12,0xb3,0xcf,0x25}, 
+{ 0x99,0x3b,0xc8,0xac},{  0x7d,0xa7,0x10,0x18},{  0x63,0x6e,0xe8,0x9c},{  0xbb,0x7b,0xdb,0x3b}, 
+{ 0x78,0x09,0xcd,0x26},{  0x18,0xf4,0x6e,0x59},{  0xb7,0x01,0xec,0x9a},{  0x9a,0xa8,0x83,0x4f}, 
+{ 0x6e,0x65,0xe6,0x95},{  0xe6,0x7e,0xaa,0xff},{  0xcf,0x08,0x21,0xbc},{  0xe8,0xe6,0xef,0x15}, 
+{ 0x9b,0xd9,0xba,0xe7},{  0x36,0xce,0x4a,0x6f},{  0x09,0xd4,0xea,0x9f},{  0x7c,0xd6,0x29,0xb0}, 
+{ 0xb2,0xaf,0x31,0xa4},{  0x23,0x31,0x2a,0x3f},{  0x94,0x30,0xc6,0xa5},{  0x66,0xc0,0x35,0xa2}, 
+{ 0xbc,0x37,0x74,0x4e},{  0xca,0xa6,0xfc,0x82},{  0xd0,0xb0,0xe0,0x90},{  0xd8,0x15,0x33,0xa7}, 
+{ 0x98,0x4a,0xf1,0x04},{  0xda,0xf7,0x41,0xec},{  0x50,0x0e,0x7f,0xcd},{  0xf6,0x2f,0x17,0x91}, 
+{ 0xd6,0x8d,0x76,0x4d},{  0xb0,0x4d,0x43,0xef},{  0x4d,0x54,0xcc,0xaa},{  0x04,0xdf,0xe4,0x96}, 
+{ 0xb5,0xe3,0x9e,0xd1},{  0x88,0x1b,0x4c,0x6a},{  0x1f,0xb8,0xc1,0x2c},{  0x51,0x7f,0x46,0x65}, 
+{ 0xea,0x04,0x9d,0x5e},{  0x35,0x5d,0x01,0x8c},{  0x74,0x73,0xfa,0x87},{  0x41,0x2e,0xfb,0x0b}, 
+{ 0x1d,0x5a,0xb3,0x67},{  0xd2,0x52,0x92,0xdb},{  0x56,0x33,0xe9,0x10},{  0x47,0x13,0x6d,0xd6}, 
+{ 0x61,0x8c,0x9a,0xd7},{  0x0c,0x7a,0x37,0xa1},{  0x14,0x8e,0x59,0xf8},{  0x3c,0x89,0xeb,0x13}, 
+{ 0x27,0xee,0xce,0xa9},{  0xc9,0x35,0xb7,0x61},{  0xe5,0xed,0xe1,0x1c},{  0xb1,0x3c,0x7a,0x47}, 
+{ 0xdf,0x59,0x9c,0xd2},{  0x73,0x3f,0x55,0xf2},{  0xce,0x79,0x18,0x14},{  0x37,0xbf,0x73,0xc7}, 
+{ 0xcd,0xea,0x53,0xf7},{  0xaa,0x5b,0x5f,0xfd},{  0x6f,0x14,0xdf,0x3d},{  0xdb,0x86,0x78,0x44}, 
+{ 0xf3,0x81,0xca,0xaf},{  0xc4,0x3e,0xb9,0x68},{  0x34,0x2c,0x38,0x24},{  0x40,0x5f,0xc2,0xa3}, 
+{ 0xc3,0x72,0x16,0x1d},{  0x25,0x0c,0xbc,0xe2},{  0x49,0x8b,0x28,0x3c},{  0x95,0x41,0xff,0x0d}, 
+{ 0x01,0x71,0x39,0xa8},{  0xb3,0xde,0x08,0x0c},{  0xe4,0x9c,0xd8,0xb4},{  0xc1,0x90,0x64,0x56}, 
+{ 0x84,0x61,0x7b,0xcb},{  0xb6,0x70,0xd5,0x32},{  0x5c,0x74,0x48,0x6c},{  0x57,0x42,0xd0,0xb8 } 
+};
+
+word8 T8[256][4] = {
+{ 0xf4,0xa7,0x50,0x51},{  0x41,0x65,0x53,0x7e},{  0x17,0xa4,0xc3,0x1a},{  0x27,0x5e,0x96,0x3a}, 
+{ 0xab,0x6b,0xcb,0x3b},{  0x9d,0x45,0xf1,0x1f},{  0xfa,0x58,0xab,0xac},{  0xe3,0x03,0x93,0x4b}, 
+{ 0x30,0xfa,0x55,0x20},{  0x76,0x6d,0xf6,0xad},{  0xcc,0x76,0x91,0x88},{  0x02,0x4c,0x25,0xf5}, 
+{ 0xe5,0xd7,0xfc,0x4f},{  0x2a,0xcb,0xd7,0xc5},{  0x35,0x44,0x80,0x26},{  0x62,0xa3,0x8f,0xb5}, 
+{ 0xb1,0x5a,0x49,0xde},{  0xba,0x1b,0x67,0x25},{  0xea,0x0e,0x98,0x45},{  0xfe,0xc0,0xe1,0x5d}, 
+{ 0x2f,0x75,0x02,0xc3},{  0x4c,0xf0,0x12,0x81},{  0x46,0x97,0xa3,0x8d},{  0xd3,0xf9,0xc6,0x6b}, 
+{ 0x8f,0x5f,0xe7,0x03},{  0x92,0x9c,0x95,0x15},{  0x6d,0x7a,0xeb,0xbf},{  0x52,0x59,0xda,0x95}, 
+{ 0xbe,0x83,0x2d,0xd4},{  0x74,0x21,0xd3,0x58},{  0xe0,0x69,0x29,0x49},{  0xc9,0xc8,0x44,0x8e}, 
+{ 0xc2,0x89,0x6a,0x75},{  0x8e,0x79,0x78,0xf4},{  0x58,0x3e,0x6b,0x99},{  0xb9,0x71,0xdd,0x27}, 
+{ 0xe1,0x4f,0xb6,0xbe},{  0x88,0xad,0x17,0xf0},{  0x20,0xac,0x66,0xc9},{  0xce,0x3a,0xb4,0x7d}, 
+{ 0xdf,0x4a,0x18,0x63},{  0x1a,0x31,0x82,0xe5},{  0x51,0x33,0x60,0x97},{  0x53,0x7f,0x45,0x62}, 
+{ 0x64,0x77,0xe0,0xb1},{  0x6b,0xae,0x84,0xbb},{  0x81,0xa0,0x1c,0xfe},{  0x08,0x2b,0x94,0xf9}, 
+{ 0x48,0x68,0x58,0x70},{  0x45,0xfd,0x19,0x8f},{  0xde,0x6c,0x87,0x94},{  0x7b,0xf8,0xb7,0x52}, 
+{ 0x73,0xd3,0x23,0xab},{  0x4b,0x02,0xe2,0x72},{  0x1f,0x8f,0x57,0xe3},{  0x55,0xab,0x2a,0x66}, 
+{ 0xeb,0x28,0x07,0xb2},{  0xb5,0xc2,0x03,0x2f},{  0xc5,0x7b,0x9a,0x86},{  0x37,0x08,0xa5,0xd3}, 
+{ 0x28,0x87,0xf2,0x30},{  0xbf,0xa5,0xb2,0x23},{  0x03,0x6a,0xba,0x02},{  0x16,0x82,0x5c,0xed}, 
+{ 0xcf,0x1c,0x2b,0x8a},{  0x79,0xb4,0x92,0xa7},{  0x07,0xf2,0xf0,0xf3},{  0x69,0xe2,0xa1,0x4e}, 
+{ 0xda,0xf4,0xcd,0x65},{  0x05,0xbe,0xd5,0x06},{  0x34,0x62,0x1f,0xd1},{  0xa6,0xfe,0x8a,0xc4}, 
+{ 0x2e,0x53,0x9d,0x34},{  0xf3,0x55,0xa0,0xa2},{  0x8a,0xe1,0x32,0x05},{  0xf6,0xeb,0x75,0xa4}, 
+{ 0x83,0xec,0x39,0x0b},{  0x60,0xef,0xaa,0x40},{  0x71,0x9f,0x06,0x5e},{  0x6e,0x10,0x51,0xbd}, 
+{ 0x21,0x8a,0xf9,0x3e},{  0xdd,0x06,0x3d,0x96},{  0x3e,0x05,0xae,0xdd},{  0xe6,0xbd,0x46,0x4d}, 
+{ 0x54,0x8d,0xb5,0x91},{  0xc4,0x5d,0x05,0x71},{  0x06,0xd4,0x6f,0x04},{  0x50,0x15,0xff,0x60}, 
+{ 0x98,0xfb,0x24,0x19},{  0xbd,0xe9,0x97,0xd6},{  0x40,0x43,0xcc,0x89},{  0xd9,0x9e,0x77,0x67}, 
+{ 0xe8,0x42,0xbd,0xb0},{  0x89,0x8b,0x88,0x07},{  0x19,0x5b,0x38,0xe7},{  0xc8,0xee,0xdb,0x79}, 
+{ 0x7c,0x0a,0x47,0xa1},{  0x42,0x0f,0xe9,0x7c},{  0x84,0x1e,0xc9,0xf8},{  0x00,0x00,0x00,0x00}, 
+{ 0x80,0x86,0x83,0x09},{  0x2b,0xed,0x48,0x32},{  0x11,0x70,0xac,0x1e},{  0x5a,0x72,0x4e,0x6c}, 
+{ 0x0e,0xff,0xfb,0xfd},{  0x85,0x38,0x56,0x0f},{  0xae,0xd5,0x1e,0x3d},{  0x2d,0x39,0x27,0x36}, 
+{ 0x0f,0xd9,0x64,0x0a},{  0x5c,0xa6,0x21,0x68},{  0x5b,0x54,0xd1,0x9b},{  0x36,0x2e,0x3a,0x24}, 
+{ 0x0a,0x67,0xb1,0x0c},{  0x57,0xe7,0x0f,0x93},{  0xee,0x96,0xd2,0xb4},{  0x9b,0x91,0x9e,0x1b}, 
+{ 0xc0,0xc5,0x4f,0x80},{  0xdc,0x20,0xa2,0x61},{  0x77,0x4b,0x69,0x5a},{  0x12,0x1a,0x16,0x1c}, 
+{ 0x93,0xba,0x0a,0xe2},{  0xa0,0x2a,0xe5,0xc0},{  0x22,0xe0,0x43,0x3c},{  0x1b,0x17,0x1d,0x12}, 
+{ 0x09,0x0d,0x0b,0x0e},{  0x8b,0xc7,0xad,0xf2},{  0xb6,0xa8,0xb9,0x2d},{  0x1e,0xa9,0xc8,0x14}, 
+{ 0xf1,0x19,0x85,0x57},{  0x75,0x07,0x4c,0xaf},{  0x99,0xdd,0xbb,0xee},{  0x7f,0x60,0xfd,0xa3}, 
+{ 0x01,0x26,0x9f,0xf7},{  0x72,0xf5,0xbc,0x5c},{  0x66,0x3b,0xc5,0x44},{  0xfb,0x7e,0x34,0x5b}, 
+{ 0x43,0x29,0x76,0x8b},{  0x23,0xc6,0xdc,0xcb},{  0xed,0xfc,0x68,0xb6},{  0xe4,0xf1,0x63,0xb8}, 
+{ 0x31,0xdc,0xca,0xd7},{  0x63,0x85,0x10,0x42},{  0x97,0x22,0x40,0x13},{  0xc6,0x11,0x20,0x84}, 
+{ 0x4a,0x24,0x7d,0x85},{  0xbb,0x3d,0xf8,0xd2},{  0xf9,0x32,0x11,0xae},{  0x29,0xa1,0x6d,0xc7}, 
+{ 0x9e,0x2f,0x4b,0x1d},{  0xb2,0x30,0xf3,0xdc},{  0x86,0x52,0xec,0x0d},{  0xc1,0xe3,0xd0,0x77}, 
+{ 0xb3,0x16,0x6c,0x2b},{  0x70,0xb9,0x99,0xa9},{  0x94,0x48,0xfa,0x11},{  0xe9,0x64,0x22,0x47}, 
+{ 0xfc,0x8c,0xc4,0xa8},{  0xf0,0x3f,0x1a,0xa0},{  0x7d,0x2c,0xd8,0x56},{  0x33,0x90,0xef,0x22}, 
+{ 0x49,0x4e,0xc7,0x87},{  0x38,0xd1,0xc1,0xd9},{  0xca,0xa2,0xfe,0x8c},{  0xd4,0x0b,0x36,0x98}, 
+{ 0xf5,0x81,0xcf,0xa6},{  0x7a,0xde,0x28,0xa5},{  0xb7,0x8e,0x26,0xda},{  0xad,0xbf,0xa4,0x3f}, 
+{ 0x3a,0x9d,0xe4,0x2c},{  0x78,0x92,0x0d,0x50},{  0x5f,0xcc,0x9b,0x6a},{  0x7e,0x46,0x62,0x54}, 
+{ 0x8d,0x13,0xc2,0xf6},{  0xd8,0xb8,0xe8,0x90},{  0x39,0xf7,0x5e,0x2e},{  0xc3,0xaf,0xf5,0x82}, 
+{ 0x5d,0x80,0xbe,0x9f},{  0xd0,0x93,0x7c,0x69},{  0xd5,0x2d,0xa9,0x6f},{  0x25,0x12,0xb3,0xcf}, 
+{ 0xac,0x99,0x3b,0xc8},{  0x18,0x7d,0xa7,0x10},{  0x9c,0x63,0x6e,0xe8},{  0x3b,0xbb,0x7b,0xdb}, 
+{ 0x26,0x78,0x09,0xcd},{  0x59,0x18,0xf4,0x6e},{  0x9a,0xb7,0x01,0xec},{  0x4f,0x9a,0xa8,0x83}, 
+{ 0x95,0x6e,0x65,0xe6},{  0xff,0xe6,0x7e,0xaa},{  0xbc,0xcf,0x08,0x21},{  0x15,0xe8,0xe6,0xef}, 
+{ 0xe7,0x9b,0xd9,0xba},{  0x6f,0x36,0xce,0x4a},{  0x9f,0x09,0xd4,0xea},{  0xb0,0x7c,0xd6,0x29}, 
+{ 0xa4,0xb2,0xaf,0x31},{  0x3f,0x23,0x31,0x2a},{  0xa5,0x94,0x30,0xc6},{  0xa2,0x66,0xc0,0x35}, 
+{ 0x4e,0xbc,0x37,0x74},{  0x82,0xca,0xa6,0xfc},{  0x90,0xd0,0xb0,0xe0},{  0xa7,0xd8,0x15,0x33}, 
+{ 0x04,0x98,0x4a,0xf1},{  0xec,0xda,0xf7,0x41},{  0xcd,0x50,0x0e,0x7f},{  0x91,0xf6,0x2f,0x17}, 
+{ 0x4d,0xd6,0x8d,0x76},{  0xef,0xb0,0x4d,0x43},{  0xaa,0x4d,0x54,0xcc},{  0x96,0x04,0xdf,0xe4}, 
+{ 0xd1,0xb5,0xe3,0x9e},{  0x6a,0x88,0x1b,0x4c},{  0x2c,0x1f,0xb8,0xc1},{  0x65,0x51,0x7f,0x46}, 
+{ 0x5e,0xea,0x04,0x9d},{  0x8c,0x35,0x5d,0x01},{  0x87,0x74,0x73,0xfa},{  0x0b,0x41,0x2e,0xfb}, 
+{ 0x67,0x1d,0x5a,0xb3},{  0xdb,0xd2,0x52,0x92},{  0x10,0x56,0x33,0xe9},{  0xd6,0x47,0x13,0x6d}, 
+{ 0xd7,0x61,0x8c,0x9a},{  0xa1,0x0c,0x7a,0x37},{  0xf8,0x14,0x8e,0x59},{  0x13,0x3c,0x89,0xeb}, 
+{ 0xa9,0x27,0xee,0xce},{  0x61,0xc9,0x35,0xb7},{  0x1c,0xe5,0xed,0xe1},{  0x47,0xb1,0x3c,0x7a}, 
+{ 0xd2,0xdf,0x59,0x9c},{  0xf2,0x73,0x3f,0x55},{  0x14,0xce,0x79,0x18},{  0xc7,0x37,0xbf,0x73}, 
+{ 0xf7,0xcd,0xea,0x53},{  0xfd,0xaa,0x5b,0x5f},{  0x3d,0x6f,0x14,0xdf},{  0x44,0xdb,0x86,0x78}, 
+{ 0xaf,0xf3,0x81,0xca},{  0x68,0xc4,0x3e,0xb9},{  0x24,0x34,0x2c,0x38},{  0xa3,0x40,0x5f,0xc2}, 
+{ 0x1d,0xc3,0x72,0x16},{  0xe2,0x25,0x0c,0xbc},{  0x3c,0x49,0x8b,0x28},{  0x0d,0x95,0x41,0xff}, 
+{ 0xa8,0x01,0x71,0x39},{  0x0c,0xb3,0xde,0x08},{  0xb4,0xe4,0x9c,0xd8},{  0x56,0xc1,0x90,0x64}, 
+{ 0xcb,0x84,0x61,0x7b},{  0x32,0xb6,0x70,0xd5},{  0x6c,0x5c,0x74,0x48},{  0xb8,0x57,0x42,0xd0 } 
+};
+
+word8 S5[256] = {
+0x52,0x09,0x6a,0xd5,
+0x30,0x36,0xa5,0x38,
+0xbf,0x40,0xa3,0x9e,
+0x81,0xf3,0xd7,0xfb,
+0x7c,0xe3,0x39,0x82,
+0x9b,0x2f,0xff,0x87,
+0x34,0x8e,0x43,0x44,
+0xc4,0xde,0xe9,0xcb,
+0x54,0x7b,0x94,0x32,
+0xa6,0xc2,0x23,0x3d,
+0xee,0x4c,0x95,0x0b,
+0x42,0xfa,0xc3,0x4e,
+0x08,0x2e,0xa1,0x66,
+0x28,0xd9,0x24,0xb2,
+0x76,0x5b,0xa2,0x49,
+0x6d,0x8b,0xd1,0x25,
+0x72,0xf8,0xf6,0x64,
+0x86,0x68,0x98,0x16,
+0xd4,0xa4,0x5c,0xcc,
+0x5d,0x65,0xb6,0x92,
+0x6c,0x70,0x48,0x50,
+0xfd,0xed,0xb9,0xda,
+0x5e,0x15,0x46,0x57,
+0xa7,0x8d,0x9d,0x84,
+0x90,0xd8,0xab,0x00,
+0x8c,0xbc,0xd3,0x0a,
+0xf7,0xe4,0x58,0x05,
+0xb8,0xb3,0x45,0x06,
+0xd0,0x2c,0x1e,0x8f,
+0xca,0x3f,0x0f,0x02,
+0xc1,0xaf,0xbd,0x03,
+0x01,0x13,0x8a,0x6b,
+0x3a,0x91,0x11,0x41,
+0x4f,0x67,0xdc,0xea,
+0x97,0xf2,0xcf,0xce,
+0xf0,0xb4,0xe6,0x73,
+0x96,0xac,0x74,0x22,
+0xe7,0xad,0x35,0x85,
+0xe2,0xf9,0x37,0xe8,
+0x1c,0x75,0xdf,0x6e,
+0x47,0xf1,0x1a,0x71,
+0x1d,0x29,0xc5,0x89,
+0x6f,0xb7,0x62,0x0e,
+0xaa,0x18,0xbe,0x1b,
+0xfc,0x56,0x3e,0x4b,
+0xc6,0xd2,0x79,0x20,
+0x9a,0xdb,0xc0,0xfe,
+0x78,0xcd,0x5a,0xf4,
+0x1f,0xdd,0xa8,0x33,
+0x88,0x07,0xc7,0x31,
+0xb1,0x12,0x10,0x59,
+0x27,0x80,0xec,0x5f,
+0x60,0x51,0x7f,0xa9,
+0x19,0xb5,0x4a,0x0d,
+0x2d,0xe5,0x7a,0x9f,
+0x93,0xc9,0x9c,0xef,
+0xa0,0xe0,0x3b,0x4d,
+0xae,0x2a,0xf5,0xb0,
+0xc8,0xeb,0xbb,0x3c,
+0x83,0x53,0x99,0x61,
+0x17,0x2b,0x04,0x7e,
+0xba,0x77,0xd6,0x26,
+0xe1,0x69,0x14,0x63,
+0x55,0x21,0x0c,0x7d
+};
+
+word8 U1[256][4] = {
+{ 0x00,0x00,0x00,0x00},{  0x0e,0x09,0x0d,0x0b},{  0x1c,0x12,0x1a,0x16},{  0x12,0x1b,0x17,0x1d}, 
+{ 0x38,0x24,0x34,0x2c},{  0x36,0x2d,0x39,0x27},{  0x24,0x36,0x2e,0x3a},{  0x2a,0x3f,0x23,0x31}, 
+{ 0x70,0x48,0x68,0x58},{  0x7e,0x41,0x65,0x53},{  0x6c,0x5a,0x72,0x4e},{  0x62,0x53,0x7f,0x45}, 
+{ 0x48,0x6c,0x5c,0x74},{  0x46,0x65,0x51,0x7f},{  0x54,0x7e,0x46,0x62},{  0x5a,0x77,0x4b,0x69}, 
+{ 0xe0,0x90,0xd0,0xb0},{  0xee,0x99,0xdd,0xbb},{  0xfc,0x82,0xca,0xa6},{  0xf2,0x8b,0xc7,0xad}, 
+{ 0xd8,0xb4,0xe4,0x9c},{  0xd6,0xbd,0xe9,0x97},{  0xc4,0xa6,0xfe,0x8a},{  0xca,0xaf,0xf3,0x81}, 
+{ 0x90,0xd8,0xb8,0xe8},{  0x9e,0xd1,0xb5,0xe3},{  0x8c,0xca,0xa2,0xfe},{  0x82,0xc3,0xaf,0xf5}, 
+{ 0xa8,0xfc,0x8c,0xc4},{  0xa6,0xf5,0x81,0xcf},{  0xb4,0xee,0x96,0xd2},{  0xba,0xe7,0x9b,0xd9}, 
+{ 0xdb,0x3b,0xbb,0x7b},{  0xd5,0x32,0xb6,0x70},{  0xc7,0x29,0xa1,0x6d},{  0xc9,0x20,0xac,0x66}, 
+{ 0xe3,0x1f,0x8f,0x57},{  0xed,0x16,0x82,0x5c},{  0xff,0x0d,0x95,0x41},{  0xf1,0x04,0x98,0x4a}, 
+{ 0xab,0x73,0xd3,0x23},{  0xa5,0x7a,0xde,0x28},{  0xb7,0x61,0xc9,0x35},{  0xb9,0x68,0xc4,0x3e}, 
+{ 0x93,0x57,0xe7,0x0f},{  0x9d,0x5e,0xea,0x04},{  0x8f,0x45,0xfd,0x19},{  0x81,0x4c,0xf0,0x12}, 
+{ 0x3b,0xab,0x6b,0xcb},{  0x35,0xa2,0x66,0xc0},{  0x27,0xb9,0x71,0xdd},{  0x29,0xb0,0x7c,0xd6}, 
+{ 0x03,0x8f,0x5f,0xe7},{  0x0d,0x86,0x52,0xec},{  0x1f,0x9d,0x45,0xf1},{  0x11,0x94,0x48,0xfa}, 
+{ 0x4b,0xe3,0x03,0x93},{  0x45,0xea,0x0e,0x98},{  0x57,0xf1,0x19,0x85},{  0x59,0xf8,0x14,0x8e}, 
+{ 0x73,0xc7,0x37,0xbf},{  0x7d,0xce,0x3a,0xb4},{  0x6f,0xd5,0x2d,0xa9},{  0x61,0xdc,0x20,0xa2}, 
+{ 0xad,0x76,0x6d,0xf6},{  0xa3,0x7f,0x60,0xfd},{  0xb1,0x64,0x77,0xe0},{  0xbf,0x6d,0x7a,0xeb}, 
+{ 0x95,0x52,0x59,0xda},{  0x9b,0x5b,0x54,0xd1},{  0x89,0x40,0x43,0xcc},{  0x87,0x49,0x4e,0xc7}, 
+{ 0xdd,0x3e,0x05,0xae},{  0xd3,0x37,0x08,0xa5},{  0xc1,0x2c,0x1f,0xb8},{  0xcf,0x25,0x12,0xb3}, 
+{ 0xe5,0x1a,0x31,0x82},{  0xeb,0x13,0x3c,0x89},{  0xf9,0x08,0x2b,0x94},{  0xf7,0x01,0x26,0x9f}, 
+{ 0x4d,0xe6,0xbd,0x46},{  0x43,0xef,0xb0,0x4d},{  0x51,0xf4,0xa7,0x50},{  0x5f,0xfd,0xaa,0x5b}, 
+{ 0x75,0xc2,0x89,0x6a},{  0x7b,0xcb,0x84,0x61},{  0x69,0xd0,0x93,0x7c},{  0x67,0xd9,0x9e,0x77}, 
+{ 0x3d,0xae,0xd5,0x1e},{  0x33,0xa7,0xd8,0x15},{  0x21,0xbc,0xcf,0x08},{  0x2f,0xb5,0xc2,0x03}, 
+{ 0x05,0x8a,0xe1,0x32},{  0x0b,0x83,0xec,0x39},{  0x19,0x98,0xfb,0x24},{  0x17,0x91,0xf6,0x2f}, 
+{ 0x76,0x4d,0xd6,0x8d},{  0x78,0x44,0xdb,0x86},{  0x6a,0x5f,0xcc,0x9b},{  0x64,0x56,0xc1,0x90}, 
+{ 0x4e,0x69,0xe2,0xa1},{  0x40,0x60,0xef,0xaa},{  0x52,0x7b,0xf8,0xb7},{  0x5c,0x72,0xf5,0xbc}, 
+{ 0x06,0x05,0xbe,0xd5},{  0x08,0x0c,0xb3,0xde},{  0x1a,0x17,0xa4,0xc3},{  0x14,0x1e,0xa9,0xc8}, 
+{ 0x3e,0x21,0x8a,0xf9},{  0x30,0x28,0x87,0xf2},{  0x22,0x33,0x90,0xef},{  0x2c,0x3a,0x9d,0xe4}, 
+{ 0x96,0xdd,0x06,0x3d},{  0x98,0xd4,0x0b,0x36},{  0x8a,0xcf,0x1c,0x2b},{  0x84,0xc6,0x11,0x20}, 
+{ 0xae,0xf9,0x32,0x11},{  0xa0,0xf0,0x3f,0x1a},{  0xb2,0xeb,0x28,0x07},{  0xbc,0xe2,0x25,0x0c}, 
+{ 0xe6,0x95,0x6e,0x65},{  0xe8,0x9c,0x63,0x6e},{  0xfa,0x87,0x74,0x73},{  0xf4,0x8e,0x79,0x78}, 
+{ 0xde,0xb1,0x5a,0x49},{  0xd0,0xb8,0x57,0x42},{  0xc2,0xa3,0x40,0x5f},{  0xcc,0xaa,0x4d,0x54}, 
+{ 0x41,0xec,0xda,0xf7},{  0x4f,0xe5,0xd7,0xfc},{  0x5d,0xfe,0xc0,0xe1},{  0x53,0xf7,0xcd,0xea}, 
+{ 0x79,0xc8,0xee,0xdb},{  0x77,0xc1,0xe3,0xd0},{  0x65,0xda,0xf4,0xcd},{  0x6b,0xd3,0xf9,0xc6}, 
+{ 0x31,0xa4,0xb2,0xaf},{  0x3f,0xad,0xbf,0xa4},{  0x2d,0xb6,0xa8,0xb9},{  0x23,0xbf,0xa5,0xb2}, 
+{ 0x09,0x80,0x86,0x83},{  0x07,0x89,0x8b,0x88},{  0x15,0x92,0x9c,0x95},{  0x1b,0x9b,0x91,0x9e}, 
+{ 0xa1,0x7c,0x0a,0x47},{  0xaf,0x75,0x07,0x4c},{  0xbd,0x6e,0x10,0x51},{  0xb3,0x67,0x1d,0x5a}, 
+{ 0x99,0x58,0x3e,0x6b},{  0x97,0x51,0x33,0x60},{  0x85,0x4a,0x24,0x7d},{  0x8b,0x43,0x29,0x76}, 
+{ 0xd1,0x34,0x62,0x1f},{  0xdf,0x3d,0x6f,0x14},{  0xcd,0x26,0x78,0x09},{  0xc3,0x2f,0x75,0x02}, 
+{ 0xe9,0x10,0x56,0x33},{  0xe7,0x19,0x5b,0x38},{  0xf5,0x02,0x4c,0x25},{  0xfb,0x0b,0x41,0x2e}, 
+{ 0x9a,0xd7,0x61,0x8c},{  0x94,0xde,0x6c,0x87},{  0x86,0xc5,0x7b,0x9a},{  0x88,0xcc,0x76,0x91}, 
+{ 0xa2,0xf3,0x55,0xa0},{  0xac,0xfa,0x58,0xab},{  0xbe,0xe1,0x4f,0xb6},{  0xb0,0xe8,0x42,0xbd}, 
+{ 0xea,0x9f,0x09,0xd4},{  0xe4,0x96,0x04,0xdf},{  0xf6,0x8d,0x13,0xc2},{  0xf8,0x84,0x1e,0xc9}, 
+{ 0xd2,0xbb,0x3d,0xf8},{  0xdc,0xb2,0x30,0xf3},{  0xce,0xa9,0x27,0xee},{  0xc0,0xa0,0x2a,0xe5}, 
+{ 0x7a,0x47,0xb1,0x3c},{  0x74,0x4e,0xbc,0x37},{  0x66,0x55,0xab,0x2a},{  0x68,0x5c,0xa6,0x21}, 
+{ 0x42,0x63,0x85,0x10},{  0x4c,0x6a,0x88,0x1b},{  0x5e,0x71,0x9f,0x06},{  0x50,0x78,0x92,0x0d}, 
+{ 0x0a,0x0f,0xd9,0x64},{  0x04,0x06,0xd4,0x6f},{  0x16,0x1d,0xc3,0x72},{  0x18,0x14,0xce,0x79}, 
+{ 0x32,0x2b,0xed,0x48},{  0x3c,0x22,0xe0,0x43},{  0x2e,0x39,0xf7,0x5e},{  0x20,0x30,0xfa,0x55}, 
+{ 0xec,0x9a,0xb7,0x01},{  0xe2,0x93,0xba,0x0a},{  0xf0,0x88,0xad,0x17},{  0xfe,0x81,0xa0,0x1c}, 
+{ 0xd4,0xbe,0x83,0x2d},{  0xda,0xb7,0x8e,0x26},{  0xc8,0xac,0x99,0x3b},{  0xc6,0xa5,0x94,0x30}, 
+{ 0x9c,0xd2,0xdf,0x59},{  0x92,0xdb,0xd2,0x52},{  0x80,0xc0,0xc5,0x4f},{  0x8e,0xc9,0xc8,0x44}, 
+{ 0xa4,0xf6,0xeb,0x75},{  0xaa,0xff,0xe6,0x7e},{  0xb8,0xe4,0xf1,0x63},{  0xb6,0xed,0xfc,0x68}, 
+{ 0x0c,0x0a,0x67,0xb1},{  0x02,0x03,0x6a,0xba},{  0x10,0x18,0x7d,0xa7},{  0x1e,0x11,0x70,0xac}, 
+{ 0x34,0x2e,0x53,0x9d},{  0x3a,0x27,0x5e,0x96},{  0x28,0x3c,0x49,0x8b},{  0x26,0x35,0x44,0x80}, 
+{ 0x7c,0x42,0x0f,0xe9},{  0x72,0x4b,0x02,0xe2},{  0x60,0x50,0x15,0xff},{  0x6e,0x59,0x18,0xf4}, 
+{ 0x44,0x66,0x3b,0xc5},{  0x4a,0x6f,0x36,0xce},{  0x58,0x74,0x21,0xd3},{  0x56,0x7d,0x2c,0xd8}, 
+{ 0x37,0xa1,0x0c,0x7a},{  0x39,0xa8,0x01,0x71},{  0x2b,0xb3,0x16,0x6c},{  0x25,0xba,0x1b,0x67}, 
+{ 0x0f,0x85,0x38,0x56},{  0x01,0x8c,0x35,0x5d},{  0x13,0x97,0x22,0x40},{  0x1d,0x9e,0x2f,0x4b}, 
+{ 0x47,0xe9,0x64,0x22},{  0x49,0xe0,0x69,0x29},{  0x5b,0xfb,0x7e,0x34},{  0x55,0xf2,0x73,0x3f}, 
+{ 0x7f,0xcd,0x50,0x0e},{  0x71,0xc4,0x5d,0x05},{  0x63,0xdf,0x4a,0x18},{  0x6d,0xd6,0x47,0x13}, 
+{ 0xd7,0x31,0xdc,0xca},{  0xd9,0x38,0xd1,0xc1},{  0xcb,0x23,0xc6,0xdc},{  0xc5,0x2a,0xcb,0xd7}, 
+{ 0xef,0x15,0xe8,0xe6},{  0xe1,0x1c,0xe5,0xed},{  0xf3,0x07,0xf2,0xf0},{  0xfd,0x0e,0xff,0xfb}, 
+{ 0xa7,0x79,0xb4,0x92},{  0xa9,0x70,0xb9,0x99},{  0xbb,0x6b,0xae,0x84},{  0xb5,0x62,0xa3,0x8f}, 
+{ 0x9f,0x5d,0x80,0xbe},{  0x91,0x54,0x8d,0xb5},{  0x83,0x4f,0x9a,0xa8},{  0x8d,0x46,0x97,0xa3 } 
+};
+
+word8 U2[256][4] = {
+{ 0x00,0x00,0x00,0x00},{  0x0b,0x0e,0x09,0x0d},{  0x16,0x1c,0x12,0x1a},{  0x1d,0x12,0x1b,0x17}, 
+{ 0x2c,0x38,0x24,0x34},{  0x27,0x36,0x2d,0x39},{  0x3a,0x24,0x36,0x2e},{  0x31,0x2a,0x3f,0x23}, 
+{ 0x58,0x70,0x48,0x68},{  0x53,0x7e,0x41,0x65},{  0x4e,0x6c,0x5a,0x72},{  0x45,0x62,0x53,0x7f}, 
+{ 0x74,0x48,0x6c,0x5c},{  0x7f,0x46,0x65,0x51},{  0x62,0x54,0x7e,0x46},{  0x69,0x5a,0x77,0x4b}, 
+{ 0xb0,0xe0,0x90,0xd0},{  0xbb,0xee,0x99,0xdd},{  0xa6,0xfc,0x82,0xca},{  0xad,0xf2,0x8b,0xc7}, 
+{ 0x9c,0xd8,0xb4,0xe4},{  0x97,0xd6,0xbd,0xe9},{  0x8a,0xc4,0xa6,0xfe},{  0x81,0xca,0xaf,0xf3}, 
+{ 0xe8,0x90,0xd8,0xb8},{  0xe3,0x9e,0xd1,0xb5},{  0xfe,0x8c,0xca,0xa2},{  0xf5,0x82,0xc3,0xaf}, 
+{ 0xc4,0xa8,0xfc,0x8c},{  0xcf,0xa6,0xf5,0x81},{  0xd2,0xb4,0xee,0x96},{  0xd9,0xba,0xe7,0x9b}, 
+{ 0x7b,0xdb,0x3b,0xbb},{  0x70,0xd5,0x32,0xb6},{  0x6d,0xc7,0x29,0xa1},{  0x66,0xc9,0x20,0xac}, 
+{ 0x57,0xe3,0x1f,0x8f},{  0x5c,0xed,0x16,0x82},{  0x41,0xff,0x0d,0x95},{  0x4a,0xf1,0x04,0x98}, 
+{ 0x23,0xab,0x73,0xd3},{  0x28,0xa5,0x7a,0xde},{  0x35,0xb7,0x61,0xc9},{  0x3e,0xb9,0x68,0xc4}, 
+{ 0x0f,0x93,0x57,0xe7},{  0x04,0x9d,0x5e,0xea},{  0x19,0x8f,0x45,0xfd},{  0x12,0x81,0x4c,0xf0}, 
+{ 0xcb,0x3b,0xab,0x6b},{  0xc0,0x35,0xa2,0x66},{  0xdd,0x27,0xb9,0x71},{  0xd6,0x29,0xb0,0x7c}, 
+{ 0xe7,0x03,0x8f,0x5f},{  0xec,0x0d,0x86,0x52},{  0xf1,0x1f,0x9d,0x45},{  0xfa,0x11,0x94,0x48}, 
+{ 0x93,0x4b,0xe3,0x03},{  0x98,0x45,0xea,0x0e},{  0x85,0x57,0xf1,0x19},{  0x8e,0x59,0xf8,0x14}, 
+{ 0xbf,0x73,0xc7,0x37},{  0xb4,0x7d,0xce,0x3a},{  0xa9,0x6f,0xd5,0x2d},{  0xa2,0x61,0xdc,0x20}, 
+{ 0xf6,0xad,0x76,0x6d},{  0xfd,0xa3,0x7f,0x60},{  0xe0,0xb1,0x64,0x77},{  0xeb,0xbf,0x6d,0x7a}, 
+{ 0xda,0x95,0x52,0x59},{  0xd1,0x9b,0x5b,0x54},{  0xcc,0x89,0x40,0x43},{  0xc7,0x87,0x49,0x4e}, 
+{ 0xae,0xdd,0x3e,0x05},{  0xa5,0xd3,0x37,0x08},{  0xb8,0xc1,0x2c,0x1f},{  0xb3,0xcf,0x25,0x12}, 
+{ 0x82,0xe5,0x1a,0x31},{  0x89,0xeb,0x13,0x3c},{  0x94,0xf9,0x08,0x2b},{  0x9f,0xf7,0x01,0x26}, 
+{ 0x46,0x4d,0xe6,0xbd},{  0x4d,0x43,0xef,0xb0},{  0x50,0x51,0xf4,0xa7},{  0x5b,0x5f,0xfd,0xaa}, 
+{ 0x6a,0x75,0xc2,0x89},{  0x61,0x7b,0xcb,0x84},{  0x7c,0x69,0xd0,0x93},{  0x77,0x67,0xd9,0x9e}, 
+{ 0x1e,0x3d,0xae,0xd5},{  0x15,0x33,0xa7,0xd8},{  0x08,0x21,0xbc,0xcf},{  0x03,0x2f,0xb5,0xc2}, 
+{ 0x32,0x05,0x8a,0xe1},{  0x39,0x0b,0x83,0xec},{  0x24,0x19,0x98,0xfb},{  0x2f,0x17,0x91,0xf6}, 
+{ 0x8d,0x76,0x4d,0xd6},{  0x86,0x78,0x44,0xdb},{  0x9b,0x6a,0x5f,0xcc},{  0x90,0x64,0x56,0xc1}, 
+{ 0xa1,0x4e,0x69,0xe2},{  0xaa,0x40,0x60,0xef},{  0xb7,0x52,0x7b,0xf8},{  0xbc,0x5c,0x72,0xf5}, 
+{ 0xd5,0x06,0x05,0xbe},{  0xde,0x08,0x0c,0xb3},{  0xc3,0x1a,0x17,0xa4},{  0xc8,0x14,0x1e,0xa9}, 
+{ 0xf9,0x3e,0x21,0x8a},{  0xf2,0x30,0x28,0x87},{  0xef,0x22,0x33,0x90},{  0xe4,0x2c,0x3a,0x9d}, 
+{ 0x3d,0x96,0xdd,0x06},{  0x36,0x98,0xd4,0x0b},{  0x2b,0x8a,0xcf,0x1c},{  0x20,0x84,0xc6,0x11}, 
+{ 0x11,0xae,0xf9,0x32},{  0x1a,0xa0,0xf0,0x3f},{  0x07,0xb2,0xeb,0x28},{  0x0c,0xbc,0xe2,0x25}, 
+{ 0x65,0xe6,0x95,0x6e},{  0x6e,0xe8,0x9c,0x63},{  0x73,0xfa,0x87,0x74},{  0x78,0xf4,0x8e,0x79}, 
+{ 0x49,0xde,0xb1,0x5a},{  0x42,0xd0,0xb8,0x57},{  0x5f,0xc2,0xa3,0x40},{  0x54,0xcc,0xaa,0x4d}, 
+{ 0xf7,0x41,0xec,0xda},{  0xfc,0x4f,0xe5,0xd7},{  0xe1,0x5d,0xfe,0xc0},{  0xea,0x53,0xf7,0xcd}, 
+{ 0xdb,0x79,0xc8,0xee},{  0xd0,0x77,0xc1,0xe3},{  0xcd,0x65,0xda,0xf4},{  0xc6,0x6b,0xd3,0xf9}, 
+{ 0xaf,0x31,0xa4,0xb2},{  0xa4,0x3f,0xad,0xbf},{  0xb9,0x2d,0xb6,0xa8},{  0xb2,0x23,0xbf,0xa5}, 
+{ 0x83,0x09,0x80,0x86},{  0x88,0x07,0x89,0x8b},{  0x95,0x15,0x92,0x9c},{  0x9e,0x1b,0x9b,0x91}, 
+{ 0x47,0xa1,0x7c,0x0a},{  0x4c,0xaf,0x75,0x07},{  0x51,0xbd,0x6e,0x10},{  0x5a,0xb3,0x67,0x1d}, 
+{ 0x6b,0x99,0x58,0x3e},{  0x60,0x97,0x51,0x33},{  0x7d,0x85,0x4a,0x24},{  0x76,0x8b,0x43,0x29}, 
+{ 0x1f,0xd1,0x34,0x62},{  0x14,0xdf,0x3d,0x6f},{  0x09,0xcd,0x26,0x78},{  0x02,0xc3,0x2f,0x75}, 
+{ 0x33,0xe9,0x10,0x56},{  0x38,0xe7,0x19,0x5b},{  0x25,0xf5,0x02,0x4c},{  0x2e,0xfb,0x0b,0x41}, 
+{ 0x8c,0x9a,0xd7,0x61},{  0x87,0x94,0xde,0x6c},{  0x9a,0x86,0xc5,0x7b},{  0x91,0x88,0xcc,0x76}, 
+{ 0xa0,0xa2,0xf3,0x55},{  0xab,0xac,0xfa,0x58},{  0xb6,0xbe,0xe1,0x4f},{  0xbd,0xb0,0xe8,0x42}, 
+{ 0xd4,0xea,0x9f,0x09},{  0xdf,0xe4,0x96,0x04},{  0xc2,0xf6,0x8d,0x13},{  0xc9,0xf8,0x84,0x1e}, 
+{ 0xf8,0xd2,0xbb,0x3d},{  0xf3,0xdc,0xb2,0x30},{  0xee,0xce,0xa9,0x27},{  0xe5,0xc0,0xa0,0x2a}, 
+{ 0x3c,0x7a,0x47,0xb1},{  0x37,0x74,0x4e,0xbc},{  0x2a,0x66,0x55,0xab},{  0x21,0x68,0x5c,0xa6}, 
+{ 0x10,0x42,0x63,0x85},{  0x1b,0x4c,0x6a,0x88},{  0x06,0x5e,0x71,0x9f},{  0x0d,0x50,0x78,0x92}, 
+{ 0x64,0x0a,0x0f,0xd9},{  0x6f,0x04,0x06,0xd4},{  0x72,0x16,0x1d,0xc3},{  0x79,0x18,0x14,0xce}, 
+{ 0x48,0x32,0x2b,0xed},{  0x43,0x3c,0x22,0xe0},{  0x5e,0x2e,0x39,0xf7},{  0x55,0x20,0x30,0xfa}, 
+{ 0x01,0xec,0x9a,0xb7},{  0x0a,0xe2,0x93,0xba},{  0x17,0xf0,0x88,0xad},{  0x1c,0xfe,0x81,0xa0}, 
+{ 0x2d,0xd4,0xbe,0x83},{  0x26,0xda,0xb7,0x8e},{  0x3b,0xc8,0xac,0x99},{  0x30,0xc6,0xa5,0x94}, 
+{ 0x59,0x9c,0xd2,0xdf},{  0x52,0x92,0xdb,0xd2},{  0x4f,0x80,0xc0,0xc5},{  0x44,0x8e,0xc9,0xc8}, 
+{ 0x75,0xa4,0xf6,0xeb},{  0x7e,0xaa,0xff,0xe6},{  0x63,0xb8,0xe4,0xf1},{  0x68,0xb6,0xed,0xfc}, 
+{ 0xb1,0x0c,0x0a,0x67},{  0xba,0x02,0x03,0x6a},{  0xa7,0x10,0x18,0x7d},{  0xac,0x1e,0x11,0x70}, 
+{ 0x9d,0x34,0x2e,0x53},{  0x96,0x3a,0x27,0x5e},{  0x8b,0x28,0x3c,0x49},{  0x80,0x26,0x35,0x44}, 
+{ 0xe9,0x7c,0x42,0x0f},{  0xe2,0x72,0x4b,0x02},{  0xff,0x60,0x50,0x15},{  0xf4,0x6e,0x59,0x18}, 
+{ 0xc5,0x44,0x66,0x3b},{  0xce,0x4a,0x6f,0x36},{  0xd3,0x58,0x74,0x21},{  0xd8,0x56,0x7d,0x2c}, 
+{ 0x7a,0x37,0xa1,0x0c},{  0x71,0x39,0xa8,0x01},{  0x6c,0x2b,0xb3,0x16},{  0x67,0x25,0xba,0x1b}, 
+{ 0x56,0x0f,0x85,0x38},{  0x5d,0x01,0x8c,0x35},{  0x40,0x13,0x97,0x22},{  0x4b,0x1d,0x9e,0x2f}, 
+{ 0x22,0x47,0xe9,0x64},{  0x29,0x49,0xe0,0x69},{  0x34,0x5b,0xfb,0x7e},{  0x3f,0x55,0xf2,0x73}, 
+{ 0x0e,0x7f,0xcd,0x50},{  0x05,0x71,0xc4,0x5d},{  0x18,0x63,0xdf,0x4a},{  0x13,0x6d,0xd6,0x47}, 
+{ 0xca,0xd7,0x31,0xdc},{  0xc1,0xd9,0x38,0xd1},{  0xdc,0xcb,0x23,0xc6},{  0xd7,0xc5,0x2a,0xcb}, 
+{ 0xe6,0xef,0x15,0xe8},{  0xed,0xe1,0x1c,0xe5},{  0xf0,0xf3,0x07,0xf2},{  0xfb,0xfd,0x0e,0xff}, 
+{ 0x92,0xa7,0x79,0xb4},{  0x99,0xa9,0x70,0xb9},{  0x84,0xbb,0x6b,0xae},{  0x8f,0xb5,0x62,0xa3}, 
+{ 0xbe,0x9f,0x5d,0x80},{  0xb5,0x91,0x54,0x8d},{  0xa8,0x83,0x4f,0x9a},{  0xa3,0x8d,0x46,0x97 } 
+};
+
+word8 U3[256][4] = {
+{ 0x00,0x00,0x00,0x00},{  0x0d,0x0b,0x0e,0x09},{  0x1a,0x16,0x1c,0x12},{  0x17,0x1d,0x12,0x1b}, 
+{ 0x34,0x2c,0x38,0x24},{  0x39,0x27,0x36,0x2d},{  0x2e,0x3a,0x24,0x36},{  0x23,0x31,0x2a,0x3f}, 
+{ 0x68,0x58,0x70,0x48},{  0x65,0x53,0x7e,0x41},{  0x72,0x4e,0x6c,0x5a},{  0x7f,0x45,0x62,0x53}, 
+{ 0x5c,0x74,0x48,0x6c},{  0x51,0x7f,0x46,0x65},{  0x46,0x62,0x54,0x7e},{  0x4b,0x69,0x5a,0x77}, 
+{ 0xd0,0xb0,0xe0,0x90},{  0xdd,0xbb,0xee,0x99},{  0xca,0xa6,0xfc,0x82},{  0xc7,0xad,0xf2,0x8b}, 
+{ 0xe4,0x9c,0xd8,0xb4},{  0xe9,0x97,0xd6,0xbd},{  0xfe,0x8a,0xc4,0xa6},{  0xf3,0x81,0xca,0xaf}, 
+{ 0xb8,0xe8,0x90,0xd8},{  0xb5,0xe3,0x9e,0xd1},{  0xa2,0xfe,0x8c,0xca},{  0xaf,0xf5,0x82,0xc3}, 
+{ 0x8c,0xc4,0xa8,0xfc},{  0x81,0xcf,0xa6,0xf5},{  0x96,0xd2,0xb4,0xee},{  0x9b,0xd9,0xba,0xe7}, 
+{ 0xbb,0x7b,0xdb,0x3b},{  0xb6,0x70,0xd5,0x32},{  0xa1,0x6d,0xc7,0x29},{  0xac,0x66,0xc9,0x20}, 
+{ 0x8f,0x57,0xe3,0x1f},{  0x82,0x5c,0xed,0x16},{  0x95,0x41,0xff,0x0d},{  0x98,0x4a,0xf1,0x04}, 
+{ 0xd3,0x23,0xab,0x73},{  0xde,0x28,0xa5,0x7a},{  0xc9,0x35,0xb7,0x61},{  0xc4,0x3e,0xb9,0x68}, 
+{ 0xe7,0x0f,0x93,0x57},{  0xea,0x04,0x9d,0x5e},{  0xfd,0x19,0x8f,0x45},{  0xf0,0x12,0x81,0x4c}, 
+{ 0x6b,0xcb,0x3b,0xab},{  0x66,0xc0,0x35,0xa2},{  0x71,0xdd,0x27,0xb9},{  0x7c,0xd6,0x29,0xb0}, 
+{ 0x5f,0xe7,0x03,0x8f},{  0x52,0xec,0x0d,0x86},{  0x45,0xf1,0x1f,0x9d},{  0x48,0xfa,0x11,0x94}, 
+{ 0x03,0x93,0x4b,0xe3},{  0x0e,0x98,0x45,0xea},{  0x19,0x85,0x57,0xf1},{  0x14,0x8e,0x59,0xf8}, 
+{ 0x37,0xbf,0x73,0xc7},{  0x3a,0xb4,0x7d,0xce},{  0x2d,0xa9,0x6f,0xd5},{  0x20,0xa2,0x61,0xdc}, 
+{ 0x6d,0xf6,0xad,0x76},{  0x60,0xfd,0xa3,0x7f},{  0x77,0xe0,0xb1,0x64},{  0x7a,0xeb,0xbf,0x6d}, 
+{ 0x59,0xda,0x95,0x52},{  0x54,0xd1,0x9b,0x5b},{  0x43,0xcc,0x89,0x40},{  0x4e,0xc7,0x87,0x49}, 
+{ 0x05,0xae,0xdd,0x3e},{  0x08,0xa5,0xd3,0x37},{  0x1f,0xb8,0xc1,0x2c},{  0x12,0xb3,0xcf,0x25}, 
+{ 0x31,0x82,0xe5,0x1a},{  0x3c,0x89,0xeb,0x13},{  0x2b,0x94,0xf9,0x08},{  0x26,0x9f,0xf7,0x01}, 
+{ 0xbd,0x46,0x4d,0xe6},{  0xb0,0x4d,0x43,0xef},{  0xa7,0x50,0x51,0xf4},{  0xaa,0x5b,0x5f,0xfd}, 
+{ 0x89,0x6a,0x75,0xc2},{  0x84,0x61,0x7b,0xcb},{  0x93,0x7c,0x69,0xd0},{  0x9e,0x77,0x67,0xd9}, 
+{ 0xd5,0x1e,0x3d,0xae},{  0xd8,0x15,0x33,0xa7},{  0xcf,0x08,0x21,0xbc},{  0xc2,0x03,0x2f,0xb5}, 
+{ 0xe1,0x32,0x05,0x8a},{  0xec,0x39,0x0b,0x83},{  0xfb,0x24,0x19,0x98},{  0xf6,0x2f,0x17,0x91}, 
+{ 0xd6,0x8d,0x76,0x4d},{  0xdb,0x86,0x78,0x44},{  0xcc,0x9b,0x6a,0x5f},{  0xc1,0x90,0x64,0x56}, 
+{ 0xe2,0xa1,0x4e,0x69},{  0xef,0xaa,0x40,0x60},{  0xf8,0xb7,0x52,0x7b},{  0xf5,0xbc,0x5c,0x72}, 
+{ 0xbe,0xd5,0x06,0x05},{  0xb3,0xde,0x08,0x0c},{  0xa4,0xc3,0x1a,0x17},{  0xa9,0xc8,0x14,0x1e}, 
+{ 0x8a,0xf9,0x3e,0x21},{  0x87,0xf2,0x30,0x28},{  0x90,0xef,0x22,0x33},{  0x9d,0xe4,0x2c,0x3a}, 
+{ 0x06,0x3d,0x96,0xdd},{  0x0b,0x36,0x98,0xd4},{  0x1c,0x2b,0x8a,0xcf},{  0x11,0x20,0x84,0xc6}, 
+{ 0x32,0x11,0xae,0xf9},{  0x3f,0x1a,0xa0,0xf0},{  0x28,0x07,0xb2,0xeb},{  0x25,0x0c,0xbc,0xe2}, 
+{ 0x6e,0x65,0xe6,0x95},{  0x63,0x6e,0xe8,0x9c},{  0x74,0x73,0xfa,0x87},{  0x79,0x78,0xf4,0x8e}, 
+{ 0x5a,0x49,0xde,0xb1},{  0x57,0x42,0xd0,0xb8},{  0x40,0x5f,0xc2,0xa3},{  0x4d,0x54,0xcc,0xaa}, 
+{ 0xda,0xf7,0x41,0xec},{  0xd7,0xfc,0x4f,0xe5},{  0xc0,0xe1,0x5d,0xfe},{  0xcd,0xea,0x53,0xf7}, 
+{ 0xee,0xdb,0x79,0xc8},{  0xe3,0xd0,0x77,0xc1},{  0xf4,0xcd,0x65,0xda},{  0xf9,0xc6,0x6b,0xd3}, 
+{ 0xb2,0xaf,0x31,0xa4},{  0xbf,0xa4,0x3f,0xad},{  0xa8,0xb9,0x2d,0xb6},{  0xa5,0xb2,0x23,0xbf}, 
+{ 0x86,0x83,0x09,0x80},{  0x8b,0x88,0x07,0x89},{  0x9c,0x95,0x15,0x92},{  0x91,0x9e,0x1b,0x9b}, 
+{ 0x0a,0x47,0xa1,0x7c},{  0x07,0x4c,0xaf,0x75},{  0x10,0x51,0xbd,0x6e},{  0x1d,0x5a,0xb3,0x67}, 
+{ 0x3e,0x6b,0x99,0x58},{  0x33,0x60,0x97,0x51},{  0x24,0x7d,0x85,0x4a},{  0x29,0x76,0x8b,0x43}, 
+{ 0x62,0x1f,0xd1,0x34},{  0x6f,0x14,0xdf,0x3d},{  0x78,0x09,0xcd,0x26},{  0x75,0x02,0xc3,0x2f}, 
+{ 0x56,0x33,0xe9,0x10},{  0x5b,0x38,0xe7,0x19},{  0x4c,0x25,0xf5,0x02},{  0x41,0x2e,0xfb,0x0b}, 
+{ 0x61,0x8c,0x9a,0xd7},{  0x6c,0x87,0x94,0xde},{  0x7b,0x9a,0x86,0xc5},{  0x76,0x91,0x88,0xcc}, 
+{ 0x55,0xa0,0xa2,0xf3},{  0x58,0xab,0xac,0xfa},{  0x4f,0xb6,0xbe,0xe1},{  0x42,0xbd,0xb0,0xe8}, 
+{ 0x09,0xd4,0xea,0x9f},{  0x04,0xdf,0xe4,0x96},{  0x13,0xc2,0xf6,0x8d},{  0x1e,0xc9,0xf8,0x84}, 
+{ 0x3d,0xf8,0xd2,0xbb},{  0x30,0xf3,0xdc,0xb2},{  0x27,0xee,0xce,0xa9},{  0x2a,0xe5,0xc0,0xa0}, 
+{ 0xb1,0x3c,0x7a,0x47},{  0xbc,0x37,0x74,0x4e},{  0xab,0x2a,0x66,0x55},{  0xa6,0x21,0x68,0x5c}, 
+{ 0x85,0x10,0x42,0x63},{  0x88,0x1b,0x4c,0x6a},{  0x9f,0x06,0x5e,0x71},{  0x92,0x0d,0x50,0x78}, 
+{ 0xd9,0x64,0x0a,0x0f},{  0xd4,0x6f,0x04,0x06},{  0xc3,0x72,0x16,0x1d},{  0xce,0x79,0x18,0x14}, 
+{ 0xed,0x48,0x32,0x2b},{  0xe0,0x43,0x3c,0x22},{  0xf7,0x5e,0x2e,0x39},{  0xfa,0x55,0x20,0x30}, 
+{ 0xb7,0x01,0xec,0x9a},{  0xba,0x0a,0xe2,0x93},{  0xad,0x17,0xf0,0x88},{  0xa0,0x1c,0xfe,0x81}, 
+{ 0x83,0x2d,0xd4,0xbe},{  0x8e,0x26,0xda,0xb7},{  0x99,0x3b,0xc8,0xac},{  0x94,0x30,0xc6,0xa5}, 
+{ 0xdf,0x59,0x9c,0xd2},{  0xd2,0x52,0x92,0xdb},{  0xc5,0x4f,0x80,0xc0},{  0xc8,0x44,0x8e,0xc9}, 
+{ 0xeb,0x75,0xa4,0xf6},{  0xe6,0x7e,0xaa,0xff},{  0xf1,0x63,0xb8,0xe4},{  0xfc,0x68,0xb6,0xed}, 
+{ 0x67,0xb1,0x0c,0x0a},{  0x6a,0xba,0x02,0x03},{  0x7d,0xa7,0x10,0x18},{  0x70,0xac,0x1e,0x11}, 
+{ 0x53,0x9d,0x34,0x2e},{  0x5e,0x96,0x3a,0x27},{  0x49,0x8b,0x28,0x3c},{  0x44,0x80,0x26,0x35}, 
+{ 0x0f,0xe9,0x7c,0x42},{  0x02,0xe2,0x72,0x4b},{  0x15,0xff,0x60,0x50},{  0x18,0xf4,0x6e,0x59}, 
+{ 0x3b,0xc5,0x44,0x66},{  0x36,0xce,0x4a,0x6f},{  0x21,0xd3,0x58,0x74},{  0x2c,0xd8,0x56,0x7d}, 
+{ 0x0c,0x7a,0x37,0xa1},{  0x01,0x71,0x39,0xa8},{  0x16,0x6c,0x2b,0xb3},{  0x1b,0x67,0x25,0xba}, 
+{ 0x38,0x56,0x0f,0x85},{  0x35,0x5d,0x01,0x8c},{  0x22,0x40,0x13,0x97},{  0x2f,0x4b,0x1d,0x9e}, 
+{ 0x64,0x22,0x47,0xe9},{  0x69,0x29,0x49,0xe0},{  0x7e,0x34,0x5b,0xfb},{  0x73,0x3f,0x55,0xf2}, 
+{ 0x50,0x0e,0x7f,0xcd},{  0x5d,0x05,0x71,0xc4},{  0x4a,0x18,0x63,0xdf},{  0x47,0x13,0x6d,0xd6}, 
+{ 0xdc,0xca,0xd7,0x31},{  0xd1,0xc1,0xd9,0x38},{  0xc6,0xdc,0xcb,0x23},{  0xcb,0xd7,0xc5,0x2a}, 
+{ 0xe8,0xe6,0xef,0x15},{  0xe5,0xed,0xe1,0x1c},{  0xf2,0xf0,0xf3,0x07},{  0xff,0xfb,0xfd,0x0e}, 
+{ 0xb4,0x92,0xa7,0x79},{  0xb9,0x99,0xa9,0x70},{  0xae,0x84,0xbb,0x6b},{  0xa3,0x8f,0xb5,0x62}, 
+{ 0x80,0xbe,0x9f,0x5d},{  0x8d,0xb5,0x91,0x54},{  0x9a,0xa8,0x83,0x4f},{  0x97,0xa3,0x8d,0x46 } 
+};
+
+word8 U4[256][4] = {
+{ 0x00,0x00,0x00,0x00},{  0x09,0x0d,0x0b,0x0e},{  0x12,0x1a,0x16,0x1c},{  0x1b,0x17,0x1d,0x12}, 
+{ 0x24,0x34,0x2c,0x38},{  0x2d,0x39,0x27,0x36},{  0x36,0x2e,0x3a,0x24},{  0x3f,0x23,0x31,0x2a}, 
+{ 0x48,0x68,0x58,0x70},{  0x41,0x65,0x53,0x7e},{  0x5a,0x72,0x4e,0x6c},{  0x53,0x7f,0x45,0x62}, 
+{ 0x6c,0x5c,0x74,0x48},{  0x65,0x51,0x7f,0x46},{  0x7e,0x46,0x62,0x54},{  0x77,0x4b,0x69,0x5a}, 
+{ 0x90,0xd0,0xb0,0xe0},{  0x99,0xdd,0xbb,0xee},{  0x82,0xca,0xa6,0xfc},{  0x8b,0xc7,0xad,0xf2}, 
+{ 0xb4,0xe4,0x9c,0xd8},{  0xbd,0xe9,0x97,0xd6},{  0xa6,0xfe,0x8a,0xc4},{  0xaf,0xf3,0x81,0xca}, 
+{ 0xd8,0xb8,0xe8,0x90},{  0xd1,0xb5,0xe3,0x9e},{  0xca,0xa2,0xfe,0x8c},{  0xc3,0xaf,0xf5,0x82}, 
+{ 0xfc,0x8c,0xc4,0xa8},{  0xf5,0x81,0xcf,0xa6},{  0xee,0x96,0xd2,0xb4},{  0xe7,0x9b,0xd9,0xba}, 
+{ 0x3b,0xbb,0x7b,0xdb},{  0x32,0xb6,0x70,0xd5},{  0x29,0xa1,0x6d,0xc7},{  0x20,0xac,0x66,0xc9}, 
+{ 0x1f,0x8f,0x57,0xe3},{  0x16,0x82,0x5c,0xed},{  0x0d,0x95,0x41,0xff},{  0x04,0x98,0x4a,0xf1}, 
+{ 0x73,0xd3,0x23,0xab},{  0x7a,0xde,0x28,0xa5},{  0x61,0xc9,0x35,0xb7},{  0x68,0xc4,0x3e,0xb9}, 
+{ 0x57,0xe7,0x0f,0x93},{  0x5e,0xea,0x04,0x9d},{  0x45,0xfd,0x19,0x8f},{  0x4c,0xf0,0x12,0x81}, 
+{ 0xab,0x6b,0xcb,0x3b},{  0xa2,0x66,0xc0,0x35},{  0xb9,0x71,0xdd,0x27},{  0xb0,0x7c,0xd6,0x29}, 
+{ 0x8f,0x5f,0xe7,0x03},{  0x86,0x52,0xec,0x0d},{  0x9d,0x45,0xf1,0x1f},{  0x94,0x48,0xfa,0x11}, 
+{ 0xe3,0x03,0x93,0x4b},{  0xea,0x0e,0x98,0x45},{  0xf1,0x19,0x85,0x57},{  0xf8,0x14,0x8e,0x59}, 
+{ 0xc7,0x37,0xbf,0x73},{  0xce,0x3a,0xb4,0x7d},{  0xd5,0x2d,0xa9,0x6f},{  0xdc,0x20,0xa2,0x61}, 
+{ 0x76,0x6d,0xf6,0xad},{  0x7f,0x60,0xfd,0xa3},{  0x64,0x77,0xe0,0xb1},{  0x6d,0x7a,0xeb,0xbf}, 
+{ 0x52,0x59,0xda,0x95},{  0x5b,0x54,0xd1,0x9b},{  0x40,0x43,0xcc,0x89},{  0x49,0x4e,0xc7,0x87}, 
+{ 0x3e,0x05,0xae,0xdd},{  0x37,0x08,0xa5,0xd3},{  0x2c,0x1f,0xb8,0xc1},{  0x25,0x12,0xb3,0xcf}, 
+{ 0x1a,0x31,0x82,0xe5},{  0x13,0x3c,0x89,0xeb},{  0x08,0x2b,0x94,0xf9},{  0x01,0x26,0x9f,0xf7}, 
+{ 0xe6,0xbd,0x46,0x4d},{  0xef,0xb0,0x4d,0x43},{  0xf4,0xa7,0x50,0x51},{  0xfd,0xaa,0x5b,0x5f}, 
+{ 0xc2,0x89,0x6a,0x75},{  0xcb,0x84,0x61,0x7b},{  0xd0,0x93,0x7c,0x69},{  0xd9,0x9e,0x77,0x67}, 
+{ 0xae,0xd5,0x1e,0x3d},{  0xa7,0xd8,0x15,0x33},{  0xbc,0xcf,0x08,0x21},{  0xb5,0xc2,0x03,0x2f}, 
+{ 0x8a,0xe1,0x32,0x05},{  0x83,0xec,0x39,0x0b},{  0x98,0xfb,0x24,0x19},{  0x91,0xf6,0x2f,0x17}, 
+{ 0x4d,0xd6,0x8d,0x76},{  0x44,0xdb,0x86,0x78},{  0x5f,0xcc,0x9b,0x6a},{  0x56,0xc1,0x90,0x64}, 
+{ 0x69,0xe2,0xa1,0x4e},{  0x60,0xef,0xaa,0x40},{  0x7b,0xf8,0xb7,0x52},{  0x72,0xf5,0xbc,0x5c}, 
+{ 0x05,0xbe,0xd5,0x06},{  0x0c,0xb3,0xde,0x08},{  0x17,0xa4,0xc3,0x1a},{  0x1e,0xa9,0xc8,0x14}, 
+{ 0x21,0x8a,0xf9,0x3e},{  0x28,0x87,0xf2,0x30},{  0x33,0x90,0xef,0x22},{  0x3a,0x9d,0xe4,0x2c}, 
+{ 0xdd,0x06,0x3d,0x96},{  0xd4,0x0b,0x36,0x98},{  0xcf,0x1c,0x2b,0x8a},{  0xc6,0x11,0x20,0x84}, 
+{ 0xf9,0x32,0x11,0xae},{  0xf0,0x3f,0x1a,0xa0},{  0xeb,0x28,0x07,0xb2},{  0xe2,0x25,0x0c,0xbc}, 
+{ 0x95,0x6e,0x65,0xe6},{  0x9c,0x63,0x6e,0xe8},{  0x87,0x74,0x73,0xfa},{  0x8e,0x79,0x78,0xf4}, 
+{ 0xb1,0x5a,0x49,0xde},{  0xb8,0x57,0x42,0xd0},{  0xa3,0x40,0x5f,0xc2},{  0xaa,0x4d,0x54,0xcc}, 
+{ 0xec,0xda,0xf7,0x41},{  0xe5,0xd7,0xfc,0x4f},{  0xfe,0xc0,0xe1,0x5d},{  0xf7,0xcd,0xea,0x53}, 
+{ 0xc8,0xee,0xdb,0x79},{  0xc1,0xe3,0xd0,0x77},{  0xda,0xf4,0xcd,0x65},{  0xd3,0xf9,0xc6,0x6b}, 
+{ 0xa4,0xb2,0xaf,0x31},{  0xad,0xbf,0xa4,0x3f},{  0xb6,0xa8,0xb9,0x2d},{  0xbf,0xa5,0xb2,0x23}, 
+{ 0x80,0x86,0x83,0x09},{  0x89,0x8b,0x88,0x07},{  0x92,0x9c,0x95,0x15},{  0x9b,0x91,0x9e,0x1b}, 
+{ 0x7c,0x0a,0x47,0xa1},{  0x75,0x07,0x4c,0xaf},{  0x6e,0x10,0x51,0xbd},{  0x67,0x1d,0x5a,0xb3}, 
+{ 0x58,0x3e,0x6b,0x99},{  0x51,0x33,0x60,0x97},{  0x4a,0x24,0x7d,0x85},{  0x43,0x29,0x76,0x8b}, 
+{ 0x34,0x62,0x1f,0xd1},{  0x3d,0x6f,0x14,0xdf},{  0x26,0x78,0x09,0xcd},{  0x2f,0x75,0x02,0xc3}, 
+{ 0x10,0x56,0x33,0xe9},{  0x19,0x5b,0x38,0xe7},{  0x02,0x4c,0x25,0xf5},{  0x0b,0x41,0x2e,0xfb}, 
+{ 0xd7,0x61,0x8c,0x9a},{  0xde,0x6c,0x87,0x94},{  0xc5,0x7b,0x9a,0x86},{  0xcc,0x76,0x91,0x88}, 
+{ 0xf3,0x55,0xa0,0xa2},{  0xfa,0x58,0xab,0xac},{  0xe1,0x4f,0xb6,0xbe},{  0xe8,0x42,0xbd,0xb0}, 
+{ 0x9f,0x09,0xd4,0xea},{  0x96,0x04,0xdf,0xe4},{  0x8d,0x13,0xc2,0xf6},{  0x84,0x1e,0xc9,0xf8}, 
+{ 0xbb,0x3d,0xf8,0xd2},{  0xb2,0x30,0xf3,0xdc},{  0xa9,0x27,0xee,0xce},{  0xa0,0x2a,0xe5,0xc0}, 
+{ 0x47,0xb1,0x3c,0x7a},{  0x4e,0xbc,0x37,0x74},{  0x55,0xab,0x2a,0x66},{  0x5c,0xa6,0x21,0x68}, 
+{ 0x63,0x85,0x10,0x42},{  0x6a,0x88,0x1b,0x4c},{  0x71,0x9f,0x06,0x5e},{  0x78,0x92,0x0d,0x50}, 
+{ 0x0f,0xd9,0x64,0x0a},{  0x06,0xd4,0x6f,0x04},{  0x1d,0xc3,0x72,0x16},{  0x14,0xce,0x79,0x18}, 
+{ 0x2b,0xed,0x48,0x32},{  0x22,0xe0,0x43,0x3c},{  0x39,0xf7,0x5e,0x2e},{  0x30,0xfa,0x55,0x20}, 
+{ 0x9a,0xb7,0x01,0xec},{  0x93,0xba,0x0a,0xe2},{  0x88,0xad,0x17,0xf0},{  0x81,0xa0,0x1c,0xfe}, 
+{ 0xbe,0x83,0x2d,0xd4},{  0xb7,0x8e,0x26,0xda},{  0xac,0x99,0x3b,0xc8},{  0xa5,0x94,0x30,0xc6}, 
+{ 0xd2,0xdf,0x59,0x9c},{  0xdb,0xd2,0x52,0x92},{  0xc0,0xc5,0x4f,0x80},{  0xc9,0xc8,0x44,0x8e}, 
+{ 0xf6,0xeb,0x75,0xa4},{  0xff,0xe6,0x7e,0xaa},{  0xe4,0xf1,0x63,0xb8},{  0xed,0xfc,0x68,0xb6}, 
+{ 0x0a,0x67,0xb1,0x0c},{  0x03,0x6a,0xba,0x02},{  0x18,0x7d,0xa7,0x10},{  0x11,0x70,0xac,0x1e}, 
+{ 0x2e,0x53,0x9d,0x34},{  0x27,0x5e,0x96,0x3a},{  0x3c,0x49,0x8b,0x28},{  0x35,0x44,0x80,0x26}, 
+{ 0x42,0x0f,0xe9,0x7c},{  0x4b,0x02,0xe2,0x72},{  0x50,0x15,0xff,0x60},{  0x59,0x18,0xf4,0x6e}, 
+{ 0x66,0x3b,0xc5,0x44},{  0x6f,0x36,0xce,0x4a},{  0x74,0x21,0xd3,0x58},{  0x7d,0x2c,0xd8,0x56}, 
+{ 0xa1,0x0c,0x7a,0x37},{  0xa8,0x01,0x71,0x39},{  0xb3,0x16,0x6c,0x2b},{  0xba,0x1b,0x67,0x25}, 
+{ 0x85,0x38,0x56,0x0f},{  0x8c,0x35,0x5d,0x01},{  0x97,0x22,0x40,0x13},{  0x9e,0x2f,0x4b,0x1d}, 
+{ 0xe9,0x64,0x22,0x47},{  0xe0,0x69,0x29,0x49},{  0xfb,0x7e,0x34,0x5b},{  0xf2,0x73,0x3f,0x55}, 
+{ 0xcd,0x50,0x0e,0x7f},{  0xc4,0x5d,0x05,0x71},{  0xdf,0x4a,0x18,0x63},{  0xd6,0x47,0x13,0x6d}, 
+{ 0x31,0xdc,0xca,0xd7},{  0x38,0xd1,0xc1,0xd9},{  0x23,0xc6,0xdc,0xcb},{  0x2a,0xcb,0xd7,0xc5}, 
+{ 0x15,0xe8,0xe6,0xef},{  0x1c,0xe5,0xed,0xe1},{  0x07,0xf2,0xf0,0xf3},{  0x0e,0xff,0xfb,0xfd}, 
+{ 0x79,0xb4,0x92,0xa7},{  0x70,0xb9,0x99,0xa9},{  0x6b,0xae,0x84,0xbb},{  0x62,0xa3,0x8f,0xb5},  
+{ 0x5d,0x80,0xbe,0x9f},{  0x54,0x8d,0xb5,0x91},{  0x4f,0x9a,0xa8,0x83},{  0x46,0x97,0xa3,0x8d }
+};
+
+word32 rcon[30] = { 
+  0x01,0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91
+};
Index: trunk/include/samhain.h
===================================================================
--- trunk/include/samhain.h	(revision 591)
+++ trunk/include/samhain.h	(revision 1)
@@ -28,30 +28,4 @@
 #endif
 
-#if defined(__GNUC__) && (__GNUC__ >= 4)
-#define SH_GNUC_SENTINEL __attribute__((__sentinel__))
-#else
-#define SH_GNUC_SENTINEL
-#endif
-
-#if defined(__GNUC__) && (__GNUC__ >= 3)
-#undef  SH_GNUC_PURE
-#define SH_GNUC_PURE     __attribute__((pure))
-#undef  SH_GNUC_CONST
-#define SH_GNUC_CONST	 __attribute__((const))
-#undef  SH_GNUC_NORETURN
-#define SH_GNUC_NORETURN __attribute__((noreturn))
-#undef  SH_GNUC_MALLOC
-#define SH_GNUC_MALLOC   __attribute__((malloc))
-#else
-#undef  SH_GNUC_PURE
-#define SH_GNUC_PURE
-#undef  SH_GNUC_CONST
-#define SH_GNUC_CONST
-#undef  SH_GNUC_NORETURN
-#define SH_GNUC_NORETURN
-#undef  SH_GNUC_MALLOC
-#define SH_GNUC_MALLOC
-#endif
-
 /**************************************************
  *
@@ -60,55 +34,18 @@
  **************************************************/
 
-/* IPv6 */
-#if defined(HAVE_GETNAMEINFO) && defined(HAVE_GETADDRINFO)
-
-#if defined(SH_COMPILE_STATIC) && defined(__linux__)
-#undef USE_IPVX
-#define SH_SOCKMAX 1
-#else
-
-#if defined(USE_IPV4)
-#undef USE_IPVX
-#else
-#define USE_IPVX 1
-#endif
-
-#define SH_SOCKMAX 8
-#endif
-
-#else
-#undef USE_IPVX
-#define SH_SOCKMAX 1
-#endif
-
-/* end IPv6 */
-
-/* Standard buffer sizes. 
- * IPv6 is 8 groups of 4 hex digits seperated by colons.
- */
-#define SH_IP_BUF        48
+#define REPLACE_OLD
+
+/* Standard buffer sizes.
+ */
 #define SH_MINIBUF       64
 #define SH_BUFSIZE     1024
 #define SH_MAXBUF      4096
 #define SH_PATHBUF      256
-#define SH_MSG_BUF    64512
-
-#define SH_ERRBUF_SIZE   64
-
-/* MAX_PATH_STORE must be >= KEY_LEN
- */
-#define MAX_PATH_STORE 12287
 
 /* Sizes for arrays (user, group, timestamp).
  */
-#define SOCKPASS_MAX 14
-#define USER_MAX     20
-#define GROUP_MAX    20
-#define TIM_MAX      32
-
-#define CMODE_SIZE   11
-
-#define ATTRBUF_SIZE 16
-#define ATTRBUF_USED 12
+#define USER_MAX  20
+#define GROUP_MAX 20
+#define TIM_MAX   32
 
 /* The number of bytes in a key,  
@@ -119,5 +56,4 @@
 #define KEY_LEN   48
 #define KEY_BLOCK 24
-#define KEYBUF_SIZE (KEY_LEN+1)
 
 /* The length of the compiled-in password.
@@ -125,32 +61,20 @@
 #define PW_LEN     8
 
+/* Buffer for privileged content.
+ */
+#define PRIV_MAX  4096   
+
+#undef  GOOD
+#define GOOD  1
+#undef  BAD
+#define BAD   0
+#undef  ON
+#define ON    1
+#undef  OFF
+#define OFF   0
 #undef  S_TRUE
 #define S_TRUE    1
 #undef  S_FALSE
 #define S_FALSE   0
-
-#undef  GOOD
-#define GOOD  S_TRUE
-#undef  BAD
-#define BAD   S_FALSE
-
-#define SH_SILENT_FULL 2
-#define SH_SILENT_STD  1
-
-
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#if !defined(HAVE_UINT16_T)
-#define UINT16 unsigned short
-#else
-#define UINT16 uint16_t
-#endif
-
-#if !defined(HAVE_UINT32_T)
 
 /* An unsigned integer guaranteed to be 32 bit.
@@ -165,15 +89,15 @@
 #define UINT32 unsigned short
 #define SINT32 short
-#else
-#error "No 32 bit integer type found"
-#endif
-
-#else
-#define UINT32 uint32_t
-#define SINT32 int32_t
-
-#endif
-
-#if !defined(HAVE_UINT64_T)
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#endif
+
+#if !defined(HAVE_INTTYPES_H) && !defined(HAVE_STDINT_H)
 
 #ifdef HAVE_LONG_LONG_64
@@ -183,5 +107,6 @@
 #define  UINT64 unsigned long
 #else
-#error "no 64bit type found"
+#define UINT64_IS_32
+#define  UINT64 unsigned long
 #endif
 #endif
@@ -194,11 +119,4 @@
 
 #define UBYTE unsigned char
-
-enum {
-  SH_TIGER192    = 0, 
-  SH_SHA1        = 1,
-  SH_MD5         = 2,
-  SH_SHA256      = 3
-};
 
 
@@ -208,51 +126,4 @@
   SH_CHECK_CHECK   = 2
 };
-
-#define SH_MOD_THREAD  1
-#define SH_MOD_ACTIVE  0
-#define SH_MOD_FAILED -1
-#define SH_MOD_OFFSET 10
-
-/* Flags for file status
- */
-#define SH_FFLAG_ALLIGNORE (1<<0)
-#define SH_FFLAG_VISITED   (1<<1)
-#define SH_FFLAG_CHECKED   (1<<3)
-#define SH_FFLAG_REPORTED  (1<<3)
-#define SH_FFLAG_SUIDCHK   (1<<4)
-#define SH_FFLAG_ENOENT    (1<<5)
-
-#define SH_FFLAG_ALLIGNORE_SET(a)   (((a) & SH_FFLAG_ALLIGNORE) != 0)
-#define SET_SH_FFLAG_ALLIGNORE(a)   ((a) |= SH_FFLAG_ALLIGNORE)
-#define CLEAR_SH_FFLAG_ALLIGNORE(a) ((a) &= ~SH_FFLAG_ALLIGNORE)
-
-#define SH_FFLAG_VISITED_SET(a)     (((a) & SH_FFLAG_VISITED) != 0)
-#define SET_SH_FFLAG_VISITED(a)     ((a) |= SH_FFLAG_VISITED)
-#define CLEAR_SH_FFLAG_VISITED(a)   ((a) &= ~SH_FFLAG_VISITED)
-
-#define SH_FFLAG_CHECKED_SET(a)     (((a) & SH_FFLAG_VISITED) != 0)
-#define SET_SH_FFLAG_CHECKED(a)     ((a) |= SH_FFLAG_VISITED)
-#define CLEAR_SH_FFLAG_CHECKED(a)   ((a) &= ~SH_FFLAG_VISITED)
-
-#define SH_FFLAG_REPORTED_SET(a)    (((a) & SH_FFLAG_REPORTED) != 0)
-#define SET_SH_FFLAG_REPORTED(a)    ((a) |= SH_FFLAG_REPORTED)
-#define CLEAR_SH_FFLAG_REPORTED(a)  ((a) &= ~SH_FFLAG_REPORTED)
-
-#define SH_FFLAG_SUIDCHK_SET(a)     (((a) & SH_FFLAG_SUIDCHK) != 0)
-#define SET_SH_FFLAG_SUIDCHK(a)     ((a) |= SH_FFLAG_SUIDCHK)
-#define CLEAR_SH_FFLAG_SUIDCHK(a)   ((a) &= ~SH_FFLAG_SUIDCHK)
-
-#define SH_FFLAG_ENOENT_SET(a)      (((a) & SH_FFLAG_ENOENT) != 0)
-#define SET_SH_FFLAG_ENOENT(a)      ((a) |= SH_FFLAG_ENOENT)
-#define CLEAR_SH_FFLAG_ENOENT(a)    ((a) &= ~SH_FFLAG_ENOENT)
-
-/* Flags for inotify
- */
-#define SH_INOTIFY_USE      (1<<0)
-#define SH_INOTIFY_DOSCAN   (1<<1)
-#define SH_INOTIFY_NEEDINIT (1<<2)
-#define SH_INOTIFY_INSCAN   (1<<3)
-#define SH_INOTIFY_IFUSED(a)   if ((sh.flag.inotify & SH_INOTIFY_USE) != 0) { a }
-
 
 /**************************************************
@@ -271,8 +142,5 @@
   SH_LEVEL_USER0       = 7,
   SH_LEVEL_USER1       = 8,
-  SH_LEVEL_USER2       = 9,
-  SH_LEVEL_USER3       = 10,
-  SH_LEVEL_USER4       = 11,
-  SH_LEVEL_PRELINK     = 12
+  SH_LEVEL_PRELINK     = 9
 };
 
@@ -316,7 +184,4 @@
   unsigned long   dirs_checked;  /* #dirs     last check */
   unsigned long   files_checked; /* #files    last check */
-  unsigned long   files_report;  /* #file reports        */
-  unsigned long   files_error;   /* #file access error   */
-  unsigned long   files_nodir;   /* #file not a directory*/
 } sh_sh_stat;
 
@@ -326,5 +191,4 @@
   int    update;                   /* update db                       */
   int    opts;                     /* reading cl options              */
-  int    started;                  /* finished with startup stuff     */
   int    isdaemon;                 /* daemon or not                   */
   int    loop;                     /* go in loop even if not daemon   */
@@ -338,8 +202,7 @@
   int    client_severity;          /* TRUE if client severity used    */
   int    client_class;             /* TRUE if client class used       */
-  int    hidefile;                 /* TRUE if file not shown in log   */
-  int    inotify;                  /* Flags for inotify               */
   int    audit;
   unsigned long aud_mask;
+  int    hidefile;                 /* TRUE if file not reveled in log */
 } sh_sh_flag;
 
@@ -347,6 +210,4 @@
 
   char   prg_name[8];
-
-  UINT64 pid;  
  
   sh_sh_df     exec;
@@ -379,12 +240,4 @@
   int    looptime;                 /* timing for main loop            */
   /*@null@*//*@out@*/ char   * timezone;
-
-  int delayload;
-
-#ifdef SCREW_IT_UP
-  int sigtrap_max_duration;
-#endif
-
-  char * outpath;
 } sh_struct;
 
@@ -394,25 +247,18 @@
 extern volatile  int      sig_debug_switch;       /* SIGUSR1 */
 extern volatile  int      sig_suspend_switch;     /* SIGUSR2 */
-extern volatile  int      sh_global_suspend_flag;
+extern volatile  int      sh_global_suspend_flag; /* SIGUSR2 */
 extern volatile  int      sig_fresh_trail;        /* SIGIOT  */
-extern volatile  int      sh_thread_pause_flag;
 extern volatile  int      sig_config_read_again;  /* SIGHUP  */
 extern volatile  int      sig_terminate;          /* SIGQUIT */
 extern volatile  int      sig_termfast;           /* SIGTERM */
 extern volatile  int      sig_force_check;        /* SIGTTOU */
-extern volatile  int      sig_force_silent;       /* SIGTSTP */
-extern volatile  int      sh_global_check_silent;
-extern volatile  int      sh_load_delta_flag;
 
 extern long int eintr__result;
 
-extern int     sh_argc_store;
-extern char ** sh_argv_store;
-
 #include "sh_calls.h"
 
 
 typedef struct {
-  char   sh_sockpass[2*SOCKPASS_MAX+2];
+  char   sh_sockpass[32];
   char   sigkey_old[KEY_LEN+1];
   char   sigkey_new[KEY_LEN+1];
@@ -434,6 +280,4 @@
   UINT32 rng2[3];
 
-  UINT32 res_vec[6];
-
   UINT32 ErrFlag[2];
 
@@ -447,61 +291,11 @@
 /*@null@*/ extern sh_key_t  *skey; 
 
-/**************************************************
- *
- * macros
- *
- **************************************************/
-
-#if defined(SH_ABORT_ON_ERROR)
-#define SH_ABORT abort()
-#else
-#define SH_ABORT 
-#endif
-
-
-
-/* The semantics of the built-in are that it is expected that expr == const
- * for __builtin_expect ((expr), const)
- */
-#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
-#define SH_LIKELY(expr)   (__builtin_expect((expr), 1))
-#define SH_UNLIKELY(expr) (__builtin_expect((expr), 0))
-#else
-#define SH_LIKELY(expr) (expr)
-#define SH_UNLIKELY(expr) (expr)
-#endif
-
-/* signal-safe log function
- */
-int  safe_logger (int thesignal, int method, char * details);
-void safe_fatal  (const char * details, const char *f, int l);
-
-#define SH_VALIDATE_EQ(a,b) \
-     do { \
-         if ((a) != (b)) safe_fatal(#a " != " #b, FIL__, __LINE__);\
-     } while (0)
-
-#define SH_VALIDATE_NE(a,b) \
-     do { \
-         if ((a) == (b)) safe_fatal(#a " == " #b, FIL__, __LINE__);\
-     } while (0)
-
-#define SH_VALIDATE_GE(a,b) \
-     do { \
-         if ((a) < (b)) safe_fatal(#a " < " #b, FIL__, __LINE__);\
-     } while (0)
 
 #if defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK)
-#ifdef USE_SUID
 #define MLOCK(a, b) \
-      if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \
+      if ((skey != NULL) && skey->mlock_failed == SL_FALSE){ \
         (void) sl_set_suid(); \
-	if (sh_unix_mlock(FIL__, __LINE__, a, b) < 0) skey->mlock_failed = S_TRUE; \
-        (void) sl_unset_suid(); }
-#else
-#define MLOCK(a, b) \
-      if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \
-        if (sh_unix_mlock(FIL__, __LINE__, a, b) < 0) skey->mlock_failed = S_TRUE; }
-#endif 
+	if (sh_unix_mlock( a, b) < 0) skey->mlock_failed = SL_TRUE; \
+        (void) sl_unset_suid(); } 
 #else
 #define MLOCK(a, b) \
@@ -510,15 +304,9 @@
 
 #if defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK)
-#ifdef USE_SUID
 #define MUNLOCK(a, b) \
-      if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \
+      if ((skey != NULL) && skey->mlock_failed == SL_FALSE){ \
         (void) sl_set_suid(); \
 	(void) sh_unix_munlock( a, b );\
-        (void) sl_unset_suid(); }
-#else
-#define MUNLOCK(a, b) \
-      if ((skey != NULL) && skey->mlock_failed == S_FALSE){ \
-        (void) sh_unix_munlock( a, b ); }
-#endif 
+        (void) sl_unset_suid(); } 
 #else
 #define MUNLOCK(a, b) \
Index: trunk/include/sh_calls.h
===================================================================
--- trunk/include/sh_calls.h	(revision 591)
+++ trunk/include/sh_calls.h	(revision 1)
@@ -31,74 +31,57 @@
 /*@-fixedformalarray@*/
 
-#include "config_xor.h"
-#if defined(__GNUC__) && (__GNUC__ >= 3)
-#undef  SH_GNUC_NORETURN
-#define SH_GNUC_NORETURN __attribute__((noreturn))
-#else
-#undef  SH_GNUC_NORETURN
-#define SH_GNUC_NORETURN
-#endif
+/* Set aud functions
+ */
+int sh_aud_set_functions(char * str_s);
 
 
-/* Set aud functions
- */
-int sh_aud_set_functions(const char * str_s);
-
-#ifdef SH_IPVX_H
-long int retry_accept(const char * file, int line, 
-		      int fd, struct sh_sockaddr *serv_addr, int * addrlen);
-#endif
-
-void sh_calls_enable_sub();
-int  sh_calls_set_sub (const char * str);
-
-long int retry_stat (const char * file, int line, 
+long int retry_accept(char * file, int line, 
+		      int fd, struct sockaddr *serv_addr, int * addrlen);
+long int retry_stat (char * file, int line, 
 		     const char *file_name, struct stat *buf);
-long int retry_fstat(const char * file, int line, 
+long int retry_fstat(char * file, int line, 
 		     int filed,             struct stat *buf);
-long int retry_lstat_ns(const char * file, int line, 
-			const char *file_name, struct stat *buf);
-long int retry_lstat(const char * file, int line, 
+long int retry_lstat(char * file, int line, 
 		     const char *file_name, struct stat *buf);
-long int retry_fcntl(const char * file, int line, 
+long int retry_fcntl(char * file, int line, 
 		     int fd, int cmd, long arg);
 
 long int retry_msleep (int sec, int millisec);
 
-long int retry_sigaction(const char * file, int line, 
+long int retry_sigaction(char * file, int line, 
 			 int signum,  const  struct  sigaction  *act,
 			 struct sigaction *oldact);
 
-int      sh_calls_set_bind_addr (const char *);
-long int retry_connect(const char * file, int line,
+int      sh_calls_set_bind_addr (char *);
+long int retry_connect(char * file, int line,
 		       int fd, struct sockaddr *serv_addr, int addrlen);
 
-long int retry_aud_dup2    (const char * file, int line, int fd, int fd2);
-long int retry_aud_execve  (const char * file, int line, 
-			    const  char *dateiname, char *const argv[],
-			    char *const envp[]);
-long int retry_aud_dup     (const char * file, int line, 
+long int retry_aud_dup2    (char * file, int line, int fd, int fd2);
+long int retry_aud_execve  (char * file, int line, 
+			    const  char *dateiname, char * argv[],
+			    char *envp[]);
+long int retry_aud_dup     (char * file, int line, 
 			    int fd);
-long int retry_aud_chdir   (const char * file, int line, 
+long int retry_aud_chdir   (char * file, int line, 
 			    const char *path);
-long int retry_aud_unlink  (const char * file, int line, 
+long int retry_aud_unlink  (char * file, int line, 
 			    char * path);
-long int retry_aud_utime   (const char * file, int line, 
+long int retry_aud_utime   (char * file, int line, 
 			    char * path, struct utimbuf *buf);
 
-long int aud_open           (const char * file, int line, int privs,
+long int aud_open           (char * file, int line, int privs,
 			     const char *pathname, int flags, mode_t mode);
-long int aud_open_noatime   (const char * file, int line, int privs,
+long int aud_open_noatime   (char * file, int line, int privs,
 			     const char *pathname, int flags, mode_t mode,
 			     int * o_noatime);
 /*@noreturn@*/
-void     aud_exit   (const char * file, int line, int fd) SH_GNUC_NORETURN;
+void     aud_exit   (char * file, int line, int fd);
 /*@noreturn@*/
-void     aud__exit  (const char * file, int line, int fd) SH_GNUC_NORETURN;
-pid_t    aud_fork   (const char * file, int line);
-int      aud_pipe   (const char * file, int line, int modus[2]);
-int      aud_setuid (const char * file, int line, uid_t uid);
-int      aud_setgid (const char * file, int line, gid_t gid);
-long int aud_kill   (const char * file, int line, pid_t pid, int sig);
+void     aud__exit  (char * file, int line, int fd);
+pid_t    aud_fork   (char * file, int line);
+int      aud_pipe   (char * file, int line, int modus[2]);
+int      aud_setuid (char * file, int line, uid_t uid);
+int      aud_setgid (char * file, int line, gid_t gid);
+long int aud_kill   (char * file, int line, pid_t pid, int sig);
 
 #endif 
Index: trunk/include/sh_cat.h
===================================================================
--- trunk/include/sh_cat.h	(revision 591)
+++ trunk/include/sh_cat.h	(revision 1)
@@ -7,10 +7,10 @@
   unsigned long priority;
   unsigned long class;
-  const char *        format;
+  char *        format;
 } cat_entry;
 
 extern cat_entry msg_cat[];
 
-extern const char * class_cat[];
+extern char * class_cat[];
 
 #define  AUD      0
@@ -75,13 +75,10 @@
  MSG_CHECK_0,     
  MSG_CHECK_1,     
- MSG_CHECK_2,     
- MSG_STAMP,
- MSG_DCLOSE,
+ MSG_STAMP,       
  		  
  MSG_D_START,     
  MSG_D_DSTART,    
  MSG_D_FAIL,      
- MSG_D_DELTAOK,
- MSG_D_DELTAFAIL,
+
 
 #ifndef HAVE_URANDOM 
@@ -103,4 +100,16 @@
 #endif
 
+#ifdef SH_USE_KERN
+ /* FreeBSD */
+ MSG_KERN_POLICY,    
+ MSG_KERN_POL_CO,
+
+ /* Linux */
+ MSG_KERN_SYSCALL,
+ MSG_KERN_PROC,
+ MSG_KERN_IDT,
+ MSG_KERN_GATE,
+#endif
+
 #ifdef SH_USE_UTMP
  MSG_UT_CHECK,
@@ -121,23 +130,4 @@
  MSG_UT_ROT,      
 
- MSG_UT_BAD,
- MSG_UT_FIRST,
- MSG_UT_OUTLIER,
-#endif
-
-#ifdef SH_USE_PROCESSCHECK
- MSG_PCK_CHECK,  
- MSG_PCK_OK,     
- MSG_PCK_P_HIDDEN, 
- MSG_PCK_HIDDEN, 
- MSG_PCK_FAKE,   
- MSG_PCK_MISS,   
-#endif
-
-#ifdef SH_USE_PORTCHECK
- MSG_PORT_MISS,
- MSG_PORT_NEW,
- MSG_PORT_RESTART,
- MSG_PORT_NEWPORT,
 #endif
 
@@ -151,23 +141,4 @@
 #ifdef SH_USE_USERFILES
  MSG_USERFILES_SUMMARY,
-#endif
-
-#ifdef USE_LOGFILE_MONITOR
- MSG_LOGMON_CHKS,
- MSG_LOGMON_CHKE,
- MSG_LOGMON_MISS,
- MSG_LOGMON_EOPEN,
- MSG_LOGMON_EREAD,
- MSG_LOGMON_REP,
- MSG_LOGMON_SUM,
- MSG_LOGMON_COR,
- MSG_LOGMON_MARK,
- MSG_LOGMON_BURST,
-#endif
-
-#ifdef USE_REGISTRY_CHECK
- MSG_REG_MISS,
- MSG_REG_NEW,
- MSG_REG_CHANGE,
 #endif
 
@@ -190,5 +161,5 @@
  MSG_FI_NOGRP,    
  MSG_FI_NOUSR,    
- MSG_FI_STAT,    
+ MSG_FI_LSTAT,    
  MSG_FI_OBSC,     
  MSG_FI_OBSC2,    
@@ -229,6 +200,5 @@
  MSG_TCP_EBGN,    
  		  
- MSG_TCP_CREG,
- MSG_TCP_AREG,
+ MSG_TCP_CREG,    
  MSG_TCP_FAUTH,   
  MSG_TCP_TIMOUT,  
@@ -281,6 +251,5 @@
  MSG_E_HASH,      
  MSG_E_ACCESS,    
- MSG_E_READ,
- MSG_E_NOTREG,
+ MSG_E_READ,      
  MSG_E_TIMEOUT,
  MSG_NODEV,       
Index: trunk/include/sh_checksum.h
===================================================================
--- trunk/include/sh_checksum.h	(revision 591)
+++ 	(revision )
@@ -1,27 +1,0 @@
-#ifndef SH_CHECKSUM_H
-#define SH_CHECKSUM_H
-
-typedef unsigned char sha2_byte  ;
-typedef UINT32        sha2_word32;
-typedef UINT64        sha2_word64;
-
-
-#define SHA256_BLOCK_LENGTH             64
-#define SHA256_SHORT_BLOCK_LENGTH       (SHA256_BLOCK_LENGTH - 8)
-#define SHA256_DIGEST_LENGTH            32
-#define SHA256_DIGEST_STRING_LENGTH     (SHA256_DIGEST_LENGTH * 2 + 1)
-
-typedef struct _SHA256_CTX {
-        sha2_word32     state[8];
-        sha2_word64     bitcount;
-        sha2_byte       buffer[SHA256_BLOCK_LENGTH];
-} SHA256_CTX;
-
-void SHA256_Init(SHA256_CTX *);
-void SHA256_Update(SHA256_CTX*, const sha2_byte*, size_t);
-void SHA256_Final(sha2_byte[SHA256_DIGEST_LENGTH], SHA256_CTX*);
-char* SHA256_End(SHA256_CTX*, char[KEYBUF_SIZE]);
-char* SHA256_Data(const sha2_byte*, size_t, char[KEYBUF_SIZE]);
-char* SHA256_Base2Hex(char * b64digest, char * hexdigest); 
-char * SHA256_ReplaceBaseByHex(const char * str, char * before, char after);
-#endif
Index: trunk/include/sh_database.h
===================================================================
--- trunk/include/sh_database.h	(revision 591)
+++ trunk/include/sh_database.h	(revision 1)
@@ -2,15 +2,15 @@
 #define SH_DATABASE_H
 
-void sh_database_reset(void);
+void sh_database_reset();
 int sh_database_insert (char * message);
 
-int sh_database_use_persistent (const char * str);
+int sh_database_use_persistent (char * str);
 
-int sh_database_set_database (const char * str);
-int sh_database_set_table (const char * str);
-int sh_database_set_host (const char * str);
-int sh_database_set_user (const char * str);
-int sh_database_set_password (const char * str);
-int sh_database_add_to_hash  (const char * str);
-int set_enter_wrapper (const char * str);
+int sh_database_set_database (char * str);
+int sh_database_set_table (char * str);
+int sh_database_set_host (char * str);
+int sh_database_set_user (char * str);
+int sh_database_set_password (char * str);
+int sh_database_add_to_hash  (char * str);
+int set_enter_wrapper (char * str);
 #endif
Index: trunk/include/sh_dbCheck.h
===================================================================
--- trunk/include/sh_dbCheck.h	(revision 591)
+++ 	(revision )
@@ -1,26 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 2015 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-
-#ifndef SH_DBCHECK_H
-#define SH_DBCHECK_H
-
-int sh_dbCheck_verify (const char * db_file);
-
-#endif
Index: trunk/include/sh_dbCreate.h
===================================================================
--- trunk/include/sh_dbCreate.h	(revision 591)
+++ 	(revision )
@@ -1,26 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 2015 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-
-#ifndef SH_DBCREATE_H
-#define SH_DBCREATE_H
-
-int sh_dbCreate (const char * path);
-
-#endif
Index: trunk/include/sh_dbIO.h
===================================================================
--- trunk/include/sh_dbIO.h	(revision 591)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 2015 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-
-#ifndef SH_DBIO_H
-#define SH_DBIO_H
-
-
-
-/* Read one line, trim newline. Return char count, or -1 on error or eof.
- */
-int sh_dbIO_getline (FILE * fd, char * line, const size_t sizeofline);
-
-/* Read given database file for listing
- */
-int sh_dbIO_list_db (const char * db_file);
-
-/* Write single record to database
- */
-void sh_dbIO_data_write (file_type * buf, char * fileHash);
-
-/* Write whole default database
- */
-int sh_dbIO_writeout_update ();
-
-/* write database to given path
- */
-int sh_dbIO_writeout_to_path(const char * path);
-
-/* write database to stdout
- */
-int sh_dbIO_writeout_stdout (const char * str);
-
-/* version string for database
- */
-int sh_dbIO_version_string(const char * str);
-
-/* Load a delta database
- */
-int sh_dbIO_load_delta();
-
-int sh_dbIO_list_binary (const char * c);
-int sh_dbIO_list_filter (const char * c);
-
-/* alternative rootfs */
-
-int sh_dbIO_init_rootfs (const char * rootfs);
-size_t sh_dbIO_get_rootfs_len();
-char * sh_dbIO_rootfs_prepend(char * path);
-char * sh_dbIO_rootfs_strip(char * path);
-char * sh_dbIO_rootfs_strip_link(char * path);
-
-#endif
Index: trunk/include/sh_dbIO_int.h
===================================================================
--- trunk/include/sh_dbIO_int.h	(revision 591)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 2015 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-
-#ifndef SH_DBIO_INT_H
-#define SH_DBIO_INT_H
-
-#define SH_DEADFILE 65535
-
-typedef struct store_info_old {
-
-  UINT32           mode;
-  UINT32           linkmode;
-
-  UINT64           dev;
-  UINT64           rdev;
-
-  UINT32           hardlinks;
-  UINT32           ino;
-
-  UINT64           size;
-  UINT64           atime;
-  UINT64           mtime;
-  UINT64           ctime;
-
-  UINT32           owner;
-  UINT32           group;
-
-  UINT32           attributes;
-
-  char             c_attributes[ATTRBUF_SIZE]; /* 16 = 2*UINT64 */
-
-  unsigned short   mark;
-  char             c_owner[USER_MAX+2];
-  char             c_group[GROUP_MAX+2];
-  char             c_mode[CMODE_SIZE];
-  char             checksum[KEY_LEN+1];
-  
-} sh_filestore_old_t;
-
-typedef struct store_info {
-
-  UINT32           mode;
-  UINT32           linkmode;
-
-  UINT64           dev;
-  UINT64           rdev;
-
-  UINT32           hardlinks;
-  UINT32           ino;
-
-  UINT64           size;
-  UINT64           atime;
-  UINT64           mtime;
-  UINT64           ctime;
-
-  UINT32           owner;
-  UINT32           group;
-
-  UINT32           attributes;
-
-  char             c_attributes[ATTRBUF_SIZE]; /* 16 = 2*UINT64 */
-
-  unsigned short   mark;
-  char             c_owner[USER_MAX+2];
-  char             c_group[GROUP_MAX+2];
-  char             c_mode[CMODE_SIZE];
-  char             checksum[KEY_LEN+1];
-  
-  /* If 'checkflags' is elsewhere, the compiler would still use
-   * a 6-byte padding to align the whole struct to an 8-byte boundary.
-   * ipad, opad: make explicit what the compiler does on a 64-byte system.
-   */
-  char             ipad[2];
-  UINT32           checkflags;
-  char             opad[4];
-
-} sh_filestore_t;
-  
-typedef struct file_info {
-  sh_filestore_t   theFile;
-  char           * fullpath;
-  char           * linkpath;
-  char           * attr_string;
-  int              fflags;
-  unsigned long    modi_mask;
-  struct           file_info * next;
-} sh_file_t;
-
-//* must fit an int              */
-#define TABSIZE 65536
-
-/* must fit an unsigned short   */
-/* changed for V0.8, as the     */
-/* database format has changed  */
-/* changed again for V0.9       */
-/* #define REC_MAGIC 19         */
-/* changed again for V1.3       */
-/* #define REC_MAGIC 20         */
-/* changed again for V1.4       */
-/* #define REC_MAGIC 21         */
-#define OLD_REC_MAGIC 21 
-/* changed again for V3.2       */
-#define REC_MAGIC 22
-
-#define REC_FLAGS_ATTR (1<<8)
-#define REC_FLAGS_MASK 0xFF00
-
-/* Insert into database table
- */
-void hashinsert (sh_file_t * tab[TABSIZE], sh_file_t * s); 
-
-/* Internal conversion function
- */
-file_type * sh_hash_create_ft (const sh_file_t * p, char * fileHash);
-
-/* Print what's in the link path
- */
-int sh_hash_printcontent(char * linkpath);
-
-/* List database entry
- */
-void sh_hash_list_db_entry (sh_file_t * p);
-
-/* get the location of the default/main database table
- */
-sh_file_t ** get_default_data_table();
-
-/* Write whole database
- */
-int sh_dbIO_writeout(sh_file_t * mtab[TABSIZE], const char * outpath, int truncate);
-
-/* Load from the default source into hash table 'tab'
- */
-int sh_dbIO_load_db(sh_file_t * tab[TABSIZE]);
-
-/* Load from the file 'filepath' into hash table 'tab'
- */
-int sh_dbIO_load_db_file(sh_file_t * tab[TABSIZE], const char * filepath);
-
-#endif
Index: trunk/include/sh_error.h
===================================================================
--- trunk/include/sh_error.h	(revision 591)
+++ trunk/include/sh_error.h	(revision 1)
@@ -30,5 +30,5 @@
   SH_ERR_T_START  = 0,
 
-  /* 1-13 = SH_LEVEL_XXX */
+  /* 1-9 = SH_LEVEL_XXX */
 
   SH_ERR_T_RO      = SH_LEVEL_READONLY,
@@ -40,14 +40,11 @@
   SH_ERR_T_USER0   = SH_LEVEL_USER0,  
   SH_ERR_T_USER1   = SH_LEVEL_USER1,  
-  SH_ERR_T_USER2   = SH_LEVEL_USER2,  
-  SH_ERR_T_USER3   = SH_LEVEL_USER3,  
-  SH_ERR_T_USER4   = SH_LEVEL_USER4,  
   SH_ERR_T_PRELINK = SH_LEVEL_PRELINK,  
 
-  SH_ERR_T_DIR    = 13,
-  SH_ERR_T_FILE   = 14,
-  SH_ERR_T_NAME   = 15,
+  SH_ERR_T_DIR    = 10,
+  SH_ERR_T_FILE   = 11,
+  SH_ERR_T_NAME   = 12,
 
-  SH_ERR_T_END    = 16
+  SH_ERR_T_END    = 13
 };
 
@@ -84,32 +81,32 @@
 /* set mask for message class
  */
-int sh_error_log_mask (const char * c);
-int sh_error_print_mask (const char * c);
-int sh_error_mail_mask (const char * c);
-int sh_error_export_mask (const char * c);
-int sh_error_syslog_mask (const char * c);
-int sh_error_external_mask (const char * c);
-int sh_error_database_mask (const char * c);
-int sh_error_prelude_mask (const char * c);
+int sh_error_log_mask (char * c);
+int sh_error_print_mask (char * c);
+int sh_error_mail_mask (char * c);
+int sh_error_export_mask (char * c);
+int sh_error_syslog_mask (char * c);
+int sh_error_external_mask (char * c);
+int sh_error_database_mask (char * c);
+int sh_error_prelude_mask (char * c);
 
 
-int sh_error_verify (const char * s);
-int sh_error_logverify_mod (const char * s); /* just list, don't verify */
-int sh_error_logverify (const char * s);
+int sh_error_verify (char * s);
+int sh_error_logverify_mod (char * s); /* just list, don't verify */
+int sh_error_logverify (char * s);
 
 void sh_error_dbg_switch(void);
 
 #ifdef SH_WITH_SERVER
-
 void sh_error_set_peer(const char * str);
-#ifdef HAVE_LIBPRELUDE
-void sh_error_set_peer_ip(const char * str);
-#endif
-int  set_flag_sep_log (const char * str);
+int  set_flag_sep_log (char * str);
 #endif
 
 /* init or re-init log facilities that need it
  */
-void sh_error_fixup(void);
+void sh_error_fixup();
+
+/* convert a string to a numeric priority
+ */ 
+int sh_error_convert_level (char * str_s);
 
 /* only to stderr (GOOD/BAD)
@@ -117,64 +114,60 @@
 void sh_error_only_stderr (int flag);
 
-/* facilities unsafe for closeall()
- */
-void sh_error_enable_unsafe (int flag);
-
 /* set syslog facility 
  */
-int  sh_log_set_facility (const char * c);
-
-/* map heartbeat messages 
- */
-int sh_log_set_stamp_priority (const char * c);
+int  sh_log_set_facility (char * c);
 
 /* define message header
  */
-int sh_error_ehead (/*@null@*/const char * s);
+int sh_error_ehead (/*@null@*/char * s);
 
 /* set level for error logging 
  */
-int sh_error_setlog(const char * str_s);
+int sh_error_setlog(char * str_s);
 
 /* set severity levels
  */
-int sh_error_set_iv (int iv, const char *  severity_s);
+int sh_error_set_iv (int iv, char *  severity_s);
 
 /* set priorities
  */
-int sh_error_set_level(const char * str_s, int *facility);
+int sh_error_set_level(char * str_s, int *facility);
 
 /* set level for TCP export
  */
-int sh_error_setexport(const char *  str_s);
+int sh_error_setexport(char *  str_s);
 
 /* set level for syslog
  */
-int sh_error_set_syslog (const char * flag_s);
+int sh_error_set_syslog (char * flag_s);
 
 /* set level for printing
  */
-int sh_error_setprint(const char *  flag_s);
+int sh_error_setprint(char *  flag_s);
 
 /* set severity for external
  */
-int sh_error_set_external (const char * str_s);
+int sh_error_set_external (char * str_s);
 
 /* set severity for external
  */
-int sh_error_set_database (const char * str_s);
+int sh_error_set_database (char * str_s);
 
 /* set severity for external
  */
-int sh_error_set_prelude (const char * str_s);
+int sh_error_set_prelude (char * str_s);
 
 
 /* set level for mailing
  */
-int sh_error_setseverity (const char * flag);
+int sh_error_setseverity (char * flag);
 
 /* set debug level
  */
 int sh_error_setdebug (char * debug_s);
+
+/* error messages
+ */
+/*@owned@*/char * sh_error_message (int tellme);
 
 /* switch on/off log to file temporarily
@@ -183,23 +176,17 @@
 void sh_error_logrestore(void);
 
-/* short errfile
- */
-void sh_efile_report();
-int sh_efile_path(const char * str);
-int sh_efile_group(const char * str);
-
 /* (re)set the console device(s)
  */
-int sh_log_set_console (const char * address);
+int sh_log_set_console (char * address);
 void reset_count_dev_console(void);
 
-/* close the message queue [no-op if !defined(WITH_MESSAGE_QUEUE)]
+#ifdef WITH_MESSAGE_QUEUE
+/* close the message queue
  */
 void close_ipc (void);
 
-#ifdef WITH_MESSAGE_QUEUE
 /* enable message queue
  */
-int enable_msgq(const char * foo);
+int enable_msgq(char * foo);
 #endif
  
Index: trunk/include/sh_error_min.h
===================================================================
--- trunk/include/sh_error_min.h	(revision 591)
+++ trunk/include/sh_error_min.h	(revision 1)
@@ -22,20 +22,6 @@
 /* this function should be called to report an error
  */
-void sh_error_handle (int flag, const char * file, long line, 
+void sh_error_handle (int flag, char * file, long line, 
 		      long errnum, unsigned long  msg_index, ...);
 
-/* this function should be called to (only) send mail
- */
-void sh_error_mail (const char * alias, int sev, 
-		    const char * file, long line, 
-		    long status, unsigned long msg_id, ...);
-
-/* convert a string to a numeric priority
- */ 
-int sh_error_convert_level (const char * str_s);
-
-/* error messages
- */
-char * sh_error_message (int tellme, char * str, size_t len);
-
 #endif
Index: trunk/include/sh_extern.h
===================================================================
--- trunk/include/sh_extern.h	(revision 591)
+++ trunk/include/sh_extern.h	(revision 1)
@@ -1,6 +1,4 @@
 #ifndef SH_EXTERN_H
 #define SH_EXTERN_H
-
-#include <stdarg.h>
 
 typedef struct 
@@ -12,7 +10,6 @@
   char   *  envv[32];
   char      checksum[KEY_LEN + 1];
-#if 0
+
   uid_t     trusted_users[32];
-#endif
   uid_t     run_user_uid;
   gid_t     run_user_gid;
@@ -39,20 +36,4 @@
 
 /*
- * -- generic simple safe popen; returns 0 on success, -1 otherwise,
- *    executes shell command
- */
-int sh_ext_popen_init (sh_tas_t * task, const char * command, char * argv0, ...) SH_GNUC_SENTINEL;
-
-/*
- * -- Execute command, return first line of output
- */
-int sh_ext_system (char * command, char * argv0, ...) SH_GNUC_SENTINEL;
-
-/*
- * -- Execute command, return first line of output
- */
-char * sh_ext_popen_str (const char * command);
-
-/*
  * -- close the pipe, clear and return task->exit_status
  */
@@ -62,5 +43,5 @@
  * -- add CL argument, return # of arguments
  */
-int sh_ext_tas_add_argv(sh_tas_t * tas, const char * val);
+int sh_ext_tas_add_argv(sh_tas_t * tas, char * val);
 /*
  * -- remove last CL argument
@@ -70,9 +51,9 @@
  * -- add environment variable, return # of variables
  */
-int sh_ext_tas_add_envv(sh_tas_t * tas, const char * key, const char * val);
+int sh_ext_tas_add_envv(sh_tas_t * tas, char * key, char * val);
 /*
  * -- set command
  */
-void sh_ext_tas_command(sh_tas_t * tas, const char * command);
+void sh_ext_tas_command(sh_tas_t * tas, char * command);
 /*
  * -- initialize task structure
@@ -90,10 +71,5 @@
  * -- start a new external command, and add it to the list
  */ 
-int sh_ext_setcommand(const char * cmd);
-
-/*
- * -- explicitely close a command
- */
-int sh_ext_close_command (const char * str);
+int sh_ext_setcommand(char * cmd);
 
 /* 
@@ -105,50 +81,50 @@
  * -- set deadtime
  */
-int sh_ext_deadtime (const char * str);
+int sh_ext_deadtime (char * str);
 
 /*
  * -- add keywords to the OR filter
  */
-int sh_ext_add_or (const char * str);
+int sh_ext_add_or (char * str);
 
 /*
  * -- add keywords to the AND filter
  */
-int sh_ext_add_and (const char * str);
+int sh_ext_add_and (char * str);
 
 /*
  * -- add keywords to the NOT filter
  */
-int sh_ext_add_not (const char * str);
+int sh_ext_add_not (char * str);
 
 /*
  * -- add keywords to the CL argument list
  */
-int sh_ext_add_argv (const char * str);
+int sh_ext_add_argv (char * str);
 
 /*
  * -- add a path to the environment
  */
-int sh_ext_add_default (const char * str);
+int sh_ext_add_default (char * str);
 
 /*
  * -- add an environment variable
  */
-int sh_ext_add_environ (const char * str);
+int sh_ext_add_environ (char * str);
 
 /*
  * -- define type
  */
-int sh_ext_type (const char * str);
+int sh_ext_type (char * str);
 
 /*
  * -- define checksum
  */
-int sh_ext_checksum (const char * str);
+int sh_ext_checksum (char * str);
 
 /*
  * -- choose privileges
  */
-int sh_ext_priv (const char * c);
+int sh_ext_priv (char * c);
 
 /*
Index: trunk/include/sh_fInotify.h
===================================================================
--- trunk/include/sh_fInotify.h	(revision 591)
+++ 	(revision )
@@ -1,13 +1,0 @@
-
-#ifndef SH_F_INOTIFY_H
-#define SH_F_INOTIFY_H
-
-int sh_fInotify_init(struct mod_type * arg);
-int sh_fInotify_timer(time_t tcurrent);
-int sh_fInotify_run(void);
-int sh_fInotify_reconf(void);
-int sh_fInotify_cleanup(void);
-
-extern sh_rconf sh_fInotify_table[];
-
-#endif
Index: trunk/include/sh_fifo.h
===================================================================
--- trunk/include/sh_fifo.h	(revision 591)
+++ trunk/include/sh_fifo.h	(revision 1)
@@ -10,5 +10,5 @@
  *****************************************************/
 
-#define SH_FIFO_MAX 16384
+#define SH_FIFO_MAX 128
 
 /*****************************************************
@@ -21,7 +21,4 @@
   struct dlist * next;
   char         * data;
-  char         * s_xtra;
-  int            i_xtra;
-  int            transact;
   struct dlist * prev;
 };
@@ -32,6 +29,4 @@
   int            fifo_cts;
 } SH_FIFO;
-
-#define SH_FIFO_INITIALIZER { NULL, NULL, 0 }
 
 /*****************************************************
@@ -44,6 +39,6 @@
  *
  */
-#define fifo_init(fifo_p) { (fifo_p)->fifo_cts = 0; (fifo_p)->head_ptr = NULL; \
-    (fifo_p)->tail_ptr = NULL; }
+#define fifo_init(fifo_p) { fifo_p->fifo_cts = 0; fifo_p->head_ptr = NULL; \
+ fifo_p->tail_ptr = NULL; }
 
 
@@ -52,6 +47,5 @@
  * Returns: -1 if the list is full, 0 on success 
  */
-int push_list (SH_FIFO * fifo, const char * indat, int in_i, const char * in_str);
-#define sh_fifo_push(a, b) push_list((a), (b), 0, NULL)
+int push_list (SH_FIFO * fifo, char * indat);
 
 /* Push an item on the tail of the list.
@@ -59,6 +53,5 @@
  * Returns: -1 if the list is full, 0 on success 
  */
-int push_tail_list (SH_FIFO * fifo, const char * indat, int in_i, const char * in_str);
-#define sh_fifo_push_tail(a, b) push_tail_list((a), (b), 0, NULL)
+int push_tail_list (SH_FIFO * fifo, char * indat);
 
 /* pop an item from the tail of the list
@@ -68,28 +61,4 @@
  */
 char * pop_list (SH_FIFO * fifo);
-#define sh_fifo_pop(a) pop_list((a))
-
-/* ----  Special functions -------------------------------------------------*/
-
-/* This is for eMail where different recipients may be eligible for         *
- * different subsets of messages. We need to delete all that were sent      *
- * to all intended recipients, and keep all with at least one failure.      */
-
-/* Iterate over list and check for each if it is valid for 'tag';
- * i.e. (item->s_extra == tag). If yes, add to the returned string.
- * If (okNull == False) then item->s_xtra must be defined
- */
-sh_string * tag_list (SH_FIFO * fifo, char * tag,
-		      int(*check)(int, const char*, const char*, const void*),
-		      const void * info, int okNull);
-
-/* Flag all tagged as candidate to keep */
-void rollback_list (SH_FIFO * fifo);
-/* Flag all tagged as candidate to delete */
-void mark_list (SH_FIFO * fifo);
-/* Remove all flags */
-void reset_list (SH_FIFO * fifo);
-/* Delete all marked for delete that are not flagged for keep */
-int commit_list (SH_FIFO * fifo);
 
 #endif
Index: trunk/include/sh_files.h
===================================================================
--- trunk/include/sh_files.h	(revision 591)
+++ trunk/include/sh_files.h	(revision 1)
@@ -21,53 +21,7 @@
 #define SH_FILES_H
 
-void sh_audit_mark (const char * file);
-void sh_audit_commit ();
-void sh_audit_delete_all ();
-int  sh_audit_set_flags(const char * str);
-char * sh_audit_fetch (char * file, time_t mtime, time_t ctime, time_t atime, char * result, size_t rsize);
-
-struct sh_dirent {
-  char             * sh_d_name;
-  struct sh_dirent * next;
-};
-
-/* Fix the check flags
- */
-void sh_files_fixup_mask (int class, unsigned long * check_flags);
-
-/* Dequote a filename in the config file
- */
-char * sh_files_parse_input(const char * str_s, size_t * len);
-
-/* Check whether a file is in the config 
- */
-char * sh_files_findfile(const char * path);
-
-/* Find the most specific directory in the config
- */
-char * sh_files_find_mostspecific_dir(const char * path);
-
-/* free a directory listing
- */
-void kill_sh_dirlist (struct sh_dirent * dirlist);
-
-#ifdef NEED_ADD_DIRENT
-/* add an entry to a directory listing
- */
-struct sh_dirent * addto_sh_dirlist (struct dirent * thisEntry, 
-				     struct sh_dirent * dirlist);
-#endif
-
 /* register exceptions to hardlink check
  */
-int sh_files_hle_reg (const char * str);
-
-/* Check for new files/dirs matching configured glob patterns.
- */
-void sh_files_check_globPatterns();
-
-/* Check for new files (only) matching configured glob patterns.
- */
-void sh_files_check_globFilePatterns();
+int sh_files_hle_reg (char * str);
 
 /* check the setup
@@ -81,9 +35,5 @@
 /* activate hardlink check
  */
-int sh_files_check_hardlinks (const char * opt);
-
-/* check  rsrc fork (Mac OS X)
- */
-int sh_files_use_rsrc(const char * str);
+int sh_files_check_hardlinks (char * opt);
 
 /* set recursion depth
@@ -93,9 +43,9 @@
 /* report only once
  */
-int sh_files_reportonce(const char * c);
+int sh_files_reportonce(char * c);
 
 /* report full details
  */
-int sh_files_fulldetail(const char * c);
+int sh_files_fulldetail(char * c);
 
 /* reset the 'checked' flag
@@ -109,5 +59,5 @@
 /* set maximum recursion level
  */
-int sh_files_setrecursion (const char * flag_s);
+int sh_files_setrecursion (char * flag_s);
 
 /* select a directory stack 2=Two, else One (standard)
@@ -117,98 +67,74 @@
 /* push a directory on the stack USER0
  */
-int  sh_files_pushdir_user0 (const char * dirName);
+int  sh_files_pushdir_user0 (char * dirName);
 
 /* push a directory on the stack USER1
  */
-int  sh_files_pushdir_user1 (const char * dirName);
-
-/* push a directory on the stack USER2
- */
-int  sh_files_pushdir_user2 (const char * dirName);
-
-/* push a directory on the stack USER3
- */
-int  sh_files_pushdir_user3 (const char * dirName);
-
-/* push a directory on the stack USER4
- */
-int  sh_files_pushdir_user4 (const char * dirName);
+int  sh_files_pushdir_user1 (char * dirName);
 
 /* push a directory on the stack PRELINK
  */
-int  sh_files_pushdir_prelink (const char * dirName);
+int  sh_files_pushdir_prelink (char * dirName);
 
 /* push a directory on the stack ATTR
  */
-int  sh_files_pushdir_attr (const char * dirName);
+int  sh_files_pushdir_attr (char * dirName);
 
 /* push a directory on the stack READONLY
  */
-int  sh_files_pushdir_ro (const char * dirName);
+int  sh_files_pushdir_ro (char * dirName);
 
 /* push a directory on the stack LOGFILE
  */
-int  sh_files_pushdir_log (const char * dirName);
+int  sh_files_pushdir_log (char * dirName);
 
 /* push a directory on the stack GROWING LOGFILE
  */
-int  sh_files_pushdir_glog (const char * dirName);
+int  sh_files_pushdir_glog (char * dirName);
 
 /* push a directory on the stack IGNORE NONE
  */
-int  sh_files_pushdir_noig (const char * dirName);
+int  sh_files_pushdir_noig (char * dirName);
 
 /* push a directory on the stack IGNORE ALL 
  */
-int  sh_files_pushdir_allig (const char * dirName);
+int  sh_files_pushdir_allig (char * dirName);
 
 
 /* push a file on the stack USER0
  */
-int  sh_files_pushfile_user0 (const char * dirName);
+int  sh_files_pushfile_user0 (char * dirName);
 
 /* push a file on the stack USER1
  */
-int  sh_files_pushfile_user1 (const char * dirName);
-
-/* push a file on the stack USER2
- */
-int  sh_files_pushfile_user2 (const char * dirName);
-
-/* push a file on the stack USER3
- */
-int  sh_files_pushfile_user3 (const char * dirName);
-
-/* push a file on the stack USER4
- */
-int  sh_files_pushfile_user4 (const char * dirName);
+int  sh_files_pushfile_user1 (char * dirName);
 
 /* push a file on the stack PRELINK
  */
-int  sh_files_pushfile_prelink (const char * dirName);
+int  sh_files_pushfile_prelink (char * dirName);
 
 /* push a file on the stack ATTR
  */
-int  sh_files_pushfile_attr (const char * dirName);
+int  sh_files_pushfile_attr (char * dirName);
 
 /* push a file on the stack READONLY
  */
-int  sh_files_pushfile_ro (const char * dirName);
+int  sh_files_pushfile_ro (char * dirName);
 
 /* push a file on the stack LOGFILE
  */
-int  sh_files_pushfile_log (const char * dirName);
+int  sh_files_pushfile_log (char * dirName);
 
 /* push a file on the stack GROWING LOGFILE
  */
-int  sh_files_pushfile_glog (const char * dirName);
+int  sh_files_pushfile_glog (char * dirName);
 
 /* push a file on the stack IGNORE NONE
  */
-int  sh_files_pushfile_noig (const char * dirName);
+int  sh_files_pushfile_noig (char * dirName);
 
 /* push a file on the stack IGNORE ALL
  */
-int  sh_files_pushfile_allig (const char * dirName);
+int  sh_files_pushfile_allig (char * dirName);
 
 
@@ -221,6 +147,4 @@
 unsigned long sh_files_chk       (void);
 
-int sh_files_delglobstack (void);
-
 int sh_files_deldirstack (void);
 
@@ -229,34 +153,14 @@
 /* redefine policies
  */
-int sh_files_redef_user0(const char * str);
-int sh_files_redef_user1(const char * str);
-int sh_files_redef_user2(const char * str);
-int sh_files_redef_user3(const char * str);
-int sh_files_redef_user4(const char * str);
-int sh_files_redef_prelink(const char * str);
-int sh_files_redef_readonly(const char * str);
-int sh_files_redef_loggrow(const char * str);
-int sh_files_redef_logfiles(const char * str);
-int sh_files_redef_attributes(const char * str);
-int sh_files_redef_noignore(const char * str);
-int sh_files_redef_allignore(const char * str);
+int sh_files_redef_user0(char * str);
+int sh_files_redef_user1(char * str);
+int sh_files_redef_prelink(char * str);
+int sh_files_redef_readonly(char * str);
+int sh_files_redef_loggrow(char * str);
+int sh_files_redef_logfiles(char * str);
+int sh_files_redef_attributes(char * str);
+int sh_files_redef_noignore(char * str);
+int sh_files_redef_allignore(char * str);
 
-ShFileType sh_files_filecheck (int class, unsigned long check_flags,
-			       const char * dirName, 
-			       const char * infileName,
-			       int * reported, 
-			       int rsrcflag);
-
-int sh_files_checkdir (int iclass, unsigned long check_flags, 
-		       int idepth, char * iname, 
-		       char * relativeName);
-
-int sh_files_search_file(char * name, int * class, 
-			 unsigned long *check_flags, int * reported);
-int sh_files_search_dir(char * name, int * class, 
-			unsigned long *check_flags, int *reported,
-			int * rdepth);
-void sh_files_set_file_reported(const char * name);
-void sh_files_clear_file_reported(const char * name);
 
 #endif
Index: trunk/include/sh_filter.h
===================================================================
--- trunk/include/sh_filter.h	(revision 591)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#ifndef SH_FILTER_H
-#define SH_FILTER_H
-
-/* Filtering
- */
-
-#define SH_FILT_NUM 32
-#define SH_FILT_OR  0
-#define SH_FILT_AND 1
-#define SH_FILT_NOT 2
-#define SH_FILT_INIT { 0, { NULL }, 0, { NULL }, 0, { NULL }}
-
-/* Pattern storage is of type void since it may be a char*
- * or a regex_t*
- */
-typedef struct _sh_filter_type
-{
-  int      for_c;
-  void   * for_v[SH_FILT_NUM];
-  int      fand_c;
-  void   * fand_v[SH_FILT_NUM];
-  int      fnot_c;
-  void   * fnot_v[SH_FILT_NUM];
-
-} sh_filter_type;
-
-int  sh_filter_add (const char * str, sh_filter_type * filter, int type);
-
-void sh_filter_free (sh_filter_type * filter);
-
-int  sh_filter_filter (const char * message, sh_filter_type * filter);
-
-sh_filter_type * sh_filter_alloc(void);
-
-#endif
Index: trunk/include/sh_forward.h
===================================================================
--- trunk/include/sh_forward.h	(revision 1)
+++ trunk/include/sh_forward.h	(revision 1)
@@ -0,0 +1,111 @@
+/* SAMHAIN file system integrity testing                                   */
+/* Copyright (C) 1999 Rainer Wichmann                                      */
+/*                                                                         */
+/*  This program 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.                                    */
+/*                                                                         */
+/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
+
+#ifndef SH_FORWARD_H
+#define SH_FORWARD_H
+
+#ifndef SH_STANDALONE
+int sh_forward_set_strip (char * str);
+
+#endif
+
+/* generate a random password
+ */
+int sh_forward_create_password (char * dummy);
+
+/* set time limit
+ */
+int sh_forward_set_time_limit(char * str);
+
+/* error level for lookup failure
+ */
+int sh_forward_lookup_level (char * c);
+
+/* create client entry for given password
+ */
+int sh_forward_make_client (char * str);
+
+#ifdef SH_WITH_SERVER
+
+#ifdef INET_SYSLOG
+int set_syslog_active(char * c);
+#endif
+
+/* create socket and start listening
+ */
+void create_server_tcp_socket ();
+
+/* whether to use client address as known to the communication layer
+ * and set by accept()
+ */
+int set_socket_peer (char * c);
+
+/* whether to use client severity
+ */
+int sh_forward_use_clt_sev (char * c);
+
+/* whether to use client class
+ */
+int sh_forward_use_clt_class (char * c);
+
+/* server port
+ */
+int sh_forward_set_port(char * c);
+
+/* server interface
+ */
+int sh_forward_set_interface(char * c);
+
+/* a wrapper function
+ */
+void sh_forward_html_write(void);
+
+/* register a client
+ */
+int sh_forward_register_client (char * str);
+
+/* start server
+ */
+void sh_receive(void);
+
+/* free() everything
+ */
+void sh_forward_free_all (void);
+
+#endif
+
+#ifdef SH_WITH_CLIENT
+/* talk to server
+ */
+long  sh_forward (char * errmsg);
+
+
+/* request file from server. file may be "CONF" or "DATA".
+ */
+long sh_forward_req_file (char * file);
+
+/* set log server
+ */
+int sh_forward_setlogserver (char * address);
+void reset_count_dev_server(void);
+
+#endif
+
+#endif
+
Index: trunk/include/sh_gpg.h
===================================================================
--- trunk/include/sh_gpg.h	(revision 1)
+++ trunk/include/sh_gpg.h	(revision 1)
@@ -0,0 +1,46 @@
+/* SAMHAIN file system integrity testing                                   */
+/* Copyright (C) 1999 Rainer Wichmann                                      */
+/*                                                                         */
+/*  This program 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.                                    */
+/*                                                                         */
+/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
+
+#if (defined(WITH_GPG) || defined(WITH_PGP))
+
+#ifndef SH_GPG_H
+#define SH_GPG_H
+/* this function exits if configuration file
+ * and/or database cannot be verified; otherwise returns 0
+ */
+int sh_gpg_check_sign (long file_1, long file_2, int what);
+
+#endif
+
+/* #ifdef WITH_GPG */
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/include/sh_gpg_chksum.h
===================================================================
--- trunk/include/sh_gpg_chksum.h	(revision 1)
+++ trunk/include/sh_gpg_chksum.h	(revision 1)
@@ -0,0 +1,53 @@
+#ifndef CHKSUM_H
+#define CHKSUM_H
+char gpgchk[50];
+gpgchk[0] = '4';
+gpgchk[1] = '0';
+gpgchk[2] = '7';
+gpgchk[3] = '8';
+gpgchk[4] = '4';
+gpgchk[5] = '6';
+gpgchk[6] = '0';
+gpgchk[7] = '1';
+gpgchk[8] = '7';
+gpgchk[9] = '5';
+gpgchk[10] = 'D';
+gpgchk[11] = '0';
+gpgchk[12] = '1';
+gpgchk[13] = 'B';
+gpgchk[14] = '4';
+gpgchk[15] = '4';
+gpgchk[16] = 'B';
+gpgchk[17] = '5';
+gpgchk[18] = 'E';
+gpgchk[19] = '3';
+gpgchk[20] = 'A';
+gpgchk[21] = '4';
+gpgchk[22] = '0';
+gpgchk[23] = 'E';
+gpgchk[24] = '4';
+gpgchk[25] = '4';
+gpgchk[26] = '0';
+gpgchk[27] = '1';
+gpgchk[28] = '6';
+gpgchk[29] = '3';
+gpgchk[30] = '3';
+gpgchk[31] = '3';
+gpgchk[32] = 'C';
+gpgchk[33] = 'F';
+gpgchk[34] = '3';
+gpgchk[35] = 'C';
+gpgchk[36] = '5';
+gpgchk[37] = '6';
+gpgchk[38] = 'A';
+gpgchk[39] = '7';
+gpgchk[40] = 'A';
+gpgchk[41] = 'B';
+gpgchk[42] = 'D';
+gpgchk[43] = '9';
+gpgchk[44] = '1';
+gpgchk[45] = '9';
+gpgchk[46] = '6';
+gpgchk[47] = '6';
+gpgchk[48] = '\0';
+#endif
Index: trunk/include/sh_guid.h
===================================================================
--- trunk/include/sh_guid.h	(revision 591)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 2015 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-
-#ifndef SH_GUID_H
-#define SH_GUID_H
-
-
-#define SH_UUID_BUF 37
-
-char * sh_uuid_generate_random(char * out, size_t len);
-
-/* return 0 if it looks like a uuid
- */
-int sh_uuid_check(const char * in);
-
-#endif
-
Index: trunk/include/sh_hash.h
===================================================================
--- trunk/include/sh_hash.h	(revision 591)
+++ trunk/include/sh_hash.h	(revision 1)
@@ -28,19 +28,7 @@
 #include "sh_error.h"
 
-/* the report_checkflags flag
- */
-int get_report_checkflags();
-
-/* whether to report checkflags
- */
-int set_report_checkflags(const char * c);
-
-/* convert to policy string
- */
-const char * sh_hash_getpolicy(int class);
-
 /* format a uint64
  */
-char * sh_hash_size_format(void);
+char * sh_hash_size_format();
 
 /* report on a missing file
@@ -48,41 +36,23 @@
 int hashreport_missing( char *fullpath, int level);
 
-/* remove internal db record for a file (checks for some flags).
+/* write database to stdout
  */
-void sh_hash_remove (const char * path);
+int sh_hash_pushdata_stdout (char * str);
 
-/* remove internal db record for a file
+/* version string for database
  */
-void sh_hash_remove_unconditional (const char * path);
+int sh_hash_version_string(char * str);
 
-/* Insert a "null" record in-memory (representing a missing file).
+/* List database content
  */
-void sh_hash_insert_null(char * str);
-
-#ifdef SH_DBIO_INT_H
-/* Check for "null" record
- */
-int sh_hash_is_null_record(sh_filestore_t * theFile);
-#endif
-
-/* Dont report on ctm/mtm change for directories
- */
-int sh_hash_loosedircheck(const char * str);
-
-/* List database content for a single file
- */
-int set_list_file (const char * c);
-
-/* Set the path of that file
- */
-char * get_list_file();
+int sh_hash_list_db (char * db_file);
 
 /* List database content with full detail
  */
-int set_full_detail (const char * c);
+int set_full_detail (char * c);
 
 /* List database content with full detail, comma delimited
  */
-int set_list_delimited (const char * c);
+int set_list_delimited (char * c);
 
 /* Read the database from disk.
@@ -90,24 +60,11 @@
 void sh_hash_init (void);
 
-/* Check init status
- */
-int sh_hash_get_initialized();
-
-/* Read the database from disk and fill sh.data.hash with checksum.
- */
-void sh_hash_init_and_checksum();
-
-/* Set status to 'database is read in'.
- */
-void sh_hash_set_initialized();
-
 /* Check whether a file is present in the database.
  */
-int sh_hash_have_it (const char * newname);
+int sh_hash_have_it (char * newname);
 
 /* Get a file if it is present in the database.
- * If fileHash != NULL also return checksum.
  */
-int sh_hash_get_it (const char * newname, file_type * tmpFile, char * fileHash);
+int sh_hash_get_it (char * newname, file_type * tmpFile);
 
 /* Delete the database from memory.
@@ -121,25 +78,9 @@
 /* reset sh_hash_pushdata to use 'update' in daemon mode
  */
-void sh_hash_pushdata_reset (void);
+void sh_hash_pushdata_reset ();
 
 /* Insert a file into the in-memory database.
  */ 
 void sh_hash_pushdata_memory (file_type * theFile, char * fileHash);
-
-/* Get file flags from in-memory database
- */
-int sh_hash_getflags (char * filename);
-
-/* Set file flags in in-memory database
- */
-int sh_hash_setflags (char * filename, int flags);
-
-/* Set a file flag in in-memory database
- */
-void sh_hash_set_flag  (char * filename, int flag);
-
-/* Unset a file flag in in-memory database
- */
-void sh_hash_clear_flag (char * filename, int flag_to_set);
 
 /* Compare a file with its status in the database.
@@ -151,8 +92,4 @@
  */
 void sh_hash_unvisited (ShErrLevel level);
-
-/* Search for unvisited entries in the database, custom error handler.
- */
-void sh_hash_unvisited_custom (char prefix, void(*handler)(const char * key));
 
 /* Set a file's status to 'visited'. This is required for
@@ -178,28 +115,18 @@
 int hash_full_tree (void); 
 
-/* Insert data.
- * 'key' -> path
- * 'str' -> binary with size 'size'
+/* Insert data
  */
-struct store2db {
-  UINT64 val0;
-  UINT64 val1;
-  UINT64 val2;
-  UINT64 val3;
-  char   checksum[KEY_LEN+1];
-  unsigned char * str;
-  int size;
-};
-
-void sh_hash_push2db (const char * key, struct store2db * save);
-
+void sh_hash_push2db (char * key, unsigned long val1, 
+		      unsigned long val2, unsigned long val3,
+		      unsigned char * str, int size);
 
 /* Retrieve data
  */
-char * sh_hash_db2pop (const char * key,  struct store2db * get);
-
+char * sh_hash_db2pop (char * key, unsigned long * val1, 
+		       unsigned long * val2, unsigned long * val3,
+		       int * size);
 
 /* Write out database
  */
-int sh_hash_writeout(void);
+int sh_hash_writeout();
 #endif
Index: trunk/include/sh_html.h
===================================================================
--- trunk/include/sh_html.h	(revision 591)
+++ trunk/include/sh_html.h	(revision 1)
@@ -53,5 +53,4 @@
   int                     encf_flag;
   int                     ency_flag;
-  int                     ivst_flag;
   int                     status_now;
   int                     status_arr[CLT_MAX];
Index: trunk/include/sh_ignore.h
===================================================================
--- trunk/include/sh_ignore.h	(revision 591)
+++ trunk/include/sh_ignore.h	(revision 1)
@@ -2,13 +2,11 @@
 #define SH_IGNORE_H
 
-int sh_ignore_add_del (const char * addpath);
-int sh_ignore_add_new (const char * addpath);
-int sh_ignore_add_mod (const char * addpath);
+int sh_ignore_add_del (char * addpath);
+int sh_ignore_add_new (char * addpath);
 
 int sh_ignore_chk_del (const char * chkpath);
 int sh_ignore_chk_new (const char * chkpath);
-int sh_ignore_chk_mod (const char * chkpath);
 
-int sh_ignore_clean (void);
+int sh_ignore_clean ();
 
 #endif
Index: trunk/include/sh_inotify.h
===================================================================
--- trunk/include/sh_inotify.h	(revision 591)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#ifndef SH_INOTIFY_H
-#define SH_INOTIFY_H
-
-#define SH_INOTIFY_MAX 128
-
-typedef struct 
-{
-  void * list_of_watches;
-  void * dormant_watches;
-
-  /*
-  int    watch[SH_INOTIFY_MAX];
-  int    flag[SH_INOTIFY_MAX];
-  char * file[SH_INOTIFY_MAX];
-  */
-
-  int     count;
-  int  max_count;
-} sh_watches;
-
-/* #define SH_INOTIFY_INITIALIZER { { 0 }, { 0 }, { NULL}, 0, 0 } */
-
-#define SH_INOTIFY_INITIALIZER { NULL, NULL, 0, 0 }
-
-#define SH_INOTIFY_FILE 0
-#define SH_INOTIFY_DIR  1
-
-int sh_inotify_wait_for_change(char * filename, sh_watches * watches, 
-			       int  * errnum,   int waitsec);
-
-int sh_inotify_rm_watch (sh_watches * watches, sh_watches * save, int wd);
-
-int sh_inotify_add_watch(char * filename, sh_watches * watches, int  * errnum,
-			 int class, unsigned long check_flags, int type, int rdepth);
-
-int sh_inotify_add_watch_later(const char * filename, sh_watches * watches, 
-			       int  * errnum,
-			       int class, unsigned long check_flags, 
-			       int type, int rdepth);
-
-char * sh_inotify_pop_dormant(sh_watches * watches, int * class, 
-			      unsigned long * check_flags, int * type, int * rdepth);
-
-void sh_inotify_purge_dormant(sh_watches * watches);
-void sh_inotify_remove(sh_watches * watches);
-void sh_inotify_init(sh_watches * watches);
-void sh_inotify_close();
-
-char * sh_inotify_search_item(sh_watches * watches, int watch, 
-			      int * class, unsigned long * check_flags, 
-			      int * type, int * rdepth);
-ssize_t sh_inotify_read(char * buffer, size_t count);
-ssize_t sh_inotify_read_timeout(char * buffer, size_t count, int timeout);
-int sh_inotify_recheck_watches (sh_watches * watches, sh_watches * save);
-
-#define SH_INOTIFY_ERROR(a) (a != 0)
-
-#endif
Index: trunk/include/sh_ipvx.h
===================================================================
--- trunk/include/sh_ipvx.h	(revision 591)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#ifndef SH_IPVX_H
-#define SH_IPVX_H
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#if defined(USE_IPVX)
-#define SH_SSP_LEN(a) ((a)->ss_family == AF_INET) ? \
-	sizeof(struct sockaddr_in) : \
-	sizeof(struct sockaddr_in6)
-
-#define SH_SS_LEN(a) ((a).ss_family == AF_INET) ? \
-	sizeof(struct sockaddr_in) : \
-	sizeof(struct sockaddr_in6)
-#else
-#define SH_SSP_LEN(a) sizeof(struct sockaddr_in)
-#define SH_SS_LEN(a)  sizeof(struct sockaddr_in)
-#endif
-
-struct sh_sockaddr {
-  int ss_family;
-
-  struct sockaddr_in  sin;
-#if defined(USE_IPVX)
-  struct sockaddr_in6 sin6;
-#endif
-};
-
-/* Cast a sockaddress
- */
-struct sockaddr * sh_ipvx_sockaddr_cast (struct sh_sockaddr * ss);
-
-/* Compare with any_address
- */
-int sh_ipvx_isany (struct sh_sockaddr * a);
-
-/* Compare two addresses
- */
-int sh_ipvx_cmp(struct sh_sockaddr * a, struct sh_sockaddr * b);
-
-/* Set the port
- */
-int sh_ipvx_set_port(struct sh_sockaddr * ss, int port);
-
-/* Get the port
- */
-int sh_ipvx_get_port(struct sh_sockaddr * ss);
-
-/* Save a sockaddress
- */
-void sh_ipvx_save(struct sh_sockaddr * ss, int sa_family, struct sockaddr * sa);
-
-/* Ascii numerical sockaddress
- */
-char * sh_ipvx_print_sockaddr (struct sockaddr * sa, int sa_family);
-
-/* Determine whether the given address is numeric
- */
-int sh_ipvx_is_numeric (const char * addr);
-
-/* Convert a network address to an ascii numeric address
- */
-int sh_ipvx_ntoa (char * name, size_t name_size, struct sh_sockaddr * ss);
-
-/* Convert an ascii numeric address to a network address
- */
-int sh_ipvx_aton (const char * name, struct sh_sockaddr * ss);
-
-/* Try to find canonical hostname
- */
-char * sh_ipvx_canonical(const char * hostname, char * numeric, size_t nlen);
-
-/* Convert address to hostname
- */
-char * sh_ipvx_addrtoname(struct sh_sockaddr * ss);
-
-/* Try a reverse lookup
- */
-int sh_ipvx_reverse_check_ok (char * peer, int port, struct sh_sockaddr * ss);
-#endif
Index: trunk/include/sh_kern.h
===================================================================
--- trunk/include/sh_kern.h	(revision 1)
+++ trunk/include/sh_kern.h	(revision 1)
@@ -0,0 +1,30 @@
+
+#ifndef SH_KERN_H
+#define SH_KERN_H
+
+#include "sh_modules.h"
+
+#ifdef SH_USE_KERN
+int sh_kern_init  (void);
+int sh_kern_timer (time_t tcurrent);
+int sh_kern_check (void);
+int sh_kern_end   (void);
+int sh_kern_null  (void);
+
+int sh_kern_set_activate (char * c);
+int sh_kern_set_severity (char * c);
+int sh_kern_set_timer    (char * c);
+int sh_kern_set_idt      (char * c);
+
+/* FIXME: document these */
+int sh_kern_set_sct_addr (char * c);
+int sh_kern_set_sc_addr  (char * c);
+int sh_kern_set_proc_root (char * c);
+int sh_kern_set_proc_root_lookup (char * c);
+int sh_kern_set_proc_root_iops (char * c);
+
+extern sh_rconf sh_kern_table[];
+#endif
+
+/* #ifndef SH_UTMP_H */
+#endif
Index: trunk/include/sh_log_check.h
===================================================================
--- trunk/include/sh_log_check.h	(revision 591)
+++ 	(revision )
@@ -1,138 +1,0 @@
-#ifndef SH_LOGCHECK_H
-#define SH_LOGCHECK_H
-
-#include <sys/types.h>
-#include <time.h>
-
-/* Convert a struct tm to unix timestamp with caching 
- */
-time_t conv_timestamp (struct tm * btime, 
-		       struct tm * old_tm, time_t * old_time);
-
-/* Definition of a log record entry, to be returned from parsing function.
- */
-#define PID_INVALID 0
-struct sh_logrecord 
-{
-  char      * filename;
-  sh_string * host;
-  sh_string * timestr;
-  pid_t       pid;
-  time_t      timestamp;
-  sh_string * message;
-};
-
-#define SH_LOGFILE_MOVED  (1<<0)
-#define SH_LOGFILE_REWIND (1<<1)
-#define SH_LOGFILE_PIPE   (1<<2)
-#define SH_LOGFILE_NOFILE (1<<3)
-
-struct sh_logfile 
-{
-  FILE * fp;
-  int    flags;
-  char * filename;
-  dev_t  device_id;
-  ino_t  inode;
-  fpos_t offset;
-
-  /* Info for the parser, e.g. a regular expression
-   */
-  void * fileinfo;
-
-  /* Callback function to read the next record
-   */
-  sh_string *           (*get_record)  (sh_string * record, 
-					struct sh_logfile * logfile);
-
-  /* Callback function to parse the record into standard format
-   */
-  struct sh_logrecord * (*parse_record)(sh_string * logline, void * fileinfo);
-
-  struct sh_logfile * next;
-};
-
-/* Generic callback function to parse fileinfo. 
- */
-void * sh_eval_fileinfo_generic(char * str);
-
-/* Generic parser info. 
- */
-struct sh_logrecord * sh_parse_generic (sh_string * logline, void * fileinfo);
-
-
-/****************************************************************
- **
- ** Parsing and reading functions
- **/
-
-/* Open file, position at stored offset. */
-int sh_open_for_reader (struct sh_logfile * logfile);
-
-/* Simple line reader for executed shell command   */ 
-sh_string * sh_command_reader (sh_string * record, 
-			       struct sh_logfile * logfile);
-
-/* Wrapper for sh_command_reader */
-sh_string * sh_read_shell (sh_string * record, struct sh_logfile * logfile);
-
-/* Parses a shell command reply. */
-struct sh_logrecord * sh_parse_shell (sh_string * logline, void * fileinfo);
-
-/* Simple line reader.   */ 
-sh_string * sh_default_reader (sh_string * record, 
-			       struct sh_logfile * logfile);
-
-/* Continued line reader.   */ 
-sh_string * sh_cont_reader (sh_string * record, 
-			    struct sh_logfile * logfile, char * cont);
-
-/* Binary reader */
-sh_string * sh_binary_reader (void * s, size_t size, struct sh_logfile * logfile);
-
-/* Parses a syslog-style line. */
-struct sh_logrecord * sh_parse_syslog (sh_string * logline, void * fileinfo);
-
-/* Format info for apache log. */
-void * sh_eval_fileinfo_apache(char * str);
-
-/* Parses a apache-style line. */
-struct sh_logrecord * sh_parse_apache (sh_string * logline, void * fileinfo);
-
-/* Get a pacct record */
-sh_string * sh_read_pacct (sh_string * record, struct sh_logfile * logfile);
-
-/* Parses a pacct record. */
-struct sh_logrecord * sh_parse_pacct (sh_string * logline, void * fileinfo);
-
-/* Get a samba record */
-sh_string * sh_read_samba (sh_string * record, struct sh_logfile * logfile);
-
-/* Parses a samba record. */
-struct sh_logrecord * sh_parse_samba (sh_string * logline, void * fileinfo);
-
-
-/**
-*****************************************************************/
-
-int sh_get_hidepid();
-int sh_set_hidepid(const char *s);
-
-#define SH_MAX_LCODE_SIZE 16
-
-struct sh_logfile_type 
-{
-  char code[SH_MAX_LCODE_SIZE];
-
-  /* read callback */
-  /*@null@*/sh_string * (*get_record)  (sh_string * record,
-					struct sh_logfile * logfile);
-  /* parsing callback */
-  struct sh_logrecord * (*parse_record)(sh_string * logline, void * fileinfo);
-
-  /* evaluate fileinfo */
-  void * (*eval_fileinfo)(char * str); 
-};
-
-
-#endif
Index: trunk/include/sh_log_correlate.h
===================================================================
--- trunk/include/sh_log_correlate.h	(revision 591)
+++ 	(revision )
@@ -1,28 +1,0 @@
-#ifndef SH_LOG_CORRELATE_H
-#define SH_LOG_CORRELATE_H
-
-/* Clean up everything.
- */
-void sh_keep_destroy();
-
-/* Add an event 
- */
-int sh_keep_add(sh_string * label, unsigned long delay, time_t last);
-
-/* Add an event sequence matching rule 
- */
-int sh_keep_match_add(const char * str, const char * queue, const char * pattern);
-
-/* Delete the list of event sequence matching rules
- */
-void sh_keep_match_del();
-
-/* Try to find correlated events
- */
-void sh_keep_match();
-
-/* Deadtime for a correlation rule
- */
-int sh_keep_deadtime (const char * str);
-
-#endif
Index: trunk/include/sh_log_evalrule.h
===================================================================
--- trunk/include/sh_log_evalrule.h	(revision 591)
+++ 	(revision )
@@ -1,61 +1,0 @@
-#ifndef SH_EVALRULE_H
-#define SH_EVALRULE_H
-
-/* Clean up everything.
- */
-void sh_eval_cleanup();
-
-/* Define a new reporting queue, str := label:interval:(report|sum):severity
- */
-int sh_eval_qadd (const char * str);
-
-/* Add a new rule, str := queue:regex
- * If there is an open group, add it to its rules.
- * ..else, add it to the currently open host (open the
- * default host, if there is no open one)
- */
-int sh_eval_radd (const char * str);
-
-/* Open a new host group definition.
- */
-int sh_eval_hadd (const char * str);
-/*
- * End the host definition
- */
-int sh_eval_hend (const char * str);
-
-
-/* Open a new group definition. If a host is currently open, 
- * the new group will automatically be added to that host.
- */
-int sh_eval_gadd (const char * str);
-/*
- * End the group definition
- */
-int sh_eval_gend (const char * str);
-
-/* Process a single log record
- */
-int sh_eval_process_msg(struct sh_logrecord * record);
-
-enum policies {
-  EVAL_REPORT,
-  EVAL_SUM
-};
-
-struct sh_qeval  /* Queue with definitions */
-{
-  sh_string       * label;
-  enum policies     policy;
-  int               severity;
-  sh_string       * alias;
-  time_t            interval;        /* if EVAL_SUM, interval   */ 
-  struct sh_qeval * next;
-};
-
-struct sh_qeval * sh_log_find_queue(const char * str);
-
-int sh_log_lookup_severity(const char * str);
-sh_string * sh_log_lookup_alias(const char * str);
-
-#endif
Index: trunk/include/sh_log_mark.h
===================================================================
--- trunk/include/sh_log_mark.h	(revision 591)
+++ 	(revision )
@@ -1,14 +1,0 @@
-#ifndef SH_LOG_MARK_H
-#define SH_LOG_MARK_H
-
-void sh_log_mark_destroy();
-
-int sh_log_mark_add (const char * label, time_t interval, const char * qlabel);
-
-void sh_log_mark_update (sh_string * label, time_t timestamp);
-
-void sh_log_mark_check();
-
-int sh_log_set_mark_severity (const char * str);
-
-#endif
Index: trunk/include/sh_log_repeat.h
===================================================================
--- trunk/include/sh_log_repeat.h	(revision 591)
+++ 	(revision )
@@ -1,14 +1,0 @@
-#ifndef SH_LOG_REPEAT_H
-#define SH_LOG_REPEAT_H
-
-int sh_repeat_set_trigger (const char * str);
-
-int sh_repeat_set_queue (const char * str);
-
-int sh_repeat_set_cron (const char * str);
-
-int sh_repeat_message_check (const sh_string * host, 
-			     const sh_string * msg, 
-			     time_t ltime);
-
-#endif
Index: trunk/include/sh_logmon.h
===================================================================
--- trunk/include/sh_logmon.h	(revision 591)
+++ 	(revision )
@@ -1,12 +1,0 @@
-#ifndef SH_LOGMON_H
-#define SH_LOGMON_H
-
-extern sh_rconf sh_log_check_table[];
-
-int sh_log_check_init (struct mod_type * arg);
-int sh_log_check_timer(time_t tcurrent);
-int sh_log_check_check(void);
-int sh_log_check_reconf(void); 
-int sh_log_check_cleanup(void);
-
-#endif
Index: trunk/include/sh_mail.h
===================================================================
--- trunk/include/sh_mail.h	(revision 591)
+++ trunk/include/sh_mail.h	(revision 1)
@@ -26,17 +26,17 @@
 /* set a relay server
  */
-int sh_mail_set_relay (const char * str_s);
+int sh_mail_set_relay (char * str_s);
 
 /* send to all recpts. in one mail
  */
-int sh_mail_setFlag (const char * str);
+int sh_mail_setFlag (char * str);
 
 /* set the subject string 
  */
-int set_mail_subject (const char * str);
+int set_mail_subject (char * str);
 
 /* test mailbox
  */
-int sh_mail_sigverify (const char * s);
+int sh_mail_sigverify (char * s);
 
 /* maximum number of mail attempts
@@ -44,21 +44,25 @@
 #define SH_MAX_FAIL    48
 
-int sh_mail_setNum (const char * str);
+int sh_mail_setNum (char * str);
 
-int sh_mail_setaddress (const char * address);
+int sh_mail_setaddress (char * address);
 void reset_count_dev_mail(void);
-int sh_mail_setaddress_int (const char * address);
+int sh_mail_setaddress_int (char * address);
 
 /* call if not urgent
  */
-int sh_mail_pushstack (int severity, const char * msg, const char * alias);
+int sh_mail_pushstack (/*@null@*/char * msg);
 
-/* Set the port to use (default 25)
+/* call if mail immediate
  */
-int sh_mail_set_port (const char * str);
+int sh_mail_msg (/*@null@*/char * message);
 
 /* set sender of mail
  */
-int sh_mail_set_sender (const char *str);
+int sh_mail_set_sender (char *str);
+
+int sh_mail_add_or  (char * str);
+int sh_mail_add_and (char * str);
+int sh_mail_add_not (char * str);
 
 #endif
Index: trunk/include/sh_mail_int.h
===================================================================
--- trunk/include/sh_mail_int.h	(revision 591)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#ifndef SH_MAIL_INT_H
-#define SH_MAIL_INT_H
-
-extern int sh_mail_all_in_one;
-
-/* MX Resolver Struct
- */
-typedef struct mx_ {
-  int    pref;
-  char * address;
-} mx;
-
-typedef struct dnsrep_ {
-  int    count;
-  mx   * reply;
-} dnsrep;
-
-int free_mx (dnsrep * answers);
-
-/* adress struct
- */
-struct alias {
-  sh_string        * recipient;
-  struct alias     * recipient_list;
-  dnsrep           * mx_list;
-  int                severity;
-  short              send_mail;
-  short              isAlias;
-  sh_filter_type   * mail_filter;
-  struct alias     * next;
-  struct alias     * all_next;
-};
-
-extern struct alias * all_recipients;
-
-int sh_mail_msg (const char * message);
-
-/* Per recipient mail key
- */
-
-int sh_nmail_get_mailkey (const char * alias, char * buf, size_t bufsiz,
-			  time_t * id_audit);
-
-SH_MUTEX_EXTERN(mutex_listall);
-SH_MUTEX_EXTERN(mutex_fifo_mail);
-extern SH_FIFO * fifo_mail;
-
-#endif
Index: trunk/include/sh_mem.h
===================================================================
--- trunk/include/sh_mem.h	(revision 591)
+++ trunk/include/sh_mem.h	(revision 1)
@@ -35,24 +35,13 @@
 #define SH_FREE(a)   sh_mem_free((a), FIL__, __LINE__)
 #define SH_ALLOC(a)  sh_mem_malloc((a), FIL__, __LINE__) 
-#define SH_OALLOC(a,b,c)  sh_mem_malloc((a), (b), (c)) 
 
 #else
 
-#if defined(__GNUC__) && (__GNUC__ >= 3)
-#undef  SH_GNUC_MALLOC
-#define SH_GNUC_MALLOC   __attribute__((malloc))
-#else
-#undef  SH_GNUC_MALLOC
-#define SH_GNUC_MALLOC
-#endif
 
 void   sh_mem_free (/*@only@*//*@out@*//*@null@*/ void * a);
-/*@only@*//*@notnull@*/void * sh_mem_malloc (size_t size) SH_GNUC_MALLOC;
+/*@only@*//*@notnull@*/void * sh_mem_malloc (size_t size);
 
 #define SH_FREE(a)   sh_mem_free(a)
 #define SH_ALLOC(a)  sh_mem_malloc(a)
-#define SH_OALLOC(a,b,c)  ((void) (b),		 \
-			   (void) (c),		 \
-			   sh_mem_malloc(a))	 \
 
 #endif
Index: trunk/include/sh_modules.h
===================================================================
--- trunk/include/sh_modules.h	(revision 591)
+++ trunk/include/sh_modules.h	(revision 1)
@@ -2,13 +2,4 @@
 #ifndef SH_MODULE_H
 #define SH_MODULE_H
-
-#include "sh_pthread.h"
-
-enum
-  {
-    SH_MODFL_NOTIMER    = (1 << 0),
-    SH_MODFL_NEEDPAUSED = (1 << 1),
-    SH_MODFL_ISPAUSED   = (1 << 2)
-  };
 
 
@@ -16,5 +7,5 @@
 {
   char * the_opt;
-  int (*func)(const char * opt);
+  int (*func)(char * opt);
 } sh_rconf;
 
@@ -27,9 +18,6 @@
   int    initval; 
 
-  /* Flags: SH_MOD_NOTIMER                                     */
-  int    flags; 
-
   /* The initialization function. Return 0 on success.         */
-  int (* mod_init)    (struct mod_type * arg);  
+  int (* mod_init)    (void);  
                              
   /* The timer function. Return 0 if NOT time to check.        */
@@ -37,5 +25,4 @@
 
   /* The check function. Return 0 on success.                  */
-  /* Return nonzero on fatal error or if module is disabled.   */
   int (* mod_check)   (void); 
 
@@ -52,6 +39,4 @@
   sh_rconf * conf_table; 
 
-  SH_MUTEX(mod_mutex);
-
 } sh_mtype;
 
Index: trunk/include/sh_mounts.h
===================================================================
--- trunk/include/sh_mounts.h	(revision 591)
+++ trunk/include/sh_mounts.h	(revision 1)
@@ -11,5 +11,5 @@
 
 #ifdef SH_USE_MOUNTS
-int sh_mounts_init  (struct mod_type * arg);
+int sh_mounts_init  (void);
 int sh_mounts_timer (time_t tcurrent);
 int sh_mounts_check (void);
Index: trunk/include/sh_nmail.h
===================================================================
--- trunk/include/sh_nmail.h	(revision 591)
+++ 	(revision )
@@ -1,20 +1,0 @@
-#ifndef SH_NMAIL_H
-#define SH_NMAIL_H
-
-int sh_nmail_pushstack (int level, const char * message, 
-			const char * alias);
-int sh_nmail_msg (int level, const char * message, 
-		  const char * alias);
-int sh_nmail_flush ();
-void sh_nmail_free();
-
-int sh_nmail_set_severity (const char * str);
-int sh_nmail_add_not (const char * str);
-int sh_nmail_add_and (const char * str);
-int sh_nmail_add_or  (const char * str);
-
-int sh_nmail_close_recipient(const char * str);
-int sh_nmail_add_compiled_recipient(const char * str);
-int sh_nmail_add_recipient(const char * str);
-int sh_nmail_add_alias(const char * str);
-#endif
Index: trunk/include/sh_portcheck.h
===================================================================
--- trunk/include/sh_portcheck.h	(revision 591)
+++ 	(revision )
@@ -1,13 +1,0 @@
-
-#ifndef SH_PORTCHECK_H
-#define SH_PORTCHECK_H
-
-int sh_portchk_init(struct mod_type * arg);
-int sh_portchk_timer(time_t tcurrent);
-int sh_portchk_check(void);
-int sh_portchk_reconf(void);
-int sh_portchk_cleanup(void);
-
-extern sh_rconf sh_portchk_table[];
-
-#endif
Index: trunk/include/sh_prelink.h
===================================================================
--- trunk/include/sh_prelink.h	(revision 591)
+++ trunk/include/sh_prelink.h	(revision 1)
@@ -6,13 +6,13 @@
  * alert_timeout: timeout for read
  */
-int sh_prelink_run (char * path, char * file_hash, int alert_timeout, unsigned long mask);
+int sh_prelink_run (char * path, char * file_hash, int alert_timeout);
 
 /* return S_TRUE if ELF file, S_FALSE otherwise
  */
-int sh_prelink_iself (SL_TICKET fd, off_t size, int alert_timeout, char * path);
+int sh_prelink_iself (SL_TICKET fd, off_t size, int alert_timeout);
 
 /* configuration
  */
-int sh_prelink_set_path (const char * str);
-int sh_prelink_set_hash (const char * str);
+int sh_prelink_set_path (char * str);
+int sh_prelink_set_hash (char * str);
 #endif
Index: trunk/include/sh_prelude.h
===================================================================
--- trunk/include/sh_prelude.h	(revision 591)
+++ trunk/include/sh_prelude.h	(revision 1)
@@ -2,19 +2,19 @@
 #define SH_PRELUDE_H
 
-void sh_prelude_reset(void);
-void sh_prelude_stop(void);
-int  sh_prelude_init(void);
+void sh_prelude_reset();
+void sh_prelude_stop();
+int  sh_prelude_init();
 
-int sh_prelude_set_profile(const char *arg);
+int sh_prelude_set_profile(char *arg);
 
 int sh_prelude_alert (int priority, int class, char * message,
-		      long msgflags, unsigned long msgid, char * inet_peer_ip);
+		      long msgflags, unsigned long msgid);
 
 /* map severity levels
  */
-int sh_prelude_map_info (const char * str);
-int sh_prelude_map_low (const char * str);
-int sh_prelude_map_medium (const char * str);
-int sh_prelude_map_high (const char * str);
+int sh_prelude_map_info (char * str);
+int sh_prelude_map_low (char * str);
+int sh_prelude_map_medium (char * str);
+int sh_prelude_map_high (char * str);
 
 #endif
Index: trunk/include/sh_processcheck.h
===================================================================
--- trunk/include/sh_processcheck.h	(revision 591)
+++ 	(revision )
@@ -1,13 +1,0 @@
-
-#ifndef SH_PROCESSCHECK_H
-#define SH_PROCESSCHECK_H
-
-int sh_prochk_init(struct mod_type * arg);
-int sh_prochk_timer(time_t tcurrent);
-int sh_prochk_check(void);
-int sh_prochk_reconf(void);
-int sh_prochk_cleanup(void);
-
-extern sh_rconf sh_prochk_table[];
-
-#endif
Index: trunk/include/sh_pthread.h
===================================================================
--- trunk/include/sh_pthread.h	(revision 591)
+++ 	(revision )
@@ -1,180 +1,0 @@
-#ifndef SH_PTHREAD_H
-#define SH_PTHREAD_H
-
-#ifdef HAVE_PTHREAD
-
-#include <pthread.h>
-
-#define SH_MUTEX(M)				pthread_mutex_t M
-#define SH_MUTEX_INIT(M,I)			pthread_mutex_t M = I
-#define SH_MUTEX_STATIC(M,I)			static pthread_mutex_t M = I
-#define SH_MUTEX_EXTERN(M)			extern pthread_mutex_t M
-
-#define SH_SETSIGMASK(A, B, C)                  sh_pthread_setsigmask(A,B,C)
-
-int sh_pthread_setsigmask(int how, const void *set, void *oldset);
-
-/* pthread_mutex_unlock() has the wrong type (returns int), so
- * we need to wrap it in this function.
- */
-extern void sh_pthread_mutex_unlock (void *arg);
-
-#define SH_MUTEX_LOCK(M)						   \
-	do {                                                               \
-                int oldtype;                                               \
-		int executeStack = 1;                                      \
-		pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
-                pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\
-                pthread_mutex_lock(&(M))
-
-#define SH_MUTEX_TRYLOCK(M)						   \
-	do {                                                               \
-                int oldtype;                                               \
-		volatile int executeStack = 0;                             \
-		pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
-                pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\
-                if (0 == pthread_mutex_trylock(&(M))) {		           \
-		  executeStack = 1
-
-#define SH_MUTEX_TRYLOCK_UNLOCK(M)					   \
-                }                                                          \
-		pthread_cleanup_pop(executeStack);                         \
-                pthread_setcanceltype(oldtype, NULL);                      \
-	} while (0)
-
-#define SH_MUTEX_UNLOCK(M)						   \
-		pthread_cleanup_pop(executeStack);                         \
-                pthread_setcanceltype(oldtype, NULL);                      \
-	} while (0)
-
-#define SH_MUTEX_LOCK_UNSAFE(M) pthread_mutex_lock(&(M))
-#define SH_MUTEX_TRYLOCK_UNSAFE(M) pthread_mutex_trylock(&(M))
-#define SH_MUTEX_UNLOCK_UNSAFE(M) pthread_mutex_unlock(&(M))
-
-
-/*
- * ----   Recursive mutex  ----
- */
-#if defined(HAVE_PTHREAD_MUTEX_RECURSIVE)
-
-#define SH_MUTEX_RECURSIVE(M)                                          \
-static pthread_mutex_t M;                                              \
-static void M ## _init (void)                                          \
-{                                                                      \
-  pthread_mutexattr_t   mta;                                           \
-  pthread_mutexattr_init(&mta);                                        \
-  pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE);            \
-  pthread_mutex_init(&(M), &mta);                                      \
-  pthread_mutexattr_destroy(&mta);                                     \
-  return;                                                              \
-}                                                                      \
-static pthread_once_t  M ## _initialized = PTHREAD_ONCE_INIT
-
-#define SH_MUTEX_RECURSIVE_INIT(M)                                     \
-(void) pthread_once(&(M ## _initialized), (M ## _init))
-
-#define SH_MUTEX_RECURSIVE_LOCK(M)					   \
-	do {                                                               \
-                int oldtype;                                               \
-		pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
-                pthread_cleanup_push(sh_pthread_mutex_unlock, (void*)&(M));\
-                pthread_mutex_lock(&(M))
-
-#define SH_MUTEX_RECURSIVE_UNLOCK(M)					   \
-		pthread_cleanup_pop(1);                                    \
-                pthread_setcanceltype(oldtype, NULL);                      \
-	} while (0)
-
-#else
-/* !defined(PTHREAD_MUTEX_RECURSIVE) */
- struct sh_RMutex {
-
-  pthread_mutex_t lock;
-  unsigned int    held;
-  unsigned int    waiters;
-  pthread_t       tid;
-  pthread_cond_t  cv;
-};
-
-void sh_RMutexLock(struct sh_RMutex * tok);
-void sh_RMutexUnlock(void * arg);
-void sh_InitRMutex(struct sh_RMutex * tok);
-
-#define SH_MUTEX_RECURSIVE(M)                                          \
-static struct sh_RMutex M;                                             \
-static void M ## _init (void)                                          \
-{                                                                      \
-  sh_InitRMutex(&(M));                                                 \
-  return;                                                              \
-}                                                                      \
-static pthread_once_t  M ## _initialized = PTHREAD_ONCE_INIT
-
-#define SH_MUTEX_RECURSIVE_INIT(M)                                     \
-(void) pthread_once(&(M ## _initialized), (M ## _init))
-
-#define SH_MUTEX_RECURSIVE_LOCK(M)					   \
-	do {                                                               \
-                int oldtype;                                               \
-		pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);  \
-                pthread_cleanup_push(sh_RMutexUnlock, (void*)&(M));        \
-                sh_RMutexLock(&(M))
-
-#define SH_MUTEX_RECURSIVE_UNLOCK(M)					   \
-		pthread_cleanup_pop(1);                                    \
-                pthread_setcanceltype(oldtype, NULL);                      \
-	} while (0)
-
-#endif
-/* 
- * ----   Global mutexes   ----
- */
-SH_MUTEX_EXTERN(mutex_skey);
-SH_MUTEX_EXTERN(mutex_resolv);
-SH_MUTEX_EXTERN(mutex_pwent);
-SH_MUTEX_EXTERN(mutex_readdir);
-/* Prevent threads from logging while we are in suspend */
-SH_MUTEX_EXTERN(mutex_thread_nolog);
-
-/*
- * ----   Initialize thread-specific conversion area   ----
- */
-extern int sh_g_thread(void);
-
-
-/*
- * ----   Functions for threaded modules   ----
- */
-int sh_pthread_create(void *(*start_routine)(void*), void *arg);
-int sh_pthread_cancel_all(void);
-void sh_threaded_module_reconf(void *arg);
-void * sh_threaded_module_run(void *arg);
-
-#else
-
-#define SH_SETSIGMASK(A, B, C)                  sh_pthread_setsigmask(A,B,C)
-
-int sh_pthread_setsigmask(int how, const void *set, void *oldset);
-
-#define PTHREAD_MUTEX_INITIALIZER               NULL
-#define SH_MUTEX(M)				void *SH_MUTEX_DUMMY_ ## M
-#define SH_MUTEX_INIT(M,I)			extern void *SH_MUTEX_DUMMY_ ## M
-#define SH_MUTEX_STATIC(M,I)			extern void *SH_MUTEX_DUMMY_ ## M
-#define SH_MUTEX_EXTERN(M)			extern void *SH_MUTEX_DUMMY_ ## M
-#define SH_MUTEX_LOCK(M)			((void)0)
-#define SH_MUTEX_TRYLOCK(M)			((void)0)
-#define SH_MUTEX_UNLOCK(M)			((void)0)
-#define SH_MUTEX_TRYLOCK_UNLOCK(M)		((void)0)
-#define SH_MUTEX_LOCK_UNSAFE(M)			((void)0)
-#define SH_MUTEX_TRYLOCK_UNSAFE(M)		(0)
-#define SH_MUTEX_UNLOCK_UNSAFE(M)		((void)0)
-
-#define SH_MUTEX_RECURSIVE(M)                   extern void *SH_MUTEX_DUMMY_ ## M
-#define SH_MUTEX_RECURSIVE_INIT(M)              ((void)0)
-#define SH_MUTEX_RECURSIVE_LOCK(M)		((void)0)
-#define SH_MUTEX_RECURSIVE_UNLOCK(M)		((void)0)
-
-/* #ifdef HAVE_PTHREAD */
-#endif
-
-/* #ifndef SH_PTHREAD_H */
-#endif
Index: trunk/include/sh_registry.h
===================================================================
--- trunk/include/sh_registry.h	(revision 591)
+++ 	(revision )
@@ -1,13 +1,0 @@
-
-#ifndef SH_REGISTRY_H
-#define SH_REGISTRY_H
-
-int sh_reg_check_init(struct mod_type * arg);
-int sh_reg_check_timer(time_t tcurrent);
-int sh_reg_check_run(void);
-int sh_reg_check_reconf(void);
-int sh_reg_check_cleanup(void);
-
-extern sh_rconf sh_reg_check_table[];
-
-#endif
Index: trunk/include/sh_restrict.h
===================================================================
--- trunk/include/sh_restrict.h	(revision 591)
+++ 	(revision )
@@ -1,9 +1,0 @@
-#ifndef SH_RESTRICT_H
-#define SH_RESTRICT_H
-
-int  sh_restrict_define(const char * str);
-void sh_restrict_purge ();
-int  sh_restrict_this(const char * path, UINT64 size, UINT64 perm, SL_TICKET fh);
-int  sh_restrict_add_ftype(const char * str);
-
-#endif
Index: trunk/include/sh_sem.h
===================================================================
--- trunk/include/sh_sem.h	(revision 591)
+++ 	(revision )
@@ -1,14 +1,0 @@
-#ifndef SH_SEM_H
-#define SH_SEM_H
-
-#define SH_SEM_LOCK       -1
-#define SH_SEM_UNLOCK      1
-
-void sh_sem_open();
-void sh_sem_trylock();
-void sh_sem_lock();
-void sh_sem_unlock(long val);
-void sh_sem_close();
-
-int  sh_sem_wait(const char * wait);
-#endif
Index: trunk/include/sh_sig.h
===================================================================
--- trunk/include/sh_sig.h	(revision 591)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 1999 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-#if defined(WITH_SIG) 
-
-#ifndef SH_SIG_H
-#define SH_SIG_H
-
-typedef enum {
-  SIG_CONF,
-  SIG_DATA
-} ShSigFile;
-
-/* Top level function to verify file.
- */
-SL_TICKET sh_sig_extract_signed(SL_TICKET fd);
-SL_TICKET sh_sig_extract_signed_data(SL_TICKET fd);
-
-/* this function exits if configuration file
- * and/or database cannot be verified; otherwise returns 0
- */
-int sh_sig_check_signature (SL_TICKET file, ShSigFile what);
-
-int sh_sig_msg_start(const char * line);
-int sh_sig_msg_startdata(const char * line);
-int sh_sig_msg_end(const char * line);
-int sh_sig_data_end(const char * line);
-
-/* log successful startup
- */
-void sh_sig_log_startup (void);
-
-#endif
-
-/* #ifdef WITH_SIG */
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: trunk/include/sh_socket.h
===================================================================
--- trunk/include/sh_socket.h	(revision 591)
+++ trunk/include/sh_socket.h	(revision 1)
@@ -8,10 +8,5 @@
 
 #if defined (SH_WITH_CLIENT)
-char * sh_socket_get_uuid(int * errflag, unsigned int * count, time_t * last);
-int    sh_socket_store_uuid(const char * cmd);
-int    sh_socket_return_uuid(const char * uuid, unsigned int count, time_t last);
-void   sh_socket_server_cmd(const char * srvcmd);
-int    set_delta_retry_interval(const char * str);
-int    set_delta_retry_count(const char * str);
+void sh_socket_server_cmd(const char * srvcmd);
 #endif
 
@@ -19,9 +14,10 @@
 
 
-int    sh_socket_open_int (void);
-int    sh_socket_remove (void);
+int    sh_socket_open_int ();
+int    sh_socket_remove ();
 char * sh_socket_check(const char * client_name);
-int    sh_socket_poll(void);
+int    sh_socket_poll();
 void   sh_socket_add2reload (const char * clt);
+
 
 #endif
Index: trunk/include/sh_srp.h
===================================================================
--- trunk/include/sh_srp.h	(revision 591)
+++ trunk/include/sh_srp.h	(revision 1)
@@ -21,5 +21,5 @@
 void sh_srp_x (char * salt, char * password);
 int  sh_srp_make_a (void);
-char * sh_srp_M (char * x1, char * x2, char * x3, char * buf, size_t size);
+char * sh_srp_M (char * x1, char * x2, char * x3);
 
 char * sh_srp_verifier (void);
Index: trunk/include/sh_static.h
===================================================================
--- trunk/include/sh_static.h	(revision 591)
+++ trunk/include/sh_static.h	(revision 1)
@@ -15,19 +15,7 @@
 void  sh_setpwent(void);
 struct group * sh_getgrnam(const char *name);
-int sh_getgrnam_r(const char *name, struct group *gbuf,
-               char *buf, size_t buflen, struct group **gbufp);
-
 struct passwd * sh_getpwnam(const char *name);
-int sh_getpwnam_r(const char *name, struct passwd *pwbuf,
-               char *buf, size_t buflen, struct passwd **pwbufp);
-
 struct group * sh_getgrgid(gid_t gid);
-int sh_getgrgid_r(gid_t gid, struct group *gbuf,
-	       char *buf, size_t buflen, struct group **gbufp);
-
 struct passwd * sh_getpwuid(uid_t uid);
-int sh_getpwuid_r(uid_t uid, struct passwd *pwbuf,
-               char *buf, size_t buflen, struct passwd **pwbufp);
-
 #endif
 
@@ -40,15 +28,9 @@
 
 #define sh_initgroups initgroups
-#define sh_getgrnam   getgrnam
-#define sh_getgrnam_r getgrnam_r
 #define sh_getgrgid   getgrgid
-#define sh_getgrgid_r getgrgid_r
+#define sh_getpwent   getpwent
 #define sh_getpwnam   getpwnam
-#define sh_getpwnam_r getpwnam_r
 #define sh_getpwuid   getpwuid
-#define sh_getpwuid_r getpwuid_r
-#define sh_getpwent   getpwent
 #define sh_endpwent   endpwent
-#define sh_setpwent   setpwent
 
 #define sh_gethostbyaddr gethostbyaddr
Index: trunk/include/sh_string.h
===================================================================
--- trunk/include/sh_string.h	(revision 591)
+++ 	(revision )
@@ -1,112 +1,0 @@
-#ifndef SH_STRING_H
-#define SH_STRING_H
-
-#include <stdio.h>
-
-/* String definition and utility functions.
- */
-typedef struct sh_str_struct
-{
-  char * str; /* always NULL terminated               */
-  size_t len; /* without terminating \0               */
-  size_t siz; /* size of allocated buffer             */
-} sh_string;
-
-sh_string * sh_string_new(size_t size);
-void sh_string_destroy(sh_string ** s);
-#define sh_string_str(a) ((a)->str)
-#define sh_string_len(a) ((a)->len)
-
-/* concat string to sh_string
- */
-sh_string * sh_string_cat_lchar(sh_string * s, const char * str, size_t len);
-
-/* add char array to end of string */
-sh_string * sh_string_add_from_char(sh_string * s, const char * str);
-
-/* set sh_string from string
- */
-sh_string * sh_string_set_from_char(sh_string * s, const char * str);
-
-/* create new sh_string from array of given length
- */
-sh_string * sh_string_new_from_lchar(const char * str, size_t len);
-
-#define sh_string_copy(a)  ((a) ? sh_string_new_from_lchar(((a)->str), ((a)->len)) : NULL)
-#define sh_string_add(a,b) ((a && b) ? sh_string_cat_lchar((a), ((b)->str), ((b)->len)) : NULL)
-
-/* create new sh_string from three arrays of given length
- */
-sh_string * sh_string_new_from_lchar3(const char * str1, size_t len1,
-                                      const char * str2, size_t len2,
-                                      const char * str3, size_t len3);
-
-/* Truncate to desired length.
- */
-sh_string * sh_string_truncate(sh_string * s, size_t len);
-
-/* If requested increase is zero, increase by default amount. 
- */
-sh_string * sh_string_grow(sh_string * s, size_t increase);
-
-/* Read a string from a file, with maxlen. Return 0 on EOF,
- * -1 on error, and -2 if a line exceeds maxlen.
- */
-size_t sh_string_read(sh_string * s, FILE * fp, size_t maxlen);
-
-/* Read a string from a file, with maxlen. Return 0 on EOF,
- * -1 on error, and -2 if a line exceeds maxlen.
- * If 'cont' != NULL, continuation lines starting with a char
- * in 'cont' are concatenated.
- */
-size_t sh_string_read_cont(sh_string * s, FILE * fp, size_t maxlen, char *cont);
-
-/* Split array at delim in at most nfields fields. 
- * Empty fields are returned as empty (zero-length) strings. 
- * Leading and trailing WS are removed from token. 
- * The number of fields is returned in 'nfields', their
- * lengths in 'lengths'.
- * A single delimiter will return two empty fields.
- * The returned array is allocated memory, and its fields
- * are modified parts of the 'line' parameter.
- */
-char ** split_array(char *line, unsigned int * nfields, 
-                    char delim, size_t * lengths);
-
-/* Split array at whitespace in at most nfields fields.
- * Multiple whitespaces are collapsed. 
- * Empty fields are returned as empty (zero-length) strings.
- * The number of fields is returned in nfields.
- * An empty string will return zero fields.
- * If nfields < actual fields, last string will be remainder.
- * The returned array is allocated memory, and its fields
- * are modified parts of the 'line' parameter.
- */
-char ** split_array_ws(char *line, unsigned int * nfields, size_t * lengths);
-
-/* Same as above, but split on [space, tab, comma]
- */ 
-char ** split_array_list(char *line, unsigned int * nfields, size_t * lengths);
-
-/* Same as above, but split on delimiter list (token)
- */ 
-char ** split_array_token (char *line, 
-			   unsigned int * nfields, size_t * lengths,
-			   const char * token);
-
-/* Return a split_array_list() of a list contained in 'PREFIX\s*( list ).*'
- */
-char ** split_array_braced (char *line, const char * prefix,
-			    unsigned int * nfields, size_t * lengths);
-
-/* Replaces fields in s with 'replacement'. Fields are given
- * in the ordered array ovector, comprising ovecnum pairs 
- * ovector[i], ovector[i+1] which list offset of first char
- * of field, offset of first char after field (this is how
- * the pcre library does it).
- */  
-sh_string * sh_string_replace(const sh_string * s, 
-                              const size_t * ovector, int ovecnum, 
-                              const char * replacement, size_t rlen);
-
-#endif
Index: trunk/include/sh_sub.h
===================================================================
--- trunk/include/sh_sub.h	(revision 591)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef SH_SUB_H
-#define SH_SUB_H
-
-void sh_kill_sub ();
-int sh_sub_stat  (const char *path, struct stat *buf);
-int sh_sub_lstat (const char *path, struct stat *buf);
-
-#endif
Index: trunk/include/sh_subuid.h
===================================================================
--- trunk/include/sh_subuid.h	(revision 591)
+++ 	(revision )
@@ -1,24 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 2018 Rainer Wichmann                                      */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-/* These functions return NULL if the subuid/subgid is not found;
- * else the user/group name is returned (needs to be copied).
- */
-char * sh_get_subuid (unsigned long subuid);
-char * sh_get_subgid (unsigned long subgid);
Index: trunk/include/sh_suidchk.h
===================================================================
--- trunk/include/sh_suidchk.h	(revision 591)
+++ trunk/include/sh_suidchk.h	(revision 1)
@@ -6,21 +6,20 @@
 
 #ifdef SH_USE_SUIDCHK
-int sh_suidchk_init   (struct mod_type * arg);
-int sh_suidchk_timer  (time_t tcurrent);
-int sh_suidchk_check  (void);
-int sh_suidchk_end    (void);
-int sh_suidchk_reconf (void);
+int sh_suidchk_init  (void);
+int sh_suidchk_timer (time_t tcurrent);
+int sh_suidchk_check (void);
+int sh_suidchk_end   (void);
+int sh_suidchk_free_schedule (void);
 
-int sh_suidchk_set_activate   (const char * c);
-int sh_suidchk_set_severity   (const char * c);
-int sh_suidchk_set_timer      (const char * c);
-int sh_suidchk_set_schedule   (const char * c);
-int sh_suidchk_set_exclude    (const char * c);
-int sh_suidchk_set_fps        (const char * c);
-int sh_suidchk_set_yield      (const char * c);
-int sh_suidchk_set_nosuid     (const char * c);
-int sh_suidchk_set_quarantine (const char * c);
-int sh_suidchk_set_qmethod    (const char * c);
-int sh_suidchk_set_qdelete    (const char * c);
+int sh_suidchk_set_activate   (char * c);
+int sh_suidchk_set_severity   (char * c);
+int sh_suidchk_set_timer      (char * c);
+int sh_suidchk_set_schedule   (char * c);
+int sh_suidchk_set_exclude    (char * c);
+int sh_suidchk_set_fps        (char * c);
+int sh_suidchk_set_yield      (char * c);
+int sh_suidchk_set_quarantine (char * c);
+int sh_suidchk_set_qmethod    (char * c);
+int sh_suidchk_set_qdelete    (char * c);
 
 
Index: trunk/include/sh_tiger.h
===================================================================
--- trunk/include/sh_tiger.h	(revision 591)
+++ trunk/include/sh_tiger.h	(revision 1)
@@ -7,11 +7,4 @@
 #include "samhain.h"
 
-typedef long int TigerType;
-
-#define TIGER_FILE -1
-#define TIGER_DATA -2
-
-/****************
-typedef long int TigerType;
 typedef enum {
   TIGER_FILE,
@@ -19,41 +12,30 @@
   TIGER_DATA
 } TigerType;
-*****************/
 
-#define TIGER_NOLIM ((UINT64)-1)
+extern SL_TICKET tiger_fd;
 
 /* the checksum function
  */
-char * sh_tiger_hash (const char * filename, TigerType what, 
-		      UINT64 Length, char * out, size_t len);
+/*@owned@*/ char * sh_tiger_hash (char * filename, TigerType what, 
+				  unsigned long Length);
 
 /* NEW Thu Oct 18 19:59:08 CEST 2001
  */
-int sh_tiger_hashtype (const char * c);
+int sh_tiger_hashtype (char * c);
 char * sh_tiger_generic_hash (char * filename, TigerType what, 
-			      UINT64 * Length, int timeout, 
-			      char * out, size_t len);
+			      unsigned long Length, int timeout);
 
 UINT32 * sh_tiger_hash_uint32 (char * filename, 
 			       TigerType what, 
-			       UINT64 Length, UINT32 * out, size_t len);
+			       unsigned long Length);
 
 /* get the type of hash function used
  * 0 = tiger192, 1 = sha1, 2 = md5
  */
-int sh_tiger_get_hashtype (void);
+int sh_tiger_get_hashtype ();
 
-/* set the hash fuction in use in the mask
+/* GnuPG-like format
  */
-void sh_tiger_get_mask_hashtype(unsigned long * mask);
-
-
-/* reset the hash function to the one in the mask
- */
-void sh_tiger_set_hashtype_mask(unsigned long mask);
-
-/* GnuPG-like format, returns allocated memory
- */
-/*@owned@*/ char * sh_tiger_hash_gpg (const char * filename, TigerType what, 
-				      UINT64 Length);
+/*@owned@*/ char * sh_tiger_hash_gpg (char * filename, TigerType what, 
+			  unsigned long Length);
 #endif
Index: trunk/include/sh_tools.h
===================================================================
--- trunk/include/sh_tools.h	(revision 591)
+++ trunk/include/sh_tools.h	(revision 1)
@@ -8,27 +8,17 @@
  */
 #define SH_PROTO_SRP (1 << 0)
-#define SH_PROTO_IVA (1 << 1)
 #define SH_PROTO_MSG (1 << 2)
 #define SH_PROTO_BIG (1 << 3)
 #define SH_PROTO_END (1 << 4)
-#define SH_PROTO_EN1 (1 << 5)
+#define SH_PROTO_ENC (1 << 5)
 #define SH_PROTO_EN2 (1 << 6)
-#define SH_PROTO_ENC (SH_PROTO_EN1|SH_PROTO_EN2)
 #define SH_MASK_ENC (SH_PROTO_ENC|SH_PROTO_EN2)
 
 #ifdef SH_ENCRYPT
-/* returns pointer to errbuf
- */
-char * errorExplain (int err_num, char * errbuf, size_t len);
+char * errorExplain (int err_num);
 #endif
 
-/* Returns non-zero if interface exists
- */
-int sh_tools_iface_is_present(char *str);
-
-/* returns allocated buffer
- */
 char * sh_tools_safe_name(const char * str, int flag);
-
+int is_numeric (const char * address);
 int connect_port (char * address, int port, 
 		  char * ecall, int * errnum, char * errmsg, int errsiz);
@@ -36,8 +26,5 @@
 		    char * ecall, int * errnum, char * errmsg, int errsiz);
 void delete_cache(void);
-
-/* returns pointer to errbuf
- */
-char * sh_tools_errmessage (int tellme, char * errbuf, size_t len);
+char * sh_tools_errmessage (int tellme);
 
 
@@ -46,9 +33,7 @@
 #if defined (SH_WITH_SERVER)
 
-unsigned char sh_tools_probe_store(unsigned char protocol, int * probe_flag);
-
 int get_open_max (void);
 
-void put_header (/*@out@*/unsigned char * head, const int protocol, 
+void put_header (/*@out@*/unsigned char * head, int protocol, 
 		 unsigned long * length, char * u);
 
@@ -56,22 +41,11 @@
 int check_request_nerr (char * have, char * need);
 
-/* returns allocated buffer
- */
 char * hash_me (char * key, char * buf,   int buflen);
 int sh_tools_hash_vfy(char * key, char * buf, int buflen);
 
-/* returns allocated buffer
- */
-char * get_client_conf_file (const char * peer, unsigned long * length);
+char * get_client_conf_file (char * peer, unsigned long * length);
+char * get_client_data_file (char * peer, unsigned long * length);
 
-/* returns allocated buffer
- */
-char * get_client_data_file (const char * peer, unsigned long * length);
-
-/* returns allocated buffer
- */
-char * get_client_uuid_file (const char * peer, unsigned long * length, const char * uuid);
 #endif
-
 
 unsigned long read_port (int sockfd, char *buf, unsigned long nbytes, 
@@ -79,7 +53,5 @@
 
 
-#if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
-
-void sh_tools_probe_reset();
+#if defined (SH_WITH_CLIENT)
 
 unsigned long write_port (int sockfd, char *buf, unsigned long nbytes, 
@@ -93,9 +65,8 @@
 		 unsigned long * length, char * u);
 
-/*
-  SL_TICKET open_tmp (void);
-  int close_tmp (SL_TICKET fd);
-  int rewind_tmp (SL_TICKET fd);
-*/
+
+SL_TICKET open_tmp (void);
+int close_tmp (SL_TICKET fd);
+int rewind_tmp (SL_TICKET fd);
 
 void sh_tools_server_cmd(const char * srvcmd);
@@ -107,9 +78,4 @@
 #endif
 
-#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
-SL_TICKET open_tmp (void);
-int close_tmp (SL_TICKET fd);
-int rewind_tmp (SL_TICKET fd);
-#endif
 
 #endif
Index: trunk/include/sh_trace.h
===================================================================
--- trunk/include/sh_trace.h	(revision 591)
+++ trunk/include/sh_trace.h	(revision 1)
@@ -5,23 +5,11 @@
 /* This file should be included via samhain.h only.
  */
-#ifdef SL_DEBUG
-#define SDG_0RETU _("return.\n")
-#define SDG_TERRO _("ERROR: file=<%s>, line=<%d>, reason=<%s>\n")
-#define SDG_AERRO _("ERROR: file=<%s>, line=<%d>, failed_assertion=<%s>\n")
-#define SDG_AFAIL _("FAILED: file=<%s>, line=<%d>, assertion=<%s>\n")
-#define SDG_ENTER _("enter=<%s>\n")
-#define SDG_RETUR _("return=<%s>.\n")
-#define SDG_ERROR _("error=<%ld>.\n")
-#endif
 
 #ifdef SL_DEBUG
 #define ASSERT(expr, expr1) \
       if (!(expr)) \
-	{ \
-         fprintf(stderr,	    \
+         fprintf(stderr, \
 		 SDG_AERRO, \
-		 FIL__, __LINE__, expr1 ); \
-          abort(); \
-	}
+		 FIL__, __LINE__, expr1 );
 
 
Index: trunk/include/sh_unix.h
===================================================================
--- trunk/include/sh_unix.h	(revision 591)
+++ trunk/include/sh_unix.h	(revision 1)
@@ -23,10 +23,5 @@
 #define SH_UNIX_H
 
-/* For PATH_MAX */
 #include <limits.h>
-#if !defined(PATH_MAX)
-#define PATH_MAX 1024
-#endif
-
 #include <unistd.h>
 #include "samhain.h"
@@ -54,6 +49,4 @@
   SH_FILE_FIFO,
   SH_FILE_SOCKET,
-  SH_FILE_DOOR,
-  SH_FILE_PORT,
   SH_FILE_UNKNOWN
 } ShFileType;
@@ -68,5 +61,4 @@
 /* inode        */
 #define MODI_INO (1 << 2)
-
 /* user         */
 #define MODI_USR (1 << 3)
@@ -75,5 +67,4 @@
 /* mtime        */
 #define MODI_MTM (1 << 5)
-
 /* ctime        */
 #define MODI_CTM (1 << 6)
@@ -82,42 +73,10 @@
 /* size         */
 #define MODI_SIZ (1 << 8)
-
 /* file mode    */
 #define MODI_MOD (1 << 9)
 /* hardlinks    */
 #define MODI_HLN (1 << 10)
-/* device type   */
+/* device num   */
 #define MODI_RDEV (1 << 11)
-
-/* size may grow   */
-#define MODI_SGROW (1 << 12)
-/* use prelink     */
-#define MODI_PREL (1 << 13)
-/* get content     */
-#define MODI_TXT ((1 << 14)|MODI_CHK)
-#define MODI_TXT_ENABLED(a) (((a)&(1 << 14))!=0)
-
-/* get audit record  */
-#define MODI_AUDIT (1 << 15)
-#define MODI_AUDIT_ENABLED(a) (((a)&(1 << 15))!=0)
-/* do not check  */
-#define MODI_NOCHECK (1 << 16)
-/* do not check  */
-#define MODI_ALLIGNORE (1 << 17)
-
-#define MODI_TIGER192  0x01000000UL
-#define MODI_SHA1      0x02000000UL
-#define MODI_MD5       0x03000000UL
-#define MODI_SHA256    0x04000000UL
-#define MODI_HASHTYPE  0x0F000000UL
-
-#define MODI_INIT 0xD0000000UL
-#define MODI_INITIALIZED(a) (((a) & 0xF0000000UL) == MODI_INIT)
-
-#define MODI_SET(a, b) ((a) |= (b))
-#define MODI_CLEAR(a, b) ((a) &= ~(b))
-#define MODI_ISSET(a, b) (((a) & (b)) != 0)
-
-#define SH_TXT_MAX 9200
 
 #define MASK_ALLIGNORE_  0
@@ -127,5 +86,5 @@
 #define MASK_LOGFILES_   (MASK_ATTRIBUTES_|MODI_HLN|MODI_LNK|MODI_INO)
 extern  unsigned long mask_LOGFILES;
-#define MASK_LOGGROW_    (MASK_LOGFILES_|MODI_SIZ|MODI_SGROW|MODI_CHK) 
+#define MASK_LOGGROW_    (MASK_LOGFILES_|MODI_SIZ) 
 extern  unsigned long mask_LOGGROW;
 #define MASK_READONLY_   (MASK_LOGFILES_|MODI_CHK|MODI_SIZ|MODI_MTM|MODI_CTM)
@@ -136,15 +95,12 @@
 extern  unsigned long mask_USER0;
 extern  unsigned long mask_USER1;
-extern  unsigned long mask_USER2;
-extern  unsigned long mask_USER3;
-extern  unsigned long mask_USER4;
-/* like READONLY, but without MTM,CTM,SIZ,INO, and with PREL)
- */
-#define MASK_PRELINK_   (MASK_ATTRIBUTES_|MODI_HLN|MODI_LNK|MODI_CHK|MODI_PREL)
+/* like READONLY, but without MTM,CTM,SIZ,INO)
+ */
+#define MASK_PRELINK_   (MASK_ATTRIBUTES_|MODI_HLN|MODI_LNK|MODI_CHK)
 extern  unsigned long mask_PRELINK;
 
 typedef struct file_struct {
-  unsigned long    check_flags;
-  int              file_reported;
+  unsigned long    check_mask;
+  int              reported;
   char             fullpath[PATH_MAX];
   ShFileType       type;
@@ -153,9 +109,9 @@
   mode_t           mode;
   nlink_t          hardlinks;
-#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
+#if defined(__linux__)
   unsigned long    attributes;
-  char             c_attributes[ATTRBUF_SIZE];
-#endif
-  char             c_mode[CMODE_SIZE];
+  char             c_attributes[16];
+#endif
+  char             c_mode[11];
   uid_t            owner;
   char             c_owner[USER_MAX+2];
@@ -170,59 +126,28 @@
   time_t           ctime;
 
-  char           * link_path;
+  char             linkpath[PATH_MAX];
   mode_t           linkmode;
   char             link_c_mode[11];
   int              linkisok;
-  char           * attr_string;
 } file_type;
 
-extern int sh_unix_check_selinux;
-extern int sh_unix_check_acl;
-
-/* destroy userid cache 
- */
-void sh_userid_destroy ();
-
-/* --- run a command, securely --- 
- */
-int sh_unix_run_command (const char * str);
-
-/* Ignore SIGPIPE
- */
-void sh_unix_ign_sigpipe();
-
 /* mlock utilities
  */
-int sh_unix_mlock(const char * file, int line, void * addr, size_t len);
+int sh_unix_mlock(void * addr, size_t len);
 int sh_unix_munlock(void * addr, size_t len);
-int sh_unix_count_mlock(void);
-/* public for unit tests */
-int sh_unix_pagesize(void);
-unsigned long sh_unix_lookup_page(void * in_addr, size_t len, int * num_pages);
+int sh_unix_count_mlock();
 
 /* chroot directory
  */
-int sh_unix_set_chroot(const char * str);
+int sh_unix_set_chroot(char * str);
 
 /* whether to use localtime for file timesatams in logs
  */
-int sh_unix_uselocaltime (const char * c);
-
-/* whether to perform selinux/acl checks
- */ 
-#ifdef USE_XATTR
-int sh_unix_setcheckselinux (const char * c);
-#endif
-#ifdef USE_ACL
-int sh_unix_setcheckacl (const char * c);
-#endif
-#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
-int sh_unix_setcheckattributes (const char * c);
-#endif
+int sh_unix_uselocaltime (char * c);
 
 /* set I/O limit
  */
-int  sh_unix_set_io_limit (const char * c);
-void sh_unix_io_pause (void);
+int  sh_unix_set_io_limit (char * c);
+void sh_unix_io_pause ();
 
 /* get file type
@@ -232,9 +157,9 @@
 /* reset masks for policies
  */
-int sh_unix_maskreset(void);
+int sh_unix_maskreset();
 
 /* return true if database is remote
  */
-int file_is_remote (void);
+int file_is_remote ();
 
 /* return the path to the configuration/database file
@@ -248,9 +173,6 @@
 /* close all files >= fd, except possibly one
  */
-void sh_unix_closeall (int fd, int except, int inchild);
-
-/* Check whether directory for pid file exists
- */
-int sh_unix_check_piddir (char * pidpath);
+void sh_unix_closeall (int fd, int except);
+
 
 /* write lock for filename
@@ -264,14 +186,14 @@
 /* write the PID file
  */
-int sh_unix_write_pid_file(void);
+int sh_unix_write_pid_file();
 
 /* rm the PID file
  */
-int sh_unix_rm_pid_file(void);
+int sh_unix_rm_pid_file();
 
 
 /* checksum of own binary
  */
-int sh_unix_self_hash (const char * c);
+int sh_unix_self_hash (char * c);
 
 /* return BAD on failure
@@ -281,9 +203,9 @@
 /* add a trusted user to the list 
  */
-int tf_add_trusted_user(const char *);
+int tf_add_trusted_user(char *);
 
 /* check a file 
  */
-int tf_trust_check (const char * file, int mode);
+int tf_trust_check (char * file, int mode);
 
 /* initialize group vector
@@ -298,5 +220,5 @@
 /* set the timeserver address
  */
-int sh_unix_settimeserver (const char * address);
+int sh_unix_settimeserver (char * address);
 void reset_count_dev_time(void);
 
@@ -307,14 +229,14 @@
 /* deamon mode 
  */
-int sh_unix_setdeamon  (const char * dummy);
-int sh_unix_setnodeamon(const char * dummy);
+int sh_unix_setdeamon  (char * dummy);
+int sh_unix_setnodeamon(char * dummy);
 
 /* Test whether file exists
  */
-int sh_unix_file_exists(char * path);
+int sh_unix_file_stat(char * path);
 
 /* test whether file exists with proper attributes
  */
-int sh_unix_device_readable(int fd);
+int sh_unix_file_exists(int fd);
 
 /* local host
@@ -331,12 +253,7 @@
 /* int sh_unix_is_secure_dir (ShErrLevel level, char * tmp); */
 
-/* check whether there's a rotated log with the correct inode and checksum 
- */
-int sh_check_rotated_log (const char * path,  
-			  UINT64 old_size, UINT64 old_inode, const char * old_hash, unsigned long mask);
-
 /* obtain file info
  */
-int sh_unix_getinfo (int level, const char * filename, file_type * theFile, 
+int sh_unix_getinfo (int level, char * filename, file_type * theFile, 
 		     char * fileHash, int flagrel);
 
@@ -349,11 +266,11 @@
 int  sh_unix_init(int goDaemon);
 
-/* for local time use thetime = 0, returns pointer to buffer 
- */
-char * sh_unix_time (time_t thetime, char * buffer, size_t len);
-
-/* convert to GMT time, returns pointer to buffer
- */
-char * sh_unix_gmttime (time_t thetime, char * buffer, size_t len);
+/* for local time use thetime = 0 
+ */
+/*@owned@*/ char * sh_unix_time (time_t thetime);
+
+/* convert to GMT time
+ */
+char * sh_unix_gmttime (time_t thetime);
 
 /* effective user info
@@ -361,11 +278,8 @@
 int  sh_unix_getUser (void);
 
-/* get home directory, , returns pointer to out
- */
-char *  sh_unix_getUIDdir (int level, uid_t uid, char * out, size_t len);
-
-/* get a group GID 
- */
-long sh_group_to_gid (const char * g, int * fail);
+/* get home directory
+ */
+char *  sh_unix_getUIDdir (int level, uid_t uid);
+
 
 #ifdef HAVE_GETTIMEOFDAY
@@ -389,22 +303,19 @@
 
 void   sh_sigtrap_handler (int signum);
+extern volatile int sh_not_traced;
 
 #ifdef HAVE_GETTIMEOFDAY
+#if TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#else
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
-#endif
+#else
 #include <time.h>
 #endif
-
-struct sh_sigtrap_variables {
-  int not_traced;
-#ifdef HAVE_GETTIMEOFDAY
-  struct timeval save_tv;
-#endif
-};
-
-struct sh_sigtrap_variables * sh_sigtrap_variables_get();
-
-int sh_sigtrap_max_duration_set (const char * str);
+#endif
+extern struct timeval  save_tv;
+#endif
 
 static inline
@@ -425,26 +336,19 @@
 int sh_derr(void)
 {
-  struct sh_sigtrap_variables * sigtrap_variables;
-  sigtrap_variables = sh_sigtrap_variables_get();
-  if (sigtrap_variables == NULL) {
-    /* Perhaps, its better to not die, and to continue using Samhain,
-       even if this part does not work. */
-    return (0);
-  }
-
-  sigtrap_variables->not_traced = 0;
+  sh_not_traced = 0;
 
 #ifdef HAVE_GETTIMEOFDAY
-  gettimeofday(&sigtrap_variables->save_tv, NULL);
-#endif
-
-  /* raise() sends to same thread, like pthread_kill(pthread_self(), sig); 
-   */
+  gettimeofday(&save_tv, NULL);
+#endif
+
+#if defined(__linux__) && defined(__GNUC__) && defined(__i386__)
+  __asm__ __volatile__ ("int $0x03");
+#else
   raise(SIGTRAP);
+#endif
   
-  if (sigtrap_variables->not_traced == 0)
+  if (sh_not_traced == 0)
     _exit(5);
-
-  sigtrap_variables->not_traced = 0;
+  sh_not_traced = 0;
   return (0);
 }
Index: trunk/include/sh_userfiles.h
===================================================================
--- trunk/include/sh_userfiles.h	(revision 591)
+++ trunk/include/sh_userfiles.h	(revision 1)
@@ -9,5 +9,5 @@
 
 #ifdef SH_USE_USERFILES
-int sh_userfiles_init  (struct mod_type * arg);
+int sh_userfiles_init  (void);
 int sh_userfiles_timer (time_t tcurrent);
 int sh_userfiles_check (void);
@@ -16,9 +16,9 @@
 int sh_userfiles_reconf (void);
 
-int sh_userfiles_set_uid (const char * str);
-int sh_userfiles_add_file(const char *c);
-int sh_userfiles_set_interval(const char *c);
-int sh_userfiles_set_active(const char *c);
-int sh_userfiles_check_internal(void);
+int sh_userfiles_set_uid (char * str);
+int sh_userfiles_add_file(char *c);
+int sh_userfiles_set_interval(char *c);
+int sh_userfiles_set_active(char *c);
+int sh_userfiles_check_internal();
 
 extern sh_rconf sh_userfiles_table[];
Index: trunk/include/sh_utils.h
===================================================================
--- trunk/include/sh_utils.h	(revision 591)
+++ trunk/include/sh_utils.h	(revision 1)
@@ -40,9 +40,7 @@
   unsigned long   data_ulong;
   long            data_long;
-  char           *data_str;
+  /*@null@*/char *data_str;
 } st_format;
 
-/* returns allocated string
- */
 char * sh_util_formatted (const char * fmt, st_format * ftab);
 
@@ -58,81 +56,52 @@
  *  generator. 
  */
-UINT32 taus_get            (void);  
+UINT32 taus_get            (void *state1, void *state2, void *state3);  
 double taus_get_double     (void *vstate);  /* fast */
 int    taus_seed           (void);
 
-/* returns allocated memory
- */
-char * sh_util_strdup (const char * str) SH_GNUC_MALLOC;
-char * sh_util_strdup_track (const char * str, 
-			     char * file, int line) SH_GNUC_MALLOC;
-
-/* returns allocated memory
- */
-char * sh_util_strdup_l (const char * str, size_t len) SH_GNUC_MALLOC;
-
-/* returns pointer within str
- */
+char * sh_util_strdup (const char * str);
 char * sh_util_strsep (char **str, const char *delim);
-
-/* compactify verbose acl text, returns allocated memory
- */
-char * sh_util_acl_compact (char * buf, ssize_t len);
 
 /* set signature type HASH-TIGER/HMAC-TIGER
  */
-int sh_util_sigtype (const char * c);
+int sh_util_sigtype (char * c);
 
 /* compute a signature
  */
 char * sh_util_siggen (char * hexkey,  
-		       char * text, size_t textlen, 
-		       char * sigbuf, size_t sigbuflen);
+		       char * text, size_t textlen);
 
 /* eval boolean input
  */
-int sh_util_flagval(const char * c, int * fval);
+int sh_util_flagval(char * c, int * fval);
 
 /* ask if a file should be updated (returns S_TRUE/S_FALSE)
  */
-int sh_util_ask_update(const char * path);
-int sh_util_set_interactive(const char * str);
-int sh_util_update_file (const char * str);
+int sh_util_ask_update(char * path);
+int sh_util_set_interactive(char * str);
 
 /* don't log output files
  */
-int sh_util_hidesetup(const char * c);
-
-/* valif utf-8 string
- */
-int sh_util_valid_utf8 (const unsigned char * str);
-
-/* filenames are utf8
- */
-int sh_util_obscure_utf8 (const char * c);
+int sh_util_hidesetup(char * c);
 
 /* exceptions to obscure name check
  */
-int sh_util_obscure_ok (const char * str);
+int sh_util_obscure_ok (char * str);
 
-/* output a hexchar[2]; i2h must be char[2]
+/* read a hexchar
  */
-char * sh_util_charhex( unsigned char c, char * i2h );
-
-/* read a hexchar, return int value (0-15)
- */
-int sh_util_hexchar( char c ) SH_GNUC_CONST;
+int sh_util_hexchar( char c );
 
 /* change verifier 
  */
-int sh_util_set_newkey (const char * str);
+int sh_util_set_newkey (char * str);
 
 /* server mode 
  */
-int sh_util_setserver (const char * dummy);
+int sh_util_setserver (char * dummy);
 
 /* a simple compressor
  */
-size_t sh_util_compress (char * dest, char * src, size_t dest_size);
+long sh_util_compress (char * dest, char * src, size_t dest_size);
 
 /* an even simpler en-/decoder 
@@ -147,9 +116,9 @@
 /* set timer for main loop
  */
-int sh_util_setlooptime (const char * str);
+int sh_util_setlooptime (char * str);
 
 /* whether init or check the database
  */
-int  sh_util_setchecksum (const char * str);
+int  sh_util_setchecksum (char * str);
 
 /* compare an in_string against a regular expression regex_str
@@ -160,11 +129,11 @@
 
 /* returns freshly allocated memory, return value should be free'd.
- * Argument list must be NULL terminated.
+ * Arhument list must be NULL terminated.
  */
-char * sh_util_strconcat (const char * arg1, ...) SH_GNUC_MALLOC SH_GNUC_SENTINEL;
+char * sh_util_strconcat (const char * arg1, ...);
 
 /* check if string is numeric only
  */
-int sh_util_isnum (const char *str) SH_GNUC_PURE;
+int sh_util_isnum (char *str);
 
 /* init a key w/random string
@@ -175,11 +144,9 @@
 /* returns freshly allocated memory, return value should be free'd
  */
-char * sh_util_dirname(const char * fullpath);
+char * sh_util_filename(char * fullpath);
 
 /* returns freshly allocated memory, return value should be free'd
  */
-char * sh_util_safe_name (const char * name) SH_GNUC_MALLOC;
-
-char * sh_util_safe_name_keepspace (const char * name) SH_GNUC_MALLOC;
+char * sh_util_safe_name (const char * name);
 
 /* check max size of printf result string
@@ -189,30 +156,9 @@
 /* check for obscure filenames
  */
-int sh_util_obscurename (ShErrLevel level, const char * name, int flag);
+int sh_util_obscurename (ShErrLevel level, char * name, int flag);
 
 /* returns freshly allocated memory, return value should be free'd
  */
-char * sh_util_basename(const char * fullpath);
-
-/* required size (including terminating NULL) for string of strlen l
- */
-#define SH_B64_SIZ(l)  (1 + ((((l) + 2) / 3) * 4))
-
-/* return len of encoded string
- */
-size_t sh_util_base64_enc (unsigned char * out, const unsigned char * instr, 
-			   size_t lin);
-
-/* return allocated encoded string in out, return its len
- */
-size_t sh_util_base64_enc_alloc (char **out, const char *in, size_t inlen);
-
-/* return len of decoded string
- */  
-size_t sh_util_base64_dec (unsigned char *out, const unsigned char *in, size_t lin);
-
-/* return allocated decoded string in out, return its len
- */  
-size_t sh_util_base64_dec_alloc (unsigned char **out, const unsigned char *in, size_t lin);
+char * sh_util_basename(char * fullpath);
 
 #endif
Index: trunk/include/sh_utmp.h
===================================================================
--- trunk/include/sh_utmp.h	(revision 591)
+++ trunk/include/sh_utmp.h	(revision 1)
@@ -6,35 +6,17 @@
 
 #ifdef SH_USE_UTMP
-int sh_utmp_init   (struct mod_type * arg);
-int sh_utmp_timer  (time_t tcurrent);
-int sh_utmp_check  (void);
-int sh_utmp_end    (void);
-int sh_utmp_reconf (void);
+int sh_utmp_init  (void);
+int sh_utmp_timer (time_t tcurrent);
+int sh_utmp_check (void);
+int sh_utmp_end (void);
+int sh_utmp_null (void);
 
-int sh_utmp_set_login_activate (const char * c);
-int sh_utmp_set_login_solo     (const char * c);
-int sh_utmp_set_login_multi    (const char * c);
-int sh_utmp_set_logout_good    (const char * c);
-int sh_utmp_set_login_timer    (const char * c);
+int sh_utmp_set_login_activate (char * c);
+int sh_utmp_set_login_solo     (char * c);
+int sh_utmp_set_login_multi    (char * c);
+int sh_utmp_set_logout_good    (char * c);
+int sh_utmp_set_login_timer    (char * c);
 
 extern sh_rconf sh_utmp_table[];
-
-/* >>           Login tracking             << */
-
-/* 'yes', 'no', 'paranoid'                    */
-int sh_login_set_siglevel      (const char * c);
-
-/* 'yes', 'no', 'domain'                      */
-int sh_login_set_checklevel    (const char * c);
-
-/* 'always' 'never' workdays(..) sunday(..)   */
-int sh_login_set_def_allow     (const char * c);
-
-/* user:'always' 'never' workdays(..)         */
-int sh_login_set_user_allow    (const char * c);
-
-/* Reset everything to defaults.              */
-void sh_login_reset (void);
-
 #endif
 
Index: trunk/include/sh_xfer.h
===================================================================
--- trunk/include/sh_xfer.h	(revision 591)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/* SAMHAIN file system integrity testing                                   */
-/* Copyright (C) 1999, 2015 Rainer Wichmann                                */
-/*                                                                         */
-/*  This program 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.                                    */
-/*                                                                         */
-/*  This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.              */
-
-#ifndef SH_XFER_H
-#define SH_XFER_H
-
-#ifndef SH_STANDALONE
-int sh_xfer_set_strip (const char * str);
-#endif
-
-/* generate a random password
- */
-int sh_xfer_create_password (const char * dummy);
-
-/* set timeout for active client connections
- */
-int sh_xfer_set_timeout (const char * c);
-
-/* set time limit after which client is reported dead 
- */
-int sh_xfer_set_time_limit(const char * str);
-
-/* error level for lookup failure
- */
-int sh_xfer_lookup_level (const char * c);
-
-/* create client entry for given password
- */
-int sh_xfer_make_client (const char * str);
-
-/* set port to which we connect
- */
-int sh_xfer_server_port (const char * str);
-
-#ifdef SH_WITH_SERVER
-
-#ifdef INET_SYSLOG
-int set_syslog_active(const char * c);
-#endif
-
-/* create socket and start listening
- */
-void create_server_tcp_socket (void);
-
-/* whether to use client address as known to the communication layer
- * and set by accept()
- */
-int set_socket_peer (const char * c);
-
-/* whether to use client severity
- */
-int sh_xfer_use_clt_sev (const char * c);
-
-/* whether to use client class
- */
-int sh_xfer_use_clt_class (const char * c);
-
-/* server port
- */
-int sh_xfer_set_port(const char * c);
-
-/* server interface
- */
-int sh_xfer_set_interface(const char * c);
-
-/* a wrapper function
- */
-void sh_xfer_html_write(void);
-
-/* register an alias
- */
-int sh_xfer_register_alias (const char * str);
-
-/* register a client
- */
-int sh_xfer_register_client (const char * str);
-
-/* start server
- */
-void sh_xfer_start_server(void);
-
-/* free() everything
- */
-void sh_xfer_free_all (void);
-
-#endif
-
-#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
-/* talk to server
- */
-long  sh_xfer_report (char * errmsg);
-
-/* set log server
- */
-int sh_xfer_set_logserver (const char * address);
-void reset_count_dev_server(void);
-#endif
-
-#ifdef SH_WITH_CLIENT
-
-/* Throttle file download
- */
-int sh_xfer_set_throttle_delay (const char * c);
-
-/* request file from server. file may be "CONF" or "DATA" or a UUID.
- */
-long sh_xfer_request_file (const char * file);
-
-#endif
-
-#endif
-
Index: trunk/include/slib.h
===================================================================
--- trunk/include/slib.h	(revision 591)
+++ trunk/include/slib.h	(revision 1)
@@ -24,6 +24,4 @@
 #endif
 
-#include "sh_string.h"
-
 /****************
 
@@ -40,5 +38,4 @@
 *****************/
 
-
 /* --------------------------------------------------------------
  * 
@@ -60,20 +57,8 @@
  * TRUE, FALSE
  */
-#if !defined(S_TRUE)
-#define S_TRUE  1
-#define S_FALSE 0
-#endif
-
-#define SH_GRBUF_SIZE   4096
-#define SH_PWBUF_SIZE  32768
-
-
-#if defined(__GNUC__) && (__GNUC__ >= 3)
-#undef  SL_GNUC_CONST
-#define SL_GNUC_CONST   __attribute__((const))
-#else
-#undef  SL_GNUC_CONST
-#define SL_GNUC_CONST
-#endif
+#define SL_TRUE  1
+#define SL_FALSE 0
+
+
 
 /*
@@ -108,9 +93,7 @@
 #define SL_EWRITE    -1037     /* Write error. Check errno.            */
 #define SL_ESYNC     -1038     /* Write error. Check errno.            */
-#define SL_ECLOSE    -1039     /* Close error. Check errno.            */
 
 #define SL_EBADNAME  -1040     /* Invalid name.                        */
 #define SL_ESTAT     -1041     /* stat of file failed. Check errno.    */
-#define SL_EFSTAT    -1042     /* fstat of file failed. Check errno.   */
 
 #define SL_EBADUID   -1050	/* Owner not trustworthy.              */
@@ -120,20 +103,4 @@
 #define SL_TOOMANY   -1053      /* Too many open files                 */
 #define SL_TIMEOUT   -1054      /* Timeout in read                     */
-
-#define SL_EISDIR    -1055      /* Is a directory                      */
-
-#define SL_EINTERNAL01 -1061    /* Internal error.                      */
-#define SL_EINTERNAL02 -1062    /* Internal error.                      */
-#define SL_EINTERNAL03 -1063    /* Internal error.                      */
-#define SL_EINTERNAL04 -1064    /* Internal error.                      */
-#define SL_EINTERNAL05 -1065    /* Internal error.                      */
-#define SL_EINTERNAL06 -1066    /* Internal error.                      */
-#define SL_EINTERNAL07 -1067    /* Internal error.                      */
-#define SL_EINTERNAL08 -1068    /* Internal error.                      */
-#define SL_EINTERNAL09 -1069    /* Internal error.                      */
-#define SL_EINTERNAL10 -1070    /* Internal error.                      */
-#define SL_EINTERNAL11 -1071    /* Internal error.                      */
-#define SL_EINTERNAL12 -1072    /* Internal error.                      */
-
 /*
  * All int functions return SL_NONE on success.
@@ -144,7 +111,7 @@
 #endif
 
-  int dlog (int flag, const char * file, int line, const char *fmt, ...);
-
-  char * sl_get_errmsg(void);
+  int dlog (int flag, char * file, int line, const char *fmt, ...);
+
+  char * sl_get_errmsg();
 
   /* ---------------------------------------------------------------- 
@@ -154,5 +121,5 @@
    * ---------------------------------------------------------------- */
 
-  int sl_test_heap(void);
+  int sl_test_heap();
 
   /* ---------------------------------------------------------------- 
@@ -164,9 +131,9 @@
   extern int sl_useCaps;
 
-  int sl_drop_cap (void);
-  int sl_drop_cap_sub(void);
-  int sl_get_cap_sub(void);
-  int sl_drop_cap_qdel(void);
-  int sl_get_cap_qdel(void);
+  int sl_drop_cap ();
+  int sl_drop_cap_sub();
+  int sl_get_cap_sub();
+  int sl_drop_cap_qdel();
+  int sl_get_cap_qdel();
 
   /* ---------------------------------------------------------------- 
@@ -180,8 +147,6 @@
    */
   void *sl_memset(void *s, int c, size_t n);
-#if !defined(SH_REAL_SET)
 #undef  memset
 #define memset sl_memset
-#endif
 
   /* 
@@ -224,10 +189,7 @@
 
   /*
-   * robust strn[case]cmp replacement
+   * robust strncmp replacement
    */
   int sl_strncmp(const char * a, const char * b, size_t n);
-  int sl_ts_strncmp(const char * a, const char * b, size_t n);
-
-  int sl_strncasecmp(const char * a, const char * b, size_t n);
 
   /*
@@ -235,9 +197,4 @@
    */
   int sl_strcmp(const char * a, const char * b);
-
-  /*
-   * robust strcasecmp replacement
-   */
-  int sl_strcasecmp(const char * one, const char * two);
 
   /*
@@ -257,5 +214,5 @@
    * UID HANDLING FUNCTIONS.
    */
-  int sl_policy_get_user(const char *username);  /* drop SUID to <username>  */ 
+  int sl_policy_get_user(char *username);  /* drop SUID to <username>  */ 
   int sl_policy_get_real(char *username);  /* drop privs to <username> */
   int sl_policy_get_root(void);            /* drop SUID to root        */
@@ -274,5 +231,5 @@
    */
   int sl_get_euid(/*@out@*/uid_t * ret);
-  uid_t sl_ret_euid(void);
+  uid_t sl_ret_euid();
 
   /*
@@ -334,80 +291,37 @@
    * ---------------------------------------------------------------- */
 
-#define SL_OFILE_SIZE 32
-
-  char * sl_check_badfd();
-  char * sl_check_stale();
-
-  /* Create a file record for an open file
-   */
-  SL_TICKET sl_make_ticket (const char * ofile, int oline,
-			    int fd, const char * filename, FILE * stream);
- 
-  /* Get the pointer to a stream. If none exists yet, open it
-   */
-  FILE * sl_stream (SL_TICKET ticket, char * mode);
+  SL_TICKET sl_make_ticket (int fd, char * path);
 
   /* Open for writing.
    */
-  SL_TICKET  sl_open_write       (const char * ofile, int oline,
-				  const char * fname, int priviledge_mode);
+  SL_TICKET  sl_open_write       (char * fname, int priviledge_mode);
 
   /* Open for reading.
    */
-  SL_TICKET  sl_open_read        (const char * ofile, int oline,
-				  const char * fname, int priviledge_mode);
-
-  /* Drop from cach when closing
-   */
-  int sl_set_drop_cache(const char * str);
+  SL_TICKET  sl_open_read        (char * fname, int priviledge_mode);
 
   /* Open for reading w/minimum checking.
    */
-  SL_TICKET  sl_open_fastread    (const char * ofile, int oline,
-				  const char * fname, int priviledge_mode);
+  SL_TICKET  sl_open_fastread    (char * fname, int priviledge_mode);
 
   /* Open for read and write.
    */
-  SL_TICKET  sl_open_rdwr        (const char * ofile, int oline,
-				  const char * fname, int priviledge_mode);
+  SL_TICKET  sl_open_rdwr        (char * fname, int priviledge_mode);
 
   /* Open for read and write, fail if file exists.
    */
-  SL_TICKET sl_open_safe_rdwr    (const char * ofile, int oline,
-				  const char * fname, int priv);
+  SL_TICKET sl_open_safe_rdwr    (char * fname, int priv);
 
   /* Open for write, truncate.
    */
-  SL_TICKET  sl_open_write_trunc (const char * ofile, int oline,
-				  const char * fname, int priviledge_mode);
+  SL_TICKET  sl_open_write_trunc (char * fname, int priviledge_mode);
 
   /* Open for read and write, truncate.
    */
-  SL_TICKET  sl_open_rdwr_trunc  (const char * ofile, int oline,
-				  const char * fname, int priviledge_mode);
-
-  /* Initialize the content sh_string.
-   */
-  int sl_init_content (SL_TICKET ticket, size_t size);
-
-  /* Get the (pointer to) the content sh_string.
-   */
-  sh_string * sl_get_content (SL_TICKET ticket);
-
-  /* Lock file (uses fcntl F_SETLK).
-   */
-  int sl_lock (SL_TICKET ticket);
+  SL_TICKET  sl_open_rdwr_trunc  (char * fname, int priviledge_mode);
 
   /* Close file.
    */
   int sl_close (SL_TICKET ticket);
-
-  /* Close file descriptor.
-   */
-  int sl_close_fd (const char * file, int line, int fd);
-
-  /* Close stream.
-   */
-  int sl_fclose (const char * file, int line, FILE * fp);
 
   /* Unlink file.
@@ -435,14 +349,6 @@
   int sl_read (SL_TICKET ticket, void * buf, size_t count);
 
-  int sl_read_timeout_prep (SL_TICKET ticket);
-
-  int sl_read_timeout_fd (int fd, void * buf, 
-			  size_t count, int timeout, int is_nonblocking);
-
-  int sl_read_timeout_fd_once (int fd, void * buf, 
-			       size_t count, int timeout, int is_nonblocking);
-
   int sl_read_timeout (SL_TICKET ticket, void * buf, 
-		       size_t count, int timeout, int is_nonblocking);
+		       size_t count, int timeout);
 
   int sl_read_fast (SL_TICKET ticket, void * buf_in, size_t count);
@@ -450,30 +356,25 @@
   /* Write file.
    */
-  int sl_write (SL_TICKET ticket, const void * msg, long nbytes);
+  int sl_write (SL_TICKET ticket, void * msg, long nbytes);
 
   /* Write file, terminate with newline.
    */
-  int sl_write_line (SL_TICKET ticket, const void * msg, long nbytes);
-
-  /* As above, but only for non-constant strings.
-   */
-  int sl_write_line_fast (SL_TICKET ticket, void * msg, long nbytes);
+  int sl_write_line (SL_TICKET ticket, void * msg, long nbytes);
 
   /* Drop all metadata for file descriptors >= fd.
    */
   int sl_dropall(int fd, int except);
-  int sl_dropall_dirty(int fd, int except); /* don't deallocate */
 
   /* Check whether file is trustworthy.
    */
-  int sl_trustfile(const char * path, uid_t * ok, uid_t * bad);
+  int sl_trustfile(char * path, uid_t * ok, uid_t * bad);
 
   /* Check whether file is trustworthy.
    */
-  int sl_trustfile_euid(const char * filename, uid_t euid);
+  int sl_trustfile_euid(char * filename, uid_t euid);
 
   /* purge list of trusted users
    */
-  int  sl_trust_purge_user (void);
+  int  sl_trust_purge_user ();
 
   /* Add a trusted user.
@@ -488,14 +389,4 @@
    */
   char * sl_trust_errfile(void);
-
-  /* Overflow tests
-   */
-  int sl_ok_muli (int a, int b) SL_GNUC_CONST;
-  int sl_ok_divi (int a, int b) SL_GNUC_CONST;
-  int sl_ok_addi (int a, int b) SL_GNUC_CONST;
-  int sl_ok_subi (int a, int b) SL_GNUC_CONST;
-
-  int sl_ok_muls (size_t a, size_t b) SL_GNUC_CONST;
-  int sl_ok_adds (size_t a, size_t b) SL_GNUC_CONST;
 
 
@@ -509,7 +400,5 @@
 #define SL_NOPRIV  0x34
 
-/* Suitable for Linux
- */
-#define MAXFILENAME	4096
+#define MAXFILENAME	2048
 
 
@@ -533,5 +422,5 @@
     /*@i@*/ if (assertion) ;                           \
     else {                                             \
-        dlog(0, FIL__, __LINE__, _("FAILED: file=<%s>, line=<%d>, assertion=<%s>\n"),            \
+        dlog(0, FIL__, __LINE__, SDG_AFAIL,            \
                  FIL__, __LINE__, astext);             \
         _exit(EXIT_FAILURE);                           \
@@ -603,10 +492,10 @@
 void sl_stack_push(char * c, char * file, int line);
 void sl_stack_pop(char * c, char * file, int line);
-void sl_stack_print(void);
+void sl_stack_print();
 #endif
-void sl_trace_in   (const char * str, const char * file, int line);
-void sl_trace_out  (const char * str, const char * file, int line);
-int  sl_trace_file (const char * str);
-int  sl_trace_use  (const char * str);
+void sl_trace_in   (char * str, char * file, int line);
+void sl_trace_out  (char * str, char * file, int line);
+int  sl_trace_file (char * str);
+int  sl_trace_use  (char * str);
 
 
@@ -621,5 +510,5 @@
 do {                                                                \
    if((long)(x) < 0) {                                              \
-      TPT((0,    FIL__, __LINE__, _("error=<%ld>.\n"), (long)(x)))            \
+      TPT((0,    FIL__, __LINE__, SDG_ERROR, (long)(x)))            \
       sl_errno=(x);                                                 \
     }                                                               \
Index: trunk/include/zAVLTree.h
===================================================================
--- trunk/include/zAVLTree.h	(revision 591)
+++ trunk/include/zAVLTree.h	(revision 1)
@@ -33,11 +33,8 @@
 
 /* typedef the keytype */
-typedef const void * zAVLKey;
+typedef const char * zAVLKey;
 
 /* Comparison function for strings is strcmp(). */
-/* #define zAVLKey_cmp(tree, a, b) (strcmp((a), (b))) */
-
-#define zAVL_KEY_STRING 0
-#define zAVL_KEY_INT    1
+#define zAVLKey_cmp(tree, a, b) (strcmp((a), (b)))
 
 
@@ -56,5 +53,4 @@
   long count;
   zAVLKey (*getkey)(const void *item);
-  int keytype;
 } zAVLTree;
 
@@ -66,5 +62,5 @@
 
 
-extern zAVLTree *zAVLAllocTree (zAVLKey (*getkey)(void const *item), int keytype);
+extern zAVLTree *zAVLAllocTree (zAVLKey (*getkey)(void const *item));
 extern void zAVLFreeTree (zAVLTree *avltree, void (freeitem)(void *item));
 extern int zAVLInsert (zAVLTree *avltree, void *item);
@@ -74,9 +70,3 @@
 extern void *zAVLNext (zAVLCursor *avlcursor);
 
-extern char * zAVL_string_get (zAVLTree * tree, const char * key);
-/* uses strdup to insert a copy */
-extern int zAVL_string_set (zAVLTree ** tree, const char * key); 
-extern void zAVL_string_reset (zAVLTree * tree);
-extern void zAVL_string_del (zAVLTree * tree, const char * key);
-
 #endif
