The branch, master has been updated via 1fcd85e8b9235301c7bc6c4c0878e73ddcbd4b16 (commit) via ebb929779bf9f4aa0cb9695a3ee5ce5d550bcecc (commit) via a4afed1e9a28498885382daf96ab7b8997821dca (commit) via fc50f7ecbab4bf273697f2114a723eae917251bb (commit) via 8f68a716fdefb153811d7d930fdd73df9963246a (commit) via e490c1b8c858ea42e31ae1a6504c4788e0fb1545 (commit) from 8e2b48e1b7c7fd6b6080f2e56f654b682c6426a3 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 1fcd85e8b9235301c7bc6c4c0878e73ddcbd4b16 Merge: ebb929779bf9f4aa0cb9695a3ee5ce5d550bcecc 8e2b48e1b7c7fd6b6080f2e56f654b682c6426a3 Author: Jelmer Vernooij <jel...@samba.org> Date: Thu Jan 22 22:49:30 2009 +0100 Merge branch 'master' of ssh://git.samba.org/data/git/samba commit ebb929779bf9f4aa0cb9695a3ee5ce5d550bcecc Author: Jelmer Vernooij <jel...@samba.org> Date: Thu Jan 22 15:23:32 2009 +0100 Remove obsolete samr Python module - use samba.dcerpc.samr instead. commit a4afed1e9a28498885382daf96ab7b8997821dca Author: Jelmer Vernooij <jel...@samba.org> Date: Thu Jan 22 14:49:51 2009 +0100 Implement as_sddl. commit fc50f7ecbab4bf273697f2114a723eae917251bb Author: Jelmer Vernooij <jel...@samba.org> Date: Thu Jan 22 14:37:59 2009 +0100 Support parsing sddl for security descriptors. commit 8f68a716fdefb153811d7d930fdd73df9963246a Merge: e490c1b8c858ea42e31ae1a6504c4788e0fb1545 3662c2b0f648d1719cbb26f9abfc61dbe03f8a2a Author: Jelmer Vernooij <jel...@samba.org> Date: Thu Jan 22 11:37:27 2009 +0100 Merge branch 'master' of ssh://git.samba.org/data/git/samba commit e490c1b8c858ea42e31ae1a6504c4788e0fb1545 Author: Jelmer Vernooij <jel...@samba.org> Date: Thu Jan 22 11:35:28 2009 +0100 Move configure test files to the top-level and share them between s3 and s4. ----------------------------------------------------------------------- Summary of changes: source3/configure.in | 22 +- source3/tests/trivial.c | 4 - source4/build/m4/check_cc.m4 | 2 +- source4/build/m4/check_ld.m4 | 6 +- source4/build/m4/public.m4 | 2 +- source4/build/tests/README | 10 - source4/build/tests/crypttest.c | 851 -------------------- source4/build/tests/fcntl_lock.c | 112 --- source4/build/tests/fcntl_lock64.c | 87 -- source4/build/tests/shlib.c | 6 - source4/build/tests/summary.c | 22 - source4/configure.ac | 2 +- source4/libcli/security/tests/bindings.py | 18 + source4/librpc/ndr/py_security.c | 49 ++- source4/scripting/python/samba/samr.py | 759 ----------------- {source3/tests => tests}/README | 0 {source3/tests => tests}/crypttest.c | 0 {source3/tests => tests}/fcntl_lock.c | 0 {source3/tests => tests}/fcntl_lock64.c | 0 {source4/build/tests => tests}/fcntl_lock_thread.c | 0 {source3/tests => tests}/ftruncate.c | 0 {source3/tests => tests}/getgroups.c | 0 {source4/build/tests => tests}/shared_mmap.c | 0 {source3/tests => tests}/shlib.c | 0 {source3/tests => tests}/summary.c | 2 + {source4/build/tests => tests}/trivial.c | 0 26 files changed, 84 insertions(+), 1870 deletions(-) delete mode 100644 source3/tests/trivial.c delete mode 100644 source4/build/tests/README delete mode 100644 source4/build/tests/crypttest.c delete mode 100644 source4/build/tests/fcntl_lock.c delete mode 100644 source4/build/tests/fcntl_lock64.c delete mode 100644 source4/build/tests/shlib.c delete mode 100644 source4/build/tests/summary.c delete mode 100644 source4/scripting/python/samba/samr.py rename {source3/tests => tests}/README (100%) rename {source3/tests => tests}/crypttest.c (100%) rename {source3/tests => tests}/fcntl_lock.c (100%) rename {source3/tests => tests}/fcntl_lock64.c (100%) rename {source4/build/tests => tests}/fcntl_lock_thread.c (100%) rename {source3/tests => tests}/ftruncate.c (100%) rename {source3/tests => tests}/getgroups.c (100%) rename {source4/build/tests => tests}/shared_mmap.c (100%) rename {source3/tests => tests}/shlib.c (100%) rename {source3/tests => tests}/summary.c (98%) rename {source4/build/tests => tests}/trivial.c (100%) Changeset truncated at 500 lines: diff --git a/source3/configure.in b/source3/configure.in index 87b4c33..44a932c 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1916,7 +1916,7 @@ AC_CACHE_CHECK([whether building shared libraries actually works], # The $SHLD and $LDSHFLAGS variables may contain references to other # variables so they need to be eval'ed. $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o \ - shlib.o ${srcdir-.}/tests/shlib.c && \ + shlib.o ${srcdir-.}/../tests/shlib.c && \ `eval echo $SHLD` `eval echo $LDSHFLAGS` -o "shlib.$SHLIBEXT" \ shlib.o && ac_cv_shlib_works=yes rm -f "shlib.$SHLIBEXT" shlib.o @@ -2749,20 +2749,20 @@ if test x"$samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT" = x"yes"; then fi AC_MSG_CHECKING([for test routines]) -AC_TRY_RUN([#include "${srcdir-.}/tests/trivial.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"], AC_MSG_RESULT(yes), AC_MSG_ERROR([cant find test code. Aborting config]), AC_MSG_WARN([cannot run when cross-compiling])) AC_CACHE_CHECK([for ftruncate extend],samba_cv_HAVE_FTRUNCATE_EXTEND,[ -AC_TRY_RUN([#include "${srcdir-.}/tests/ftruncate.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/ftruncate.c"], samba_cv_HAVE_FTRUNCATE_EXTEND=yes,samba_cv_HAVE_FTRUNCATE_EXTEND=no,samba_cv_HAVE_FTRUNCATE_EXTEND=cross)]) if test x"$samba_cv_HAVE_FTRUNCATE_EXTEND" = x"yes"; then AC_DEFINE(HAVE_FTRUNCATE_EXTEND,1,[Truncate extend]) fi AC_CACHE_CHECK([for broken getgroups],samba_cv_HAVE_BROKEN_GETGROUPS,[ -AC_TRY_RUN([#include "${srcdir-.}/tests/getgroups.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/getgroups.c"], samba_cv_HAVE_BROKEN_GETGROUPS=yes,samba_cv_HAVE_BROKEN_GETGROUPS=no,samba_cv_HAVE_BROKEN_GETGROUPS=cross)]) if test x"$samba_cv_HAVE_BROKEN_GETGROUPS" = x"yes"; then AC_DEFINE(HAVE_BROKEN_GETGROUPS,1,[Whether getgroups is broken]) @@ -2849,14 +2849,14 @@ if test x"$samba_cv_DARWIN_INITGROUPS" = x"yes" ; then fi AC_CACHE_CHECK([for fcntl locking],samba_cv_HAVE_FCNTL_LOCK,[ -AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/fcntl_lock.c"], samba_cv_HAVE_FCNTL_LOCK=yes,samba_cv_HAVE_FCNTL_LOCK=no,samba_cv_HAVE_FCNTL_LOCK=cross)]) if test x"$samba_cv_HAVE_FCNTL_LOCK" = x"yes"; then AC_DEFINE(HAVE_FCNTL_LOCK,1,[Whether fcntl locking is available]) fi AC_CACHE_CHECK([for broken (glibc2.1/x86) 64 bit fcntl locking],samba_cv_HAVE_BROKEN_FCNTL64_LOCKS,[ -AC_TRY_RUN([#include "${srcdir-.}/tests/fcntl_lock64.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/fcntl_lock64.c"], samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=no,samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross)]) if test x"$samba_cv_HAVE_BROKEN_FCNTL64_LOCKS" = x"yes"; then AC_DEFINE(HAVE_BROKEN_FCNTL64_LOCKS,1,[Whether fcntl64 locks are broken]) @@ -4375,7 +4375,7 @@ if test $with_pam_for_crypt = no; then AC_CACHE_CHECK([for a crypt that needs truncated salt],samba_cv_HAVE_TRUNCATED_SALT,[ crypt_LIBS="$LIBS" LIBS="$AUTH_LIBS $LIBS" -AC_TRY_RUN([#include "${srcdir-.}/tests/crypttest.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/crypttest.c"], samba_cv_HAVE_TRUNCATED_SALT=no,samba_cv_HAVE_TRUNCATED_SALT=yes,samba_cv_HAVE_TRUNCATED_SALT=cross) LIBS="$crypt_LIBS"]) if test x"$samba_cv_HAVE_TRUNCATED_SALT" = x"yes"; then @@ -4603,7 +4603,7 @@ AC_TRY_RUN_STRICT([ #define HAVE_QUOTACTL_4A 1 #define AUTOCONF_TEST 1 #include "confdefs.h" -#include "${srcdir-.}/tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS], +#include "${srcdir-.}/../tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS], samba_cv_HAVE_QUOTACTL_4A=yes,samba_cv_HAVE_QUOTACTL_4A=no,samba_cv_HAVE_QUOTACTL_4A=cross)]) if test x"$samba_cv_HAVE_QUOTACTL_4A" = x"yes"; then samba_cv_SYSQUOTA_FOUND=yes; @@ -4618,7 +4618,7 @@ AC_TRY_RUN_STRICT([ #define HAVE_QUOTACTL_4B 1 #define AUTOCONF_TEST 1 #include "confdefs.h" -#include "${srcdir-.}/tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS], +#include "${srcdir-.}/../tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS], samba_cv_HAVE_QUOTACTL_4B=yes,samba_cv_HAVE_QUOTACTL_4B=no,samba_cv_HAVE_QUOTACTL_4B=cross)]) if test x"$samba_cv_HAVE_QUOTACTL_4B" = x"yes"; then echo "int quotactl(const char *path, int cmd, int id, char *addr) is not reworked for the new sys_quota api" @@ -4634,7 +4634,7 @@ AC_TRY_RUN_STRICT([ #define HAVE_QUOTACTL_3 1 #define AUTOCONF_TEST 1 #include "confdefs.h" -#include "${srcdir-.}/tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS], +#include "${srcdir-.}/../tests/sysquotas.c"],[$Werror_FLAGS],[$CPPFLAGS],[$LDFLAGS], samba_cv_HAVE_QUOTACTL_3=yes,samba_cv_HAVE_QUOTACTL_3=no,samba_cv_HAVE_QUOTACTL_3=cross)]) if test x"$samba_cv_HAVE_QUOTACTL_3" = x"yes"; then echo "CRAY int quotactl (char *spec, int request, char *arg) is NOT reworked for the sys_quota api" @@ -6348,7 +6348,7 @@ AC_MSG_RESULT([ AUTH_LIBS = $AUTH_LIBS]) # final configure stuff AC_MSG_CHECKING([configure summary]) -AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/summary.c"], AC_MSG_RESULT(yes), AC_MSG_ERROR([summary failure. Aborting config]); exit 1;, AC_MSG_WARN([cannot run when cross-compiling])) diff --git a/source3/tests/trivial.c b/source3/tests/trivial.c deleted file mode 100644 index 2723637..0000000 --- a/source3/tests/trivial.c +++ /dev/null @@ -1,4 +0,0 @@ -main() -{ - exit(0); -} diff --git a/source4/build/m4/check_cc.m4 b/source4/build/m4/check_cc.m4 index 51531ca..1683cb0 100644 --- a/source4/build/m4/check_cc.m4 +++ b/source4/build/m4/check_cc.m4 @@ -51,7 +51,7 @@ if test x"$samba_cv_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then fi AC_MSG_CHECKING([for test routines]) -AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"], AC_MSG_RESULT(yes), AC_MSG_ERROR([cant find test code. Aborting config]), AC_MSG_WARN([cannot run when cross-compiling])) diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4 index 3a74ffc..48d6b33 100644 --- a/source4/build/m4/check_ld.m4 +++ b/source4/build/m4/check_ld.m4 @@ -137,7 +137,7 @@ if test $BLDSHARED = true; then ac_cv_shlib_works=no # try building a trivial shared library # TODO: also test SONAMEFLAG - ${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/build/tests/shlib.c -o shlib.o && + ${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/../tests/shlib.c -o shlib.o && ${SHLD} ${SHLD_FLAGS} -o shlib.${SHLIBEXT} shlib.o && ac_cv_shlib_works=yes rm -f shlib.${SHLIBEXT} shlib.o @@ -146,7 +146,7 @@ if test $BLDSHARED = true; then [ac_cv_shmod_works],[ ac_cv_shmod_works=no # try building a trivial shared library - ${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/build/tests/shlib.c -o shlib.o && + ${CC} ${CFLAGS} ${PICFLAG} -c ${srcdir-.}/../tests/shlib.c -o shlib.o && ${MDLD} ${MDLD_FLAGS} -o shlib.${SHLIBEXT} shlib.o && ac_cv_shmod_works=yes rm -f shlib.${SHLIBEXT} shlib.o @@ -162,7 +162,7 @@ fi AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension]) AC_MSG_CHECKING([if we can link using the selected flags]) -AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"], +AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"], AC_MSG_RESULT(yes), AC_MSG_ERROR([we cannot link with the selected cc and ld flags. Aborting configure]), AC_MSG_WARN([cannot run when cross-compiling])) diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index a2b46a5..ffd112f 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -90,7 +90,7 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], OLD_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $$1_CFLAGS" AC_MSG_CHECKING([that the C compiler can use the $1_CFLAGS]) - AC_TRY_RUN([#include "${srcdir-.}/build/tests/trivial.c"], + AC_TRY_RUN([#include "${srcdir-.}/../tests/trivial.c"], SMB_ENABLE($1, YES) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), diff --git a/source4/build/tests/README b/source4/build/tests/README deleted file mode 100644 index cf1be8b..0000000 --- a/source4/build/tests/README +++ /dev/null @@ -1,10 +0,0 @@ -This directory contains autoconf test programs that are too large to -comfortably fit in configure.in. - -These programs should test one feature of the OS and exit(0) if it -works or exit(1) if it doesn't work (do _not_ use return) - -The programs should be kept simple and to the point. Beautiful/fast -code is not necessary - - diff --git a/source4/build/tests/crypttest.c b/source4/build/tests/crypttest.c deleted file mode 100644 index 0e500d5..0000000 --- a/source4/build/tests/crypttest.c +++ /dev/null @@ -1,851 +0,0 @@ -#if defined(HAVE_UNISTD_H) -#include <unistd.h> -#endif - -#include <sys/types.h> - -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#ifdef HAVE_STRINGS_H -#include <strings.h> -#endif - -#if !defined(HAVE_CRYPT) - -/* - This bit of code was derived from the UFC-crypt package which - carries the following copyright - - Modified for use by Samba by Andrew Tridgell, October 1994 - - Note that this routine is only faster on some machines. Under Linux 1.1.51 - libc 4.5.26 I actually found this routine to be slightly slower. - - Under SunOS I found a huge speedup by using these routines - (a factor of 20 or so) - - Warning: I've had a report from Steve Kennedy <st...@gbnet.org> - that this crypt routine may sometimes get the wrong answer. Only - use UFC_CRYT if you really need it. - -*/ - -/* - * UFC-crypt: ultra fast crypt(3) implementation - * - * Copyright (C) 1991-1998, Free Software Foundation, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see <http://www.gnu.org/licenses/>. - * - * @(#)crypt_util.c 2.31 02/08/92 - * - * Support routines - * - */ - - -#ifndef long32 -#if (SIZEOF_INT == 4) -#define long32 int -#elif (SIZEOF_LONG == 4) -#define long32 long -#elif (SIZEOF_SHORT == 4) -#define long32 short -#else -/* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */ -#define long32 int -#endif -#endif - -#ifndef long64 -#ifdef HAVE_LONGLONG -#define long64 long long long -#endif -#endif - -#ifndef ufc_long -#define ufc_long unsigned -#endif - -#ifndef _UFC_64_ -#define _UFC_32_ -#endif - -/* - * Permutation done once on the 56 bit - * key derived from the original 8 byte ASCII key. - */ -static int pc1[56] = { - 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, - 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, - 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, - 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 -}; - -/* - * How much to rotate each 28 bit half of the pc1 permutated - * 56 bit key before using pc2 to give the i' key - */ -static int rots[16] = { - 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 -}; - -/* - * Permutation giving the key - * of the i' DES round - */ -static int pc2[48] = { - 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, - 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, - 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, - 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 -}; - -/* - * The E expansion table which selects - * bits from the 32 bit intermediate result. - */ -static int esel[48] = { - 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, - 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, - 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, - 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 -}; -static int e_inverse[64]; - -/* - * Permutation done on the - * result of sbox lookups - */ -static int perm32[32] = { - 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, - 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 -}; - -/* - * The sboxes - */ -static int sbox[8][4][16]= { - { { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 }, - { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 }, - { 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 }, - { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 } - }, - - { { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 }, - { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 }, - { 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 }, - { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 } - }, - - { { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 }, - { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 }, - { 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 }, - { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 } - }, - - { { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 }, - { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 }, - { 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 }, - { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 } - }, - - { { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 }, - { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 }, - { 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 }, - { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 } - }, - - { { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 }, - { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 }, - { 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 }, - { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 } - }, - - { { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 }, - { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 }, - { 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 }, - { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 } - }, - - { { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 }, - { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 }, - { 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 }, - { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 } - } -}; - -/* - * This is the final - * permutation matrix - */ -static int final_perm[64] = { - 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, - 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, - 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, - 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25 -}; - -/* - * The 16 DES keys in BITMASK format - */ -#ifdef _UFC_32_ -long32 _ufc_keytab[16][2]; -#endif - -#ifdef _UFC_64_ -long64 _ufc_keytab[16]; -#endif - - -#define ascii_to_bin(c) ((c)>='a'?(c-59):(c)>='A'?((c)-53):(c)-'.') -#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.') - -/* Macro to set a bit (0..23) */ -#define BITMASK(i) ( (1<<(11-(i)%12+3)) << ((i)<12?16:0) ) - -/* - * sb arrays: - * - * Workhorses of the inner loop of the DES implementation. - * They do sbox lookup, shifting of this value, 32 bit - * permutation and E permutation for the next round. - * - * Kept in 'BITMASK' format. - */ - -#ifdef _UFC_32_ -long32 _ufc_sb0[8192], _ufc_sb1[8192], _ufc_sb2[8192], _ufc_sb3[8192]; -static long32 *sb[4] = {_ufc_sb0, _ufc_sb1, _ufc_sb2, _ufc_sb3}; -#endif - -#ifdef _UFC_64_ -long64 _ufc_sb0[4096], _ufc_sb1[4096], _ufc_sb2[4096], _ufc_sb3[4096]; -static long64 *sb[4] = {_ufc_sb0, _ufc_sb1, _ufc_sb2, _ufc_sb3}; -#endif - -/* - * eperm32tab: do 32 bit permutation and E selection - * - * The first index is the byte number in the 32 bit value to be permuted - * - second - is the value of this byte - * - third - selects the two 32 bit values - * - * The table is used and generated internally in init_des to speed it up - */ -static ufc_long eperm32tab[4][256][2]; - -/* - * do_pc1: permform pc1 permutation in the key schedule generation. - * - * The first index is the byte number in the 8 byte ASCII key - * - second - - the two 28 bits halfs of the result - * - third - selects the 7 bits actually used of each byte - * - * The result is kept with 28 bit per 32 bit with the 4 most significant - * bits zero. - */ -static ufc_long do_pc1[8][2][128]; - -/* - * do_pc2: permform pc2 permutation in the key schedule generation. - * - * The first index is the septet number in the two 28 bit intermediate values - * - second - - - septet values - * - * Knowledge of the structure of the pc2 permutation is used. - * - * The result is kept with 28 bit per 32 bit with the 4 most significant - * bits zero. - */ -static ufc_long do_pc2[8][128]; - -/* - * efp: undo an extra e selection and do final - * permutation giving the DES result. - * - * Invoked 6 bit a time on two 48 bit values - * giving two 32 bit longs. - */ -static ufc_long efp[16][64][2]; - -static unsigned char bytemask[8] = { - 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 -}; - -static ufc_long longmask[32] = { - 0x80000000, 0x40000000, 0x20000000, 0x10000000, - 0x08000000, 0x04000000, 0x02000000, 0x01000000, - 0x00800000, 0x00400000, 0x00200000, 0x00100000, - 0x00080000, 0x00040000, 0x00020000, 0x00010000, - 0x00008000, 0x00004000, 0x00002000, 0x00001000, - 0x00000800, 0x00000400, 0x00000200, 0x00000100, - 0x00000080, 0x00000040, 0x00000020, 0x00000010, - 0x00000008, 0x00000004, 0x00000002, 0x00000001 -}; - - -/* - * Silly rewrite of 'bzero'. I do so - * because some machines don't have - * bzero and some don't have memset. - */ - -static void clearmem(char *start, int cnt) - { while(cnt--) - *start++ = '\0'; - } - -static int initialized = 0; -- Samba Shared Repository