mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-29 20:04:57 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a964be6d2c |
No files matched your search
@@ -1,99 +0,0 @@
|
||||
$FreeBSD$
|
||||
CVS
|
||||
testsuite
|
||||
.cvsignore
|
||||
config.if
|
||||
mkdep
|
||||
*COPYING*
|
||||
etc
|
||||
*-hp*
|
||||
*-macos*
|
||||
*-ncr*
|
||||
*.bat
|
||||
*.com
|
||||
*.info*
|
||||
arlex.c
|
||||
arparse.[ch]
|
||||
deflex.c
|
||||
gprof
|
||||
itbl-lex.c
|
||||
itbl-parse.[ch]
|
||||
ldgram.[ch]
|
||||
ldlex.c
|
||||
sysinfo.[ch]
|
||||
syslex.c
|
||||
testsuite
|
||||
texinfo
|
||||
*10[23]00*
|
||||
*532*
|
||||
*[a-z]29k*
|
||||
*[a-z][89]60*
|
||||
*_be*
|
||||
*a68*
|
||||
*adobe*
|
||||
*aix*
|
||||
*apollo*
|
||||
*beos*
|
||||
*bout*
|
||||
*cisco*
|
||||
*d10v*
|
||||
*delt88*
|
||||
*delta*
|
||||
*dgux*
|
||||
*djgpp*
|
||||
*dos*
|
||||
*dpx2*
|
||||
*dynix*
|
||||
*epoc*
|
||||
*go32*
|
||||
*h8[35]00*
|
||||
*hp300*
|
||||
*hp[-.]*
|
||||
*hppa*
|
||||
*hpux*
|
||||
*interix*
|
||||
*irix*
|
||||
*lynx*
|
||||
*m32r*
|
||||
*m[68]8k*
|
||||
*mac-*
|
||||
*mach*
|
||||
*mcore*
|
||||
*mpw*
|
||||
*netware*
|
||||
*news*
|
||||
*nlm*
|
||||
*ns32*
|
||||
*oasys*
|
||||
*os9*
|
||||
*pei*
|
||||
*pmac*
|
||||
*psos*
|
||||
*pyr*
|
||||
*riscix*
|
||||
*riscos*
|
||||
*rs6000*
|
||||
*sa29200*
|
||||
*shpe*
|
||||
*som*
|
||||
*st2000*
|
||||
*sun*
|
||||
*symmetry*
|
||||
*tahoe*
|
||||
*u68k*
|
||||
*vax*
|
||||
*vms*
|
||||
*vxworks*
|
||||
*w65*
|
||||
*we32k*
|
||||
*win*
|
||||
*xcoff*
|
||||
*i370*
|
||||
*avr*
|
||||
*tic54x*
|
||||
*tic80*
|
||||
*d30v*
|
||||
*fr30*
|
||||
*-sh.*
|
||||
*pj*
|
||||
*ver.texi
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
/* Name of package. */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version of package. */
|
||||
#undef VERSION
|
||||
|
||||
/* Whether strstr must be declared even if <string.h> is included. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
|
||||
/* Whether malloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Whether realloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_REALLOC
|
||||
|
||||
/* Whether free must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Whether getenv must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_GETENV
|
||||
@TOP@
|
||||
|
||||
/* Do we need to use the b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
|
||||
/* Name of host specific header file to include in trad-core.c. */
|
||||
#undef TRAD_HEADER
|
||||
|
||||
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
|
||||
#undef HAVE_SYS_PROCFS_H
|
||||
|
||||
/* Do we really want to use mmap if it's available? */
|
||||
#undef USE_MMAP
|
||||
@@ -1,62 +0,0 @@
|
||||
# Makefile for gperf
|
||||
|
||||
# Copyright (C) 1989, 1992, 1993, 1998 Free Software Foundation, Inc.
|
||||
# written by Douglas C. Schmidt ([email protected])
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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 1, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to
|
||||
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Programs used by "make":
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
all : force
|
||||
cd @subdir@; $(MAKE) all
|
||||
|
||||
install : force
|
||||
cd @subdir@; $(MAKE) install
|
||||
|
||||
installdirs : force
|
||||
cd @subdir@; $(MAKE) installdirs
|
||||
|
||||
uninstall : force
|
||||
cd @subdir@; $(MAKE) uninstall
|
||||
|
||||
check : force
|
||||
cd @subdir@; $(MAKE) check
|
||||
|
||||
mostlyclean : force
|
||||
cd @subdir@; $(MAKE) mostlyclean
|
||||
|
||||
clean : force
|
||||
cd @subdir@; $(MAKE) clean
|
||||
|
||||
distclean : force
|
||||
cd @subdir@; if test -f Makefile; then $(MAKE) distclean; fi
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
maintainer-clean : force
|
||||
cd @subdir@; if test -f Makefile; then $(MAKE) maintainer-clean; fi
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
force :
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
/* Define if the C++ compiler supports "throw ()" declarations. */
|
||||
#undef HAVE_THROW_DECL
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
dnl autoconf configuration for gperf
|
||||
|
||||
dnl Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
dnl written by Douglas C. Schmidt ([email protected])
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 1, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU GPERF; see the file COPYING. If not, write to the
|
||||
dnl Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
dnl MA 02111-1307, USA.
|
||||
|
||||
AC_INIT(doc/gperf.1)
|
||||
AC_PROG_MAKE_SET
|
||||
dnl This piece of sed script replaces every line containing '@subdir@'
|
||||
dnl by several consecutive lines, each referencing one subdir.
|
||||
extrasub="$extrasub"'
|
||||
/@subdir@/{
|
||||
h
|
||||
g
|
||||
s/@subdir@/lib/
|
||||
p
|
||||
g
|
||||
s/@subdir@/src/
|
||||
p
|
||||
g
|
||||
s/@subdir@/tests/
|
||||
p
|
||||
g
|
||||
s/@subdir@/doc/
|
||||
p
|
||||
d
|
||||
}
|
||||
'
|
||||
AC_OUTPUT(Makefile)
|
||||
AC_OUTPUT_SUBDIRS(lib src tests doc)
|
||||
@@ -1,109 +0,0 @@
|
||||
# Makefile for gperf/lib
|
||||
|
||||
# Copyright (C) 1989, 1992, 1993, 1998 Free Software Foundation, Inc.
|
||||
# written by Douglas C. Schmidt ([email protected])
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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 1, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Directories used by "make":
|
||||
srcdir = @srcdir@
|
||||
|
||||
# Directories used by "make install":
|
||||
prefix = @prefix@
|
||||
local_prefix = /usr/local
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
# Programs used by "make":
|
||||
# C compiler
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
# C++ compiler
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCPP = @CXXCPP@
|
||||
# Other
|
||||
AR = ar
|
||||
AR_FLAGS = rc
|
||||
RANLIB = @RANLIB@
|
||||
MV = mv
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
# Programs used by "make install":
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
VPATH = $(srcdir)
|
||||
|
||||
OBJECTS = getopt.o getopt1.o hash.o
|
||||
CPPFLAGS = -I$(srcdir)
|
||||
|
||||
TARGETLIB = libgp.a
|
||||
|
||||
all : $(TARGETLIB)
|
||||
|
||||
$(TARGETLIB): $(OBJECTS)
|
||||
$(RM) $@
|
||||
$(AR) $(AR_FLAGS) $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
# Don't use implicit rules, since AIX "make" and OSF/1 "make" don't always
|
||||
# expand $< correctly in this context.
|
||||
#
|
||||
#%.o : %.c
|
||||
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
|
||||
#
|
||||
#%.o : %.cc
|
||||
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
|
||||
|
||||
getopt.o : getopt.c getopt.h
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt.c
|
||||
|
||||
getopt1.o : getopt1.c getopt.h
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt1.c
|
||||
|
||||
hash.o : hash.cc hash.h
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash.cc
|
||||
|
||||
install : all
|
||||
|
||||
installdirs :
|
||||
|
||||
uninstall :
|
||||
|
||||
check : all
|
||||
|
||||
mostlyclean : clean
|
||||
|
||||
clean : force
|
||||
$(RM) *~ *.s *.o *.a $(TARGETLIB) core
|
||||
|
||||
distclean : clean
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
maintainer-clean : distclean
|
||||
|
||||
force :
|
||||
@@ -1,43 +0,0 @@
|
||||
dnl autoconf configuration for gperf/lib
|
||||
|
||||
dnl Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
dnl written by Douglas C. Schmidt ([email protected])
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 1, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU GPERF; see the file COPYING. If not, write to the
|
||||
dnl Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
dnl MA 02111-1307, USA.
|
||||
|
||||
AC_INIT(hash.cc)
|
||||
AC_PROG_MAKE_SET
|
||||
dnl
|
||||
dnl checks for programs
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
dnl sets variable CC
|
||||
AC_PROG_CPP
|
||||
dnl sets variable CPP
|
||||
AC_PROG_CXX
|
||||
dnl sets variable CXX
|
||||
AC_PROG_CXXCPP
|
||||
dnl sets variable CXXCPP
|
||||
CL_PROG_RANLIB
|
||||
dnl sets variable RANLIB
|
||||
CL_PROG_INSTALL
|
||||
dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
|
||||
dnl
|
||||
dnl That's it.
|
||||
dnl
|
||||
AC_OUTPUT(Makefile)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,25 +0,0 @@
|
||||
getopt.c is a modified version of the getopt.c found in the glibc snapshot
|
||||
on 1998-04-14. Below the patch that has been applied to this file. The glibc
|
||||
maintainer has been informed of these patches.
|
||||
|
||||
diff -c3 getopt.c.orig getopt.c
|
||||
*** getopt.c.orig Sun Mar 8 16:06:55 1998
|
||||
--- getopt.c Thu Apr 16 00:09:41 1998
|
||||
***************
|
||||
*** 201,207 ****
|
||||
/* Avoid depending on library functions or files
|
||||
whose names are inconsistent. */
|
||||
|
||||
! char *getenv ();
|
||||
|
||||
static char *
|
||||
my_index (str, chr)
|
||||
--- 201,208 ----
|
||||
/* Avoid depending on library functions or files
|
||||
whose names are inconsistent. */
|
||||
|
||||
! extern char *getenv ();
|
||||
! extern int strncmp ();
|
||||
|
||||
static char *
|
||||
my_index (str, chr)
|
||||
@@ -1,188 +0,0 @@
|
||||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if !defined __STDC__ || !__STDC__
|
||||
/* This is a separate conditional since some stdc systems
|
||||
reject `defined (const)'. */
|
||||
#ifndef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
Library, but also included in many other GNU distributions. Compiling
|
||||
and linking in this code is a waste when using the GNU C library
|
||||
(especially if it is a shared library). Rather than having every GNU
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#define GETOPT_INTERFACE_VERSION 2
|
||||
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* This needs to come after some library #include
|
||||
to get __GNU_LIBRARY__ defined. */
|
||||
#ifdef __GNU_LIBRARY__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
int
|
||||
getopt_long (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (argc, argv, options, long_options, opt_index)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *options;
|
||||
const struct option *long_options;
|
||||
int *opt_index;
|
||||
{
|
||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value `%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
||||
@@ -1,49 +0,0 @@
|
||||
/* Fast lookup table abstraction implemented as an Iteration Number Array
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#include "bool-array.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "options.h"
|
||||
#include "trace.h"
|
||||
|
||||
STORAGE_TYPE * Bool_Array::storage_array;
|
||||
STORAGE_TYPE Bool_Array::iteration_number;
|
||||
unsigned int Bool_Array::size;
|
||||
|
||||
/* Prints out debugging diagnostics. */
|
||||
|
||||
Bool_Array::~Bool_Array (void)
|
||||
{
|
||||
T (Trace t ("Bool_Array::~Bool_Array");)
|
||||
if (option[DEBUG])
|
||||
fprintf (stderr, "\ndumping boolean array information\n"
|
||||
"size = %d\niteration number = %d\nend of array dump\n",
|
||||
size, iteration_number);
|
||||
}
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
#define INLINE /* not inline */
|
||||
#include "bool-array.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif /* not defined __OPTIMIZE__ */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Simple lookup table abstraction implemented as an Iteration Number Array.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Define and implement a simple boolean array abstraction,
|
||||
uses an Iteration Numbering implementation to save on initialization time. */
|
||||
|
||||
#ifndef bool_array_h
|
||||
#define bool_array_h 1
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
#ifdef LO_CAL
|
||||
/* If we are on a memory diet then we'll only make these use a limited
|
||||
amount of storage space. */
|
||||
typedef unsigned short STORAGE_TYPE;
|
||||
#else
|
||||
typedef unsigned int STORAGE_TYPE;
|
||||
#endif
|
||||
|
||||
class Bool_Array
|
||||
{
|
||||
private:
|
||||
static STORAGE_TYPE *storage_array; /* Initialization of the index space. */
|
||||
static STORAGE_TYPE iteration_number; /* Keep track of the current iteration. */
|
||||
static unsigned int size; /* Keep track of array size. */
|
||||
|
||||
public:
|
||||
Bool_Array (void);
|
||||
~Bool_Array (void);
|
||||
static void init (STORAGE_TYPE *buffer, unsigned int s);
|
||||
static int find (int hash_value);
|
||||
static void reset (void);
|
||||
};
|
||||
|
||||
#ifdef __OPTIMIZE__ /* efficiency hack! */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "options.h"
|
||||
#define INLINE inline
|
||||
#include "bool-array.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,85 +0,0 @@
|
||||
/* Inline Functions for bool-array.{h,cc}.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
// This needs:
|
||||
//#include <stdio.h>
|
||||
//#include <string.h>
|
||||
//#include "options.h"
|
||||
//#include "trace.h"
|
||||
|
||||
INLINE
|
||||
Bool_Array::Bool_Array (void)
|
||||
{
|
||||
T (Trace t ("Bool_Array::Bool_Array");)
|
||||
storage_array = 0;
|
||||
iteration_number = size = 0;
|
||||
}
|
||||
|
||||
INLINE void
|
||||
Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
|
||||
{
|
||||
T (Trace t ("Bool_Array::init");)
|
||||
size = s;
|
||||
iteration_number = 1;
|
||||
storage_array = buffer;
|
||||
memset (storage_array, 0, s * sizeof (*storage_array));
|
||||
if (option[DEBUG])
|
||||
fprintf (stderr, "\nbool array size = %d, total bytes = %d\n",
|
||||
size, (unsigned int) (size * sizeof (*storage_array)));
|
||||
}
|
||||
|
||||
INLINE int
|
||||
Bool_Array::find (int index)
|
||||
{
|
||||
T (Trace t ("Bool_Array::find");)
|
||||
if (storage_array[index] == iteration_number)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
storage_array[index] = iteration_number;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void
|
||||
Bool_Array::reset (void)
|
||||
{
|
||||
T (Trace t ("Bool_Array::reset");)
|
||||
/* If we wrap around it's time to zero things out again! However, this only
|
||||
occurs once about every 2^31 or 2^15 iterations, so it should probably
|
||||
never happen! */
|
||||
|
||||
if (++iteration_number == 0)
|
||||
{
|
||||
if (option[DEBUG])
|
||||
{
|
||||
fprintf (stderr, "(re-initializing bool_array)...");
|
||||
fflush (stderr);
|
||||
}
|
||||
iteration_number = 1;
|
||||
memset (storage_array, 0, size * sizeof (*storage_array));
|
||||
if (option[DEBUG])
|
||||
{
|
||||
fprintf (stderr, "done\n");
|
||||
fflush (stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if the C++ compiler supports "throw ()" declarations. */
|
||||
#undef HAVE_THROW_DECL
|
||||
|
||||
/* Define if you have the getrlimit function. */
|
||||
#undef HAVE_GETRLIMIT
|
||||
|
||||
/* Define if you have the setrlimit function. */
|
||||
#undef HAVE_SETRLIMIT
|
||||
|
||||
/* Define if you have the <sys/resource.h> header file. */
|
||||
#undef HAVE_SYS_RESOURCE_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
@@ -1,96 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Data and function member declarations for the keyword list class.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
/* The key word list is a useful abstraction that keeps track of
|
||||
various pieces of information that enable that fast generation
|
||||
of the Gen_Perf.hash function. A Key_List is a singly-linked
|
||||
list of List_Nodes. */
|
||||
|
||||
#ifndef key_list_h
|
||||
#define key_list_h 1
|
||||
|
||||
#include "list-node.h"
|
||||
#include "vectors.h"
|
||||
#include "read-line.h"
|
||||
|
||||
/* OSF/1 cxx needs these forward declarations. */
|
||||
struct Output_Constants;
|
||||
struct Output_Compare;
|
||||
|
||||
class Key_List : private Read_Line, public Vectors
|
||||
{
|
||||
private:
|
||||
const char *array_type; /* Pointer to the type for word list. */
|
||||
const char *return_type; /* Pointer to return type for lookup function. */
|
||||
const char *struct_tag; /* Shorthand for user-defined struct tag type. */
|
||||
const char *include_src; /* C source code to be included verbatim. */
|
||||
int max_key_len; /* Maximum length of the longest keyword. */
|
||||
int min_key_len; /* Minimum length of the shortest keyword. */
|
||||
int min_hash_value; /* Minimum hash value for all keywords. */
|
||||
int max_hash_value; /* Maximum hash value for all keywords. */
|
||||
int occurrence_sort; /* True if sorting by occurrence. */
|
||||
int hash_sort; /* True if sorting by hash value. */
|
||||
int additional_code; /* True if any additional C code is included. */
|
||||
int list_len; /* Length of head's Key_List, not counting duplicates. */
|
||||
int total_keys; /* Total number of keys, counting duplicates. */
|
||||
static int determined[MAX_ALPHA_SIZE]; /* Used in function reorder, below. */
|
||||
static int get_occurrence (List_Node *ptr);
|
||||
#ifndef strcspn
|
||||
static int strcspn (const char *s, const char *reject);
|
||||
#endif
|
||||
static int already_determined (List_Node *ptr);
|
||||
static void set_determined (List_Node *ptr);
|
||||
void compute_min_max (void);
|
||||
int num_hash_values (void);
|
||||
void output_constants (struct Output_Constants&);
|
||||
void output_hash_function (void);
|
||||
void output_keylength_table (void);
|
||||
void output_keyword_table (void);
|
||||
void output_lookup_array (void);
|
||||
void output_lookup_tables (void);
|
||||
void output_lookup_function_body (const struct Output_Compare&);
|
||||
void output_lookup_function (void);
|
||||
void set_output_types (void);
|
||||
void dump (void);
|
||||
const char *get_array_type (void);
|
||||
const char *save_include_src (void);
|
||||
const char *get_special_input (char delimiter);
|
||||
List_Node *merge (List_Node *list1, List_Node *list2);
|
||||
List_Node *merge_sort (List_Node *head);
|
||||
|
||||
protected:
|
||||
List_Node *head; /* Points to the head of the linked list. */
|
||||
int total_duplicates; /* Total number of duplicate hash values. */
|
||||
|
||||
public:
|
||||
Key_List (void);
|
||||
~Key_List (void);
|
||||
int keyword_list_length (void);
|
||||
int max_key_length (void);
|
||||
void reorder (void);
|
||||
void sort (void);
|
||||
void read_keys (void);
|
||||
void output (void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,87 +0,0 @@
|
||||
/* Defines a buffered memory allocation abstraction that reduces calls to
|
||||
malloc.
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* declares malloc(), exit() */
|
||||
#include "trace.h"
|
||||
|
||||
/* Determine default alignment. If your C++ compiler does not
|
||||
like this then try something like #define DEFAULT_ALIGNMENT 8. */
|
||||
struct fooalign {char x; double d;};
|
||||
const int ALIGNMENT = ((char *)&((struct fooalign *) 0)->d - (char *)0);
|
||||
|
||||
/* Provide an abstraction that cuts down on the number of
|
||||
calls to NEW by buffering the memory pool from which
|
||||
strings are allocated. */
|
||||
|
||||
void *
|
||||
operator new (size_t size)
|
||||
{
|
||||
T (Trace t ("operator new");)
|
||||
static char *buf_start = 0; /* Large array used to reduce calls to NEW. */
|
||||
static char *buf_end = 0; /* Indicates end of BUF_START. */
|
||||
static size_t buf_size = 4096; /* Size of buffer pointed to by BUF_START. */
|
||||
char *temp;
|
||||
|
||||
/* Align this on correct boundaries, just to be safe... */
|
||||
size = ((size + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT;
|
||||
|
||||
/* If we are about to overflow our buffer we'll just grab another
|
||||
chunk of memory. Since we never free the original memory it
|
||||
doesn't matter that no one points to the beginning of that
|
||||
chunk. Note we use a heuristic that grows the buffer either by
|
||||
size of the request or by twice the previous size, whichever is
|
||||
larger. */
|
||||
|
||||
if (buf_start + size >= buf_end)
|
||||
{
|
||||
buf_size *= 2;
|
||||
if (buf_size < size)
|
||||
buf_size = size;
|
||||
if ((buf_start = (char *)malloc (buf_size)) != (char *)0)
|
||||
buf_end = buf_start + buf_size;
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Virtual memory exhausted in `operator new'\n");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
temp = buf_start;
|
||||
buf_start += size;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/* We need this deletion operator in order to make the linker happy.
|
||||
Because `operator new' and `operator delete' always come together. */
|
||||
|
||||
void
|
||||
operator delete (void *ptr)
|
||||
#ifdef HAVE_THROW_DECL
|
||||
throw()
|
||||
#endif
|
||||
{
|
||||
T (Trace t ("operator delete");)
|
||||
// We cannot call free here, as it doesn't match the mallocs.
|
||||
// free ((char *) ptr);
|
||||
(void) ptr;
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/* Correctly reads an arbitrarily size string.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#include "read-line.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* declares memcpy() */
|
||||
#include "options.h"
|
||||
#include "trace.h"
|
||||
|
||||
/* Recursively fills up the buffer. */
|
||||
|
||||
#define CHUNK_SIZE 4096
|
||||
|
||||
/* CHUNKS is the number of chunks (each of size CHUNK_SIZE) which have
|
||||
already been read and which are temporarily stored on the stack.
|
||||
This function reads the remainder of the line, allocates a buffer
|
||||
for the entire line, fills the part beyond &buffer[chunks*CHUNK_SIZE],
|
||||
and returns &buffer[chunks*CHUNK_SIZE]. */
|
||||
|
||||
char *
|
||||
Read_Line::readln_aux (int chunks)
|
||||
{
|
||||
T (Trace t ("Read_Line::readln_aux");)
|
||||
#if LARGE_STACK
|
||||
char buf[CHUNK_SIZE];
|
||||
#else
|
||||
// Note: we don't use new, because that invokes a custom operator new.
|
||||
char *buf = (char*)malloc(CHUNK_SIZE);
|
||||
if (buf == NULL)
|
||||
abort ();
|
||||
#endif
|
||||
char *bufptr = buf;
|
||||
char *ptr;
|
||||
int c;
|
||||
|
||||
while (c = getc (fp), c != EOF && c != '\n') /* fill the current buffer */
|
||||
{
|
||||
*bufptr++ = c;
|
||||
if (bufptr - buf == CHUNK_SIZE)
|
||||
{
|
||||
if ((ptr = readln_aux (chunks + 1)) != NULL)
|
||||
|
||||
/* prepend remainder to ptr buffer */
|
||||
{
|
||||
ptr -= CHUNK_SIZE;
|
||||
memcpy (ptr, buf, CHUNK_SIZE);
|
||||
}
|
||||
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (c == EOF && bufptr == buf && chunks == 0)
|
||||
ptr = NULL;
|
||||
else
|
||||
{
|
||||
size_t s1 = chunks * CHUNK_SIZE;
|
||||
size_t s2 = bufptr - buf;
|
||||
|
||||
ptr = new char[s1+s2+1];
|
||||
ptr += s1;
|
||||
ptr[s2] = '\0';
|
||||
memcpy (ptr, buf, s2);
|
||||
}
|
||||
done:
|
||||
#if !LARGE_STACK
|
||||
free (buf);
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
#define INLINE /* not inline */
|
||||
#include "read-line.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif /* not defined __OPTIMIZE__ */
|
||||
@@ -1,53 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Reads arbitrarily long string from input file, returning it as a
|
||||
dynamically allocated buffer.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
/* Returns a pointer to an arbitrary length string. Returns NULL on error or EOF
|
||||
The storage for the string is dynamically allocated by new. */
|
||||
|
||||
#ifndef read_line_h
|
||||
#define read_line_h 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
class Read_Line
|
||||
{
|
||||
private:
|
||||
char *readln_aux (int chunks);
|
||||
FILE *fp; /* FILE pointer to the input stream. */
|
||||
|
||||
public:
|
||||
Read_Line (FILE *stream = stdin) : fp (stream) {}
|
||||
char *get_line (void);
|
||||
};
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
|
||||
#include "trace.h"
|
||||
#define INLINE inline
|
||||
#include "read-line.icc"
|
||||
#undef INLINE
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
/* Inline Functions for read-line.{h,cc}.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
// This needs:
|
||||
//#include <stdio.h>
|
||||
//#include "trace.h"
|
||||
|
||||
/* Returns the ``next'' line, ignoring comments beginning with '#'. */
|
||||
INLINE char *
|
||||
Read_Line::get_line (void)
|
||||
{
|
||||
T (Trace t ("Read_Line::get_line");)
|
||||
int c;
|
||||
|
||||
while ((c = getc (fp)) == '#')
|
||||
{
|
||||
while (c = getc (fp), c != EOF && c != '\n')
|
||||
;
|
||||
|
||||
if (c == EOF)
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
if (c == EOF)
|
||||
return (char *)0;
|
||||
|
||||
ungetc (c, stdin);
|
||||
return readln_aux (0);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/* Tracing function calls.
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int Trace::nesting = 0;
|
||||
|
||||
Trace::Trace (const char *n)
|
||||
{
|
||||
fprintf (stderr, "%*scalling %s\n", 3 * nesting++, "", name = n);
|
||||
}
|
||||
|
||||
Trace::~Trace (void)
|
||||
{
|
||||
fprintf (stderr, "%*sleaving %s\n", 3 * --nesting, "", name);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/* Tracing function calls.
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#ifndef trace_h
|
||||
#define trace_h 1
|
||||
|
||||
#ifdef TRACE
|
||||
#define T(X) X
|
||||
#else
|
||||
#define T(X)
|
||||
#endif
|
||||
|
||||
class Trace
|
||||
{
|
||||
private:
|
||||
static int nesting;
|
||||
const char *name;
|
||||
public:
|
||||
Trace (const char *n);
|
||||
~Trace (void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,25 +0,0 @@
|
||||
/* Static class data members that are shared between several classes.
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#include "vectors.h"
|
||||
|
||||
int Vectors::ALPHA_SIZE = MAX_ALPHA_SIZE;
|
||||
int Vectors::occurrences[MAX_ALPHA_SIZE];
|
||||
int Vectors::asso_values[MAX_ALPHA_SIZE];
|
||||
@@ -1,37 +0,0 @@
|
||||
/* This may look like C code, but it is really -*- C++ -*- */
|
||||
|
||||
/* Static class data members that are shared between several classes via
|
||||
inheritance.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
#ifndef vectors_h
|
||||
#define vectors_h 1
|
||||
|
||||
static const int MAX_ALPHA_SIZE = 256;
|
||||
|
||||
struct Vectors
|
||||
{
|
||||
static int ALPHA_SIZE; /* Size of alphabet. */
|
||||
static int occurrences[MAX_ALPHA_SIZE]; /* Counts occurrences of each key set character. */
|
||||
static int asso_values[MAX_ALPHA_SIZE]; /* Value associated with each character. */
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,23 +0,0 @@
|
||||
/* Current program version number.
|
||||
|
||||
Copyright (C) 1989-1998 Free Software Foundation, Inc.
|
||||
written by Douglas C. Schmidt ([email protected])
|
||||
|
||||
This file is part of GNU GPERF.
|
||||
|
||||
GNU GPERF 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 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
|
||||
/* Current release version. */
|
||||
extern const char *version_string;
|
||||
@@ -1,232 +0,0 @@
|
||||
# Makefile for gperf/tests
|
||||
|
||||
# Copyright (C) 1989, 1992, 1993, 1995, 1998 Free Software Foundation, Inc.
|
||||
# written by Douglas C. Schmidt ([email protected])
|
||||
#
|
||||
# This file is part of GNU GPERF.
|
||||
#
|
||||
# GNU GPERF 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 1, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# GNU GPERF 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 GNU GPERF; see the file COPYING. If not, write to the Free
|
||||
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
# Directories used by "make":
|
||||
srcdir = @srcdir@
|
||||
|
||||
# Programs used by "make":
|
||||
# C compiler
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
# C++ compiler
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCPP = @CXXCPP@
|
||||
# Other
|
||||
MV = mv
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
@SET_MAKE@
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
VPATH = $(srcdir)
|
||||
|
||||
GPERF = ../src/gperf
|
||||
|
||||
all :
|
||||
|
||||
install : all
|
||||
|
||||
installdirs :
|
||||
|
||||
uninstall :
|
||||
|
||||
check : check-link-c check-link-c++ check-c check-ada check-modula3 check-pascal check-test
|
||||
@true
|
||||
|
||||
extracheck : @CHECK_LANG_SYNTAX@
|
||||
@true
|
||||
|
||||
check-link-c: force
|
||||
@echo "performing some tests of the perfect hash generator"
|
||||
$(CC) -c $(CFLAGS) $(srcdir)/test.c
|
||||
$(GPERF) -p -c -l -S1 -o $(srcdir)/c.gperf > cinset.c
|
||||
$(CC) $(CFLAGS) -o cout cinset.c test.o
|
||||
|
||||
check-link-c++: force
|
||||
|
||||
check-c:
|
||||
@echo "testing ANSI C reserved words, all items should be found in the set"
|
||||
./cout -v < $(srcdir)/c.gperf > c.out
|
||||
diff $(srcdir)/c.exp c.out
|
||||
|
||||
check-ada:
|
||||
$(GPERF) -k1,4,'$$' $(srcdir)/ada.gperf > adainset.c
|
||||
# double '$$' is only there since make gets confused; program wants only 1 '$'
|
||||
$(CC) $(CFLAGS) -o aout adainset.c test.o
|
||||
@echo "testing Ada reserved words, all items should be found in the set"
|
||||
./aout -v < $(srcdir)/ada.gperf > ada-res.out
|
||||
diff $(srcdir)/ada-res.exp ada-res.out
|
||||
$(GPERF) -p -D -k1,'$$' -s 2 -o $(srcdir)/adadefs.gperf > preinset.c
|
||||
$(CC) $(CFLAGS) -o preout preinset.c test.o
|
||||
@echo "testing Ada predefined words, all items should be found in the set"
|
||||
./preout -v < $(srcdir)/adadefs.gperf > ada-pred.out
|
||||
diff $(srcdir)/ada-pred.exp ada-pred.out
|
||||
|
||||
check-modula3:
|
||||
$(GPERF) -k1,2,'$$' -o $(srcdir)/modula3.gperf > m3inset.c
|
||||
$(CC) $(CFLAGS) -o m3out m3inset.c test.o
|
||||
@echo "testing Modula3 reserved words, all items should be found in the set"
|
||||
./m3out -v < $(srcdir)/modula3.gperf > modula.out
|
||||
diff $(srcdir)/modula.exp modula.out
|
||||
|
||||
check-pascal:
|
||||
$(GPERF) -o -S2 -p < $(srcdir)/pascal.gperf > pinset.c
|
||||
$(CC) $(CFLAGS) -o pout pinset.c test.o
|
||||
@echo "testing Pascal reserved words, all items should be found in the set"
|
||||
./pout -v < $(srcdir)/pascal.gperf > pascal.out
|
||||
diff $(srcdir)/pascal.exp pascal.out
|
||||
|
||||
# these next 5 are demos that show off the generated code
|
||||
check-test:
|
||||
$(GPERF) -p -j1 -g -o -t -N is_reserved_word -k1,3,'$$' < $(srcdir)/c-parse.gperf > test-1.out
|
||||
diff $(srcdir)/test-1.exp test-1.out
|
||||
$(GPERF) -n -k1-8 -l < $(srcdir)/modula2.gperf > test-2.out
|
||||
diff $(srcdir)/test-2.exp test-2.out
|
||||
$(GPERF) -p -j 1 -o -a -C -g -t -k1,4,$$ < $(srcdir)/gplus.gperf > test-3.out
|
||||
diff $(srcdir)/test-3.exp test-3.out
|
||||
$(GPERF) -D -p -t < $(srcdir)/c-parse.gperf > test-4.out
|
||||
diff $(srcdir)/test-4.exp test-4.out
|
||||
$(GPERF) -g -o -j1 -t -p -N is_reserved_word < $(srcdir)/gpc.gperf > test-5.out
|
||||
diff $(srcdir)/test-5.exp test-5.out
|
||||
# prints out the help message
|
||||
-$(GPERF) -h > test-6.out 2>&1
|
||||
diff $(srcdir)/test-6.exp test-6.out
|
||||
@echo "only if, do, for, case, goto, else, while, and return should be found "
|
||||
./aout -v < $(srcdir)/c.gperf > test-7.out
|
||||
diff $(srcdir)/test-7.exp test-7.out
|
||||
|
||||
# The following validates valid language syntax with different parameters.
|
||||
# Works only with gcc and g++, and only on platforms where "gcc -ansi" is
|
||||
# usable. (There are still platforms where gcc-2.8.0's fixincludes does not
|
||||
# work well enough.)
|
||||
|
||||
VALIDATE = CC='$(CC)' CFLAGS='$(CFLAGS)' CXX='$(CXX)' CXXFLAGS='$(CXXFLAGS)' GPERF='$(GPERF)' ./validate
|
||||
|
||||
check-lang-syntax : force
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -c
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -E
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -G
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -G -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -G -E
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -D
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -D -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -c
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -E
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -G
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -D
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -D -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 1000
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -D
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -D -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -D
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -D -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 1000
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -K key_name
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -H hash_function_name
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -W word_list_name
|
||||
sed -e 's,in_word_set,lookup_function_name,g' < jstest1.gperf > tmp-jstest1.gperf && \
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest1.gperf -N lookup_function_name
|
||||
sed -e 's,Perfect_Hash,class_name,g' < jstest1.gperf > tmp-jstest1.gperf && \
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest1.gperf -Z class_name
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -c
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -E
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -G
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -G -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -G -E
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -D
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -D -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -c
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -C
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -E
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -G
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -D
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -D -l
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 1000
|
||||
sed -e 's,name,key_name,g' < jstest2.gperf > tmp-jstest2.gperf && \
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest2.gperf -t -p -K key_name
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -H hash_function_name
|
||||
sed -e 's,in_word_set,lookup_function_name,g' < jstest2.gperf > tmp-jstest2.gperf && \
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest2.gperf -t -p -N lookup_function_name
|
||||
sed -e 's,Perfect_Hash,class_name,g' < jstest2.gperf > tmp-jstest2.gperf && \
|
||||
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest2.gperf -t -p -Z class_name
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -c
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -C
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -E
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -G
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -G -C
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -G -E
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -l
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -D
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -D -l
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -c
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -C
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -E
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -G
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -l
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -D
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -D -l
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 1000
|
||||
sed -e 's,name,key_name,g' < jstest3.gperf > tmp-jstest3.gperf && \
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 tmp-jstest3.gperf -t -p -K key_name
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -H hash_function_name
|
||||
sed -e 's,in_word_set,lookup_function_name,g' < jstest3.gperf > tmp-jstest3.gperf && \
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 tmp-jstest3.gperf -t -p -N lookup_function_name
|
||||
sed -e 's,Perfect_Hash,class_name,g' < jstest3.gperf > tmp-jstest3.gperf && \
|
||||
$(VALIDATE) C,ANSI-C,C++ -k1,2 tmp-jstest3.gperf -t -p -Z class_name
|
||||
|
||||
mostlyclean : clean
|
||||
|
||||
clean : force
|
||||
$(RM) *.o core *inset.c output.* *.out aout cout m3out pout preout tmp-* valitest*
|
||||
|
||||
distclean : clean
|
||||
$(RM) config.status config.log config.cache Makefile
|
||||
|
||||
maintainer-clean : distclean
|
||||
|
||||
force :
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
in word set boolean
|
||||
in word set character
|
||||
in word set constraint_error
|
||||
in word set false
|
||||
in word set float
|
||||
in word set integer
|
||||
in word set natural
|
||||
in word set numeric_error
|
||||
in word set positive
|
||||
in word set program_error
|
||||
in word set storage_error
|
||||
in word set string
|
||||
in word set tasking_error
|
||||
in word set true
|
||||
in word set address
|
||||
in word set aft
|
||||
in word set base
|
||||
in word set callable
|
||||
in word set constrained
|
||||
in word set count
|
||||
in word set delta
|
||||
in word set digits
|
||||
in word set emax
|
||||
in word set epsilon
|
||||
in word set first
|
||||
in word set firstbit
|
||||
in word set fore
|
||||
in word set image
|
||||
in word set large
|
||||
in word set last
|
||||
in word set lastbit
|
||||
in word set length
|
||||
in word set machine_emax
|
||||
in word set machine_emin
|
||||
in word set machine_mantissa
|
||||
in word set machine_overflows
|
||||
in word set machine_radix
|
||||
in word set machine_rounds
|
||||
in word set mantissa
|
||||
in word set pos
|
||||
in word set position
|
||||
in word set pred
|
||||
in word set range
|
||||
in word set safe_emax
|
||||
in word set safe_large
|
||||
in word set safe_small
|
||||
in word set size
|
||||
in word set small
|
||||
in word set storage_size
|
||||
in word set succ
|
||||
in word set terminated
|
||||
in word set val
|
||||
in word set value
|
||||
in word set width
|
||||
@@ -1,63 +0,0 @@
|
||||
in word set else
|
||||
in word set exit
|
||||
in word set terminate
|
||||
in word set type
|
||||
in word set raise
|
||||
in word set range
|
||||
in word set reverse
|
||||
in word set declare
|
||||
in word set end
|
||||
in word set record
|
||||
in word set exception
|
||||
in word set not
|
||||
in word set then
|
||||
in word set return
|
||||
in word set separate
|
||||
in word set select
|
||||
in word set digits
|
||||
in word set renames
|
||||
in word set subtype
|
||||
in word set elsif
|
||||
in word set function
|
||||
in word set for
|
||||
in word set package
|
||||
in word set procedure
|
||||
in word set private
|
||||
in word set while
|
||||
in word set when
|
||||
in word set new
|
||||
in word set entry
|
||||
in word set delay
|
||||
in word set case
|
||||
in word set constant
|
||||
in word set at
|
||||
in word set abort
|
||||
in word set accept
|
||||
in word set and
|
||||
in word set delta
|
||||
in word set access
|
||||
in word set abs
|
||||
in word set pragma
|
||||
in word set array
|
||||
in word set use
|
||||
in word set out
|
||||
in word set do
|
||||
in word set others
|
||||
in word set of
|
||||
in word set or
|
||||
in word set all
|
||||
in word set limited
|
||||
in word set loop
|
||||
in word set null
|
||||
in word set task
|
||||
in word set in
|
||||
in word set is
|
||||
in word set if
|
||||
in word set rem
|
||||
in word set mod
|
||||
in word set begin
|
||||
in word set body
|
||||
in word set xor
|
||||
in word set goto
|
||||
in word set generic
|
||||
in word set with
|
||||
@@ -1,54 +0,0 @@
|
||||
boolean
|
||||
character
|
||||
constraint_error
|
||||
false
|
||||
float
|
||||
integer
|
||||
natural
|
||||
numeric_error
|
||||
positive
|
||||
program_error
|
||||
storage_error
|
||||
string
|
||||
tasking_error
|
||||
true
|
||||
address
|
||||
aft
|
||||
base
|
||||
callable
|
||||
constrained
|
||||
count
|
||||
delta
|
||||
digits
|
||||
emax
|
||||
epsilon
|
||||
first
|
||||
firstbit
|
||||
fore
|
||||
image
|
||||
large
|
||||
last
|
||||
lastbit
|
||||
length
|
||||
machine_emax
|
||||
machine_emin
|
||||
machine_mantissa
|
||||
machine_overflows
|
||||
machine_radix
|
||||
machine_rounds
|
||||
mantissa
|
||||
pos
|
||||
position
|
||||
pred
|
||||
range
|
||||
safe_emax
|
||||
safe_large
|
||||
safe_small
|
||||
size
|
||||
small
|
||||
storage_size
|
||||
succ
|
||||
terminated
|
||||
val
|
||||
value
|
||||
width
|
||||
@@ -1,32 +0,0 @@
|
||||
in word set if
|
||||
in word set do
|
||||
in word set int
|
||||
in word set for
|
||||
in word set case
|
||||
in word set char
|
||||
in word set auto
|
||||
in word set goto
|
||||
in word set else
|
||||
in word set long
|
||||
in word set void
|
||||
in word set enum
|
||||
in word set float
|
||||
in word set short
|
||||
in word set union
|
||||
in word set break
|
||||
in word set while
|
||||
in word set const
|
||||
in word set double
|
||||
in word set static
|
||||
in word set extern
|
||||
in word set struct
|
||||
in word set return
|
||||
in word set sizeof
|
||||
in word set switch
|
||||
in word set signed
|
||||
in word set typedef
|
||||
in word set default
|
||||
in word set unsigned
|
||||
in word set continue
|
||||
in word set register
|
||||
in word set volatile
|
||||
Vendored
-1214
File diff suppressed because it is too large.
Load diff
@@ -1,45 +0,0 @@
|
||||
dnl autoconf configuration for gperf/tests
|
||||
|
||||
dnl Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
dnl written by Douglas C. Schmidt ([email protected])
|
||||
dnl
|
||||
dnl This file is part of GNU GPERF.
|
||||
dnl
|
||||
dnl GNU GPERF is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 1, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU GPERF is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU GPERF; see the file COPYING. If not, write to the
|
||||
dnl Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
dnl MA 02111-1307, USA.
|
||||
|
||||
AC_INIT(c-parse.gperf)
|
||||
AC_PROG_MAKE_SET
|
||||
dnl
|
||||
dnl checks for programs
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
dnl sets variable CC
|
||||
AC_PROG_CPP
|
||||
dnl sets variable CPP
|
||||
AC_PROG_CXX
|
||||
dnl sets variable CXX
|
||||
AC_PROG_CXXCPP
|
||||
dnl sets variable CXXCPP
|
||||
if test $ac_cv_prog_gcc = yes -a $ac_cv_prog_gxx = yes; then
|
||||
CHECK_LANG_SYNTAX='check-lang-syntax'
|
||||
else
|
||||
CHECK_LANG_SYNTAX=''
|
||||
fi
|
||||
AC_SUBST(CHECK_LANG_SYNTAX)
|
||||
dnl
|
||||
dnl That's it.
|
||||
dnl
|
||||
AC_OUTPUT(Makefile)
|
||||
@@ -1,63 +0,0 @@
|
||||
%{
|
||||
extern int m_text(), m_private(), m_who(), m_whois(), m_user(), m_list();
|
||||
extern int m_topic(), m_invite(), m_channel(), m_version(), m_quit();
|
||||
extern int m_server(), m_kill(), m_info(), m_links(), m_summon(), m_stats();
|
||||
extern int m_users(), m_nick(), m_error(), m_help(), m_whoreply();
|
||||
extern int m_squit(), m_restart(), m_away(), m_die(), m_connect();
|
||||
extern int m_ping(), m_pong(), m_oper(), m_pass(), m_wall(), m_trace();
|
||||
extern int m_time(), m_rehash(), m_names(), m_namreply(), m_admin();
|
||||
extern int m_linreply(), m_notice(), m_lusers(), m_voice(), m_grph();
|
||||
extern int m_xtra(), m_motd();
|
||||
%}
|
||||
struct Message {
|
||||
char *cmd;
|
||||
int (* func)();
|
||||
int count;
|
||||
int parameters;
|
||||
};
|
||||
%%
|
||||
NICK, m_nick, 0, 1
|
||||
MSG, m_text, 0, 1
|
||||
PRIVMSG, m_private, 0, 2
|
||||
WHO, m_who, 0, 1
|
||||
WHOIS, m_whois, 0, 4
|
||||
USER, m_user, 0, 4
|
||||
SERVER, m_server, 0, 2
|
||||
LIST, m_list, 0, 1
|
||||
TOPIC, m_topic, 0, 1
|
||||
INVITE, m_invite, 0, 2
|
||||
CHANNEL, m_channel, 0, 1
|
||||
VERSION, m_version, 0, 1
|
||||
QUIT, m_quit, 0, 2
|
||||
SQUIT, m_squit, 0, 2
|
||||
KILL, m_kill, 0, 2
|
||||
INFO, m_info, 0, 1
|
||||
LINKS, m_links, 0, 1
|
||||
SUMMON, m_summon, 0, 1
|
||||
STATS, m_stats, 0, 1
|
||||
USERS, m_users, 0, 1
|
||||
RESTART, m_restart, 0, 1
|
||||
WHOREPLY,m_whoreply, 0, 7
|
||||
HELP, m_help, 0, 2
|
||||
ERROR, m_error, 0, 1
|
||||
AWAY, m_away, 0, 1
|
||||
DIE, m_die, 0, 1
|
||||
CONNECT, m_connect, 0, 3
|
||||
PING, m_ping, 0, 2
|
||||
PONG, m_pong, 0, 3
|
||||
OPER, m_oper, 0, 3
|
||||
PASS, m_pass, 0, 2
|
||||
WALL, m_wall, 0, 1
|
||||
TIME, m_time, 0, 1
|
||||
REHASH, m_rehash, 0, 1
|
||||
NAMES, m_names, 0, 1
|
||||
NAMREPLY,m_namreply, 0, 3
|
||||
ADMIN, m_admin, 0, 1
|
||||
TRACE, m_trace, 0, 1
|
||||
LINREPLY,m_linreply, 0, 2
|
||||
NOTICE, m_notice, 0, 2
|
||||
LUSERS, m_lusers, 0, 1
|
||||
VOICE, m_voice, 0, 2
|
||||
GRPH, m_grph, 0, 2
|
||||
XTRA, m_xtra, 0, 2
|
||||
MOTD, m_motd, 0, 2
|
||||
@@ -1,73 +0,0 @@
|
||||
%{
|
||||
/* Command-line: gperf -k'1,2,$' -t -p -K 'name' -H 'js_kw_hash' -N 'js_kw_lookup' -a -g jscript.gperf */
|
||||
%}
|
||||
struct js_keyword {
|
||||
char * name;
|
||||
int token;
|
||||
}
|
||||
|
||||
%%
|
||||
# Javascript reserved words, see "keywords.html"
|
||||
abstract, TK_ABSTRACT
|
||||
boolean, TK_BOOLEAN
|
||||
break, TK_BREAK
|
||||
byte, TK_BYTE
|
||||
case, TK_CASE
|
||||
catch, TK_CATCH
|
||||
char, TK_CHAR
|
||||
class, TK_CLASS
|
||||
const, TK_CONST
|
||||
continue, TK_CONTINUE
|
||||
default, TK_DEFAULT
|
||||
do, TK_DO
|
||||
double, TK_DOUBLE
|
||||
else, TK_ELSE
|
||||
extends, TK_EXTENDS
|
||||
false, TK_FALSE
|
||||
final, TK_FINAL
|
||||
finally, TK_FINALLY
|
||||
float, TK_FLOAT
|
||||
for, TK_FOR
|
||||
function, TK_FUNCTION
|
||||
goto, TK_GOTO
|
||||
if, TK_IF
|
||||
implements, TK_IMPLEMENTS
|
||||
import, TK_IMPORT
|
||||
in, TK_IN
|
||||
instanceof, TK_INSTANCEOF
|
||||
int, TK_INT
|
||||
interface, TK_INTERFACE
|
||||
long, TK_LONG
|
||||
native, TK_NATIVE
|
||||
new, TK_NEW
|
||||
null, TK_NULL
|
||||
package, TK_PACKAGE
|
||||
private, TK_PRIVATE
|
||||
protected, TK_PROTECTED
|
||||
public, TK_PUBLIC
|
||||
return, TK_RETURN
|
||||
short, TK_SHORT
|
||||
static, TK_STATIC
|
||||
super, TK_SUPER
|
||||
switch, TK_SWITCH
|
||||
synchronized, TK_SYNCHRONIZED
|
||||
this, TK_THIS
|
||||
throw, TK_THROW
|
||||
throws, TK_THROWS
|
||||
transient, TK_TRANSIENT
|
||||
true, TK_TRUE
|
||||
try, TK_TRY
|
||||
var, TK_VAR
|
||||
void, TK_VOID
|
||||
while, TK_WHILE
|
||||
with, TK_WITH
|
||||
%%
|
||||
|
||||
int js_keyword_lookup (register const char *str, register int len)
|
||||
{
|
||||
struct js_keyword * keyword = js_kw_lookup(str,len);
|
||||
if (keyword)
|
||||
return keyword->token;
|
||||
else
|
||||
return TK_IDENT;
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
abstract
|
||||
boolean
|
||||
break
|
||||
byte
|
||||
case
|
||||
catch
|
||||
char
|
||||
class
|
||||
const
|
||||
continue
|
||||
default
|
||||
do
|
||||
double
|
||||
else
|
||||
extends
|
||||
false
|
||||
final
|
||||
finally
|
||||
float
|
||||
for
|
||||
function
|
||||
goto
|
||||
if
|
||||
implements
|
||||
import
|
||||
in
|
||||
instanceof
|
||||
int
|
||||
interface
|
||||
long
|
||||
native
|
||||
new
|
||||
null
|
||||
package
|
||||
private
|
||||
protected
|
||||
public
|
||||
return
|
||||
short
|
||||
static
|
||||
super
|
||||
switch
|
||||
synchronized
|
||||
this
|
||||
throw
|
||||
throws
|
||||
transient
|
||||
true
|
||||
try
|
||||
var
|
||||
void
|
||||
while
|
||||
with
|
||||
%%
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define CONST const
|
||||
#else
|
||||
#define CONST
|
||||
#endif
|
||||
static CONST char* testdata[] = {
|
||||
"bogus",
|
||||
"abstract",
|
||||
"boolean",
|
||||
"break",
|
||||
"byte",
|
||||
"case",
|
||||
"catch",
|
||||
"char",
|
||||
"class",
|
||||
"const",
|
||||
"continue",
|
||||
"default",
|
||||
"do",
|
||||
"double",
|
||||
"else",
|
||||
"extends",
|
||||
"false",
|
||||
"final",
|
||||
"finally",
|
||||
"float",
|
||||
"for",
|
||||
"function",
|
||||
"goto",
|
||||
"if",
|
||||
"implements",
|
||||
"import",
|
||||
"in",
|
||||
"instanceof",
|
||||
"int",
|
||||
"interface",
|
||||
"long",
|
||||
"native",
|
||||
"new",
|
||||
"null",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"return",
|
||||
"short",
|
||||
"static",
|
||||
"super",
|
||||
"switch",
|
||||
"synchronized",
|
||||
"this",
|
||||
"throw",
|
||||
"throws",
|
||||
"transient",
|
||||
"true",
|
||||
"try",
|
||||
"var",
|
||||
"void",
|
||||
"while",
|
||||
"with"
|
||||
};
|
||||
int main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++)
|
||||
{
|
||||
#ifdef CPLUSPLUS_TEST
|
||||
CONST char * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i]));
|
||||
#else
|
||||
CONST char * resword = in_word_set(testdata[i],strlen(testdata[i]));
|
||||
#endif
|
||||
if (i > 0)
|
||||
{
|
||||
if (!resword)
|
||||
exit (1);
|
||||
if (strcmp(testdata[i],resword))
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resword)
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
struct js_keyword {
|
||||
char * name;
|
||||
int token;
|
||||
}
|
||||
%%
|
||||
abstract, 1
|
||||
boolean, 2
|
||||
break, 3
|
||||
byte, 4
|
||||
case, 5
|
||||
catch, 6
|
||||
char, 7
|
||||
class, 8
|
||||
const, 9
|
||||
continue, 10
|
||||
default, 11
|
||||
do, 12
|
||||
double, 13
|
||||
else, 14
|
||||
extends, 15
|
||||
false, 16
|
||||
final, 17
|
||||
finally, 18
|
||||
float, 19
|
||||
for, 20
|
||||
function, 21
|
||||
goto, 22
|
||||
if, 23
|
||||
implements, 24
|
||||
import, 25
|
||||
in, 26
|
||||
instanceof, 27
|
||||
int, 28
|
||||
interface, 29
|
||||
long, 30
|
||||
native, 31
|
||||
new, 32
|
||||
null, 33
|
||||
package, 34
|
||||
private, 35
|
||||
protected, 36
|
||||
public, 37
|
||||
return, 38
|
||||
short, 39
|
||||
static, 40
|
||||
super, 41
|
||||
switch, 42
|
||||
synchronized, 43
|
||||
this, 44
|
||||
throw, 45
|
||||
throws, 46
|
||||
transient, 47
|
||||
true, 48
|
||||
try, 49
|
||||
var, 50
|
||||
void, 51
|
||||
while, 52
|
||||
with, 53
|
||||
%%
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define CONST const
|
||||
#else
|
||||
#define CONST
|
||||
#endif
|
||||
static CONST char* testdata[] = {
|
||||
"bogus",
|
||||
"abstract",
|
||||
"boolean",
|
||||
"break",
|
||||
"byte",
|
||||
"case",
|
||||
"catch",
|
||||
"char",
|
||||
"class",
|
||||
"const",
|
||||
"continue",
|
||||
"default",
|
||||
"do",
|
||||
"double",
|
||||
"else",
|
||||
"extends",
|
||||
"false",
|
||||
"final",
|
||||
"finally",
|
||||
"float",
|
||||
"for",
|
||||
"function",
|
||||
"goto",
|
||||
"if",
|
||||
"implements",
|
||||
"import",
|
||||
"in",
|
||||
"instanceof",
|
||||
"int",
|
||||
"interface",
|
||||
"long",
|
||||
"native",
|
||||
"new",
|
||||
"null",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"return",
|
||||
"short",
|
||||
"static",
|
||||
"super",
|
||||
"switch",
|
||||
"synchronized",
|
||||
"this",
|
||||
"throw",
|
||||
"throws",
|
||||
"transient",
|
||||
"true",
|
||||
"try",
|
||||
"var",
|
||||
"void",
|
||||
"while",
|
||||
"with"
|
||||
};
|
||||
int main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++)
|
||||
{
|
||||
#ifdef CPLUSPLUS_TEST
|
||||
CONST struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i]));
|
||||
#else
|
||||
CONST struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i]));
|
||||
#endif
|
||||
if (i > 0)
|
||||
{
|
||||
if (!resword)
|
||||
exit (1);
|
||||
if (strcmp(testdata[i],resword->name))
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resword)
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
struct js_keyword {
|
||||
const char * name;
|
||||
int token;
|
||||
}
|
||||
%%
|
||||
abstract, 1
|
||||
boolean, 2
|
||||
break, 3
|
||||
byte, 4
|
||||
case, 5
|
||||
catch, 6
|
||||
char, 7
|
||||
class, 8
|
||||
const, 9
|
||||
continue, 10
|
||||
default, 11
|
||||
do, 12
|
||||
double, 13
|
||||
else, 14
|
||||
extends, 15
|
||||
false, 16
|
||||
final, 17
|
||||
finally, 18
|
||||
float, 19
|
||||
for, 20
|
||||
function, 21
|
||||
goto, 22
|
||||
if, 23
|
||||
implements, 24
|
||||
import, 25
|
||||
in, 26
|
||||
instanceof, 27
|
||||
int, 28
|
||||
interface, 29
|
||||
long, 30
|
||||
native, 31
|
||||
new, 32
|
||||
null, 33
|
||||
package, 34
|
||||
private, 35
|
||||
protected, 36
|
||||
public, 37
|
||||
return, 38
|
||||
short, 39
|
||||
static, 40
|
||||
super, 41
|
||||
switch, 42
|
||||
synchronized, 43
|
||||
this, 44
|
||||
throw, 45
|
||||
throws, 46
|
||||
transient, 47
|
||||
true, 48
|
||||
try, 49
|
||||
var, 50
|
||||
void, 51
|
||||
while, 52
|
||||
with, 53
|
||||
%%
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define CONST const
|
||||
#else
|
||||
#define CONST
|
||||
#endif
|
||||
static CONST char* testdata[] = {
|
||||
"bogus",
|
||||
"abstract",
|
||||
"boolean",
|
||||
"break",
|
||||
"byte",
|
||||
"case",
|
||||
"catch",
|
||||
"char",
|
||||
"class",
|
||||
"const",
|
||||
"continue",
|
||||
"default",
|
||||
"do",
|
||||
"double",
|
||||
"else",
|
||||
"extends",
|
||||
"false",
|
||||
"final",
|
||||
"finally",
|
||||
"float",
|
||||
"for",
|
||||
"function",
|
||||
"goto",
|
||||
"if",
|
||||
"implements",
|
||||
"import",
|
||||
"in",
|
||||
"instanceof",
|
||||
"int",
|
||||
"interface",
|
||||
"long",
|
||||
"native",
|
||||
"new",
|
||||
"null",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"return",
|
||||
"short",
|
||||
"static",
|
||||
"super",
|
||||
"switch",
|
||||
"synchronized",
|
||||
"this",
|
||||
"throw",
|
||||
"throws",
|
||||
"transient",
|
||||
"true",
|
||||
"try",
|
||||
"var",
|
||||
"void",
|
||||
"while",
|
||||
"with"
|
||||
};
|
||||
int main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++)
|
||||
{
|
||||
#ifdef CPLUSPLUS_TEST
|
||||
CONST struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i]));
|
||||
#else
|
||||
CONST struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i]));
|
||||
#endif
|
||||
if (i > 0)
|
||||
{
|
||||
if (!resword)
|
||||
exit (1);
|
||||
if (strcmp(testdata[i],resword->name))
|
||||
exit (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (resword)
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
COMMAND;
|
||||
%%
|
||||
!, cm_force_sentence_end, false
|
||||
', insert_self, false
|
||||
*, cm_asterisk, false
|
||||
., cm_force_sentence_end, false
|
||||
:, cm_force_abbreviated_whitespace, false
|
||||
?, cm_force_sentence_end, false
|
||||
@, insert_self, false
|
||||
TeX, cm_TeX, true
|
||||
`, insert_self, false
|
||||
appendix, cm_appendix, false
|
||||
appendixsec, cm_appendixsec, false
|
||||
appendixsubsec, cm_appendixsubsec, false
|
||||
asis, cm_asis, true
|
||||
b, cm_bold, true
|
||||
br, cm_br, false
|
||||
bullet, cm_bullet, true
|
||||
bye, cm_bye, false
|
||||
c, cm_comment, false
|
||||
center, cm_center, false
|
||||
chapter, cm_chapter, false
|
||||
cindex, cm_cindex, false
|
||||
cite, cm_cite, true
|
||||
code, cm_code, true
|
||||
comment, cm_comment, false
|
||||
contents, do_nothing, false
|
||||
copyright, cm_copyright, true
|
||||
ctrl, cm_ctrl, true
|
||||
defcodeindex, cm_defindex, false
|
||||
defindex, cm_defindex, false
|
||||
dfn, cm_dfn, true
|
||||
display, cm_display, false
|
||||
dots, cm_dots, true
|
||||
emph, cm_emph, true
|
||||
end, cm_end, false
|
||||
enumerate, cm_enumerate, false
|
||||
equiv, cm_equiv, true
|
||||
error, cm_error, true
|
||||
example, cm_example, false
|
||||
exdent, cm_exdent, false
|
||||
expansion, cm_expansion, true
|
||||
file, cm_file, true
|
||||
findex, cm_findex, false
|
||||
format, cm_format, false
|
||||
group, cm_group, false
|
||||
i, cm_italic, true
|
||||
iappendix, cm_appendix, false
|
||||
iappendixsec, cm_appendixsec, false
|
||||
iappendixsubsec, cm_appendixsubsec, false
|
||||
ichapter, cm_chapter, false
|
||||
ifinfo, cm_ifinfo, false
|
||||
iftex, cm_iftex, false
|
||||
ignore, cm_ignore, false
|
||||
include, cm_include, false
|
||||
inforef, cm_inforef, true
|
||||
input, cm_include, false
|
||||
isection, cm_section, false
|
||||
isubsection, cm_subsection, false
|
||||
isubsubsection, cm_subsubsection, false
|
||||
item, cm_item, false
|
||||
itemize, cm_itemize, false
|
||||
itemx, cm_itemx, false
|
||||
iunnumbered, cm_unnumbered, false
|
||||
iunnumberedsec, cm_unnumberedsec, false
|
||||
iunnumberedsubsec, cm_unnumberedsubsec, false
|
||||
kbd, cm_kbd, true
|
||||
key, cm_key, true
|
||||
kindex, cm_kindex, false
|
||||
lisp, cm_lisp, false
|
||||
menu, cm_menu
|
||||
minus, cm_minus, true
|
||||
need, cm_need, false
|
||||
node, cm_node, false
|
||||
noindent, cm_noindent, false
|
||||
page, do_nothing, false
|
||||
pindex, cm_pindex, false
|
||||
point, cm_point, true
|
||||
print, cm_print, true
|
||||
printindex, cm_printindex, false
|
||||
pxref, cm_pxref, true
|
||||
quotation, cm_quotation, false
|
||||
r, cm_roman, true
|
||||
ref, cm_xref, true
|
||||
refill, cm_refill, false
|
||||
result, cm_result, true
|
||||
samp, cm_samp, true
|
||||
sc, cm_sc, true
|
||||
section, cm_section, false
|
||||
setchapternewpage, cm_setchapternewpage, false
|
||||
setfilename, cm_setfilename, false
|
||||
settitle, cm_settitle, false
|
||||
smallexample, cm_smallexample, false
|
||||
sp, cm_sp, false
|
||||
strong, cm_strong, true
|
||||
subsection, cm_subsection, false
|
||||
subsubsection, cm_subsubsection, false
|
||||
summarycontents, do_nothing, false
|
||||
syncodeindex, cm_synindex, false
|
||||
synindex, cm_synindex, false
|
||||
t, cm_title, true
|
||||
table, cm_table, false
|
||||
tex, cm_tex, false
|
||||
tindex, cm_tindex, false
|
||||
titlepage, cm_titlepage, false
|
||||
unnumbered, cm_unnumbered, false
|
||||
unnumberedsec, cm_unnumberedsec, false
|
||||
unnumberedsubsec, cm_unnumberedsubsec, false
|
||||
var, cm_var, true
|
||||
vindex, cm_vindex, false
|
||||
w, cm_w, true
|
||||
xref, cm_xref, true
|
||||
{, insert_self, false
|
||||
}, insert_self, false
|
||||
infoinclude, cm_infoinclude, false
|
||||
footnote, cm_footnote, false
|
||||
@@ -1,106 +0,0 @@
|
||||
in word set AND
|
||||
in word set ARRAY
|
||||
in word set BEGIN
|
||||
in word set BITS
|
||||
in word set BY
|
||||
in word set CASE
|
||||
in word set CONST
|
||||
in word set DIV
|
||||
in word set DO
|
||||
in word set ELSE
|
||||
in word set ELSIF
|
||||
in word set END
|
||||
in word set EVAL
|
||||
in word set EXCEPT
|
||||
in word set EXCEPTION
|
||||
in word set EXIT
|
||||
in word set EXPORTS
|
||||
in word set FINALLY
|
||||
in word set FOR
|
||||
in word set FROM
|
||||
in word set IF
|
||||
in word set IMPORT
|
||||
in word set INTERFACE
|
||||
in word set IN
|
||||
in word set INLINE
|
||||
in word set LOCK
|
||||
in word set METHODS
|
||||
in word set MOD
|
||||
in word set MODULE
|
||||
in word set NOT
|
||||
in word set OBJECT
|
||||
in word set OF
|
||||
in word set OR
|
||||
in word set PROCEDURE
|
||||
in word set RAISES
|
||||
in word set READONLY
|
||||
in word set RECORD
|
||||
in word set REF
|
||||
in word set REPEAT
|
||||
in word set RETURN
|
||||
in word set SET
|
||||
in word set THEN
|
||||
in word set TO
|
||||
in word set TRY
|
||||
in word set TYPE
|
||||
in word set TYPECASE
|
||||
in word set UNSAFE
|
||||
in word set UNTIL
|
||||
in word set UNTRACED
|
||||
in word set VALUE
|
||||
in word set VAR
|
||||
in word set WHILE
|
||||
in word set WITH
|
||||
in word set and
|
||||
in word set array
|
||||
in word set begin
|
||||
in word set bits
|
||||
in word set by
|
||||
in word set case
|
||||
in word set const
|
||||
in word set div
|
||||
in word set do
|
||||
in word set else
|
||||
in word set elsif
|
||||
in word set end
|
||||
in word set eval
|
||||
in word set except
|
||||
in word set exception
|
||||
in word set exit
|
||||
in word set exports
|
||||
in word set finally
|
||||
in word set for
|
||||
in word set from
|
||||
in word set if
|
||||
in word set import
|
||||
in word set interface
|
||||
in word set in
|
||||
in word set inline
|
||||
in word set lock
|
||||
in word set methods
|
||||
in word set mod
|
||||
in word set module
|
||||
in word set not
|
||||
in word set object
|
||||
in word set of
|
||||
in word set or
|
||||
in word set procedure
|
||||
in word set raises
|
||||
in word set readonly
|
||||
in word set record
|
||||
in word set ref
|
||||
in word set repeat
|
||||
in word set return
|
||||
in word set set
|
||||
in word set then
|
||||
in word set to
|
||||
in word set try
|
||||
in word set type
|
||||
in word set typecase
|
||||
in word set unsafe
|
||||
in word set until
|
||||
in word set untraced
|
||||
in word set value
|
||||
in word set var
|
||||
in word set while
|
||||
in word set with
|
||||
@@ -1,36 +0,0 @@
|
||||
in word set with
|
||||
in word set array
|
||||
in word set and
|
||||
in word set function
|
||||
in word set case
|
||||
in word set var
|
||||
in word set const
|
||||
in word set until
|
||||
in word set then
|
||||
in word set set
|
||||
in word set record
|
||||
in word set program
|
||||
in word set procedure
|
||||
in word set or
|
||||
in word set packed
|
||||
in word set not
|
||||
in word set nil
|
||||
in word set label
|
||||
in word set in
|
||||
in word set repeat
|
||||
in word set of
|
||||
in word set goto
|
||||
in word set forward
|
||||
in word set for
|
||||
in word set while
|
||||
in word set file
|
||||
in word set else
|
||||
in word set downto
|
||||
in word set do
|
||||
in word set div
|
||||
in word set to
|
||||
in word set type
|
||||
in word set end
|
||||
in word set mod
|
||||
in word set begin
|
||||
in word set if
|
||||
@@ -1,153 +0,0 @@
|
||||
/* C code produced by gperf version 2.7 */
|
||||
/* Command-line: ../src/gperf -p -j1 -g -o -t -N is_reserved_word -k1,3,$ */
|
||||
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
|
||||
struct resword { char *name; short token; enum rid rid; };
|
||||
|
||||
#define TOTAL_KEYWORDS 51
|
||||
#define MIN_WORD_LENGTH 2
|
||||
#define MAX_WORD_LENGTH 13
|
||||
#define MIN_HASH_VALUE 8
|
||||
#define MAX_HASH_VALUE 82
|
||||
/* maximum key range = 75, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static unsigned char asso_values[] =
|
||||
{
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 0, 83, 1, 2, 34,
|
||||
19, 6, 11, 29, 0, 17, 83, 0, 23, 28,
|
||||
26, 30, 31, 83, 15, 1, 0, 28, 13, 4,
|
||||
83, 83, 5, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
case 3:
|
||||
hval += asso_values[(unsigned char)str[2]];
|
||||
case 2:
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval + asso_values[(unsigned char)str[len - 1]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
struct resword *
|
||||
is_reserved_word (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static struct resword wordlist[] =
|
||||
{
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{"__asm__", ASM, NORID},
|
||||
{""},
|
||||
{"__typeof__", TYPEOF, NORID},
|
||||
{"__signed__", TYPESPEC, RID_SIGNED},
|
||||
{"__alignof__", ALIGNOF, NORID},
|
||||
{"break", BREAK, NORID},
|
||||
{"__attribute__", ATTRIBUTE, NORID},
|
||||
{""}, {""},
|
||||
{"else", ELSE, NORID},
|
||||
{"__attribute", ATTRIBUTE, NORID},
|
||||
{"__typeof", TYPEOF, NORID},
|
||||
{"int", TYPESPEC, RID_INT},
|
||||
{"__alignof", ALIGNOF, NORID},
|
||||
{"struct", STRUCT, NORID},
|
||||
{"sizeof", SIZEOF, NORID},
|
||||
{"switch", SWITCH, NORID},
|
||||
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
|
||||
{""},
|
||||
{"__inline__", SCSPEC, RID_INLINE},
|
||||
{"__signed", TYPESPEC, RID_SIGNED},
|
||||
{"__volatile", TYPE_QUAL, RID_VOLATILE},
|
||||
{"if", IF, NORID},
|
||||
{"__inline", SCSPEC, RID_INLINE},
|
||||
{"while", WHILE, NORID},
|
||||
{""},
|
||||
{"__asm", ASM, NORID},
|
||||
{"auto", SCSPEC, RID_AUTO},
|
||||
{"short", TYPESPEC, RID_SHORT},
|
||||
{"default", DEFAULT, NORID},
|
||||
{"extern", SCSPEC, RID_EXTERN},
|
||||
{""}, {""},
|
||||
{"__const", TYPE_QUAL, RID_CONST},
|
||||
{"static", SCSPEC, RID_STATIC},
|
||||
{"__const__", TYPE_QUAL, RID_CONST},
|
||||
{"for", FOR, NORID},
|
||||
{"case", CASE, NORID},
|
||||
{"float", TYPESPEC, RID_FLOAT},
|
||||
{"return", RETURN, NORID},
|
||||
{"typeof", TYPEOF, NORID},
|
||||
{"typedef", SCSPEC, RID_TYPEDEF},
|
||||
{"volatile", TYPE_QUAL, RID_VOLATILE},
|
||||
{"do", DO, NORID},
|
||||
{"inline", SCSPEC, RID_INLINE},
|
||||
{"void", TYPESPEC, RID_VOID},
|
||||
{"char", TYPESPEC, RID_CHAR},
|
||||
{"signed", TYPESPEC, RID_SIGNED},
|
||||
{"unsigned", TYPESPEC, RID_UNSIGNED},
|
||||
{""}, {""},
|
||||
{"double", TYPESPEC, RID_DOUBLE},
|
||||
{"asm", ASM, NORID},
|
||||
{""}, {""},
|
||||
{"goto", GOTO, NORID},
|
||||
{""},
|
||||
{"const", TYPE_QUAL, RID_CONST},
|
||||
{"enum", ENUM, NORID},
|
||||
{"register", SCSPEC, RID_REGISTER},
|
||||
{""}, {""}, {""}, {""}, {""}, {""},
|
||||
{"continue", CONTINUE, NORID},
|
||||
{""},
|
||||
{"union", UNION, NORID},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
{"long", TYPESPEC, RID_LONG}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
/* C code produced by gperf version 2.7 */
|
||||
/* Command-line: ../src/gperf -n -k1-8 -l */
|
||||
|
||||
#define TOTAL_KEYWORDS 40
|
||||
#define MIN_WORD_LENGTH 2
|
||||
#define MAX_WORD_LENGTH 14
|
||||
#define MIN_HASH_VALUE 1
|
||||
#define MAX_HASH_VALUE 256
|
||||
/* maximum key range = 256, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static unsigned short asso_values[] =
|
||||
{
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 25, 30, 35, 21, 0,
|
||||
30, 15, 30, 45, 257, 257, 0, 5, 45, 0,
|
||||
10, 0, 1, 20, 25, 15, 30, 40, 15, 5,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
|
||||
257, 257, 257, 257, 257, 257
|
||||
};
|
||||
register int hval = 0;
|
||||
|
||||
switch (len)
|
||||
{
|
||||
default:
|
||||
case 8:
|
||||
hval += asso_values[(unsigned char)str[7]];
|
||||
case 7:
|
||||
hval += asso_values[(unsigned char)str[6]];
|
||||
case 6:
|
||||
hval += asso_values[(unsigned char)str[5]];
|
||||
case 5:
|
||||
hval += asso_values[(unsigned char)str[4]];
|
||||
case 4:
|
||||
hval += asso_values[(unsigned char)str[3]];
|
||||
case 3:
|
||||
hval += asso_values[(unsigned char)str[2]];
|
||||
case 2:
|
||||
hval += asso_values[(unsigned char)str[1]];
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
const char *
|
||||
in_word_set (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static unsigned char lengthtable[] =
|
||||
{
|
||||
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 2, 3, 0,
|
||||
0, 0, 2, 3, 0, 0, 0, 2, 4, 0, 0, 0, 4, 6,
|
||||
0, 0, 0, 3, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
|
||||
3, 5, 6, 0, 0, 6, 0, 0, 0, 0, 3, 0, 0, 0,
|
||||
3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 0, 9,
|
||||
0, 4, 6, 6, 0, 0, 2, 3, 0, 0, 0, 5, 3, 0,
|
||||
0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
|
||||
0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
|
||||
7, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 10
|
||||
};
|
||||
static const char * wordlist[] =
|
||||
{
|
||||
"",
|
||||
"OR",
|
||||
"", "", "", "", "", "", "", "",
|
||||
"LOOP",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"ELSE",
|
||||
"DO",
|
||||
"", "", "",
|
||||
"TO",
|
||||
"MOD",
|
||||
"", "", "",
|
||||
"OF",
|
||||
"FOR",
|
||||
"", "", "",
|
||||
"BY",
|
||||
"FROM",
|
||||
"", "", "",
|
||||
"TYPE",
|
||||
"MODULE",
|
||||
"", "", "",
|
||||
"SET",
|
||||
"", "", "", "", "",
|
||||
"EXPORT",
|
||||
"", "", "", "",
|
||||
"VAR",
|
||||
"ARRAY",
|
||||
"RECORD",
|
||||
"", "",
|
||||
"REPEAT",
|
||||
"", "", "", "",
|
||||
"END",
|
||||
"", "", "",
|
||||
"NOT",
|
||||
"", "", "", "",
|
||||
"IF",
|
||||
"", "", "", "",
|
||||
"CASE",
|
||||
"", "",
|
||||
"PROCEDURE",
|
||||
"",
|
||||
"EXIT",
|
||||
"IMPORT",
|
||||
"RETURN",
|
||||
"", "",
|
||||
"IN",
|
||||
"AND",
|
||||
"", "", "",
|
||||
"ELSIF",
|
||||
"DIV",
|
||||
"", "", "",
|
||||
"THEN",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"IMPLEMENTATION",
|
||||
"", "", "", "",
|
||||
"WHILE",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"CONST",
|
||||
"POINTER",
|
||||
"", "", "",
|
||||
"UNTIL",
|
||||
"", "", "", "",
|
||||
"BEGIN",
|
||||
"", "", "", "",
|
||||
"WITH",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"",
|
||||
"QUALIFIED",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "",
|
||||
"DEFINITION"
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
if (len == lengthtable[key])
|
||||
{
|
||||
register const char *s = wordlist[key];
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/* C code produced by gperf version 2.7 */
|
||||
/* Command-line: ../src/gperf -p -j 1 -o -a -C -g -t -k1,4,$ */
|
||||
/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$ gplus.gperf */
|
||||
struct resword { char *name; short token; enum rid rid;};
|
||||
|
||||
#define TOTAL_KEYWORDS 71
|
||||
#define MIN_WORD_LENGTH 2
|
||||
#define MAX_WORD_LENGTH 13
|
||||
#define MIN_HASH_VALUE 4
|
||||
#define MAX_HASH_VALUE 147
|
||||
/* maximum key range = 144, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static const unsigned char asso_values[] =
|
||||
{
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 0, 148, 19, 6, 27,
|
||||
37, 0, 12, 1, 15, 63, 148, 4, 0, 56,
|
||||
20, 15, 42, 148, 31, 5, 26, 39, 32, 10,
|
||||
148, 40, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
|
||||
148, 148, 148, 148, 148, 148
|
||||
};
|
||||
register int hval = len;
|
||||
|
||||
switch (hval)
|
||||
{
|
||||
default:
|
||||
case 4:
|
||||
hval += asso_values[(unsigned char)str[3]];
|
||||
case 3:
|
||||
case 2:
|
||||
case 1:
|
||||
hval += asso_values[(unsigned char)str[0]];
|
||||
break;
|
||||
}
|
||||
return hval + asso_values[(unsigned char)str[len - 1]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
const struct resword *
|
||||
in_word_set (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static const struct resword wordlist[] =
|
||||
{
|
||||
{""}, {""}, {""}, {""},
|
||||
{"else", ELSE, NORID,},
|
||||
{""},
|
||||
{"long", TYPESPEC, RID_LONG,},
|
||||
{""}, {""}, {""}, {""},
|
||||
{"__alignof__", ALIGNOF, NORID},
|
||||
{"__asm__", ASM, NORID},
|
||||
{""}, {""},
|
||||
{"while", WHILE, NORID,},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
{"__alignof", ALIGNOF, NORID},
|
||||
{"all", ALL, NORID /* Extension */,},
|
||||
{"sizeof", SIZEOF, NORID,},
|
||||
{"__const__", TYPE_QUAL, RID_CONST},
|
||||
{"__volatile", TYPE_QUAL, RID_VOLATILE},
|
||||
{"extern", SCSPEC, RID_EXTERN,},
|
||||
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
|
||||
{"__inline", SCSPEC, RID_INLINE},
|
||||
{"exception", AGGR, RID_EXCEPTION /* Extension */,},
|
||||
{"__inline__", SCSPEC, RID_INLINE},
|
||||
{"case", CASE, NORID,},
|
||||
{"except", EXCEPT, NORID /* Extension */,},
|
||||
{"new", NEW, NORID,},
|
||||
{"break", BREAK, NORID,},
|
||||
{"goto", GOTO, NORID,},
|
||||
{""},
|
||||
{"__attribute", ATTRIBUTE, NORID},
|
||||
{""},
|
||||
{"__attribute__", ATTRIBUTE, NORID},
|
||||
{"this", THIS, NORID,},
|
||||
{"raise", RAISE, NORID /* Extension */,},
|
||||
{"class", AGGR, RID_CLASS,},
|
||||
{"delete", DELETE, NORID,},
|
||||
{"typeof", TYPEOF, NORID,},
|
||||
{"typedef", SCSPEC, RID_TYPEDEF,},
|
||||
{"for", FOR, NORID,},
|
||||
{"raises", RAISES, NORID /* Extension */,},
|
||||
{"__const", TYPE_QUAL, RID_CONST},
|
||||
{"double", TYPESPEC, RID_DOUBLE,},
|
||||
{"__typeof__", TYPEOF, NORID},
|
||||
{""},
|
||||
{"switch", SWITCH, NORID,},
|
||||
{"auto", SCSPEC, RID_AUTO,},
|
||||
{"do", DO, NORID,},
|
||||
{"friend", SCSPEC, RID_FRIEND,},
|
||||
{""},
|
||||
{"reraise", RERAISE, NORID /* Extension */,},
|
||||
{""},
|
||||
{"volatile", TYPE_QUAL, RID_VOLATILE,},
|
||||
{"__typeof", TYPEOF, NORID},
|
||||
{"continue", CONTINUE, NORID,},
|
||||
{"float", TYPESPEC, RID_FLOAT,},
|
||||
{"const", TYPE_QUAL, RID_CONST,},
|
||||
{"static", SCSPEC, RID_STATIC,},
|
||||
{"virtual", SCSPEC, RID_VIRTUAL,},
|
||||
{"__asm", ASM, NORID},
|
||||
{"short", TYPESPEC, RID_SHORT,},
|
||||
{"signed", TYPESPEC, RID_SIGNED,},
|
||||
{"try", TRY, NORID /* Extension */,},
|
||||
{""}, {""}, {""},
|
||||
{"__signed__", TYPESPEC, RID_SIGNED},
|
||||
{"catch", CATCH, NORID,},
|
||||
{"public", PUBLIC, NORID,},
|
||||
{"struct", AGGR, RID_RECORD,},
|
||||
{"if", IF, NORID,},
|
||||
{"asm", ASM, NORID,},
|
||||
{"union", AGGR, RID_UNION,},
|
||||
{""},
|
||||
{"private", PRIVATE, NORID,},
|
||||
{""}, {""}, {""},
|
||||
{"operator", OPERATOR, NORID,},
|
||||
{""}, {""}, {""},
|
||||
{"default", DEFAULT, NORID,},
|
||||
{"dynamic", DYNAMIC, NORID,},
|
||||
{"overload", OVERLOAD, NORID,},
|
||||
{"int", TYPESPEC, RID_INT,},
|
||||
{"char", TYPESPEC, RID_CHAR,},
|
||||
{""}, {""},
|
||||
{"return", RETURN, NORID,},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""},
|
||||
{"__signed", TYPESPEC, RID_SIGNED},
|
||||
{""},
|
||||
{"void", TYPESPEC, RID_VOID,},
|
||||
{""}, {""}, {""},
|
||||
{"protected", PROTECTED, NORID,},
|
||||
{""},
|
||||
{"enum", ENUM, NORID,},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""},
|
||||
{"inline", SCSPEC, RID_INLINE,},
|
||||
{"register", SCSPEC, RID_REGISTER,},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""},
|
||||
{"unsigned", TYPESPEC, RID_UNSIGNED,}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
/* C code produced by gperf version 2.7 */
|
||||
/* Command-line: ../src/gperf -D -p -t */
|
||||
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
|
||||
struct resword { char *name; short token; enum rid rid; };
|
||||
|
||||
#define TOTAL_KEYWORDS 51
|
||||
#define MIN_WORD_LENGTH 2
|
||||
#define MAX_WORD_LENGTH 13
|
||||
#define MIN_HASH_VALUE 4
|
||||
#define MAX_HASH_VALUE 82
|
||||
/* maximum key range = 79, duplicates = 2 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static unsigned char asso_values[] =
|
||||
{
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 0, 83, 40, 20, 50,
|
||||
25, 10, 30, 0, 0, 50, 83, 0, 15, 0,
|
||||
35, 0, 83, 83, 20, 0, 10, 40, 5, 15,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
|
||||
83, 83, 83, 83, 83, 83
|
||||
};
|
||||
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
struct resword *
|
||||
in_word_set (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static struct resword wordlist[] =
|
||||
{
|
||||
{"goto", GOTO, NORID},
|
||||
{"__asm", ASM, NORID},
|
||||
{"switch", SWITCH, NORID},
|
||||
{"__asm__", ASM, NORID},
|
||||
{"__const__", TYPE_QUAL, RID_CONST},
|
||||
{"__inline__", SCSPEC, RID_INLINE},
|
||||
{"__typeof__", TYPEOF, NORID},
|
||||
{"__signed__", TYPESPEC, RID_SIGNED},
|
||||
{"__alignof__", ALIGNOF, NORID},
|
||||
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
|
||||
{"__attribute__", ATTRIBUTE, NORID},
|
||||
{"enum", ENUM, NORID},
|
||||
{"short", TYPESPEC, RID_SHORT},
|
||||
{"struct", STRUCT, NORID},
|
||||
{"__const", TYPE_QUAL, RID_CONST},
|
||||
{"__inline", SCSPEC, RID_INLINE},
|
||||
{"long", TYPESPEC, RID_LONG},
|
||||
{"__volatile", TYPE_QUAL, RID_VOLATILE},
|
||||
{"__attribute", ATTRIBUTE, NORID},
|
||||
{"volatile", TYPE_QUAL, RID_VOLATILE},
|
||||
{"else", ELSE, NORID},
|
||||
{"break", BREAK, NORID},
|
||||
{"do", DO, NORID},
|
||||
{"while", WHILE, NORID},
|
||||
{"signed", TYPESPEC, RID_SIGNED},
|
||||
{"__signed", TYPESPEC, RID_SIGNED},
|
||||
{"void", TYPESPEC, RID_VOID},
|
||||
{"sizeof", SIZEOF, NORID},
|
||||
{"__typeof", TYPEOF, NORID},
|
||||
{"__alignof", ALIGNOF, NORID},
|
||||
{"double", TYPESPEC, RID_DOUBLE},
|
||||
{"default", DEFAULT, NORID},
|
||||
{"asm", ASM, NORID},
|
||||
{"auto", SCSPEC, RID_AUTO},
|
||||
{"float", TYPESPEC, RID_FLOAT},
|
||||
{"typeof", TYPEOF, NORID},
|
||||
{"typedef", SCSPEC, RID_TYPEDEF},
|
||||
{"register", SCSPEC, RID_REGISTER},
|
||||
{"extern", SCSPEC, RID_EXTERN},
|
||||
{"for", FOR, NORID},
|
||||
{"static", SCSPEC, RID_STATIC},
|
||||
{"return", RETURN, NORID},
|
||||
{"int", TYPESPEC, RID_INT},
|
||||
{"case", CASE, NORID},
|
||||
{"const", TYPE_QUAL, RID_CONST},
|
||||
{"inline", SCSPEC, RID_INLINE},
|
||||
{"continue", CONTINUE, NORID},
|
||||
{"unsigned", TYPESPEC, RID_UNSIGNED},
|
||||
{"char", TYPESPEC, RID_CHAR},
|
||||
{"union", UNION, NORID},
|
||||
{"if", IF, NORID}
|
||||
};
|
||||
|
||||
static short lookup[] =
|
||||
{
|
||||
-1, -1, -1, -1, 0, 1, 2, 3, -1, 4,
|
||||
-80, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
||||
17, 18, -1, 19, 20, 21, -1, 22, -46, -3,
|
||||
23, 24, -1, 25, 26, -1, 27, -1, 28, 29,
|
||||
-1, 30, 31, 32, 33, 34, 35, 36, 37, -1,
|
||||
-1, 38, -1, 39, -1, -1, 40, -1, -1, -1,
|
||||
-1, 41, -1, 42, 43, 44, 45, -1, 46, -1,
|
||||
-1, -1, -1, 47, 48, -1, -1, -1, -1, -1,
|
||||
49, -1, 50
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register int index = lookup[key];
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
register const char *s = wordlist[index].name;
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return &wordlist[index];
|
||||
}
|
||||
else if (index < -TOTAL_KEYWORDS)
|
||||
{
|
||||
register int offset = - 1 - TOTAL_KEYWORDS - index;
|
||||
register struct resword *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
|
||||
register struct resword *wordendptr = wordptr + -lookup[offset + 1];
|
||||
|
||||
while (wordptr < wordendptr)
|
||||
{
|
||||
register const char *s = wordptr->name;
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return wordptr;
|
||||
wordptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
/* C code produced by gperf version 2.7 */
|
||||
/* Command-line: ../src/gperf -g -o -j1 -t -p -N is_reserved_word */
|
||||
/* ISO Pascal 7185 reserved words.
|
||||
*
|
||||
* For GNU Pascal compiler (GPC) by [email protected]
|
||||
*
|
||||
* run this through the Doug Schmidt's gperf program
|
||||
* with command
|
||||
* gperf -g -o -j1 -t -p -N is_reserved_word
|
||||
*
|
||||
*/
|
||||
struct resword { char *name; short token; short iclass;};
|
||||
|
||||
#define TOTAL_KEYWORDS 35
|
||||
#define MIN_WORD_LENGTH 2
|
||||
#define MAX_WORD_LENGTH 9
|
||||
#define MIN_HASH_VALUE 2
|
||||
#define MAX_HASH_VALUE 43
|
||||
/* maximum key range = 42, duplicates = 0 */
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
static unsigned int
|
||||
hash (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static unsigned char asso_values[] =
|
||||
{
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 18, 29, 14, 6, 7,
|
||||
10, 20, 44, 28, 44, 44, 28, 19, 22, 15,
|
||||
0, 44, 9, 23, 0, 23, 26, 2, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
0, 0, 13, 44, 30, 44, 44, 44, 0, 25,
|
||||
1, 0, 44, 44, 0, 44, 1, 44, 25, 44,
|
||||
44, 0, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44
|
||||
};
|
||||
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#endif
|
||||
struct resword *
|
||||
is_reserved_word (str, len)
|
||||
register const char *str;
|
||||
register unsigned int len;
|
||||
{
|
||||
static struct resword wordlist[] =
|
||||
{
|
||||
{""}, {""},
|
||||
{"To", TO, PASCAL_ISO},
|
||||
{""},
|
||||
{"Type", TYPE, PASCAL_ISO},
|
||||
{"Then", THEN, PASCAL_ISO},
|
||||
{"Packed", PACKED, PASCAL_ISO},
|
||||
{"While", WHILE, PASCAL_ISO},
|
||||
{"Do", DO, PASCAL_ISO},
|
||||
{"Procedure", PROCEDURE, PASCAL_ISO},
|
||||
{"End", END, PASCAL_ISO},
|
||||
{"Else", ELSE, PASCAL_ISO},
|
||||
{"Downto", DOWNTO, PASCAL_ISO},
|
||||
{"For", FOR, PASCAL_ISO},
|
||||
{"File", FILE_, PASCAL_ISO},
|
||||
{"Record", RECORD, PASCAL_ISO},
|
||||
{"Repeat", REPEAT, PASCAL_ISO},
|
||||
{"Or", OR, PASCAL_ISO},
|
||||
{"Case", CASE, PASCAL_ISO},
|
||||
{"Function", FUNCTION, PASCAL_ISO},
|
||||
{"Const", CONST, PASCAL_ISO},
|
||||
{"And", AND, PASCAL_ISO},
|
||||
{"Mod", MOD, PASCAL_ISO},
|
||||
{"Array", ARRAY, PASCAL_ISO},
|
||||
{"Goto", GOTO, PASCAL_ISO},
|
||||
{"Nil", NIL, PASCAL_ISO},
|
||||
{"Not", NOT, PASCAL_ISO},
|
||||
{"Set", SET, PASCAL_ISO},
|
||||
{"Until", UNTIL, PASCAL_ISO},
|
||||
{"Var", VAR, PASCAL_ISO},
|
||||
{"Of", OF, PASCAL_ISO},
|
||||
{"In", IN, PASCAL_ISO},
|
||||
{"Program",PROGRAM,PASCAL_ISO},
|
||||
{"Label", LABEL, PASCAL_ISO},
|
||||
{"Div", DIV, PASCAL_ISO},
|
||||
{"Begin", BEGIN_, PASCAL_ISO},
|
||||
{"With", WITH, PASCAL_ISO},
|
||||
{""}, {""}, {""}, {""}, {""}, {""},
|
||||
{"If", IF, PASCAL_ISO}
|
||||
};
|
||||
|
||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||
{
|
||||
register int key = hash (str, len);
|
||||
|
||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||
{
|
||||
register const char *s = wordlist[key].name;
|
||||
|
||||
if (*str == *s && !strcmp (str + 1, s + 1))
|
||||
return &wordlist[key];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
GNU `gperf' generates perfect hash functions.
|
||||
|
||||
Usage: ../src/gperf [OPTION]... [INPUT-FILE]
|
||||
|
||||
If a long option shows an argument as mandatory, then it is mandatory
|
||||
for the equivalent short option also.
|
||||
|
||||
Input file interpretation:
|
||||
-e, --delimiters=DELIMITER-LIST
|
||||
Allow user to provide a string containing delimiters
|
||||
used to separate keywords from their attributes.
|
||||
Default is ",\n".
|
||||
-t, --struct-type Allows the user to include a structured type
|
||||
declaration for generated code. Any text before %%
|
||||
is considered part of the type declaration. Key
|
||||
words and additional fields may follow this, one
|
||||
group of fields per line.
|
||||
|
||||
Language for the output code:
|
||||
-L, --language=LANGUAGE-NAME
|
||||
Generates code in the specified language. Languages
|
||||
handled are currently C++, ANSI-C, C, and KR-C. The
|
||||
default is C.
|
||||
|
||||
Details in the output code:
|
||||
-K, --slot-name=NAME Select name of the keyword component in the keyword
|
||||
structure.
|
||||
-H, --hash-fn-name=NAME
|
||||
Specify name of generated hash function. Default is
|
||||
`hash'.
|
||||
-N, --lookup-fn-name=NAME
|
||||
Specify name of generated lookup function. Default
|
||||
name is `in_word_set'.
|
||||
-Z, --class-name=NAME Specify name of generated C++ class. Default name is
|
||||
`Perfect_Hash'.
|
||||
-7, --seven-bit Assume 7-bit characters.
|
||||
-c, --compare-strncmp Generate comparison code using strncmp rather than
|
||||
strcmp.
|
||||
-C, --readonly-tables Make the contents of generated lookup tables
|
||||
constant, i.e., readonly.
|
||||
-E, --enum Define constant values using an enum local to the
|
||||
lookup function rather than with defines.
|
||||
-I, --includes Include the necessary system include file <string.h>
|
||||
at the beginning of the code.
|
||||
-G, --global Generate the static table of keywords as a static
|
||||
global variable, rather than hiding it inside of the
|
||||
lookup function (which is the default behavior).
|
||||
-W, --word-array-name=NAME
|
||||
Specify name of word list array. Default name is
|
||||
`wordlist'.
|
||||
-S, --switch=COUNT Causes the generated C code to use a switch
|
||||
statement scheme, rather than an array lookup table.
|
||||
This can lead to a reduction in both time and space
|
||||
requirements for some keyfiles. The COUNT argument
|
||||
determines how many switch statements are generated.
|
||||
A value of 1 generates 1 switch containing all the
|
||||
elements, a value of 2 generates 2 tables with 1/2
|
||||
the elements in each table, etc. If COUNT is very
|
||||
large, say 1000000, the generated C code does a
|
||||
binary search.
|
||||
-T, --omit-struct-type
|
||||
Prevents the transfer of the type declaration to the
|
||||
output file. Use this option if the type is already
|
||||
defined elsewhere.
|
||||
|
||||
Algorithm employed by gperf:
|
||||
-k, --key-positions=KEYS
|
||||
Select the key positions used in the hash function.
|
||||
The allowable choices range between 1-126, inclusive.
|
||||
The positions are separated by commas, ranges may be
|
||||
used, and key positions may occur in any order.
|
||||
Also, the meta-character '*' causes the generated
|
||||
hash function to consider ALL key positions, and $
|
||||
indicates the ``final character'' of a key, e.g.,
|
||||
$,1,2,4,6-10.
|
||||
-l, --compare-strlen Compare key lengths before trying a string
|
||||
comparison. This helps cut down on the number of
|
||||
string comparisons made during the lookup.
|
||||
-D, --duplicates Handle keywords that hash to duplicate values. This
|
||||
is useful for certain highly redundant keyword sets.
|
||||
-f, --fast=ITERATIONS Generate the gen-perf.hash function ``fast''. This
|
||||
decreases gperf's running time at the cost of
|
||||
minimizing generated table size. The numeric
|
||||
argument represents the number of times to iterate
|
||||
when resolving a collision. `0' means ``iterate by
|
||||
the number of keywords''.
|
||||
-i, --initial-asso=N Provide an initial value for the associate values
|
||||
array. Default is 0. Setting this value larger helps
|
||||
inflate the size of the final table.
|
||||
-j, --jump=JUMP-VALUE Affects the ``jump value'', i.e., how far to advance
|
||||
the associated character value upon collisions. Must
|
||||
be an odd number, default is 5.
|
||||
-n, --no-strlen Do not include the length of the keyword when
|
||||
computing the hash function.
|
||||
-o, --occurrence-sort Reorders input keys by frequency of occurrence of
|
||||
the key sets. This should decrease the search time
|
||||
dramatically.
|
||||
-r, --random Utilizes randomness to initialize the associated
|
||||
values table.
|
||||
-s, --size-multiple=N Affects the size of the generated hash table. The
|
||||
numeric argument N indicates ``how many times larger
|
||||
or smaller'' the associated value range should be,
|
||||
in relationship to the number of keys, e.g. a value
|
||||
of 3 means ``allow the maximum associated value to
|
||||
be about 3 times larger than the number of input
|
||||
keys.'' Conversely, a value of -3 means ``make the
|
||||
maximum associated value about 3 times smaller than
|
||||
the number of input keys. A larger table should
|
||||
decrease the time required for an unsuccessful
|
||||
search, at the expense of extra table space. Default
|
||||
value is 1.
|
||||
|
||||
Informative output:
|
||||
-h, --help Print this message.
|
||||
-v, --version Print the gperf version number.
|
||||
-d, --debug Enables the debugging option (produces verbose
|
||||
output to the standard error).
|
||||
|
||||
Report bugs to <[email protected]>.
|
||||
@@ -1,32 +0,0 @@
|
||||
in word set if
|
||||
in word set do
|
||||
NOT in word set int
|
||||
in word set for
|
||||
in word set case
|
||||
NOT in word set char
|
||||
NOT in word set auto
|
||||
in word set goto
|
||||
in word set else
|
||||
NOT in word set long
|
||||
NOT in word set void
|
||||
NOT in word set enum
|
||||
NOT in word set float
|
||||
NOT in word set short
|
||||
NOT in word set union
|
||||
NOT in word set break
|
||||
in word set while
|
||||
NOT in word set const
|
||||
NOT in word set double
|
||||
NOT in word set static
|
||||
NOT in word set extern
|
||||
NOT in word set struct
|
||||
in word set return
|
||||
NOT in word set sizeof
|
||||
NOT in word set switch
|
||||
NOT in word set signed
|
||||
NOT in word set typedef
|
||||
NOT in word set default
|
||||
NOT in word set unsigned
|
||||
NOT in word set continue
|
||||
NOT in word set register
|
||||
NOT in word set volatile
|
||||
@@ -1,54 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Validate gperf's operation on a given input file.
|
||||
# Usage: validate languages input.gperf [more gperf options]
|
||||
# Uses the environment variables GPERF, CC, CFLAGS, CXX, CXXFLAGS.
|
||||
# Supposes gcc and g++.
|
||||
|
||||
# Exit on error
|
||||
set -e
|
||||
|
||||
verbose () {
|
||||
echo "$@"
|
||||
"$@"
|
||||
}
|
||||
|
||||
languages=$1
|
||||
shift
|
||||
|
||||
for lang in `echo $languages | sed -e 's/,/ /g'`; do
|
||||
case "$lang" in
|
||||
KR-C )
|
||||
echo "${GPERF} -I -L KR-C $@ > valitest.c"
|
||||
${GPERF} -I -L KR-C "$@" > valitest.c
|
||||
grep -n ' const ' valitest.c /dev/null && exit 1
|
||||
verbose ${CC} ${CFLAGS} -traditional valitest.c -o valitest
|
||||
./valitest
|
||||
verbose ${CC} ${CFLAGS} -ansi -pedantic valitest.c -o valitest
|
||||
./valitest
|
||||
;;
|
||||
C )
|
||||
echo "${GPERF} -I -L C $@ > valitest.c"
|
||||
${GPERF} -I -L C "$@" > valitest.c
|
||||
verbose ${CC} ${CFLAGS} -traditional -Dconst= valitest.c -o valitest
|
||||
./valitest
|
||||
verbose ${CC} ${CFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest
|
||||
./valitest
|
||||
;;
|
||||
ANSI-C )
|
||||
echo "${GPERF} -I -L ANSI-C $@ > valitest.c"
|
||||
${GPERF} -I -L ANSI-C "$@" > valitest.c
|
||||
verbose ${CC} ${CFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest
|
||||
./valitest
|
||||
verbose ${CXX} ${CXXFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest
|
||||
./valitest
|
||||
;;
|
||||
"C++" )
|
||||
echo "${GPERF} -I -L C++ $@ > valitest.c"
|
||||
${GPERF} -I -L C++ "$@" > valitest.c
|
||||
verbose ${CXX} ${CXXFLAGS} -ansi -pedantic -pedantic-errors -DCPLUSPLUS_TEST valitest.c -o valitest
|
||||
./valitest
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -1,62 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Written by James Clark ([email protected])
|
||||
|
||||
This file is part of groff.
|
||||
|
||||
groff 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, or (at your option) any later
|
||||
version.
|
||||
|
||||
groff 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 groff; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include "cmap.h"
|
||||
|
||||
cmap cmlower(CMAP_BUILTIN);
|
||||
cmap cmupper(CMAP_BUILTIN);
|
||||
|
||||
#if defined(isascii) && !defined(__FreeBSD__)
|
||||
#define ISASCII(c) isascii(c)
|
||||
#else
|
||||
#define ISASCII(c) (1)
|
||||
#endif
|
||||
|
||||
cmap::cmap()
|
||||
{
|
||||
unsigned char *p = v;
|
||||
for (int i = 0; i <= UCHAR_MAX; i++)
|
||||
p[i] = i;
|
||||
}
|
||||
|
||||
cmap::cmap(cmap_builtin)
|
||||
{
|
||||
// these are initialised by cmap_init::cmap_init()
|
||||
}
|
||||
|
||||
int cmap_init::initialised = 0;
|
||||
|
||||
cmap_init::cmap_init()
|
||||
{
|
||||
if (initialised)
|
||||
return;
|
||||
initialised = 1;
|
||||
#ifdef __FreeBSD__
|
||||
(void) setlocale(LC_CTYPE, "");
|
||||
#endif
|
||||
for (int i = 0; i <= UCHAR_MAX; i++) {
|
||||
cmupper.v[i] = ISASCII(i) && islower(i) ? toupper(i) : i;
|
||||
cmlower.v[i] = ISASCII(i) && isupper(i) ? tolower(i) : i;
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
Written by James Clark ([email protected])
|
||||
|
||||
This file is part of groff.
|
||||
|
||||
groff 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, or (at your option) any later
|
||||
version.
|
||||
|
||||
groff 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 groff; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include "cset.h"
|
||||
|
||||
cset csalpha(CSET_BUILTIN);
|
||||
cset csupper(CSET_BUILTIN);
|
||||
cset cslower(CSET_BUILTIN);
|
||||
cset csdigit(CSET_BUILTIN);
|
||||
cset csxdigit(CSET_BUILTIN);
|
||||
cset csspace(CSET_BUILTIN);
|
||||
cset cspunct(CSET_BUILTIN);
|
||||
cset csalnum(CSET_BUILTIN);
|
||||
cset csprint(CSET_BUILTIN);
|
||||
cset csgraph(CSET_BUILTIN);
|
||||
cset cscntrl(CSET_BUILTIN);
|
||||
|
||||
#if defined(isascii) && !defined(__FreeBSD__)
|
||||
#define ISASCII(c) isascii(c)
|
||||
#else
|
||||
#define ISASCII(c) (1)
|
||||
#endif
|
||||
|
||||
void cset::clear()
|
||||
{
|
||||
char *p = v;
|
||||
for (int i = 0; i <= UCHAR_MAX; i++)
|
||||
p[i] = 0;
|
||||
}
|
||||
|
||||
cset::cset()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
cset::cset(const char *s)
|
||||
{
|
||||
clear();
|
||||
while (*s)
|
||||
v[(unsigned char)*s++] = 1;
|
||||
}
|
||||
|
||||
cset::cset(const unsigned char *s)
|
||||
{
|
||||
clear();
|
||||
while (*s)
|
||||
v[*s++] = 1;
|
||||
}
|
||||
|
||||
cset::cset(cset_builtin)
|
||||
{
|
||||
// these are initialised by cset_init::cset_init()
|
||||
}
|
||||
|
||||
cset &cset::operator|=(const cset &cs)
|
||||
{
|
||||
for (int i = 0; i <= UCHAR_MAX; i++)
|
||||
if (cs.v[i])
|
||||
v[i] = 1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
int cset_init::initialised = 0;
|
||||
|
||||
cset_init::cset_init()
|
||||
{
|
||||
if (initialised)
|
||||
return;
|
||||
initialised = 1;
|
||||
#ifdef __FreeBSD__
|
||||
(void) setlocale(LC_CTYPE, "");
|
||||
#endif
|
||||
for (int i = 0; i <= UCHAR_MAX; i++) {
|
||||
csalpha.v[i] = ISASCII(i) && isalpha(i);
|
||||
csupper.v[i] = ISASCII(i) && isupper(i);
|
||||
cslower.v[i] = ISASCII(i) && islower(i);
|
||||
csdigit.v[i] = ISASCII(i) && isdigit(i);
|
||||
csxdigit.v[i] = ISASCII(i) && isxdigit(i);
|
||||
csspace.v[i] = ISASCII(i) && isspace(i);
|
||||
cspunct.v[i] = ISASCII(i) && ispunct(i);
|
||||
csalnum.v[i] = ISASCII(i) && isalnum(i);
|
||||
csprint.v[i] = ISASCII(i) && isprint(i);
|
||||
csgraph.v[i] = ISASCII(i) && isgraph(i);
|
||||
cscntrl.v[i] = ISASCII(i) && iscntrl(i);
|
||||
}
|
||||
}
|
||||
@@ -1,287 +0,0 @@
|
||||
OpenSSL - Frequently Asked Questions
|
||||
--------------------------------------
|
||||
|
||||
* Which is the current version of OpenSSL?
|
||||
* Where is the documentation?
|
||||
* How can I contact the OpenSSL developers?
|
||||
* Do I need patent licenses to use OpenSSL?
|
||||
* Is OpenSSL thread-safe?
|
||||
* Why do I get a "PRNG not seeded" error message?
|
||||
* Why does the linker complain about undefined symbols?
|
||||
* Where can I get a compiled version of OpenSSL?
|
||||
* I've compiled a program under Windows and it crashes: why?
|
||||
* I've called <some function> and it fails, why?
|
||||
* I just get a load of numbers for the error output, what do they mean?
|
||||
* Why do I get errors about unknown algorithms?
|
||||
* How do I create certificates or certificate requests?
|
||||
* Why can't I create certificate requests?
|
||||
* Why does <SSL program> fail with a certificate verify error?
|
||||
* How can I create DSA certificates?
|
||||
* Why can't I make an SSL connection using a DSA certificate?
|
||||
* Why can't the OpenSSH configure script detect OpenSSL?
|
||||
|
||||
|
||||
* Which is the current version of OpenSSL?
|
||||
|
||||
The current version is available from <URL: http://www.openssl.org>.
|
||||
OpenSSL 0.9.5a was released on April 1st, 2000.
|
||||
|
||||
In addition to the current stable release, you can also access daily
|
||||
snapshots of the OpenSSL development version at <URL:
|
||||
ftp://ftp.openssl.org/snapshot/>, or get it by anonymous CVS access.
|
||||
|
||||
|
||||
* Where is the documentation?
|
||||
|
||||
OpenSSL is a library that provides cryptographic functionality to
|
||||
applications such as secure web servers. Be sure to read the
|
||||
documentation of the application you want to use. The INSTALL file
|
||||
explains how to install this library.
|
||||
|
||||
OpenSSL includes a command line utility that can be used to perform a
|
||||
variety of cryptographic functions. It is described in the openssl(1)
|
||||
manpage. Documentation for developers is currently being written. A
|
||||
few manual pages already are available; overviews over libcrypto and
|
||||
libssl are given in the crypto(3) and ssl(3) manpages.
|
||||
|
||||
The OpenSSL manpages are installed in /usr/local/ssl/man/ (or a
|
||||
different directory if you specified one as described in INSTALL).
|
||||
In addition, you can read the most current versions at
|
||||
<URL: http://www.openssl.org/docs/>.
|
||||
|
||||
For information on parts of libcrypto that are not yet documented, you
|
||||
might want to read Ariel Glenn's documentation on SSLeay 0.9, OpenSSL's
|
||||
predecessor, at <URL: http://www.columbia.edu/~ariel/ssleay/>. Much
|
||||
of this still applies to OpenSSL.
|
||||
|
||||
There is some documentation about certificate extensions and PKCS#12
|
||||
in doc/openssl.txt
|
||||
|
||||
The original SSLeay documentation is included in OpenSSL as
|
||||
doc/ssleay.txt. It may be useful when none of the other resources
|
||||
help, but please note that it reflects the obsolete version SSLeay
|
||||
0.6.6.
|
||||
|
||||
|
||||
* How can I contact the OpenSSL developers?
|
||||
|
||||
The README file describes how to submit bug reports and patches to
|
||||
OpenSSL. Information on the OpenSSL mailing lists is available from
|
||||
<URL: http://www.openssl.org>.
|
||||
|
||||
|
||||
* Do I need patent licenses to use OpenSSL?
|
||||
|
||||
The patents section of the README file lists patents that may apply to
|
||||
you if you want to use OpenSSL. For information on intellectual
|
||||
property rights, please consult a lawyer. The OpenSSL team does not
|
||||
offer legal advice.
|
||||
|
||||
You can configure OpenSSL so as not to use RC5 and IDEA by using
|
||||
./config no-rc5 no-idea
|
||||
|
||||
Until the RSA patent expires, U.S. users may want to use
|
||||
./config no-rc5 no-idea no-rsa
|
||||
|
||||
Please note that you will *not* be able to communicate with most of
|
||||
the popular web browsers without RSA support.
|
||||
|
||||
|
||||
* Is OpenSSL thread-safe?
|
||||
|
||||
Yes (with limitations: an SSL connection may not concurrently be used
|
||||
by multiple threads). On Windows and many Unix systems, OpenSSL
|
||||
automatically uses the multi-threaded versions of the standard
|
||||
libraries. If your platform is not one of these, consult the INSTALL
|
||||
file.
|
||||
|
||||
Multi-threaded applications must provide two callback functions to
|
||||
OpenSSL. This is described in the threads(3) manpage.
|
||||
|
||||
|
||||
* Why do I get a "PRNG not seeded" error message?
|
||||
|
||||
Cryptographic software needs a source of unpredictable data to work
|
||||
correctly. Many open source operating systems provide a "randomness
|
||||
device" that serves this purpose. On other systems, applications have
|
||||
to call the RAND_add() or RAND_seed() function with appropriate data
|
||||
before generating keys or performing public key encryption.
|
||||
|
||||
Some broken applications do not do this. As of version 0.9.5, the
|
||||
OpenSSL functions that need randomness report an error if the random
|
||||
number generator has not been seeded with at least 128 bits of
|
||||
randomness. If this error occurs, please contact the author of the
|
||||
application you are using. It is likely that it never worked
|
||||
correctly. OpenSSL 0.9.5 and later make the error visible by refusing
|
||||
to perform potentially insecure encryption.
|
||||
|
||||
On systems without /dev/urandom, it is a good idea to use the Entropy
|
||||
Gathering Demon; see the RAND_egd() manpage for details.
|
||||
|
||||
Most components of the openssl command line tool try to use the
|
||||
file $HOME/.rnd (or $RANDFILE, if this environment variable is set)
|
||||
for seeding the PRNG. If this file does not exist or is too short,
|
||||
the "PRNG not seeded" error message may occur.
|
||||
|
||||
[Note to OpenSSL 0.9.5 users: The command "openssl rsa" in version
|
||||
0.9.5 does not do this and will fail on systems without /dev/urandom
|
||||
when trying to password-encrypt an RSA key! This is a bug in the
|
||||
library; try a later version instead.]
|
||||
|
||||
|
||||
* Why does the linker complain about undefined symbols?
|
||||
|
||||
Maybe the compilation was interrupted, and make doesn't notice that
|
||||
something is missing. Run "make clean; make".
|
||||
|
||||
If you used ./Configure instead of ./config, make sure that you
|
||||
selected the right target. File formats may differ slightly between
|
||||
OS versions (for example sparcv8/sparcv9, or a.out/elf).
|
||||
|
||||
In case you get errors about the following symbols, use the config
|
||||
option "no-asm", as described in INSTALL:
|
||||
|
||||
BF_cbc_encrypt, BF_decrypt, BF_encrypt, CAST_cbc_encrypt,
|
||||
CAST_decrypt, CAST_encrypt, RC4, RC5_32_cbc_encrypt, RC5_32_decrypt,
|
||||
RC5_32_encrypt, bn_add_words, bn_div_words, bn_mul_add_words,
|
||||
bn_mul_comba4, bn_mul_comba8, bn_mul_words, bn_sqr_comba4,
|
||||
bn_sqr_comba8, bn_sqr_words, bn_sub_words, des_decrypt3,
|
||||
des_ede3_cbc_encrypt, des_encrypt, des_encrypt2, des_encrypt3,
|
||||
des_ncbc_encrypt, md5_block_asm_host_order, sha1_block_asm_data_order
|
||||
|
||||
If none of these helps, you may want to try using the current snapshot.
|
||||
If the problem persists, please submit a bug report.
|
||||
|
||||
|
||||
* Where can I get a compiled version of OpenSSL?
|
||||
|
||||
Some applications that use OpenSSL are distributed in binary form.
|
||||
When using such an application, you don't need to install OpenSSL
|
||||
yourself; the application will include the required parts (e.g. DLLs).
|
||||
|
||||
If you want to install OpenSSL on a Windows system and you don't have
|
||||
a C compiler, read the "Mingw32" section of INSTALL.W32 for information
|
||||
on how to obtain and install the free GNU C compiler.
|
||||
|
||||
A number of Linux and *BSD distributions include OpenSSL.
|
||||
|
||||
|
||||
* I've compiled a program under Windows and it crashes: why?
|
||||
|
||||
This is usually because you've missed the comment in INSTALL.W32. You
|
||||
must link with the multithreaded DLL version of the VC++ runtime library
|
||||
otherwise the conflict will cause a program to crash: typically on the
|
||||
first BIO related read or write operation.
|
||||
|
||||
|
||||
* I've called <some function> and it fails, why?
|
||||
|
||||
Before submitting a report or asking in one of the mailing lists you
|
||||
should try to determine the cause. In particular you should call
|
||||
ERR_print_errors() or ERR_print_errors_fp() after the failed call
|
||||
and see if the message helps.
|
||||
|
||||
|
||||
* I just get a load of numbers for the error output, what do they mean?
|
||||
|
||||
The actual format is described in the ERR_print_errors() manual page.
|
||||
You should call the function ERR_load_crypto_strings() before hand and
|
||||
the message will be output in text form. If you can't do this (for example
|
||||
it is a pre-compiled binary) you can use the errstr utility on the error
|
||||
code itself (the hex digits after the second colon).
|
||||
|
||||
|
||||
* Why do I get errors about unknown algorithms?
|
||||
|
||||
This can happen under several circumstances such as reading in an
|
||||
encrypted private key or attempting to decrypt a PKCS#12 file. The cause
|
||||
is forgetting to load OpenSSL's table of algorithms with
|
||||
OpenSSL_add_all_algorithms(). See the manual page for more information.
|
||||
|
||||
|
||||
* How do I create certificates or certificate requests?
|
||||
|
||||
Check out the CA.pl(1) manual page. This provides a simple wrapper round
|
||||
the 'req', 'verify', 'ca' and 'pkcs12' utilities. For finer control check
|
||||
out the manual pages for the individual utilities and the certificate
|
||||
extensions documentation (currently in doc/openssl.txt).
|
||||
|
||||
|
||||
* Why can't I create certificate requests?
|
||||
|
||||
You typically get the error:
|
||||
|
||||
unable to find 'distinguished_name' in config
|
||||
problems making Certificate Request
|
||||
|
||||
This is because it can't find the configuration file. Check out the
|
||||
DIAGNOSTICS section of req(1) for more information.
|
||||
|
||||
|
||||
* Why does <SSL program> fail with a certificate verify error?
|
||||
|
||||
This problem is usually indicated by log messages saying something like
|
||||
"unable to get local issuer certificate" or "self signed certificate".
|
||||
When a certificate is verified its root CA must be "trusted" by OpenSSL
|
||||
this typically means that the CA certificate must be placed in a directory
|
||||
or file and the relevant program configured to read it. The OpenSSL program
|
||||
'verify' behaves in a similar way and issues similar error messages: check
|
||||
the verify(1) program manual page for more information.
|
||||
|
||||
|
||||
* How can I create DSA certificates?
|
||||
|
||||
Check the CA.pl(1) manual page for a DSA certificate example.
|
||||
|
||||
|
||||
* Why can't I make an SSL connection to a server using a DSA certificate?
|
||||
|
||||
Typically you'll see a message saying there are no shared ciphers when
|
||||
the same setup works fine with an RSA certificate. There are two possible
|
||||
causes. The client may not support connections to DSA servers most web
|
||||
browsers only support connections to servers supporting RSA cipher suites.
|
||||
The other cause is that a set of DH parameters has not been supplied to
|
||||
the server. DH parameters can be created with the dhparam(1) command and
|
||||
loaded using the SSL_CTX_set_tmp_dh() for example: check the source to
|
||||
s_server in apps/s_server.c for an example.
|
||||
|
||||
|
||||
* Why can't the OpenSSH configure script detect OpenSSL?
|
||||
|
||||
There is a problem with OpenSSH 1.2.2p1, in that the configure script
|
||||
can't find the installed OpenSSL libraries. The problem is actually
|
||||
a small glitch that is easily solved with the following patch to be
|
||||
applied to the OpenSSH distribution:
|
||||
|
||||
----- snip:start -----
|
||||
--- openssh-1.2.2p1/configure.in.orig Thu Mar 23 18:56:58 2000
|
||||
+++ openssh-1.2.2p1/configure.in Thu Mar 23 18:55:05 2000
|
||||
@@ -152,10 +152,10 @@
|
||||
AC_MSG_CHECKING([for OpenSSL/SSLeay directory])
|
||||
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
|
||||
if test ! -z "$ssldir" ; then
|
||||
- LIBS="$saved_LIBS -L$ssldir"
|
||||
+ LIBS="$saved_LIBS -L$ssldir/lib"
|
||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
||||
if test "x$need_dash_r" = "x1" ; then
|
||||
- LIBS="$LIBS -R$ssldir"
|
||||
+ LIBS="$LIBS -R$ssldir/lib"
|
||||
fi
|
||||
fi
|
||||
LIBS="$LIBS -lcrypto"
|
||||
--- openssh-1.2.2p1/configure.orig Thu Mar 23 18:55:02 2000
|
||||
+++ openssh-1.2.2p1/configure Thu Mar 23 18:57:08 2000
|
||||
@@ -1890,10 +1890,10 @@
|
||||
echo "configure:1891: checking for OpenSSL/SSLeay directory" >&5
|
||||
for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
|
||||
if test ! -z "$ssldir" ; then
|
||||
- LIBS="$saved_LIBS -L$ssldir"
|
||||
+ LIBS="$saved_LIBS -L$ssldir/lib"
|
||||
CFLAGS="$CFLAGS -I$ssldir/include"
|
||||
if test "x$need_dash_r" = "x1" ; then
|
||||
- LIBS="$LIBS -R$ssldir"
|
||||
+ LIBS="$LIBS -R$ssldir/lib"
|
||||
fi
|
||||
fi
|
||||
LIBS="$LIBS -lcrypto"
|
||||
----- snip:end -----
|
||||
@@ -1,162 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
#
|
||||
# CA - wrapper around ca to make it easier to use ... basically ca requires
|
||||
# some setup stuff to be done before you can use it and this makes
|
||||
# things easier between now and when Eric is convinced to fix it :-)
|
||||
#
|
||||
# CA -newca ... will setup the right stuff
|
||||
# CA -newreq ... will generate a certificate request
|
||||
# CA -sign ... will sign the generated request and output
|
||||
#
|
||||
# At the end of that grab newreq.pem and newcert.pem (one has the key
|
||||
# and the other the certificate) and cat them together and that is what
|
||||
# you want/need ... I'll make even this a little cleaner later.
|
||||
#
|
||||
#
|
||||
# 12-Jan-96 tjh Added more things ... including CA -signcert which
|
||||
# converts a certificate to a request and then signs it.
|
||||
# 10-Jan-96 eay Fixed a few more bugs and added the SSLEAY_CONFIG
|
||||
# environment variable so this can be driven from
|
||||
# a script.
|
||||
# 25-Jul-96 eay Cleaned up filenames some more.
|
||||
# 11-Jun-96 eay Fixed a few filename missmatches.
|
||||
# 03-May-96 eay Modified to use 'ssleay cmd' instead of 'cmd'.
|
||||
# 18-Apr-96 tjh Original hacking
|
||||
#
|
||||
# Tim Hudson
|
||||
# [email protected]
|
||||
#
|
||||
|
||||
# 27-Apr-98 snh Translation into perl, fix existing CA bug.
|
||||
#
|
||||
#
|
||||
# Steve Henson
|
||||
# [email protected]
|
||||
|
||||
# default openssl.cnf file has setup as per the following
|
||||
# demoCA ... where everything is stored
|
||||
|
||||
$DAYS="-days 365";
|
||||
$REQ="openssl req $SSLEAY_CONFIG";
|
||||
$CA="openssl ca $SSLEAY_CONFIG";
|
||||
$VERIFY="openssl verify";
|
||||
$X509="openssl x509";
|
||||
$PKCS12="openssl pkcs12";
|
||||
|
||||
$CATOP="./demoCA";
|
||||
$CAKEY="cakey.pem";
|
||||
$CACERT="cacert.pem";
|
||||
|
||||
$DIRMODE = 0777;
|
||||
|
||||
$RET = 0;
|
||||
|
||||
foreach (@ARGV) {
|
||||
if ( /^(-\?|-h|-help)$/ ) {
|
||||
print STDERR "usage: CA -newcert|-newreq|-newca|-sign|-verify\n";
|
||||
exit 0;
|
||||
} elsif (/^-newcert$/) {
|
||||
# create a certificate
|
||||
system ("$REQ -new -x509 -keyout newreq.pem -out newreq.pem $DAYS");
|
||||
$RET=$?;
|
||||
print "Certificate (and private key) is in newreq.pem\n"
|
||||
} elsif (/^-newreq$/) {
|
||||
# create a certificate request
|
||||
system ("$REQ -new -keyout newreq.pem -out newreq.pem $DAYS");
|
||||
$RET=$?;
|
||||
print "Request (and private key) is in newreq.pem\n";
|
||||
} elsif (/^-newca$/) {
|
||||
# if explicitly asked for or it doesn't exist then setup the
|
||||
# directory structure that Eric likes to manage things
|
||||
$NEW="1";
|
||||
if ( "$NEW" || ! -f "${CATOP}/serial" ) {
|
||||
# create the directory hierarchy
|
||||
mkdir $CATOP, $DIRMODE;
|
||||
mkdir "${CATOP}/certs", $DIRMODE;
|
||||
mkdir "${CATOP}/crl", $DIRMODE ;
|
||||
mkdir "${CATOP}/newcerts", $DIRMODE;
|
||||
mkdir "${CATOP}/private", $DIRMODE;
|
||||
open OUT, ">${CATOP}/serial";
|
||||
print OUT "01\n";
|
||||
close OUT;
|
||||
open OUT, ">${CATOP}/index.txt";
|
||||
close OUT;
|
||||
}
|
||||
if ( ! -f "${CATOP}/private/$CAKEY" ) {
|
||||
print "CA certificate filename (or enter to create)\n";
|
||||
$FILE = <STDIN>;
|
||||
|
||||
chop $FILE;
|
||||
|
||||
# ask user for existing CA certificate
|
||||
if ($FILE) {
|
||||
cp_pem($FILE,"${CATOP}/private/$CAKEY", "PRIVATE");
|
||||
cp_pem($FILE,"${CATOP}/$CACERT", "CERTIFICATE");
|
||||
$RET=$?;
|
||||
} else {
|
||||
print "Making CA certificate ...\n";
|
||||
system ("$REQ -new -x509 -keyout " .
|
||||
"${CATOP}/private/$CAKEY -out ${CATOP}/$CACERT $DAYS");
|
||||
$RET=$?;
|
||||
}
|
||||
}
|
||||
} elsif (/^-pkcs12$/) {
|
||||
my $cname = $ARGV[1];
|
||||
$cname = "My Certificate" unless defined $cname;
|
||||
system ("$PKCS12 -in newcert.pem -inkey newreq.pem " .
|
||||
"-certfile ${CATOP}/$CACERT -out newcert.p12 " .
|
||||
"-export -name \"$cname\"");
|
||||
$RET=$?;
|
||||
exit $RET;
|
||||
} elsif (/^-xsign$/) {
|
||||
system ("$CA -policy policy_anything -infiles newreq.pem");
|
||||
$RET=$?;
|
||||
} elsif (/^(-sign|-signreq)$/) {
|
||||
system ("$CA -policy policy_anything -out newcert.pem " .
|
||||
"-infiles newreq.pem");
|
||||
$RET=$?;
|
||||
print "Signed certificate is in newcert.pem\n";
|
||||
} elsif (/^-signcert$/) {
|
||||
system ("$X509 -x509toreq -in newreq.pem -signkey newreq.pem " .
|
||||
"-out tmp.pem");
|
||||
system ("$CA -policy policy_anything -out newcert.pem " .
|
||||
"-infiles tmp.pem");
|
||||
$RET = $?;
|
||||
print "Signed certificate is in newcert.pem\n";
|
||||
} elsif (/^-verify$/) {
|
||||
if (shift) {
|
||||
foreach $j (@ARGV) {
|
||||
system ("$VERIFY -CAfile $CATOP/$CACERT $j");
|
||||
$RET=$? if ($? != 0);
|
||||
}
|
||||
exit $RET;
|
||||
} else {
|
||||
system ("$VERIFY -CAfile $CATOP/$CACERT newcert.pem");
|
||||
$RET=$?;
|
||||
exit 0;
|
||||
}
|
||||
} else {
|
||||
print STDERR "Unknown arg $_\n";
|
||||
print STDERR "usage: CA -newcert|-newreq|-newca|-sign|-verify\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
exit $RET;
|
||||
|
||||
sub cp_pem {
|
||||
my ($infile, $outfile, $bound) = @_;
|
||||
open IN, $infile;
|
||||
open OUT, ">$outfile";
|
||||
my $flag = 0;
|
||||
while (<IN>) {
|
||||
$flag = 1 if (/^-----BEGIN.*$bound/) ;
|
||||
print OUT $_ if ($flag);
|
||||
if (/^-----END.*$bound/) {
|
||||
close IN;
|
||||
close OUT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,818 +0,0 @@
|
||||
#
|
||||
# apps/Makefile.ssl
|
||||
#
|
||||
|
||||
DIR= apps
|
||||
TOP= ..
|
||||
CC= cc
|
||||
INCLUDES= -I../include
|
||||
CFLAG= -g -static
|
||||
INSTALL_PREFIX=
|
||||
INSTALLTOP= /usr/local/ssl
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
PERL=/usr/local/bin/perl
|
||||
RM= rm -f
|
||||
|
||||
PEX_LIBS=
|
||||
EX_LIBS=
|
||||
|
||||
CFLAGS= -DMONOLITH $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile makeapps.com install.com
|
||||
|
||||
DLIBCRYPTO=../libcrypto.a
|
||||
DLIBSSL=../libssl.a
|
||||
LIBCRYPTO=-L.. -lcrypto
|
||||
LIBSSL=-L.. -lssl
|
||||
|
||||
PROGRAM= openssl
|
||||
|
||||
SCRIPTS=CA.sh CA.pl der_chop
|
||||
|
||||
EXE= $(PROGRAM)
|
||||
|
||||
E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
|
||||
ca crl rsa dsa dsaparam \
|
||||
x509 genrsa gendsa s_server s_client speed \
|
||||
s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \
|
||||
pkcs8 spkac smime rand
|
||||
|
||||
PROGS= $(PROGRAM).c
|
||||
|
||||
A_OBJ=apps.o
|
||||
A_SRC=apps.c
|
||||
S_OBJ= s_cb.o s_socket.o
|
||||
S_SRC= s_cb.c s_socket.c
|
||||
RAND_OBJ=app_rand.o
|
||||
RAND_SRC=app_rand.c
|
||||
|
||||
E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o \
|
||||
ca.o pkcs7.o crl2p7.o crl.o \
|
||||
rsa.o dsa.o dsaparam.o \
|
||||
x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
|
||||
s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
|
||||
ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o
|
||||
|
||||
E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \
|
||||
pkcs7.c crl2p7.c crl.c \
|
||||
rsa.c dsa.c dsaparam.c \
|
||||
x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
|
||||
s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
|
||||
ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c
|
||||
|
||||
SRC=$(E_SRC)
|
||||
|
||||
EXHEADER=
|
||||
HEADER= apps.h progs.h s_apps.h \
|
||||
testdsa.h testrsa.h \
|
||||
$(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
@(cd ..; $(MAKE) DIRS=$(DIR) all)
|
||||
|
||||
all: exe
|
||||
|
||||
exe: $(EXE)
|
||||
|
||||
req: sreq.o $(A_OBJ) $(DLIBCRYPTO)
|
||||
$(CC) -o req $(CFLAG) sreq.o $(A_OBJ) $(RAND_OBJ) $(PEX_LIBS) $(LIBCRYPTO) $(EX_LIBS)
|
||||
|
||||
sreq.o: req.c
|
||||
$(CC) -c $(INCLUDES) $(CFLAG) -o sreq.o req.c
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
install:
|
||||
@for i in $(EXE); \
|
||||
do \
|
||||
(echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
|
||||
done;
|
||||
@for i in $(SCRIPTS); \
|
||||
do \
|
||||
(echo installing $$i; \
|
||||
cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
|
||||
chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
|
||||
done
|
||||
@cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR); \
|
||||
chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(SRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
|
||||
rm -f req
|
||||
|
||||
$(DLIBSSL):
|
||||
(cd ../ssl; $(MAKE))
|
||||
|
||||
$(DLIBCRYPTO):
|
||||
(cd ../crypto; $(MAKE))
|
||||
|
||||
$(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
|
||||
$(RM) $(PROGRAM)
|
||||
$(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
|
||||
@(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
|
||||
|
||||
progs.h: progs.pl
|
||||
$(PERL) progs.pl $(E_EXE) >progs.h
|
||||
$(RM) $(PROGRAM).o
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
app_rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
app_rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
app_rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
app_rand.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
app_rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
app_rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
app_rand.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
app_rand.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
app_rand.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
app_rand.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
app_rand.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
|
||||
app_rand.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
app_rand.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
app_rand.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
app_rand.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
app_rand.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
apps.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
apps.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
apps.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
apps.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
apps.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
apps.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
apps.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
apps.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
apps.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
apps.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
apps.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
apps.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
apps.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
apps.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
apps.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
apps.o: ../include/openssl/x509_vfy.h apps.h
|
||||
asn1pars.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
asn1pars.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
asn1pars.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
asn1pars.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
asn1pars.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
asn1pars.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
asn1pars.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
asn1pars.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
asn1pars.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
asn1pars.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
asn1pars.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
asn1pars.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
asn1pars.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
asn1pars.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
asn1pars.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
asn1pars.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
asn1pars.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
ca.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
ca.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
ca.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
ca.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
ca.o: ../include/openssl/des.h ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
ca.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
ca.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
ca.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
ca.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
ca.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
ca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
ca.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
ca.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
ca.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
ca.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
ca.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
ca.o: ../include/openssl/stack.h ../include/openssl/txt_db.h
|
||||
ca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
|
||||
ca.o: ../include/openssl/x509v3.h apps.h
|
||||
ciphers.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
ciphers.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
ciphers.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
ciphers.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
ciphers.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
ciphers.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
ciphers.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
ciphers.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
ciphers.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
ciphers.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
ciphers.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
ciphers.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
ciphers.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
ciphers.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
ciphers.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
ciphers.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
ciphers.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
ciphers.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
ciphers.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
ciphers.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
crl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
crl.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
crl.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
crl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
crl.o: ../include/openssl/des.h ../include/openssl/dh.h
|
||||
crl.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
|
||||
crl.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
crl.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
crl.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
crl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
crl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
crl.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
crl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
crl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
crl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
crl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
crl.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
crl.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
|
||||
crl.o: ../include/openssl/x509v3.h apps.h
|
||||
crl2p7.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
crl2p7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
crl2p7.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
crl2p7.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
crl2p7.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
crl2p7.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
crl2p7.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
crl2p7.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
crl2p7.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
crl2p7.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
crl2p7.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
crl2p7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
crl2p7.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
crl2p7.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
crl2p7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
crl2p7.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
crl2p7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
dgst.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
dgst.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
dgst.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
dgst.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
dgst.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
dgst.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
dgst.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
dgst.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
dgst.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
dgst.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
dgst.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
dgst.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
dgst.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
dgst.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
dgst.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
dgst.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
dgst.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
dh.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
dh.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
dh.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
dh.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
dh.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
dh.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
dh.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
dh.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
dh.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
dh.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
dh.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
dh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
dh.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
dh.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
dh.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
dh.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
dh.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
dsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
dsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
dsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
dsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
dsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
dsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
dsa.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
dsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
dsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
dsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
dsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
dsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
dsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
dsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
dsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
dsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
dsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
dsaparam.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
dsaparam.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
dsaparam.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
dsaparam.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
dsaparam.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
dsaparam.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
dsaparam.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
dsaparam.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
dsaparam.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
dsaparam.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
dsaparam.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
dsaparam.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
dsaparam.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
dsaparam.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
dsaparam.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
dsaparam.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
dsaparam.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
enc.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
enc.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
enc.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
enc.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
enc.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
enc.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
enc.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
enc.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
enc.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
enc.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
enc.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
enc.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
enc.o: ../include/openssl/rand.h ../include/openssl/rc2.h
|
||||
enc.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
enc.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
enc.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
enc.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
enc.o: ../include/openssl/x509_vfy.h apps.h
|
||||
errstr.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
errstr.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
errstr.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
errstr.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
errstr.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
errstr.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
errstr.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
errstr.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
errstr.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
errstr.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
errstr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
errstr.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
errstr.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
errstr.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
errstr.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
errstr.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
errstr.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
errstr.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
errstr.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
errstr.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
gendh.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
gendh.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
gendh.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
gendh.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
gendh.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
gendh.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
gendh.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
gendh.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
gendh.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
gendh.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
gendh.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
gendh.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
gendh.o: ../include/openssl/rand.h ../include/openssl/rc2.h
|
||||
gendh.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
gendh.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
gendh.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
gendh.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
gendh.o: ../include/openssl/x509_vfy.h apps.h
|
||||
gendsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
gendsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
gendsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
gendsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
gendsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
gendsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
gendsa.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
gendsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
gendsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
gendsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
gendsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
gendsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
gendsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
gendsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
gendsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
gendsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
gendsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
genrsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
genrsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
genrsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
genrsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
genrsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
genrsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
genrsa.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
genrsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
genrsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
genrsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
genrsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
genrsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
genrsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
genrsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
genrsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
genrsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
genrsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
nseq.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
nseq.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
nseq.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
nseq.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
nseq.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
nseq.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
nseq.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
nseq.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
nseq.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
nseq.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
nseq.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
nseq.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
nseq.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
nseq.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
nseq.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
nseq.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
nseq.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
openssl.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
openssl.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
openssl.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
openssl.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
openssl.o: ../include/openssl/des.h ../include/openssl/dh.h
|
||||
openssl.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
|
||||
openssl.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
openssl.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
openssl.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
openssl.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
openssl.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
openssl.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
openssl.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
openssl.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
openssl.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
openssl.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
openssl.o: ../include/openssl/sha.h ../include/openssl/ssl.h
|
||||
openssl.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
|
||||
openssl.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
|
||||
openssl.o: ../include/openssl/tls1.h ../include/openssl/x509.h
|
||||
openssl.o: ../include/openssl/x509_vfy.h apps.h progs.h s_apps.h
|
||||
passwd.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
passwd.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
passwd.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
passwd.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
passwd.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
passwd.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
passwd.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
passwd.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
passwd.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
passwd.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
passwd.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
|
||||
passwd.o: ../include/openssl/rand.h ../include/openssl/rc2.h
|
||||
passwd.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
passwd.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
passwd.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
passwd.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
passwd.o: ../include/openssl/x509_vfy.h apps.h
|
||||
pkcs12.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
pkcs12.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
pkcs12.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
pkcs12.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
pkcs12.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
pkcs12.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
pkcs12.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
pkcs12.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
pkcs12.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
pkcs12.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
pkcs12.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
pkcs12.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
|
||||
pkcs12.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
pkcs12.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
pkcs12.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
pkcs12.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
pkcs12.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
pkcs12.o: ../include/openssl/x509_vfy.h apps.h
|
||||
pkcs7.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
pkcs7.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
pkcs7.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
pkcs7.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
pkcs7.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
pkcs7.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
pkcs7.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
pkcs7.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
pkcs7.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
pkcs7.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
pkcs7.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
pkcs7.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
pkcs7.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
pkcs7.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
pkcs7.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
pkcs7.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
pkcs7.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
pkcs8.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
pkcs8.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
pkcs8.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
pkcs8.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
pkcs8.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
pkcs8.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
pkcs8.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
pkcs8.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
pkcs8.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
pkcs8.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
pkcs8.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
pkcs8.o: ../include/openssl/pem2.h ../include/openssl/pkcs12.h
|
||||
pkcs8.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
pkcs8.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
pkcs8.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
pkcs8.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
pkcs8.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
pkcs8.o: ../include/openssl/x509_vfy.h apps.h
|
||||
rand.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
rand.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
rand.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
rand.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
rand.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
rand.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
rand.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
rand.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
rand.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
rand.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
rand.o: ../include/openssl/opensslv.h ../include/openssl/pkcs7.h
|
||||
rand.o: ../include/openssl/rand.h ../include/openssl/rc2.h
|
||||
rand.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
rand.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
rand.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
rand.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
rand.o: ../include/openssl/x509_vfy.h apps.h
|
||||
req.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
req.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
req.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
req.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
req.o: ../include/openssl/des.h ../include/openssl/dh.h
|
||||
req.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
|
||||
req.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
req.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
req.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
req.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
req.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
req.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
req.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
req.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
req.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
req.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
req.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
req.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
|
||||
req.o: ../include/openssl/x509v3.h apps.h
|
||||
rsa.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
rsa.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
rsa.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
rsa.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
rsa.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
rsa.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
rsa.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
rsa.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
rsa.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
rsa.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
rsa.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
rsa.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
rsa.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
rsa.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
rsa.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
rsa.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
rsa.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
s_cb.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
s_cb.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
s_cb.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
s_cb.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
s_cb.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
s_cb.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
s_cb.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
s_cb.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
s_cb.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
s_cb.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
s_cb.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
s_cb.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
s_cb.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
s_cb.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
s_cb.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
s_cb.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
s_cb.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
s_cb.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
s_cb.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
s_cb.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h s_apps.h
|
||||
s_client.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
s_client.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
s_client.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
s_client.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
s_client.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
s_client.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
s_client.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
s_client.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
s_client.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
s_client.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
s_client.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
s_client.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
s_client.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
s_client.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
s_client.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
s_client.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
s_client.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
s_client.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
s_client.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
s_client.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
s_client.o: s_apps.h
|
||||
s_server.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
s_server.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
s_server.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
s_server.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
s_server.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
s_server.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
s_server.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
s_server.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
s_server.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
s_server.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
s_server.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
s_server.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
s_server.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
s_server.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
s_server.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
s_server.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
s_server.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
s_server.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
s_server.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
s_server.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
s_server.o: s_apps.h
|
||||
s_socket.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
s_socket.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
s_socket.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
s_socket.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
s_socket.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
s_socket.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
s_socket.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
s_socket.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
s_socket.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
s_socket.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
s_socket.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
s_socket.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
s_socket.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
s_socket.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
s_socket.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
s_socket.o: ../include/openssl/sha.h ../include/openssl/ssl.h
|
||||
s_socket.o: ../include/openssl/ssl2.h ../include/openssl/ssl23.h
|
||||
s_socket.o: ../include/openssl/ssl3.h ../include/openssl/stack.h
|
||||
s_socket.o: ../include/openssl/tls1.h ../include/openssl/x509.h
|
||||
s_socket.o: ../include/openssl/x509_vfy.h apps.h s_apps.h
|
||||
s_time.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
s_time.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
s_time.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
s_time.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
s_time.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
s_time.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
s_time.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
s_time.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
s_time.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
s_time.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
s_time.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
s_time.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
s_time.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
s_time.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
s_time.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
s_time.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
s_time.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
s_time.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
s_time.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
s_time.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
s_time.o: s_apps.h
|
||||
sess_id.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
sess_id.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
sess_id.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
sess_id.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
sess_id.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
sess_id.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
sess_id.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
sess_id.o: ../include/openssl/idea.h ../include/openssl/lhash.h
|
||||
sess_id.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
sess_id.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
sess_id.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
sess_id.o: ../include/openssl/pem.h ../include/openssl/pem2.h
|
||||
sess_id.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
sess_id.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
sess_id.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
sess_id.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
sess_id.o: ../include/openssl/ssl.h ../include/openssl/ssl2.h
|
||||
sess_id.o: ../include/openssl/ssl23.h ../include/openssl/ssl3.h
|
||||
sess_id.o: ../include/openssl/stack.h ../include/openssl/tls1.h
|
||||
sess_id.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
smime.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
smime.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
smime.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
smime.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
smime.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
smime.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
smime.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
smime.o: ../include/openssl/idea.h ../include/openssl/md2.h
|
||||
smime.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
smime.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
smime.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
smime.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
smime.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
smime.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
smime.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
smime.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
smime.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
speed.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
speed.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
speed.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
speed.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
speed.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
speed.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
speed.o: ../include/openssl/err.h ../include/openssl/evp.h
|
||||
speed.o: ../include/openssl/hmac.h ../include/openssl/idea.h
|
||||
speed.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
speed.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
speed.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
speed.o: ../include/openssl/pkcs7.h ../include/openssl/rand.h
|
||||
speed.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
speed.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
speed.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
speed.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
speed.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ./testdsa.h
|
||||
speed.o: ./testrsa.h apps.h
|
||||
spkac.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
spkac.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
spkac.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
spkac.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
spkac.o: ../include/openssl/des.h ../include/openssl/dh.h
|
||||
spkac.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
|
||||
spkac.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
spkac.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
spkac.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
spkac.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
spkac.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
spkac.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
spkac.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
spkac.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
spkac.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
spkac.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
spkac.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
spkac.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h apps.h
|
||||
verify.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
verify.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
verify.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
verify.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
verify.o: ../include/openssl/des.h ../include/openssl/dh.h
|
||||
verify.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
|
||||
verify.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
verify.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
verify.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
verify.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
verify.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
verify.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
verify.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
verify.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
verify.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
verify.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
verify.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
verify.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
|
||||
verify.o: ../include/openssl/x509v3.h apps.h
|
||||
version.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
version.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
version.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
version.o: ../include/openssl/crypto.h ../include/openssl/des.h
|
||||
version.o: ../include/openssl/dh.h ../include/openssl/dsa.h
|
||||
version.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h
|
||||
version.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
version.o: ../include/openssl/md2.h ../include/openssl/md5.h
|
||||
version.o: ../include/openssl/mdc2.h ../include/openssl/objects.h
|
||||
version.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
version.o: ../include/openssl/pkcs7.h ../include/openssl/rc2.h
|
||||
version.o: ../include/openssl/rc4.h ../include/openssl/rc5.h
|
||||
version.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
|
||||
version.o: ../include/openssl/safestack.h ../include/openssl/sha.h
|
||||
version.o: ../include/openssl/stack.h ../include/openssl/x509.h
|
||||
version.o: ../include/openssl/x509_vfy.h apps.h
|
||||
x509.o: ../include/openssl/asn1.h ../include/openssl/bio.h
|
||||
x509.o: ../include/openssl/blowfish.h ../include/openssl/bn.h
|
||||
x509.o: ../include/openssl/buffer.h ../include/openssl/cast.h
|
||||
x509.o: ../include/openssl/conf.h ../include/openssl/crypto.h
|
||||
x509.o: ../include/openssl/des.h ../include/openssl/dh.h
|
||||
x509.o: ../include/openssl/dsa.h ../include/openssl/e_os.h
|
||||
x509.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
x509.o: ../include/openssl/evp.h ../include/openssl/idea.h
|
||||
x509.o: ../include/openssl/lhash.h ../include/openssl/md2.h
|
||||
x509.o: ../include/openssl/md5.h ../include/openssl/mdc2.h
|
||||
x509.o: ../include/openssl/objects.h ../include/openssl/opensslconf.h
|
||||
x509.o: ../include/openssl/opensslv.h ../include/openssl/pem.h
|
||||
x509.o: ../include/openssl/pem2.h ../include/openssl/pkcs7.h
|
||||
x509.o: ../include/openssl/rc2.h ../include/openssl/rc4.h
|
||||
x509.o: ../include/openssl/rc5.h ../include/openssl/ripemd.h
|
||||
x509.o: ../include/openssl/rsa.h ../include/openssl/safestack.h
|
||||
x509.o: ../include/openssl/sha.h ../include/openssl/stack.h
|
||||
x509.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h
|
||||
x509.o: ../include/openssl/x509v3.h apps.h
|
||||
@@ -1,213 +0,0 @@
|
||||
/* apps/app_rand.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#define NON_MAIN
|
||||
#include "apps.h"
|
||||
#undef NON_MAIN
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
|
||||
static int seeded = 0;
|
||||
static int egdsocket = 0;
|
||||
|
||||
int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn)
|
||||
{
|
||||
int consider_randfile = (file == NULL);
|
||||
char buffer[200];
|
||||
|
||||
#ifdef WINDOWS
|
||||
BIO_printf(bio_e,"Loading 'screen' into random state -");
|
||||
BIO_flush(bio_e);
|
||||
RAND_screen();
|
||||
BIO_printf(bio_e," done\n");
|
||||
#endif
|
||||
|
||||
if (file == NULL)
|
||||
file = RAND_file_name(buffer, sizeof buffer);
|
||||
else if (RAND_egd(file) > 0)
|
||||
{
|
||||
/* we try if the given filename is an EGD socket.
|
||||
if it is, we don't write anything back to the file. */
|
||||
egdsocket = 1;
|
||||
return 1;
|
||||
}
|
||||
if (file == NULL || !RAND_load_file(file, -1))
|
||||
{
|
||||
if (RAND_status() == 0 && !dont_warn)
|
||||
{
|
||||
BIO_printf(bio_e,"unable to load 'random state'\n");
|
||||
BIO_printf(bio_e,"This means that the random number generator has not been seeded\n");
|
||||
BIO_printf(bio_e,"with much random data.\n");
|
||||
if (consider_randfile) /* explanation does not apply when a file is explicitly named */
|
||||
{
|
||||
BIO_printf(bio_e,"Consider setting the RANDFILE environment variable to point at a file that\n");
|
||||
BIO_printf(bio_e,"'random' data can be kept in (the file will be overwritten).\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
seeded = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
long app_RAND_load_files(char *name)
|
||||
{
|
||||
char *p,*n;
|
||||
int last;
|
||||
long tot=0;
|
||||
int egd;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
last=0;
|
||||
for (p=name; ((*p != '\0') && (*p != LIST_SEPARATOR_CHAR)); p++);
|
||||
if (*p == '\0') last=1;
|
||||
*p='\0';
|
||||
n=name;
|
||||
name=p+1;
|
||||
if (*n == '\0') break;
|
||||
|
||||
egd=RAND_egd(n);
|
||||
if (egd > 0) tot+=egd;
|
||||
tot+=RAND_load_file(n,-1);
|
||||
if (last) break;
|
||||
}
|
||||
if (tot > 512)
|
||||
app_RAND_allow_write_file();
|
||||
return(tot);
|
||||
}
|
||||
|
||||
int app_RAND_write_file(const char *file, BIO *bio_e)
|
||||
{
|
||||
char buffer[200];
|
||||
|
||||
if (egdsocket || !seeded)
|
||||
/* If we did not manage to read the seed file,
|
||||
* we should not write a low-entropy seed file back --
|
||||
* it would suppress a crucial warning the next time
|
||||
* we want to use it. */
|
||||
return 0;
|
||||
|
||||
if (file == NULL)
|
||||
file = RAND_file_name(buffer, sizeof buffer);
|
||||
if (file == NULL || !RAND_write_file(file))
|
||||
{
|
||||
BIO_printf(bio_e,"unable to write 'random state'\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void app_RAND_allow_write_file(void)
|
||||
{
|
||||
seeded = 1;
|
||||
}
|
||||
@@ -1,520 +0,0 @@
|
||||
/* apps/dhparam.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NO_DH
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#ifndef NO_DSA
|
||||
#include <openssl/dsa.h>
|
||||
#endif
|
||||
|
||||
#undef PROG
|
||||
#define PROG dhparam_main
|
||||
|
||||
#define DEFBITS 512
|
||||
|
||||
/* -inform arg - input format - default PEM (DER or PEM)
|
||||
* -outform arg - output format - default PEM
|
||||
* -in arg - input file - default stdin
|
||||
* -out arg - output file - default stdout
|
||||
* -dsaparam - read or generate DSA parameters, convert to DH
|
||||
* -check - check the parameters are ok
|
||||
* -noout
|
||||
* -text
|
||||
* -C
|
||||
*/
|
||||
|
||||
static void MS_CALLBACK dh_cb(int p, int n, void *arg);
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
DH *dh=NULL;
|
||||
int i,badops=0,text=0;
|
||||
#ifndef NO_DSA
|
||||
int dsaparam=0;
|
||||
#endif
|
||||
BIO *in=NULL,*out=NULL;
|
||||
int informat,outformat,check=0,noout=0,C=0,ret=1;
|
||||
char *infile,*outfile,*prog;
|
||||
char *inrand=NULL;
|
||||
int num = 0, g = 0;
|
||||
|
||||
apps_startup();
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||
|
||||
infile=NULL;
|
||||
outfile=NULL;
|
||||
informat=FORMAT_PEM;
|
||||
outformat=FORMAT_PEM;
|
||||
|
||||
prog=argv[0];
|
||||
argc--;
|
||||
argv++;
|
||||
while (argc >= 1)
|
||||
{
|
||||
if (strcmp(*argv,"-inform") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
informat=str2fmt(*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-outform") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
outformat=str2fmt(*(++argv));
|
||||
}
|
||||
else if (strcmp(*argv,"-in") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
infile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-out") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
outfile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-check") == 0)
|
||||
check=1;
|
||||
else if (strcmp(*argv,"-text") == 0)
|
||||
text=1;
|
||||
#ifndef NO_DSA
|
||||
else if (strcmp(*argv,"-dsaparam") == 0)
|
||||
dsaparam=1;
|
||||
#endif
|
||||
else if (strcmp(*argv,"-C") == 0)
|
||||
C=1;
|
||||
else if (strcmp(*argv,"-noout") == 0)
|
||||
noout=1;
|
||||
else if (strcmp(*argv,"-2") == 0)
|
||||
g=2;
|
||||
else if (strcmp(*argv,"-5") == 0)
|
||||
g=5;
|
||||
else if (strcmp(*argv,"-rand") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
inrand= *(++argv);
|
||||
}
|
||||
else if (((sscanf(*argv,"%d",&num) == 0) || (num <= 0)))
|
||||
goto bad;
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
|
||||
if (badops)
|
||||
{
|
||||
bad:
|
||||
BIO_printf(bio_err,"%s [options] [numbits]\n",prog);
|
||||
BIO_printf(bio_err,"where options are\n");
|
||||
BIO_printf(bio_err," -inform arg input format - one of DER PEM\n");
|
||||
BIO_printf(bio_err," -outform arg output format - one of DER PEM\n");
|
||||
BIO_printf(bio_err," -in arg input file\n");
|
||||
BIO_printf(bio_err," -out arg output file\n");
|
||||
#ifndef NO_DSA
|
||||
BIO_printf(bio_err," -dsaparam read or generate DSA parameters, convert to DH\n");
|
||||
#endif
|
||||
BIO_printf(bio_err," -check check the DH parameters\n");
|
||||
BIO_printf(bio_err," -text print a text form of the DH parameters\n");
|
||||
BIO_printf(bio_err," -C Output C code\n");
|
||||
BIO_printf(bio_err," -2 generate parameters using 2 as the generator value\n");
|
||||
BIO_printf(bio_err," -5 generate parameters using 5 as the generator value\n");
|
||||
BIO_printf(bio_err," numbits number of bits in to generate (default 512)\n");
|
||||
BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
||||
BIO_printf(bio_err," - load the file (or the files in the directory) into\n");
|
||||
BIO_printf(bio_err," the random number generator\n");
|
||||
BIO_printf(bio_err," -noout no output\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
|
||||
if (g && !num)
|
||||
num = DEFBITS;
|
||||
|
||||
#ifndef NO_DSA
|
||||
if (dsaparam)
|
||||
{
|
||||
if (g)
|
||||
{
|
||||
BIO_printf(bio_err, "generator may not be chosen for DSA parameters\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* DH parameters */
|
||||
if (num && !g)
|
||||
g = 2;
|
||||
}
|
||||
|
||||
if(num) {
|
||||
|
||||
if (!app_RAND_load_file(NULL, bio_err, 1) && inrand == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"warning, not much extra random data, consider using the -rand option\n");
|
||||
}
|
||||
if (inrand != NULL)
|
||||
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
|
||||
app_RAND_load_files(inrand));
|
||||
|
||||
#ifndef NO_DSA
|
||||
if (dsaparam)
|
||||
{
|
||||
DSA *dsa;
|
||||
|
||||
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
|
||||
dsa = DSA_generate_parameters(num, NULL, 0, NULL, NULL, dh_cb, bio_err);
|
||||
if (dsa == NULL)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
dh = DSA_dup_DH(dsa);
|
||||
DSA_free(dsa);
|
||||
if (dh == NULL)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
BIO_printf(bio_err,"Generating DH parameters, %d bit long safe prime, generator %d\n",num,g);
|
||||
BIO_printf(bio_err,"This is going to take a long time\n");
|
||||
dh=DH_generate_parameters(num,g,dh_cb,bio_err);
|
||||
|
||||
if (dh == NULL)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
app_RAND_write_file(NULL, bio_err);
|
||||
} else {
|
||||
|
||||
in=BIO_new(BIO_s_file());
|
||||
if (in == NULL)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (infile == NULL)
|
||||
BIO_set_fp(in,stdin,BIO_NOCLOSE);
|
||||
else
|
||||
{
|
||||
if (BIO_read_filename(in,infile) <= 0)
|
||||
{
|
||||
perror(infile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (informat != FORMAT_ASN1 && informat != FORMAT_PEM)
|
||||
{
|
||||
BIO_printf(bio_err,"bad input format specified\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
#ifndef NO_DSA
|
||||
if (dsaparam)
|
||||
{
|
||||
DSA *dsa;
|
||||
|
||||
if (informat == FORMAT_ASN1)
|
||||
dsa=d2i_DSAparams_bio(in,NULL);
|
||||
else /* informat == FORMAT_PEM */
|
||||
dsa=PEM_read_bio_DSAparams(in,NULL,NULL,NULL);
|
||||
|
||||
if (dsa == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load DSA parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
dh = DSA_dup_DH(dsa);
|
||||
DSA_free(dsa);
|
||||
if (dh == NULL)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (informat == FORMAT_ASN1)
|
||||
dh=d2i_DHparams_bio(in,NULL);
|
||||
else /* informat == FORMAT_PEM */
|
||||
dh=PEM_read_bio_DHparams(in,NULL,NULL,NULL);
|
||||
|
||||
if (dh == NULL)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to load DH parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
/* dh != NULL */
|
||||
}
|
||||
|
||||
out=BIO_new(BIO_s_file());
|
||||
if (out == NULL)
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (outfile == NULL)
|
||||
BIO_set_fp(out,stdout,BIO_NOCLOSE);
|
||||
else
|
||||
{
|
||||
if (BIO_write_filename(out,outfile) <= 0)
|
||||
{
|
||||
perror(outfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (text)
|
||||
{
|
||||
DHparams_print(out,dh);
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
if (!DH_check(dh,&i))
|
||||
{
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
if (i & DH_CHECK_P_NOT_PRIME)
|
||||
printf("p value is not prime\n");
|
||||
if (i & DH_CHECK_P_NOT_SAFE_PRIME)
|
||||
printf("p value is not a safe prime\n");
|
||||
if (i & DH_UNABLE_TO_CHECK_GENERATOR)
|
||||
printf("unable to check the generator value\n");
|
||||
if (i & DH_NOT_SUITABLE_GENERATOR)
|
||||
printf("the g value is not a generator\n");
|
||||
if (i == 0)
|
||||
printf("DH parameters appear to be ok.\n");
|
||||
}
|
||||
if (C)
|
||||
{
|
||||
unsigned char *data;
|
||||
int len,l,bits;
|
||||
|
||||
len=BN_num_bytes(dh->p);
|
||||
bits=BN_num_bits(dh->p);
|
||||
data=(unsigned char *)Malloc(len);
|
||||
if (data == NULL)
|
||||
{
|
||||
perror("Malloc");
|
||||
goto end;
|
||||
}
|
||||
printf("#ifndef HEADER_DH_H\n"
|
||||
"#include <openssl/dh.h>\n"
|
||||
"#endif\n");
|
||||
printf("DH *get_dh%d()\n\t{\n",bits);
|
||||
|
||||
l=BN_bn2bin(dh->p,data);
|
||||
printf("\tstatic unsigned char dh%d_p[]={",bits);
|
||||
for (i=0; i<l; i++)
|
||||
{
|
||||
if ((i%12) == 0) printf("\n\t\t");
|
||||
printf("0x%02X,",data[i]);
|
||||
}
|
||||
printf("\n\t\t};\n");
|
||||
|
||||
l=BN_bn2bin(dh->g,data);
|
||||
printf("\tstatic unsigned char dh%d_g[]={",bits);
|
||||
for (i=0; i<l; i++)
|
||||
{
|
||||
if ((i%12) == 0) printf("\n\t\t");
|
||||
printf("0x%02X,",data[i]);
|
||||
}
|
||||
printf("\n\t\t};\n");
|
||||
|
||||
printf("\tDH *dh;\n\n");
|
||||
printf("\tif ((dh=DH_new()) == NULL) return(NULL);\n");
|
||||
printf("\tdh->p=BN_bin2bn(dh%d_p,sizeof(dh%d_p),NULL);\n",
|
||||
bits,bits);
|
||||
printf("\tdh->g=BN_bin2bn(dh%d_g,sizeof(dh%d_g),NULL);\n",
|
||||
bits,bits);
|
||||
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
|
||||
printf("\t\t{ DH_free(dh); return(NULL); }\n");
|
||||
if (dh->length)
|
||||
printf("\tdh->length = %d;\n", dh->length);
|
||||
printf("\treturn(dh);\n\t}\n");
|
||||
Free(data);
|
||||
}
|
||||
|
||||
|
||||
if (!noout)
|
||||
{
|
||||
if (outformat == FORMAT_ASN1)
|
||||
i=i2d_DHparams_bio(out,dh);
|
||||
else if (outformat == FORMAT_PEM)
|
||||
i=PEM_write_bio_DHparams(out,dh);
|
||||
else {
|
||||
BIO_printf(bio_err,"bad output format specified for outfile\n");
|
||||
goto end;
|
||||
}
|
||||
if (!i)
|
||||
{
|
||||
BIO_printf(bio_err,"unable to write DH parameters\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
ret=0;
|
||||
end:
|
||||
if (in != NULL) BIO_free(in);
|
||||
if (out != NULL) BIO_free(out);
|
||||
if (dh != NULL) DH_free(dh);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */
|
||||
static void MS_CALLBACK dh_cb(int p, int n, void *arg)
|
||||
{
|
||||
char c='*';
|
||||
|
||||
if (p == 0) c='.';
|
||||
if (p == 1) c='+';
|
||||
if (p == 2) c='*';
|
||||
if (p == 3) c='\n';
|
||||
BIO_write((BIO *)arg,&c,1);
|
||||
(void)BIO_flush((BIO *)arg);
|
||||
#ifdef LINT
|
||||
p=n;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,475 +0,0 @@
|
||||
/* apps/passwd.c */
|
||||
|
||||
#if defined NO_MD5 || defined CHARSET_EBCDIC
|
||||
# define NO_APR1
|
||||
#endif
|
||||
|
||||
#if !defined(NO_DES) || !defined(NO_APR1)
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "apps.h"
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#ifndef NO_DES
|
||||
# include <openssl/des.h>
|
||||
#endif
|
||||
#ifndef NO_APR1
|
||||
# include <openssl/md5.h>
|
||||
#endif
|
||||
|
||||
|
||||
#undef PROG
|
||||
#define PROG passwd_main
|
||||
|
||||
|
||||
static unsigned const char cov_2char[64]={
|
||||
/* from crypto/des/fcrypt.c */
|
||||
0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
|
||||
0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,
|
||||
0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,
|
||||
0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,
|
||||
0x55,0x56,0x57,0x58,0x59,0x5A,0x61,0x62,
|
||||
0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,
|
||||
0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,
|
||||
0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A
|
||||
};
|
||||
|
||||
static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
||||
char *passwd, BIO *out, int quiet, int table, int reverse,
|
||||
size_t pw_maxlen, int usecrypt, int useapr1);
|
||||
|
||||
/* -crypt - standard Unix password algorithm (default, only choice)
|
||||
* -apr1 - MD5-based password algorithm
|
||||
* -salt string - salt
|
||||
* -in file - read passwords from file
|
||||
* -stdin - read passwords from stdin
|
||||
* -quiet - no warnings
|
||||
* -table - format output as table
|
||||
* -reverse - switch table columns
|
||||
*/
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int ret = 1;
|
||||
char *infile = NULL;
|
||||
int in_stdin = 0;
|
||||
char *salt = NULL, *passwd = NULL, **passwds = NULL;
|
||||
char *salt_malloc = NULL, *passwd_malloc = NULL;
|
||||
int pw_source_defined = 0;
|
||||
BIO *in = NULL, *out = NULL;
|
||||
int i, badopt, opt_done;
|
||||
int passed_salt = 0, quiet = 0, table = 0, reverse = 0;
|
||||
int usecrypt = 0, useapr1 = 0;
|
||||
size_t pw_maxlen = 0;
|
||||
|
||||
apps_startup();
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
|
||||
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
|
||||
out = BIO_new(BIO_s_file());
|
||||
if (out == NULL)
|
||||
goto err;
|
||||
BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
|
||||
badopt = 0, opt_done = 0;
|
||||
i = 0;
|
||||
while (!badopt && !opt_done && argv[++i] != NULL)
|
||||
{
|
||||
if (strcmp(argv[i], "-crypt") == 0)
|
||||
usecrypt = 1;
|
||||
else if (strcmp(argv[i], "-apr1") == 0)
|
||||
useapr1 = 1;
|
||||
else if (strcmp(argv[i], "-salt") == 0)
|
||||
{
|
||||
if ((argv[i+1] != NULL) && (salt == NULL))
|
||||
{
|
||||
passed_salt = 1;
|
||||
salt = argv[++i];
|
||||
}
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-in") == 0)
|
||||
{
|
||||
if ((argv[i+1] != NULL) && !pw_source_defined)
|
||||
{
|
||||
pw_source_defined = 1;
|
||||
infile = argv[++i];
|
||||
}
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-stdin") == 0)
|
||||
{
|
||||
if (!pw_source_defined)
|
||||
{
|
||||
pw_source_defined = 1;
|
||||
in_stdin = 1;
|
||||
}
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-quiet") == 0)
|
||||
quiet = 1;
|
||||
else if (strcmp(argv[i], "-table") == 0)
|
||||
table = 1;
|
||||
else if (strcmp(argv[i], "-reverse") == 0)
|
||||
reverse = 1;
|
||||
else if (argv[i][0] == '-')
|
||||
badopt = 1;
|
||||
else if (!pw_source_defined)
|
||||
/* non-option arguments, use as passwords */
|
||||
{
|
||||
pw_source_defined = 1;
|
||||
passwds = &argv[i];
|
||||
opt_done = 1;
|
||||
}
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
|
||||
if (!usecrypt && !useapr1) /* use default */
|
||||
usecrypt = 1;
|
||||
if (usecrypt + useapr1 > 1) /* conflict */
|
||||
badopt = 1;
|
||||
|
||||
/* reject unsupported algorithms */
|
||||
#ifdef NO_DES
|
||||
if (usecrypt) badopt = 1;
|
||||
#endif
|
||||
#ifdef NO_APR1
|
||||
if (useapr1) badopt = 1;
|
||||
#endif
|
||||
|
||||
if (badopt)
|
||||
{
|
||||
BIO_printf(bio_err, "Usage: passwd [options] [passwords]\n");
|
||||
BIO_printf(bio_err, "where options are\n");
|
||||
#ifndef NO_DES
|
||||
BIO_printf(bio_err, "-crypt standard Unix password algorithm (default)\n");
|
||||
#endif
|
||||
#ifndef NO_APR1
|
||||
BIO_printf(bio_err, "-apr1 MD5-based password algorithm\n");
|
||||
#endif
|
||||
BIO_printf(bio_err, "-salt string use provided salt\n");
|
||||
BIO_printf(bio_err, "-in file read passwords from file\n");
|
||||
BIO_printf(bio_err, "-stdin read passwords from stdin\n");
|
||||
BIO_printf(bio_err, "-quiet no warnings\n");
|
||||
BIO_printf(bio_err, "-table format output as table\n");
|
||||
BIO_printf(bio_err, "-reverse switch table columns\n");
|
||||
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((infile != NULL) || in_stdin)
|
||||
{
|
||||
in = BIO_new(BIO_s_file());
|
||||
if (in == NULL)
|
||||
goto err;
|
||||
if (infile != NULL)
|
||||
{
|
||||
assert(in_stdin == 0);
|
||||
if (BIO_read_filename(in, infile) <= 0)
|
||||
goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(in_stdin);
|
||||
BIO_set_fp(in, stdin, BIO_NOCLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (usecrypt)
|
||||
pw_maxlen = 8;
|
||||
else if (useapr1)
|
||||
pw_maxlen = 256; /* arbitrary limit, should be enough for most passwords */
|
||||
|
||||
if (passwds == NULL)
|
||||
{
|
||||
/* no passwords on the command line */
|
||||
passwd = passwd_malloc = Malloc(pw_maxlen + 1);
|
||||
if (passwd_malloc == NULL)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((in == NULL) && (passwds == NULL))
|
||||
{
|
||||
/* build a null-terminated list */
|
||||
static char *passwds_static[2] = {NULL, NULL};
|
||||
|
||||
passwds = passwds_static;
|
||||
if (in == NULL)
|
||||
if (EVP_read_pw_string(passwd_malloc, pw_maxlen + 1, "Password: ", 0) != 0)
|
||||
goto err;
|
||||
passwds[0] = passwd_malloc;
|
||||
}
|
||||
|
||||
if (in == NULL)
|
||||
{
|
||||
assert(passwds != NULL);
|
||||
assert(*passwds != NULL);
|
||||
|
||||
do /* loop over list of passwords */
|
||||
{
|
||||
passwd = *passwds++;
|
||||
if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out,
|
||||
quiet, table, reverse, pw_maxlen, usecrypt, useapr1))
|
||||
goto err;
|
||||
}
|
||||
while (*passwds != NULL);
|
||||
}
|
||||
else
|
||||
/* in != NULL */
|
||||
{
|
||||
int done;
|
||||
|
||||
assert (passwd != NULL);
|
||||
do
|
||||
{
|
||||
int r = BIO_gets(in, passwd, pw_maxlen + 1);
|
||||
if (r > 0)
|
||||
{
|
||||
char *c = (strchr(passwd, '\n')) ;
|
||||
if (c != NULL)
|
||||
*c = 0; /* truncate at newline */
|
||||
else
|
||||
{
|
||||
/* ignore rest of line */
|
||||
char trash[BUFSIZ];
|
||||
do
|
||||
r = BIO_gets(in, trash, sizeof trash);
|
||||
while ((r > 0) && (!strchr(trash, '\n')));
|
||||
}
|
||||
|
||||
if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, out,
|
||||
quiet, table, reverse, pw_maxlen, usecrypt, useapr1))
|
||||
goto err;
|
||||
}
|
||||
done = (r <= 0);
|
||||
}
|
||||
while (!done);
|
||||
}
|
||||
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
if (salt_malloc)
|
||||
Free(salt_malloc);
|
||||
if (passwd_malloc)
|
||||
Free(passwd_malloc);
|
||||
if (in)
|
||||
BIO_free(in);
|
||||
if (out)
|
||||
BIO_free(out);
|
||||
EXIT(ret);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_APR1
|
||||
/* MD5-based password algorithm compatible to the one found in Apache
|
||||
* (should probably be available as a library function;
|
||||
* then the static buffer would not be acceptable) */
|
||||
static char *apr1_crypt(const char *passwd, const char *salt)
|
||||
{
|
||||
static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */
|
||||
unsigned char buf[MD5_DIGEST_LENGTH];
|
||||
char *salt_out;
|
||||
int n, i;
|
||||
MD5_CTX md;
|
||||
size_t passwd_len, salt_len;
|
||||
|
||||
passwd_len = strlen(passwd);
|
||||
strcpy(out_buf, "$apr1$");
|
||||
strncat(out_buf, salt, 8);
|
||||
assert(strlen(out_buf) <= 6 + 8); /* "$apr1$..salt.." */
|
||||
salt_out = out_buf + 6;
|
||||
salt_len = strlen(salt_out);
|
||||
assert(salt_len <= 8);
|
||||
|
||||
MD5_Init(&md);
|
||||
MD5_Update(&md, passwd, passwd_len);
|
||||
MD5_Update(&md, "$apr1$", 6);
|
||||
MD5_Update(&md, salt_out, salt_len);
|
||||
|
||||
{
|
||||
MD5_CTX md2;
|
||||
|
||||
MD5_Init(&md2);
|
||||
MD5_Update(&md2, passwd, passwd_len);
|
||||
MD5_Update(&md2, salt_out, salt_len);
|
||||
MD5_Update(&md2, passwd, passwd_len);
|
||||
MD5_Final(buf, &md2);
|
||||
}
|
||||
for (i = passwd_len; i > sizeof buf; i -= sizeof buf)
|
||||
MD5_Update(&md, buf, sizeof buf);
|
||||
MD5_Update(&md, buf, i);
|
||||
|
||||
n = passwd_len;
|
||||
while (n)
|
||||
{
|
||||
MD5_Update(&md, (n & 1) ? "\0" : passwd, 1);
|
||||
n >>= 1;
|
||||
}
|
||||
MD5_Final(buf, &md);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
{
|
||||
MD5_CTX md2;
|
||||
|
||||
MD5_Init(&md2);
|
||||
MD5_Update(&md2, (i & 1) ? (unsigned char *) passwd : buf,
|
||||
(i & 1) ? passwd_len : sizeof buf);
|
||||
if (i % 3)
|
||||
MD5_Update(&md2, salt_out, salt_len);
|
||||
if (i % 7)
|
||||
MD5_Update(&md2, passwd, passwd_len);
|
||||
MD5_Update(&md2, (i & 1) ? buf : (unsigned char *) passwd,
|
||||
(i & 1) ? sizeof buf : passwd_len);
|
||||
MD5_Final(buf, &md2);
|
||||
}
|
||||
|
||||
{
|
||||
/* transform buf into output string */
|
||||
|
||||
unsigned char buf_perm[sizeof buf];
|
||||
int dest, source;
|
||||
char *output;
|
||||
|
||||
/* silly output permutation */
|
||||
for (dest = 0, source = 0; dest < 14; dest++, source = (source + 6) % 17)
|
||||
buf_perm[dest] = buf[source];
|
||||
buf_perm[14] = buf[5];
|
||||
buf_perm[15] = buf[11];
|
||||
#ifndef PEDANTIC /* Unfortunately, this generates a "no effect" warning */
|
||||
assert(16 == sizeof buf_perm);
|
||||
#endif
|
||||
|
||||
output = salt_out + salt_len;
|
||||
assert(output == out_buf + strlen(out_buf));
|
||||
|
||||
*output++ = '$';
|
||||
|
||||
for (i = 0; i < 15; i += 3)
|
||||
{
|
||||
*output++ = cov_2char[buf_perm[i+2] & 0x3f];
|
||||
*output++ = cov_2char[((buf_perm[i+1] & 0xf) << 2) |
|
||||
(buf_perm[i+2] >> 6)];
|
||||
*output++ = cov_2char[((buf_perm[i] & 3) << 4) |
|
||||
(buf_perm[i+1] >> 4)];
|
||||
*output++ = cov_2char[buf_perm[i] >> 2];
|
||||
}
|
||||
assert(i == 15);
|
||||
*output++ = cov_2char[buf_perm[i] & 0x3f];
|
||||
*output++ = cov_2char[buf_perm[i] >> 6];
|
||||
*output = 0;
|
||||
assert(strlen(out_buf) < sizeof(out_buf));
|
||||
}
|
||||
|
||||
return out_buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
||||
char *passwd, BIO *out, int quiet, int table, int reverse,
|
||||
size_t pw_maxlen, int usecrypt, int useapr1)
|
||||
{
|
||||
char *hash = NULL;
|
||||
|
||||
assert(salt_p != NULL);
|
||||
assert(salt_malloc_p != NULL);
|
||||
|
||||
/* first make sure we have a salt */
|
||||
if (!passed_salt)
|
||||
{
|
||||
#ifndef NO_DES
|
||||
if (usecrypt)
|
||||
{
|
||||
if (*salt_malloc_p == NULL)
|
||||
{
|
||||
*salt_p = *salt_malloc_p = Malloc(3);
|
||||
if (*salt_malloc_p == NULL)
|
||||
goto err;
|
||||
}
|
||||
if (RAND_pseudo_bytes((unsigned char *)*salt_p, 2) < 0)
|
||||
goto err;
|
||||
(*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; /* 6 bits */
|
||||
(*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; /* 6 bits */
|
||||
(*salt_p)[2] = 0;
|
||||
#ifdef CHARSET_EBCDIC
|
||||
ascii2ebcdic(*salt_p, *salt_p, 2); /* des_crypt will convert
|
||||
* back to ASCII */
|
||||
#endif
|
||||
}
|
||||
#endif /* !NO_DES */
|
||||
|
||||
#ifndef NO_APR1
|
||||
if (useapr1)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (*salt_malloc_p == NULL)
|
||||
{
|
||||
*salt_p = *salt_malloc_p = Malloc(9);
|
||||
if (*salt_malloc_p == NULL)
|
||||
goto err;
|
||||
}
|
||||
if (RAND_pseudo_bytes((unsigned char *)*salt_p, 8) < 0)
|
||||
goto err;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
(*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; /* 6 bits */
|
||||
(*salt_p)[8] = 0;
|
||||
}
|
||||
#endif /* !NO_APR1 */
|
||||
}
|
||||
|
||||
assert(*salt_p != NULL);
|
||||
|
||||
/* truncate password if necessary */
|
||||
if ((strlen(passwd) > pw_maxlen))
|
||||
{
|
||||
if (!quiet)
|
||||
BIO_printf(bio_err, "Warning: truncating password to %u characters\n", pw_maxlen);
|
||||
passwd[pw_maxlen] = 0;
|
||||
}
|
||||
assert(strlen(passwd) <= pw_maxlen);
|
||||
|
||||
/* now compute password hash */
|
||||
#ifndef NO_DES
|
||||
if (usecrypt)
|
||||
hash = des_crypt(passwd, *salt_p);
|
||||
#endif
|
||||
#ifndef NO_APR1
|
||||
if (useapr1)
|
||||
hash = apr1_crypt(passwd, *salt_p);
|
||||
#endif
|
||||
assert(hash != NULL);
|
||||
|
||||
if (table && !reverse)
|
||||
BIO_printf(out, "%s\t%s\n", passwd, hash);
|
||||
else if (table && reverse)
|
||||
BIO_printf(out, "%s\t%s\n", hash, passwd);
|
||||
else
|
||||
BIO_printf(out, "%s\n", hash);
|
||||
return 1;
|
||||
|
||||
err:
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
fputs("Program not available.\n", stderr)
|
||||
EXIT(1);
|
||||
}
|
||||
#endif
|
||||
@@ -1,140 +0,0 @@
|
||||
/* apps/rand.c */
|
||||
|
||||
#include "apps.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#undef PROG
|
||||
#define PROG rand_main
|
||||
|
||||
/* -out file - write to file
|
||||
* -rand file:file - PRNG seed files
|
||||
* -base64 - encode output
|
||||
* num - write 'num' bytes
|
||||
*/
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int i, r, ret = 1;
|
||||
int badopt;
|
||||
char *outfile = NULL;
|
||||
char *inrand = NULL;
|
||||
int base64 = 0;
|
||||
BIO *out = NULL;
|
||||
int num = -1;
|
||||
|
||||
apps_startup();
|
||||
|
||||
if (bio_err == NULL)
|
||||
if ((bio_err = BIO_new(BIO_s_file())) != NULL)
|
||||
BIO_set_fp(bio_err, stderr, BIO_NOCLOSE|BIO_FP_TEXT);
|
||||
|
||||
badopt = 0;
|
||||
i = 0;
|
||||
while (!badopt && argv[++i] != NULL)
|
||||
{
|
||||
if (strcmp(argv[i], "-out") == 0)
|
||||
{
|
||||
if ((argv[i+1] != NULL) && (outfile == NULL))
|
||||
outfile = argv[++i];
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-rand") == 0)
|
||||
{
|
||||
if ((argv[i+1] != NULL) && (inrand == NULL))
|
||||
inrand = argv[++i];
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-base64") == 0)
|
||||
{
|
||||
if (!base64)
|
||||
base64 = 1;
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else if (isdigit(argv[i][0]))
|
||||
{
|
||||
if (num < 0)
|
||||
{
|
||||
r = sscanf(argv[i], "%d", &num);
|
||||
if (r == 0 || num < 0)
|
||||
badopt = 1;
|
||||
}
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
else
|
||||
badopt = 1;
|
||||
}
|
||||
|
||||
if (num < 0)
|
||||
badopt = 1;
|
||||
|
||||
if (badopt)
|
||||
{
|
||||
BIO_printf(bio_err, "Usage: rand [options] num\n");
|
||||
BIO_printf(bio_err, "where options are\n");
|
||||
BIO_printf(bio_err, "-out file - write to file\n");
|
||||
BIO_printf(bio_err, "-rand file%cfile%c... - seed PRNG from files\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
||||
BIO_printf(bio_err, "-base64 - encode output\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
||||
if (inrand != NULL)
|
||||
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
|
||||
app_RAND_load_files(inrand));
|
||||
|
||||
out = BIO_new(BIO_s_file());
|
||||
if (out == NULL)
|
||||
goto err;
|
||||
if (outfile != NULL)
|
||||
r = BIO_write_filename(out, outfile);
|
||||
else
|
||||
r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
if (r <= 0)
|
||||
goto err;
|
||||
|
||||
if (base64)
|
||||
{
|
||||
BIO *b64 = BIO_new(BIO_f_base64());
|
||||
if (b64 == NULL)
|
||||
goto err;
|
||||
out = BIO_push(b64, out);
|
||||
}
|
||||
|
||||
while (num > 0)
|
||||
{
|
||||
unsigned char buf[4096];
|
||||
int chunk;
|
||||
|
||||
chunk = num;
|
||||
if (chunk > sizeof buf)
|
||||
chunk = sizeof buf;
|
||||
r = RAND_bytes(buf, chunk);
|
||||
if (r <= 0)
|
||||
goto err;
|
||||
BIO_write(out, buf, chunk);
|
||||
num -= chunk;
|
||||
}
|
||||
BIO_flush(out);
|
||||
|
||||
app_RAND_write_file(NULL, bio_err);
|
||||
ret = 0;
|
||||
|
||||
err:
|
||||
ERR_print_errors(bio_err);
|
||||
if (out)
|
||||
BIO_free_all(out);
|
||||
EXIT(ret);
|
||||
}
|
||||
@@ -1,535 +0,0 @@
|
||||
/* smime.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
/* S/MIME utility function */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#undef PROG
|
||||
#define PROG smime_main
|
||||
static X509 *load_cert(char *file);
|
||||
static EVP_PKEY *load_key(char *file, char *pass);
|
||||
static STACK_OF(X509) *load_certs(char *file);
|
||||
static X509_STORE *setup_verify(char *CAfile, char *CApath);
|
||||
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
|
||||
|
||||
#define SMIME_OP 0x10
|
||||
#define SMIME_ENCRYPT (1 | SMIME_OP)
|
||||
#define SMIME_DECRYPT 2
|
||||
#define SMIME_SIGN (3 | SMIME_OP)
|
||||
#define SMIME_VERIFY 4
|
||||
#define SMIME_PK7OUT 5
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int operation = 0;
|
||||
int ret = 0;
|
||||
char **args;
|
||||
char *inmode = "r", *outmode = "w";
|
||||
char *infile = NULL, *outfile = NULL;
|
||||
char *signerfile = NULL, *recipfile = NULL;
|
||||
char *certfile = NULL, *keyfile = NULL;
|
||||
EVP_CIPHER *cipher = NULL;
|
||||
PKCS7 *p7 = NULL;
|
||||
X509_STORE *store = NULL;
|
||||
X509 *cert = NULL, *recip = NULL, *signer = NULL;
|
||||
EVP_PKEY *key = NULL;
|
||||
STACK_OF(X509) *encerts = NULL, *other = NULL;
|
||||
BIO *in = NULL, *out = NULL, *indata = NULL;
|
||||
int badarg = 0;
|
||||
int flags = PKCS7_DETACHED;
|
||||
char *to = NULL, *from = NULL, *subject = NULL;
|
||||
char *CAfile = NULL, *CApath = NULL;
|
||||
char *passargin = NULL, *passin = NULL;
|
||||
char *inrand = NULL;
|
||||
int need_rand = 0;
|
||||
args = argv + 1;
|
||||
|
||||
ret = 1;
|
||||
|
||||
while (!badarg && *args && *args[0] == '-') {
|
||||
if (!strcmp (*args, "-encrypt")) operation = SMIME_ENCRYPT;
|
||||
else if (!strcmp (*args, "-decrypt")) operation = SMIME_DECRYPT;
|
||||
else if (!strcmp (*args, "-sign")) operation = SMIME_SIGN;
|
||||
else if (!strcmp (*args, "-verify")) operation = SMIME_VERIFY;
|
||||
else if (!strcmp (*args, "-pk7out")) operation = SMIME_PK7OUT;
|
||||
#ifndef NO_DES
|
||||
else if (!strcmp (*args, "-des3"))
|
||||
cipher = EVP_des_ede3_cbc();
|
||||
else if (!strcmp (*args, "-des"))
|
||||
cipher = EVP_des_cbc();
|
||||
#endif
|
||||
#ifndef NO_RC2
|
||||
else if (!strcmp (*args, "-rc2-40"))
|
||||
cipher = EVP_rc2_40_cbc();
|
||||
else if (!strcmp (*args, "-rc2-128"))
|
||||
cipher = EVP_rc2_cbc();
|
||||
else if (!strcmp (*args, "-rc2-64"))
|
||||
cipher = EVP_rc2_64_cbc();
|
||||
#endif
|
||||
else if (!strcmp (*args, "-text"))
|
||||
flags |= PKCS7_TEXT;
|
||||
else if (!strcmp (*args, "-nointern"))
|
||||
flags |= PKCS7_NOINTERN;
|
||||
else if (!strcmp (*args, "-noverify"))
|
||||
flags |= PKCS7_NOVERIFY;
|
||||
else if (!strcmp (*args, "-nochain"))
|
||||
flags |= PKCS7_NOCHAIN;
|
||||
else if (!strcmp (*args, "-nocerts"))
|
||||
flags |= PKCS7_NOCERTS;
|
||||
else if (!strcmp (*args, "-noattr"))
|
||||
flags |= PKCS7_NOATTR;
|
||||
else if (!strcmp (*args, "-nodetach"))
|
||||
flags &= ~PKCS7_DETACHED;
|
||||
else if (!strcmp (*args, "-binary"))
|
||||
flags |= PKCS7_BINARY;
|
||||
else if (!strcmp (*args, "-nosigs"))
|
||||
flags |= PKCS7_NOSIGS;
|
||||
else if (!strcmp(*args,"-rand")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
inrand = *args;
|
||||
} else badarg = 1;
|
||||
need_rand = 1;
|
||||
} else if (!strcmp(*args,"-passin")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
passargin = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-to")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
to = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-from")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
from = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-subject")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
subject = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-signer")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
signerfile = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-recip")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
recipfile = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-inkey")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
keyfile = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-certfile")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
certfile = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-CAfile")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
CAfile = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-CApath")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
CApath = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-in")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
infile = *args;
|
||||
} else badarg = 1;
|
||||
} else if (!strcmp (*args, "-out")) {
|
||||
if (args[1]) {
|
||||
args++;
|
||||
outfile = *args;
|
||||
} else badarg = 1;
|
||||
} else badarg = 1;
|
||||
args++;
|
||||
}
|
||||
|
||||
if(operation == SMIME_SIGN) {
|
||||
if(!signerfile) {
|
||||
BIO_printf(bio_err, "No signer certificate specified\n");
|
||||
badarg = 1;
|
||||
}
|
||||
need_rand = 1;
|
||||
} else if(operation == SMIME_DECRYPT) {
|
||||
if(!recipfile) {
|
||||
BIO_printf(bio_err, "No recipient certificate and key specified\n");
|
||||
badarg = 1;
|
||||
}
|
||||
} else if(operation == SMIME_ENCRYPT) {
|
||||
if(!*args) {
|
||||
BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
|
||||
badarg = 1;
|
||||
}
|
||||
need_rand = 1;
|
||||
} else if(!operation) badarg = 1;
|
||||
|
||||
if (badarg) {
|
||||
BIO_printf (bio_err, "Usage smime [options] cert.pem ...\n");
|
||||
BIO_printf (bio_err, "where options are\n");
|
||||
BIO_printf (bio_err, "-encrypt encrypt message\n");
|
||||
BIO_printf (bio_err, "-decrypt decrypt encrypted message\n");
|
||||
BIO_printf (bio_err, "-sign sign message\n");
|
||||
BIO_printf (bio_err, "-verify verify signed message\n");
|
||||
BIO_printf (bio_err, "-pk7out output PKCS#7 structure\n");
|
||||
#ifndef NO_DES
|
||||
BIO_printf (bio_err, "-des3 encrypt with triple DES\n");
|
||||
BIO_printf (bio_err, "-des encrypt with DES\n");
|
||||
#endif
|
||||
#ifndef NO_RC2
|
||||
BIO_printf (bio_err, "-rc2-40 encrypt with RC2-40 (default)\n");
|
||||
BIO_printf (bio_err, "-rc2-64 encrypt with RC2-64\n");
|
||||
BIO_printf (bio_err, "-rc2-128 encrypt with RC2-128\n");
|
||||
#endif
|
||||
BIO_printf (bio_err, "-nointern don't search certificates in message for signer\n");
|
||||
BIO_printf (bio_err, "-nosigs don't verify message signature\n");
|
||||
BIO_printf (bio_err, "-noverify don't verify signers certificate\n");
|
||||
BIO_printf (bio_err, "-nocerts don't include signers certificate when signing\n");
|
||||
BIO_printf (bio_err, "-nodetach use opaque signing\n");
|
||||
BIO_printf (bio_err, "-noattr don't include any signed attributes\n");
|
||||
BIO_printf (bio_err, "-binary don't translate message to text\n");
|
||||
BIO_printf (bio_err, "-certfile file other certificates file\n");
|
||||
BIO_printf (bio_err, "-signer file signer certificate file\n");
|
||||
BIO_printf (bio_err, "-recip file recipient certificate file for decryption\n");
|
||||
BIO_printf (bio_err, "-in file input file\n");
|
||||
BIO_printf (bio_err, "-inkey file input private key (if not signer or recipient)\n");
|
||||
BIO_printf (bio_err, "-out file output file\n");
|
||||
BIO_printf (bio_err, "-to addr to address\n");
|
||||
BIO_printf (bio_err, "-from ad from address\n");
|
||||
BIO_printf (bio_err, "-subject s subject\n");
|
||||
BIO_printf (bio_err, "-text include or delete text MIME headers\n");
|
||||
BIO_printf (bio_err, "-CApath dir trusted certificates directory\n");
|
||||
BIO_printf (bio_err, "-CAfile file trusted certificates file\n");
|
||||
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
|
||||
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
|
||||
BIO_printf(bio_err, " the random number generator\n");
|
||||
BIO_printf (bio_err, "cert.pem recipient certificate(s) for encryption\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
|
||||
BIO_printf(bio_err, "Error getting password\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (need_rand) {
|
||||
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
||||
if (inrand != NULL)
|
||||
BIO_printf(bio_err,"%ld semi-random bytes loaded\n",
|
||||
app_RAND_load_files(inrand));
|
||||
}
|
||||
|
||||
ret = 2;
|
||||
|
||||
if(operation != SMIME_SIGN) flags &= ~PKCS7_DETACHED;
|
||||
|
||||
if(flags & PKCS7_BINARY) {
|
||||
if(operation & SMIME_OP) inmode = "rb";
|
||||
else outmode = "rb";
|
||||
}
|
||||
|
||||
if(operation == SMIME_ENCRYPT) {
|
||||
if (!cipher) {
|
||||
#ifndef NO_RC2
|
||||
cipher = EVP_rc2_40_cbc();
|
||||
#else
|
||||
BIO_printf(bio_err, "No cipher selected\n");
|
||||
goto end;
|
||||
#endif
|
||||
}
|
||||
encerts = sk_X509_new_null();
|
||||
while (*args) {
|
||||
if(!(cert = load_cert(*args))) {
|
||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", *args);
|
||||
goto end;
|
||||
}
|
||||
sk_X509_push(encerts, cert);
|
||||
cert = NULL;
|
||||
args++;
|
||||
}
|
||||
}
|
||||
|
||||
if(signerfile && (operation == SMIME_SIGN)) {
|
||||
if(!(signer = load_cert(signerfile))) {
|
||||
BIO_printf(bio_err, "Can't read signer certificate file %s\n", signerfile);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if(certfile) {
|
||||
if(!(other = load_certs(certfile))) {
|
||||
BIO_printf(bio_err, "Can't read certificate file %s\n", certfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if(recipfile && (operation == SMIME_DECRYPT)) {
|
||||
if(!(recip = load_cert(recipfile))) {
|
||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", recipfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if(operation == SMIME_DECRYPT) {
|
||||
if(!keyfile) keyfile = recipfile;
|
||||
} else if(operation == SMIME_SIGN) {
|
||||
if(!keyfile) keyfile = signerfile;
|
||||
} else keyfile = NULL;
|
||||
|
||||
if(keyfile) {
|
||||
if(!(key = load_key(keyfile, passin))) {
|
||||
BIO_printf(bio_err, "Can't read recipient certificate file %s\n", keyfile);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (infile) {
|
||||
if (!(in = BIO_new_file(infile, inmode))) {
|
||||
BIO_printf (bio_err,
|
||||
"Can't open input file %s\n", infile);
|
||||
goto end;
|
||||
}
|
||||
} else in = BIO_new_fp(stdin, BIO_NOCLOSE);
|
||||
|
||||
if (outfile) {
|
||||
if (!(out = BIO_new_file(outfile, outmode))) {
|
||||
BIO_printf (bio_err,
|
||||
"Can't open output file %s\n", outfile);
|
||||
goto end;
|
||||
}
|
||||
} else out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
|
||||
if(operation == SMIME_VERIFY) {
|
||||
if(!(store = setup_verify(CAfile, CApath))) goto end;
|
||||
}
|
||||
|
||||
ret = 3;
|
||||
|
||||
if(operation == SMIME_ENCRYPT) {
|
||||
p7 = PKCS7_encrypt(encerts, in, cipher, flags);
|
||||
} else if(operation == SMIME_SIGN) {
|
||||
p7 = PKCS7_sign(signer, key, other, in, flags);
|
||||
BIO_reset(in);
|
||||
} else {
|
||||
if(!(p7 = SMIME_read_PKCS7(in, &indata))) {
|
||||
BIO_printf(bio_err, "Error reading S/MIME message\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if(!p7) {
|
||||
BIO_printf(bio_err, "Error creating PKCS#7 structure\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = 4;
|
||||
if(operation == SMIME_DECRYPT) {
|
||||
if(!PKCS7_decrypt(p7, key, recip, out, flags)) {
|
||||
BIO_printf(bio_err, "Error decrypting PKCS#7 structure\n");
|
||||
goto end;
|
||||
}
|
||||
} else if(operation == SMIME_VERIFY) {
|
||||
STACK_OF(X509) *signers;
|
||||
if(PKCS7_verify(p7, other, store, indata, out, flags)) {
|
||||
BIO_printf(bio_err, "Verification Successful\n");
|
||||
} else {
|
||||
BIO_printf(bio_err, "Verification Failure\n");
|
||||
goto end;
|
||||
}
|
||||
signers = PKCS7_get0_signers(p7, other, flags);
|
||||
if(!save_certs(signerfile, signers)) {
|
||||
BIO_printf(bio_err, "Error writing signers to %s\n",
|
||||
signerfile);
|
||||
ret = 5;
|
||||
goto end;
|
||||
}
|
||||
sk_X509_free(signers);
|
||||
} else if(operation == SMIME_PK7OUT) {
|
||||
PEM_write_bio_PKCS7(out, p7);
|
||||
} else {
|
||||
if(to) BIO_printf(out, "To: %s\n", to);
|
||||
if(from) BIO_printf(out, "From: %s\n", from);
|
||||
if(subject) BIO_printf(out, "Subject: %s\n", subject);
|
||||
SMIME_write_PKCS7(out, p7, in, flags);
|
||||
}
|
||||
ret = 0;
|
||||
end:
|
||||
if (need_rand)
|
||||
app_RAND_write_file(NULL, bio_err);
|
||||
if(ret) ERR_print_errors(bio_err);
|
||||
sk_X509_pop_free(encerts, X509_free);
|
||||
sk_X509_pop_free(other, X509_free);
|
||||
X509_STORE_free(store);
|
||||
X509_free(cert);
|
||||
X509_free(recip);
|
||||
X509_free(signer);
|
||||
EVP_PKEY_free(key);
|
||||
PKCS7_free(p7);
|
||||
BIO_free(in);
|
||||
BIO_free(indata);
|
||||
BIO_free(out);
|
||||
if(passin) Free(passin);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static X509 *load_cert(char *file)
|
||||
{
|
||||
BIO *in;
|
||||
X509 *cert;
|
||||
if(!(in = BIO_new_file(file, "r"))) return NULL;
|
||||
cert = PEM_read_bio_X509(in, NULL, NULL,NULL);
|
||||
BIO_free(in);
|
||||
return cert;
|
||||
}
|
||||
|
||||
static EVP_PKEY *load_key(char *file, char *pass)
|
||||
{
|
||||
BIO *in;
|
||||
EVP_PKEY *key;
|
||||
if(!(in = BIO_new_file(file, "r"))) return NULL;
|
||||
key = PEM_read_bio_PrivateKey(in, NULL,NULL,pass);
|
||||
BIO_free(in);
|
||||
return key;
|
||||
}
|
||||
|
||||
static STACK_OF(X509) *load_certs(char *file)
|
||||
{
|
||||
BIO *in;
|
||||
int i;
|
||||
STACK_OF(X509) *othercerts;
|
||||
STACK_OF(X509_INFO) *allcerts;
|
||||
X509_INFO *xi;
|
||||
if(!(in = BIO_new_file(file, "r"))) return NULL;
|
||||
othercerts = sk_X509_new(NULL);
|
||||
if(!othercerts) return NULL;
|
||||
allcerts = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
|
||||
for(i = 0; i < sk_X509_INFO_num(allcerts); i++) {
|
||||
xi = sk_X509_INFO_value (allcerts, i);
|
||||
if (xi->x509) {
|
||||
sk_X509_push(othercerts, xi->x509);
|
||||
xi->x509 = NULL;
|
||||
}
|
||||
}
|
||||
sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
|
||||
BIO_free(in);
|
||||
return othercerts;
|
||||
}
|
||||
|
||||
static X509_STORE *setup_verify(char *CAfile, char *CApath)
|
||||
{
|
||||
X509_STORE *store;
|
||||
X509_LOOKUP *lookup;
|
||||
if(!(store = X509_STORE_new())) goto end;
|
||||
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());
|
||||
if (lookup == NULL) goto end;
|
||||
if (CAfile) {
|
||||
if(!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) {
|
||||
BIO_printf(bio_err, "Error loading file %s\n", CAfile);
|
||||
goto end;
|
||||
}
|
||||
} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
|
||||
|
||||
lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir());
|
||||
if (lookup == NULL) goto end;
|
||||
if (CApath) {
|
||||
if(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) {
|
||||
BIO_printf(bio_err, "Error loading directory %s\n", CApath);
|
||||
goto end;
|
||||
}
|
||||
} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
|
||||
|
||||
ERR_clear_error();
|
||||
return store;
|
||||
end:
|
||||
X509_STORE_free(store);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int save_certs(char *signerfile, STACK_OF(X509) *signers)
|
||||
{
|
||||
int i;
|
||||
BIO *tmp;
|
||||
if(!signerfile) return 1;
|
||||
tmp = BIO_new_file(signerfile, "w");
|
||||
if(!tmp) return 0;
|
||||
for(i = 0; i < sk_X509_num(signers); i++)
|
||||
PEM_write_bio_X509(tmp, sk_X509_value(signers, i));
|
||||
BIO_free(tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
/* apps/spkac.c */
|
||||
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999. Based on an original idea by Massimiliano Pala
|
||||
* ([email protected]).
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "apps.h"
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/lhash.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
#undef PROG
|
||||
#define PROG spkac_main
|
||||
|
||||
/* -in arg - input file - default stdin
|
||||
* -out arg - output file - default stdout
|
||||
*/
|
||||
|
||||
int MAIN(int, char **);
|
||||
|
||||
int MAIN(int argc, char **argv)
|
||||
{
|
||||
int i,badops=0, ret = 1;
|
||||
BIO *in = NULL,*out = NULL, *key = NULL;
|
||||
int verify=0,noout=0,pubkey=0;
|
||||
char *infile = NULL,*outfile = NULL,*prog;
|
||||
char *passargin = NULL, *passin = NULL;
|
||||
char *spkac = "SPKAC", *spksect = "default", *spkstr = NULL;
|
||||
char *challenge = NULL, *keyfile = NULL;
|
||||
LHASH *conf = NULL;
|
||||
NETSCAPE_SPKI *spki = NULL;
|
||||
EVP_PKEY *pkey = NULL;
|
||||
|
||||
apps_startup();
|
||||
|
||||
if (!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||
|
||||
prog=argv[0];
|
||||
argc--;
|
||||
argv++;
|
||||
while (argc >= 1)
|
||||
{
|
||||
if (strcmp(*argv,"-in") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
infile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-out") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
outfile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-passin") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
passargin= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-key") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
keyfile= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-challenge") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
challenge= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-spkac") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
spkac= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-spksect") == 0)
|
||||
{
|
||||
if (--argc < 1) goto bad;
|
||||
spksect= *(++argv);
|
||||
}
|
||||
else if (strcmp(*argv,"-noout") == 0)
|
||||
noout=1;
|
||||
else if (strcmp(*argv,"-pubkey") == 0)
|
||||
pubkey=1;
|
||||
else if (strcmp(*argv,"-verify") == 0)
|
||||
verify=1;
|
||||
else badops = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (badops)
|
||||
{
|
||||
bad:
|
||||
BIO_printf(bio_err,"%s [options]\n",prog);
|
||||
BIO_printf(bio_err,"where options are\n");
|
||||
BIO_printf(bio_err," -in arg input file\n");
|
||||
BIO_printf(bio_err," -out arg output file\n");
|
||||
BIO_printf(bio_err," -key arg create SPKAC using private key\n");
|
||||
BIO_printf(bio_err," -passin arg input file pass phrase source\n");
|
||||
BIO_printf(bio_err," -challenge arg challenge string\n");
|
||||
BIO_printf(bio_err," -spkac arg alternative SPKAC name\n");
|
||||
BIO_printf(bio_err," -noout don't print SPKAC\n");
|
||||
BIO_printf(bio_err," -pubkey output public key\n");
|
||||
BIO_printf(bio_err," -verify verify SPKAC signature\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
ERR_load_crypto_strings();
|
||||
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
|
||||
BIO_printf(bio_err, "Error getting password\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(keyfile) {
|
||||
if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");
|
||||
else key = BIO_new_fp(stdin, BIO_NOCLOSE);
|
||||
if(!key) {
|
||||
BIO_printf(bio_err, "Error opening key file\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, passin);
|
||||
if(!pkey) {
|
||||
BIO_printf(bio_err, "Error reading private key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
spki = NETSCAPE_SPKI_new();
|
||||
if(challenge) ASN1_STRING_set(spki->spkac->challenge,
|
||||
challenge, strlen(challenge));
|
||||
NETSCAPE_SPKI_set_pubkey(spki, pkey);
|
||||
NETSCAPE_SPKI_sign(spki, pkey, EVP_md5());
|
||||
spkstr = NETSCAPE_SPKI_b64_encode(spki);
|
||||
|
||||
if (outfile) out = BIO_new_file(outfile, "w");
|
||||
else out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
|
||||
if(!out) {
|
||||
BIO_printf(bio_err, "Error opening output file\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(out, "SPKAC=%s\n", spkstr);
|
||||
Free(spkstr);
|
||||
ret = 0;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (infile) in = BIO_new_file(infile, "r");
|
||||
else in = BIO_new_fp(stdin, BIO_NOCLOSE);
|
||||
|
||||
if(!in) {
|
||||
BIO_printf(bio_err, "Error opening input file\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
conf = CONF_load_bio(NULL, in, NULL);
|
||||
|
||||
if(!conf) {
|
||||
BIO_printf(bio_err, "Error parsing config file\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
spkstr = CONF_get_string(conf, spksect, spkac);
|
||||
|
||||
if(!spkstr) {
|
||||
BIO_printf(bio_err, "Can't find SPKAC called \"%s\"\n", spkac);
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
spki = NETSCAPE_SPKI_b64_decode(spkstr, -1);
|
||||
|
||||
if(!spki) {
|
||||
BIO_printf(bio_err, "Error loading SPKAC\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (outfile) out = BIO_new_file(outfile, "w");
|
||||
else out = BIO_new_fp(stdout, BIO_NOCLOSE);
|
||||
|
||||
if(!out) {
|
||||
BIO_printf(bio_err, "Error opening output file\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if(!noout) NETSCAPE_SPKI_print(out, spki);
|
||||
pkey = NETSCAPE_SPKI_get_pubkey(spki);
|
||||
if(verify) {
|
||||
i = NETSCAPE_SPKI_verify(spki, pkey);
|
||||
if(i) BIO_printf(bio_err, "Signature OK\n");
|
||||
else {
|
||||
BIO_printf(bio_err, "Signature Failure\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if(pubkey) PEM_write_bio_PUBKEY(out, pkey);
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
CONF_free(conf);
|
||||
NETSCAPE_SPKI_free(spki);
|
||||
BIO_free(in);
|
||||
BIO_free(out);
|
||||
BIO_free(key);
|
||||
EVP_PKEY_free(pkey);
|
||||
if(passin) Free(passin);
|
||||
EXIT(ret);
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
/* apps/winrand.c */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
/* Usage: winrand [filename]
|
||||
*
|
||||
* Collects entropy from mouse movements and other events and writes
|
||||
* random data to filename or .rnd
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
const char *filename;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
PSTR cmdline, int iCmdShow)
|
||||
{
|
||||
static char appname[] = "OpenSSL";
|
||||
HWND hwnd;
|
||||
MSG msg;
|
||||
WNDCLASSEX wndclass;
|
||||
char buffer[200];
|
||||
|
||||
if (cmdline[0] == '\0')
|
||||
filename = RAND_file_name(buffer, sizeof buffer);
|
||||
else
|
||||
filename = cmdline;
|
||||
|
||||
RAND_load_file(filename, -1);
|
||||
|
||||
wndclass.cbSize = sizeof(wndclass);
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wndclass.lpfnWndProc = WndProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = 0;
|
||||
wndclass.hInstance = hInstance;
|
||||
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
wndclass.lpszClassName = appname;
|
||||
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||
RegisterClassEx(&wndclass);
|
||||
|
||||
hwnd = CreateWindow(appname, OPENSSL_VERSION_TEXT,
|
||||
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
|
||||
|
||||
ShowWindow(hwnd, iCmdShow);
|
||||
UpdateWindow(hwnd);
|
||||
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
RECT rect;
|
||||
char buffer[200];
|
||||
static int seeded = 0;
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hwnd, &ps);
|
||||
GetClientRect(hwnd, &rect);
|
||||
DrawText(hdc, "Seeding the PRNG. Please move the mouse!", -1,
|
||||
&rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (RAND_event(iMsg, wParam, lParam) == 1 && seeded == 0)
|
||||
{
|
||||
seeded = 1;
|
||||
if (RAND_write_file(filename) <= 0)
|
||||
MessageBox(hwnd, "Couldn't write random file!",
|
||||
"OpenSSL", MB_OK | MB_ICONERROR);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, iMsg, wParam, lParam);
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/Makefile
|
||||
#
|
||||
|
||||
DIR= crypto
|
||||
TOP= ..
|
||||
CC= cc
|
||||
INCLUDE= -I. -I../include
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG= -g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP= /usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
RM= rm -f
|
||||
AR= ar r
|
||||
|
||||
PEX_LIBS=
|
||||
EX_LIBS=
|
||||
|
||||
CFLAGS= $(INCLUDE) $(CFLAG)
|
||||
|
||||
|
||||
LIBS=
|
||||
|
||||
SDIRS= md2 md5 sha mdc2 hmac ripemd \
|
||||
des rc2 rc4 rc5 idea bf cast \
|
||||
bn rsa dsa dh \
|
||||
buffer bio stack lhash rand err objects \
|
||||
evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
|
||||
|
||||
GENERAL=Makefile README crypto-lib.com install.com
|
||||
|
||||
LIB= $(TOP)/libcrypto.a
|
||||
LIBSRC= cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c
|
||||
LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= crypto.h tmdiff.h opensslv.h opensslconf.h ebcdic.h
|
||||
HEADER= cryptlib.h buildinf.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
@(cd ..; $(MAKE) DIRS=$(DIR) all)
|
||||
|
||||
all: buildinf.h lib subdirs
|
||||
|
||||
buildinf.h: ../Makefile.ssl
|
||||
( echo "#ifndef MK1MF_BUILD"; \
|
||||
echo " /* auto-generated by crypto/Makefile.ssl for crypto/cversion.c */"; \
|
||||
echo " #define CFLAGS \"$(CC) $(CFLAG)\""; \
|
||||
echo " #define PLATFORM \"$(PLATFORM)\""; \
|
||||
echo " #define DATE \"`date`\""; \
|
||||
echo "#endif" ) >buildinf.h
|
||||
|
||||
testapps:
|
||||
if echo ${SDIRS} | fgrep ' des '; \
|
||||
then cd des && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' des; fi
|
||||
cd pkcs7 && $(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
|
||||
|
||||
subdirs:
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i && echo "making all in crypto/$$i..." && \
|
||||
$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
|
||||
done;
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making 'files' in crypto/$$i..."; \
|
||||
$(MAKE) PERL='${PERL}' files ); \
|
||||
done;
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS)
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@for i in $(SDIRS); do \
|
||||
(cd $$i; echo "making links in crypto/$$i..."; \
|
||||
$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' PERL='${PERL}' links ); \
|
||||
done;
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
libs:
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making libs in crypto/$$i..."; \
|
||||
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' lib ); \
|
||||
done;
|
||||
|
||||
tests:
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making tests in crypto/$$i..."; \
|
||||
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' AR='${AR}' tests ); \
|
||||
done;
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ;\
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making install in crypto/$$i..."; \
|
||||
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' install ); \
|
||||
done;
|
||||
|
||||
lint:
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making lint in crypto/$$i..."; \
|
||||
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' lint ); \
|
||||
done;
|
||||
|
||||
depend:
|
||||
if [ ! -f buildinf.h ]; then touch buildinf.h; fi # fake buildinf.h if it does not exist
|
||||
$(MAKEDEPEND) $(INCLUDE) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
if [ ! -s buildinf.h ]; then rm buildinf.h; fi
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making depend in crypto/$$i..."; \
|
||||
$(MAKE) MAKEFILE='${MAKEFILE}' INCLUDES='${INCLUDES}' DEPFLAG='${DEPFLAG}' depend ); \
|
||||
done;
|
||||
|
||||
clean:
|
||||
rm -f buildinf.h *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making clean in crypto/$$i..."; \
|
||||
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' clean ); \
|
||||
done;
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
@for i in $(SDIRS) ;\
|
||||
do \
|
||||
(cd $$i; echo "making dclean in crypto/$$i..."; \
|
||||
$(MAKE) PERL='${PERL}' CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \
|
||||
done;
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
cpt_err.o: ../include/openssl/crypto.h ../include/openssl/err.h
|
||||
cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
|
||||
cpt_err.o: ../include/openssl/stack.h
|
||||
cryptlib.o: ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
|
||||
cryptlib.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
cryptlib.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
cryptlib.o: cryptlib.h
|
||||
cversion.o: ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
|
||||
cversion.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
cversion.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
cversion.o: buildinf.h cryptlib.h
|
||||
ex_data.o: ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
|
||||
ex_data.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
ex_data.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
|
||||
ex_data.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
|
||||
ex_data.o: ../include/openssl/stack.h cryptlib.h
|
||||
mem.o: ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
mem.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
|
||||
mem.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
mem.o: ../include/openssl/safestack.h ../include/openssl/stack.h cryptlib.h
|
||||
mem_dbg.o: ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
|
||||
mem_dbg.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
mem_dbg.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h
|
||||
mem_dbg.o: ../include/openssl/opensslv.h ../include/openssl/safestack.h
|
||||
mem_dbg.o: ../include/openssl/stack.h cryptlib.h
|
||||
tmdiff.o: ../include/openssl/bio.h ../include/openssl/buffer.h
|
||||
tmdiff.o: ../include/openssl/crypto.h ../include/openssl/e_os.h
|
||||
tmdiff.o: ../include/openssl/e_os2.h ../include/openssl/err.h
|
||||
tmdiff.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
|
||||
tmdiff.o: ../include/openssl/safestack.h ../include/openssl/stack.h
|
||||
tmdiff.o: ../include/openssl/tmdiff.h cryptlib.h
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,390 +0,0 @@
|
||||
/* a_mbstr.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
static int traverse_string(const unsigned char *p, int len, int inform,
|
||||
int (*rfunc)(unsigned long value, void *in), void *arg);
|
||||
static int in_utf8(unsigned long value, void *arg);
|
||||
static int out_utf8(unsigned long value, void *arg);
|
||||
static int type_str(unsigned long value, void *arg);
|
||||
static int cpy_asc(unsigned long value, void *arg);
|
||||
static int cpy_bmp(unsigned long value, void *arg);
|
||||
static int cpy_univ(unsigned long value, void *arg);
|
||||
static int cpy_utf8(unsigned long value, void *arg);
|
||||
static int is_printable(unsigned long value);
|
||||
|
||||
/* These functions take a string in UTF8, ASCII or multibyte form and
|
||||
* a mask of permissible ASN1 string types. It then works out the minimal
|
||||
* type (using the order Printable < IA5 < T61 < BMP < Universal < UTF8)
|
||||
* and creates a string of the correct type with the supplied data.
|
||||
* Yes this is horrible: it has to be :-(
|
||||
* The 'ncopy' form checks minimum and maximum size limits too.
|
||||
*/
|
||||
|
||||
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
|
||||
int inform, unsigned long mask)
|
||||
{
|
||||
return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0);
|
||||
}
|
||||
|
||||
int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
|
||||
int inform, unsigned long mask,
|
||||
long minsize, long maxsize)
|
||||
{
|
||||
int str_type;
|
||||
int ret;
|
||||
int outform, outlen;
|
||||
ASN1_STRING *dest;
|
||||
unsigned char *p;
|
||||
int nchar;
|
||||
char strbuf[32];
|
||||
int (*cpyfunc)(unsigned long,void *) = NULL;
|
||||
if(len == -1) len = strlen((const char *)in);
|
||||
if(!mask) mask = DIRSTRING_TYPE;
|
||||
|
||||
/* First do a string check and work out the number of characters */
|
||||
switch(inform) {
|
||||
|
||||
case MBSTRING_BMP:
|
||||
if(len & 1) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
|
||||
ASN1_R_INVALID_BMPSTRING_LENGTH);
|
||||
return -1;
|
||||
}
|
||||
nchar = len >> 1;
|
||||
break;
|
||||
|
||||
case MBSTRING_UNIV:
|
||||
if(len & 3) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
|
||||
ASN1_R_INVALID_UNIVERSALSTRING_LENGTH);
|
||||
return -1;
|
||||
}
|
||||
nchar = len >> 2;
|
||||
break;
|
||||
|
||||
case MBSTRING_UTF8:
|
||||
nchar = 0;
|
||||
/* This counts the characters and does utf8 syntax checking */
|
||||
ret = traverse_string(in, len, MBSTRING_UTF8, in_utf8, &nchar);
|
||||
if(ret < 0) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
|
||||
ASN1_R_INVALID_UTF8STRING);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case MBSTRING_ASC:
|
||||
nchar = len;
|
||||
break;
|
||||
|
||||
default:
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_UNKNOWN_FORMAT);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((minsize > 0) && (nchar < minsize)) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_SHORT);
|
||||
sprintf(strbuf, "%ld", minsize);
|
||||
ERR_add_error_data(2, "minsize=", strbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((maxsize > 0) && (nchar > maxsize)) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_STRING_TOO_LONG);
|
||||
sprintf(strbuf, "%ld", maxsize);
|
||||
ERR_add_error_data(2, "maxsize=", strbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Now work out minimal type (if any) */
|
||||
if(traverse_string(in, len, inform, type_str, &mask) < 0) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY, ASN1_R_ILLEGAL_CHARACTERS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Now work out output format and string type */
|
||||
outform = MBSTRING_ASC;
|
||||
if(mask & B_ASN1_PRINTABLESTRING) str_type = V_ASN1_PRINTABLESTRING;
|
||||
else if(mask & B_ASN1_IA5STRING) str_type = V_ASN1_IA5STRING;
|
||||
else if(mask & B_ASN1_T61STRING) str_type = V_ASN1_T61STRING;
|
||||
else if(mask & B_ASN1_BMPSTRING) {
|
||||
str_type = V_ASN1_BMPSTRING;
|
||||
outform = MBSTRING_BMP;
|
||||
} else if(mask & B_ASN1_UNIVERSALSTRING) {
|
||||
str_type = V_ASN1_UNIVERSALSTRING;
|
||||
outform = MBSTRING_UNIV;
|
||||
} else {
|
||||
str_type = V_ASN1_UTF8STRING;
|
||||
outform = MBSTRING_UTF8;
|
||||
}
|
||||
if(!out) return str_type;
|
||||
if(*out) {
|
||||
dest = *out;
|
||||
if(dest->data) {
|
||||
dest->length = 0;
|
||||
Free(dest->data);
|
||||
dest->data = NULL;
|
||||
}
|
||||
dest->type = str_type;
|
||||
} else {
|
||||
dest = ASN1_STRING_type_new(str_type);
|
||||
if(!dest) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,
|
||||
ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
*out = dest;
|
||||
}
|
||||
/* If both the same type just copy across */
|
||||
if(inform == outform) {
|
||||
if(!ASN1_STRING_set(dest, in, len)) {
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
return str_type;
|
||||
}
|
||||
|
||||
/* Work out how much space the destination will need */
|
||||
switch(outform) {
|
||||
case MBSTRING_ASC:
|
||||
outlen = nchar;
|
||||
cpyfunc = cpy_asc;
|
||||
break;
|
||||
|
||||
case MBSTRING_BMP:
|
||||
outlen = nchar << 1;
|
||||
cpyfunc = cpy_bmp;
|
||||
break;
|
||||
|
||||
case MBSTRING_UNIV:
|
||||
outlen = nchar << 2;
|
||||
cpyfunc = cpy_univ;
|
||||
break;
|
||||
|
||||
case MBSTRING_UTF8:
|
||||
outlen = 0;
|
||||
traverse_string(in, len, inform, out_utf8, &outlen);
|
||||
cpyfunc = cpy_utf8;
|
||||
break;
|
||||
}
|
||||
if(!(p = Malloc(outlen + 1))) {
|
||||
ASN1_STRING_free(dest);
|
||||
ASN1err(ASN1_F_ASN1_MBSTRING_COPY,ERR_R_MALLOC_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
dest->length = outlen;
|
||||
dest->data = p;
|
||||
p[outlen] = 0;
|
||||
traverse_string(in, len, inform, cpyfunc, &p);
|
||||
return str_type;
|
||||
}
|
||||
|
||||
/* This function traverses a string and passes the value of each character
|
||||
* to an optional function along with a void * argument.
|
||||
*/
|
||||
|
||||
static int traverse_string(const unsigned char *p, int len, int inform,
|
||||
int (*rfunc)(unsigned long value, void *in), void *arg)
|
||||
{
|
||||
unsigned long value;
|
||||
int ret;
|
||||
while(len) {
|
||||
if(inform == MBSTRING_ASC) {
|
||||
value = *p++;
|
||||
len--;
|
||||
} else if(inform == MBSTRING_BMP) {
|
||||
value = *p++ << 8;
|
||||
value |= *p++;
|
||||
len -= 2;
|
||||
} else if(inform == MBSTRING_UNIV) {
|
||||
value = *p++ << 24;
|
||||
value |= *p++ << 16;
|
||||
value |= *p++ << 8;
|
||||
value |= *p++;
|
||||
len -= 4;
|
||||
} else {
|
||||
ret = UTF8_getc(p, len, &value);
|
||||
if(ret < 0) return -1;
|
||||
len -= ret;
|
||||
p += ret;
|
||||
}
|
||||
if(rfunc) {
|
||||
ret = rfunc(value, arg);
|
||||
if(ret <= 0) return ret;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Various utility functions for traverse_string */
|
||||
|
||||
/* Just count number of characters */
|
||||
|
||||
static int in_utf8(unsigned long value, void *arg)
|
||||
{
|
||||
int *nchar;
|
||||
nchar = arg;
|
||||
(*nchar)++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Determine size of output as a UTF8 String */
|
||||
|
||||
static int out_utf8(unsigned long value, void *arg)
|
||||
{
|
||||
long *outlen;
|
||||
outlen = arg;
|
||||
*outlen += UTF8_putc(NULL, -1, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Determine the "type" of a string: check each character against a
|
||||
* supplied "mask".
|
||||
*/
|
||||
|
||||
static int type_str(unsigned long value, void *arg)
|
||||
{
|
||||
unsigned long types;
|
||||
types = *((unsigned long *)arg);
|
||||
if((types & B_ASN1_PRINTABLESTRING) && !is_printable(value))
|
||||
types &= ~B_ASN1_PRINTABLESTRING;
|
||||
if((types & B_ASN1_IA5STRING) && (value > 127))
|
||||
types &= ~B_ASN1_IA5STRING;
|
||||
if((types & B_ASN1_T61STRING) && (value > 0xff))
|
||||
types &= ~B_ASN1_T61STRING;
|
||||
if((types & B_ASN1_BMPSTRING) && (value > 0xffff))
|
||||
types &= ~B_ASN1_BMPSTRING;
|
||||
if(!types) return -1;
|
||||
*((unsigned long *)arg) = types;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copy one byte per character ASCII like strings */
|
||||
|
||||
static int cpy_asc(unsigned long value, void *arg)
|
||||
{
|
||||
unsigned char **p, *q;
|
||||
p = arg;
|
||||
q = *p;
|
||||
*q = (unsigned char) value;
|
||||
(*p)++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copy two byte per character BMPStrings */
|
||||
|
||||
static int cpy_bmp(unsigned long value, void *arg)
|
||||
{
|
||||
unsigned char **p, *q;
|
||||
p = arg;
|
||||
q = *p;
|
||||
*q++ = (unsigned char) ((value >> 8) & 0xff);
|
||||
*q = (unsigned char) (value & 0xff);
|
||||
*p += 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copy four byte per character UniversalStrings */
|
||||
|
||||
static int cpy_univ(unsigned long value, void *arg)
|
||||
{
|
||||
unsigned char **p, *q;
|
||||
p = arg;
|
||||
q = *p;
|
||||
*q++ = (unsigned char) ((value >> 24) & 0xff);
|
||||
*q++ = (unsigned char) ((value >> 16) & 0xff);
|
||||
*q++ = (unsigned char) ((value >> 8) & 0xff);
|
||||
*q = (unsigned char) (value & 0xff);
|
||||
*p += 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Copy to a UTF8String */
|
||||
|
||||
static int cpy_utf8(unsigned long value, void *arg)
|
||||
{
|
||||
unsigned char **p;
|
||||
int ret;
|
||||
p = arg;
|
||||
/* We already know there is enough room so pass 0xff as the length */
|
||||
ret = UTF8_putc(*p, 0xff, value);
|
||||
*p += ret;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return 1 if the character is permitted in a PrintableString */
|
||||
static int is_printable(unsigned long value)
|
||||
{
|
||||
int ch;
|
||||
if(value > 0x7f) return 0;
|
||||
ch = (int) value;
|
||||
/* Note: we can't use 'isalnum' because certain accented
|
||||
* characters may count as alphanumeric in some environments.
|
||||
*/
|
||||
if((ch >= 'a') && (ch <= 'z')) return 1;
|
||||
if((ch >= 'A') && (ch <= 'Z')) return 1;
|
||||
if((ch >= '0') && (ch <= '9')) return 1;
|
||||
if ((ch == ' ') || strchr("'()+,-./:=?", ch)) return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/* a_null.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
/* ASN1 functions for NULL type. For compatibility with other ASN1 code
|
||||
* it returns a pointer to an "ASN1_NULL" structure. The new/free functions
|
||||
* don't need to do any allocating because nothing is stored in a NULL.
|
||||
*/
|
||||
|
||||
int i2d_ASN1_NULL(ASN1_NULL *a, unsigned char **pp)
|
||||
{
|
||||
if(!a) return 0;
|
||||
if (pp) ASN1_put_object(pp,0,0,V_ASN1_NULL,V_ASN1_UNIVERSAL);
|
||||
return 2;
|
||||
}
|
||||
|
||||
ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, unsigned char **pp, long length)
|
||||
{
|
||||
ASN1_NULL *ret = NULL;
|
||||
unsigned char *p;
|
||||
long len;
|
||||
int inf,tag,xclass;
|
||||
int i=0;
|
||||
|
||||
p= *pp;
|
||||
inf=ASN1_get_object(&p,&len,&tag,&xclass,length);
|
||||
if (inf & 0x80)
|
||||
{
|
||||
i=ASN1_R_BAD_OBJECT_HEADER;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (tag != V_ASN1_NULL)
|
||||
{
|
||||
i=ASN1_R_EXPECTING_A_NULL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (len != 0)
|
||||
{
|
||||
i=ASN1_R_NULL_IS_WRONG_LENGTH;
|
||||
goto err;
|
||||
}
|
||||
ret=(ASN1_NULL *)1;
|
||||
if (a != NULL) (*a)=ret;
|
||||
*pp=p;
|
||||
return(ret);
|
||||
err:
|
||||
ASN1err(ASN1_F_D2I_ASN1_NULL,i);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
ASN1_NULL *ASN1_NULL_new(void)
|
||||
{
|
||||
return (ASN1_NULL *)1;
|
||||
}
|
||||
|
||||
void ASN1_NULL_free(ASN1_NULL *a)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
/* a_strnid.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
|
||||
static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
|
||||
static void st_free(ASN1_STRING_TABLE *tbl);
|
||||
static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b);
|
||||
static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b);
|
||||
|
||||
|
||||
/* This is the global mask for the mbstring functions: this is use to
|
||||
* mask out certain types (such as BMPString and UTF8String) because
|
||||
* certain software (e.g. Netscape) has problems with them.
|
||||
*/
|
||||
|
||||
static unsigned long global_mask = 0xFFFFFFFFL;
|
||||
|
||||
void ASN1_STRING_set_default_mask(unsigned long mask)
|
||||
{
|
||||
global_mask = mask;
|
||||
}
|
||||
|
||||
unsigned long ASN1_STRING_get_default_mask(void)
|
||||
{
|
||||
return global_mask;
|
||||
}
|
||||
|
||||
/* This function sets the default to various "flavours" of configuration.
|
||||
* based on an ASCII string. Currently this is:
|
||||
* MASK:XXXX : a numerical mask value.
|
||||
* nobmp : Don't use BMPStrings (just Printable, T61).
|
||||
* pkix : PKIX recommendation in RFC2459.
|
||||
* utf8only : only use UTF8Strings (RFC2459 recommendation for 2004).
|
||||
* default: the default value, Printable, T61, BMP.
|
||||
*/
|
||||
|
||||
int ASN1_STRING_set_default_mask_asc(char *p)
|
||||
{
|
||||
unsigned long mask;
|
||||
char *end;
|
||||
if(!strncmp(p, "MASK:", 5)) {
|
||||
if(!p[5]) return 0;
|
||||
mask = strtoul(p + 5, &end, 0);
|
||||
if(*end) return 0;
|
||||
} else if(!strcmp(p, "nombstr"))
|
||||
mask = ~(B_ASN1_BMPSTRING|B_ASN1_UTF8STRING);
|
||||
else if(!strcmp(p, "pkix"))
|
||||
mask = ~B_ASN1_T61STRING;
|
||||
else if(!strcmp(p, "utf8only")) mask = B_ASN1_UTF8STRING;
|
||||
else if(!strcmp(p, "default"))
|
||||
mask = 0xFFFFFFFFL;
|
||||
else return 0;
|
||||
ASN1_STRING_set_default_mask(mask);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* The following function generates an ASN1_STRING based on limits in a table.
|
||||
* Frequently the types and length of an ASN1_STRING are restricted by a
|
||||
* corresponding OID. For example certificates and certificate requests.
|
||||
*/
|
||||
|
||||
ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
|
||||
int inlen, int inform, int nid)
|
||||
{
|
||||
ASN1_STRING_TABLE *tbl;
|
||||
ASN1_STRING *str = NULL;
|
||||
unsigned long mask;
|
||||
int ret;
|
||||
if(!out) out = &str;
|
||||
tbl = ASN1_STRING_TABLE_get(nid);
|
||||
if(tbl) {
|
||||
mask = tbl->mask;
|
||||
if(!(tbl->flags & STABLE_NO_MASK)) mask &= global_mask;
|
||||
ret = ASN1_mbstring_ncopy(out, in, inlen, inform, tbl->mask,
|
||||
tbl->minsize, tbl->maxsize);
|
||||
} else ret = ASN1_mbstring_copy(out, in, inlen, inform, DIRSTRING_TYPE & global_mask);
|
||||
if(ret <= 0) return NULL;
|
||||
return *out;
|
||||
}
|
||||
|
||||
/* Now the tables and helper functions for the string table:
|
||||
*/
|
||||
|
||||
/* size limits: this stuff is taken straight from RFC2459 */
|
||||
|
||||
#define ub_name 32768
|
||||
#define ub_common_name 64
|
||||
#define ub_locality_name 128
|
||||
#define ub_state_name 128
|
||||
#define ub_organization_name 64
|
||||
#define ub_organization_unit_name 64
|
||||
#define ub_title 64
|
||||
#define ub_email_address 128
|
||||
|
||||
/* This table must be kept in NID order */
|
||||
|
||||
static ASN1_STRING_TABLE tbl_standard[] = {
|
||||
{NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0},
|
||||
{NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
|
||||
{NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0},
|
||||
{NID_stateOrProvinceName, 1, ub_state_name, DIRSTRING_TYPE, 0},
|
||||
{NID_organizationName, 1, ub_organization_name, DIRSTRING_TYPE, 0},
|
||||
{NID_organizationalUnitName, 1, ub_organization_unit_name, DIRSTRING_TYPE, 0},
|
||||
{NID_pkcs9_emailAddress, 1, ub_email_address, B_ASN1_IA5STRING, STABLE_NO_MASK},
|
||||
{NID_pkcs9_unstructuredName, 1, -1, PKCS9STRING_TYPE, 0},
|
||||
{NID_pkcs9_challengePassword, 1, -1, PKCS9STRING_TYPE, 0},
|
||||
{NID_pkcs9_unstructuredAddress, 1, -1, DIRSTRING_TYPE, 0},
|
||||
{NID_givenName, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||
{NID_surname, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||
{NID_initials, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||
{NID_name, 1, ub_name, DIRSTRING_TYPE, 0},
|
||||
{NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK}
|
||||
};
|
||||
|
||||
static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b)
|
||||
{
|
||||
return (*a)->nid - (*b)->nid;
|
||||
}
|
||||
|
||||
static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b)
|
||||
{
|
||||
return a->nid - b->nid;
|
||||
}
|
||||
|
||||
ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid)
|
||||
{
|
||||
int idx;
|
||||
ASN1_STRING_TABLE *ttmp;
|
||||
ASN1_STRING_TABLE fnd;
|
||||
fnd.nid = nid;
|
||||
ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd,
|
||||
(char *)tbl_standard,
|
||||
sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE),
|
||||
sizeof(ASN1_STRING_TABLE), (int(*)())table_cmp);
|
||||
if(ttmp) return ttmp;
|
||||
if(!stable) return NULL;
|
||||
idx = sk_ASN1_STRING_TABLE_find(stable, &fnd);
|
||||
if(idx < 0) return NULL;
|
||||
return sk_ASN1_STRING_TABLE_value(stable, idx);
|
||||
}
|
||||
|
||||
int ASN1_STRING_TABLE_add(int nid,
|
||||
long minsize, long maxsize, unsigned long mask,
|
||||
unsigned long flags)
|
||||
{
|
||||
ASN1_STRING_TABLE *tmp;
|
||||
char new_nid = 0;
|
||||
flags &= ~STABLE_FLAGS_MALLOC;
|
||||
if(!stable) stable = sk_ASN1_STRING_TABLE_new(sk_table_cmp);
|
||||
if(!stable) {
|
||||
ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
if(!(tmp = ASN1_STRING_TABLE_get(nid))) {
|
||||
tmp = Malloc(sizeof(ASN1_STRING_TABLE));
|
||||
if(!tmp) {
|
||||
ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD,
|
||||
ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
tmp->flags = flags | STABLE_FLAGS_MALLOC;
|
||||
tmp->nid = nid;
|
||||
new_nid = 1;
|
||||
} else tmp->flags = (tmp->flags & STABLE_FLAGS_MALLOC) | flags;
|
||||
if(minsize != -1) tmp->minsize = minsize;
|
||||
if(maxsize != -1) tmp->maxsize = maxsize;
|
||||
tmp->mask = mask;
|
||||
if(new_nid) sk_ASN1_STRING_TABLE_push(stable, tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ASN1_STRING_TABLE_cleanup(void)
|
||||
{
|
||||
STACK_OF(ASN1_STRING_TABLE) *tmp;
|
||||
tmp = stable;
|
||||
if(!tmp) return;
|
||||
stable = NULL;
|
||||
sk_ASN1_STRING_TABLE_pop_free(tmp, st_free);
|
||||
}
|
||||
|
||||
static void st_free(ASN1_STRING_TABLE *tbl)
|
||||
{
|
||||
if(tbl->flags & STABLE_FLAGS_MALLOC) Free(tbl);
|
||||
}
|
||||
|
||||
IMPLEMENT_STACK_OF(ASN1_STRING_TABLE)
|
||||
@@ -1,131 +0,0 @@
|
||||
/* crypto/asn1/p8_key.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/asn1_mac.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
int i2d_X509_KEY(X509 *a, unsigned char **pp)
|
||||
{
|
||||
M_ASN1_I2D_vars(a);
|
||||
|
||||
M_ASN1_I2D_len(a->cert_info, i2d_X509_CINF);
|
||||
M_ASN1_I2D_len(a->sig_alg, i2d_X509_ALGOR);
|
||||
M_ASN1_I2D_len(a->signature, i2d_ASN1_BIT_STRING);
|
||||
|
||||
M_ASN1_I2D_seq_total();
|
||||
|
||||
M_ASN1_I2D_put(a->cert_info, i2d_X509_CINF);
|
||||
M_ASN1_I2D_put(a->sig_alg, i2d_X509_ALGOR);
|
||||
M_ASN1_I2D_put(a->signature, i2d_ASN1_BIT_STRING);
|
||||
|
||||
M_ASN1_I2D_finish();
|
||||
}
|
||||
|
||||
X509 *d2i_X509_KEY(X509 **a, unsigned char **pp, long length)
|
||||
{
|
||||
M_ASN1_D2I_vars(a,X509 *,X509_new);
|
||||
|
||||
M_ASN1_D2I_Init();
|
||||
M_ASN1_D2I_start_sequence();
|
||||
M_ASN1_D2I_get(ret->cert_info,d2i_X509_CINF);
|
||||
M_ASN1_D2I_get(ret->sig_alg,d2i_X509_ALGOR);
|
||||
M_ASN1_D2I_get(ret->signature,d2i_ASN1_BIT_STRING);
|
||||
M_ASN1_D2I_Finish(a,X509_free,ASN1_F_D2I_X509);
|
||||
}
|
||||
|
||||
X509 *X509_KEY_new(void)
|
||||
{
|
||||
X509_KEY *ret=NULL;
|
||||
|
||||
M_ASN1_New_Malloc(ret,X509_KEY);
|
||||
ret->references=1;
|
||||
ret->type=NID
|
||||
M_ASN1_New(ret->cert_info,X509_CINF_new);
|
||||
M_ASN1_New(ret->sig_alg,X509_ALGOR_new);
|
||||
M_ASN1_New(ret->signature,ASN1_BIT_STRING_new);
|
||||
return(ret);
|
||||
M_ASN1_New_Error(ASN1_F_X509_NEW);
|
||||
}
|
||||
|
||||
void X509_KEY_free(X509 *a)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (a == NULL) return;
|
||||
|
||||
i=CRYPTO_add_lock(&a->references,-1,CRYPTO_LOCK_X509_KEY);
|
||||
#ifdef REF_PRINT
|
||||
REF_PRINT("X509_KEY",a);
|
||||
#endif
|
||||
if (i > 0) return;
|
||||
#ifdef REF_CHECK
|
||||
if (i < 0)
|
||||
{
|
||||
fprintf(stderr,"X509_KEY_free, bad reference count\n");
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
X509_CINF_free(a->cert_info);
|
||||
X509_ALGOR_free(a->sig_alg);
|
||||
ASN1_BIT_STRING_free(a->signature);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/* t_bitst.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
|
||||
BIT_STRING_BITNAME *tbl, int indent)
|
||||
{
|
||||
BIT_STRING_BITNAME *bnam;
|
||||
char first = 1;
|
||||
BIO_printf(out, "%*s", indent, "");
|
||||
for(bnam = tbl; bnam->lname; bnam++) {
|
||||
if(ASN1_BIT_STRING_get_bit(bs, bnam->bitnum)) {
|
||||
if(!first) BIO_puts(out, ", ");
|
||||
BIO_puts(out, bnam->lname);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
BIO_puts(out, "\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
|
||||
BIT_STRING_BITNAME *tbl)
|
||||
{
|
||||
int bitnum;
|
||||
bitnum = ASN1_BIT_STRING_num_asc(name, tbl);
|
||||
if(bitnum < 0) return 0;
|
||||
if(bs) ASN1_BIT_STRING_set_bit(bs, bitnum, value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl)
|
||||
{
|
||||
BIT_STRING_BITNAME *bnam;
|
||||
for(bnam = tbl; bnam->lname; bnam++) {
|
||||
if(!strcmp(bnam->sname, name) ||
|
||||
!strcmp(bnam->lname, name) ) return bnam->bitnum;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/* t_spki.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
|
||||
/* Print out an SPKI */
|
||||
|
||||
int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
|
||||
{
|
||||
EVP_PKEY *pkey;
|
||||
ASN1_IA5STRING *chal;
|
||||
int i, n;
|
||||
char *s;
|
||||
BIO_printf(out, "Netscape SPKI:\n");
|
||||
i=OBJ_obj2nid(spki->spkac->pubkey->algor->algorithm);
|
||||
BIO_printf(out," Public Key Algorithm: %s\n",
|
||||
(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
|
||||
pkey = X509_PUBKEY_get(spki->spkac->pubkey);
|
||||
if(!pkey) BIO_printf(out, " Unable to load public key\n");
|
||||
else {
|
||||
#ifndef NO_RSA
|
||||
if (pkey->type == EVP_PKEY_RSA)
|
||||
{
|
||||
BIO_printf(out," RSA Public Key: (%d bit)\n",
|
||||
BN_num_bits(pkey->pkey.rsa->n));
|
||||
RSA_print(out,pkey->pkey.rsa,2);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
if (pkey->type == EVP_PKEY_DSA)
|
||||
{
|
||||
BIO_printf(out," DSA Public Key:\n");
|
||||
DSA_print(out,pkey->pkey.dsa,2);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
BIO_printf(out," Unknown Public Key:\n");
|
||||
EVP_PKEY_free(pkey);
|
||||
}
|
||||
chal = spki->spkac->challenge;
|
||||
if(chal->length)
|
||||
BIO_printf(out, " Challenge String: %s\n", chal->data);
|
||||
i=OBJ_obj2nid(spki->sig_algor->algorithm);
|
||||
BIO_printf(out," Signature Algorithm: %s",
|
||||
(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i));
|
||||
|
||||
n=spki->signature->length;
|
||||
s=(char *)spki->signature->data;
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
if ((i%18) == 0) BIO_write(out,"\n ",7);
|
||||
BIO_printf(out,"%02x%s",(unsigned char)s[i],
|
||||
((i+1) == n)?"":":");
|
||||
}
|
||||
BIO_write(out,"\n",1);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/* t_x509a.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
/* X509_CERT_AUX and string set routines
|
||||
*/
|
||||
|
||||
int X509_CERT_AUX_print(BIO *out, X509_CERT_AUX *aux, int indent)
|
||||
{
|
||||
char oidstr[80], first;
|
||||
int i;
|
||||
if(!aux) return 1;
|
||||
if(aux->trust) {
|
||||
first = 1;
|
||||
BIO_printf(out, "%*sTrusted Uses:\n%*s",
|
||||
indent, "", indent + 2, "");
|
||||
for(i = 0; i < sk_ASN1_OBJECT_num(aux->trust); i++) {
|
||||
if(!first) BIO_puts(out, ", ");
|
||||
else first = 0;
|
||||
OBJ_obj2txt(oidstr, 80,
|
||||
sk_ASN1_OBJECT_value(aux->trust, i), 0);
|
||||
BIO_puts(out, oidstr);
|
||||
}
|
||||
BIO_puts(out, "\n");
|
||||
} else BIO_printf(out, "%*sNo Trusted Uses.\n", indent, "");
|
||||
if(aux->reject) {
|
||||
first = 1;
|
||||
BIO_printf(out, "%*sRejected Uses:\n%*s",
|
||||
indent, "", indent + 2, "");
|
||||
for(i = 0; i < sk_ASN1_OBJECT_num(aux->reject); i++) {
|
||||
if(!first) BIO_puts(out, ", ");
|
||||
else first = 0;
|
||||
OBJ_obj2txt(oidstr, 80,
|
||||
sk_ASN1_OBJECT_value(aux->reject, i), 0);
|
||||
BIO_puts(out, oidstr);
|
||||
}
|
||||
BIO_puts(out, "\n");
|
||||
} else BIO_printf(out, "%*sNo Rejected Uses.\n", indent, "");
|
||||
if(aux->alias) BIO_printf(out, "%*sAlias: %s\n", indent, "",
|
||||
aux->alias->data);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
/* a_x509a.c */
|
||||
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/asn1_mac.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
/* X509_CERT_AUX routines. These are used to encode additional
|
||||
* user modifiable data about a certificate. This data is
|
||||
* appended to the X509 encoding when the *_X509_AUX routines
|
||||
* are used. This means that the "traditional" X509 routines
|
||||
* will simply ignore the extra data.
|
||||
*/
|
||||
|
||||
static X509_CERT_AUX *aux_get(X509 *x);
|
||||
|
||||
X509_CERT_AUX *d2i_X509_CERT_AUX(X509_CERT_AUX **a, unsigned char **pp, long length)
|
||||
{
|
||||
M_ASN1_D2I_vars(a, X509_CERT_AUX *, X509_CERT_AUX_new);
|
||||
|
||||
M_ASN1_D2I_Init();
|
||||
M_ASN1_D2I_start_sequence();
|
||||
|
||||
M_ASN1_D2I_get_seq_opt_type(ASN1_OBJECT, ret->trust,
|
||||
d2i_ASN1_OBJECT, ASN1_OBJECT_free);
|
||||
M_ASN1_D2I_get_IMP_set_opt_type(ASN1_OBJECT, ret->reject,
|
||||
d2i_ASN1_OBJECT, ASN1_OBJECT_free, 0);
|
||||
M_ASN1_D2I_get_opt(ret->alias, d2i_ASN1_UTF8STRING, V_ASN1_UTF8STRING);
|
||||
M_ASN1_D2I_get_opt(ret->keyid, d2i_ASN1_OCTET_STRING, V_ASN1_OCTET_STRING);
|
||||
M_ASN1_D2I_get_IMP_set_opt_type(X509_ALGOR, ret->other,
|
||||
d2i_X509_ALGOR, X509_ALGOR_free, 1);
|
||||
|
||||
M_ASN1_D2I_Finish(a, X509_CERT_AUX_free, ASN1_F_D2I_X509_CERT_AUX);
|
||||
}
|
||||
|
||||
X509_CERT_AUX *X509_CERT_AUX_new()
|
||||
{
|
||||
X509_CERT_AUX *ret = NULL;
|
||||
ASN1_CTX c;
|
||||
M_ASN1_New_Malloc(ret, X509_CERT_AUX);
|
||||
ret->trust = NULL;
|
||||
ret->reject = NULL;
|
||||
ret->alias = NULL;
|
||||
ret->keyid = NULL;
|
||||
ret->other = NULL;
|
||||
return(ret);
|
||||
M_ASN1_New_Error(ASN1_F_X509_CERT_AUX_NEW);
|
||||
}
|
||||
|
||||
void X509_CERT_AUX_free(X509_CERT_AUX *a)
|
||||
{
|
||||
if(a == NULL) return;
|
||||
sk_ASN1_OBJECT_pop_free(a->trust, ASN1_OBJECT_free);
|
||||
sk_ASN1_OBJECT_pop_free(a->reject, ASN1_OBJECT_free);
|
||||
ASN1_UTF8STRING_free(a->alias);
|
||||
ASN1_OCTET_STRING_free(a->keyid);
|
||||
sk_X509_ALGOR_pop_free(a->other, X509_ALGOR_free);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **pp)
|
||||
{
|
||||
M_ASN1_I2D_vars(a);
|
||||
|
||||
M_ASN1_I2D_len_SEQUENCE_opt_type(ASN1_OBJECT, a->trust, i2d_ASN1_OBJECT);
|
||||
M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(ASN1_OBJECT, a->reject, i2d_ASN1_OBJECT, 0);
|
||||
|
||||
M_ASN1_I2D_len(a->alias, i2d_ASN1_UTF8STRING);
|
||||
M_ASN1_I2D_len(a->keyid, i2d_ASN1_OCTET_STRING);
|
||||
M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(X509_ALGOR, a->other, i2d_X509_ALGOR, 1);
|
||||
|
||||
M_ASN1_I2D_seq_total();
|
||||
|
||||
M_ASN1_I2D_put_SEQUENCE_opt_type(ASN1_OBJECT, a->trust, i2d_ASN1_OBJECT);
|
||||
M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(ASN1_OBJECT, a->reject, i2d_ASN1_OBJECT, 0);
|
||||
|
||||
M_ASN1_I2D_put(a->alias, i2d_ASN1_UTF8STRING);
|
||||
M_ASN1_I2D_put(a->keyid, i2d_ASN1_OCTET_STRING);
|
||||
M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(X509_ALGOR, a->other, i2d_X509_ALGOR, 1);
|
||||
|
||||
M_ASN1_I2D_finish();
|
||||
}
|
||||
|
||||
static X509_CERT_AUX *aux_get(X509 *x)
|
||||
{
|
||||
if(!x) return NULL;
|
||||
if(!x->aux && !(x->aux = X509_CERT_AUX_new())) return NULL;
|
||||
return x->aux;
|
||||
}
|
||||
|
||||
int X509_alias_set1(X509 *x, unsigned char *name, int len)
|
||||
{
|
||||
X509_CERT_AUX *aux;
|
||||
if(!(aux = aux_get(x))) return 0;
|
||||
if(!aux->alias && !(aux->alias = ASN1_UTF8STRING_new())) return 0;
|
||||
return ASN1_STRING_set(aux->alias, name, len);
|
||||
}
|
||||
|
||||
unsigned char *X509_alias_get0(X509 *x, int *len)
|
||||
{
|
||||
if(!x->aux || !x->aux->alias) return NULL;
|
||||
if(len) *len = x->aux->alias->length;
|
||||
return x->aux->alias->data;
|
||||
}
|
||||
|
||||
int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj)
|
||||
{
|
||||
X509_CERT_AUX *aux;
|
||||
ASN1_OBJECT *objtmp;
|
||||
if(!(objtmp = OBJ_dup(obj))) return 0;
|
||||
if(!(aux = aux_get(x))) return 0;
|
||||
if(!aux->trust
|
||||
&& !(aux->trust = sk_ASN1_OBJECT_new_null())) return 0;
|
||||
return sk_ASN1_OBJECT_push(aux->trust, objtmp);
|
||||
}
|
||||
|
||||
int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj)
|
||||
{
|
||||
X509_CERT_AUX *aux;
|
||||
ASN1_OBJECT *objtmp;
|
||||
if(!(objtmp = OBJ_dup(obj))) return 0;
|
||||
if(!(aux = aux_get(x))) return 0;
|
||||
if(!aux->reject
|
||||
&& !(aux->reject = sk_ASN1_OBJECT_new_null())) return 0;
|
||||
return sk_ASN1_OBJECT_push(aux->reject, objtmp);
|
||||
}
|
||||
|
||||
void X509_trust_clear(X509 *x)
|
||||
{
|
||||
if(x->aux && x->aux->trust) {
|
||||
sk_ASN1_OBJECT_pop_free(x->aux->trust, ASN1_OBJECT_free);
|
||||
x->aux->trust = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void X509_reject_clear(X509 *x)
|
||||
{
|
||||
if(x->aux && x->aux->reject) {
|
||||
sk_ASN1_OBJECT_pop_free(x->aux->reject, ASN1_OBJECT_free);
|
||||
x->aux->reject = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/blowfish/Makefile
|
||||
#
|
||||
|
||||
DIR= bf
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
CPP= $(CC) -E
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
BF_ENC= bf_enc.o
|
||||
# or use
|
||||
#DES_ENC= bx86-elf.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=bftest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c
|
||||
LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= blowfish.h
|
||||
HEADER= bf_pi.h bf_locl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
# elf
|
||||
asm/bx86-elf.o: asm/bx86unix.cpp
|
||||
$(CPP) -DELF -x c asm/bx86unix.cpp | as -o asm/bx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/bx86-sol.o: asm/bx86unix.cpp
|
||||
$(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
|
||||
as -o asm/bx86-sol.o asm/bx86-sol.s
|
||||
rm -f asm/bx86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/bx86-out.o: asm/bx86unix.cpp
|
||||
$(CPP) -DOUT asm/bx86unix.cpp | as -o asm/bx86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/bx86bsdi.o: asm/bx86unix.cpp
|
||||
$(CPP) -DBSDI asm/bx86unix.cpp | sed 's/ :/:/' | as -o asm/bx86bsdi.o
|
||||
|
||||
asm/bx86unix.cpp: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
|
||||
(cd asm; $(PERL) bf-586.pl cpp $(PROCESSOR) >bx86unix.cpp)
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f asm/bx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
bf_cfb64.o: ../../include/openssl/blowfish.h
|
||||
bf_cfb64.o: ../../include/openssl/opensslconf.h bf_locl.h
|
||||
bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/opensslconf.h
|
||||
bf_ecb.o: ../../include/openssl/opensslv.h bf_locl.h
|
||||
bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/opensslconf.h
|
||||
bf_enc.o: bf_locl.h
|
||||
bf_ofb64.o: ../../include/openssl/blowfish.h
|
||||
bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h
|
||||
bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/opensslconf.h
|
||||
bf_skey.o: bf_locl.h bf_pi.h
|
||||
@@ -1,220 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/bio/Makefile
|
||||
#
|
||||
|
||||
DIR= bio
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= bio_lib.c bio_cb.c bio_err.c \
|
||||
bss_mem.c bss_null.c bss_fd.c \
|
||||
bss_file.c bss_sock.c bss_conn.c \
|
||||
bf_null.c bf_buff.c b_print.c b_dump.c \
|
||||
b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c
|
||||
LIBOBJ= bio_lib.o bio_cb.o bio_err.o \
|
||||
bss_mem.o bss_null.o bss_fd.o \
|
||||
bss_file.o bss_sock.o bss_conn.o \
|
||||
bf_null.o bf_buff.o b_print.o b_dump.o \
|
||||
b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= bio.h
|
||||
HEADER= bss_file.c $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER); \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
b_dump.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
b_dump.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
b_dump.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
b_dump.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
b_dump.o: ../cryptlib.h
|
||||
b_print.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
b_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
b_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
b_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
b_print.o: ../cryptlib.h
|
||||
b_sock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
b_sock.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
b_sock.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
b_sock.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
b_sock.o: ../cryptlib.h
|
||||
bf_buff.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
bf_buff.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
|
||||
bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
|
||||
bf_buff.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
bf_buff.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
bf_buff.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bf_buff.o: ../../include/openssl/err.h ../../include/openssl/evp.h
|
||||
bf_buff.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
|
||||
bf_buff.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
|
||||
bf_buff.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
|
||||
bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
|
||||
bf_buff.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
|
||||
bf_buff.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
|
||||
bf_buff.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
||||
bf_buff.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bf_nbio.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
bf_nbio.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
|
||||
bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
|
||||
bf_nbio.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
bf_nbio.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
bf_nbio.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bf_nbio.o: ../../include/openssl/err.h ../../include/openssl/evp.h
|
||||
bf_nbio.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
|
||||
bf_nbio.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
|
||||
bf_nbio.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
|
||||
bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
bf_nbio.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
|
||||
bf_nbio.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
|
||||
bf_nbio.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
|
||||
bf_nbio.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
|
||||
bf_nbio.o: ../cryptlib.h
|
||||
bf_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
bf_null.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
|
||||
bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
|
||||
bf_null.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
bf_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
bf_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bf_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
|
||||
bf_null.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
|
||||
bf_null.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
|
||||
bf_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
|
||||
bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
|
||||
bf_null.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
|
||||
bf_null.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
|
||||
bf_null.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
||||
bf_null.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bio_cb.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bio_cb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bio_cb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
bio_cb.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bio_cb.o: ../cryptlib.h
|
||||
bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
|
||||
bio_err.o: ../../include/openssl/err.h ../../include/openssl/opensslv.h
|
||||
bio_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bio_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bio_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bio_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
bio_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bio_lib.o: ../cryptlib.h
|
||||
bss_acpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_acpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_acpt.o: ../../include/openssl/opensslconf.h
|
||||
bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bss_acpt.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bss_bio.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
|
||||
bss_bio.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bss_bio.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bss_bio.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bss_bio.o: ../../include/openssl/stack.h
|
||||
bss_conn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_conn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_conn.o: ../../include/openssl/opensslconf.h
|
||||
bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bss_conn.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bss_fd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_fd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_fd.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
bss_fd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bss_fd.o: ../cryptlib.h bss_sock.c
|
||||
bss_file.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_file.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_file.o: ../../include/openssl/opensslconf.h
|
||||
bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bss_file.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bss_log.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_log.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_log.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
bss_log.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bss_log.o: ../cryptlib.h
|
||||
bss_mem.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_mem.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_mem.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
bss_mem.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bss_mem.o: ../cryptlib.h
|
||||
bss_null.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_null.o: ../../include/openssl/opensslconf.h
|
||||
bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bss_null.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bss_sock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
bss_sock.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
bss_sock.o: ../../include/openssl/opensslconf.h
|
||||
bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bss_sock.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
@@ -1,286 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/bn/Makefile
|
||||
#
|
||||
|
||||
DIR= bn
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
BN_ASM= bn_asm.o
|
||||
# or use
|
||||
#BN_ASM= bn86-elf.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
# We let the C compiler driver to take care of .s files. This is done in
|
||||
# order to be excused from maintaining a separate set of architecture
|
||||
# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
|
||||
# gcc, then the driver will automatically translate it to -xarch=v8plus
|
||||
# and pass it down to assembler.
|
||||
AS=$(CC) -c
|
||||
ASFLAGS=$(CFLAGS)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=bntest.c exptest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \
|
||||
bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
|
||||
bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c bn_recp.c bn_mont.c \
|
||||
bn_mpi.c bn_exp2.c
|
||||
|
||||
LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o \
|
||||
bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \
|
||||
bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) bn_recp.o bn_mont.o \
|
||||
bn_mpi.o bn_exp2.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= bn.h
|
||||
HEADER= bn_lcl.h bn_prime.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
bn_prime.h: bn_prime.pl
|
||||
$(PERL) bn_prime.pl >bn_prime.h
|
||||
|
||||
divtest: divtest.c ../../libcrypto.a
|
||||
cc -I../../include divtest.c -o divtest ../../libcrypto.a
|
||||
|
||||
bnbug: bnbug.c ../../libcrypto.a top
|
||||
cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
# elf
|
||||
asm/bn86-elf.o: asm/bn86unix.cpp
|
||||
$(CPP) -DELF -x c asm/bn86unix.cpp | as -o asm/bn86-elf.o
|
||||
|
||||
asm/co86-elf.o: asm/co86unix.cpp
|
||||
$(CPP) -DELF -x c asm/co86unix.cpp | as -o asm/co86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/bn86-sol.o: asm/bn86unix.cpp
|
||||
$(CC) -E -DSOL asm/bn86unix.cpp | sed 's/^#.*//' > asm/bn86-sol.s
|
||||
as -o asm/bn86-sol.o asm/bn86-sol.s
|
||||
rm -f asm/bn86-sol.s
|
||||
|
||||
asm/co86-sol.o: asm/co86unix.cpp
|
||||
$(CC) -E -DSOL asm/co86unix.cpp | sed 's/^#.*//' > asm/co86-sol.s
|
||||
as -o asm/co86-sol.o asm/co86-sol.s
|
||||
rm -f asm/co86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/bn86-out.o: asm/bn86unix.cpp
|
||||
$(CPP) -DOUT asm/bn86unix.cpp | as -o asm/bn86-out.o
|
||||
|
||||
asm/co86-out.o: asm/co86unix.cpp
|
||||
$(CPP) -DOUT asm/co86unix.cpp | as -o asm/co86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/bn86bsdi.o: asm/bn86unix.cpp
|
||||
$(CPP) -DBSDI asm/bn86unix.cpp | sed 's/ :/:/' | as -o asm/bn86bsdi.o
|
||||
|
||||
asm/co86bsdi.o: asm/co86unix.cpp
|
||||
$(CPP) -DBSDI asm/co86unix.cpp | sed 's/ :/:/' | as -o asm/co86bsdi.o
|
||||
|
||||
asm/bn86unix.cpp: asm/bn-586.pl ../perlasm/x86asm.pl
|
||||
(cd asm; $(PERL) bn-586.pl cpp >bn86unix.cpp )
|
||||
|
||||
asm/co86unix.cpp: asm/co-586.pl ../perlasm/x86asm.pl
|
||||
(cd asm; $(PERL) co-586.pl cpp >co86unix.cpp )
|
||||
|
||||
asm/sparcv8.o: asm/sparcv8.S
|
||||
|
||||
asm/sparcv8plus.o: asm/sparcv8plus.S
|
||||
|
||||
# Old GNU assembler doesn't understand V9 instructions, so we
|
||||
# hire /usr/ccs/bin/as to do the job. Note that option is called
|
||||
# *-gcc27, but even gcc 2>=8 users may experience similar problem
|
||||
# if they didn't bother to upgrade GNU assembler. Such users should
|
||||
# not choose this option, but be adviced to *remove* GNU assembler
|
||||
# or upgrade it.
|
||||
asm/sparcv8plus-gcc27.o: asm/sparcv8plus.S
|
||||
$(CC) $(ASFLAGS) -E asm/sparcv8plus.S | \
|
||||
/usr/ccs/bin/as -xarch=v8plus - -o asm/sparcv8plus-gcc27.o
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
exptest:
|
||||
rm -f exptest
|
||||
gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a
|
||||
|
||||
div:
|
||||
rm -f a.out
|
||||
gcc -I.. -g div.c ../../libcrypto.a
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f asm/co86unix.cpp asm/bn86unix.cpp *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
bn_add.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_add.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_add.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_add.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_asm.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_asm.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_asm.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_asm.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_blind.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_blind.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_blind.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_blind.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_ctx.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_ctx.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_ctx.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_ctx.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
bn_div.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_div.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_div.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_div.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_err.o: ../../include/openssl/bn.h ../../include/openssl/err.h
|
||||
bn_err.o: ../../include/openssl/opensslconf.h
|
||||
bn_exp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_exp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_exp.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_exp.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_exp2.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_exp2.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_exp2.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_exp2.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_gcd.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_gcd.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_gcd.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_gcd.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_lib.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_lib.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_mont.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_mont.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_mont.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_mont.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_mpi.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_mpi.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_mpi.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_mpi.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_mul.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_mul.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_mul.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_mul.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_prime.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_prime.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_prime.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
bn_prime.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.h
|
||||
bn_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_print.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_print.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_print.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_rand.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_rand.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_rand.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
bn_rand.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
bn_rand.o: ../cryptlib.h bn_lcl.h
|
||||
bn_recp.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_recp.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_recp.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_recp.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_shift.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_shift.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_shift.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_shift.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_sqr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_sqr.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_sqr.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_sqr.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
bn_word.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
bn_word.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
bn_word.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
bn_word.o: ../../include/openssl/stack.h ../cryptlib.h bn_lcl.h
|
||||
@@ -1,144 +0,0 @@
|
||||
/* crypto/bn/bn_ctx.c */
|
||||
/* Written by Ulf Moeller for the OpenSSL project. */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* [email protected].
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED 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 OpenSSL PROJECT OR
|
||||
* ITS 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.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* ([email protected]). This product includes software written by Tim
|
||||
* Hudson ([email protected]).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BN_CTX_DEBUG
|
||||
# undef NDEBUG /* avoid conflicting definitions */
|
||||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/bn.h>
|
||||
|
||||
|
||||
BN_CTX *BN_CTX_new(void)
|
||||
{
|
||||
BN_CTX *ret;
|
||||
|
||||
ret=(BN_CTX *)Malloc(sizeof(BN_CTX));
|
||||
if (ret == NULL)
|
||||
{
|
||||
BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
BN_CTX_init(ret);
|
||||
ret->flags=BN_FLG_MALLOCED;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void BN_CTX_init(BN_CTX *ctx)
|
||||
{
|
||||
int i;
|
||||
ctx->tos = 0;
|
||||
ctx->flags = 0;
|
||||
ctx->depth = 0;
|
||||
ctx->too_many = 0;
|
||||
for (i = 0; i < BN_CTX_NUM; i++)
|
||||
BN_init(&(ctx->bn[i]));
|
||||
}
|
||||
|
||||
void BN_CTX_free(BN_CTX *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (ctx == NULL) return;
|
||||
assert(ctx->depth == 0);
|
||||
|
||||
for (i=0; i < BN_CTX_NUM; i++)
|
||||
BN_clear_free(&(ctx->bn[i]));
|
||||
if (ctx->flags & BN_FLG_MALLOCED)
|
||||
Free(ctx);
|
||||
}
|
||||
|
||||
void BN_CTX_start(BN_CTX *ctx)
|
||||
{
|
||||
if (ctx->depth < BN_CTX_NUM_POS)
|
||||
ctx->pos[ctx->depth] = ctx->tos;
|
||||
ctx->depth++;
|
||||
}
|
||||
|
||||
BIGNUM *BN_CTX_get(BN_CTX *ctx)
|
||||
{
|
||||
if (ctx->depth > BN_CTX_NUM_POS || ctx->tos >= BN_CTX_NUM)
|
||||
{
|
||||
if (!ctx->too_many)
|
||||
{
|
||||
BNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES);
|
||||
/* disable error code until BN_CTX_end is called: */
|
||||
ctx->too_many = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return (&(ctx->bn[ctx->tos++]));
|
||||
}
|
||||
|
||||
void BN_CTX_end(BN_CTX *ctx)
|
||||
{
|
||||
if (ctx == NULL) return;
|
||||
assert(ctx->depth > 0);
|
||||
if (ctx->depth == 0)
|
||||
/* should never happen, but we can tolerate it if not in
|
||||
* debug mode (could be a 'goto err' in the calling function
|
||||
* before BN_CTX_start was reached) */
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
ctx->too_many = 0;
|
||||
ctx->depth--;
|
||||
if (ctx->depth < BN_CTX_NUM_POS)
|
||||
ctx->tos = ctx->pos[ctx->depth];
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
static int rand(n)
|
||||
{
|
||||
unsigned char x[2];
|
||||
RAND_pseudo_bytes(x,2);
|
||||
return (x[0] + 2*x[1]);
|
||||
}
|
||||
|
||||
static void bug(char *m, BIGNUM *a, BIGNUM *b)
|
||||
{
|
||||
printf("%s!\na=",m);
|
||||
BN_print_fp(stdout, a);
|
||||
printf("\nb=");
|
||||
BN_print_fp(stdout, b);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
BIGNUM *a=BN_new(), *b=BN_new(), *c=BN_new(), *d=BN_new(),
|
||||
*C=BN_new(), *D=BN_new();
|
||||
BN_RECP_CTX *recp=BN_RECP_CTX_new();
|
||||
BN_CTX *ctx=BN_CTX_new();
|
||||
|
||||
for(;;) {
|
||||
BN_pseudo_rand(a,rand(),0,0);
|
||||
BN_pseudo_rand(b,rand(),0,0);
|
||||
if (BN_is_zero(b)) continue;
|
||||
|
||||
BN_RECP_CTX_set(recp,b,ctx);
|
||||
if (BN_div(C,D,a,b,ctx) != 1)
|
||||
bug("BN_div failed",a,b);
|
||||
if (BN_div_recp(c,d,a,recp,ctx) != 1)
|
||||
bug("BN_div_recp failed",a,b);
|
||||
else if (BN_cmp(c,C) != 0 || BN_cmp(c,C) != 0)
|
||||
bug("mismatch",a,b);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/buffer/Makefile
|
||||
#
|
||||
|
||||
DIR= buffer
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= buffer.c buf_err.c
|
||||
LIBOBJ= buffer.o buf_err.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= buffer.h
|
||||
HEADER= $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
buf_err.o: ../../include/openssl/buffer.h ../../include/openssl/err.h
|
||||
buffer.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
buffer.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
buffer.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
buffer.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
buffer.o: ../cryptlib.h
|
||||
@@ -1,124 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/cast/Makefile
|
||||
#
|
||||
|
||||
DIR= cast
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
CPP= $(CC) -E
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CAST_ENC=c_enc.o
|
||||
# or use
|
||||
#CAST_ENC=asm/cx86-elf.o
|
||||
#CAST_ENC=asm/cx86-out.o
|
||||
#CAST_ENC=asm/cx86-sol.o
|
||||
#CAST_ENC=asm/cx86bdsi.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=casttest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c
|
||||
LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= cast.h
|
||||
HEADER= cast_s.h cast_lcl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
# elf
|
||||
asm/cx86-elf.o: asm/cx86unix.cpp
|
||||
$(CPP) -DELF -x c asm/cx86unix.cpp | as -o asm/cx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/cx86-sol.o: asm/cx86unix.cpp
|
||||
$(CC) -E -DSOL asm/cx86unix.cpp | sed 's/^#.*//' > asm/cx86-sol.s
|
||||
as -o asm/cx86-sol.o asm/cx86-sol.s
|
||||
rm -f asm/cx86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/cx86-out.o: asm/cx86unix.cpp
|
||||
$(CPP) -DOUT asm/cx86unix.cpp | as -o asm/cx86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/cx86bsdi.o: asm/cx86unix.cpp
|
||||
$(CPP) -DBSDI asm/cx86unix.cpp | sed 's/ :/:/' | as -o asm/cx86bsdi.o
|
||||
|
||||
asm/cx86unix.cpp: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
|
||||
(cd asm; $(PERL) cast-586.pl cpp $(PROCESSOR) >cx86unix.cpp)
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f asm/cx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
c_cfb64.o: ../../include/openssl/cast.h ../../include/openssl/e_os.h
|
||||
c_cfb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
c_cfb64.o: cast_lcl.h
|
||||
c_ecb.o: ../../include/openssl/cast.h ../../include/openssl/e_os.h
|
||||
c_ecb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
c_ecb.o: ../../include/openssl/opensslv.h cast_lcl.h
|
||||
c_enc.o: ../../include/openssl/cast.h ../../include/openssl/e_os.h
|
||||
c_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
c_enc.o: cast_lcl.h
|
||||
c_ofb64.o: ../../include/openssl/cast.h ../../include/openssl/e_os.h
|
||||
c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
c_ofb64.o: cast_lcl.h
|
||||
c_skey.o: ../../include/openssl/cast.h ../../include/openssl/e_os.h
|
||||
c_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
|
||||
c_skey.o: cast_lcl.h cast_s.h
|
||||
@@ -1,99 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/comp/Makefile
|
||||
#
|
||||
|
||||
DIR= comp
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= comp_lib.c \
|
||||
c_rle.c c_zlib.c
|
||||
|
||||
LIBOBJ= comp_lib.o \
|
||||
c_rle.o c_zlib.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= comp.h
|
||||
HEADER= $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
|
||||
c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/objects.h
|
||||
c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
c_rle.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
|
||||
c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/objects.h
|
||||
c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
c_zlib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h
|
||||
comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/objects.h
|
||||
comp_lib.o: ../../include/openssl/opensslconf.h
|
||||
comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
comp_lib.o: ../../include/openssl/stack.h
|
||||
@@ -1,92 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/conf/Makefile
|
||||
#
|
||||
|
||||
DIR= conf
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= conf.c conf_err.c
|
||||
|
||||
LIBOBJ= conf.o conf_err.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= conf.h
|
||||
HEADER= conf_lcl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
|
||||
conf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
conf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
|
||||
conf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
conf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
conf.o: ../cryptlib.h conf_lcl.h
|
||||
conf_err.o: ../../include/openssl/bio.h ../../include/openssl/conf.h
|
||||
conf_err.o: ../../include/openssl/crypto.h ../../include/openssl/err.h
|
||||
conf_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslv.h
|
||||
conf_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
@@ -1,206 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/des/Makefile
|
||||
#
|
||||
|
||||
DIR= des
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
CPP= $(CC) -E
|
||||
INCLUDES=-I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
RANLIB= ranlib
|
||||
DES_ENC= des_enc.o fcrypt_b.o
|
||||
# or use
|
||||
#DES_ENC= dx86-elf.o yx86-elf.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=destest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \
|
||||
ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \
|
||||
fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \
|
||||
qud_cksm.c rand_key.c read_pwd.c rpc_enc.c set_key.c \
|
||||
des_enc.c fcrypt_b.c read2pwd.c \
|
||||
xcbc_enc.c \
|
||||
str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c
|
||||
|
||||
LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \
|
||||
ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \
|
||||
enc_read.o enc_writ.o ofb64enc.o \
|
||||
ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \
|
||||
${DES_ENC} read2pwd.o \
|
||||
fcrypt.o xcbc_enc.o read_pwd.o rpc_enc.o cbc_cksm.o \
|
||||
ede_cbcm_enc.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= des.h
|
||||
HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
des: des.o cbc3_enc.o lib
|
||||
$(CC) $(CFLAGS) -o des des.o cbc3_enc.o $(LIB)
|
||||
|
||||
# elf
|
||||
asm/dx86-elf.o: asm/dx86unix.cpp
|
||||
$(CPP) -DELF -x c asm/dx86unix.cpp | as -o asm/dx86-elf.o
|
||||
|
||||
asm/yx86-elf.o: asm/yx86unix.cpp
|
||||
$(CPP) -DELF -x c asm/yx86unix.cpp | as -o asm/yx86-elf.o
|
||||
|
||||
# solaris
|
||||
asm/dx86-sol.o: asm/dx86unix.cpp
|
||||
$(CC) -E -DSOL asm/dx86unix.cpp | sed 's/^#.*//' > asm/dx86-sol.s
|
||||
as -o asm/dx86-sol.o asm/dx86-sol.s
|
||||
rm -f asm/dx86-sol.s
|
||||
|
||||
asm/yx86-sol.o: asm/yx86unix.cpp
|
||||
$(CC) -E -DSOL asm/yx86unix.cpp | sed 's/^#.*//' > asm/yx86-sol.s
|
||||
as -o asm/yx86-sol.o asm/yx86-sol.s
|
||||
rm -f asm/yx86-sol.s
|
||||
|
||||
# a.out
|
||||
asm/dx86-out.o: asm/dx86unix.cpp
|
||||
$(CPP) -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o
|
||||
|
||||
asm/yx86-out.o: asm/yx86unix.cpp
|
||||
$(CPP) -DOUT asm/yx86unix.cpp | as -o asm/yx86-out.o
|
||||
|
||||
# bsdi
|
||||
asm/dx86bsdi.o: asm/dx86unix.cpp
|
||||
$(CPP) -DBSDI asm/dx86unix.cpp | sed 's/ :/:/' | as -o asm/dx86bsdi.o
|
||||
|
||||
asm/yx86bsdi.o: asm/yx86unix.cpp
|
||||
$(CPP) -DBSDI asm/yx86unix.cpp | sed 's/ :/:/' | as -o asm/yx86bsdi.o
|
||||
|
||||
asm/dx86unix.cpp: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
|
||||
(cd asm; $(PERL) des-586.pl cpp >dx86unix.cpp)
|
||||
|
||||
asm/yx86unix.cpp: asm/crypt586.pl ../perlasm/x86asm.pl
|
||||
(cd asm; $(PERL) crypt586.pl cpp >yx86unix.cpp)
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(TOP)/util/point.sh ../../perlasm asm/perlasm
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install: installs
|
||||
|
||||
installs:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f asm/dx86unix.cpp asm/yx86unix.cpp *.o asm/*.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
cbc_cksm.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
cbc_cksm.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
cbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
cbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h ncbc_enc.c
|
||||
cfb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
cfb64ede.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
cfb64enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
cfb64enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
cfb_enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
des_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
des_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_locl.h ncbc_enc.c
|
||||
ecb3_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
ecb3_enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
ecb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
ecb_enc.o: des_locl.h spr.h
|
||||
ede_cbcm_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
ede_cbcm_enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
enc_read.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
enc_read.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
enc_read.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
enc_read.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
enc_read.o: ../../include/openssl/stack.h ../cryptlib.h des_locl.h
|
||||
enc_writ.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
enc_writ.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
enc_writ.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
enc_writ.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
enc_writ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
enc_writ.o: ../cryptlib.h des_locl.h
|
||||
fcrypt.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
fcrypt.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
fcrypt_b.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
ofb64ede.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
ofb64enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
ofb64enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
ofb_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
ofb_enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
pcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
pcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
qud_cksm.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
qud_cksm.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
rand_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
rand_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/rand.h
|
||||
read2pwd.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
read2pwd.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
read_pwd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
read_pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
|
||||
read_pwd.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
read_pwd.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
read_pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
read_pwd.o: ../../include/openssl/stack.h ../cryptlib.h des_locl.h
|
||||
rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
rpc_enc.o: ../../include/openssl/opensslconf.h des_locl.h des_ver.h rpc_des.h
|
||||
set_key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
set_key.o: ../../include/openssl/opensslconf.h des_locl.h podd.h sk.h
|
||||
str2key.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
str2key.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/e_os2.h
|
||||
xcbc_enc.o: ../../include/openssl/opensslconf.h des_locl.h
|
||||
@@ -1,217 +0,0 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
des - encrypt or decrypt data using Data Encryption Standard
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<des>
|
||||
(
|
||||
B<-e>
|
||||
|
|
||||
B<-E>
|
||||
) | (
|
||||
B<-d>
|
||||
|
|
||||
B<-D>
|
||||
) | (
|
||||
B<->[B<cC>][B<ckname>]
|
||||
) |
|
||||
[
|
||||
B<-b3hfs>
|
||||
] [
|
||||
B<-k>
|
||||
I<key>
|
||||
]
|
||||
] [
|
||||
B<-u>[I<uuname>]
|
||||
[
|
||||
I<input-file>
|
||||
[
|
||||
I<output-file>
|
||||
] ]
|
||||
|
||||
=head1 NOTE
|
||||
|
||||
This page describes the B<des> stand-alone program, not the B<openssl des>
|
||||
command.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<des>
|
||||
encrypts and decrypts data using the
|
||||
Data Encryption Standard algorithm.
|
||||
One of
|
||||
B<-e>, B<-E>
|
||||
(for encrypt) or
|
||||
B<-d>, B<-D>
|
||||
(for decrypt) must be specified.
|
||||
It is also possible to use
|
||||
B<-c>
|
||||
or
|
||||
B<-C>
|
||||
in conjunction or instead of the a encrypt/decrypt option to generate
|
||||
a 16 character hexadecimal checksum, generated via the
|
||||
I<des_cbc_cksum>.
|
||||
|
||||
Two standard encryption modes are supported by the
|
||||
B<des>
|
||||
program, Cipher Block Chaining (the default) and Electronic Code Book
|
||||
(specified with
|
||||
B<-b>).
|
||||
|
||||
The key used for the DES
|
||||
algorithm is obtained by prompting the user unless the
|
||||
B<-k>
|
||||
I<key>
|
||||
option is given.
|
||||
If the key is an argument to the
|
||||
B<des>
|
||||
command, it is potentially visible to users executing
|
||||
ps(1)
|
||||
or a derivative. To minimise this possibility,
|
||||
B<des>
|
||||
takes care to destroy the key argument immediately upon entry.
|
||||
If your shell keeps a history file be careful to make sure it is not
|
||||
world readable.
|
||||
|
||||
Since this program attempts to maintain compatibility with sunOS's
|
||||
des(1) command, there are 2 different methods used to convert the user
|
||||
supplied key to a des key.
|
||||
Whenever and one or more of
|
||||
B<-E>, B<-D>, B<-C>
|
||||
or
|
||||
B<-3>
|
||||
options are used, the key conversion procedure will not be compatible
|
||||
with the sunOS des(1) version but will use all the user supplied
|
||||
character to generate the des key.
|
||||
B<des>
|
||||
command reads from standard input unless
|
||||
I<input-file>
|
||||
is specified and writes to standard output unless
|
||||
I<output-file>
|
||||
is given.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-b>
|
||||
|
||||
Select ECB
|
||||
(eight bytes at a time) encryption mode.
|
||||
|
||||
=item B<-3>
|
||||
|
||||
Encrypt using triple encryption.
|
||||
By default triple cbc encryption is used but if the
|
||||
B<-b>
|
||||
option is used then triple ECB encryption is performed.
|
||||
If the key is less than 8 characters long, the flag has no effect.
|
||||
|
||||
=item B<-e>
|
||||
|
||||
Encrypt data using an 8 byte key in a manner compatible with sunOS
|
||||
des(1).
|
||||
|
||||
=item B<-E>
|
||||
|
||||
Encrypt data using a key of nearly unlimited length (1024 bytes).
|
||||
This will product a more secure encryption.
|
||||
|
||||
=item B<-d>
|
||||
|
||||
Decrypt data that was encrypted with the B<-e> option.
|
||||
|
||||
=item B<-D>
|
||||
|
||||
Decrypt data that was encrypted with the B<-E> option.
|
||||
|
||||
=item B<-c>
|
||||
|
||||
Generate a 16 character hexadecimal cbc checksum and output this to
|
||||
stderr.
|
||||
If a filename was specified after the
|
||||
B<-c>
|
||||
option, the checksum is output to that file.
|
||||
The checksum is generated using a key generated in a sunOS compatible
|
||||
manner.
|
||||
|
||||
=item B<-C>
|
||||
|
||||
A cbc checksum is generated in the same manner as described for the
|
||||
B<-c>
|
||||
option but the DES key is generated in the same manner as used for the
|
||||
B<-E>
|
||||
and
|
||||
B<-D>
|
||||
options
|
||||
|
||||
=item B<-f>
|
||||
|
||||
Does nothing - allowed for compatibility with sunOS des(1) command.
|
||||
|
||||
=item B<-s>
|
||||
|
||||
Does nothing - allowed for compatibility with sunOS des(1) command.
|
||||
|
||||
=item B<-k> I<key>
|
||||
|
||||
Use the encryption
|
||||
I<key>
|
||||
specified.
|
||||
|
||||
=item B<-h>
|
||||
|
||||
The
|
||||
I<key>
|
||||
is assumed to be a 16 character hexadecimal number.
|
||||
If the
|
||||
B<-3>
|
||||
option is used the key is assumed to be a 32 character hexadecimal
|
||||
number.
|
||||
|
||||
=item B<-u>
|
||||
|
||||
This flag is used to read and write uuencoded files. If decrypting,
|
||||
the input file is assumed to contain uuencoded, DES encrypted data.
|
||||
If encrypting, the characters following the B<-u> are used as the name of
|
||||
the uuencoded file to embed in the begin line of the uuencoded
|
||||
output. If there is no name specified after the B<-u>, the name text.des
|
||||
will be embedded in the header.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
ps(1),
|
||||
L<des_crypt(3)|des_crypt(3)>
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
The problem with using the
|
||||
B<-e>
|
||||
option is the short key length.
|
||||
It would be better to use a real 56-bit key rather than an
|
||||
ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII
|
||||
radically reduces the time necessary for a brute-force cryptographic attack.
|
||||
My attempt to remove this problem is to add an alternative text-key to
|
||||
DES-key function. This alternative function (accessed via
|
||||
B<-E>, B<-D>, B<-S>
|
||||
and
|
||||
B<-3>)
|
||||
uses DES to help generate the key.
|
||||
|
||||
Be carefully when using the B<-u> option. Doing B<des -ud> I<filename> will
|
||||
not decrypt filename (the B<-u> option will gobble the B<-d> option).
|
||||
|
||||
The VMS operating system operates in a world where files are always a
|
||||
multiple of 512 bytes. This causes problems when encrypted data is
|
||||
send from Unix to VMS since a 88 byte file will suddenly be padded
|
||||
with 424 null bytes. To get around this problem, use the B<-u> option
|
||||
to uuencode the data before it is send to the VMS system.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Young ([email protected])
|
||||
|
||||
=cut
|
||||
@@ -1,112 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/dh/Makefile
|
||||
#
|
||||
|
||||
DIR= dh
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST= dhtest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c
|
||||
LIBOBJ= dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= dh.h
|
||||
HEADER= $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
dh_check.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h
|
||||
dh_check.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dh_check.o: ../../include/openssl/opensslconf.h
|
||||
dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
dh_check.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
dh_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
|
||||
dh_err.o: ../../include/openssl/dh.h ../../include/openssl/err.h
|
||||
dh_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
dh_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dh_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h
|
||||
dh_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
dh_gen.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dh_gen.o: ../cryptlib.h
|
||||
dh_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h
|
||||
dh_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
dh_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
|
||||
dh_key.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
dh_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dh_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dh_lib.o: ../../include/openssl/dh.h ../../include/openssl/e_os.h
|
||||
dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dh_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dh_lib.o: ../cryptlib.h
|
||||
@@ -1,146 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/dsa/Makefile
|
||||
#
|
||||
|
||||
DIR= dsa
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=dsatest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \
|
||||
dsa_err.c dsa_ossl.c
|
||||
LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \
|
||||
dsa_err.o dsa_ossl.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= dsa.h
|
||||
HEADER= $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
dsa_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
|
||||
dsa_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dsa_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
dsa_asn1.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
dsa_asn1.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
dsa_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
|
||||
dsa_err.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
dsa_err.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
dsa_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
dsa_err.o: ../../include/openssl/stack.h
|
||||
dsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dsa_gen.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
dsa_gen.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
dsa_gen.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
||||
dsa_gen.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
dsa_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dsa_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
dsa_key.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
dsa_key.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
dsa_key.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
dsa_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
||||
dsa_key.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
dsa_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
dsa_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
|
||||
dsa_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
|
||||
dsa_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
|
||||
dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dsa_lib.o: ../cryptlib.h
|
||||
dsa_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
dsa_ossl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
|
||||
dsa_ossl.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
|
||||
dsa_ossl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
|
||||
dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dsa_ossl.o: ../../include/openssl/opensslconf.h
|
||||
dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
dsa_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dsa_ossl.o: ../cryptlib.h
|
||||
dsa_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
dsa_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
|
||||
dsa_sign.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
|
||||
dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os.h
|
||||
dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
dsa_sign.o: ../../include/openssl/opensslconf.h
|
||||
dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dsa_sign.o: ../cryptlib.h
|
||||
dsa_vrf.o: ../../include/openssl/asn1.h ../../include/openssl/asn1_mac.h
|
||||
dsa_vrf.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
|
||||
dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
|
||||
dsa_vrf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
|
||||
dsa_vrf.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
|
||||
dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/opensslconf.h
|
||||
dsa_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
|
||||
dsa_vrf.o: ../cryptlib.h
|
||||
@@ -1,321 +0,0 @@
|
||||
/* crypto/dsa/dsa_ossl.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/* Original version from Steven Schoch <[email protected]> */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dsa.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
|
||||
static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
|
||||
static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
|
||||
DSA *dsa);
|
||||
static int dsa_init(DSA *dsa);
|
||||
static int dsa_finish(DSA *dsa);
|
||||
static int dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
|
||||
BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont);
|
||||
static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx);
|
||||
|
||||
static DSA_METHOD openssl_dsa_meth = {
|
||||
"OpenSSL DSA method",
|
||||
dsa_do_sign,
|
||||
dsa_sign_setup,
|
||||
dsa_do_verify,
|
||||
dsa_mod_exp,
|
||||
dsa_bn_mod_exp,
|
||||
dsa_init,
|
||||
dsa_finish,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
|
||||
DSA_METHOD *DSA_OpenSSL(void)
|
||||
{
|
||||
return &openssl_dsa_meth;
|
||||
}
|
||||
|
||||
static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
|
||||
{
|
||||
BIGNUM *kinv=NULL,*r=NULL,*s=NULL;
|
||||
BIGNUM m;
|
||||
BIGNUM xr;
|
||||
BN_CTX *ctx=NULL;
|
||||
int i,reason=ERR_R_BN_LIB;
|
||||
DSA_SIG *ret=NULL;
|
||||
|
||||
BN_init(&m);
|
||||
BN_init(&xr);
|
||||
s=BN_new();
|
||||
if (s == NULL) goto err;
|
||||
|
||||
i=BN_num_bytes(dsa->q); /* should be 20 */
|
||||
if ((dlen > i) || (dlen > 50))
|
||||
{
|
||||
reason=DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ctx=BN_CTX_new();
|
||||
if (ctx == NULL) goto err;
|
||||
|
||||
if ((dsa->kinv == NULL) || (dsa->r == NULL))
|
||||
{
|
||||
if (!DSA_sign_setup(dsa,ctx,&kinv,&r)) goto err;
|
||||
}
|
||||
else
|
||||
{
|
||||
kinv=dsa->kinv;
|
||||
dsa->kinv=NULL;
|
||||
r=dsa->r;
|
||||
dsa->r=NULL;
|
||||
}
|
||||
|
||||
if (BN_bin2bn(dgst,dlen,&m) == NULL) goto err;
|
||||
|
||||
/* Compute s = inv(k) (m + xr) mod q */
|
||||
if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */
|
||||
if (!BN_add(s, &xr, &m)) goto err; /* s = m + xr */
|
||||
if (BN_cmp(s,dsa->q) > 0)
|
||||
BN_sub(s,s,dsa->q);
|
||||
if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err;
|
||||
|
||||
ret=DSA_SIG_new();
|
||||
if (ret == NULL) goto err;
|
||||
ret->r = r;
|
||||
ret->s = s;
|
||||
|
||||
err:
|
||||
if (!ret)
|
||||
{
|
||||
DSAerr(DSA_F_DSA_DO_SIGN,reason);
|
||||
BN_free(r);
|
||||
BN_free(s);
|
||||
}
|
||||
if (ctx != NULL) BN_CTX_free(ctx);
|
||||
BN_clear_free(&m);
|
||||
BN_clear_free(&xr);
|
||||
if (kinv != NULL) /* dsa->kinv is NULL now if we used it */
|
||||
BN_clear_free(kinv);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
|
||||
{
|
||||
BN_CTX *ctx;
|
||||
BIGNUM k,*kinv=NULL,*r=NULL;
|
||||
int ret=0;
|
||||
|
||||
if (ctx_in == NULL)
|
||||
{
|
||||
if ((ctx=BN_CTX_new()) == NULL) goto err;
|
||||
}
|
||||
else
|
||||
ctx=ctx_in;
|
||||
|
||||
BN_init(&k);
|
||||
if ((r=BN_new()) == NULL) goto err;
|
||||
kinv=NULL;
|
||||
|
||||
/* Get random k */
|
||||
for (;;)
|
||||
{
|
||||
if (!BN_rand(&k, BN_num_bits(dsa->q), 1, 0)) goto err;
|
||||
if (BN_cmp(&k,dsa->q) >= 0)
|
||||
BN_sub(&k,&k,dsa->q);
|
||||
if (!BN_is_zero(&k)) break;
|
||||
}
|
||||
|
||||
if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P))
|
||||
{
|
||||
if ((dsa->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL)
|
||||
if (!BN_MONT_CTX_set((BN_MONT_CTX *)dsa->method_mont_p,
|
||||
dsa->p,ctx)) goto err;
|
||||
}
|
||||
|
||||
/* Compute r = (g^k mod p) mod q */
|
||||
if (!dsa->meth->bn_mod_exp(dsa, r,dsa->g,&k,dsa->p,ctx,
|
||||
(BN_MONT_CTX *)dsa->method_mont_p)) goto err;
|
||||
if (!BN_mod(r,r,dsa->q,ctx)) goto err;
|
||||
|
||||
/* Compute part of 's = inv(k) (m + xr) mod q' */
|
||||
if ((kinv=BN_mod_inverse(NULL,&k,dsa->q,ctx)) == NULL) goto err;
|
||||
|
||||
if (*kinvp != NULL) BN_clear_free(*kinvp);
|
||||
*kinvp=kinv;
|
||||
kinv=NULL;
|
||||
if (*rp != NULL) BN_clear_free(*rp);
|
||||
*rp=r;
|
||||
ret=1;
|
||||
err:
|
||||
if (!ret)
|
||||
{
|
||||
DSAerr(DSA_F_DSA_SIGN_SETUP,ERR_R_BN_LIB);
|
||||
if (kinv != NULL) BN_clear_free(kinv);
|
||||
if (r != NULL) BN_clear_free(r);
|
||||
}
|
||||
if (ctx_in == NULL) BN_CTX_free(ctx);
|
||||
if (kinv != NULL) BN_clear_free(kinv);
|
||||
BN_clear_free(&k);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
|
||||
DSA *dsa)
|
||||
{
|
||||
BN_CTX *ctx;
|
||||
BIGNUM u1,u2,t1;
|
||||
BN_MONT_CTX *mont=NULL;
|
||||
int ret = -1;
|
||||
|
||||
if ((ctx=BN_CTX_new()) == NULL) goto err;
|
||||
BN_init(&u1);
|
||||
BN_init(&u2);
|
||||
BN_init(&t1);
|
||||
|
||||
/* Calculate W = inv(S) mod Q
|
||||
* save W in u2 */
|
||||
if ((BN_mod_inverse(&u2,sig->s,dsa->q,ctx)) == NULL) goto err;
|
||||
|
||||
/* save M in u1 */
|
||||
if (BN_bin2bn(dgst,dgst_len,&u1) == NULL) goto err;
|
||||
|
||||
/* u1 = M * w mod q */
|
||||
if (!BN_mod_mul(&u1,&u1,&u2,dsa->q,ctx)) goto err;
|
||||
|
||||
/* u2 = r * w mod q */
|
||||
if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err;
|
||||
|
||||
if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P))
|
||||
{
|
||||
if ((dsa->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL)
|
||||
if (!BN_MONT_CTX_set((BN_MONT_CTX *)dsa->method_mont_p,
|
||||
dsa->p,ctx)) goto err;
|
||||
}
|
||||
mont=(BN_MONT_CTX *)dsa->method_mont_p;
|
||||
|
||||
#if 0
|
||||
{
|
||||
BIGNUM t2;
|
||||
|
||||
BN_init(&t2);
|
||||
/* v = ( g^u1 * y^u2 mod p ) mod q */
|
||||
/* let t1 = g ^ u1 mod p */
|
||||
if (!BN_mod_exp_mont(&t1,dsa->g,&u1,dsa->p,ctx,mont)) goto err;
|
||||
/* let t2 = y ^ u2 mod p */
|
||||
if (!BN_mod_exp_mont(&t2,dsa->pub_key,&u2,dsa->p,ctx,mont)) goto err;
|
||||
/* let u1 = t1 * t2 mod p */
|
||||
if (!BN_mod_mul(&u1,&t1,&t2,dsa->p,ctx)) goto err_bn;
|
||||
BN_free(&t2);
|
||||
}
|
||||
/* let u1 = u1 mod q */
|
||||
if (!BN_mod(&u1,&u1,dsa->q,ctx)) goto err;
|
||||
#else
|
||||
{
|
||||
if (!dsa->meth->dsa_mod_exp(dsa, &t1,dsa->g,&u1,dsa->pub_key,&u2,
|
||||
dsa->p,ctx,mont)) goto err;
|
||||
/* BN_copy(&u1,&t1); */
|
||||
/* let u1 = u1 mod q */
|
||||
if (!BN_mod(&u1,&t1,dsa->q,ctx)) goto err;
|
||||
}
|
||||
#endif
|
||||
/* V is now in u1. If the signature is correct, it will be
|
||||
* equal to R. */
|
||||
ret=(BN_ucmp(&u1, sig->r) == 0);
|
||||
|
||||
err:
|
||||
if (ret != 1) DSAerr(DSA_F_DSA_DO_VERIFY,ERR_R_BN_LIB);
|
||||
if (ctx != NULL) BN_CTX_free(ctx);
|
||||
BN_free(&u1);
|
||||
BN_free(&u2);
|
||||
BN_free(&t1);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int dsa_init(DSA *dsa)
|
||||
{
|
||||
dsa->flags|=DSA_FLAG_CACHE_MONT_P;
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int dsa_finish(DSA *dsa)
|
||||
{
|
||||
if(dsa->method_mont_p)
|
||||
BN_MONT_CTX_free((BN_MONT_CTX *)dsa->method_mont_p);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
|
||||
BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont)
|
||||
{
|
||||
return BN_mod_exp2_mont(rr, a1, p1, a2, p2, m, ctx, in_mont);
|
||||
}
|
||||
|
||||
static int dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx)
|
||||
{
|
||||
return BN_mod_exp_mont(r, a, p, m, ctx, m_ctx);
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
/* crypto/ebcdic.c */
|
||||
|
||||
#ifdef CHARSET_EBCDIC
|
||||
#include "ebcdic.h"
|
||||
/* Initial Port for Apache-1.3 by <[email protected]>
|
||||
* Adapted for OpenSSL-0.9.4 by <[email protected]>
|
||||
*/
|
||||
|
||||
#ifdef _OSD_POSIX
|
||||
/*
|
||||
"BS2000 OSD" is a POSIX subsystem on a main frame.
|
||||
It is made by Siemens AG, Germany, for their BS2000 mainframe machines.
|
||||
Within the POSIX subsystem, the same character set was chosen as in
|
||||
"native BS2000", namely EBCDIC. (EDF04)
|
||||
|
||||
The name "ASCII" in these routines is misleading: actually, conversion
|
||||
is not between EBCDIC and ASCII, but EBCDIC(EDF04) and ISO-8859.1;
|
||||
that means that (western european) national characters are preserved.
|
||||
|
||||
This table is identical to the one used by rsh/rcp/ftp and other POSIX tools.
|
||||
*/
|
||||
|
||||
/* Here's the bijective ebcdic-to-ascii table: */
|
||||
const unsigned char os_toascii[256] = {
|
||||
/*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f,
|
||||
0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
|
||||
/*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97,
|
||||
0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
|
||||
/*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/
|
||||
/*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/
|
||||
/*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
|
||||
0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/
|
||||
/*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
|
||||
0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/
|
||||
/*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
|
||||
0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/
|
||||
/*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
|
||||
0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/
|
||||
/*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/
|
||||
/*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
|
||||
0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/
|
||||
/*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/
|
||||
/*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
|
||||
0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/
|
||||
/*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/
|
||||
/*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
|
||||
0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/
|
||||
/*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/
|
||||
/*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/
|
||||
};
|
||||
|
||||
|
||||
/* The ascii-to-ebcdic table: */
|
||||
const unsigned char os_toebcdic[256] = {
|
||||
/*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
|
||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/
|
||||
/*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
|
||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/
|
||||
/*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
|
||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
|
||||
/*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/
|
||||
/*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/
|
||||
/*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
|
||||
0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/
|
||||
/*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/
|
||||
/*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
|
||||
0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/
|
||||
/*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/
|
||||
/*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/
|
||||
/*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5,
|
||||
0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/
|
||||
/*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
|
||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/
|
||||
/*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/
|
||||
/*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
|
||||
0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/
|
||||
/*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/
|
||||
/*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
|
||||
0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/
|
||||
};
|
||||
|
||||
#else /*_OSD_POSIX*/
|
||||
|
||||
/*
|
||||
This code does basic character mapping for IBM's TPF and OS/390 operating systems.
|
||||
It is a modified version of the BS2000 table.
|
||||
|
||||
Bijective EBCDIC (character set IBM-1047) to US-ASCII table:
|
||||
This table is bijective - there are no ambigous or duplicate characters.
|
||||
*/
|
||||
const unsigned char os_toascii[256] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */
|
||||
0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
|
||||
0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */
|
||||
0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */
|
||||
0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */
|
||||
0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */
|
||||
0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */
|
||||
0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */
|
||||
0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */
|
||||
0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */
|
||||
0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */
|
||||
0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */
|
||||
0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */
|
||||
0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */
|
||||
0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */
|
||||
0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */
|
||||
0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */
|
||||
0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */
|
||||
0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */
|
||||
0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */
|
||||
0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */
|
||||
0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */
|
||||
0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */
|
||||
0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */
|
||||
0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */
|
||||
0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */
|
||||
0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */
|
||||
0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
The US-ASCII to EBCDIC (character set IBM-1047) table:
|
||||
This table is bijective (no ambiguous or duplicate characters)
|
||||
*/
|
||||
const unsigned char os_toebcdic[256] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */
|
||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */
|
||||
0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */
|
||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */
|
||||
0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */
|
||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */
|
||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */
|
||||
0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */
|
||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */
|
||||
0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */
|
||||
0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */
|
||||
0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */
|
||||
0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */
|
||||
0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */
|
||||
0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */
|
||||
0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */
|
||||
0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */
|
||||
0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */
|
||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */
|
||||
0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */
|
||||
0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */
|
||||
0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */
|
||||
0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */
|
||||
0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */
|
||||
0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */
|
||||
};
|
||||
#endif /*_OSD_POSIX*/
|
||||
|
||||
/* Translate a memory block from EBCDIC (host charset) to ASCII (net charset)
|
||||
* dest and srce may be identical, or separate memory blocks, but
|
||||
* should not overlap. These functions intentionally have an interface
|
||||
* compatible to memcpy(3).
|
||||
*/
|
||||
|
||||
void *
|
||||
ebcdic2ascii(void *dest, const void *srce, size_t count)
|
||||
{
|
||||
unsigned char *udest = dest;
|
||||
const unsigned char *usrce = srce;
|
||||
|
||||
while (count-- != 0) {
|
||||
*udest++ = os_toascii[*usrce++];
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
void *
|
||||
ascii2ebcdic(void *dest, const void *srce, size_t count)
|
||||
{
|
||||
unsigned char *udest = dest;
|
||||
const unsigned char *usrce = srce;
|
||||
|
||||
while (count-- != 0) {
|
||||
*udest++ = os_toebcdic[*usrce++];
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#else /*CHARSET_EBCDIC*/
|
||||
#ifdef PEDANTIC
|
||||
static void *dummy=&dummy;
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,111 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/err/Makefile
|
||||
#
|
||||
|
||||
DIR= err
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES= -I.. -I../../include
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=err.c err_all.c err_prn.c
|
||||
LIBOBJ=err.o err_all.o err_prn.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= err.h
|
||||
HEADER= $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
|
||||
err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
err.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
err_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
|
||||
err_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
|
||||
err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
|
||||
err_all.o: ../../include/openssl/des.h ../../include/openssl/dh.h
|
||||
err_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
|
||||
err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
|
||||
err_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
|
||||
err_all.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
|
||||
err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
|
||||
err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
|
||||
err_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
|
||||
err_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h
|
||||
err_all.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
|
||||
err_all.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
|
||||
err_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
|
||||
err_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
|
||||
err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
|
||||
err_all.o: ../../include/openssl/x509v3.h
|
||||
err_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
|
||||
err_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
|
||||
err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
|
||||
err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
|
||||
err_prn.o: ../../include/openssl/stack.h ../cryptlib.h
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,149 +0,0 @@
|
||||
/* crypto/evp/c_allc.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
void OpenSSL_add_all_ciphers(void)
|
||||
{
|
||||
#ifndef NO_DES
|
||||
EVP_add_cipher(EVP_des_cfb());
|
||||
EVP_add_cipher(EVP_des_ede_cfb());
|
||||
EVP_add_cipher(EVP_des_ede3_cfb());
|
||||
|
||||
EVP_add_cipher(EVP_des_ofb());
|
||||
EVP_add_cipher(EVP_des_ede_ofb());
|
||||
EVP_add_cipher(EVP_des_ede3_ofb());
|
||||
|
||||
EVP_add_cipher(EVP_desx_cbc());
|
||||
EVP_add_cipher_alias(SN_desx_cbc,"DESX");
|
||||
EVP_add_cipher_alias(SN_desx_cbc,"desx");
|
||||
|
||||
EVP_add_cipher(EVP_des_cbc());
|
||||
EVP_add_cipher_alias(SN_des_cbc,"DES");
|
||||
EVP_add_cipher_alias(SN_des_cbc,"des");
|
||||
EVP_add_cipher(EVP_des_ede_cbc());
|
||||
EVP_add_cipher(EVP_des_ede3_cbc());
|
||||
EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3");
|
||||
EVP_add_cipher_alias(SN_des_ede3_cbc,"des3");
|
||||
|
||||
EVP_add_cipher(EVP_des_ecb());
|
||||
EVP_add_cipher(EVP_des_ede());
|
||||
EVP_add_cipher(EVP_des_ede3());
|
||||
#endif
|
||||
|
||||
#ifndef NO_RC4
|
||||
EVP_add_cipher(EVP_rc4());
|
||||
EVP_add_cipher(EVP_rc4_40());
|
||||
#endif
|
||||
|
||||
#ifndef NO_IDEA
|
||||
EVP_add_cipher(EVP_idea_ecb());
|
||||
EVP_add_cipher(EVP_idea_cfb());
|
||||
EVP_add_cipher(EVP_idea_ofb());
|
||||
EVP_add_cipher(EVP_idea_cbc());
|
||||
EVP_add_cipher_alias(SN_idea_cbc,"IDEA");
|
||||
EVP_add_cipher_alias(SN_idea_cbc,"idea");
|
||||
#endif
|
||||
|
||||
#ifndef NO_RC2
|
||||
EVP_add_cipher(EVP_rc2_ecb());
|
||||
EVP_add_cipher(EVP_rc2_cfb());
|
||||
EVP_add_cipher(EVP_rc2_ofb());
|
||||
EVP_add_cipher(EVP_rc2_cbc());
|
||||
EVP_add_cipher(EVP_rc2_40_cbc());
|
||||
EVP_add_cipher(EVP_rc2_64_cbc());
|
||||
EVP_add_cipher_alias(SN_rc2_cbc,"RC2");
|
||||
EVP_add_cipher_alias(SN_rc2_cbc,"rc2");
|
||||
#endif
|
||||
|
||||
#ifndef NO_BF
|
||||
EVP_add_cipher(EVP_bf_ecb());
|
||||
EVP_add_cipher(EVP_bf_cfb());
|
||||
EVP_add_cipher(EVP_bf_ofb());
|
||||
EVP_add_cipher(EVP_bf_cbc());
|
||||
EVP_add_cipher_alias(SN_bf_cbc,"BF");
|
||||
EVP_add_cipher_alias(SN_bf_cbc,"bf");
|
||||
EVP_add_cipher_alias(SN_bf_cbc,"blowfish");
|
||||
#endif
|
||||
|
||||
#ifndef NO_CAST
|
||||
EVP_add_cipher(EVP_cast5_ecb());
|
||||
EVP_add_cipher(EVP_cast5_cfb());
|
||||
EVP_add_cipher(EVP_cast5_ofb());
|
||||
EVP_add_cipher(EVP_cast5_cbc());
|
||||
EVP_add_cipher_alias(SN_cast5_cbc,"CAST");
|
||||
EVP_add_cipher_alias(SN_cast5_cbc,"cast");
|
||||
EVP_add_cipher_alias(SN_cast5_cbc,"CAST-cbc");
|
||||
EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc");
|
||||
#endif
|
||||
|
||||
#ifndef NO_RC5
|
||||
EVP_add_cipher(EVP_rc5_32_12_16_ecb());
|
||||
EVP_add_cipher(EVP_rc5_32_12_16_cfb());
|
||||
EVP_add_cipher(EVP_rc5_32_12_16_ofb());
|
||||
EVP_add_cipher(EVP_rc5_32_12_16_cbc());
|
||||
EVP_add_cipher_alias(SN_rc5_cbc,"rc5");
|
||||
EVP_add_cipher_alias(SN_rc5_cbc,"RC5");
|
||||
#endif
|
||||
PKCS12_PBE_add();
|
||||
PKCS5_PBE_add();
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
/* crypto/evp/c_alld.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
void OpenSSL_add_all_digests(void)
|
||||
{
|
||||
#ifndef NO_MD2
|
||||
EVP_add_digest(EVP_md2());
|
||||
#endif
|
||||
#ifndef NO_MD5
|
||||
EVP_add_digest(EVP_md5());
|
||||
EVP_add_digest_alias(SN_md5,"ssl2-md5");
|
||||
EVP_add_digest_alias(SN_md5,"ssl3-md5");
|
||||
#endif
|
||||
#ifndef NO_SHA
|
||||
EVP_add_digest(EVP_sha());
|
||||
#ifndef NO_DSA
|
||||
EVP_add_digest(EVP_dss());
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NO_SHA
|
||||
EVP_add_digest(EVP_sha1());
|
||||
EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
|
||||
EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA);
|
||||
#ifndef NO_DSA
|
||||
EVP_add_digest(EVP_dss1());
|
||||
EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2);
|
||||
EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1");
|
||||
EVP_add_digest_alias(SN_dsaWithSHA1,"dss1");
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(NO_MDC2) && !defined(NO_DES)
|
||||
EVP_add_digest(EVP_mdc2());
|
||||
#endif
|
||||
#ifndef NO_RIPEMD
|
||||
EVP_add_digest(EVP_ripemd160());
|
||||
EVP_add_digest_alias(SN_ripemd160,"ripemd");
|
||||
EVP_add_digest_alias(SN_ripemd160,"rmd160");
|
||||
#endif
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/md/Makefile
|
||||
#
|
||||
|
||||
DIR= hmac
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=hmactest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=hmac.c
|
||||
LIBOBJ=hmac.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= hmac.h
|
||||
HEADER= $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
hmac.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
|
||||
hmac.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
|
||||
hmac.o: ../../include/openssl/cast.h ../../include/openssl/crypto.h
|
||||
hmac.o: ../../include/openssl/des.h ../../include/openssl/dh.h
|
||||
hmac.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
|
||||
hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h
|
||||
hmac.o: ../../include/openssl/idea.h ../../include/openssl/md2.h
|
||||
hmac.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
|
||||
hmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
|
||||
hmac.o: ../../include/openssl/opensslv.h ../../include/openssl/rc2.h
|
||||
hmac.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
|
||||
hmac.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
|
||||
hmac.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
|
||||
hmac.o: ../../include/openssl/stack.h
|
||||
@@ -1,91 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/idea/Makefile
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
DIR= idea
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=ideatest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c
|
||||
LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= idea.h
|
||||
HEADER= idea_lcl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_cbc.o: idea_lcl.h
|
||||
i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_cfb64.o: idea_lcl.h
|
||||
i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_ecb.o: ../../include/openssl/opensslv.h idea_lcl.h
|
||||
i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_ofb64.o: idea_lcl.h
|
||||
i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_skey.o: idea_lcl.h
|
||||
@@ -1,91 +0,0 @@
|
||||
#
|
||||
# SSLeay/crypto/idea/Makefile
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
DIR= idea
|
||||
TOP= ../..
|
||||
CC= cc
|
||||
INCLUDES=
|
||||
CFLAG=-g
|
||||
INSTALL_PREFIX=
|
||||
OPENSSLDIR= /usr/local/ssl
|
||||
INSTALLTOP=/usr/local/ssl
|
||||
MAKE= make -f Makefile.ssl
|
||||
MAKEDEPEND= $(TOP)/util/domd $(TOP)
|
||||
MAKEFILE= Makefile.ssl
|
||||
AR= ar r
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=ideatest.c
|
||||
APPS=
|
||||
|
||||
LIB=$(TOP)/libcrypto.a
|
||||
LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c
|
||||
LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= idea.h
|
||||
HEADER= idea_lcl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
top:
|
||||
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
|
||||
|
||||
all: lib
|
||||
|
||||
lib: $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
@touch lib
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
|
||||
|
||||
links:
|
||||
@$(TOP)/util/point.sh Makefile.ssl Makefile
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
|
||||
|
||||
install:
|
||||
@for i in $(EXHEADER) ; \
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
tests:
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_cbc.o: idea_lcl.h
|
||||
i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_cfb64.o: idea_lcl.h
|
||||
i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_ecb.o: ../../include/openssl/opensslv.h idea_lcl.h
|
||||
i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_ofb64.o: idea_lcl.h
|
||||
i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h
|
||||
i_skey.o: idea_lcl.h
|
||||
@@ -1,74 +0,0 @@
|
||||
# Targets
|
||||
# make - twidle the options yourself :-)
|
||||
# make cc - standard cc options
|
||||
# make gcc - standard gcc options
|
||||
# $FreeBSD$
|
||||
|
||||
DIR= cast
|
||||
TOP= .
|
||||
CC= gcc
|
||||
CFLAG= -O3 -fomit-frame-pointer
|
||||
|
||||
CPP= $(CC) -E
|
||||
INCLUDES=
|
||||
INSTALLTOP=/usr/local/lib
|
||||
MAKE= make
|
||||
MAKEDEPEND= makedepend
|
||||
MAKEFILE= Makefile.uni
|
||||
AR= ar r
|
||||
RANLIB= ranlib
|
||||
|
||||
IDEA_ENC=i_cbc.o
|
||||
|
||||
CFLAGS= $(INCLUDES) $(CFLAG)
|
||||
|
||||
GENERAL=Makefile
|
||||
TEST=ideatest
|
||||
APPS=idea_spd
|
||||
|
||||
LIB=libidea.a
|
||||
LIBSRC=i_skey.c i_ecb.c i_cbc.c i_cfb64.c i_ofb64.c
|
||||
LIBOBJ=i_skey.o i_ecb.o $(IDEA_ENC) i_cfb64.o i_ofb64.o
|
||||
|
||||
SRC= $(LIBSRC)
|
||||
|
||||
EXHEADER= idea.h
|
||||
HEADER= idea_lcl.h $(EXHEADER)
|
||||
|
||||
ALL= $(GENERAL) $(SRC) $(HEADER)
|
||||
|
||||
all: $(LIB) $(TEST) $(APPS)
|
||||
|
||||
$(LIB): $(LIBOBJ)
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
test: $(TEST)
|
||||
./$(TEST)
|
||||
|
||||
$(TEST): $(TEST).c $(LIB)
|
||||
$(CC) -o $(TEST) $(CFLAGS) $(TEST).c $(LIB)
|
||||
|
||||
$(APPS): $(APPS).c $(LIB)
|
||||
$(CC) -o $(APPS) $(CFLAGS) $(APPS).c $(LIB)
|
||||
|
||||
lint:
|
||||
lint -DLINT $(INCLUDES) $(SRC)>fluff
|
||||
|
||||
depend:
|
||||
$(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
|
||||
|
||||
dclean:
|
||||
perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
|
||||
mv -f Makefile.new $(MAKEFILE)
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(LIB) $(TEST) $(APPS) *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
|
||||
|
||||
cc:
|
||||
$(MAKE) CC="cc" CFLAG="-O" all
|
||||
|
||||
gcc:
|
||||
$(MAKE) CC="gcc" CFLAGS="-O3 -fomit-frame-pointer" all
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
@@ -1,169 +0,0 @@
|
||||
/* crypto/idea/i_cbc.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <openssl/idea.h>
|
||||
#include "idea_lcl.h"
|
||||
|
||||
void idea_cbc_encrypt(unsigned char *in, unsigned char *out, long length,
|
||||
IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int encrypt)
|
||||
{
|
||||
register unsigned long tin0,tin1;
|
||||
register unsigned long tout0,tout1,xor0,xor1;
|
||||
register long l=length;
|
||||
unsigned long tin[2];
|
||||
|
||||
if (encrypt)
|
||||
{
|
||||
n2l(iv,tout0);
|
||||
n2l(iv,tout1);
|
||||
iv-=8;
|
||||
for (l-=8; l>=0; l-=8)
|
||||
{
|
||||
n2l(in,tin0);
|
||||
n2l(in,tin1);
|
||||
tin0^=tout0;
|
||||
tin1^=tout1;
|
||||
tin[0]=tin0;
|
||||
tin[1]=tin1;
|
||||
idea_encrypt(tin,ks);
|
||||
tout0=tin[0]; l2n(tout0,out);
|
||||
tout1=tin[1]; l2n(tout1,out);
|
||||
}
|
||||
if (l != -8)
|
||||
{
|
||||
n2ln(in,tin0,tin1,l+8);
|
||||
tin0^=tout0;
|
||||
tin1^=tout1;
|
||||
tin[0]=tin0;
|
||||
tin[1]=tin1;
|
||||
idea_encrypt(tin,ks);
|
||||
tout0=tin[0]; l2n(tout0,out);
|
||||
tout1=tin[1]; l2n(tout1,out);
|
||||
}
|
||||
l2n(tout0,iv);
|
||||
l2n(tout1,iv);
|
||||
}
|
||||
else
|
||||
{
|
||||
n2l(iv,xor0);
|
||||
n2l(iv,xor1);
|
||||
iv-=8;
|
||||
for (l-=8; l>=0; l-=8)
|
||||
{
|
||||
n2l(in,tin0); tin[0]=tin0;
|
||||
n2l(in,tin1); tin[1]=tin1;
|
||||
idea_encrypt(tin,ks);
|
||||
tout0=tin[0]^xor0;
|
||||
tout1=tin[1]^xor1;
|
||||
l2n(tout0,out);
|
||||
l2n(tout1,out);
|
||||
xor0=tin0;
|
||||
xor1=tin1;
|
||||
}
|
||||
if (l != -8)
|
||||
{
|
||||
n2l(in,tin0); tin[0]=tin0;
|
||||
n2l(in,tin1); tin[1]=tin1;
|
||||
idea_encrypt(tin,ks);
|
||||
tout0=tin[0]^xor0;
|
||||
tout1=tin[1]^xor1;
|
||||
l2nn(tout0,tout1,out,l+8);
|
||||
xor0=tin0;
|
||||
xor1=tin1;
|
||||
}
|
||||
l2n(xor0,iv);
|
||||
l2n(xor1,iv);
|
||||
}
|
||||
tin0=tin1=tout0=tout1=xor0=xor1=0;
|
||||
tin[0]=tin[1]=0;
|
||||
}
|
||||
|
||||
void idea_encrypt(unsigned long *d, IDEA_KEY_SCHEDULE *key)
|
||||
{
|
||||
register IDEA_INT *p;
|
||||
register unsigned long x1,x2,x3,x4,t0,t1,ul;
|
||||
|
||||
x2=d[0];
|
||||
x1=(x2>>16);
|
||||
x4=d[1];
|
||||
x3=(x4>>16);
|
||||
|
||||
p= &(key->data[0][0]);
|
||||
|
||||
E_IDEA(0);
|
||||
E_IDEA(1);
|
||||
E_IDEA(2);
|
||||
E_IDEA(3);
|
||||
E_IDEA(4);
|
||||
E_IDEA(5);
|
||||
E_IDEA(6);
|
||||
E_IDEA(7);
|
||||
|
||||
x1&=0xffff;
|
||||
idea_mul(x1,x1,*p,ul); p++;
|
||||
|
||||
t0= x3+ *(p++);
|
||||
t1= x2+ *(p++);
|
||||
|
||||
x4&=0xffff;
|
||||
idea_mul(x4,x4,*p,ul);
|
||||
|
||||
d[0]=(t0&0xffff)|((x1&0xffff)<<16);
|
||||
d[1]=(x4&0xffff)|((t1&0xffff)<<16);
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
/* crypto/idea/i_cfb64.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <openssl/idea.h>
|
||||
#include "idea_lcl.h"
|
||||
|
||||
/* The input and output encrypted as though 64bit cfb mode is being
|
||||
* used. The extra state information to record how much of the
|
||||
* 64bit block we have used is contained in *num;
|
||||
*/
|
||||
|
||||
void idea_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
|
||||
IDEA_KEY_SCHEDULE *schedule, unsigned char *ivec, int *num,
|
||||
int encrypt)
|
||||
{
|
||||
register unsigned long v0,v1,t;
|
||||
register int n= *num;
|
||||
register long l=length;
|
||||
unsigned long ti[2];
|
||||
unsigned char *iv,c,cc;
|
||||
|
||||
iv=(unsigned char *)ivec;
|
||||
if (encrypt)
|
||||
{
|
||||
while (l--)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
n2l(iv,v0); ti[0]=v0;
|
||||
n2l(iv,v1); ti[1]=v1;
|
||||
idea_encrypt((unsigned long *)ti,schedule);
|
||||
iv=(unsigned char *)ivec;
|
||||
t=ti[0]; l2n(t,iv);
|
||||
t=ti[1]; l2n(t,iv);
|
||||
iv=(unsigned char *)ivec;
|
||||
}
|
||||
c= *(in++)^iv[n];
|
||||
*(out++)=c;
|
||||
iv[n]=c;
|
||||
n=(n+1)&0x07;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (l--)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
n2l(iv,v0); ti[0]=v0;
|
||||
n2l(iv,v1); ti[1]=v1;
|
||||
idea_encrypt((unsigned long *)ti,schedule);
|
||||
iv=(unsigned char *)ivec;
|
||||
t=ti[0]; l2n(t,iv);
|
||||
t=ti[1]; l2n(t,iv);
|
||||
iv=(unsigned char *)ivec;
|
||||
}
|
||||
cc= *(in++);
|
||||
c=iv[n];
|
||||
iv[n]=cc;
|
||||
*(out++)=c^cc;
|
||||
n=(n+1)&0x07;
|
||||
}
|
||||
}
|
||||
v0=v1=ti[0]=ti[1]=t=c=cc=0;
|
||||
*num=n;
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/* crypto/idea/i_ecb.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <openssl/idea.h>
|
||||
#include "idea_lcl.h"
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
const char *IDEA_version="IDEA" OPENSSL_VERSION_PTEXT;
|
||||
|
||||
const char *idea_options(void)
|
||||
{
|
||||
if (sizeof(short) != sizeof(IDEA_INT))
|
||||
return("idea(int)");
|
||||
else
|
||||
return("idea(short)");
|
||||
}
|
||||
|
||||
void idea_ecb_encrypt(unsigned char *in, unsigned char *out,
|
||||
IDEA_KEY_SCHEDULE *ks)
|
||||
{
|
||||
unsigned long l0,l1,d[2];
|
||||
|
||||
n2l(in,l0); d[0]=l0;
|
||||
n2l(in,l1); d[1]=l1;
|
||||
idea_encrypt(d,ks);
|
||||
l0=d[0]; l2n(l0,out);
|
||||
l1=d[1]; l2n(l1,out);
|
||||
l0=l1=d[0]=d[1]=0;
|
||||
}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
/* crypto/idea/i_ofb64.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <openssl/idea.h>
|
||||
#include "idea_lcl.h"
|
||||
|
||||
/* The input and output encrypted as though 64bit ofb mode is being
|
||||
* used. The extra state information to record how much of the
|
||||
* 64bit block we have used is contained in *num;
|
||||
*/
|
||||
void idea_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
|
||||
IDEA_KEY_SCHEDULE *schedule, unsigned char *ivec, int *num)
|
||||
{
|
||||
register unsigned long v0,v1,t;
|
||||
register int n= *num;
|
||||
register long l=length;
|
||||
unsigned char d[8];
|
||||
register char *dp;
|
||||
unsigned long ti[2];
|
||||
unsigned char *iv;
|
||||
int save=0;
|
||||
|
||||
iv=(unsigned char *)ivec;
|
||||
n2l(iv,v0);
|
||||
n2l(iv,v1);
|
||||
ti[0]=v0;
|
||||
ti[1]=v1;
|
||||
dp=(char *)d;
|
||||
l2n(v0,dp);
|
||||
l2n(v1,dp);
|
||||
while (l--)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
idea_encrypt((unsigned long *)ti,schedule);
|
||||
dp=(char *)d;
|
||||
t=ti[0]; l2n(t,dp);
|
||||
t=ti[1]; l2n(t,dp);
|
||||
save++;
|
||||
}
|
||||
*(out++)= *(in++)^d[n];
|
||||
n=(n+1)&0x07;
|
||||
}
|
||||
if (save)
|
||||
{
|
||||
v0=ti[0];
|
||||
v1=ti[1];
|
||||
iv=(unsigned char *)ivec;
|
||||
l2n(v0,iv);
|
||||
l2n(v1,iv);
|
||||
}
|
||||
t=v0=v1=ti[0]=ti[1]=0;
|
||||
*num=n;
|
||||
}
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/* crypto/idea/i_skey.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <openssl/idea.h>
|
||||
#include "idea_lcl.h"
|
||||
|
||||
static IDEA_INT inverse(unsigned int xin);
|
||||
void idea_set_encrypt_key(unsigned char *key, IDEA_KEY_SCHEDULE *ks)
|
||||
{
|
||||
int i;
|
||||
register IDEA_INT *kt,*kf,r0,r1,r2;
|
||||
|
||||
kt= &(ks->data[0][0]);
|
||||
n2s(key,kt[0]); n2s(key,kt[1]); n2s(key,kt[2]); n2s(key,kt[3]);
|
||||
n2s(key,kt[4]); n2s(key,kt[5]); n2s(key,kt[6]); n2s(key,kt[7]);
|
||||
|
||||
kf=kt;
|
||||
kt+=8;
|
||||
for (i=0; i<6; i++)
|
||||
{
|
||||
r2= kf[1];
|
||||
r1= kf[2];
|
||||
*(kt++)= ((r2<<9) | (r1>>7))&0xffff;
|
||||
r0= kf[3];
|
||||
*(kt++)= ((r1<<9) | (r0>>7))&0xffff;
|
||||
r1= kf[4];
|
||||
*(kt++)= ((r0<<9) | (r1>>7))&0xffff;
|
||||
r0= kf[5];
|
||||
*(kt++)= ((r1<<9) | (r0>>7))&0xffff;
|
||||
r1= kf[6];
|
||||
*(kt++)= ((r0<<9) | (r1>>7))&0xffff;
|
||||
r0= kf[7];
|
||||
*(kt++)= ((r1<<9) | (r0>>7))&0xffff;
|
||||
r1= kf[0];
|
||||
if (i >= 5) break;
|
||||
*(kt++)= ((r0<<9) | (r1>>7))&0xffff;
|
||||
*(kt++)= ((r1<<9) | (r2>>7))&0xffff;
|
||||
kf+=8;
|
||||
}
|
||||
}
|
||||
|
||||
void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk)
|
||||
{
|
||||
int r;
|
||||
register IDEA_INT *fp,*tp,t;
|
||||
|
||||
tp= &(dk->data[0][0]);
|
||||
fp= &(ek->data[8][0]);
|
||||
for (r=0; r<9; r++)
|
||||
{
|
||||
*(tp++)=inverse(fp[0]);
|
||||
*(tp++)=((int)(0x10000L-fp[2])&0xffff);
|
||||
*(tp++)=((int)(0x10000L-fp[1])&0xffff);
|
||||
*(tp++)=inverse(fp[3]);
|
||||
if (r == 8) break;
|
||||
fp-=6;
|
||||
*(tp++)=fp[4];
|
||||
*(tp++)=fp[5];
|
||||
}
|
||||
|
||||
tp= &(dk->data[0][0]);
|
||||
t=tp[1];
|
||||
tp[1]=tp[2];
|
||||
tp[2]=t;
|
||||
|
||||
t=tp[49];
|
||||
tp[49]=tp[50];
|
||||
tp[50]=t;
|
||||
}
|
||||
|
||||
/* taken directly from the 'paper' I'll have a look at it later */
|
||||
static IDEA_INT inverse(unsigned int xin)
|
||||
{
|
||||
long n1,n2,q,r,b1,b2,t;
|
||||
|
||||
if (xin == 0)
|
||||
b2=0;
|
||||
else
|
||||
{
|
||||
n1=0x10001;
|
||||
n2=xin;
|
||||
b2=1;
|
||||
b1=0;
|
||||
|
||||
do {
|
||||
r=(n1%n2);
|
||||
q=(n1-r)/n2;
|
||||
if (r == 0)
|
||||
{ if (b2 < 0) b2=0x10001+b2; }
|
||||
else
|
||||
{
|
||||
n1=n2;
|
||||
n2=r;
|
||||
t=b2;
|
||||
b2=b1-q*b2;
|
||||
b1=t;
|
||||
}
|
||||
} while (r != 0);
|
||||
}
|
||||
return((IDEA_INT)b2);
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
/* crypto/idea/idea.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef HEADER_IDEA_H
|
||||
#define HEADER_IDEA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef NO_IDEA
|
||||
#error IDEA is disabled.
|
||||
#endif
|
||||
|
||||
#define IDEA_ENCRYPT 1
|
||||
#define IDEA_DECRYPT 0
|
||||
|
||||
#include <openssl/opensslconf.h> /* IDEA_INT */
|
||||
#define IDEA_BLOCK 8
|
||||
#define IDEA_KEY_LENGTH 16
|
||||
|
||||
typedef struct idea_key_st
|
||||
{
|
||||
IDEA_INT data[9][6];
|
||||
} IDEA_KEY_SCHEDULE;
|
||||
|
||||
const char *idea_options(void);
|
||||
void idea_ecb_encrypt(unsigned char *in, unsigned char *out,
|
||||
IDEA_KEY_SCHEDULE *ks);
|
||||
void idea_set_encrypt_key(unsigned char *key, IDEA_KEY_SCHEDULE *ks);
|
||||
void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
|
||||
void idea_cbc_encrypt(unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);
|
||||
void idea_cfb64_encrypt(unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||
int *num,int enc);
|
||||
void idea_ofb64_encrypt(unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num);
|
||||
void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,216 +0,0 @@
|
||||
/* crypto/idea/idea_lcl.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young ([email protected]).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson ([email protected]).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young ([email protected])"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/* The new form of this macro (check if the a*b == 0) was suggested by
|
||||
* Colin Plumb <[email protected]> */
|
||||
/* Removal of the inner if from from Wei Dai 24/4/96 */
|
||||
#define idea_mul(r,a,b,ul) \
|
||||
ul=(unsigned long)a*b; \
|
||||
if (ul != 0) \
|
||||
{ \
|
||||
r=(ul&0xffff)-(ul>>16); \
|
||||
r-=((r)>>16); \
|
||||
} \
|
||||
else \
|
||||
r=(-(int)a-b+1); /* assuming a or b is 0 and in range */ \
|
||||
|
||||
#ifdef undef
|
||||
#define idea_mul(r,a,b,ul,sl) \
|
||||
if (a == 0) r=(0x10001-b)&0xffff; \
|
||||
else if (b == 0) r=(0x10001-a)&0xffff; \
|
||||
else { \
|
||||
ul=(unsigned long)a*b; \
|
||||
sl=(ul&0xffff)-(ul>>16); \
|
||||
if (sl <= 0) sl+=0x10001; \
|
||||
r=sl; \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 7/12/95 - Many thanks to Rhys Weatherley <[email protected]>
|
||||
* for pointing out that I was assuming little endian
|
||||
* byte order for all quantities what idea
|
||||
* actually used bigendian. No where in the spec does it mention
|
||||
* this, it is all in terms of 16 bit numbers and even the example
|
||||
* does not use byte streams for the input example :-(.
|
||||
* If you byte swap each pair of input, keys and iv, the functions
|
||||
* would produce the output as the old version :-(.
|
||||
*/
|
||||
|
||||
/* NOTE - c is not incremented as per n2l */
|
||||
#define n2ln(c,l1,l2,n) { \
|
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c)))) ; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 5: l2|=((unsigned long)(*(--(c))))<<24; \
|
||||
case 4: l1 =((unsigned long)(*(--(c)))) ; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 1: l1|=((unsigned long)(*(--(c))))<<24; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* NOTE - c is not incremented as per l2n */
|
||||
#define l2nn(l1,l2,c,n) { \
|
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef n2l
|
||||
#define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++))))
|
||||
|
||||
#undef l2n
|
||||
#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l) )&0xff))
|
||||
|
||||
#undef s2n
|
||||
#define s2n(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff))
|
||||
|
||||
#undef n2s
|
||||
#define n2s(c,l) (l =((IDEA_INT)(*((c)++)))<< 8L, \
|
||||
l|=((IDEA_INT)(*((c)++))) )
|
||||
|
||||
#ifdef undef
|
||||
/* NOTE - c is not incremented as per c2l */
|
||||
#define c2ln(c,l1,l2,n) { \
|
||||
c+=n; \
|
||||
l1=l2=0; \
|
||||
switch (n) { \
|
||||
case 8: l2 =((unsigned long)(*(--(c))))<<24; \
|
||||
case 7: l2|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 6: l2|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 5: l2|=((unsigned long)(*(--(c)))); \
|
||||
case 4: l1 =((unsigned long)(*(--(c))))<<24; \
|
||||
case 3: l1|=((unsigned long)(*(--(c))))<<16; \
|
||||
case 2: l1|=((unsigned long)(*(--(c))))<< 8; \
|
||||
case 1: l1|=((unsigned long)(*(--(c)))); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* NOTE - c is not incremented as per l2c */
|
||||
#define l2cn(l1,l2,c,n) { \
|
||||
c+=n; \
|
||||
switch (n) { \
|
||||
case 8: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \
|
||||
case 7: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \
|
||||
case 6: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \
|
||||
case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \
|
||||
case 4: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \
|
||||
case 3: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \
|
||||
case 2: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \
|
||||
case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef c2s
|
||||
#define c2s(c,l) (l =((unsigned long)(*((c)++))) , \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L)
|
||||
|
||||
#undef s2c
|
||||
#define s2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff))
|
||||
|
||||
#undef c2l
|
||||
#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
|
||||
l|=((unsigned long)(*((c)++)))<< 8L, \
|
||||
l|=((unsigned long)(*((c)++)))<<16L, \
|
||||
l|=((unsigned long)(*((c)++)))<<24L)
|
||||
|
||||
#undef l2c
|
||||
#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16L)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
|
||||
#endif
|
||||
|
||||
#define E_IDEA(num) \
|
||||
x1&=0xffff; \
|
||||
idea_mul(x1,x1,*p,ul); p++; \
|
||||
x2+= *(p++); \
|
||||
x3+= *(p++); \
|
||||
x4&=0xffff; \
|
||||
idea_mul(x4,x4,*p,ul); p++; \
|
||||
t0=(x1^x3)&0xffff; \
|
||||
idea_mul(t0,t0,*p,ul); p++; \
|
||||
t1=(t0+(x2^x4))&0xffff; \
|
||||
idea_mul(t1,t1,*p,ul); p++; \
|
||||
t0+=t1; \
|
||||
x1^=t1; \
|
||||
x4^=t0; \
|
||||
ul=x2^t0; /* do the swap to x3 */ \
|
||||
x2=x3^t1; \
|
||||
x3=ul;
|
||||
|
||||
@@ -1,297 +0,0 @@
|
||||
/* crypto/idea/idea_spd.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young ([email protected])
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson ([email protected])"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR 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.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
|
||||
/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
|
||||
|
||||
#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC))
|
||||
#define TIMES
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#include OPENSSL_UNISTD_IO
|
||||
OPENSSL_DECLARE_EXIT
|
||||
|
||||
#include <signal.h>
|
||||
#ifndef _IRIX
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef TIMES
|
||||
#include <sys/types.h>
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
|
||||
/* Depending on the VMS version, the tms structure is perhaps defined.
|
||||
The __TMS macro will show if it was. If it wasn't defined, we should
|
||||
undefine TIMES, since that tells the rest of the program how things
|
||||
should be handled. -- Richard Levitte */
|
||||
#if defined(VMS) && defined(__DECC) && !defined(__TMS)
|
||||
#undef TIMES
|
||||
#endif
|
||||
|
||||
#ifndef TIMES
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#if defined(sun) || defined(__ultrix)
|
||||
#define _POSIX_SOURCE
|
||||
#include <limits.h>
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/idea.h>
|
||||
|
||||
/* The following if from times(3) man page. It may need to be changed */
|
||||
#ifndef HZ
|
||||
#ifndef CLK_TCK
|
||||
#define HZ 100.0
|
||||
#else /* CLK_TCK */
|
||||
#define HZ ((double)CLK_TCK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUFSIZE ((long)1024)
|
||||
long run=0;
|
||||
|
||||
double Time_F(int s);
|
||||
#ifdef SIGALRM
|
||||
#if defined(__STDC__) || defined(sgi) || defined(_AIX)
|
||||
#define SIGRETTYPE void
|
||||
#else
|
||||
#define SIGRETTYPE int
|
||||
#endif
|
||||
|
||||
SIGRETTYPE sig_done(int sig);
|
||||
SIGRETTYPE sig_done(int sig)
|
||||
{
|
||||
signal(SIGALRM,sig_done);
|
||||
run=0;
|
||||
#ifdef LINT
|
||||
sig=sig;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#define START 0
|
||||
#define STOP 1
|
||||
|
||||
double Time_F(int s)
|
||||
{
|
||||
double ret;
|
||||
#ifdef TIMES
|
||||
static struct tms tstart,tend;
|
||||
|
||||
if (s == START)
|
||||
{
|
||||
times(&tstart);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
times(&tend);
|
||||
ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
|
||||
return((ret == 0.0)?1e-6:ret);
|
||||
}
|
||||
#else /* !times() */
|
||||
static struct timeb tstart,tend;
|
||||
long i;
|
||||
|
||||
if (s == START)
|
||||
{
|
||||
ftime(&tstart);
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ftime(&tend);
|
||||
i=(long)tend.millitm-(long)tstart.millitm;
|
||||
ret=((double)(tend.time-tstart.time))+((double)i)/1e3;
|
||||
return((ret == 0.0)?1e-6:ret);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
long count;
|
||||
static unsigned char buf[BUFSIZE];
|
||||
static unsigned char key[] ={
|
||||
0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
|
||||
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
};
|
||||
IDEA_KEY_SCHEDULE sch;
|
||||
double a,aa,b,c,d;
|
||||
#ifndef SIGALRM
|
||||
long ca,cca,cb,cc;
|
||||
#endif
|
||||
|
||||
#ifndef TIMES
|
||||
printf("To get the most accurate results, try to run this\n");
|
||||
printf("program when this computer is idle.\n");
|
||||
#endif
|
||||
|
||||
#ifndef SIGALRM
|
||||
printf("First we calculate the approximate speed ...\n");
|
||||
idea_set_encrypt_key(key,&sch);
|
||||
count=10;
|
||||
do {
|
||||
long i;
|
||||
IDEA_INT data[2];
|
||||
|
||||
count*=2;
|
||||
Time_F(START);
|
||||
for (i=count; i; i--)
|
||||
idea_encrypt(data,&sch);
|
||||
d=Time_F(STOP);
|
||||
} while (d < 3.0);
|
||||
ca=count/4;
|
||||
cca=count/200;
|
||||
cb=count;
|
||||
cc=count*8/BUFSIZE+1;
|
||||
printf("idea_set_encrypt_key %ld times\n",ca);
|
||||
#define COND(d) (count <= (d))
|
||||
#define COUNT(d) (d)
|
||||
#else
|
||||
#define COND(c) (run)
|
||||
#define COUNT(d) (count)
|
||||
signal(SIGALRM,sig_done);
|
||||
printf("Doing idea_set_encrypt_key for 10 seconds\n");
|
||||
alarm(10);
|
||||
#endif
|
||||
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(ca); count+=4)
|
||||
{
|
||||
idea_set_encrypt_key(key,&sch);
|
||||
idea_set_encrypt_key(key,&sch);
|
||||
idea_set_encrypt_key(key,&sch);
|
||||
idea_set_encrypt_key(key,&sch);
|
||||
}
|
||||
d=Time_F(STOP);
|
||||
printf("%ld idea idea_set_encrypt_key's in %.2f seconds\n",count,d);
|
||||
a=((double)COUNT(ca))/d;
|
||||
|
||||
#ifdef SIGALRM
|
||||
printf("Doing idea_set_decrypt_key for 10 seconds\n");
|
||||
alarm(10);
|
||||
#else
|
||||
printf("Doing idea_set_decrypt_key %ld times\n",cca);
|
||||
#endif
|
||||
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(cca); count+=4)
|
||||
{
|
||||
idea_set_decrypt_key(&sch,&sch);
|
||||
idea_set_decrypt_key(&sch,&sch);
|
||||
idea_set_decrypt_key(&sch,&sch);
|
||||
idea_set_decrypt_key(&sch,&sch);
|
||||
}
|
||||
d=Time_F(STOP);
|
||||
printf("%ld idea idea_set_decrypt_key's in %.2f seconds\n",count,d);
|
||||
aa=((double)COUNT(cca))/d;
|
||||
|
||||
#ifdef SIGALRM
|
||||
printf("Doing idea_encrypt's for 10 seconds\n");
|
||||
alarm(10);
|
||||
#else
|
||||
printf("Doing idea_encrypt %ld times\n",cb);
|
||||
#endif
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(cb); count+=4)
|
||||
{
|
||||
unsigned long data[2];
|
||||
|
||||
idea_encrypt(data,&sch);
|
||||
idea_encrypt(data,&sch);
|
||||
idea_encrypt(data,&sch);
|
||||
idea_encrypt(data,&sch);
|
||||
}
|
||||
d=Time_F(STOP);
|
||||
printf("%ld idea_encrypt's in %.2f second\n",count,d);
|
||||
b=((double)COUNT(cb)*8)/d;
|
||||
|
||||
#ifdef SIGALRM
|
||||
printf("Doing idea_cbc_encrypt on %ld byte blocks for 10 seconds\n",
|
||||
BUFSIZE);
|
||||
alarm(10);
|
||||
#else
|
||||
printf("Doing idea_cbc_encrypt %ld times on %ld byte blocks\n",cc,
|
||||
BUFSIZE);
|
||||
#endif
|
||||
Time_F(START);
|
||||
for (count=0,run=1; COND(cc); count++)
|
||||
idea_cbc_encrypt(buf,buf,BUFSIZE,&sch,
|
||||
&(key[0]),IDEA_ENCRYPT);
|
||||
d=Time_F(STOP);
|
||||
printf("%ld idea_cbc_encrypt's of %ld byte blocks in %.2f second\n",
|
||||
count,BUFSIZE,d);
|
||||
c=((double)COUNT(cc)*BUFSIZE)/d;
|
||||
|
||||
printf("IDEA set_encrypt_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a);
|
||||
printf("IDEA set_decrypt_key per sec = %12.2f (%9.3fuS)\n",aa,1.0e6/aa);
|
||||
printf("IDEA raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b);
|
||||
printf("IDEA cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c);
|
||||
exit(0);
|
||||
#if defined(LINT) || defined(MSDOS)
|
||||
return(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
Loaded 100 of 385 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user