diff options
Diffstat (limited to 'src/lib/libcrypto')
452 files changed, 84723 insertions, 775 deletions
diff --git a/src/lib/libcrypto/Attic/Makefile b/src/lib/libcrypto/Attic/Makefile new file mode 100644 index 0000000000..c1033f6d77 --- /dev/null +++ b/src/lib/libcrypto/Attic/Makefile | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= crypto | ||
| 6 | TOP= .. | ||
| 7 | CC= cc | ||
| 8 | INCLUDE= -I. -I$(TOP) -I../include $(ZLIB_INCLUDE) | ||
| 9 | # INCLUDES targets sudbirs! | ||
| 10 | INCLUDES= -I.. -I../.. -I../asn1 -I../evp -I../../include $(ZLIB_INCLUDE) | ||
| 11 | CFLAG= -g | ||
| 12 | MAKEDEPPROG= makedepend | ||
| 13 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 14 | MAKEFILE= Makefile | ||
| 15 | RM= rm -f | ||
| 16 | AR= ar r | ||
| 17 | |||
| 18 | RECURSIVE_MAKE= [ -n "$(SDIRS)" ] && for i in $(SDIRS) ; do \ | ||
| 19 | (cd $$i && echo "making $$target in $(DIR)/$$i..." && \ | ||
| 20 | $(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \ | ||
| 21 | done; | ||
| 22 | |||
| 23 | PEX_LIBS= | ||
| 24 | EX_LIBS= | ||
| 25 | |||
| 26 | CFLAGS= $(INCLUDE) $(CFLAG) | ||
| 27 | ASFLAGS= $(INCLUDE) $(ASFLAG) | ||
| 28 | AFLAGS=$(ASFLAGS) | ||
| 29 | CPUID_OBJ=mem_clr.o | ||
| 30 | |||
| 31 | LIBS= | ||
| 32 | |||
| 33 | GENERAL=Makefile README crypto-lib.com install.com | ||
| 34 | |||
| 35 | LIB= $(TOP)/libcrypto.a | ||
| 36 | SHARED_LIB= libcrypto$(SHLIB_EXT) | ||
| 37 | LIBSRC= cryptlib.c mem.c mem_clr.c mem_dbg.c cversion.c ex_data.c cpt_err.c ebcdic.c uid.c o_time.c o_str.c o_dir.c | ||
| 38 | LIBOBJ= cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o cpt_err.o ebcdic.o uid.o o_time.o o_str.o o_dir.o $(CPUID_OBJ) | ||
| 39 | |||
| 40 | SRC= $(LIBSRC) | ||
| 41 | |||
| 42 | EXHEADER= crypto.h opensslv.h opensslconf.h ebcdic.h symhacks.h \ | ||
| 43 | ossl_typ.h | ||
| 44 | HEADER= cryptlib.h buildinf.h md32_common.h o_time.h o_str.h o_dir.h $(EXHEADER) | ||
| 45 | |||
| 46 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 47 | |||
| 48 | top: | ||
| 49 | @(cd ..; $(MAKE) DIRS=$(DIR) all) | ||
| 50 | |||
| 51 | all: shared | ||
| 52 | |||
| 53 | buildinf.h: ../Makefile | ||
| 54 | ( echo "#ifndef MK1MF_BUILD"; \ | ||
| 55 | echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \ | ||
| 56 | echo ' #define CFLAGS "$(CC) $(CFLAG)"'; \ | ||
| 57 | echo ' #define PLATFORM "$(PLATFORM)"'; \ | ||
| 58 | echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \ | ||
| 59 | echo '#endif' ) >buildinf.h | ||
| 60 | |||
| 61 | x86cpuid.s: x86cpuid.pl perlasm/x86asm.pl | ||
| 62 | $(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 63 | |||
| 64 | applink.o: $(TOP)/ms/applink.c | ||
| 65 | $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/applink.c | ||
| 66 | |||
| 67 | uplink.o: $(TOP)/ms/uplink.c applink.o | ||
| 68 | $(CC) $(CFLAGS) -c -o $@ $(TOP)/ms/uplink.c | ||
| 69 | |||
| 70 | uplink-cof.s: $(TOP)/ms/uplink.pl | ||
| 71 | $(PERL) $(TOP)/ms/uplink.pl coff > $@ | ||
| 72 | |||
| 73 | x86_64cpuid.s: x86_64cpuid.pl | ||
| 74 | $(PERL) x86_64cpuid.pl $(PERLASM_SCHEME) > $@ | ||
| 75 | ia64cpuid.s: ia64cpuid.S | ||
| 76 | $(CC) $(CFLAGS) -E ia64cpuid.S > $@ | ||
| 77 | ppccpuid.s: ppccpuid.pl; $(PERL) ppccpuid.pl $(PERLASM_SCHEME) $@ | ||
| 78 | |||
| 79 | testapps: | ||
| 80 | [ -z "$(THIS)" ] || ( if echo $(SDIRS) | fgrep ' des '; \ | ||
| 81 | then cd des && $(MAKE) -e des; fi ) | ||
| 82 | [ -z "$(THIS)" ] || ( cd pkcs7 && $(MAKE) -e testapps ); | ||
| 83 | @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi | ||
| 84 | |||
| 85 | subdirs: | ||
| 86 | @target=all; $(RECURSIVE_MAKE) | ||
| 87 | |||
| 88 | files: | ||
| 89 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 90 | @target=files; $(RECURSIVE_MAKE) | ||
| 91 | |||
| 92 | links: | ||
| 93 | @$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER) | ||
| 94 | @$(PERL) $(TOP)/util/mklink.pl ../test $(TEST) | ||
| 95 | @$(PERL) $(TOP)/util/mklink.pl ../apps $(APPS) | ||
| 96 | @target=links; $(RECURSIVE_MAKE) | ||
| 97 | |||
| 98 | # lib: $(LIB): are splitted to avoid end-less loop | ||
| 99 | lib: $(LIB) | ||
| 100 | @touch lib | ||
| 101 | $(LIB): $(LIBOBJ) | ||
| 102 | $(AR) $(LIB) $(LIBOBJ) | ||
| 103 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 104 | |||
| 105 | shared: buildinf.h lib subdirs | ||
| 106 | if [ -n "$(SHARED_LIBS)" ]; then \ | ||
| 107 | (cd ..; $(MAKE) $(SHARED_LIB)); \ | ||
| 108 | fi | ||
| 109 | |||
| 110 | libs: | ||
| 111 | @target=lib; $(RECURSIVE_MAKE) | ||
| 112 | |||
| 113 | install: | ||
| 114 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 115 | @headerlist="$(EXHEADER)"; for i in $$headerlist ;\ | ||
| 116 | do \ | ||
| 117 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 118 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 119 | done; | ||
| 120 | @target=install; $(RECURSIVE_MAKE) | ||
| 121 | |||
| 122 | lint: | ||
| 123 | @target=lint; $(RECURSIVE_MAKE) | ||
| 124 | |||
| 125 | depend: | ||
| 126 | @[ -z "$(THIS)" -o -f buildinf.h ] || touch buildinf.h # fake buildinf.h if it does not exist | ||
| 127 | @[ -z "$(THIS)" ] || $(MAKEDEPEND) -- $(CFLAG) $(INCLUDE) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 128 | @[ -z "$(THIS)" -o -s buildinf.h ] || rm buildinf.h | ||
| 129 | @[ -z "$(THIS)" ] || (set -e; target=depend; $(RECURSIVE_MAKE) ) | ||
| 130 | @if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi | ||
| 131 | |||
| 132 | clean: | ||
| 133 | rm -f buildinf.h *.s *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 134 | @target=clean; $(RECURSIVE_MAKE) | ||
| 135 | |||
| 136 | dclean: | ||
| 137 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 138 | mv -f Makefile.new $(MAKEFILE) | ||
| 139 | rm -f opensslconf.h | ||
| 140 | @target=dclean; $(RECURSIVE_MAKE) | ||
| 141 | |||
| 142 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 143 | |||
| 144 | cpt_err.o: ../include/openssl/bio.h ../include/openssl/crypto.h | ||
| 145 | cpt_err.o: ../include/openssl/e_os2.h ../include/openssl/err.h | ||
| 146 | cpt_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h | ||
| 147 | cpt_err.o: ../include/openssl/opensslv.h ../include/openssl/ossl_typ.h | ||
| 148 | cpt_err.o: ../include/openssl/safestack.h ../include/openssl/stack.h | ||
| 149 | cpt_err.o: ../include/openssl/symhacks.h cpt_err.c | ||
| 150 | cryptlib.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 151 | cryptlib.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 152 | cryptlib.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 153 | cryptlib.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 154 | cryptlib.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 155 | cryptlib.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.c | ||
| 156 | cryptlib.o: cryptlib.h | ||
| 157 | cversion.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 158 | cversion.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 159 | cversion.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 160 | cversion.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 161 | cversion.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 162 | cversion.o: ../include/openssl/stack.h ../include/openssl/symhacks.h buildinf.h | ||
| 163 | cversion.o: cryptlib.h cversion.c | ||
| 164 | ebcdic.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h ebcdic.c | ||
| 165 | ex_data.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 166 | ex_data.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 167 | ex_data.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 168 | ex_data.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 169 | ex_data.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 170 | ex_data.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h | ||
| 171 | ex_data.o: ex_data.c | ||
| 172 | mem.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 173 | mem.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 174 | mem.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 175 | mem.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 176 | mem.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 177 | mem.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h | ||
| 178 | mem.o: mem.c | ||
| 179 | mem_clr.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 180 | mem_clr.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 181 | mem_clr.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 182 | mem_clr.o: ../include/openssl/stack.h ../include/openssl/symhacks.h mem_clr.c | ||
| 183 | mem_dbg.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h | ||
| 184 | mem_dbg.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 185 | mem_dbg.o: ../include/openssl/err.h ../include/openssl/lhash.h | ||
| 186 | mem_dbg.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 187 | mem_dbg.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 188 | mem_dbg.o: ../include/openssl/stack.h ../include/openssl/symhacks.h cryptlib.h | ||
| 189 | mem_dbg.o: mem_dbg.c | ||
| 190 | o_dir.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h | ||
| 191 | o_dir.o: LPdir_unix.c o_dir.c o_dir.h | ||
| 192 | o_str.o: ../e_os.h ../include/openssl/e_os2.h ../include/openssl/opensslconf.h | ||
| 193 | o_str.o: o_str.c o_str.h | ||
| 194 | o_time.o: ../include/openssl/e_os2.h ../include/openssl/opensslconf.h o_time.c | ||
| 195 | o_time.o: o_time.h | ||
| 196 | uid.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h | ||
| 197 | uid.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h | ||
| 198 | uid.o: ../include/openssl/ossl_typ.h ../include/openssl/safestack.h | ||
| 199 | uid.o: ../include/openssl/stack.h ../include/openssl/symhacks.h uid.c | ||
diff --git a/src/lib/libcrypto/LPdir_nyi.c b/src/lib/libcrypto/LPdir_nyi.c new file mode 100644 index 0000000000..6c1a50e6a8 --- /dev/null +++ b/src/lib/libcrypto/LPdir_nyi.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * | ||
| 15 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 25 | * SUCH DAMAGE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef LPDIR_H | ||
| 29 | #include "LPdir.h" | ||
| 30 | #endif | ||
| 31 | |||
| 32 | struct LP_dir_context_st { void *dummy; }; | ||
| 33 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) | ||
| 34 | { | ||
| 35 | errno = EINVAL; | ||
| 36 | return 0; | ||
| 37 | } | ||
| 38 | int LP_find_file_end(LP_DIR_CTX **ctx) | ||
| 39 | { | ||
| 40 | errno = EINVAL; | ||
| 41 | return 0; | ||
| 42 | } | ||
diff --git a/src/lib/libcrypto/LPdir_unix.c b/src/lib/libcrypto/LPdir_unix.c new file mode 100644 index 0000000000..b004cd99e8 --- /dev/null +++ b/src/lib/libcrypto/LPdir_unix.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* $LP: LPlib/source/LPdir_unix.c,v 1.11 2004/09/23 22:07:22 _cvs_levitte Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * | ||
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 18 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 19 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 21 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include <stddef.h> | ||
| 29 | #include <stdlib.h> | ||
| 30 | #include <limits.h> | ||
| 31 | #include <string.h> | ||
| 32 | #include <sys/types.h> | ||
| 33 | #include <dirent.h> | ||
| 34 | #include <errno.h> | ||
| 35 | #ifndef LPDIR_H | ||
| 36 | #include "LPdir.h" | ||
| 37 | #endif | ||
| 38 | |||
| 39 | /* The POSIXly macro for the maximum number of characters in a file path | ||
| 40 | is NAME_MAX. However, some operating systems use PATH_MAX instead. | ||
| 41 | Therefore, it seems natural to first check for PATH_MAX and use that, | ||
| 42 | and if it doesn't exist, use NAME_MAX. */ | ||
| 43 | #if defined(PATH_MAX) | ||
| 44 | # define LP_ENTRY_SIZE PATH_MAX | ||
| 45 | #elif defined(NAME_MAX) | ||
| 46 | # define LP_ENTRY_SIZE NAME_MAX | ||
| 47 | #endif | ||
| 48 | |||
| 49 | /* Of course, there's the possibility that neither PATH_MAX nor NAME_MAX | ||
| 50 | exist. It's also possible that NAME_MAX exists but is define to a | ||
| 51 | very small value (HP-UX offers 14), so we need to check if we got a | ||
| 52 | result, and if it meets a minimum standard, and create or change it | ||
| 53 | if not. */ | ||
| 54 | #if !defined(LP_ENTRY_SIZE) || LP_ENTRY_SIZE<255 | ||
| 55 | # undef LP_ENTRY_SIZE | ||
| 56 | # define LP_ENTRY_SIZE 255 | ||
| 57 | #endif | ||
| 58 | |||
| 59 | struct LP_dir_context_st | ||
| 60 | { | ||
| 61 | DIR *dir; | ||
| 62 | char entry_name[LP_ENTRY_SIZE+1]; | ||
| 63 | }; | ||
| 64 | |||
| 65 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) | ||
| 66 | { | ||
| 67 | struct dirent *direntry = NULL; | ||
| 68 | |||
| 69 | if (ctx == NULL || directory == NULL) | ||
| 70 | { | ||
| 71 | errno = EINVAL; | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | errno = 0; | ||
| 76 | if (*ctx == NULL) | ||
| 77 | { | ||
| 78 | *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); | ||
| 79 | if (*ctx == NULL) | ||
| 80 | { | ||
| 81 | errno = ENOMEM; | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | memset(*ctx, '\0', sizeof(LP_DIR_CTX)); | ||
| 85 | |||
| 86 | (*ctx)->dir = opendir(directory); | ||
| 87 | if ((*ctx)->dir == NULL) | ||
| 88 | { | ||
| 89 | int save_errno = errno; /* Probably not needed, but I'm paranoid */ | ||
| 90 | free(*ctx); | ||
| 91 | *ctx = NULL; | ||
| 92 | errno = save_errno; | ||
| 93 | return 0; | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | direntry = readdir((*ctx)->dir); | ||
| 98 | if (direntry == NULL) | ||
| 99 | { | ||
| 100 | return 0; | ||
| 101 | } | ||
| 102 | |||
| 103 | strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1); | ||
| 104 | (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; | ||
| 105 | return (*ctx)->entry_name; | ||
| 106 | } | ||
| 107 | |||
| 108 | int LP_find_file_end(LP_DIR_CTX **ctx) | ||
| 109 | { | ||
| 110 | if (ctx != NULL && *ctx != NULL) | ||
| 111 | { | ||
| 112 | int ret = closedir((*ctx)->dir); | ||
| 113 | |||
| 114 | free(*ctx); | ||
| 115 | switch (ret) | ||
| 116 | { | ||
| 117 | case 0: | ||
| 118 | return 1; | ||
| 119 | case -1: | ||
| 120 | return 0; | ||
| 121 | default: | ||
| 122 | break; | ||
| 123 | } | ||
| 124 | } | ||
| 125 | errno = EINVAL; | ||
| 126 | return 0; | ||
| 127 | } | ||
diff --git a/src/lib/libcrypto/LPdir_vms.c b/src/lib/libcrypto/LPdir_vms.c new file mode 100644 index 0000000000..7613bd254e --- /dev/null +++ b/src/lib/libcrypto/LPdir_vms.c | |||
| @@ -0,0 +1,206 @@ | |||
| 1 | /* $LP: LPlib/source/LPdir_vms.c,v 1.20 2004/08/26 13:36:05 _cvs_levitte Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * | ||
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 18 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 19 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 21 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include <stddef.h> | ||
| 29 | #include <stdlib.h> | ||
| 30 | #include <string.h> | ||
| 31 | #include <errno.h> | ||
| 32 | #include <descrip.h> | ||
| 33 | #include <namdef.h> | ||
| 34 | #include <rmsdef.h> | ||
| 35 | #include <libfildef.h> | ||
| 36 | #include <lib$routines.h> | ||
| 37 | #include <strdef.h> | ||
| 38 | #include <str$routines.h> | ||
| 39 | #include <stsdef.h> | ||
| 40 | #ifndef LPDIR_H | ||
| 41 | #include "LPdir.h" | ||
| 42 | #endif | ||
| 43 | #include "vms_rms.h" | ||
| 44 | |||
| 45 | /* Some compiler options hide EVMSERR. */ | ||
| 46 | #ifndef EVMSERR | ||
| 47 | # define EVMSERR 65535 /* error for non-translatable VMS errors */ | ||
| 48 | #endif | ||
| 49 | |||
| 50 | struct LP_dir_context_st | ||
| 51 | { | ||
| 52 | unsigned long VMS_context; | ||
| 53 | char filespec[ NAMX_MAXRSS+ 1]; | ||
| 54 | char result[ NAMX_MAXRSS+ 1]; | ||
| 55 | struct dsc$descriptor_d filespec_dsc; | ||
| 56 | struct dsc$descriptor_d result_dsc; | ||
| 57 | }; | ||
| 58 | |||
| 59 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) | ||
| 60 | { | ||
| 61 | int status; | ||
| 62 | char *p, *r; | ||
| 63 | size_t l; | ||
| 64 | unsigned long flags = 0; | ||
| 65 | |||
| 66 | /* Arrange 32-bit pointer to (copied) string storage, if needed. */ | ||
| 67 | #if __INITIAL_POINTER_SIZE == 64 | ||
| 68 | # pragma pointer_size save | ||
| 69 | # pragma pointer_size 32 | ||
| 70 | char *ctx_filespec_32p; | ||
| 71 | # pragma pointer_size restore | ||
| 72 | char ctx_filespec_32[ NAMX_MAXRSS+ 1]; | ||
| 73 | #endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 74 | |||
| 75 | #ifdef NAML$C_MAXRSS | ||
| 76 | flags |= LIB$M_FIL_LONG_NAMES; | ||
| 77 | #endif | ||
| 78 | |||
| 79 | if (ctx == NULL || directory == NULL) | ||
| 80 | { | ||
| 81 | errno = EINVAL; | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | errno = 0; | ||
| 86 | if (*ctx == NULL) | ||
| 87 | { | ||
| 88 | size_t filespeclen = strlen(directory); | ||
| 89 | char *filespec = NULL; | ||
| 90 | |||
| 91 | /* MUST be a VMS directory specification! Let's estimate if it is. */ | ||
| 92 | if (directory[filespeclen-1] != ']' | ||
| 93 | && directory[filespeclen-1] != '>' | ||
| 94 | && directory[filespeclen-1] != ':') | ||
| 95 | { | ||
| 96 | errno = EINVAL; | ||
| 97 | return 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | filespeclen += 4; /* "*.*;" */ | ||
| 101 | |||
| 102 | if (filespeclen > NAMX_MAXRSS) | ||
| 103 | { | ||
| 104 | errno = ENAMETOOLONG; | ||
| 105 | return 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); | ||
| 109 | if (*ctx == NULL) | ||
| 110 | { | ||
| 111 | errno = ENOMEM; | ||
| 112 | return 0; | ||
| 113 | } | ||
| 114 | memset(*ctx, '\0', sizeof(LP_DIR_CTX)); | ||
| 115 | |||
| 116 | strcpy((*ctx)->filespec,directory); | ||
| 117 | strcat((*ctx)->filespec,"*.*;"); | ||
| 118 | |||
| 119 | /* Arrange 32-bit pointer to (copied) string storage, if needed. */ | ||
| 120 | #if __INITIAL_POINTER_SIZE == 64 | ||
| 121 | # define CTX_FILESPEC ctx_filespec_32p | ||
| 122 | /* Copy the file name to storage with a 32-bit pointer. */ | ||
| 123 | ctx_filespec_32p = ctx_filespec_32; | ||
| 124 | strcpy( ctx_filespec_32p, (*ctx)->filespec); | ||
| 125 | #else /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 126 | # define CTX_FILESPEC (*ctx)->filespec | ||
| 127 | #endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
| 128 | |||
| 129 | (*ctx)->filespec_dsc.dsc$w_length = filespeclen; | ||
| 130 | (*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 131 | (*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
| 132 | (*ctx)->filespec_dsc.dsc$a_pointer = CTX_FILESPEC; | ||
| 133 | } | ||
| 134 | |||
| 135 | (*ctx)->result_dsc.dsc$w_length = 0; | ||
| 136 | (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 137 | (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D; | ||
| 138 | (*ctx)->result_dsc.dsc$a_pointer = 0; | ||
| 139 | |||
| 140 | status = lib$find_file(&(*ctx)->filespec_dsc, &(*ctx)->result_dsc, | ||
| 141 | &(*ctx)->VMS_context, 0, 0, 0, &flags); | ||
| 142 | |||
| 143 | if (status == RMS$_NMF) | ||
| 144 | { | ||
| 145 | errno = 0; | ||
| 146 | vaxc$errno = status; | ||
| 147 | return NULL; | ||
| 148 | } | ||
| 149 | |||
| 150 | if(!$VMS_STATUS_SUCCESS(status)) | ||
| 151 | { | ||
| 152 | errno = EVMSERR; | ||
| 153 | vaxc$errno = status; | ||
| 154 | return NULL; | ||
| 155 | } | ||
| 156 | |||
| 157 | /* Quick, cheap and dirty way to discard any device and directory, | ||
| 158 | since we only want file names */ | ||
| 159 | l = (*ctx)->result_dsc.dsc$w_length; | ||
| 160 | p = (*ctx)->result_dsc.dsc$a_pointer; | ||
| 161 | r = p; | ||
| 162 | for (; *p; p++) | ||
| 163 | { | ||
| 164 | if (*p == '^' && p[1] != '\0') /* Take care of ODS-5 escapes */ | ||
| 165 | { | ||
| 166 | p++; | ||
| 167 | } | ||
| 168 | else if (*p == ':' || *p == '>' || *p == ']') | ||
| 169 | { | ||
| 170 | l -= p + 1 - r; | ||
| 171 | r = p + 1; | ||
| 172 | } | ||
| 173 | else if (*p == ';') | ||
| 174 | { | ||
| 175 | l = p - r; | ||
| 176 | break; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 180 | strncpy((*ctx)->result, r, l); | ||
| 181 | (*ctx)->result[l] = '\0'; | ||
| 182 | str$free1_dx(&(*ctx)->result_dsc); | ||
| 183 | |||
| 184 | return (*ctx)->result; | ||
| 185 | } | ||
| 186 | |||
| 187 | int LP_find_file_end(LP_DIR_CTX **ctx) | ||
| 188 | { | ||
| 189 | if (ctx != NULL && *ctx != NULL) | ||
| 190 | { | ||
| 191 | int status = lib$find_file_end(&(*ctx)->VMS_context); | ||
| 192 | |||
| 193 | free(*ctx); | ||
| 194 | |||
| 195 | if(!$VMS_STATUS_SUCCESS(status)) | ||
| 196 | { | ||
| 197 | errno = EVMSERR; | ||
| 198 | vaxc$errno = status; | ||
| 199 | return 0; | ||
| 200 | } | ||
| 201 | return 1; | ||
| 202 | } | ||
| 203 | errno = EINVAL; | ||
| 204 | return 0; | ||
| 205 | } | ||
| 206 | |||
diff --git a/src/lib/libcrypto/LPdir_win.c b/src/lib/libcrypto/LPdir_win.c new file mode 100644 index 0000000000..702dbc730f --- /dev/null +++ b/src/lib/libcrypto/LPdir_win.c | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /* $LP: LPlib/source/LPdir_win.c,v 1.10 2004/08/26 13:36:05 _cvs_levitte Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * | ||
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 18 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 19 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 21 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | */ | ||
| 27 | #include <windows.h> | ||
| 28 | #include <tchar.h> | ||
| 29 | #ifndef LPDIR_H | ||
| 30 | #include "LPdir.h" | ||
| 31 | #endif | ||
| 32 | |||
| 33 | /* We're most likely overcautious here, but let's reserve for | ||
| 34 | broken WinCE headers and explicitly opt for UNICODE call. | ||
| 35 | Keep in mind that our WinCE builds are compiled with -DUNICODE | ||
| 36 | [as well as -D_UNICODE]. */ | ||
| 37 | #if defined(LP_SYS_WINCE) && !defined(FindFirstFile) | ||
| 38 | # define FindFirstFile FindFirstFileW | ||
| 39 | #endif | ||
| 40 | #if defined(LP_SYS_WINCE) && !defined(FindFirstFile) | ||
| 41 | # define FindNextFile FindNextFileW | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #ifndef NAME_MAX | ||
| 45 | #define NAME_MAX 255 | ||
| 46 | #endif | ||
| 47 | |||
| 48 | struct LP_dir_context_st | ||
| 49 | { | ||
| 50 | WIN32_FIND_DATA ctx; | ||
| 51 | HANDLE handle; | ||
| 52 | char entry_name[NAME_MAX+1]; | ||
| 53 | }; | ||
| 54 | |||
| 55 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) | ||
| 56 | { | ||
| 57 | if (ctx == NULL || directory == NULL) | ||
| 58 | { | ||
| 59 | errno = EINVAL; | ||
| 60 | return 0; | ||
| 61 | } | ||
| 62 | |||
| 63 | errno = 0; | ||
| 64 | if (*ctx == NULL) | ||
| 65 | { | ||
| 66 | *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); | ||
| 67 | if (*ctx == NULL) | ||
| 68 | { | ||
| 69 | errno = ENOMEM; | ||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | memset(*ctx, '\0', sizeof(LP_DIR_CTX)); | ||
| 73 | |||
| 74 | if (sizeof(TCHAR) != sizeof(char)) | ||
| 75 | { | ||
| 76 | TCHAR *wdir = NULL; | ||
| 77 | /* len_0 denotes string length *with* trailing 0 */ | ||
| 78 | size_t index = 0,len_0 = strlen(directory) + 1; | ||
| 79 | |||
| 80 | wdir = (TCHAR *)malloc(len_0 * sizeof(TCHAR)); | ||
| 81 | if (wdir == NULL) | ||
| 82 | { | ||
| 83 | free(*ctx); | ||
| 84 | *ctx = NULL; | ||
| 85 | errno = ENOMEM; | ||
| 86 | return 0; | ||
| 87 | } | ||
| 88 | |||
| 89 | #ifdef LP_MULTIBYTE_AVAILABLE | ||
| 90 | if (!MultiByteToWideChar(CP_ACP, 0, directory, len_0, (WCHAR *)wdir, len_0)) | ||
| 91 | #endif | ||
| 92 | for (index = 0; index < len_0; index++) | ||
| 93 | wdir[index] = (TCHAR)directory[index]; | ||
| 94 | |||
| 95 | (*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx); | ||
| 96 | |||
| 97 | free(wdir); | ||
| 98 | } | ||
| 99 | else | ||
| 100 | (*ctx)->handle = FindFirstFile((TCHAR *)directory, &(*ctx)->ctx); | ||
| 101 | |||
| 102 | if ((*ctx)->handle == INVALID_HANDLE_VALUE) | ||
| 103 | { | ||
| 104 | free(*ctx); | ||
| 105 | *ctx = NULL; | ||
| 106 | errno = EINVAL; | ||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | } | ||
| 110 | else | ||
| 111 | { | ||
| 112 | if (FindNextFile((*ctx)->handle, &(*ctx)->ctx) == FALSE) | ||
| 113 | { | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | if (sizeof(TCHAR) != sizeof(char)) | ||
| 119 | { | ||
| 120 | TCHAR *wdir = (*ctx)->ctx.cFileName; | ||
| 121 | size_t index, len_0 = 0; | ||
| 122 | |||
| 123 | while (wdir[len_0] && len_0 < (sizeof((*ctx)->entry_name) - 1)) len_0++; | ||
| 124 | len_0++; | ||
| 125 | |||
| 126 | #ifdef LP_MULTIBYTE_AVAILABLE | ||
| 127 | if (!WideCharToMultiByte(CP_ACP, 0, (WCHAR *)wdir, len_0, (*ctx)->entry_name, | ||
| 128 | sizeof((*ctx)->entry_name), NULL, 0)) | ||
| 129 | #endif | ||
| 130 | for (index = 0; index < len_0; index++) | ||
| 131 | (*ctx)->entry_name[index] = (char)wdir[index]; | ||
| 132 | } | ||
| 133 | else | ||
| 134 | strncpy((*ctx)->entry_name, (const char *)(*ctx)->ctx.cFileName, | ||
| 135 | sizeof((*ctx)->entry_name)-1); | ||
| 136 | |||
| 137 | (*ctx)->entry_name[sizeof((*ctx)->entry_name)-1] = '\0'; | ||
| 138 | |||
| 139 | return (*ctx)->entry_name; | ||
| 140 | } | ||
| 141 | |||
| 142 | int LP_find_file_end(LP_DIR_CTX **ctx) | ||
| 143 | { | ||
| 144 | if (ctx != NULL && *ctx != NULL) | ||
| 145 | { | ||
| 146 | FindClose((*ctx)->handle); | ||
| 147 | free(*ctx); | ||
| 148 | *ctx = NULL; | ||
| 149 | return 1; | ||
| 150 | } | ||
| 151 | errno = EINVAL; | ||
| 152 | return 0; | ||
| 153 | } | ||
diff --git a/src/lib/libcrypto/LPdir_win32.c b/src/lib/libcrypto/LPdir_win32.c new file mode 100644 index 0000000000..e39872da52 --- /dev/null +++ b/src/lib/libcrypto/LPdir_win32.c | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * | ||
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 18 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 19 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 21 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #define LP_SYS_WIN32 | ||
| 29 | #define LP_MULTIBYTE_AVAILABLE | ||
| 30 | #include "LPdir_win.c" | ||
diff --git a/src/lib/libcrypto/LPdir_wince.c b/src/lib/libcrypto/LPdir_wince.c new file mode 100644 index 0000000000..ab0e1e6f4f --- /dev/null +++ b/src/lib/libcrypto/LPdir_wince.c | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* $LP: LPlib/source/LPdir_wince.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 4 | * All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in the | ||
| 13 | * documentation and/or other materials provided with the distribution. | ||
| 14 | * | ||
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 18 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 19 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 21 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #define LP_SYS_WINCE | ||
| 29 | /* We might want to define LP_MULTIBYTE_AVAILABLE here. It's currently | ||
| 30 | under investigation what the exact conditions would be */ | ||
| 31 | #include "LPdir_win.c" | ||
diff --git a/src/lib/libcrypto/acss/acss.h b/src/lib/libcrypto/acss/acss.h new file mode 100644 index 0000000000..c2d3550796 --- /dev/null +++ b/src/lib/libcrypto/acss/acss.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | /* $OpenBSD: acss.h,v 1.4 2005/04/25 13:20:52 miod Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _ACSS_H_ | ||
| 19 | #define _ACSS_H_ | ||
| 20 | |||
| 21 | #ifdef OPENSSL_NO_ACSS | ||
| 22 | #error acss is disabled. | ||
| 23 | #endif | ||
| 24 | |||
| 25 | /* 40bit key */ | ||
| 26 | #define ACSS_KEYSIZE 5 | ||
| 27 | |||
| 28 | /* modes of acss */ | ||
| 29 | #define ACSS_MODE0 0 | ||
| 30 | #define ACSS_MODE1 1 | ||
| 31 | #define ACSS_MODE2 2 | ||
| 32 | #define ACSS_MODE3 3 | ||
| 33 | |||
| 34 | typedef struct acss_key_st { | ||
| 35 | unsigned int lfsr17; /* current state of lfsrs */ | ||
| 36 | unsigned int lfsr25; | ||
| 37 | unsigned int lfsrsum; | ||
| 38 | unsigned char seed[ACSS_KEYSIZE]; | ||
| 39 | unsigned char data[ACSS_KEYSIZE]; | ||
| 40 | int encrypt; | ||
| 41 | int mode; | ||
| 42 | } ACSS_KEY; | ||
| 43 | |||
| 44 | void acss_setkey(ACSS_KEY *, const unsigned char *, int, int); | ||
| 45 | void acss(ACSS_KEY *, unsigned long, const unsigned char *, unsigned char *); | ||
| 46 | |||
| 47 | #endif /* ifndef _ACSS_H_ */ | ||
diff --git a/src/lib/libcrypto/acss/acss_enc.c b/src/lib/libcrypto/acss/acss_enc.c new file mode 100644 index 0000000000..829830bc54 --- /dev/null +++ b/src/lib/libcrypto/acss/acss_enc.c | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | /* $OpenBSD: acss_enc.c,v 1.4 2004/02/13 10:05:44 hshoexer Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/acss.h> | ||
| 19 | |||
| 20 | /* decryption sbox */ | ||
| 21 | static unsigned char sboxdec[] = { | ||
| 22 | 0x33, 0x73, 0x3b, 0x26, 0x63, 0x23, 0x6b, 0x76, | ||
| 23 | 0x3e, 0x7e, 0x36, 0x2b, 0x6e, 0x2e, 0x66, 0x7b, | ||
| 24 | 0xd3, 0x93, 0xdb, 0x06, 0x43, 0x03, 0x4b, 0x96, | ||
| 25 | 0xde, 0x9e, 0xd6, 0x0b, 0x4e, 0x0e, 0x46, 0x9b, | ||
| 26 | 0x57, 0x17, 0x5f, 0x82, 0xc7, 0x87, 0xcf, 0x12, | ||
| 27 | 0x5a, 0x1a, 0x52, 0x8f, 0xca, 0x8a, 0xc2, 0x1f, | ||
| 28 | 0xd9, 0x99, 0xd1, 0x00, 0x49, 0x09, 0x41, 0x90, | ||
| 29 | 0xd8, 0x98, 0xd0, 0x01, 0x48, 0x08, 0x40, 0x91, | ||
| 30 | 0x3d, 0x7d, 0x35, 0x24, 0x6d, 0x2d, 0x65, 0x74, | ||
| 31 | 0x3c, 0x7c, 0x34, 0x25, 0x6c, 0x2c, 0x64, 0x75, | ||
| 32 | 0xdd, 0x9d, 0xd5, 0x04, 0x4d, 0x0d, 0x45, 0x94, | ||
| 33 | 0xdc, 0x9c, 0xd4, 0x05, 0x4c, 0x0c, 0x44, 0x95, | ||
| 34 | 0x59, 0x19, 0x51, 0x80, 0xc9, 0x89, 0xc1, 0x10, | ||
| 35 | 0x58, 0x18, 0x50, 0x81, 0xc8, 0x88, 0xc0, 0x11, | ||
| 36 | 0xd7, 0x97, 0xdf, 0x02, 0x47, 0x07, 0x4f, 0x92, | ||
| 37 | 0xda, 0x9a, 0xd2, 0x0f, 0x4a, 0x0a, 0x42, 0x9f, | ||
| 38 | 0x53, 0x13, 0x5b, 0x86, 0xc3, 0x83, 0xcb, 0x16, | ||
| 39 | 0x5e, 0x1e, 0x56, 0x8b, 0xce, 0x8e, 0xc6, 0x1b, | ||
| 40 | 0xb3, 0xf3, 0xbb, 0xa6, 0xe3, 0xa3, 0xeb, 0xf6, | ||
| 41 | 0xbe, 0xfe, 0xb6, 0xab, 0xee, 0xae, 0xe6, 0xfb, | ||
| 42 | 0x37, 0x77, 0x3f, 0x22, 0x67, 0x27, 0x6f, 0x72, | ||
| 43 | 0x3a, 0x7a, 0x32, 0x2f, 0x6a, 0x2a, 0x62, 0x7f, | ||
| 44 | 0xb9, 0xf9, 0xb1, 0xa0, 0xe9, 0xa9, 0xe1, 0xf0, | ||
| 45 | 0xb8, 0xf8, 0xb0, 0xa1, 0xe8, 0xa8, 0xe0, 0xf1, | ||
| 46 | 0x5d, 0x1d, 0x55, 0x84, 0xcd, 0x8d, 0xc5, 0x14, | ||
| 47 | 0x5c, 0x1c, 0x54, 0x85, 0xcc, 0x8c, 0xc4, 0x15, | ||
| 48 | 0xbd, 0xfd, 0xb5, 0xa4, 0xed, 0xad, 0xe5, 0xf4, | ||
| 49 | 0xbc, 0xfc, 0xb4, 0xa5, 0xec, 0xac, 0xe4, 0xf5, | ||
| 50 | 0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70, | ||
| 51 | 0x38, 0x78, 0x30, 0x21, 0x68, 0x28, 0x60, 0x71, | ||
| 52 | 0xb7, 0xf7, 0xbf, 0xa2, 0xe7, 0xa7, 0xef, 0xf2, | ||
| 53 | 0xba, 0xfa, 0xb2, 0xaf, 0xea, 0xaa, 0xe2, 0xff | ||
| 54 | }; | ||
| 55 | |||
| 56 | /* encryption sbox */ | ||
| 57 | static unsigned char sboxenc[] = { | ||
| 58 | 0x33, 0x3b, 0x73, 0x15, 0x53, 0x5b, 0x13, 0x75, | ||
| 59 | 0x3d, 0x35, 0x7d, 0x1b, 0x5d, 0x55, 0x1d, 0x7b, | ||
| 60 | 0x67, 0x6f, 0x27, 0x81, 0xc7, 0xcf, 0x87, 0x21, | ||
| 61 | 0x69, 0x61, 0x29, 0x8f, 0xc9, 0xc1, 0x89, 0x2f, | ||
| 62 | 0xe3, 0xeb, 0xa3, 0x05, 0x43, 0x4b, 0x03, 0xa5, | ||
| 63 | 0xed, 0xe5, 0xad, 0x0b, 0x4d, 0x45, 0x0d, 0xab, | ||
| 64 | 0xea, 0xe2, 0xaa, 0x00, 0x4a, 0x42, 0x0a, 0xa0, | ||
| 65 | 0xe8, 0xe0, 0xa8, 0x02, 0x48, 0x40, 0x08, 0xa2, | ||
| 66 | 0x3e, 0x36, 0x7e, 0x14, 0x5e, 0x56, 0x1e, 0x74, | ||
| 67 | 0x3c, 0x34, 0x7c, 0x16, 0x5c, 0x54, 0x1c, 0x76, | ||
| 68 | 0x6a, 0x62, 0x2a, 0x80, 0xca, 0xc2, 0x8a, 0x20, | ||
| 69 | 0x68, 0x60, 0x28, 0x82, 0xc8, 0xc0, 0x88, 0x22, | ||
| 70 | 0xee, 0xe6, 0xae, 0x04, 0x4e, 0x46, 0x0e, 0xa4, | ||
| 71 | 0xec, 0xe4, 0xac, 0x06, 0x4c, 0x44, 0x0c, 0xa6, | ||
| 72 | 0xe7, 0xef, 0xa7, 0x01, 0x47, 0x4f, 0x07, 0xa1, | ||
| 73 | 0xe9, 0xe1, 0xa9, 0x0f, 0x49, 0x41, 0x09, 0xaf, | ||
| 74 | 0x63, 0x6b, 0x23, 0x85, 0xc3, 0xcb, 0x83, 0x25, | ||
| 75 | 0x6d, 0x65, 0x2d, 0x8b, 0xcd, 0xc5, 0x8d, 0x2b, | ||
| 76 | 0x37, 0x3f, 0x77, 0x11, 0x57, 0x5f, 0x17, 0x71, | ||
| 77 | 0x39, 0x31, 0x79, 0x1f, 0x59, 0x51, 0x19, 0x7f, | ||
| 78 | 0xb3, 0xbb, 0xf3, 0x95, 0xd3, 0xdb, 0x93, 0xf5, | ||
| 79 | 0xbd, 0xb5, 0xfd, 0x9b, 0xdd, 0xd5, 0x9d, 0xfb, | ||
| 80 | 0xba, 0xb2, 0xfa, 0x90, 0xda, 0xd2, 0x9a, 0xf0, | ||
| 81 | 0xb8, 0xb0, 0xf8, 0x92, 0xd8, 0xd0, 0x98, 0xf2, | ||
| 82 | 0x6e, 0x66, 0x2e, 0x84, 0xce, 0xc6, 0x8e, 0x24, | ||
| 83 | 0x6c, 0x64, 0x2c, 0x86, 0xcc, 0xc4, 0x8c, 0x26, | ||
| 84 | 0x3a, 0x32, 0x7a, 0x10, 0x5a, 0x52, 0x1a, 0x70, | ||
| 85 | 0x38, 0x30, 0x78, 0x12, 0x58, 0x50, 0x18, 0x72, | ||
| 86 | 0xbe, 0xb6, 0xfe, 0x94, 0xde, 0xd6, 0x9e, 0xf4, | ||
| 87 | 0xbc, 0xb4, 0xfc, 0x96, 0xdc, 0xd4, 0x9c, 0xf6, | ||
| 88 | 0xb7, 0xbf, 0xf7, 0x91, 0xd7, 0xdf, 0x97, 0xf1, | ||
| 89 | 0xb9, 0xb1, 0xf9, 0x9f, 0xd9, 0xd1, 0x99, 0xff | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* | ||
| 93 | * Two linear feedback shift registers are used: | ||
| 94 | * | ||
| 95 | * lfsr17: polynomial of degree 17, primitive modulo 2 (listed in Schneier) | ||
| 96 | * x^15 + x + 1 | ||
| 97 | * lfsr25: polynomial of degree 25, not know if primitive modulo 2 | ||
| 98 | * x^13 + x^5 + x^4 + x + 1 | ||
| 99 | * | ||
| 100 | * Output bits are discarded, instead the feedback bits are added to produce | ||
| 101 | * the cipher stream. Depending on the mode, feedback bytes may be inverted | ||
| 102 | * bit-wise before addition. | ||
| 103 | * | ||
| 104 | * The lfsrs are seeded with bytes from the raw key: | ||
| 105 | * | ||
| 106 | * lfsr17: byte 0[0:7] at bit 9 | ||
| 107 | * byte 1[0:7] at bit 0 | ||
| 108 | * | ||
| 109 | * lfsr25: byte 2[0:4] at bit 16 | ||
| 110 | * byte 2[5:7] at bit 22 | ||
| 111 | * byte 3[0:7] at bit 8 | ||
| 112 | * byte 4[0:7] at bit 0 | ||
| 113 | * | ||
| 114 | * To prevent 0 cycles, 1's are inject at bit 8 in lfrs17 and bit 21 in | ||
| 115 | * lfsr25. | ||
| 116 | * | ||
| 117 | */ | ||
| 118 | |||
| 119 | void | ||
| 120 | acss(ACSS_KEY *key, unsigned long len, const unsigned char *in, | ||
| 121 | unsigned char *out) | ||
| 122 | { | ||
| 123 | unsigned long i; | ||
| 124 | unsigned long lfsr17tmp, lfsr25tmp, lfsrsumtmp; | ||
| 125 | |||
| 126 | lfsrsumtmp = lfsr17tmp = lfsr25tmp = 0; | ||
| 127 | |||
| 128 | /* keystream is sum of lfsrs */ | ||
| 129 | for (i = 0; i < len; i++) { | ||
| 130 | lfsr17tmp = key->lfsr17 ^ (key->lfsr17 >> 14); | ||
| 131 | key->lfsr17 = (key->lfsr17 >> 8) | ||
| 132 | ^ (lfsr17tmp << 9) | ||
| 133 | ^ (lfsr17tmp << 12) | ||
| 134 | ^ (lfsr17tmp << 15); | ||
| 135 | key->lfsr17 &= 0x1ffff; /* 17 bit LFSR */ | ||
| 136 | |||
| 137 | lfsr25tmp = key->lfsr25 | ||
| 138 | ^ (key->lfsr25 >> 3) | ||
| 139 | ^ (key->lfsr25 >> 4) | ||
| 140 | ^ (key->lfsr25 >> 12); | ||
| 141 | key->lfsr25 = (key->lfsr25 >> 8) ^ (lfsr25tmp << 17); | ||
| 142 | key->lfsr25 &= 0x1ffffff; /* 25 bit LFSR */ | ||
| 143 | |||
| 144 | lfsrsumtmp = key->lfsrsum; | ||
| 145 | |||
| 146 | /* addition */ | ||
| 147 | switch (key->mode) { | ||
| 148 | case ACSS_MODE3: | ||
| 149 | key->lfsrsum = 0xff & ~(key->lfsr17 >> 9); | ||
| 150 | key->lfsrsum += 0xff & ~(key->lfsr25 >> 17); | ||
| 151 | break; | ||
| 152 | case ACSS_MODE2: | ||
| 153 | key->lfsrsum = key->lfsr17 >> 9; | ||
| 154 | key->lfsrsum += 0xff & ~(key->lfsr25 >> 17); | ||
| 155 | break; | ||
| 156 | case ACSS_MODE1: | ||
| 157 | key->lfsrsum = 0xff & ~(key->lfsr17 >> 9); | ||
| 158 | key->lfsrsum += key->lfsr25 >> 17; | ||
| 159 | break; | ||
| 160 | case ACSS_MODE0: | ||
| 161 | default: | ||
| 162 | key->lfsrsum = key->lfsr17 >> 9; | ||
| 163 | key->lfsrsum += key->lfsr25 >> 17; | ||
| 164 | break; | ||
| 165 | } | ||
| 166 | key->lfsrsum += (lfsrsumtmp >> 8); | ||
| 167 | |||
| 168 | if (in == (unsigned char *)0) | ||
| 169 | /* generate only a keystream */ | ||
| 170 | out[i] = key->lfsrsum & 0xff; | ||
| 171 | else if (key->encrypt) { | ||
| 172 | out[i] = sboxenc[(in[i] ^ key->lfsrsum) & 0xff]; | ||
| 173 | } else { | ||
| 174 | out[i] = (sboxdec[in[i]] ^ key->lfsrsum) & 0xff; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | } | ||
diff --git a/src/lib/libcrypto/acss/acss_skey.c b/src/lib/libcrypto/acss/acss_skey.c new file mode 100644 index 0000000000..1f1a51eaf9 --- /dev/null +++ b/src/lib/libcrypto/acss/acss_skey.c | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* $OpenBSD: acss_skey.c,v 1.3 2009/08/07 00:05:04 martynas Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <openssl/acss.h> | ||
| 19 | #include <string.h> | ||
| 20 | |||
| 21 | static unsigned char reverse[] = { | ||
| 22 | 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, | ||
| 23 | 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, | ||
| 24 | 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, | ||
| 25 | 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, | ||
| 26 | 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, | ||
| 27 | 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, | ||
| 28 | 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, | ||
| 29 | 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, | ||
| 30 | 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, | ||
| 31 | 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, | ||
| 32 | 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, | ||
| 33 | 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, | ||
| 34 | 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, | ||
| 35 | 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, | ||
| 36 | 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, | ||
| 37 | 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, | ||
| 38 | 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, | ||
| 39 | 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, | ||
| 40 | 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, | ||
| 41 | 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, | ||
| 42 | 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, | ||
| 43 | 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, | ||
| 44 | 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, | ||
| 45 | 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, | ||
| 46 | 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, | ||
| 47 | 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, | ||
| 48 | 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, | ||
| 49 | 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, | ||
| 50 | 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, | ||
| 51 | 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, | ||
| 52 | 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, | ||
| 53 | 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff | ||
| 54 | }; | ||
| 55 | |||
| 56 | static void | ||
| 57 | acss_seed(ACSS_KEY *key) | ||
| 58 | { | ||
| 59 | int i; | ||
| 60 | |||
| 61 | for (i = 0; i < ACSS_KEYSIZE; i++) | ||
| 62 | key->seed[i] = reverse[key->data[i]]; | ||
| 63 | |||
| 64 | /* seed lfsrs */ | ||
| 65 | key->lfsr17 = key->seed[1] | ||
| 66 | | (key->seed[0] << 9) | ||
| 67 | | (1 << 8); /* inject 1 at bit 9 */ | ||
| 68 | key->lfsr25 = key->seed[4] | ||
| 69 | | (key->seed[3] << 8) | ||
| 70 | | ((key->seed[2] & 0x1f) << 16) | ||
| 71 | | ((key->seed[2] & 0xe0) << 17) | ||
| 72 | | (1 << 21); /* inject 1 at bit 22 */ | ||
| 73 | |||
| 74 | key->lfsrsum = 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | void | ||
| 78 | acss_setkey(ACSS_KEY *key, const unsigned char *data, int enc, int mode) | ||
| 79 | { | ||
| 80 | memcpy(key->data, data, sizeof(key->data)); | ||
| 81 | |||
| 82 | if (enc != -1) | ||
| 83 | key->encrypt = enc; | ||
| 84 | key->mode = mode; | ||
| 85 | |||
| 86 | acss_seed(key); | ||
| 87 | } | ||
diff --git a/src/lib/libcrypto/aes/Makefile b/src/lib/libcrypto/aes/Makefile new file mode 100644 index 0000000000..c501a43a8f --- /dev/null +++ b/src/lib/libcrypto/aes/Makefile | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | # | ||
| 2 | # crypto/aes/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= aes | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | AES_ENC=aes_core.o aes_cbc.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | #TEST=aestest.c | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=aes_core.c aes_misc.c aes_ecb.c aes_cbc.c aes_cfb.c aes_ofb.c \ | ||
| 27 | aes_ctr.c aes_ige.c aes_wrap.c | ||
| 28 | LIBOBJ=aes_misc.o aes_ecb.o aes_cfb.o aes_ofb.o aes_ctr.o aes_ige.o aes_wrap.o \ | ||
| 29 | $(AES_ENC) | ||
| 30 | |||
| 31 | SRC= $(LIBSRC) | ||
| 32 | |||
| 33 | EXHEADER= aes.h | ||
| 34 | HEADER= aes_locl.h $(EXHEADER) | ||
| 35 | |||
| 36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 37 | |||
| 38 | top: | ||
| 39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 40 | |||
| 41 | all: lib | ||
| 42 | |||
| 43 | lib: $(LIBOBJ) | ||
| 44 | $(AR) $(LIB) $(LIBOBJ) | ||
| 45 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 46 | @touch lib | ||
| 47 | |||
| 48 | aes-ia64.s: asm/aes-ia64.S | ||
| 49 | $(CC) $(CFLAGS) -E asm/aes-ia64.S > $@ | ||
| 50 | |||
| 51 | aes-586.s: asm/aes-586.pl ../perlasm/x86asm.pl | ||
| 52 | $(PERL) asm/aes-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 53 | |||
| 54 | aes-x86_64.s: asm/aes-x86_64.pl | ||
| 55 | $(PERL) asm/aes-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 56 | |||
| 57 | aes-sparcv9.s: asm/aes-sparcv9.pl | ||
| 58 | $(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@ | ||
| 59 | |||
| 60 | aes-ppc.s: asm/aes-ppc.pl | ||
| 61 | $(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@ | ||
| 62 | |||
| 63 | # GNU make "catch all" | ||
| 64 | aes-%.s: asm/aes-%.pl; $(PERL) $< $(CFLAGS) > $@ | ||
| 65 | |||
| 66 | files: | ||
| 67 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 68 | |||
| 69 | links: | ||
| 70 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 71 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 72 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 73 | |||
| 74 | install: | ||
| 75 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 76 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 77 | do \ | ||
| 78 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 79 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 80 | done; | ||
| 81 | |||
| 82 | tags: | ||
| 83 | ctags $(SRC) | ||
| 84 | |||
| 85 | tests: | ||
| 86 | |||
| 87 | lint: | ||
| 88 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 89 | |||
| 90 | depend: | ||
| 91 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 92 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 93 | |||
| 94 | dclean: | ||
| 95 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 96 | mv -f Makefile.new $(MAKEFILE) | ||
| 97 | |||
| 98 | clean: | ||
| 99 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 100 | |||
| 101 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 102 | |||
| 103 | aes_cbc.o: ../../include/openssl/aes.h ../../include/openssl/modes.h | ||
| 104 | aes_cbc.o: ../../include/openssl/opensslconf.h aes_cbc.c | ||
| 105 | aes_cfb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h | ||
| 106 | aes_cfb.o: ../../include/openssl/opensslconf.h aes_cfb.c | ||
| 107 | aes_core.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 108 | aes_core.o: ../../include/openssl/opensslconf.h aes_core.c aes_locl.h | ||
| 109 | aes_ctr.o: ../../include/openssl/aes.h ../../include/openssl/modes.h | ||
| 110 | aes_ctr.o: ../../include/openssl/opensslconf.h aes_ctr.c | ||
| 111 | aes_ecb.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 112 | aes_ecb.o: ../../include/openssl/opensslconf.h aes_ecb.c aes_locl.h | ||
| 113 | aes_ige.o: ../../e_os.h ../../include/openssl/aes.h ../../include/openssl/bio.h | ||
| 114 | aes_ige.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 115 | aes_ige.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 116 | aes_ige.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 117 | aes_ige.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 118 | aes_ige.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 119 | aes_ige.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_ige.c aes_locl.h | ||
| 120 | aes_misc.o: ../../include/openssl/aes.h ../../include/openssl/e_os2.h | ||
| 121 | aes_misc.o: ../../include/openssl/opensslconf.h | ||
| 122 | aes_misc.o: ../../include/openssl/opensslv.h aes_locl.h aes_misc.c | ||
| 123 | aes_ofb.o: ../../include/openssl/aes.h ../../include/openssl/modes.h | ||
| 124 | aes_ofb.o: ../../include/openssl/opensslconf.h aes_ofb.c | ||
| 125 | aes_wrap.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 126 | aes_wrap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 127 | aes_wrap.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 128 | aes_wrap.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 129 | aes_wrap.o: ../../include/openssl/opensslconf.h | ||
| 130 | aes_wrap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 131 | aes_wrap.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 132 | aes_wrap.o: ../../include/openssl/symhacks.h ../cryptlib.h aes_wrap.c | ||
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl index a545e892ae..53e4ef85fd 100755 --- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl | |||
| @@ -1669,7 +1669,7 @@ AES_cbc_encrypt: | |||
| 1669 | lea .LAES_Td(%rip),$sbox | 1669 | lea .LAES_Td(%rip),$sbox |
| 1670 | .Lcbc_picked_te: | 1670 | .Lcbc_picked_te: |
| 1671 | 1671 | ||
| 1672 | mov OPENSSL_ia32cap_P(%rip),%r10d | 1672 | mov PIC_GOT(OPENSSL_ia32cap_P),%r10d |
| 1673 | cmp \$$speed_limit,%rdx | 1673 | cmp \$$speed_limit,%rdx |
| 1674 | jb .Lcbc_slow_prologue | 1674 | jb .Lcbc_slow_prologue |
| 1675 | test \$15,%rdx | 1675 | test \$15,%rdx |
diff --git a/src/lib/libcrypto/asn1/Makefile b/src/lib/libcrypto/asn1/Makefile new file mode 100644 index 0000000000..160544eede --- /dev/null +++ b/src/lib/libcrypto/asn1/Makefile | |||
| @@ -0,0 +1,930 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/asn1/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= asn1 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile README | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= a_object.c a_bitstr.c a_utctm.c a_gentm.c a_time.c a_int.c a_octet.c \ | ||
| 21 | a_print.c a_type.c a_set.c a_dup.c a_d2i_fp.c a_i2d_fp.c \ | ||
| 22 | a_enum.c a_utf8.c a_sign.c a_digest.c a_verify.c a_mbstr.c a_strex.c \ | ||
| 23 | x_algor.c x_val.c x_pubkey.c x_sig.c x_req.c x_attrib.c x_bignum.c \ | ||
| 24 | x_long.c x_name.c x_x509.c x_x509a.c x_crl.c x_info.c x_spki.c nsseq.c \ | ||
| 25 | x_nx509.c d2i_pu.c d2i_pr.c i2d_pu.c i2d_pr.c\ | ||
| 26 | t_req.c t_x509.c t_x509a.c t_crl.c t_pkey.c t_spki.c t_bitst.c \ | ||
| 27 | tasn_new.c tasn_fre.c tasn_enc.c tasn_dec.c tasn_utl.c tasn_typ.c \ | ||
| 28 | tasn_prn.c ameth_lib.c \ | ||
| 29 | f_int.c f_string.c n_pkey.c \ | ||
| 30 | f_enum.c x_pkey.c a_bool.c x_exten.c bio_asn1.c bio_ndef.c asn_mime.c \ | ||
| 31 | asn1_gen.c asn1_par.c asn1_lib.c asn1_err.c a_bytes.c a_strnid.c \ | ||
| 32 | evp_asn1.c asn_pack.c p5_pbe.c p5_pbev2.c p8_pkey.c asn_moid.c | ||
| 33 | LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_gentm.o a_time.o a_int.o a_octet.o \ | ||
| 34 | a_print.o a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \ | ||
| 35 | a_enum.o a_utf8.o a_sign.o a_digest.o a_verify.o a_mbstr.o a_strex.o \ | ||
| 36 | x_algor.o x_val.o x_pubkey.o x_sig.o x_req.o x_attrib.o x_bignum.o \ | ||
| 37 | x_long.o x_name.o x_x509.o x_x509a.o x_crl.o x_info.o x_spki.o nsseq.o \ | ||
| 38 | x_nx509.o d2i_pu.o d2i_pr.o i2d_pu.o i2d_pr.o \ | ||
| 39 | t_req.o t_x509.o t_x509a.o t_crl.o t_pkey.o t_spki.o t_bitst.o \ | ||
| 40 | tasn_new.o tasn_fre.o tasn_enc.o tasn_dec.o tasn_utl.o tasn_typ.o \ | ||
| 41 | tasn_prn.o ameth_lib.o \ | ||
| 42 | f_int.o f_string.o n_pkey.o \ | ||
| 43 | f_enum.o x_pkey.o a_bool.o x_exten.o bio_asn1.o bio_ndef.o asn_mime.o \ | ||
| 44 | asn1_gen.o asn1_par.o asn1_lib.o asn1_err.o a_bytes.o a_strnid.o \ | ||
| 45 | evp_asn1.o asn_pack.o p5_pbe.o p5_pbev2.o p8_pkey.o asn_moid.o | ||
| 46 | |||
| 47 | SRC= $(LIBSRC) | ||
| 48 | |||
| 49 | EXHEADER= asn1.h asn1_mac.h asn1t.h | ||
| 50 | HEADER= $(EXHEADER) asn1_locl.h | ||
| 51 | |||
| 52 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 53 | |||
| 54 | top: | ||
| 55 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 56 | |||
| 57 | test: test.c | ||
| 58 | cc -g -I../../include -c test.c | ||
| 59 | cc -g -I../../include -o test test.o -L../.. -lcrypto | ||
| 60 | |||
| 61 | pk: pk.c | ||
| 62 | cc -g -I../../include -c pk.c | ||
| 63 | cc -g -I../../include -o pk pk.o -L../.. -lcrypto | ||
| 64 | |||
| 65 | all: lib | ||
| 66 | |||
| 67 | lib: $(LIBOBJ) | ||
| 68 | $(AR) $(LIB) $(LIBOBJ) | ||
| 69 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 70 | @touch lib | ||
| 71 | |||
| 72 | files: | ||
| 73 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 74 | |||
| 75 | links: | ||
| 76 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 77 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 78 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 79 | |||
| 80 | install: | ||
| 81 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 82 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 83 | do \ | ||
| 84 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 85 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 86 | done; | ||
| 87 | |||
| 88 | tags: | ||
| 89 | ctags $(SRC) | ||
| 90 | |||
| 91 | tests: | ||
| 92 | |||
| 93 | lint: | ||
| 94 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 95 | |||
| 96 | depend: | ||
| 97 | @[ -n "$(MAKEDEPEND)" ] # should be set by top Makefile... | ||
| 98 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 99 | |||
| 100 | dclean: | ||
| 101 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 102 | mv -f Makefile.new $(MAKEFILE) | ||
| 103 | |||
| 104 | clean: | ||
| 105 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 106 | |||
| 107 | |||
| 108 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 109 | |||
| 110 | a_bitstr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 111 | a_bitstr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 112 | a_bitstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 113 | a_bitstr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 114 | a_bitstr.o: ../../include/openssl/opensslconf.h | ||
| 115 | a_bitstr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 116 | a_bitstr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 117 | a_bitstr.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bitstr.c | ||
| 118 | a_bool.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 119 | a_bool.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 120 | a_bool.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 121 | a_bool.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 122 | a_bool.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 123 | a_bool.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 124 | a_bool.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 125 | a_bool.o: ../../include/openssl/symhacks.h ../cryptlib.h a_bool.c | ||
| 126 | a_bytes.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 127 | a_bytes.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 128 | a_bytes.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 129 | a_bytes.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 130 | a_bytes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 131 | a_bytes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 132 | a_bytes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 133 | a_bytes.o: ../cryptlib.h a_bytes.c | ||
| 134 | a_d2i_fp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 135 | a_d2i_fp.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 136 | a_d2i_fp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 137 | a_d2i_fp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 138 | a_d2i_fp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 139 | a_d2i_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 140 | a_d2i_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 141 | a_d2i_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_d2i_fp.c | ||
| 142 | a_digest.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 143 | a_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 144 | a_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 145 | a_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 146 | a_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 147 | a_digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 148 | a_digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 149 | a_digest.o: ../../include/openssl/opensslconf.h | ||
| 150 | a_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 151 | a_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 152 | a_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 153 | a_digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 154 | a_digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_digest.c | ||
| 155 | a_dup.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 156 | a_dup.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 157 | a_dup.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 158 | a_dup.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 159 | a_dup.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 160 | a_dup.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 161 | a_dup.o: ../../include/openssl/symhacks.h ../cryptlib.h a_dup.c | ||
| 162 | a_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 163 | a_enum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 164 | a_enum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 165 | a_enum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 166 | a_enum.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 167 | a_enum.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 168 | a_enum.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 169 | a_enum.o: ../cryptlib.h a_enum.c | ||
| 170 | a_gentm.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 171 | a_gentm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 172 | a_gentm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 173 | a_gentm.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 174 | a_gentm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 175 | a_gentm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 176 | a_gentm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 177 | a_gentm.o: ../cryptlib.h ../o_time.h a_gentm.c | ||
| 178 | a_i2d_fp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 179 | a_i2d_fp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 180 | a_i2d_fp.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 181 | a_i2d_fp.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 182 | a_i2d_fp.o: ../../include/openssl/opensslconf.h | ||
| 183 | a_i2d_fp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 184 | a_i2d_fp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 185 | a_i2d_fp.o: ../../include/openssl/symhacks.h ../cryptlib.h a_i2d_fp.c | ||
| 186 | a_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 187 | a_int.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 188 | a_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 189 | a_int.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 190 | a_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 191 | a_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 192 | a_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 193 | a_int.o: ../cryptlib.h a_int.c | ||
| 194 | a_mbstr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 195 | a_mbstr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 196 | a_mbstr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 197 | a_mbstr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 198 | a_mbstr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 199 | a_mbstr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 200 | a_mbstr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 201 | a_mbstr.o: ../cryptlib.h a_mbstr.c | ||
| 202 | a_object.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 203 | a_object.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 204 | a_object.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 205 | a_object.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 206 | a_object.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 207 | a_object.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 208 | a_object.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 209 | a_object.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 210 | a_object.o: ../../include/openssl/symhacks.h ../cryptlib.h a_object.c | ||
| 211 | a_octet.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 212 | a_octet.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 213 | a_octet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 214 | a_octet.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 215 | a_octet.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 216 | a_octet.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 217 | a_octet.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 218 | a_octet.o: ../cryptlib.h a_octet.c | ||
| 219 | a_print.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 220 | a_print.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 221 | a_print.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 222 | a_print.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 223 | a_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 224 | a_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 225 | a_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 226 | a_print.o: ../cryptlib.h a_print.c | ||
| 227 | a_set.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 228 | a_set.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 229 | a_set.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 230 | a_set.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 231 | a_set.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 232 | a_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 233 | a_set.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 234 | a_set.o: ../../include/openssl/symhacks.h ../cryptlib.h a_set.c | ||
| 235 | a_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 236 | a_sign.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 237 | a_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 238 | a_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 239 | a_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 240 | a_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 241 | a_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 242 | a_sign.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 243 | a_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 244 | a_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 245 | a_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 246 | a_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 247 | a_sign.o: ../cryptlib.h a_sign.c asn1_locl.h | ||
| 248 | a_strex.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 249 | a_strex.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 250 | a_strex.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 251 | a_strex.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 252 | a_strex.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 253 | a_strex.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 254 | a_strex.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 255 | a_strex.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 256 | a_strex.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 257 | a_strex.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 258 | a_strex.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 259 | a_strex.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 260 | a_strex.o: ../cryptlib.h a_strex.c charmap.h | ||
| 261 | a_strnid.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 262 | a_strnid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 263 | a_strnid.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 264 | a_strnid.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 265 | a_strnid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 266 | a_strnid.o: ../../include/openssl/opensslconf.h | ||
| 267 | a_strnid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 268 | a_strnid.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 269 | a_strnid.o: ../../include/openssl/symhacks.h ../cryptlib.h a_strnid.c | ||
| 270 | a_time.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 271 | a_time.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 272 | a_time.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 273 | a_time.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 274 | a_time.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 275 | a_time.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 276 | a_time.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 277 | a_time.o: ../../include/openssl/symhacks.h ../cryptlib.h ../o_time.h a_time.c | ||
| 278 | a_type.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 279 | a_type.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 280 | a_type.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 281 | a_type.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 282 | a_type.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 283 | a_type.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 284 | a_type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 285 | a_type.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 286 | a_type.o: ../../include/openssl/symhacks.h ../cryptlib.h a_type.c | ||
| 287 | a_utctm.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 288 | a_utctm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 289 | a_utctm.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 290 | a_utctm.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 291 | a_utctm.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 292 | a_utctm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 293 | a_utctm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 294 | a_utctm.o: ../cryptlib.h ../o_time.h a_utctm.c | ||
| 295 | a_utf8.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 296 | a_utf8.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 297 | a_utf8.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 298 | a_utf8.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 299 | a_utf8.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 300 | a_utf8.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 301 | a_utf8.o: ../../include/openssl/symhacks.h ../cryptlib.h a_utf8.c | ||
| 302 | a_verify.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 303 | a_verify.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 304 | a_verify.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 305 | a_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 306 | a_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 307 | a_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 308 | a_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 309 | a_verify.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 310 | a_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 311 | a_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 312 | a_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 313 | a_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 314 | a_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h a_verify.c | ||
| 315 | a_verify.o: asn1_locl.h | ||
| 316 | ameth_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 317 | ameth_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 318 | ameth_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 319 | ameth_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 320 | ameth_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 321 | ameth_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 322 | ameth_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 323 | ameth_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 324 | ameth_lib.o: ../../include/openssl/opensslconf.h | ||
| 325 | ameth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 326 | ameth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 327 | ameth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 328 | ameth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 329 | ameth_lib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ameth_lib.c | ||
| 330 | ameth_lib.o: asn1_locl.h | ||
| 331 | asn1_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 332 | asn1_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 333 | asn1_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 334 | asn1_err.o: ../../include/openssl/opensslconf.h | ||
| 335 | asn1_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 336 | asn1_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 337 | asn1_err.o: ../../include/openssl/symhacks.h asn1_err.c | ||
| 338 | asn1_gen.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 339 | asn1_gen.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 340 | asn1_gen.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 341 | asn1_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 342 | asn1_gen.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 343 | asn1_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 344 | asn1_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 345 | asn1_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 346 | asn1_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 347 | asn1_gen.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 348 | asn1_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 349 | asn1_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 350 | asn1_gen.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 351 | asn1_gen.o: ../cryptlib.h asn1_gen.c | ||
| 352 | asn1_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 353 | asn1_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 354 | asn1_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 355 | asn1_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 356 | asn1_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 357 | asn1_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 358 | asn1_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 359 | asn1_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_lib.c | ||
| 360 | asn1_par.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 361 | asn1_par.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 362 | asn1_par.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 363 | asn1_par.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 364 | asn1_par.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 365 | asn1_par.o: ../../include/openssl/opensslconf.h | ||
| 366 | asn1_par.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 367 | asn1_par.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 368 | asn1_par.o: ../../include/openssl/symhacks.h ../cryptlib.h asn1_par.c | ||
| 369 | asn_mime.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 370 | asn_mime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 371 | asn_mime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 372 | asn_mime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 373 | asn_mime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 374 | asn_mime.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 375 | asn_mime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 376 | asn_mime.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 377 | asn_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 378 | asn_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 379 | asn_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 380 | asn_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 381 | asn_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 382 | asn_mime.o: ../cryptlib.h asn1_locl.h asn_mime.c | ||
| 383 | asn_moid.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 384 | asn_moid.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 385 | asn_moid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 386 | asn_moid.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 387 | asn_moid.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 388 | asn_moid.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 389 | asn_moid.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 390 | asn_moid.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 391 | asn_moid.o: ../../include/openssl/opensslconf.h | ||
| 392 | asn_moid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 393 | asn_moid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 394 | asn_moid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 395 | asn_moid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 396 | asn_moid.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn_moid.c | ||
| 397 | asn_pack.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 398 | asn_pack.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 399 | asn_pack.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 400 | asn_pack.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 401 | asn_pack.o: ../../include/openssl/opensslconf.h | ||
| 402 | asn_pack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 403 | asn_pack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 404 | asn_pack.o: ../../include/openssl/symhacks.h ../cryptlib.h asn_pack.c | ||
| 405 | bio_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 406 | bio_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 407 | bio_asn1.o: ../../include/openssl/opensslconf.h | ||
| 408 | bio_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 409 | bio_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 410 | bio_asn1.o: ../../include/openssl/symhacks.h bio_asn1.c | ||
| 411 | bio_ndef.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 412 | bio_ndef.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 413 | bio_ndef.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 414 | bio_ndef.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 415 | bio_ndef.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 416 | bio_ndef.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 417 | bio_ndef.o: ../../include/openssl/symhacks.h bio_ndef.c | ||
| 418 | d2i_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 419 | d2i_pr.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 420 | d2i_pr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 421 | d2i_pr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 422 | d2i_pr.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 423 | d2i_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 424 | d2i_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 425 | d2i_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 426 | d2i_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 427 | d2i_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 428 | d2i_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 429 | d2i_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 430 | d2i_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h d2i_pr.c | ||
| 431 | d2i_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 432 | d2i_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 433 | d2i_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 434 | d2i_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 435 | d2i_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 436 | d2i_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 437 | d2i_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 438 | d2i_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 439 | d2i_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 440 | d2i_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 441 | d2i_pu.o: ../cryptlib.h d2i_pu.c | ||
| 442 | evp_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 443 | evp_asn1.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 444 | evp_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 445 | evp_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 446 | evp_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 447 | evp_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 448 | evp_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 449 | evp_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_asn1.c | ||
| 450 | f_enum.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 451 | f_enum.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 452 | f_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 453 | f_enum.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 454 | f_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 455 | f_enum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 456 | f_enum.o: ../../include/openssl/symhacks.h ../cryptlib.h f_enum.c | ||
| 457 | f_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 458 | f_int.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 459 | f_int.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 460 | f_int.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 461 | f_int.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 462 | f_int.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 463 | f_int.o: ../../include/openssl/symhacks.h ../cryptlib.h f_int.c | ||
| 464 | f_string.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 465 | f_string.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 466 | f_string.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 467 | f_string.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 468 | f_string.o: ../../include/openssl/opensslconf.h | ||
| 469 | f_string.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 470 | f_string.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 471 | f_string.o: ../../include/openssl/symhacks.h ../cryptlib.h f_string.c | ||
| 472 | i2d_pr.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 473 | i2d_pr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 474 | i2d_pr.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 475 | i2d_pr.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 476 | i2d_pr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 477 | i2d_pr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 478 | i2d_pr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 479 | i2d_pr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 480 | i2d_pr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 481 | i2d_pr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 482 | i2d_pr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 483 | i2d_pr.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h i2d_pr.c | ||
| 484 | i2d_pu.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 485 | i2d_pu.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 486 | i2d_pu.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 487 | i2d_pu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 488 | i2d_pu.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 489 | i2d_pu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 490 | i2d_pu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 491 | i2d_pu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 492 | i2d_pu.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 493 | i2d_pu.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 494 | i2d_pu.o: ../cryptlib.h i2d_pu.c | ||
| 495 | n_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 496 | n_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/asn1t.h | ||
| 497 | n_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 498 | n_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 499 | n_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 500 | n_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 501 | n_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 502 | n_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 503 | n_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 504 | n_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 505 | n_pkey.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 506 | n_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 507 | n_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 508 | n_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h n_pkey.c | ||
| 509 | nsseq.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 510 | nsseq.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 511 | nsseq.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 512 | nsseq.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 513 | nsseq.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h | ||
| 514 | nsseq.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 515 | nsseq.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 516 | nsseq.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 517 | nsseq.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 518 | nsseq.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 519 | nsseq.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 520 | nsseq.o: ../../include/openssl/x509_vfy.h nsseq.c | ||
| 521 | p5_pbe.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 522 | p5_pbe.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 523 | p5_pbe.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 524 | p5_pbe.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 525 | p5_pbe.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 526 | p5_pbe.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 527 | p5_pbe.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 528 | p5_pbe.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 529 | p5_pbe.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 530 | p5_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 531 | p5_pbe.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 532 | p5_pbe.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 533 | p5_pbe.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 534 | p5_pbe.o: ../cryptlib.h p5_pbe.c | ||
| 535 | p5_pbev2.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 536 | p5_pbev2.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 537 | p5_pbev2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 538 | p5_pbev2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 539 | p5_pbev2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 540 | p5_pbev2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 541 | p5_pbev2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 542 | p5_pbev2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 543 | p5_pbev2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 544 | p5_pbev2.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 545 | p5_pbev2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 546 | p5_pbev2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 547 | p5_pbev2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 548 | p5_pbev2.o: ../cryptlib.h p5_pbev2.c | ||
| 549 | p8_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 550 | p8_pkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 551 | p8_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 552 | p8_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 553 | p8_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 554 | p8_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 555 | p8_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 556 | p8_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 557 | p8_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 558 | p8_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 559 | p8_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 560 | p8_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 561 | p8_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p8_pkey.c | ||
| 562 | t_bitst.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 563 | t_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 564 | t_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 565 | t_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 566 | t_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 567 | t_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 568 | t_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 569 | t_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 570 | t_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 571 | t_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 572 | t_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 573 | t_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 574 | t_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 575 | t_bitst.o: ../cryptlib.h t_bitst.c | ||
| 576 | t_crl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 577 | t_crl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 578 | t_crl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 579 | t_crl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 580 | t_crl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 581 | t_crl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 582 | t_crl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 583 | t_crl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 584 | t_crl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 585 | t_crl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 586 | t_crl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 587 | t_crl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 588 | t_crl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 589 | t_crl.o: ../cryptlib.h t_crl.c | ||
| 590 | t_pkey.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 591 | t_pkey.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 592 | t_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 593 | t_pkey.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 594 | t_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 595 | t_pkey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 596 | t_pkey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 597 | t_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 598 | t_pkey.o: ../cryptlib.h t_pkey.c | ||
| 599 | t_req.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 600 | t_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 601 | t_req.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 602 | t_req.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 603 | t_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 604 | t_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 605 | t_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 606 | t_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 607 | t_req.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 608 | t_req.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 609 | t_req.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 610 | t_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 611 | t_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 612 | t_req.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 613 | t_req.o: ../cryptlib.h t_req.c | ||
| 614 | t_spki.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 615 | t_spki.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 616 | t_spki.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 617 | t_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 618 | t_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 619 | t_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 620 | t_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 621 | t_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 622 | t_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 623 | t_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 624 | t_spki.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 625 | t_spki.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 626 | t_spki.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 627 | t_spki.o: ../cryptlib.h t_spki.c | ||
| 628 | t_x509.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 629 | t_x509.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 630 | t_x509.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 631 | t_x509.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 632 | t_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 633 | t_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 634 | t_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 635 | t_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 636 | t_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 637 | t_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 638 | t_x509.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 639 | t_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 640 | t_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 641 | t_x509.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 642 | t_x509.o: ../cryptlib.h t_x509.c | ||
| 643 | t_x509a.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 644 | t_x509a.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 645 | t_x509a.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 646 | t_x509a.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 647 | t_x509a.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 648 | t_x509a.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 649 | t_x509a.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 650 | t_x509a.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 651 | t_x509a.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 652 | t_x509a.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 653 | t_x509a.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 654 | t_x509a.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 655 | t_x509a.o: ../cryptlib.h t_x509a.c | ||
| 656 | tasn_dec.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 657 | tasn_dec.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 658 | tasn_dec.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 659 | tasn_dec.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 660 | tasn_dec.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 661 | tasn_dec.o: ../../include/openssl/opensslconf.h | ||
| 662 | tasn_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 663 | tasn_dec.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 664 | tasn_dec.o: ../../include/openssl/symhacks.h tasn_dec.c | ||
| 665 | tasn_enc.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 666 | tasn_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 667 | tasn_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 668 | tasn_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 669 | tasn_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 670 | tasn_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 671 | tasn_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 672 | tasn_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 673 | tasn_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h tasn_enc.c | ||
| 674 | tasn_fre.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 675 | tasn_fre.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 676 | tasn_fre.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h | ||
| 677 | tasn_fre.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 678 | tasn_fre.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 679 | tasn_fre.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 680 | tasn_fre.o: ../../include/openssl/symhacks.h tasn_fre.c | ||
| 681 | tasn_new.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 682 | tasn_new.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 683 | tasn_new.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 684 | tasn_new.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 685 | tasn_new.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 686 | tasn_new.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 687 | tasn_new.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 688 | tasn_new.o: ../../include/openssl/symhacks.h tasn_new.c | ||
| 689 | tasn_prn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 690 | tasn_prn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 691 | tasn_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 692 | tasn_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 693 | tasn_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 694 | tasn_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 695 | tasn_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 696 | tasn_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 697 | tasn_prn.o: ../../include/openssl/opensslconf.h | ||
| 698 | tasn_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 699 | tasn_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 700 | tasn_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 701 | tasn_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 702 | tasn_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 703 | tasn_prn.o: ../cryptlib.h asn1_locl.h tasn_prn.c | ||
| 704 | tasn_typ.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 705 | tasn_typ.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 706 | tasn_typ.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 707 | tasn_typ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 708 | tasn_typ.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 709 | tasn_typ.o: ../../include/openssl/symhacks.h tasn_typ.c | ||
| 710 | tasn_utl.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 711 | tasn_utl.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 712 | tasn_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 713 | tasn_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 714 | tasn_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 715 | tasn_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 716 | tasn_utl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 717 | tasn_utl.o: ../../include/openssl/symhacks.h tasn_utl.c | ||
| 718 | x_algor.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 719 | x_algor.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 720 | x_algor.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 721 | x_algor.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 722 | x_algor.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h | ||
| 723 | x_algor.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 724 | x_algor.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 725 | x_algor.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 726 | x_algor.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 727 | x_algor.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 728 | x_algor.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 729 | x_algor.o: ../../include/openssl/x509_vfy.h x_algor.c | ||
| 730 | x_attrib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 731 | x_attrib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 732 | x_attrib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 733 | x_attrib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 734 | x_attrib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 735 | x_attrib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 736 | x_attrib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 737 | x_attrib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 738 | x_attrib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 739 | x_attrib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 740 | x_attrib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 741 | x_attrib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 742 | x_attrib.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_attrib.c | ||
| 743 | x_bignum.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 744 | x_bignum.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 745 | x_bignum.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 746 | x_bignum.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 747 | x_bignum.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 748 | x_bignum.o: ../../include/openssl/opensslconf.h | ||
| 749 | x_bignum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 750 | x_bignum.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 751 | x_bignum.o: ../../include/openssl/symhacks.h ../cryptlib.h x_bignum.c | ||
| 752 | x_crl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 753 | x_crl.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 754 | x_crl.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 755 | x_crl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 756 | x_crl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 757 | x_crl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 758 | x_crl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 759 | x_crl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 760 | x_crl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 761 | x_crl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 762 | x_crl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 763 | x_crl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 764 | x_crl.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 765 | x_crl.o: ../../include/openssl/x509v3.h ../cryptlib.h asn1_locl.h x_crl.c | ||
| 766 | x_exten.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 767 | x_exten.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 768 | x_exten.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 769 | x_exten.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 770 | x_exten.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h | ||
| 771 | x_exten.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 772 | x_exten.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 773 | x_exten.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 774 | x_exten.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 775 | x_exten.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 776 | x_exten.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 777 | x_exten.o: ../../include/openssl/x509_vfy.h x_exten.c | ||
| 778 | x_info.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 779 | x_info.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 780 | x_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 781 | x_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 782 | x_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 783 | x_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 784 | x_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 785 | x_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 786 | x_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 787 | x_info.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 788 | x_info.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 789 | x_info.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_info.c | ||
| 790 | x_long.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 791 | x_long.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 792 | x_long.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 793 | x_long.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 794 | x_long.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 795 | x_long.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 796 | x_long.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 797 | x_long.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 798 | x_long.o: ../cryptlib.h x_long.c | ||
| 799 | x_name.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 800 | x_name.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 801 | x_name.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 802 | x_name.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 803 | x_name.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 804 | x_name.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 805 | x_name.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 806 | x_name.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 807 | x_name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 808 | x_name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 809 | x_name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 810 | x_name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 811 | x_name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h asn1_locl.h x_name.c | ||
| 812 | x_nx509.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 813 | x_nx509.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 814 | x_nx509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 815 | x_nx509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 816 | x_nx509.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h | ||
| 817 | x_nx509.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 818 | x_nx509.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 819 | x_nx509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 820 | x_nx509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 821 | x_nx509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 822 | x_nx509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 823 | x_nx509.o: ../../include/openssl/x509_vfy.h x_nx509.c | ||
| 824 | x_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 825 | x_pkey.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 826 | x_pkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 827 | x_pkey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 828 | x_pkey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 829 | x_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 830 | x_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 831 | x_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 832 | x_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 833 | x_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 834 | x_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 835 | x_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 836 | x_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_pkey.c | ||
| 837 | x_pubkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 838 | x_pubkey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 839 | x_pubkey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 840 | x_pubkey.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 841 | x_pubkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 842 | x_pubkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 843 | x_pubkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 844 | x_pubkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 845 | x_pubkey.o: ../../include/openssl/opensslconf.h | ||
| 846 | x_pubkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 847 | x_pubkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 848 | x_pubkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 849 | x_pubkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 850 | x_pubkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 851 | x_pubkey.o: ../cryptlib.h asn1_locl.h x_pubkey.c | ||
| 852 | x_req.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 853 | x_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 854 | x_req.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 855 | x_req.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 856 | x_req.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 857 | x_req.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 858 | x_req.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 859 | x_req.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 860 | x_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 861 | x_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 862 | x_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 863 | x_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 864 | x_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_req.c | ||
| 865 | x_sig.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 866 | x_sig.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 867 | x_sig.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 868 | x_sig.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 869 | x_sig.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 870 | x_sig.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 871 | x_sig.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 872 | x_sig.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 873 | x_sig.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 874 | x_sig.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 875 | x_sig.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 876 | x_sig.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 877 | x_sig.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_sig.c | ||
| 878 | x_spki.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 879 | x_spki.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 880 | x_spki.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 881 | x_spki.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 882 | x_spki.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 883 | x_spki.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 884 | x_spki.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 885 | x_spki.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 886 | x_spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 887 | x_spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 888 | x_spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 889 | x_spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 890 | x_spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_spki.c | ||
| 891 | x_val.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 892 | x_val.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 893 | x_val.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 894 | x_val.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 895 | x_val.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 896 | x_val.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 897 | x_val.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 898 | x_val.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 899 | x_val.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 900 | x_val.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 901 | x_val.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 902 | x_val.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 903 | x_val.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_val.c | ||
| 904 | x_x509.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 905 | x_x509.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 906 | x_x509.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 907 | x_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 908 | x_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 909 | x_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 910 | x_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 911 | x_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 912 | x_x509.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 913 | x_x509.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 914 | x_x509.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 915 | x_x509.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 916 | x_x509.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 917 | x_x509.o: ../../include/openssl/x509v3.h ../cryptlib.h x_x509.c | ||
| 918 | x_x509a.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 919 | x_x509a.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 920 | x_x509a.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 921 | x_x509a.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 922 | x_x509a.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 923 | x_x509a.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 924 | x_x509a.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 925 | x_x509a.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 926 | x_x509a.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 927 | x_x509a.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 928 | x_x509a.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 929 | x_x509a.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 930 | x_x509a.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_x509a.c | ||
diff --git a/src/lib/libcrypto/asn1/a_gentm.c b/src/lib/libcrypto/asn1/a_gentm.c new file mode 100644 index 0000000000..c79c6f538c --- /dev/null +++ b/src/lib/libcrypto/asn1/a_gentm.c | |||
| @@ -0,0 +1,263 @@ | |||
| 1 | /* crypto/asn1/a_gentm.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* GENERALIZEDTIME implementation, written by Steve Henson. Based on UTCTIME */ | ||
| 60 | |||
| 61 | #include <stdio.h> | ||
| 62 | #include <time.h> | ||
| 63 | #include "cryptlib.h" | ||
| 64 | #include "o_time.h" | ||
| 65 | #include <openssl/asn1.h> | ||
| 66 | |||
| 67 | #if 0 | ||
| 68 | |||
| 69 | int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp) | ||
| 70 | { | ||
| 71 | #ifdef CHARSET_EBCDIC | ||
| 72 | /* KLUDGE! We convert to ascii before writing DER */ | ||
| 73 | int len; | ||
| 74 | char tmp[24]; | ||
| 75 | ASN1_STRING tmpstr = *(ASN1_STRING *)a; | ||
| 76 | |||
| 77 | len = tmpstr.length; | ||
| 78 | ebcdic2ascii(tmp, tmpstr.data, (len >= sizeof tmp) ? sizeof tmp : len); | ||
| 79 | tmpstr.data = tmp; | ||
| 80 | |||
| 81 | a = (ASN1_GENERALIZEDTIME *) &tmpstr; | ||
| 82 | #endif | ||
| 83 | return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, | ||
| 84 | V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL)); | ||
| 85 | } | ||
| 86 | |||
| 87 | |||
| 88 | ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a, | ||
| 89 | unsigned char **pp, long length) | ||
| 90 | { | ||
| 91 | ASN1_GENERALIZEDTIME *ret=NULL; | ||
| 92 | |||
| 93 | ret=(ASN1_GENERALIZEDTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length, | ||
| 94 | V_ASN1_GENERALIZEDTIME,V_ASN1_UNIVERSAL); | ||
| 95 | if (ret == NULL) | ||
| 96 | { | ||
| 97 | ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ERR_R_NESTED_ASN1_ERROR); | ||
| 98 | return(NULL); | ||
| 99 | } | ||
| 100 | #ifdef CHARSET_EBCDIC | ||
| 101 | ascii2ebcdic(ret->data, ret->data, ret->length); | ||
| 102 | #endif | ||
| 103 | if (!ASN1_GENERALIZEDTIME_check(ret)) | ||
| 104 | { | ||
| 105 | ASN1err(ASN1_F_D2I_ASN1_GENERALIZEDTIME,ASN1_R_INVALID_TIME_FORMAT); | ||
| 106 | goto err; | ||
| 107 | } | ||
| 108 | |||
| 109 | return(ret); | ||
| 110 | err: | ||
| 111 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) | ||
| 112 | M_ASN1_GENERALIZEDTIME_free(ret); | ||
| 113 | return(NULL); | ||
| 114 | } | ||
| 115 | |||
| 116 | #endif | ||
| 117 | |||
| 118 | int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d) | ||
| 119 | { | ||
| 120 | static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0}; | ||
| 121 | static const int max[9]={99, 99,12,31,23,59,59,12,59}; | ||
| 122 | char *a; | ||
| 123 | int n,i,l,o; | ||
| 124 | |||
| 125 | if (d->type != V_ASN1_GENERALIZEDTIME) return(0); | ||
| 126 | l=d->length; | ||
| 127 | a=(char *)d->data; | ||
| 128 | o=0; | ||
| 129 | /* GENERALIZEDTIME is similar to UTCTIME except the year is | ||
| 130 | * represented as YYYY. This stuff treats everything as a two digit | ||
| 131 | * field so make first two fields 00 to 99 | ||
| 132 | */ | ||
| 133 | if (l < 13) goto err; | ||
| 134 | for (i=0; i<7; i++) | ||
| 135 | { | ||
| 136 | if ((i == 6) && ((a[o] == 'Z') || | ||
| 137 | (a[o] == '+') || (a[o] == '-'))) | ||
| 138 | { i++; break; } | ||
| 139 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 140 | n= a[o]-'0'; | ||
| 141 | if (++o > l) goto err; | ||
| 142 | |||
| 143 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 144 | n=(n*10)+ a[o]-'0'; | ||
| 145 | if (++o > l) goto err; | ||
| 146 | |||
| 147 | if ((n < min[i]) || (n > max[i])) goto err; | ||
| 148 | } | ||
| 149 | /* Optional fractional seconds: decimal point followed by one | ||
| 150 | * or more digits. | ||
| 151 | */ | ||
| 152 | if (a[o] == '.') | ||
| 153 | { | ||
| 154 | if (++o > l) goto err; | ||
| 155 | i = o; | ||
| 156 | while ((a[o] >= '0') && (a[o] <= '9') && (o <= l)) | ||
| 157 | o++; | ||
| 158 | /* Must have at least one digit after decimal point */ | ||
| 159 | if (i == o) goto err; | ||
| 160 | } | ||
| 161 | |||
| 162 | if (a[o] == 'Z') | ||
| 163 | o++; | ||
| 164 | else if ((a[o] == '+') || (a[o] == '-')) | ||
| 165 | { | ||
| 166 | o++; | ||
| 167 | if (o+4 > l) goto err; | ||
| 168 | for (i=7; i<9; i++) | ||
| 169 | { | ||
| 170 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 171 | n= a[o]-'0'; | ||
| 172 | o++; | ||
| 173 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 174 | n=(n*10)+ a[o]-'0'; | ||
| 175 | if ((n < min[i]) || (n > max[i])) goto err; | ||
| 176 | o++; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | else | ||
| 180 | { | ||
| 181 | /* Missing time zone information. */ | ||
| 182 | goto err; | ||
| 183 | } | ||
| 184 | return(o == l); | ||
| 185 | err: | ||
| 186 | return(0); | ||
| 187 | } | ||
| 188 | |||
| 189 | int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str) | ||
| 190 | { | ||
| 191 | ASN1_GENERALIZEDTIME t; | ||
| 192 | |||
| 193 | t.type=V_ASN1_GENERALIZEDTIME; | ||
| 194 | t.length=strlen(str); | ||
| 195 | t.data=(unsigned char *)str; | ||
| 196 | if (ASN1_GENERALIZEDTIME_check(&t)) | ||
| 197 | { | ||
| 198 | if (s != NULL) | ||
| 199 | { | ||
| 200 | if (!ASN1_STRING_set((ASN1_STRING *)s, | ||
| 201 | (unsigned char *)str,t.length)) | ||
| 202 | return 0; | ||
| 203 | s->type=V_ASN1_GENERALIZEDTIME; | ||
| 204 | } | ||
| 205 | return(1); | ||
| 206 | } | ||
| 207 | else | ||
| 208 | return(0); | ||
| 209 | } | ||
| 210 | |||
| 211 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, | ||
| 212 | time_t t) | ||
| 213 | { | ||
| 214 | return ASN1_GENERALIZEDTIME_adj(s, t, 0, 0); | ||
| 215 | } | ||
| 216 | |||
| 217 | ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, | ||
| 218 | time_t t, int offset_day, long offset_sec) | ||
| 219 | { | ||
| 220 | char *p; | ||
| 221 | struct tm *ts; | ||
| 222 | struct tm data; | ||
| 223 | size_t len = 20; | ||
| 224 | |||
| 225 | if (s == NULL) | ||
| 226 | s=M_ASN1_GENERALIZEDTIME_new(); | ||
| 227 | if (s == NULL) | ||
| 228 | return(NULL); | ||
| 229 | |||
| 230 | ts=OPENSSL_gmtime(&t, &data); | ||
| 231 | if (ts == NULL) | ||
| 232 | return(NULL); | ||
| 233 | |||
| 234 | if (offset_day || offset_sec) | ||
| 235 | { | ||
| 236 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) | ||
| 237 | return NULL; | ||
| 238 | } | ||
| 239 | |||
| 240 | p=(char *)s->data; | ||
| 241 | if ((p == NULL) || ((size_t)s->length < len)) | ||
| 242 | { | ||
| 243 | p=OPENSSL_malloc(len); | ||
| 244 | if (p == NULL) | ||
| 245 | { | ||
| 246 | ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ, | ||
| 247 | ERR_R_MALLOC_FAILURE); | ||
| 248 | return(NULL); | ||
| 249 | } | ||
| 250 | if (s->data != NULL) | ||
| 251 | OPENSSL_free(s->data); | ||
| 252 | s->data=(unsigned char *)p; | ||
| 253 | } | ||
| 254 | |||
| 255 | BIO_snprintf(p,len,"%04d%02d%02d%02d%02d%02dZ",ts->tm_year + 1900, | ||
| 256 | ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); | ||
| 257 | s->length=strlen(p); | ||
| 258 | s->type=V_ASN1_GENERALIZEDTIME; | ||
| 259 | #ifdef CHARSET_EBCDIC_not | ||
| 260 | ebcdic2ascii(s->data, s->data, s->length); | ||
| 261 | #endif | ||
| 262 | return(s); | ||
| 263 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index 3348b8762c..c6fd204ae3 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
| @@ -273,7 +273,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
| 273 | { | 273 | { |
| 274 | ASN1_INTEGER *ret=NULL; | 274 | ASN1_INTEGER *ret=NULL; |
| 275 | const unsigned char *p; | 275 | const unsigned char *p; |
| 276 | unsigned char *s; | 276 | unsigned char *to,*s; |
| 277 | long len; | 277 | long len; |
| 278 | int inf,tag,xclass; | 278 | int inf,tag,xclass; |
| 279 | int i; | 279 | int i; |
| @@ -308,6 +308,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, | |||
| 308 | i=ERR_R_MALLOC_FAILURE; | 308 | i=ERR_R_MALLOC_FAILURE; |
| 309 | goto err; | 309 | goto err; |
| 310 | } | 310 | } |
| 311 | to=s; | ||
| 311 | ret->type=V_ASN1_INTEGER; | 312 | ret->type=V_ASN1_INTEGER; |
| 312 | if(len) { | 313 | if(len) { |
| 313 | if ((*p == 0) && (len != 1)) | 314 | if ((*p == 0) && (len != 1)) |
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index 3978c9150d..e5fbe7cbb1 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
| @@ -139,7 +139,7 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) | |||
| 139 | ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT); | 139 | ASN1err(ASN1_F_A2D_ASN1_OBJECT,ASN1_R_INVALID_DIGIT); |
| 140 | goto err; | 140 | goto err; |
| 141 | } | 141 | } |
| 142 | if (!use_bn && l >= ((ULONG_MAX - 80) / 10L)) | 142 | if (!use_bn && l > (ULONG_MAX / 10L)) |
| 143 | { | 143 | { |
| 144 | use_bn = 1; | 144 | use_bn = 1; |
| 145 | if (!bl) | 145 | if (!bl) |
| @@ -293,7 +293,7 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, | |||
| 293 | /* Sanity check OID encoding: can't have leading 0x80 in | 293 | /* Sanity check OID encoding: can't have leading 0x80 in |
| 294 | * subidentifiers, see: X.690 8.19.2 | 294 | * subidentifiers, see: X.690 8.19.2 |
| 295 | */ | 295 | */ |
| 296 | for (i = 0, p = *pp; i < len; i++, p++) | 296 | for (i = 0, p = *pp + 1; i < len - 1; i++, p++) |
| 297 | { | 297 | { |
| 298 | if (*p == 0x80 && (!i || !(p[-1] & 0x80))) | 298 | if (*p == 0x80 && (!i || !(p[-1] & 0x80))) |
| 299 | { | 299 | { |
diff --git a/src/lib/libcrypto/asn1/a_strex.c b/src/lib/libcrypto/asn1/a_strex.c index 264ebf2393..7fc14d3296 100644 --- a/src/lib/libcrypto/asn1/a_strex.c +++ b/src/lib/libcrypto/asn1/a_strex.c | |||
| @@ -74,11 +74,6 @@ | |||
| 74 | 74 | ||
| 75 | #define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) | 75 | #define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) |
| 76 | 76 | ||
| 77 | #define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ | ||
| 78 | ASN1_STRFLGS_ESC_QUOTE | \ | ||
| 79 | ASN1_STRFLGS_ESC_CTRL | \ | ||
| 80 | ASN1_STRFLGS_ESC_MSB) | ||
| 81 | |||
| 82 | 77 | ||
| 83 | /* Three IO functions for sending data to memory, a BIO and | 78 | /* Three IO functions for sending data to memory, a BIO and |
| 84 | * and a FILE pointer. | 79 | * and a FILE pointer. |
| @@ -153,13 +148,6 @@ static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, ch | |||
| 153 | if(!io_ch(arg, tmphex, 3)) return -1; | 148 | if(!io_ch(arg, tmphex, 3)) return -1; |
| 154 | return 3; | 149 | return 3; |
| 155 | } | 150 | } |
| 156 | /* If we get this far and do any escaping at all must escape | ||
| 157 | * the escape character itself: backslash. | ||
| 158 | */ | ||
| 159 | if (chtmp == '\\' && flags & ESC_FLAGS) { | ||
| 160 | if(!io_ch(arg, "\\\\", 2)) return -1; | ||
| 161 | return 2; | ||
| 162 | } | ||
| 163 | if(!io_ch(arg, &chtmp, 1)) return -1; | 151 | if(!io_ch(arg, &chtmp, 1)) return -1; |
| 164 | return 1; | 152 | return 1; |
| 165 | } | 153 | } |
| @@ -304,6 +292,11 @@ static const signed char tag2nbyte[] = { | |||
| 304 | 4, -1, 2 /* 28-30 */ | 292 | 4, -1, 2 /* 28-30 */ |
| 305 | }; | 293 | }; |
| 306 | 294 | ||
| 295 | #define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ | ||
| 296 | ASN1_STRFLGS_ESC_QUOTE | \ | ||
| 297 | ASN1_STRFLGS_ESC_CTRL | \ | ||
| 298 | ASN1_STRFLGS_ESC_MSB) | ||
| 299 | |||
| 307 | /* This is the main function, print out an | 300 | /* This is the main function, print out an |
| 308 | * ASN1_STRING taking note of various escape | 301 | * ASN1_STRING taking note of various escape |
| 309 | * and display options. Returns number of | 302 | * and display options. Returns number of |
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index 2fc48c1551..753021a7a2 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
| @@ -95,7 +95,7 @@ unsigned long ASN1_STRING_get_default_mask(void) | |||
| 95 | * default: the default value, Printable, T61, BMP. | 95 | * default: the default value, Printable, T61, BMP. |
| 96 | */ | 96 | */ |
| 97 | 97 | ||
| 98 | int ASN1_STRING_set_default_mask_asc(const char *p) | 98 | int ASN1_STRING_set_default_mask_asc(char *p) |
| 99 | { | 99 | { |
| 100 | unsigned long mask; | 100 | unsigned long mask; |
| 101 | char *end; | 101 | char *end; |
diff --git a/src/lib/libcrypto/asn1/a_utctm.c b/src/lib/libcrypto/asn1/a_utctm.c new file mode 100644 index 0000000000..072e236592 --- /dev/null +++ b/src/lib/libcrypto/asn1/a_utctm.c | |||
| @@ -0,0 +1,318 @@ | |||
| 1 | /* crypto/asn1/a_utctm.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <time.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include "o_time.h" | ||
| 63 | #include <openssl/asn1.h> | ||
| 64 | |||
| 65 | #if 0 | ||
| 66 | int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp) | ||
| 67 | { | ||
| 68 | #ifndef CHARSET_EBCDIC | ||
| 69 | return(i2d_ASN1_bytes((ASN1_STRING *)a,pp, | ||
| 70 | V_ASN1_UTCTIME,V_ASN1_UNIVERSAL)); | ||
| 71 | #else | ||
| 72 | /* KLUDGE! We convert to ascii before writing DER */ | ||
| 73 | int len; | ||
| 74 | char tmp[24]; | ||
| 75 | ASN1_STRING x = *(ASN1_STRING *)a; | ||
| 76 | |||
| 77 | len = x.length; | ||
| 78 | ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len); | ||
| 79 | x.data = tmp; | ||
| 80 | return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL); | ||
| 81 | #endif | ||
| 82 | } | ||
| 83 | |||
| 84 | |||
| 85 | ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp, | ||
| 86 | long length) | ||
| 87 | { | ||
| 88 | ASN1_UTCTIME *ret=NULL; | ||
| 89 | |||
| 90 | ret=(ASN1_UTCTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length, | ||
| 91 | V_ASN1_UTCTIME,V_ASN1_UNIVERSAL); | ||
| 92 | if (ret == NULL) | ||
| 93 | { | ||
| 94 | ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR); | ||
| 95 | return(NULL); | ||
| 96 | } | ||
| 97 | #ifdef CHARSET_EBCDIC | ||
| 98 | ascii2ebcdic(ret->data, ret->data, ret->length); | ||
| 99 | #endif | ||
| 100 | if (!ASN1_UTCTIME_check(ret)) | ||
| 101 | { | ||
| 102 | ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT); | ||
| 103 | goto err; | ||
| 104 | } | ||
| 105 | |||
| 106 | return(ret); | ||
| 107 | err: | ||
| 108 | if ((ret != NULL) && ((a == NULL) || (*a != ret))) | ||
| 109 | M_ASN1_UTCTIME_free(ret); | ||
| 110 | return(NULL); | ||
| 111 | } | ||
| 112 | |||
| 113 | #endif | ||
| 114 | |||
| 115 | int ASN1_UTCTIME_check(ASN1_UTCTIME *d) | ||
| 116 | { | ||
| 117 | static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0}; | ||
| 118 | static const int max[8]={99,12,31,23,59,59,12,59}; | ||
| 119 | char *a; | ||
| 120 | int n,i,l,o; | ||
| 121 | |||
| 122 | if (d->type != V_ASN1_UTCTIME) return(0); | ||
| 123 | l=d->length; | ||
| 124 | a=(char *)d->data; | ||
| 125 | o=0; | ||
| 126 | |||
| 127 | if (l < 11) goto err; | ||
| 128 | for (i=0; i<6; i++) | ||
| 129 | { | ||
| 130 | if ((i == 5) && ((a[o] == 'Z') || | ||
| 131 | (a[o] == '+') || (a[o] == '-'))) | ||
| 132 | { i++; break; } | ||
| 133 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 134 | n= a[o]-'0'; | ||
| 135 | if (++o > l) goto err; | ||
| 136 | |||
| 137 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 138 | n=(n*10)+ a[o]-'0'; | ||
| 139 | if (++o > l) goto err; | ||
| 140 | |||
| 141 | if ((n < min[i]) || (n > max[i])) goto err; | ||
| 142 | } | ||
| 143 | if (a[o] == 'Z') | ||
| 144 | o++; | ||
| 145 | else if ((a[o] == '+') || (a[o] == '-')) | ||
| 146 | { | ||
| 147 | o++; | ||
| 148 | if (o+4 > l) goto err; | ||
| 149 | for (i=6; i<8; i++) | ||
| 150 | { | ||
| 151 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 152 | n= a[o]-'0'; | ||
| 153 | o++; | ||
| 154 | if ((a[o] < '0') || (a[o] > '9')) goto err; | ||
| 155 | n=(n*10)+ a[o]-'0'; | ||
| 156 | if ((n < min[i]) || (n > max[i])) goto err; | ||
| 157 | o++; | ||
| 158 | } | ||
| 159 | } | ||
| 160 | return(o == l); | ||
| 161 | err: | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | |||
| 165 | int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str) | ||
| 166 | { | ||
| 167 | ASN1_UTCTIME t; | ||
| 168 | |||
| 169 | t.type=V_ASN1_UTCTIME; | ||
| 170 | t.length=strlen(str); | ||
| 171 | t.data=(unsigned char *)str; | ||
| 172 | if (ASN1_UTCTIME_check(&t)) | ||
| 173 | { | ||
| 174 | if (s != NULL) | ||
| 175 | { | ||
| 176 | if (!ASN1_STRING_set((ASN1_STRING *)s, | ||
| 177 | (unsigned char *)str,t.length)) | ||
| 178 | return 0; | ||
| 179 | s->type = V_ASN1_UTCTIME; | ||
| 180 | } | ||
| 181 | return(1); | ||
| 182 | } | ||
| 183 | else | ||
| 184 | return(0); | ||
| 185 | } | ||
| 186 | |||
| 187 | ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t) | ||
| 188 | { | ||
| 189 | return ASN1_UTCTIME_adj(s, t, 0, 0); | ||
| 190 | } | ||
| 191 | |||
| 192 | ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, | ||
| 193 | int offset_day, long offset_sec) | ||
| 194 | { | ||
| 195 | char *p; | ||
| 196 | struct tm *ts; | ||
| 197 | struct tm data; | ||
| 198 | size_t len = 20; | ||
| 199 | |||
| 200 | if (s == NULL) | ||
| 201 | s=M_ASN1_UTCTIME_new(); | ||
| 202 | if (s == NULL) | ||
| 203 | return(NULL); | ||
| 204 | |||
| 205 | ts=OPENSSL_gmtime(&t, &data); | ||
| 206 | if (ts == NULL) | ||
| 207 | return(NULL); | ||
| 208 | |||
| 209 | if (offset_day || offset_sec) | ||
| 210 | { | ||
| 211 | if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) | ||
| 212 | return NULL; | ||
| 213 | } | ||
| 214 | |||
| 215 | if((ts->tm_year < 50) || (ts->tm_year >= 150)) | ||
| 216 | return NULL; | ||
| 217 | |||
| 218 | p=(char *)s->data; | ||
| 219 | if ((p == NULL) || ((size_t)s->length < len)) | ||
| 220 | { | ||
| 221 | p=OPENSSL_malloc(len); | ||
| 222 | if (p == NULL) | ||
| 223 | { | ||
| 224 | ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE); | ||
| 225 | return(NULL); | ||
| 226 | } | ||
| 227 | if (s->data != NULL) | ||
| 228 | OPENSSL_free(s->data); | ||
| 229 | s->data=(unsigned char *)p; | ||
| 230 | } | ||
| 231 | |||
| 232 | BIO_snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, | ||
| 233 | ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); | ||
| 234 | s->length=strlen(p); | ||
| 235 | s->type=V_ASN1_UTCTIME; | ||
| 236 | #ifdef CHARSET_EBCDIC_not | ||
| 237 | ebcdic2ascii(s->data, s->data, s->length); | ||
| 238 | #endif | ||
| 239 | return(s); | ||
| 240 | } | ||
| 241 | |||
| 242 | |||
| 243 | int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) | ||
| 244 | { | ||
| 245 | struct tm *tm; | ||
| 246 | struct tm data; | ||
| 247 | int offset; | ||
| 248 | int year; | ||
| 249 | |||
| 250 | #define g2(p) (((p)[0]-'0')*10+(p)[1]-'0') | ||
| 251 | |||
| 252 | if (s->data[12] == 'Z') | ||
| 253 | offset=0; | ||
| 254 | else | ||
| 255 | { | ||
| 256 | offset = g2(s->data+13)*60+g2(s->data+15); | ||
| 257 | if (s->data[12] == '-') | ||
| 258 | offset = -offset; | ||
| 259 | } | ||
| 260 | |||
| 261 | t -= offset*60; /* FIXME: may overflow in extreme cases */ | ||
| 262 | |||
| 263 | tm = OPENSSL_gmtime(&t, &data); | ||
| 264 | |||
| 265 | #define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1 | ||
| 266 | year = g2(s->data); | ||
| 267 | if (year < 50) | ||
| 268 | year += 100; | ||
| 269 | return_cmp(year, tm->tm_year); | ||
| 270 | return_cmp(g2(s->data+2) - 1, tm->tm_mon); | ||
| 271 | return_cmp(g2(s->data+4), tm->tm_mday); | ||
| 272 | return_cmp(g2(s->data+6), tm->tm_hour); | ||
| 273 | return_cmp(g2(s->data+8), tm->tm_min); | ||
| 274 | return_cmp(g2(s->data+10), tm->tm_sec); | ||
| 275 | #undef g2 | ||
| 276 | #undef return_cmp | ||
| 277 | |||
| 278 | return 0; | ||
| 279 | } | ||
| 280 | |||
| 281 | |||
| 282 | #if 0 | ||
| 283 | time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s) | ||
| 284 | { | ||
| 285 | struct tm tm; | ||
| 286 | int offset; | ||
| 287 | |||
| 288 | memset(&tm,'\0',sizeof tm); | ||
| 289 | |||
| 290 | #define g2(p) (((p)[0]-'0')*10+(p)[1]-'0') | ||
| 291 | tm.tm_year=g2(s->data); | ||
| 292 | if(tm.tm_year < 50) | ||
| 293 | tm.tm_year+=100; | ||
| 294 | tm.tm_mon=g2(s->data+2)-1; | ||
| 295 | tm.tm_mday=g2(s->data+4); | ||
| 296 | tm.tm_hour=g2(s->data+6); | ||
| 297 | tm.tm_min=g2(s->data+8); | ||
| 298 | tm.tm_sec=g2(s->data+10); | ||
| 299 | if(s->data[12] == 'Z') | ||
| 300 | offset=0; | ||
| 301 | else | ||
| 302 | { | ||
| 303 | offset=g2(s->data+13)*60+g2(s->data+15); | ||
| 304 | if(s->data[12] == '-') | ||
| 305 | offset= -offset; | ||
| 306 | } | ||
| 307 | #undef g2 | ||
| 308 | |||
| 309 | return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone | ||
| 310 | * instead of UTC, and unless we rewrite OpenSSL | ||
| 311 | * in Lisp we cannot locally change the timezone | ||
| 312 | * without possibly interfering with other parts | ||
| 313 | * of the program. timegm, which uses UTC, is | ||
| 314 | * non-standard. | ||
| 315 | * Also time_t is inappropriate for general | ||
| 316 | * UTC times because it may a 32 bit type. */ | ||
| 317 | } | ||
| 318 | #endif | ||
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 59540e4e79..f7718b5a94 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
| @@ -1067,7 +1067,7 @@ ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, | |||
| 1067 | ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); | 1067 | ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); |
| 1068 | 1068 | ||
| 1069 | void ASN1_STRING_set_default_mask(unsigned long mask); | 1069 | void ASN1_STRING_set_default_mask(unsigned long mask); |
| 1070 | int ASN1_STRING_set_default_mask_asc(const char *p); | 1070 | int ASN1_STRING_set_default_mask_asc(char *p); |
| 1071 | unsigned long ASN1_STRING_get_default_mask(void); | 1071 | unsigned long ASN1_STRING_get_default_mask(void); |
| 1072 | int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, | 1072 | int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, |
| 1073 | int inform, unsigned long mask); | 1073 | int inform, unsigned long mask); |
diff --git a/src/lib/libcrypto/asn1/n_pkey.c b/src/lib/libcrypto/asn1/n_pkey.c index e7d0439062..60bc437938 100644 --- a/src/lib/libcrypto/asn1/n_pkey.c +++ b/src/lib/libcrypto/asn1/n_pkey.c | |||
| @@ -242,7 +242,7 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, | |||
| 242 | int sgckey) | 242 | int sgckey) |
| 243 | { | 243 | { |
| 244 | RSA *ret=NULL; | 244 | RSA *ret=NULL; |
| 245 | const unsigned char *p; | 245 | const unsigned char *p, *kp; |
| 246 | NETSCAPE_ENCRYPTED_PKEY *enckey = NULL; | 246 | NETSCAPE_ENCRYPTED_PKEY *enckey = NULL; |
| 247 | 247 | ||
| 248 | p = *pp; | 248 | p = *pp; |
| @@ -265,6 +265,7 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, | |||
| 265 | ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM); | 265 | ASN1err(ASN1_F_D2I_RSA_NET,ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM); |
| 266 | goto err; | 266 | goto err; |
| 267 | } | 267 | } |
| 268 | kp = enckey->enckey->digest->data; | ||
| 268 | if (cb == NULL) | 269 | if (cb == NULL) |
| 269 | cb=EVP_read_pw_string; | 270 | cb=EVP_read_pw_string; |
| 270 | if ((ret=d2i_RSA_NET_2(a, enckey->enckey->digest,cb, sgckey)) == NULL) goto err; | 271 | if ((ret=d2i_RSA_NET_2(a, enckey->enckey->digest,cb, sgckey)) == NULL) goto err; |
diff --git a/src/lib/libcrypto/asn1/t_crl.c b/src/lib/libcrypto/asn1/t_crl.c index ee5a687ce8..bdb244c015 100644 --- a/src/lib/libcrypto/asn1/t_crl.c +++ b/src/lib/libcrypto/asn1/t_crl.c | |||
| @@ -87,7 +87,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x) | |||
| 87 | STACK_OF(X509_REVOKED) *rev; | 87 | STACK_OF(X509_REVOKED) *rev; |
| 88 | X509_REVOKED *r; | 88 | X509_REVOKED *r; |
| 89 | long l; | 89 | long l; |
| 90 | int i; | 90 | int i, n; |
| 91 | char *p; | 91 | char *p; |
| 92 | 92 | ||
| 93 | BIO_printf(out, "Certificate Revocation List (CRL):\n"); | 93 | BIO_printf(out, "Certificate Revocation List (CRL):\n"); |
| @@ -107,6 +107,7 @@ int X509_CRL_print(BIO *out, X509_CRL *x) | |||
| 107 | else BIO_printf(out,"NONE"); | 107 | else BIO_printf(out,"NONE"); |
| 108 | BIO_printf(out,"\n"); | 108 | BIO_printf(out,"\n"); |
| 109 | 109 | ||
| 110 | n=X509_CRL_get_ext_count(x); | ||
| 110 | X509V3_extensions_print(out, "CRL extensions", | 111 | X509V3_extensions_print(out, "CRL extensions", |
| 111 | x->crl->extensions, 0, 8); | 112 | x->crl->extensions, 0, 8); |
| 112 | 113 | ||
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 87d7dfdf5c..3bee439968 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
| @@ -168,7 +168,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 168 | int i; | 168 | int i; |
| 169 | int otag; | 169 | int otag; |
| 170 | int ret = 0; | 170 | int ret = 0; |
| 171 | ASN1_VALUE **pchptr, *ptmpval; | 171 | ASN1_VALUE *pchval, **pchptr, *ptmpval; |
| 172 | if (!pval) | 172 | if (!pval) |
| 173 | return 0; | 173 | return 0; |
| 174 | if (aux && aux->asn1_cb) | 174 | if (aux && aux->asn1_cb) |
| @@ -319,6 +319,7 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 319 | goto err; | 319 | goto err; |
| 320 | } | 320 | } |
| 321 | /* CHOICE type, try each possibility in turn */ | 321 | /* CHOICE type, try each possibility in turn */ |
| 322 | pchval = NULL; | ||
| 322 | p = *in; | 323 | p = *in; |
| 323 | for (i = 0, tt=it->templates; i < it->tcount; i++, tt++) | 324 | for (i = 0, tt=it->templates; i < it->tcount; i++, tt++) |
| 324 | { | 325 | { |
diff --git a/src/lib/libcrypto/asn1/x_name.c b/src/lib/libcrypto/asn1/x_name.c index 49be08b4da..caa4409feb 100644 --- a/src/lib/libcrypto/asn1/x_name.c +++ b/src/lib/libcrypto/asn1/x_name.c | |||
| @@ -214,9 +214,7 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, | |||
| 214 | *val = nm.a; | 214 | *val = nm.a; |
| 215 | *in = p; | 215 | *in = p; |
| 216 | return ret; | 216 | return ret; |
| 217 | err: | 217 | err: |
| 218 | if (nm.x != NULL) | ||
| 219 | X509_NAME_free(nm.x); | ||
| 220 | ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | 218 | ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR); |
| 221 | return 0; | 219 | return 0; |
| 222 | } | 220 | } |
| @@ -466,8 +464,7 @@ static int asn1_string_canon(ASN1_STRING *out, ASN1_STRING *in) | |||
| 466 | } | 464 | } |
| 467 | else | 465 | else |
| 468 | { | 466 | { |
| 469 | *to++ = tolower(*from); | 467 | *to++ = tolower(*from++); |
| 470 | from++; | ||
| 471 | i++; | 468 | i++; |
| 472 | } | 469 | } |
| 473 | } | 470 | } |
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c index de3df9eb51..dafd3cc921 100644 --- a/src/lib/libcrypto/asn1/x_x509.c +++ b/src/lib/libcrypto/asn1/x_x509.c | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | #include <openssl/x509.h> | 63 | #include <openssl/x509.h> |
| 64 | #include <openssl/x509v3.h> | 64 | #include <openssl/x509v3.h> |
| 65 | 65 | ||
| 66 | ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = { | 66 | ASN1_SEQUENCE(X509_CINF) = { |
| 67 | ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0), | 67 | ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0), |
| 68 | ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER), | 68 | ASN1_SIMPLE(X509_CINF, serialNumber, ASN1_INTEGER), |
| 69 | ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR), | 69 | ASN1_SIMPLE(X509_CINF, signature, X509_ALGOR), |
| @@ -74,7 +74,7 @@ ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = { | |||
| 74 | ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1), | 74 | ASN1_IMP_OPT(X509_CINF, issuerUID, ASN1_BIT_STRING, 1), |
| 75 | ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2), | 75 | ASN1_IMP_OPT(X509_CINF, subjectUID, ASN1_BIT_STRING, 2), |
| 76 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3) | 76 | ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3) |
| 77 | } ASN1_SEQUENCE_END_enc(X509_CINF, X509_CINF) | 77 | } ASN1_SEQUENCE_END(X509_CINF) |
| 78 | 78 | ||
| 79 | IMPLEMENT_ASN1_FUNCTIONS(X509_CINF) | 79 | IMPLEMENT_ASN1_FUNCTIONS(X509_CINF) |
| 80 | /* X509 top level structure needs a bit of customisation */ | 80 | /* X509 top level structure needs a bit of customisation */ |
diff --git a/src/lib/libcrypto/bf/Makefile b/src/lib/libcrypto/bf/Makefile new file mode 100644 index 0000000000..dd2c2c708e --- /dev/null +++ b/src/lib/libcrypto/bf/Makefile | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/blowfish/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= bf | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | BF_ENC= bf_enc.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=bftest.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cfb64.c bf_ofb64.c | ||
| 26 | LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cfb64.o bf_ofb64.o | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= blowfish.h | ||
| 31 | HEADER= bf_pi.h bf_locl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | bf-586.s: asm/bf-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 46 | $(PERL) asm/bf-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 47 | |||
| 48 | files: | ||
| 49 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 55 | |||
| 56 | # We need to use force because 'install' matches 'INSTALL' on case | ||
| 57 | # insensitive systems | ||
| 58 | FRC.install: | ||
| 59 | install: FRC.install | ||
| 60 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 61 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 62 | do \ | ||
| 63 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 64 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 65 | done; | ||
| 66 | |||
| 67 | tags: | ||
| 68 | ctags $(SRC) | ||
| 69 | |||
| 70 | tests: | ||
| 71 | |||
| 72 | lint: | ||
| 73 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 74 | |||
| 75 | depend: | ||
| 76 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 77 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 78 | |||
| 79 | dclean: | ||
| 80 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 81 | mv -f Makefile.new $(MAKEFILE) | ||
| 82 | |||
| 83 | clean: | ||
| 84 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 85 | |||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 87 | |||
| 88 | bf_cfb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 89 | bf_cfb64.o: ../../include/openssl/opensslconf.h bf_cfb64.c bf_locl.h | ||
| 90 | bf_ecb.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 91 | bf_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 92 | bf_ecb.o: bf_ecb.c bf_locl.h | ||
| 93 | bf_enc.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 94 | bf_enc.o: ../../include/openssl/opensslconf.h bf_enc.c bf_locl.h | ||
| 95 | bf_ofb64.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 96 | bf_ofb64.o: ../../include/openssl/opensslconf.h bf_locl.h bf_ofb64.c | ||
| 97 | bf_skey.o: ../../include/openssl/blowfish.h ../../include/openssl/e_os2.h | ||
| 98 | bf_skey.o: ../../include/openssl/opensslconf.h bf_locl.h bf_pi.h bf_skey.c | ||
diff --git a/src/lib/libcrypto/bf/asm/bf-586.pl b/src/lib/libcrypto/bf/asm/bf-586.pl index b74cfbafd4..1f9b345aee 100644 --- a/src/lib/libcrypto/bf/asm/bf-586.pl +++ b/src/lib/libcrypto/bf/asm/bf-586.pl | |||
| @@ -19,7 +19,7 @@ $tmp4="edx"; | |||
| 19 | 19 | ||
| 20 | &BF_encrypt("BF_encrypt",1); | 20 | &BF_encrypt("BF_encrypt",1); |
| 21 | &BF_encrypt("BF_decrypt",0); | 21 | &BF_encrypt("BF_decrypt",0); |
| 22 | &cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); | 22 | &cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1) unless $main'openbsd; |
| 23 | &asm_finish(); | 23 | &asm_finish(); |
| 24 | 24 | ||
| 25 | sub BF_encrypt | 25 | sub BF_encrypt |
diff --git a/src/lib/libcrypto/bf/asm/bf-686.pl b/src/lib/libcrypto/bf/asm/bf-686.pl new file mode 100644 index 0000000000..8e4c25f598 --- /dev/null +++ b/src/lib/libcrypto/bf/asm/bf-686.pl | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | push(@INC,"perlasm","../../perlasm"); | ||
| 4 | require "x86asm.pl"; | ||
| 5 | require "cbc.pl"; | ||
| 6 | |||
| 7 | &asm_init($ARGV[0],"bf-686.pl"); | ||
| 8 | |||
| 9 | $BF_ROUNDS=16; | ||
| 10 | $BF_OFF=($BF_ROUNDS+2)*4; | ||
| 11 | $L="ecx"; | ||
| 12 | $R="edx"; | ||
| 13 | $P="edi"; | ||
| 14 | $tot="esi"; | ||
| 15 | $tmp1="eax"; | ||
| 16 | $tmp2="ebx"; | ||
| 17 | $tmp3="ebp"; | ||
| 18 | |||
| 19 | &des_encrypt("BF_encrypt",1); | ||
| 20 | &des_encrypt("BF_decrypt",0); | ||
| 21 | &cbc("BF_cbc_encrypt","BF_encrypt","BF_decrypt",1,4,5,3,-1,-1); | ||
| 22 | |||
| 23 | &asm_finish(); | ||
| 24 | |||
| 25 | &file_end(); | ||
| 26 | |||
| 27 | sub des_encrypt | ||
| 28 | { | ||
| 29 | local($name,$enc)=@_; | ||
| 30 | |||
| 31 | &function_begin($name,""); | ||
| 32 | |||
| 33 | &comment(""); | ||
| 34 | &comment("Load the 2 words"); | ||
| 35 | &mov("eax",&wparam(0)); | ||
| 36 | &mov($L,&DWP(0,"eax","",0)); | ||
| 37 | &mov($R,&DWP(4,"eax","",0)); | ||
| 38 | |||
| 39 | &comment(""); | ||
| 40 | &comment("P pointer, s and enc flag"); | ||
| 41 | &mov($P,&wparam(1)); | ||
| 42 | |||
| 43 | &xor( $tmp1, $tmp1); | ||
| 44 | &xor( $tmp2, $tmp2); | ||
| 45 | |||
| 46 | # encrypting part | ||
| 47 | |||
| 48 | if ($enc) | ||
| 49 | { | ||
| 50 | &xor($L,&DWP(0,$P,"",0)); | ||
| 51 | for ($i=0; $i<$BF_ROUNDS; $i+=2) | ||
| 52 | { | ||
| 53 | &comment(""); | ||
| 54 | &comment("Round $i"); | ||
| 55 | &BF_ENCRYPT($i+1,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3); | ||
| 56 | |||
| 57 | &comment(""); | ||
| 58 | &comment("Round ".sprintf("%d",$i+1)); | ||
| 59 | &BF_ENCRYPT($i+2,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3); | ||
| 60 | } | ||
| 61 | &xor($R,&DWP(($BF_ROUNDS+1)*4,$P,"",0)); | ||
| 62 | |||
| 63 | &mov("eax",&wparam(0)); | ||
| 64 | &mov(&DWP(0,"eax","",0),$R); | ||
| 65 | &mov(&DWP(4,"eax","",0),$L); | ||
| 66 | &function_end_A($name); | ||
| 67 | } | ||
| 68 | else | ||
| 69 | { | ||
| 70 | &xor($L,&DWP(($BF_ROUNDS+1)*4,$P,"",0)); | ||
| 71 | for ($i=$BF_ROUNDS; $i>0; $i-=2) | ||
| 72 | { | ||
| 73 | &comment(""); | ||
| 74 | &comment("Round $i"); | ||
| 75 | &BF_ENCRYPT($i,$R,$L,$P,$tot,$tmp1,$tmp2,$tmp3); | ||
| 76 | &comment(""); | ||
| 77 | &comment("Round ".sprintf("%d",$i-1)); | ||
| 78 | &BF_ENCRYPT($i-1,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3); | ||
| 79 | } | ||
| 80 | &xor($R,&DWP(0,$P,"",0)); | ||
| 81 | |||
| 82 | &mov("eax",&wparam(0)); | ||
| 83 | &mov(&DWP(0,"eax","",0),$R); | ||
| 84 | &mov(&DWP(4,"eax","",0),$L); | ||
| 85 | &function_end_A($name); | ||
| 86 | } | ||
| 87 | |||
| 88 | &function_end_B($name); | ||
| 89 | } | ||
| 90 | |||
| 91 | sub BF_ENCRYPT | ||
| 92 | { | ||
| 93 | local($i,$L,$R,$P,$tot,$tmp1,$tmp2,$tmp3)=@_; | ||
| 94 | |||
| 95 | &rotr( $R, 16); | ||
| 96 | &mov( $tot, &DWP(&n2a($i*4),$P,"",0)); | ||
| 97 | |||
| 98 | &movb( &LB($tmp1), &HB($R)); | ||
| 99 | &movb( &LB($tmp2), &LB($R)); | ||
| 100 | |||
| 101 | &rotr( $R, 16); | ||
| 102 | &xor( $L, $tot); | ||
| 103 | |||
| 104 | &mov( $tot, &DWP(&n2a($BF_OFF+0x0000),$P,$tmp1,4)); | ||
| 105 | &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0400),$P,$tmp2,4)); | ||
| 106 | |||
| 107 | &movb( &LB($tmp1), &HB($R)); | ||
| 108 | &movb( &LB($tmp2), &LB($R)); | ||
| 109 | |||
| 110 | &add( $tot, $tmp3); | ||
| 111 | &mov( $tmp1, &DWP(&n2a($BF_OFF+0x0800),$P,$tmp1,4)); # delay | ||
| 112 | |||
| 113 | &xor( $tot, $tmp1); | ||
| 114 | &mov( $tmp3, &DWP(&n2a($BF_OFF+0x0C00),$P,$tmp2,4)); | ||
| 115 | |||
| 116 | &add( $tot, $tmp3); | ||
| 117 | &xor( $tmp1, $tmp1); | ||
| 118 | |||
| 119 | &xor( $L, $tot); | ||
| 120 | # delay | ||
| 121 | } | ||
| 122 | |||
| 123 | sub n2a | ||
| 124 | { | ||
| 125 | sprintf("%d",$_[0]); | ||
| 126 | } | ||
| 127 | |||
diff --git a/src/lib/libcrypto/bf/asm/readme b/src/lib/libcrypto/bf/asm/readme new file mode 100644 index 0000000000..2385fa3812 --- /dev/null +++ b/src/lib/libcrypto/bf/asm/readme | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | There are blowfish assembler generation scripts. | ||
| 2 | bf-586.pl version is for the pentium and | ||
| 3 | bf-686.pl is my original version, which is faster on the pentium pro. | ||
| 4 | |||
| 5 | When using a bf-586.pl, the pentium pro/II is %8 slower than using | ||
| 6 | bf-686.pl. When using a bf-686.pl, the pentium is %16 slower | ||
| 7 | than bf-586.pl | ||
| 8 | |||
| 9 | So the default is bf-586.pl | ||
| 10 | |||
diff --git a/src/lib/libcrypto/bf/bf_opts.c b/src/lib/libcrypto/bf/bf_opts.c new file mode 100644 index 0000000000..1721bb99b4 --- /dev/null +++ b/src/lib/libcrypto/bf/bf_opts.c | |||
| @@ -0,0 +1,331 @@ | |||
| 1 | /* crypto/bf/bf_opts.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. | ||
| 60 | * This is for machines with 64k code segment size restrictions. */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef _IRIX | ||
| 77 | #include <time.h> | ||
| 78 | #endif | ||
| 79 | #ifdef TIMES | ||
| 80 | #include <sys/types.h> | ||
| 81 | #include <sys/times.h> | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 85 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 86 | undefine TIMES, since that tells the rest of the program how things | ||
| 87 | should be handled. -- Richard Levitte */ | ||
| 88 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 89 | #undef TIMES | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef TIMES | ||
| 93 | #include <sys/timeb.h> | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(sun) || defined(__ultrix) | ||
| 97 | #define _POSIX_SOURCE | ||
| 98 | #include <limits.h> | ||
| 99 | #include <sys/param.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #include <openssl/blowfish.h> | ||
| 103 | |||
| 104 | #define BF_DEFAULT_OPTIONS | ||
| 105 | |||
| 106 | #undef BF_ENC | ||
| 107 | #define BF_encrypt BF_encrypt_normal | ||
| 108 | #undef HEADER_BF_LOCL_H | ||
| 109 | #include "bf_enc.c" | ||
| 110 | |||
| 111 | #define BF_PTR | ||
| 112 | #undef BF_PTR2 | ||
| 113 | #undef BF_ENC | ||
| 114 | #undef BF_encrypt | ||
| 115 | #define BF_encrypt BF_encrypt_ptr | ||
| 116 | #undef HEADER_BF_LOCL_H | ||
| 117 | #include "bf_enc.c" | ||
| 118 | |||
| 119 | #undef BF_PTR | ||
| 120 | #define BF_PTR2 | ||
| 121 | #undef BF_ENC | ||
| 122 | #undef BF_encrypt | ||
| 123 | #define BF_encrypt BF_encrypt_ptr2 | ||
| 124 | #undef HEADER_BF_LOCL_H | ||
| 125 | #include "bf_enc.c" | ||
| 126 | |||
| 127 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 128 | #ifndef HZ | ||
| 129 | # ifndef CLK_TCK | ||
| 130 | # ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ | ||
| 131 | # define HZ 100.0 | ||
| 132 | # else /* _BSD_CLK_TCK_ */ | ||
| 133 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 134 | # endif | ||
| 135 | # else /* CLK_TCK */ | ||
| 136 | # define HZ ((double)CLK_TCK) | ||
| 137 | # endif | ||
| 138 | #endif | ||
| 139 | |||
| 140 | #define BUFSIZE ((long)1024) | ||
| 141 | long run=0; | ||
| 142 | |||
| 143 | double Time_F(int s); | ||
| 144 | #ifdef SIGALRM | ||
| 145 | #if defined(__STDC__) || defined(sgi) | ||
| 146 | #define SIGRETTYPE void | ||
| 147 | #else | ||
| 148 | #define SIGRETTYPE int | ||
| 149 | #endif | ||
| 150 | |||
| 151 | SIGRETTYPE sig_done(int sig); | ||
| 152 | SIGRETTYPE sig_done(int sig) | ||
| 153 | { | ||
| 154 | signal(SIGALRM,sig_done); | ||
| 155 | run=0; | ||
| 156 | #ifdef LINT | ||
| 157 | sig=sig; | ||
| 158 | #endif | ||
| 159 | } | ||
| 160 | #endif | ||
| 161 | |||
| 162 | #define START 0 | ||
| 163 | #define STOP 1 | ||
| 164 | |||
| 165 | double Time_F(int s) | ||
| 166 | { | ||
| 167 | double ret; | ||
| 168 | #ifdef TIMES | ||
| 169 | static struct tms tstart,tend; | ||
| 170 | |||
| 171 | if (s == START) | ||
| 172 | { | ||
| 173 | times(&tstart); | ||
| 174 | return(0); | ||
| 175 | } | ||
| 176 | else | ||
| 177 | { | ||
| 178 | times(&tend); | ||
| 179 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 180 | return((ret == 0.0)?1e-6:ret); | ||
| 181 | } | ||
| 182 | #else /* !times() */ | ||
| 183 | static struct timeb tstart,tend; | ||
| 184 | long i; | ||
| 185 | |||
| 186 | if (s == START) | ||
| 187 | { | ||
| 188 | ftime(&tstart); | ||
| 189 | return(0); | ||
| 190 | } | ||
| 191 | else | ||
| 192 | { | ||
| 193 | ftime(&tend); | ||
| 194 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 195 | ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; | ||
| 196 | return((ret == 0.0)?1e-6:ret); | ||
| 197 | } | ||
| 198 | #endif | ||
| 199 | } | ||
| 200 | |||
| 201 | #ifdef SIGALRM | ||
| 202 | #define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); | ||
| 203 | #else | ||
| 204 | #define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); | ||
| 205 | #endif | ||
| 206 | |||
| 207 | #define time_it(func,name,index) \ | ||
| 208 | print_name(name); \ | ||
| 209 | Time_F(START); \ | ||
| 210 | for (count=0,run=1; COND(cb); count+=4) \ | ||
| 211 | { \ | ||
| 212 | unsigned long d[2]; \ | ||
| 213 | func(d,&sch); \ | ||
| 214 | func(d,&sch); \ | ||
| 215 | func(d,&sch); \ | ||
| 216 | func(d,&sch); \ | ||
| 217 | } \ | ||
| 218 | tm[index]=Time_F(STOP); \ | ||
| 219 | fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ | ||
| 220 | tm[index]=((double)COUNT(cb))/tm[index]; | ||
| 221 | |||
| 222 | #define print_it(name,index) \ | ||
| 223 | fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ | ||
| 224 | tm[index]*8,1.0e6/tm[index]); | ||
| 225 | |||
| 226 | int main(int argc, char **argv) | ||
| 227 | { | ||
| 228 | long count; | ||
| 229 | static unsigned char buf[BUFSIZE]; | ||
| 230 | static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, | ||
| 231 | 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | ||
| 232 | BF_KEY sch; | ||
| 233 | double d,tm[16],max=0; | ||
| 234 | int rank[16]; | ||
| 235 | char *str[16]; | ||
| 236 | int max_idx=0,i,num=0,j; | ||
| 237 | #ifndef SIGALARM | ||
| 238 | long ca,cb,cc,cd,ce; | ||
| 239 | #endif | ||
| 240 | |||
| 241 | for (i=0; i<12; i++) | ||
| 242 | { | ||
| 243 | tm[i]=0.0; | ||
| 244 | rank[i]=0; | ||
| 245 | } | ||
| 246 | |||
| 247 | #ifndef TIMES | ||
| 248 | fprintf(stderr,"To get the most accurate results, try to run this\n"); | ||
| 249 | fprintf(stderr,"program when this computer is idle.\n"); | ||
| 250 | #endif | ||
| 251 | |||
| 252 | BF_set_key(&sch,16,key); | ||
| 253 | |||
| 254 | #ifndef SIGALRM | ||
| 255 | fprintf(stderr,"First we calculate the approximate speed ...\n"); | ||
| 256 | count=10; | ||
| 257 | do { | ||
| 258 | long i; | ||
| 259 | unsigned long data[2]; | ||
| 260 | |||
| 261 | count*=2; | ||
| 262 | Time_F(START); | ||
| 263 | for (i=count; i; i--) | ||
| 264 | BF_encrypt(data,&sch); | ||
| 265 | d=Time_F(STOP); | ||
| 266 | } while (d < 3.0); | ||
| 267 | ca=count; | ||
| 268 | cb=count*3; | ||
| 269 | cc=count*3*8/BUFSIZE+1; | ||
| 270 | cd=count*8/BUFSIZE+1; | ||
| 271 | |||
| 272 | ce=count/20+1; | ||
| 273 | #define COND(d) (count != (d)) | ||
| 274 | #define COUNT(d) (d) | ||
| 275 | #else | ||
| 276 | #define COND(c) (run) | ||
| 277 | #define COUNT(d) (count) | ||
| 278 | signal(SIGALRM,sig_done); | ||
| 279 | alarm(10); | ||
| 280 | #endif | ||
| 281 | |||
| 282 | time_it(BF_encrypt_normal, "BF_encrypt_normal ", 0); | ||
| 283 | time_it(BF_encrypt_ptr, "BF_encrypt_ptr ", 1); | ||
| 284 | time_it(BF_encrypt_ptr2, "BF_encrypt_ptr2 ", 2); | ||
| 285 | num+=3; | ||
| 286 | |||
| 287 | str[0]="<nothing>"; | ||
| 288 | print_it("BF_encrypt_normal ",0); | ||
| 289 | max=tm[0]; | ||
| 290 | max_idx=0; | ||
| 291 | str[1]="ptr "; | ||
| 292 | print_it("BF_encrypt_ptr ",1); | ||
| 293 | if (max < tm[1]) { max=tm[1]; max_idx=1; } | ||
| 294 | str[2]="ptr2 "; | ||
| 295 | print_it("BF_encrypt_ptr2 ",2); | ||
| 296 | if (max < tm[2]) { max=tm[2]; max_idx=2; } | ||
| 297 | |||
| 298 | printf("options BF ecb/s\n"); | ||
| 299 | printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]); | ||
| 300 | d=tm[max_idx]; | ||
| 301 | tm[max_idx]= -2.0; | ||
| 302 | max= -1.0; | ||
| 303 | for (;;) | ||
| 304 | { | ||
| 305 | for (i=0; i<3; i++) | ||
| 306 | { | ||
| 307 | if (max < tm[i]) { max=tm[i]; j=i; } | ||
| 308 | } | ||
| 309 | if (max < 0.0) break; | ||
| 310 | printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0); | ||
| 311 | tm[j]= -2.0; | ||
| 312 | max= -1.0; | ||
| 313 | } | ||
| 314 | |||
| 315 | switch (max_idx) | ||
| 316 | { | ||
| 317 | case 0: | ||
| 318 | printf("-DBF_DEFAULT_OPTIONS\n"); | ||
| 319 | break; | ||
| 320 | case 1: | ||
| 321 | printf("-DBF_PTR\n"); | ||
| 322 | break; | ||
| 323 | case 2: | ||
| 324 | printf("-DBF_PTR2\n"); | ||
| 325 | break; | ||
| 326 | } | ||
| 327 | exit(0); | ||
| 328 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 329 | return(0); | ||
| 330 | #endif | ||
| 331 | } | ||
diff --git a/src/lib/libcrypto/bf/bfs.cpp b/src/lib/libcrypto/bf/bfs.cpp new file mode 100644 index 0000000000..d74c457760 --- /dev/null +++ b/src/lib/libcrypto/bf/bfs.cpp | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/blowfish.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | BF_KEY key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | |||
| 44 | for (j=0; j<6; j++) | ||
| 45 | { | ||
| 46 | for (i=0; i<1000; i++) /**/ | ||
| 47 | { | ||
| 48 | BF_encrypt(&data[0],&key); | ||
| 49 | GetTSC(s1); | ||
| 50 | BF_encrypt(&data[0],&key); | ||
| 51 | BF_encrypt(&data[0],&key); | ||
| 52 | BF_encrypt(&data[0],&key); | ||
| 53 | GetTSC(e1); | ||
| 54 | GetTSC(s2); | ||
| 55 | BF_encrypt(&data[0],&key); | ||
| 56 | BF_encrypt(&data[0],&key); | ||
| 57 | BF_encrypt(&data[0],&key); | ||
| 58 | BF_encrypt(&data[0],&key); | ||
| 59 | GetTSC(e2); | ||
| 60 | BF_encrypt(&data[0],&key); | ||
| 61 | } | ||
| 62 | |||
| 63 | printf("blowfish %d %d (%d)\n", | ||
| 64 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
diff --git a/src/lib/libcrypto/bf/bfspeed.c b/src/lib/libcrypto/bf/bfspeed.c new file mode 100644 index 0000000000..c41ef3b403 --- /dev/null +++ b/src/lib/libcrypto/bf/bfspeed.c | |||
| @@ -0,0 +1,277 @@ | |||
| 1 | /* crypto/bf/bfspeed.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ | ||
| 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef _IRIX | ||
| 77 | #include <time.h> | ||
| 78 | #endif | ||
| 79 | #ifdef TIMES | ||
| 80 | #include <sys/types.h> | ||
| 81 | #include <sys/times.h> | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 85 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 86 | undefine TIMES, since that tells the rest of the program how things | ||
| 87 | should be handled. -- Richard Levitte */ | ||
| 88 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 89 | #undef TIMES | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef TIMES | ||
| 93 | #include <sys/timeb.h> | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(sun) || defined(__ultrix) | ||
| 97 | #define _POSIX_SOURCE | ||
| 98 | #include <limits.h> | ||
| 99 | #include <sys/param.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #include <openssl/blowfish.h> | ||
| 103 | |||
| 104 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 105 | #ifndef HZ | ||
| 106 | #ifndef CLK_TCK | ||
| 107 | #define HZ 100.0 | ||
| 108 | #else /* CLK_TCK */ | ||
| 109 | #define HZ ((double)CLK_TCK) | ||
| 110 | #endif | ||
| 111 | #endif | ||
| 112 | |||
| 113 | #define BUFSIZE ((long)1024) | ||
| 114 | long run=0; | ||
| 115 | |||
| 116 | double Time_F(int s); | ||
| 117 | #ifdef SIGALRM | ||
| 118 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) | ||
| 119 | #define SIGRETTYPE void | ||
| 120 | #else | ||
| 121 | #define SIGRETTYPE int | ||
| 122 | #endif | ||
| 123 | |||
| 124 | SIGRETTYPE sig_done(int sig); | ||
| 125 | SIGRETTYPE sig_done(int sig) | ||
| 126 | { | ||
| 127 | signal(SIGALRM,sig_done); | ||
| 128 | run=0; | ||
| 129 | #ifdef LINT | ||
| 130 | sig=sig; | ||
| 131 | #endif | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | |||
| 135 | #define START 0 | ||
| 136 | #define STOP 1 | ||
| 137 | |||
| 138 | double Time_F(int s) | ||
| 139 | { | ||
| 140 | double ret; | ||
| 141 | #ifdef TIMES | ||
| 142 | static struct tms tstart,tend; | ||
| 143 | |||
| 144 | if (s == START) | ||
| 145 | { | ||
| 146 | times(&tstart); | ||
| 147 | return(0); | ||
| 148 | } | ||
| 149 | else | ||
| 150 | { | ||
| 151 | times(&tend); | ||
| 152 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 153 | return((ret == 0.0)?1e-6:ret); | ||
| 154 | } | ||
| 155 | #else /* !times() */ | ||
| 156 | static struct timeb tstart,tend; | ||
| 157 | long i; | ||
| 158 | |||
| 159 | if (s == START) | ||
| 160 | { | ||
| 161 | ftime(&tstart); | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | else | ||
| 165 | { | ||
| 166 | ftime(&tend); | ||
| 167 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 168 | ret=((double)(tend.time-tstart.time))+((double)i)/1e3; | ||
| 169 | return((ret == 0.0)?1e-6:ret); | ||
| 170 | } | ||
| 171 | #endif | ||
| 172 | } | ||
| 173 | |||
| 174 | int main(int argc, char **argv) | ||
| 175 | { | ||
| 176 | long count; | ||
| 177 | static unsigned char buf[BUFSIZE]; | ||
| 178 | static unsigned char key[] ={ | ||
| 179 | 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, | ||
| 180 | 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, | ||
| 181 | }; | ||
| 182 | BF_KEY sch; | ||
| 183 | double a,b,c,d; | ||
| 184 | #ifndef SIGALRM | ||
| 185 | long ca,cb,cc; | ||
| 186 | #endif | ||
| 187 | |||
| 188 | #ifndef TIMES | ||
| 189 | printf("To get the most accurate results, try to run this\n"); | ||
| 190 | printf("program when this computer is idle.\n"); | ||
| 191 | #endif | ||
| 192 | |||
| 193 | #ifndef SIGALRM | ||
| 194 | printf("First we calculate the approximate speed ...\n"); | ||
| 195 | BF_set_key(&sch,16,key); | ||
| 196 | count=10; | ||
| 197 | do { | ||
| 198 | long i; | ||
| 199 | BF_LONG data[2]; | ||
| 200 | |||
| 201 | count*=2; | ||
| 202 | Time_F(START); | ||
| 203 | for (i=count; i; i--) | ||
| 204 | BF_encrypt(data,&sch); | ||
| 205 | d=Time_F(STOP); | ||
| 206 | } while (d < 3.0); | ||
| 207 | ca=count/512; | ||
| 208 | cb=count; | ||
| 209 | cc=count*8/BUFSIZE+1; | ||
| 210 | printf("Doing BF_set_key %ld times\n",ca); | ||
| 211 | #define COND(d) (count != (d)) | ||
| 212 | #define COUNT(d) (d) | ||
| 213 | #else | ||
| 214 | #define COND(c) (run) | ||
| 215 | #define COUNT(d) (count) | ||
| 216 | signal(SIGALRM,sig_done); | ||
| 217 | printf("Doing BF_set_key for 10 seconds\n"); | ||
| 218 | alarm(10); | ||
| 219 | #endif | ||
| 220 | |||
| 221 | Time_F(START); | ||
| 222 | for (count=0,run=1; COND(ca); count+=4) | ||
| 223 | { | ||
| 224 | BF_set_key(&sch,16,key); | ||
| 225 | BF_set_key(&sch,16,key); | ||
| 226 | BF_set_key(&sch,16,key); | ||
| 227 | BF_set_key(&sch,16,key); | ||
| 228 | } | ||
| 229 | d=Time_F(STOP); | ||
| 230 | printf("%ld BF_set_key's in %.2f seconds\n",count,d); | ||
| 231 | a=((double)COUNT(ca))/d; | ||
| 232 | |||
| 233 | #ifdef SIGALRM | ||
| 234 | printf("Doing BF_encrypt's for 10 seconds\n"); | ||
| 235 | alarm(10); | ||
| 236 | #else | ||
| 237 | printf("Doing BF_encrypt %ld times\n",cb); | ||
| 238 | #endif | ||
| 239 | Time_F(START); | ||
| 240 | for (count=0,run=1; COND(cb); count+=4) | ||
| 241 | { | ||
| 242 | BF_LONG data[2]; | ||
| 243 | |||
| 244 | BF_encrypt(data,&sch); | ||
| 245 | BF_encrypt(data,&sch); | ||
| 246 | BF_encrypt(data,&sch); | ||
| 247 | BF_encrypt(data,&sch); | ||
| 248 | } | ||
| 249 | d=Time_F(STOP); | ||
| 250 | printf("%ld BF_encrypt's in %.2f second\n",count,d); | ||
| 251 | b=((double)COUNT(cb)*8)/d; | ||
| 252 | |||
| 253 | #ifdef SIGALRM | ||
| 254 | printf("Doing BF_cbc_encrypt on %ld byte blocks for 10 seconds\n", | ||
| 255 | BUFSIZE); | ||
| 256 | alarm(10); | ||
| 257 | #else | ||
| 258 | printf("Doing BF_cbc_encrypt %ld times on %ld byte blocks\n",cc, | ||
| 259 | BUFSIZE); | ||
| 260 | #endif | ||
| 261 | Time_F(START); | ||
| 262 | for (count=0,run=1; COND(cc); count++) | ||
| 263 | BF_cbc_encrypt(buf,buf,BUFSIZE,&sch, | ||
| 264 | &(key[0]),BF_ENCRYPT); | ||
| 265 | d=Time_F(STOP); | ||
| 266 | printf("%ld BF_cbc_encrypt's of %ld byte blocks in %.2f second\n", | ||
| 267 | count,BUFSIZE,d); | ||
| 268 | c=((double)COUNT(cc)*BUFSIZE)/d; | ||
| 269 | |||
| 270 | printf("Blowfish set_key per sec = %12.3f (%9.3fuS)\n",a,1.0e6/a); | ||
| 271 | printf("Blowfish raw ecb bytes per sec = %12.3f (%9.3fuS)\n",b,8.0e6/b); | ||
| 272 | printf("Blowfish cbc bytes per sec = %12.3f (%9.3fuS)\n",c,8.0e6/c); | ||
| 273 | exit(0); | ||
| 274 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 275 | return(0); | ||
| 276 | #endif | ||
| 277 | } | ||
diff --git a/src/lib/libcrypto/bf/bftest.c b/src/lib/libcrypto/bf/bftest.c new file mode 100644 index 0000000000..97e6634d37 --- /dev/null +++ b/src/lib/libcrypto/bf/bftest.c | |||
| @@ -0,0 +1,540 @@ | |||
| 1 | /* crypto/bf/bftest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* This has been a quickly hacked 'ideatest.c'. When I add tests for other | ||
| 60 | * RC2 modes, more of the code will be uncommented. */ | ||
| 61 | |||
| 62 | #include <stdio.h> | ||
| 63 | #include <string.h> | ||
| 64 | #include <stdlib.h> | ||
| 65 | #include <openssl/opensslconf.h> /* To see if OPENSSL_NO_BF is defined */ | ||
| 66 | |||
| 67 | #include "../e_os.h" | ||
| 68 | |||
| 69 | #ifdef OPENSSL_NO_BF | ||
| 70 | int main(int argc, char *argv[]) | ||
| 71 | { | ||
| 72 | printf("No BF support\n"); | ||
| 73 | return(0); | ||
| 74 | } | ||
| 75 | #else | ||
| 76 | #include <openssl/blowfish.h> | ||
| 77 | |||
| 78 | #ifdef CHARSET_EBCDIC | ||
| 79 | #include <openssl/ebcdic.h> | ||
| 80 | #endif | ||
| 81 | |||
| 82 | static char *bf_key[2]={ | ||
| 83 | "abcdefghijklmnopqrstuvwxyz", | ||
| 84 | "Who is John Galt?" | ||
| 85 | }; | ||
| 86 | |||
| 87 | /* big endian */ | ||
| 88 | static BF_LONG bf_plain[2][2]={ | ||
| 89 | {0x424c4f57L,0x46495348L}, | ||
| 90 | {0xfedcba98L,0x76543210L} | ||
| 91 | }; | ||
| 92 | |||
| 93 | static BF_LONG bf_cipher[2][2]={ | ||
| 94 | {0x324ed0feL,0xf413a203L}, | ||
| 95 | {0xcc91732bL,0x8022f684L} | ||
| 96 | }; | ||
| 97 | /************/ | ||
| 98 | |||
| 99 | /* Lets use the DES test vectors :-) */ | ||
| 100 | #define NUM_TESTS 34 | ||
| 101 | static unsigned char ecb_data[NUM_TESTS][8]={ | ||
| 102 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 103 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 104 | {0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 105 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 106 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 107 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 108 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 109 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}, | ||
| 110 | {0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57}, | ||
| 111 | {0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E}, | ||
| 112 | {0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86}, | ||
| 113 | {0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E}, | ||
| 114 | {0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6}, | ||
| 115 | {0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE}, | ||
| 116 | {0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6}, | ||
| 117 | {0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE}, | ||
| 118 | {0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16}, | ||
| 119 | {0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F}, | ||
| 120 | {0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46}, | ||
| 121 | {0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E}, | ||
| 122 | {0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76}, | ||
| 123 | {0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07}, | ||
| 124 | {0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F}, | ||
| 125 | {0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7}, | ||
| 126 | {0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF}, | ||
| 127 | {0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6}, | ||
| 128 | {0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF}, | ||
| 129 | {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, | ||
| 130 | {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E}, | ||
| 131 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, | ||
| 132 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 133 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 134 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 135 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}}; | ||
| 136 | |||
| 137 | static unsigned char plain_data[NUM_TESTS][8]={ | ||
| 138 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 139 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 140 | {0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, | ||
| 141 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 142 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 143 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 144 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 145 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 146 | {0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42}, | ||
| 147 | {0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA}, | ||
| 148 | {0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72}, | ||
| 149 | {0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A}, | ||
| 150 | {0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2}, | ||
| 151 | {0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A}, | ||
| 152 | {0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2}, | ||
| 153 | {0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A}, | ||
| 154 | {0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02}, | ||
| 155 | {0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A}, | ||
| 156 | {0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32}, | ||
| 157 | {0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA}, | ||
| 158 | {0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62}, | ||
| 159 | {0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2}, | ||
| 160 | {0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA}, | ||
| 161 | {0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92}, | ||
| 162 | {0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A}, | ||
| 163 | {0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2}, | ||
| 164 | {0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A}, | ||
| 165 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 166 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 167 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 168 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 169 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 170 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 171 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}; | ||
| 172 | |||
| 173 | static unsigned char cipher_data[NUM_TESTS][8]={ | ||
| 174 | {0x4E,0xF9,0x97,0x45,0x61,0x98,0xDD,0x78}, | ||
| 175 | {0x51,0x86,0x6F,0xD5,0xB8,0x5E,0xCB,0x8A}, | ||
| 176 | {0x7D,0x85,0x6F,0x9A,0x61,0x30,0x63,0xF2}, | ||
| 177 | {0x24,0x66,0xDD,0x87,0x8B,0x96,0x3C,0x9D}, | ||
| 178 | {0x61,0xF9,0xC3,0x80,0x22,0x81,0xB0,0x96}, | ||
| 179 | {0x7D,0x0C,0xC6,0x30,0xAF,0xDA,0x1E,0xC7}, | ||
| 180 | {0x4E,0xF9,0x97,0x45,0x61,0x98,0xDD,0x78}, | ||
| 181 | {0x0A,0xCE,0xAB,0x0F,0xC6,0xA0,0xA2,0x8D}, | ||
| 182 | {0x59,0xC6,0x82,0x45,0xEB,0x05,0x28,0x2B}, | ||
| 183 | {0xB1,0xB8,0xCC,0x0B,0x25,0x0F,0x09,0xA0}, | ||
| 184 | {0x17,0x30,0xE5,0x77,0x8B,0xEA,0x1D,0xA4}, | ||
| 185 | {0xA2,0x5E,0x78,0x56,0xCF,0x26,0x51,0xEB}, | ||
| 186 | {0x35,0x38,0x82,0xB1,0x09,0xCE,0x8F,0x1A}, | ||
| 187 | {0x48,0xF4,0xD0,0x88,0x4C,0x37,0x99,0x18}, | ||
| 188 | {0x43,0x21,0x93,0xB7,0x89,0x51,0xFC,0x98}, | ||
| 189 | {0x13,0xF0,0x41,0x54,0xD6,0x9D,0x1A,0xE5}, | ||
| 190 | {0x2E,0xED,0xDA,0x93,0xFF,0xD3,0x9C,0x79}, | ||
| 191 | {0xD8,0x87,0xE0,0x39,0x3C,0x2D,0xA6,0xE3}, | ||
| 192 | {0x5F,0x99,0xD0,0x4F,0x5B,0x16,0x39,0x69}, | ||
| 193 | {0x4A,0x05,0x7A,0x3B,0x24,0xD3,0x97,0x7B}, | ||
| 194 | {0x45,0x20,0x31,0xC1,0xE4,0xFA,0xDA,0x8E}, | ||
| 195 | {0x75,0x55,0xAE,0x39,0xF5,0x9B,0x87,0xBD}, | ||
| 196 | {0x53,0xC5,0x5F,0x9C,0xB4,0x9F,0xC0,0x19}, | ||
| 197 | {0x7A,0x8E,0x7B,0xFA,0x93,0x7E,0x89,0xA3}, | ||
| 198 | {0xCF,0x9C,0x5D,0x7A,0x49,0x86,0xAD,0xB5}, | ||
| 199 | {0xD1,0xAB,0xB2,0x90,0x65,0x8B,0xC7,0x78}, | ||
| 200 | {0x55,0xCB,0x37,0x74,0xD1,0x3E,0xF2,0x01}, | ||
| 201 | {0xFA,0x34,0xEC,0x48,0x47,0xB2,0x68,0xB2}, | ||
| 202 | {0xA7,0x90,0x79,0x51,0x08,0xEA,0x3C,0xAE}, | ||
| 203 | {0xC3,0x9E,0x07,0x2D,0x9F,0xAC,0x63,0x1D}, | ||
| 204 | {0x01,0x49,0x33,0xE0,0xCD,0xAF,0xF6,0xE4}, | ||
| 205 | {0xF2,0x1E,0x9A,0x77,0xB7,0x1C,0x49,0xBC}, | ||
| 206 | {0x24,0x59,0x46,0x88,0x57,0x54,0x36,0x9A}, | ||
| 207 | {0x6B,0x5C,0x5A,0x9C,0x5D,0x9E,0x0A,0x5A}, | ||
| 208 | }; | ||
| 209 | |||
| 210 | static unsigned char cbc_key [16]={ | ||
| 211 | 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, | ||
| 212 | 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87}; | ||
| 213 | static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; | ||
| 214 | static char cbc_data[40]="7654321 Now is the time for "; | ||
| 215 | static unsigned char cbc_ok[32]={ | ||
| 216 | 0x6B,0x77,0xB4,0xD6,0x30,0x06,0xDE,0xE6, | ||
| 217 | 0x05,0xB1,0x56,0xE2,0x74,0x03,0x97,0x93, | ||
| 218 | 0x58,0xDE,0xB9,0xE7,0x15,0x46,0x16,0xD9, | ||
| 219 | 0x59,0xF1,0x65,0x2B,0xD5,0xFF,0x92,0xCC}; | ||
| 220 | |||
| 221 | static unsigned char cfb64_ok[]={ | ||
| 222 | 0xE7,0x32,0x14,0xA2,0x82,0x21,0x39,0xCA, | ||
| 223 | 0xF2,0x6E,0xCF,0x6D,0x2E,0xB9,0xE7,0x6E, | ||
| 224 | 0x3D,0xA3,0xDE,0x04,0xD1,0x51,0x72,0x00, | ||
| 225 | 0x51,0x9D,0x57,0xA6,0xC3}; | ||
| 226 | |||
| 227 | static unsigned char ofb64_ok[]={ | ||
| 228 | 0xE7,0x32,0x14,0xA2,0x82,0x21,0x39,0xCA, | ||
| 229 | 0x62,0xB3,0x43,0xCC,0x5B,0x65,0x58,0x73, | ||
| 230 | 0x10,0xDD,0x90,0x8D,0x0C,0x24,0x1B,0x22, | ||
| 231 | 0x63,0xC2,0xCF,0x80,0xDA}; | ||
| 232 | |||
| 233 | #define KEY_TEST_NUM 25 | ||
| 234 | static unsigned char key_test[KEY_TEST_NUM]={ | ||
| 235 | 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87, | ||
| 236 | 0x78,0x69,0x5a,0x4b,0x3c,0x2d,0x1e,0x0f, | ||
| 237 | 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, | ||
| 238 | 0x88}; | ||
| 239 | |||
| 240 | static unsigned char key_data[8]= | ||
| 241 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}; | ||
| 242 | |||
| 243 | static unsigned char key_out[KEY_TEST_NUM][8]={ | ||
| 244 | {0xF9,0xAD,0x59,0x7C,0x49,0xDB,0x00,0x5E}, | ||
| 245 | {0xE9,0x1D,0x21,0xC1,0xD9,0x61,0xA6,0xD6}, | ||
| 246 | {0xE9,0xC2,0xB7,0x0A,0x1B,0xC6,0x5C,0xF3}, | ||
| 247 | {0xBE,0x1E,0x63,0x94,0x08,0x64,0x0F,0x05}, | ||
| 248 | {0xB3,0x9E,0x44,0x48,0x1B,0xDB,0x1E,0x6E}, | ||
| 249 | {0x94,0x57,0xAA,0x83,0xB1,0x92,0x8C,0x0D}, | ||
| 250 | {0x8B,0xB7,0x70,0x32,0xF9,0x60,0x62,0x9D}, | ||
| 251 | {0xE8,0x7A,0x24,0x4E,0x2C,0xC8,0x5E,0x82}, | ||
| 252 | {0x15,0x75,0x0E,0x7A,0x4F,0x4E,0xC5,0x77}, | ||
| 253 | {0x12,0x2B,0xA7,0x0B,0x3A,0xB6,0x4A,0xE0}, | ||
| 254 | {0x3A,0x83,0x3C,0x9A,0xFF,0xC5,0x37,0xF6}, | ||
| 255 | {0x94,0x09,0xDA,0x87,0xA9,0x0F,0x6B,0xF2}, | ||
| 256 | {0x88,0x4F,0x80,0x62,0x50,0x60,0xB8,0xB4}, | ||
| 257 | {0x1F,0x85,0x03,0x1C,0x19,0xE1,0x19,0x68}, | ||
| 258 | {0x79,0xD9,0x37,0x3A,0x71,0x4C,0xA3,0x4F}, | ||
| 259 | {0x93,0x14,0x28,0x87,0xEE,0x3B,0xE1,0x5C}, | ||
| 260 | {0x03,0x42,0x9E,0x83,0x8C,0xE2,0xD1,0x4B}, | ||
| 261 | {0xA4,0x29,0x9E,0x27,0x46,0x9F,0xF6,0x7B}, | ||
| 262 | {0xAF,0xD5,0xAE,0xD1,0xC1,0xBC,0x96,0xA8}, | ||
| 263 | {0x10,0x85,0x1C,0x0E,0x38,0x58,0xDA,0x9F}, | ||
| 264 | {0xE6,0xF5,0x1E,0xD7,0x9B,0x9D,0xB2,0x1F}, | ||
| 265 | {0x64,0xA6,0xE1,0x4A,0xFD,0x36,0xB4,0x6F}, | ||
| 266 | {0x80,0xC7,0xD7,0xD4,0x5A,0x54,0x79,0xAD}, | ||
| 267 | {0x05,0x04,0x4B,0x62,0xFA,0x52,0xD0,0x80}, | ||
| 268 | }; | ||
| 269 | |||
| 270 | static int test(void ); | ||
| 271 | static int print_test_data(void ); | ||
| 272 | int main(int argc, char *argv[]) | ||
| 273 | { | ||
| 274 | int ret; | ||
| 275 | |||
| 276 | if (argc > 1) | ||
| 277 | ret=print_test_data(); | ||
| 278 | else | ||
| 279 | ret=test(); | ||
| 280 | |||
| 281 | #ifdef OPENSSL_SYS_NETWARE | ||
| 282 | if (ret) printf("ERROR: %d\n", ret); | ||
| 283 | #endif | ||
| 284 | EXIT(ret); | ||
| 285 | return(0); | ||
| 286 | } | ||
| 287 | |||
| 288 | static int print_test_data(void) | ||
| 289 | { | ||
| 290 | unsigned int i,j; | ||
| 291 | |||
| 292 | printf("ecb test data\n"); | ||
| 293 | printf("key bytes\t\tclear bytes\t\tcipher bytes\n"); | ||
| 294 | for (i=0; i<NUM_TESTS; i++) | ||
| 295 | { | ||
| 296 | for (j=0; j<8; j++) | ||
| 297 | printf("%02X",ecb_data[i][j]); | ||
| 298 | printf("\t"); | ||
| 299 | for (j=0; j<8; j++) | ||
| 300 | printf("%02X",plain_data[i][j]); | ||
| 301 | printf("\t"); | ||
| 302 | for (j=0; j<8; j++) | ||
| 303 | printf("%02X",cipher_data[i][j]); | ||
| 304 | printf("\n"); | ||
| 305 | } | ||
| 306 | |||
| 307 | printf("set_key test data\n"); | ||
| 308 | printf("data[8]= "); | ||
| 309 | for (j=0; j<8; j++) | ||
| 310 | printf("%02X",key_data[j]); | ||
| 311 | printf("\n"); | ||
| 312 | for (i=0; i<KEY_TEST_NUM-1; i++) | ||
| 313 | { | ||
| 314 | printf("c="); | ||
| 315 | for (j=0; j<8; j++) | ||
| 316 | printf("%02X",key_out[i][j]); | ||
| 317 | printf(" k[%2u]=",i+1); | ||
| 318 | for (j=0; j<i+1; j++) | ||
| 319 | printf("%02X",key_test[j]); | ||
| 320 | printf("\n"); | ||
| 321 | } | ||
| 322 | |||
| 323 | printf("\nchaining mode test data\n"); | ||
| 324 | printf("key[16] = "); | ||
| 325 | for (j=0; j<16; j++) | ||
| 326 | printf("%02X",cbc_key[j]); | ||
| 327 | printf("\niv[8] = "); | ||
| 328 | for (j=0; j<8; j++) | ||
| 329 | printf("%02X",cbc_iv[j]); | ||
| 330 | printf("\ndata[%d] = '%s'",(int)strlen(cbc_data)+1,cbc_data); | ||
| 331 | printf("\ndata[%d] = ",(int)strlen(cbc_data)+1); | ||
| 332 | for (j=0; j<strlen(cbc_data)+1; j++) | ||
| 333 | printf("%02X",cbc_data[j]); | ||
| 334 | printf("\n"); | ||
| 335 | printf("cbc cipher text\n"); | ||
| 336 | printf("cipher[%d]= ",32); | ||
| 337 | for (j=0; j<32; j++) | ||
| 338 | printf("%02X",cbc_ok[j]); | ||
| 339 | printf("\n"); | ||
| 340 | |||
| 341 | printf("cfb64 cipher text\n"); | ||
| 342 | printf("cipher[%d]= ",(int)strlen(cbc_data)+1); | ||
| 343 | for (j=0; j<strlen(cbc_data)+1; j++) | ||
| 344 | printf("%02X",cfb64_ok[j]); | ||
| 345 | printf("\n"); | ||
| 346 | |||
| 347 | printf("ofb64 cipher text\n"); | ||
| 348 | printf("cipher[%d]= ",(int)strlen(cbc_data)+1); | ||
| 349 | for (j=0; j<strlen(cbc_data)+1; j++) | ||
| 350 | printf("%02X",ofb64_ok[j]); | ||
| 351 | printf("\n"); | ||
| 352 | return(0); | ||
| 353 | } | ||
| 354 | |||
| 355 | static int test(void) | ||
| 356 | { | ||
| 357 | unsigned char cbc_in[40],cbc_out[40],iv[8]; | ||
| 358 | int i,n,err=0; | ||
| 359 | BF_KEY key; | ||
| 360 | BF_LONG data[2]; | ||
| 361 | unsigned char out[8]; | ||
| 362 | BF_LONG len; | ||
| 363 | |||
| 364 | #ifdef CHARSET_EBCDIC | ||
| 365 | ebcdic2ascii(cbc_data, cbc_data, strlen(cbc_data)); | ||
| 366 | #endif | ||
| 367 | |||
| 368 | printf("testing blowfish in raw ecb mode\n"); | ||
| 369 | for (n=0; n<2; n++) | ||
| 370 | { | ||
| 371 | #ifdef CHARSET_EBCDIC | ||
| 372 | ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n])); | ||
| 373 | #endif | ||
| 374 | BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]); | ||
| 375 | |||
| 376 | data[0]=bf_plain[n][0]; | ||
| 377 | data[1]=bf_plain[n][1]; | ||
| 378 | BF_encrypt(data,&key); | ||
| 379 | if (memcmp(&(bf_cipher[n][0]),&(data[0]),8) != 0) | ||
| 380 | { | ||
| 381 | printf("BF_encrypt error encrypting\n"); | ||
| 382 | printf("got :"); | ||
| 383 | for (i=0; i<2; i++) | ||
| 384 | printf("%08lX ",(unsigned long)data[i]); | ||
| 385 | printf("\n"); | ||
| 386 | printf("expected:"); | ||
| 387 | for (i=0; i<2; i++) | ||
| 388 | printf("%08lX ",(unsigned long)bf_cipher[n][i]); | ||
| 389 | err=1; | ||
| 390 | printf("\n"); | ||
| 391 | } | ||
| 392 | |||
| 393 | BF_decrypt(&(data[0]),&key); | ||
| 394 | if (memcmp(&(bf_plain[n][0]),&(data[0]),8) != 0) | ||
| 395 | { | ||
| 396 | printf("BF_encrypt error decrypting\n"); | ||
| 397 | printf("got :"); | ||
| 398 | for (i=0; i<2; i++) | ||
| 399 | printf("%08lX ",(unsigned long)data[i]); | ||
| 400 | printf("\n"); | ||
| 401 | printf("expected:"); | ||
| 402 | for (i=0; i<2; i++) | ||
| 403 | printf("%08lX ",(unsigned long)bf_plain[n][i]); | ||
| 404 | printf("\n"); | ||
| 405 | err=1; | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | printf("testing blowfish in ecb mode\n"); | ||
| 410 | |||
| 411 | for (n=0; n<NUM_TESTS; n++) | ||
| 412 | { | ||
| 413 | BF_set_key(&key,8,ecb_data[n]); | ||
| 414 | |||
| 415 | BF_ecb_encrypt(&(plain_data[n][0]),out,&key,BF_ENCRYPT); | ||
| 416 | if (memcmp(&(cipher_data[n][0]),out,8) != 0) | ||
| 417 | { | ||
| 418 | printf("BF_ecb_encrypt blowfish error encrypting\n"); | ||
| 419 | printf("got :"); | ||
| 420 | for (i=0; i<8; i++) | ||
| 421 | printf("%02X ",out[i]); | ||
| 422 | printf("\n"); | ||
| 423 | printf("expected:"); | ||
| 424 | for (i=0; i<8; i++) | ||
| 425 | printf("%02X ",cipher_data[n][i]); | ||
| 426 | err=1; | ||
| 427 | printf("\n"); | ||
| 428 | } | ||
| 429 | |||
| 430 | BF_ecb_encrypt(out,out,&key,BF_DECRYPT); | ||
| 431 | if (memcmp(&(plain_data[n][0]),out,8) != 0) | ||
| 432 | { | ||
| 433 | printf("BF_ecb_encrypt error decrypting\n"); | ||
| 434 | printf("got :"); | ||
| 435 | for (i=0; i<8; i++) | ||
| 436 | printf("%02X ",out[i]); | ||
| 437 | printf("\n"); | ||
| 438 | printf("expected:"); | ||
| 439 | for (i=0; i<8; i++) | ||
| 440 | printf("%02X ",plain_data[n][i]); | ||
| 441 | printf("\n"); | ||
| 442 | err=1; | ||
| 443 | } | ||
| 444 | } | ||
| 445 | |||
| 446 | printf("testing blowfish set_key\n"); | ||
| 447 | for (n=1; n<KEY_TEST_NUM; n++) | ||
| 448 | { | ||
| 449 | BF_set_key(&key,n,key_test); | ||
| 450 | BF_ecb_encrypt(key_data,out,&key,BF_ENCRYPT); | ||
| 451 | /* mips-sgi-irix6.5-gcc vv -mabi=64 bug workaround */ | ||
| 452 | if (memcmp(out,&(key_out[i=n-1][0]),8) != 0) | ||
| 453 | { | ||
| 454 | printf("blowfish setkey error\n"); | ||
| 455 | err=1; | ||
| 456 | } | ||
| 457 | } | ||
| 458 | |||
| 459 | printf("testing blowfish in cbc mode\n"); | ||
| 460 | len=strlen(cbc_data)+1; | ||
| 461 | |||
| 462 | BF_set_key(&key,16,cbc_key); | ||
| 463 | memset(cbc_in,0,sizeof cbc_in); | ||
| 464 | memset(cbc_out,0,sizeof cbc_out); | ||
| 465 | memcpy(iv,cbc_iv,sizeof iv); | ||
| 466 | BF_cbc_encrypt((unsigned char *)cbc_data,cbc_out,len, | ||
| 467 | &key,iv,BF_ENCRYPT); | ||
| 468 | if (memcmp(cbc_out,cbc_ok,32) != 0) | ||
| 469 | { | ||
| 470 | err=1; | ||
| 471 | printf("BF_cbc_encrypt encrypt error\n"); | ||
| 472 | for (i=0; i<32; i++) printf("0x%02X,",cbc_out[i]); | ||
| 473 | } | ||
| 474 | memcpy(iv,cbc_iv,8); | ||
| 475 | BF_cbc_encrypt(cbc_out,cbc_in,len, | ||
| 476 | &key,iv,BF_DECRYPT); | ||
| 477 | if (memcmp(cbc_in,cbc_data,strlen(cbc_data)+1) != 0) | ||
| 478 | { | ||
| 479 | printf("BF_cbc_encrypt decrypt error\n"); | ||
| 480 | err=1; | ||
| 481 | } | ||
| 482 | |||
| 483 | printf("testing blowfish in cfb64 mode\n"); | ||
| 484 | |||
| 485 | BF_set_key(&key,16,cbc_key); | ||
| 486 | memset(cbc_in,0,40); | ||
| 487 | memset(cbc_out,0,40); | ||
| 488 | memcpy(iv,cbc_iv,8); | ||
| 489 | n=0; | ||
| 490 | BF_cfb64_encrypt((unsigned char *)cbc_data,cbc_out,(long)13, | ||
| 491 | &key,iv,&n,BF_ENCRYPT); | ||
| 492 | BF_cfb64_encrypt((unsigned char *)&(cbc_data[13]),&(cbc_out[13]),len-13, | ||
| 493 | &key,iv,&n,BF_ENCRYPT); | ||
| 494 | if (memcmp(cbc_out,cfb64_ok,(int)len) != 0) | ||
| 495 | { | ||
| 496 | err=1; | ||
| 497 | printf("BF_cfb64_encrypt encrypt error\n"); | ||
| 498 | for (i=0; i<(int)len; i++) printf("0x%02X,",cbc_out[i]); | ||
| 499 | } | ||
| 500 | n=0; | ||
| 501 | memcpy(iv,cbc_iv,8); | ||
| 502 | BF_cfb64_encrypt(cbc_out,cbc_in,17, | ||
| 503 | &key,iv,&n,BF_DECRYPT); | ||
| 504 | BF_cfb64_encrypt(&(cbc_out[17]),&(cbc_in[17]),len-17, | ||
| 505 | &key,iv,&n,BF_DECRYPT); | ||
| 506 | if (memcmp(cbc_in,cbc_data,(int)len) != 0) | ||
| 507 | { | ||
| 508 | printf("BF_cfb64_encrypt decrypt error\n"); | ||
| 509 | err=1; | ||
| 510 | } | ||
| 511 | |||
| 512 | printf("testing blowfish in ofb64\n"); | ||
| 513 | |||
| 514 | BF_set_key(&key,16,cbc_key); | ||
| 515 | memset(cbc_in,0,40); | ||
| 516 | memset(cbc_out,0,40); | ||
| 517 | memcpy(iv,cbc_iv,8); | ||
| 518 | n=0; | ||
| 519 | BF_ofb64_encrypt((unsigned char *)cbc_data,cbc_out,(long)13,&key,iv,&n); | ||
| 520 | BF_ofb64_encrypt((unsigned char *)&(cbc_data[13]), | ||
| 521 | &(cbc_out[13]),len-13,&key,iv,&n); | ||
| 522 | if (memcmp(cbc_out,ofb64_ok,(int)len) != 0) | ||
| 523 | { | ||
| 524 | err=1; | ||
| 525 | printf("BF_ofb64_encrypt encrypt error\n"); | ||
| 526 | for (i=0; i<(int)len; i++) printf("0x%02X,",cbc_out[i]); | ||
| 527 | } | ||
| 528 | n=0; | ||
| 529 | memcpy(iv,cbc_iv,8); | ||
| 530 | BF_ofb64_encrypt(cbc_out,cbc_in,17,&key,iv,&n); | ||
| 531 | BF_ofb64_encrypt(&(cbc_out[17]),&(cbc_in[17]),len-17,&key,iv,&n); | ||
| 532 | if (memcmp(cbc_in,cbc_data,(int)len) != 0) | ||
| 533 | { | ||
| 534 | printf("BF_ofb64_encrypt decrypt error\n"); | ||
| 535 | err=1; | ||
| 536 | } | ||
| 537 | |||
| 538 | return(err); | ||
| 539 | } | ||
| 540 | #endif | ||
diff --git a/src/lib/libcrypto/bio/Makefile b/src/lib/libcrypto/bio/Makefile new file mode 100644 index 0000000000..c395d80496 --- /dev/null +++ b/src/lib/libcrypto/bio/Makefile | |||
| @@ -0,0 +1,222 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/bio/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= bio | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= bio_lib.c bio_cb.c bio_err.c \ | ||
| 21 | bss_mem.c bss_null.c bss_fd.c \ | ||
| 22 | bss_file.c bss_sock.c bss_conn.c \ | ||
| 23 | bf_null.c bf_buff.c b_print.c b_dump.c \ | ||
| 24 | b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c \ | ||
| 25 | bss_dgram.c | ||
| 26 | # bf_lbuf.c | ||
| 27 | LIBOBJ= bio_lib.o bio_cb.o bio_err.o \ | ||
| 28 | bss_mem.o bss_null.o bss_fd.o \ | ||
| 29 | bss_file.o bss_sock.o bss_conn.o \ | ||
| 30 | bf_null.o bf_buff.o b_print.o b_dump.o \ | ||
| 31 | b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o \ | ||
| 32 | bss_dgram.o | ||
| 33 | # bf_lbuf.o | ||
| 34 | |||
| 35 | SRC= $(LIBSRC) | ||
| 36 | |||
| 37 | EXHEADER= bio.h | ||
| 38 | HEADER= bio_lcl.h $(EXHEADER) | ||
| 39 | |||
| 40 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 41 | |||
| 42 | top: | ||
| 43 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 44 | |||
| 45 | all: lib | ||
| 46 | |||
| 47 | lib: $(LIBOBJ) | ||
| 48 | $(AR) $(LIB) $(LIBOBJ) | ||
| 49 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 50 | @touch lib | ||
| 51 | |||
| 52 | files: | ||
| 53 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 54 | |||
| 55 | links: | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 59 | |||
| 60 | install: | ||
| 61 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 62 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
| 63 | do \ | ||
| 64 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 65 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 66 | done; | ||
| 67 | |||
| 68 | tags: | ||
| 69 | ctags $(SRC) | ||
| 70 | |||
| 71 | tests: | ||
| 72 | |||
| 73 | lint: | ||
| 74 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 75 | |||
| 76 | depend: | ||
| 77 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 78 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 79 | |||
| 80 | dclean: | ||
| 81 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 82 | mv -f Makefile.new $(MAKEFILE) | ||
| 83 | |||
| 84 | clean: | ||
| 85 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 86 | |||
| 87 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 88 | |||
| 89 | b_dump.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 90 | b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 91 | b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 92 | b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 93 | b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 94 | b_dump.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 95 | b_dump.o: ../../include/openssl/symhacks.h ../cryptlib.h b_dump.c bio_lcl.h | ||
| 96 | b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 97 | b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 98 | b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 99 | b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 100 | b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 101 | b_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 102 | b_print.o: ../../include/openssl/symhacks.h ../cryptlib.h b_print.c | ||
| 103 | b_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 104 | b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 105 | b_sock.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 106 | b_sock.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 107 | b_sock.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 108 | b_sock.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 109 | b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 110 | b_sock.o: ../cryptlib.h b_sock.c | ||
| 111 | bf_buff.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 112 | bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 113 | bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 114 | bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 115 | bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 116 | bf_buff.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 117 | bf_buff.o: ../../include/openssl/symhacks.h ../cryptlib.h bf_buff.c | ||
| 118 | bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 119 | bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 120 | bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 121 | bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 122 | bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 123 | bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 124 | bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 125 | bf_nbio.o: ../cryptlib.h bf_nbio.c | ||
| 126 | bf_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 127 | bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 128 | bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 129 | bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 130 | bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 131 | bf_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 132 | bf_null.o: ../../include/openssl/symhacks.h ../cryptlib.h bf_null.c | ||
| 133 | bio_cb.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 134 | bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 135 | bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 136 | bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 137 | bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 138 | bio_cb.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 139 | bio_cb.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_cb.c | ||
| 140 | bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 141 | bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 142 | bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 143 | bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 144 | bio_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 145 | bio_err.o: ../../include/openssl/symhacks.h bio_err.c | ||
| 146 | bio_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 147 | bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 148 | bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 149 | bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 150 | bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 151 | bio_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 152 | bio_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lib.c | ||
| 153 | bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 154 | bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 155 | bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 156 | bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 157 | bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 158 | bss_acpt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 159 | bss_acpt.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_acpt.c | ||
| 160 | bss_bio.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 161 | bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 162 | bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 163 | bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 164 | bss_bio.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 165 | bss_bio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 166 | bss_bio.o: bss_bio.c | ||
| 167 | bss_conn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 168 | bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 169 | bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 170 | bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 171 | bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 172 | bss_conn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 173 | bss_conn.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_conn.c | ||
| 174 | bss_dgram.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 175 | bss_dgram.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 176 | bss_dgram.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 177 | bss_dgram.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 178 | bss_dgram.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 179 | bss_dgram.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 180 | bss_dgram.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_dgram.c | ||
| 181 | bss_fd.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 182 | bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 183 | bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 184 | bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 185 | bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 186 | bss_fd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 187 | bss_fd.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lcl.h bss_fd.c | ||
| 188 | bss_file.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 189 | bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 190 | bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 191 | bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 192 | bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 193 | bss_file.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 194 | bss_file.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_lcl.h bss_file.c | ||
| 195 | bss_log.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 196 | bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 197 | bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 198 | bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 199 | bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 200 | bss_log.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 201 | bss_log.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_log.c | ||
| 202 | bss_mem.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 203 | bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 204 | bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 205 | bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 206 | bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 207 | bss_mem.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 208 | bss_mem.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_mem.c | ||
| 209 | bss_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 210 | bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 211 | bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 212 | bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 213 | bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 214 | bss_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 215 | bss_null.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_null.c | ||
| 216 | bss_sock.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 217 | bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 218 | bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 219 | bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 220 | bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 221 | bss_sock.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 222 | bss_sock.o: ../../include/openssl/symhacks.h ../cryptlib.h bss_sock.c | ||
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c index d47310d650..12b0a53a81 100644 --- a/src/lib/libcrypto/bio/b_sock.c +++ b/src/lib/libcrypto/bio/b_sock.c | |||
| @@ -551,30 +551,7 @@ int BIO_socket_ioctl(int fd, long type, void *arg) | |||
| 551 | #ifdef __DJGPP__ | 551 | #ifdef __DJGPP__ |
| 552 | i=ioctlsocket(fd,type,(char *)arg); | 552 | i=ioctlsocket(fd,type,(char *)arg); |
| 553 | #else | 553 | #else |
| 554 | # if defined(OPENSSL_SYS_VMS) | 554 | i=ioctlsocket(fd,type,arg); |
| 555 | /* 2011-02-18 SMS. | ||
| 556 | * VMS ioctl() can't tolerate a 64-bit "void *arg", but we | ||
| 557 | * observe that all the consumers pass in an "unsigned long *", | ||
| 558 | * so we arrange a local copy with a short pointer, and use | ||
| 559 | * that, instead. | ||
| 560 | */ | ||
| 561 | # if __INITIAL_POINTER_SIZE == 64 | ||
| 562 | # define ARG arg_32p | ||
| 563 | # pragma pointer_size save | ||
| 564 | # pragma pointer_size 32 | ||
| 565 | unsigned long arg_32; | ||
| 566 | unsigned long *arg_32p; | ||
| 567 | # pragma pointer_size restore | ||
| 568 | arg_32p = &arg_32; | ||
| 569 | arg_32 = *((unsigned long *) arg); | ||
| 570 | # else /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 571 | # define ARG arg | ||
| 572 | # endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
| 573 | # else /* defined(OPENSSL_SYS_VMS) */ | ||
| 574 | # define ARG arg | ||
| 575 | # endif /* defined(OPENSSL_SYS_VMS) [else] */ | ||
| 576 | |||
| 577 | i=ioctlsocket(fd,type,ARG); | ||
| 578 | #endif /* __DJGPP__ */ | 555 | #endif /* __DJGPP__ */ |
| 579 | if (i < 0) | 556 | if (i < 0) |
| 580 | SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error()); | 557 | SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error()); |
| @@ -683,7 +660,6 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
| 683 | * note that commonly IPv6 wildchard socket can service | 660 | * note that commonly IPv6 wildchard socket can service |
| 684 | * IPv4 connections just as well... */ | 661 | * IPv4 connections just as well... */ |
| 685 | memset(&hint,0,sizeof(hint)); | 662 | memset(&hint,0,sizeof(hint)); |
| 686 | hint.ai_flags = AI_PASSIVE; | ||
| 687 | if (h) | 663 | if (h) |
| 688 | { | 664 | { |
| 689 | if (strchr(h,':')) | 665 | if (strchr(h,':')) |
| @@ -696,10 +672,7 @@ int BIO_get_accept_socket(char *host, int bind_mode) | |||
| 696 | #endif | 672 | #endif |
| 697 | } | 673 | } |
| 698 | else if (h[0]=='*' && h[1]=='\0') | 674 | else if (h[0]=='*' && h[1]=='\0') |
| 699 | { | ||
| 700 | hint.ai_family = AF_INET; | ||
| 701 | h=NULL; | 675 | h=NULL; |
| 702 | } | ||
| 703 | } | 676 | } |
| 704 | 677 | ||
| 705 | if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break; | 678 | if ((*p_getaddrinfo.f)(h,p,&hint,&res)) break; |
diff --git a/src/lib/libcrypto/bio/bf_nbio.c b/src/lib/libcrypto/bio/bf_nbio.c index 028616c064..c72a23c2e1 100644 --- a/src/lib/libcrypto/bio/bf_nbio.c +++ b/src/lib/libcrypto/bio/bf_nbio.c | |||
| @@ -125,6 +125,7 @@ static int nbiof_free(BIO *a) | |||
| 125 | 125 | ||
| 126 | static int nbiof_read(BIO *b, char *out, int outl) | 126 | static int nbiof_read(BIO *b, char *out, int outl) |
| 127 | { | 127 | { |
| 128 | NBIO_TEST *nt; | ||
| 128 | int ret=0; | 129 | int ret=0; |
| 129 | #if 1 | 130 | #if 1 |
| 130 | int num; | 131 | int num; |
| @@ -133,6 +134,7 @@ static int nbiof_read(BIO *b, char *out, int outl) | |||
| 133 | 134 | ||
| 134 | if (out == NULL) return(0); | 135 | if (out == NULL) return(0); |
| 135 | if (b->next_bio == NULL) return(0); | 136 | if (b->next_bio == NULL) return(0); |
| 137 | nt=(NBIO_TEST *)b->ptr; | ||
| 136 | 138 | ||
| 137 | BIO_clear_retry_flags(b); | 139 | BIO_clear_retry_flags(b); |
| 138 | #if 1 | 140 | #if 1 |
diff --git a/src/lib/libcrypto/bio/bio_lcl.h b/src/lib/libcrypto/bio/bio_lcl.h new file mode 100644 index 0000000000..e7f7ec8d8b --- /dev/null +++ b/src/lib/libcrypto/bio/bio_lcl.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | #include <openssl/bio.h> | ||
| 2 | |||
| 3 | #if BIO_FLAGS_UPLINK==0 | ||
| 4 | /* Shortcut UPLINK calls on most platforms... */ | ||
| 5 | #define UP_stdin stdin | ||
| 6 | #define UP_stdout stdout | ||
| 7 | #define UP_stderr stderr | ||
| 8 | #define UP_fprintf fprintf | ||
| 9 | #define UP_fgets fgets | ||
| 10 | #define UP_fread fread | ||
| 11 | #define UP_fwrite fwrite | ||
| 12 | #undef UP_fsetmod | ||
| 13 | #define UP_feof feof | ||
| 14 | #define UP_fclose fclose | ||
| 15 | |||
| 16 | #define UP_fopen fopen | ||
| 17 | #define UP_fseek fseek | ||
| 18 | #define UP_ftell ftell | ||
| 19 | #define UP_fflush fflush | ||
| 20 | #define UP_ferror ferror | ||
| 21 | #ifdef _WIN32 | ||
| 22 | #define UP_fileno _fileno | ||
| 23 | #define UP_open _open | ||
| 24 | #define UP_read _read | ||
| 25 | #define UP_write _write | ||
| 26 | #define UP_lseek _lseek | ||
| 27 | #define UP_close _close | ||
| 28 | #else | ||
| 29 | #define UP_fileno fileno | ||
| 30 | #define UP_open open | ||
| 31 | #define UP_read read | ||
| 32 | #define UP_write write | ||
| 33 | #define UP_lseek lseek | ||
| 34 | #define UP_close close | ||
| 35 | #endif | ||
| 36 | #endif | ||
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index e12bc3a2ca..77f4de9c32 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
| @@ -110,7 +110,7 @@ int BIO_set(BIO *bio, BIO_METHOD *method) | |||
| 110 | 110 | ||
| 111 | int BIO_free(BIO *a) | 111 | int BIO_free(BIO *a) |
| 112 | { | 112 | { |
| 113 | int i; | 113 | int ret=0,i; |
| 114 | 114 | ||
| 115 | if (a == NULL) return(0); | 115 | if (a == NULL) return(0); |
| 116 | 116 | ||
| @@ -133,7 +133,7 @@ int BIO_free(BIO *a) | |||
| 133 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); | 133 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data); |
| 134 | 134 | ||
| 135 | if ((a->method == NULL) || (a->method->destroy == NULL)) return(1); | 135 | if ((a->method == NULL) || (a->method->destroy == NULL)) return(1); |
| 136 | a->method->destroy(a); | 136 | ret=a->method->destroy(a); |
| 137 | OPENSSL_free(a); | 137 | OPENSSL_free(a); |
| 138 | return(1); | 138 | return(1); |
| 139 | } | 139 | } |
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index 5d49e1a72b..826f761143 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
| @@ -340,6 +340,7 @@ static int acpt_write(BIO *b, const char *in, int inl) | |||
| 340 | 340 | ||
| 341 | static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) | 341 | static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) |
| 342 | { | 342 | { |
| 343 | BIO *dbio; | ||
| 343 | int *ip; | 344 | int *ip; |
| 344 | long ret=1; | 345 | long ret=1; |
| 345 | BIO_ACCEPT *data; | 346 | BIO_ACCEPT *data; |
| @@ -436,8 +437,8 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 436 | ret=(long)data->bind_mode; | 437 | ret=(long)data->bind_mode; |
| 437 | break; | 438 | break; |
| 438 | case BIO_CTRL_DUP: | 439 | case BIO_CTRL_DUP: |
| 439 | /* dbio=(BIO *)ptr; | 440 | dbio=(BIO *)ptr; |
| 440 | if (data->param_port) EAY EAY | 441 | /* if (data->param_port) EAY EAY |
| 441 | BIO_set_port(dbio,data->param_port); | 442 | BIO_set_port(dbio,data->param_port); |
| 442 | if (data->param_hostname) | 443 | if (data->param_hostname) |
| 443 | BIO_set_hostname(dbio,data->param_hostname); | 444 | BIO_set_hostname(dbio,data->param_hostname); |
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c index 71ebe987b6..eb7e365467 100644 --- a/src/lib/libcrypto/bio/bss_dgram.c +++ b/src/lib/libcrypto/bio/bss_dgram.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | * | 57 | * |
| 58 | */ | 58 | */ |
| 59 | 59 | ||
| 60 | #ifndef OPENSSL_NO_DGRAM | ||
| 60 | 61 | ||
| 61 | #include <stdio.h> | 62 | #include <stdio.h> |
| 62 | #include <errno.h> | 63 | #include <errno.h> |
| @@ -64,7 +65,6 @@ | |||
| 64 | #include "cryptlib.h" | 65 | #include "cryptlib.h" |
| 65 | 66 | ||
| 66 | #include <openssl/bio.h> | 67 | #include <openssl/bio.h> |
| 67 | #ifndef OPENSSL_NO_DGRAM | ||
| 68 | 68 | ||
| 69 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) | 69 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) |
| 70 | #include <sys/timeb.h> | 70 | #include <sys/timeb.h> |
| @@ -308,6 +308,7 @@ static int dgram_read(BIO *b, char *out, int outl) | |||
| 308 | OPENSSL_assert(sa.len.s<=sizeof(sa.peer)); | 308 | OPENSSL_assert(sa.len.s<=sizeof(sa.peer)); |
| 309 | sa.len.i = (int)sa.len.s; | 309 | sa.len.i = (int)sa.len.s; |
| 310 | } | 310 | } |
| 311 | dgram_reset_rcv_timeout(b); | ||
| 311 | 312 | ||
| 312 | if ( ! data->connected && ret >= 0) | 313 | if ( ! data->connected && ret >= 0) |
| 313 | BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &sa.peer); | 314 | BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, &sa.peer); |
| @@ -321,8 +322,6 @@ static int dgram_read(BIO *b, char *out, int outl) | |||
| 321 | data->_errno = get_last_socket_error(); | 322 | data->_errno = get_last_socket_error(); |
| 322 | } | 323 | } |
| 323 | } | 324 | } |
| 324 | |||
| 325 | dgram_reset_rcv_timeout(b); | ||
| 326 | } | 325 | } |
| 327 | return(ret); | 326 | return(ret); |
| 328 | } | 327 | } |
| @@ -341,7 +340,7 @@ static int dgram_write(BIO *b, const char *in, int inl) | |||
| 341 | 340 | ||
| 342 | if (data->peer.sa.sa_family == AF_INET) | 341 | if (data->peer.sa.sa_family == AF_INET) |
| 343 | peerlen = sizeof(data->peer.sa_in); | 342 | peerlen = sizeof(data->peer.sa_in); |
| 344 | #if OPENSSL_USE_IPV6 | 343 | #if OPENSSL_USE_IVP6 |
| 345 | else if (data->peer.sa.sa_family == AF_INET6) | 344 | else if (data->peer.sa.sa_family == AF_INET6) |
| 346 | peerlen = sizeof(data->peer.sa_in6); | 345 | peerlen = sizeof(data->peer.sa_in6); |
| 347 | #endif | 346 | #endif |
| @@ -746,13 +745,9 @@ static int BIO_dgram_should_retry(int i) | |||
| 746 | { | 745 | { |
| 747 | err=get_last_socket_error(); | 746 | err=get_last_socket_error(); |
| 748 | 747 | ||
| 749 | #if defined(OPENSSL_SYS_WINDOWS) | 748 | #if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */ |
| 750 | /* If the socket return value (i) is -1 | 749 | if ((i == -1) && (err == 0)) |
| 751 | * and err is unexpectedly 0 at this point, | 750 | return(1); |
| 752 | * the error code was overwritten by | ||
| 753 | * another system call before this error | ||
| 754 | * handling is called. | ||
| 755 | */ | ||
| 756 | #endif | 751 | #endif |
| 757 | 752 | ||
| 758 | return(BIO_dgram_non_fatal_error(err)); | 753 | return(BIO_dgram_non_fatal_error(err)); |
| @@ -815,6 +810,7 @@ int BIO_dgram_non_fatal_error(int err) | |||
| 815 | } | 810 | } |
| 816 | return(0); | 811 | return(0); |
| 817 | } | 812 | } |
| 813 | #endif | ||
| 818 | 814 | ||
| 819 | static void get_current_time(struct timeval *t) | 815 | static void get_current_time(struct timeval *t) |
| 820 | { | 816 | { |
| @@ -832,5 +828,3 @@ static void get_current_time(struct timeval *t) | |||
| 832 | gettimeofday(t, NULL); | 828 | gettimeofday(t, NULL); |
| 833 | #endif | 829 | #endif |
| 834 | } | 830 | } |
| 835 | |||
| 836 | #endif | ||
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index b954fe7ebc..8bfa0bcd97 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
| @@ -123,7 +123,6 @@ BIO *BIO_new_file(const char *filename, const char *mode) | |||
| 123 | 123 | ||
| 124 | #if defined(_WIN32) && defined(CP_UTF8) | 124 | #if defined(_WIN32) && defined(CP_UTF8) |
| 125 | int sz, len_0 = (int)strlen(filename)+1; | 125 | int sz, len_0 = (int)strlen(filename)+1; |
| 126 | DWORD flags; | ||
| 127 | 126 | ||
| 128 | /* | 127 | /* |
| 129 | * Basically there are three cases to cover: a) filename is | 128 | * Basically there are three cases to cover: a) filename is |
| @@ -137,22 +136,17 @@ BIO *BIO_new_file(const char *filename, const char *mode) | |||
| 137 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall | 136 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall |
| 138 | * back to fopen... | 137 | * back to fopen... |
| 139 | */ | 138 | */ |
| 140 | if ((sz=MultiByteToWideChar(CP_UTF8,(flags=MB_ERR_INVALID_CHARS), | 139 | if ((sz=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS, |
| 141 | filename,len_0,NULL,0))>0 || | ||
| 142 | (GetLastError()==ERROR_INVALID_FLAGS && | ||
| 143 | (sz=MultiByteToWideChar(CP_UTF8,(flags=0), | ||
| 144 | filename,len_0,NULL,0))>0) | 140 | filename,len_0,NULL,0))>0) |
| 145 | ) | ||
| 146 | { | 141 | { |
| 147 | WCHAR wmode[8]; | 142 | WCHAR wmode[8]; |
| 148 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); | 143 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); |
| 149 | 144 | ||
| 150 | if (MultiByteToWideChar(CP_UTF8,flags, | 145 | if (MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS, |
| 151 | filename,len_0,wfilename,sz) && | 146 | filename,len_0,wfilename,sz) && |
| 152 | MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1, | 147 | MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1, |
| 153 | wmode,sizeof(wmode)/sizeof(wmode[0])) && | 148 | wmode,sizeof(wmode)/sizeof(wmode[0])) && |
| 154 | (file=_wfopen(wfilename,wmode))==NULL && | 149 | (file=_wfopen(wfilename,wmode))==NULL && errno==ENOENT |
| 155 | (errno==ENOENT || errno==EBADF) | ||
| 156 | ) /* UTF-8 decode succeeded, but no file, filename | 150 | ) /* UTF-8 decode succeeded, but no file, filename |
| 157 | * could still have been locale-ized... */ | 151 | * could still have been locale-ized... */ |
| 158 | file = fopen(filename,mode); | 152 | file = fopen(filename,mode); |
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index b7dce5c1a2..7ead044b37 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
| @@ -75,15 +75,6 @@ | |||
| 75 | # include <descrip.h> | 75 | # include <descrip.h> |
| 76 | # include <lib$routines.h> | 76 | # include <lib$routines.h> |
| 77 | # include <starlet.h> | 77 | # include <starlet.h> |
| 78 | /* Some compiler options may mask the declaration of "_malloc32". */ | ||
| 79 | # if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE | ||
| 80 | # if __INITIAL_POINTER_SIZE == 64 | ||
| 81 | # pragma pointer_size save | ||
| 82 | # pragma pointer_size 32 | ||
| 83 | void * _malloc32 (__size_t); | ||
| 84 | # pragma pointer_size restore | ||
| 85 | # endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 86 | # endif /* __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE */ | ||
| 87 | #elif defined(__ultrix) | 78 | #elif defined(__ultrix) |
| 88 | # include <sys/syslog.h> | 79 | # include <sys/syslog.h> |
| 89 | #elif defined(OPENSSL_SYS_NETWARE) | 80 | #elif defined(OPENSSL_SYS_NETWARE) |
| @@ -309,24 +300,7 @@ static void xopenlog(BIO* bp, char* name, int level) | |||
| 309 | static void xsyslog(BIO *bp, int priority, const char *string) | 300 | static void xsyslog(BIO *bp, int priority, const char *string) |
| 310 | { | 301 | { |
| 311 | struct dsc$descriptor_s opc_dsc; | 302 | struct dsc$descriptor_s opc_dsc; |
| 312 | |||
| 313 | /* Arrange 32-bit pointer to opcdef buffer and malloc(), if needed. */ | ||
| 314 | #if __INITIAL_POINTER_SIZE == 64 | ||
| 315 | # pragma pointer_size save | ||
| 316 | # pragma pointer_size 32 | ||
| 317 | # define OPCDEF_TYPE __char_ptr32 | ||
| 318 | # define OPCDEF_MALLOC _malloc32 | ||
| 319 | #else /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 320 | # define OPCDEF_TYPE char * | ||
| 321 | # define OPCDEF_MALLOC OPENSSL_malloc | ||
| 322 | #endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
| 323 | |||
| 324 | struct opcdef *opcdef_p; | 303 | struct opcdef *opcdef_p; |
| 325 | |||
| 326 | #if __INITIAL_POINTER_SIZE == 64 | ||
| 327 | # pragma pointer_size restore | ||
| 328 | #endif /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 329 | |||
| 330 | char buf[10240]; | 304 | char buf[10240]; |
| 331 | unsigned int len; | 305 | unsigned int len; |
| 332 | struct dsc$descriptor_s buf_dsc; | 306 | struct dsc$descriptor_s buf_dsc; |
| @@ -352,8 +326,8 @@ static void xsyslog(BIO *bp, int priority, const char *string) | |||
| 352 | 326 | ||
| 353 | lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); | 327 | lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); |
| 354 | 328 | ||
| 355 | /* We know there's an 8-byte header. That's documented. */ | 329 | /* we know there's an 8 byte header. That's documented */ |
| 356 | opcdef_p = OPCDEF_MALLOC( 8+ len); | 330 | opcdef_p = (struct opcdef *) OPENSSL_malloc(8 + len); |
| 357 | opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; | 331 | opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; |
| 358 | memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); | 332 | memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); |
| 359 | opcdef_p->opc$l_ms_rqstid = 0; | 333 | opcdef_p->opc$l_ms_rqstid = 0; |
| @@ -361,7 +335,7 @@ static void xsyslog(BIO *bp, int priority, const char *string) | |||
| 361 | 335 | ||
| 362 | opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | 336 | opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; |
| 363 | opc_dsc.dsc$b_class = DSC$K_CLASS_S; | 337 | opc_dsc.dsc$b_class = DSC$K_CLASS_S; |
| 364 | opc_dsc.dsc$a_pointer = (OPCDEF_TYPE) opcdef_p; | 338 | opc_dsc.dsc$a_pointer = (char *)opcdef_p; |
| 365 | opc_dsc.dsc$w_length = len + 8; | 339 | opc_dsc.dsc$w_length = len + 8; |
| 366 | 340 | ||
| 367 | sys$sndopr(opc_dsc, 0); | 341 | sys$sndopr(opc_dsc, 0); |
diff --git a/src/lib/libcrypto/bio/bss_rtcp.c b/src/lib/libcrypto/bio/bss_rtcp.c new file mode 100644 index 0000000000..7dae485564 --- /dev/null +++ b/src/lib/libcrypto/bio/bss_rtcp.c | |||
| @@ -0,0 +1,294 @@ | |||
| 1 | /* crypto/bio/bss_rtcp.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Written by David L. Jones <jonesd@kcgl1.eng.ohio-state.edu> | ||
| 60 | * Date: 22-JUL-1996 | ||
| 61 | * Revised: 25-SEP-1997 Update for 0.8.1, BIO_CTRL_SET -> BIO_C_SET_FD | ||
| 62 | */ | ||
| 63 | /* VMS */ | ||
| 64 | #include <stdio.h> | ||
| 65 | #include <stdlib.h> | ||
| 66 | #include <string.h> | ||
| 67 | #include <errno.h> | ||
| 68 | #include "cryptlib.h" | ||
| 69 | #include <openssl/bio.h> | ||
| 70 | |||
| 71 | #include <iodef.h> /* VMS IO$_ definitions */ | ||
| 72 | #include <starlet.h> | ||
| 73 | |||
| 74 | typedef unsigned short io_channel; | ||
| 75 | /*************************************************************************/ | ||
| 76 | struct io_status { short status, count; long flags; }; | ||
| 77 | |||
| 78 | struct rpc_msg { /* Should have member alignment inhibited */ | ||
| 79 | char channel; /* 'A'-app data. 'R'-remote client 'G'-global */ | ||
| 80 | char function; /* 'G'-get, 'P'-put, 'C'-confirm, 'X'-close */ | ||
| 81 | unsigned short int length; /* Amount of data returned or max to return */ | ||
| 82 | char data[4092]; /* variable data */ | ||
| 83 | }; | ||
| 84 | #define RPC_HDR_SIZE (sizeof(struct rpc_msg) - 4092) | ||
| 85 | |||
| 86 | struct rpc_ctx { | ||
| 87 | int filled, pos; | ||
| 88 | struct rpc_msg msg; | ||
| 89 | }; | ||
| 90 | |||
| 91 | static int rtcp_write(BIO *h,const char *buf,int num); | ||
| 92 | static int rtcp_read(BIO *h,char *buf,int size); | ||
| 93 | static int rtcp_puts(BIO *h,const char *str); | ||
| 94 | static int rtcp_gets(BIO *h,char *str,int size); | ||
| 95 | static long rtcp_ctrl(BIO *h,int cmd,long arg1,void *arg2); | ||
| 96 | static int rtcp_new(BIO *h); | ||
| 97 | static int rtcp_free(BIO *data); | ||
| 98 | |||
| 99 | static BIO_METHOD rtcp_method= | ||
| 100 | { | ||
| 101 | BIO_TYPE_FD, | ||
| 102 | "RTCP", | ||
| 103 | rtcp_write, | ||
| 104 | rtcp_read, | ||
| 105 | rtcp_puts, | ||
| 106 | rtcp_gets, | ||
| 107 | rtcp_ctrl, | ||
| 108 | rtcp_new, | ||
| 109 | rtcp_free, | ||
| 110 | NULL, | ||
| 111 | }; | ||
| 112 | |||
| 113 | BIO_METHOD *BIO_s_rtcp(void) | ||
| 114 | { | ||
| 115 | return(&rtcp_method); | ||
| 116 | } | ||
| 117 | /*****************************************************************************/ | ||
| 118 | /* Decnet I/O routines. | ||
| 119 | */ | ||
| 120 | |||
| 121 | #ifdef __DECC | ||
| 122 | #pragma message save | ||
| 123 | #pragma message disable DOLLARID | ||
| 124 | #endif | ||
| 125 | |||
| 126 | static int get ( io_channel chan, char *buffer, int maxlen, int *length ) | ||
| 127 | { | ||
| 128 | int status; | ||
| 129 | struct io_status iosb; | ||
| 130 | status = sys$qiow ( 0, chan, IO$_READVBLK, &iosb, 0, 0, | ||
| 131 | buffer, maxlen, 0, 0, 0, 0 ); | ||
| 132 | if ( (status&1) == 1 ) status = iosb.status; | ||
| 133 | if ( (status&1) == 1 ) *length = iosb.count; | ||
| 134 | return status; | ||
| 135 | } | ||
| 136 | |||
| 137 | static int put ( io_channel chan, char *buffer, int length ) | ||
| 138 | { | ||
| 139 | int status; | ||
| 140 | struct io_status iosb; | ||
| 141 | status = sys$qiow ( 0, chan, IO$_WRITEVBLK, &iosb, 0, 0, | ||
| 142 | buffer, length, 0, 0, 0, 0 ); | ||
| 143 | if ( (status&1) == 1 ) status = iosb.status; | ||
| 144 | return status; | ||
| 145 | } | ||
| 146 | |||
| 147 | #ifdef __DECC | ||
| 148 | #pragma message restore | ||
| 149 | #endif | ||
| 150 | |||
| 151 | /***************************************************************************/ | ||
| 152 | |||
| 153 | static int rtcp_new(BIO *bi) | ||
| 154 | { | ||
| 155 | struct rpc_ctx *ctx; | ||
| 156 | bi->init=1; | ||
| 157 | bi->num=0; | ||
| 158 | bi->flags = 0; | ||
| 159 | bi->ptr=OPENSSL_malloc(sizeof(struct rpc_ctx)); | ||
| 160 | ctx = (struct rpc_ctx *) bi->ptr; | ||
| 161 | ctx->filled = 0; | ||
| 162 | ctx->pos = 0; | ||
| 163 | return(1); | ||
| 164 | } | ||
| 165 | |||
| 166 | static int rtcp_free(BIO *a) | ||
| 167 | { | ||
| 168 | if (a == NULL) return(0); | ||
| 169 | if ( a->ptr ) OPENSSL_free ( a->ptr ); | ||
| 170 | a->ptr = NULL; | ||
| 171 | return(1); | ||
| 172 | } | ||
| 173 | |||
| 174 | static int rtcp_read(BIO *b, char *out, int outl) | ||
| 175 | { | ||
| 176 | int status, length; | ||
| 177 | struct rpc_ctx *ctx; | ||
| 178 | /* | ||
| 179 | * read data, return existing. | ||
| 180 | */ | ||
| 181 | ctx = (struct rpc_ctx *) b->ptr; | ||
| 182 | if ( ctx->pos < ctx->filled ) { | ||
| 183 | length = ctx->filled - ctx->pos; | ||
| 184 | if ( length > outl ) length = outl; | ||
| 185 | memmove ( out, &ctx->msg.data[ctx->pos], length ); | ||
| 186 | ctx->pos += length; | ||
| 187 | return length; | ||
| 188 | } | ||
| 189 | /* | ||
| 190 | * Requst more data from R channel. | ||
| 191 | */ | ||
| 192 | ctx->msg.channel = 'R'; | ||
| 193 | ctx->msg.function = 'G'; | ||
| 194 | ctx->msg.length = sizeof(ctx->msg.data); | ||
| 195 | status = put ( b->num, (char *) &ctx->msg, RPC_HDR_SIZE ); | ||
| 196 | if ( (status&1) == 0 ) { | ||
| 197 | return -1; | ||
| 198 | } | ||
| 199 | /* | ||
| 200 | * Read. | ||
| 201 | */ | ||
| 202 | ctx->pos = ctx->filled = 0; | ||
| 203 | status = get ( b->num, (char *) &ctx->msg, sizeof(ctx->msg), &length ); | ||
| 204 | if ( (status&1) == 0 ) length = -1; | ||
| 205 | if ( ctx->msg.channel != 'R' || ctx->msg.function != 'C' ) { | ||
| 206 | length = -1; | ||
| 207 | } | ||
| 208 | ctx->filled = length - RPC_HDR_SIZE; | ||
| 209 | |||
| 210 | if ( ctx->pos < ctx->filled ) { | ||
| 211 | length = ctx->filled - ctx->pos; | ||
| 212 | if ( length > outl ) length = outl; | ||
| 213 | memmove ( out, ctx->msg.data, length ); | ||
| 214 | ctx->pos += length; | ||
| 215 | return length; | ||
| 216 | } | ||
| 217 | |||
| 218 | return length; | ||
| 219 | } | ||
| 220 | |||
| 221 | static int rtcp_write(BIO *b, const char *in, int inl) | ||
| 222 | { | ||
| 223 | int status, i, segment, length; | ||
| 224 | struct rpc_ctx *ctx; | ||
| 225 | /* | ||
| 226 | * Output data, send in chunks no larger that sizeof(ctx->msg.data). | ||
| 227 | */ | ||
| 228 | ctx = (struct rpc_ctx *) b->ptr; | ||
| 229 | for ( i = 0; i < inl; i += segment ) { | ||
| 230 | segment = inl - i; | ||
| 231 | if ( segment > sizeof(ctx->msg.data) ) segment = sizeof(ctx->msg.data); | ||
| 232 | ctx->msg.channel = 'R'; | ||
| 233 | ctx->msg.function = 'P'; | ||
| 234 | ctx->msg.length = segment; | ||
| 235 | memmove ( ctx->msg.data, &in[i], segment ); | ||
| 236 | status = put ( b->num, (char *) &ctx->msg, segment + RPC_HDR_SIZE ); | ||
| 237 | if ((status&1) == 0 ) { i = -1; break; } | ||
| 238 | |||
| 239 | status = get ( b->num, (char *) &ctx->msg, sizeof(ctx->msg), &length ); | ||
| 240 | if ( ((status&1) == 0) || (length < RPC_HDR_SIZE) ) { i = -1; break; } | ||
| 241 | if ( (ctx->msg.channel != 'R') || (ctx->msg.function != 'C') ) { | ||
| 242 | printf("unexpected response when confirming put %c %c\n", | ||
| 243 | ctx->msg.channel, ctx->msg.function ); | ||
| 244 | |||
| 245 | } | ||
| 246 | } | ||
| 247 | return(i); | ||
| 248 | } | ||
| 249 | |||
| 250 | static long rtcp_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 251 | { | ||
| 252 | long ret=1; | ||
| 253 | |||
| 254 | switch (cmd) | ||
| 255 | { | ||
| 256 | case BIO_CTRL_RESET: | ||
| 257 | case BIO_CTRL_EOF: | ||
| 258 | ret = 1; | ||
| 259 | break; | ||
| 260 | case BIO_C_SET_FD: | ||
| 261 | b->num = num; | ||
| 262 | ret = 1; | ||
| 263 | break; | ||
| 264 | case BIO_CTRL_SET_CLOSE: | ||
| 265 | case BIO_CTRL_FLUSH: | ||
| 266 | case BIO_CTRL_DUP: | ||
| 267 | ret=1; | ||
| 268 | break; | ||
| 269 | case BIO_CTRL_GET_CLOSE: | ||
| 270 | case BIO_CTRL_INFO: | ||
| 271 | case BIO_CTRL_GET: | ||
| 272 | case BIO_CTRL_PENDING: | ||
| 273 | case BIO_CTRL_WPENDING: | ||
| 274 | default: | ||
| 275 | ret=0; | ||
| 276 | break; | ||
| 277 | } | ||
| 278 | return(ret); | ||
| 279 | } | ||
| 280 | |||
| 281 | static int rtcp_gets(BIO *bp, char *buf, int size) | ||
| 282 | { | ||
| 283 | return(0); | ||
| 284 | } | ||
| 285 | |||
| 286 | static int rtcp_puts(BIO *bp, const char *str) | ||
| 287 | { | ||
| 288 | int length; | ||
| 289 | if (str == NULL) return(0); | ||
| 290 | length = strlen ( str ); | ||
| 291 | if ( length == 0 ) return (0); | ||
| 292 | return rtcp_write ( bp,str, length ); | ||
| 293 | } | ||
| 294 | |||
diff --git a/src/lib/libcrypto/bn/Makefile b/src/lib/libcrypto/bn/Makefile new file mode 100644 index 0000000000..aabc4f56b8 --- /dev/null +++ b/src/lib/libcrypto/bn/Makefile | |||
| @@ -0,0 +1,347 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/bn/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= bn | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | BN_ASM= bn_asm.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=bntest.c exptest.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC= bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \ | ||
| 26 | bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \ | ||
| 27 | bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \ | ||
| 28 | bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \ | ||
| 29 | bn_depr.c bn_const.c | ||
| 30 | |||
| 31 | LIBOBJ= bn_add.o bn_div.o bn_exp.o bn_lib.o bn_ctx.o bn_mul.o bn_mod.o \ | ||
| 32 | bn_print.o bn_rand.o bn_shift.o bn_word.o bn_blind.o \ | ||
| 33 | bn_kron.o bn_sqrt.o bn_gcd.o bn_prime.o bn_err.o bn_sqr.o $(BN_ASM) \ | ||
| 34 | bn_recp.o bn_mont.o bn_mpi.o bn_exp2.o bn_gf2m.o bn_nist.o \ | ||
| 35 | bn_depr.o bn_const.o | ||
| 36 | |||
| 37 | SRC= $(LIBSRC) | ||
| 38 | |||
| 39 | EXHEADER= bn.h | ||
| 40 | HEADER= bn_lcl.h bn_prime.h $(EXHEADER) | ||
| 41 | |||
| 42 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 43 | |||
| 44 | top: | ||
| 45 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 46 | |||
| 47 | all: lib | ||
| 48 | |||
| 49 | bn_prime.h: bn_prime.pl | ||
| 50 | $(PERL) bn_prime.pl >bn_prime.h | ||
| 51 | |||
| 52 | divtest: divtest.c ../../libcrypto.a | ||
| 53 | cc -I../../include divtest.c -o divtest ../../libcrypto.a | ||
| 54 | |||
| 55 | bnbug: bnbug.c ../../libcrypto.a top | ||
| 56 | cc -g -I../../include bnbug.c -o bnbug ../../libcrypto.a | ||
| 57 | |||
| 58 | lib: $(LIBOBJ) | ||
| 59 | $(AR) $(LIB) $(LIBOBJ) | ||
| 60 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 61 | @touch lib | ||
| 62 | |||
| 63 | bn-586.s: asm/bn-586.pl ../perlasm/x86asm.pl | ||
| 64 | $(PERL) asm/bn-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 65 | co-586.s: asm/co-586.pl ../perlasm/x86asm.pl | ||
| 66 | $(PERL) asm/co-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 67 | x86-mont.s: asm/x86-mont.pl ../perlasm/x86asm.pl | ||
| 68 | $(PERL) asm/x86-mont.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 69 | |||
| 70 | sparcv8.o: asm/sparcv8.S | ||
| 71 | $(CC) $(CFLAGS) -c asm/sparcv8.S | ||
| 72 | bn-sparcv9.o: asm/sparcv8plus.S | ||
| 73 | $(CC) $(CFLAGS) -c -o $@ asm/sparcv8plus.S | ||
| 74 | sparcv9a-mont.s: asm/sparcv9a-mont.pl | ||
| 75 | $(PERL) asm/sparcv9a-mont.pl $(CFLAGS) > $@ | ||
| 76 | sparcv9-mont.s: asm/sparcv9-mont.pl | ||
| 77 | $(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@ | ||
| 78 | |||
| 79 | bn-mips3.o: asm/mips3.s | ||
| 80 | @if [ "$(CC)" = "gcc" ]; then \ | ||
| 81 | ABI=`expr "$(CFLAGS)" : ".*-mabi=\([n3264]*\)"` && \ | ||
| 82 | as -$$ABI -O -o $@ asm/mips3.s; \ | ||
| 83 | else $(CC) -c $(CFLAGS) -o $@ asm/mips3.s; fi | ||
| 84 | |||
| 85 | bn-s390x.o: asm/s390x.S | ||
| 86 | $(CC) $(CFLAGS) -c -o $@ asm/s390x.S | ||
| 87 | |||
| 88 | x86_64-gcc.o: asm/x86_64-gcc.c | ||
| 89 | $(CC) $(CFLAGS) -c -o $@ asm/x86_64-gcc.c | ||
| 90 | x86_64-mont.s: asm/x86_64-mont.pl | ||
| 91 | $(PERL) asm/x86_64-mont.pl $(PERLASM_SCHEME) > $@ | ||
| 92 | |||
| 93 | bn-ia64.s: asm/ia64.S | ||
| 94 | $(CC) $(CFLAGS) -E asm/ia64.S > $@ | ||
| 95 | |||
| 96 | # GNU assembler fails to compile PA-RISC2 modules, insist on calling | ||
| 97 | # vendor assembler... | ||
| 98 | pa-risc2W.o: asm/pa-risc2W.s | ||
| 99 | /usr/ccs/bin/as -o pa-risc2W.o asm/pa-risc2W.s | ||
| 100 | pa-risc2.o: asm/pa-risc2.s | ||
| 101 | /usr/ccs/bin/as -o pa-risc2.o asm/pa-risc2.s | ||
| 102 | |||
| 103 | # ppc - AIX, Linux, MacOS X... | ||
| 104 | bn-ppc.s: asm/ppc.pl; $(PERL) asm/ppc.pl $(PERLASM_SCHEME) $@ | ||
| 105 | ppc-mont.s: asm/ppc-mont.pl;$(PERL) asm/ppc-mont.pl $(PERLASM_SCHEME) $@ | ||
| 106 | |||
| 107 | alpha-mont.s: asm/alpha-mont.pl | ||
| 108 | $(PERL) $< | $(CC) -E - | tee $@ > /dev/null | ||
| 109 | |||
| 110 | # GNU make "catch all" | ||
| 111 | %-mont.s: asm/%-mont.pl; $(PERL) $< $(CFLAGS) > $@ | ||
| 112 | |||
| 113 | files: | ||
| 114 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 115 | |||
| 116 | links: | ||
| 117 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 118 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 119 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 120 | |||
| 121 | install: | ||
| 122 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 123 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 124 | do \ | ||
| 125 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 126 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 127 | done; | ||
| 128 | |||
| 129 | exptest: | ||
| 130 | rm -f exptest | ||
| 131 | gcc -I../../include -g2 -ggdb -o exptest exptest.c ../../libcrypto.a | ||
| 132 | |||
| 133 | div: | ||
| 134 | rm -f a.out | ||
| 135 | gcc -I.. -g div.c ../../libcrypto.a | ||
| 136 | |||
| 137 | tags: | ||
| 138 | ctags $(SRC) | ||
| 139 | |||
| 140 | tests: | ||
| 141 | |||
| 142 | lint: | ||
| 143 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 144 | |||
| 145 | depend: | ||
| 146 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 147 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 148 | |||
| 149 | dclean: | ||
| 150 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 151 | mv -f Makefile.new $(MAKEFILE) | ||
| 152 | |||
| 153 | clean: | ||
| 154 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 155 | |||
| 156 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 157 | |||
| 158 | bn_add.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 159 | bn_add.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 160 | bn_add.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 161 | bn_add.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 162 | bn_add.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 163 | bn_add.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 164 | bn_add.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_add.c bn_lcl.h | ||
| 165 | bn_asm.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 166 | bn_asm.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 167 | bn_asm.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 168 | bn_asm.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 169 | bn_asm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 170 | bn_asm.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 171 | bn_asm.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_asm.c bn_lcl.h | ||
| 172 | bn_blind.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 173 | bn_blind.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 174 | bn_blind.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 175 | bn_blind.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 176 | bn_blind.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 177 | bn_blind.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 178 | bn_blind.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_blind.c bn_lcl.h | ||
| 179 | bn_const.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 180 | bn_const.o: ../../include/openssl/opensslconf.h | ||
| 181 | bn_const.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 182 | bn_const.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 183 | bn_const.o: ../../include/openssl/symhacks.h bn.h bn_const.c | ||
| 184 | bn_ctx.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 185 | bn_ctx.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 186 | bn_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 187 | bn_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 188 | bn_ctx.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 189 | bn_ctx.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 190 | bn_ctx.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_ctx.c bn_lcl.h | ||
| 191 | bn_depr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 192 | bn_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 193 | bn_depr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 194 | bn_depr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 195 | bn_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 196 | bn_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 197 | bn_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 198 | bn_depr.o: ../cryptlib.h bn_depr.c bn_lcl.h | ||
| 199 | bn_div.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 200 | bn_div.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 201 | bn_div.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 202 | bn_div.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 203 | bn_div.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 204 | bn_div.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 205 | bn_div.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_div.c bn_lcl.h | ||
| 206 | bn_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 207 | bn_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 208 | bn_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 209 | bn_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 210 | bn_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 211 | bn_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 212 | bn_err.o: bn_err.c | ||
| 213 | bn_exp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 214 | bn_exp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 215 | bn_exp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 216 | bn_exp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 217 | bn_exp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 218 | bn_exp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 219 | bn_exp.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_exp.c bn_lcl.h | ||
| 220 | bn_exp2.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 221 | bn_exp2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 222 | bn_exp2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 223 | bn_exp2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 224 | bn_exp2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 225 | bn_exp2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 226 | bn_exp2.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_exp2.c bn_lcl.h | ||
| 227 | bn_gcd.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 228 | bn_gcd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 229 | bn_gcd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 230 | bn_gcd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 231 | bn_gcd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 232 | bn_gcd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 233 | bn_gcd.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_gcd.c bn_lcl.h | ||
| 234 | bn_gf2m.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 235 | bn_gf2m.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 236 | bn_gf2m.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 237 | bn_gf2m.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 238 | bn_gf2m.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 239 | bn_gf2m.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 240 | bn_gf2m.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_gf2m.c bn_lcl.h | ||
| 241 | bn_kron.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 242 | bn_kron.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 243 | bn_kron.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 244 | bn_kron.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 245 | bn_kron.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 246 | bn_kron.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 247 | bn_kron.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_kron.c bn_lcl.h | ||
| 248 | bn_lib.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 249 | bn_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 250 | bn_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 251 | bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 252 | bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 253 | bn_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 254 | bn_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_lib.c | ||
| 255 | bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 256 | bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 257 | bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 258 | bn_mod.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 259 | bn_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 260 | bn_mod.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 261 | bn_mod.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mod.c | ||
| 262 | bn_mont.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 263 | bn_mont.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 264 | bn_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 265 | bn_mont.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 266 | bn_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 267 | bn_mont.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 268 | bn_mont.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mont.c | ||
| 269 | bn_mpi.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 270 | bn_mpi.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 271 | bn_mpi.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 272 | bn_mpi.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 273 | bn_mpi.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 274 | bn_mpi.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 275 | bn_mpi.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mpi.c | ||
| 276 | bn_mul.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 277 | bn_mul.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 278 | bn_mul.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 279 | bn_mul.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 280 | bn_mul.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 281 | bn_mul.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 282 | bn_mul.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_mul.c | ||
| 283 | bn_nist.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 284 | bn_nist.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 285 | bn_nist.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 286 | bn_nist.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 287 | bn_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 288 | bn_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 289 | bn_nist.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_nist.c | ||
| 290 | bn_prime.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 291 | bn_prime.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 292 | bn_prime.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 293 | bn_prime.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 294 | bn_prime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 295 | bn_prime.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 296 | bn_prime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 297 | bn_prime.o: ../cryptlib.h bn_lcl.h bn_prime.c bn_prime.h | ||
| 298 | bn_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 299 | bn_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 300 | bn_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 301 | bn_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 302 | bn_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 303 | bn_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 304 | bn_print.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_print.c | ||
| 305 | bn_rand.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 306 | bn_rand.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 307 | bn_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 308 | bn_rand.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 309 | bn_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 310 | bn_rand.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 311 | bn_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 312 | bn_rand.o: ../cryptlib.h bn_lcl.h bn_rand.c | ||
| 313 | bn_recp.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 314 | bn_recp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 315 | bn_recp.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 316 | bn_recp.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 317 | bn_recp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 318 | bn_recp.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 319 | bn_recp.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_recp.c | ||
| 320 | bn_shift.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 321 | bn_shift.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 322 | bn_shift.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 323 | bn_shift.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 324 | bn_shift.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 325 | bn_shift.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 326 | bn_shift.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_shift.c | ||
| 327 | bn_sqr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 328 | bn_sqr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 329 | bn_sqr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 330 | bn_sqr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 331 | bn_sqr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 332 | bn_sqr.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 333 | bn_sqr.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_sqr.c | ||
| 334 | bn_sqrt.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 335 | bn_sqrt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 336 | bn_sqrt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 337 | bn_sqrt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 338 | bn_sqrt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 339 | bn_sqrt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 340 | bn_sqrt.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_sqrt.c | ||
| 341 | bn_word.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 342 | bn_word.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 343 | bn_word.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 344 | bn_word.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 345 | bn_word.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 346 | bn_word.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 347 | bn_word.o: ../../include/openssl/symhacks.h ../cryptlib.h bn_lcl.h bn_word.c | ||
diff --git a/src/lib/libcrypto/bn/asm/README b/src/lib/libcrypto/bn/asm/README new file mode 100644 index 0000000000..b0f3a68a06 --- /dev/null +++ b/src/lib/libcrypto/bn/asm/README | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | <OBSOLETE> | ||
| 2 | |||
| 3 | All assember in this directory are just version of the file | ||
| 4 | crypto/bn/bn_asm.c. | ||
| 5 | |||
| 6 | Quite a few of these files are just the assember output from gcc since on | ||
| 7 | quite a few machines they are 2 times faster than the system compiler. | ||
| 8 | |||
| 9 | For the x86, I have hand written assember because of the bad job all | ||
| 10 | compilers seem to do on it. This normally gives a 2 time speed up in the RSA | ||
| 11 | routines. | ||
| 12 | |||
| 13 | For the DEC alpha, I also hand wrote the assember (except the division which | ||
| 14 | is just the output from the C compiler pasted on the end of the file). | ||
| 15 | On the 2 alpha C compilers I had access to, it was not possible to do | ||
| 16 | 64b x 64b -> 128b calculations (both long and the long long data types | ||
| 17 | were 64 bits). So the hand assember gives access to the 128 bit result and | ||
| 18 | a 2 times speedup :-). | ||
| 19 | |||
| 20 | There are 3 versions of assember for the HP PA-RISC. | ||
| 21 | |||
| 22 | pa-risc.s is the origional one which works fine and generated using gcc :-) | ||
| 23 | |||
| 24 | pa-risc2W.s and pa-risc2.s are 64 and 32-bit PA-RISC 2.0 implementations | ||
| 25 | by Chris Ruemmler from HP (with some help from the HP C compiler). | ||
| 26 | |||
| 27 | </OBSOLETE> | ||
diff --git a/src/lib/libcrypto/bn/asm/mips3-mont.pl b/src/lib/libcrypto/bn/asm/mips3-mont.pl new file mode 100644 index 0000000000..8f9156e02a --- /dev/null +++ b/src/lib/libcrypto/bn/asm/mips3-mont.pl | |||
| @@ -0,0 +1,327 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | # | ||
| 3 | # ==================================================================== | ||
| 4 | # Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 5 | # project. The module is, however, dual licensed under OpenSSL and | ||
| 6 | # CRYPTOGAMS licenses depending on where you obtain it. For further | ||
| 7 | # details see http://www.openssl.org/~appro/cryptogams/. | ||
| 8 | # ==================================================================== | ||
| 9 | |||
| 10 | # This module doesn't present direct interest for OpenSSL, because it | ||
| 11 | # doesn't provide better performance for longer keys. While 512-bit | ||
| 12 | # RSA private key operations are 40% faster, 1024-bit ones are hardly | ||
| 13 | # faster at all, while longer key operations are slower by up to 20%. | ||
| 14 | # It might be of interest to embedded system developers though, as | ||
| 15 | # it's smaller than 1KB, yet offers ~3x improvement over compiler | ||
| 16 | # generated code. | ||
| 17 | # | ||
| 18 | # The module targets N32 and N64 MIPS ABIs and currently is a bit | ||
| 19 | # IRIX-centric, i.e. is likely to require adaptation for other OSes. | ||
| 20 | |||
| 21 | # int bn_mul_mont( | ||
| 22 | $rp="a0"; # BN_ULONG *rp, | ||
| 23 | $ap="a1"; # const BN_ULONG *ap, | ||
| 24 | $bp="a2"; # const BN_ULONG *bp, | ||
| 25 | $np="a3"; # const BN_ULONG *np, | ||
| 26 | $n0="a4"; # const BN_ULONG *n0, | ||
| 27 | $num="a5"; # int num); | ||
| 28 | |||
| 29 | $lo0="a6"; | ||
| 30 | $hi0="a7"; | ||
| 31 | $lo1="v0"; | ||
| 32 | $hi1="v1"; | ||
| 33 | $aj="t0"; | ||
| 34 | $bi="t1"; | ||
| 35 | $nj="t2"; | ||
| 36 | $tp="t3"; | ||
| 37 | $alo="s0"; | ||
| 38 | $ahi="s1"; | ||
| 39 | $nlo="s2"; | ||
| 40 | $nhi="s3"; | ||
| 41 | $tj="s4"; | ||
| 42 | $i="s5"; | ||
| 43 | $j="s6"; | ||
| 44 | $fp="t8"; | ||
| 45 | $m1="t9"; | ||
| 46 | |||
| 47 | $FRAME=8*(2+8); | ||
| 48 | |||
| 49 | $code=<<___; | ||
| 50 | #include <asm.h> | ||
| 51 | #include <regdef.h> | ||
| 52 | |||
| 53 | .text | ||
| 54 | |||
| 55 | .set noat | ||
| 56 | .set reorder | ||
| 57 | |||
| 58 | .align 5 | ||
| 59 | .globl bn_mul_mont | ||
| 60 | .ent bn_mul_mont | ||
| 61 | bn_mul_mont: | ||
| 62 | .set noreorder | ||
| 63 | PTR_SUB sp,64 | ||
| 64 | move $fp,sp | ||
| 65 | .frame $fp,64,ra | ||
| 66 | slt AT,$num,4 | ||
| 67 | li v0,0 | ||
| 68 | beqzl AT,.Lproceed | ||
| 69 | nop | ||
| 70 | jr ra | ||
| 71 | PTR_ADD sp,$fp,64 | ||
| 72 | .set reorder | ||
| 73 | .align 5 | ||
| 74 | .Lproceed: | ||
| 75 | ld $n0,0($n0) | ||
| 76 | ld $bi,0($bp) # bp[0] | ||
| 77 | ld $aj,0($ap) # ap[0] | ||
| 78 | ld $nj,0($np) # np[0] | ||
| 79 | PTR_SUB sp,16 # place for two extra words | ||
| 80 | sll $num,3 | ||
| 81 | li AT,-4096 | ||
| 82 | PTR_SUB sp,$num | ||
| 83 | and sp,AT | ||
| 84 | |||
| 85 | sd s0,0($fp) | ||
| 86 | sd s1,8($fp) | ||
| 87 | sd s2,16($fp) | ||
| 88 | sd s3,24($fp) | ||
| 89 | sd s4,32($fp) | ||
| 90 | sd s5,40($fp) | ||
| 91 | sd s6,48($fp) | ||
| 92 | sd s7,56($fp) | ||
| 93 | |||
| 94 | dmultu $aj,$bi | ||
| 95 | ld $alo,8($ap) | ||
| 96 | ld $nlo,8($np) | ||
| 97 | mflo $lo0 | ||
| 98 | mfhi $hi0 | ||
| 99 | dmultu $lo0,$n0 | ||
| 100 | mflo $m1 | ||
| 101 | |||
| 102 | dmultu $alo,$bi | ||
| 103 | mflo $alo | ||
| 104 | mfhi $ahi | ||
| 105 | |||
| 106 | dmultu $nj,$m1 | ||
| 107 | mflo $lo1 | ||
| 108 | mfhi $hi1 | ||
| 109 | dmultu $nlo,$m1 | ||
| 110 | daddu $lo1,$lo0 | ||
| 111 | sltu AT,$lo1,$lo0 | ||
| 112 | daddu $hi1,AT | ||
| 113 | mflo $nlo | ||
| 114 | mfhi $nhi | ||
| 115 | |||
| 116 | move $tp,sp | ||
| 117 | li $j,16 | ||
| 118 | .align 4 | ||
| 119 | .L1st: | ||
| 120 | .set noreorder | ||
| 121 | PTR_ADD $aj,$ap,$j | ||
| 122 | ld $aj,($aj) | ||
| 123 | PTR_ADD $nj,$np,$j | ||
| 124 | ld $nj,($nj) | ||
| 125 | |||
| 126 | dmultu $aj,$bi | ||
| 127 | daddu $lo0,$alo,$hi0 | ||
| 128 | daddu $lo1,$nlo,$hi1 | ||
| 129 | sltu AT,$lo0,$hi0 | ||
| 130 | sltu s7,$lo1,$hi1 | ||
| 131 | daddu $hi0,$ahi,AT | ||
| 132 | daddu $hi1,$nhi,s7 | ||
| 133 | mflo $alo | ||
| 134 | mfhi $ahi | ||
| 135 | |||
| 136 | daddu $lo1,$lo0 | ||
| 137 | sltu AT,$lo1,$lo0 | ||
| 138 | dmultu $nj,$m1 | ||
| 139 | daddu $hi1,AT | ||
| 140 | addu $j,8 | ||
| 141 | sd $lo1,($tp) | ||
| 142 | sltu s7,$j,$num | ||
| 143 | mflo $nlo | ||
| 144 | mfhi $nhi | ||
| 145 | |||
| 146 | bnez s7,.L1st | ||
| 147 | PTR_ADD $tp,8 | ||
| 148 | .set reorder | ||
| 149 | |||
| 150 | daddu $lo0,$alo,$hi0 | ||
| 151 | sltu AT,$lo0,$hi0 | ||
| 152 | daddu $hi0,$ahi,AT | ||
| 153 | |||
| 154 | daddu $lo1,$nlo,$hi1 | ||
| 155 | sltu s7,$lo1,$hi1 | ||
| 156 | daddu $hi1,$nhi,s7 | ||
| 157 | daddu $lo1,$lo0 | ||
| 158 | sltu AT,$lo1,$lo0 | ||
| 159 | daddu $hi1,AT | ||
| 160 | |||
| 161 | sd $lo1,($tp) | ||
| 162 | |||
| 163 | daddu $hi1,$hi0 | ||
| 164 | sltu AT,$hi1,$hi0 | ||
| 165 | sd $hi1,8($tp) | ||
| 166 | sd AT,16($tp) | ||
| 167 | |||
| 168 | li $i,8 | ||
| 169 | .align 4 | ||
| 170 | .Louter: | ||
| 171 | PTR_ADD $bi,$bp,$i | ||
| 172 | ld $bi,($bi) | ||
| 173 | ld $aj,($ap) | ||
| 174 | ld $alo,8($ap) | ||
| 175 | ld $tj,(sp) | ||
| 176 | |||
| 177 | dmultu $aj,$bi | ||
| 178 | ld $nj,($np) | ||
| 179 | ld $nlo,8($np) | ||
| 180 | mflo $lo0 | ||
| 181 | mfhi $hi0 | ||
| 182 | daddu $lo0,$tj | ||
| 183 | dmultu $lo0,$n0 | ||
| 184 | sltu AT,$lo0,$tj | ||
| 185 | daddu $hi0,AT | ||
| 186 | mflo $m1 | ||
| 187 | |||
| 188 | dmultu $alo,$bi | ||
| 189 | mflo $alo | ||
| 190 | mfhi $ahi | ||
| 191 | |||
| 192 | dmultu $nj,$m1 | ||
| 193 | mflo $lo1 | ||
| 194 | mfhi $hi1 | ||
| 195 | |||
| 196 | dmultu $nlo,$m1 | ||
| 197 | daddu $lo1,$lo0 | ||
| 198 | sltu AT,$lo1,$lo0 | ||
| 199 | daddu $hi1,AT | ||
| 200 | mflo $nlo | ||
| 201 | mfhi $nhi | ||
| 202 | |||
| 203 | move $tp,sp | ||
| 204 | li $j,16 | ||
| 205 | ld $tj,8($tp) | ||
| 206 | .align 4 | ||
| 207 | .Linner: | ||
| 208 | .set noreorder | ||
| 209 | PTR_ADD $aj,$ap,$j | ||
| 210 | ld $aj,($aj) | ||
| 211 | PTR_ADD $nj,$np,$j | ||
| 212 | ld $nj,($nj) | ||
| 213 | |||
| 214 | dmultu $aj,$bi | ||
| 215 | daddu $lo0,$alo,$hi0 | ||
| 216 | daddu $lo1,$nlo,$hi1 | ||
| 217 | sltu AT,$lo0,$hi0 | ||
| 218 | sltu s7,$lo1,$hi1 | ||
| 219 | daddu $hi0,$ahi,AT | ||
| 220 | daddu $hi1,$nhi,s7 | ||
| 221 | mflo $alo | ||
| 222 | mfhi $ahi | ||
| 223 | |||
| 224 | daddu $lo0,$tj | ||
| 225 | addu $j,8 | ||
| 226 | dmultu $nj,$m1 | ||
| 227 | sltu AT,$lo0,$tj | ||
| 228 | daddu $lo1,$lo0 | ||
| 229 | daddu $hi0,AT | ||
| 230 | sltu s7,$lo1,$lo0 | ||
| 231 | ld $tj,16($tp) | ||
| 232 | daddu $hi1,s7 | ||
| 233 | sltu AT,$j,$num | ||
| 234 | mflo $nlo | ||
| 235 | mfhi $nhi | ||
| 236 | sd $lo1,($tp) | ||
| 237 | bnez AT,.Linner | ||
| 238 | PTR_ADD $tp,8 | ||
| 239 | .set reorder | ||
| 240 | |||
| 241 | daddu $lo0,$alo,$hi0 | ||
| 242 | sltu AT,$lo0,$hi0 | ||
| 243 | daddu $hi0,$ahi,AT | ||
| 244 | daddu $lo0,$tj | ||
| 245 | sltu s7,$lo0,$tj | ||
| 246 | daddu $hi0,s7 | ||
| 247 | |||
| 248 | ld $tj,16($tp) | ||
| 249 | daddu $lo1,$nlo,$hi1 | ||
| 250 | sltu AT,$lo1,$hi1 | ||
| 251 | daddu $hi1,$nhi,AT | ||
| 252 | daddu $lo1,$lo0 | ||
| 253 | sltu s7,$lo1,$lo0 | ||
| 254 | daddu $hi1,s7 | ||
| 255 | sd $lo1,($tp) | ||
| 256 | |||
| 257 | daddu $lo1,$hi1,$hi0 | ||
| 258 | sltu $hi1,$lo1,$hi0 | ||
| 259 | daddu $lo1,$tj | ||
| 260 | sltu AT,$lo1,$tj | ||
| 261 | daddu $hi1,AT | ||
| 262 | sd $lo1,8($tp) | ||
| 263 | sd $hi1,16($tp) | ||
| 264 | |||
| 265 | addu $i,8 | ||
| 266 | sltu s7,$i,$num | ||
| 267 | bnez s7,.Louter | ||
| 268 | |||
| 269 | .set noreorder | ||
| 270 | PTR_ADD $tj,sp,$num # &tp[num] | ||
| 271 | move $tp,sp | ||
| 272 | move $ap,sp | ||
| 273 | li $hi0,0 # clear borrow bit | ||
| 274 | |||
| 275 | .align 4 | ||
| 276 | .Lsub: ld $lo0,($tp) | ||
| 277 | ld $lo1,($np) | ||
| 278 | PTR_ADD $tp,8 | ||
| 279 | PTR_ADD $np,8 | ||
| 280 | dsubu $lo1,$lo0,$lo1 # tp[i]-np[i] | ||
| 281 | sgtu AT,$lo1,$lo0 | ||
| 282 | dsubu $lo0,$lo1,$hi0 | ||
| 283 | sgtu $hi0,$lo0,$lo1 | ||
| 284 | sd $lo0,($rp) | ||
| 285 | or $hi0,AT | ||
| 286 | sltu AT,$tp,$tj | ||
| 287 | bnez AT,.Lsub | ||
| 288 | PTR_ADD $rp,8 | ||
| 289 | |||
| 290 | dsubu $hi0,$hi1,$hi0 # handle upmost overflow bit | ||
| 291 | move $tp,sp | ||
| 292 | PTR_SUB $rp,$num # restore rp | ||
| 293 | not $hi1,$hi0 | ||
| 294 | |||
| 295 | and $ap,$hi0,sp | ||
| 296 | and $bp,$hi1,$rp | ||
| 297 | or $ap,$ap,$bp # ap=borrow?tp:rp | ||
| 298 | |||
| 299 | .align 4 | ||
| 300 | .Lcopy: ld $aj,($ap) | ||
| 301 | PTR_ADD $ap,8 | ||
| 302 | PTR_ADD $tp,8 | ||
| 303 | sd zero,-8($tp) | ||
| 304 | sltu AT,$tp,$tj | ||
| 305 | sd $aj,($rp) | ||
| 306 | bnez AT,.Lcopy | ||
| 307 | PTR_ADD $rp,8 | ||
| 308 | |||
| 309 | ld s0,0($fp) | ||
| 310 | ld s1,8($fp) | ||
| 311 | ld s2,16($fp) | ||
| 312 | ld s3,24($fp) | ||
| 313 | ld s4,32($fp) | ||
| 314 | ld s5,40($fp) | ||
| 315 | ld s6,48($fp) | ||
| 316 | ld s7,56($fp) | ||
| 317 | li v0,1 | ||
| 318 | jr ra | ||
| 319 | PTR_ADD sp,$fp,64 | ||
| 320 | .set reorder | ||
| 321 | END(bn_mul_mont) | ||
| 322 | .rdata | ||
| 323 | .asciiz "Montgomery Multiplication for MIPS III/IV, CRYPTOGAMS by <appro\@openssl.org>" | ||
| 324 | ___ | ||
| 325 | |||
| 326 | print $code; | ||
| 327 | close STDOUT; | ||
diff --git a/src/lib/libcrypto/bn/asm/mips3.s b/src/lib/libcrypto/bn/asm/mips3.s new file mode 100644 index 0000000000..dca4105c7d --- /dev/null +++ b/src/lib/libcrypto/bn/asm/mips3.s | |||
| @@ -0,0 +1,2201 @@ | |||
| 1 | .rdata | ||
| 2 | .asciiz "mips3.s, Version 1.1" | ||
| 3 | .asciiz "MIPS III/IV ISA artwork by Andy Polyakov <appro@fy.chalmers.se>" | ||
| 4 | |||
| 5 | /* | ||
| 6 | * ==================================================================== | ||
| 7 | * Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL | ||
| 8 | * project. | ||
| 9 | * | ||
| 10 | * Rights for redistribution and usage in source and binary forms are | ||
| 11 | * granted according to the OpenSSL license. Warranty of any kind is | ||
| 12 | * disclaimed. | ||
| 13 | * ==================================================================== | ||
| 14 | */ | ||
| 15 | |||
| 16 | /* | ||
| 17 | * This is my modest contributon to the OpenSSL project (see | ||
| 18 | * http://www.openssl.org/ for more information about it) and is | ||
| 19 | * a drop-in MIPS III/IV ISA replacement for crypto/bn/bn_asm.c | ||
| 20 | * module. For updates see http://fy.chalmers.se/~appro/hpe/. | ||
| 21 | * | ||
| 22 | * The module is designed to work with either of the "new" MIPS ABI(5), | ||
| 23 | * namely N32 or N64, offered by IRIX 6.x. It's not ment to work under | ||
| 24 | * IRIX 5.x not only because it doesn't support new ABIs but also | ||
| 25 | * because 5.x kernels put R4x00 CPU into 32-bit mode and all those | ||
| 26 | * 64-bit instructions (daddu, dmultu, etc.) found below gonna only | ||
| 27 | * cause illegal instruction exception:-( | ||
| 28 | * | ||
| 29 | * In addition the code depends on preprocessor flags set up by MIPSpro | ||
| 30 | * compiler driver (either as or cc) and therefore (probably?) can't be | ||
| 31 | * compiled by the GNU assembler. GNU C driver manages fine though... | ||
| 32 | * I mean as long as -mmips-as is specified or is the default option, | ||
| 33 | * because then it simply invokes /usr/bin/as which in turn takes | ||
| 34 | * perfect care of the preprocessor definitions. Another neat feature | ||
| 35 | * offered by the MIPSpro assembler is an optimization pass. This gave | ||
| 36 | * me the opportunity to have the code looking more regular as all those | ||
| 37 | * architecture dependent instruction rescheduling details were left to | ||
| 38 | * the assembler. Cool, huh? | ||
| 39 | * | ||
| 40 | * Performance improvement is astonishing! 'apps/openssl speed rsa dsa' | ||
| 41 | * goes way over 3 times faster! | ||
| 42 | * | ||
| 43 | * <appro@fy.chalmers.se> | ||
| 44 | */ | ||
| 45 | #include <asm.h> | ||
| 46 | #include <regdef.h> | ||
| 47 | |||
| 48 | #if _MIPS_ISA>=4 | ||
| 49 | #define MOVNZ(cond,dst,src) \ | ||
| 50 | movn dst,src,cond | ||
| 51 | #else | ||
| 52 | #define MOVNZ(cond,dst,src) \ | ||
| 53 | .set noreorder; \ | ||
| 54 | bnezl cond,.+8; \ | ||
| 55 | move dst,src; \ | ||
| 56 | .set reorder | ||
| 57 | #endif | ||
| 58 | |||
| 59 | .text | ||
| 60 | |||
| 61 | .set noat | ||
| 62 | .set reorder | ||
| 63 | |||
| 64 | #define MINUS4 v1 | ||
| 65 | |||
| 66 | .align 5 | ||
| 67 | LEAF(bn_mul_add_words) | ||
| 68 | .set noreorder | ||
| 69 | bgtzl a2,.L_bn_mul_add_words_proceed | ||
| 70 | ld t0,0(a1) | ||
| 71 | jr ra | ||
| 72 | move v0,zero | ||
| 73 | .set reorder | ||
| 74 | |||
| 75 | .L_bn_mul_add_words_proceed: | ||
| 76 | li MINUS4,-4 | ||
| 77 | and ta0,a2,MINUS4 | ||
| 78 | move v0,zero | ||
| 79 | beqz ta0,.L_bn_mul_add_words_tail | ||
| 80 | |||
| 81 | .L_bn_mul_add_words_loop: | ||
| 82 | dmultu t0,a3 | ||
| 83 | ld t1,0(a0) | ||
| 84 | ld t2,8(a1) | ||
| 85 | ld t3,8(a0) | ||
| 86 | ld ta0,16(a1) | ||
| 87 | ld ta1,16(a0) | ||
| 88 | daddu t1,v0 | ||
| 89 | sltu v0,t1,v0 /* All manuals say it "compares 32-bit | ||
| 90 | * values", but it seems to work fine | ||
| 91 | * even on 64-bit registers. */ | ||
| 92 | mflo AT | ||
| 93 | mfhi t0 | ||
| 94 | daddu t1,AT | ||
| 95 | daddu v0,t0 | ||
| 96 | sltu AT,t1,AT | ||
| 97 | sd t1,0(a0) | ||
| 98 | daddu v0,AT | ||
| 99 | |||
| 100 | dmultu t2,a3 | ||
| 101 | ld ta2,24(a1) | ||
| 102 | ld ta3,24(a0) | ||
| 103 | daddu t3,v0 | ||
| 104 | sltu v0,t3,v0 | ||
| 105 | mflo AT | ||
| 106 | mfhi t2 | ||
| 107 | daddu t3,AT | ||
| 108 | daddu v0,t2 | ||
| 109 | sltu AT,t3,AT | ||
| 110 | sd t3,8(a0) | ||
| 111 | daddu v0,AT | ||
| 112 | |||
| 113 | dmultu ta0,a3 | ||
| 114 | subu a2,4 | ||
| 115 | PTR_ADD a0,32 | ||
| 116 | PTR_ADD a1,32 | ||
| 117 | daddu ta1,v0 | ||
| 118 | sltu v0,ta1,v0 | ||
| 119 | mflo AT | ||
| 120 | mfhi ta0 | ||
| 121 | daddu ta1,AT | ||
| 122 | daddu v0,ta0 | ||
| 123 | sltu AT,ta1,AT | ||
| 124 | sd ta1,-16(a0) | ||
| 125 | daddu v0,AT | ||
| 126 | |||
| 127 | |||
| 128 | dmultu ta2,a3 | ||
| 129 | and ta0,a2,MINUS4 | ||
| 130 | daddu ta3,v0 | ||
| 131 | sltu v0,ta3,v0 | ||
| 132 | mflo AT | ||
| 133 | mfhi ta2 | ||
| 134 | daddu ta3,AT | ||
| 135 | daddu v0,ta2 | ||
| 136 | sltu AT,ta3,AT | ||
| 137 | sd ta3,-8(a0) | ||
| 138 | daddu v0,AT | ||
| 139 | .set noreorder | ||
| 140 | bgtzl ta0,.L_bn_mul_add_words_loop | ||
| 141 | ld t0,0(a1) | ||
| 142 | |||
| 143 | bnezl a2,.L_bn_mul_add_words_tail | ||
| 144 | ld t0,0(a1) | ||
| 145 | .set reorder | ||
| 146 | |||
| 147 | .L_bn_mul_add_words_return: | ||
| 148 | jr ra | ||
| 149 | |||
| 150 | .L_bn_mul_add_words_tail: | ||
| 151 | dmultu t0,a3 | ||
| 152 | ld t1,0(a0) | ||
| 153 | subu a2,1 | ||
| 154 | daddu t1,v0 | ||
| 155 | sltu v0,t1,v0 | ||
| 156 | mflo AT | ||
| 157 | mfhi t0 | ||
| 158 | daddu t1,AT | ||
| 159 | daddu v0,t0 | ||
| 160 | sltu AT,t1,AT | ||
| 161 | sd t1,0(a0) | ||
| 162 | daddu v0,AT | ||
| 163 | beqz a2,.L_bn_mul_add_words_return | ||
| 164 | |||
| 165 | ld t0,8(a1) | ||
| 166 | dmultu t0,a3 | ||
| 167 | ld t1,8(a0) | ||
| 168 | subu a2,1 | ||
| 169 | daddu t1,v0 | ||
| 170 | sltu v0,t1,v0 | ||
| 171 | mflo AT | ||
| 172 | mfhi t0 | ||
| 173 | daddu t1,AT | ||
| 174 | daddu v0,t0 | ||
| 175 | sltu AT,t1,AT | ||
| 176 | sd t1,8(a0) | ||
| 177 | daddu v0,AT | ||
| 178 | beqz a2,.L_bn_mul_add_words_return | ||
| 179 | |||
| 180 | ld t0,16(a1) | ||
| 181 | dmultu t0,a3 | ||
| 182 | ld t1,16(a0) | ||
| 183 | daddu t1,v0 | ||
| 184 | sltu v0,t1,v0 | ||
| 185 | mflo AT | ||
| 186 | mfhi t0 | ||
| 187 | daddu t1,AT | ||
| 188 | daddu v0,t0 | ||
| 189 | sltu AT,t1,AT | ||
| 190 | sd t1,16(a0) | ||
| 191 | daddu v0,AT | ||
| 192 | jr ra | ||
| 193 | END(bn_mul_add_words) | ||
| 194 | |||
| 195 | .align 5 | ||
| 196 | LEAF(bn_mul_words) | ||
| 197 | .set noreorder | ||
| 198 | bgtzl a2,.L_bn_mul_words_proceed | ||
| 199 | ld t0,0(a1) | ||
| 200 | jr ra | ||
| 201 | move v0,zero | ||
| 202 | .set reorder | ||
| 203 | |||
| 204 | .L_bn_mul_words_proceed: | ||
| 205 | li MINUS4,-4 | ||
| 206 | and ta0,a2,MINUS4 | ||
| 207 | move v0,zero | ||
| 208 | beqz ta0,.L_bn_mul_words_tail | ||
| 209 | |||
| 210 | .L_bn_mul_words_loop: | ||
| 211 | dmultu t0,a3 | ||
| 212 | ld t2,8(a1) | ||
| 213 | ld ta0,16(a1) | ||
| 214 | ld ta2,24(a1) | ||
| 215 | mflo AT | ||
| 216 | mfhi t0 | ||
| 217 | daddu v0,AT | ||
| 218 | sltu t1,v0,AT | ||
| 219 | sd v0,0(a0) | ||
| 220 | daddu v0,t1,t0 | ||
| 221 | |||
| 222 | dmultu t2,a3 | ||
| 223 | subu a2,4 | ||
| 224 | PTR_ADD a0,32 | ||
| 225 | PTR_ADD a1,32 | ||
| 226 | mflo AT | ||
| 227 | mfhi t2 | ||
| 228 | daddu v0,AT | ||
| 229 | sltu t3,v0,AT | ||
| 230 | sd v0,-24(a0) | ||
| 231 | daddu v0,t3,t2 | ||
| 232 | |||
| 233 | dmultu ta0,a3 | ||
| 234 | mflo AT | ||
| 235 | mfhi ta0 | ||
| 236 | daddu v0,AT | ||
| 237 | sltu ta1,v0,AT | ||
| 238 | sd v0,-16(a0) | ||
| 239 | daddu v0,ta1,ta0 | ||
| 240 | |||
| 241 | |||
| 242 | dmultu ta2,a3 | ||
| 243 | and ta0,a2,MINUS4 | ||
| 244 | mflo AT | ||
| 245 | mfhi ta2 | ||
| 246 | daddu v0,AT | ||
| 247 | sltu ta3,v0,AT | ||
| 248 | sd v0,-8(a0) | ||
| 249 | daddu v0,ta3,ta2 | ||
| 250 | .set noreorder | ||
| 251 | bgtzl ta0,.L_bn_mul_words_loop | ||
| 252 | ld t0,0(a1) | ||
| 253 | |||
| 254 | bnezl a2,.L_bn_mul_words_tail | ||
| 255 | ld t0,0(a1) | ||
| 256 | .set reorder | ||
| 257 | |||
| 258 | .L_bn_mul_words_return: | ||
| 259 | jr ra | ||
| 260 | |||
| 261 | .L_bn_mul_words_tail: | ||
| 262 | dmultu t0,a3 | ||
| 263 | subu a2,1 | ||
| 264 | mflo AT | ||
| 265 | mfhi t0 | ||
| 266 | daddu v0,AT | ||
| 267 | sltu t1,v0,AT | ||
| 268 | sd v0,0(a0) | ||
| 269 | daddu v0,t1,t0 | ||
| 270 | beqz a2,.L_bn_mul_words_return | ||
| 271 | |||
| 272 | ld t0,8(a1) | ||
| 273 | dmultu t0,a3 | ||
| 274 | subu a2,1 | ||
| 275 | mflo AT | ||
| 276 | mfhi t0 | ||
| 277 | daddu v0,AT | ||
| 278 | sltu t1,v0,AT | ||
| 279 | sd v0,8(a0) | ||
| 280 | daddu v0,t1,t0 | ||
| 281 | beqz a2,.L_bn_mul_words_return | ||
| 282 | |||
| 283 | ld t0,16(a1) | ||
| 284 | dmultu t0,a3 | ||
| 285 | mflo AT | ||
| 286 | mfhi t0 | ||
| 287 | daddu v0,AT | ||
| 288 | sltu t1,v0,AT | ||
| 289 | sd v0,16(a0) | ||
| 290 | daddu v0,t1,t0 | ||
| 291 | jr ra | ||
| 292 | END(bn_mul_words) | ||
| 293 | |||
| 294 | .align 5 | ||
| 295 | LEAF(bn_sqr_words) | ||
| 296 | .set noreorder | ||
| 297 | bgtzl a2,.L_bn_sqr_words_proceed | ||
| 298 | ld t0,0(a1) | ||
| 299 | jr ra | ||
| 300 | move v0,zero | ||
| 301 | .set reorder | ||
| 302 | |||
| 303 | .L_bn_sqr_words_proceed: | ||
| 304 | li MINUS4,-4 | ||
| 305 | and ta0,a2,MINUS4 | ||
| 306 | move v0,zero | ||
| 307 | beqz ta0,.L_bn_sqr_words_tail | ||
| 308 | |||
| 309 | .L_bn_sqr_words_loop: | ||
| 310 | dmultu t0,t0 | ||
| 311 | ld t2,8(a1) | ||
| 312 | ld ta0,16(a1) | ||
| 313 | ld ta2,24(a1) | ||
| 314 | mflo t1 | ||
| 315 | mfhi t0 | ||
| 316 | sd t1,0(a0) | ||
| 317 | sd t0,8(a0) | ||
| 318 | |||
| 319 | dmultu t2,t2 | ||
| 320 | subu a2,4 | ||
| 321 | PTR_ADD a0,64 | ||
| 322 | PTR_ADD a1,32 | ||
| 323 | mflo t3 | ||
| 324 | mfhi t2 | ||
| 325 | sd t3,-48(a0) | ||
| 326 | sd t2,-40(a0) | ||
| 327 | |||
| 328 | dmultu ta0,ta0 | ||
| 329 | mflo ta1 | ||
| 330 | mfhi ta0 | ||
| 331 | sd ta1,-32(a0) | ||
| 332 | sd ta0,-24(a0) | ||
| 333 | |||
| 334 | |||
| 335 | dmultu ta2,ta2 | ||
| 336 | and ta0,a2,MINUS4 | ||
| 337 | mflo ta3 | ||
| 338 | mfhi ta2 | ||
| 339 | sd ta3,-16(a0) | ||
| 340 | sd ta2,-8(a0) | ||
| 341 | |||
| 342 | .set noreorder | ||
| 343 | bgtzl ta0,.L_bn_sqr_words_loop | ||
| 344 | ld t0,0(a1) | ||
| 345 | |||
| 346 | bnezl a2,.L_bn_sqr_words_tail | ||
| 347 | ld t0,0(a1) | ||
| 348 | .set reorder | ||
| 349 | |||
| 350 | .L_bn_sqr_words_return: | ||
| 351 | move v0,zero | ||
| 352 | jr ra | ||
| 353 | |||
| 354 | .L_bn_sqr_words_tail: | ||
| 355 | dmultu t0,t0 | ||
| 356 | subu a2,1 | ||
| 357 | mflo t1 | ||
| 358 | mfhi t0 | ||
| 359 | sd t1,0(a0) | ||
| 360 | sd t0,8(a0) | ||
| 361 | beqz a2,.L_bn_sqr_words_return | ||
| 362 | |||
| 363 | ld t0,8(a1) | ||
| 364 | dmultu t0,t0 | ||
| 365 | subu a2,1 | ||
| 366 | mflo t1 | ||
| 367 | mfhi t0 | ||
| 368 | sd t1,16(a0) | ||
| 369 | sd t0,24(a0) | ||
| 370 | beqz a2,.L_bn_sqr_words_return | ||
| 371 | |||
| 372 | ld t0,16(a1) | ||
| 373 | dmultu t0,t0 | ||
| 374 | mflo t1 | ||
| 375 | mfhi t0 | ||
| 376 | sd t1,32(a0) | ||
| 377 | sd t0,40(a0) | ||
| 378 | jr ra | ||
| 379 | END(bn_sqr_words) | ||
| 380 | |||
| 381 | .align 5 | ||
| 382 | LEAF(bn_add_words) | ||
| 383 | .set noreorder | ||
| 384 | bgtzl a3,.L_bn_add_words_proceed | ||
| 385 | ld t0,0(a1) | ||
| 386 | jr ra | ||
| 387 | move v0,zero | ||
| 388 | .set reorder | ||
| 389 | |||
| 390 | .L_bn_add_words_proceed: | ||
| 391 | li MINUS4,-4 | ||
| 392 | and AT,a3,MINUS4 | ||
| 393 | move v0,zero | ||
| 394 | beqz AT,.L_bn_add_words_tail | ||
| 395 | |||
| 396 | .L_bn_add_words_loop: | ||
| 397 | ld ta0,0(a2) | ||
| 398 | subu a3,4 | ||
| 399 | ld t1,8(a1) | ||
| 400 | and AT,a3,MINUS4 | ||
| 401 | ld t2,16(a1) | ||
| 402 | PTR_ADD a2,32 | ||
| 403 | ld t3,24(a1) | ||
| 404 | PTR_ADD a0,32 | ||
| 405 | ld ta1,-24(a2) | ||
| 406 | PTR_ADD a1,32 | ||
| 407 | ld ta2,-16(a2) | ||
| 408 | ld ta3,-8(a2) | ||
| 409 | daddu ta0,t0 | ||
| 410 | sltu t8,ta0,t0 | ||
| 411 | daddu t0,ta0,v0 | ||
| 412 | sltu v0,t0,ta0 | ||
| 413 | sd t0,-32(a0) | ||
| 414 | daddu v0,t8 | ||
| 415 | |||
| 416 | daddu ta1,t1 | ||
| 417 | sltu t9,ta1,t1 | ||
| 418 | daddu t1,ta1,v0 | ||
| 419 | sltu v0,t1,ta1 | ||
| 420 | sd t1,-24(a0) | ||
| 421 | daddu v0,t9 | ||
| 422 | |||
| 423 | daddu ta2,t2 | ||
| 424 | sltu t8,ta2,t2 | ||
| 425 | daddu t2,ta2,v0 | ||
| 426 | sltu v0,t2,ta2 | ||
| 427 | sd t2,-16(a0) | ||
| 428 | daddu v0,t8 | ||
| 429 | |||
| 430 | daddu ta3,t3 | ||
| 431 | sltu t9,ta3,t3 | ||
| 432 | daddu t3,ta3,v0 | ||
| 433 | sltu v0,t3,ta3 | ||
| 434 | sd t3,-8(a0) | ||
| 435 | daddu v0,t9 | ||
| 436 | |||
| 437 | .set noreorder | ||
| 438 | bgtzl AT,.L_bn_add_words_loop | ||
| 439 | ld t0,0(a1) | ||
| 440 | |||
| 441 | bnezl a3,.L_bn_add_words_tail | ||
| 442 | ld t0,0(a1) | ||
| 443 | .set reorder | ||
| 444 | |||
| 445 | .L_bn_add_words_return: | ||
| 446 | jr ra | ||
| 447 | |||
| 448 | .L_bn_add_words_tail: | ||
| 449 | ld ta0,0(a2) | ||
| 450 | daddu ta0,t0 | ||
| 451 | subu a3,1 | ||
| 452 | sltu t8,ta0,t0 | ||
| 453 | daddu t0,ta0,v0 | ||
| 454 | sltu v0,t0,ta0 | ||
| 455 | sd t0,0(a0) | ||
| 456 | daddu v0,t8 | ||
| 457 | beqz a3,.L_bn_add_words_return | ||
| 458 | |||
| 459 | ld t1,8(a1) | ||
| 460 | ld ta1,8(a2) | ||
| 461 | daddu ta1,t1 | ||
| 462 | subu a3,1 | ||
| 463 | sltu t9,ta1,t1 | ||
| 464 | daddu t1,ta1,v0 | ||
| 465 | sltu v0,t1,ta1 | ||
| 466 | sd t1,8(a0) | ||
| 467 | daddu v0,t9 | ||
| 468 | beqz a3,.L_bn_add_words_return | ||
| 469 | |||
| 470 | ld t2,16(a1) | ||
| 471 | ld ta2,16(a2) | ||
| 472 | daddu ta2,t2 | ||
| 473 | sltu t8,ta2,t2 | ||
| 474 | daddu t2,ta2,v0 | ||
| 475 | sltu v0,t2,ta2 | ||
| 476 | sd t2,16(a0) | ||
| 477 | daddu v0,t8 | ||
| 478 | jr ra | ||
| 479 | END(bn_add_words) | ||
| 480 | |||
| 481 | .align 5 | ||
| 482 | LEAF(bn_sub_words) | ||
| 483 | .set noreorder | ||
| 484 | bgtzl a3,.L_bn_sub_words_proceed | ||
| 485 | ld t0,0(a1) | ||
| 486 | jr ra | ||
| 487 | move v0,zero | ||
| 488 | .set reorder | ||
| 489 | |||
| 490 | .L_bn_sub_words_proceed: | ||
| 491 | li MINUS4,-4 | ||
| 492 | and AT,a3,MINUS4 | ||
| 493 | move v0,zero | ||
| 494 | beqz AT,.L_bn_sub_words_tail | ||
| 495 | |||
| 496 | .L_bn_sub_words_loop: | ||
| 497 | ld ta0,0(a2) | ||
| 498 | subu a3,4 | ||
| 499 | ld t1,8(a1) | ||
| 500 | and AT,a3,MINUS4 | ||
| 501 | ld t2,16(a1) | ||
| 502 | PTR_ADD a2,32 | ||
| 503 | ld t3,24(a1) | ||
| 504 | PTR_ADD a0,32 | ||
| 505 | ld ta1,-24(a2) | ||
| 506 | PTR_ADD a1,32 | ||
| 507 | ld ta2,-16(a2) | ||
| 508 | ld ta3,-8(a2) | ||
| 509 | sltu t8,t0,ta0 | ||
| 510 | dsubu t0,ta0 | ||
| 511 | dsubu ta0,t0,v0 | ||
| 512 | sd ta0,-32(a0) | ||
| 513 | MOVNZ (t0,v0,t8) | ||
| 514 | |||
| 515 | sltu t9,t1,ta1 | ||
| 516 | dsubu t1,ta1 | ||
| 517 | dsubu ta1,t1,v0 | ||
| 518 | sd ta1,-24(a0) | ||
| 519 | MOVNZ (t1,v0,t9) | ||
| 520 | |||
| 521 | |||
| 522 | sltu t8,t2,ta2 | ||
| 523 | dsubu t2,ta2 | ||
| 524 | dsubu ta2,t2,v0 | ||
| 525 | sd ta2,-16(a0) | ||
| 526 | MOVNZ (t2,v0,t8) | ||
| 527 | |||
| 528 | sltu t9,t3,ta3 | ||
| 529 | dsubu t3,ta3 | ||
| 530 | dsubu ta3,t3,v0 | ||
| 531 | sd ta3,-8(a0) | ||
| 532 | MOVNZ (t3,v0,t9) | ||
| 533 | |||
| 534 | .set noreorder | ||
| 535 | bgtzl AT,.L_bn_sub_words_loop | ||
| 536 | ld t0,0(a1) | ||
| 537 | |||
| 538 | bnezl a3,.L_bn_sub_words_tail | ||
| 539 | ld t0,0(a1) | ||
| 540 | .set reorder | ||
| 541 | |||
| 542 | .L_bn_sub_words_return: | ||
| 543 | jr ra | ||
| 544 | |||
| 545 | .L_bn_sub_words_tail: | ||
| 546 | ld ta0,0(a2) | ||
| 547 | subu a3,1 | ||
| 548 | sltu t8,t0,ta0 | ||
| 549 | dsubu t0,ta0 | ||
| 550 | dsubu ta0,t0,v0 | ||
| 551 | MOVNZ (t0,v0,t8) | ||
| 552 | sd ta0,0(a0) | ||
| 553 | beqz a3,.L_bn_sub_words_return | ||
| 554 | |||
| 555 | ld t1,8(a1) | ||
| 556 | subu a3,1 | ||
| 557 | ld ta1,8(a2) | ||
| 558 | sltu t9,t1,ta1 | ||
| 559 | dsubu t1,ta1 | ||
| 560 | dsubu ta1,t1,v0 | ||
| 561 | MOVNZ (t1,v0,t9) | ||
| 562 | sd ta1,8(a0) | ||
| 563 | beqz a3,.L_bn_sub_words_return | ||
| 564 | |||
| 565 | ld t2,16(a1) | ||
| 566 | ld ta2,16(a2) | ||
| 567 | sltu t8,t2,ta2 | ||
| 568 | dsubu t2,ta2 | ||
| 569 | dsubu ta2,t2,v0 | ||
| 570 | MOVNZ (t2,v0,t8) | ||
| 571 | sd ta2,16(a0) | ||
| 572 | jr ra | ||
| 573 | END(bn_sub_words) | ||
| 574 | |||
| 575 | #undef MINUS4 | ||
| 576 | |||
| 577 | .align 5 | ||
| 578 | LEAF(bn_div_3_words) | ||
| 579 | .set reorder | ||
| 580 | move a3,a0 /* we know that bn_div_words doesn't | ||
| 581 | * touch a3, ta2, ta3 and preserves a2 | ||
| 582 | * so that we can save two arguments | ||
| 583 | * and return address in registers | ||
| 584 | * instead of stack:-) | ||
| 585 | */ | ||
| 586 | ld a0,(a3) | ||
| 587 | move ta2,a1 | ||
| 588 | ld a1,-8(a3) | ||
| 589 | bne a0,a2,.L_bn_div_3_words_proceed | ||
| 590 | li v0,-1 | ||
| 591 | jr ra | ||
| 592 | .L_bn_div_3_words_proceed: | ||
| 593 | move ta3,ra | ||
| 594 | bal bn_div_words | ||
| 595 | move ra,ta3 | ||
| 596 | dmultu ta2,v0 | ||
| 597 | ld t2,-16(a3) | ||
| 598 | move ta0,zero | ||
| 599 | mfhi t1 | ||
| 600 | mflo t0 | ||
| 601 | sltu t8,t1,v1 | ||
| 602 | .L_bn_div_3_words_inner_loop: | ||
| 603 | bnez t8,.L_bn_div_3_words_inner_loop_done | ||
| 604 | sgeu AT,t2,t0 | ||
| 605 | seq t9,t1,v1 | ||
| 606 | and AT,t9 | ||
| 607 | sltu t3,t0,ta2 | ||
| 608 | daddu v1,a2 | ||
| 609 | dsubu t1,t3 | ||
| 610 | dsubu t0,ta2 | ||
| 611 | sltu t8,t1,v1 | ||
| 612 | sltu ta0,v1,a2 | ||
| 613 | or t8,ta0 | ||
| 614 | .set noreorder | ||
| 615 | beqzl AT,.L_bn_div_3_words_inner_loop | ||
| 616 | dsubu v0,1 | ||
| 617 | .set reorder | ||
| 618 | .L_bn_div_3_words_inner_loop_done: | ||
| 619 | jr ra | ||
| 620 | END(bn_div_3_words) | ||
| 621 | |||
| 622 | .align 5 | ||
| 623 | LEAF(bn_div_words) | ||
| 624 | .set noreorder | ||
| 625 | bnezl a2,.L_bn_div_words_proceed | ||
| 626 | move v1,zero | ||
| 627 | jr ra | ||
| 628 | li v0,-1 /* I'd rather signal div-by-zero | ||
| 629 | * which can be done with 'break 7' */ | ||
| 630 | |||
| 631 | .L_bn_div_words_proceed: | ||
| 632 | bltz a2,.L_bn_div_words_body | ||
| 633 | move t9,v1 | ||
| 634 | dsll a2,1 | ||
| 635 | bgtz a2,.-4 | ||
| 636 | addu t9,1 | ||
| 637 | |||
| 638 | .set reorder | ||
| 639 | negu t1,t9 | ||
| 640 | li t2,-1 | ||
| 641 | dsll t2,t1 | ||
| 642 | and t2,a0 | ||
| 643 | dsrl AT,a1,t1 | ||
| 644 | .set noreorder | ||
| 645 | bnezl t2,.+8 | ||
| 646 | break 6 /* signal overflow */ | ||
| 647 | .set reorder | ||
| 648 | dsll a0,t9 | ||
| 649 | dsll a1,t9 | ||
| 650 | or a0,AT | ||
| 651 | |||
| 652 | #define QT ta0 | ||
| 653 | #define HH ta1 | ||
| 654 | #define DH v1 | ||
| 655 | .L_bn_div_words_body: | ||
| 656 | dsrl DH,a2,32 | ||
| 657 | sgeu AT,a0,a2 | ||
| 658 | .set noreorder | ||
| 659 | bnezl AT,.+8 | ||
| 660 | dsubu a0,a2 | ||
| 661 | .set reorder | ||
| 662 | |||
| 663 | li QT,-1 | ||
| 664 | dsrl HH,a0,32 | ||
| 665 | dsrl QT,32 /* q=0xffffffff */ | ||
| 666 | beq DH,HH,.L_bn_div_words_skip_div1 | ||
| 667 | ddivu zero,a0,DH | ||
| 668 | mflo QT | ||
| 669 | .L_bn_div_words_skip_div1: | ||
| 670 | dmultu a2,QT | ||
| 671 | dsll t3,a0,32 | ||
| 672 | dsrl AT,a1,32 | ||
| 673 | or t3,AT | ||
| 674 | mflo t0 | ||
| 675 | mfhi t1 | ||
| 676 | .L_bn_div_words_inner_loop1: | ||
| 677 | sltu t2,t3,t0 | ||
| 678 | seq t8,HH,t1 | ||
| 679 | sltu AT,HH,t1 | ||
| 680 | and t2,t8 | ||
| 681 | sltu v0,t0,a2 | ||
| 682 | or AT,t2 | ||
| 683 | .set noreorder | ||
| 684 | beqz AT,.L_bn_div_words_inner_loop1_done | ||
| 685 | dsubu t1,v0 | ||
| 686 | dsubu t0,a2 | ||
| 687 | b .L_bn_div_words_inner_loop1 | ||
| 688 | dsubu QT,1 | ||
| 689 | .set reorder | ||
| 690 | .L_bn_div_words_inner_loop1_done: | ||
| 691 | |||
| 692 | dsll a1,32 | ||
| 693 | dsubu a0,t3,t0 | ||
| 694 | dsll v0,QT,32 | ||
| 695 | |||
| 696 | li QT,-1 | ||
| 697 | dsrl HH,a0,32 | ||
| 698 | dsrl QT,32 /* q=0xffffffff */ | ||
| 699 | beq DH,HH,.L_bn_div_words_skip_div2 | ||
| 700 | ddivu zero,a0,DH | ||
| 701 | mflo QT | ||
| 702 | .L_bn_div_words_skip_div2: | ||
| 703 | #undef DH | ||
| 704 | dmultu a2,QT | ||
| 705 | dsll t3,a0,32 | ||
| 706 | dsrl AT,a1,32 | ||
| 707 | or t3,AT | ||
| 708 | mflo t0 | ||
| 709 | mfhi t1 | ||
| 710 | .L_bn_div_words_inner_loop2: | ||
| 711 | sltu t2,t3,t0 | ||
| 712 | seq t8,HH,t1 | ||
| 713 | sltu AT,HH,t1 | ||
| 714 | and t2,t8 | ||
| 715 | sltu v1,t0,a2 | ||
| 716 | or AT,t2 | ||
| 717 | .set noreorder | ||
| 718 | beqz AT,.L_bn_div_words_inner_loop2_done | ||
| 719 | dsubu t1,v1 | ||
| 720 | dsubu t0,a2 | ||
| 721 | b .L_bn_div_words_inner_loop2 | ||
| 722 | dsubu QT,1 | ||
| 723 | .set reorder | ||
| 724 | .L_bn_div_words_inner_loop2_done: | ||
| 725 | #undef HH | ||
| 726 | |||
| 727 | dsubu a0,t3,t0 | ||
| 728 | or v0,QT | ||
| 729 | dsrl v1,a0,t9 /* v1 contains remainder if anybody wants it */ | ||
| 730 | dsrl a2,t9 /* restore a2 */ | ||
| 731 | jr ra | ||
| 732 | #undef QT | ||
| 733 | END(bn_div_words) | ||
| 734 | |||
| 735 | #define a_0 t0 | ||
| 736 | #define a_1 t1 | ||
| 737 | #define a_2 t2 | ||
| 738 | #define a_3 t3 | ||
| 739 | #define b_0 ta0 | ||
| 740 | #define b_1 ta1 | ||
| 741 | #define b_2 ta2 | ||
| 742 | #define b_3 ta3 | ||
| 743 | |||
| 744 | #define a_4 s0 | ||
| 745 | #define a_5 s2 | ||
| 746 | #define a_6 s4 | ||
| 747 | #define a_7 a1 /* once we load a[7] we don't need a anymore */ | ||
| 748 | #define b_4 s1 | ||
| 749 | #define b_5 s3 | ||
| 750 | #define b_6 s5 | ||
| 751 | #define b_7 a2 /* once we load b[7] we don't need b anymore */ | ||
| 752 | |||
| 753 | #define t_1 t8 | ||
| 754 | #define t_2 t9 | ||
| 755 | |||
| 756 | #define c_1 v0 | ||
| 757 | #define c_2 v1 | ||
| 758 | #define c_3 a3 | ||
| 759 | |||
| 760 | #define FRAME_SIZE 48 | ||
| 761 | |||
| 762 | .align 5 | ||
| 763 | LEAF(bn_mul_comba8) | ||
| 764 | .set noreorder | ||
| 765 | PTR_SUB sp,FRAME_SIZE | ||
| 766 | .frame sp,64,ra | ||
| 767 | .set reorder | ||
| 768 | ld a_0,0(a1) /* If compiled with -mips3 option on | ||
| 769 | * R5000 box assembler barks on this | ||
| 770 | * line with "shouldn't have mult/div | ||
| 771 | * as last instruction in bb (R10K | ||
| 772 | * bug)" warning. If anybody out there | ||
| 773 | * has a clue about how to circumvent | ||
| 774 | * this do send me a note. | ||
| 775 | * <appro@fy.chalmers.se> | ||
| 776 | */ | ||
| 777 | ld b_0,0(a2) | ||
| 778 | ld a_1,8(a1) | ||
| 779 | ld a_2,16(a1) | ||
| 780 | ld a_3,24(a1) | ||
| 781 | ld b_1,8(a2) | ||
| 782 | ld b_2,16(a2) | ||
| 783 | ld b_3,24(a2) | ||
| 784 | dmultu a_0,b_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */ | ||
| 785 | sd s0,0(sp) | ||
| 786 | sd s1,8(sp) | ||
| 787 | sd s2,16(sp) | ||
| 788 | sd s3,24(sp) | ||
| 789 | sd s4,32(sp) | ||
| 790 | sd s5,40(sp) | ||
| 791 | mflo c_1 | ||
| 792 | mfhi c_2 | ||
| 793 | |||
| 794 | dmultu a_0,b_1 /* mul_add_c(a[0],b[1],c2,c3,c1); */ | ||
| 795 | ld a_4,32(a1) | ||
| 796 | ld a_5,40(a1) | ||
| 797 | ld a_6,48(a1) | ||
| 798 | ld a_7,56(a1) | ||
| 799 | ld b_4,32(a2) | ||
| 800 | ld b_5,40(a2) | ||
| 801 | mflo t_1 | ||
| 802 | mfhi t_2 | ||
| 803 | daddu c_2,t_1 | ||
| 804 | sltu AT,c_2,t_1 | ||
| 805 | daddu c_3,t_2,AT | ||
| 806 | dmultu a_1,b_0 /* mul_add_c(a[1],b[0],c2,c3,c1); */ | ||
| 807 | ld b_6,48(a2) | ||
| 808 | ld b_7,56(a2) | ||
| 809 | sd c_1,0(a0) /* r[0]=c1; */ | ||
| 810 | mflo t_1 | ||
| 811 | mfhi t_2 | ||
| 812 | daddu c_2,t_1 | ||
| 813 | sltu AT,c_2,t_1 | ||
| 814 | daddu t_2,AT | ||
| 815 | daddu c_3,t_2 | ||
| 816 | sltu c_1,c_3,t_2 | ||
| 817 | sd c_2,8(a0) /* r[1]=c2; */ | ||
| 818 | |||
| 819 | dmultu a_2,b_0 /* mul_add_c(a[2],b[0],c3,c1,c2); */ | ||
| 820 | mflo t_1 | ||
| 821 | mfhi t_2 | ||
| 822 | daddu c_3,t_1 | ||
| 823 | sltu AT,c_3,t_1 | ||
| 824 | daddu t_2,AT | ||
| 825 | daddu c_1,t_2 | ||
| 826 | dmultu a_1,b_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */ | ||
| 827 | mflo t_1 | ||
| 828 | mfhi t_2 | ||
| 829 | daddu c_3,t_1 | ||
| 830 | sltu AT,c_3,t_1 | ||
| 831 | daddu t_2,AT | ||
| 832 | daddu c_1,t_2 | ||
| 833 | sltu c_2,c_1,t_2 | ||
| 834 | dmultu a_0,b_2 /* mul_add_c(a[0],b[2],c3,c1,c2); */ | ||
| 835 | mflo t_1 | ||
| 836 | mfhi t_2 | ||
| 837 | daddu c_3,t_1 | ||
| 838 | sltu AT,c_3,t_1 | ||
| 839 | daddu t_2,AT | ||
| 840 | daddu c_1,t_2 | ||
| 841 | sltu AT,c_1,t_2 | ||
| 842 | daddu c_2,AT | ||
| 843 | sd c_3,16(a0) /* r[2]=c3; */ | ||
| 844 | |||
| 845 | dmultu a_0,b_3 /* mul_add_c(a[0],b[3],c1,c2,c3); */ | ||
| 846 | mflo t_1 | ||
| 847 | mfhi t_2 | ||
| 848 | daddu c_1,t_1 | ||
| 849 | sltu AT,c_1,t_1 | ||
| 850 | daddu t_2,AT | ||
| 851 | daddu c_2,t_2 | ||
| 852 | sltu c_3,c_2,t_2 | ||
| 853 | dmultu a_1,b_2 /* mul_add_c(a[1],b[2],c1,c2,c3); */ | ||
| 854 | mflo t_1 | ||
| 855 | mfhi t_2 | ||
| 856 | daddu c_1,t_1 | ||
| 857 | sltu AT,c_1,t_1 | ||
| 858 | daddu t_2,AT | ||
| 859 | daddu c_2,t_2 | ||
| 860 | sltu AT,c_2,t_2 | ||
| 861 | daddu c_3,AT | ||
| 862 | dmultu a_2,b_1 /* mul_add_c(a[2],b[1],c1,c2,c3); */ | ||
| 863 | mflo t_1 | ||
| 864 | mfhi t_2 | ||
| 865 | daddu c_1,t_1 | ||
| 866 | sltu AT,c_1,t_1 | ||
| 867 | daddu t_2,AT | ||
| 868 | daddu c_2,t_2 | ||
| 869 | sltu AT,c_2,t_2 | ||
| 870 | daddu c_3,AT | ||
| 871 | dmultu a_3,b_0 /* mul_add_c(a[3],b[0],c1,c2,c3); */ | ||
| 872 | mflo t_1 | ||
| 873 | mfhi t_2 | ||
| 874 | daddu c_1,t_1 | ||
| 875 | sltu AT,c_1,t_1 | ||
| 876 | daddu t_2,AT | ||
| 877 | daddu c_2,t_2 | ||
| 878 | sltu AT,c_2,t_2 | ||
| 879 | daddu c_3,AT | ||
| 880 | sd c_1,24(a0) /* r[3]=c1; */ | ||
| 881 | |||
| 882 | dmultu a_4,b_0 /* mul_add_c(a[4],b[0],c2,c3,c1); */ | ||
| 883 | mflo t_1 | ||
| 884 | mfhi t_2 | ||
| 885 | daddu c_2,t_1 | ||
| 886 | sltu AT,c_2,t_1 | ||
| 887 | daddu t_2,AT | ||
| 888 | daddu c_3,t_2 | ||
| 889 | sltu c_1,c_3,t_2 | ||
| 890 | dmultu a_3,b_1 /* mul_add_c(a[3],b[1],c2,c3,c1); */ | ||
| 891 | mflo t_1 | ||
| 892 | mfhi t_2 | ||
| 893 | daddu c_2,t_1 | ||
| 894 | sltu AT,c_2,t_1 | ||
| 895 | daddu t_2,AT | ||
| 896 | daddu c_3,t_2 | ||
| 897 | sltu AT,c_3,t_2 | ||
| 898 | daddu c_1,AT | ||
| 899 | dmultu a_2,b_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */ | ||
| 900 | mflo t_1 | ||
| 901 | mfhi t_2 | ||
| 902 | daddu c_2,t_1 | ||
| 903 | sltu AT,c_2,t_1 | ||
| 904 | daddu t_2,AT | ||
| 905 | daddu c_3,t_2 | ||
| 906 | sltu AT,c_3,t_2 | ||
| 907 | daddu c_1,AT | ||
| 908 | dmultu a_1,b_3 /* mul_add_c(a[1],b[3],c2,c3,c1); */ | ||
| 909 | mflo t_1 | ||
| 910 | mfhi t_2 | ||
| 911 | daddu c_2,t_1 | ||
| 912 | sltu AT,c_2,t_1 | ||
| 913 | daddu t_2,AT | ||
| 914 | daddu c_3,t_2 | ||
| 915 | sltu AT,c_3,t_2 | ||
| 916 | daddu c_1,AT | ||
| 917 | dmultu a_0,b_4 /* mul_add_c(a[0],b[4],c2,c3,c1); */ | ||
| 918 | mflo t_1 | ||
| 919 | mfhi t_2 | ||
| 920 | daddu c_2,t_1 | ||
| 921 | sltu AT,c_2,t_1 | ||
| 922 | daddu t_2,AT | ||
| 923 | daddu c_3,t_2 | ||
| 924 | sltu AT,c_3,t_2 | ||
| 925 | daddu c_1,AT | ||
| 926 | sd c_2,32(a0) /* r[4]=c2; */ | ||
| 927 | |||
| 928 | dmultu a_0,b_5 /* mul_add_c(a[0],b[5],c3,c1,c2); */ | ||
| 929 | mflo t_1 | ||
| 930 | mfhi t_2 | ||
| 931 | daddu c_3,t_1 | ||
| 932 | sltu AT,c_3,t_1 | ||
| 933 | daddu t_2,AT | ||
| 934 | daddu c_1,t_2 | ||
| 935 | sltu c_2,c_1,t_2 | ||
| 936 | dmultu a_1,b_4 /* mul_add_c(a[1],b[4],c3,c1,c2); */ | ||
| 937 | mflo t_1 | ||
| 938 | mfhi t_2 | ||
| 939 | daddu c_3,t_1 | ||
| 940 | sltu AT,c_3,t_1 | ||
| 941 | daddu t_2,AT | ||
| 942 | daddu c_1,t_2 | ||
| 943 | sltu AT,c_1,t_2 | ||
| 944 | daddu c_2,AT | ||
| 945 | dmultu a_2,b_3 /* mul_add_c(a[2],b[3],c3,c1,c2); */ | ||
| 946 | mflo t_1 | ||
| 947 | mfhi t_2 | ||
| 948 | daddu c_3,t_1 | ||
| 949 | sltu AT,c_3,t_1 | ||
| 950 | daddu t_2,AT | ||
| 951 | daddu c_1,t_2 | ||
| 952 | sltu AT,c_1,t_2 | ||
| 953 | daddu c_2,AT | ||
| 954 | dmultu a_3,b_2 /* mul_add_c(a[3],b[2],c3,c1,c2); */ | ||
| 955 | mflo t_1 | ||
| 956 | mfhi t_2 | ||
| 957 | daddu c_3,t_1 | ||
| 958 | sltu AT,c_3,t_1 | ||
| 959 | daddu t_2,AT | ||
| 960 | daddu c_1,t_2 | ||
| 961 | sltu AT,c_1,t_2 | ||
| 962 | daddu c_2,AT | ||
| 963 | dmultu a_4,b_1 /* mul_add_c(a[4],b[1],c3,c1,c2); */ | ||
| 964 | mflo t_1 | ||
| 965 | mfhi t_2 | ||
| 966 | daddu c_3,t_1 | ||
| 967 | sltu AT,c_3,t_1 | ||
| 968 | daddu t_2,AT | ||
| 969 | daddu c_1,t_2 | ||
| 970 | sltu AT,c_1,t_2 | ||
| 971 | daddu c_2,AT | ||
| 972 | dmultu a_5,b_0 /* mul_add_c(a[5],b[0],c3,c1,c2); */ | ||
| 973 | mflo t_1 | ||
| 974 | mfhi t_2 | ||
| 975 | daddu c_3,t_1 | ||
| 976 | sltu AT,c_3,t_1 | ||
| 977 | daddu t_2,AT | ||
| 978 | daddu c_1,t_2 | ||
| 979 | sltu AT,c_1,t_2 | ||
| 980 | daddu c_2,AT | ||
| 981 | sd c_3,40(a0) /* r[5]=c3; */ | ||
| 982 | |||
| 983 | dmultu a_6,b_0 /* mul_add_c(a[6],b[0],c1,c2,c3); */ | ||
| 984 | mflo t_1 | ||
| 985 | mfhi t_2 | ||
| 986 | daddu c_1,t_1 | ||
| 987 | sltu AT,c_1,t_1 | ||
| 988 | daddu t_2,AT | ||
| 989 | daddu c_2,t_2 | ||
| 990 | sltu c_3,c_2,t_2 | ||
| 991 | dmultu a_5,b_1 /* mul_add_c(a[5],b[1],c1,c2,c3); */ | ||
| 992 | mflo t_1 | ||
| 993 | mfhi t_2 | ||
| 994 | daddu c_1,t_1 | ||
| 995 | sltu AT,c_1,t_1 | ||
| 996 | daddu t_2,AT | ||
| 997 | daddu c_2,t_2 | ||
| 998 | sltu AT,c_2,t_2 | ||
| 999 | daddu c_3,AT | ||
| 1000 | dmultu a_4,b_2 /* mul_add_c(a[4],b[2],c1,c2,c3); */ | ||
| 1001 | mflo t_1 | ||
| 1002 | mfhi t_2 | ||
| 1003 | daddu c_1,t_1 | ||
| 1004 | sltu AT,c_1,t_1 | ||
| 1005 | daddu t_2,AT | ||
| 1006 | daddu c_2,t_2 | ||
| 1007 | sltu AT,c_2,t_2 | ||
| 1008 | daddu c_3,AT | ||
| 1009 | dmultu a_3,b_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */ | ||
| 1010 | mflo t_1 | ||
| 1011 | mfhi t_2 | ||
| 1012 | daddu c_1,t_1 | ||
| 1013 | sltu AT,c_1,t_1 | ||
| 1014 | daddu t_2,AT | ||
| 1015 | daddu c_2,t_2 | ||
| 1016 | sltu AT,c_2,t_2 | ||
| 1017 | daddu c_3,AT | ||
| 1018 | dmultu a_2,b_4 /* mul_add_c(a[2],b[4],c1,c2,c3); */ | ||
| 1019 | mflo t_1 | ||
| 1020 | mfhi t_2 | ||
| 1021 | daddu c_1,t_1 | ||
| 1022 | sltu AT,c_1,t_1 | ||
| 1023 | daddu t_2,AT | ||
| 1024 | daddu c_2,t_2 | ||
| 1025 | sltu AT,c_2,t_2 | ||
| 1026 | daddu c_3,AT | ||
| 1027 | dmultu a_1,b_5 /* mul_add_c(a[1],b[5],c1,c2,c3); */ | ||
| 1028 | mflo t_1 | ||
| 1029 | mfhi t_2 | ||
| 1030 | daddu c_1,t_1 | ||
| 1031 | sltu AT,c_1,t_1 | ||
| 1032 | daddu t_2,AT | ||
| 1033 | daddu c_2,t_2 | ||
| 1034 | sltu AT,c_2,t_2 | ||
| 1035 | daddu c_3,AT | ||
| 1036 | dmultu a_0,b_6 /* mul_add_c(a[0],b[6],c1,c2,c3); */ | ||
| 1037 | mflo t_1 | ||
| 1038 | mfhi t_2 | ||
| 1039 | daddu c_1,t_1 | ||
| 1040 | sltu AT,c_1,t_1 | ||
| 1041 | daddu t_2,AT | ||
| 1042 | daddu c_2,t_2 | ||
| 1043 | sltu AT,c_2,t_2 | ||
| 1044 | daddu c_3,AT | ||
| 1045 | sd c_1,48(a0) /* r[6]=c1; */ | ||
| 1046 | |||
| 1047 | dmultu a_0,b_7 /* mul_add_c(a[0],b[7],c2,c3,c1); */ | ||
| 1048 | mflo t_1 | ||
| 1049 | mfhi t_2 | ||
| 1050 | daddu c_2,t_1 | ||
| 1051 | sltu AT,c_2,t_1 | ||
| 1052 | daddu t_2,AT | ||
| 1053 | daddu c_3,t_2 | ||
| 1054 | sltu c_1,c_3,t_2 | ||
| 1055 | dmultu a_1,b_6 /* mul_add_c(a[1],b[6],c2,c3,c1); */ | ||
| 1056 | mflo t_1 | ||
| 1057 | mfhi t_2 | ||
| 1058 | daddu c_2,t_1 | ||
| 1059 | sltu AT,c_2,t_1 | ||
| 1060 | daddu t_2,AT | ||
| 1061 | daddu c_3,t_2 | ||
| 1062 | sltu AT,c_3,t_2 | ||
| 1063 | daddu c_1,AT | ||
| 1064 | dmultu a_2,b_5 /* mul_add_c(a[2],b[5],c2,c3,c1); */ | ||
| 1065 | mflo t_1 | ||
| 1066 | mfhi t_2 | ||
| 1067 | daddu c_2,t_1 | ||
| 1068 | sltu AT,c_2,t_1 | ||
| 1069 | daddu t_2,AT | ||
| 1070 | daddu c_3,t_2 | ||
| 1071 | sltu AT,c_3,t_2 | ||
| 1072 | daddu c_1,AT | ||
| 1073 | dmultu a_3,b_4 /* mul_add_c(a[3],b[4],c2,c3,c1); */ | ||
| 1074 | mflo t_1 | ||
| 1075 | mfhi t_2 | ||
| 1076 | daddu c_2,t_1 | ||
| 1077 | sltu AT,c_2,t_1 | ||
| 1078 | daddu t_2,AT | ||
| 1079 | daddu c_3,t_2 | ||
| 1080 | sltu AT,c_3,t_2 | ||
| 1081 | daddu c_1,AT | ||
| 1082 | dmultu a_4,b_3 /* mul_add_c(a[4],b[3],c2,c3,c1); */ | ||
| 1083 | mflo t_1 | ||
| 1084 | mfhi t_2 | ||
| 1085 | daddu c_2,t_1 | ||
| 1086 | sltu AT,c_2,t_1 | ||
| 1087 | daddu t_2,AT | ||
| 1088 | daddu c_3,t_2 | ||
| 1089 | sltu AT,c_3,t_2 | ||
| 1090 | daddu c_1,AT | ||
| 1091 | dmultu a_5,b_2 /* mul_add_c(a[5],b[2],c2,c3,c1); */ | ||
| 1092 | mflo t_1 | ||
| 1093 | mfhi t_2 | ||
| 1094 | daddu c_2,t_1 | ||
| 1095 | sltu AT,c_2,t_1 | ||
| 1096 | daddu t_2,AT | ||
| 1097 | daddu c_3,t_2 | ||
| 1098 | sltu AT,c_3,t_2 | ||
| 1099 | daddu c_1,AT | ||
| 1100 | dmultu a_6,b_1 /* mul_add_c(a[6],b[1],c2,c3,c1); */ | ||
| 1101 | mflo t_1 | ||
| 1102 | mfhi t_2 | ||
| 1103 | daddu c_2,t_1 | ||
| 1104 | sltu AT,c_2,t_1 | ||
| 1105 | daddu t_2,AT | ||
| 1106 | daddu c_3,t_2 | ||
| 1107 | sltu AT,c_3,t_2 | ||
| 1108 | daddu c_1,AT | ||
| 1109 | dmultu a_7,b_0 /* mul_add_c(a[7],b[0],c2,c3,c1); */ | ||
| 1110 | mflo t_1 | ||
| 1111 | mfhi t_2 | ||
| 1112 | daddu c_2,t_1 | ||
| 1113 | sltu AT,c_2,t_1 | ||
| 1114 | daddu t_2,AT | ||
| 1115 | daddu c_3,t_2 | ||
| 1116 | sltu AT,c_3,t_2 | ||
| 1117 | daddu c_1,AT | ||
| 1118 | sd c_2,56(a0) /* r[7]=c2; */ | ||
| 1119 | |||
| 1120 | dmultu a_7,b_1 /* mul_add_c(a[7],b[1],c3,c1,c2); */ | ||
| 1121 | mflo t_1 | ||
| 1122 | mfhi t_2 | ||
| 1123 | daddu c_3,t_1 | ||
| 1124 | sltu AT,c_3,t_1 | ||
| 1125 | daddu t_2,AT | ||
| 1126 | daddu c_1,t_2 | ||
| 1127 | sltu c_2,c_1,t_2 | ||
| 1128 | dmultu a_6,b_2 /* mul_add_c(a[6],b[2],c3,c1,c2); */ | ||
| 1129 | mflo t_1 | ||
| 1130 | mfhi t_2 | ||
| 1131 | daddu c_3,t_1 | ||
| 1132 | sltu AT,c_3,t_1 | ||
| 1133 | daddu t_2,AT | ||
| 1134 | daddu c_1,t_2 | ||
| 1135 | sltu AT,c_1,t_2 | ||
| 1136 | daddu c_2,AT | ||
| 1137 | dmultu a_5,b_3 /* mul_add_c(a[5],b[3],c3,c1,c2); */ | ||
| 1138 | mflo t_1 | ||
| 1139 | mfhi t_2 | ||
| 1140 | daddu c_3,t_1 | ||
| 1141 | sltu AT,c_3,t_1 | ||
| 1142 | daddu t_2,AT | ||
| 1143 | daddu c_1,t_2 | ||
| 1144 | sltu AT,c_1,t_2 | ||
| 1145 | daddu c_2,AT | ||
| 1146 | dmultu a_4,b_4 /* mul_add_c(a[4],b[4],c3,c1,c2); */ | ||
| 1147 | mflo t_1 | ||
| 1148 | mfhi t_2 | ||
| 1149 | daddu c_3,t_1 | ||
| 1150 | sltu AT,c_3,t_1 | ||
| 1151 | daddu t_2,AT | ||
| 1152 | daddu c_1,t_2 | ||
| 1153 | sltu AT,c_1,t_2 | ||
| 1154 | daddu c_2,AT | ||
| 1155 | dmultu a_3,b_5 /* mul_add_c(a[3],b[5],c3,c1,c2); */ | ||
| 1156 | mflo t_1 | ||
| 1157 | mfhi t_2 | ||
| 1158 | daddu c_3,t_1 | ||
| 1159 | sltu AT,c_3,t_1 | ||
| 1160 | daddu t_2,AT | ||
| 1161 | daddu c_1,t_2 | ||
| 1162 | sltu AT,c_1,t_2 | ||
| 1163 | daddu c_2,AT | ||
| 1164 | dmultu a_2,b_6 /* mul_add_c(a[2],b[6],c3,c1,c2); */ | ||
| 1165 | mflo t_1 | ||
| 1166 | mfhi t_2 | ||
| 1167 | daddu c_3,t_1 | ||
| 1168 | sltu AT,c_3,t_1 | ||
| 1169 | daddu t_2,AT | ||
| 1170 | daddu c_1,t_2 | ||
| 1171 | sltu AT,c_1,t_2 | ||
| 1172 | daddu c_2,AT | ||
| 1173 | dmultu a_1,b_7 /* mul_add_c(a[1],b[7],c3,c1,c2); */ | ||
| 1174 | mflo t_1 | ||
| 1175 | mfhi t_2 | ||
| 1176 | daddu c_3,t_1 | ||
| 1177 | sltu AT,c_3,t_1 | ||
| 1178 | daddu t_2,AT | ||
| 1179 | daddu c_1,t_2 | ||
| 1180 | sltu AT,c_1,t_2 | ||
| 1181 | daddu c_2,AT | ||
| 1182 | sd c_3,64(a0) /* r[8]=c3; */ | ||
| 1183 | |||
| 1184 | dmultu a_2,b_7 /* mul_add_c(a[2],b[7],c1,c2,c3); */ | ||
| 1185 | mflo t_1 | ||
| 1186 | mfhi t_2 | ||
| 1187 | daddu c_1,t_1 | ||
| 1188 | sltu AT,c_1,t_1 | ||
| 1189 | daddu t_2,AT | ||
| 1190 | daddu c_2,t_2 | ||
| 1191 | sltu c_3,c_2,t_2 | ||
| 1192 | dmultu a_3,b_6 /* mul_add_c(a[3],b[6],c1,c2,c3); */ | ||
| 1193 | mflo t_1 | ||
| 1194 | mfhi t_2 | ||
| 1195 | daddu c_1,t_1 | ||
| 1196 | sltu AT,c_1,t_1 | ||
| 1197 | daddu t_2,AT | ||
| 1198 | daddu c_2,t_2 | ||
| 1199 | sltu AT,c_2,t_2 | ||
| 1200 | daddu c_3,AT | ||
| 1201 | dmultu a_4,b_5 /* mul_add_c(a[4],b[5],c1,c2,c3); */ | ||
| 1202 | mflo t_1 | ||
| 1203 | mfhi t_2 | ||
| 1204 | daddu c_1,t_1 | ||
| 1205 | sltu AT,c_1,t_1 | ||
| 1206 | daddu t_2,AT | ||
| 1207 | daddu c_2,t_2 | ||
| 1208 | sltu AT,c_2,t_2 | ||
| 1209 | daddu c_3,AT | ||
| 1210 | dmultu a_5,b_4 /* mul_add_c(a[5],b[4],c1,c2,c3); */ | ||
| 1211 | mflo t_1 | ||
| 1212 | mfhi t_2 | ||
| 1213 | daddu c_1,t_1 | ||
| 1214 | sltu AT,c_1,t_1 | ||
| 1215 | daddu t_2,AT | ||
| 1216 | daddu c_2,t_2 | ||
| 1217 | sltu AT,c_2,t_2 | ||
| 1218 | daddu c_3,AT | ||
| 1219 | dmultu a_6,b_3 /* mul_add_c(a[6],b[3],c1,c2,c3); */ | ||
| 1220 | mflo t_1 | ||
| 1221 | mfhi t_2 | ||
| 1222 | daddu c_1,t_1 | ||
| 1223 | sltu AT,c_1,t_1 | ||
| 1224 | daddu t_2,AT | ||
| 1225 | daddu c_2,t_2 | ||
| 1226 | sltu AT,c_2,t_2 | ||
| 1227 | daddu c_3,AT | ||
| 1228 | dmultu a_7,b_2 /* mul_add_c(a[7],b[2],c1,c2,c3); */ | ||
| 1229 | mflo t_1 | ||
| 1230 | mfhi t_2 | ||
| 1231 | daddu c_1,t_1 | ||
| 1232 | sltu AT,c_1,t_1 | ||
| 1233 | daddu t_2,AT | ||
| 1234 | daddu c_2,t_2 | ||
| 1235 | sltu AT,c_2,t_2 | ||
| 1236 | daddu c_3,AT | ||
| 1237 | sd c_1,72(a0) /* r[9]=c1; */ | ||
| 1238 | |||
| 1239 | dmultu a_7,b_3 /* mul_add_c(a[7],b[3],c2,c3,c1); */ | ||
| 1240 | mflo t_1 | ||
| 1241 | mfhi t_2 | ||
| 1242 | daddu c_2,t_1 | ||
| 1243 | sltu AT,c_2,t_1 | ||
| 1244 | daddu t_2,AT | ||
| 1245 | daddu c_3,t_2 | ||
| 1246 | sltu c_1,c_3,t_2 | ||
| 1247 | dmultu a_6,b_4 /* mul_add_c(a[6],b[4],c2,c3,c1); */ | ||
| 1248 | mflo t_1 | ||
| 1249 | mfhi t_2 | ||
| 1250 | daddu c_2,t_1 | ||
| 1251 | sltu AT,c_2,t_1 | ||
| 1252 | daddu t_2,AT | ||
| 1253 | daddu c_3,t_2 | ||
| 1254 | sltu AT,c_3,t_2 | ||
| 1255 | daddu c_1,AT | ||
| 1256 | dmultu a_5,b_5 /* mul_add_c(a[5],b[5],c2,c3,c1); */ | ||
| 1257 | mflo t_1 | ||
| 1258 | mfhi t_2 | ||
| 1259 | daddu c_2,t_1 | ||
| 1260 | sltu AT,c_2,t_1 | ||
| 1261 | daddu t_2,AT | ||
| 1262 | daddu c_3,t_2 | ||
| 1263 | sltu AT,c_3,t_2 | ||
| 1264 | daddu c_1,AT | ||
| 1265 | dmultu a_4,b_6 /* mul_add_c(a[4],b[6],c2,c3,c1); */ | ||
| 1266 | mflo t_1 | ||
| 1267 | mfhi t_2 | ||
| 1268 | daddu c_2,t_1 | ||
| 1269 | sltu AT,c_2,t_1 | ||
| 1270 | daddu t_2,AT | ||
| 1271 | daddu c_3,t_2 | ||
| 1272 | sltu AT,c_3,t_2 | ||
| 1273 | daddu c_1,AT | ||
| 1274 | dmultu a_3,b_7 /* mul_add_c(a[3],b[7],c2,c3,c1); */ | ||
| 1275 | mflo t_1 | ||
| 1276 | mfhi t_2 | ||
| 1277 | daddu c_2,t_1 | ||
| 1278 | sltu AT,c_2,t_1 | ||
| 1279 | daddu t_2,AT | ||
| 1280 | daddu c_3,t_2 | ||
| 1281 | sltu AT,c_3,t_2 | ||
| 1282 | daddu c_1,AT | ||
| 1283 | sd c_2,80(a0) /* r[10]=c2; */ | ||
| 1284 | |||
| 1285 | dmultu a_4,b_7 /* mul_add_c(a[4],b[7],c3,c1,c2); */ | ||
| 1286 | mflo t_1 | ||
| 1287 | mfhi t_2 | ||
| 1288 | daddu c_3,t_1 | ||
| 1289 | sltu AT,c_3,t_1 | ||
| 1290 | daddu t_2,AT | ||
| 1291 | daddu c_1,t_2 | ||
| 1292 | sltu c_2,c_1,t_2 | ||
| 1293 | dmultu a_5,b_6 /* mul_add_c(a[5],b[6],c3,c1,c2); */ | ||
| 1294 | mflo t_1 | ||
| 1295 | mfhi t_2 | ||
| 1296 | daddu c_3,t_1 | ||
| 1297 | sltu AT,c_3,t_1 | ||
| 1298 | daddu t_2,AT | ||
| 1299 | daddu c_1,t_2 | ||
| 1300 | sltu AT,c_1,t_2 | ||
| 1301 | daddu c_2,AT | ||
| 1302 | dmultu a_6,b_5 /* mul_add_c(a[6],b[5],c3,c1,c2); */ | ||
| 1303 | mflo t_1 | ||
| 1304 | mfhi t_2 | ||
| 1305 | daddu c_3,t_1 | ||
| 1306 | sltu AT,c_3,t_1 | ||
| 1307 | daddu t_2,AT | ||
| 1308 | daddu c_1,t_2 | ||
| 1309 | sltu AT,c_1,t_2 | ||
| 1310 | daddu c_2,AT | ||
| 1311 | dmultu a_7,b_4 /* mul_add_c(a[7],b[4],c3,c1,c2); */ | ||
| 1312 | mflo t_1 | ||
| 1313 | mfhi t_2 | ||
| 1314 | daddu c_3,t_1 | ||
| 1315 | sltu AT,c_3,t_1 | ||
| 1316 | daddu t_2,AT | ||
| 1317 | daddu c_1,t_2 | ||
| 1318 | sltu AT,c_1,t_2 | ||
| 1319 | daddu c_2,AT | ||
| 1320 | sd c_3,88(a0) /* r[11]=c3; */ | ||
| 1321 | |||
| 1322 | dmultu a_7,b_5 /* mul_add_c(a[7],b[5],c1,c2,c3); */ | ||
| 1323 | mflo t_1 | ||
| 1324 | mfhi t_2 | ||
| 1325 | daddu c_1,t_1 | ||
| 1326 | sltu AT,c_1,t_1 | ||
| 1327 | daddu t_2,AT | ||
| 1328 | daddu c_2,t_2 | ||
| 1329 | sltu c_3,c_2,t_2 | ||
| 1330 | dmultu a_6,b_6 /* mul_add_c(a[6],b[6],c1,c2,c3); */ | ||
| 1331 | mflo t_1 | ||
| 1332 | mfhi t_2 | ||
| 1333 | daddu c_1,t_1 | ||
| 1334 | sltu AT,c_1,t_1 | ||
| 1335 | daddu t_2,AT | ||
| 1336 | daddu c_2,t_2 | ||
| 1337 | sltu AT,c_2,t_2 | ||
| 1338 | daddu c_3,AT | ||
| 1339 | dmultu a_5,b_7 /* mul_add_c(a[5],b[7],c1,c2,c3); */ | ||
| 1340 | mflo t_1 | ||
| 1341 | mfhi t_2 | ||
| 1342 | daddu c_1,t_1 | ||
| 1343 | sltu AT,c_1,t_1 | ||
| 1344 | daddu t_2,AT | ||
| 1345 | daddu c_2,t_2 | ||
| 1346 | sltu AT,c_2,t_2 | ||
| 1347 | daddu c_3,AT | ||
| 1348 | sd c_1,96(a0) /* r[12]=c1; */ | ||
| 1349 | |||
| 1350 | dmultu a_6,b_7 /* mul_add_c(a[6],b[7],c2,c3,c1); */ | ||
| 1351 | mflo t_1 | ||
| 1352 | mfhi t_2 | ||
| 1353 | daddu c_2,t_1 | ||
| 1354 | sltu AT,c_2,t_1 | ||
| 1355 | daddu t_2,AT | ||
| 1356 | daddu c_3,t_2 | ||
| 1357 | sltu c_1,c_3,t_2 | ||
| 1358 | dmultu a_7,b_6 /* mul_add_c(a[7],b[6],c2,c3,c1); */ | ||
| 1359 | mflo t_1 | ||
| 1360 | mfhi t_2 | ||
| 1361 | daddu c_2,t_1 | ||
| 1362 | sltu AT,c_2,t_1 | ||
| 1363 | daddu t_2,AT | ||
| 1364 | daddu c_3,t_2 | ||
| 1365 | sltu AT,c_3,t_2 | ||
| 1366 | daddu c_1,AT | ||
| 1367 | sd c_2,104(a0) /* r[13]=c2; */ | ||
| 1368 | |||
| 1369 | dmultu a_7,b_7 /* mul_add_c(a[7],b[7],c3,c1,c2); */ | ||
| 1370 | ld s0,0(sp) | ||
| 1371 | ld s1,8(sp) | ||
| 1372 | ld s2,16(sp) | ||
| 1373 | ld s3,24(sp) | ||
| 1374 | ld s4,32(sp) | ||
| 1375 | ld s5,40(sp) | ||
| 1376 | mflo t_1 | ||
| 1377 | mfhi t_2 | ||
| 1378 | daddu c_3,t_1 | ||
| 1379 | sltu AT,c_3,t_1 | ||
| 1380 | daddu t_2,AT | ||
| 1381 | daddu c_1,t_2 | ||
| 1382 | sd c_3,112(a0) /* r[14]=c3; */ | ||
| 1383 | sd c_1,120(a0) /* r[15]=c1; */ | ||
| 1384 | |||
| 1385 | PTR_ADD sp,FRAME_SIZE | ||
| 1386 | |||
| 1387 | jr ra | ||
| 1388 | END(bn_mul_comba8) | ||
| 1389 | |||
| 1390 | .align 5 | ||
| 1391 | LEAF(bn_mul_comba4) | ||
| 1392 | .set reorder | ||
| 1393 | ld a_0,0(a1) | ||
| 1394 | ld b_0,0(a2) | ||
| 1395 | ld a_1,8(a1) | ||
| 1396 | ld a_2,16(a1) | ||
| 1397 | dmultu a_0,b_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */ | ||
| 1398 | ld a_3,24(a1) | ||
| 1399 | ld b_1,8(a2) | ||
| 1400 | ld b_2,16(a2) | ||
| 1401 | ld b_3,24(a2) | ||
| 1402 | mflo c_1 | ||
| 1403 | mfhi c_2 | ||
| 1404 | sd c_1,0(a0) | ||
| 1405 | |||
| 1406 | dmultu a_0,b_1 /* mul_add_c(a[0],b[1],c2,c3,c1); */ | ||
| 1407 | mflo t_1 | ||
| 1408 | mfhi t_2 | ||
| 1409 | daddu c_2,t_1 | ||
| 1410 | sltu AT,c_2,t_1 | ||
| 1411 | daddu c_3,t_2,AT | ||
| 1412 | dmultu a_1,b_0 /* mul_add_c(a[1],b[0],c2,c3,c1); */ | ||
| 1413 | mflo t_1 | ||
| 1414 | mfhi t_2 | ||
| 1415 | daddu c_2,t_1 | ||
| 1416 | sltu AT,c_2,t_1 | ||
| 1417 | daddu t_2,AT | ||
| 1418 | daddu c_3,t_2 | ||
| 1419 | sltu c_1,c_3,t_2 | ||
| 1420 | sd c_2,8(a0) | ||
| 1421 | |||
| 1422 | dmultu a_2,b_0 /* mul_add_c(a[2],b[0],c3,c1,c2); */ | ||
| 1423 | mflo t_1 | ||
| 1424 | mfhi t_2 | ||
| 1425 | daddu c_3,t_1 | ||
| 1426 | sltu AT,c_3,t_1 | ||
| 1427 | daddu t_2,AT | ||
| 1428 | daddu c_1,t_2 | ||
| 1429 | dmultu a_1,b_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */ | ||
| 1430 | mflo t_1 | ||
| 1431 | mfhi t_2 | ||
| 1432 | daddu c_3,t_1 | ||
| 1433 | sltu AT,c_3,t_1 | ||
| 1434 | daddu t_2,AT | ||
| 1435 | daddu c_1,t_2 | ||
| 1436 | sltu c_2,c_1,t_2 | ||
| 1437 | dmultu a_0,b_2 /* mul_add_c(a[0],b[2],c3,c1,c2); */ | ||
| 1438 | mflo t_1 | ||
| 1439 | mfhi t_2 | ||
| 1440 | daddu c_3,t_1 | ||
| 1441 | sltu AT,c_3,t_1 | ||
| 1442 | daddu t_2,AT | ||
| 1443 | daddu c_1,t_2 | ||
| 1444 | sltu AT,c_1,t_2 | ||
| 1445 | daddu c_2,AT | ||
| 1446 | sd c_3,16(a0) | ||
| 1447 | |||
| 1448 | dmultu a_0,b_3 /* mul_add_c(a[0],b[3],c1,c2,c3); */ | ||
| 1449 | mflo t_1 | ||
| 1450 | mfhi t_2 | ||
| 1451 | daddu c_1,t_1 | ||
| 1452 | sltu AT,c_1,t_1 | ||
| 1453 | daddu t_2,AT | ||
| 1454 | daddu c_2,t_2 | ||
| 1455 | sltu c_3,c_2,t_2 | ||
| 1456 | dmultu a_1,b_2 /* mul_add_c(a[1],b[2],c1,c2,c3); */ | ||
| 1457 | mflo t_1 | ||
| 1458 | mfhi t_2 | ||
| 1459 | daddu c_1,t_1 | ||
| 1460 | sltu AT,c_1,t_1 | ||
| 1461 | daddu t_2,AT | ||
| 1462 | daddu c_2,t_2 | ||
| 1463 | sltu AT,c_2,t_2 | ||
| 1464 | daddu c_3,AT | ||
| 1465 | dmultu a_2,b_1 /* mul_add_c(a[2],b[1],c1,c2,c3); */ | ||
| 1466 | mflo t_1 | ||
| 1467 | mfhi t_2 | ||
| 1468 | daddu c_1,t_1 | ||
| 1469 | sltu AT,c_1,t_1 | ||
| 1470 | daddu t_2,AT | ||
| 1471 | daddu c_2,t_2 | ||
| 1472 | sltu AT,c_2,t_2 | ||
| 1473 | daddu c_3,AT | ||
| 1474 | dmultu a_3,b_0 /* mul_add_c(a[3],b[0],c1,c2,c3); */ | ||
| 1475 | mflo t_1 | ||
| 1476 | mfhi t_2 | ||
| 1477 | daddu c_1,t_1 | ||
| 1478 | sltu AT,c_1,t_1 | ||
| 1479 | daddu t_2,AT | ||
| 1480 | daddu c_2,t_2 | ||
| 1481 | sltu AT,c_2,t_2 | ||
| 1482 | daddu c_3,AT | ||
| 1483 | sd c_1,24(a0) | ||
| 1484 | |||
| 1485 | dmultu a_3,b_1 /* mul_add_c(a[3],b[1],c2,c3,c1); */ | ||
| 1486 | mflo t_1 | ||
| 1487 | mfhi t_2 | ||
| 1488 | daddu c_2,t_1 | ||
| 1489 | sltu AT,c_2,t_1 | ||
| 1490 | daddu t_2,AT | ||
| 1491 | daddu c_3,t_2 | ||
| 1492 | sltu c_1,c_3,t_2 | ||
| 1493 | dmultu a_2,b_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */ | ||
| 1494 | mflo t_1 | ||
| 1495 | mfhi t_2 | ||
| 1496 | daddu c_2,t_1 | ||
| 1497 | sltu AT,c_2,t_1 | ||
| 1498 | daddu t_2,AT | ||
| 1499 | daddu c_3,t_2 | ||
| 1500 | sltu AT,c_3,t_2 | ||
| 1501 | daddu c_1,AT | ||
| 1502 | dmultu a_1,b_3 /* mul_add_c(a[1],b[3],c2,c3,c1); */ | ||
| 1503 | mflo t_1 | ||
| 1504 | mfhi t_2 | ||
| 1505 | daddu c_2,t_1 | ||
| 1506 | sltu AT,c_2,t_1 | ||
| 1507 | daddu t_2,AT | ||
| 1508 | daddu c_3,t_2 | ||
| 1509 | sltu AT,c_3,t_2 | ||
| 1510 | daddu c_1,AT | ||
| 1511 | sd c_2,32(a0) | ||
| 1512 | |||
| 1513 | dmultu a_2,b_3 /* mul_add_c(a[2],b[3],c3,c1,c2); */ | ||
| 1514 | mflo t_1 | ||
| 1515 | mfhi t_2 | ||
| 1516 | daddu c_3,t_1 | ||
| 1517 | sltu AT,c_3,t_1 | ||
| 1518 | daddu t_2,AT | ||
| 1519 | daddu c_1,t_2 | ||
| 1520 | sltu c_2,c_1,t_2 | ||
| 1521 | dmultu a_3,b_2 /* mul_add_c(a[3],b[2],c3,c1,c2); */ | ||
| 1522 | mflo t_1 | ||
| 1523 | mfhi t_2 | ||
| 1524 | daddu c_3,t_1 | ||
| 1525 | sltu AT,c_3,t_1 | ||
| 1526 | daddu t_2,AT | ||
| 1527 | daddu c_1,t_2 | ||
| 1528 | sltu AT,c_1,t_2 | ||
| 1529 | daddu c_2,AT | ||
| 1530 | sd c_3,40(a0) | ||
| 1531 | |||
| 1532 | dmultu a_3,b_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */ | ||
| 1533 | mflo t_1 | ||
| 1534 | mfhi t_2 | ||
| 1535 | daddu c_1,t_1 | ||
| 1536 | sltu AT,c_1,t_1 | ||
| 1537 | daddu t_2,AT | ||
| 1538 | daddu c_2,t_2 | ||
| 1539 | sd c_1,48(a0) | ||
| 1540 | sd c_2,56(a0) | ||
| 1541 | |||
| 1542 | jr ra | ||
| 1543 | END(bn_mul_comba4) | ||
| 1544 | |||
| 1545 | #undef a_4 | ||
| 1546 | #undef a_5 | ||
| 1547 | #undef a_6 | ||
| 1548 | #undef a_7 | ||
| 1549 | #define a_4 b_0 | ||
| 1550 | #define a_5 b_1 | ||
| 1551 | #define a_6 b_2 | ||
| 1552 | #define a_7 b_3 | ||
| 1553 | |||
| 1554 | .align 5 | ||
| 1555 | LEAF(bn_sqr_comba8) | ||
| 1556 | .set reorder | ||
| 1557 | ld a_0,0(a1) | ||
| 1558 | ld a_1,8(a1) | ||
| 1559 | ld a_2,16(a1) | ||
| 1560 | ld a_3,24(a1) | ||
| 1561 | |||
| 1562 | dmultu a_0,a_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */ | ||
| 1563 | ld a_4,32(a1) | ||
| 1564 | ld a_5,40(a1) | ||
| 1565 | ld a_6,48(a1) | ||
| 1566 | ld a_7,56(a1) | ||
| 1567 | mflo c_1 | ||
| 1568 | mfhi c_2 | ||
| 1569 | sd c_1,0(a0) | ||
| 1570 | |||
| 1571 | dmultu a_0,a_1 /* mul_add_c2(a[0],b[1],c2,c3,c1); */ | ||
| 1572 | mflo t_1 | ||
| 1573 | mfhi t_2 | ||
| 1574 | slt c_1,t_2,zero | ||
| 1575 | dsll t_2,1 | ||
| 1576 | slt a2,t_1,zero | ||
| 1577 | daddu t_2,a2 | ||
| 1578 | dsll t_1,1 | ||
| 1579 | daddu c_2,t_1 | ||
| 1580 | sltu AT,c_2,t_1 | ||
| 1581 | daddu c_3,t_2,AT | ||
| 1582 | sd c_2,8(a0) | ||
| 1583 | |||
| 1584 | dmultu a_2,a_0 /* mul_add_c2(a[2],b[0],c3,c1,c2); */ | ||
| 1585 | mflo t_1 | ||
| 1586 | mfhi t_2 | ||
| 1587 | slt c_2,t_2,zero | ||
| 1588 | dsll t_2,1 | ||
| 1589 | slt a2,t_1,zero | ||
| 1590 | daddu t_2,a2 | ||
| 1591 | dsll t_1,1 | ||
| 1592 | daddu c_3,t_1 | ||
| 1593 | sltu AT,c_3,t_1 | ||
| 1594 | daddu t_2,AT | ||
| 1595 | daddu c_1,t_2 | ||
| 1596 | sltu AT,c_1,t_2 | ||
| 1597 | daddu c_2,AT | ||
| 1598 | dmultu a_1,a_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */ | ||
| 1599 | mflo t_1 | ||
| 1600 | mfhi t_2 | ||
| 1601 | daddu c_3,t_1 | ||
| 1602 | sltu AT,c_3,t_1 | ||
| 1603 | daddu t_2,AT | ||
| 1604 | daddu c_1,t_2 | ||
| 1605 | sltu AT,c_1,t_2 | ||
| 1606 | daddu c_2,AT | ||
| 1607 | sd c_3,16(a0) | ||
| 1608 | |||
| 1609 | dmultu a_0,a_3 /* mul_add_c2(a[0],b[3],c1,c2,c3); */ | ||
| 1610 | mflo t_1 | ||
| 1611 | mfhi t_2 | ||
| 1612 | slt c_3,t_2,zero | ||
| 1613 | dsll t_2,1 | ||
| 1614 | slt a2,t_1,zero | ||
| 1615 | daddu t_2,a2 | ||
| 1616 | dsll t_1,1 | ||
| 1617 | daddu c_1,t_1 | ||
| 1618 | sltu AT,c_1,t_1 | ||
| 1619 | daddu t_2,AT | ||
| 1620 | daddu c_2,t_2 | ||
| 1621 | sltu AT,c_2,t_2 | ||
| 1622 | daddu c_3,AT | ||
| 1623 | dmultu a_1,a_2 /* mul_add_c2(a[1],b[2],c1,c2,c3); */ | ||
| 1624 | mflo t_1 | ||
| 1625 | mfhi t_2 | ||
| 1626 | slt AT,t_2,zero | ||
| 1627 | daddu c_3,AT | ||
| 1628 | dsll t_2,1 | ||
| 1629 | slt a2,t_1,zero | ||
| 1630 | daddu t_2,a2 | ||
| 1631 | dsll t_1,1 | ||
| 1632 | daddu c_1,t_1 | ||
| 1633 | sltu AT,c_1,t_1 | ||
| 1634 | daddu t_2,AT | ||
| 1635 | daddu c_2,t_2 | ||
| 1636 | sltu AT,c_2,t_2 | ||
| 1637 | daddu c_3,AT | ||
| 1638 | sd c_1,24(a0) | ||
| 1639 | |||
| 1640 | dmultu a_4,a_0 /* mul_add_c2(a[4],b[0],c2,c3,c1); */ | ||
| 1641 | mflo t_1 | ||
| 1642 | mfhi t_2 | ||
| 1643 | slt c_1,t_2,zero | ||
| 1644 | dsll t_2,1 | ||
| 1645 | slt a2,t_1,zero | ||
| 1646 | daddu t_2,a2 | ||
| 1647 | dsll t_1,1 | ||
| 1648 | daddu c_2,t_1 | ||
| 1649 | sltu AT,c_2,t_1 | ||
| 1650 | daddu t_2,AT | ||
| 1651 | daddu c_3,t_2 | ||
| 1652 | sltu AT,c_3,t_2 | ||
| 1653 | daddu c_1,AT | ||
| 1654 | dmultu a_3,a_1 /* mul_add_c2(a[3],b[1],c2,c3,c1); */ | ||
| 1655 | mflo t_1 | ||
| 1656 | mfhi t_2 | ||
| 1657 | slt AT,t_2,zero | ||
| 1658 | daddu c_1,AT | ||
| 1659 | dsll t_2,1 | ||
| 1660 | slt a2,t_1,zero | ||
| 1661 | daddu t_2,a2 | ||
| 1662 | dsll t_1,1 | ||
| 1663 | daddu c_2,t_1 | ||
| 1664 | sltu AT,c_2,t_1 | ||
| 1665 | daddu t_2,AT | ||
| 1666 | daddu c_3,t_2 | ||
| 1667 | sltu AT,c_3,t_2 | ||
| 1668 | daddu c_1,AT | ||
| 1669 | dmultu a_2,a_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */ | ||
| 1670 | mflo t_1 | ||
| 1671 | mfhi t_2 | ||
| 1672 | daddu c_2,t_1 | ||
| 1673 | sltu AT,c_2,t_1 | ||
| 1674 | daddu t_2,AT | ||
| 1675 | daddu c_3,t_2 | ||
| 1676 | sltu AT,c_3,t_2 | ||
| 1677 | daddu c_1,AT | ||
| 1678 | sd c_2,32(a0) | ||
| 1679 | |||
| 1680 | dmultu a_0,a_5 /* mul_add_c2(a[0],b[5],c3,c1,c2); */ | ||
| 1681 | mflo t_1 | ||
| 1682 | mfhi t_2 | ||
| 1683 | slt c_2,t_2,zero | ||
| 1684 | dsll t_2,1 | ||
| 1685 | slt a2,t_1,zero | ||
| 1686 | daddu t_2,a2 | ||
| 1687 | dsll t_1,1 | ||
| 1688 | daddu c_3,t_1 | ||
| 1689 | sltu AT,c_3,t_1 | ||
| 1690 | daddu t_2,AT | ||
| 1691 | daddu c_1,t_2 | ||
| 1692 | sltu AT,c_1,t_2 | ||
| 1693 | daddu c_2,AT | ||
| 1694 | dmultu a_1,a_4 /* mul_add_c2(a[1],b[4],c3,c1,c2); */ | ||
| 1695 | mflo t_1 | ||
| 1696 | mfhi t_2 | ||
| 1697 | slt AT,t_2,zero | ||
| 1698 | daddu c_2,AT | ||
| 1699 | dsll t_2,1 | ||
| 1700 | slt a2,t_1,zero | ||
| 1701 | daddu t_2,a2 | ||
| 1702 | dsll t_1,1 | ||
| 1703 | daddu c_3,t_1 | ||
| 1704 | sltu AT,c_3,t_1 | ||
| 1705 | daddu t_2,AT | ||
| 1706 | daddu c_1,t_2 | ||
| 1707 | sltu AT,c_1,t_2 | ||
| 1708 | daddu c_2,AT | ||
| 1709 | dmultu a_2,a_3 /* mul_add_c2(a[2],b[3],c3,c1,c2); */ | ||
| 1710 | mflo t_1 | ||
| 1711 | mfhi t_2 | ||
| 1712 | slt AT,t_2,zero | ||
| 1713 | daddu c_2,AT | ||
| 1714 | dsll t_2,1 | ||
| 1715 | slt a2,t_1,zero | ||
| 1716 | daddu t_2,a2 | ||
| 1717 | dsll t_1,1 | ||
| 1718 | daddu c_3,t_1 | ||
| 1719 | sltu AT,c_3,t_1 | ||
| 1720 | daddu t_2,AT | ||
| 1721 | daddu c_1,t_2 | ||
| 1722 | sltu AT,c_1,t_2 | ||
| 1723 | daddu c_2,AT | ||
| 1724 | sd c_3,40(a0) | ||
| 1725 | |||
| 1726 | dmultu a_6,a_0 /* mul_add_c2(a[6],b[0],c1,c2,c3); */ | ||
| 1727 | mflo t_1 | ||
| 1728 | mfhi t_2 | ||
| 1729 | slt c_3,t_2,zero | ||
| 1730 | dsll t_2,1 | ||
| 1731 | slt a2,t_1,zero | ||
| 1732 | daddu t_2,a2 | ||
| 1733 | dsll t_1,1 | ||
| 1734 | daddu c_1,t_1 | ||
| 1735 | sltu AT,c_1,t_1 | ||
| 1736 | daddu t_2,AT | ||
| 1737 | daddu c_2,t_2 | ||
| 1738 | sltu AT,c_2,t_2 | ||
| 1739 | daddu c_3,AT | ||
| 1740 | dmultu a_5,a_1 /* mul_add_c2(a[5],b[1],c1,c2,c3); */ | ||
| 1741 | mflo t_1 | ||
| 1742 | mfhi t_2 | ||
| 1743 | slt AT,t_2,zero | ||
| 1744 | daddu c_3,AT | ||
| 1745 | dsll t_2,1 | ||
| 1746 | slt a2,t_1,zero | ||
| 1747 | daddu t_2,a2 | ||
| 1748 | dsll t_1,1 | ||
| 1749 | daddu c_1,t_1 | ||
| 1750 | sltu AT,c_1,t_1 | ||
| 1751 | daddu t_2,AT | ||
| 1752 | daddu c_2,t_2 | ||
| 1753 | sltu AT,c_2,t_2 | ||
| 1754 | daddu c_3,AT | ||
| 1755 | dmultu a_4,a_2 /* mul_add_c2(a[4],b[2],c1,c2,c3); */ | ||
| 1756 | mflo t_1 | ||
| 1757 | mfhi t_2 | ||
| 1758 | slt AT,t_2,zero | ||
| 1759 | daddu c_3,AT | ||
| 1760 | dsll t_2,1 | ||
| 1761 | slt a2,t_1,zero | ||
| 1762 | daddu t_2,a2 | ||
| 1763 | dsll t_1,1 | ||
| 1764 | daddu c_1,t_1 | ||
| 1765 | sltu AT,c_1,t_1 | ||
| 1766 | daddu t_2,AT | ||
| 1767 | daddu c_2,t_2 | ||
| 1768 | sltu AT,c_2,t_2 | ||
| 1769 | daddu c_3,AT | ||
| 1770 | dmultu a_3,a_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */ | ||
| 1771 | mflo t_1 | ||
| 1772 | mfhi t_2 | ||
| 1773 | daddu c_1,t_1 | ||
| 1774 | sltu AT,c_1,t_1 | ||
| 1775 | daddu t_2,AT | ||
| 1776 | daddu c_2,t_2 | ||
| 1777 | sltu AT,c_2,t_2 | ||
| 1778 | daddu c_3,AT | ||
| 1779 | sd c_1,48(a0) | ||
| 1780 | |||
| 1781 | dmultu a_0,a_7 /* mul_add_c2(a[0],b[7],c2,c3,c1); */ | ||
| 1782 | mflo t_1 | ||
| 1783 | mfhi t_2 | ||
| 1784 | slt c_1,t_2,zero | ||
| 1785 | dsll t_2,1 | ||
| 1786 | slt a2,t_1,zero | ||
| 1787 | daddu t_2,a2 | ||
| 1788 | dsll t_1,1 | ||
| 1789 | daddu c_2,t_1 | ||
| 1790 | sltu AT,c_2,t_1 | ||
| 1791 | daddu t_2,AT | ||
| 1792 | daddu c_3,t_2 | ||
| 1793 | sltu AT,c_3,t_2 | ||
| 1794 | daddu c_1,AT | ||
| 1795 | dmultu a_1,a_6 /* mul_add_c2(a[1],b[6],c2,c3,c1); */ | ||
| 1796 | mflo t_1 | ||
| 1797 | mfhi t_2 | ||
| 1798 | slt AT,t_2,zero | ||
| 1799 | daddu c_1,AT | ||
| 1800 | dsll t_2,1 | ||
| 1801 | slt a2,t_1,zero | ||
| 1802 | daddu t_2,a2 | ||
| 1803 | dsll t_1,1 | ||
| 1804 | daddu c_2,t_1 | ||
| 1805 | sltu AT,c_2,t_1 | ||
| 1806 | daddu t_2,AT | ||
| 1807 | daddu c_3,t_2 | ||
| 1808 | sltu AT,c_3,t_2 | ||
| 1809 | daddu c_1,AT | ||
| 1810 | dmultu a_2,a_5 /* mul_add_c2(a[2],b[5],c2,c3,c1); */ | ||
| 1811 | mflo t_1 | ||
| 1812 | mfhi t_2 | ||
| 1813 | slt AT,t_2,zero | ||
| 1814 | daddu c_1,AT | ||
| 1815 | dsll t_2,1 | ||
| 1816 | slt a2,t_1,zero | ||
| 1817 | daddu t_2,a2 | ||
| 1818 | dsll t_1,1 | ||
| 1819 | daddu c_2,t_1 | ||
| 1820 | sltu AT,c_2,t_1 | ||
| 1821 | daddu t_2,AT | ||
| 1822 | daddu c_3,t_2 | ||
| 1823 | sltu AT,c_3,t_2 | ||
| 1824 | daddu c_1,AT | ||
| 1825 | dmultu a_3,a_4 /* mul_add_c2(a[3],b[4],c2,c3,c1); */ | ||
| 1826 | mflo t_1 | ||
| 1827 | mfhi t_2 | ||
| 1828 | slt AT,t_2,zero | ||
| 1829 | daddu c_1,AT | ||
| 1830 | dsll t_2,1 | ||
| 1831 | slt a2,t_1,zero | ||
| 1832 | daddu t_2,a2 | ||
| 1833 | dsll t_1,1 | ||
| 1834 | daddu c_2,t_1 | ||
| 1835 | sltu AT,c_2,t_1 | ||
| 1836 | daddu t_2,AT | ||
| 1837 | daddu c_3,t_2 | ||
| 1838 | sltu AT,c_3,t_2 | ||
| 1839 | daddu c_1,AT | ||
| 1840 | sd c_2,56(a0) | ||
| 1841 | |||
| 1842 | dmultu a_7,a_1 /* mul_add_c2(a[7],b[1],c3,c1,c2); */ | ||
| 1843 | mflo t_1 | ||
| 1844 | mfhi t_2 | ||
| 1845 | slt c_2,t_2,zero | ||
| 1846 | dsll t_2,1 | ||
| 1847 | slt a2,t_1,zero | ||
| 1848 | daddu t_2,a2 | ||
| 1849 | dsll t_1,1 | ||
| 1850 | daddu c_3,t_1 | ||
| 1851 | sltu AT,c_3,t_1 | ||
| 1852 | daddu t_2,AT | ||
| 1853 | daddu c_1,t_2 | ||
| 1854 | sltu AT,c_1,t_2 | ||
| 1855 | daddu c_2,AT | ||
| 1856 | dmultu a_6,a_2 /* mul_add_c2(a[6],b[2],c3,c1,c2); */ | ||
| 1857 | mflo t_1 | ||
| 1858 | mfhi t_2 | ||
| 1859 | slt AT,t_2,zero | ||
| 1860 | daddu c_2,AT | ||
| 1861 | dsll t_2,1 | ||
| 1862 | slt a2,t_1,zero | ||
| 1863 | daddu t_2,a2 | ||
| 1864 | dsll t_1,1 | ||
| 1865 | daddu c_3,t_1 | ||
| 1866 | sltu AT,c_3,t_1 | ||
| 1867 | daddu t_2,AT | ||
| 1868 | daddu c_1,t_2 | ||
| 1869 | sltu AT,c_1,t_2 | ||
| 1870 | daddu c_2,AT | ||
| 1871 | dmultu a_5,a_3 /* mul_add_c2(a[5],b[3],c3,c1,c2); */ | ||
| 1872 | mflo t_1 | ||
| 1873 | mfhi t_2 | ||
| 1874 | slt AT,t_2,zero | ||
| 1875 | daddu c_2,AT | ||
| 1876 | dsll t_2,1 | ||
| 1877 | slt a2,t_1,zero | ||
| 1878 | daddu t_2,a2 | ||
| 1879 | dsll t_1,1 | ||
| 1880 | daddu c_3,t_1 | ||
| 1881 | sltu AT,c_3,t_1 | ||
| 1882 | daddu t_2,AT | ||
| 1883 | daddu c_1,t_2 | ||
| 1884 | sltu AT,c_1,t_2 | ||
| 1885 | daddu c_2,AT | ||
| 1886 | dmultu a_4,a_4 /* mul_add_c(a[4],b[4],c3,c1,c2); */ | ||
| 1887 | mflo t_1 | ||
| 1888 | mfhi t_2 | ||
| 1889 | daddu c_3,t_1 | ||
| 1890 | sltu AT,c_3,t_1 | ||
| 1891 | daddu t_2,AT | ||
| 1892 | daddu c_1,t_2 | ||
| 1893 | sltu AT,c_1,t_2 | ||
| 1894 | daddu c_2,AT | ||
| 1895 | sd c_3,64(a0) | ||
| 1896 | |||
| 1897 | dmultu a_2,a_7 /* mul_add_c2(a[2],b[7],c1,c2,c3); */ | ||
| 1898 | mflo t_1 | ||
| 1899 | mfhi t_2 | ||
| 1900 | slt c_3,t_2,zero | ||
| 1901 | dsll t_2,1 | ||
| 1902 | slt a2,t_1,zero | ||
| 1903 | daddu t_2,a2 | ||
| 1904 | dsll t_1,1 | ||
| 1905 | daddu c_1,t_1 | ||
| 1906 | sltu AT,c_1,t_1 | ||
| 1907 | daddu t_2,AT | ||
| 1908 | daddu c_2,t_2 | ||
| 1909 | sltu AT,c_2,t_2 | ||
| 1910 | daddu c_3,AT | ||
| 1911 | dmultu a_3,a_6 /* mul_add_c2(a[3],b[6],c1,c2,c3); */ | ||
| 1912 | mflo t_1 | ||
| 1913 | mfhi t_2 | ||
| 1914 | slt AT,t_2,zero | ||
| 1915 | daddu c_3,AT | ||
| 1916 | dsll t_2,1 | ||
| 1917 | slt a2,t_1,zero | ||
| 1918 | daddu t_2,a2 | ||
| 1919 | dsll t_1,1 | ||
| 1920 | daddu c_1,t_1 | ||
| 1921 | sltu AT,c_1,t_1 | ||
| 1922 | daddu t_2,AT | ||
| 1923 | daddu c_2,t_2 | ||
| 1924 | sltu AT,c_2,t_2 | ||
| 1925 | daddu c_3,AT | ||
| 1926 | dmultu a_4,a_5 /* mul_add_c2(a[4],b[5],c1,c2,c3); */ | ||
| 1927 | mflo t_1 | ||
| 1928 | mfhi t_2 | ||
| 1929 | slt AT,t_2,zero | ||
| 1930 | daddu c_3,AT | ||
| 1931 | dsll t_2,1 | ||
| 1932 | slt a2,t_1,zero | ||
| 1933 | daddu t_2,a2 | ||
| 1934 | dsll t_1,1 | ||
| 1935 | daddu c_1,t_1 | ||
| 1936 | sltu AT,c_1,t_1 | ||
| 1937 | daddu t_2,AT | ||
| 1938 | daddu c_2,t_2 | ||
| 1939 | sltu AT,c_2,t_2 | ||
| 1940 | daddu c_3,AT | ||
| 1941 | sd c_1,72(a0) | ||
| 1942 | |||
| 1943 | dmultu a_7,a_3 /* mul_add_c2(a[7],b[3],c2,c3,c1); */ | ||
| 1944 | mflo t_1 | ||
| 1945 | mfhi t_2 | ||
| 1946 | slt c_1,t_2,zero | ||
| 1947 | dsll t_2,1 | ||
| 1948 | slt a2,t_1,zero | ||
| 1949 | daddu t_2,a2 | ||
| 1950 | dsll t_1,1 | ||
| 1951 | daddu c_2,t_1 | ||
| 1952 | sltu AT,c_2,t_1 | ||
| 1953 | daddu t_2,AT | ||
| 1954 | daddu c_3,t_2 | ||
| 1955 | sltu AT,c_3,t_2 | ||
| 1956 | daddu c_1,AT | ||
| 1957 | dmultu a_6,a_4 /* mul_add_c2(a[6],b[4],c2,c3,c1); */ | ||
| 1958 | mflo t_1 | ||
| 1959 | mfhi t_2 | ||
| 1960 | slt AT,t_2,zero | ||
| 1961 | daddu c_1,AT | ||
| 1962 | dsll t_2,1 | ||
| 1963 | slt a2,t_1,zero | ||
| 1964 | daddu t_2,a2 | ||
| 1965 | dsll t_1,1 | ||
| 1966 | daddu c_2,t_1 | ||
| 1967 | sltu AT,c_2,t_1 | ||
| 1968 | daddu t_2,AT | ||
| 1969 | daddu c_3,t_2 | ||
| 1970 | sltu AT,c_3,t_2 | ||
| 1971 | daddu c_1,AT | ||
| 1972 | dmultu a_5,a_5 /* mul_add_c(a[5],b[5],c2,c3,c1); */ | ||
| 1973 | mflo t_1 | ||
| 1974 | mfhi t_2 | ||
| 1975 | daddu c_2,t_1 | ||
| 1976 | sltu AT,c_2,t_1 | ||
| 1977 | daddu t_2,AT | ||
| 1978 | daddu c_3,t_2 | ||
| 1979 | sltu AT,c_3,t_2 | ||
| 1980 | daddu c_1,AT | ||
| 1981 | sd c_2,80(a0) | ||
| 1982 | |||
| 1983 | dmultu a_4,a_7 /* mul_add_c2(a[4],b[7],c3,c1,c2); */ | ||
| 1984 | mflo t_1 | ||
| 1985 | mfhi t_2 | ||
| 1986 | slt c_2,t_2,zero | ||
| 1987 | dsll t_2,1 | ||
| 1988 | slt a2,t_1,zero | ||
| 1989 | daddu t_2,a2 | ||
| 1990 | dsll t_1,1 | ||
| 1991 | daddu c_3,t_1 | ||
| 1992 | sltu AT,c_3,t_1 | ||
| 1993 | daddu t_2,AT | ||
| 1994 | daddu c_1,t_2 | ||
| 1995 | sltu AT,c_1,t_2 | ||
| 1996 | daddu c_2,AT | ||
| 1997 | dmultu a_5,a_6 /* mul_add_c2(a[5],b[6],c3,c1,c2); */ | ||
| 1998 | mflo t_1 | ||
| 1999 | mfhi t_2 | ||
| 2000 | slt AT,t_2,zero | ||
| 2001 | daddu c_2,AT | ||
| 2002 | dsll t_2,1 | ||
| 2003 | slt a2,t_1,zero | ||
| 2004 | daddu t_2,a2 | ||
| 2005 | dsll t_1,1 | ||
| 2006 | daddu c_3,t_1 | ||
| 2007 | sltu AT,c_3,t_1 | ||
| 2008 | daddu t_2,AT | ||
| 2009 | daddu c_1,t_2 | ||
| 2010 | sltu AT,c_1,t_2 | ||
| 2011 | daddu c_2,AT | ||
| 2012 | sd c_3,88(a0) | ||
| 2013 | |||
| 2014 | dmultu a_7,a_5 /* mul_add_c2(a[7],b[5],c1,c2,c3); */ | ||
| 2015 | mflo t_1 | ||
| 2016 | mfhi t_2 | ||
| 2017 | slt c_3,t_2,zero | ||
| 2018 | dsll t_2,1 | ||
| 2019 | slt a2,t_1,zero | ||
| 2020 | daddu t_2,a2 | ||
| 2021 | dsll t_1,1 | ||
| 2022 | daddu c_1,t_1 | ||
| 2023 | sltu AT,c_1,t_1 | ||
| 2024 | daddu t_2,AT | ||
| 2025 | daddu c_2,t_2 | ||
| 2026 | sltu AT,c_2,t_2 | ||
| 2027 | daddu c_3,AT | ||
| 2028 | dmultu a_6,a_6 /* mul_add_c(a[6],b[6],c1,c2,c3); */ | ||
| 2029 | mflo t_1 | ||
| 2030 | mfhi t_2 | ||
| 2031 | daddu c_1,t_1 | ||
| 2032 | sltu AT,c_1,t_1 | ||
| 2033 | daddu t_2,AT | ||
| 2034 | daddu c_2,t_2 | ||
| 2035 | sltu AT,c_2,t_2 | ||
| 2036 | daddu c_3,AT | ||
| 2037 | sd c_1,96(a0) | ||
| 2038 | |||
| 2039 | dmultu a_6,a_7 /* mul_add_c2(a[6],b[7],c2,c3,c1); */ | ||
| 2040 | mflo t_1 | ||
| 2041 | mfhi t_2 | ||
| 2042 | slt c_1,t_2,zero | ||
| 2043 | dsll t_2,1 | ||
| 2044 | slt a2,t_1,zero | ||
| 2045 | daddu t_2,a2 | ||
| 2046 | dsll t_1,1 | ||
| 2047 | daddu c_2,t_1 | ||
| 2048 | sltu AT,c_2,t_1 | ||
| 2049 | daddu t_2,AT | ||
| 2050 | daddu c_3,t_2 | ||
| 2051 | sltu AT,c_3,t_2 | ||
| 2052 | daddu c_1,AT | ||
| 2053 | sd c_2,104(a0) | ||
| 2054 | |||
| 2055 | dmultu a_7,a_7 /* mul_add_c(a[7],b[7],c3,c1,c2); */ | ||
| 2056 | mflo t_1 | ||
| 2057 | mfhi t_2 | ||
| 2058 | daddu c_3,t_1 | ||
| 2059 | sltu AT,c_3,t_1 | ||
| 2060 | daddu t_2,AT | ||
| 2061 | daddu c_1,t_2 | ||
| 2062 | sd c_3,112(a0) | ||
| 2063 | sd c_1,120(a0) | ||
| 2064 | |||
| 2065 | jr ra | ||
| 2066 | END(bn_sqr_comba8) | ||
| 2067 | |||
| 2068 | .align 5 | ||
| 2069 | LEAF(bn_sqr_comba4) | ||
| 2070 | .set reorder | ||
| 2071 | ld a_0,0(a1) | ||
| 2072 | ld a_1,8(a1) | ||
| 2073 | ld a_2,16(a1) | ||
| 2074 | ld a_3,24(a1) | ||
| 2075 | dmultu a_0,a_0 /* mul_add_c(a[0],b[0],c1,c2,c3); */ | ||
| 2076 | mflo c_1 | ||
| 2077 | mfhi c_2 | ||
| 2078 | sd c_1,0(a0) | ||
| 2079 | |||
| 2080 | dmultu a_0,a_1 /* mul_add_c2(a[0],b[1],c2,c3,c1); */ | ||
| 2081 | mflo t_1 | ||
| 2082 | mfhi t_2 | ||
| 2083 | slt c_1,t_2,zero | ||
| 2084 | dsll t_2,1 | ||
| 2085 | slt a2,t_1,zero | ||
| 2086 | daddu t_2,a2 | ||
| 2087 | dsll t_1,1 | ||
| 2088 | daddu c_2,t_1 | ||
| 2089 | sltu AT,c_2,t_1 | ||
| 2090 | daddu c_3,t_2,AT | ||
| 2091 | sd c_2,8(a0) | ||
| 2092 | |||
| 2093 | dmultu a_2,a_0 /* mul_add_c2(a[2],b[0],c3,c1,c2); */ | ||
| 2094 | mflo t_1 | ||
| 2095 | mfhi t_2 | ||
| 2096 | slt c_2,t_2,zero | ||
| 2097 | dsll t_2,1 | ||
| 2098 | slt a2,t_1,zero | ||
| 2099 | daddu t_2,a2 | ||
| 2100 | dsll t_1,1 | ||
| 2101 | daddu c_3,t_1 | ||
| 2102 | sltu AT,c_3,t_1 | ||
| 2103 | daddu t_2,AT | ||
| 2104 | daddu c_1,t_2 | ||
| 2105 | sltu AT,c_1,t_2 | ||
| 2106 | daddu c_2,AT | ||
| 2107 | dmultu a_1,a_1 /* mul_add_c(a[1],b[1],c3,c1,c2); */ | ||
| 2108 | mflo t_1 | ||
| 2109 | mfhi t_2 | ||
| 2110 | daddu c_3,t_1 | ||
| 2111 | sltu AT,c_3,t_1 | ||
| 2112 | daddu t_2,AT | ||
| 2113 | daddu c_1,t_2 | ||
| 2114 | sltu AT,c_1,t_2 | ||
| 2115 | daddu c_2,AT | ||
| 2116 | sd c_3,16(a0) | ||
| 2117 | |||
| 2118 | dmultu a_0,a_3 /* mul_add_c2(a[0],b[3],c1,c2,c3); */ | ||
| 2119 | mflo t_1 | ||
| 2120 | mfhi t_2 | ||
| 2121 | slt c_3,t_2,zero | ||
| 2122 | dsll t_2,1 | ||
| 2123 | slt a2,t_1,zero | ||
| 2124 | daddu t_2,a2 | ||
| 2125 | dsll t_1,1 | ||
| 2126 | daddu c_1,t_1 | ||
| 2127 | sltu AT,c_1,t_1 | ||
| 2128 | daddu t_2,AT | ||
| 2129 | daddu c_2,t_2 | ||
| 2130 | sltu AT,c_2,t_2 | ||
| 2131 | daddu c_3,AT | ||
| 2132 | dmultu a_1,a_2 /* mul_add_c(a2[1],b[2],c1,c2,c3); */ | ||
| 2133 | mflo t_1 | ||
| 2134 | mfhi t_2 | ||
| 2135 | slt AT,t_2,zero | ||
| 2136 | daddu c_3,AT | ||
| 2137 | dsll t_2,1 | ||
| 2138 | slt a2,t_1,zero | ||
| 2139 | daddu t_2,a2 | ||
| 2140 | dsll t_1,1 | ||
| 2141 | daddu c_1,t_1 | ||
| 2142 | sltu AT,c_1,t_1 | ||
| 2143 | daddu t_2,AT | ||
| 2144 | daddu c_2,t_2 | ||
| 2145 | sltu AT,c_2,t_2 | ||
| 2146 | daddu c_3,AT | ||
| 2147 | sd c_1,24(a0) | ||
| 2148 | |||
| 2149 | dmultu a_3,a_1 /* mul_add_c2(a[3],b[1],c2,c3,c1); */ | ||
| 2150 | mflo t_1 | ||
| 2151 | mfhi t_2 | ||
| 2152 | slt c_1,t_2,zero | ||
| 2153 | dsll t_2,1 | ||
| 2154 | slt a2,t_1,zero | ||
| 2155 | daddu t_2,a2 | ||
| 2156 | dsll t_1,1 | ||
| 2157 | daddu c_2,t_1 | ||
| 2158 | sltu AT,c_2,t_1 | ||
| 2159 | daddu t_2,AT | ||
| 2160 | daddu c_3,t_2 | ||
| 2161 | sltu AT,c_3,t_2 | ||
| 2162 | daddu c_1,AT | ||
| 2163 | dmultu a_2,a_2 /* mul_add_c(a[2],b[2],c2,c3,c1); */ | ||
| 2164 | mflo t_1 | ||
| 2165 | mfhi t_2 | ||
| 2166 | daddu c_2,t_1 | ||
| 2167 | sltu AT,c_2,t_1 | ||
| 2168 | daddu t_2,AT | ||
| 2169 | daddu c_3,t_2 | ||
| 2170 | sltu AT,c_3,t_2 | ||
| 2171 | daddu c_1,AT | ||
| 2172 | sd c_2,32(a0) | ||
| 2173 | |||
| 2174 | dmultu a_2,a_3 /* mul_add_c2(a[2],b[3],c3,c1,c2); */ | ||
| 2175 | mflo t_1 | ||
| 2176 | mfhi t_2 | ||
| 2177 | slt c_2,t_2,zero | ||
| 2178 | dsll t_2,1 | ||
| 2179 | slt a2,t_1,zero | ||
| 2180 | daddu t_2,a2 | ||
| 2181 | dsll t_1,1 | ||
| 2182 | daddu c_3,t_1 | ||
| 2183 | sltu AT,c_3,t_1 | ||
| 2184 | daddu t_2,AT | ||
| 2185 | daddu c_1,t_2 | ||
| 2186 | sltu AT,c_1,t_2 | ||
| 2187 | daddu c_2,AT | ||
| 2188 | sd c_3,40(a0) | ||
| 2189 | |||
| 2190 | dmultu a_3,a_3 /* mul_add_c(a[3],b[3],c1,c2,c3); */ | ||
| 2191 | mflo t_1 | ||
| 2192 | mfhi t_2 | ||
| 2193 | daddu c_1,t_1 | ||
| 2194 | sltu AT,c_1,t_1 | ||
| 2195 | daddu t_2,AT | ||
| 2196 | daddu c_2,t_2 | ||
| 2197 | sd c_1,48(a0) | ||
| 2198 | sd c_2,56(a0) | ||
| 2199 | |||
| 2200 | jr ra | ||
| 2201 | END(bn_sqr_comba4) | ||
diff --git a/src/lib/libcrypto/bn/asm/vms.mar b/src/lib/libcrypto/bn/asm/vms.mar new file mode 100644 index 0000000000..aefab15cdb --- /dev/null +++ b/src/lib/libcrypto/bn/asm/vms.mar | |||
| @@ -0,0 +1,6440 @@ | |||
| 1 | .title vax_bn_mul_add_words unsigned multiply & add, 32*32+32+32=>64 | ||
| 2 | ; | ||
| 3 | ; w.j.m. 15-jan-1999 | ||
| 4 | ; | ||
| 5 | ; it's magic ... | ||
| 6 | ; | ||
| 7 | ; ULONG bn_mul_add_words(ULONG r[],ULONG a[],int n,ULONG w) { | ||
| 8 | ; ULONG c = 0; | ||
| 9 | ; int i; | ||
| 10 | ; for(i = 0; i < n; i++) <c,r[i]> := r[i] + c + a[i] * w ; | ||
| 11 | ; return c; | ||
| 12 | ; } | ||
| 13 | |||
| 14 | r=4 ;(AP) | ||
| 15 | a=8 ;(AP) | ||
| 16 | n=12 ;(AP) n by value (input) | ||
| 17 | w=16 ;(AP) w by value (input) | ||
| 18 | |||
| 19 | |||
| 20 | .psect code,nowrt | ||
| 21 | |||
| 22 | .entry bn_mul_add_words,^m<r2,r3,r4,r5,r6> | ||
| 23 | |||
| 24 | moval @r(ap),r2 | ||
| 25 | moval @a(ap),r3 | ||
| 26 | movl n(ap),r4 ; assumed >0 by C code | ||
| 27 | movl w(ap),r5 | ||
| 28 | clrl r6 ; c | ||
| 29 | |||
| 30 | 0$: | ||
| 31 | emul r5,(r3),(r2),r0 ; w, a[], r[] considered signed | ||
| 32 | |||
| 33 | ; fixup for "negative" r[] | ||
| 34 | tstl (r2) | ||
| 35 | bgeq 10$ | ||
| 36 | incl r1 | ||
| 37 | 10$: | ||
| 38 | |||
| 39 | ; add in c | ||
| 40 | addl2 r6,r0 | ||
| 41 | adwc #0,r1 | ||
| 42 | |||
| 43 | ; combined fixup for "negative" w, a[] | ||
| 44 | tstl r5 | ||
| 45 | bgeq 20$ | ||
| 46 | addl2 (r3),r1 | ||
| 47 | 20$: | ||
| 48 | tstl (r3) | ||
| 49 | bgeq 30$ | ||
| 50 | addl2 r5,r1 | ||
| 51 | 30$: | ||
| 52 | |||
| 53 | movl r0,(r2)+ ; store lo result in r[] & advance | ||
| 54 | addl #4,r3 ; advance a[] | ||
| 55 | movl r1,r6 ; store hi result => c | ||
| 56 | |||
| 57 | sobgtr r4,0$ | ||
| 58 | |||
| 59 | movl r6,r0 ; return c | ||
| 60 | ret | ||
| 61 | |||
| 62 | .title vax_bn_mul_words unsigned multiply & add, 32*32+32=>64 | ||
| 63 | ; | ||
| 64 | ; w.j.m. 15-jan-1999 | ||
| 65 | ; | ||
| 66 | ; it's magic ... | ||
| 67 | ; | ||
| 68 | ; ULONG bn_mul_words(ULONG r[],ULONG a[],int n,ULONG w) { | ||
| 69 | ; ULONG c = 0; | ||
| 70 | ; int i; | ||
| 71 | ; for(i = 0; i < num; i++) <c,r[i]> := a[i] * w + c ; | ||
| 72 | ; return(c); | ||
| 73 | ; } | ||
| 74 | |||
| 75 | r=4 ;(AP) | ||
| 76 | a=8 ;(AP) | ||
| 77 | n=12 ;(AP) n by value (input) | ||
| 78 | w=16 ;(AP) w by value (input) | ||
| 79 | |||
| 80 | |||
| 81 | .psect code,nowrt | ||
| 82 | |||
| 83 | .entry bn_mul_words,^m<r2,r3,r4,r5,r6> | ||
| 84 | |||
| 85 | moval @r(ap),r2 ; r2 -> r[] | ||
| 86 | moval @a(ap),r3 ; r3 -> a[] | ||
| 87 | movl n(ap),r4 ; r4 = loop count (assumed >0 by C code) | ||
| 88 | movl w(ap),r5 ; r5 = w | ||
| 89 | clrl r6 ; r6 = c | ||
| 90 | |||
| 91 | 0$: | ||
| 92 | ; <r1,r0> := w * a[] + c | ||
| 93 | emul r5,(r3),r6,r0 ; w, a[], c considered signed | ||
| 94 | |||
| 95 | ; fixup for "negative" c | ||
| 96 | tstl r6 ; c | ||
| 97 | bgeq 10$ | ||
| 98 | incl r1 | ||
| 99 | 10$: | ||
| 100 | |||
| 101 | ; combined fixup for "negative" w, a[] | ||
| 102 | tstl r5 ; w | ||
| 103 | bgeq 20$ | ||
| 104 | addl2 (r3),r1 ; a[] | ||
| 105 | 20$: | ||
| 106 | tstl (r3) ; a[] | ||
| 107 | bgeq 30$ | ||
| 108 | addl2 r5,r1 ; w | ||
| 109 | 30$: | ||
| 110 | |||
| 111 | movl r0,(r2)+ ; store lo result in r[] & advance | ||
| 112 | addl #4,r3 ; advance a[] | ||
| 113 | movl r1,r6 ; store hi result => c | ||
| 114 | |||
| 115 | sobgtr r4,0$ | ||
| 116 | |||
| 117 | movl r6,r0 ; return c | ||
| 118 | ret | ||
| 119 | |||
| 120 | .title vax_bn_sqr_words unsigned square, 32*32=>64 | ||
| 121 | ; | ||
| 122 | ; w.j.m. 15-jan-1999 | ||
| 123 | ; | ||
| 124 | ; it's magic ... | ||
| 125 | ; | ||
| 126 | ; void bn_sqr_words(ULONG r[],ULONG a[],int n) { | ||
| 127 | ; int i; | ||
| 128 | ; for(i = 0; i < n; i++) <r[2*i+1],r[2*i]> := a[i] * a[i] ; | ||
| 129 | ; } | ||
| 130 | |||
| 131 | r=4 ;(AP) | ||
| 132 | a=8 ;(AP) | ||
| 133 | n=12 ;(AP) n by value (input) | ||
| 134 | |||
| 135 | |||
| 136 | .psect code,nowrt | ||
| 137 | |||
| 138 | .entry bn_sqr_words,^m<r2,r3,r4,r5> | ||
| 139 | |||
| 140 | moval @r(ap),r2 ; r2 -> r[] | ||
| 141 | moval @a(ap),r3 ; r3 -> a[] | ||
| 142 | movl n(ap),r4 ; r4 = n (assumed >0 by C code) | ||
| 143 | |||
| 144 | 0$: | ||
| 145 | movl (r3)+,r5 ; r5 = a[] & advance | ||
| 146 | |||
| 147 | ; <r1,r0> := a[] * a[] | ||
| 148 | emul r5,r5,#0,r0 ; a[] considered signed | ||
| 149 | |||
| 150 | ; fixup for "negative" a[] | ||
| 151 | tstl r5 ; a[] | ||
| 152 | bgeq 30$ | ||
| 153 | addl2 r5,r1 ; a[] | ||
| 154 | addl2 r5,r1 ; a[] | ||
| 155 | 30$: | ||
| 156 | |||
| 157 | movl r0,(r2)+ ; store lo result in r[] & advance | ||
| 158 | movl r1,(r2)+ ; store hi result in r[] & advance | ||
| 159 | |||
| 160 | sobgtr r4,0$ | ||
| 161 | |||
| 162 | movl #1,r0 ; return SS$_NORMAL | ||
| 163 | ret | ||
| 164 | |||
| 165 | .title vax_bn_div_words unsigned divide | ||
| 166 | ; | ||
| 167 | ; Richard Levitte 20-Nov-2000 | ||
| 168 | ; | ||
| 169 | ; ULONG bn_div_words(ULONG h, ULONG l, ULONG d) | ||
| 170 | ; { | ||
| 171 | ; return ((ULONG)((((ULLONG)h)<<32)|l) / (ULLONG)d); | ||
| 172 | ; } | ||
| 173 | ; | ||
| 174 | ; Using EDIV would be very easy, if it didn't do signed calculations. | ||
| 175 | ; Any time any of the input numbers are signed, there are problems, | ||
| 176 | ; usually with integer overflow, at which point it returns useless | ||
| 177 | ; data (the quotient gets the value of l, and the remainder becomes 0). | ||
| 178 | ; | ||
| 179 | ; If it was just for the dividend, it would be very easy, just divide | ||
| 180 | ; it by 2 (unsigned), do the division, multiply the resulting quotient | ||
| 181 | ; and remainder by 2, add the bit that was dropped when dividing by 2 | ||
| 182 | ; to the remainder, and do some adjustment so the remainder doesn't | ||
| 183 | ; end up larger than the divisor. For some cases when the divisor is | ||
| 184 | ; negative (from EDIV's point of view, i.e. when the highest bit is set), | ||
| 185 | ; dividing the dividend by 2 isn't enough, and since some operations | ||
| 186 | ; might generate integer overflows even when the dividend is divided by | ||
| 187 | ; 4 (when the high part of the shifted down dividend ends up being exactly | ||
| 188 | ; half of the divisor, the result is the quotient 0x80000000, which is | ||
| 189 | ; negative...) it needs to be divided by 8. Furthermore, the divisor needs | ||
| 190 | ; to be divided by 2 (unsigned) as well, to avoid more problems with the sign. | ||
| 191 | ; In this case, a little extra fiddling with the remainder is required. | ||
| 192 | ; | ||
| 193 | ; So, the simplest way to handle this is always to divide the dividend | ||
| 194 | ; by 8, and to divide the divisor by 2 if it's highest bit is set. | ||
| 195 | ; After EDIV has been used, the quotient gets multiplied by 8 if the | ||
| 196 | ; original divisor was positive, otherwise 4. The remainder, oddly | ||
| 197 | ; enough, is *always* multiplied by 8. | ||
| 198 | ; NOTE: in the case mentioned above, where the high part of the shifted | ||
| 199 | ; down dividend ends up being exactly half the shifted down divisor, we | ||
| 200 | ; end up with a 33 bit quotient. That's no problem however, it usually | ||
| 201 | ; means we have ended up with a too large remainder as well, and the | ||
| 202 | ; problem is fixed by the last part of the algorithm (next paragraph). | ||
| 203 | ; | ||
| 204 | ; The routine ends with comparing the resulting remainder with the | ||
| 205 | ; original divisor and if the remainder is larger, subtract the | ||
| 206 | ; original divisor from it, and increase the quotient by 1. This is | ||
| 207 | ; done until the remainder is smaller than the divisor. | ||
| 208 | ; | ||
| 209 | ; The complete algorithm looks like this: | ||
| 210 | ; | ||
| 211 | ; d' = d | ||
| 212 | ; l' = l & 7 | ||
| 213 | ; [h,l] = [h,l] >> 3 | ||
| 214 | ; [q,r] = floor([h,l] / d) # This is the EDIV operation | ||
| 215 | ; if (q < 0) q = -q # I doubt this is necessary any more | ||
| 216 | ; | ||
| 217 | ; r' = r >> 29 | ||
| 218 | ; if (d' >= 0) | ||
| 219 | ; q' = q >> 29 | ||
| 220 | ; q = q << 3 | ||
| 221 | ; else | ||
| 222 | ; q' = q >> 30 | ||
| 223 | ; q = q << 2 | ||
| 224 | ; r = (r << 3) + l' | ||
| 225 | ; | ||
| 226 | ; if (d' < 0) | ||
| 227 | ; { | ||
| 228 | ; [r',r] = [r',r] - q | ||
| 229 | ; while ([r',r] < 0) | ||
| 230 | ; { | ||
| 231 | ; [r',r] = [r',r] + d | ||
| 232 | ; [q',q] = [q',q] - 1 | ||
| 233 | ; } | ||
| 234 | ; } | ||
| 235 | ; | ||
| 236 | ; while ([r',r] >= d') | ||
| 237 | ; { | ||
| 238 | ; [r',r] = [r',r] - d' | ||
| 239 | ; [q',q] = [q',q] + 1 | ||
| 240 | ; } | ||
| 241 | ; | ||
| 242 | ; return q | ||
| 243 | |||
| 244 | h=4 ;(AP) h by value (input) | ||
| 245 | l=8 ;(AP) l by value (input) | ||
| 246 | d=12 ;(AP) d by value (input) | ||
| 247 | |||
| 248 | ;r2 = l, q | ||
| 249 | ;r3 = h, r | ||
| 250 | ;r4 = d | ||
| 251 | ;r5 = l' | ||
| 252 | ;r6 = r' | ||
| 253 | ;r7 = d' | ||
| 254 | ;r8 = q' | ||
| 255 | |||
| 256 | .psect code,nowrt | ||
| 257 | |||
| 258 | .entry bn_div_words,^m<r2,r3,r4,r5,r6,r7,r8> | ||
| 259 | movl l(ap),r2 | ||
| 260 | movl h(ap),r3 | ||
| 261 | movl d(ap),r4 | ||
| 262 | |||
| 263 | bicl3 #^XFFFFFFF8,r2,r5 ; l' = l & 7 | ||
| 264 | bicl3 #^X00000007,r2,r2 | ||
| 265 | |||
| 266 | bicl3 #^XFFFFFFF8,r3,r6 | ||
| 267 | bicl3 #^X00000007,r3,r3 | ||
| 268 | |||
| 269 | addl r6,r2 | ||
| 270 | |||
| 271 | rotl #-3,r2,r2 ; l = l >> 3 | ||
| 272 | rotl #-3,r3,r3 ; h = h >> 3 | ||
| 273 | |||
| 274 | movl r4,r7 ; d' = d | ||
| 275 | |||
| 276 | movl #0,r6 ; r' = 0 | ||
| 277 | movl #0,r8 ; q' = 0 | ||
| 278 | |||
| 279 | tstl r4 | ||
| 280 | beql 666$ ; Uh-oh, the divisor is 0... | ||
| 281 | bgtr 1$ | ||
| 282 | rotl #-1,r4,r4 ; If d is negative, shift it right. | ||
| 283 | bicl2 #^X80000000,r4 ; Since d is then a large number, the | ||
| 284 | ; lowest bit is insignificant | ||
| 285 | ; (contradict that, and I'll fix the problem!) | ||
| 286 | 1$: | ||
| 287 | ediv r4,r2,r2,r3 ; Do the actual division | ||
| 288 | |||
| 289 | tstl r2 | ||
| 290 | bgeq 3$ | ||
| 291 | mnegl r2,r2 ; if q < 0, negate it | ||
| 292 | 3$: | ||
| 293 | tstl r7 | ||
| 294 | blss 4$ | ||
| 295 | rotl #3,r2,r2 ; q = q << 3 | ||
| 296 | bicl3 #^XFFFFFFF8,r2,r8 ; q' gets the high bits from q | ||
| 297 | bicl3 #^X00000007,r2,r2 | ||
| 298 | bsb 41$ | ||
| 299 | 4$: ; else | ||
| 300 | rotl #2,r2,r2 ; q = q << 2 | ||
| 301 | bicl3 #^XFFFFFFFC,r2,r8 ; q' gets the high bits from q | ||
| 302 | bicl3 #^X00000003,r2,r2 | ||
| 303 | 41$: | ||
| 304 | rotl #3,r3,r3 ; r = r << 3 | ||
| 305 | bicl3 #^XFFFFFFF8,r3,r6 ; r' gets the high bits from r | ||
| 306 | bicl3 #^X00000007,r3,r3 | ||
| 307 | addl r5,r3 ; r = r + l' | ||
| 308 | |||
| 309 | tstl r7 | ||
| 310 | bgeq 5$ | ||
| 311 | bitl #1,r7 | ||
| 312 | beql 5$ ; if d' < 0 && d' & 1 | ||
| 313 | subl r2,r3 ; [r',r] = [r',r] - [q',q] | ||
| 314 | sbwc r8,r6 | ||
| 315 | 45$: | ||
| 316 | bgeq 5$ ; while r < 0 | ||
| 317 | decl r2 ; [q',q] = [q',q] - 1 | ||
| 318 | sbwc #0,r8 | ||
| 319 | addl r7,r3 ; [r',r] = [r',r] + d' | ||
| 320 | adwc #0,r6 | ||
| 321 | brb 45$ | ||
| 322 | |||
| 323 | ; The return points are placed in the middle to keep a short distance from | ||
| 324 | ; all the branch points | ||
| 325 | 42$: | ||
| 326 | ; movl r3,r1 | ||
| 327 | movl r2,r0 | ||
| 328 | ret | ||
| 329 | 666$: | ||
| 330 | movl #^XFFFFFFFF,r0 | ||
| 331 | ret | ||
| 332 | |||
| 333 | 5$: | ||
| 334 | tstl r6 | ||
| 335 | bneq 6$ | ||
| 336 | cmpl r3,r7 | ||
| 337 | blssu 42$ ; while [r',r] >= d' | ||
| 338 | 6$: | ||
| 339 | subl r7,r3 ; [r',r] = [r',r] - d' | ||
| 340 | sbwc #0,r6 | ||
| 341 | incl r2 ; [q',q] = [q',q] + 1 | ||
| 342 | adwc #0,r8 | ||
| 343 | brb 5$ | ||
| 344 | |||
| 345 | .title vax_bn_add_words unsigned add of two arrays | ||
| 346 | ; | ||
| 347 | ; Richard Levitte 20-Nov-2000 | ||
| 348 | ; | ||
| 349 | ; ULONG bn_add_words(ULONG r[], ULONG a[], ULONG b[], int n) { | ||
| 350 | ; ULONG c = 0; | ||
| 351 | ; int i; | ||
| 352 | ; for (i = 0; i < n; i++) <c,r[i]> = a[i] + b[i] + c; | ||
| 353 | ; return(c); | ||
| 354 | ; } | ||
| 355 | |||
| 356 | r=4 ;(AP) r by reference (output) | ||
| 357 | a=8 ;(AP) a by reference (input) | ||
| 358 | b=12 ;(AP) b by reference (input) | ||
| 359 | n=16 ;(AP) n by value (input) | ||
| 360 | |||
| 361 | |||
| 362 | .psect code,nowrt | ||
| 363 | |||
| 364 | .entry bn_add_words,^m<r2,r3,r4,r5,r6> | ||
| 365 | |||
| 366 | moval @r(ap),r2 | ||
| 367 | moval @a(ap),r3 | ||
| 368 | moval @b(ap),r4 | ||
| 369 | movl n(ap),r5 ; assumed >0 by C code | ||
| 370 | clrl r0 ; c | ||
| 371 | |||
| 372 | tstl r5 ; carry = 0 | ||
| 373 | bleq 666$ | ||
| 374 | |||
| 375 | 0$: | ||
| 376 | movl (r3)+,r6 ; carry untouched | ||
| 377 | adwc (r4)+,r6 ; carry used and touched | ||
| 378 | movl r6,(r2)+ ; carry untouched | ||
| 379 | sobgtr r5,0$ ; carry untouched | ||
| 380 | |||
| 381 | adwc #0,r0 | ||
| 382 | 666$: | ||
| 383 | ret | ||
| 384 | |||
| 385 | .title vax_bn_sub_words unsigned add of two arrays | ||
| 386 | ; | ||
| 387 | ; Richard Levitte 20-Nov-2000 | ||
| 388 | ; | ||
| 389 | ; ULONG bn_sub_words(ULONG r[], ULONG a[], ULONG b[], int n) { | ||
| 390 | ; ULONG c = 0; | ||
| 391 | ; int i; | ||
| 392 | ; for (i = 0; i < n; i++) <c,r[i]> = a[i] - b[i] - c; | ||
| 393 | ; return(c); | ||
| 394 | ; } | ||
| 395 | |||
| 396 | r=4 ;(AP) r by reference (output) | ||
| 397 | a=8 ;(AP) a by reference (input) | ||
| 398 | b=12 ;(AP) b by reference (input) | ||
| 399 | n=16 ;(AP) n by value (input) | ||
| 400 | |||
| 401 | |||
| 402 | .psect code,nowrt | ||
| 403 | |||
| 404 | .entry bn_sub_words,^m<r2,r3,r4,r5,r6> | ||
| 405 | |||
| 406 | moval @r(ap),r2 | ||
| 407 | moval @a(ap),r3 | ||
| 408 | moval @b(ap),r4 | ||
| 409 | movl n(ap),r5 ; assumed >0 by C code | ||
| 410 | clrl r0 ; c | ||
| 411 | |||
| 412 | tstl r5 ; carry = 0 | ||
| 413 | bleq 666$ | ||
| 414 | |||
| 415 | 0$: | ||
| 416 | movl (r3)+,r6 ; carry untouched | ||
| 417 | sbwc (r4)+,r6 ; carry used and touched | ||
| 418 | movl r6,(r2)+ ; carry untouched | ||
| 419 | sobgtr r5,0$ ; carry untouched | ||
| 420 | |||
| 421 | adwc #0,r0 | ||
| 422 | 666$: | ||
| 423 | ret | ||
| 424 | |||
| 425 | |||
| 426 | ;r=4 ;(AP) | ||
| 427 | ;a=8 ;(AP) | ||
| 428 | ;b=12 ;(AP) | ||
| 429 | ;n=16 ;(AP) n by value (input) | ||
| 430 | |||
| 431 | .psect code,nowrt | ||
| 432 | |||
| 433 | .entry BN_MUL_COMBA8,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> | ||
| 434 | movab -924(sp),sp | ||
| 435 | clrq r8 | ||
| 436 | |||
| 437 | clrl r10 | ||
| 438 | |||
| 439 | movl 8(ap),r6 | ||
| 440 | movzwl 2(r6),r3 | ||
| 441 | movl 12(ap),r7 | ||
| 442 | bicl3 #-65536,(r7),r2 | ||
| 443 | movzwl 2(r7),r0 | ||
| 444 | bicl2 #-65536,r0 | ||
| 445 | bicl3 #-65536,(r6),-12(fp) | ||
| 446 | bicl3 #-65536,r3,-16(fp) | ||
| 447 | mull3 r0,-12(fp),-4(fp) | ||
| 448 | mull2 r2,-12(fp) | ||
| 449 | mull3 r2,-16(fp),-8(fp) | ||
| 450 | mull2 r0,-16(fp) | ||
| 451 | addl3 -4(fp),-8(fp),r0 | ||
| 452 | bicl3 #0,r0,-4(fp) | ||
| 453 | cmpl -4(fp),-8(fp) | ||
| 454 | bgequ noname.45 | ||
| 455 | addl2 #65536,-16(fp) | ||
| 456 | noname.45: | ||
| 457 | movzwl -2(fp),r0 | ||
| 458 | bicl2 #-65536,r0 | ||
| 459 | addl2 r0,-16(fp) | ||
| 460 | bicl3 #-65536,-4(fp),r0 | ||
| 461 | ashl #16,r0,-8(fp) | ||
| 462 | addl3 -8(fp),-12(fp),r0 | ||
| 463 | bicl3 #0,r0,-12(fp) | ||
| 464 | cmpl -12(fp),-8(fp) | ||
| 465 | bgequ noname.46 | ||
| 466 | incl -16(fp) | ||
| 467 | noname.46: | ||
| 468 | movl -12(fp),r1 | ||
| 469 | movl -16(fp),r2 | ||
| 470 | addl2 r1,r9 | ||
| 471 | bicl2 #0,r9 | ||
| 472 | cmpl r9,r1 | ||
| 473 | bgequ noname.47 | ||
| 474 | incl r2 | ||
| 475 | noname.47: | ||
| 476 | addl2 r2,r8 | ||
| 477 | bicl2 #0,r8 | ||
| 478 | cmpl r8,r2 | ||
| 479 | bgequ noname.48 | ||
| 480 | incl r10 | ||
| 481 | noname.48: | ||
| 482 | |||
| 483 | movl 4(ap),r11 | ||
| 484 | movl r9,(r11) | ||
| 485 | |||
| 486 | clrl r9 | ||
| 487 | |||
| 488 | movzwl 2(r6),r2 | ||
| 489 | bicl3 #-65536,4(r7),r3 | ||
| 490 | movzwl 6(r7),r0 | ||
| 491 | bicl2 #-65536,r0 | ||
| 492 | bicl3 #-65536,(r6),-28(fp) | ||
| 493 | bicl3 #-65536,r2,-32(fp) | ||
| 494 | mull3 r0,-28(fp),-20(fp) | ||
| 495 | mull2 r3,-28(fp) | ||
| 496 | mull3 r3,-32(fp),-24(fp) | ||
| 497 | mull2 r0,-32(fp) | ||
| 498 | addl3 -20(fp),-24(fp),r0 | ||
| 499 | bicl3 #0,r0,-20(fp) | ||
| 500 | cmpl -20(fp),-24(fp) | ||
| 501 | bgequ noname.49 | ||
| 502 | addl2 #65536,-32(fp) | ||
| 503 | noname.49: | ||
| 504 | movzwl -18(fp),r0 | ||
| 505 | bicl2 #-65536,r0 | ||
| 506 | addl2 r0,-32(fp) | ||
| 507 | bicl3 #-65536,-20(fp),r0 | ||
| 508 | ashl #16,r0,-24(fp) | ||
| 509 | addl3 -24(fp),-28(fp),r0 | ||
| 510 | bicl3 #0,r0,-28(fp) | ||
| 511 | cmpl -28(fp),-24(fp) | ||
| 512 | bgequ noname.50 | ||
| 513 | incl -32(fp) | ||
| 514 | noname.50: | ||
| 515 | movl -28(fp),r1 | ||
| 516 | movl -32(fp),r2 | ||
| 517 | addl2 r1,r8 | ||
| 518 | bicl2 #0,r8 | ||
| 519 | cmpl r8,r1 | ||
| 520 | bgequ noname.51 | ||
| 521 | incl r2 | ||
| 522 | noname.51: | ||
| 523 | addl2 r2,r10 | ||
| 524 | bicl2 #0,r10 | ||
| 525 | cmpl r10,r2 | ||
| 526 | bgequ noname.52 | ||
| 527 | incl r9 | ||
| 528 | noname.52: | ||
| 529 | |||
| 530 | movzwl 6(r6),r2 | ||
| 531 | bicl3 #-65536,(r7),r3 | ||
| 532 | movzwl 2(r7),r0 | ||
| 533 | bicl2 #-65536,r0 | ||
| 534 | bicl3 #-65536,4(r6),-44(fp) | ||
| 535 | bicl3 #-65536,r2,-48(fp) | ||
| 536 | mull3 r0,-44(fp),-36(fp) | ||
| 537 | mull2 r3,-44(fp) | ||
| 538 | mull3 r3,-48(fp),-40(fp) | ||
| 539 | mull2 r0,-48(fp) | ||
| 540 | addl3 -36(fp),-40(fp),r0 | ||
| 541 | bicl3 #0,r0,-36(fp) | ||
| 542 | cmpl -36(fp),-40(fp) | ||
| 543 | bgequ noname.53 | ||
| 544 | addl2 #65536,-48(fp) | ||
| 545 | noname.53: | ||
| 546 | movzwl -34(fp),r0 | ||
| 547 | bicl2 #-65536,r0 | ||
| 548 | addl2 r0,-48(fp) | ||
| 549 | bicl3 #-65536,-36(fp),r0 | ||
| 550 | ashl #16,r0,-40(fp) | ||
| 551 | addl3 -40(fp),-44(fp),r0 | ||
| 552 | bicl3 #0,r0,-44(fp) | ||
| 553 | cmpl -44(fp),-40(fp) | ||
| 554 | bgequ noname.54 | ||
| 555 | incl -48(fp) | ||
| 556 | noname.54: | ||
| 557 | movl -44(fp),r1 | ||
| 558 | movl -48(fp),r2 | ||
| 559 | addl2 r1,r8 | ||
| 560 | bicl2 #0,r8 | ||
| 561 | cmpl r8,r1 | ||
| 562 | bgequ noname.55 | ||
| 563 | incl r2 | ||
| 564 | noname.55: | ||
| 565 | addl2 r2,r10 | ||
| 566 | bicl2 #0,r10 | ||
| 567 | cmpl r10,r2 | ||
| 568 | bgequ noname.56 | ||
| 569 | incl r9 | ||
| 570 | noname.56: | ||
| 571 | |||
| 572 | movl r8,4(r11) | ||
| 573 | |||
| 574 | clrl r8 | ||
| 575 | |||
| 576 | movzwl 10(r6),r2 | ||
| 577 | bicl3 #-65536,(r7),r3 | ||
| 578 | movzwl 2(r7),r0 | ||
| 579 | bicl2 #-65536,r0 | ||
| 580 | bicl3 #-65536,8(r6),-60(fp) | ||
| 581 | bicl3 #-65536,r2,-64(fp) | ||
| 582 | mull3 r0,-60(fp),-52(fp) | ||
| 583 | mull2 r3,-60(fp) | ||
| 584 | mull3 r3,-64(fp),-56(fp) | ||
| 585 | mull2 r0,-64(fp) | ||
| 586 | addl3 -52(fp),-56(fp),r0 | ||
| 587 | bicl3 #0,r0,-52(fp) | ||
| 588 | cmpl -52(fp),-56(fp) | ||
| 589 | bgequ noname.57 | ||
| 590 | addl2 #65536,-64(fp) | ||
| 591 | noname.57: | ||
| 592 | movzwl -50(fp),r0 | ||
| 593 | bicl2 #-65536,r0 | ||
| 594 | addl2 r0,-64(fp) | ||
| 595 | bicl3 #-65536,-52(fp),r0 | ||
| 596 | ashl #16,r0,-56(fp) | ||
| 597 | addl3 -56(fp),-60(fp),r0 | ||
| 598 | bicl3 #0,r0,-60(fp) | ||
| 599 | cmpl -60(fp),-56(fp) | ||
| 600 | bgequ noname.58 | ||
| 601 | incl -64(fp) | ||
| 602 | noname.58: | ||
| 603 | movl -60(fp),r1 | ||
| 604 | movl -64(fp),r2 | ||
| 605 | addl2 r1,r10 | ||
| 606 | bicl2 #0,r10 | ||
| 607 | cmpl r10,r1 | ||
| 608 | bgequ noname.59 | ||
| 609 | incl r2 | ||
| 610 | noname.59: | ||
| 611 | addl2 r2,r9 | ||
| 612 | bicl2 #0,r9 | ||
| 613 | cmpl r9,r2 | ||
| 614 | bgequ noname.60 | ||
| 615 | incl r8 | ||
| 616 | noname.60: | ||
| 617 | |||
| 618 | movzwl 6(r6),r2 | ||
| 619 | bicl3 #-65536,4(r7),r3 | ||
| 620 | movzwl 6(r7),r0 | ||
| 621 | bicl2 #-65536,r0 | ||
| 622 | bicl3 #-65536,4(r6),-76(fp) | ||
| 623 | bicl3 #-65536,r2,-80(fp) | ||
| 624 | mull3 r0,-76(fp),-68(fp) | ||
| 625 | mull2 r3,-76(fp) | ||
| 626 | mull3 r3,-80(fp),-72(fp) | ||
| 627 | mull2 r0,-80(fp) | ||
| 628 | addl3 -68(fp),-72(fp),r0 | ||
| 629 | bicl3 #0,r0,-68(fp) | ||
| 630 | cmpl -68(fp),-72(fp) | ||
| 631 | bgequ noname.61 | ||
| 632 | addl2 #65536,-80(fp) | ||
| 633 | noname.61: | ||
| 634 | movzwl -66(fp),r0 | ||
| 635 | bicl2 #-65536,r0 | ||
| 636 | addl2 r0,-80(fp) | ||
| 637 | bicl3 #-65536,-68(fp),r0 | ||
| 638 | ashl #16,r0,-72(fp) | ||
| 639 | addl3 -72(fp),-76(fp),r0 | ||
| 640 | bicl3 #0,r0,-76(fp) | ||
| 641 | cmpl -76(fp),-72(fp) | ||
| 642 | bgequ noname.62 | ||
| 643 | incl -80(fp) | ||
| 644 | noname.62: | ||
| 645 | movl -76(fp),r1 | ||
| 646 | movl -80(fp),r2 | ||
| 647 | addl2 r1,r10 | ||
| 648 | bicl2 #0,r10 | ||
| 649 | cmpl r10,r1 | ||
| 650 | bgequ noname.63 | ||
| 651 | incl r2 | ||
| 652 | noname.63: | ||
| 653 | addl2 r2,r9 | ||
| 654 | bicl2 #0,r9 | ||
| 655 | cmpl r9,r2 | ||
| 656 | bgequ noname.64 | ||
| 657 | incl r8 | ||
| 658 | noname.64: | ||
| 659 | |||
| 660 | movzwl 2(r6),r2 | ||
| 661 | bicl3 #-65536,8(r7),r3 | ||
| 662 | movzwl 10(r7),r0 | ||
| 663 | bicl2 #-65536,r0 | ||
| 664 | bicl3 #-65536,(r6),-92(fp) | ||
| 665 | bicl3 #-65536,r2,-96(fp) | ||
| 666 | mull3 r0,-92(fp),-84(fp) | ||
| 667 | mull2 r3,-92(fp) | ||
| 668 | mull3 r3,-96(fp),-88(fp) | ||
| 669 | mull2 r0,-96(fp) | ||
| 670 | addl3 -84(fp),-88(fp),r0 | ||
| 671 | bicl3 #0,r0,-84(fp) | ||
| 672 | cmpl -84(fp),-88(fp) | ||
| 673 | bgequ noname.65 | ||
| 674 | addl2 #65536,-96(fp) | ||
| 675 | noname.65: | ||
| 676 | movzwl -82(fp),r0 | ||
| 677 | bicl2 #-65536,r0 | ||
| 678 | addl2 r0,-96(fp) | ||
| 679 | bicl3 #-65536,-84(fp),r0 | ||
| 680 | ashl #16,r0,-88(fp) | ||
| 681 | addl3 -88(fp),-92(fp),r0 | ||
| 682 | bicl3 #0,r0,-92(fp) | ||
| 683 | cmpl -92(fp),-88(fp) | ||
| 684 | bgequ noname.66 | ||
| 685 | incl -96(fp) | ||
| 686 | noname.66: | ||
| 687 | movl -92(fp),r1 | ||
| 688 | movl -96(fp),r2 | ||
| 689 | addl2 r1,r10 | ||
| 690 | bicl2 #0,r10 | ||
| 691 | cmpl r10,r1 | ||
| 692 | bgequ noname.67 | ||
| 693 | incl r2 | ||
| 694 | noname.67: | ||
| 695 | addl2 r2,r9 | ||
| 696 | bicl2 #0,r9 | ||
| 697 | cmpl r9,r2 | ||
| 698 | bgequ noname.68 | ||
| 699 | incl r8 | ||
| 700 | noname.68: | ||
| 701 | |||
| 702 | movl r10,8(r11) | ||
| 703 | |||
| 704 | clrl r10 | ||
| 705 | |||
| 706 | movzwl 2(r6),r2 | ||
| 707 | bicl3 #-65536,12(r7),r3 | ||
| 708 | movzwl 14(r7),r0 | ||
| 709 | bicl2 #-65536,r0 | ||
| 710 | bicl3 #-65536,(r6),-108(fp) | ||
| 711 | bicl3 #-65536,r2,-112(fp) | ||
| 712 | mull3 r0,-108(fp),-100(fp) | ||
| 713 | mull2 r3,-108(fp) | ||
| 714 | mull3 r3,-112(fp),-104(fp) | ||
| 715 | mull2 r0,-112(fp) | ||
| 716 | addl3 -100(fp),-104(fp),r0 | ||
| 717 | bicl3 #0,r0,-100(fp) | ||
| 718 | cmpl -100(fp),-104(fp) | ||
| 719 | bgequ noname.69 | ||
| 720 | addl2 #65536,-112(fp) | ||
| 721 | noname.69: | ||
| 722 | movzwl -98(fp),r0 | ||
| 723 | bicl2 #-65536,r0 | ||
| 724 | addl2 r0,-112(fp) | ||
| 725 | bicl3 #-65536,-100(fp),r0 | ||
| 726 | ashl #16,r0,-104(fp) | ||
| 727 | addl3 -104(fp),-108(fp),r0 | ||
| 728 | bicl3 #0,r0,-108(fp) | ||
| 729 | cmpl -108(fp),-104(fp) | ||
| 730 | bgequ noname.70 | ||
| 731 | incl -112(fp) | ||
| 732 | noname.70: | ||
| 733 | movl -108(fp),r1 | ||
| 734 | movl -112(fp),r2 | ||
| 735 | addl2 r1,r9 | ||
| 736 | bicl2 #0,r9 | ||
| 737 | cmpl r9,r1 | ||
| 738 | bgequ noname.71 | ||
| 739 | incl r2 | ||
| 740 | noname.71: | ||
| 741 | addl2 r2,r8 | ||
| 742 | bicl2 #0,r8 | ||
| 743 | cmpl r8,r2 | ||
| 744 | bgequ noname.72 | ||
| 745 | incl r10 | ||
| 746 | noname.72: | ||
| 747 | |||
| 748 | movzwl 6(r6),r2 | ||
| 749 | bicl3 #-65536,8(r7),r3 | ||
| 750 | movzwl 10(r7),r0 | ||
| 751 | bicl2 #-65536,r0 | ||
| 752 | bicl3 #-65536,4(r6),-124(fp) | ||
| 753 | bicl3 #-65536,r2,-128(fp) | ||
| 754 | mull3 r0,-124(fp),-116(fp) | ||
| 755 | mull2 r3,-124(fp) | ||
| 756 | mull3 r3,-128(fp),-120(fp) | ||
| 757 | mull2 r0,-128(fp) | ||
| 758 | addl3 -116(fp),-120(fp),r0 | ||
| 759 | bicl3 #0,r0,-116(fp) | ||
| 760 | cmpl -116(fp),-120(fp) | ||
| 761 | bgequ noname.73 | ||
| 762 | addl2 #65536,-128(fp) | ||
| 763 | noname.73: | ||
| 764 | movzwl -114(fp),r0 | ||
| 765 | bicl2 #-65536,r0 | ||
| 766 | addl2 r0,-128(fp) | ||
| 767 | bicl3 #-65536,-116(fp),r0 | ||
| 768 | ashl #16,r0,-120(fp) | ||
| 769 | addl3 -120(fp),-124(fp),r0 | ||
| 770 | bicl3 #0,r0,-124(fp) | ||
| 771 | cmpl -124(fp),-120(fp) | ||
| 772 | bgequ noname.74 | ||
| 773 | incl -128(fp) | ||
| 774 | noname.74: | ||
| 775 | movl -124(fp),r1 | ||
| 776 | movl -128(fp),r2 | ||
| 777 | addl2 r1,r9 | ||
| 778 | bicl2 #0,r9 | ||
| 779 | cmpl r9,r1 | ||
| 780 | bgequ noname.75 | ||
| 781 | incl r2 | ||
| 782 | noname.75: | ||
| 783 | addl2 r2,r8 | ||
| 784 | bicl2 #0,r8 | ||
| 785 | cmpl r8,r2 | ||
| 786 | bgequ noname.76 | ||
| 787 | incl r10 | ||
| 788 | noname.76: | ||
| 789 | |||
| 790 | movzwl 10(r6),r2 | ||
| 791 | bicl3 #-65536,4(r7),r3 | ||
| 792 | movzwl 6(r7),r0 | ||
| 793 | bicl2 #-65536,r0 | ||
| 794 | bicl3 #-65536,8(r6),-140(fp) | ||
| 795 | bicl3 #-65536,r2,-144(fp) | ||
| 796 | mull3 r0,-140(fp),-132(fp) | ||
| 797 | mull2 r3,-140(fp) | ||
| 798 | mull3 r3,-144(fp),-136(fp) | ||
| 799 | mull2 r0,-144(fp) | ||
| 800 | addl3 -132(fp),-136(fp),r0 | ||
| 801 | bicl3 #0,r0,-132(fp) | ||
| 802 | cmpl -132(fp),-136(fp) | ||
| 803 | bgequ noname.77 | ||
| 804 | addl2 #65536,-144(fp) | ||
| 805 | noname.77: | ||
| 806 | movzwl -130(fp),r0 | ||
| 807 | bicl2 #-65536,r0 | ||
| 808 | addl2 r0,-144(fp) | ||
| 809 | bicl3 #-65536,-132(fp),r0 | ||
| 810 | ashl #16,r0,-136(fp) | ||
| 811 | addl3 -136(fp),-140(fp),r0 | ||
| 812 | bicl3 #0,r0,-140(fp) | ||
| 813 | cmpl -140(fp),-136(fp) | ||
| 814 | bgequ noname.78 | ||
| 815 | incl -144(fp) | ||
| 816 | noname.78: | ||
| 817 | movl -140(fp),r1 | ||
| 818 | movl -144(fp),r2 | ||
| 819 | addl2 r1,r9 | ||
| 820 | bicl2 #0,r9 | ||
| 821 | cmpl r9,r1 | ||
| 822 | bgequ noname.79 | ||
| 823 | incl r2 | ||
| 824 | noname.79: | ||
| 825 | addl2 r2,r8 | ||
| 826 | bicl2 #0,r8 | ||
| 827 | cmpl r8,r2 | ||
| 828 | bgequ noname.80 | ||
| 829 | incl r10 | ||
| 830 | noname.80: | ||
| 831 | |||
| 832 | movzwl 14(r6),r2 | ||
| 833 | bicl3 #-65536,(r7),r3 | ||
| 834 | movzwl 2(r7),r0 | ||
| 835 | bicl2 #-65536,r0 | ||
| 836 | bicl3 #-65536,12(r6),-156(fp) | ||
| 837 | bicl3 #-65536,r2,-160(fp) | ||
| 838 | mull3 r0,-156(fp),-148(fp) | ||
| 839 | mull2 r3,-156(fp) | ||
| 840 | mull3 r3,-160(fp),-152(fp) | ||
| 841 | mull2 r0,-160(fp) | ||
| 842 | addl3 -148(fp),-152(fp),r0 | ||
| 843 | bicl3 #0,r0,-148(fp) | ||
| 844 | cmpl -148(fp),-152(fp) | ||
| 845 | bgequ noname.81 | ||
| 846 | addl2 #65536,-160(fp) | ||
| 847 | noname.81: | ||
| 848 | movzwl -146(fp),r0 | ||
| 849 | bicl2 #-65536,r0 | ||
| 850 | addl2 r0,-160(fp) | ||
| 851 | bicl3 #-65536,-148(fp),r0 | ||
| 852 | ashl #16,r0,-152(fp) | ||
| 853 | addl3 -152(fp),-156(fp),r0 | ||
| 854 | bicl3 #0,r0,-156(fp) | ||
| 855 | cmpl -156(fp),-152(fp) | ||
| 856 | bgequ noname.82 | ||
| 857 | incl -160(fp) | ||
| 858 | noname.82: | ||
| 859 | movl -156(fp),r1 | ||
| 860 | movl -160(fp),r2 | ||
| 861 | addl2 r1,r9 | ||
| 862 | bicl2 #0,r9 | ||
| 863 | cmpl r9,r1 | ||
| 864 | bgequ noname.83 | ||
| 865 | incl r2 | ||
| 866 | noname.83: | ||
| 867 | addl2 r2,r8 | ||
| 868 | bicl2 #0,r8 | ||
| 869 | cmpl r8,r2 | ||
| 870 | bgequ noname.84 | ||
| 871 | incl r10 | ||
| 872 | noname.84: | ||
| 873 | |||
| 874 | movl r9,12(r11) | ||
| 875 | |||
| 876 | clrl r9 | ||
| 877 | |||
| 878 | movzwl 18(r6),r2 | ||
| 879 | bicl3 #-65536,(r7),r3 | ||
| 880 | movzwl 2(r7),r0 | ||
| 881 | bicl2 #-65536,r0 | ||
| 882 | bicl3 #-65536,16(r6),-172(fp) | ||
| 883 | bicl3 #-65536,r2,-176(fp) | ||
| 884 | mull3 r0,-172(fp),-164(fp) | ||
| 885 | mull2 r3,-172(fp) | ||
| 886 | mull3 r3,-176(fp),-168(fp) | ||
| 887 | mull2 r0,-176(fp) | ||
| 888 | addl3 -164(fp),-168(fp),r0 | ||
| 889 | bicl3 #0,r0,-164(fp) | ||
| 890 | cmpl -164(fp),-168(fp) | ||
| 891 | bgequ noname.85 | ||
| 892 | addl2 #65536,-176(fp) | ||
| 893 | noname.85: | ||
| 894 | movzwl -162(fp),r0 | ||
| 895 | bicl2 #-65536,r0 | ||
| 896 | addl2 r0,-176(fp) | ||
| 897 | bicl3 #-65536,-164(fp),r0 | ||
| 898 | ashl #16,r0,-168(fp) | ||
| 899 | addl3 -168(fp),-172(fp),r0 | ||
| 900 | bicl3 #0,r0,-172(fp) | ||
| 901 | cmpl -172(fp),-168(fp) | ||
| 902 | bgequ noname.86 | ||
| 903 | incl -176(fp) | ||
| 904 | noname.86: | ||
| 905 | movl -172(fp),r1 | ||
| 906 | movl -176(fp),r2 | ||
| 907 | addl2 r1,r8 | ||
| 908 | bicl2 #0,r8 | ||
| 909 | cmpl r8,r1 | ||
| 910 | bgequ noname.87 | ||
| 911 | incl r2 | ||
| 912 | noname.87: | ||
| 913 | addl2 r2,r10 | ||
| 914 | bicl2 #0,r10 | ||
| 915 | cmpl r10,r2 | ||
| 916 | bgequ noname.88 | ||
| 917 | incl r9 | ||
| 918 | noname.88: | ||
| 919 | |||
| 920 | movzwl 14(r6),r2 | ||
| 921 | bicl3 #-65536,4(r7),r3 | ||
| 922 | movzwl 6(r7),r0 | ||
| 923 | bicl2 #-65536,r0 | ||
| 924 | bicl3 #-65536,12(r6),-188(fp) | ||
| 925 | bicl3 #-65536,r2,-192(fp) | ||
| 926 | mull3 r0,-188(fp),-180(fp) | ||
| 927 | mull2 r3,-188(fp) | ||
| 928 | mull3 r3,-192(fp),-184(fp) | ||
| 929 | mull2 r0,-192(fp) | ||
| 930 | addl3 -180(fp),-184(fp),r0 | ||
| 931 | bicl3 #0,r0,-180(fp) | ||
| 932 | cmpl -180(fp),-184(fp) | ||
| 933 | bgequ noname.89 | ||
| 934 | addl2 #65536,-192(fp) | ||
| 935 | noname.89: | ||
| 936 | movzwl -178(fp),r0 | ||
| 937 | bicl2 #-65536,r0 | ||
| 938 | addl2 r0,-192(fp) | ||
| 939 | bicl3 #-65536,-180(fp),r0 | ||
| 940 | ashl #16,r0,-184(fp) | ||
| 941 | addl3 -184(fp),-188(fp),r0 | ||
| 942 | bicl3 #0,r0,-188(fp) | ||
| 943 | cmpl -188(fp),-184(fp) | ||
| 944 | bgequ noname.90 | ||
| 945 | incl -192(fp) | ||
| 946 | noname.90: | ||
| 947 | movl -188(fp),r1 | ||
| 948 | movl -192(fp),r2 | ||
| 949 | addl2 r1,r8 | ||
| 950 | bicl2 #0,r8 | ||
| 951 | cmpl r8,r1 | ||
| 952 | bgequ noname.91 | ||
| 953 | incl r2 | ||
| 954 | noname.91: | ||
| 955 | addl2 r2,r10 | ||
| 956 | bicl2 #0,r10 | ||
| 957 | cmpl r10,r2 | ||
| 958 | bgequ noname.92 | ||
| 959 | incl r9 | ||
| 960 | noname.92: | ||
| 961 | |||
| 962 | movzwl 10(r6),r2 | ||
| 963 | bicl3 #-65536,8(r7),r3 | ||
| 964 | movzwl 10(r7),r0 | ||
| 965 | bicl2 #-65536,r0 | ||
| 966 | bicl3 #-65536,8(r6),-204(fp) | ||
| 967 | bicl3 #-65536,r2,-208(fp) | ||
| 968 | mull3 r0,-204(fp),-196(fp) | ||
| 969 | mull2 r3,-204(fp) | ||
| 970 | mull3 r3,-208(fp),-200(fp) | ||
| 971 | mull2 r0,-208(fp) | ||
| 972 | addl3 -196(fp),-200(fp),r0 | ||
| 973 | bicl3 #0,r0,-196(fp) | ||
| 974 | cmpl -196(fp),-200(fp) | ||
| 975 | bgequ noname.93 | ||
| 976 | addl2 #65536,-208(fp) | ||
| 977 | noname.93: | ||
| 978 | movzwl -194(fp),r0 | ||
| 979 | bicl2 #-65536,r0 | ||
| 980 | addl2 r0,-208(fp) | ||
| 981 | bicl3 #-65536,-196(fp),r0 | ||
| 982 | ashl #16,r0,-200(fp) | ||
| 983 | addl3 -200(fp),-204(fp),r0 | ||
| 984 | bicl3 #0,r0,-204(fp) | ||
| 985 | cmpl -204(fp),-200(fp) | ||
| 986 | bgequ noname.94 | ||
| 987 | incl -208(fp) | ||
| 988 | noname.94: | ||
| 989 | movl -204(fp),r1 | ||
| 990 | movl -208(fp),r2 | ||
| 991 | addl2 r1,r8 | ||
| 992 | bicl2 #0,r8 | ||
| 993 | cmpl r8,r1 | ||
| 994 | bgequ noname.95 | ||
| 995 | incl r2 | ||
| 996 | noname.95: | ||
| 997 | addl2 r2,r10 | ||
| 998 | bicl2 #0,r10 | ||
| 999 | cmpl r10,r2 | ||
| 1000 | bgequ noname.96 | ||
| 1001 | incl r9 | ||
| 1002 | noname.96: | ||
| 1003 | |||
| 1004 | movzwl 6(r6),r2 | ||
| 1005 | bicl3 #-65536,12(r7),r3 | ||
| 1006 | movzwl 14(r7),r0 | ||
| 1007 | bicl2 #-65536,r0 | ||
| 1008 | bicl3 #-65536,4(r6),-220(fp) | ||
| 1009 | bicl3 #-65536,r2,-224(fp) | ||
| 1010 | mull3 r0,-220(fp),-212(fp) | ||
| 1011 | mull2 r3,-220(fp) | ||
| 1012 | mull3 r3,-224(fp),-216(fp) | ||
| 1013 | mull2 r0,-224(fp) | ||
| 1014 | addl3 -212(fp),-216(fp),r0 | ||
| 1015 | bicl3 #0,r0,-212(fp) | ||
| 1016 | cmpl -212(fp),-216(fp) | ||
| 1017 | bgequ noname.97 | ||
| 1018 | addl2 #65536,-224(fp) | ||
| 1019 | noname.97: | ||
| 1020 | movzwl -210(fp),r0 | ||
| 1021 | bicl2 #-65536,r0 | ||
| 1022 | addl2 r0,-224(fp) | ||
| 1023 | bicl3 #-65536,-212(fp),r0 | ||
| 1024 | ashl #16,r0,-216(fp) | ||
| 1025 | addl3 -216(fp),-220(fp),r0 | ||
| 1026 | bicl3 #0,r0,-220(fp) | ||
| 1027 | cmpl -220(fp),-216(fp) | ||
| 1028 | bgequ noname.98 | ||
| 1029 | incl -224(fp) | ||
| 1030 | noname.98: | ||
| 1031 | movl -220(fp),r1 | ||
| 1032 | movl -224(fp),r2 | ||
| 1033 | addl2 r1,r8 | ||
| 1034 | bicl2 #0,r8 | ||
| 1035 | cmpl r8,r1 | ||
| 1036 | bgequ noname.99 | ||
| 1037 | incl r2 | ||
| 1038 | noname.99: | ||
| 1039 | addl2 r2,r10 | ||
| 1040 | bicl2 #0,r10 | ||
| 1041 | cmpl r10,r2 | ||
| 1042 | bgequ noname.100 | ||
| 1043 | incl r9 | ||
| 1044 | noname.100: | ||
| 1045 | |||
| 1046 | movzwl 2(r6),r2 | ||
| 1047 | bicl3 #-65536,16(r7),r3 | ||
| 1048 | movzwl 18(r7),r0 | ||
| 1049 | bicl2 #-65536,r0 | ||
| 1050 | bicl3 #-65536,(r6),-236(fp) | ||
| 1051 | bicl3 #-65536,r2,-240(fp) | ||
| 1052 | mull3 r0,-236(fp),-228(fp) | ||
| 1053 | mull2 r3,-236(fp) | ||
| 1054 | mull3 r3,-240(fp),-232(fp) | ||
| 1055 | mull2 r0,-240(fp) | ||
| 1056 | addl3 -228(fp),-232(fp),r0 | ||
| 1057 | bicl3 #0,r0,-228(fp) | ||
| 1058 | cmpl -228(fp),-232(fp) | ||
| 1059 | bgequ noname.101 | ||
| 1060 | addl2 #65536,-240(fp) | ||
| 1061 | noname.101: | ||
| 1062 | movzwl -226(fp),r0 | ||
| 1063 | bicl2 #-65536,r0 | ||
| 1064 | addl2 r0,-240(fp) | ||
| 1065 | bicl3 #-65536,-228(fp),r0 | ||
| 1066 | ashl #16,r0,-232(fp) | ||
| 1067 | addl3 -232(fp),-236(fp),r0 | ||
| 1068 | bicl3 #0,r0,-236(fp) | ||
| 1069 | cmpl -236(fp),-232(fp) | ||
| 1070 | bgequ noname.102 | ||
| 1071 | incl -240(fp) | ||
| 1072 | noname.102: | ||
| 1073 | movl -236(fp),r1 | ||
| 1074 | movl -240(fp),r2 | ||
| 1075 | addl2 r1,r8 | ||
| 1076 | bicl2 #0,r8 | ||
| 1077 | cmpl r8,r1 | ||
| 1078 | bgequ noname.103 | ||
| 1079 | incl r2 | ||
| 1080 | noname.103: | ||
| 1081 | addl2 r2,r10 | ||
| 1082 | bicl2 #0,r10 | ||
| 1083 | cmpl r10,r2 | ||
| 1084 | bgequ noname.104 | ||
| 1085 | incl r9 | ||
| 1086 | noname.104: | ||
| 1087 | |||
| 1088 | movl r8,16(r11) | ||
| 1089 | |||
| 1090 | clrl r8 | ||
| 1091 | |||
| 1092 | movzwl 2(r6),r2 | ||
| 1093 | bicl3 #-65536,20(r7),r3 | ||
| 1094 | movzwl 22(r7),r0 | ||
| 1095 | bicl2 #-65536,r0 | ||
| 1096 | bicl3 #-65536,(r6),-252(fp) | ||
| 1097 | bicl3 #-65536,r2,-256(fp) | ||
| 1098 | mull3 r0,-252(fp),-244(fp) | ||
| 1099 | mull2 r3,-252(fp) | ||
| 1100 | mull3 r3,-256(fp),-248(fp) | ||
| 1101 | mull2 r0,-256(fp) | ||
| 1102 | addl3 -244(fp),-248(fp),r0 | ||
| 1103 | bicl3 #0,r0,-244(fp) | ||
| 1104 | cmpl -244(fp),-248(fp) | ||
| 1105 | bgequ noname.105 | ||
| 1106 | addl2 #65536,-256(fp) | ||
| 1107 | noname.105: | ||
| 1108 | movzwl -242(fp),r0 | ||
| 1109 | bicl2 #-65536,r0 | ||
| 1110 | addl2 r0,-256(fp) | ||
| 1111 | bicl3 #-65536,-244(fp),r0 | ||
| 1112 | ashl #16,r0,-248(fp) | ||
| 1113 | addl3 -248(fp),-252(fp),r0 | ||
| 1114 | bicl3 #0,r0,-252(fp) | ||
| 1115 | cmpl -252(fp),-248(fp) | ||
| 1116 | bgequ noname.106 | ||
| 1117 | incl -256(fp) | ||
| 1118 | noname.106: | ||
| 1119 | movl -252(fp),r1 | ||
| 1120 | movl -256(fp),r2 | ||
| 1121 | addl2 r1,r10 | ||
| 1122 | bicl2 #0,r10 | ||
| 1123 | cmpl r10,r1 | ||
| 1124 | bgequ noname.107 | ||
| 1125 | incl r2 | ||
| 1126 | noname.107: | ||
| 1127 | addl2 r2,r9 | ||
| 1128 | bicl2 #0,r9 | ||
| 1129 | cmpl r9,r2 | ||
| 1130 | bgequ noname.108 | ||
| 1131 | incl r8 | ||
| 1132 | noname.108: | ||
| 1133 | |||
| 1134 | movzwl 6(r6),r2 | ||
| 1135 | bicl3 #-65536,16(r7),r3 | ||
| 1136 | movzwl 18(r7),r0 | ||
| 1137 | bicl2 #-65536,r0 | ||
| 1138 | bicl3 #-65536,4(r6),-268(fp) | ||
| 1139 | bicl3 #-65536,r2,-272(fp) | ||
| 1140 | mull3 r0,-268(fp),-260(fp) | ||
| 1141 | mull2 r3,-268(fp) | ||
| 1142 | mull3 r3,-272(fp),-264(fp) | ||
| 1143 | mull2 r0,-272(fp) | ||
| 1144 | addl3 -260(fp),-264(fp),r0 | ||
| 1145 | bicl3 #0,r0,-260(fp) | ||
| 1146 | cmpl -260(fp),-264(fp) | ||
| 1147 | bgequ noname.109 | ||
| 1148 | addl2 #65536,-272(fp) | ||
| 1149 | noname.109: | ||
| 1150 | movzwl -258(fp),r0 | ||
| 1151 | bicl2 #-65536,r0 | ||
| 1152 | addl2 r0,-272(fp) | ||
| 1153 | bicl3 #-65536,-260(fp),r0 | ||
| 1154 | ashl #16,r0,-264(fp) | ||
| 1155 | addl3 -264(fp),-268(fp),r0 | ||
| 1156 | bicl3 #0,r0,-268(fp) | ||
| 1157 | cmpl -268(fp),-264(fp) | ||
| 1158 | bgequ noname.110 | ||
| 1159 | incl -272(fp) | ||
| 1160 | noname.110: | ||
| 1161 | movl -268(fp),r1 | ||
| 1162 | movl -272(fp),r2 | ||
| 1163 | addl2 r1,r10 | ||
| 1164 | bicl2 #0,r10 | ||
| 1165 | cmpl r10,r1 | ||
| 1166 | bgequ noname.111 | ||
| 1167 | incl r2 | ||
| 1168 | noname.111: | ||
| 1169 | addl2 r2,r9 | ||
| 1170 | bicl2 #0,r9 | ||
| 1171 | cmpl r9,r2 | ||
| 1172 | bgequ noname.112 | ||
| 1173 | incl r8 | ||
| 1174 | noname.112: | ||
| 1175 | |||
| 1176 | movzwl 10(r6),r2 | ||
| 1177 | bicl3 #-65536,12(r7),r3 | ||
| 1178 | movzwl 14(r7),r0 | ||
| 1179 | bicl2 #-65536,r0 | ||
| 1180 | bicl3 #-65536,8(r6),-284(fp) | ||
| 1181 | bicl3 #-65536,r2,-288(fp) | ||
| 1182 | mull3 r0,-284(fp),-276(fp) | ||
| 1183 | mull2 r3,-284(fp) | ||
| 1184 | mull3 r3,-288(fp),-280(fp) | ||
| 1185 | mull2 r0,-288(fp) | ||
| 1186 | addl3 -276(fp),-280(fp),r0 | ||
| 1187 | bicl3 #0,r0,-276(fp) | ||
| 1188 | cmpl -276(fp),-280(fp) | ||
| 1189 | bgequ noname.113 | ||
| 1190 | addl2 #65536,-288(fp) | ||
| 1191 | noname.113: | ||
| 1192 | movzwl -274(fp),r0 | ||
| 1193 | bicl2 #-65536,r0 | ||
| 1194 | addl2 r0,-288(fp) | ||
| 1195 | bicl3 #-65536,-276(fp),r0 | ||
| 1196 | ashl #16,r0,-280(fp) | ||
| 1197 | addl3 -280(fp),-284(fp),r0 | ||
| 1198 | bicl3 #0,r0,-284(fp) | ||
| 1199 | cmpl -284(fp),-280(fp) | ||
| 1200 | bgequ noname.114 | ||
| 1201 | incl -288(fp) | ||
| 1202 | noname.114: | ||
| 1203 | movl -284(fp),r1 | ||
| 1204 | movl -288(fp),r2 | ||
| 1205 | addl2 r1,r10 | ||
| 1206 | bicl2 #0,r10 | ||
| 1207 | cmpl r10,r1 | ||
| 1208 | bgequ noname.115 | ||
| 1209 | incl r2 | ||
| 1210 | noname.115: | ||
| 1211 | addl2 r2,r9 | ||
| 1212 | bicl2 #0,r9 | ||
| 1213 | cmpl r9,r2 | ||
| 1214 | bgequ noname.116 | ||
| 1215 | incl r8 | ||
| 1216 | noname.116: | ||
| 1217 | |||
| 1218 | movzwl 14(r6),r2 | ||
| 1219 | bicl3 #-65536,8(r7),r3 | ||
| 1220 | movzwl 10(r7),r0 | ||
| 1221 | bicl2 #-65536,r0 | ||
| 1222 | bicl3 #-65536,12(r6),-300(fp) | ||
| 1223 | bicl3 #-65536,r2,-304(fp) | ||
| 1224 | mull3 r0,-300(fp),-292(fp) | ||
| 1225 | mull2 r3,-300(fp) | ||
| 1226 | mull3 r3,-304(fp),-296(fp) | ||
| 1227 | mull2 r0,-304(fp) | ||
| 1228 | addl3 -292(fp),-296(fp),r0 | ||
| 1229 | bicl3 #0,r0,-292(fp) | ||
| 1230 | cmpl -292(fp),-296(fp) | ||
| 1231 | bgequ noname.117 | ||
| 1232 | addl2 #65536,-304(fp) | ||
| 1233 | noname.117: | ||
| 1234 | movzwl -290(fp),r0 | ||
| 1235 | bicl2 #-65536,r0 | ||
| 1236 | addl2 r0,-304(fp) | ||
| 1237 | bicl3 #-65536,-292(fp),r0 | ||
| 1238 | ashl #16,r0,-296(fp) | ||
| 1239 | addl3 -296(fp),-300(fp),r0 | ||
| 1240 | bicl3 #0,r0,-300(fp) | ||
| 1241 | cmpl -300(fp),-296(fp) | ||
| 1242 | bgequ noname.118 | ||
| 1243 | incl -304(fp) | ||
| 1244 | noname.118: | ||
| 1245 | movl -300(fp),r1 | ||
| 1246 | movl -304(fp),r2 | ||
| 1247 | addl2 r1,r10 | ||
| 1248 | bicl2 #0,r10 | ||
| 1249 | cmpl r10,r1 | ||
| 1250 | bgequ noname.119 | ||
| 1251 | incl r2 | ||
| 1252 | noname.119: | ||
| 1253 | addl2 r2,r9 | ||
| 1254 | bicl2 #0,r9 | ||
| 1255 | cmpl r9,r2 | ||
| 1256 | bgequ noname.120 | ||
| 1257 | incl r8 | ||
| 1258 | noname.120: | ||
| 1259 | |||
| 1260 | movzwl 18(r6),r2 | ||
| 1261 | bicl3 #-65536,4(r7),r3 | ||
| 1262 | movzwl 6(r7),r0 | ||
| 1263 | bicl2 #-65536,r0 | ||
| 1264 | bicl3 #-65536,16(r6),-316(fp) | ||
| 1265 | bicl3 #-65536,r2,-320(fp) | ||
| 1266 | mull3 r0,-316(fp),-308(fp) | ||
| 1267 | mull2 r3,-316(fp) | ||
| 1268 | mull3 r3,-320(fp),-312(fp) | ||
| 1269 | mull2 r0,-320(fp) | ||
| 1270 | addl3 -308(fp),-312(fp),r0 | ||
| 1271 | bicl3 #0,r0,-308(fp) | ||
| 1272 | cmpl -308(fp),-312(fp) | ||
| 1273 | bgequ noname.121 | ||
| 1274 | addl2 #65536,-320(fp) | ||
| 1275 | noname.121: | ||
| 1276 | movzwl -306(fp),r0 | ||
| 1277 | bicl2 #-65536,r0 | ||
| 1278 | addl2 r0,-320(fp) | ||
| 1279 | bicl3 #-65536,-308(fp),r0 | ||
| 1280 | ashl #16,r0,-312(fp) | ||
| 1281 | addl3 -312(fp),-316(fp),r0 | ||
| 1282 | bicl3 #0,r0,-316(fp) | ||
| 1283 | cmpl -316(fp),-312(fp) | ||
| 1284 | bgequ noname.122 | ||
| 1285 | incl -320(fp) | ||
| 1286 | noname.122: | ||
| 1287 | movl -316(fp),r1 | ||
| 1288 | movl -320(fp),r2 | ||
| 1289 | addl2 r1,r10 | ||
| 1290 | bicl2 #0,r10 | ||
| 1291 | cmpl r10,r1 | ||
| 1292 | bgequ noname.123 | ||
| 1293 | incl r2 | ||
| 1294 | |||
| 1295 | noname.123: | ||
| 1296 | addl2 r2,r9 | ||
| 1297 | bicl2 #0,r9 | ||
| 1298 | cmpl r9,r2 | ||
| 1299 | bgequ noname.124 | ||
| 1300 | incl r8 | ||
| 1301 | noname.124: | ||
| 1302 | |||
| 1303 | movzwl 22(r6),r2 | ||
| 1304 | bicl3 #-65536,(r7),r3 | ||
| 1305 | movzwl 2(r7),r0 | ||
| 1306 | bicl2 #-65536,r0 | ||
| 1307 | bicl3 #-65536,20(r6),-332(fp) | ||
| 1308 | bicl3 #-65536,r2,-336(fp) | ||
| 1309 | mull3 r0,-332(fp),-324(fp) | ||
| 1310 | mull2 r3,-332(fp) | ||
| 1311 | mull3 r3,-336(fp),-328(fp) | ||
| 1312 | mull2 r0,-336(fp) | ||
| 1313 | addl3 -324(fp),-328(fp),r0 | ||
| 1314 | bicl3 #0,r0,-324(fp) | ||
| 1315 | cmpl -324(fp),-328(fp) | ||
| 1316 | bgequ noname.125 | ||
| 1317 | addl2 #65536,-336(fp) | ||
| 1318 | noname.125: | ||
| 1319 | movzwl -322(fp),r0 | ||
| 1320 | bicl2 #-65536,r0 | ||
| 1321 | addl2 r0,-336(fp) | ||
| 1322 | bicl3 #-65536,-324(fp),r0 | ||
| 1323 | ashl #16,r0,-328(fp) | ||
| 1324 | addl3 -328(fp),-332(fp),r0 | ||
| 1325 | bicl3 #0,r0,-332(fp) | ||
| 1326 | cmpl -332(fp),-328(fp) | ||
| 1327 | bgequ noname.126 | ||
| 1328 | incl -336(fp) | ||
| 1329 | noname.126: | ||
| 1330 | movl -332(fp),r1 | ||
| 1331 | movl -336(fp),r2 | ||
| 1332 | addl2 r1,r10 | ||
| 1333 | bicl2 #0,r10 | ||
| 1334 | cmpl r10,r1 | ||
| 1335 | bgequ noname.127 | ||
| 1336 | incl r2 | ||
| 1337 | noname.127: | ||
| 1338 | addl2 r2,r9 | ||
| 1339 | bicl2 #0,r9 | ||
| 1340 | cmpl r9,r2 | ||
| 1341 | bgequ noname.128 | ||
| 1342 | incl r8 | ||
| 1343 | noname.128: | ||
| 1344 | |||
| 1345 | movl r10,20(r11) | ||
| 1346 | |||
| 1347 | clrl r10 | ||
| 1348 | |||
| 1349 | movzwl 26(r6),r2 | ||
| 1350 | bicl3 #-65536,(r7),r3 | ||
| 1351 | movzwl 2(r7),r0 | ||
| 1352 | bicl2 #-65536,r0 | ||
| 1353 | bicl3 #-65536,24(r6),-348(fp) | ||
| 1354 | bicl3 #-65536,r2,-352(fp) | ||
| 1355 | mull3 r0,-348(fp),-340(fp) | ||
| 1356 | mull2 r3,-348(fp) | ||
| 1357 | mull3 r3,-352(fp),-344(fp) | ||
| 1358 | mull2 r0,-352(fp) | ||
| 1359 | addl3 -340(fp),-344(fp),r0 | ||
| 1360 | bicl3 #0,r0,-340(fp) | ||
| 1361 | cmpl -340(fp),-344(fp) | ||
| 1362 | bgequ noname.129 | ||
| 1363 | addl2 #65536,-352(fp) | ||
| 1364 | noname.129: | ||
| 1365 | movzwl -338(fp),r0 | ||
| 1366 | bicl2 #-65536,r0 | ||
| 1367 | addl2 r0,-352(fp) | ||
| 1368 | bicl3 #-65536,-340(fp),r0 | ||
| 1369 | ashl #16,r0,-344(fp) | ||
| 1370 | addl3 -344(fp),-348(fp),r0 | ||
| 1371 | bicl3 #0,r0,-348(fp) | ||
| 1372 | cmpl -348(fp),-344(fp) | ||
| 1373 | bgequ noname.130 | ||
| 1374 | incl -352(fp) | ||
| 1375 | noname.130: | ||
| 1376 | movl -348(fp),r1 | ||
| 1377 | movl -352(fp),r2 | ||
| 1378 | addl2 r1,r9 | ||
| 1379 | bicl2 #0,r9 | ||
| 1380 | cmpl r9,r1 | ||
| 1381 | bgequ noname.131 | ||
| 1382 | incl r2 | ||
| 1383 | noname.131: | ||
| 1384 | addl2 r2,r8 | ||
| 1385 | bicl2 #0,r8 | ||
| 1386 | cmpl r8,r2 | ||
| 1387 | bgequ noname.132 | ||
| 1388 | incl r10 | ||
| 1389 | noname.132: | ||
| 1390 | |||
| 1391 | movzwl 22(r6),r2 | ||
| 1392 | bicl3 #-65536,4(r7),r3 | ||
| 1393 | movzwl 6(r7),r0 | ||
| 1394 | bicl2 #-65536,r0 | ||
| 1395 | bicl3 #-65536,20(r6),-364(fp) | ||
| 1396 | bicl3 #-65536,r2,-368(fp) | ||
| 1397 | mull3 r0,-364(fp),-356(fp) | ||
| 1398 | mull2 r3,-364(fp) | ||
| 1399 | mull3 r3,-368(fp),-360(fp) | ||
| 1400 | mull2 r0,-368(fp) | ||
| 1401 | addl3 -356(fp),-360(fp),r0 | ||
| 1402 | bicl3 #0,r0,-356(fp) | ||
| 1403 | cmpl -356(fp),-360(fp) | ||
| 1404 | bgequ noname.133 | ||
| 1405 | addl2 #65536,-368(fp) | ||
| 1406 | noname.133: | ||
| 1407 | movzwl -354(fp),r0 | ||
| 1408 | bicl2 #-65536,r0 | ||
| 1409 | addl2 r0,-368(fp) | ||
| 1410 | bicl3 #-65536,-356(fp),r0 | ||
| 1411 | ashl #16,r0,-360(fp) | ||
| 1412 | addl3 -360(fp),-364(fp),r0 | ||
| 1413 | bicl3 #0,r0,-364(fp) | ||
| 1414 | cmpl -364(fp),-360(fp) | ||
| 1415 | bgequ noname.134 | ||
| 1416 | incl -368(fp) | ||
| 1417 | noname.134: | ||
| 1418 | movl -364(fp),r1 | ||
| 1419 | movl -368(fp),r2 | ||
| 1420 | addl2 r1,r9 | ||
| 1421 | bicl2 #0,r9 | ||
| 1422 | cmpl r9,r1 | ||
| 1423 | bgequ noname.135 | ||
| 1424 | incl r2 | ||
| 1425 | noname.135: | ||
| 1426 | addl2 r2,r8 | ||
| 1427 | bicl2 #0,r8 | ||
| 1428 | cmpl r8,r2 | ||
| 1429 | bgequ noname.136 | ||
| 1430 | incl r10 | ||
| 1431 | noname.136: | ||
| 1432 | |||
| 1433 | movzwl 18(r6),r2 | ||
| 1434 | bicl3 #-65536,8(r7),r3 | ||
| 1435 | movzwl 10(r7),r0 | ||
| 1436 | bicl2 #-65536,r0 | ||
| 1437 | bicl3 #-65536,16(r6),-380(fp) | ||
| 1438 | bicl3 #-65536,r2,-384(fp) | ||
| 1439 | mull3 r0,-380(fp),-372(fp) | ||
| 1440 | mull2 r3,-380(fp) | ||
| 1441 | mull3 r3,-384(fp),-376(fp) | ||
| 1442 | mull2 r0,-384(fp) | ||
| 1443 | addl3 -372(fp),-376(fp),r0 | ||
| 1444 | bicl3 #0,r0,-372(fp) | ||
| 1445 | cmpl -372(fp),-376(fp) | ||
| 1446 | bgequ noname.137 | ||
| 1447 | addl2 #65536,-384(fp) | ||
| 1448 | noname.137: | ||
| 1449 | movzwl -370(fp),r0 | ||
| 1450 | bicl2 #-65536,r0 | ||
| 1451 | addl2 r0,-384(fp) | ||
| 1452 | bicl3 #-65536,-372(fp),r0 | ||
| 1453 | ashl #16,r0,-376(fp) | ||
| 1454 | addl3 -376(fp),-380(fp),r0 | ||
| 1455 | bicl3 #0,r0,-380(fp) | ||
| 1456 | cmpl -380(fp),-376(fp) | ||
| 1457 | bgequ noname.138 | ||
| 1458 | incl -384(fp) | ||
| 1459 | noname.138: | ||
| 1460 | movl -380(fp),r1 | ||
| 1461 | movl -384(fp),r2 | ||
| 1462 | addl2 r1,r9 | ||
| 1463 | bicl2 #0,r9 | ||
| 1464 | cmpl r9,r1 | ||
| 1465 | bgequ noname.139 | ||
| 1466 | incl r2 | ||
| 1467 | noname.139: | ||
| 1468 | addl2 r2,r8 | ||
| 1469 | bicl2 #0,r8 | ||
| 1470 | cmpl r8,r2 | ||
| 1471 | bgequ noname.140 | ||
| 1472 | incl r10 | ||
| 1473 | noname.140: | ||
| 1474 | |||
| 1475 | movzwl 14(r6),r2 | ||
| 1476 | bicl3 #-65536,12(r7),r3 | ||
| 1477 | movzwl 14(r7),r0 | ||
| 1478 | bicl2 #-65536,r0 | ||
| 1479 | bicl3 #-65536,12(r6),-396(fp) | ||
| 1480 | bicl3 #-65536,r2,-400(fp) | ||
| 1481 | mull3 r0,-396(fp),-388(fp) | ||
| 1482 | mull2 r3,-396(fp) | ||
| 1483 | mull3 r3,-400(fp),-392(fp) | ||
| 1484 | mull2 r0,-400(fp) | ||
| 1485 | addl3 -388(fp),-392(fp),r0 | ||
| 1486 | bicl3 #0,r0,-388(fp) | ||
| 1487 | cmpl -388(fp),-392(fp) | ||
| 1488 | bgequ noname.141 | ||
| 1489 | addl2 #65536,-400(fp) | ||
| 1490 | noname.141: | ||
| 1491 | movzwl -386(fp),r0 | ||
| 1492 | bicl2 #-65536,r0 | ||
| 1493 | addl2 r0,-400(fp) | ||
| 1494 | bicl3 #-65536,-388(fp),r0 | ||
| 1495 | ashl #16,r0,-392(fp) | ||
| 1496 | addl3 -392(fp),-396(fp),r0 | ||
| 1497 | bicl3 #0,r0,-396(fp) | ||
| 1498 | cmpl -396(fp),-392(fp) | ||
| 1499 | bgequ noname.142 | ||
| 1500 | incl -400(fp) | ||
| 1501 | noname.142: | ||
| 1502 | movl -396(fp),r1 | ||
| 1503 | movl -400(fp),r2 | ||
| 1504 | addl2 r1,r9 | ||
| 1505 | bicl2 #0,r9 | ||
| 1506 | cmpl r9,r1 | ||
| 1507 | bgequ noname.143 | ||
| 1508 | incl r2 | ||
| 1509 | noname.143: | ||
| 1510 | addl2 r2,r8 | ||
| 1511 | bicl2 #0,r8 | ||
| 1512 | cmpl r8,r2 | ||
| 1513 | bgequ noname.144 | ||
| 1514 | incl r10 | ||
| 1515 | noname.144: | ||
| 1516 | |||
| 1517 | movzwl 10(r6),r2 | ||
| 1518 | bicl3 #-65536,16(r7),r3 | ||
| 1519 | movzwl 18(r7),r0 | ||
| 1520 | bicl2 #-65536,r0 | ||
| 1521 | bicl3 #-65536,8(r6),-412(fp) | ||
| 1522 | bicl3 #-65536,r2,-416(fp) | ||
| 1523 | mull3 r0,-412(fp),-404(fp) | ||
| 1524 | mull2 r3,-412(fp) | ||
| 1525 | mull3 r3,-416(fp),-408(fp) | ||
| 1526 | mull2 r0,-416(fp) | ||
| 1527 | addl3 -404(fp),-408(fp),r0 | ||
| 1528 | bicl3 #0,r0,-404(fp) | ||
| 1529 | cmpl -404(fp),-408(fp) | ||
| 1530 | bgequ noname.145 | ||
| 1531 | addl2 #65536,-416(fp) | ||
| 1532 | noname.145: | ||
| 1533 | movzwl -402(fp),r0 | ||
| 1534 | bicl2 #-65536,r0 | ||
| 1535 | addl2 r0,-416(fp) | ||
| 1536 | bicl3 #-65536,-404(fp),r0 | ||
| 1537 | ashl #16,r0,-408(fp) | ||
| 1538 | addl3 -408(fp),-412(fp),r0 | ||
| 1539 | bicl3 #0,r0,-412(fp) | ||
| 1540 | cmpl -412(fp),-408(fp) | ||
| 1541 | bgequ noname.146 | ||
| 1542 | incl -416(fp) | ||
| 1543 | noname.146: | ||
| 1544 | movl -412(fp),r1 | ||
| 1545 | movl -416(fp),r2 | ||
| 1546 | addl2 r1,r9 | ||
| 1547 | bicl2 #0,r9 | ||
| 1548 | cmpl r9,r1 | ||
| 1549 | bgequ noname.147 | ||
| 1550 | incl r2 | ||
| 1551 | noname.147: | ||
| 1552 | addl2 r2,r8 | ||
| 1553 | bicl2 #0,r8 | ||
| 1554 | cmpl r8,r2 | ||
| 1555 | bgequ noname.148 | ||
| 1556 | incl r10 | ||
| 1557 | noname.148: | ||
| 1558 | |||
| 1559 | movzwl 6(r6),r2 | ||
| 1560 | bicl3 #-65536,20(r7),r3 | ||
| 1561 | movzwl 22(r7),r0 | ||
| 1562 | bicl2 #-65536,r0 | ||
| 1563 | bicl3 #-65536,4(r6),-428(fp) | ||
| 1564 | bicl3 #-65536,r2,-432(fp) | ||
| 1565 | mull3 r0,-428(fp),-420(fp) | ||
| 1566 | mull2 r3,-428(fp) | ||
| 1567 | mull3 r3,-432(fp),-424(fp) | ||
| 1568 | mull2 r0,-432(fp) | ||
| 1569 | addl3 -420(fp),-424(fp),r0 | ||
| 1570 | bicl3 #0,r0,-420(fp) | ||
| 1571 | cmpl -420(fp),-424(fp) | ||
| 1572 | bgequ noname.149 | ||
| 1573 | addl2 #65536,-432(fp) | ||
| 1574 | noname.149: | ||
| 1575 | movzwl -418(fp),r0 | ||
| 1576 | bicl2 #-65536,r0 | ||
| 1577 | addl2 r0,-432(fp) | ||
| 1578 | bicl3 #-65536,-420(fp),r0 | ||
| 1579 | ashl #16,r0,-424(fp) | ||
| 1580 | addl3 -424(fp),-428(fp),r0 | ||
| 1581 | bicl3 #0,r0,-428(fp) | ||
| 1582 | cmpl -428(fp),-424(fp) | ||
| 1583 | bgequ noname.150 | ||
| 1584 | incl -432(fp) | ||
| 1585 | noname.150: | ||
| 1586 | movl -428(fp),r1 | ||
| 1587 | movl -432(fp),r2 | ||
| 1588 | addl2 r1,r9 | ||
| 1589 | bicl2 #0,r9 | ||
| 1590 | cmpl r9,r1 | ||
| 1591 | bgequ noname.151 | ||
| 1592 | incl r2 | ||
| 1593 | noname.151: | ||
| 1594 | addl2 r2,r8 | ||
| 1595 | bicl2 #0,r8 | ||
| 1596 | cmpl r8,r2 | ||
| 1597 | bgequ noname.152 | ||
| 1598 | incl r10 | ||
| 1599 | noname.152: | ||
| 1600 | |||
| 1601 | movzwl 2(r6),r2 | ||
| 1602 | bicl3 #-65536,24(r7),r3 | ||
| 1603 | movzwl 26(r7),r0 | ||
| 1604 | bicl2 #-65536,r0 | ||
| 1605 | bicl3 #-65536,(r6),-444(fp) | ||
| 1606 | bicl3 #-65536,r2,-448(fp) | ||
| 1607 | mull3 r0,-444(fp),-436(fp) | ||
| 1608 | mull2 r3,-444(fp) | ||
| 1609 | mull3 r3,-448(fp),-440(fp) | ||
| 1610 | mull2 r0,-448(fp) | ||
| 1611 | addl3 -436(fp),-440(fp),r0 | ||
| 1612 | bicl3 #0,r0,-436(fp) | ||
| 1613 | cmpl -436(fp),-440(fp) | ||
| 1614 | bgequ noname.153 | ||
| 1615 | addl2 #65536,-448(fp) | ||
| 1616 | noname.153: | ||
| 1617 | movzwl -434(fp),r0 | ||
| 1618 | bicl2 #-65536,r0 | ||
| 1619 | addl2 r0,-448(fp) | ||
| 1620 | bicl3 #-65536,-436(fp),r0 | ||
| 1621 | ashl #16,r0,-440(fp) | ||
| 1622 | addl3 -440(fp),-444(fp),r0 | ||
| 1623 | bicl3 #0,r0,-444(fp) | ||
| 1624 | cmpl -444(fp),-440(fp) | ||
| 1625 | bgequ noname.154 | ||
| 1626 | incl -448(fp) | ||
| 1627 | noname.154: | ||
| 1628 | movl -444(fp),r1 | ||
| 1629 | movl -448(fp),r2 | ||
| 1630 | addl2 r1,r9 | ||
| 1631 | bicl2 #0,r9 | ||
| 1632 | cmpl r9,r1 | ||
| 1633 | bgequ noname.155 | ||
| 1634 | incl r2 | ||
| 1635 | noname.155: | ||
| 1636 | addl2 r2,r8 | ||
| 1637 | bicl2 #0,r8 | ||
| 1638 | cmpl r8,r2 | ||
| 1639 | bgequ noname.156 | ||
| 1640 | incl r10 | ||
| 1641 | noname.156: | ||
| 1642 | |||
| 1643 | movl r9,24(r11) | ||
| 1644 | |||
| 1645 | clrl r9 | ||
| 1646 | |||
| 1647 | movzwl 2(r6),r2 | ||
| 1648 | bicl3 #-65536,28(r7),r3 | ||
| 1649 | movzwl 30(r7),r0 | ||
| 1650 | bicl2 #-65536,r0 | ||
| 1651 | bicl3 #-65536,(r6),-460(fp) | ||
| 1652 | bicl3 #-65536,r2,-464(fp) | ||
| 1653 | mull3 r0,-460(fp),-452(fp) | ||
| 1654 | mull2 r3,-460(fp) | ||
| 1655 | mull3 r3,-464(fp),-456(fp) | ||
| 1656 | mull2 r0,-464(fp) | ||
| 1657 | addl3 -452(fp),-456(fp),r0 | ||
| 1658 | bicl3 #0,r0,-452(fp) | ||
| 1659 | cmpl -452(fp),-456(fp) | ||
| 1660 | bgequ noname.157 | ||
| 1661 | addl2 #65536,-464(fp) | ||
| 1662 | noname.157: | ||
| 1663 | movzwl -450(fp),r0 | ||
| 1664 | bicl2 #-65536,r0 | ||
| 1665 | addl2 r0,-464(fp) | ||
| 1666 | bicl3 #-65536,-452(fp),r0 | ||
| 1667 | ashl #16,r0,-456(fp) | ||
| 1668 | addl3 -456(fp),-460(fp),r0 | ||
| 1669 | bicl3 #0,r0,-460(fp) | ||
| 1670 | cmpl -460(fp),-456(fp) | ||
| 1671 | bgequ noname.158 | ||
| 1672 | incl -464(fp) | ||
| 1673 | noname.158: | ||
| 1674 | movl -460(fp),r1 | ||
| 1675 | movl -464(fp),r2 | ||
| 1676 | addl2 r1,r8 | ||
| 1677 | bicl2 #0,r8 | ||
| 1678 | cmpl r8,r1 | ||
| 1679 | bgequ noname.159 | ||
| 1680 | incl r2 | ||
| 1681 | noname.159: | ||
| 1682 | addl2 r2,r10 | ||
| 1683 | bicl2 #0,r10 | ||
| 1684 | cmpl r10,r2 | ||
| 1685 | bgequ noname.160 | ||
| 1686 | incl r9 | ||
| 1687 | noname.160: | ||
| 1688 | |||
| 1689 | movzwl 6(r6),r2 | ||
| 1690 | bicl3 #-65536,24(r7),r3 | ||
| 1691 | movzwl 26(r7),r0 | ||
| 1692 | bicl2 #-65536,r0 | ||
| 1693 | bicl3 #-65536,4(r6),-476(fp) | ||
| 1694 | bicl3 #-65536,r2,-480(fp) | ||
| 1695 | mull3 r0,-476(fp),-468(fp) | ||
| 1696 | mull2 r3,-476(fp) | ||
| 1697 | mull3 r3,-480(fp),-472(fp) | ||
| 1698 | mull2 r0,-480(fp) | ||
| 1699 | addl3 -468(fp),-472(fp),r0 | ||
| 1700 | bicl3 #0,r0,-468(fp) | ||
| 1701 | cmpl -468(fp),-472(fp) | ||
| 1702 | bgequ noname.161 | ||
| 1703 | addl2 #65536,-480(fp) | ||
| 1704 | noname.161: | ||
| 1705 | movzwl -466(fp),r0 | ||
| 1706 | bicl2 #-65536,r0 | ||
| 1707 | addl2 r0,-480(fp) | ||
| 1708 | bicl3 #-65536,-468(fp),r0 | ||
| 1709 | ashl #16,r0,-472(fp) | ||
| 1710 | addl3 -472(fp),-476(fp),r0 | ||
| 1711 | bicl3 #0,r0,-476(fp) | ||
| 1712 | cmpl -476(fp),-472(fp) | ||
| 1713 | bgequ noname.162 | ||
| 1714 | incl -480(fp) | ||
| 1715 | noname.162: | ||
| 1716 | movl -476(fp),r1 | ||
| 1717 | movl -480(fp),r2 | ||
| 1718 | addl2 r1,r8 | ||
| 1719 | bicl2 #0,r8 | ||
| 1720 | cmpl r8,r1 | ||
| 1721 | bgequ noname.163 | ||
| 1722 | incl r2 | ||
| 1723 | noname.163: | ||
| 1724 | addl2 r2,r10 | ||
| 1725 | bicl2 #0,r10 | ||
| 1726 | cmpl r10,r2 | ||
| 1727 | bgequ noname.164 | ||
| 1728 | incl r9 | ||
| 1729 | noname.164: | ||
| 1730 | |||
| 1731 | movzwl 10(r6),r2 | ||
| 1732 | bicl3 #-65536,20(r7),r3 | ||
| 1733 | movzwl 22(r7),r0 | ||
| 1734 | bicl2 #-65536,r0 | ||
| 1735 | bicl3 #-65536,8(r6),-492(fp) | ||
| 1736 | bicl3 #-65536,r2,-496(fp) | ||
| 1737 | mull3 r0,-492(fp),-484(fp) | ||
| 1738 | mull2 r3,-492(fp) | ||
| 1739 | mull3 r3,-496(fp),-488(fp) | ||
| 1740 | mull2 r0,-496(fp) | ||
| 1741 | addl3 -484(fp),-488(fp),r0 | ||
| 1742 | bicl3 #0,r0,-484(fp) | ||
| 1743 | cmpl -484(fp),-488(fp) | ||
| 1744 | bgequ noname.165 | ||
| 1745 | addl2 #65536,-496(fp) | ||
| 1746 | noname.165: | ||
| 1747 | movzwl -482(fp),r0 | ||
| 1748 | bicl2 #-65536,r0 | ||
| 1749 | addl2 r0,-496(fp) | ||
| 1750 | bicl3 #-65536,-484(fp),r0 | ||
| 1751 | ashl #16,r0,-488(fp) | ||
| 1752 | addl3 -488(fp),-492(fp),r0 | ||
| 1753 | bicl3 #0,r0,-492(fp) | ||
| 1754 | cmpl -492(fp),-488(fp) | ||
| 1755 | bgequ noname.166 | ||
| 1756 | incl -496(fp) | ||
| 1757 | noname.166: | ||
| 1758 | movl -492(fp),r1 | ||
| 1759 | movl -496(fp),r2 | ||
| 1760 | addl2 r1,r8 | ||
| 1761 | bicl2 #0,r8 | ||
| 1762 | cmpl r8,r1 | ||
| 1763 | bgequ noname.167 | ||
| 1764 | incl r2 | ||
| 1765 | noname.167: | ||
| 1766 | addl2 r2,r10 | ||
| 1767 | bicl2 #0,r10 | ||
| 1768 | cmpl r10,r2 | ||
| 1769 | bgequ noname.168 | ||
| 1770 | incl r9 | ||
| 1771 | noname.168: | ||
| 1772 | |||
| 1773 | movzwl 14(r6),r2 | ||
| 1774 | bicl3 #-65536,16(r7),r3 | ||
| 1775 | movzwl 18(r7),r0 | ||
| 1776 | bicl2 #-65536,r0 | ||
| 1777 | bicl3 #-65536,12(r6),-508(fp) | ||
| 1778 | bicl3 #-65536,r2,-512(fp) | ||
| 1779 | mull3 r0,-508(fp),-500(fp) | ||
| 1780 | mull2 r3,-508(fp) | ||
| 1781 | mull3 r3,-512(fp),-504(fp) | ||
| 1782 | mull2 r0,-512(fp) | ||
| 1783 | addl3 -500(fp),-504(fp),r0 | ||
| 1784 | bicl3 #0,r0,-500(fp) | ||
| 1785 | cmpl -500(fp),-504(fp) | ||
| 1786 | bgequ noname.169 | ||
| 1787 | addl2 #65536,-512(fp) | ||
| 1788 | noname.169: | ||
| 1789 | movzwl -498(fp),r0 | ||
| 1790 | bicl2 #-65536,r0 | ||
| 1791 | addl2 r0,-512(fp) | ||
| 1792 | bicl3 #-65536,-500(fp),r0 | ||
| 1793 | ashl #16,r0,-504(fp) | ||
| 1794 | addl3 -504(fp),-508(fp),r0 | ||
| 1795 | bicl3 #0,r0,-508(fp) | ||
| 1796 | cmpl -508(fp),-504(fp) | ||
| 1797 | bgequ noname.170 | ||
| 1798 | incl -512(fp) | ||
| 1799 | noname.170: | ||
| 1800 | movl -508(fp),r1 | ||
| 1801 | movl -512(fp),r2 | ||
| 1802 | addl2 r1,r8 | ||
| 1803 | bicl2 #0,r8 | ||
| 1804 | cmpl r8,r1 | ||
| 1805 | bgequ noname.171 | ||
| 1806 | incl r2 | ||
| 1807 | noname.171: | ||
| 1808 | addl2 r2,r10 | ||
| 1809 | bicl2 #0,r10 | ||
| 1810 | cmpl r10,r2 | ||
| 1811 | bgequ noname.172 | ||
| 1812 | incl r9 | ||
| 1813 | noname.172: | ||
| 1814 | |||
| 1815 | movzwl 18(r6),r2 | ||
| 1816 | bicl3 #-65536,12(r7),r3 | ||
| 1817 | movzwl 14(r7),r0 | ||
| 1818 | bicl2 #-65536,r0 | ||
| 1819 | bicl3 #-65536,16(r6),-524(fp) | ||
| 1820 | bicl3 #-65536,r2,-528(fp) | ||
| 1821 | mull3 r0,-524(fp),-516(fp) | ||
| 1822 | mull2 r3,-524(fp) | ||
| 1823 | mull3 r3,-528(fp),-520(fp) | ||
| 1824 | mull2 r0,-528(fp) | ||
| 1825 | addl3 -516(fp),-520(fp),r0 | ||
| 1826 | bicl3 #0,r0,-516(fp) | ||
| 1827 | cmpl -516(fp),-520(fp) | ||
| 1828 | bgequ noname.173 | ||
| 1829 | addl2 #65536,-528(fp) | ||
| 1830 | noname.173: | ||
| 1831 | movzwl -514(fp),r0 | ||
| 1832 | bicl2 #-65536,r0 | ||
| 1833 | addl2 r0,-528(fp) | ||
| 1834 | bicl3 #-65536,-516(fp),r0 | ||
| 1835 | ashl #16,r0,-520(fp) | ||
| 1836 | addl3 -520(fp),-524(fp),r0 | ||
| 1837 | bicl3 #0,r0,-524(fp) | ||
| 1838 | cmpl -524(fp),-520(fp) | ||
| 1839 | bgequ noname.174 | ||
| 1840 | incl -528(fp) | ||
| 1841 | noname.174: | ||
| 1842 | movl -524(fp),r1 | ||
| 1843 | movl -528(fp),r2 | ||
| 1844 | addl2 r1,r8 | ||
| 1845 | bicl2 #0,r8 | ||
| 1846 | cmpl r8,r1 | ||
| 1847 | bgequ noname.175 | ||
| 1848 | incl r2 | ||
| 1849 | noname.175: | ||
| 1850 | addl2 r2,r10 | ||
| 1851 | bicl2 #0,r10 | ||
| 1852 | cmpl r10,r2 | ||
| 1853 | bgequ noname.176 | ||
| 1854 | incl r9 | ||
| 1855 | noname.176: | ||
| 1856 | |||
| 1857 | movzwl 22(r6),r2 | ||
| 1858 | bicl3 #-65536,8(r7),r3 | ||
| 1859 | movzwl 10(r7),r0 | ||
| 1860 | bicl2 #-65536,r0 | ||
| 1861 | bicl3 #-65536,20(r6),-540(fp) | ||
| 1862 | bicl3 #-65536,r2,-544(fp) | ||
| 1863 | mull3 r0,-540(fp),-532(fp) | ||
| 1864 | mull2 r3,-540(fp) | ||
| 1865 | mull3 r3,-544(fp),-536(fp) | ||
| 1866 | mull2 r0,-544(fp) | ||
| 1867 | addl3 -532(fp),-536(fp),r0 | ||
| 1868 | bicl3 #0,r0,-532(fp) | ||
| 1869 | cmpl -532(fp),-536(fp) | ||
| 1870 | bgequ noname.177 | ||
| 1871 | addl2 #65536,-544(fp) | ||
| 1872 | noname.177: | ||
| 1873 | movzwl -530(fp),r0 | ||
| 1874 | bicl2 #-65536,r0 | ||
| 1875 | addl2 r0,-544(fp) | ||
| 1876 | bicl3 #-65536,-532(fp),r0 | ||
| 1877 | ashl #16,r0,-536(fp) | ||
| 1878 | addl3 -536(fp),-540(fp),r0 | ||
| 1879 | bicl3 #0,r0,-540(fp) | ||
| 1880 | cmpl -540(fp),-536(fp) | ||
| 1881 | bgequ noname.178 | ||
| 1882 | incl -544(fp) | ||
| 1883 | noname.178: | ||
| 1884 | movl -540(fp),r1 | ||
| 1885 | movl -544(fp),r2 | ||
| 1886 | addl2 r1,r8 | ||
| 1887 | bicl2 #0,r8 | ||
| 1888 | cmpl r8,r1 | ||
| 1889 | bgequ noname.179 | ||
| 1890 | incl r2 | ||
| 1891 | noname.179: | ||
| 1892 | addl2 r2,r10 | ||
| 1893 | bicl2 #0,r10 | ||
| 1894 | cmpl r10,r2 | ||
| 1895 | bgequ noname.180 | ||
| 1896 | incl r9 | ||
| 1897 | noname.180: | ||
| 1898 | |||
| 1899 | movzwl 26(r6),r2 | ||
| 1900 | bicl3 #-65536,4(r7),r3 | ||
| 1901 | movzwl 6(r7),r0 | ||
| 1902 | bicl2 #-65536,r0 | ||
| 1903 | bicl3 #-65536,24(r6),-556(fp) | ||
| 1904 | bicl3 #-65536,r2,-560(fp) | ||
| 1905 | mull3 r0,-556(fp),-548(fp) | ||
| 1906 | mull2 r3,-556(fp) | ||
| 1907 | mull3 r3,-560(fp),-552(fp) | ||
| 1908 | mull2 r0,-560(fp) | ||
| 1909 | addl3 -548(fp),-552(fp),r0 | ||
| 1910 | bicl3 #0,r0,-548(fp) | ||
| 1911 | cmpl -548(fp),-552(fp) | ||
| 1912 | bgequ noname.181 | ||
| 1913 | addl2 #65536,-560(fp) | ||
| 1914 | noname.181: | ||
| 1915 | movzwl -546(fp),r0 | ||
| 1916 | bicl2 #-65536,r0 | ||
| 1917 | addl2 r0,-560(fp) | ||
| 1918 | bicl3 #-65536,-548(fp),r0 | ||
| 1919 | ashl #16,r0,-552(fp) | ||
| 1920 | addl3 -552(fp),-556(fp),r0 | ||
| 1921 | bicl3 #0,r0,-556(fp) | ||
| 1922 | cmpl -556(fp),-552(fp) | ||
| 1923 | bgequ noname.182 | ||
| 1924 | incl -560(fp) | ||
| 1925 | noname.182: | ||
| 1926 | movl -556(fp),r1 | ||
| 1927 | movl -560(fp),r2 | ||
| 1928 | addl2 r1,r8 | ||
| 1929 | bicl2 #0,r8 | ||
| 1930 | cmpl r8,r1 | ||
| 1931 | bgequ noname.183 | ||
| 1932 | incl r2 | ||
| 1933 | noname.183: | ||
| 1934 | addl2 r2,r10 | ||
| 1935 | bicl2 #0,r10 | ||
| 1936 | cmpl r10,r2 | ||
| 1937 | bgequ noname.184 | ||
| 1938 | incl r9 | ||
| 1939 | noname.184: | ||
| 1940 | |||
| 1941 | movzwl 30(r6),r2 | ||
| 1942 | bicl3 #-65536,(r7),r3 | ||
| 1943 | movzwl 2(r7),r0 | ||
| 1944 | bicl2 #-65536,r0 | ||
| 1945 | bicl3 #-65536,28(r6),-572(fp) | ||
| 1946 | bicl3 #-65536,r2,-576(fp) | ||
| 1947 | mull3 r0,-572(fp),-564(fp) | ||
| 1948 | mull2 r3,-572(fp) | ||
| 1949 | mull3 r3,-576(fp),-568(fp) | ||
| 1950 | mull2 r0,-576(fp) | ||
| 1951 | addl3 -564(fp),-568(fp),r0 | ||
| 1952 | bicl3 #0,r0,-564(fp) | ||
| 1953 | cmpl -564(fp),-568(fp) | ||
| 1954 | bgequ noname.185 | ||
| 1955 | addl2 #65536,-576(fp) | ||
| 1956 | noname.185: | ||
| 1957 | movzwl -562(fp),r0 | ||
| 1958 | bicl2 #-65536,r0 | ||
| 1959 | addl2 r0,-576(fp) | ||
| 1960 | bicl3 #-65536,-564(fp),r0 | ||
| 1961 | ashl #16,r0,-568(fp) | ||
| 1962 | addl3 -568(fp),-572(fp),r0 | ||
| 1963 | bicl3 #0,r0,-572(fp) | ||
| 1964 | cmpl -572(fp),-568(fp) | ||
| 1965 | bgequ noname.186 | ||
| 1966 | incl -576(fp) | ||
| 1967 | noname.186: | ||
| 1968 | movl -572(fp),r1 | ||
| 1969 | movl -576(fp),r2 | ||
| 1970 | addl2 r1,r8 | ||
| 1971 | bicl2 #0,r8 | ||
| 1972 | cmpl r8,r1 | ||
| 1973 | bgequ noname.187 | ||
| 1974 | incl r2 | ||
| 1975 | noname.187: | ||
| 1976 | addl2 r2,r10 | ||
| 1977 | bicl2 #0,r10 | ||
| 1978 | cmpl r10,r2 | ||
| 1979 | bgequ noname.188 | ||
| 1980 | incl r9 | ||
| 1981 | noname.188: | ||
| 1982 | |||
| 1983 | movl r8,28(r11) | ||
| 1984 | |||
| 1985 | clrl r8 | ||
| 1986 | |||
| 1987 | movzwl 30(r6),r2 | ||
| 1988 | bicl3 #-65536,4(r7),r3 | ||
| 1989 | movzwl 6(r7),r0 | ||
| 1990 | bicl2 #-65536,r0 | ||
| 1991 | bicl3 #-65536,28(r6),-588(fp) | ||
| 1992 | bicl3 #-65536,r2,-592(fp) | ||
| 1993 | mull3 r0,-588(fp),-580(fp) | ||
| 1994 | mull2 r3,-588(fp) | ||
| 1995 | mull3 r3,-592(fp),-584(fp) | ||
| 1996 | mull2 r0,-592(fp) | ||
| 1997 | addl3 -580(fp),-584(fp),r0 | ||
| 1998 | bicl3 #0,r0,-580(fp) | ||
| 1999 | cmpl -580(fp),-584(fp) | ||
| 2000 | bgequ noname.189 | ||
| 2001 | addl2 #65536,-592(fp) | ||
| 2002 | noname.189: | ||
| 2003 | movzwl -578(fp),r0 | ||
| 2004 | bicl2 #-65536,r0 | ||
| 2005 | addl2 r0,-592(fp) | ||
| 2006 | bicl3 #-65536,-580(fp),r0 | ||
| 2007 | ashl #16,r0,-584(fp) | ||
| 2008 | addl3 -584(fp),-588(fp),r0 | ||
| 2009 | bicl3 #0,r0,-588(fp) | ||
| 2010 | cmpl -588(fp),-584(fp) | ||
| 2011 | bgequ noname.190 | ||
| 2012 | incl -592(fp) | ||
| 2013 | noname.190: | ||
| 2014 | movl -588(fp),r1 | ||
| 2015 | movl -592(fp),r2 | ||
| 2016 | addl2 r1,r10 | ||
| 2017 | bicl2 #0,r10 | ||
| 2018 | cmpl r10,r1 | ||
| 2019 | bgequ noname.191 | ||
| 2020 | incl r2 | ||
| 2021 | noname.191: | ||
| 2022 | addl2 r2,r9 | ||
| 2023 | bicl2 #0,r9 | ||
| 2024 | cmpl r9,r2 | ||
| 2025 | bgequ noname.192 | ||
| 2026 | incl r8 | ||
| 2027 | noname.192: | ||
| 2028 | |||
| 2029 | movzwl 26(r6),r2 | ||
| 2030 | bicl3 #-65536,8(r7),r3 | ||
| 2031 | movzwl 10(r7),r0 | ||
| 2032 | bicl2 #-65536,r0 | ||
| 2033 | bicl3 #-65536,24(r6),-604(fp) | ||
| 2034 | bicl3 #-65536,r2,-608(fp) | ||
| 2035 | mull3 r0,-604(fp),-596(fp) | ||
| 2036 | mull2 r3,-604(fp) | ||
| 2037 | mull3 r3,-608(fp),-600(fp) | ||
| 2038 | mull2 r0,-608(fp) | ||
| 2039 | addl3 -596(fp),-600(fp),r0 | ||
| 2040 | bicl3 #0,r0,-596(fp) | ||
| 2041 | cmpl -596(fp),-600(fp) | ||
| 2042 | bgequ noname.193 | ||
| 2043 | addl2 #65536,-608(fp) | ||
| 2044 | noname.193: | ||
| 2045 | movzwl -594(fp),r0 | ||
| 2046 | bicl2 #-65536,r0 | ||
| 2047 | addl2 r0,-608(fp) | ||
| 2048 | bicl3 #-65536,-596(fp),r0 | ||
| 2049 | ashl #16,r0,-600(fp) | ||
| 2050 | addl3 -600(fp),-604(fp),r0 | ||
| 2051 | bicl3 #0,r0,-604(fp) | ||
| 2052 | cmpl -604(fp),-600(fp) | ||
| 2053 | bgequ noname.194 | ||
| 2054 | incl -608(fp) | ||
| 2055 | noname.194: | ||
| 2056 | movl -604(fp),r1 | ||
| 2057 | movl -608(fp),r2 | ||
| 2058 | addl2 r1,r10 | ||
| 2059 | bicl2 #0,r10 | ||
| 2060 | cmpl r10,r1 | ||
| 2061 | bgequ noname.195 | ||
| 2062 | incl r2 | ||
| 2063 | noname.195: | ||
| 2064 | addl2 r2,r9 | ||
| 2065 | bicl2 #0,r9 | ||
| 2066 | cmpl r9,r2 | ||
| 2067 | bgequ noname.196 | ||
| 2068 | incl r8 | ||
| 2069 | noname.196: | ||
| 2070 | |||
| 2071 | movzwl 22(r6),r2 | ||
| 2072 | bicl3 #-65536,12(r7),r3 | ||
| 2073 | movzwl 14(r7),r0 | ||
| 2074 | bicl2 #-65536,r0 | ||
| 2075 | bicl3 #-65536,20(r6),-620(fp) | ||
| 2076 | bicl3 #-65536,r2,-624(fp) | ||
| 2077 | mull3 r0,-620(fp),-612(fp) | ||
| 2078 | mull2 r3,-620(fp) | ||
| 2079 | mull3 r3,-624(fp),-616(fp) | ||
| 2080 | mull2 r0,-624(fp) | ||
| 2081 | addl3 -612(fp),-616(fp),r0 | ||
| 2082 | bicl3 #0,r0,-612(fp) | ||
| 2083 | cmpl -612(fp),-616(fp) | ||
| 2084 | bgequ noname.197 | ||
| 2085 | addl2 #65536,-624(fp) | ||
| 2086 | noname.197: | ||
| 2087 | movzwl -610(fp),r0 | ||
| 2088 | bicl2 #-65536,r0 | ||
| 2089 | addl2 r0,-624(fp) | ||
| 2090 | bicl3 #-65536,-612(fp),r0 | ||
| 2091 | ashl #16,r0,-616(fp) | ||
| 2092 | addl3 -616(fp),-620(fp),r0 | ||
| 2093 | bicl3 #0,r0,-620(fp) | ||
| 2094 | cmpl -620(fp),-616(fp) | ||
| 2095 | bgequ noname.198 | ||
| 2096 | incl -624(fp) | ||
| 2097 | noname.198: | ||
| 2098 | movl -620(fp),r1 | ||
| 2099 | movl -624(fp),r2 | ||
| 2100 | addl2 r1,r10 | ||
| 2101 | bicl2 #0,r10 | ||
| 2102 | cmpl r10,r1 | ||
| 2103 | bgequ noname.199 | ||
| 2104 | incl r2 | ||
| 2105 | noname.199: | ||
| 2106 | addl2 r2,r9 | ||
| 2107 | bicl2 #0,r9 | ||
| 2108 | cmpl r9,r2 | ||
| 2109 | bgequ noname.200 | ||
| 2110 | incl r8 | ||
| 2111 | noname.200: | ||
| 2112 | |||
| 2113 | movzwl 18(r6),r2 | ||
| 2114 | bicl3 #-65536,16(r7),r3 | ||
| 2115 | movzwl 18(r7),r0 | ||
| 2116 | bicl2 #-65536,r0 | ||
| 2117 | bicl3 #-65536,16(r6),-636(fp) | ||
| 2118 | bicl3 #-65536,r2,-640(fp) | ||
| 2119 | mull3 r0,-636(fp),-628(fp) | ||
| 2120 | mull2 r3,-636(fp) | ||
| 2121 | mull3 r3,-640(fp),-632(fp) | ||
| 2122 | mull2 r0,-640(fp) | ||
| 2123 | addl3 -628(fp),-632(fp),r0 | ||
| 2124 | bicl3 #0,r0,-628(fp) | ||
| 2125 | cmpl -628(fp),-632(fp) | ||
| 2126 | bgequ noname.201 | ||
| 2127 | addl2 #65536,-640(fp) | ||
| 2128 | noname.201: | ||
| 2129 | movzwl -626(fp),r0 | ||
| 2130 | bicl2 #-65536,r0 | ||
| 2131 | addl2 r0,-640(fp) | ||
| 2132 | bicl3 #-65536,-628(fp),r0 | ||
| 2133 | ashl #16,r0,-632(fp) | ||
| 2134 | addl3 -632(fp),-636(fp),r0 | ||
| 2135 | bicl3 #0,r0,-636(fp) | ||
| 2136 | cmpl -636(fp),-632(fp) | ||
| 2137 | bgequ noname.202 | ||
| 2138 | incl -640(fp) | ||
| 2139 | noname.202: | ||
| 2140 | movl -636(fp),r1 | ||
| 2141 | movl -640(fp),r2 | ||
| 2142 | addl2 r1,r10 | ||
| 2143 | bicl2 #0,r10 | ||
| 2144 | cmpl r10,r1 | ||
| 2145 | bgequ noname.203 | ||
| 2146 | incl r2 | ||
| 2147 | noname.203: | ||
| 2148 | addl2 r2,r9 | ||
| 2149 | bicl2 #0,r9 | ||
| 2150 | cmpl r9,r2 | ||
| 2151 | bgequ noname.204 | ||
| 2152 | incl r8 | ||
| 2153 | noname.204: | ||
| 2154 | |||
| 2155 | movzwl 14(r6),r2 | ||
| 2156 | bicl3 #-65536,20(r7),r3 | ||
| 2157 | movzwl 22(r7),r0 | ||
| 2158 | bicl2 #-65536,r0 | ||
| 2159 | bicl3 #-65536,12(r6),-652(fp) | ||
| 2160 | bicl3 #-65536,r2,-656(fp) | ||
| 2161 | mull3 r0,-652(fp),-644(fp) | ||
| 2162 | mull2 r3,-652(fp) | ||
| 2163 | mull3 r3,-656(fp),-648(fp) | ||
| 2164 | mull2 r0,-656(fp) | ||
| 2165 | addl3 -644(fp),-648(fp),r0 | ||
| 2166 | bicl3 #0,r0,-644(fp) | ||
| 2167 | cmpl -644(fp),-648(fp) | ||
| 2168 | bgequ noname.205 | ||
| 2169 | addl2 #65536,-656(fp) | ||
| 2170 | noname.205: | ||
| 2171 | movzwl -642(fp),r0 | ||
| 2172 | bicl2 #-65536,r0 | ||
| 2173 | addl2 r0,-656(fp) | ||
| 2174 | bicl3 #-65536,-644(fp),r0 | ||
| 2175 | ashl #16,r0,-648(fp) | ||
| 2176 | addl3 -648(fp),-652(fp),r0 | ||
| 2177 | bicl3 #0,r0,-652(fp) | ||
| 2178 | cmpl -652(fp),-648(fp) | ||
| 2179 | bgequ noname.206 | ||
| 2180 | incl -656(fp) | ||
| 2181 | noname.206: | ||
| 2182 | movl -652(fp),r1 | ||
| 2183 | movl -656(fp),r2 | ||
| 2184 | addl2 r1,r10 | ||
| 2185 | bicl2 #0,r10 | ||
| 2186 | cmpl r10,r1 | ||
| 2187 | bgequ noname.207 | ||
| 2188 | incl r2 | ||
| 2189 | noname.207: | ||
| 2190 | addl2 r2,r9 | ||
| 2191 | bicl2 #0,r9 | ||
| 2192 | cmpl r9,r2 | ||
| 2193 | bgequ noname.208 | ||
| 2194 | incl r8 | ||
| 2195 | noname.208: | ||
| 2196 | |||
| 2197 | movzwl 10(r6),r2 | ||
| 2198 | bicl3 #-65536,24(r7),r3 | ||
| 2199 | movzwl 26(r7),r0 | ||
| 2200 | bicl2 #-65536,r0 | ||
| 2201 | bicl3 #-65536,8(r6),-668(fp) | ||
| 2202 | bicl3 #-65536,r2,-672(fp) | ||
| 2203 | mull3 r0,-668(fp),-660(fp) | ||
| 2204 | mull2 r3,-668(fp) | ||
| 2205 | mull3 r3,-672(fp),-664(fp) | ||
| 2206 | mull2 r0,-672(fp) | ||
| 2207 | addl3 -660(fp),-664(fp),r0 | ||
| 2208 | bicl3 #0,r0,-660(fp) | ||
| 2209 | cmpl -660(fp),-664(fp) | ||
| 2210 | bgequ noname.209 | ||
| 2211 | addl2 #65536,-672(fp) | ||
| 2212 | noname.209: | ||
| 2213 | movzwl -658(fp),r0 | ||
| 2214 | bicl2 #-65536,r0 | ||
| 2215 | addl2 r0,-672(fp) | ||
| 2216 | bicl3 #-65536,-660(fp),r0 | ||
| 2217 | ashl #16,r0,-664(fp) | ||
| 2218 | addl3 -664(fp),-668(fp),r0 | ||
| 2219 | bicl3 #0,r0,-668(fp) | ||
| 2220 | cmpl -668(fp),-664(fp) | ||
| 2221 | bgequ noname.210 | ||
| 2222 | incl -672(fp) | ||
| 2223 | noname.210: | ||
| 2224 | movl -668(fp),r1 | ||
| 2225 | movl -672(fp),r2 | ||
| 2226 | addl2 r1,r10 | ||
| 2227 | bicl2 #0,r10 | ||
| 2228 | cmpl r10,r1 | ||
| 2229 | bgequ noname.211 | ||
| 2230 | incl r2 | ||
| 2231 | noname.211: | ||
| 2232 | addl2 r2,r9 | ||
| 2233 | bicl2 #0,r9 | ||
| 2234 | cmpl r9,r2 | ||
| 2235 | bgequ noname.212 | ||
| 2236 | incl r8 | ||
| 2237 | noname.212: | ||
| 2238 | |||
| 2239 | movzwl 6(r6),r2 | ||
| 2240 | bicl3 #-65536,28(r7),r3 | ||
| 2241 | movzwl 30(r7),r0 | ||
| 2242 | bicl2 #-65536,r0 | ||
| 2243 | bicl3 #-65536,4(r6),-684(fp) | ||
| 2244 | bicl3 #-65536,r2,-688(fp) | ||
| 2245 | mull3 r0,-684(fp),-676(fp) | ||
| 2246 | mull2 r3,-684(fp) | ||
| 2247 | mull3 r3,-688(fp),-680(fp) | ||
| 2248 | mull2 r0,-688(fp) | ||
| 2249 | addl3 -676(fp),-680(fp),r0 | ||
| 2250 | bicl3 #0,r0,-676(fp) | ||
| 2251 | cmpl -676(fp),-680(fp) | ||
| 2252 | bgequ noname.213 | ||
| 2253 | addl2 #65536,-688(fp) | ||
| 2254 | noname.213: | ||
| 2255 | movzwl -674(fp),r0 | ||
| 2256 | bicl2 #-65536,r0 | ||
| 2257 | addl2 r0,-688(fp) | ||
| 2258 | bicl3 #-65536,-676(fp),r0 | ||
| 2259 | ashl #16,r0,-680(fp) | ||
| 2260 | addl3 -680(fp),-684(fp),r0 | ||
| 2261 | bicl3 #0,r0,-684(fp) | ||
| 2262 | cmpl -684(fp),-680(fp) | ||
| 2263 | bgequ noname.214 | ||
| 2264 | incl -688(fp) | ||
| 2265 | noname.214: | ||
| 2266 | movl -684(fp),r1 | ||
| 2267 | movl -688(fp),r2 | ||
| 2268 | addl2 r1,r10 | ||
| 2269 | bicl2 #0,r10 | ||
| 2270 | cmpl r10,r1 | ||
| 2271 | bgequ noname.215 | ||
| 2272 | incl r2 | ||
| 2273 | noname.215: | ||
| 2274 | addl2 r2,r9 | ||
| 2275 | bicl2 #0,r9 | ||
| 2276 | cmpl r9,r2 | ||
| 2277 | bgequ noname.216 | ||
| 2278 | incl r8 | ||
| 2279 | noname.216: | ||
| 2280 | |||
| 2281 | movl r10,32(r11) | ||
| 2282 | |||
| 2283 | clrl r10 | ||
| 2284 | |||
| 2285 | movzwl 10(r6),r2 | ||
| 2286 | bicl3 #-65536,28(r7),r3 | ||
| 2287 | movzwl 30(r7),r0 | ||
| 2288 | bicl2 #-65536,r0 | ||
| 2289 | bicl3 #-65536,8(r6),-700(fp) | ||
| 2290 | bicl3 #-65536,r2,-704(fp) | ||
| 2291 | mull3 r0,-700(fp),-692(fp) | ||
| 2292 | mull2 r3,-700(fp) | ||
| 2293 | mull3 r3,-704(fp),-696(fp) | ||
| 2294 | mull2 r0,-704(fp) | ||
| 2295 | addl3 -692(fp),-696(fp),r0 | ||
| 2296 | bicl3 #0,r0,-692(fp) | ||
| 2297 | cmpl -692(fp),-696(fp) | ||
| 2298 | bgequ noname.217 | ||
| 2299 | addl2 #65536,-704(fp) | ||
| 2300 | noname.217: | ||
| 2301 | movzwl -690(fp),r0 | ||
| 2302 | bicl2 #-65536,r0 | ||
| 2303 | addl2 r0,-704(fp) | ||
| 2304 | bicl3 #-65536,-692(fp),r0 | ||
| 2305 | ashl #16,r0,-696(fp) | ||
| 2306 | addl3 -696(fp),-700(fp),r0 | ||
| 2307 | bicl3 #0,r0,-700(fp) | ||
| 2308 | cmpl -700(fp),-696(fp) | ||
| 2309 | bgequ noname.218 | ||
| 2310 | incl -704(fp) | ||
| 2311 | noname.218: | ||
| 2312 | movl -700(fp),r1 | ||
| 2313 | movl -704(fp),r2 | ||
| 2314 | addl2 r1,r9 | ||
| 2315 | bicl2 #0,r9 | ||
| 2316 | cmpl r9,r1 | ||
| 2317 | bgequ noname.219 | ||
| 2318 | incl r2 | ||
| 2319 | noname.219: | ||
| 2320 | addl2 r2,r8 | ||
| 2321 | bicl2 #0,r8 | ||
| 2322 | cmpl r8,r2 | ||
| 2323 | bgequ noname.220 | ||
| 2324 | incl r10 | ||
| 2325 | noname.220: | ||
| 2326 | |||
| 2327 | movzwl 14(r6),r2 | ||
| 2328 | bicl3 #-65536,24(r7),r3 | ||
| 2329 | movzwl 26(r7),r0 | ||
| 2330 | bicl2 #-65536,r0 | ||
| 2331 | bicl3 #-65536,12(r6),-716(fp) | ||
| 2332 | bicl3 #-65536,r2,-720(fp) | ||
| 2333 | mull3 r0,-716(fp),-708(fp) | ||
| 2334 | mull2 r3,-716(fp) | ||
| 2335 | mull3 r3,-720(fp),-712(fp) | ||
| 2336 | mull2 r0,-720(fp) | ||
| 2337 | addl3 -708(fp),-712(fp),r0 | ||
| 2338 | bicl3 #0,r0,-708(fp) | ||
| 2339 | cmpl -708(fp),-712(fp) | ||
| 2340 | bgequ noname.221 | ||
| 2341 | addl2 #65536,-720(fp) | ||
| 2342 | noname.221: | ||
| 2343 | movzwl -706(fp),r0 | ||
| 2344 | bicl2 #-65536,r0 | ||
| 2345 | addl2 r0,-720(fp) | ||
| 2346 | bicl3 #-65536,-708(fp),r0 | ||
| 2347 | ashl #16,r0,-712(fp) | ||
| 2348 | addl3 -712(fp),-716(fp),r0 | ||
| 2349 | bicl3 #0,r0,-716(fp) | ||
| 2350 | cmpl -716(fp),-712(fp) | ||
| 2351 | bgequ noname.222 | ||
| 2352 | incl -720(fp) | ||
| 2353 | noname.222: | ||
| 2354 | movl -716(fp),r1 | ||
| 2355 | movl -720(fp),r2 | ||
| 2356 | addl2 r1,r9 | ||
| 2357 | bicl2 #0,r9 | ||
| 2358 | cmpl r9,r1 | ||
| 2359 | bgequ noname.223 | ||
| 2360 | incl r2 | ||
| 2361 | noname.223: | ||
| 2362 | addl2 r2,r8 | ||
| 2363 | bicl2 #0,r8 | ||
| 2364 | cmpl r8,r2 | ||
| 2365 | bgequ noname.224 | ||
| 2366 | incl r10 | ||
| 2367 | noname.224: | ||
| 2368 | |||
| 2369 | movzwl 18(r6),r2 | ||
| 2370 | bicl3 #-65536,20(r7),r3 | ||
| 2371 | movzwl 22(r7),r0 | ||
| 2372 | bicl2 #-65536,r0 | ||
| 2373 | bicl3 #-65536,16(r6),-732(fp) | ||
| 2374 | bicl3 #-65536,r2,-736(fp) | ||
| 2375 | mull3 r0,-732(fp),-724(fp) | ||
| 2376 | mull2 r3,-732(fp) | ||
| 2377 | mull3 r3,-736(fp),-728(fp) | ||
| 2378 | mull2 r0,-736(fp) | ||
| 2379 | addl3 -724(fp),-728(fp),r0 | ||
| 2380 | bicl3 #0,r0,-724(fp) | ||
| 2381 | cmpl -724(fp),-728(fp) | ||
| 2382 | bgequ noname.225 | ||
| 2383 | addl2 #65536,-736(fp) | ||
| 2384 | noname.225: | ||
| 2385 | movzwl -722(fp),r0 | ||
| 2386 | bicl2 #-65536,r0 | ||
| 2387 | addl2 r0,-736(fp) | ||
| 2388 | bicl3 #-65536,-724(fp),r0 | ||
| 2389 | ashl #16,r0,-728(fp) | ||
| 2390 | addl3 -728(fp),-732(fp),r0 | ||
| 2391 | bicl3 #0,r0,-732(fp) | ||
| 2392 | cmpl -732(fp),-728(fp) | ||
| 2393 | bgequ noname.226 | ||
| 2394 | incl -736(fp) | ||
| 2395 | noname.226: | ||
| 2396 | movl -732(fp),r1 | ||
| 2397 | movl -736(fp),r2 | ||
| 2398 | addl2 r1,r9 | ||
| 2399 | bicl2 #0,r9 | ||
| 2400 | cmpl r9,r1 | ||
| 2401 | bgequ noname.227 | ||
| 2402 | incl r2 | ||
| 2403 | noname.227: | ||
| 2404 | addl2 r2,r8 | ||
| 2405 | bicl2 #0,r8 | ||
| 2406 | cmpl r8,r2 | ||
| 2407 | bgequ noname.228 | ||
| 2408 | incl r10 | ||
| 2409 | noname.228: | ||
| 2410 | |||
| 2411 | movzwl 22(r6),r2 | ||
| 2412 | bicl3 #-65536,16(r7),r3 | ||
| 2413 | movzwl 18(r7),r0 | ||
| 2414 | bicl2 #-65536,r0 | ||
| 2415 | bicl3 #-65536,20(r6),-748(fp) | ||
| 2416 | bicl3 #-65536,r2,-752(fp) | ||
| 2417 | mull3 r0,-748(fp),-740(fp) | ||
| 2418 | mull2 r3,-748(fp) | ||
| 2419 | mull3 r3,-752(fp),-744(fp) | ||
| 2420 | mull2 r0,-752(fp) | ||
| 2421 | addl3 -740(fp),-744(fp),r0 | ||
| 2422 | bicl3 #0,r0,-740(fp) | ||
| 2423 | cmpl -740(fp),-744(fp) | ||
| 2424 | bgequ noname.229 | ||
| 2425 | addl2 #65536,-752(fp) | ||
| 2426 | noname.229: | ||
| 2427 | movzwl -738(fp),r0 | ||
| 2428 | bicl2 #-65536,r0 | ||
| 2429 | addl2 r0,-752(fp) | ||
| 2430 | bicl3 #-65536,-740(fp),r0 | ||
| 2431 | ashl #16,r0,-744(fp) | ||
| 2432 | addl3 -744(fp),-748(fp),r0 | ||
| 2433 | bicl3 #0,r0,-748(fp) | ||
| 2434 | cmpl -748(fp),-744(fp) | ||
| 2435 | bgequ noname.230 | ||
| 2436 | incl -752(fp) | ||
| 2437 | noname.230: | ||
| 2438 | movl -748(fp),r1 | ||
| 2439 | movl -752(fp),r2 | ||
| 2440 | addl2 r1,r9 | ||
| 2441 | bicl2 #0,r9 | ||
| 2442 | cmpl r9,r1 | ||
| 2443 | bgequ noname.231 | ||
| 2444 | incl r2 | ||
| 2445 | noname.231: | ||
| 2446 | addl2 r2,r8 | ||
| 2447 | bicl2 #0,r8 | ||
| 2448 | cmpl r8,r2 | ||
| 2449 | bgequ noname.232 | ||
| 2450 | incl r10 | ||
| 2451 | noname.232: | ||
| 2452 | |||
| 2453 | movzwl 26(r6),r2 | ||
| 2454 | bicl3 #-65536,12(r7),r3 | ||
| 2455 | movzwl 14(r7),r0 | ||
| 2456 | bicl2 #-65536,r0 | ||
| 2457 | bicl3 #-65536,24(r6),-764(fp) | ||
| 2458 | bicl3 #-65536,r2,-768(fp) | ||
| 2459 | mull3 r0,-764(fp),-756(fp) | ||
| 2460 | mull2 r3,-764(fp) | ||
| 2461 | mull3 r3,-768(fp),-760(fp) | ||
| 2462 | mull2 r0,-768(fp) | ||
| 2463 | addl3 -756(fp),-760(fp),r0 | ||
| 2464 | bicl3 #0,r0,-756(fp) | ||
| 2465 | cmpl -756(fp),-760(fp) | ||
| 2466 | bgequ noname.233 | ||
| 2467 | addl2 #65536,-768(fp) | ||
| 2468 | noname.233: | ||
| 2469 | movzwl -754(fp),r0 | ||
| 2470 | bicl2 #-65536,r0 | ||
| 2471 | addl2 r0,-768(fp) | ||
| 2472 | bicl3 #-65536,-756(fp),r0 | ||
| 2473 | ashl #16,r0,-760(fp) | ||
| 2474 | addl3 -760(fp),-764(fp),r0 | ||
| 2475 | bicl3 #0,r0,-764(fp) | ||
| 2476 | cmpl -764(fp),-760(fp) | ||
| 2477 | bgequ noname.234 | ||
| 2478 | incl -768(fp) | ||
| 2479 | noname.234: | ||
| 2480 | movl -764(fp),r1 | ||
| 2481 | movl -768(fp),r2 | ||
| 2482 | addl2 r1,r9 | ||
| 2483 | bicl2 #0,r9 | ||
| 2484 | cmpl r9,r1 | ||
| 2485 | bgequ noname.235 | ||
| 2486 | incl r2 | ||
| 2487 | noname.235: | ||
| 2488 | addl2 r2,r8 | ||
| 2489 | bicl2 #0,r8 | ||
| 2490 | cmpl r8,r2 | ||
| 2491 | bgequ noname.236 | ||
| 2492 | incl r10 | ||
| 2493 | noname.236: | ||
| 2494 | |||
| 2495 | bicl3 #-65536,28(r6),r3 | ||
| 2496 | movzwl 30(r6),r1 | ||
| 2497 | bicl2 #-65536,r1 | ||
| 2498 | bicl3 #-65536,8(r7),r2 | ||
| 2499 | movzwl 10(r7),r0 | ||
| 2500 | bicl2 #-65536,r0 | ||
| 2501 | movl r3,r5 | ||
| 2502 | movl r1,r4 | ||
| 2503 | mull3 r0,r5,-772(fp) | ||
| 2504 | mull2 r2,r5 | ||
| 2505 | mull3 r2,r4,-776(fp) | ||
| 2506 | mull2 r0,r4 | ||
| 2507 | addl3 -772(fp),-776(fp),r0 | ||
| 2508 | bicl3 #0,r0,-772(fp) | ||
| 2509 | cmpl -772(fp),-776(fp) | ||
| 2510 | bgequ noname.237 | ||
| 2511 | addl2 #65536,r4 | ||
| 2512 | noname.237: | ||
| 2513 | movzwl -770(fp),r0 | ||
| 2514 | bicl2 #-65536,r0 | ||
| 2515 | addl2 r0,r4 | ||
| 2516 | bicl3 #-65536,-772(fp),r0 | ||
| 2517 | ashl #16,r0,-776(fp) | ||
| 2518 | addl2 -776(fp),r5 | ||
| 2519 | bicl2 #0,r5 | ||
| 2520 | cmpl r5,-776(fp) | ||
| 2521 | bgequ noname.238 | ||
| 2522 | incl r4 | ||
| 2523 | noname.238: | ||
| 2524 | movl r5,r1 | ||
| 2525 | movl r4,r2 | ||
| 2526 | addl2 r1,r9 | ||
| 2527 | bicl2 #0,r9 | ||
| 2528 | cmpl r9,r1 | ||
| 2529 | bgequ noname.239 | ||
| 2530 | incl r2 | ||
| 2531 | noname.239: | ||
| 2532 | addl2 r2,r8 | ||
| 2533 | bicl2 #0,r8 | ||
| 2534 | cmpl r8,r2 | ||
| 2535 | bgequ noname.240 | ||
| 2536 | incl r10 | ||
| 2537 | noname.240: | ||
| 2538 | |||
| 2539 | movl r9,36(r11) | ||
| 2540 | |||
| 2541 | clrl r9 | ||
| 2542 | |||
| 2543 | bicl3 #-65536,28(r6),r3 | ||
| 2544 | movzwl 30(r6),r1 | ||
| 2545 | bicl2 #-65536,r1 | ||
| 2546 | bicl3 #-65536,12(r7),r2 | ||
| 2547 | movzwl 14(r7),r0 | ||
| 2548 | bicl2 #-65536,r0 | ||
| 2549 | movl r3,r5 | ||
| 2550 | movl r1,r4 | ||
| 2551 | mull3 r0,r5,-780(fp) | ||
| 2552 | mull2 r2,r5 | ||
| 2553 | mull3 r2,r4,-784(fp) | ||
| 2554 | mull2 r0,r4 | ||
| 2555 | addl3 -780(fp),-784(fp),r0 | ||
| 2556 | bicl3 #0,r0,-780(fp) | ||
| 2557 | cmpl -780(fp),-784(fp) | ||
| 2558 | bgequ noname.241 | ||
| 2559 | addl2 #65536,r4 | ||
| 2560 | noname.241: | ||
| 2561 | movzwl -778(fp),r0 | ||
| 2562 | bicl2 #-65536,r0 | ||
| 2563 | addl2 r0,r4 | ||
| 2564 | bicl3 #-65536,-780(fp),r0 | ||
| 2565 | ashl #16,r0,-784(fp) | ||
| 2566 | addl2 -784(fp),r5 | ||
| 2567 | bicl2 #0,r5 | ||
| 2568 | cmpl r5,-784(fp) | ||
| 2569 | bgequ noname.242 | ||
| 2570 | incl r4 | ||
| 2571 | noname.242: | ||
| 2572 | movl r5,r1 | ||
| 2573 | movl r4,r2 | ||
| 2574 | addl2 r1,r8 | ||
| 2575 | bicl2 #0,r8 | ||
| 2576 | cmpl r8,r1 | ||
| 2577 | bgequ noname.243 | ||
| 2578 | incl r2 | ||
| 2579 | noname.243: | ||
| 2580 | addl2 r2,r10 | ||
| 2581 | bicl2 #0,r10 | ||
| 2582 | cmpl r10,r2 | ||
| 2583 | bgequ noname.244 | ||
| 2584 | incl r9 | ||
| 2585 | noname.244: | ||
| 2586 | |||
| 2587 | bicl3 #-65536,24(r6),r3 | ||
| 2588 | movzwl 26(r6),r1 | ||
| 2589 | bicl2 #-65536,r1 | ||
| 2590 | bicl3 #-65536,16(r7),r2 | ||
| 2591 | movzwl 18(r7),r0 | ||
| 2592 | bicl2 #-65536,r0 | ||
| 2593 | movl r3,r5 | ||
| 2594 | movl r1,r4 | ||
| 2595 | mull3 r0,r5,-788(fp) | ||
| 2596 | mull2 r2,r5 | ||
| 2597 | mull3 r2,r4,-792(fp) | ||
| 2598 | mull2 r0,r4 | ||
| 2599 | addl3 -788(fp),-792(fp),r0 | ||
| 2600 | bicl3 #0,r0,-788(fp) | ||
| 2601 | cmpl -788(fp),-792(fp) | ||
| 2602 | bgequ noname.245 | ||
| 2603 | addl2 #65536,r4 | ||
| 2604 | noname.245: | ||
| 2605 | movzwl -786(fp),r0 | ||
| 2606 | bicl2 #-65536,r0 | ||
| 2607 | addl2 r0,r4 | ||
| 2608 | bicl3 #-65536,-788(fp),r0 | ||
| 2609 | ashl #16,r0,-792(fp) | ||
| 2610 | addl2 -792(fp),r5 | ||
| 2611 | bicl2 #0,r5 | ||
| 2612 | cmpl r5,-792(fp) | ||
| 2613 | bgequ noname.246 | ||
| 2614 | incl r4 | ||
| 2615 | noname.246: | ||
| 2616 | movl r5,r1 | ||
| 2617 | movl r4,r2 | ||
| 2618 | addl2 r1,r8 | ||
| 2619 | bicl2 #0,r8 | ||
| 2620 | cmpl r8,r1 | ||
| 2621 | bgequ noname.247 | ||
| 2622 | incl r2 | ||
| 2623 | noname.247: | ||
| 2624 | addl2 r2,r10 | ||
| 2625 | bicl2 #0,r10 | ||
| 2626 | cmpl r10,r2 | ||
| 2627 | bgequ noname.248 | ||
| 2628 | incl r9 | ||
| 2629 | noname.248: | ||
| 2630 | |||
| 2631 | bicl3 #-65536,20(r6),r3 | ||
| 2632 | movzwl 22(r6),r1 | ||
| 2633 | bicl2 #-65536,r1 | ||
| 2634 | bicl3 #-65536,20(r7),r2 | ||
| 2635 | movzwl 22(r7),r0 | ||
| 2636 | bicl2 #-65536,r0 | ||
| 2637 | movl r3,r5 | ||
| 2638 | movl r1,r4 | ||
| 2639 | mull3 r0,r5,-796(fp) | ||
| 2640 | mull2 r2,r5 | ||
| 2641 | mull3 r2,r4,-800(fp) | ||
| 2642 | mull2 r0,r4 | ||
| 2643 | addl3 -796(fp),-800(fp),r0 | ||
| 2644 | bicl3 #0,r0,-796(fp) | ||
| 2645 | cmpl -796(fp),-800(fp) | ||
| 2646 | bgequ noname.249 | ||
| 2647 | addl2 #65536,r4 | ||
| 2648 | noname.249: | ||
| 2649 | movzwl -794(fp),r0 | ||
| 2650 | bicl2 #-65536,r0 | ||
| 2651 | addl2 r0,r4 | ||
| 2652 | bicl3 #-65536,-796(fp),r0 | ||
| 2653 | ashl #16,r0,-800(fp) | ||
| 2654 | addl2 -800(fp),r5 | ||
| 2655 | bicl2 #0,r5 | ||
| 2656 | cmpl r5,-800(fp) | ||
| 2657 | bgequ noname.250 | ||
| 2658 | incl r4 | ||
| 2659 | noname.250: | ||
| 2660 | movl r5,r1 | ||
| 2661 | movl r4,r2 | ||
| 2662 | addl2 r1,r8 | ||
| 2663 | bicl2 #0,r8 | ||
| 2664 | cmpl r8,r1 | ||
| 2665 | bgequ noname.251 | ||
| 2666 | incl r2 | ||
| 2667 | noname.251: | ||
| 2668 | addl2 r2,r10 | ||
| 2669 | bicl2 #0,r10 | ||
| 2670 | cmpl r10,r2 | ||
| 2671 | bgequ noname.252 | ||
| 2672 | incl r9 | ||
| 2673 | noname.252: | ||
| 2674 | |||
| 2675 | bicl3 #-65536,16(r6),r3 | ||
| 2676 | movzwl 18(r6),r1 | ||
| 2677 | bicl2 #-65536,r1 | ||
| 2678 | bicl3 #-65536,24(r7),r2 | ||
| 2679 | movzwl 26(r7),r0 | ||
| 2680 | bicl2 #-65536,r0 | ||
| 2681 | movl r3,r5 | ||
| 2682 | movl r1,r4 | ||
| 2683 | mull3 r0,r5,-804(fp) | ||
| 2684 | mull2 r2,r5 | ||
| 2685 | mull3 r2,r4,-808(fp) | ||
| 2686 | mull2 r0,r4 | ||
| 2687 | addl3 -804(fp),-808(fp),r0 | ||
| 2688 | bicl3 #0,r0,-804(fp) | ||
| 2689 | cmpl -804(fp),-808(fp) | ||
| 2690 | bgequ noname.253 | ||
| 2691 | addl2 #65536,r4 | ||
| 2692 | noname.253: | ||
| 2693 | movzwl -802(fp),r0 | ||
| 2694 | bicl2 #-65536,r0 | ||
| 2695 | addl2 r0,r4 | ||
| 2696 | bicl3 #-65536,-804(fp),r0 | ||
| 2697 | ashl #16,r0,-808(fp) | ||
| 2698 | addl2 -808(fp),r5 | ||
| 2699 | bicl2 #0,r5 | ||
| 2700 | cmpl r5,-808(fp) | ||
| 2701 | bgequ noname.254 | ||
| 2702 | incl r4 | ||
| 2703 | noname.254: | ||
| 2704 | movl r5,r1 | ||
| 2705 | movl r4,r2 | ||
| 2706 | addl2 r1,r8 | ||
| 2707 | bicl2 #0,r8 | ||
| 2708 | cmpl r8,r1 | ||
| 2709 | bgequ noname.255 | ||
| 2710 | incl r2 | ||
| 2711 | noname.255: | ||
| 2712 | addl2 r2,r10 | ||
| 2713 | bicl2 #0,r10 | ||
| 2714 | cmpl r10,r2 | ||
| 2715 | bgequ noname.256 | ||
| 2716 | incl r9 | ||
| 2717 | noname.256: | ||
| 2718 | |||
| 2719 | bicl3 #-65536,12(r6),r3 | ||
| 2720 | movzwl 14(r6),r1 | ||
| 2721 | bicl2 #-65536,r1 | ||
| 2722 | bicl3 #-65536,28(r7),r2 | ||
| 2723 | movzwl 30(r7),r0 | ||
| 2724 | bicl2 #-65536,r0 | ||
| 2725 | movl r3,r5 | ||
| 2726 | movl r1,r4 | ||
| 2727 | mull3 r0,r5,-812(fp) | ||
| 2728 | mull2 r2,r5 | ||
| 2729 | mull3 r2,r4,-816(fp) | ||
| 2730 | mull2 r0,r4 | ||
| 2731 | addl3 -812(fp),-816(fp),r0 | ||
| 2732 | bicl3 #0,r0,-812(fp) | ||
| 2733 | cmpl -812(fp),-816(fp) | ||
| 2734 | bgequ noname.257 | ||
| 2735 | addl2 #65536,r4 | ||
| 2736 | noname.257: | ||
| 2737 | movzwl -810(fp),r0 | ||
| 2738 | bicl2 #-65536,r0 | ||
| 2739 | addl2 r0,r4 | ||
| 2740 | bicl3 #-65536,-812(fp),r0 | ||
| 2741 | ashl #16,r0,-816(fp) | ||
| 2742 | addl2 -816(fp),r5 | ||
| 2743 | bicl2 #0,r5 | ||
| 2744 | cmpl r5,-816(fp) | ||
| 2745 | bgequ noname.258 | ||
| 2746 | incl r4 | ||
| 2747 | noname.258: | ||
| 2748 | movl r5,r1 | ||
| 2749 | movl r4,r2 | ||
| 2750 | addl2 r1,r8 | ||
| 2751 | bicl2 #0,r8 | ||
| 2752 | cmpl r8,r1 | ||
| 2753 | bgequ noname.259 | ||
| 2754 | incl r2 | ||
| 2755 | noname.259: | ||
| 2756 | addl2 r2,r10 | ||
| 2757 | bicl2 #0,r10 | ||
| 2758 | cmpl r10,r2 | ||
| 2759 | bgequ noname.260 | ||
| 2760 | incl r9 | ||
| 2761 | noname.260: | ||
| 2762 | |||
| 2763 | movl r8,40(r11) | ||
| 2764 | |||
| 2765 | clrl r8 | ||
| 2766 | |||
| 2767 | bicl3 #-65536,16(r6),r3 | ||
| 2768 | movzwl 18(r6),r2 | ||
| 2769 | bicl3 #-65536,28(r7),r1 | ||
| 2770 | movzwl 30(r7),r0 | ||
| 2771 | bicl2 #-65536,r0 | ||
| 2772 | movl r3,r4 | ||
| 2773 | bicl3 #-65536,r2,-828(fp) | ||
| 2774 | mull3 r0,r4,-820(fp) | ||
| 2775 | mull2 r1,r4 | ||
| 2776 | mull3 r1,-828(fp),-824(fp) | ||
| 2777 | mull2 r0,-828(fp) | ||
| 2778 | addl3 -820(fp),-824(fp),r0 | ||
| 2779 | bicl3 #0,r0,-820(fp) | ||
| 2780 | cmpl -820(fp),-824(fp) | ||
| 2781 | bgequ noname.261 | ||
| 2782 | addl2 #65536,-828(fp) | ||
| 2783 | noname.261: | ||
| 2784 | movzwl -818(fp),r0 | ||
| 2785 | bicl2 #-65536,r0 | ||
| 2786 | addl2 r0,-828(fp) | ||
| 2787 | bicl3 #-65536,-820(fp),r0 | ||
| 2788 | ashl #16,r0,-824(fp) | ||
| 2789 | addl2 -824(fp),r4 | ||
| 2790 | bicl2 #0,r4 | ||
| 2791 | cmpl r4,-824(fp) | ||
| 2792 | bgequ noname.262 | ||
| 2793 | incl -828(fp) | ||
| 2794 | noname.262: | ||
| 2795 | movl r4,r1 | ||
| 2796 | movl -828(fp),r2 | ||
| 2797 | addl2 r1,r10 | ||
| 2798 | bicl2 #0,r10 | ||
| 2799 | cmpl r10,r1 | ||
| 2800 | bgequ noname.263 | ||
| 2801 | incl r2 | ||
| 2802 | noname.263: | ||
| 2803 | addl2 r2,r9 | ||
| 2804 | bicl2 #0,r9 | ||
| 2805 | cmpl r9,r2 | ||
| 2806 | bgequ noname.264 | ||
| 2807 | incl r8 | ||
| 2808 | noname.264: | ||
| 2809 | |||
| 2810 | movzwl 22(r6),r2 | ||
| 2811 | bicl3 #-65536,24(r7),r3 | ||
| 2812 | movzwl 26(r7),r0 | ||
| 2813 | bicl2 #-65536,r0 | ||
| 2814 | bicl3 #-65536,20(r6),-840(fp) | ||
| 2815 | bicl3 #-65536,r2,-844(fp) | ||
| 2816 | mull3 r0,-840(fp),-832(fp) | ||
| 2817 | mull2 r3,-840(fp) | ||
| 2818 | mull3 r3,-844(fp),-836(fp) | ||
| 2819 | mull2 r0,-844(fp) | ||
| 2820 | addl3 -832(fp),-836(fp),r0 | ||
| 2821 | bicl3 #0,r0,-832(fp) | ||
| 2822 | cmpl -832(fp),-836(fp) | ||
| 2823 | bgequ noname.265 | ||
| 2824 | addl2 #65536,-844(fp) | ||
| 2825 | noname.265: | ||
| 2826 | movzwl -830(fp),r0 | ||
| 2827 | bicl2 #-65536,r0 | ||
| 2828 | addl2 r0,-844(fp) | ||
| 2829 | bicl3 #-65536,-832(fp),r0 | ||
| 2830 | ashl #16,r0,-836(fp) | ||
| 2831 | addl3 -836(fp),-840(fp),r0 | ||
| 2832 | bicl3 #0,r0,-840(fp) | ||
| 2833 | cmpl -840(fp),-836(fp) | ||
| 2834 | bgequ noname.266 | ||
| 2835 | incl -844(fp) | ||
| 2836 | noname.266: | ||
| 2837 | movl -840(fp),r1 | ||
| 2838 | movl -844(fp),r2 | ||
| 2839 | addl2 r1,r10 | ||
| 2840 | bicl2 #0,r10 | ||
| 2841 | cmpl r10,r1 | ||
| 2842 | bgequ noname.267 | ||
| 2843 | incl r2 | ||
| 2844 | noname.267: | ||
| 2845 | addl2 r2,r9 | ||
| 2846 | bicl2 #0,r9 | ||
| 2847 | cmpl r9,r2 | ||
| 2848 | bgequ noname.268 | ||
| 2849 | incl r8 | ||
| 2850 | noname.268: | ||
| 2851 | |||
| 2852 | bicl3 #-65536,24(r6),r3 | ||
| 2853 | movzwl 26(r6),r1 | ||
| 2854 | bicl2 #-65536,r1 | ||
| 2855 | bicl3 #-65536,20(r7),r2 | ||
| 2856 | movzwl 22(r7),r0 | ||
| 2857 | bicl2 #-65536,r0 | ||
| 2858 | movl r3,r5 | ||
| 2859 | movl r1,r4 | ||
| 2860 | mull3 r0,r5,-848(fp) | ||
| 2861 | mull2 r2,r5 | ||
| 2862 | mull3 r2,r4,-852(fp) | ||
| 2863 | mull2 r0,r4 | ||
| 2864 | addl3 -848(fp),-852(fp),r0 | ||
| 2865 | bicl3 #0,r0,-848(fp) | ||
| 2866 | cmpl -848(fp),-852(fp) | ||
| 2867 | bgequ noname.269 | ||
| 2868 | addl2 #65536,r4 | ||
| 2869 | noname.269: | ||
| 2870 | movzwl -846(fp),r0 | ||
| 2871 | bicl2 #-65536,r0 | ||
| 2872 | addl2 r0,r4 | ||
| 2873 | bicl3 #-65536,-848(fp),r0 | ||
| 2874 | ashl #16,r0,-852(fp) | ||
| 2875 | addl2 -852(fp),r5 | ||
| 2876 | bicl2 #0,r5 | ||
| 2877 | cmpl r5,-852(fp) | ||
| 2878 | bgequ noname.270 | ||
| 2879 | incl r4 | ||
| 2880 | noname.270: | ||
| 2881 | movl r5,r1 | ||
| 2882 | movl r4,r2 | ||
| 2883 | addl2 r1,r10 | ||
| 2884 | bicl2 #0,r10 | ||
| 2885 | cmpl r10,r1 | ||
| 2886 | bgequ noname.271 | ||
| 2887 | incl r2 | ||
| 2888 | noname.271: | ||
| 2889 | addl2 r2,r9 | ||
| 2890 | bicl2 #0,r9 | ||
| 2891 | cmpl r9,r2 | ||
| 2892 | bgequ noname.272 | ||
| 2893 | incl r8 | ||
| 2894 | noname.272: | ||
| 2895 | |||
| 2896 | bicl3 #-65536,28(r6),r3 | ||
| 2897 | movzwl 30(r6),r1 | ||
| 2898 | bicl2 #-65536,r1 | ||
| 2899 | bicl3 #-65536,16(r7),r2 | ||
| 2900 | movzwl 18(r7),r0 | ||
| 2901 | bicl2 #-65536,r0 | ||
| 2902 | movl r3,r5 | ||
| 2903 | movl r1,r4 | ||
| 2904 | mull3 r0,r5,-856(fp) | ||
| 2905 | mull2 r2,r5 | ||
| 2906 | mull3 r2,r4,-860(fp) | ||
| 2907 | mull2 r0,r4 | ||
| 2908 | addl3 -856(fp),-860(fp),r0 | ||
| 2909 | bicl3 #0,r0,-856(fp) | ||
| 2910 | cmpl -856(fp),-860(fp) | ||
| 2911 | bgequ noname.273 | ||
| 2912 | addl2 #65536,r4 | ||
| 2913 | noname.273: | ||
| 2914 | movzwl -854(fp),r0 | ||
| 2915 | bicl2 #-65536,r0 | ||
| 2916 | addl2 r0,r4 | ||
| 2917 | bicl3 #-65536,-856(fp),r0 | ||
| 2918 | ashl #16,r0,-860(fp) | ||
| 2919 | addl2 -860(fp),r5 | ||
| 2920 | bicl2 #0,r5 | ||
| 2921 | cmpl r5,-860(fp) | ||
| 2922 | bgequ noname.274 | ||
| 2923 | incl r4 | ||
| 2924 | noname.274: | ||
| 2925 | movl r5,r1 | ||
| 2926 | movl r4,r2 | ||
| 2927 | addl2 r1,r10 | ||
| 2928 | bicl2 #0,r10 | ||
| 2929 | cmpl r10,r1 | ||
| 2930 | bgequ noname.275 | ||
| 2931 | incl r2 | ||
| 2932 | noname.275: | ||
| 2933 | addl2 r2,r9 | ||
| 2934 | bicl2 #0,r9 | ||
| 2935 | cmpl r9,r2 | ||
| 2936 | bgequ noname.276 | ||
| 2937 | incl r8 | ||
| 2938 | noname.276: | ||
| 2939 | |||
| 2940 | movl r10,44(r11) | ||
| 2941 | |||
| 2942 | clrl r10 | ||
| 2943 | |||
| 2944 | bicl3 #-65536,28(r6),r3 | ||
| 2945 | movzwl 30(r6),r1 | ||
| 2946 | bicl2 #-65536,r1 | ||
| 2947 | bicl3 #-65536,20(r7),r2 | ||
| 2948 | movzwl 22(r7),r0 | ||
| 2949 | bicl2 #-65536,r0 | ||
| 2950 | movl r3,r5 | ||
| 2951 | movl r1,r4 | ||
| 2952 | mull3 r0,r5,-864(fp) | ||
| 2953 | mull2 r2,r5 | ||
| 2954 | mull3 r2,r4,-868(fp) | ||
| 2955 | mull2 r0,r4 | ||
| 2956 | addl3 -864(fp),-868(fp),r0 | ||
| 2957 | bicl3 #0,r0,-864(fp) | ||
| 2958 | cmpl -864(fp),-868(fp) | ||
| 2959 | bgequ noname.277 | ||
| 2960 | addl2 #65536,r4 | ||
| 2961 | noname.277: | ||
| 2962 | movzwl -862(fp),r0 | ||
| 2963 | bicl2 #-65536,r0 | ||
| 2964 | addl2 r0,r4 | ||
| 2965 | bicl3 #-65536,-864(fp),r0 | ||
| 2966 | ashl #16,r0,-868(fp) | ||
| 2967 | addl2 -868(fp),r5 | ||
| 2968 | bicl2 #0,r5 | ||
| 2969 | cmpl r5,-868(fp) | ||
| 2970 | bgequ noname.278 | ||
| 2971 | incl r4 | ||
| 2972 | noname.278: | ||
| 2973 | movl r5,r1 | ||
| 2974 | movl r4,r2 | ||
| 2975 | addl2 r1,r9 | ||
| 2976 | bicl2 #0,r9 | ||
| 2977 | cmpl r9,r1 | ||
| 2978 | bgequ noname.279 | ||
| 2979 | incl r2 | ||
| 2980 | noname.279: | ||
| 2981 | addl2 r2,r8 | ||
| 2982 | bicl2 #0,r8 | ||
| 2983 | cmpl r8,r2 | ||
| 2984 | bgequ noname.280 | ||
| 2985 | incl r10 | ||
| 2986 | noname.280: | ||
| 2987 | |||
| 2988 | bicl3 #-65536,24(r6),r3 | ||
| 2989 | movzwl 26(r6),r1 | ||
| 2990 | bicl2 #-65536,r1 | ||
| 2991 | bicl3 #-65536,24(r7),r2 | ||
| 2992 | movzwl 26(r7),r0 | ||
| 2993 | bicl2 #-65536,r0 | ||
| 2994 | movl r3,r5 | ||
| 2995 | movl r1,r4 | ||
| 2996 | mull3 r0,r5,-872(fp) | ||
| 2997 | mull2 r2,r5 | ||
| 2998 | mull3 r2,r4,-876(fp) | ||
| 2999 | mull2 r0,r4 | ||
| 3000 | addl3 -872(fp),-876(fp),r0 | ||
| 3001 | bicl3 #0,r0,-872(fp) | ||
| 3002 | cmpl -872(fp),-876(fp) | ||
| 3003 | bgequ noname.281 | ||
| 3004 | addl2 #65536,r4 | ||
| 3005 | noname.281: | ||
| 3006 | movzwl -870(fp),r0 | ||
| 3007 | bicl2 #-65536,r0 | ||
| 3008 | addl2 r0,r4 | ||
| 3009 | bicl3 #-65536,-872(fp),r0 | ||
| 3010 | ashl #16,r0,-876(fp) | ||
| 3011 | addl2 -876(fp),r5 | ||
| 3012 | bicl2 #0,r5 | ||
| 3013 | cmpl r5,-876(fp) | ||
| 3014 | bgequ noname.282 | ||
| 3015 | incl r4 | ||
| 3016 | noname.282: | ||
| 3017 | movl r5,r1 | ||
| 3018 | movl r4,r2 | ||
| 3019 | addl2 r1,r9 | ||
| 3020 | bicl2 #0,r9 | ||
| 3021 | cmpl r9,r1 | ||
| 3022 | bgequ noname.283 | ||
| 3023 | incl r2 | ||
| 3024 | noname.283: | ||
| 3025 | addl2 r2,r8 | ||
| 3026 | bicl2 #0,r8 | ||
| 3027 | cmpl r8,r2 | ||
| 3028 | bgequ noname.284 | ||
| 3029 | incl r10 | ||
| 3030 | noname.284: | ||
| 3031 | |||
| 3032 | bicl3 #-65536,20(r6),r3 | ||
| 3033 | movzwl 22(r6),r1 | ||
| 3034 | bicl2 #-65536,r1 | ||
| 3035 | bicl3 #-65536,28(r7),r2 | ||
| 3036 | movzwl 30(r7),r0 | ||
| 3037 | bicl2 #-65536,r0 | ||
| 3038 | movl r3,r5 | ||
| 3039 | movl r1,r4 | ||
| 3040 | mull3 r0,r5,-880(fp) | ||
| 3041 | mull2 r2,r5 | ||
| 3042 | mull3 r2,r4,-884(fp) | ||
| 3043 | mull2 r0,r4 | ||
| 3044 | addl3 -880(fp),-884(fp),r0 | ||
| 3045 | bicl3 #0,r0,-880(fp) | ||
| 3046 | cmpl -880(fp),-884(fp) | ||
| 3047 | bgequ noname.285 | ||
| 3048 | addl2 #65536,r4 | ||
| 3049 | noname.285: | ||
| 3050 | movzwl -878(fp),r0 | ||
| 3051 | bicl2 #-65536,r0 | ||
| 3052 | addl2 r0,r4 | ||
| 3053 | bicl3 #-65536,-880(fp),r0 | ||
| 3054 | ashl #16,r0,-884(fp) | ||
| 3055 | addl2 -884(fp),r5 | ||
| 3056 | bicl2 #0,r5 | ||
| 3057 | cmpl r5,-884(fp) | ||
| 3058 | bgequ noname.286 | ||
| 3059 | incl r4 | ||
| 3060 | noname.286: | ||
| 3061 | movl r5,r1 | ||
| 3062 | movl r4,r2 | ||
| 3063 | addl2 r1,r9 | ||
| 3064 | bicl2 #0,r9 | ||
| 3065 | cmpl r9,r1 | ||
| 3066 | bgequ noname.287 | ||
| 3067 | incl r2 | ||
| 3068 | noname.287: | ||
| 3069 | addl2 r2,r8 | ||
| 3070 | bicl2 #0,r8 | ||
| 3071 | cmpl r8,r2 | ||
| 3072 | bgequ noname.288 | ||
| 3073 | incl r10 | ||
| 3074 | noname.288: | ||
| 3075 | |||
| 3076 | movl r9,48(r11) | ||
| 3077 | |||
| 3078 | clrl r9 | ||
| 3079 | |||
| 3080 | bicl3 #-65536,24(r6),r3 | ||
| 3081 | movzwl 26(r6),r1 | ||
| 3082 | bicl2 #-65536,r1 | ||
| 3083 | bicl3 #-65536,28(r7),r2 | ||
| 3084 | movzwl 30(r7),r0 | ||
| 3085 | bicl2 #-65536,r0 | ||
| 3086 | movl r3,r5 | ||
| 3087 | movl r1,r4 | ||
| 3088 | mull3 r0,r5,-888(fp) | ||
| 3089 | mull2 r2,r5 | ||
| 3090 | mull3 r2,r4,-892(fp) | ||
| 3091 | mull2 r0,r4 | ||
| 3092 | addl3 -888(fp),-892(fp),r0 | ||
| 3093 | bicl3 #0,r0,-888(fp) | ||
| 3094 | cmpl -888(fp),-892(fp) | ||
| 3095 | bgequ noname.289 | ||
| 3096 | addl2 #65536,r4 | ||
| 3097 | noname.289: | ||
| 3098 | movzwl -886(fp),r0 | ||
| 3099 | bicl2 #-65536,r0 | ||
| 3100 | addl2 r0,r4 | ||
| 3101 | bicl3 #-65536,-888(fp),r0 | ||
| 3102 | ashl #16,r0,-892(fp) | ||
| 3103 | addl2 -892(fp),r5 | ||
| 3104 | bicl2 #0,r5 | ||
| 3105 | cmpl r5,-892(fp) | ||
| 3106 | bgequ noname.290 | ||
| 3107 | incl r4 | ||
| 3108 | noname.290: | ||
| 3109 | movl r5,r1 | ||
| 3110 | movl r4,r2 | ||
| 3111 | addl2 r1,r8 | ||
| 3112 | bicl2 #0,r8 | ||
| 3113 | cmpl r8,r1 | ||
| 3114 | bgequ noname.291 | ||
| 3115 | incl r2 | ||
| 3116 | noname.291: | ||
| 3117 | addl2 r2,r10 | ||
| 3118 | bicl2 #0,r10 | ||
| 3119 | cmpl r10,r2 | ||
| 3120 | bgequ noname.292 | ||
| 3121 | incl r9 | ||
| 3122 | noname.292: | ||
| 3123 | |||
| 3124 | movzwl 30(r6),r2 | ||
| 3125 | bicl3 #-65536,24(r7),r3 | ||
| 3126 | movzwl 26(r7),r0 | ||
| 3127 | bicl2 #-65536,r0 | ||
| 3128 | bicl3 #-65536,28(r6),-904(fp) | ||
| 3129 | bicl3 #-65536,r2,-908(fp) | ||
| 3130 | mull3 r0,-904(fp),-896(fp) | ||
| 3131 | mull2 r3,-904(fp) | ||
| 3132 | mull3 r3,-908(fp),-900(fp) | ||
| 3133 | mull2 r0,-908(fp) | ||
| 3134 | addl3 -896(fp),-900(fp),r0 | ||
| 3135 | bicl3 #0,r0,-896(fp) | ||
| 3136 | cmpl -896(fp),-900(fp) | ||
| 3137 | bgequ noname.293 | ||
| 3138 | addl2 #65536,-908(fp) | ||
| 3139 | noname.293: | ||
| 3140 | movzwl -894(fp),r0 | ||
| 3141 | bicl2 #-65536,r0 | ||
| 3142 | addl2 r0,-908(fp) | ||
| 3143 | bicl3 #-65536,-896(fp),r0 | ||
| 3144 | ashl #16,r0,-900(fp) | ||
| 3145 | addl3 -900(fp),-904(fp),r0 | ||
| 3146 | bicl3 #0,r0,-904(fp) | ||
| 3147 | cmpl -904(fp),-900(fp) | ||
| 3148 | bgequ noname.294 | ||
| 3149 | incl -908(fp) | ||
| 3150 | noname.294: | ||
| 3151 | movl -904(fp),r1 | ||
| 3152 | movl -908(fp),r2 | ||
| 3153 | addl2 r1,r8 | ||
| 3154 | bicl2 #0,r8 | ||
| 3155 | cmpl r8,r1 | ||
| 3156 | bgequ noname.295 | ||
| 3157 | incl r2 | ||
| 3158 | noname.295: | ||
| 3159 | addl2 r2,r10 | ||
| 3160 | bicl2 #0,r10 | ||
| 3161 | cmpl r10,r2 | ||
| 3162 | bgequ noname.296 | ||
| 3163 | incl r9 | ||
| 3164 | noname.296: | ||
| 3165 | |||
| 3166 | movl r8,52(r11) | ||
| 3167 | |||
| 3168 | clrl r8 | ||
| 3169 | |||
| 3170 | movzwl 30(r6),r2 | ||
| 3171 | bicl3 #-65536,28(r7),r3 | ||
| 3172 | movzwl 30(r7),r0 | ||
| 3173 | bicl2 #-65536,r0 | ||
| 3174 | bicl3 #-65536,28(r6),-920(fp) | ||
| 3175 | bicl3 #-65536,r2,-924(fp) | ||
| 3176 | mull3 r0,-920(fp),-912(fp) | ||
| 3177 | mull2 r3,-920(fp) | ||
| 3178 | mull3 r3,-924(fp),-916(fp) | ||
| 3179 | mull2 r0,-924(fp) | ||
| 3180 | addl3 -912(fp),-916(fp),r0 | ||
| 3181 | bicl3 #0,r0,-912(fp) | ||
| 3182 | cmpl -912(fp),-916(fp) | ||
| 3183 | bgequ noname.297 | ||
| 3184 | addl2 #65536,-924(fp) | ||
| 3185 | noname.297: | ||
| 3186 | movzwl -910(fp),r0 | ||
| 3187 | bicl2 #-65536,r0 | ||
| 3188 | addl2 r0,-924(fp) | ||
| 3189 | bicl3 #-65536,-912(fp),r0 | ||
| 3190 | ashl #16,r0,-916(fp) | ||
| 3191 | addl3 -916(fp),-920(fp),r0 | ||
| 3192 | bicl3 #0,r0,-920(fp) | ||
| 3193 | cmpl -920(fp),-916(fp) | ||
| 3194 | bgequ noname.298 | ||
| 3195 | incl -924(fp) | ||
| 3196 | noname.298: | ||
| 3197 | movl -920(fp),r1 | ||
| 3198 | movl -924(fp),r2 | ||
| 3199 | addl2 r1,r10 | ||
| 3200 | bicl2 #0,r10 | ||
| 3201 | cmpl r10,r1 | ||
| 3202 | bgequ noname.299 | ||
| 3203 | incl r2 | ||
| 3204 | noname.299: | ||
| 3205 | addl2 r2,r9 | ||
| 3206 | bicl2 #0,r9 | ||
| 3207 | cmpl r9,r2 | ||
| 3208 | bgequ noname.300 | ||
| 3209 | incl r8 | ||
| 3210 | noname.300: | ||
| 3211 | |||
| 3212 | movl r10,56(r11) | ||
| 3213 | |||
| 3214 | movl r9,60(r11) | ||
| 3215 | |||
| 3216 | ret | ||
| 3217 | |||
| 3218 | |||
| 3219 | |||
| 3220 | ;r=4 ;(AP) | ||
| 3221 | ;a=8 ;(AP) | ||
| 3222 | ;b=12 ;(AP) | ||
| 3223 | ;n=16 ;(AP) n by value (input) | ||
| 3224 | |||
| 3225 | .psect code,nowrt | ||
| 3226 | |||
| 3227 | .entry BN_MUL_COMBA4,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> | ||
| 3228 | movab -156(sp),sp | ||
| 3229 | |||
| 3230 | clrq r9 | ||
| 3231 | |||
| 3232 | clrl r8 | ||
| 3233 | |||
| 3234 | movl 8(ap),r6 | ||
| 3235 | bicl3 #-65536,(r6),r3 | ||
| 3236 | movzwl 2(r6),r2 | ||
| 3237 | bicl2 #-65536,r2 | ||
| 3238 | movl 12(ap),r7 | ||
| 3239 | bicl3 #-65536,(r7),r1 | ||
| 3240 | movzwl 2(r7),r0 | ||
| 3241 | bicl2 #-65536,r0 | ||
| 3242 | movl r3,r5 | ||
| 3243 | movl r2,r4 | ||
| 3244 | mull3 r0,r5,-4(fp) | ||
| 3245 | mull2 r1,r5 | ||
| 3246 | mull3 r1,r4,-8(fp) | ||
| 3247 | mull2 r0,r4 | ||
| 3248 | addl3 -4(fp),-8(fp),r0 | ||
| 3249 | bicl3 #0,r0,-4(fp) | ||
| 3250 | cmpl -4(fp),-8(fp) | ||
| 3251 | bgequ noname.303 | ||
| 3252 | addl2 #65536,r4 | ||
| 3253 | noname.303: | ||
| 3254 | movzwl -2(fp),r0 | ||
| 3255 | bicl2 #-65536,r0 | ||
| 3256 | addl2 r0,r4 | ||
| 3257 | bicl3 #-65536,-4(fp),r0 | ||
| 3258 | ashl #16,r0,-8(fp) | ||
| 3259 | addl2 -8(fp),r5 | ||
| 3260 | bicl2 #0,r5 | ||
| 3261 | cmpl r5,-8(fp) | ||
| 3262 | bgequ noname.304 | ||
| 3263 | incl r4 | ||
| 3264 | noname.304: | ||
| 3265 | movl r5,r1 | ||
| 3266 | movl r4,r2 | ||
| 3267 | addl2 r1,r10 | ||
| 3268 | bicl2 #0,r10 | ||
| 3269 | cmpl r10,r1 | ||
| 3270 | bgequ noname.305 | ||
| 3271 | incl r2 | ||
| 3272 | noname.305: | ||
| 3273 | addl2 r2,r9 | ||
| 3274 | bicl2 #0,r9 | ||
| 3275 | cmpl r9,r2 | ||
| 3276 | bgequ noname.306 | ||
| 3277 | incl r8 | ||
| 3278 | noname.306: | ||
| 3279 | |||
| 3280 | movl 4(ap),r11 | ||
| 3281 | movl r10,(r11) | ||
| 3282 | |||
| 3283 | clrl r10 | ||
| 3284 | |||
| 3285 | bicl3 #-65536,(r6),r3 | ||
| 3286 | movzwl 2(r6),r1 | ||
| 3287 | bicl2 #-65536,r1 | ||
| 3288 | bicl3 #-65536,4(r7),r2 | ||
| 3289 | movzwl 6(r7),r0 | ||
| 3290 | bicl2 #-65536,r0 | ||
| 3291 | movl r3,r5 | ||
| 3292 | movl r1,r4 | ||
| 3293 | mull3 r0,r5,-12(fp) | ||
| 3294 | mull2 r2,r5 | ||
| 3295 | mull3 r2,r4,-16(fp) | ||
| 3296 | mull2 r0,r4 | ||
| 3297 | addl3 -12(fp),-16(fp),r0 | ||
| 3298 | bicl3 #0,r0,-12(fp) | ||
| 3299 | cmpl -12(fp),-16(fp) | ||
| 3300 | bgequ noname.307 | ||
| 3301 | addl2 #65536,r4 | ||
| 3302 | noname.307: | ||
| 3303 | movzwl -10(fp),r0 | ||
| 3304 | bicl2 #-65536,r0 | ||
| 3305 | addl2 r0,r4 | ||
| 3306 | bicl3 #-65536,-12(fp),r0 | ||
| 3307 | ashl #16,r0,-16(fp) | ||
| 3308 | addl2 -16(fp),r5 | ||
| 3309 | bicl2 #0,r5 | ||
| 3310 | cmpl r5,-16(fp) | ||
| 3311 | bgequ noname.308 | ||
| 3312 | incl r4 | ||
| 3313 | noname.308: | ||
| 3314 | movl r5,r1 | ||
| 3315 | movl r4,r2 | ||
| 3316 | addl2 r1,r9 | ||
| 3317 | bicl2 #0,r9 | ||
| 3318 | cmpl r9,r1 | ||
| 3319 | bgequ noname.309 | ||
| 3320 | incl r2 | ||
| 3321 | noname.309: | ||
| 3322 | addl2 r2,r8 | ||
| 3323 | bicl2 #0,r8 | ||
| 3324 | cmpl r8,r2 | ||
| 3325 | bgequ noname.310 | ||
| 3326 | incl r10 | ||
| 3327 | noname.310: | ||
| 3328 | |||
| 3329 | bicl3 #-65536,4(r6),r3 | ||
| 3330 | movzwl 6(r6),r1 | ||
| 3331 | bicl2 #-65536,r1 | ||
| 3332 | bicl3 #-65536,(r7),r2 | ||
| 3333 | movzwl 2(r7),r0 | ||
| 3334 | bicl2 #-65536,r0 | ||
| 3335 | movl r3,r5 | ||
| 3336 | movl r1,r4 | ||
| 3337 | mull3 r0,r5,-20(fp) | ||
| 3338 | mull2 r2,r5 | ||
| 3339 | mull3 r2,r4,-24(fp) | ||
| 3340 | mull2 r0,r4 | ||
| 3341 | addl3 -20(fp),-24(fp),r0 | ||
| 3342 | bicl3 #0,r0,-20(fp) | ||
| 3343 | cmpl -20(fp),-24(fp) | ||
| 3344 | bgequ noname.311 | ||
| 3345 | addl2 #65536,r4 | ||
| 3346 | noname.311: | ||
| 3347 | movzwl -18(fp),r0 | ||
| 3348 | bicl2 #-65536,r0 | ||
| 3349 | addl2 r0,r4 | ||
| 3350 | bicl3 #-65536,-20(fp),r0 | ||
| 3351 | ashl #16,r0,-24(fp) | ||
| 3352 | addl2 -24(fp),r5 | ||
| 3353 | bicl2 #0,r5 | ||
| 3354 | cmpl r5,-24(fp) | ||
| 3355 | bgequ noname.312 | ||
| 3356 | incl r4 | ||
| 3357 | noname.312: | ||
| 3358 | movl r5,r1 | ||
| 3359 | movl r4,r2 | ||
| 3360 | addl2 r1,r9 | ||
| 3361 | bicl2 #0,r9 | ||
| 3362 | cmpl r9,r1 | ||
| 3363 | bgequ noname.313 | ||
| 3364 | incl r2 | ||
| 3365 | noname.313: | ||
| 3366 | addl2 r2,r8 | ||
| 3367 | bicl2 #0,r8 | ||
| 3368 | cmpl r8,r2 | ||
| 3369 | bgequ noname.314 | ||
| 3370 | incl r10 | ||
| 3371 | noname.314: | ||
| 3372 | |||
| 3373 | movl r9,4(r11) | ||
| 3374 | |||
| 3375 | clrl r9 | ||
| 3376 | |||
| 3377 | bicl3 #-65536,8(r6),r3 | ||
| 3378 | movzwl 10(r6),r1 | ||
| 3379 | bicl2 #-65536,r1 | ||
| 3380 | bicl3 #-65536,(r7),r2 | ||
| 3381 | movzwl 2(r7),r0 | ||
| 3382 | bicl2 #-65536,r0 | ||
| 3383 | movl r3,r5 | ||
| 3384 | movl r1,r4 | ||
| 3385 | mull3 r0,r5,-28(fp) | ||
| 3386 | mull2 r2,r5 | ||
| 3387 | mull3 r2,r4,-32(fp) | ||
| 3388 | mull2 r0,r4 | ||
| 3389 | addl3 -28(fp),-32(fp),r0 | ||
| 3390 | bicl3 #0,r0,-28(fp) | ||
| 3391 | cmpl -28(fp),-32(fp) | ||
| 3392 | bgequ noname.315 | ||
| 3393 | addl2 #65536,r4 | ||
| 3394 | noname.315: | ||
| 3395 | movzwl -26(fp),r0 | ||
| 3396 | bicl2 #-65536,r0 | ||
| 3397 | addl2 r0,r4 | ||
| 3398 | bicl3 #-65536,-28(fp),r0 | ||
| 3399 | ashl #16,r0,-32(fp) | ||
| 3400 | addl2 -32(fp),r5 | ||
| 3401 | bicl2 #0,r5 | ||
| 3402 | cmpl r5,-32(fp) | ||
| 3403 | bgequ noname.316 | ||
| 3404 | incl r4 | ||
| 3405 | noname.316: | ||
| 3406 | movl r5,r1 | ||
| 3407 | movl r4,r2 | ||
| 3408 | addl2 r1,r8 | ||
| 3409 | bicl2 #0,r8 | ||
| 3410 | cmpl r8,r1 | ||
| 3411 | bgequ noname.317 | ||
| 3412 | incl r2 | ||
| 3413 | noname.317: | ||
| 3414 | addl2 r2,r10 | ||
| 3415 | bicl2 #0,r10 | ||
| 3416 | cmpl r10,r2 | ||
| 3417 | bgequ noname.318 | ||
| 3418 | incl r9 | ||
| 3419 | noname.318: | ||
| 3420 | |||
| 3421 | bicl3 #-65536,4(r6),r3 | ||
| 3422 | movzwl 6(r6),r1 | ||
| 3423 | bicl2 #-65536,r1 | ||
| 3424 | bicl3 #-65536,4(r7),r2 | ||
| 3425 | movzwl 6(r7),r0 | ||
| 3426 | bicl2 #-65536,r0 | ||
| 3427 | movl r3,r5 | ||
| 3428 | movl r1,r4 | ||
| 3429 | mull3 r0,r5,-36(fp) | ||
| 3430 | mull2 r2,r5 | ||
| 3431 | mull3 r2,r4,-40(fp) | ||
| 3432 | mull2 r0,r4 | ||
| 3433 | addl3 -36(fp),-40(fp),r0 | ||
| 3434 | bicl3 #0,r0,-36(fp) | ||
| 3435 | cmpl -36(fp),-40(fp) | ||
| 3436 | bgequ noname.319 | ||
| 3437 | addl2 #65536,r4 | ||
| 3438 | noname.319: | ||
| 3439 | movzwl -34(fp),r0 | ||
| 3440 | bicl2 #-65536,r0 | ||
| 3441 | addl2 r0,r4 | ||
| 3442 | bicl3 #-65536,-36(fp),r0 | ||
| 3443 | ashl #16,r0,-40(fp) | ||
| 3444 | addl2 -40(fp),r5 | ||
| 3445 | bicl2 #0,r5 | ||
| 3446 | cmpl r5,-40(fp) | ||
| 3447 | bgequ noname.320 | ||
| 3448 | incl r4 | ||
| 3449 | noname.320: | ||
| 3450 | movl r5,r1 | ||
| 3451 | movl r4,r2 | ||
| 3452 | addl2 r1,r8 | ||
| 3453 | bicl2 #0,r8 | ||
| 3454 | cmpl r8,r1 | ||
| 3455 | bgequ noname.321 | ||
| 3456 | incl r2 | ||
| 3457 | noname.321: | ||
| 3458 | addl2 r2,r10 | ||
| 3459 | bicl2 #0,r10 | ||
| 3460 | cmpl r10,r2 | ||
| 3461 | bgequ noname.322 | ||
| 3462 | incl r9 | ||
| 3463 | noname.322: | ||
| 3464 | |||
| 3465 | bicl3 #-65536,(r6),r3 | ||
| 3466 | movzwl 2(r6),r1 | ||
| 3467 | bicl2 #-65536,r1 | ||
| 3468 | bicl3 #-65536,8(r7),r2 | ||
| 3469 | movzwl 10(r7),r0 | ||
| 3470 | bicl2 #-65536,r0 | ||
| 3471 | movl r3,r5 | ||
| 3472 | movl r1,r4 | ||
| 3473 | mull3 r0,r5,-44(fp) | ||
| 3474 | mull2 r2,r5 | ||
| 3475 | mull3 r2,r4,-48(fp) | ||
| 3476 | mull2 r0,r4 | ||
| 3477 | addl3 -44(fp),-48(fp),r0 | ||
| 3478 | bicl3 #0,r0,-44(fp) | ||
| 3479 | cmpl -44(fp),-48(fp) | ||
| 3480 | bgequ noname.323 | ||
| 3481 | addl2 #65536,r4 | ||
| 3482 | noname.323: | ||
| 3483 | movzwl -42(fp),r0 | ||
| 3484 | bicl2 #-65536,r0 | ||
| 3485 | addl2 r0,r4 | ||
| 3486 | bicl3 #-65536,-44(fp),r0 | ||
| 3487 | ashl #16,r0,-48(fp) | ||
| 3488 | addl2 -48(fp),r5 | ||
| 3489 | bicl2 #0,r5 | ||
| 3490 | cmpl r5,-48(fp) | ||
| 3491 | bgequ noname.324 | ||
| 3492 | incl r4 | ||
| 3493 | noname.324: | ||
| 3494 | movl r5,r1 | ||
| 3495 | movl r4,r2 | ||
| 3496 | addl2 r1,r8 | ||
| 3497 | bicl2 #0,r8 | ||
| 3498 | cmpl r8,r1 | ||
| 3499 | bgequ noname.325 | ||
| 3500 | incl r2 | ||
| 3501 | noname.325: | ||
| 3502 | addl2 r2,r10 | ||
| 3503 | bicl2 #0,r10 | ||
| 3504 | cmpl r10,r2 | ||
| 3505 | bgequ noname.326 | ||
| 3506 | incl r9 | ||
| 3507 | noname.326: | ||
| 3508 | |||
| 3509 | movl r8,8(r11) | ||
| 3510 | |||
| 3511 | clrl r8 | ||
| 3512 | |||
| 3513 | bicl3 #-65536,(r6),r3 | ||
| 3514 | movzwl 2(r6),r2 | ||
| 3515 | bicl3 #-65536,12(r7),r1 | ||
| 3516 | movzwl 14(r7),r0 | ||
| 3517 | bicl2 #-65536,r0 | ||
| 3518 | movl r3,r4 | ||
| 3519 | bicl3 #-65536,r2,-60(fp) | ||
| 3520 | mull3 r0,r4,-52(fp) | ||
| 3521 | mull2 r1,r4 | ||
| 3522 | mull3 r1,-60(fp),-56(fp) | ||
| 3523 | mull2 r0,-60(fp) | ||
| 3524 | addl3 -52(fp),-56(fp),r0 | ||
| 3525 | bicl3 #0,r0,-52(fp) | ||
| 3526 | cmpl -52(fp),-56(fp) | ||
| 3527 | bgequ noname.327 | ||
| 3528 | addl2 #65536,-60(fp) | ||
| 3529 | noname.327: | ||
| 3530 | movzwl -50(fp),r0 | ||
| 3531 | bicl2 #-65536,r0 | ||
| 3532 | addl2 r0,-60(fp) | ||
| 3533 | bicl3 #-65536,-52(fp),r0 | ||
| 3534 | ashl #16,r0,-56(fp) | ||
| 3535 | addl2 -56(fp),r4 | ||
| 3536 | bicl2 #0,r4 | ||
| 3537 | cmpl r4,-56(fp) | ||
| 3538 | bgequ noname.328 | ||
| 3539 | incl -60(fp) | ||
| 3540 | noname.328: | ||
| 3541 | movl r4,r1 | ||
| 3542 | movl -60(fp),r2 | ||
| 3543 | addl2 r1,r10 | ||
| 3544 | bicl2 #0,r10 | ||
| 3545 | cmpl r10,r1 | ||
| 3546 | bgequ noname.329 | ||
| 3547 | incl r2 | ||
| 3548 | noname.329: | ||
| 3549 | addl2 r2,r9 | ||
| 3550 | bicl2 #0,r9 | ||
| 3551 | cmpl r9,r2 | ||
| 3552 | bgequ noname.330 | ||
| 3553 | incl r8 | ||
| 3554 | noname.330: | ||
| 3555 | |||
| 3556 | movzwl 6(r6),r2 | ||
| 3557 | bicl3 #-65536,8(r7),r3 | ||
| 3558 | movzwl 10(r7),r0 | ||
| 3559 | bicl2 #-65536,r0 | ||
| 3560 | bicl3 #-65536,4(r6),-72(fp) | ||
| 3561 | bicl3 #-65536,r2,-76(fp) | ||
| 3562 | mull3 r0,-72(fp),-64(fp) | ||
| 3563 | mull2 r3,-72(fp) | ||
| 3564 | mull3 r3,-76(fp),-68(fp) | ||
| 3565 | mull2 r0,-76(fp) | ||
| 3566 | addl3 -64(fp),-68(fp),r0 | ||
| 3567 | bicl3 #0,r0,-64(fp) | ||
| 3568 | cmpl -64(fp),-68(fp) | ||
| 3569 | bgequ noname.331 | ||
| 3570 | addl2 #65536,-76(fp) | ||
| 3571 | noname.331: | ||
| 3572 | movzwl -62(fp),r0 | ||
| 3573 | bicl2 #-65536,r0 | ||
| 3574 | addl2 r0,-76(fp) | ||
| 3575 | bicl3 #-65536,-64(fp),r0 | ||
| 3576 | ashl #16,r0,-68(fp) | ||
| 3577 | addl3 -68(fp),-72(fp),r0 | ||
| 3578 | bicl3 #0,r0,-72(fp) | ||
| 3579 | cmpl -72(fp),-68(fp) | ||
| 3580 | bgequ noname.332 | ||
| 3581 | incl -76(fp) | ||
| 3582 | noname.332: | ||
| 3583 | movl -72(fp),r1 | ||
| 3584 | movl -76(fp),r2 | ||
| 3585 | addl2 r1,r10 | ||
| 3586 | bicl2 #0,r10 | ||
| 3587 | cmpl r10,r1 | ||
| 3588 | bgequ noname.333 | ||
| 3589 | incl r2 | ||
| 3590 | noname.333: | ||
| 3591 | addl2 r2,r9 | ||
| 3592 | bicl2 #0,r9 | ||
| 3593 | cmpl r9,r2 | ||
| 3594 | bgequ noname.334 | ||
| 3595 | incl r8 | ||
| 3596 | noname.334: | ||
| 3597 | |||
| 3598 | bicl3 #-65536,8(r6),r3 | ||
| 3599 | movzwl 10(r6),r1 | ||
| 3600 | bicl2 #-65536,r1 | ||
| 3601 | bicl3 #-65536,4(r7),r2 | ||
| 3602 | movzwl 6(r7),r0 | ||
| 3603 | bicl2 #-65536,r0 | ||
| 3604 | movl r3,r5 | ||
| 3605 | movl r1,r4 | ||
| 3606 | mull3 r0,r5,-80(fp) | ||
| 3607 | mull2 r2,r5 | ||
| 3608 | mull3 r2,r4,-84(fp) | ||
| 3609 | mull2 r0,r4 | ||
| 3610 | addl3 -80(fp),-84(fp),r0 | ||
| 3611 | bicl3 #0,r0,-80(fp) | ||
| 3612 | cmpl -80(fp),-84(fp) | ||
| 3613 | bgequ noname.335 | ||
| 3614 | addl2 #65536,r4 | ||
| 3615 | noname.335: | ||
| 3616 | movzwl -78(fp),r0 | ||
| 3617 | bicl2 #-65536,r0 | ||
| 3618 | addl2 r0,r4 | ||
| 3619 | bicl3 #-65536,-80(fp),r0 | ||
| 3620 | ashl #16,r0,-84(fp) | ||
| 3621 | addl2 -84(fp),r5 | ||
| 3622 | bicl2 #0,r5 | ||
| 3623 | cmpl r5,-84(fp) | ||
| 3624 | bgequ noname.336 | ||
| 3625 | incl r4 | ||
| 3626 | noname.336: | ||
| 3627 | movl r5,r1 | ||
| 3628 | movl r4,r2 | ||
| 3629 | addl2 r1,r10 | ||
| 3630 | bicl2 #0,r10 | ||
| 3631 | cmpl r10,r1 | ||
| 3632 | bgequ noname.337 | ||
| 3633 | incl r2 | ||
| 3634 | noname.337: | ||
| 3635 | addl2 r2,r9 | ||
| 3636 | bicl2 #0,r9 | ||
| 3637 | cmpl r9,r2 | ||
| 3638 | bgequ noname.338 | ||
| 3639 | incl r8 | ||
| 3640 | noname.338: | ||
| 3641 | |||
| 3642 | bicl3 #-65536,12(r6),r3 | ||
| 3643 | movzwl 14(r6),r1 | ||
| 3644 | bicl2 #-65536,r1 | ||
| 3645 | bicl3 #-65536,(r7),r2 | ||
| 3646 | movzwl 2(r7),r0 | ||
| 3647 | bicl2 #-65536,r0 | ||
| 3648 | movl r3,r5 | ||
| 3649 | movl r1,r4 | ||
| 3650 | mull3 r0,r5,-88(fp) | ||
| 3651 | mull2 r2,r5 | ||
| 3652 | mull3 r2,r4,-92(fp) | ||
| 3653 | mull2 r0,r4 | ||
| 3654 | addl3 -88(fp),-92(fp),r0 | ||
| 3655 | bicl3 #0,r0,-88(fp) | ||
| 3656 | cmpl -88(fp),-92(fp) | ||
| 3657 | bgequ noname.339 | ||
| 3658 | addl2 #65536,r4 | ||
| 3659 | noname.339: | ||
| 3660 | movzwl -86(fp),r0 | ||
| 3661 | bicl2 #-65536,r0 | ||
| 3662 | addl2 r0,r4 | ||
| 3663 | bicl3 #-65536,-88(fp),r0 | ||
| 3664 | ashl #16,r0,-92(fp) | ||
| 3665 | addl2 -92(fp),r5 | ||
| 3666 | bicl2 #0,r5 | ||
| 3667 | cmpl r5,-92(fp) | ||
| 3668 | bgequ noname.340 | ||
| 3669 | incl r4 | ||
| 3670 | noname.340: | ||
| 3671 | movl r5,r1 | ||
| 3672 | movl r4,r2 | ||
| 3673 | addl2 r1,r10 | ||
| 3674 | bicl2 #0,r10 | ||
| 3675 | cmpl r10,r1 | ||
| 3676 | bgequ noname.341 | ||
| 3677 | incl r2 | ||
| 3678 | noname.341: | ||
| 3679 | addl2 r2,r9 | ||
| 3680 | bicl2 #0,r9 | ||
| 3681 | cmpl r9,r2 | ||
| 3682 | bgequ noname.342 | ||
| 3683 | incl r8 | ||
| 3684 | noname.342: | ||
| 3685 | |||
| 3686 | movl r10,12(r11) | ||
| 3687 | |||
| 3688 | clrl r10 | ||
| 3689 | |||
| 3690 | bicl3 #-65536,12(r6),r3 | ||
| 3691 | movzwl 14(r6),r1 | ||
| 3692 | bicl2 #-65536,r1 | ||
| 3693 | bicl3 #-65536,4(r7),r2 | ||
| 3694 | movzwl 6(r7),r0 | ||
| 3695 | bicl2 #-65536,r0 | ||
| 3696 | movl r3,r5 | ||
| 3697 | movl r1,r4 | ||
| 3698 | mull3 r0,r5,-96(fp) | ||
| 3699 | mull2 r2,r5 | ||
| 3700 | mull3 r2,r4,-100(fp) | ||
| 3701 | mull2 r0,r4 | ||
| 3702 | addl3 -96(fp),-100(fp),r0 | ||
| 3703 | bicl3 #0,r0,-96(fp) | ||
| 3704 | cmpl -96(fp),-100(fp) | ||
| 3705 | bgequ noname.343 | ||
| 3706 | addl2 #65536,r4 | ||
| 3707 | noname.343: | ||
| 3708 | movzwl -94(fp),r0 | ||
| 3709 | bicl2 #-65536,r0 | ||
| 3710 | addl2 r0,r4 | ||
| 3711 | bicl3 #-65536,-96(fp),r0 | ||
| 3712 | ashl #16,r0,-100(fp) | ||
| 3713 | addl2 -100(fp),r5 | ||
| 3714 | bicl2 #0,r5 | ||
| 3715 | cmpl r5,-100(fp) | ||
| 3716 | bgequ noname.344 | ||
| 3717 | incl r4 | ||
| 3718 | noname.344: | ||
| 3719 | movl r5,r1 | ||
| 3720 | movl r4,r2 | ||
| 3721 | addl2 r1,r9 | ||
| 3722 | bicl2 #0,r9 | ||
| 3723 | cmpl r9,r1 | ||
| 3724 | bgequ noname.345 | ||
| 3725 | incl r2 | ||
| 3726 | noname.345: | ||
| 3727 | addl2 r2,r8 | ||
| 3728 | bicl2 #0,r8 | ||
| 3729 | cmpl r8,r2 | ||
| 3730 | bgequ noname.346 | ||
| 3731 | incl r10 | ||
| 3732 | noname.346: | ||
| 3733 | |||
| 3734 | bicl3 #-65536,8(r6),r3 | ||
| 3735 | movzwl 10(r6),r1 | ||
| 3736 | bicl2 #-65536,r1 | ||
| 3737 | bicl3 #-65536,8(r7),r2 | ||
| 3738 | movzwl 10(r7),r0 | ||
| 3739 | bicl2 #-65536,r0 | ||
| 3740 | movl r3,r5 | ||
| 3741 | movl r1,r4 | ||
| 3742 | mull3 r0,r5,-104(fp) | ||
| 3743 | mull2 r2,r5 | ||
| 3744 | mull3 r2,r4,-108(fp) | ||
| 3745 | mull2 r0,r4 | ||
| 3746 | addl3 -104(fp),-108(fp),r0 | ||
| 3747 | bicl3 #0,r0,-104(fp) | ||
| 3748 | cmpl -104(fp),-108(fp) | ||
| 3749 | bgequ noname.347 | ||
| 3750 | addl2 #65536,r4 | ||
| 3751 | noname.347: | ||
| 3752 | movzwl -102(fp),r0 | ||
| 3753 | bicl2 #-65536,r0 | ||
| 3754 | addl2 r0,r4 | ||
| 3755 | bicl3 #-65536,-104(fp),r0 | ||
| 3756 | ashl #16,r0,-108(fp) | ||
| 3757 | addl2 -108(fp),r5 | ||
| 3758 | bicl2 #0,r5 | ||
| 3759 | cmpl r5,-108(fp) | ||
| 3760 | bgequ noname.348 | ||
| 3761 | incl r4 | ||
| 3762 | noname.348: | ||
| 3763 | movl r5,r1 | ||
| 3764 | movl r4,r2 | ||
| 3765 | addl2 r1,r9 | ||
| 3766 | bicl2 #0,r9 | ||
| 3767 | cmpl r9,r1 | ||
| 3768 | bgequ noname.349 | ||
| 3769 | incl r2 | ||
| 3770 | noname.349: | ||
| 3771 | addl2 r2,r8 | ||
| 3772 | bicl2 #0,r8 | ||
| 3773 | cmpl r8,r2 | ||
| 3774 | bgequ noname.350 | ||
| 3775 | incl r10 | ||
| 3776 | noname.350: | ||
| 3777 | |||
| 3778 | bicl3 #-65536,4(r6),r3 | ||
| 3779 | movzwl 6(r6),r1 | ||
| 3780 | bicl2 #-65536,r1 | ||
| 3781 | bicl3 #-65536,12(r7),r2 | ||
| 3782 | movzwl 14(r7),r0 | ||
| 3783 | bicl2 #-65536,r0 | ||
| 3784 | movl r3,r5 | ||
| 3785 | movl r1,r4 | ||
| 3786 | mull3 r0,r5,-112(fp) | ||
| 3787 | mull2 r2,r5 | ||
| 3788 | mull3 r2,r4,-116(fp) | ||
| 3789 | mull2 r0,r4 | ||
| 3790 | addl3 -112(fp),-116(fp),r0 | ||
| 3791 | bicl3 #0,r0,-112(fp) | ||
| 3792 | cmpl -112(fp),-116(fp) | ||
| 3793 | bgequ noname.351 | ||
| 3794 | addl2 #65536,r4 | ||
| 3795 | noname.351: | ||
| 3796 | movzwl -110(fp),r0 | ||
| 3797 | bicl2 #-65536,r0 | ||
| 3798 | addl2 r0,r4 | ||
| 3799 | bicl3 #-65536,-112(fp),r0 | ||
| 3800 | ashl #16,r0,-116(fp) | ||
| 3801 | addl2 -116(fp),r5 | ||
| 3802 | bicl2 #0,r5 | ||
| 3803 | cmpl r5,-116(fp) | ||
| 3804 | bgequ noname.352 | ||
| 3805 | incl r4 | ||
| 3806 | noname.352: | ||
| 3807 | movl r5,r1 | ||
| 3808 | movl r4,r2 | ||
| 3809 | addl2 r1,r9 | ||
| 3810 | bicl2 #0,r9 | ||
| 3811 | cmpl r9,r1 | ||
| 3812 | bgequ noname.353 | ||
| 3813 | incl r2 | ||
| 3814 | noname.353: | ||
| 3815 | addl2 r2,r8 | ||
| 3816 | bicl2 #0,r8 | ||
| 3817 | cmpl r8,r2 | ||
| 3818 | bgequ noname.354 | ||
| 3819 | incl r10 | ||
| 3820 | noname.354: | ||
| 3821 | |||
| 3822 | movl r9,16(r11) | ||
| 3823 | |||
| 3824 | clrl r9 | ||
| 3825 | |||
| 3826 | bicl3 #-65536,8(r6),r3 | ||
| 3827 | movzwl 10(r6),r1 | ||
| 3828 | bicl2 #-65536,r1 | ||
| 3829 | bicl3 #-65536,12(r7),r2 | ||
| 3830 | movzwl 14(r7),r0 | ||
| 3831 | bicl2 #-65536,r0 | ||
| 3832 | movl r3,r5 | ||
| 3833 | movl r1,r4 | ||
| 3834 | mull3 r0,r5,-120(fp) | ||
| 3835 | mull2 r2,r5 | ||
| 3836 | mull3 r2,r4,-124(fp) | ||
| 3837 | mull2 r0,r4 | ||
| 3838 | addl3 -120(fp),-124(fp),r0 | ||
| 3839 | bicl3 #0,r0,-120(fp) | ||
| 3840 | cmpl -120(fp),-124(fp) | ||
| 3841 | bgequ noname.355 | ||
| 3842 | addl2 #65536,r4 | ||
| 3843 | noname.355: | ||
| 3844 | movzwl -118(fp),r0 | ||
| 3845 | bicl2 #-65536,r0 | ||
| 3846 | addl2 r0,r4 | ||
| 3847 | bicl3 #-65536,-120(fp),r0 | ||
| 3848 | ashl #16,r0,-124(fp) | ||
| 3849 | addl2 -124(fp),r5 | ||
| 3850 | bicl2 #0,r5 | ||
| 3851 | cmpl r5,-124(fp) | ||
| 3852 | bgequ noname.356 | ||
| 3853 | incl r4 | ||
| 3854 | noname.356: | ||
| 3855 | movl r5,r1 | ||
| 3856 | movl r4,r2 | ||
| 3857 | addl2 r1,r8 | ||
| 3858 | bicl2 #0,r8 | ||
| 3859 | cmpl r8,r1 | ||
| 3860 | bgequ noname.357 | ||
| 3861 | incl r2 | ||
| 3862 | noname.357: | ||
| 3863 | addl2 r2,r10 | ||
| 3864 | bicl2 #0,r10 | ||
| 3865 | cmpl r10,r2 | ||
| 3866 | bgequ noname.358 | ||
| 3867 | incl r9 | ||
| 3868 | noname.358: | ||
| 3869 | |||
| 3870 | movzwl 14(r6),r2 | ||
| 3871 | bicl3 #-65536,8(r7),r3 | ||
| 3872 | movzwl 10(r7),r0 | ||
| 3873 | bicl2 #-65536,r0 | ||
| 3874 | bicl3 #-65536,12(r6),-136(fp) | ||
| 3875 | bicl3 #-65536,r2,-140(fp) | ||
| 3876 | mull3 r0,-136(fp),-128(fp) | ||
| 3877 | mull2 r3,-136(fp) | ||
| 3878 | mull3 r3,-140(fp),-132(fp) | ||
| 3879 | mull2 r0,-140(fp) | ||
| 3880 | addl3 -128(fp),-132(fp),r0 | ||
| 3881 | bicl3 #0,r0,-128(fp) | ||
| 3882 | cmpl -128(fp),-132(fp) | ||
| 3883 | bgequ noname.359 | ||
| 3884 | addl2 #65536,-140(fp) | ||
| 3885 | noname.359: | ||
| 3886 | movzwl -126(fp),r0 | ||
| 3887 | bicl2 #-65536,r0 | ||
| 3888 | addl2 r0,-140(fp) | ||
| 3889 | bicl3 #-65536,-128(fp),r0 | ||
| 3890 | ashl #16,r0,-132(fp) | ||
| 3891 | addl3 -132(fp),-136(fp),r0 | ||
| 3892 | bicl3 #0,r0,-136(fp) | ||
| 3893 | cmpl -136(fp),-132(fp) | ||
| 3894 | bgequ noname.360 | ||
| 3895 | incl -140(fp) | ||
| 3896 | noname.360: | ||
| 3897 | movl -136(fp),r1 | ||
| 3898 | movl -140(fp),r2 | ||
| 3899 | addl2 r1,r8 | ||
| 3900 | bicl2 #0,r8 | ||
| 3901 | cmpl r8,r1 | ||
| 3902 | bgequ noname.361 | ||
| 3903 | incl r2 | ||
| 3904 | noname.361: | ||
| 3905 | addl2 r2,r10 | ||
| 3906 | bicl2 #0,r10 | ||
| 3907 | cmpl r10,r2 | ||
| 3908 | bgequ noname.362 | ||
| 3909 | incl r9 | ||
| 3910 | noname.362: | ||
| 3911 | |||
| 3912 | movl r8,20(r11) | ||
| 3913 | |||
| 3914 | clrl r8 | ||
| 3915 | |||
| 3916 | movzwl 14(r6),r2 | ||
| 3917 | bicl3 #-65536,12(r7),r3 | ||
| 3918 | movzwl 14(r7),r0 | ||
| 3919 | bicl2 #-65536,r0 | ||
| 3920 | bicl3 #-65536,12(r6),-152(fp) | ||
| 3921 | bicl3 #-65536,r2,-156(fp) | ||
| 3922 | mull3 r0,-152(fp),-144(fp) | ||
| 3923 | mull2 r3,-152(fp) | ||
| 3924 | mull3 r3,-156(fp),-148(fp) | ||
| 3925 | mull2 r0,-156(fp) | ||
| 3926 | addl3 -144(fp),-148(fp),r0 | ||
| 3927 | bicl3 #0,r0,-144(fp) | ||
| 3928 | cmpl -144(fp),-148(fp) | ||
| 3929 | bgequ noname.363 | ||
| 3930 | addl2 #65536,-156(fp) | ||
| 3931 | noname.363: | ||
| 3932 | movzwl -142(fp),r0 | ||
| 3933 | bicl2 #-65536,r0 | ||
| 3934 | addl2 r0,-156(fp) | ||
| 3935 | bicl3 #-65536,-144(fp),r0 | ||
| 3936 | ashl #16,r0,-148(fp) | ||
| 3937 | addl3 -148(fp),-152(fp),r0 | ||
| 3938 | bicl3 #0,r0,-152(fp) | ||
| 3939 | cmpl -152(fp),-148(fp) | ||
| 3940 | bgequ noname.364 | ||
| 3941 | incl -156(fp) | ||
| 3942 | noname.364: | ||
| 3943 | movl -152(fp),r1 | ||
| 3944 | movl -156(fp),r2 | ||
| 3945 | addl2 r1,r10 | ||
| 3946 | bicl2 #0,r10 | ||
| 3947 | cmpl r10,r1 | ||
| 3948 | bgequ noname.365 | ||
| 3949 | incl r2 | ||
| 3950 | noname.365: | ||
| 3951 | addl2 r2,r9 | ||
| 3952 | bicl2 #0,r9 | ||
| 3953 | cmpl r9,r2 | ||
| 3954 | bgequ noname.366 | ||
| 3955 | incl r8 | ||
| 3956 | noname.366: | ||
| 3957 | |||
| 3958 | movl r10,24(r11) | ||
| 3959 | |||
| 3960 | movl r9,28(r11) | ||
| 3961 | |||
| 3962 | ret | ||
| 3963 | |||
| 3964 | |||
| 3965 | |||
| 3966 | ;r=4 ;(AP) | ||
| 3967 | ;a=8 ;(AP) | ||
| 3968 | ;b=12 ;(AP) | ||
| 3969 | ;n=16 ;(AP) n by value (input) | ||
| 3970 | |||
| 3971 | .psect code,nowrt | ||
| 3972 | |||
| 3973 | .entry BN_SQR_COMBA8,^m<r2,r3,r4,r5,r6,r7,r8,r9> | ||
| 3974 | movab -444(sp),sp | ||
| 3975 | |||
| 3976 | clrq r8 | ||
| 3977 | |||
| 3978 | clrl r7 | ||
| 3979 | |||
| 3980 | movl 8(ap),r4 | ||
| 3981 | movl (r4),r3 | ||
| 3982 | bicl3 #-65536,r3,-4(fp) | ||
| 3983 | extzv #16,#16,r3,r0 | ||
| 3984 | bicl3 #-65536,r0,r3 | ||
| 3985 | movl -4(fp),r0 | ||
| 3986 | mull3 r0,r3,-8(fp) | ||
| 3987 | mull3 r0,r0,-4(fp) | ||
| 3988 | mull2 r3,r3 | ||
| 3989 | bicl3 #32767,-8(fp),r0 | ||
| 3990 | extzv #15,#17,r0,r0 | ||
| 3991 | addl2 r0,r3 | ||
| 3992 | bicl3 #-65536,-8(fp),r0 | ||
| 3993 | ashl #17,r0,-8(fp) | ||
| 3994 | addl3 -4(fp),-8(fp),r0 | ||
| 3995 | bicl3 #0,r0,-4(fp) | ||
| 3996 | cmpl -4(fp),-8(fp) | ||
| 3997 | bgequ noname.369 | ||
| 3998 | incl r3 | ||
| 3999 | noname.369: | ||
| 4000 | movl -4(fp),r1 | ||
| 4001 | movl r3,r2 | ||
| 4002 | addl2 r1,r9 | ||
| 4003 | bicl2 #0,r9 | ||
| 4004 | cmpl r9,r1 | ||
| 4005 | bgequ noname.370 | ||
| 4006 | incl r2 | ||
| 4007 | noname.370: | ||
| 4008 | addl2 r2,r8 | ||
| 4009 | bicl2 #0,r8 | ||
| 4010 | cmpl r8,r2 | ||
| 4011 | bgequ noname.371 | ||
| 4012 | incl r7 | ||
| 4013 | noname.371: | ||
| 4014 | |||
| 4015 | movl r9,@4(ap) | ||
| 4016 | |||
| 4017 | clrl r9 | ||
| 4018 | |||
| 4019 | movzwl 6(r4),r2 | ||
| 4020 | bicl3 #-65536,(r4),r3 | ||
| 4021 | movzwl 2(r4),r0 | ||
| 4022 | bicl2 #-65536,r0 | ||
| 4023 | bicl3 #-65536,4(r4),-20(fp) | ||
| 4024 | bicl3 #-65536,r2,-24(fp) | ||
| 4025 | mull3 r0,-20(fp),-12(fp) | ||
| 4026 | mull2 r3,-20(fp) | ||
| 4027 | mull3 r3,-24(fp),-16(fp) | ||
| 4028 | mull2 r0,-24(fp) | ||
| 4029 | addl3 -12(fp),-16(fp),r0 | ||
| 4030 | bicl3 #0,r0,-12(fp) | ||
| 4031 | cmpl -12(fp),-16(fp) | ||
| 4032 | bgequ noname.372 | ||
| 4033 | addl2 #65536,-24(fp) | ||
| 4034 | noname.372: | ||
| 4035 | movzwl -10(fp),r0 | ||
| 4036 | bicl2 #-65536,r0 | ||
| 4037 | addl2 r0,-24(fp) | ||
| 4038 | bicl3 #-65536,-12(fp),r0 | ||
| 4039 | ashl #16,r0,-16(fp) | ||
| 4040 | addl3 -16(fp),-20(fp),r0 | ||
| 4041 | bicl3 #0,r0,-20(fp) | ||
| 4042 | cmpl -20(fp),-16(fp) | ||
| 4043 | bgequ noname.373 | ||
| 4044 | incl -24(fp) | ||
| 4045 | noname.373: | ||
| 4046 | movl -20(fp),r3 | ||
| 4047 | movl -24(fp),r2 | ||
| 4048 | bbc #31,r2,noname.374 | ||
| 4049 | incl r9 | ||
| 4050 | noname.374: | ||
| 4051 | addl2 r2,r2 | ||
| 4052 | bicl2 #0,r2 | ||
| 4053 | bbc #31,r3,noname.375 | ||
| 4054 | incl r2 | ||
| 4055 | noname.375: | ||
| 4056 | addl2 r3,r3 | ||
| 4057 | bicl2 #0,r3 | ||
| 4058 | addl2 r3,r8 | ||
| 4059 | bicl2 #0,r8 | ||
| 4060 | cmpl r8,r3 | ||
| 4061 | bgequ noname.376 | ||
| 4062 | incl r2 | ||
| 4063 | bicl3 #0,r2,r0 | ||
| 4064 | bneq noname.376 | ||
| 4065 | incl r9 | ||
| 4066 | noname.376: | ||
| 4067 | addl2 r2,r7 | ||
| 4068 | bicl2 #0,r7 | ||
| 4069 | cmpl r7,r2 | ||
| 4070 | bgequ noname.377 | ||
| 4071 | incl r9 | ||
| 4072 | noname.377: | ||
| 4073 | |||
| 4074 | movl 4(ap),r0 | ||
| 4075 | movl r8,4(r0) | ||
| 4076 | |||
| 4077 | clrl r8 | ||
| 4078 | |||
| 4079 | movl 8(ap),r4 | ||
| 4080 | movl 4(r4),r3 | ||
| 4081 | bicl3 #-65536,r3,-28(fp) | ||
| 4082 | extzv #16,#16,r3,r0 | ||
| 4083 | bicl3 #-65536,r0,r3 | ||
| 4084 | movl -28(fp),r0 | ||
| 4085 | mull3 r0,r3,-32(fp) | ||
| 4086 | mull3 r0,r0,-28(fp) | ||
| 4087 | mull2 r3,r3 | ||
| 4088 | bicl3 #32767,-32(fp),r0 | ||
| 4089 | extzv #15,#17,r0,r0 | ||
| 4090 | addl2 r0,r3 | ||
| 4091 | bicl3 #-65536,-32(fp),r0 | ||
| 4092 | ashl #17,r0,-32(fp) | ||
| 4093 | addl3 -28(fp),-32(fp),r0 | ||
| 4094 | bicl3 #0,r0,-28(fp) | ||
| 4095 | cmpl -28(fp),-32(fp) | ||
| 4096 | bgequ noname.378 | ||
| 4097 | incl r3 | ||
| 4098 | noname.378: | ||
| 4099 | movl -28(fp),r1 | ||
| 4100 | movl r3,r2 | ||
| 4101 | addl2 r1,r7 | ||
| 4102 | bicl2 #0,r7 | ||
| 4103 | cmpl r7,r1 | ||
| 4104 | bgequ noname.379 | ||
| 4105 | incl r2 | ||
| 4106 | noname.379: | ||
| 4107 | addl2 r2,r9 | ||
| 4108 | bicl2 #0,r9 | ||
| 4109 | cmpl r9,r2 | ||
| 4110 | bgequ noname.380 | ||
| 4111 | incl r8 | ||
| 4112 | noname.380: | ||
| 4113 | |||
| 4114 | movzwl 10(r4),r2 | ||
| 4115 | bicl3 #-65536,(r4),r3 | ||
| 4116 | movzwl 2(r4),r0 | ||
| 4117 | bicl2 #-65536,r0 | ||
| 4118 | bicl3 #-65536,8(r4),-44(fp) | ||
| 4119 | bicl3 #-65536,r2,-48(fp) | ||
| 4120 | mull3 r0,-44(fp),-36(fp) | ||
| 4121 | mull2 r3,-44(fp) | ||
| 4122 | mull3 r3,-48(fp),-40(fp) | ||
| 4123 | mull2 r0,-48(fp) | ||
| 4124 | addl3 -36(fp),-40(fp),r0 | ||
| 4125 | bicl3 #0,r0,-36(fp) | ||
| 4126 | cmpl -36(fp),-40(fp) | ||
| 4127 | bgequ noname.381 | ||
| 4128 | addl2 #65536,-48(fp) | ||
| 4129 | noname.381: | ||
| 4130 | movzwl -34(fp),r0 | ||
| 4131 | bicl2 #-65536,r0 | ||
| 4132 | addl2 r0,-48(fp) | ||
| 4133 | bicl3 #-65536,-36(fp),r0 | ||
| 4134 | ashl #16,r0,-40(fp) | ||
| 4135 | addl3 -40(fp),-44(fp),r0 | ||
| 4136 | bicl3 #0,r0,-44(fp) | ||
| 4137 | cmpl -44(fp),-40(fp) | ||
| 4138 | bgequ noname.382 | ||
| 4139 | incl -48(fp) | ||
| 4140 | noname.382: | ||
| 4141 | movl -44(fp),r3 | ||
| 4142 | movl -48(fp),r2 | ||
| 4143 | bbc #31,r2,noname.383 | ||
| 4144 | incl r8 | ||
| 4145 | noname.383: | ||
| 4146 | addl2 r2,r2 | ||
| 4147 | bicl2 #0,r2 | ||
| 4148 | bbc #31,r3,noname.384 | ||
| 4149 | incl r2 | ||
| 4150 | noname.384: | ||
| 4151 | addl2 r3,r3 | ||
| 4152 | bicl2 #0,r3 | ||
| 4153 | addl2 r3,r7 | ||
| 4154 | bicl2 #0,r7 | ||
| 4155 | cmpl r7,r3 | ||
| 4156 | bgequ noname.385 | ||
| 4157 | incl r2 | ||
| 4158 | bicl3 #0,r2,r0 | ||
| 4159 | bneq noname.385 | ||
| 4160 | incl r8 | ||
| 4161 | noname.385: | ||
| 4162 | addl2 r2,r9 | ||
| 4163 | bicl2 #0,r9 | ||
| 4164 | cmpl r9,r2 | ||
| 4165 | bgequ noname.386 | ||
| 4166 | incl r8 | ||
| 4167 | noname.386: | ||
| 4168 | |||
| 4169 | movl 4(ap),r0 | ||
| 4170 | movl r7,8(r0) | ||
| 4171 | |||
| 4172 | clrl r7 | ||
| 4173 | |||
| 4174 | movl 8(ap),r0 | ||
| 4175 | movzwl 14(r0),r2 | ||
| 4176 | bicl3 #-65536,(r0),r3 | ||
| 4177 | movzwl 2(r0),r1 | ||
| 4178 | bicl2 #-65536,r1 | ||
| 4179 | bicl3 #-65536,12(r0),-60(fp) | ||
| 4180 | bicl3 #-65536,r2,-64(fp) | ||
| 4181 | mull3 r1,-60(fp),-52(fp) | ||
| 4182 | mull2 r3,-60(fp) | ||
| 4183 | mull3 r3,-64(fp),-56(fp) | ||
| 4184 | mull2 r1,-64(fp) | ||
| 4185 | addl3 -52(fp),-56(fp),r0 | ||
| 4186 | bicl3 #0,r0,-52(fp) | ||
| 4187 | cmpl -52(fp),-56(fp) | ||
| 4188 | bgequ noname.387 | ||
| 4189 | addl2 #65536,-64(fp) | ||
| 4190 | noname.387: | ||
| 4191 | movzwl -50(fp),r0 | ||
| 4192 | bicl2 #-65536,r0 | ||
| 4193 | addl2 r0,-64(fp) | ||
| 4194 | bicl3 #-65536,-52(fp),r0 | ||
| 4195 | ashl #16,r0,-56(fp) | ||
| 4196 | addl3 -56(fp),-60(fp),r0 | ||
| 4197 | bicl3 #0,r0,-60(fp) | ||
| 4198 | cmpl -60(fp),-56(fp) | ||
| 4199 | bgequ noname.388 | ||
| 4200 | incl -64(fp) | ||
| 4201 | noname.388: | ||
| 4202 | movl -60(fp),r3 | ||
| 4203 | movl -64(fp),r2 | ||
| 4204 | bbc #31,r2,noname.389 | ||
| 4205 | incl r7 | ||
| 4206 | noname.389: | ||
| 4207 | addl2 r2,r2 | ||
| 4208 | bicl2 #0,r2 | ||
| 4209 | bbc #31,r3,noname.390 | ||
| 4210 | incl r2 | ||
| 4211 | noname.390: | ||
| 4212 | addl2 r3,r3 | ||
| 4213 | bicl2 #0,r3 | ||
| 4214 | addl2 r3,r9 | ||
| 4215 | bicl2 #0,r9 | ||
| 4216 | cmpl r9,r3 | ||
| 4217 | bgequ noname.391 | ||
| 4218 | incl r2 | ||
| 4219 | bicl3 #0,r2,r0 | ||
| 4220 | bneq noname.391 | ||
| 4221 | incl r7 | ||
| 4222 | noname.391: | ||
| 4223 | addl2 r2,r8 | ||
| 4224 | bicl2 #0,r8 | ||
| 4225 | cmpl r8,r2 | ||
| 4226 | bgequ noname.392 | ||
| 4227 | incl r7 | ||
| 4228 | noname.392: | ||
| 4229 | |||
| 4230 | movl 8(ap),r0 | ||
| 4231 | movzwl 10(r0),r2 | ||
| 4232 | bicl3 #-65536,4(r0),r3 | ||
| 4233 | movzwl 6(r0),r1 | ||
| 4234 | bicl2 #-65536,r1 | ||
| 4235 | bicl3 #-65536,8(r0),-76(fp) | ||
| 4236 | bicl3 #-65536,r2,-80(fp) | ||
| 4237 | mull3 r1,-76(fp),-68(fp) | ||
| 4238 | mull2 r3,-76(fp) | ||
| 4239 | mull3 r3,-80(fp),-72(fp) | ||
| 4240 | mull2 r1,-80(fp) | ||
| 4241 | addl3 -68(fp),-72(fp),r0 | ||
| 4242 | bicl3 #0,r0,-68(fp) | ||
| 4243 | cmpl -68(fp),-72(fp) | ||
| 4244 | bgequ noname.393 | ||
| 4245 | addl2 #65536,-80(fp) | ||
| 4246 | noname.393: | ||
| 4247 | movzwl -66(fp),r0 | ||
| 4248 | bicl2 #-65536,r0 | ||
| 4249 | addl2 r0,-80(fp) | ||
| 4250 | bicl3 #-65536,-68(fp),r0 | ||
| 4251 | ashl #16,r0,-72(fp) | ||
| 4252 | addl3 -72(fp),-76(fp),r0 | ||
| 4253 | bicl3 #0,r0,-76(fp) | ||
| 4254 | cmpl -76(fp),-72(fp) | ||
| 4255 | bgequ noname.394 | ||
| 4256 | incl -80(fp) | ||
| 4257 | noname.394: | ||
| 4258 | movl -76(fp),r3 | ||
| 4259 | movl -80(fp),r2 | ||
| 4260 | bbc #31,r2,noname.395 | ||
| 4261 | incl r7 | ||
| 4262 | noname.395: | ||
| 4263 | addl2 r2,r2 | ||
| 4264 | bicl2 #0,r2 | ||
| 4265 | bbc #31,r3,noname.396 | ||
| 4266 | incl r2 | ||
| 4267 | noname.396: | ||
| 4268 | addl2 r3,r3 | ||
| 4269 | bicl2 #0,r3 | ||
| 4270 | addl2 r3,r9 | ||
| 4271 | bicl2 #0,r9 | ||
| 4272 | cmpl r9,r3 | ||
| 4273 | bgequ noname.397 | ||
| 4274 | incl r2 | ||
| 4275 | bicl3 #0,r2,r0 | ||
| 4276 | bneq noname.397 | ||
| 4277 | incl r7 | ||
| 4278 | noname.397: | ||
| 4279 | addl2 r2,r8 | ||
| 4280 | bicl2 #0,r8 | ||
| 4281 | cmpl r8,r2 | ||
| 4282 | bgequ noname.398 | ||
| 4283 | incl r7 | ||
| 4284 | noname.398: | ||
| 4285 | |||
| 4286 | movl 4(ap),r0 | ||
| 4287 | movl r9,12(r0) | ||
| 4288 | |||
| 4289 | clrl r9 | ||
| 4290 | |||
| 4291 | movl 8(ap),r2 | ||
| 4292 | movl 8(r2),r4 | ||
| 4293 | bicl3 #-65536,r4,-84(fp) | ||
| 4294 | extzv #16,#16,r4,r0 | ||
| 4295 | bicl3 #-65536,r0,r4 | ||
| 4296 | movl -84(fp),r0 | ||
| 4297 | mull3 r0,r4,-88(fp) | ||
| 4298 | mull3 r0,r0,-84(fp) | ||
| 4299 | mull2 r4,r4 | ||
| 4300 | bicl3 #32767,-88(fp),r0 | ||
| 4301 | extzv #15,#17,r0,r0 | ||
| 4302 | addl2 r0,r4 | ||
| 4303 | bicl3 #-65536,-88(fp),r0 | ||
| 4304 | ashl #17,r0,-88(fp) | ||
| 4305 | addl3 -84(fp),-88(fp),r0 | ||
| 4306 | bicl3 #0,r0,-84(fp) | ||
| 4307 | cmpl -84(fp),-88(fp) | ||
| 4308 | bgequ noname.399 | ||
| 4309 | incl r4 | ||
| 4310 | noname.399: | ||
| 4311 | movl -84(fp),r1 | ||
| 4312 | movl r4,r3 | ||
| 4313 | addl2 r1,r8 | ||
| 4314 | bicl2 #0,r8 | ||
| 4315 | cmpl r8,r1 | ||
| 4316 | bgequ noname.400 | ||
| 4317 | incl r3 | ||
| 4318 | noname.400: | ||
| 4319 | addl2 r3,r7 | ||
| 4320 | bicl2 #0,r7 | ||
| 4321 | cmpl r7,r3 | ||
| 4322 | bgequ noname.401 | ||
| 4323 | incl r9 | ||
| 4324 | noname.401: | ||
| 4325 | |||
| 4326 | movzwl 14(r2),r3 | ||
| 4327 | bicl3 #-65536,4(r2),r1 | ||
| 4328 | movzwl 6(r2),r0 | ||
| 4329 | bicl2 #-65536,r0 | ||
| 4330 | bicl3 #-65536,12(r2),-100(fp) | ||
| 4331 | bicl3 #-65536,r3,-104(fp) | ||
| 4332 | mull3 r0,-100(fp),-92(fp) | ||
| 4333 | mull2 r1,-100(fp) | ||
| 4334 | mull3 r1,-104(fp),-96(fp) | ||
| 4335 | mull2 r0,-104(fp) | ||
| 4336 | addl3 -92(fp),-96(fp),r0 | ||
| 4337 | bicl3 #0,r0,-92(fp) | ||
| 4338 | cmpl -92(fp),-96(fp) | ||
| 4339 | bgequ noname.402 | ||
| 4340 | addl2 #65536,-104(fp) | ||
| 4341 | noname.402: | ||
| 4342 | movzwl -90(fp),r0 | ||
| 4343 | bicl2 #-65536,r0 | ||
| 4344 | addl2 r0,-104(fp) | ||
| 4345 | bicl3 #-65536,-92(fp),r0 | ||
| 4346 | ashl #16,r0,-96(fp) | ||
| 4347 | addl3 -96(fp),-100(fp),r0 | ||
| 4348 | bicl3 #0,r0,-100(fp) | ||
| 4349 | cmpl -100(fp),-96(fp) | ||
| 4350 | bgequ noname.403 | ||
| 4351 | incl -104(fp) | ||
| 4352 | noname.403: | ||
| 4353 | movl -100(fp),r3 | ||
| 4354 | movl -104(fp),r2 | ||
| 4355 | bbc #31,r2,noname.404 | ||
| 4356 | incl r9 | ||
| 4357 | noname.404: | ||
| 4358 | addl2 r2,r2 | ||
| 4359 | bicl2 #0,r2 | ||
| 4360 | bbc #31,r3,noname.405 | ||
| 4361 | incl r2 | ||
| 4362 | noname.405: | ||
| 4363 | addl2 r3,r3 | ||
| 4364 | bicl2 #0,r3 | ||
| 4365 | addl2 r3,r8 | ||
| 4366 | bicl2 #0,r8 | ||
| 4367 | cmpl r8,r3 | ||
| 4368 | bgequ noname.406 | ||
| 4369 | incl r2 | ||
| 4370 | bicl3 #0,r2,r0 | ||
| 4371 | bneq noname.406 | ||
| 4372 | incl r9 | ||
| 4373 | noname.406: | ||
| 4374 | addl2 r2,r7 | ||
| 4375 | bicl2 #0,r7 | ||
| 4376 | cmpl r7,r2 | ||
| 4377 | bgequ noname.407 | ||
| 4378 | incl r9 | ||
| 4379 | noname.407: | ||
| 4380 | |||
| 4381 | movl 8(ap),r0 | ||
| 4382 | movzwl 18(r0),r2 | ||
| 4383 | bicl3 #-65536,(r0),r3 | ||
| 4384 | movzwl 2(r0),r1 | ||
| 4385 | bicl2 #-65536,r1 | ||
| 4386 | bicl3 #-65536,16(r0),-116(fp) | ||
| 4387 | bicl3 #-65536,r2,-120(fp) | ||
| 4388 | mull3 r1,-116(fp),-108(fp) | ||
| 4389 | mull2 r3,-116(fp) | ||
| 4390 | mull3 r3,-120(fp),-112(fp) | ||
| 4391 | mull2 r1,-120(fp) | ||
| 4392 | addl3 -108(fp),-112(fp),r0 | ||
| 4393 | bicl3 #0,r0,-108(fp) | ||
| 4394 | cmpl -108(fp),-112(fp) | ||
| 4395 | bgequ noname.408 | ||
| 4396 | addl2 #65536,-120(fp) | ||
| 4397 | noname.408: | ||
| 4398 | movzwl -106(fp),r0 | ||
| 4399 | bicl2 #-65536,r0 | ||
| 4400 | addl2 r0,-120(fp) | ||
| 4401 | bicl3 #-65536,-108(fp),r0 | ||
| 4402 | ashl #16,r0,-112(fp) | ||
| 4403 | addl3 -112(fp),-116(fp),r0 | ||
| 4404 | bicl3 #0,r0,-116(fp) | ||
| 4405 | cmpl -116(fp),-112(fp) | ||
| 4406 | bgequ noname.409 | ||
| 4407 | incl -120(fp) | ||
| 4408 | noname.409: | ||
| 4409 | movl -116(fp),r3 | ||
| 4410 | movl -120(fp),r2 | ||
| 4411 | bbc #31,r2,noname.410 | ||
| 4412 | incl r9 | ||
| 4413 | noname.410: | ||
| 4414 | addl2 r2,r2 | ||
| 4415 | bicl2 #0,r2 | ||
| 4416 | bbc #31,r3,noname.411 | ||
| 4417 | incl r2 | ||
| 4418 | noname.411: | ||
| 4419 | addl2 r3,r3 | ||
| 4420 | bicl2 #0,r3 | ||
| 4421 | addl2 r3,r8 | ||
| 4422 | bicl2 #0,r8 | ||
| 4423 | cmpl r8,r3 | ||
| 4424 | bgequ noname.412 | ||
| 4425 | incl r2 | ||
| 4426 | bicl3 #0,r2,r0 | ||
| 4427 | bneq noname.412 | ||
| 4428 | incl r9 | ||
| 4429 | noname.412: | ||
| 4430 | addl2 r2,r7 | ||
| 4431 | bicl2 #0,r7 | ||
| 4432 | cmpl r7,r2 | ||
| 4433 | bgequ noname.413 | ||
| 4434 | incl r9 | ||
| 4435 | noname.413: | ||
| 4436 | |||
| 4437 | movl 4(ap),r0 | ||
| 4438 | movl r8,16(r0) | ||
| 4439 | |||
| 4440 | clrl r8 | ||
| 4441 | |||
| 4442 | movl 8(ap),r0 | ||
| 4443 | movzwl 22(r0),r2 | ||
| 4444 | bicl3 #-65536,(r0),r3 | ||
| 4445 | movzwl 2(r0),r1 | ||
| 4446 | bicl2 #-65536,r1 | ||
| 4447 | bicl3 #-65536,20(r0),-132(fp) | ||
| 4448 | bicl3 #-65536,r2,-136(fp) | ||
| 4449 | mull3 r1,-132(fp),-124(fp) | ||
| 4450 | mull2 r3,-132(fp) | ||
| 4451 | mull3 r3,-136(fp),-128(fp) | ||
| 4452 | mull2 r1,-136(fp) | ||
| 4453 | addl3 -124(fp),-128(fp),r0 | ||
| 4454 | bicl3 #0,r0,-124(fp) | ||
| 4455 | cmpl -124(fp),-128(fp) | ||
| 4456 | bgequ noname.414 | ||
| 4457 | addl2 #65536,-136(fp) | ||
| 4458 | noname.414: | ||
| 4459 | movzwl -122(fp),r0 | ||
| 4460 | bicl2 #-65536,r0 | ||
| 4461 | addl2 r0,-136(fp) | ||
| 4462 | bicl3 #-65536,-124(fp),r0 | ||
| 4463 | ashl #16,r0,-128(fp) | ||
| 4464 | addl3 -128(fp),-132(fp),r0 | ||
| 4465 | bicl3 #0,r0,-132(fp) | ||
| 4466 | cmpl -132(fp),-128(fp) | ||
| 4467 | bgequ noname.415 | ||
| 4468 | incl -136(fp) | ||
| 4469 | noname.415: | ||
| 4470 | movl -132(fp),r3 | ||
| 4471 | movl -136(fp),r2 | ||
| 4472 | bbc #31,r2,noname.416 | ||
| 4473 | incl r8 | ||
| 4474 | noname.416: | ||
| 4475 | addl2 r2,r2 | ||
| 4476 | bicl2 #0,r2 | ||
| 4477 | bbc #31,r3,noname.417 | ||
| 4478 | incl r2 | ||
| 4479 | noname.417: | ||
| 4480 | addl2 r3,r3 | ||
| 4481 | bicl2 #0,r3 | ||
| 4482 | addl2 r3,r7 | ||
| 4483 | bicl2 #0,r7 | ||
| 4484 | cmpl r7,r3 | ||
| 4485 | bgequ noname.418 | ||
| 4486 | incl r2 | ||
| 4487 | bicl3 #0,r2,r0 | ||
| 4488 | bneq noname.418 | ||
| 4489 | incl r8 | ||
| 4490 | noname.418: | ||
| 4491 | addl2 r2,r9 | ||
| 4492 | bicl2 #0,r9 | ||
| 4493 | cmpl r9,r2 | ||
| 4494 | bgequ noname.419 | ||
| 4495 | incl r8 | ||
| 4496 | noname.419: | ||
| 4497 | |||
| 4498 | movl 8(ap),r0 | ||
| 4499 | movzwl 18(r0),r2 | ||
| 4500 | bicl3 #-65536,4(r0),r3 | ||
| 4501 | movzwl 6(r0),r1 | ||
| 4502 | bicl2 #-65536,r1 | ||
| 4503 | bicl3 #-65536,16(r0),-148(fp) | ||
| 4504 | bicl3 #-65536,r2,-152(fp) | ||
| 4505 | mull3 r1,-148(fp),-140(fp) | ||
| 4506 | mull2 r3,-148(fp) | ||
| 4507 | mull3 r3,-152(fp),-144(fp) | ||
| 4508 | mull2 r1,-152(fp) | ||
| 4509 | addl3 -140(fp),-144(fp),r0 | ||
| 4510 | bicl3 #0,r0,-140(fp) | ||
| 4511 | cmpl -140(fp),-144(fp) | ||
| 4512 | bgequ noname.420 | ||
| 4513 | addl2 #65536,-152(fp) | ||
| 4514 | noname.420: | ||
| 4515 | movzwl -138(fp),r0 | ||
| 4516 | bicl2 #-65536,r0 | ||
| 4517 | addl2 r0,-152(fp) | ||
| 4518 | bicl3 #-65536,-140(fp),r0 | ||
| 4519 | ashl #16,r0,-144(fp) | ||
| 4520 | addl3 -144(fp),-148(fp),r0 | ||
| 4521 | bicl3 #0,r0,-148(fp) | ||
| 4522 | cmpl -148(fp),-144(fp) | ||
| 4523 | bgequ noname.421 | ||
| 4524 | incl -152(fp) | ||
| 4525 | noname.421: | ||
| 4526 | movl -148(fp),r3 | ||
| 4527 | movl -152(fp),r2 | ||
| 4528 | bbc #31,r2,noname.422 | ||
| 4529 | incl r8 | ||
| 4530 | noname.422: | ||
| 4531 | addl2 r2,r2 | ||
| 4532 | bicl2 #0,r2 | ||
| 4533 | bbc #31,r3,noname.423 | ||
| 4534 | incl r2 | ||
| 4535 | noname.423: | ||
| 4536 | addl2 r3,r3 | ||
| 4537 | bicl2 #0,r3 | ||
| 4538 | addl2 r3,r7 | ||
| 4539 | bicl2 #0,r7 | ||
| 4540 | cmpl r7,r3 | ||
| 4541 | bgequ noname.424 | ||
| 4542 | incl r2 | ||
| 4543 | bicl3 #0,r2,r0 | ||
| 4544 | bneq noname.424 | ||
| 4545 | incl r8 | ||
| 4546 | noname.424: | ||
| 4547 | addl2 r2,r9 | ||
| 4548 | bicl2 #0,r9 | ||
| 4549 | cmpl r9,r2 | ||
| 4550 | bgequ noname.425 | ||
| 4551 | incl r8 | ||
| 4552 | noname.425: | ||
| 4553 | |||
| 4554 | movl 8(ap),r0 | ||
| 4555 | movzwl 14(r0),r2 | ||
| 4556 | bicl3 #-65536,8(r0),r3 | ||
| 4557 | movzwl 10(r0),r1 | ||
| 4558 | bicl2 #-65536,r1 | ||
| 4559 | bicl3 #-65536,12(r0),-164(fp) | ||
| 4560 | bicl3 #-65536,r2,-168(fp) | ||
| 4561 | mull3 r1,-164(fp),-156(fp) | ||
| 4562 | mull2 r3,-164(fp) | ||
| 4563 | mull3 r3,-168(fp),-160(fp) | ||
| 4564 | mull2 r1,-168(fp) | ||
| 4565 | addl3 -156(fp),-160(fp),r0 | ||
| 4566 | bicl3 #0,r0,-156(fp) | ||
| 4567 | cmpl -156(fp),-160(fp) | ||
| 4568 | bgequ noname.426 | ||
| 4569 | addl2 #65536,-168(fp) | ||
| 4570 | noname.426: | ||
| 4571 | movzwl -154(fp),r0 | ||
| 4572 | bicl2 #-65536,r0 | ||
| 4573 | addl2 r0,-168(fp) | ||
| 4574 | bicl3 #-65536,-156(fp),r0 | ||
| 4575 | ashl #16,r0,-160(fp) | ||
| 4576 | addl3 -160(fp),-164(fp),r0 | ||
| 4577 | bicl3 #0,r0,-164(fp) | ||
| 4578 | cmpl -164(fp),-160(fp) | ||
| 4579 | bgequ noname.427 | ||
| 4580 | incl -168(fp) | ||
| 4581 | noname.427: | ||
| 4582 | movl -164(fp),r3 | ||
| 4583 | movl -168(fp),r2 | ||
| 4584 | bbc #31,r2,noname.428 | ||
| 4585 | incl r8 | ||
| 4586 | noname.428: | ||
| 4587 | addl2 r2,r2 | ||
| 4588 | bicl2 #0,r2 | ||
| 4589 | bbc #31,r3,noname.429 | ||
| 4590 | incl r2 | ||
| 4591 | noname.429: | ||
| 4592 | addl2 r3,r3 | ||
| 4593 | bicl2 #0,r3 | ||
| 4594 | addl2 r3,r7 | ||
| 4595 | bicl2 #0,r7 | ||
| 4596 | cmpl r7,r3 | ||
| 4597 | bgequ noname.430 | ||
| 4598 | incl r2 | ||
| 4599 | bicl3 #0,r2,r0 | ||
| 4600 | bneq noname.430 | ||
| 4601 | incl r8 | ||
| 4602 | noname.430: | ||
| 4603 | addl2 r2,r9 | ||
| 4604 | bicl2 #0,r9 | ||
| 4605 | cmpl r9,r2 | ||
| 4606 | bgequ noname.431 | ||
| 4607 | incl r8 | ||
| 4608 | noname.431: | ||
| 4609 | |||
| 4610 | movl 4(ap),r0 | ||
| 4611 | movl r7,20(r0) | ||
| 4612 | |||
| 4613 | clrl r7 | ||
| 4614 | |||
| 4615 | movl 8(ap),r2 | ||
| 4616 | movl 12(r2),r4 | ||
| 4617 | bicl3 #-65536,r4,-172(fp) | ||
| 4618 | extzv #16,#16,r4,r0 | ||
| 4619 | bicl3 #-65536,r0,r4 | ||
| 4620 | movl -172(fp),r0 | ||
| 4621 | mull3 r0,r4,-176(fp) | ||
| 4622 | mull3 r0,r0,-172(fp) | ||
| 4623 | mull2 r4,r4 | ||
| 4624 | bicl3 #32767,-176(fp),r0 | ||
| 4625 | extzv #15,#17,r0,r0 | ||
| 4626 | addl2 r0,r4 | ||
| 4627 | bicl3 #-65536,-176(fp),r0 | ||
| 4628 | ashl #17,r0,-176(fp) | ||
| 4629 | addl3 -172(fp),-176(fp),r0 | ||
| 4630 | bicl3 #0,r0,-172(fp) | ||
| 4631 | cmpl -172(fp),-176(fp) | ||
| 4632 | bgequ noname.432 | ||
| 4633 | incl r4 | ||
| 4634 | noname.432: | ||
| 4635 | movl -172(fp),r1 | ||
| 4636 | movl r4,r3 | ||
| 4637 | addl2 r1,r9 | ||
| 4638 | bicl2 #0,r9 | ||
| 4639 | cmpl r9,r1 | ||
| 4640 | bgequ noname.433 | ||
| 4641 | incl r3 | ||
| 4642 | noname.433: | ||
| 4643 | addl2 r3,r8 | ||
| 4644 | bicl2 #0,r8 | ||
| 4645 | cmpl r8,r3 | ||
| 4646 | bgequ noname.434 | ||
| 4647 | incl r7 | ||
| 4648 | noname.434: | ||
| 4649 | |||
| 4650 | movzwl 18(r2),r3 | ||
| 4651 | bicl3 #-65536,8(r2),r1 | ||
| 4652 | movzwl 10(r2),r0 | ||
| 4653 | bicl2 #-65536,r0 | ||
| 4654 | bicl3 #-65536,16(r2),-188(fp) | ||
| 4655 | bicl3 #-65536,r3,-192(fp) | ||
| 4656 | mull3 r0,-188(fp),-180(fp) | ||
| 4657 | mull2 r1,-188(fp) | ||
| 4658 | mull3 r1,-192(fp),-184(fp) | ||
| 4659 | mull2 r0,-192(fp) | ||
| 4660 | addl3 -180(fp),-184(fp),r0 | ||
| 4661 | bicl3 #0,r0,-180(fp) | ||
| 4662 | cmpl -180(fp),-184(fp) | ||
| 4663 | bgequ noname.435 | ||
| 4664 | addl2 #65536,-192(fp) | ||
| 4665 | noname.435: | ||
| 4666 | movzwl -178(fp),r0 | ||
| 4667 | bicl2 #-65536,r0 | ||
| 4668 | addl2 r0,-192(fp) | ||
| 4669 | bicl3 #-65536,-180(fp),r0 | ||
| 4670 | ashl #16,r0,-184(fp) | ||
| 4671 | addl3 -184(fp),-188(fp),r0 | ||
| 4672 | bicl3 #0,r0,-188(fp) | ||
| 4673 | cmpl -188(fp),-184(fp) | ||
| 4674 | bgequ noname.436 | ||
| 4675 | incl -192(fp) | ||
| 4676 | noname.436: | ||
| 4677 | movl -188(fp),r3 | ||
| 4678 | movl -192(fp),r2 | ||
| 4679 | bbc #31,r2,noname.437 | ||
| 4680 | incl r7 | ||
| 4681 | noname.437: | ||
| 4682 | addl2 r2,r2 | ||
| 4683 | bicl2 #0,r2 | ||
| 4684 | bbc #31,r3,noname.438 | ||
| 4685 | incl r2 | ||
| 4686 | noname.438: | ||
| 4687 | addl2 r3,r3 | ||
| 4688 | bicl2 #0,r3 | ||
| 4689 | addl2 r3,r9 | ||
| 4690 | bicl2 #0,r9 | ||
| 4691 | cmpl r9,r3 | ||
| 4692 | bgequ noname.439 | ||
| 4693 | incl r2 | ||
| 4694 | bicl3 #0,r2,r0 | ||
| 4695 | bneq noname.439 | ||
| 4696 | incl r7 | ||
| 4697 | noname.439: | ||
| 4698 | addl2 r2,r8 | ||
| 4699 | bicl2 #0,r8 | ||
| 4700 | cmpl r8,r2 | ||
| 4701 | bgequ noname.440 | ||
| 4702 | incl r7 | ||
| 4703 | noname.440: | ||
| 4704 | |||
| 4705 | movl 8(ap),r0 | ||
| 4706 | movzwl 22(r0),r2 | ||
| 4707 | bicl3 #-65536,4(r0),r3 | ||
| 4708 | movzwl 6(r0),r1 | ||
| 4709 | bicl2 #-65536,r1 | ||
| 4710 | bicl3 #-65536,20(r0),-204(fp) | ||
| 4711 | bicl3 #-65536,r2,-208(fp) | ||
| 4712 | mull3 r1,-204(fp),-196(fp) | ||
| 4713 | mull2 r3,-204(fp) | ||
| 4714 | mull3 r3,-208(fp),-200(fp) | ||
| 4715 | mull2 r1,-208(fp) | ||
| 4716 | addl3 -196(fp),-200(fp),r0 | ||
| 4717 | bicl3 #0,r0,-196(fp) | ||
| 4718 | cmpl -196(fp),-200(fp) | ||
| 4719 | bgequ noname.441 | ||
| 4720 | addl2 #65536,-208(fp) | ||
| 4721 | noname.441: | ||
| 4722 | movzwl -194(fp),r0 | ||
| 4723 | bicl2 #-65536,r0 | ||
| 4724 | addl2 r0,-208(fp) | ||
| 4725 | bicl3 #-65536,-196(fp),r0 | ||
| 4726 | ashl #16,r0,-200(fp) | ||
| 4727 | addl3 -200(fp),-204(fp),r0 | ||
| 4728 | bicl3 #0,r0,-204(fp) | ||
| 4729 | cmpl -204(fp),-200(fp) | ||
| 4730 | bgequ noname.442 | ||
| 4731 | incl -208(fp) | ||
| 4732 | noname.442: | ||
| 4733 | movl -204(fp),r3 | ||
| 4734 | movl -208(fp),r2 | ||
| 4735 | bbc #31,r2,noname.443 | ||
| 4736 | incl r7 | ||
| 4737 | noname.443: | ||
| 4738 | addl2 r2,r2 | ||
| 4739 | bicl2 #0,r2 | ||
| 4740 | bbc #31,r3,noname.444 | ||
| 4741 | incl r2 | ||
| 4742 | noname.444: | ||
| 4743 | addl2 r3,r3 | ||
| 4744 | bicl2 #0,r3 | ||
| 4745 | addl2 r3,r9 | ||
| 4746 | bicl2 #0,r9 | ||
| 4747 | cmpl r9,r3 | ||
| 4748 | bgequ noname.445 | ||
| 4749 | incl r2 | ||
| 4750 | bicl3 #0,r2,r0 | ||
| 4751 | bneq noname.445 | ||
| 4752 | incl r7 | ||
| 4753 | noname.445: | ||
| 4754 | addl2 r2,r8 | ||
| 4755 | bicl2 #0,r8 | ||
| 4756 | cmpl r8,r2 | ||
| 4757 | bgequ noname.446 | ||
| 4758 | incl r7 | ||
| 4759 | noname.446: | ||
| 4760 | |||
| 4761 | movl 8(ap),r0 | ||
| 4762 | movzwl 26(r0),r2 | ||
| 4763 | bicl3 #-65536,(r0),r3 | ||
| 4764 | movzwl 2(r0),r1 | ||
| 4765 | bicl2 #-65536,r1 | ||
| 4766 | bicl3 #-65536,24(r0),-220(fp) | ||
| 4767 | bicl3 #-65536,r2,-224(fp) | ||
| 4768 | mull3 r1,-220(fp),-212(fp) | ||
| 4769 | mull2 r3,-220(fp) | ||
| 4770 | mull3 r3,-224(fp),-216(fp) | ||
| 4771 | mull2 r1,-224(fp) | ||
| 4772 | addl3 -212(fp),-216(fp),r0 | ||
| 4773 | bicl3 #0,r0,-212(fp) | ||
| 4774 | cmpl -212(fp),-216(fp) | ||
| 4775 | bgequ noname.447 | ||
| 4776 | addl2 #65536,-224(fp) | ||
| 4777 | noname.447: | ||
| 4778 | movzwl -210(fp),r0 | ||
| 4779 | bicl2 #-65536,r0 | ||
| 4780 | addl2 r0,-224(fp) | ||
| 4781 | bicl3 #-65536,-212(fp),r0 | ||
| 4782 | ashl #16,r0,-216(fp) | ||
| 4783 | addl3 -216(fp),-220(fp),r0 | ||
| 4784 | bicl3 #0,r0,-220(fp) | ||
| 4785 | cmpl -220(fp),-216(fp) | ||
| 4786 | bgequ noname.448 | ||
| 4787 | incl -224(fp) | ||
| 4788 | noname.448: | ||
| 4789 | movl -220(fp),r3 | ||
| 4790 | movl -224(fp),r2 | ||
| 4791 | bbc #31,r2,noname.449 | ||
| 4792 | incl r7 | ||
| 4793 | noname.449: | ||
| 4794 | addl2 r2,r2 | ||
| 4795 | bicl2 #0,r2 | ||
| 4796 | bbc #31,r3,noname.450 | ||
| 4797 | incl r2 | ||
| 4798 | noname.450: | ||
| 4799 | addl2 r3,r3 | ||
| 4800 | bicl2 #0,r3 | ||
| 4801 | addl2 r3,r9 | ||
| 4802 | bicl2 #0,r9 | ||
| 4803 | cmpl r9,r3 | ||
| 4804 | bgequ noname.451 | ||
| 4805 | incl r2 | ||
| 4806 | bicl3 #0,r2,r0 | ||
| 4807 | bneq noname.451 | ||
| 4808 | incl r7 | ||
| 4809 | noname.451: | ||
| 4810 | addl2 r2,r8 | ||
| 4811 | bicl2 #0,r8 | ||
| 4812 | cmpl r8,r2 | ||
| 4813 | bgequ noname.452 | ||
| 4814 | incl r7 | ||
| 4815 | noname.452: | ||
| 4816 | |||
| 4817 | movl 4(ap),r0 | ||
| 4818 | movl r9,24(r0) | ||
| 4819 | |||
| 4820 | clrl r9 | ||
| 4821 | |||
| 4822 | movl 8(ap),r0 | ||
| 4823 | movzwl 30(r0),r2 | ||
| 4824 | bicl3 #-65536,(r0),r3 | ||
| 4825 | movzwl 2(r0),r1 | ||
| 4826 | bicl2 #-65536,r1 | ||
| 4827 | bicl3 #-65536,28(r0),-236(fp) | ||
| 4828 | bicl3 #-65536,r2,-240(fp) | ||
| 4829 | mull3 r1,-236(fp),-228(fp) | ||
| 4830 | mull2 r3,-236(fp) | ||
| 4831 | mull3 r3,-240(fp),-232(fp) | ||
| 4832 | mull2 r1,-240(fp) | ||
| 4833 | addl3 -228(fp),-232(fp),r0 | ||
| 4834 | bicl3 #0,r0,-228(fp) | ||
| 4835 | cmpl -228(fp),-232(fp) | ||
| 4836 | bgequ noname.453 | ||
| 4837 | addl2 #65536,-240(fp) | ||
| 4838 | noname.453: | ||
| 4839 | movzwl -226(fp),r0 | ||
| 4840 | bicl2 #-65536,r0 | ||
| 4841 | addl2 r0,-240(fp) | ||
| 4842 | bicl3 #-65536,-228(fp),r0 | ||
| 4843 | ashl #16,r0,-232(fp) | ||
| 4844 | addl3 -232(fp),-236(fp),r0 | ||
| 4845 | bicl3 #0,r0,-236(fp) | ||
| 4846 | cmpl -236(fp),-232(fp) | ||
| 4847 | bgequ noname.454 | ||
| 4848 | incl -240(fp) | ||
| 4849 | noname.454: | ||
| 4850 | movl -236(fp),r3 | ||
| 4851 | movl -240(fp),r2 | ||
| 4852 | bbc #31,r2,noname.455 | ||
| 4853 | incl r9 | ||
| 4854 | noname.455: | ||
| 4855 | addl2 r2,r2 | ||
| 4856 | bicl2 #0,r2 | ||
| 4857 | bbc #31,r3,noname.456 | ||
| 4858 | incl r2 | ||
| 4859 | noname.456: | ||
| 4860 | addl2 r3,r3 | ||
| 4861 | bicl2 #0,r3 | ||
| 4862 | addl2 r3,r8 | ||
| 4863 | bicl2 #0,r8 | ||
| 4864 | cmpl r8,r3 | ||
| 4865 | bgequ noname.457 | ||
| 4866 | incl r2 | ||
| 4867 | bicl3 #0,r2,r0 | ||
| 4868 | bneq noname.457 | ||
| 4869 | incl r9 | ||
| 4870 | noname.457: | ||
| 4871 | addl2 r2,r7 | ||
| 4872 | bicl2 #0,r7 | ||
| 4873 | cmpl r7,r2 | ||
| 4874 | bgequ noname.458 | ||
| 4875 | incl r9 | ||
| 4876 | noname.458: | ||
| 4877 | |||
| 4878 | movl 8(ap),r0 | ||
| 4879 | movzwl 26(r0),r2 | ||
| 4880 | bicl3 #-65536,4(r0),r3 | ||
| 4881 | movzwl 6(r0),r1 | ||
| 4882 | bicl2 #-65536,r1 | ||
| 4883 | bicl3 #-65536,24(r0),-252(fp) | ||
| 4884 | bicl3 #-65536,r2,-256(fp) | ||
| 4885 | mull3 r1,-252(fp),-244(fp) | ||
| 4886 | mull2 r3,-252(fp) | ||
| 4887 | mull3 r3,-256(fp),-248(fp) | ||
| 4888 | mull2 r1,-256(fp) | ||
| 4889 | addl3 -244(fp),-248(fp),r0 | ||
| 4890 | bicl3 #0,r0,-244(fp) | ||
| 4891 | cmpl -244(fp),-248(fp) | ||
| 4892 | bgequ noname.459 | ||
| 4893 | addl2 #65536,-256(fp) | ||
| 4894 | noname.459: | ||
| 4895 | movzwl -242(fp),r0 | ||
| 4896 | bicl2 #-65536,r0 | ||
| 4897 | addl2 r0,-256(fp) | ||
| 4898 | bicl3 #-65536,-244(fp),r0 | ||
| 4899 | ashl #16,r0,-248(fp) | ||
| 4900 | addl3 -248(fp),-252(fp),r0 | ||
| 4901 | bicl3 #0,r0,-252(fp) | ||
| 4902 | cmpl -252(fp),-248(fp) | ||
| 4903 | bgequ noname.460 | ||
| 4904 | incl -256(fp) | ||
| 4905 | noname.460: | ||
| 4906 | movl -252(fp),r3 | ||
| 4907 | movl -256(fp),r2 | ||
| 4908 | bbc #31,r2,noname.461 | ||
| 4909 | incl r9 | ||
| 4910 | noname.461: | ||
| 4911 | addl2 r2,r2 | ||
| 4912 | bicl2 #0,r2 | ||
| 4913 | bbc #31,r3,noname.462 | ||
| 4914 | incl r2 | ||
| 4915 | noname.462: | ||
| 4916 | addl2 r3,r3 | ||
| 4917 | bicl2 #0,r3 | ||
| 4918 | addl2 r3,r8 | ||
| 4919 | bicl2 #0,r8 | ||
| 4920 | cmpl r8,r3 | ||
| 4921 | bgequ noname.463 | ||
| 4922 | incl r2 | ||
| 4923 | bicl3 #0,r2,r0 | ||
| 4924 | bneq noname.463 | ||
| 4925 | incl r9 | ||
| 4926 | noname.463: | ||
| 4927 | addl2 r2,r7 | ||
| 4928 | bicl2 #0,r7 | ||
| 4929 | cmpl r7,r2 | ||
| 4930 | bgequ noname.464 | ||
| 4931 | incl r9 | ||
| 4932 | noname.464: | ||
| 4933 | |||
| 4934 | movl 8(ap),r0 | ||
| 4935 | movzwl 22(r0),r2 | ||
| 4936 | bicl3 #-65536,8(r0),r3 | ||
| 4937 | movzwl 10(r0),r1 | ||
| 4938 | bicl2 #-65536,r1 | ||
| 4939 | bicl3 #-65536,20(r0),-268(fp) | ||
| 4940 | bicl3 #-65536,r2,-272(fp) | ||
| 4941 | mull3 r1,-268(fp),-260(fp) | ||
| 4942 | mull2 r3,-268(fp) | ||
| 4943 | mull3 r3,-272(fp),-264(fp) | ||
| 4944 | mull2 r1,-272(fp) | ||
| 4945 | addl3 -260(fp),-264(fp),r0 | ||
| 4946 | bicl3 #0,r0,-260(fp) | ||
| 4947 | cmpl -260(fp),-264(fp) | ||
| 4948 | bgequ noname.465 | ||
| 4949 | addl2 #65536,-272(fp) | ||
| 4950 | noname.465: | ||
| 4951 | movzwl -258(fp),r0 | ||
| 4952 | bicl2 #-65536,r0 | ||
| 4953 | addl2 r0,-272(fp) | ||
| 4954 | bicl3 #-65536,-260(fp),r0 | ||
| 4955 | ashl #16,r0,-264(fp) | ||
| 4956 | addl3 -264(fp),-268(fp),r0 | ||
| 4957 | bicl3 #0,r0,-268(fp) | ||
| 4958 | cmpl -268(fp),-264(fp) | ||
| 4959 | bgequ noname.466 | ||
| 4960 | incl -272(fp) | ||
| 4961 | noname.466: | ||
| 4962 | movl -268(fp),r3 | ||
| 4963 | movl -272(fp),r2 | ||
| 4964 | bbc #31,r2,noname.467 | ||
| 4965 | incl r9 | ||
| 4966 | noname.467: | ||
| 4967 | addl2 r2,r2 | ||
| 4968 | bicl2 #0,r2 | ||
| 4969 | bbc #31,r3,noname.468 | ||
| 4970 | incl r2 | ||
| 4971 | noname.468: | ||
| 4972 | addl2 r3,r3 | ||
| 4973 | bicl2 #0,r3 | ||
| 4974 | addl2 r3,r8 | ||
| 4975 | bicl2 #0,r8 | ||
| 4976 | cmpl r8,r3 | ||
| 4977 | bgequ noname.469 | ||
| 4978 | incl r2 | ||
| 4979 | bicl3 #0,r2,r0 | ||
| 4980 | bneq noname.469 | ||
| 4981 | incl r9 | ||
| 4982 | noname.469: | ||
| 4983 | addl2 r2,r7 | ||
| 4984 | bicl2 #0,r7 | ||
| 4985 | cmpl r7,r2 | ||
| 4986 | bgequ noname.470 | ||
| 4987 | incl r9 | ||
| 4988 | noname.470: | ||
| 4989 | |||
| 4990 | movl 8(ap),r0 | ||
| 4991 | movzwl 18(r0),r2 | ||
| 4992 | bicl3 #-65536,12(r0),r3 | ||
| 4993 | movzwl 14(r0),r1 | ||
| 4994 | bicl2 #-65536,r1 | ||
| 4995 | bicl3 #-65536,16(r0),-284(fp) | ||
| 4996 | bicl3 #-65536,r2,-288(fp) | ||
| 4997 | mull3 r1,-284(fp),-276(fp) | ||
| 4998 | mull2 r3,-284(fp) | ||
| 4999 | mull3 r3,-288(fp),-280(fp) | ||
| 5000 | mull2 r1,-288(fp) | ||
| 5001 | addl3 -276(fp),-280(fp),r0 | ||
| 5002 | bicl3 #0,r0,-276(fp) | ||
| 5003 | cmpl -276(fp),-280(fp) | ||
| 5004 | bgequ noname.471 | ||
| 5005 | addl2 #65536,-288(fp) | ||
| 5006 | noname.471: | ||
| 5007 | movzwl -274(fp),r0 | ||
| 5008 | bicl2 #-65536,r0 | ||
| 5009 | addl2 r0,-288(fp) | ||
| 5010 | bicl3 #-65536,-276(fp),r0 | ||
| 5011 | ashl #16,r0,-280(fp) | ||
| 5012 | addl3 -280(fp),-284(fp),r0 | ||
| 5013 | bicl3 #0,r0,-284(fp) | ||
| 5014 | cmpl -284(fp),-280(fp) | ||
| 5015 | bgequ noname.472 | ||
| 5016 | incl -288(fp) | ||
| 5017 | noname.472: | ||
| 5018 | movl -284(fp),r3 | ||
| 5019 | movl -288(fp),r2 | ||
| 5020 | bbc #31,r2,noname.473 | ||
| 5021 | incl r9 | ||
| 5022 | noname.473: | ||
| 5023 | addl2 r2,r2 | ||
| 5024 | bicl2 #0,r2 | ||
| 5025 | bbc #31,r3,noname.474 | ||
| 5026 | incl r2 | ||
| 5027 | noname.474: | ||
| 5028 | addl2 r3,r3 | ||
| 5029 | bicl2 #0,r3 | ||
| 5030 | addl2 r3,r8 | ||
| 5031 | bicl2 #0,r8 | ||
| 5032 | cmpl r8,r3 | ||
| 5033 | bgequ noname.475 | ||
| 5034 | incl r2 | ||
| 5035 | bicl3 #0,r2,r0 | ||
| 5036 | bneq noname.475 | ||
| 5037 | incl r9 | ||
| 5038 | noname.475: | ||
| 5039 | addl2 r2,r7 | ||
| 5040 | bicl2 #0,r7 | ||
| 5041 | cmpl r7,r2 | ||
| 5042 | bgequ noname.476 | ||
| 5043 | incl r9 | ||
| 5044 | noname.476: | ||
| 5045 | |||
| 5046 | movl 4(ap),r0 | ||
| 5047 | movl r8,28(r0) | ||
| 5048 | |||
| 5049 | clrl r8 | ||
| 5050 | |||
| 5051 | movl 8(ap),r3 | ||
| 5052 | movl 16(r3),r4 | ||
| 5053 | bicl3 #-65536,r4,r5 | ||
| 5054 | extzv #16,#16,r4,r0 | ||
| 5055 | bicl3 #-65536,r0,r4 | ||
| 5056 | mull3 r5,r4,-292(fp) | ||
| 5057 | mull2 r5,r5 | ||
| 5058 | mull2 r4,r4 | ||
| 5059 | bicl3 #32767,-292(fp),r0 | ||
| 5060 | extzv #15,#17,r0,r0 | ||
| 5061 | addl2 r0,r4 | ||
| 5062 | bicl3 #-65536,-292(fp),r0 | ||
| 5063 | ashl #17,r0,-292(fp) | ||
| 5064 | addl2 -292(fp),r5 | ||
| 5065 | bicl2 #0,r5 | ||
| 5066 | cmpl r5,-292(fp) | ||
| 5067 | bgequ noname.477 | ||
| 5068 | incl r4 | ||
| 5069 | noname.477: | ||
| 5070 | movl r5,r1 | ||
| 5071 | movl r4,r2 | ||
| 5072 | addl2 r1,r7 | ||
| 5073 | bicl2 #0,r7 | ||
| 5074 | cmpl r7,r1 | ||
| 5075 | bgequ noname.478 | ||
| 5076 | incl r2 | ||
| 5077 | noname.478: | ||
| 5078 | addl2 r2,r9 | ||
| 5079 | bicl2 #0,r9 | ||
| 5080 | cmpl r9,r2 | ||
| 5081 | bgequ noname.479 | ||
| 5082 | incl r8 | ||
| 5083 | noname.479: | ||
| 5084 | |||
| 5085 | bicl3 #-65536,20(r3),r4 | ||
| 5086 | movzwl 22(r3),r1 | ||
| 5087 | bicl2 #-65536,r1 | ||
| 5088 | bicl3 #-65536,12(r3),r2 | ||
| 5089 | movzwl 14(r3),r0 | ||
| 5090 | bicl2 #-65536,r0 | ||
| 5091 | movl r4,r6 | ||
| 5092 | movl r1,r5 | ||
| 5093 | mull3 r0,r6,-296(fp) | ||
| 5094 | mull2 r2,r6 | ||
| 5095 | mull3 r2,r5,-300(fp) | ||
| 5096 | mull2 r0,r5 | ||
| 5097 | addl3 -296(fp),-300(fp),r0 | ||
| 5098 | bicl3 #0,r0,-296(fp) | ||
| 5099 | cmpl -296(fp),-300(fp) | ||
| 5100 | bgequ noname.480 | ||
| 5101 | addl2 #65536,r5 | ||
| 5102 | noname.480: | ||
| 5103 | movzwl -294(fp),r0 | ||
| 5104 | bicl2 #-65536,r0 | ||
| 5105 | addl2 r0,r5 | ||
| 5106 | bicl3 #-65536,-296(fp),r0 | ||
| 5107 | ashl #16,r0,-300(fp) | ||
| 5108 | addl2 -300(fp),r6 | ||
| 5109 | bicl2 #0,r6 | ||
| 5110 | cmpl r6,-300(fp) | ||
| 5111 | bgequ noname.481 | ||
| 5112 | incl r5 | ||
| 5113 | noname.481: | ||
| 5114 | movl r6,r3 | ||
| 5115 | movl r5,r2 | ||
| 5116 | bbc #31,r2,noname.482 | ||
| 5117 | incl r8 | ||
| 5118 | noname.482: | ||
| 5119 | addl2 r2,r2 | ||
| 5120 | bicl2 #0,r2 | ||
| 5121 | bbc #31,r3,noname.483 | ||
| 5122 | incl r2 | ||
| 5123 | noname.483: | ||
| 5124 | addl2 r3,r3 | ||
| 5125 | bicl2 #0,r3 | ||
| 5126 | addl2 r3,r7 | ||
| 5127 | bicl2 #0,r7 | ||
| 5128 | cmpl r7,r3 | ||
| 5129 | bgequ noname.484 | ||
| 5130 | incl r2 | ||
| 5131 | bicl3 #0,r2,r0 | ||
| 5132 | bneq noname.484 | ||
| 5133 | incl r8 | ||
| 5134 | noname.484: | ||
| 5135 | addl2 r2,r9 | ||
| 5136 | bicl2 #0,r9 | ||
| 5137 | cmpl r9,r2 | ||
| 5138 | bgequ noname.485 | ||
| 5139 | incl r8 | ||
| 5140 | noname.485: | ||
| 5141 | |||
| 5142 | movl 8(ap),r0 | ||
| 5143 | bicl3 #-65536,24(r0),r3 | ||
| 5144 | movzwl 26(r0),r1 | ||
| 5145 | bicl2 #-65536,r1 | ||
| 5146 | bicl3 #-65536,8(r0),r2 | ||
| 5147 | movzwl 10(r0),r0 | ||
| 5148 | bicl2 #-65536,r0 | ||
| 5149 | movl r3,r5 | ||
| 5150 | movl r1,r4 | ||
| 5151 | mull3 r0,r5,-304(fp) | ||
| 5152 | mull2 r2,r5 | ||
| 5153 | mull3 r2,r4,-308(fp) | ||
| 5154 | mull2 r0,r4 | ||
| 5155 | addl3 -304(fp),-308(fp),r0 | ||
| 5156 | bicl3 #0,r0,-304(fp) | ||
| 5157 | cmpl -304(fp),-308(fp) | ||
| 5158 | bgequ noname.486 | ||
| 5159 | addl2 #65536,r4 | ||
| 5160 | noname.486: | ||
| 5161 | movzwl -302(fp),r0 | ||
| 5162 | bicl2 #-65536,r0 | ||
| 5163 | addl2 r0,r4 | ||
| 5164 | bicl3 #-65536,-304(fp),r0 | ||
| 5165 | ashl #16,r0,-308(fp) | ||
| 5166 | addl2 -308(fp),r5 | ||
| 5167 | bicl2 #0,r5 | ||
| 5168 | cmpl r5,-308(fp) | ||
| 5169 | bgequ noname.487 | ||
| 5170 | incl r4 | ||
| 5171 | noname.487: | ||
| 5172 | movl r5,r3 | ||
| 5173 | movl r4,r2 | ||
| 5174 | bbc #31,r2,noname.488 | ||
| 5175 | incl r8 | ||
| 5176 | noname.488: | ||
| 5177 | addl2 r2,r2 | ||
| 5178 | bicl2 #0,r2 | ||
| 5179 | bbc #31,r3,noname.489 | ||
| 5180 | incl r2 | ||
| 5181 | noname.489: | ||
| 5182 | addl2 r3,r3 | ||
| 5183 | bicl2 #0,r3 | ||
| 5184 | addl2 r3,r7 | ||
| 5185 | bicl2 #0,r7 | ||
| 5186 | cmpl r7,r3 | ||
| 5187 | bgequ noname.490 | ||
| 5188 | incl r2 | ||
| 5189 | bicl3 #0,r2,r0 | ||
| 5190 | bneq noname.490 | ||
| 5191 | incl r8 | ||
| 5192 | noname.490: | ||
| 5193 | addl2 r2,r9 | ||
| 5194 | bicl2 #0,r9 | ||
| 5195 | cmpl r9,r2 | ||
| 5196 | bgequ noname.491 | ||
| 5197 | incl r8 | ||
| 5198 | noname.491: | ||
| 5199 | |||
| 5200 | movl 8(ap),r0 | ||
| 5201 | bicl3 #-65536,28(r0),r3 | ||
| 5202 | movzwl 30(r0),r1 | ||
| 5203 | bicl2 #-65536,r1 | ||
| 5204 | bicl3 #-65536,4(r0),r2 | ||
| 5205 | movzwl 6(r0),r0 | ||
| 5206 | bicl2 #-65536,r0 | ||
| 5207 | movl r3,r5 | ||
| 5208 | movl r1,r4 | ||
| 5209 | mull3 r0,r5,-312(fp) | ||
| 5210 | mull2 r2,r5 | ||
| 5211 | mull3 r2,r4,-316(fp) | ||
| 5212 | mull2 r0,r4 | ||
| 5213 | addl3 -312(fp),-316(fp),r0 | ||
| 5214 | bicl3 #0,r0,-312(fp) | ||
| 5215 | cmpl -312(fp),-316(fp) | ||
| 5216 | bgequ noname.492 | ||
| 5217 | addl2 #65536,r4 | ||
| 5218 | noname.492: | ||
| 5219 | movzwl -310(fp),r0 | ||
| 5220 | bicl2 #-65536,r0 | ||
| 5221 | addl2 r0,r4 | ||
| 5222 | bicl3 #-65536,-312(fp),r0 | ||
| 5223 | ashl #16,r0,-316(fp) | ||
| 5224 | addl2 -316(fp),r5 | ||
| 5225 | bicl2 #0,r5 | ||
| 5226 | cmpl r5,-316(fp) | ||
| 5227 | bgequ noname.493 | ||
| 5228 | incl r4 | ||
| 5229 | noname.493: | ||
| 5230 | movl r5,r3 | ||
| 5231 | movl r4,r2 | ||
| 5232 | bbc #31,r2,noname.494 | ||
| 5233 | incl r8 | ||
| 5234 | noname.494: | ||
| 5235 | addl2 r2,r2 | ||
| 5236 | bicl2 #0,r2 | ||
| 5237 | bbc #31,r3,noname.495 | ||
| 5238 | incl r2 | ||
| 5239 | noname.495: | ||
| 5240 | addl2 r3,r3 | ||
| 5241 | bicl2 #0,r3 | ||
| 5242 | addl2 r3,r7 | ||
| 5243 | bicl2 #0,r7 | ||
| 5244 | cmpl r7,r3 | ||
| 5245 | bgequ noname.496 | ||
| 5246 | incl r2 | ||
| 5247 | bicl3 #0,r2,r0 | ||
| 5248 | bneq noname.496 | ||
| 5249 | incl r8 | ||
| 5250 | noname.496: | ||
| 5251 | addl2 r2,r9 | ||
| 5252 | bicl2 #0,r9 | ||
| 5253 | cmpl r9,r2 | ||
| 5254 | bgequ noname.497 | ||
| 5255 | incl r8 | ||
| 5256 | noname.497: | ||
| 5257 | |||
| 5258 | movl 4(ap),r0 | ||
| 5259 | movl r7,32(r0) | ||
| 5260 | |||
| 5261 | clrl r7 | ||
| 5262 | |||
| 5263 | movl 8(ap),r0 | ||
| 5264 | bicl3 #-65536,28(r0),r3 | ||
| 5265 | movzwl 30(r0),r2 | ||
| 5266 | bicl3 #-65536,8(r0),r1 | ||
| 5267 | movzwl 10(r0),r0 | ||
| 5268 | bicl2 #-65536,r0 | ||
| 5269 | movl r3,r4 | ||
| 5270 | bicl3 #-65536,r2,-328(fp) | ||
| 5271 | mull3 r0,r4,-320(fp) | ||
| 5272 | mull2 r1,r4 | ||
| 5273 | mull3 r1,-328(fp),-324(fp) | ||
| 5274 | mull2 r0,-328(fp) | ||
| 5275 | addl3 -320(fp),-324(fp),r0 | ||
| 5276 | bicl3 #0,r0,-320(fp) | ||
| 5277 | cmpl -320(fp),-324(fp) | ||
| 5278 | bgequ noname.498 | ||
| 5279 | addl2 #65536,-328(fp) | ||
| 5280 | noname.498: | ||
| 5281 | movzwl -318(fp),r0 | ||
| 5282 | bicl2 #-65536,r0 | ||
| 5283 | addl2 r0,-328(fp) | ||
| 5284 | bicl3 #-65536,-320(fp),r0 | ||
| 5285 | ashl #16,r0,-324(fp) | ||
| 5286 | addl2 -324(fp),r4 | ||
| 5287 | bicl2 #0,r4 | ||
| 5288 | cmpl r4,-324(fp) | ||
| 5289 | bgequ noname.499 | ||
| 5290 | incl -328(fp) | ||
| 5291 | noname.499: | ||
| 5292 | movl r4,r3 | ||
| 5293 | movl -328(fp),r2 | ||
| 5294 | bbc #31,r2,noname.500 | ||
| 5295 | incl r7 | ||
| 5296 | noname.500: | ||
| 5297 | addl2 r2,r2 | ||
| 5298 | bicl2 #0,r2 | ||
| 5299 | bbc #31,r3,noname.501 | ||
| 5300 | incl r2 | ||
| 5301 | noname.501: | ||
| 5302 | addl2 r3,r3 | ||
| 5303 | bicl2 #0,r3 | ||
| 5304 | addl2 r3,r9 | ||
| 5305 | bicl2 #0,r9 | ||
| 5306 | cmpl r9,r3 | ||
| 5307 | bgequ noname.502 | ||
| 5308 | incl r2 | ||
| 5309 | bicl3 #0,r2,r0 | ||
| 5310 | bneq noname.502 | ||
| 5311 | incl r7 | ||
| 5312 | noname.502: | ||
| 5313 | addl2 r2,r8 | ||
| 5314 | bicl2 #0,r8 | ||
| 5315 | cmpl r8,r2 | ||
| 5316 | bgequ noname.503 | ||
| 5317 | incl r7 | ||
| 5318 | noname.503: | ||
| 5319 | |||
| 5320 | movl 8(ap),r0 | ||
| 5321 | movzwl 26(r0),r2 | ||
| 5322 | bicl3 #-65536,12(r0),r3 | ||
| 5323 | movzwl 14(r0),r1 | ||
| 5324 | bicl2 #-65536,r1 | ||
| 5325 | bicl3 #-65536,24(r0),-340(fp) | ||
| 5326 | bicl3 #-65536,r2,-344(fp) | ||
| 5327 | mull3 r1,-340(fp),-332(fp) | ||
| 5328 | mull2 r3,-340(fp) | ||
| 5329 | mull3 r3,-344(fp),-336(fp) | ||
| 5330 | mull2 r1,-344(fp) | ||
| 5331 | addl3 -332(fp),-336(fp),r0 | ||
| 5332 | bicl3 #0,r0,-332(fp) | ||
| 5333 | cmpl -332(fp),-336(fp) | ||
| 5334 | bgequ noname.504 | ||
| 5335 | addl2 #65536,-344(fp) | ||
| 5336 | noname.504: | ||
| 5337 | movzwl -330(fp),r0 | ||
| 5338 | bicl2 #-65536,r0 | ||
| 5339 | addl2 r0,-344(fp) | ||
| 5340 | bicl3 #-65536,-332(fp),r0 | ||
| 5341 | ashl #16,r0,-336(fp) | ||
| 5342 | addl3 -336(fp),-340(fp),r0 | ||
| 5343 | bicl3 #0,r0,-340(fp) | ||
| 5344 | cmpl -340(fp),-336(fp) | ||
| 5345 | bgequ noname.505 | ||
| 5346 | incl -344(fp) | ||
| 5347 | noname.505: | ||
| 5348 | movl -340(fp),r3 | ||
| 5349 | movl -344(fp),r2 | ||
| 5350 | bbc #31,r2,noname.506 | ||
| 5351 | incl r7 | ||
| 5352 | noname.506: | ||
| 5353 | addl2 r2,r2 | ||
| 5354 | bicl2 #0,r2 | ||
| 5355 | bbc #31,r3,noname.507 | ||
| 5356 | incl r2 | ||
| 5357 | noname.507: | ||
| 5358 | addl2 r3,r3 | ||
| 5359 | bicl2 #0,r3 | ||
| 5360 | addl2 r3,r9 | ||
| 5361 | bicl2 #0,r9 | ||
| 5362 | cmpl r9,r3 | ||
| 5363 | bgequ noname.508 | ||
| 5364 | incl r2 | ||
| 5365 | bicl3 #0,r2,r0 | ||
| 5366 | bneq noname.508 | ||
| 5367 | incl r7 | ||
| 5368 | noname.508: | ||
| 5369 | addl2 r2,r8 | ||
| 5370 | bicl2 #0,r8 | ||
| 5371 | cmpl r8,r2 | ||
| 5372 | bgequ noname.509 | ||
| 5373 | incl r7 | ||
| 5374 | noname.509: | ||
| 5375 | |||
| 5376 | movl 8(ap),r0 | ||
| 5377 | movzwl 22(r0),r2 | ||
| 5378 | bicl3 #-65536,16(r0),r3 | ||
| 5379 | movzwl 18(r0),r1 | ||
| 5380 | bicl2 #-65536,r1 | ||
| 5381 | bicl3 #-65536,20(r0),-356(fp) | ||
| 5382 | bicl3 #-65536,r2,-360(fp) | ||
| 5383 | mull3 r1,-356(fp),-348(fp) | ||
| 5384 | mull2 r3,-356(fp) | ||
| 5385 | mull3 r3,-360(fp),-352(fp) | ||
| 5386 | mull2 r1,-360(fp) | ||
| 5387 | addl3 -348(fp),-352(fp),r0 | ||
| 5388 | bicl3 #0,r0,-348(fp) | ||
| 5389 | cmpl -348(fp),-352(fp) | ||
| 5390 | bgequ noname.510 | ||
| 5391 | addl2 #65536,-360(fp) | ||
| 5392 | noname.510: | ||
| 5393 | movzwl -346(fp),r0 | ||
| 5394 | bicl2 #-65536,r0 | ||
| 5395 | addl2 r0,-360(fp) | ||
| 5396 | bicl3 #-65536,-348(fp),r0 | ||
| 5397 | ashl #16,r0,-352(fp) | ||
| 5398 | addl3 -352(fp),-356(fp),r0 | ||
| 5399 | bicl3 #0,r0,-356(fp) | ||
| 5400 | cmpl -356(fp),-352(fp) | ||
| 5401 | bgequ noname.511 | ||
| 5402 | incl -360(fp) | ||
| 5403 | noname.511: | ||
| 5404 | movl -356(fp),r3 | ||
| 5405 | movl -360(fp),r2 | ||
| 5406 | bbc #31,r2,noname.512 | ||
| 5407 | incl r7 | ||
| 5408 | noname.512: | ||
| 5409 | addl2 r2,r2 | ||
| 5410 | bicl2 #0,r2 | ||
| 5411 | bbc #31,r3,noname.513 | ||
| 5412 | incl r2 | ||
| 5413 | noname.513: | ||
| 5414 | addl2 r3,r3 | ||
| 5415 | bicl2 #0,r3 | ||
| 5416 | addl2 r3,r9 | ||
| 5417 | bicl2 #0,r9 | ||
| 5418 | cmpl r9,r3 | ||
| 5419 | bgequ noname.514 | ||
| 5420 | incl r2 | ||
| 5421 | bicl3 #0,r2,r0 | ||
| 5422 | bneq noname.514 | ||
| 5423 | incl r7 | ||
| 5424 | noname.514: | ||
| 5425 | addl2 r2,r8 | ||
| 5426 | bicl2 #0,r8 | ||
| 5427 | cmpl r8,r2 | ||
| 5428 | bgequ noname.515 | ||
| 5429 | incl r7 | ||
| 5430 | noname.515: | ||
| 5431 | |||
| 5432 | movl 4(ap),r0 | ||
| 5433 | movl r9,36(r0) | ||
| 5434 | |||
| 5435 | clrl r9 | ||
| 5436 | |||
| 5437 | movl 8(ap),r3 | ||
| 5438 | movl 20(r3),r4 | ||
| 5439 | bicl3 #-65536,r4,-364(fp) | ||
| 5440 | extzv #16,#16,r4,r0 | ||
| 5441 | bicl3 #-65536,r0,r4 | ||
| 5442 | movl -364(fp),r0 | ||
| 5443 | mull3 r0,r4,-368(fp) | ||
| 5444 | mull3 r0,r0,-364(fp) | ||
| 5445 | mull2 r4,r4 | ||
| 5446 | bicl3 #32767,-368(fp),r0 | ||
| 5447 | extzv #15,#17,r0,r0 | ||
| 5448 | addl2 r0,r4 | ||
| 5449 | bicl3 #-65536,-368(fp),r0 | ||
| 5450 | ashl #17,r0,-368(fp) | ||
| 5451 | addl3 -364(fp),-368(fp),r0 | ||
| 5452 | bicl3 #0,r0,-364(fp) | ||
| 5453 | cmpl -364(fp),-368(fp) | ||
| 5454 | bgequ noname.516 | ||
| 5455 | incl r4 | ||
| 5456 | noname.516: | ||
| 5457 | movl -364(fp),r1 | ||
| 5458 | movl r4,r2 | ||
| 5459 | addl2 r1,r8 | ||
| 5460 | bicl2 #0,r8 | ||
| 5461 | cmpl r8,r1 | ||
| 5462 | bgequ noname.517 | ||
| 5463 | incl r2 | ||
| 5464 | noname.517: | ||
| 5465 | addl2 r2,r7 | ||
| 5466 | bicl2 #0,r7 | ||
| 5467 | cmpl r7,r2 | ||
| 5468 | bgequ noname.518 | ||
| 5469 | incl r9 | ||
| 5470 | noname.518: | ||
| 5471 | |||
| 5472 | bicl3 #-65536,24(r3),r4 | ||
| 5473 | movzwl 26(r3),r1 | ||
| 5474 | bicl2 #-65536,r1 | ||
| 5475 | bicl3 #-65536,16(r3),r2 | ||
| 5476 | movzwl 18(r3),r0 | ||
| 5477 | bicl2 #-65536,r0 | ||
| 5478 | movl r4,r6 | ||
| 5479 | movl r1,r5 | ||
| 5480 | mull3 r0,r6,-372(fp) | ||
| 5481 | mull2 r2,r6 | ||
| 5482 | mull3 r2,r5,-376(fp) | ||
| 5483 | mull2 r0,r5 | ||
| 5484 | addl3 -372(fp),-376(fp),r0 | ||
| 5485 | bicl3 #0,r0,-372(fp) | ||
| 5486 | cmpl -372(fp),-376(fp) | ||
| 5487 | bgequ noname.519 | ||
| 5488 | addl2 #65536,r5 | ||
| 5489 | noname.519: | ||
| 5490 | movzwl -370(fp),r0 | ||
| 5491 | bicl2 #-65536,r0 | ||
| 5492 | addl2 r0,r5 | ||
| 5493 | bicl3 #-65536,-372(fp),r0 | ||
| 5494 | ashl #16,r0,-376(fp) | ||
| 5495 | addl2 -376(fp),r6 | ||
| 5496 | bicl2 #0,r6 | ||
| 5497 | cmpl r6,-376(fp) | ||
| 5498 | bgequ noname.520 | ||
| 5499 | incl r5 | ||
| 5500 | noname.520: | ||
| 5501 | movl r6,r3 | ||
| 5502 | movl r5,r2 | ||
| 5503 | bbc #31,r2,noname.521 | ||
| 5504 | incl r9 | ||
| 5505 | noname.521: | ||
| 5506 | addl2 r2,r2 | ||
| 5507 | bicl2 #0,r2 | ||
| 5508 | bbc #31,r3,noname.522 | ||
| 5509 | incl r2 | ||
| 5510 | noname.522: | ||
| 5511 | addl2 r3,r3 | ||
| 5512 | bicl2 #0,r3 | ||
| 5513 | addl2 r3,r8 | ||
| 5514 | bicl2 #0,r8 | ||
| 5515 | cmpl r8,r3 | ||
| 5516 | bgequ noname.523 | ||
| 5517 | incl r2 | ||
| 5518 | bicl3 #0,r2,r0 | ||
| 5519 | bneq noname.523 | ||
| 5520 | incl r9 | ||
| 5521 | noname.523: | ||
| 5522 | addl2 r2,r7 | ||
| 5523 | bicl2 #0,r7 | ||
| 5524 | cmpl r7,r2 | ||
| 5525 | bgequ noname.524 | ||
| 5526 | incl r9 | ||
| 5527 | noname.524: | ||
| 5528 | |||
| 5529 | movl 8(ap),r0 | ||
| 5530 | bicl3 #-65536,28(r0),r3 | ||
| 5531 | movzwl 30(r0),r1 | ||
| 5532 | bicl2 #-65536,r1 | ||
| 5533 | bicl3 #-65536,12(r0),r2 | ||
| 5534 | movzwl 14(r0),r0 | ||
| 5535 | bicl2 #-65536,r0 | ||
| 5536 | movl r3,r5 | ||
| 5537 | movl r1,r4 | ||
| 5538 | mull3 r0,r5,-380(fp) | ||
| 5539 | mull2 r2,r5 | ||
| 5540 | mull3 r2,r4,-384(fp) | ||
| 5541 | mull2 r0,r4 | ||
| 5542 | addl3 -380(fp),-384(fp),r0 | ||
| 5543 | bicl3 #0,r0,-380(fp) | ||
| 5544 | cmpl -380(fp),-384(fp) | ||
| 5545 | bgequ noname.525 | ||
| 5546 | addl2 #65536,r4 | ||
| 5547 | noname.525: | ||
| 5548 | movzwl -378(fp),r0 | ||
| 5549 | bicl2 #-65536,r0 | ||
| 5550 | addl2 r0,r4 | ||
| 5551 | bicl3 #-65536,-380(fp),r0 | ||
| 5552 | ashl #16,r0,-384(fp) | ||
| 5553 | addl2 -384(fp),r5 | ||
| 5554 | bicl2 #0,r5 | ||
| 5555 | cmpl r5,-384(fp) | ||
| 5556 | bgequ noname.526 | ||
| 5557 | incl r4 | ||
| 5558 | noname.526: | ||
| 5559 | movl r5,r3 | ||
| 5560 | movl r4,r2 | ||
| 5561 | bbc #31,r2,noname.527 | ||
| 5562 | incl r9 | ||
| 5563 | noname.527: | ||
| 5564 | addl2 r2,r2 | ||
| 5565 | bicl2 #0,r2 | ||
| 5566 | bbc #31,r3,noname.528 | ||
| 5567 | incl r2 | ||
| 5568 | noname.528: | ||
| 5569 | addl2 r3,r3 | ||
| 5570 | bicl2 #0,r3 | ||
| 5571 | addl2 r3,r8 | ||
| 5572 | bicl2 #0,r8 | ||
| 5573 | cmpl r8,r3 | ||
| 5574 | bgequ noname.529 | ||
| 5575 | incl r2 | ||
| 5576 | bicl3 #0,r2,r0 | ||
| 5577 | bneq noname.529 | ||
| 5578 | incl r9 | ||
| 5579 | noname.529: | ||
| 5580 | addl2 r2,r7 | ||
| 5581 | bicl2 #0,r7 | ||
| 5582 | cmpl r7,r2 | ||
| 5583 | bgequ noname.530 | ||
| 5584 | incl r9 | ||
| 5585 | noname.530: | ||
| 5586 | movl 4(ap),r0 | ||
| 5587 | movl r8,40(r0) | ||
| 5588 | |||
| 5589 | clrl r8 | ||
| 5590 | |||
| 5591 | movl 8(ap),r0 | ||
| 5592 | bicl3 #-65536,28(r0),r3 | ||
| 5593 | movzwl 30(r0),r1 | ||
| 5594 | bicl2 #-65536,r1 | ||
| 5595 | bicl3 #-65536,16(r0),r2 | ||
| 5596 | movzwl 18(r0),r0 | ||
| 5597 | bicl2 #-65536,r0 | ||
| 5598 | movl r3,r5 | ||
| 5599 | movl r1,r4 | ||
| 5600 | mull3 r0,r5,-388(fp) | ||
| 5601 | mull2 r2,r5 | ||
| 5602 | mull3 r2,r4,-392(fp) | ||
| 5603 | mull2 r0,r4 | ||
| 5604 | addl3 -388(fp),-392(fp),r0 | ||
| 5605 | bicl3 #0,r0,-388(fp) | ||
| 5606 | cmpl -388(fp),-392(fp) | ||
| 5607 | bgequ noname.531 | ||
| 5608 | addl2 #65536,r4 | ||
| 5609 | noname.531: | ||
| 5610 | movzwl -386(fp),r0 | ||
| 5611 | bicl2 #-65536,r0 | ||
| 5612 | addl2 r0,r4 | ||
| 5613 | bicl3 #-65536,-388(fp),r0 | ||
| 5614 | ashl #16,r0,-392(fp) | ||
| 5615 | addl2 -392(fp),r5 | ||
| 5616 | bicl2 #0,r5 | ||
| 5617 | cmpl r5,-392(fp) | ||
| 5618 | bgequ noname.532 | ||
| 5619 | incl r4 | ||
| 5620 | noname.532: | ||
| 5621 | movl r5,r3 | ||
| 5622 | movl r4,r2 | ||
| 5623 | bbc #31,r2,noname.533 | ||
| 5624 | incl r8 | ||
| 5625 | noname.533: | ||
| 5626 | addl2 r2,r2 | ||
| 5627 | bicl2 #0,r2 | ||
| 5628 | bbc #31,r3,noname.534 | ||
| 5629 | incl r2 | ||
| 5630 | noname.534: | ||
| 5631 | addl2 r3,r3 | ||
| 5632 | bicl2 #0,r3 | ||
| 5633 | addl2 r3,r7 | ||
| 5634 | bicl2 #0,r7 | ||
| 5635 | cmpl r7,r3 | ||
| 5636 | bgequ noname.535 | ||
| 5637 | incl r2 | ||
| 5638 | bicl3 #0,r2,r0 | ||
| 5639 | bneq noname.535 | ||
| 5640 | incl r8 | ||
| 5641 | noname.535: | ||
| 5642 | addl2 r2,r9 | ||
| 5643 | bicl2 #0,r9 | ||
| 5644 | cmpl r9,r2 | ||
| 5645 | bgequ noname.536 | ||
| 5646 | incl r8 | ||
| 5647 | noname.536: | ||
| 5648 | |||
| 5649 | movl 8(ap),r0 | ||
| 5650 | bicl3 #-65536,24(r0),r3 | ||
| 5651 | movzwl 26(r0),r1 | ||
| 5652 | bicl2 #-65536,r1 | ||
| 5653 | bicl3 #-65536,20(r0),r2 | ||
| 5654 | movzwl 22(r0),r0 | ||
| 5655 | bicl2 #-65536,r0 | ||
| 5656 | movl r3,r5 | ||
| 5657 | movl r1,r4 | ||
| 5658 | mull3 r0,r5,-396(fp) | ||
| 5659 | mull2 r2,r5 | ||
| 5660 | mull3 r2,r4,-400(fp) | ||
| 5661 | mull2 r0,r4 | ||
| 5662 | addl3 -396(fp),-400(fp),r0 | ||
| 5663 | bicl3 #0,r0,-396(fp) | ||
| 5664 | cmpl -396(fp),-400(fp) | ||
| 5665 | bgequ noname.537 | ||
| 5666 | addl2 #65536,r4 | ||
| 5667 | noname.537: | ||
| 5668 | movzwl -394(fp),r0 | ||
| 5669 | bicl2 #-65536,r0 | ||
| 5670 | addl2 r0,r4 | ||
| 5671 | bicl3 #-65536,-396(fp),r0 | ||
| 5672 | ashl #16,r0,-400(fp) | ||
| 5673 | addl2 -400(fp),r5 | ||
| 5674 | bicl2 #0,r5 | ||
| 5675 | cmpl r5,-400(fp) | ||
| 5676 | bgequ noname.538 | ||
| 5677 | incl r4 | ||
| 5678 | noname.538: | ||
| 5679 | movl r5,r3 | ||
| 5680 | movl r4,r2 | ||
| 5681 | bbc #31,r2,noname.539 | ||
| 5682 | incl r8 | ||
| 5683 | noname.539: | ||
| 5684 | addl2 r2,r2 | ||
| 5685 | bicl2 #0,r2 | ||
| 5686 | bbc #31,r3,noname.540 | ||
| 5687 | incl r2 | ||
| 5688 | noname.540: | ||
| 5689 | addl2 r3,r3 | ||
| 5690 | bicl2 #0,r3 | ||
| 5691 | addl2 r3,r7 | ||
| 5692 | bicl2 #0,r7 | ||
| 5693 | cmpl r7,r3 | ||
| 5694 | bgequ noname.541 | ||
| 5695 | incl r2 | ||
| 5696 | bicl3 #0,r2,r0 | ||
| 5697 | bneq noname.541 | ||
| 5698 | incl r8 | ||
| 5699 | noname.541: | ||
| 5700 | addl2 r2,r9 | ||
| 5701 | bicl2 #0,r9 | ||
| 5702 | cmpl r9,r2 | ||
| 5703 | bgequ noname.542 | ||
| 5704 | incl r8 | ||
| 5705 | noname.542: | ||
| 5706 | |||
| 5707 | movl 4(ap),r0 | ||
| 5708 | movl r7,44(r0) | ||
| 5709 | |||
| 5710 | clrl r7 | ||
| 5711 | |||
| 5712 | movl 8(ap),r3 | ||
| 5713 | movl 24(r3),r4 | ||
| 5714 | bicl3 #-65536,r4,r5 | ||
| 5715 | extzv #16,#16,r4,r0 | ||
| 5716 | bicl3 #-65536,r0,r4 | ||
| 5717 | mull3 r5,r4,-404(fp) | ||
| 5718 | mull2 r5,r5 | ||
| 5719 | mull2 r4,r4 | ||
| 5720 | bicl3 #32767,-404(fp),r0 | ||
| 5721 | extzv #15,#17,r0,r0 | ||
| 5722 | addl2 r0,r4 | ||
| 5723 | bicl3 #-65536,-404(fp),r0 | ||
| 5724 | ashl #17,r0,-404(fp) | ||
| 5725 | addl2 -404(fp),r5 | ||
| 5726 | bicl2 #0,r5 | ||
| 5727 | cmpl r5,-404(fp) | ||
| 5728 | bgequ noname.543 | ||
| 5729 | incl r4 | ||
| 5730 | noname.543: | ||
| 5731 | movl r5,r1 | ||
| 5732 | movl r4,r2 | ||
| 5733 | addl2 r1,r9 | ||
| 5734 | bicl2 #0,r9 | ||
| 5735 | cmpl r9,r1 | ||
| 5736 | bgequ noname.544 | ||
| 5737 | incl r2 | ||
| 5738 | noname.544: | ||
| 5739 | addl2 r2,r8 | ||
| 5740 | bicl2 #0,r8 | ||
| 5741 | cmpl r8,r2 | ||
| 5742 | bgequ noname.545 | ||
| 5743 | incl r7 | ||
| 5744 | noname.545: | ||
| 5745 | |||
| 5746 | movzwl 30(r3),r2 | ||
| 5747 | bicl3 #-65536,20(r3),r1 | ||
| 5748 | movzwl 22(r3),r0 | ||
| 5749 | bicl2 #-65536,r0 | ||
| 5750 | bicl3 #-65536,28(r3),-416(fp) | ||
| 5751 | bicl3 #-65536,r2,-420(fp) | ||
| 5752 | mull3 r0,-416(fp),-408(fp) | ||
| 5753 | mull2 r1,-416(fp) | ||
| 5754 | mull3 r1,-420(fp),-412(fp) | ||
| 5755 | mull2 r0,-420(fp) | ||
| 5756 | addl3 -408(fp),-412(fp),r0 | ||
| 5757 | bicl3 #0,r0,-408(fp) | ||
| 5758 | cmpl -408(fp),-412(fp) | ||
| 5759 | bgequ noname.546 | ||
| 5760 | addl2 #65536,-420(fp) | ||
| 5761 | noname.546: | ||
| 5762 | movzwl -406(fp),r0 | ||
| 5763 | bicl2 #-65536,r0 | ||
| 5764 | addl2 r0,-420(fp) | ||
| 5765 | bicl3 #-65536,-408(fp),r0 | ||
| 5766 | ashl #16,r0,-412(fp) | ||
| 5767 | addl3 -412(fp),-416(fp),r0 | ||
| 5768 | bicl3 #0,r0,-416(fp) | ||
| 5769 | cmpl -416(fp),-412(fp) | ||
| 5770 | bgequ noname.547 | ||
| 5771 | incl -420(fp) | ||
| 5772 | noname.547: | ||
| 5773 | movl -416(fp),r3 | ||
| 5774 | movl -420(fp),r2 | ||
| 5775 | bbc #31,r2,noname.548 | ||
| 5776 | incl r7 | ||
| 5777 | noname.548: | ||
| 5778 | addl2 r2,r2 | ||
| 5779 | bicl2 #0,r2 | ||
| 5780 | bbc #31,r3,noname.549 | ||
| 5781 | incl r2 | ||
| 5782 | noname.549: | ||
| 5783 | addl2 r3,r3 | ||
| 5784 | bicl2 #0,r3 | ||
| 5785 | addl2 r3,r9 | ||
| 5786 | bicl2 #0,r9 | ||
| 5787 | cmpl r9,r3 | ||
| 5788 | bgequ noname.550 | ||
| 5789 | incl r2 | ||
| 5790 | bicl3 #0,r2,r0 | ||
| 5791 | bneq noname.550 | ||
| 5792 | incl r7 | ||
| 5793 | noname.550: | ||
| 5794 | addl2 r2,r8 | ||
| 5795 | bicl2 #0,r8 | ||
| 5796 | cmpl r8,r2 | ||
| 5797 | bgequ noname.551 | ||
| 5798 | incl r7 | ||
| 5799 | noname.551: | ||
| 5800 | |||
| 5801 | movl 4(ap),r0 | ||
| 5802 | movl r9,48(r0) | ||
| 5803 | |||
| 5804 | clrl r9 | ||
| 5805 | |||
| 5806 | movl 8(ap),r0 | ||
| 5807 | movzwl 30(r0),r2 | ||
| 5808 | bicl3 #-65536,24(r0),r3 | ||
| 5809 | movzwl 26(r0),r1 | ||
| 5810 | bicl2 #-65536,r1 | ||
| 5811 | bicl3 #-65536,28(r0),-432(fp) | ||
| 5812 | bicl3 #-65536,r2,-436(fp) | ||
| 5813 | mull3 r1,-432(fp),-424(fp) | ||
| 5814 | mull2 r3,-432(fp) | ||
| 5815 | mull3 r3,-436(fp),-428(fp) | ||
| 5816 | mull2 r1,-436(fp) | ||
| 5817 | addl3 -424(fp),-428(fp),r0 | ||
| 5818 | bicl3 #0,r0,-424(fp) | ||
| 5819 | cmpl -424(fp),-428(fp) | ||
| 5820 | bgequ noname.552 | ||
| 5821 | addl2 #65536,-436(fp) | ||
| 5822 | noname.552: | ||
| 5823 | movzwl -422(fp),r0 | ||
| 5824 | bicl2 #-65536,r0 | ||
| 5825 | addl2 r0,-436(fp) | ||
| 5826 | bicl3 #-65536,-424(fp),r0 | ||
| 5827 | ashl #16,r0,-428(fp) | ||
| 5828 | addl3 -428(fp),-432(fp),r0 | ||
| 5829 | bicl3 #0,r0,-432(fp) | ||
| 5830 | cmpl -432(fp),-428(fp) | ||
| 5831 | bgequ noname.553 | ||
| 5832 | incl -436(fp) | ||
| 5833 | noname.553: | ||
| 5834 | movl -432(fp),r3 | ||
| 5835 | movl -436(fp),r2 | ||
| 5836 | bbc #31,r2,noname.554 | ||
| 5837 | incl r9 | ||
| 5838 | noname.554: | ||
| 5839 | addl2 r2,r2 | ||
| 5840 | bicl2 #0,r2 | ||
| 5841 | bbc #31,r3,noname.555 | ||
| 5842 | incl r2 | ||
| 5843 | noname.555: | ||
| 5844 | addl2 r3,r3 | ||
| 5845 | bicl2 #0,r3 | ||
| 5846 | addl2 r3,r8 | ||
| 5847 | bicl2 #0,r8 | ||
| 5848 | cmpl r8,r3 | ||
| 5849 | bgequ noname.556 | ||
| 5850 | incl r2 | ||
| 5851 | bicl3 #0,r2,r0 | ||
| 5852 | bneq noname.556 | ||
| 5853 | incl r9 | ||
| 5854 | noname.556: | ||
| 5855 | addl2 r2,r7 | ||
| 5856 | bicl2 #0,r7 | ||
| 5857 | cmpl r7,r2 | ||
| 5858 | bgequ noname.557 | ||
| 5859 | incl r9 | ||
| 5860 | noname.557: | ||
| 5861 | |||
| 5862 | movl 4(ap),r4 | ||
| 5863 | movl r8,52(r4) | ||
| 5864 | |||
| 5865 | clrl r8 | ||
| 5866 | |||
| 5867 | movl 8(ap),r0 | ||
| 5868 | movl 28(r0),r3 | ||
| 5869 | bicl3 #-65536,r3,-440(fp) | ||
| 5870 | extzv #16,#16,r3,r0 | ||
| 5871 | bicl3 #-65536,r0,r3 | ||
| 5872 | movl -440(fp),r0 | ||
| 5873 | mull3 r0,r3,-444(fp) | ||
| 5874 | mull3 r0,r0,-440(fp) | ||
| 5875 | mull2 r3,r3 | ||
| 5876 | bicl3 #32767,-444(fp),r0 | ||
| 5877 | extzv #15,#17,r0,r0 | ||
| 5878 | addl2 r0,r3 | ||
| 5879 | bicl3 #-65536,-444(fp),r0 | ||
| 5880 | ashl #17,r0,-444(fp) | ||
| 5881 | addl3 -440(fp),-444(fp),r0 | ||
| 5882 | bicl3 #0,r0,-440(fp) | ||
| 5883 | cmpl -440(fp),-444(fp) | ||
| 5884 | bgequ noname.558 | ||
| 5885 | incl r3 | ||
| 5886 | noname.558: | ||
| 5887 | movl -440(fp),r1 | ||
| 5888 | movl r3,r2 | ||
| 5889 | addl2 r1,r7 | ||
| 5890 | bicl2 #0,r7 | ||
| 5891 | cmpl r7,r1 | ||
| 5892 | bgequ noname.559 | ||
| 5893 | incl r2 | ||
| 5894 | noname.559: | ||
| 5895 | addl2 r2,r9 | ||
| 5896 | bicl2 #0,r9 | ||
| 5897 | cmpl r9,r2 | ||
| 5898 | bgequ noname.560 | ||
| 5899 | incl r8 | ||
| 5900 | noname.560: | ||
| 5901 | |||
| 5902 | movl r7,56(r4) | ||
| 5903 | |||
| 5904 | movl r9,60(r4) | ||
| 5905 | |||
| 5906 | ret | ||
| 5907 | |||
| 5908 | |||
| 5909 | |||
| 5910 | ;r=4 ;(AP) | ||
| 5911 | ;a=8 ;(AP) | ||
| 5912 | ;b=12 ;(AP) | ||
| 5913 | ;n=16 ;(AP) n by value (input) | ||
| 5914 | |||
| 5915 | .psect code,nowrt | ||
| 5916 | |||
| 5917 | .entry BN_SQR_COMBA4,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10> | ||
| 5918 | subl2 #44,sp | ||
| 5919 | |||
| 5920 | clrq r8 | ||
| 5921 | |||
| 5922 | clrl r10 | ||
| 5923 | |||
| 5924 | movl 8(ap),r5 | ||
| 5925 | movl (r5),r3 | ||
| 5926 | bicl3 #-65536,r3,r4 | ||
| 5927 | extzv #16,#16,r3,r0 | ||
| 5928 | bicl3 #-65536,r0,r3 | ||
| 5929 | mull3 r4,r3,-4(fp) | ||
| 5930 | mull2 r4,r4 | ||
| 5931 | mull2 r3,r3 | ||
| 5932 | bicl3 #32767,-4(fp),r0 | ||
| 5933 | extzv #15,#17,r0,r0 | ||
| 5934 | addl2 r0,r3 | ||
| 5935 | bicl3 #-65536,-4(fp),r0 | ||
| 5936 | ashl #17,r0,-4(fp) | ||
| 5937 | addl2 -4(fp),r4 | ||
| 5938 | bicl2 #0,r4 | ||
| 5939 | cmpl r4,-4(fp) | ||
| 5940 | bgequ noname.563 | ||
| 5941 | incl r3 | ||
| 5942 | noname.563: | ||
| 5943 | movl r4,r1 | ||
| 5944 | movl r3,r2 | ||
| 5945 | addl2 r1,r9 | ||
| 5946 | bicl2 #0,r9 | ||
| 5947 | cmpl r9,r1 | ||
| 5948 | bgequ noname.564 | ||
| 5949 | incl r2 | ||
| 5950 | noname.564: | ||
| 5951 | addl2 r2,r8 | ||
| 5952 | bicl2 #0,r8 | ||
| 5953 | cmpl r8,r2 | ||
| 5954 | bgequ noname.565 | ||
| 5955 | incl r10 | ||
| 5956 | noname.565: | ||
| 5957 | |||
| 5958 | movl r9,@4(ap) | ||
| 5959 | |||
| 5960 | clrl r9 | ||
| 5961 | |||
| 5962 | bicl3 #-65536,4(r5),r3 | ||
| 5963 | movzwl 6(r5),r1 | ||
| 5964 | bicl2 #-65536,r1 | ||
| 5965 | bicl3 #-65536,(r5),r2 | ||
| 5966 | movzwl 2(r5),r0 | ||
| 5967 | bicl2 #-65536,r0 | ||
| 5968 | movl r3,r6 | ||
| 5969 | movl r1,r4 | ||
| 5970 | mull3 r0,r6,-8(fp) | ||
| 5971 | mull2 r2,r6 | ||
| 5972 | mull2 r4,r2 | ||
| 5973 | mull2 r0,r4 | ||
| 5974 | addl3 -8(fp),r2,r0 | ||
| 5975 | bicl3 #0,r0,-8(fp) | ||
| 5976 | cmpl -8(fp),r2 | ||
| 5977 | bgequ noname.566 | ||
| 5978 | addl2 #65536,r4 | ||
| 5979 | noname.566: | ||
| 5980 | movzwl -6(fp),r0 | ||
| 5981 | bicl2 #-65536,r0 | ||
| 5982 | addl2 r0,r4 | ||
| 5983 | bicl3 #-65536,-8(fp),r0 | ||
| 5984 | ashl #16,r0,r1 | ||
| 5985 | addl2 r1,r6 | ||
| 5986 | bicl2 #0,r6 | ||
| 5987 | cmpl r6,r1 | ||
| 5988 | bgequ noname.567 | ||
| 5989 | incl r4 | ||
| 5990 | noname.567: | ||
| 5991 | movl r6,r3 | ||
| 5992 | movl r4,r2 | ||
| 5993 | bbc #31,r2,noname.568 | ||
| 5994 | incl r9 | ||
| 5995 | noname.568: | ||
| 5996 | addl2 r2,r2 | ||
| 5997 | bicl2 #0,r2 | ||
| 5998 | bbc #31,r3,noname.569 | ||
| 5999 | incl r2 | ||
| 6000 | noname.569: | ||
| 6001 | addl2 r3,r3 | ||
| 6002 | bicl2 #0,r3 | ||
| 6003 | addl2 r3,r8 | ||
| 6004 | bicl2 #0,r8 | ||
| 6005 | cmpl r8,r3 | ||
| 6006 | bgequ noname.570 | ||
| 6007 | incl r2 | ||
| 6008 | bicl3 #0,r2,r0 | ||
| 6009 | bneq noname.570 | ||
| 6010 | incl r9 | ||
| 6011 | noname.570: | ||
| 6012 | addl2 r2,r10 | ||
| 6013 | bicl2 #0,r10 | ||
| 6014 | cmpl r10,r2 | ||
| 6015 | bgequ noname.571 | ||
| 6016 | incl r9 | ||
| 6017 | noname.571: | ||
| 6018 | |||
| 6019 | movl 4(ap),r0 | ||
| 6020 | movl r8,4(r0) | ||
| 6021 | |||
| 6022 | clrl r8 | ||
| 6023 | |||
| 6024 | movl 8(ap),r4 | ||
| 6025 | movl 4(r4),r3 | ||
| 6026 | bicl3 #-65536,r3,r5 | ||
| 6027 | extzv #16,#16,r3,r0 | ||
| 6028 | bicl3 #-65536,r0,r3 | ||
| 6029 | mull3 r5,r3,r1 | ||
| 6030 | mull2 r5,r5 | ||
| 6031 | mull2 r3,r3 | ||
| 6032 | bicl3 #32767,r1,r0 | ||
| 6033 | extzv #15,#17,r0,r0 | ||
| 6034 | addl2 r0,r3 | ||
| 6035 | bicl2 #-65536,r1 | ||
| 6036 | ashl #17,r1,r1 | ||
| 6037 | addl2 r1,r5 | ||
| 6038 | bicl2 #0,r5 | ||
| 6039 | cmpl r5,r1 | ||
| 6040 | bgequ noname.572 | ||
| 6041 | incl r3 | ||
| 6042 | noname.572: | ||
| 6043 | movl r5,r1 | ||
| 6044 | movl r3,r2 | ||
| 6045 | addl2 r1,r10 | ||
| 6046 | bicl2 #0,r10 | ||
| 6047 | cmpl r10,r1 | ||
| 6048 | bgequ noname.573 | ||
| 6049 | incl r2 | ||
| 6050 | noname.573: | ||
| 6051 | addl2 r2,r9 | ||
| 6052 | bicl2 #0,r9 | ||
| 6053 | cmpl r9,r2 | ||
| 6054 | bgequ noname.574 | ||
| 6055 | incl r8 | ||
| 6056 | noname.574: | ||
| 6057 | |||
| 6058 | bicl3 #-65536,8(r4),r3 | ||
| 6059 | movzwl 10(r4),r1 | ||
| 6060 | bicl2 #-65536,r1 | ||
| 6061 | bicl3 #-65536,(r4),r2 | ||
| 6062 | movzwl 2(r4),r0 | ||
| 6063 | bicl2 #-65536,r0 | ||
| 6064 | movl r3,r6 | ||
| 6065 | movl r1,r5 | ||
| 6066 | mull3 r0,r6,r7 | ||
| 6067 | mull2 r2,r6 | ||
| 6068 | mull2 r5,r2 | ||
| 6069 | mull2 r0,r5 | ||
| 6070 | addl2 r2,r7 | ||
| 6071 | bicl2 #0,r7 | ||
| 6072 | cmpl r7,r2 | ||
| 6073 | bgequ noname.575 | ||
| 6074 | addl2 #65536,r5 | ||
| 6075 | noname.575: | ||
| 6076 | extzv #16,#16,r7,r0 | ||
| 6077 | bicl2 #-65536,r0 | ||
| 6078 | addl2 r0,r5 | ||
| 6079 | bicl3 #-65536,r7,r0 | ||
| 6080 | ashl #16,r0,r1 | ||
| 6081 | addl2 r1,r6 | ||
| 6082 | bicl2 #0,r6 | ||
| 6083 | cmpl r6,r1 | ||
| 6084 | bgequ noname.576 | ||
| 6085 | incl r5 | ||
| 6086 | noname.576: | ||
| 6087 | movl r6,r3 | ||
| 6088 | movl r5,r2 | ||
| 6089 | bbc #31,r2,noname.577 | ||
| 6090 | incl r8 | ||
| 6091 | noname.577: | ||
| 6092 | addl2 r2,r2 | ||
| 6093 | bicl2 #0,r2 | ||
| 6094 | bbc #31,r3,noname.578 | ||
| 6095 | incl r2 | ||
| 6096 | noname.578: | ||
| 6097 | addl2 r3,r3 | ||
| 6098 | bicl2 #0,r3 | ||
| 6099 | addl2 r3,r10 | ||
| 6100 | bicl2 #0,r10 | ||
| 6101 | cmpl r10,r3 | ||
| 6102 | bgequ noname.579 | ||
| 6103 | incl r2 | ||
| 6104 | bicl3 #0,r2,r0 | ||
| 6105 | bneq noname.579 | ||
| 6106 | incl r8 | ||
| 6107 | noname.579: | ||
| 6108 | addl2 r2,r9 | ||
| 6109 | bicl2 #0,r9 | ||
| 6110 | cmpl r9,r2 | ||
| 6111 | bgequ noname.580 | ||
| 6112 | incl r8 | ||
| 6113 | noname.580: | ||
| 6114 | |||
| 6115 | movl 4(ap),r0 | ||
| 6116 | movl r10,8(r0) | ||
| 6117 | |||
| 6118 | clrl r10 | ||
| 6119 | |||
| 6120 | movl 8(ap),r0 | ||
| 6121 | bicl3 #-65536,12(r0),r3 | ||
| 6122 | movzwl 14(r0),r1 | ||
| 6123 | bicl2 #-65536,r1 | ||
| 6124 | bicl3 #-65536,(r0),r2 | ||
| 6125 | movzwl 2(r0),r0 | ||
| 6126 | bicl2 #-65536,r0 | ||
| 6127 | movl r3,r5 | ||
| 6128 | movl r1,r4 | ||
| 6129 | mull3 r0,r5,r6 | ||
| 6130 | mull2 r2,r5 | ||
| 6131 | mull3 r2,r4,-12(fp) | ||
| 6132 | mull2 r0,r4 | ||
| 6133 | addl2 -12(fp),r6 | ||
| 6134 | bicl2 #0,r6 | ||
| 6135 | cmpl r6,-12(fp) | ||
| 6136 | bgequ noname.581 | ||
| 6137 | addl2 #65536,r4 | ||
| 6138 | noname.581: | ||
| 6139 | extzv #16,#16,r6,r0 | ||
| 6140 | bicl2 #-65536,r0 | ||
| 6141 | addl2 r0,r4 | ||
| 6142 | bicl3 #-65536,r6,r0 | ||
| 6143 | ashl #16,r0,-12(fp) | ||
| 6144 | addl2 -12(fp),r5 | ||
| 6145 | bicl2 #0,r5 | ||
| 6146 | cmpl r5,-12(fp) | ||
| 6147 | bgequ noname.582 | ||
| 6148 | incl r4 | ||
| 6149 | noname.582: | ||
| 6150 | movl r5,r3 | ||
| 6151 | movl r4,r2 | ||
| 6152 | bbc #31,r2,noname.583 | ||
| 6153 | incl r10 | ||
| 6154 | noname.583: | ||
| 6155 | addl2 r2,r2 | ||
| 6156 | bicl2 #0,r2 | ||
| 6157 | bbc #31,r3,noname.584 | ||
| 6158 | incl r2 | ||
| 6159 | noname.584: | ||
| 6160 | addl2 r3,r3 | ||
| 6161 | bicl2 #0,r3 | ||
| 6162 | addl2 r3,r9 | ||
| 6163 | bicl2 #0,r9 | ||
| 6164 | cmpl r9,r3 | ||
| 6165 | bgequ noname.585 | ||
| 6166 | incl r2 | ||
| 6167 | bicl3 #0,r2,r0 | ||
| 6168 | bneq noname.585 | ||
| 6169 | incl r10 | ||
| 6170 | noname.585: | ||
| 6171 | addl2 r2,r8 | ||
| 6172 | bicl2 #0,r8 | ||
| 6173 | cmpl r8,r2 | ||
| 6174 | bgequ noname.586 | ||
| 6175 | incl r10 | ||
| 6176 | noname.586: | ||
| 6177 | |||
| 6178 | movl 8(ap),r0 | ||
| 6179 | bicl3 #-65536,8(r0),r3 | ||
| 6180 | movzwl 10(r0),r1 | ||
| 6181 | bicl2 #-65536,r1 | ||
| 6182 | bicl3 #-65536,4(r0),r2 | ||
| 6183 | movzwl 6(r0),r0 | ||
| 6184 | bicl2 #-65536,r0 | ||
| 6185 | movl r3,r5 | ||
| 6186 | movl r1,r4 | ||
| 6187 | mull3 r0,r5,-16(fp) | ||
| 6188 | mull2 r2,r5 | ||
| 6189 | mull3 r2,r4,-20(fp) | ||
| 6190 | mull2 r0,r4 | ||
| 6191 | addl3 -16(fp),-20(fp),r0 | ||
| 6192 | bicl3 #0,r0,-16(fp) | ||
| 6193 | cmpl -16(fp),-20(fp) | ||
| 6194 | bgequ noname.587 | ||
| 6195 | addl2 #65536,r4 | ||
| 6196 | noname.587: | ||
| 6197 | movzwl -14(fp),r0 | ||
| 6198 | bicl2 #-65536,r0 | ||
| 6199 | addl2 r0,r4 | ||
| 6200 | bicl3 #-65536,-16(fp),r0 | ||
| 6201 | ashl #16,r0,-20(fp) | ||
| 6202 | addl2 -20(fp),r5 | ||
| 6203 | bicl2 #0,r5 | ||
| 6204 | cmpl r5,-20(fp) | ||
| 6205 | bgequ noname.588 | ||
| 6206 | incl r4 | ||
| 6207 | noname.588: | ||
| 6208 | movl r5,r3 | ||
| 6209 | movl r4,r2 | ||
| 6210 | bbc #31,r2,noname.589 | ||
| 6211 | incl r10 | ||
| 6212 | noname.589: | ||
| 6213 | addl2 r2,r2 | ||
| 6214 | bicl2 #0,r2 | ||
| 6215 | bbc #31,r3,noname.590 | ||
| 6216 | incl r2 | ||
| 6217 | noname.590: | ||
| 6218 | addl2 r3,r3 | ||
| 6219 | bicl2 #0,r3 | ||
| 6220 | addl2 r3,r9 | ||
| 6221 | bicl2 #0,r9 | ||
| 6222 | cmpl r9,r3 | ||
| 6223 | bgequ noname.591 | ||
| 6224 | incl r2 | ||
| 6225 | bicl3 #0,r2,r0 | ||
| 6226 | bneq noname.591 | ||
| 6227 | incl r10 | ||
| 6228 | noname.591: | ||
| 6229 | addl2 r2,r8 | ||
| 6230 | bicl2 #0,r8 | ||
| 6231 | cmpl r8,r2 | ||
| 6232 | bgequ noname.592 | ||
| 6233 | incl r10 | ||
| 6234 | noname.592: | ||
| 6235 | movl 4(ap),r0 | ||
| 6236 | movl r9,12(r0) | ||
| 6237 | |||
| 6238 | clrl r9 | ||
| 6239 | |||
| 6240 | movl 8(ap),r3 | ||
| 6241 | movl 8(r3),r4 | ||
| 6242 | bicl3 #-65536,r4,r5 | ||
| 6243 | extzv #16,#16,r4,r0 | ||
| 6244 | bicl3 #-65536,r0,r4 | ||
| 6245 | mull3 r5,r4,-24(fp) | ||
| 6246 | mull2 r5,r5 | ||
| 6247 | mull2 r4,r4 | ||
| 6248 | bicl3 #32767,-24(fp),r0 | ||
| 6249 | extzv #15,#17,r0,r0 | ||
| 6250 | addl2 r0,r4 | ||
| 6251 | bicl3 #-65536,-24(fp),r0 | ||
| 6252 | ashl #17,r0,-24(fp) | ||
| 6253 | addl2 -24(fp),r5 | ||
| 6254 | bicl2 #0,r5 | ||
| 6255 | cmpl r5,-24(fp) | ||
| 6256 | bgequ noname.593 | ||
| 6257 | incl r4 | ||
| 6258 | noname.593: | ||
| 6259 | movl r5,r1 | ||
| 6260 | movl r4,r2 | ||
| 6261 | addl2 r1,r8 | ||
| 6262 | bicl2 #0,r8 | ||
| 6263 | cmpl r8,r1 | ||
| 6264 | bgequ noname.594 | ||
| 6265 | incl r2 | ||
| 6266 | noname.594: | ||
| 6267 | addl2 r2,r10 | ||
| 6268 | bicl2 #0,r10 | ||
| 6269 | cmpl r10,r2 | ||
| 6270 | bgequ noname.595 | ||
| 6271 | incl r9 | ||
| 6272 | noname.595: | ||
| 6273 | |||
| 6274 | bicl3 #-65536,12(r3),r4 | ||
| 6275 | movzwl 14(r3),r1 | ||
| 6276 | bicl2 #-65536,r1 | ||
| 6277 | bicl3 #-65536,4(r3),r2 | ||
| 6278 | movzwl 6(r3),r0 | ||
| 6279 | bicl2 #-65536,r0 | ||
| 6280 | movl r4,r6 | ||
| 6281 | movl r1,r5 | ||
| 6282 | mull3 r0,r6,-28(fp) | ||
| 6283 | mull2 r2,r6 | ||
| 6284 | mull3 r2,r5,-32(fp) | ||
| 6285 | mull2 r0,r5 | ||
| 6286 | addl3 -28(fp),-32(fp),r0 | ||
| 6287 | bicl3 #0,r0,-28(fp) | ||
| 6288 | cmpl -28(fp),-32(fp) | ||
| 6289 | bgequ noname.596 | ||
| 6290 | addl2 #65536,r5 | ||
| 6291 | noname.596: | ||
| 6292 | movzwl -26(fp),r0 | ||
| 6293 | bicl2 #-65536,r0 | ||
| 6294 | addl2 r0,r5 | ||
| 6295 | bicl3 #-65536,-28(fp),r0 | ||
| 6296 | ashl #16,r0,-32(fp) | ||
| 6297 | addl2 -32(fp),r6 | ||
| 6298 | bicl2 #0,r6 | ||
| 6299 | cmpl r6,-32(fp) | ||
| 6300 | bgequ noname.597 | ||
| 6301 | incl r5 | ||
| 6302 | noname.597: | ||
| 6303 | movl r6,r3 | ||
| 6304 | movl r5,r2 | ||
| 6305 | bbc #31,r2,noname.598 | ||
| 6306 | incl r9 | ||
| 6307 | noname.598: | ||
| 6308 | addl2 r2,r2 | ||
| 6309 | bicl2 #0,r2 | ||
| 6310 | bbc #31,r3,noname.599 | ||
| 6311 | incl r2 | ||
| 6312 | noname.599: | ||
| 6313 | addl2 r3,r3 | ||
| 6314 | bicl2 #0,r3 | ||
| 6315 | addl2 r3,r8 | ||
| 6316 | bicl2 #0,r8 | ||
| 6317 | cmpl r8,r3 | ||
| 6318 | bgequ noname.600 | ||
| 6319 | incl r2 | ||
| 6320 | bicl3 #0,r2,r0 | ||
| 6321 | bneq noname.600 | ||
| 6322 | incl r9 | ||
| 6323 | noname.600: | ||
| 6324 | addl2 r2,r10 | ||
| 6325 | bicl2 #0,r10 | ||
| 6326 | cmpl r10,r2 | ||
| 6327 | bgequ noname.601 | ||
| 6328 | incl r9 | ||
| 6329 | noname.601: | ||
| 6330 | |||
| 6331 | movl 4(ap),r0 | ||
| 6332 | movl r8,16(r0) | ||
| 6333 | |||
| 6334 | clrl r8 | ||
| 6335 | |||
| 6336 | movl 8(ap),r0 | ||
| 6337 | bicl3 #-65536,12(r0),r3 | ||
| 6338 | movzwl 14(r0),r1 | ||
| 6339 | bicl2 #-65536,r1 | ||
| 6340 | bicl3 #-65536,8(r0),r2 | ||
| 6341 | movzwl 10(r0),r0 | ||
| 6342 | bicl2 #-65536,r0 | ||
| 6343 | movl r3,r5 | ||
| 6344 | movl r1,r4 | ||
| 6345 | mull3 r0,r5,-36(fp) | ||
| 6346 | mull2 r2,r5 | ||
| 6347 | mull3 r2,r4,-40(fp) | ||
| 6348 | mull2 r0,r4 | ||
| 6349 | addl3 -36(fp),-40(fp),r0 | ||
| 6350 | bicl3 #0,r0,-36(fp) | ||
| 6351 | cmpl -36(fp),-40(fp) | ||
| 6352 | bgequ noname.602 | ||
| 6353 | addl2 #65536,r4 | ||
| 6354 | noname.602: | ||
| 6355 | movzwl -34(fp),r0 | ||
| 6356 | bicl2 #-65536,r0 | ||
| 6357 | addl2 r0,r4 | ||
| 6358 | bicl3 #-65536,-36(fp),r0 | ||
| 6359 | ashl #16,r0,-40(fp) | ||
| 6360 | addl2 -40(fp),r5 | ||
| 6361 | bicl2 #0,r5 | ||
| 6362 | cmpl r5,-40(fp) | ||
| 6363 | bgequ noname.603 | ||
| 6364 | incl r4 | ||
| 6365 | noname.603: | ||
| 6366 | movl r5,r3 | ||
| 6367 | movl r4,r2 | ||
| 6368 | bbc #31,r2,noname.604 | ||
| 6369 | incl r8 | ||
| 6370 | noname.604: | ||
| 6371 | addl2 r2,r2 | ||
| 6372 | bicl2 #0,r2 | ||
| 6373 | bbc #31,r3,noname.605 | ||
| 6374 | incl r2 | ||
| 6375 | noname.605: | ||
| 6376 | addl2 r3,r3 | ||
| 6377 | bicl2 #0,r3 | ||
| 6378 | addl2 r3,r10 | ||
| 6379 | bicl2 #0,r10 | ||
| 6380 | cmpl r10,r3 | ||
| 6381 | bgequ noname.606 | ||
| 6382 | incl r2 | ||
| 6383 | bicl3 #0,r2,r0 | ||
| 6384 | bneq noname.606 | ||
| 6385 | incl r8 | ||
| 6386 | noname.606: | ||
| 6387 | addl2 r2,r9 | ||
| 6388 | bicl2 #0,r9 | ||
| 6389 | cmpl r9,r2 | ||
| 6390 | bgequ noname.607 | ||
| 6391 | incl r8 | ||
| 6392 | noname.607: | ||
| 6393 | |||
| 6394 | movl 4(ap),r4 | ||
| 6395 | movl r10,20(r4) | ||
| 6396 | |||
| 6397 | clrl r10 | ||
| 6398 | |||
| 6399 | movl 8(ap),r0 | ||
| 6400 | movl 12(r0),r3 | ||
| 6401 | bicl3 #-65536,r3,r5 | ||
| 6402 | extzv #16,#16,r3,r0 | ||
| 6403 | bicl3 #-65536,r0,r3 | ||
| 6404 | mull3 r5,r3,-44(fp) | ||
| 6405 | mull2 r5,r5 | ||
| 6406 | mull2 r3,r3 | ||
| 6407 | bicl3 #32767,-44(fp),r0 | ||
| 6408 | extzv #15,#17,r0,r0 | ||
| 6409 | addl2 r0,r3 | ||
| 6410 | bicl3 #-65536,-44(fp),r0 | ||
| 6411 | ashl #17,r0,-44(fp) | ||
| 6412 | addl2 -44(fp),r5 | ||
| 6413 | bicl2 #0,r5 | ||
| 6414 | cmpl r5,-44(fp) | ||
| 6415 | bgequ noname.608 | ||
| 6416 | incl r3 | ||
| 6417 | noname.608: | ||
| 6418 | movl r5,r1 | ||
| 6419 | movl r3,r2 | ||
| 6420 | addl2 r1,r9 | ||
| 6421 | bicl2 #0,r9 | ||
| 6422 | cmpl r9,r1 | ||
| 6423 | bgequ noname.609 | ||
| 6424 | incl r2 | ||
| 6425 | noname.609: | ||
| 6426 | addl2 r2,r8 | ||
| 6427 | bicl2 #0,r8 | ||
| 6428 | cmpl r8,r2 | ||
| 6429 | bgequ noname.610 | ||
| 6430 | incl r10 | ||
| 6431 | noname.610: | ||
| 6432 | |||
| 6433 | movl r9,24(r4) | ||
| 6434 | |||
| 6435 | movl r8,28(r4) | ||
| 6436 | |||
| 6437 | ret | ||
| 6438 | |||
| 6439 | ; For now, the code below doesn't work, so I end this prematurely. | ||
| 6440 | .end | ||
diff --git a/src/lib/libcrypto/bn/asm/x86/f b/src/lib/libcrypto/bn/asm/x86/f new file mode 100644 index 0000000000..22e4112224 --- /dev/null +++ b/src/lib/libcrypto/bn/asm/x86/f | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # x86 assember | ||
| 3 | |||
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index a0bc47837d..e484b7fc11 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
| @@ -253,24 +253,6 @@ extern "C" { | |||
| 253 | #define BN_HEX_FMT2 "%08X" | 253 | #define BN_HEX_FMT2 "%08X" |
| 254 | #endif | 254 | #endif |
| 255 | 255 | ||
| 256 | /* 2011-02-22 SMS. | ||
| 257 | * In various places, a size_t variable or a type cast to size_t was | ||
| 258 | * used to perform integer-only operations on pointers. This failed on | ||
| 259 | * VMS with 64-bit pointers (CC /POINTER_SIZE = 64) because size_t is | ||
| 260 | * still only 32 bits. What's needed in these cases is an integer type | ||
| 261 | * with the same size as a pointer, which size_t is not certain to be. | ||
| 262 | * The only fix here is VMS-specific. | ||
| 263 | */ | ||
| 264 | #if defined(OPENSSL_SYS_VMS) | ||
| 265 | # if __INITIAL_POINTER_SIZE == 64 | ||
| 266 | # define PTR_SIZE_INT long long | ||
| 267 | # else /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 268 | # define PTR_SIZE_INT int | ||
| 269 | # endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
| 270 | #else /* defined(OPENSSL_SYS_VMS) */ | ||
| 271 | # define PTR_SIZE_INT size_t | ||
| 272 | #endif /* defined(OPENSSL_SYS_VMS) [else] */ | ||
| 273 | |||
| 274 | #define BN_DEFAULT_BITS 1280 | 256 | #define BN_DEFAULT_BITS 1280 |
| 275 | 257 | ||
| 276 | #define BN_FLG_MALLOCED 0x01 | 258 | #define BN_FLG_MALLOCED 0x01 |
diff --git a/src/lib/libcrypto/bn/bn.mul b/src/lib/libcrypto/bn/bn.mul new file mode 100644 index 0000000000..9728870d38 --- /dev/null +++ b/src/lib/libcrypto/bn/bn.mul | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | We need | ||
| 2 | |||
| 3 | * bn_mul_comba8 | ||
| 4 | * bn_mul_comba4 | ||
| 5 | * bn_mul_normal | ||
| 6 | * bn_mul_recursive | ||
| 7 | |||
| 8 | * bn_sqr_comba8 | ||
| 9 | * bn_sqr_comba4 | ||
| 10 | bn_sqr_normal -> BN_sqr | ||
| 11 | * bn_sqr_recursive | ||
| 12 | |||
| 13 | * bn_mul_low_recursive | ||
| 14 | * bn_mul_low_normal | ||
| 15 | * bn_mul_high | ||
| 16 | |||
| 17 | * bn_mul_part_recursive # symetric but not power of 2 | ||
| 18 | |||
| 19 | bn_mul_asymetric_recursive # uneven, but do the chop up. | ||
diff --git a/src/lib/libcrypto/bn/bn_exp2.c b/src/lib/libcrypto/bn/bn_exp2.c index bd0c34b91b..b3f43cec8c 100644 --- a/src/lib/libcrypto/bn/bn_exp2.c +++ b/src/lib/libcrypto/bn/bn_exp2.c | |||
| @@ -301,8 +301,7 @@ int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1, | |||
| 301 | r_is_one = 0; | 301 | r_is_one = 0; |
| 302 | } | 302 | } |
| 303 | } | 303 | } |
| 304 | if (!BN_from_montgomery(rr,r,mont,ctx)) | 304 | BN_from_montgomery(rr,r,mont,ctx); |
| 305 | goto err; | ||
| 306 | ret=1; | 305 | ret=1; |
| 307 | err: | 306 | err: |
| 308 | if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); | 307 | if ((in_mont == NULL) && (mont != NULL)) BN_MONT_CTX_free(mont); |
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 432a3aa338..527b0fa15b 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
| @@ -545,7 +545,6 @@ int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 545 | { | 545 | { |
| 546 | while (!BN_is_odd(u)) | 546 | while (!BN_is_odd(u)) |
| 547 | { | 547 | { |
| 548 | if (BN_is_zero(u)) goto err; | ||
| 549 | if (!BN_rshift1(u, u)) goto err; | 548 | if (!BN_rshift1(u, u)) goto err; |
| 550 | if (BN_is_odd(b)) | 549 | if (BN_is_odd(b)) |
| 551 | { | 550 | { |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index 1a866880f5..7224637ab3 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
| @@ -277,7 +277,7 @@ static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) | |||
| 277 | m1|=m2; /* (al!=ri) */ | 277 | m1|=m2; /* (al!=ri) */ |
| 278 | m1|=(0-(size_t)v); /* (al!=ri || v) */ | 278 | m1|=(0-(size_t)v); /* (al!=ri || v) */ |
| 279 | m1&=~m2; /* (al!=ri || v) && !al>ri */ | 279 | m1&=~m2; /* (al!=ri || v) && !al>ri */ |
| 280 | nrp=(BN_ULONG *)(((PTR_SIZE_INT)rp&~m1)|((PTR_SIZE_INT)ap&m1)); | 280 | nrp=(BN_ULONG *)(((size_t)rp&~m1)|((size_t)ap&m1)); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | /* 'i<ri' is chosen to eliminate dependency on input data, even | 283 | /* 'i<ri' is chosen to eliminate dependency on input data, even |
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index 12e5be80eb..a0e9ec3b46 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -551,7 +551,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, | |||
| 551 | int tna, int tnb, BN_ULONG *t) | 551 | int tna, int tnb, BN_ULONG *t) |
| 552 | { | 552 | { |
| 553 | int i,j,n2=n*2; | 553 | int i,j,n2=n*2; |
| 554 | int c1,c2,neg; | 554 | int c1,c2,neg,zero; |
| 555 | BN_ULONG ln,lo,*p; | 555 | BN_ULONG ln,lo,*p; |
| 556 | 556 | ||
| 557 | # ifdef BN_COUNT | 557 | # ifdef BN_COUNT |
| @@ -567,7 +567,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, | |||
| 567 | /* r=(a[0]-a[1])*(b[1]-b[0]) */ | 567 | /* r=(a[0]-a[1])*(b[1]-b[0]) */ |
| 568 | c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna); | 568 | c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna); |
| 569 | c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n); | 569 | c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n); |
| 570 | neg=0; | 570 | zero=neg=0; |
| 571 | switch (c1*3+c2) | 571 | switch (c1*3+c2) |
| 572 | { | 572 | { |
| 573 | case -4: | 573 | case -4: |
| @@ -575,6 +575,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, | |||
| 575 | bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */ | 575 | bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */ |
| 576 | break; | 576 | break; |
| 577 | case -3: | 577 | case -3: |
| 578 | zero=1; | ||
| 578 | /* break; */ | 579 | /* break; */ |
| 579 | case -2: | 580 | case -2: |
| 580 | bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */ | 581 | bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */ |
| @@ -584,6 +585,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, | |||
| 584 | case -1: | 585 | case -1: |
| 585 | case 0: | 586 | case 0: |
| 586 | case 1: | 587 | case 1: |
| 588 | zero=1; | ||
| 587 | /* break; */ | 589 | /* break; */ |
| 588 | case 2: | 590 | case 2: |
| 589 | bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */ | 591 | bn_sub_part_words(t, a, &(a[n]),tna,n-tna); /* + */ |
| @@ -591,6 +593,7 @@ void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, | |||
| 591 | neg=1; | 593 | neg=1; |
| 592 | break; | 594 | break; |
| 593 | case 3: | 595 | case 3: |
| 596 | zero=1; | ||
| 594 | /* break; */ | 597 | /* break; */ |
| 595 | case 4: | 598 | case 4: |
| 596 | bn_sub_part_words(t, a, &(a[n]),tna,n-tna); | 599 | bn_sub_part_words(t, a, &(a[n]),tna,n-tna); |
| @@ -1009,6 +1012,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | |||
| 1009 | { | 1012 | { |
| 1010 | if (i >= -1 && i <= 1) | 1013 | if (i >= -1 && i <= 1) |
| 1011 | { | 1014 | { |
| 1015 | int sav_j =0; | ||
| 1012 | /* Find out the power of two lower or equal | 1016 | /* Find out the power of two lower or equal |
| 1013 | to the longest of the two numbers */ | 1017 | to the longest of the two numbers */ |
| 1014 | if (i >= 0) | 1018 | if (i >= 0) |
| @@ -1019,6 +1023,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) | |||
| 1019 | { | 1023 | { |
| 1020 | j = BN_num_bits_word((BN_ULONG)bl); | 1024 | j = BN_num_bits_word((BN_ULONG)bl); |
| 1021 | } | 1025 | } |
| 1026 | sav_j = j; | ||
| 1022 | j = 1<<(j-1); | 1027 | j = 1<<(j-1); |
| 1023 | assert(j <= al || j <= bl); | 1028 | assert(j <= al || j <= bl); |
| 1024 | k = j+j; | 1029 | k = j+j; |
diff --git a/src/lib/libcrypto/bn/bn_nist.c b/src/lib/libcrypto/bn/bn_nist.c index c6de032696..2ca5b01391 100644 --- a/src/lib/libcrypto/bn/bn_nist.c +++ b/src/lib/libcrypto/bn/bn_nist.c | |||
| @@ -354,7 +354,7 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 354 | buf[BN_NIST_192_TOP], | 354 | buf[BN_NIST_192_TOP], |
| 355 | c_d[BN_NIST_192_TOP], | 355 | c_d[BN_NIST_192_TOP], |
| 356 | *res; | 356 | *res; |
| 357 | PTR_SIZE_INT mask; | 357 | size_t mask; |
| 358 | static const BIGNUM _bignum_nist_p_192_sqr = { | 358 | static const BIGNUM _bignum_nist_p_192_sqr = { |
| 359 | (BN_ULONG *)_nist_p_192_sqr, | 359 | (BN_ULONG *)_nist_p_192_sqr, |
| 360 | sizeof(_nist_p_192_sqr)/sizeof(_nist_p_192_sqr[0]), | 360 | sizeof(_nist_p_192_sqr)/sizeof(_nist_p_192_sqr[0]), |
| @@ -405,10 +405,9 @@ int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 405 | * 'tmp=result-modulus; if (!carry || !borrow) result=tmp;' | 405 | * 'tmp=result-modulus; if (!carry || !borrow) result=tmp;' |
| 406 | * this is what happens below, but without explicit if:-) a. | 406 | * this is what happens below, but without explicit if:-) a. |
| 407 | */ | 407 | */ |
| 408 | mask = 0-(PTR_SIZE_INT)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP); | 408 | mask = 0-(size_t)bn_sub_words(c_d,r_d,_nist_p_192[0],BN_NIST_192_TOP); |
| 409 | mask &= 0-(PTR_SIZE_INT)carry; | 409 | mask &= 0-(size_t)carry; |
| 410 | res = (BN_ULONG *) | 410 | res = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask)); |
| 411 | (((PTR_SIZE_INT)c_d&~mask) | ((PTR_SIZE_INT)r_d&mask)); | ||
| 412 | nist_cp_bn(r_d, res, BN_NIST_192_TOP); | 411 | nist_cp_bn(r_d, res, BN_NIST_192_TOP); |
| 413 | r->top = BN_NIST_192_TOP; | 412 | r->top = BN_NIST_192_TOP; |
| 414 | bn_correct_top(r); | 413 | bn_correct_top(r); |
| @@ -439,8 +438,8 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 439 | buf[BN_NIST_224_TOP], | 438 | buf[BN_NIST_224_TOP], |
| 440 | c_d[BN_NIST_224_TOP], | 439 | c_d[BN_NIST_224_TOP], |
| 441 | *res; | 440 | *res; |
| 442 | PTR_SIZE_INT mask; | 441 | size_t mask; |
| 443 | union { bn_addsub_f f; PTR_SIZE_INT p; } u; | 442 | union { bn_addsub_f f; size_t p; } u; |
| 444 | static const BIGNUM _bignum_nist_p_224_sqr = { | 443 | static const BIGNUM _bignum_nist_p_224_sqr = { |
| 445 | (BN_ULONG *)_nist_p_224_sqr, | 444 | (BN_ULONG *)_nist_p_224_sqr, |
| 446 | sizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]), | 445 | sizeof(_nist_p_224_sqr)/sizeof(_nist_p_224_sqr[0]), |
| @@ -511,18 +510,16 @@ int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 511 | * to be compared to the modulus and conditionally | 510 | * to be compared to the modulus and conditionally |
| 512 | * adjusted by *subtracting* the latter. */ | 511 | * adjusted by *subtracting* the latter. */ |
| 513 | carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP); | 512 | carry = (int)bn_add_words(r_d,r_d,_nist_p_224[-carry-1],BN_NIST_224_TOP); |
| 514 | mask = 0-(PTR_SIZE_INT)carry; | 513 | mask = 0-(size_t)carry; |
| 515 | u.p = ((PTR_SIZE_INT)bn_sub_words&mask) | | 514 | u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask); |
| 516 | ((PTR_SIZE_INT)bn_add_words&~mask); | ||
| 517 | } | 515 | } |
| 518 | else | 516 | else |
| 519 | carry = 1; | 517 | carry = 1; |
| 520 | 518 | ||
| 521 | /* otherwise it's effectively same as in BN_nist_mod_192... */ | 519 | /* otherwise it's effectively same as in BN_nist_mod_192... */ |
| 522 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP); | 520 | mask = 0-(size_t)(*u.f)(c_d,r_d,_nist_p_224[0],BN_NIST_224_TOP); |
| 523 | mask &= 0-(PTR_SIZE_INT)carry; | 521 | mask &= 0-(size_t)carry; |
| 524 | res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) | | 522 | res = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask)); |
| 525 | ((PTR_SIZE_INT)r_d&mask)); | ||
| 526 | nist_cp_bn(r_d, res, BN_NIST_224_TOP); | 523 | nist_cp_bn(r_d, res, BN_NIST_224_TOP); |
| 527 | r->top = BN_NIST_224_TOP; | 524 | r->top = BN_NIST_224_TOP; |
| 528 | bn_correct_top(r); | 525 | bn_correct_top(r); |
| @@ -552,8 +549,8 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 552 | buf[BN_NIST_256_TOP], | 549 | buf[BN_NIST_256_TOP], |
| 553 | c_d[BN_NIST_256_TOP], | 550 | c_d[BN_NIST_256_TOP], |
| 554 | *res; | 551 | *res; |
| 555 | PTR_SIZE_INT mask; | 552 | size_t mask; |
| 556 | union { bn_addsub_f f; PTR_SIZE_INT p; } u; | 553 | union { bn_addsub_f f; size_t p; } u; |
| 557 | static const BIGNUM _bignum_nist_p_256_sqr = { | 554 | static const BIGNUM _bignum_nist_p_256_sqr = { |
| 558 | (BN_ULONG *)_nist_p_256_sqr, | 555 | (BN_ULONG *)_nist_p_256_sqr, |
| 559 | sizeof(_nist_p_256_sqr)/sizeof(_nist_p_256_sqr[0]), | 556 | sizeof(_nist_p_256_sqr)/sizeof(_nist_p_256_sqr[0]), |
| @@ -632,17 +629,15 @@ int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 632 | else if (carry < 0) | 629 | else if (carry < 0) |
| 633 | { | 630 | { |
| 634 | carry = (int)bn_add_words(r_d,r_d,_nist_p_256[-carry-1],BN_NIST_256_TOP); | 631 | carry = (int)bn_add_words(r_d,r_d,_nist_p_256[-carry-1],BN_NIST_256_TOP); |
| 635 | mask = 0-(PTR_SIZE_INT)carry; | 632 | mask = 0-(size_t)carry; |
| 636 | u.p = ((PTR_SIZE_INT)bn_sub_words&mask) | | 633 | u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask); |
| 637 | ((PTR_SIZE_INT)bn_add_words&~mask); | ||
| 638 | } | 634 | } |
| 639 | else | 635 | else |
| 640 | carry = 1; | 636 | carry = 1; |
| 641 | 637 | ||
| 642 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP); | 638 | mask = 0-(size_t)(*u.f)(c_d,r_d,_nist_p_256[0],BN_NIST_256_TOP); |
| 643 | mask &= 0-(PTR_SIZE_INT)carry; | 639 | mask &= 0-(size_t)carry; |
| 644 | res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) | | 640 | res = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask)); |
| 645 | ((PTR_SIZE_INT)r_d&mask)); | ||
| 646 | nist_cp_bn(r_d, res, BN_NIST_256_TOP); | 641 | nist_cp_bn(r_d, res, BN_NIST_256_TOP); |
| 647 | r->top = BN_NIST_256_TOP; | 642 | r->top = BN_NIST_256_TOP; |
| 648 | bn_correct_top(r); | 643 | bn_correct_top(r); |
| @@ -676,8 +671,8 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 676 | buf[BN_NIST_384_TOP], | 671 | buf[BN_NIST_384_TOP], |
| 677 | c_d[BN_NIST_384_TOP], | 672 | c_d[BN_NIST_384_TOP], |
| 678 | *res; | 673 | *res; |
| 679 | PTR_SIZE_INT mask; | 674 | size_t mask; |
| 680 | union { bn_addsub_f f; PTR_SIZE_INT p; } u; | 675 | union { bn_addsub_f f; size_t p; } u; |
| 681 | static const BIGNUM _bignum_nist_p_384_sqr = { | 676 | static const BIGNUM _bignum_nist_p_384_sqr = { |
| 682 | (BN_ULONG *)_nist_p_384_sqr, | 677 | (BN_ULONG *)_nist_p_384_sqr, |
| 683 | sizeof(_nist_p_384_sqr)/sizeof(_nist_p_384_sqr[0]), | 678 | sizeof(_nist_p_384_sqr)/sizeof(_nist_p_384_sqr[0]), |
| @@ -759,17 +754,15 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 759 | else if (carry < 0) | 754 | else if (carry < 0) |
| 760 | { | 755 | { |
| 761 | carry = (int)bn_add_words(r_d,r_d,_nist_p_384[-carry-1],BN_NIST_384_TOP); | 756 | carry = (int)bn_add_words(r_d,r_d,_nist_p_384[-carry-1],BN_NIST_384_TOP); |
| 762 | mask = 0-(PTR_SIZE_INT)carry; | 757 | mask = 0-(size_t)carry; |
| 763 | u.p = ((PTR_SIZE_INT)bn_sub_words&mask) | | 758 | u.p = ((size_t)bn_sub_words&mask) | ((size_t)bn_add_words&~mask); |
| 764 | ((PTR_SIZE_INT)bn_add_words&~mask); | ||
| 765 | } | 759 | } |
| 766 | else | 760 | else |
| 767 | carry = 1; | 761 | carry = 1; |
| 768 | 762 | ||
| 769 | mask = 0-(PTR_SIZE_INT)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP); | 763 | mask = 0-(size_t)(*u.f)(c_d,r_d,_nist_p_384[0],BN_NIST_384_TOP); |
| 770 | mask &= 0-(PTR_SIZE_INT)carry; | 764 | mask &= 0-(size_t)carry; |
| 771 | res = (BN_ULONG *)(((PTR_SIZE_INT)c_d&~mask) | | 765 | res = (BN_ULONG *)(((size_t)c_d&~mask) | ((size_t)r_d&mask)); |
| 772 | ((PTR_SIZE_INT)r_d&mask)); | ||
| 773 | nist_cp_bn(r_d, res, BN_NIST_384_TOP); | 766 | nist_cp_bn(r_d, res, BN_NIST_384_TOP); |
| 774 | r->top = BN_NIST_384_TOP; | 767 | r->top = BN_NIST_384_TOP; |
| 775 | bn_correct_top(r); | 768 | bn_correct_top(r); |
| @@ -788,7 +781,7 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 788 | BN_ULONG *r_d, *a_d = a->d, | 781 | BN_ULONG *r_d, *a_d = a->d, |
| 789 | t_d[BN_NIST_521_TOP], | 782 | t_d[BN_NIST_521_TOP], |
| 790 | val,tmp,*res; | 783 | val,tmp,*res; |
| 791 | PTR_SIZE_INT mask; | 784 | size_t mask; |
| 792 | static const BIGNUM _bignum_nist_p_521_sqr = { | 785 | static const BIGNUM _bignum_nist_p_521_sqr = { |
| 793 | (BN_ULONG *)_nist_p_521_sqr, | 786 | (BN_ULONG *)_nist_p_521_sqr, |
| 794 | sizeof(_nist_p_521_sqr)/sizeof(_nist_p_521_sqr[0]), | 787 | sizeof(_nist_p_521_sqr)/sizeof(_nist_p_521_sqr[0]), |
| @@ -833,9 +826,8 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, | |||
| 833 | r_d[i] &= BN_NIST_521_TOP_MASK; | 826 | r_d[i] &= BN_NIST_521_TOP_MASK; |
| 834 | 827 | ||
| 835 | bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP); | 828 | bn_add_words(r_d,r_d,t_d,BN_NIST_521_TOP); |
| 836 | mask = 0-(PTR_SIZE_INT)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP); | 829 | mask = 0-(size_t)bn_sub_words(t_d,r_d,_nist_p_521,BN_NIST_521_TOP); |
| 837 | res = (BN_ULONG *)(((PTR_SIZE_INT)t_d&~mask) | | 830 | res = (BN_ULONG *)(((size_t)t_d&~mask) | ((size_t)r_d&mask)); |
| 838 | ((PTR_SIZE_INT)r_d&mask)); | ||
| 839 | nist_cp_bn(r_d,res,BN_NIST_521_TOP); | 831 | nist_cp_bn(r_d,res,BN_NIST_521_TOP); |
| 840 | r->top = BN_NIST_521_TOP; | 832 | r->top = BN_NIST_521_TOP; |
| 841 | bn_correct_top(r); | 833 | bn_correct_top(r); |
diff --git a/src/lib/libcrypto/bn/bn_x931p.c b/src/lib/libcrypto/bn/bn_x931p.c deleted file mode 100644 index 04c5c874ec..0000000000 --- a/src/lib/libcrypto/bn/bn_x931p.c +++ /dev/null | |||
| @@ -1,272 +0,0 @@ | |||
| 1 | /* bn_x931p.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 2005. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2005 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/bn.h> | ||
| 61 | |||
| 62 | /* X9.31 routines for prime derivation */ | ||
| 63 | |||
| 64 | /* X9.31 prime derivation. This is used to generate the primes pi | ||
| 65 | * (p1, p2, q1, q2) from a parameter Xpi by checking successive odd | ||
| 66 | * integers. | ||
| 67 | */ | ||
| 68 | |||
| 69 | static int bn_x931_derive_pi(BIGNUM *pi, const BIGNUM *Xpi, BN_CTX *ctx, | ||
| 70 | BN_GENCB *cb) | ||
| 71 | { | ||
| 72 | int i = 0; | ||
| 73 | if (!BN_copy(pi, Xpi)) | ||
| 74 | return 0; | ||
| 75 | if (!BN_is_odd(pi) && !BN_add_word(pi, 1)) | ||
| 76 | return 0; | ||
| 77 | for(;;) | ||
| 78 | { | ||
| 79 | i++; | ||
| 80 | BN_GENCB_call(cb, 0, i); | ||
| 81 | /* NB 27 MR is specificed in X9.31 */ | ||
| 82 | if (BN_is_prime_fasttest_ex(pi, 27, ctx, 1, cb)) | ||
| 83 | break; | ||
| 84 | if (!BN_add_word(pi, 2)) | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | BN_GENCB_call(cb, 2, i); | ||
| 88 | return 1; | ||
| 89 | } | ||
| 90 | |||
| 91 | /* This is the main X9.31 prime derivation function. From parameters | ||
| 92 | * Xp1, Xp2 and Xp derive the prime p. If the parameters p1 or p2 are | ||
| 93 | * not NULL they will be returned too: this is needed for testing. | ||
| 94 | */ | ||
| 95 | |||
| 96 | int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 97 | const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2, | ||
| 98 | const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb) | ||
| 99 | { | ||
| 100 | int ret = 0; | ||
| 101 | |||
| 102 | BIGNUM *t, *p1p2, *pm1; | ||
| 103 | |||
| 104 | /* Only even e supported */ | ||
| 105 | if (!BN_is_odd(e)) | ||
| 106 | return 0; | ||
| 107 | |||
| 108 | BN_CTX_start(ctx); | ||
| 109 | if (!p1) | ||
| 110 | p1 = BN_CTX_get(ctx); | ||
| 111 | |||
| 112 | if (!p2) | ||
| 113 | p2 = BN_CTX_get(ctx); | ||
| 114 | |||
| 115 | t = BN_CTX_get(ctx); | ||
| 116 | |||
| 117 | p1p2 = BN_CTX_get(ctx); | ||
| 118 | |||
| 119 | pm1 = BN_CTX_get(ctx); | ||
| 120 | |||
| 121 | if (!bn_x931_derive_pi(p1, Xp1, ctx, cb)) | ||
| 122 | goto err; | ||
| 123 | |||
| 124 | if (!bn_x931_derive_pi(p2, Xp2, ctx, cb)) | ||
| 125 | goto err; | ||
| 126 | |||
| 127 | if (!BN_mul(p1p2, p1, p2, ctx)) | ||
| 128 | goto err; | ||
| 129 | |||
| 130 | /* First set p to value of Rp */ | ||
| 131 | |||
| 132 | if (!BN_mod_inverse(p, p2, p1, ctx)) | ||
| 133 | goto err; | ||
| 134 | |||
| 135 | if (!BN_mul(p, p, p2, ctx)) | ||
| 136 | goto err; | ||
| 137 | |||
| 138 | if (!BN_mod_inverse(t, p1, p2, ctx)) | ||
| 139 | goto err; | ||
| 140 | |||
| 141 | if (!BN_mul(t, t, p1, ctx)) | ||
| 142 | goto err; | ||
| 143 | |||
| 144 | if (!BN_sub(p, p, t)) | ||
| 145 | goto err; | ||
| 146 | |||
| 147 | if (p->neg && !BN_add(p, p, p1p2)) | ||
| 148 | goto err; | ||
| 149 | |||
| 150 | /* p now equals Rp */ | ||
| 151 | |||
| 152 | if (!BN_mod_sub(p, p, Xp, p1p2, ctx)) | ||
| 153 | goto err; | ||
| 154 | |||
| 155 | if (!BN_add(p, p, Xp)) | ||
| 156 | goto err; | ||
| 157 | |||
| 158 | /* p now equals Yp0 */ | ||
| 159 | |||
| 160 | for (;;) | ||
| 161 | { | ||
| 162 | int i = 1; | ||
| 163 | BN_GENCB_call(cb, 0, i++); | ||
| 164 | if (!BN_copy(pm1, p)) | ||
| 165 | goto err; | ||
| 166 | if (!BN_sub_word(pm1, 1)) | ||
| 167 | goto err; | ||
| 168 | if (!BN_gcd(t, pm1, e, ctx)) | ||
| 169 | goto err; | ||
| 170 | if (BN_is_one(t) | ||
| 171 | /* X9.31 specifies 8 MR and 1 Lucas test or any prime test | ||
| 172 | * offering similar or better guarantees 50 MR is considerably | ||
| 173 | * better. | ||
| 174 | */ | ||
| 175 | && BN_is_prime_fasttest_ex(p, 50, ctx, 1, cb)) | ||
| 176 | break; | ||
| 177 | if (!BN_add(p, p, p1p2)) | ||
| 178 | goto err; | ||
| 179 | } | ||
| 180 | |||
| 181 | BN_GENCB_call(cb, 3, 0); | ||
| 182 | |||
| 183 | ret = 1; | ||
| 184 | |||
| 185 | err: | ||
| 186 | |||
| 187 | BN_CTX_end(ctx); | ||
| 188 | |||
| 189 | return ret; | ||
| 190 | } | ||
| 191 | |||
| 192 | /* Generate pair of paramters Xp, Xq for X9.31 prime generation. | ||
| 193 | * Note: nbits paramter is sum of number of bits in both. | ||
| 194 | */ | ||
| 195 | |||
| 196 | int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx) | ||
| 197 | { | ||
| 198 | BIGNUM *t; | ||
| 199 | int i; | ||
| 200 | /* Number of bits for each prime is of the form | ||
| 201 | * 512+128s for s = 0, 1, ... | ||
| 202 | */ | ||
| 203 | if ((nbits < 1024) || (nbits & 0xff)) | ||
| 204 | return 0; | ||
| 205 | nbits >>= 1; | ||
| 206 | /* The random value Xp must be between sqrt(2) * 2^(nbits-1) and | ||
| 207 | * 2^nbits - 1. By setting the top two bits we ensure that the lower | ||
| 208 | * bound is exceeded. | ||
| 209 | */ | ||
| 210 | if (!BN_rand(Xp, nbits, 1, 0)) | ||
| 211 | return 0; | ||
| 212 | |||
| 213 | BN_CTX_start(ctx); | ||
| 214 | t = BN_CTX_get(ctx); | ||
| 215 | |||
| 216 | for (i = 0; i < 1000; i++) | ||
| 217 | { | ||
| 218 | if (!BN_rand(Xq, nbits, 1, 0)) | ||
| 219 | return 0; | ||
| 220 | /* Check that |Xp - Xq| > 2^(nbits - 100) */ | ||
| 221 | BN_sub(t, Xp, Xq); | ||
| 222 | if (BN_num_bits(t) > (nbits - 100)) | ||
| 223 | break; | ||
| 224 | } | ||
| 225 | |||
| 226 | BN_CTX_end(ctx); | ||
| 227 | |||
| 228 | if (i < 1000) | ||
| 229 | return 1; | ||
| 230 | |||
| 231 | return 0; | ||
| 232 | |||
| 233 | } | ||
| 234 | |||
| 235 | /* Generate primes using X9.31 algorithm. Of the values p, p1, p2, Xp1 | ||
| 236 | * and Xp2 only 'p' needs to be non-NULL. If any of the others are not NULL | ||
| 237 | * the relevant parameter will be stored in it. | ||
| 238 | * | ||
| 239 | * Due to the fact that |Xp - Xq| > 2^(nbits - 100) must be satisfied Xp and Xq | ||
| 240 | * are generated using the previous function and supplied as input. | ||
| 241 | */ | ||
| 242 | |||
| 243 | int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, | ||
| 244 | BIGNUM *Xp1, BIGNUM *Xp2, | ||
| 245 | const BIGNUM *Xp, | ||
| 246 | const BIGNUM *e, BN_CTX *ctx, | ||
| 247 | BN_GENCB *cb) | ||
| 248 | { | ||
| 249 | int ret = 0; | ||
| 250 | |||
| 251 | BN_CTX_start(ctx); | ||
| 252 | if (!Xp1) | ||
| 253 | Xp1 = BN_CTX_get(ctx); | ||
| 254 | if (!Xp2) | ||
| 255 | Xp2 = BN_CTX_get(ctx); | ||
| 256 | |||
| 257 | if (!BN_rand(Xp1, 101, 0, 0)) | ||
| 258 | goto error; | ||
| 259 | if (!BN_rand(Xp2, 101, 0, 0)) | ||
| 260 | goto error; | ||
| 261 | if (!BN_X931_derive_prime_ex(p, p1, p2, Xp, Xp1, Xp2, e, ctx, cb)) | ||
| 262 | goto error; | ||
| 263 | |||
| 264 | ret = 1; | ||
| 265 | |||
| 266 | error: | ||
| 267 | BN_CTX_end(ctx); | ||
| 268 | |||
| 269 | return ret; | ||
| 270 | |||
| 271 | } | ||
| 272 | |||
diff --git a/src/lib/libcrypto/bn/bnspeed.c b/src/lib/libcrypto/bn/bnspeed.c new file mode 100644 index 0000000000..b554ac8cf8 --- /dev/null +++ b/src/lib/libcrypto/bn/bnspeed.c | |||
| @@ -0,0 +1,233 @@ | |||
| 1 | /* unused */ | ||
| 2 | |||
| 3 | /* crypto/bn/bnspeed.c */ | ||
| 4 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This package is an SSL implementation written | ||
| 8 | * by Eric Young (eay@cryptsoft.com). | ||
| 9 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 10 | * | ||
| 11 | * This library is free for commercial and non-commercial use as long as | ||
| 12 | * the following conditions are aheared to. The following conditions | ||
| 13 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 14 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 15 | * included with this distribution is covered by the same copyright terms | ||
| 16 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 17 | * | ||
| 18 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 19 | * the code are not to be removed. | ||
| 20 | * If this package is used in a product, Eric Young should be given attribution | ||
| 21 | * as the author of the parts of the library used. | ||
| 22 | * This can be in the form of a textual message at program startup or | ||
| 23 | * in documentation (online or textual) provided with the package. | ||
| 24 | * | ||
| 25 | * Redistribution and use in source and binary forms, with or without | ||
| 26 | * modification, are permitted provided that the following conditions | ||
| 27 | * are met: | ||
| 28 | * 1. Redistributions of source code must retain the copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer. | ||
| 30 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 31 | * notice, this list of conditions and the following disclaimer in the | ||
| 32 | * documentation and/or other materials provided with the distribution. | ||
| 33 | * 3. All advertising materials mentioning features or use of this software | ||
| 34 | * must display the following acknowledgement: | ||
| 35 | * "This product includes cryptographic software written by | ||
| 36 | * Eric Young (eay@cryptsoft.com)" | ||
| 37 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 38 | * being used are not cryptographic related :-). | ||
| 39 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 40 | * the apps directory (application code) you must include an acknowledgement: | ||
| 41 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 42 | * | ||
| 43 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 44 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 46 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 49 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 50 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 52 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 53 | * SUCH DAMAGE. | ||
| 54 | * | ||
| 55 | * The licence and distribution terms for any publically available version or | ||
| 56 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 57 | * copied and put under another distribution licence | ||
| 58 | * [including the GNU Public Licence.] | ||
| 59 | */ | ||
| 60 | |||
| 61 | /* most of this code has been pilfered from my libdes speed.c program */ | ||
| 62 | |||
| 63 | #define BASENUM 1000000 | ||
| 64 | #undef PROG | ||
| 65 | #define PROG bnspeed_main | ||
| 66 | |||
| 67 | #include <stdio.h> | ||
| 68 | #include <stdlib.h> | ||
| 69 | #include <signal.h> | ||
| 70 | #include <string.h> | ||
| 71 | #include <openssl/crypto.h> | ||
| 72 | #include <openssl/err.h> | ||
| 73 | |||
| 74 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 75 | #define TIMES | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #ifndef _IRIX | ||
| 79 | #include <time.h> | ||
| 80 | #endif | ||
| 81 | #ifdef TIMES | ||
| 82 | #include <sys/types.h> | ||
| 83 | #include <sys/times.h> | ||
| 84 | #endif | ||
| 85 | |||
| 86 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 87 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 88 | undefine TIMES, since that tells the rest of the program how things | ||
| 89 | should be handled. -- Richard Levitte */ | ||
| 90 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 91 | #undef TIMES | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #ifndef TIMES | ||
| 95 | #include <sys/timeb.h> | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #if defined(sun) || defined(__ultrix) | ||
| 99 | #define _POSIX_SOURCE | ||
| 100 | #include <limits.h> | ||
| 101 | #include <sys/param.h> | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #include <openssl/bn.h> | ||
| 105 | #include <openssl/x509.h> | ||
| 106 | |||
| 107 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 108 | #ifndef HZ | ||
| 109 | # ifndef CLK_TCK | ||
| 110 | # ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ | ||
| 111 | # define HZ 100.0 | ||
| 112 | # else /* _BSD_CLK_TCK_ */ | ||
| 113 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 114 | # endif | ||
| 115 | # else /* CLK_TCK */ | ||
| 116 | # define HZ ((double)CLK_TCK) | ||
| 117 | # endif | ||
| 118 | #endif | ||
| 119 | |||
| 120 | #undef BUFSIZE | ||
| 121 | #define BUFSIZE ((long)1024*8) | ||
| 122 | int run=0; | ||
| 123 | |||
| 124 | static double Time_F(int s); | ||
| 125 | #define START 0 | ||
| 126 | #define STOP 1 | ||
| 127 | |||
| 128 | static double Time_F(int s) | ||
| 129 | { | ||
| 130 | double ret; | ||
| 131 | #ifdef TIMES | ||
| 132 | static struct tms tstart,tend; | ||
| 133 | |||
| 134 | if (s == START) | ||
| 135 | { | ||
| 136 | times(&tstart); | ||
| 137 | return(0); | ||
| 138 | } | ||
| 139 | else | ||
| 140 | { | ||
| 141 | times(&tend); | ||
| 142 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 143 | return((ret < 1e-3)?1e-3:ret); | ||
| 144 | } | ||
| 145 | #else /* !times() */ | ||
| 146 | static struct timeb tstart,tend; | ||
| 147 | long i; | ||
| 148 | |||
| 149 | if (s == START) | ||
| 150 | { | ||
| 151 | ftime(&tstart); | ||
| 152 | return(0); | ||
| 153 | } | ||
| 154 | else | ||
| 155 | { | ||
| 156 | ftime(&tend); | ||
| 157 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 158 | ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; | ||
| 159 | return((ret < 0.001)?0.001:ret); | ||
| 160 | } | ||
| 161 | #endif | ||
| 162 | } | ||
| 163 | |||
| 164 | #define NUM_SIZES 5 | ||
| 165 | static int sizes[NUM_SIZES]={128,256,512,1024,2048}; | ||
| 166 | /*static int sizes[NUM_SIZES]={59,179,299,419,539}; */ | ||
| 167 | |||
| 168 | void do_mul(BIGNUM *r,BIGNUM *a,BIGNUM *b,BN_CTX *ctx); | ||
| 169 | |||
| 170 | int main(int argc, char **argv) | ||
| 171 | { | ||
| 172 | BN_CTX *ctx; | ||
| 173 | BIGNUM a,b,c; | ||
| 174 | |||
| 175 | ctx=BN_CTX_new(); | ||
| 176 | BN_init(&a); | ||
| 177 | BN_init(&b); | ||
| 178 | BN_init(&c); | ||
| 179 | |||
| 180 | do_mul(&a,&b,&c,ctx); | ||
| 181 | } | ||
| 182 | |||
| 183 | void do_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx) | ||
| 184 | { | ||
| 185 | int i,j,k; | ||
| 186 | double tm; | ||
| 187 | long num; | ||
| 188 | |||
| 189 | for (i=0; i<NUM_SIZES; i++) | ||
| 190 | { | ||
| 191 | num=BASENUM; | ||
| 192 | if (i) num/=(i*3); | ||
| 193 | BN_rand(a,sizes[i],1,0); | ||
| 194 | for (j=i; j<NUM_SIZES; j++) | ||
| 195 | { | ||
| 196 | BN_rand(b,sizes[j],1,0); | ||
| 197 | Time_F(START); | ||
| 198 | for (k=0; k<num; k++) | ||
| 199 | BN_mul(r,b,a,ctx); | ||
| 200 | tm=Time_F(STOP); | ||
| 201 | printf("mul %4d x %4d -> %8.3fms\n",sizes[i],sizes[j],tm*1000.0/num); | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | for (i=0; i<NUM_SIZES; i++) | ||
| 206 | { | ||
| 207 | num=BASENUM; | ||
| 208 | if (i) num/=(i*3); | ||
| 209 | BN_rand(a,sizes[i],1,0); | ||
| 210 | Time_F(START); | ||
| 211 | for (k=0; k<num; k++) | ||
| 212 | BN_sqr(r,a,ctx); | ||
| 213 | tm=Time_F(STOP); | ||
| 214 | printf("sqr %4d x %4d -> %8.3fms\n",sizes[i],sizes[i],tm*1000.0/num); | ||
| 215 | } | ||
| 216 | |||
| 217 | for (i=0; i<NUM_SIZES; i++) | ||
| 218 | { | ||
| 219 | num=BASENUM/10; | ||
| 220 | if (i) num/=(i*3); | ||
| 221 | BN_rand(a,sizes[i]-1,1,0); | ||
| 222 | for (j=i; j<NUM_SIZES; j++) | ||
| 223 | { | ||
| 224 | BN_rand(b,sizes[j],1,0); | ||
| 225 | Time_F(START); | ||
| 226 | for (k=0; k<100000; k++) | ||
| 227 | BN_div(r, NULL, b, a,ctx); | ||
| 228 | tm=Time_F(STOP); | ||
| 229 | printf("div %4d / %4d -> %8.3fms\n",sizes[j],sizes[i]-1,tm*1000.0/num); | ||
| 230 | } | ||
| 231 | } | ||
| 232 | } | ||
| 233 | |||
diff --git a/src/lib/libcrypto/bn/bntest.c b/src/lib/libcrypto/bn/bntest.c new file mode 100644 index 0000000000..0cd99c5b4b --- /dev/null +++ b/src/lib/libcrypto/bn/bntest.c | |||
| @@ -0,0 +1,2013 @@ | |||
| 1 | /* crypto/bn/bntest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 60 | * | ||
| 61 | * Portions of the attached software ("Contribution") are developed by | ||
| 62 | * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. | ||
| 63 | * | ||
| 64 | * The Contribution is licensed pursuant to the Eric Young open source | ||
| 65 | * license provided above. | ||
| 66 | * | ||
| 67 | * The binary polynomial arithmetic software is originally written by | ||
| 68 | * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. | ||
| 69 | * | ||
| 70 | */ | ||
| 71 | |||
| 72 | /* Until the key-gen callbacks are modified to use newer prototypes, we allow | ||
| 73 | * deprecated functions for openssl-internal code */ | ||
| 74 | #ifdef OPENSSL_NO_DEPRECATED | ||
| 75 | #undef OPENSSL_NO_DEPRECATED | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #include <stdio.h> | ||
| 79 | #include <stdlib.h> | ||
| 80 | #include <string.h> | ||
| 81 | |||
| 82 | #include "e_os.h" | ||
| 83 | |||
| 84 | #include <openssl/bio.h> | ||
| 85 | #include <openssl/bn.h> | ||
| 86 | #include <openssl/rand.h> | ||
| 87 | #include <openssl/x509.h> | ||
| 88 | #include <openssl/err.h> | ||
| 89 | |||
| 90 | const int num0 = 100; /* number of tests */ | ||
| 91 | const int num1 = 50; /* additional tests for some functions */ | ||
| 92 | const int num2 = 5; /* number of tests for slow functions */ | ||
| 93 | |||
| 94 | int test_add(BIO *bp); | ||
| 95 | int test_sub(BIO *bp); | ||
| 96 | int test_lshift1(BIO *bp); | ||
| 97 | int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_); | ||
| 98 | int test_rshift1(BIO *bp); | ||
| 99 | int test_rshift(BIO *bp,BN_CTX *ctx); | ||
| 100 | int test_div(BIO *bp,BN_CTX *ctx); | ||
| 101 | int test_div_word(BIO *bp); | ||
| 102 | int test_div_recp(BIO *bp,BN_CTX *ctx); | ||
| 103 | int test_mul(BIO *bp); | ||
| 104 | int test_sqr(BIO *bp,BN_CTX *ctx); | ||
| 105 | int test_mont(BIO *bp,BN_CTX *ctx); | ||
| 106 | int test_mod(BIO *bp,BN_CTX *ctx); | ||
| 107 | int test_mod_mul(BIO *bp,BN_CTX *ctx); | ||
| 108 | int test_mod_exp(BIO *bp,BN_CTX *ctx); | ||
| 109 | int test_mod_exp_mont_consttime(BIO *bp,BN_CTX *ctx); | ||
| 110 | int test_exp(BIO *bp,BN_CTX *ctx); | ||
| 111 | int test_gf2m_add(BIO *bp); | ||
| 112 | int test_gf2m_mod(BIO *bp); | ||
| 113 | int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx); | ||
| 114 | int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx); | ||
| 115 | int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx); | ||
| 116 | int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx); | ||
| 117 | int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx); | ||
| 118 | int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx); | ||
| 119 | int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx); | ||
| 120 | int test_kron(BIO *bp,BN_CTX *ctx); | ||
| 121 | int test_sqrt(BIO *bp,BN_CTX *ctx); | ||
| 122 | int rand_neg(void); | ||
| 123 | static int results=0; | ||
| 124 | |||
| 125 | static unsigned char lst[]="\xC6\x4F\x43\x04\x2A\xEA\xCA\x6E\x58\x36\x80\x5B\xE8\xC9" | ||
| 126 | "\x9B\x04\x5D\x48\x36\xC2\xFD\x16\xC9\x64\xF0"; | ||
| 127 | |||
| 128 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 129 | |||
| 130 | static void message(BIO *out, char *m) | ||
| 131 | { | ||
| 132 | fprintf(stderr, "test %s\n", m); | ||
| 133 | BIO_puts(out, "print \"test "); | ||
| 134 | BIO_puts(out, m); | ||
| 135 | BIO_puts(out, "\\n\"\n"); | ||
| 136 | } | ||
| 137 | |||
| 138 | int main(int argc, char *argv[]) | ||
| 139 | { | ||
| 140 | BN_CTX *ctx; | ||
| 141 | BIO *out; | ||
| 142 | char *outfile=NULL; | ||
| 143 | |||
| 144 | results = 0; | ||
| 145 | |||
| 146 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */ | ||
| 147 | |||
| 148 | argc--; | ||
| 149 | argv++; | ||
| 150 | while (argc >= 1) | ||
| 151 | { | ||
| 152 | if (strcmp(*argv,"-results") == 0) | ||
| 153 | results=1; | ||
| 154 | else if (strcmp(*argv,"-out") == 0) | ||
| 155 | { | ||
| 156 | if (--argc < 1) break; | ||
| 157 | outfile= *(++argv); | ||
| 158 | } | ||
| 159 | argc--; | ||
| 160 | argv++; | ||
| 161 | } | ||
| 162 | |||
| 163 | |||
| 164 | ctx=BN_CTX_new(); | ||
| 165 | if (ctx == NULL) EXIT(1); | ||
| 166 | |||
| 167 | out=BIO_new(BIO_s_file()); | ||
| 168 | if (out == NULL) EXIT(1); | ||
| 169 | if (outfile == NULL) | ||
| 170 | { | ||
| 171 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | ||
| 172 | } | ||
| 173 | else | ||
| 174 | { | ||
| 175 | if (!BIO_write_filename(out,outfile)) | ||
| 176 | { | ||
| 177 | perror(outfile); | ||
| 178 | EXIT(1); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | if (!results) | ||
| 183 | BIO_puts(out,"obase=16\nibase=16\n"); | ||
| 184 | |||
| 185 | message(out,"BN_add"); | ||
| 186 | if (!test_add(out)) goto err; | ||
| 187 | (void)BIO_flush(out); | ||
| 188 | |||
| 189 | message(out,"BN_sub"); | ||
| 190 | if (!test_sub(out)) goto err; | ||
| 191 | (void)BIO_flush(out); | ||
| 192 | |||
| 193 | message(out,"BN_lshift1"); | ||
| 194 | if (!test_lshift1(out)) goto err; | ||
| 195 | (void)BIO_flush(out); | ||
| 196 | |||
| 197 | message(out,"BN_lshift (fixed)"); | ||
| 198 | if (!test_lshift(out,ctx,BN_bin2bn(lst,sizeof(lst)-1,NULL))) | ||
| 199 | goto err; | ||
| 200 | (void)BIO_flush(out); | ||
| 201 | |||
| 202 | message(out,"BN_lshift"); | ||
| 203 | if (!test_lshift(out,ctx,NULL)) goto err; | ||
| 204 | (void)BIO_flush(out); | ||
| 205 | |||
| 206 | message(out,"BN_rshift1"); | ||
| 207 | if (!test_rshift1(out)) goto err; | ||
| 208 | (void)BIO_flush(out); | ||
| 209 | |||
| 210 | message(out,"BN_rshift"); | ||
| 211 | if (!test_rshift(out,ctx)) goto err; | ||
| 212 | (void)BIO_flush(out); | ||
| 213 | |||
| 214 | message(out,"BN_sqr"); | ||
| 215 | if (!test_sqr(out,ctx)) goto err; | ||
| 216 | (void)BIO_flush(out); | ||
| 217 | |||
| 218 | message(out,"BN_mul"); | ||
| 219 | if (!test_mul(out)) goto err; | ||
| 220 | (void)BIO_flush(out); | ||
| 221 | |||
| 222 | message(out,"BN_div"); | ||
| 223 | if (!test_div(out,ctx)) goto err; | ||
| 224 | (void)BIO_flush(out); | ||
| 225 | |||
| 226 | message(out,"BN_div_word"); | ||
| 227 | if (!test_div_word(out)) goto err; | ||
| 228 | (void)BIO_flush(out); | ||
| 229 | |||
| 230 | message(out,"BN_div_recp"); | ||
| 231 | if (!test_div_recp(out,ctx)) goto err; | ||
| 232 | (void)BIO_flush(out); | ||
| 233 | |||
| 234 | message(out,"BN_mod"); | ||
| 235 | if (!test_mod(out,ctx)) goto err; | ||
| 236 | (void)BIO_flush(out); | ||
| 237 | |||
| 238 | message(out,"BN_mod_mul"); | ||
| 239 | if (!test_mod_mul(out,ctx)) goto err; | ||
| 240 | (void)BIO_flush(out); | ||
| 241 | |||
| 242 | message(out,"BN_mont"); | ||
| 243 | if (!test_mont(out,ctx)) goto err; | ||
| 244 | (void)BIO_flush(out); | ||
| 245 | |||
| 246 | message(out,"BN_mod_exp"); | ||
| 247 | if (!test_mod_exp(out,ctx)) goto err; | ||
| 248 | (void)BIO_flush(out); | ||
| 249 | |||
| 250 | message(out,"BN_mod_exp_mont_consttime"); | ||
| 251 | if (!test_mod_exp_mont_consttime(out,ctx)) goto err; | ||
| 252 | (void)BIO_flush(out); | ||
| 253 | |||
| 254 | message(out,"BN_exp"); | ||
| 255 | if (!test_exp(out,ctx)) goto err; | ||
| 256 | (void)BIO_flush(out); | ||
| 257 | |||
| 258 | message(out,"BN_kronecker"); | ||
| 259 | if (!test_kron(out,ctx)) goto err; | ||
| 260 | (void)BIO_flush(out); | ||
| 261 | |||
| 262 | message(out,"BN_mod_sqrt"); | ||
| 263 | if (!test_sqrt(out,ctx)) goto err; | ||
| 264 | (void)BIO_flush(out); | ||
| 265 | |||
| 266 | message(out,"BN_GF2m_add"); | ||
| 267 | if (!test_gf2m_add(out)) goto err; | ||
| 268 | (void)BIO_flush(out); | ||
| 269 | |||
| 270 | message(out,"BN_GF2m_mod"); | ||
| 271 | if (!test_gf2m_mod(out)) goto err; | ||
| 272 | (void)BIO_flush(out); | ||
| 273 | |||
| 274 | message(out,"BN_GF2m_mod_mul"); | ||
| 275 | if (!test_gf2m_mod_mul(out,ctx)) goto err; | ||
| 276 | (void)BIO_flush(out); | ||
| 277 | |||
| 278 | message(out,"BN_GF2m_mod_sqr"); | ||
| 279 | if (!test_gf2m_mod_sqr(out,ctx)) goto err; | ||
| 280 | (void)BIO_flush(out); | ||
| 281 | |||
| 282 | message(out,"BN_GF2m_mod_inv"); | ||
| 283 | if (!test_gf2m_mod_inv(out,ctx)) goto err; | ||
| 284 | (void)BIO_flush(out); | ||
| 285 | |||
| 286 | message(out,"BN_GF2m_mod_div"); | ||
| 287 | if (!test_gf2m_mod_div(out,ctx)) goto err; | ||
| 288 | (void)BIO_flush(out); | ||
| 289 | |||
| 290 | message(out,"BN_GF2m_mod_exp"); | ||
| 291 | if (!test_gf2m_mod_exp(out,ctx)) goto err; | ||
| 292 | (void)BIO_flush(out); | ||
| 293 | |||
| 294 | message(out,"BN_GF2m_mod_sqrt"); | ||
| 295 | if (!test_gf2m_mod_sqrt(out,ctx)) goto err; | ||
| 296 | (void)BIO_flush(out); | ||
| 297 | |||
| 298 | message(out,"BN_GF2m_mod_solve_quad"); | ||
| 299 | if (!test_gf2m_mod_solve_quad(out,ctx)) goto err; | ||
| 300 | (void)BIO_flush(out); | ||
| 301 | |||
| 302 | BN_CTX_free(ctx); | ||
| 303 | BIO_free(out); | ||
| 304 | |||
| 305 | /**/ | ||
| 306 | EXIT(0); | ||
| 307 | err: | ||
| 308 | BIO_puts(out,"1\n"); /* make sure the Perl script fed by bc notices | ||
| 309 | * the failure, see test_bn in test/Makefile.ssl*/ | ||
| 310 | (void)BIO_flush(out); | ||
| 311 | ERR_load_crypto_strings(); | ||
| 312 | ERR_print_errors_fp(stderr); | ||
| 313 | EXIT(1); | ||
| 314 | return(1); | ||
| 315 | } | ||
| 316 | |||
| 317 | int test_add(BIO *bp) | ||
| 318 | { | ||
| 319 | BIGNUM a,b,c; | ||
| 320 | int i; | ||
| 321 | |||
| 322 | BN_init(&a); | ||
| 323 | BN_init(&b); | ||
| 324 | BN_init(&c); | ||
| 325 | |||
| 326 | BN_bntest_rand(&a,512,0,0); | ||
| 327 | for (i=0; i<num0; i++) | ||
| 328 | { | ||
| 329 | BN_bntest_rand(&b,450+i,0,0); | ||
| 330 | a.neg=rand_neg(); | ||
| 331 | b.neg=rand_neg(); | ||
| 332 | BN_add(&c,&a,&b); | ||
| 333 | if (bp != NULL) | ||
| 334 | { | ||
| 335 | if (!results) | ||
| 336 | { | ||
| 337 | BN_print(bp,&a); | ||
| 338 | BIO_puts(bp," + "); | ||
| 339 | BN_print(bp,&b); | ||
| 340 | BIO_puts(bp," - "); | ||
| 341 | } | ||
| 342 | BN_print(bp,&c); | ||
| 343 | BIO_puts(bp,"\n"); | ||
| 344 | } | ||
| 345 | a.neg=!a.neg; | ||
| 346 | b.neg=!b.neg; | ||
| 347 | BN_add(&c,&c,&b); | ||
| 348 | BN_add(&c,&c,&a); | ||
| 349 | if(!BN_is_zero(&c)) | ||
| 350 | { | ||
| 351 | fprintf(stderr,"Add test failed!\n"); | ||
| 352 | return 0; | ||
| 353 | } | ||
| 354 | } | ||
| 355 | BN_free(&a); | ||
| 356 | BN_free(&b); | ||
| 357 | BN_free(&c); | ||
| 358 | return(1); | ||
| 359 | } | ||
| 360 | |||
| 361 | int test_sub(BIO *bp) | ||
| 362 | { | ||
| 363 | BIGNUM a,b,c; | ||
| 364 | int i; | ||
| 365 | |||
| 366 | BN_init(&a); | ||
| 367 | BN_init(&b); | ||
| 368 | BN_init(&c); | ||
| 369 | |||
| 370 | for (i=0; i<num0+num1; i++) | ||
| 371 | { | ||
| 372 | if (i < num1) | ||
| 373 | { | ||
| 374 | BN_bntest_rand(&a,512,0,0); | ||
| 375 | BN_copy(&b,&a); | ||
| 376 | if (BN_set_bit(&a,i)==0) return(0); | ||
| 377 | BN_add_word(&b,i); | ||
| 378 | } | ||
| 379 | else | ||
| 380 | { | ||
| 381 | BN_bntest_rand(&b,400+i-num1,0,0); | ||
| 382 | a.neg=rand_neg(); | ||
| 383 | b.neg=rand_neg(); | ||
| 384 | } | ||
| 385 | BN_sub(&c,&a,&b); | ||
| 386 | if (bp != NULL) | ||
| 387 | { | ||
| 388 | if (!results) | ||
| 389 | { | ||
| 390 | BN_print(bp,&a); | ||
| 391 | BIO_puts(bp," - "); | ||
| 392 | BN_print(bp,&b); | ||
| 393 | BIO_puts(bp," - "); | ||
| 394 | } | ||
| 395 | BN_print(bp,&c); | ||
| 396 | BIO_puts(bp,"\n"); | ||
| 397 | } | ||
| 398 | BN_add(&c,&c,&b); | ||
| 399 | BN_sub(&c,&c,&a); | ||
| 400 | if(!BN_is_zero(&c)) | ||
| 401 | { | ||
| 402 | fprintf(stderr,"Subtract test failed!\n"); | ||
| 403 | return 0; | ||
| 404 | } | ||
| 405 | } | ||
| 406 | BN_free(&a); | ||
| 407 | BN_free(&b); | ||
| 408 | BN_free(&c); | ||
| 409 | return(1); | ||
| 410 | } | ||
| 411 | |||
| 412 | int test_div(BIO *bp, BN_CTX *ctx) | ||
| 413 | { | ||
| 414 | BIGNUM a,b,c,d,e; | ||
| 415 | int i; | ||
| 416 | |||
| 417 | BN_init(&a); | ||
| 418 | BN_init(&b); | ||
| 419 | BN_init(&c); | ||
| 420 | BN_init(&d); | ||
| 421 | BN_init(&e); | ||
| 422 | |||
| 423 | for (i=0; i<num0+num1; i++) | ||
| 424 | { | ||
| 425 | if (i < num1) | ||
| 426 | { | ||
| 427 | BN_bntest_rand(&a,400,0,0); | ||
| 428 | BN_copy(&b,&a); | ||
| 429 | BN_lshift(&a,&a,i); | ||
| 430 | BN_add_word(&a,i); | ||
| 431 | } | ||
| 432 | else | ||
| 433 | BN_bntest_rand(&b,50+3*(i-num1),0,0); | ||
| 434 | a.neg=rand_neg(); | ||
| 435 | b.neg=rand_neg(); | ||
| 436 | BN_div(&d,&c,&a,&b,ctx); | ||
| 437 | if (bp != NULL) | ||
| 438 | { | ||
| 439 | if (!results) | ||
| 440 | { | ||
| 441 | BN_print(bp,&a); | ||
| 442 | BIO_puts(bp," / "); | ||
| 443 | BN_print(bp,&b); | ||
| 444 | BIO_puts(bp," - "); | ||
| 445 | } | ||
| 446 | BN_print(bp,&d); | ||
| 447 | BIO_puts(bp,"\n"); | ||
| 448 | |||
| 449 | if (!results) | ||
| 450 | { | ||
| 451 | BN_print(bp,&a); | ||
| 452 | BIO_puts(bp," % "); | ||
| 453 | BN_print(bp,&b); | ||
| 454 | BIO_puts(bp," - "); | ||
| 455 | } | ||
| 456 | BN_print(bp,&c); | ||
| 457 | BIO_puts(bp,"\n"); | ||
| 458 | } | ||
| 459 | BN_mul(&e,&d,&b,ctx); | ||
| 460 | BN_add(&d,&e,&c); | ||
| 461 | BN_sub(&d,&d,&a); | ||
| 462 | if(!BN_is_zero(&d)) | ||
| 463 | { | ||
| 464 | fprintf(stderr,"Division test failed!\n"); | ||
| 465 | return 0; | ||
| 466 | } | ||
| 467 | } | ||
| 468 | BN_free(&a); | ||
| 469 | BN_free(&b); | ||
| 470 | BN_free(&c); | ||
| 471 | BN_free(&d); | ||
| 472 | BN_free(&e); | ||
| 473 | return(1); | ||
| 474 | } | ||
| 475 | |||
| 476 | static void print_word(BIO *bp,BN_ULONG w) | ||
| 477 | { | ||
| 478 | #ifdef SIXTY_FOUR_BIT | ||
| 479 | if (sizeof(w) > sizeof(unsigned long)) | ||
| 480 | { | ||
| 481 | unsigned long h=(unsigned long)(w>>32), | ||
| 482 | l=(unsigned long)(w); | ||
| 483 | |||
| 484 | if (h) BIO_printf(bp,"%lX%08lX",h,l); | ||
| 485 | else BIO_printf(bp,"%lX",l); | ||
| 486 | return; | ||
| 487 | } | ||
| 488 | #endif | ||
| 489 | BIO_printf(bp,BN_HEX_FMT1,w); | ||
| 490 | } | ||
| 491 | |||
| 492 | int test_div_word(BIO *bp) | ||
| 493 | { | ||
| 494 | BIGNUM a,b; | ||
| 495 | BN_ULONG r,s; | ||
| 496 | int i; | ||
| 497 | |||
| 498 | BN_init(&a); | ||
| 499 | BN_init(&b); | ||
| 500 | |||
| 501 | for (i=0; i<num0; i++) | ||
| 502 | { | ||
| 503 | do { | ||
| 504 | BN_bntest_rand(&a,512,-1,0); | ||
| 505 | BN_bntest_rand(&b,BN_BITS2,-1,0); | ||
| 506 | s = b.d[0]; | ||
| 507 | } while (!s); | ||
| 508 | |||
| 509 | BN_copy(&b, &a); | ||
| 510 | r = BN_div_word(&b, s); | ||
| 511 | |||
| 512 | if (bp != NULL) | ||
| 513 | { | ||
| 514 | if (!results) | ||
| 515 | { | ||
| 516 | BN_print(bp,&a); | ||
| 517 | BIO_puts(bp," / "); | ||
| 518 | print_word(bp,s); | ||
| 519 | BIO_puts(bp," - "); | ||
| 520 | } | ||
| 521 | BN_print(bp,&b); | ||
| 522 | BIO_puts(bp,"\n"); | ||
| 523 | |||
| 524 | if (!results) | ||
| 525 | { | ||
| 526 | BN_print(bp,&a); | ||
| 527 | BIO_puts(bp," % "); | ||
| 528 | print_word(bp,s); | ||
| 529 | BIO_puts(bp," - "); | ||
| 530 | } | ||
| 531 | print_word(bp,r); | ||
| 532 | BIO_puts(bp,"\n"); | ||
| 533 | } | ||
| 534 | BN_mul_word(&b,s); | ||
| 535 | BN_add_word(&b,r); | ||
| 536 | BN_sub(&b,&a,&b); | ||
| 537 | if(!BN_is_zero(&b)) | ||
| 538 | { | ||
| 539 | fprintf(stderr,"Division (word) test failed!\n"); | ||
| 540 | return 0; | ||
| 541 | } | ||
| 542 | } | ||
| 543 | BN_free(&a); | ||
| 544 | BN_free(&b); | ||
| 545 | return(1); | ||
| 546 | } | ||
| 547 | |||
| 548 | int test_div_recp(BIO *bp, BN_CTX *ctx) | ||
| 549 | { | ||
| 550 | BIGNUM a,b,c,d,e; | ||
| 551 | BN_RECP_CTX recp; | ||
| 552 | int i; | ||
| 553 | |||
| 554 | BN_RECP_CTX_init(&recp); | ||
| 555 | BN_init(&a); | ||
| 556 | BN_init(&b); | ||
| 557 | BN_init(&c); | ||
| 558 | BN_init(&d); | ||
| 559 | BN_init(&e); | ||
| 560 | |||
| 561 | for (i=0; i<num0+num1; i++) | ||
| 562 | { | ||
| 563 | if (i < num1) | ||
| 564 | { | ||
| 565 | BN_bntest_rand(&a,400,0,0); | ||
| 566 | BN_copy(&b,&a); | ||
| 567 | BN_lshift(&a,&a,i); | ||
| 568 | BN_add_word(&a,i); | ||
| 569 | } | ||
| 570 | else | ||
| 571 | BN_bntest_rand(&b,50+3*(i-num1),0,0); | ||
| 572 | a.neg=rand_neg(); | ||
| 573 | b.neg=rand_neg(); | ||
| 574 | BN_RECP_CTX_set(&recp,&b,ctx); | ||
| 575 | BN_div_recp(&d,&c,&a,&recp,ctx); | ||
| 576 | if (bp != NULL) | ||
| 577 | { | ||
| 578 | if (!results) | ||
| 579 | { | ||
| 580 | BN_print(bp,&a); | ||
| 581 | BIO_puts(bp," / "); | ||
| 582 | BN_print(bp,&b); | ||
| 583 | BIO_puts(bp," - "); | ||
| 584 | } | ||
| 585 | BN_print(bp,&d); | ||
| 586 | BIO_puts(bp,"\n"); | ||
| 587 | |||
| 588 | if (!results) | ||
| 589 | { | ||
| 590 | BN_print(bp,&a); | ||
| 591 | BIO_puts(bp," % "); | ||
| 592 | BN_print(bp,&b); | ||
| 593 | BIO_puts(bp," - "); | ||
| 594 | } | ||
| 595 | BN_print(bp,&c); | ||
| 596 | BIO_puts(bp,"\n"); | ||
| 597 | } | ||
| 598 | BN_mul(&e,&d,&b,ctx); | ||
| 599 | BN_add(&d,&e,&c); | ||
| 600 | BN_sub(&d,&d,&a); | ||
| 601 | if(!BN_is_zero(&d)) | ||
| 602 | { | ||
| 603 | fprintf(stderr,"Reciprocal division test failed!\n"); | ||
| 604 | fprintf(stderr,"a="); | ||
| 605 | BN_print_fp(stderr,&a); | ||
| 606 | fprintf(stderr,"\nb="); | ||
| 607 | BN_print_fp(stderr,&b); | ||
| 608 | fprintf(stderr,"\n"); | ||
| 609 | return 0; | ||
| 610 | } | ||
| 611 | } | ||
| 612 | BN_free(&a); | ||
| 613 | BN_free(&b); | ||
| 614 | BN_free(&c); | ||
| 615 | BN_free(&d); | ||
| 616 | BN_free(&e); | ||
| 617 | BN_RECP_CTX_free(&recp); | ||
| 618 | return(1); | ||
| 619 | } | ||
| 620 | |||
| 621 | int test_mul(BIO *bp) | ||
| 622 | { | ||
| 623 | BIGNUM a,b,c,d,e; | ||
| 624 | int i; | ||
| 625 | BN_CTX *ctx; | ||
| 626 | |||
| 627 | ctx = BN_CTX_new(); | ||
| 628 | if (ctx == NULL) EXIT(1); | ||
| 629 | |||
| 630 | BN_init(&a); | ||
| 631 | BN_init(&b); | ||
| 632 | BN_init(&c); | ||
| 633 | BN_init(&d); | ||
| 634 | BN_init(&e); | ||
| 635 | |||
| 636 | for (i=0; i<num0+num1; i++) | ||
| 637 | { | ||
| 638 | if (i <= num1) | ||
| 639 | { | ||
| 640 | BN_bntest_rand(&a,100,0,0); | ||
| 641 | BN_bntest_rand(&b,100,0,0); | ||
| 642 | } | ||
| 643 | else | ||
| 644 | BN_bntest_rand(&b,i-num1,0,0); | ||
| 645 | a.neg=rand_neg(); | ||
| 646 | b.neg=rand_neg(); | ||
| 647 | BN_mul(&c,&a,&b,ctx); | ||
| 648 | if (bp != NULL) | ||
| 649 | { | ||
| 650 | if (!results) | ||
| 651 | { | ||
| 652 | BN_print(bp,&a); | ||
| 653 | BIO_puts(bp," * "); | ||
| 654 | BN_print(bp,&b); | ||
| 655 | BIO_puts(bp," - "); | ||
| 656 | } | ||
| 657 | BN_print(bp,&c); | ||
| 658 | BIO_puts(bp,"\n"); | ||
| 659 | } | ||
| 660 | BN_div(&d,&e,&c,&a,ctx); | ||
| 661 | BN_sub(&d,&d,&b); | ||
| 662 | if(!BN_is_zero(&d) || !BN_is_zero(&e)) | ||
| 663 | { | ||
| 664 | fprintf(stderr,"Multiplication test failed!\n"); | ||
| 665 | return 0; | ||
| 666 | } | ||
| 667 | } | ||
| 668 | BN_free(&a); | ||
| 669 | BN_free(&b); | ||
| 670 | BN_free(&c); | ||
| 671 | BN_free(&d); | ||
| 672 | BN_free(&e); | ||
| 673 | BN_CTX_free(ctx); | ||
| 674 | return(1); | ||
| 675 | } | ||
| 676 | |||
| 677 | int test_sqr(BIO *bp, BN_CTX *ctx) | ||
| 678 | { | ||
| 679 | BIGNUM a,c,d,e; | ||
| 680 | int i; | ||
| 681 | |||
| 682 | BN_init(&a); | ||
| 683 | BN_init(&c); | ||
| 684 | BN_init(&d); | ||
| 685 | BN_init(&e); | ||
| 686 | |||
| 687 | for (i=0; i<num0; i++) | ||
| 688 | { | ||
| 689 | BN_bntest_rand(&a,40+i*10,0,0); | ||
| 690 | a.neg=rand_neg(); | ||
| 691 | BN_sqr(&c,&a,ctx); | ||
| 692 | if (bp != NULL) | ||
| 693 | { | ||
| 694 | if (!results) | ||
| 695 | { | ||
| 696 | BN_print(bp,&a); | ||
| 697 | BIO_puts(bp," * "); | ||
| 698 | BN_print(bp,&a); | ||
| 699 | BIO_puts(bp," - "); | ||
| 700 | } | ||
| 701 | BN_print(bp,&c); | ||
| 702 | BIO_puts(bp,"\n"); | ||
| 703 | } | ||
| 704 | BN_div(&d,&e,&c,&a,ctx); | ||
| 705 | BN_sub(&d,&d,&a); | ||
| 706 | if(!BN_is_zero(&d) || !BN_is_zero(&e)) | ||
| 707 | { | ||
| 708 | fprintf(stderr,"Square test failed!\n"); | ||
| 709 | return 0; | ||
| 710 | } | ||
| 711 | } | ||
| 712 | BN_free(&a); | ||
| 713 | BN_free(&c); | ||
| 714 | BN_free(&d); | ||
| 715 | BN_free(&e); | ||
| 716 | return(1); | ||
| 717 | } | ||
| 718 | |||
| 719 | int test_mont(BIO *bp, BN_CTX *ctx) | ||
| 720 | { | ||
| 721 | BIGNUM a,b,c,d,A,B; | ||
| 722 | BIGNUM n; | ||
| 723 | int i; | ||
| 724 | BN_MONT_CTX *mont; | ||
| 725 | |||
| 726 | BN_init(&a); | ||
| 727 | BN_init(&b); | ||
| 728 | BN_init(&c); | ||
| 729 | BN_init(&d); | ||
| 730 | BN_init(&A); | ||
| 731 | BN_init(&B); | ||
| 732 | BN_init(&n); | ||
| 733 | |||
| 734 | mont=BN_MONT_CTX_new(); | ||
| 735 | if (mont == NULL) | ||
| 736 | return 0; | ||
| 737 | |||
| 738 | BN_bntest_rand(&a,100,0,0); /**/ | ||
| 739 | BN_bntest_rand(&b,100,0,0); /**/ | ||
| 740 | for (i=0; i<num2; i++) | ||
| 741 | { | ||
| 742 | int bits = (200*(i+1))/num2; | ||
| 743 | |||
| 744 | if (bits == 0) | ||
| 745 | continue; | ||
| 746 | BN_bntest_rand(&n,bits,0,1); | ||
| 747 | BN_MONT_CTX_set(mont,&n,ctx); | ||
| 748 | |||
| 749 | BN_nnmod(&a,&a,&n,ctx); | ||
| 750 | BN_nnmod(&b,&b,&n,ctx); | ||
| 751 | |||
| 752 | BN_to_montgomery(&A,&a,mont,ctx); | ||
| 753 | BN_to_montgomery(&B,&b,mont,ctx); | ||
| 754 | |||
| 755 | BN_mod_mul_montgomery(&c,&A,&B,mont,ctx);/**/ | ||
| 756 | BN_from_montgomery(&A,&c,mont,ctx);/**/ | ||
| 757 | if (bp != NULL) | ||
| 758 | { | ||
| 759 | if (!results) | ||
| 760 | { | ||
| 761 | #ifdef undef | ||
| 762 | fprintf(stderr,"%d * %d %% %d\n", | ||
| 763 | BN_num_bits(&a), | ||
| 764 | BN_num_bits(&b), | ||
| 765 | BN_num_bits(mont->N)); | ||
| 766 | #endif | ||
| 767 | BN_print(bp,&a); | ||
| 768 | BIO_puts(bp," * "); | ||
| 769 | BN_print(bp,&b); | ||
| 770 | BIO_puts(bp," % "); | ||
| 771 | BN_print(bp,&(mont->N)); | ||
| 772 | BIO_puts(bp," - "); | ||
| 773 | } | ||
| 774 | BN_print(bp,&A); | ||
| 775 | BIO_puts(bp,"\n"); | ||
| 776 | } | ||
| 777 | BN_mod_mul(&d,&a,&b,&n,ctx); | ||
| 778 | BN_sub(&d,&d,&A); | ||
| 779 | if(!BN_is_zero(&d)) | ||
| 780 | { | ||
| 781 | fprintf(stderr,"Montgomery multiplication test failed!\n"); | ||
| 782 | return 0; | ||
| 783 | } | ||
| 784 | } | ||
| 785 | BN_MONT_CTX_free(mont); | ||
| 786 | BN_free(&a); | ||
| 787 | BN_free(&b); | ||
| 788 | BN_free(&c); | ||
| 789 | BN_free(&d); | ||
| 790 | BN_free(&A); | ||
| 791 | BN_free(&B); | ||
| 792 | BN_free(&n); | ||
| 793 | return(1); | ||
| 794 | } | ||
| 795 | |||
| 796 | int test_mod(BIO *bp, BN_CTX *ctx) | ||
| 797 | { | ||
| 798 | BIGNUM *a,*b,*c,*d,*e; | ||
| 799 | int i; | ||
| 800 | |||
| 801 | a=BN_new(); | ||
| 802 | b=BN_new(); | ||
| 803 | c=BN_new(); | ||
| 804 | d=BN_new(); | ||
| 805 | e=BN_new(); | ||
| 806 | |||
| 807 | BN_bntest_rand(a,1024,0,0); /**/ | ||
| 808 | for (i=0; i<num0; i++) | ||
| 809 | { | ||
| 810 | BN_bntest_rand(b,450+i*10,0,0); /**/ | ||
| 811 | a->neg=rand_neg(); | ||
| 812 | b->neg=rand_neg(); | ||
| 813 | BN_mod(c,a,b,ctx);/**/ | ||
| 814 | if (bp != NULL) | ||
| 815 | { | ||
| 816 | if (!results) | ||
| 817 | { | ||
| 818 | BN_print(bp,a); | ||
| 819 | BIO_puts(bp," % "); | ||
| 820 | BN_print(bp,b); | ||
| 821 | BIO_puts(bp," - "); | ||
| 822 | } | ||
| 823 | BN_print(bp,c); | ||
| 824 | BIO_puts(bp,"\n"); | ||
| 825 | } | ||
| 826 | BN_div(d,e,a,b,ctx); | ||
| 827 | BN_sub(e,e,c); | ||
| 828 | if(!BN_is_zero(e)) | ||
| 829 | { | ||
| 830 | fprintf(stderr,"Modulo test failed!\n"); | ||
| 831 | return 0; | ||
| 832 | } | ||
| 833 | } | ||
| 834 | BN_free(a); | ||
| 835 | BN_free(b); | ||
| 836 | BN_free(c); | ||
| 837 | BN_free(d); | ||
| 838 | BN_free(e); | ||
| 839 | return(1); | ||
| 840 | } | ||
| 841 | |||
| 842 | int test_mod_mul(BIO *bp, BN_CTX *ctx) | ||
| 843 | { | ||
| 844 | BIGNUM *a,*b,*c,*d,*e; | ||
| 845 | int i,j; | ||
| 846 | |||
| 847 | a=BN_new(); | ||
| 848 | b=BN_new(); | ||
| 849 | c=BN_new(); | ||
| 850 | d=BN_new(); | ||
| 851 | e=BN_new(); | ||
| 852 | |||
| 853 | for (j=0; j<3; j++) { | ||
| 854 | BN_bntest_rand(c,1024,0,0); /**/ | ||
| 855 | for (i=0; i<num0; i++) | ||
| 856 | { | ||
| 857 | BN_bntest_rand(a,475+i*10,0,0); /**/ | ||
| 858 | BN_bntest_rand(b,425+i*11,0,0); /**/ | ||
| 859 | a->neg=rand_neg(); | ||
| 860 | b->neg=rand_neg(); | ||
| 861 | if (!BN_mod_mul(e,a,b,c,ctx)) | ||
| 862 | { | ||
| 863 | unsigned long l; | ||
| 864 | |||
| 865 | while ((l=ERR_get_error())) | ||
| 866 | fprintf(stderr,"ERROR:%s\n", | ||
| 867 | ERR_error_string(l,NULL)); | ||
| 868 | EXIT(1); | ||
| 869 | } | ||
| 870 | if (bp != NULL) | ||
| 871 | { | ||
| 872 | if (!results) | ||
| 873 | { | ||
| 874 | BN_print(bp,a); | ||
| 875 | BIO_puts(bp," * "); | ||
| 876 | BN_print(bp,b); | ||
| 877 | BIO_puts(bp," % "); | ||
| 878 | BN_print(bp,c); | ||
| 879 | if ((a->neg ^ b->neg) && !BN_is_zero(e)) | ||
| 880 | { | ||
| 881 | /* If (a*b) % c is negative, c must be added | ||
| 882 | * in order to obtain the normalized remainder | ||
| 883 | * (new with OpenSSL 0.9.7, previous versions of | ||
| 884 | * BN_mod_mul could generate negative results) | ||
| 885 | */ | ||
| 886 | BIO_puts(bp," + "); | ||
| 887 | BN_print(bp,c); | ||
| 888 | } | ||
| 889 | BIO_puts(bp," - "); | ||
| 890 | } | ||
| 891 | BN_print(bp,e); | ||
| 892 | BIO_puts(bp,"\n"); | ||
| 893 | } | ||
| 894 | BN_mul(d,a,b,ctx); | ||
| 895 | BN_sub(d,d,e); | ||
| 896 | BN_div(a,b,d,c,ctx); | ||
| 897 | if(!BN_is_zero(b)) | ||
| 898 | { | ||
| 899 | fprintf(stderr,"Modulo multiply test failed!\n"); | ||
| 900 | ERR_print_errors_fp(stderr); | ||
| 901 | return 0; | ||
| 902 | } | ||
| 903 | } | ||
| 904 | } | ||
| 905 | BN_free(a); | ||
| 906 | BN_free(b); | ||
| 907 | BN_free(c); | ||
| 908 | BN_free(d); | ||
| 909 | BN_free(e); | ||
| 910 | return(1); | ||
| 911 | } | ||
| 912 | |||
| 913 | int test_mod_exp(BIO *bp, BN_CTX *ctx) | ||
| 914 | { | ||
| 915 | BIGNUM *a,*b,*c,*d,*e; | ||
| 916 | int i; | ||
| 917 | |||
| 918 | a=BN_new(); | ||
| 919 | b=BN_new(); | ||
| 920 | c=BN_new(); | ||
| 921 | d=BN_new(); | ||
| 922 | e=BN_new(); | ||
| 923 | |||
| 924 | BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */ | ||
| 925 | for (i=0; i<num2; i++) | ||
| 926 | { | ||
| 927 | BN_bntest_rand(a,20+i*5,0,0); /**/ | ||
| 928 | BN_bntest_rand(b,2+i,0,0); /**/ | ||
| 929 | |||
| 930 | if (!BN_mod_exp(d,a,b,c,ctx)) | ||
| 931 | return(0); | ||
| 932 | |||
| 933 | if (bp != NULL) | ||
| 934 | { | ||
| 935 | if (!results) | ||
| 936 | { | ||
| 937 | BN_print(bp,a); | ||
| 938 | BIO_puts(bp," ^ "); | ||
| 939 | BN_print(bp,b); | ||
| 940 | BIO_puts(bp," % "); | ||
| 941 | BN_print(bp,c); | ||
| 942 | BIO_puts(bp," - "); | ||
| 943 | } | ||
| 944 | BN_print(bp,d); | ||
| 945 | BIO_puts(bp,"\n"); | ||
| 946 | } | ||
| 947 | BN_exp(e,a,b,ctx); | ||
| 948 | BN_sub(e,e,d); | ||
| 949 | BN_div(a,b,e,c,ctx); | ||
| 950 | if(!BN_is_zero(b)) | ||
| 951 | { | ||
| 952 | fprintf(stderr,"Modulo exponentiation test failed!\n"); | ||
| 953 | return 0; | ||
| 954 | } | ||
| 955 | } | ||
| 956 | BN_free(a); | ||
| 957 | BN_free(b); | ||
| 958 | BN_free(c); | ||
| 959 | BN_free(d); | ||
| 960 | BN_free(e); | ||
| 961 | return(1); | ||
| 962 | } | ||
| 963 | |||
| 964 | int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx) | ||
| 965 | { | ||
| 966 | BIGNUM *a,*b,*c,*d,*e; | ||
| 967 | int i; | ||
| 968 | |||
| 969 | a=BN_new(); | ||
| 970 | b=BN_new(); | ||
| 971 | c=BN_new(); | ||
| 972 | d=BN_new(); | ||
| 973 | e=BN_new(); | ||
| 974 | |||
| 975 | BN_bntest_rand(c,30,0,1); /* must be odd for montgomery */ | ||
| 976 | for (i=0; i<num2; i++) | ||
| 977 | { | ||
| 978 | BN_bntest_rand(a,20+i*5,0,0); /**/ | ||
| 979 | BN_bntest_rand(b,2+i,0,0); /**/ | ||
| 980 | |||
| 981 | if (!BN_mod_exp_mont_consttime(d,a,b,c,ctx,NULL)) | ||
| 982 | return(00); | ||
| 983 | |||
| 984 | if (bp != NULL) | ||
| 985 | { | ||
| 986 | if (!results) | ||
| 987 | { | ||
| 988 | BN_print(bp,a); | ||
| 989 | BIO_puts(bp," ^ "); | ||
| 990 | BN_print(bp,b); | ||
| 991 | BIO_puts(bp," % "); | ||
| 992 | BN_print(bp,c); | ||
| 993 | BIO_puts(bp," - "); | ||
| 994 | } | ||
| 995 | BN_print(bp,d); | ||
| 996 | BIO_puts(bp,"\n"); | ||
| 997 | } | ||
| 998 | BN_exp(e,a,b,ctx); | ||
| 999 | BN_sub(e,e,d); | ||
| 1000 | BN_div(a,b,e,c,ctx); | ||
| 1001 | if(!BN_is_zero(b)) | ||
| 1002 | { | ||
| 1003 | fprintf(stderr,"Modulo exponentiation test failed!\n"); | ||
| 1004 | return 0; | ||
| 1005 | } | ||
| 1006 | } | ||
| 1007 | BN_free(a); | ||
| 1008 | BN_free(b); | ||
| 1009 | BN_free(c); | ||
| 1010 | BN_free(d); | ||
| 1011 | BN_free(e); | ||
| 1012 | return(1); | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | int test_exp(BIO *bp, BN_CTX *ctx) | ||
| 1016 | { | ||
| 1017 | BIGNUM *a,*b,*d,*e,*one; | ||
| 1018 | int i; | ||
| 1019 | |||
| 1020 | a=BN_new(); | ||
| 1021 | b=BN_new(); | ||
| 1022 | d=BN_new(); | ||
| 1023 | e=BN_new(); | ||
| 1024 | one=BN_new(); | ||
| 1025 | BN_one(one); | ||
| 1026 | |||
| 1027 | for (i=0; i<num2; i++) | ||
| 1028 | { | ||
| 1029 | BN_bntest_rand(a,20+i*5,0,0); /**/ | ||
| 1030 | BN_bntest_rand(b,2+i,0,0); /**/ | ||
| 1031 | |||
| 1032 | if (BN_exp(d,a,b,ctx) <= 0) | ||
| 1033 | return(0); | ||
| 1034 | |||
| 1035 | if (bp != NULL) | ||
| 1036 | { | ||
| 1037 | if (!results) | ||
| 1038 | { | ||
| 1039 | BN_print(bp,a); | ||
| 1040 | BIO_puts(bp," ^ "); | ||
| 1041 | BN_print(bp,b); | ||
| 1042 | BIO_puts(bp," - "); | ||
| 1043 | } | ||
| 1044 | BN_print(bp,d); | ||
| 1045 | BIO_puts(bp,"\n"); | ||
| 1046 | } | ||
| 1047 | BN_one(e); | ||
| 1048 | for( ; !BN_is_zero(b) ; BN_sub(b,b,one)) | ||
| 1049 | BN_mul(e,e,a,ctx); | ||
| 1050 | BN_sub(e,e,d); | ||
| 1051 | if(!BN_is_zero(e)) | ||
| 1052 | { | ||
| 1053 | fprintf(stderr,"Exponentiation test failed!\n"); | ||
| 1054 | return 0; | ||
| 1055 | } | ||
| 1056 | } | ||
| 1057 | BN_free(a); | ||
| 1058 | BN_free(b); | ||
| 1059 | BN_free(d); | ||
| 1060 | BN_free(e); | ||
| 1061 | BN_free(one); | ||
| 1062 | return(1); | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | int test_gf2m_add(BIO *bp) | ||
| 1066 | { | ||
| 1067 | BIGNUM a,b,c; | ||
| 1068 | int i, ret = 0; | ||
| 1069 | |||
| 1070 | BN_init(&a); | ||
| 1071 | BN_init(&b); | ||
| 1072 | BN_init(&c); | ||
| 1073 | |||
| 1074 | for (i=0; i<num0; i++) | ||
| 1075 | { | ||
| 1076 | BN_rand(&a,512,0,0); | ||
| 1077 | BN_copy(&b, BN_value_one()); | ||
| 1078 | a.neg=rand_neg(); | ||
| 1079 | b.neg=rand_neg(); | ||
| 1080 | BN_GF2m_add(&c,&a,&b); | ||
| 1081 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1082 | if (bp != NULL) | ||
| 1083 | { | ||
| 1084 | if (!results) | ||
| 1085 | { | ||
| 1086 | BN_print(bp,&a); | ||
| 1087 | BIO_puts(bp," ^ "); | ||
| 1088 | BN_print(bp,&b); | ||
| 1089 | BIO_puts(bp," = "); | ||
| 1090 | } | ||
| 1091 | BN_print(bp,&c); | ||
| 1092 | BIO_puts(bp,"\n"); | ||
| 1093 | } | ||
| 1094 | #endif | ||
| 1095 | /* Test that two added values have the correct parity. */ | ||
| 1096 | if((BN_is_odd(&a) && BN_is_odd(&c)) || (!BN_is_odd(&a) && !BN_is_odd(&c))) | ||
| 1097 | { | ||
| 1098 | fprintf(stderr,"GF(2^m) addition test (a) failed!\n"); | ||
| 1099 | goto err; | ||
| 1100 | } | ||
| 1101 | BN_GF2m_add(&c,&c,&c); | ||
| 1102 | /* Test that c + c = 0. */ | ||
| 1103 | if(!BN_is_zero(&c)) | ||
| 1104 | { | ||
| 1105 | fprintf(stderr,"GF(2^m) addition test (b) failed!\n"); | ||
| 1106 | goto err; | ||
| 1107 | } | ||
| 1108 | } | ||
| 1109 | ret = 1; | ||
| 1110 | err: | ||
| 1111 | BN_free(&a); | ||
| 1112 | BN_free(&b); | ||
| 1113 | BN_free(&c); | ||
| 1114 | return ret; | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | int test_gf2m_mod(BIO *bp) | ||
| 1118 | { | ||
| 1119 | BIGNUM *a,*b[2],*c,*d,*e; | ||
| 1120 | int i, j, ret = 0; | ||
| 1121 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1122 | int p1[] = {193,15,0,-1}; | ||
| 1123 | |||
| 1124 | a=BN_new(); | ||
| 1125 | b[0]=BN_new(); | ||
| 1126 | b[1]=BN_new(); | ||
| 1127 | c=BN_new(); | ||
| 1128 | d=BN_new(); | ||
| 1129 | e=BN_new(); | ||
| 1130 | |||
| 1131 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1132 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1133 | |||
| 1134 | for (i=0; i<num0; i++) | ||
| 1135 | { | ||
| 1136 | BN_bntest_rand(a, 1024, 0, 0); | ||
| 1137 | for (j=0; j < 2; j++) | ||
| 1138 | { | ||
| 1139 | BN_GF2m_mod(c, a, b[j]); | ||
| 1140 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1141 | if (bp != NULL) | ||
| 1142 | { | ||
| 1143 | if (!results) | ||
| 1144 | { | ||
| 1145 | BN_print(bp,a); | ||
| 1146 | BIO_puts(bp," % "); | ||
| 1147 | BN_print(bp,b[j]); | ||
| 1148 | BIO_puts(bp," - "); | ||
| 1149 | BN_print(bp,c); | ||
| 1150 | BIO_puts(bp,"\n"); | ||
| 1151 | } | ||
| 1152 | } | ||
| 1153 | #endif | ||
| 1154 | BN_GF2m_add(d, a, c); | ||
| 1155 | BN_GF2m_mod(e, d, b[j]); | ||
| 1156 | /* Test that a + (a mod p) mod p == 0. */ | ||
| 1157 | if(!BN_is_zero(e)) | ||
| 1158 | { | ||
| 1159 | fprintf(stderr,"GF(2^m) modulo test failed!\n"); | ||
| 1160 | goto err; | ||
| 1161 | } | ||
| 1162 | } | ||
| 1163 | } | ||
| 1164 | ret = 1; | ||
| 1165 | err: | ||
| 1166 | BN_free(a); | ||
| 1167 | BN_free(b[0]); | ||
| 1168 | BN_free(b[1]); | ||
| 1169 | BN_free(c); | ||
| 1170 | BN_free(d); | ||
| 1171 | BN_free(e); | ||
| 1172 | return ret; | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | int test_gf2m_mod_mul(BIO *bp,BN_CTX *ctx) | ||
| 1176 | { | ||
| 1177 | BIGNUM *a,*b[2],*c,*d,*e,*f,*g,*h; | ||
| 1178 | int i, j, ret = 0; | ||
| 1179 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1180 | int p1[] = {193,15,0,-1}; | ||
| 1181 | |||
| 1182 | a=BN_new(); | ||
| 1183 | b[0]=BN_new(); | ||
| 1184 | b[1]=BN_new(); | ||
| 1185 | c=BN_new(); | ||
| 1186 | d=BN_new(); | ||
| 1187 | e=BN_new(); | ||
| 1188 | f=BN_new(); | ||
| 1189 | g=BN_new(); | ||
| 1190 | h=BN_new(); | ||
| 1191 | |||
| 1192 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1193 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1194 | |||
| 1195 | for (i=0; i<num0; i++) | ||
| 1196 | { | ||
| 1197 | BN_bntest_rand(a, 1024, 0, 0); | ||
| 1198 | BN_bntest_rand(c, 1024, 0, 0); | ||
| 1199 | BN_bntest_rand(d, 1024, 0, 0); | ||
| 1200 | for (j=0; j < 2; j++) | ||
| 1201 | { | ||
| 1202 | BN_GF2m_mod_mul(e, a, c, b[j], ctx); | ||
| 1203 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1204 | if (bp != NULL) | ||
| 1205 | { | ||
| 1206 | if (!results) | ||
| 1207 | { | ||
| 1208 | BN_print(bp,a); | ||
| 1209 | BIO_puts(bp," * "); | ||
| 1210 | BN_print(bp,c); | ||
| 1211 | BIO_puts(bp," % "); | ||
| 1212 | BN_print(bp,b[j]); | ||
| 1213 | BIO_puts(bp," - "); | ||
| 1214 | BN_print(bp,e); | ||
| 1215 | BIO_puts(bp,"\n"); | ||
| 1216 | } | ||
| 1217 | } | ||
| 1218 | #endif | ||
| 1219 | BN_GF2m_add(f, a, d); | ||
| 1220 | BN_GF2m_mod_mul(g, f, c, b[j], ctx); | ||
| 1221 | BN_GF2m_mod_mul(h, d, c, b[j], ctx); | ||
| 1222 | BN_GF2m_add(f, e, g); | ||
| 1223 | BN_GF2m_add(f, f, h); | ||
| 1224 | /* Test that (a+d)*c = a*c + d*c. */ | ||
| 1225 | if(!BN_is_zero(f)) | ||
| 1226 | { | ||
| 1227 | fprintf(stderr,"GF(2^m) modular multiplication test failed!\n"); | ||
| 1228 | goto err; | ||
| 1229 | } | ||
| 1230 | } | ||
| 1231 | } | ||
| 1232 | ret = 1; | ||
| 1233 | err: | ||
| 1234 | BN_free(a); | ||
| 1235 | BN_free(b[0]); | ||
| 1236 | BN_free(b[1]); | ||
| 1237 | BN_free(c); | ||
| 1238 | BN_free(d); | ||
| 1239 | BN_free(e); | ||
| 1240 | BN_free(f); | ||
| 1241 | BN_free(g); | ||
| 1242 | BN_free(h); | ||
| 1243 | return ret; | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | int test_gf2m_mod_sqr(BIO *bp,BN_CTX *ctx) | ||
| 1247 | { | ||
| 1248 | BIGNUM *a,*b[2],*c,*d; | ||
| 1249 | int i, j, ret = 0; | ||
| 1250 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1251 | int p1[] = {193,15,0,-1}; | ||
| 1252 | |||
| 1253 | a=BN_new(); | ||
| 1254 | b[0]=BN_new(); | ||
| 1255 | b[1]=BN_new(); | ||
| 1256 | c=BN_new(); | ||
| 1257 | d=BN_new(); | ||
| 1258 | |||
| 1259 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1260 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1261 | |||
| 1262 | for (i=0; i<num0; i++) | ||
| 1263 | { | ||
| 1264 | BN_bntest_rand(a, 1024, 0, 0); | ||
| 1265 | for (j=0; j < 2; j++) | ||
| 1266 | { | ||
| 1267 | BN_GF2m_mod_sqr(c, a, b[j], ctx); | ||
| 1268 | BN_copy(d, a); | ||
| 1269 | BN_GF2m_mod_mul(d, a, d, b[j], ctx); | ||
| 1270 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1271 | if (bp != NULL) | ||
| 1272 | { | ||
| 1273 | if (!results) | ||
| 1274 | { | ||
| 1275 | BN_print(bp,a); | ||
| 1276 | BIO_puts(bp," ^ 2 % "); | ||
| 1277 | BN_print(bp,b[j]); | ||
| 1278 | BIO_puts(bp, " = "); | ||
| 1279 | BN_print(bp,c); | ||
| 1280 | BIO_puts(bp,"; a * a = "); | ||
| 1281 | BN_print(bp,d); | ||
| 1282 | BIO_puts(bp,"\n"); | ||
| 1283 | } | ||
| 1284 | } | ||
| 1285 | #endif | ||
| 1286 | BN_GF2m_add(d, c, d); | ||
| 1287 | /* Test that a*a = a^2. */ | ||
| 1288 | if(!BN_is_zero(d)) | ||
| 1289 | { | ||
| 1290 | fprintf(stderr,"GF(2^m) modular squaring test failed!\n"); | ||
| 1291 | goto err; | ||
| 1292 | } | ||
| 1293 | } | ||
| 1294 | } | ||
| 1295 | ret = 1; | ||
| 1296 | err: | ||
| 1297 | BN_free(a); | ||
| 1298 | BN_free(b[0]); | ||
| 1299 | BN_free(b[1]); | ||
| 1300 | BN_free(c); | ||
| 1301 | BN_free(d); | ||
| 1302 | return ret; | ||
| 1303 | } | ||
| 1304 | |||
| 1305 | int test_gf2m_mod_inv(BIO *bp,BN_CTX *ctx) | ||
| 1306 | { | ||
| 1307 | BIGNUM *a,*b[2],*c,*d; | ||
| 1308 | int i, j, ret = 0; | ||
| 1309 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1310 | int p1[] = {193,15,0,-1}; | ||
| 1311 | |||
| 1312 | a=BN_new(); | ||
| 1313 | b[0]=BN_new(); | ||
| 1314 | b[1]=BN_new(); | ||
| 1315 | c=BN_new(); | ||
| 1316 | d=BN_new(); | ||
| 1317 | |||
| 1318 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1319 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1320 | |||
| 1321 | for (i=0; i<num0; i++) | ||
| 1322 | { | ||
| 1323 | BN_bntest_rand(a, 512, 0, 0); | ||
| 1324 | for (j=0; j < 2; j++) | ||
| 1325 | { | ||
| 1326 | BN_GF2m_mod_inv(c, a, b[j], ctx); | ||
| 1327 | BN_GF2m_mod_mul(d, a, c, b[j], ctx); | ||
| 1328 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1329 | if (bp != NULL) | ||
| 1330 | { | ||
| 1331 | if (!results) | ||
| 1332 | { | ||
| 1333 | BN_print(bp,a); | ||
| 1334 | BIO_puts(bp, " * "); | ||
| 1335 | BN_print(bp,c); | ||
| 1336 | BIO_puts(bp," - 1 % "); | ||
| 1337 | BN_print(bp,b[j]); | ||
| 1338 | BIO_puts(bp,"\n"); | ||
| 1339 | } | ||
| 1340 | } | ||
| 1341 | #endif | ||
| 1342 | /* Test that ((1/a)*a) = 1. */ | ||
| 1343 | if(!BN_is_one(d)) | ||
| 1344 | { | ||
| 1345 | fprintf(stderr,"GF(2^m) modular inversion test failed!\n"); | ||
| 1346 | goto err; | ||
| 1347 | } | ||
| 1348 | } | ||
| 1349 | } | ||
| 1350 | ret = 1; | ||
| 1351 | err: | ||
| 1352 | BN_free(a); | ||
| 1353 | BN_free(b[0]); | ||
| 1354 | BN_free(b[1]); | ||
| 1355 | BN_free(c); | ||
| 1356 | BN_free(d); | ||
| 1357 | return ret; | ||
| 1358 | } | ||
| 1359 | |||
| 1360 | int test_gf2m_mod_div(BIO *bp,BN_CTX *ctx) | ||
| 1361 | { | ||
| 1362 | BIGNUM *a,*b[2],*c,*d,*e,*f; | ||
| 1363 | int i, j, ret = 0; | ||
| 1364 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1365 | int p1[] = {193,15,0,-1}; | ||
| 1366 | |||
| 1367 | a=BN_new(); | ||
| 1368 | b[0]=BN_new(); | ||
| 1369 | b[1]=BN_new(); | ||
| 1370 | c=BN_new(); | ||
| 1371 | d=BN_new(); | ||
| 1372 | e=BN_new(); | ||
| 1373 | f=BN_new(); | ||
| 1374 | |||
| 1375 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1376 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1377 | |||
| 1378 | for (i=0; i<num0; i++) | ||
| 1379 | { | ||
| 1380 | BN_bntest_rand(a, 512, 0, 0); | ||
| 1381 | BN_bntest_rand(c, 512, 0, 0); | ||
| 1382 | for (j=0; j < 2; j++) | ||
| 1383 | { | ||
| 1384 | BN_GF2m_mod_div(d, a, c, b[j], ctx); | ||
| 1385 | BN_GF2m_mod_mul(e, d, c, b[j], ctx); | ||
| 1386 | BN_GF2m_mod_div(f, a, e, b[j], ctx); | ||
| 1387 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1388 | if (bp != NULL) | ||
| 1389 | { | ||
| 1390 | if (!results) | ||
| 1391 | { | ||
| 1392 | BN_print(bp,a); | ||
| 1393 | BIO_puts(bp, " = "); | ||
| 1394 | BN_print(bp,c); | ||
| 1395 | BIO_puts(bp," * "); | ||
| 1396 | BN_print(bp,d); | ||
| 1397 | BIO_puts(bp, " % "); | ||
| 1398 | BN_print(bp,b[j]); | ||
| 1399 | BIO_puts(bp,"\n"); | ||
| 1400 | } | ||
| 1401 | } | ||
| 1402 | #endif | ||
| 1403 | /* Test that ((a/c)*c)/a = 1. */ | ||
| 1404 | if(!BN_is_one(f)) | ||
| 1405 | { | ||
| 1406 | fprintf(stderr,"GF(2^m) modular division test failed!\n"); | ||
| 1407 | goto err; | ||
| 1408 | } | ||
| 1409 | } | ||
| 1410 | } | ||
| 1411 | ret = 1; | ||
| 1412 | err: | ||
| 1413 | BN_free(a); | ||
| 1414 | BN_free(b[0]); | ||
| 1415 | BN_free(b[1]); | ||
| 1416 | BN_free(c); | ||
| 1417 | BN_free(d); | ||
| 1418 | BN_free(e); | ||
| 1419 | BN_free(f); | ||
| 1420 | return ret; | ||
| 1421 | } | ||
| 1422 | |||
| 1423 | int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx) | ||
| 1424 | { | ||
| 1425 | BIGNUM *a,*b[2],*c,*d,*e,*f; | ||
| 1426 | int i, j, ret = 0; | ||
| 1427 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1428 | int p1[] = {193,15,0,-1}; | ||
| 1429 | |||
| 1430 | a=BN_new(); | ||
| 1431 | b[0]=BN_new(); | ||
| 1432 | b[1]=BN_new(); | ||
| 1433 | c=BN_new(); | ||
| 1434 | d=BN_new(); | ||
| 1435 | e=BN_new(); | ||
| 1436 | f=BN_new(); | ||
| 1437 | |||
| 1438 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1439 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1440 | |||
| 1441 | for (i=0; i<num0; i++) | ||
| 1442 | { | ||
| 1443 | BN_bntest_rand(a, 512, 0, 0); | ||
| 1444 | BN_bntest_rand(c, 512, 0, 0); | ||
| 1445 | BN_bntest_rand(d, 512, 0, 0); | ||
| 1446 | for (j=0; j < 2; j++) | ||
| 1447 | { | ||
| 1448 | BN_GF2m_mod_exp(e, a, c, b[j], ctx); | ||
| 1449 | BN_GF2m_mod_exp(f, a, d, b[j], ctx); | ||
| 1450 | BN_GF2m_mod_mul(e, e, f, b[j], ctx); | ||
| 1451 | BN_add(f, c, d); | ||
| 1452 | BN_GF2m_mod_exp(f, a, f, b[j], ctx); | ||
| 1453 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1454 | if (bp != NULL) | ||
| 1455 | { | ||
| 1456 | if (!results) | ||
| 1457 | { | ||
| 1458 | BN_print(bp,a); | ||
| 1459 | BIO_puts(bp, " ^ ("); | ||
| 1460 | BN_print(bp,c); | ||
| 1461 | BIO_puts(bp," + "); | ||
| 1462 | BN_print(bp,d); | ||
| 1463 | BIO_puts(bp, ") = "); | ||
| 1464 | BN_print(bp,e); | ||
| 1465 | BIO_puts(bp, "; - "); | ||
| 1466 | BN_print(bp,f); | ||
| 1467 | BIO_puts(bp, " % "); | ||
| 1468 | BN_print(bp,b[j]); | ||
| 1469 | BIO_puts(bp,"\n"); | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | #endif | ||
| 1473 | BN_GF2m_add(f, e, f); | ||
| 1474 | /* Test that a^(c+d)=a^c*a^d. */ | ||
| 1475 | if(!BN_is_zero(f)) | ||
| 1476 | { | ||
| 1477 | fprintf(stderr,"GF(2^m) modular exponentiation test failed!\n"); | ||
| 1478 | goto err; | ||
| 1479 | } | ||
| 1480 | } | ||
| 1481 | } | ||
| 1482 | ret = 1; | ||
| 1483 | err: | ||
| 1484 | BN_free(a); | ||
| 1485 | BN_free(b[0]); | ||
| 1486 | BN_free(b[1]); | ||
| 1487 | BN_free(c); | ||
| 1488 | BN_free(d); | ||
| 1489 | BN_free(e); | ||
| 1490 | BN_free(f); | ||
| 1491 | return ret; | ||
| 1492 | } | ||
| 1493 | |||
| 1494 | int test_gf2m_mod_sqrt(BIO *bp,BN_CTX *ctx) | ||
| 1495 | { | ||
| 1496 | BIGNUM *a,*b[2],*c,*d,*e,*f; | ||
| 1497 | int i, j, ret = 0; | ||
| 1498 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1499 | int p1[] = {193,15,0,-1}; | ||
| 1500 | |||
| 1501 | a=BN_new(); | ||
| 1502 | b[0]=BN_new(); | ||
| 1503 | b[1]=BN_new(); | ||
| 1504 | c=BN_new(); | ||
| 1505 | d=BN_new(); | ||
| 1506 | e=BN_new(); | ||
| 1507 | f=BN_new(); | ||
| 1508 | |||
| 1509 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1510 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1511 | |||
| 1512 | for (i=0; i<num0; i++) | ||
| 1513 | { | ||
| 1514 | BN_bntest_rand(a, 512, 0, 0); | ||
| 1515 | for (j=0; j < 2; j++) | ||
| 1516 | { | ||
| 1517 | BN_GF2m_mod(c, a, b[j]); | ||
| 1518 | BN_GF2m_mod_sqrt(d, a, b[j], ctx); | ||
| 1519 | BN_GF2m_mod_sqr(e, d, b[j], ctx); | ||
| 1520 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1521 | if (bp != NULL) | ||
| 1522 | { | ||
| 1523 | if (!results) | ||
| 1524 | { | ||
| 1525 | BN_print(bp,d); | ||
| 1526 | BIO_puts(bp, " ^ 2 - "); | ||
| 1527 | BN_print(bp,a); | ||
| 1528 | BIO_puts(bp,"\n"); | ||
| 1529 | } | ||
| 1530 | } | ||
| 1531 | #endif | ||
| 1532 | BN_GF2m_add(f, c, e); | ||
| 1533 | /* Test that d^2 = a, where d = sqrt(a). */ | ||
| 1534 | if(!BN_is_zero(f)) | ||
| 1535 | { | ||
| 1536 | fprintf(stderr,"GF(2^m) modular square root test failed!\n"); | ||
| 1537 | goto err; | ||
| 1538 | } | ||
| 1539 | } | ||
| 1540 | } | ||
| 1541 | ret = 1; | ||
| 1542 | err: | ||
| 1543 | BN_free(a); | ||
| 1544 | BN_free(b[0]); | ||
| 1545 | BN_free(b[1]); | ||
| 1546 | BN_free(c); | ||
| 1547 | BN_free(d); | ||
| 1548 | BN_free(e); | ||
| 1549 | BN_free(f); | ||
| 1550 | return ret; | ||
| 1551 | } | ||
| 1552 | |||
| 1553 | int test_gf2m_mod_solve_quad(BIO *bp,BN_CTX *ctx) | ||
| 1554 | { | ||
| 1555 | BIGNUM *a,*b[2],*c,*d,*e; | ||
| 1556 | int i, j, s = 0, t, ret = 0; | ||
| 1557 | int p0[] = {163,7,6,3,0,-1}; | ||
| 1558 | int p1[] = {193,15,0,-1}; | ||
| 1559 | |||
| 1560 | a=BN_new(); | ||
| 1561 | b[0]=BN_new(); | ||
| 1562 | b[1]=BN_new(); | ||
| 1563 | c=BN_new(); | ||
| 1564 | d=BN_new(); | ||
| 1565 | e=BN_new(); | ||
| 1566 | |||
| 1567 | BN_GF2m_arr2poly(p0, b[0]); | ||
| 1568 | BN_GF2m_arr2poly(p1, b[1]); | ||
| 1569 | |||
| 1570 | for (i=0; i<num0; i++) | ||
| 1571 | { | ||
| 1572 | BN_bntest_rand(a, 512, 0, 0); | ||
| 1573 | for (j=0; j < 2; j++) | ||
| 1574 | { | ||
| 1575 | t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); | ||
| 1576 | if (t) | ||
| 1577 | { | ||
| 1578 | s++; | ||
| 1579 | BN_GF2m_mod_sqr(d, c, b[j], ctx); | ||
| 1580 | BN_GF2m_add(d, c, d); | ||
| 1581 | BN_GF2m_mod(e, a, b[j]); | ||
| 1582 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1583 | if (bp != NULL) | ||
| 1584 | { | ||
| 1585 | if (!results) | ||
| 1586 | { | ||
| 1587 | BN_print(bp,c); | ||
| 1588 | BIO_puts(bp, " is root of z^2 + z = "); | ||
| 1589 | BN_print(bp,a); | ||
| 1590 | BIO_puts(bp, " % "); | ||
| 1591 | BN_print(bp,b[j]); | ||
| 1592 | BIO_puts(bp, "\n"); | ||
| 1593 | } | ||
| 1594 | } | ||
| 1595 | #endif | ||
| 1596 | BN_GF2m_add(e, e, d); | ||
| 1597 | /* Test that solution of quadratic c satisfies c^2 + c = a. */ | ||
| 1598 | if(!BN_is_zero(e)) | ||
| 1599 | { | ||
| 1600 | fprintf(stderr,"GF(2^m) modular solve quadratic test failed!\n"); | ||
| 1601 | goto err; | ||
| 1602 | } | ||
| 1603 | |||
| 1604 | } | ||
| 1605 | else | ||
| 1606 | { | ||
| 1607 | #if 0 /* make test uses ouput in bc but bc can't handle GF(2^m) arithmetic */ | ||
| 1608 | if (bp != NULL) | ||
| 1609 | { | ||
| 1610 | if (!results) | ||
| 1611 | { | ||
| 1612 | BIO_puts(bp, "There are no roots of z^2 + z = "); | ||
| 1613 | BN_print(bp,a); | ||
| 1614 | BIO_puts(bp, " % "); | ||
| 1615 | BN_print(bp,b[j]); | ||
| 1616 | BIO_puts(bp, "\n"); | ||
| 1617 | } | ||
| 1618 | } | ||
| 1619 | #endif | ||
| 1620 | } | ||
| 1621 | } | ||
| 1622 | } | ||
| 1623 | if (s == 0) | ||
| 1624 | { | ||
| 1625 | fprintf(stderr,"All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", num0); | ||
| 1626 | fprintf(stderr,"this is very unlikely and probably indicates an error.\n"); | ||
| 1627 | goto err; | ||
| 1628 | } | ||
| 1629 | ret = 1; | ||
| 1630 | err: | ||
| 1631 | BN_free(a); | ||
| 1632 | BN_free(b[0]); | ||
| 1633 | BN_free(b[1]); | ||
| 1634 | BN_free(c); | ||
| 1635 | BN_free(d); | ||
| 1636 | BN_free(e); | ||
| 1637 | return ret; | ||
| 1638 | } | ||
| 1639 | |||
| 1640 | static int genprime_cb(int p, int n, BN_GENCB *arg) | ||
| 1641 | { | ||
| 1642 | char c='*'; | ||
| 1643 | |||
| 1644 | if (p == 0) c='.'; | ||
| 1645 | if (p == 1) c='+'; | ||
| 1646 | if (p == 2) c='*'; | ||
| 1647 | if (p == 3) c='\n'; | ||
| 1648 | putc(c, stderr); | ||
| 1649 | fflush(stderr); | ||
| 1650 | return 1; | ||
| 1651 | } | ||
| 1652 | |||
| 1653 | int test_kron(BIO *bp, BN_CTX *ctx) | ||
| 1654 | { | ||
| 1655 | BN_GENCB cb; | ||
| 1656 | BIGNUM *a,*b,*r,*t; | ||
| 1657 | int i; | ||
| 1658 | int legendre, kronecker; | ||
| 1659 | int ret = 0; | ||
| 1660 | |||
| 1661 | a = BN_new(); | ||
| 1662 | b = BN_new(); | ||
| 1663 | r = BN_new(); | ||
| 1664 | t = BN_new(); | ||
| 1665 | if (a == NULL || b == NULL || r == NULL || t == NULL) goto err; | ||
| 1666 | |||
| 1667 | BN_GENCB_set(&cb, genprime_cb, NULL); | ||
| 1668 | |||
| 1669 | /* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol). | ||
| 1670 | * In this case we know that if b is prime, then BN_kronecker(a, b, ctx) | ||
| 1671 | * is congruent to $a^{(b-1)/2}$, modulo $b$ (Legendre symbol). | ||
| 1672 | * So we generate a random prime b and compare these values | ||
| 1673 | * for a number of random a's. (That is, we run the Solovay-Strassen | ||
| 1674 | * primality test to confirm that b is prime, except that we | ||
| 1675 | * don't want to test whether b is prime but whether BN_kronecker | ||
| 1676 | * works.) */ | ||
| 1677 | |||
| 1678 | if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err; | ||
| 1679 | b->neg = rand_neg(); | ||
| 1680 | putc('\n', stderr); | ||
| 1681 | |||
| 1682 | for (i = 0; i < num0; i++) | ||
| 1683 | { | ||
| 1684 | if (!BN_bntest_rand(a, 512, 0, 0)) goto err; | ||
| 1685 | a->neg = rand_neg(); | ||
| 1686 | |||
| 1687 | /* t := (|b|-1)/2 (note that b is odd) */ | ||
| 1688 | if (!BN_copy(t, b)) goto err; | ||
| 1689 | t->neg = 0; | ||
| 1690 | if (!BN_sub_word(t, 1)) goto err; | ||
| 1691 | if (!BN_rshift1(t, t)) goto err; | ||
| 1692 | /* r := a^t mod b */ | ||
| 1693 | b->neg=0; | ||
| 1694 | |||
| 1695 | if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err; | ||
| 1696 | b->neg=1; | ||
| 1697 | |||
| 1698 | if (BN_is_word(r, 1)) | ||
| 1699 | legendre = 1; | ||
| 1700 | else if (BN_is_zero(r)) | ||
| 1701 | legendre = 0; | ||
| 1702 | else | ||
| 1703 | { | ||
| 1704 | if (!BN_add_word(r, 1)) goto err; | ||
| 1705 | if (0 != BN_ucmp(r, b)) | ||
| 1706 | { | ||
| 1707 | fprintf(stderr, "Legendre symbol computation failed\n"); | ||
| 1708 | goto err; | ||
| 1709 | } | ||
| 1710 | legendre = -1; | ||
| 1711 | } | ||
| 1712 | |||
| 1713 | kronecker = BN_kronecker(a, b, ctx); | ||
| 1714 | if (kronecker < -1) goto err; | ||
| 1715 | /* we actually need BN_kronecker(a, |b|) */ | ||
| 1716 | if (a->neg && b->neg) | ||
| 1717 | kronecker = -kronecker; | ||
| 1718 | |||
| 1719 | if (legendre != kronecker) | ||
| 1720 | { | ||
| 1721 | fprintf(stderr, "legendre != kronecker; a = "); | ||
| 1722 | BN_print_fp(stderr, a); | ||
| 1723 | fprintf(stderr, ", b = "); | ||
| 1724 | BN_print_fp(stderr, b); | ||
| 1725 | fprintf(stderr, "\n"); | ||
| 1726 | goto err; | ||
| 1727 | } | ||
| 1728 | |||
| 1729 | putc('.', stderr); | ||
| 1730 | fflush(stderr); | ||
| 1731 | } | ||
| 1732 | |||
| 1733 | putc('\n', stderr); | ||
| 1734 | fflush(stderr); | ||
| 1735 | ret = 1; | ||
| 1736 | err: | ||
| 1737 | if (a != NULL) BN_free(a); | ||
| 1738 | if (b != NULL) BN_free(b); | ||
| 1739 | if (r != NULL) BN_free(r); | ||
| 1740 | if (t != NULL) BN_free(t); | ||
| 1741 | return ret; | ||
| 1742 | } | ||
| 1743 | |||
| 1744 | int test_sqrt(BIO *bp, BN_CTX *ctx) | ||
| 1745 | { | ||
| 1746 | BN_GENCB cb; | ||
| 1747 | BIGNUM *a,*p,*r; | ||
| 1748 | int i, j; | ||
| 1749 | int ret = 0; | ||
| 1750 | |||
| 1751 | a = BN_new(); | ||
| 1752 | p = BN_new(); | ||
| 1753 | r = BN_new(); | ||
| 1754 | if (a == NULL || p == NULL || r == NULL) goto err; | ||
| 1755 | |||
| 1756 | BN_GENCB_set(&cb, genprime_cb, NULL); | ||
| 1757 | |||
| 1758 | for (i = 0; i < 16; i++) | ||
| 1759 | { | ||
| 1760 | if (i < 8) | ||
| 1761 | { | ||
| 1762 | unsigned primes[8] = { 2, 3, 5, 7, 11, 13, 17, 19 }; | ||
| 1763 | |||
| 1764 | if (!BN_set_word(p, primes[i])) goto err; | ||
| 1765 | } | ||
| 1766 | else | ||
| 1767 | { | ||
| 1768 | if (!BN_set_word(a, 32)) goto err; | ||
| 1769 | if (!BN_set_word(r, 2*i + 1)) goto err; | ||
| 1770 | |||
| 1771 | if (!BN_generate_prime_ex(p, 256, 0, a, r, &cb)) goto err; | ||
| 1772 | putc('\n', stderr); | ||
| 1773 | } | ||
| 1774 | p->neg = rand_neg(); | ||
| 1775 | |||
| 1776 | for (j = 0; j < num2; j++) | ||
| 1777 | { | ||
| 1778 | /* construct 'a' such that it is a square modulo p, | ||
| 1779 | * but in general not a proper square and not reduced modulo p */ | ||
| 1780 | if (!BN_bntest_rand(r, 256, 0, 3)) goto err; | ||
| 1781 | if (!BN_nnmod(r, r, p, ctx)) goto err; | ||
| 1782 | if (!BN_mod_sqr(r, r, p, ctx)) goto err; | ||
| 1783 | if (!BN_bntest_rand(a, 256, 0, 3)) goto err; | ||
| 1784 | if (!BN_nnmod(a, a, p, ctx)) goto err; | ||
| 1785 | if (!BN_mod_sqr(a, a, p, ctx)) goto err; | ||
| 1786 | if (!BN_mul(a, a, r, ctx)) goto err; | ||
| 1787 | if (rand_neg()) | ||
| 1788 | if (!BN_sub(a, a, p)) goto err; | ||
| 1789 | |||
| 1790 | if (!BN_mod_sqrt(r, a, p, ctx)) goto err; | ||
| 1791 | if (!BN_mod_sqr(r, r, p, ctx)) goto err; | ||
| 1792 | |||
| 1793 | if (!BN_nnmod(a, a, p, ctx)) goto err; | ||
| 1794 | |||
| 1795 | if (BN_cmp(a, r) != 0) | ||
| 1796 | { | ||
| 1797 | fprintf(stderr, "BN_mod_sqrt failed: a = "); | ||
| 1798 | BN_print_fp(stderr, a); | ||
| 1799 | fprintf(stderr, ", r = "); | ||
| 1800 | BN_print_fp(stderr, r); | ||
| 1801 | fprintf(stderr, ", p = "); | ||
| 1802 | BN_print_fp(stderr, p); | ||
| 1803 | fprintf(stderr, "\n"); | ||
| 1804 | goto err; | ||
| 1805 | } | ||
| 1806 | |||
| 1807 | putc('.', stderr); | ||
| 1808 | fflush(stderr); | ||
| 1809 | } | ||
| 1810 | |||
| 1811 | putc('\n', stderr); | ||
| 1812 | fflush(stderr); | ||
| 1813 | } | ||
| 1814 | ret = 1; | ||
| 1815 | err: | ||
| 1816 | if (a != NULL) BN_free(a); | ||
| 1817 | if (p != NULL) BN_free(p); | ||
| 1818 | if (r != NULL) BN_free(r); | ||
| 1819 | return ret; | ||
| 1820 | } | ||
| 1821 | |||
| 1822 | int test_lshift(BIO *bp,BN_CTX *ctx,BIGNUM *a_) | ||
| 1823 | { | ||
| 1824 | BIGNUM *a,*b,*c,*d; | ||
| 1825 | int i; | ||
| 1826 | |||
| 1827 | b=BN_new(); | ||
| 1828 | c=BN_new(); | ||
| 1829 | d=BN_new(); | ||
| 1830 | BN_one(c); | ||
| 1831 | |||
| 1832 | if(a_) | ||
| 1833 | a=a_; | ||
| 1834 | else | ||
| 1835 | { | ||
| 1836 | a=BN_new(); | ||
| 1837 | BN_bntest_rand(a,200,0,0); /**/ | ||
| 1838 | a->neg=rand_neg(); | ||
| 1839 | } | ||
| 1840 | for (i=0; i<num0; i++) | ||
| 1841 | { | ||
| 1842 | BN_lshift(b,a,i+1); | ||
| 1843 | BN_add(c,c,c); | ||
| 1844 | if (bp != NULL) | ||
| 1845 | { | ||
| 1846 | if (!results) | ||
| 1847 | { | ||
| 1848 | BN_print(bp,a); | ||
| 1849 | BIO_puts(bp," * "); | ||
| 1850 | BN_print(bp,c); | ||
| 1851 | BIO_puts(bp," - "); | ||
| 1852 | } | ||
| 1853 | BN_print(bp,b); | ||
| 1854 | BIO_puts(bp,"\n"); | ||
| 1855 | } | ||
| 1856 | BN_mul(d,a,c,ctx); | ||
| 1857 | BN_sub(d,d,b); | ||
| 1858 | if(!BN_is_zero(d)) | ||
| 1859 | { | ||
| 1860 | fprintf(stderr,"Left shift test failed!\n"); | ||
| 1861 | fprintf(stderr,"a="); | ||
| 1862 | BN_print_fp(stderr,a); | ||
| 1863 | fprintf(stderr,"\nb="); | ||
| 1864 | BN_print_fp(stderr,b); | ||
| 1865 | fprintf(stderr,"\nc="); | ||
| 1866 | BN_print_fp(stderr,c); | ||
| 1867 | fprintf(stderr,"\nd="); | ||
| 1868 | BN_print_fp(stderr,d); | ||
| 1869 | fprintf(stderr,"\n"); | ||
| 1870 | return 0; | ||
| 1871 | } | ||
| 1872 | } | ||
| 1873 | BN_free(a); | ||
| 1874 | BN_free(b); | ||
| 1875 | BN_free(c); | ||
| 1876 | BN_free(d); | ||
| 1877 | return(1); | ||
| 1878 | } | ||
| 1879 | |||
| 1880 | int test_lshift1(BIO *bp) | ||
| 1881 | { | ||
| 1882 | BIGNUM *a,*b,*c; | ||
| 1883 | int i; | ||
| 1884 | |||
| 1885 | a=BN_new(); | ||
| 1886 | b=BN_new(); | ||
| 1887 | c=BN_new(); | ||
| 1888 | |||
| 1889 | BN_bntest_rand(a,200,0,0); /**/ | ||
| 1890 | a->neg=rand_neg(); | ||
| 1891 | for (i=0; i<num0; i++) | ||
| 1892 | { | ||
| 1893 | BN_lshift1(b,a); | ||
| 1894 | if (bp != NULL) | ||
| 1895 | { | ||
| 1896 | if (!results) | ||
| 1897 | { | ||
| 1898 | BN_print(bp,a); | ||
| 1899 | BIO_puts(bp," * 2"); | ||
| 1900 | BIO_puts(bp," - "); | ||
| 1901 | } | ||
| 1902 | BN_print(bp,b); | ||
| 1903 | BIO_puts(bp,"\n"); | ||
| 1904 | } | ||
| 1905 | BN_add(c,a,a); | ||
| 1906 | BN_sub(a,b,c); | ||
| 1907 | if(!BN_is_zero(a)) | ||
| 1908 | { | ||
| 1909 | fprintf(stderr,"Left shift one test failed!\n"); | ||
| 1910 | return 0; | ||
| 1911 | } | ||
| 1912 | |||
| 1913 | BN_copy(a,b); | ||
| 1914 | } | ||
| 1915 | BN_free(a); | ||
| 1916 | BN_free(b); | ||
| 1917 | BN_free(c); | ||
| 1918 | return(1); | ||
| 1919 | } | ||
| 1920 | |||
| 1921 | int test_rshift(BIO *bp,BN_CTX *ctx) | ||
| 1922 | { | ||
| 1923 | BIGNUM *a,*b,*c,*d,*e; | ||
| 1924 | int i; | ||
| 1925 | |||
| 1926 | a=BN_new(); | ||
| 1927 | b=BN_new(); | ||
| 1928 | c=BN_new(); | ||
| 1929 | d=BN_new(); | ||
| 1930 | e=BN_new(); | ||
| 1931 | BN_one(c); | ||
| 1932 | |||
| 1933 | BN_bntest_rand(a,200,0,0); /**/ | ||
| 1934 | a->neg=rand_neg(); | ||
| 1935 | for (i=0; i<num0; i++) | ||
| 1936 | { | ||
| 1937 | BN_rshift(b,a,i+1); | ||
| 1938 | BN_add(c,c,c); | ||
| 1939 | if (bp != NULL) | ||
| 1940 | { | ||
| 1941 | if (!results) | ||
| 1942 | { | ||
| 1943 | BN_print(bp,a); | ||
| 1944 | BIO_puts(bp," / "); | ||
| 1945 | BN_print(bp,c); | ||
| 1946 | BIO_puts(bp," - "); | ||
| 1947 | } | ||
| 1948 | BN_print(bp,b); | ||
| 1949 | BIO_puts(bp,"\n"); | ||
| 1950 | } | ||
| 1951 | BN_div(d,e,a,c,ctx); | ||
| 1952 | BN_sub(d,d,b); | ||
| 1953 | if(!BN_is_zero(d)) | ||
| 1954 | { | ||
| 1955 | fprintf(stderr,"Right shift test failed!\n"); | ||
| 1956 | return 0; | ||
| 1957 | } | ||
| 1958 | } | ||
| 1959 | BN_free(a); | ||
| 1960 | BN_free(b); | ||
| 1961 | BN_free(c); | ||
| 1962 | BN_free(d); | ||
| 1963 | BN_free(e); | ||
| 1964 | return(1); | ||
| 1965 | } | ||
| 1966 | |||
| 1967 | int test_rshift1(BIO *bp) | ||
| 1968 | { | ||
| 1969 | BIGNUM *a,*b,*c; | ||
| 1970 | int i; | ||
| 1971 | |||
| 1972 | a=BN_new(); | ||
| 1973 | b=BN_new(); | ||
| 1974 | c=BN_new(); | ||
| 1975 | |||
| 1976 | BN_bntest_rand(a,200,0,0); /**/ | ||
| 1977 | a->neg=rand_neg(); | ||
| 1978 | for (i=0; i<num0; i++) | ||
| 1979 | { | ||
| 1980 | BN_rshift1(b,a); | ||
| 1981 | if (bp != NULL) | ||
| 1982 | { | ||
| 1983 | if (!results) | ||
| 1984 | { | ||
| 1985 | BN_print(bp,a); | ||
| 1986 | BIO_puts(bp," / 2"); | ||
| 1987 | BIO_puts(bp," - "); | ||
| 1988 | } | ||
| 1989 | BN_print(bp,b); | ||
| 1990 | BIO_puts(bp,"\n"); | ||
| 1991 | } | ||
| 1992 | BN_sub(c,a,b); | ||
| 1993 | BN_sub(c,c,b); | ||
| 1994 | if(!BN_is_zero(c) && !BN_abs_is_word(c, 1)) | ||
| 1995 | { | ||
| 1996 | fprintf(stderr,"Right shift one test failed!\n"); | ||
| 1997 | return 0; | ||
| 1998 | } | ||
| 1999 | BN_copy(a,b); | ||
| 2000 | } | ||
| 2001 | BN_free(a); | ||
| 2002 | BN_free(b); | ||
| 2003 | BN_free(c); | ||
| 2004 | return(1); | ||
| 2005 | } | ||
| 2006 | |||
| 2007 | int rand_neg(void) | ||
| 2008 | { | ||
| 2009 | static unsigned int neg=0; | ||
| 2010 | static int sign[8]={0,0,0,1,1,0,1,1}; | ||
| 2011 | |||
| 2012 | return(sign[(neg++)%8]); | ||
| 2013 | } | ||
diff --git a/src/lib/libcrypto/bn/divtest.c b/src/lib/libcrypto/bn/divtest.c new file mode 100644 index 0000000000..d3fc688f33 --- /dev/null +++ b/src/lib/libcrypto/bn/divtest.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #include <openssl/bn.h> | ||
| 2 | #include <openssl/rand.h> | ||
| 3 | |||
| 4 | static int Rand(n) | ||
| 5 | { | ||
| 6 | unsigned char x[2]; | ||
| 7 | RAND_pseudo_bytes(x,2); | ||
| 8 | return (x[0] + 2*x[1]); | ||
| 9 | } | ||
| 10 | |||
| 11 | static void bug(char *m, BIGNUM *a, BIGNUM *b) | ||
| 12 | { | ||
| 13 | printf("%s!\na=",m); | ||
| 14 | BN_print_fp(stdout, a); | ||
| 15 | printf("\nb="); | ||
| 16 | BN_print_fp(stdout, b); | ||
| 17 | printf("\n"); | ||
| 18 | fflush(stdout); | ||
| 19 | } | ||
| 20 | |||
| 21 | main() | ||
| 22 | { | ||
| 23 | BIGNUM *a=BN_new(), *b=BN_new(), *c=BN_new(), *d=BN_new(), | ||
| 24 | *C=BN_new(), *D=BN_new(); | ||
| 25 | BN_RECP_CTX *recp=BN_RECP_CTX_new(); | ||
| 26 | BN_CTX *ctx=BN_CTX_new(); | ||
| 27 | |||
| 28 | for(;;) { | ||
| 29 | BN_pseudo_rand(a,Rand(),0,0); | ||
| 30 | BN_pseudo_rand(b,Rand(),0,0); | ||
| 31 | if (BN_is_zero(b)) continue; | ||
| 32 | |||
| 33 | BN_RECP_CTX_set(recp,b,ctx); | ||
| 34 | if (BN_div(C,D,a,b,ctx) != 1) | ||
| 35 | bug("BN_div failed",a,b); | ||
| 36 | if (BN_div_recp(c,d,a,recp,ctx) != 1) | ||
| 37 | bug("BN_div_recp failed",a,b); | ||
| 38 | else if (BN_cmp(c,C) != 0 || BN_cmp(c,C) != 0) | ||
| 39 | bug("mismatch",a,b); | ||
| 40 | } | ||
| 41 | } | ||
diff --git a/src/lib/libcrypto/bn/exp.c b/src/lib/libcrypto/bn/exp.c new file mode 100644 index 0000000000..4865b0ef74 --- /dev/null +++ b/src/lib/libcrypto/bn/exp.c | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | /* unused */ | ||
| 2 | |||
| 3 | #include <stdio.h> | ||
| 4 | #include <openssl/tmdiff.h> | ||
| 5 | #include "bn_lcl.h" | ||
| 6 | |||
| 7 | #define SIZE 256 | ||
| 8 | #define NUM (8*8*8) | ||
| 9 | #define MOD (8*8*8*8*8) | ||
| 10 | |||
| 11 | main(argc,argv) | ||
| 12 | int argc; | ||
| 13 | char *argv[]; | ||
| 14 | { | ||
| 15 | BN_CTX ctx; | ||
| 16 | BIGNUM a,b,c,r,rr,t,l; | ||
| 17 | int j,i,size=SIZE,num=NUM,mod=MOD; | ||
| 18 | char *start,*end; | ||
| 19 | BN_MONT_CTX mont; | ||
| 20 | double d,md; | ||
| 21 | |||
| 22 | BN_MONT_CTX_init(&mont); | ||
| 23 | BN_CTX_init(&ctx); | ||
| 24 | BN_init(&a); | ||
| 25 | BN_init(&b); | ||
| 26 | BN_init(&c); | ||
| 27 | BN_init(&r); | ||
| 28 | |||
| 29 | start=ms_time_new(); | ||
| 30 | end=ms_time_new(); | ||
| 31 | while (size <= 1024*8) | ||
| 32 | { | ||
| 33 | BN_rand(&a,size,0,0); | ||
| 34 | BN_rand(&b,size,1,0); | ||
| 35 | BN_rand(&c,size,0,1); | ||
| 36 | |||
| 37 | BN_mod(&a,&a,&c,&ctx); | ||
| 38 | |||
| 39 | ms_time_get(start); | ||
| 40 | for (i=0; i<10; i++) | ||
| 41 | BN_MONT_CTX_set(&mont,&c,&ctx); | ||
| 42 | ms_time_get(end); | ||
| 43 | md=ms_time_diff(start,end); | ||
| 44 | |||
| 45 | ms_time_get(start); | ||
| 46 | for (i=0; i<num; i++) | ||
| 47 | { | ||
| 48 | /* bn_mull(&r,&a,&b,&ctx); */ | ||
| 49 | /* BN_sqr(&r,&a,&ctx); */ | ||
| 50 | BN_mod_exp_mont(&r,&a,&b,&c,&ctx,&mont); | ||
| 51 | } | ||
| 52 | ms_time_get(end); | ||
| 53 | d=ms_time_diff(start,end)/* *50/33 */; | ||
| 54 | printf("%5d bit:%6.2f %6d %6.4f %4d m_set(%5.4f)\n",size, | ||
| 55 | d,num,d/num,(int)((d/num)*mod),md/10.0); | ||
| 56 | num/=8; | ||
| 57 | mod/=8; | ||
| 58 | if (num <= 0) num=1; | ||
| 59 | size*=2; | ||
| 60 | } | ||
| 61 | |||
| 62 | } | ||
diff --git a/src/lib/libcrypto/bn/expspeed.c b/src/lib/libcrypto/bn/expspeed.c new file mode 100644 index 0000000000..4d5f221f33 --- /dev/null +++ b/src/lib/libcrypto/bn/expspeed.c | |||
| @@ -0,0 +1,353 @@ | |||
| 1 | /* unused */ | ||
| 2 | |||
| 3 | /* crypto/bn/expspeed.c */ | ||
| 4 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * This package is an SSL implementation written | ||
| 8 | * by Eric Young (eay@cryptsoft.com). | ||
| 9 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 10 | * | ||
| 11 | * This library is free for commercial and non-commercial use as long as | ||
| 12 | * the following conditions are aheared to. The following conditions | ||
| 13 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 14 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 15 | * included with this distribution is covered by the same copyright terms | ||
| 16 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 17 | * | ||
| 18 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 19 | * the code are not to be removed. | ||
| 20 | * If this package is used in a product, Eric Young should be given attribution | ||
| 21 | * as the author of the parts of the library used. | ||
| 22 | * This can be in the form of a textual message at program startup or | ||
| 23 | * in documentation (online or textual) provided with the package. | ||
| 24 | * | ||
| 25 | * Redistribution and use in source and binary forms, with or without | ||
| 26 | * modification, are permitted provided that the following conditions | ||
| 27 | * are met: | ||
| 28 | * 1. Redistributions of source code must retain the copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer. | ||
| 30 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 31 | * notice, this list of conditions and the following disclaimer in the | ||
| 32 | * documentation and/or other materials provided with the distribution. | ||
| 33 | * 3. All advertising materials mentioning features or use of this software | ||
| 34 | * must display the following acknowledgement: | ||
| 35 | * "This product includes cryptographic software written by | ||
| 36 | * Eric Young (eay@cryptsoft.com)" | ||
| 37 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 38 | * being used are not cryptographic related :-). | ||
| 39 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 40 | * the apps directory (application code) you must include an acknowledgement: | ||
| 41 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 42 | * | ||
| 43 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 44 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 46 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 49 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 50 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 52 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 53 | * SUCH DAMAGE. | ||
| 54 | * | ||
| 55 | * The licence and distribution terms for any publically available version or | ||
| 56 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 57 | * copied and put under another distribution licence | ||
| 58 | * [including the GNU Public Licence.] | ||
| 59 | */ | ||
| 60 | |||
| 61 | /* most of this code has been pilfered from my libdes speed.c program */ | ||
| 62 | |||
| 63 | #define BASENUM 5000 | ||
| 64 | #define NUM_START 0 | ||
| 65 | |||
| 66 | |||
| 67 | /* determine timings for modexp, modmul, modsqr, gcd, Kronecker symbol, | ||
| 68 | * modular inverse, or modular square roots */ | ||
| 69 | #define TEST_EXP | ||
| 70 | #undef TEST_MUL | ||
| 71 | #undef TEST_SQR | ||
| 72 | #undef TEST_GCD | ||
| 73 | #undef TEST_KRON | ||
| 74 | #undef TEST_INV | ||
| 75 | #undef TEST_SQRT | ||
| 76 | #define P_MOD_64 9 /* least significant 6 bits for prime to be used for BN_sqrt timings */ | ||
| 77 | |||
| 78 | #if defined(TEST_EXP) + defined(TEST_MUL) + defined(TEST_SQR) + defined(TEST_GCD) + defined(TEST_KRON) + defined(TEST_INV) +defined(TEST_SQRT) != 1 | ||
| 79 | # error "choose one test" | ||
| 80 | #endif | ||
| 81 | |||
| 82 | #if defined(TEST_INV) || defined(TEST_SQRT) | ||
| 83 | # define C_PRIME | ||
| 84 | static void genprime_cb(int p, int n, void *arg); | ||
| 85 | #endif | ||
| 86 | |||
| 87 | |||
| 88 | |||
| 89 | #undef PROG | ||
| 90 | #define PROG bnspeed_main | ||
| 91 | |||
| 92 | #include <stdio.h> | ||
| 93 | #include <stdlib.h> | ||
| 94 | #include <signal.h> | ||
| 95 | #include <string.h> | ||
| 96 | #include <openssl/crypto.h> | ||
| 97 | #include <openssl/err.h> | ||
| 98 | #include <openssl/rand.h> | ||
| 99 | |||
| 100 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 101 | #define TIMES | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #ifndef _IRIX | ||
| 105 | #include <time.h> | ||
| 106 | #endif | ||
| 107 | #ifdef TIMES | ||
| 108 | #include <sys/types.h> | ||
| 109 | #include <sys/times.h> | ||
| 110 | #endif | ||
| 111 | |||
| 112 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 113 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 114 | undefine TIMES, since that tells the rest of the program how things | ||
| 115 | should be handled. -- Richard Levitte */ | ||
| 116 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 117 | #undef TIMES | ||
| 118 | #endif | ||
| 119 | |||
| 120 | #ifndef TIMES | ||
| 121 | #include <sys/timeb.h> | ||
| 122 | #endif | ||
| 123 | |||
| 124 | #if defined(sun) || defined(__ultrix) | ||
| 125 | #define _POSIX_SOURCE | ||
| 126 | #include <limits.h> | ||
| 127 | #include <sys/param.h> | ||
| 128 | #endif | ||
| 129 | |||
| 130 | #include <openssl/bn.h> | ||
| 131 | #include <openssl/x509.h> | ||
| 132 | |||
| 133 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 134 | #ifndef HZ | ||
| 135 | # ifndef CLK_TCK | ||
| 136 | # ifndef _BSD_CLK_TCK_ /* FreeBSD hack */ | ||
| 137 | # define HZ 100.0 | ||
| 138 | # else /* _BSD_CLK_TCK_ */ | ||
| 139 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 140 | # endif | ||
| 141 | # else /* CLK_TCK */ | ||
| 142 | # define HZ ((double)CLK_TCK) | ||
| 143 | # endif | ||
| 144 | #endif | ||
| 145 | |||
| 146 | #undef BUFSIZE | ||
| 147 | #define BUFSIZE ((long)1024*8) | ||
| 148 | int run=0; | ||
| 149 | |||
| 150 | static double Time_F(int s); | ||
| 151 | #define START 0 | ||
| 152 | #define STOP 1 | ||
| 153 | |||
| 154 | static double Time_F(int s) | ||
| 155 | { | ||
| 156 | double ret; | ||
| 157 | #ifdef TIMES | ||
| 158 | static struct tms tstart,tend; | ||
| 159 | |||
| 160 | if (s == START) | ||
| 161 | { | ||
| 162 | times(&tstart); | ||
| 163 | return(0); | ||
| 164 | } | ||
| 165 | else | ||
| 166 | { | ||
| 167 | times(&tend); | ||
| 168 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 169 | return((ret < 1e-3)?1e-3:ret); | ||
| 170 | } | ||
| 171 | #else /* !times() */ | ||
| 172 | static struct timeb tstart,tend; | ||
| 173 | long i; | ||
| 174 | |||
| 175 | if (s == START) | ||
| 176 | { | ||
| 177 | ftime(&tstart); | ||
| 178 | return(0); | ||
| 179 | } | ||
| 180 | else | ||
| 181 | { | ||
| 182 | ftime(&tend); | ||
| 183 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 184 | ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; | ||
| 185 | return((ret < 0.001)?0.001:ret); | ||
| 186 | } | ||
| 187 | #endif | ||
| 188 | } | ||
| 189 | |||
| 190 | #define NUM_SIZES 7 | ||
| 191 | #if NUM_START > NUM_SIZES | ||
| 192 | # error "NUM_START > NUM_SIZES" | ||
| 193 | #endif | ||
| 194 | static int sizes[NUM_SIZES]={128,256,512,1024,2048,4096,8192}; | ||
| 195 | static int mul_c[NUM_SIZES]={8*8*8*8*8*8,8*8*8*8*8,8*8*8*8,8*8*8,8*8,8,1}; | ||
| 196 | /*static int sizes[NUM_SIZES]={59,179,299,419,539}; */ | ||
| 197 | |||
| 198 | #define RAND_SEED(string) { const char str[] = string; RAND_seed(string, sizeof str); } | ||
| 199 | |||
| 200 | void do_mul_exp(BIGNUM *r,BIGNUM *a,BIGNUM *b,BIGNUM *c,BN_CTX *ctx); | ||
| 201 | |||
| 202 | int main(int argc, char **argv) | ||
| 203 | { | ||
| 204 | BN_CTX *ctx; | ||
| 205 | BIGNUM *a,*b,*c,*r; | ||
| 206 | |||
| 207 | #if 1 | ||
| 208 | if (!CRYPTO_set_mem_debug_functions(0,0,0,0,0)) | ||
| 209 | abort(); | ||
| 210 | #endif | ||
| 211 | |||
| 212 | ctx=BN_CTX_new(); | ||
| 213 | a=BN_new(); | ||
| 214 | b=BN_new(); | ||
| 215 | c=BN_new(); | ||
| 216 | r=BN_new(); | ||
| 217 | |||
| 218 | while (!RAND_status()) | ||
| 219 | /* not enough bits */ | ||
| 220 | RAND_SEED("I demand a manual recount!"); | ||
| 221 | |||
| 222 | do_mul_exp(r,a,b,c,ctx); | ||
| 223 | return 0; | ||
| 224 | } | ||
| 225 | |||
| 226 | void do_mul_exp(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx) | ||
| 227 | { | ||
| 228 | int i,k; | ||
| 229 | double tm; | ||
| 230 | long num; | ||
| 231 | |||
| 232 | num=BASENUM; | ||
| 233 | for (i=NUM_START; i<NUM_SIZES; i++) | ||
| 234 | { | ||
| 235 | #ifdef C_PRIME | ||
| 236 | # ifdef TEST_SQRT | ||
| 237 | if (!BN_set_word(a, 64)) goto err; | ||
| 238 | if (!BN_set_word(b, P_MOD_64)) goto err; | ||
| 239 | # define ADD a | ||
| 240 | # define REM b | ||
| 241 | # else | ||
| 242 | # define ADD NULL | ||
| 243 | # define REM NULL | ||
| 244 | # endif | ||
| 245 | if (!BN_generate_prime(c,sizes[i],0,ADD,REM,genprime_cb,NULL)) goto err; | ||
| 246 | putc('\n', stderr); | ||
| 247 | fflush(stderr); | ||
| 248 | #endif | ||
| 249 | |||
| 250 | for (k=0; k<num; k++) | ||
| 251 | { | ||
| 252 | if (k%50 == 0) /* Average over num/50 different choices of random numbers. */ | ||
| 253 | { | ||
| 254 | if (!BN_pseudo_rand(a,sizes[i],1,0)) goto err; | ||
| 255 | |||
| 256 | if (!BN_pseudo_rand(b,sizes[i],1,0)) goto err; | ||
| 257 | |||
| 258 | #ifndef C_PRIME | ||
| 259 | if (!BN_pseudo_rand(c,sizes[i],1,1)) goto err; | ||
| 260 | #endif | ||
| 261 | |||
| 262 | #ifdef TEST_SQRT | ||
| 263 | if (!BN_mod_sqr(a,a,c,ctx)) goto err; | ||
| 264 | if (!BN_mod_sqr(b,b,c,ctx)) goto err; | ||
| 265 | #else | ||
| 266 | if (!BN_nnmod(a,a,c,ctx)) goto err; | ||
| 267 | if (!BN_nnmod(b,b,c,ctx)) goto err; | ||
| 268 | #endif | ||
| 269 | |||
| 270 | if (k == 0) | ||
| 271 | Time_F(START); | ||
| 272 | } | ||
| 273 | |||
| 274 | #if defined(TEST_EXP) | ||
| 275 | if (!BN_mod_exp(r,a,b,c,ctx)) goto err; | ||
| 276 | #elif defined(TEST_MUL) | ||
| 277 | { | ||
| 278 | int i = 0; | ||
| 279 | for (i = 0; i < 50; i++) | ||
| 280 | if (!BN_mod_mul(r,a,b,c,ctx)) goto err; | ||
| 281 | } | ||
| 282 | #elif defined(TEST_SQR) | ||
| 283 | { | ||
| 284 | int i = 0; | ||
| 285 | for (i = 0; i < 50; i++) | ||
| 286 | { | ||
| 287 | if (!BN_mod_sqr(r,a,c,ctx)) goto err; | ||
| 288 | if (!BN_mod_sqr(r,b,c,ctx)) goto err; | ||
| 289 | } | ||
| 290 | } | ||
| 291 | #elif defined(TEST_GCD) | ||
| 292 | if (!BN_gcd(r,a,b,ctx)) goto err; | ||
| 293 | if (!BN_gcd(r,b,c,ctx)) goto err; | ||
| 294 | if (!BN_gcd(r,c,a,ctx)) goto err; | ||
| 295 | #elif defined(TEST_KRON) | ||
| 296 | if (-2 == BN_kronecker(a,b,ctx)) goto err; | ||
| 297 | if (-2 == BN_kronecker(b,c,ctx)) goto err; | ||
| 298 | if (-2 == BN_kronecker(c,a,ctx)) goto err; | ||
| 299 | #elif defined(TEST_INV) | ||
| 300 | if (!BN_mod_inverse(r,a,c,ctx)) goto err; | ||
| 301 | if (!BN_mod_inverse(r,b,c,ctx)) goto err; | ||
| 302 | #else /* TEST_SQRT */ | ||
| 303 | if (!BN_mod_sqrt(r,a,c,ctx)) goto err; | ||
| 304 | if (!BN_mod_sqrt(r,b,c,ctx)) goto err; | ||
| 305 | #endif | ||
| 306 | } | ||
| 307 | tm=Time_F(STOP); | ||
| 308 | printf( | ||
| 309 | #if defined(TEST_EXP) | ||
| 310 | "modexp %4d ^ %4d %% %4d" | ||
| 311 | #elif defined(TEST_MUL) | ||
| 312 | "50*modmul %4d %4d %4d" | ||
| 313 | #elif defined(TEST_SQR) | ||
| 314 | "100*modsqr %4d %4d %4d" | ||
| 315 | #elif defined(TEST_GCD) | ||
| 316 | "3*gcd %4d %4d %4d" | ||
| 317 | #elif defined(TEST_KRON) | ||
| 318 | "3*kronecker %4d %4d %4d" | ||
| 319 | #elif defined(TEST_INV) | ||
| 320 | "2*inv %4d %4d mod %4d" | ||
| 321 | #else /* TEST_SQRT */ | ||
| 322 | "2*sqrt [prime == %d (mod 64)] %4d %4d mod %4d" | ||
| 323 | #endif | ||
| 324 | " -> %8.6fms %5.1f (%ld)\n", | ||
| 325 | #ifdef TEST_SQRT | ||
| 326 | P_MOD_64, | ||
| 327 | #endif | ||
| 328 | sizes[i],sizes[i],sizes[i],tm*1000.0/num,tm*mul_c[i]/num, num); | ||
| 329 | num/=7; | ||
| 330 | if (num <= 0) num=1; | ||
| 331 | } | ||
| 332 | return; | ||
| 333 | |||
| 334 | err: | ||
| 335 | ERR_print_errors_fp(stderr); | ||
| 336 | } | ||
| 337 | |||
| 338 | |||
| 339 | #ifdef C_PRIME | ||
| 340 | static void genprime_cb(int p, int n, void *arg) | ||
| 341 | { | ||
| 342 | char c='*'; | ||
| 343 | |||
| 344 | if (p == 0) c='.'; | ||
| 345 | if (p == 1) c='+'; | ||
| 346 | if (p == 2) c='*'; | ||
| 347 | if (p == 3) c='\n'; | ||
| 348 | putc(c, stderr); | ||
| 349 | fflush(stderr); | ||
| 350 | (void)n; | ||
| 351 | (void)arg; | ||
| 352 | } | ||
| 353 | #endif | ||
diff --git a/src/lib/libcrypto/bn/exptest.c b/src/lib/libcrypto/bn/exptest.c new file mode 100644 index 0000000000..074a8e882a --- /dev/null +++ b/src/lib/libcrypto/bn/exptest.c | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | /* crypto/bn/exptest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #include <openssl/bio.h> | ||
| 66 | #include <openssl/bn.h> | ||
| 67 | #include <openssl/rand.h> | ||
| 68 | #include <openssl/err.h> | ||
| 69 | |||
| 70 | #define NUM_BITS (BN_BITS*2) | ||
| 71 | |||
| 72 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 73 | |||
| 74 | int main(int argc, char *argv[]) | ||
| 75 | { | ||
| 76 | BN_CTX *ctx; | ||
| 77 | BIO *out=NULL; | ||
| 78 | int i,ret; | ||
| 79 | unsigned char c; | ||
| 80 | BIGNUM *r_mont,*r_mont_const,*r_recp,*r_simple,*a,*b,*m; | ||
| 81 | |||
| 82 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_rand may fail, and we don't | ||
| 83 | * even check its return value | ||
| 84 | * (which we should) */ | ||
| 85 | |||
| 86 | ERR_load_BN_strings(); | ||
| 87 | |||
| 88 | ctx=BN_CTX_new(); | ||
| 89 | if (ctx == NULL) EXIT(1); | ||
| 90 | r_mont=BN_new(); | ||
| 91 | r_mont_const=BN_new(); | ||
| 92 | r_recp=BN_new(); | ||
| 93 | r_simple=BN_new(); | ||
| 94 | a=BN_new(); | ||
| 95 | b=BN_new(); | ||
| 96 | m=BN_new(); | ||
| 97 | if ( (r_mont == NULL) || (r_recp == NULL) || | ||
| 98 | (a == NULL) || (b == NULL)) | ||
| 99 | goto err; | ||
| 100 | |||
| 101 | out=BIO_new(BIO_s_file()); | ||
| 102 | |||
| 103 | if (out == NULL) EXIT(1); | ||
| 104 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | ||
| 105 | |||
| 106 | for (i=0; i<200; i++) | ||
| 107 | { | ||
| 108 | RAND_bytes(&c,1); | ||
| 109 | c=(c%BN_BITS)-BN_BITS2; | ||
| 110 | BN_rand(a,NUM_BITS+c,0,0); | ||
| 111 | |||
| 112 | RAND_bytes(&c,1); | ||
| 113 | c=(c%BN_BITS)-BN_BITS2; | ||
| 114 | BN_rand(b,NUM_BITS+c,0,0); | ||
| 115 | |||
| 116 | RAND_bytes(&c,1); | ||
| 117 | c=(c%BN_BITS)-BN_BITS2; | ||
| 118 | BN_rand(m,NUM_BITS+c,0,1); | ||
| 119 | |||
| 120 | BN_mod(a,a,m,ctx); | ||
| 121 | BN_mod(b,b,m,ctx); | ||
| 122 | |||
| 123 | ret=BN_mod_exp_mont(r_mont,a,b,m,ctx,NULL); | ||
| 124 | if (ret <= 0) | ||
| 125 | { | ||
| 126 | printf("BN_mod_exp_mont() problems\n"); | ||
| 127 | ERR_print_errors(out); | ||
| 128 | EXIT(1); | ||
| 129 | } | ||
| 130 | |||
| 131 | ret=BN_mod_exp_recp(r_recp,a,b,m,ctx); | ||
| 132 | if (ret <= 0) | ||
| 133 | { | ||
| 134 | printf("BN_mod_exp_recp() problems\n"); | ||
| 135 | ERR_print_errors(out); | ||
| 136 | EXIT(1); | ||
| 137 | } | ||
| 138 | |||
| 139 | ret=BN_mod_exp_simple(r_simple,a,b,m,ctx); | ||
| 140 | if (ret <= 0) | ||
| 141 | { | ||
| 142 | printf("BN_mod_exp_simple() problems\n"); | ||
| 143 | ERR_print_errors(out); | ||
| 144 | EXIT(1); | ||
| 145 | } | ||
| 146 | |||
| 147 | ret=BN_mod_exp_mont_consttime(r_mont_const,a,b,m,ctx,NULL); | ||
| 148 | if (ret <= 0) | ||
| 149 | { | ||
| 150 | printf("BN_mod_exp_mont_consttime() problems\n"); | ||
| 151 | ERR_print_errors(out); | ||
| 152 | EXIT(1); | ||
| 153 | } | ||
| 154 | |||
| 155 | if (BN_cmp(r_simple, r_mont) == 0 | ||
| 156 | && BN_cmp(r_simple,r_recp) == 0 | ||
| 157 | && BN_cmp(r_simple,r_mont_const) == 0) | ||
| 158 | { | ||
| 159 | printf("."); | ||
| 160 | fflush(stdout); | ||
| 161 | } | ||
| 162 | else | ||
| 163 | { | ||
| 164 | if (BN_cmp(r_simple,r_mont) != 0) | ||
| 165 | printf("\nsimple and mont results differ\n"); | ||
| 166 | if (BN_cmp(r_simple,r_mont_const) != 0) | ||
| 167 | printf("\nsimple and mont const time results differ\n"); | ||
| 168 | if (BN_cmp(r_simple,r_recp) != 0) | ||
| 169 | printf("\nsimple and recp results differ\n"); | ||
| 170 | |||
| 171 | printf("a (%3d) = ",BN_num_bits(a)); BN_print(out,a); | ||
| 172 | printf("\nb (%3d) = ",BN_num_bits(b)); BN_print(out,b); | ||
| 173 | printf("\nm (%3d) = ",BN_num_bits(m)); BN_print(out,m); | ||
| 174 | printf("\nsimple ="); BN_print(out,r_simple); | ||
| 175 | printf("\nrecp ="); BN_print(out,r_recp); | ||
| 176 | printf("\nmont ="); BN_print(out,r_mont); | ||
| 177 | printf("\nmont_ct ="); BN_print(out,r_mont_const); | ||
| 178 | printf("\n"); | ||
| 179 | EXIT(1); | ||
| 180 | } | ||
| 181 | } | ||
| 182 | BN_free(r_mont); | ||
| 183 | BN_free(r_mont_const); | ||
| 184 | BN_free(r_recp); | ||
| 185 | BN_free(r_simple); | ||
| 186 | BN_free(a); | ||
| 187 | BN_free(b); | ||
| 188 | BN_free(m); | ||
| 189 | BN_CTX_free(ctx); | ||
| 190 | ERR_remove_thread_state(NULL); | ||
| 191 | CRYPTO_mem_leaks(out); | ||
| 192 | BIO_free(out); | ||
| 193 | printf(" done\n"); | ||
| 194 | EXIT(0); | ||
| 195 | err: | ||
| 196 | ERR_load_crypto_strings(); | ||
| 197 | ERR_print_errors(out); | ||
| 198 | #ifdef OPENSSL_SYS_NETWARE | ||
| 199 | printf("ERROR\n"); | ||
| 200 | #endif | ||
| 201 | EXIT(1); | ||
| 202 | return(1); | ||
| 203 | } | ||
| 204 | |||
diff --git a/src/lib/libcrypto/bn/todo b/src/lib/libcrypto/bn/todo new file mode 100644 index 0000000000..e47e381aea --- /dev/null +++ b/src/lib/libcrypto/bn/todo | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | Cache RECP_CTX values | ||
| 2 | make the result argument independant of the inputs. | ||
| 3 | split up the _exp_ functions | ||
diff --git a/src/lib/libcrypto/bn/vms-helper.c b/src/lib/libcrypto/bn/vms-helper.c new file mode 100644 index 0000000000..4b63149bf3 --- /dev/null +++ b/src/lib/libcrypto/bn/vms-helper.c | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* vms-helper.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@OpenSSL.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | #include <stdio.h> | ||
| 57 | #include "cryptlib.h" | ||
| 58 | #include "bn_lcl.h" | ||
| 59 | |||
| 60 | bn_div_words_abort(int i) | ||
| 61 | { | ||
| 62 | #ifdef BN_DEBUG | ||
| 63 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | ||
| 64 | fprintf(stderr,"Division would overflow (%d)\n",i); | ||
| 65 | #endif | ||
| 66 | abort(); | ||
| 67 | #endif | ||
| 68 | } | ||
diff --git a/src/lib/libcrypto/buffer/Makefile b/src/lib/libcrypto/buffer/Makefile new file mode 100644 index 0000000000..9f3a88d2d6 --- /dev/null +++ b/src/lib/libcrypto/buffer/Makefile | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/buffer/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= buffer | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= buffer.c buf_err.c | ||
| 21 | LIBOBJ= buffer.o buf_err.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= buffer.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | buf_err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 78 | buf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 79 | buf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 80 | buf_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 81 | buf_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 82 | buf_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 83 | buf_err.o: buf_err.c | ||
| 84 | buffer.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 85 | buffer.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 86 | buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 87 | buffer.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 88 | buffer.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 89 | buffer.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 90 | buffer.o: ../../include/openssl/symhacks.h ../cryptlib.h buffer.c | ||
diff --git a/src/lib/libcrypto/buildinf.h b/src/lib/libcrypto/buildinf.h new file mode 100644 index 0000000000..957f09d5fd --- /dev/null +++ b/src/lib/libcrypto/buildinf.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef MK1MF_BUILD | ||
| 2 | /* auto-generated by crypto/Makefile for crypto/cversion.c */ | ||
| 3 | #define CFLAGS "cc -O" | ||
| 4 | #define PLATFORM "dist" | ||
| 5 | #define DATE "Sat Aug 21 10:52:09 EST 2010" | ||
| 6 | #endif | ||
diff --git a/src/lib/libcrypto/camellia/Makefile b/src/lib/libcrypto/camellia/Makefile new file mode 100644 index 0000000000..ff5fe4a01d --- /dev/null +++ b/src/lib/libcrypto/camellia/Makefile | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | # | ||
| 2 | # crypto/camellia/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= camellia | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | CMLL_ENC= camellia.o cmll_misc.o cmll_cbc.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | #TEST=camelliatest.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=camellia.c cmll_misc.c cmll_ecb.c cmll_cbc.c cmll_ofb.c \ | ||
| 26 | cmll_cfb.c cmll_ctr.c | ||
| 27 | |||
| 28 | LIBOBJ= cmll_ecb.o cmll_ofb.o cmll_cfb.o cmll_ctr.o $(CMLL_ENC) | ||
| 29 | |||
| 30 | SRC= $(LIBSRC) | ||
| 31 | |||
| 32 | EXHEADER= camellia.h | ||
| 33 | HEADER= cmll_locl.h $(EXHEADER) | ||
| 34 | |||
| 35 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 36 | |||
| 37 | top: | ||
| 38 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 39 | |||
| 40 | all: lib | ||
| 41 | |||
| 42 | lib: $(LIBOBJ) | ||
| 43 | $(AR) $(LIB) $(LIBOBJ) | ||
| 44 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 45 | @touch lib | ||
| 46 | |||
| 47 | cmll-x86.s: asm/cmll-x86.pl ../perlasm/x86asm.pl | ||
| 48 | $(PERL) asm/cmll-x86.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 49 | cmll-x86_64.s: asm/cmll-x86_64.pl | ||
| 50 | $(PERL) asm/cmll-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 51 | |||
| 52 | files: | ||
| 53 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 54 | |||
| 55 | links: | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 59 | |||
| 60 | install: | ||
| 61 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 62 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 63 | do \ | ||
| 64 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 65 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 66 | done; | ||
| 67 | |||
| 68 | tags: | ||
| 69 | ctags $(SRC) | ||
| 70 | |||
| 71 | tests: | ||
| 72 | |||
| 73 | lint: | ||
| 74 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 75 | |||
| 76 | depend: | ||
| 77 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 78 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 79 | |||
| 80 | dclean: | ||
| 81 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 82 | mv -f Makefile.new $(MAKEFILE) | ||
| 83 | |||
| 84 | clean: | ||
| 85 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 86 | |||
| 87 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 88 | |||
| 89 | camellia.o: ../../include/openssl/opensslconf.h camellia.c camellia.h | ||
| 90 | camellia.o: cmll_locl.h | ||
| 91 | cmll_cbc.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h | ||
| 92 | cmll_cbc.o: ../../include/openssl/opensslconf.h cmll_cbc.c | ||
| 93 | cmll_cfb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h | ||
| 94 | cmll_cfb.o: ../../include/openssl/opensslconf.h cmll_cfb.c | ||
| 95 | cmll_ctr.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h | ||
| 96 | cmll_ctr.o: ../../include/openssl/opensslconf.h cmll_ctr.c | ||
| 97 | cmll_ecb.o: ../../include/openssl/camellia.h | ||
| 98 | cmll_ecb.o: ../../include/openssl/opensslconf.h cmll_ecb.c cmll_locl.h | ||
| 99 | cmll_misc.o: ../../include/openssl/camellia.h | ||
| 100 | cmll_misc.o: ../../include/openssl/opensslconf.h | ||
| 101 | cmll_misc.o: ../../include/openssl/opensslv.h cmll_locl.h cmll_misc.c | ||
| 102 | cmll_ofb.o: ../../include/openssl/camellia.h ../../include/openssl/modes.h | ||
| 103 | cmll_ofb.o: ../../include/openssl/opensslconf.h cmll_ofb.c | ||
diff --git a/src/lib/libcrypto/cast/Makefile b/src/lib/libcrypto/cast/Makefile new file mode 100644 index 0000000000..0acc38f28d --- /dev/null +++ b/src/lib/libcrypto/cast/Makefile | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/cast/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= cast | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | CAST_ENC=c_enc.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=casttest.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=c_skey.c c_ecb.c c_enc.c c_cfb64.c c_ofb64.c | ||
| 26 | LIBOBJ=c_skey.o c_ecb.o $(CAST_ENC) c_cfb64.o c_ofb64.o | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= cast.h | ||
| 31 | HEADER= cast_s.h cast_lcl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | cast-586.s: asm/cast-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 46 | $(PERL) asm/cast-586.pl $(PERLASM_SCHEME) $(CLAGS) $(PROCESSOR) > $@ | ||
| 47 | |||
| 48 | files: | ||
| 49 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 55 | |||
| 56 | install: | ||
| 57 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 58 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 59 | do \ | ||
| 60 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 61 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 62 | done; | ||
| 63 | |||
| 64 | tags: | ||
| 65 | ctags $(SRC) | ||
| 66 | |||
| 67 | tests: | ||
| 68 | |||
| 69 | lint: | ||
| 70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 71 | |||
| 72 | depend: | ||
| 73 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 75 | |||
| 76 | dclean: | ||
| 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 78 | mv -f Makefile.new $(MAKEFILE) | ||
| 79 | |||
| 80 | clean: | ||
| 81 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | c_cfb64.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 86 | c_cfb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 87 | c_cfb64.o: c_cfb64.c cast_lcl.h | ||
| 88 | c_ecb.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 89 | c_ecb.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 90 | c_ecb.o: ../../include/openssl/opensslv.h c_ecb.c cast_lcl.h | ||
| 91 | c_enc.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 92 | c_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 93 | c_enc.o: c_enc.c cast_lcl.h | ||
| 94 | c_ofb64.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 95 | c_ofb64.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 96 | c_ofb64.o: c_ofb64.c cast_lcl.h | ||
| 97 | c_skey.o: ../../e_os.h ../../include/openssl/cast.h | ||
| 98 | c_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 99 | c_skey.o: c_skey.c cast_lcl.h cast_s.h | ||
diff --git a/src/lib/libcrypto/cast/asm/cast-586.pl b/src/lib/libcrypto/cast/asm/cast-586.pl index bf6810d335..7a0083ecb8 100644 --- a/src/lib/libcrypto/cast/asm/cast-586.pl +++ b/src/lib/libcrypto/cast/asm/cast-586.pl | |||
| @@ -29,7 +29,7 @@ $S4="CAST_S_table3"; | |||
| 29 | 29 | ||
| 30 | &CAST_encrypt("CAST_encrypt",1); | 30 | &CAST_encrypt("CAST_encrypt",1); |
| 31 | &CAST_encrypt("CAST_decrypt",0); | 31 | &CAST_encrypt("CAST_decrypt",0); |
| 32 | &cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1); | 32 | &cbc("CAST_cbc_encrypt","CAST_encrypt","CAST_decrypt",1,4,5,3,-1,-1) unless $main'openbsd; |
| 33 | 33 | ||
| 34 | &asm_finish(); | 34 | &asm_finish(); |
| 35 | 35 | ||
diff --git a/src/lib/libcrypto/cast/asm/readme b/src/lib/libcrypto/cast/asm/readme new file mode 100644 index 0000000000..fbcd76289e --- /dev/null +++ b/src/lib/libcrypto/cast/asm/readme | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | There is a ppro flag in cast-586 which turns on/off | ||
| 2 | generation of pentium pro/II friendly code | ||
| 3 | |||
| 4 | This flag makes the inner loop one cycle longer, but generates | ||
| 5 | code that runs %30 faster on the pentium pro/II, while only %7 slower | ||
| 6 | on the pentium. By default, this flag is on. | ||
| 7 | |||
diff --git a/src/lib/libcrypto/cast/c_enc.c b/src/lib/libcrypto/cast/c_enc.c index 357c41ebf0..2ae54f5cfb 100644 --- a/src/lib/libcrypto/cast/c_enc.c +++ b/src/lib/libcrypto/cast/c_enc.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #include <openssl/cast.h> | 59 | #include <openssl/cast.h> |
| 60 | #include "cast_lcl.h" | 60 | #include "cast_lcl.h" |
| 61 | 61 | ||
| 62 | #ifndef OPENBSD_CAST_ASM | ||
| 62 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) | 63 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key) |
| 63 | { | 64 | { |
| 64 | register CAST_LONG l,r,t; | 65 | register CAST_LONG l,r,t; |
| @@ -124,6 +125,7 @@ void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key) | |||
| 124 | data[1]=l&0xffffffffL; | 125 | data[1]=l&0xffffffffL; |
| 125 | data[0]=r&0xffffffffL; | 126 | data[0]=r&0xffffffffL; |
| 126 | } | 127 | } |
| 128 | #endif | ||
| 127 | 129 | ||
| 128 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, | 130 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, |
| 129 | const CAST_KEY *ks, unsigned char *iv, int enc) | 131 | const CAST_KEY *ks, unsigned char *iv, int enc) |
diff --git a/src/lib/libcrypto/cast/cast_spd.c b/src/lib/libcrypto/cast/cast_spd.c new file mode 100644 index 0000000000..d650af475c --- /dev/null +++ b/src/lib/libcrypto/cast/cast_spd.c | |||
| @@ -0,0 +1,278 @@ | |||
| 1 | /* crypto/cast/cast_spd.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ | ||
| 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef _IRIX | ||
| 77 | #include <time.h> | ||
| 78 | #endif | ||
| 79 | #ifdef TIMES | ||
| 80 | #include <sys/types.h> | ||
| 81 | #include <sys/times.h> | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 85 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 86 | undefine TIMES, since that tells the rest of the program how things | ||
| 87 | should be handled. -- Richard Levitte */ | ||
| 88 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 89 | #undef TIMES | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef TIMES | ||
| 93 | #include <sys/timeb.h> | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(sun) || defined(__ultrix) | ||
| 97 | #define _POSIX_SOURCE | ||
| 98 | #include <limits.h> | ||
| 99 | #include <sys/param.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #include <openssl/cast.h> | ||
| 103 | |||
| 104 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 105 | #ifndef HZ | ||
| 106 | #ifndef CLK_TCK | ||
| 107 | #define HZ 100.0 | ||
| 108 | #else /* CLK_TCK */ | ||
| 109 | #define HZ ((double)CLK_TCK) | ||
| 110 | #endif | ||
| 111 | #endif | ||
| 112 | |||
| 113 | #define BUFSIZE ((long)1024) | ||
| 114 | long run=0; | ||
| 115 | |||
| 116 | double Time_F(int s); | ||
| 117 | #ifdef SIGALRM | ||
| 118 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) | ||
| 119 | #define SIGRETTYPE void | ||
| 120 | #else | ||
| 121 | #define SIGRETTYPE int | ||
| 122 | #endif | ||
| 123 | |||
| 124 | SIGRETTYPE sig_done(int sig); | ||
| 125 | SIGRETTYPE sig_done(int sig) | ||
| 126 | { | ||
| 127 | signal(SIGALRM,sig_done); | ||
| 128 | run=0; | ||
| 129 | #ifdef LINT | ||
| 130 | sig=sig; | ||
| 131 | #endif | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | |||
| 135 | #define START 0 | ||
| 136 | #define STOP 1 | ||
| 137 | |||
| 138 | double Time_F(int s) | ||
| 139 | { | ||
| 140 | double ret; | ||
| 141 | #ifdef TIMES | ||
| 142 | static struct tms tstart,tend; | ||
| 143 | |||
| 144 | if (s == START) | ||
| 145 | { | ||
| 146 | times(&tstart); | ||
| 147 | return(0); | ||
| 148 | } | ||
| 149 | else | ||
| 150 | { | ||
| 151 | times(&tend); | ||
| 152 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 153 | return((ret == 0.0)?1e-6:ret); | ||
| 154 | } | ||
| 155 | #else /* !times() */ | ||
| 156 | static struct timeb tstart,tend; | ||
| 157 | long i; | ||
| 158 | |||
| 159 | if (s == START) | ||
| 160 | { | ||
| 161 | ftime(&tstart); | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | else | ||
| 165 | { | ||
| 166 | ftime(&tend); | ||
| 167 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 168 | ret=((double)(tend.time-tstart.time))+((double)i)/1e3; | ||
| 169 | return((ret == 0.0)?1e-6:ret); | ||
| 170 | } | ||
| 171 | #endif | ||
| 172 | } | ||
| 173 | |||
| 174 | int main(int argc, char **argv) | ||
| 175 | { | ||
| 176 | long count; | ||
| 177 | static unsigned char buf[BUFSIZE]; | ||
| 178 | static unsigned char key[] ={ | ||
| 179 | 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, | ||
| 180 | 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, | ||
| 181 | }; | ||
| 182 | CAST_KEY sch; | ||
| 183 | double a,b,c,d; | ||
| 184 | #ifndef SIGALRM | ||
| 185 | long ca,cb,cc; | ||
| 186 | #endif | ||
| 187 | |||
| 188 | #ifndef TIMES | ||
| 189 | printf("To get the most accurate results, try to run this\n"); | ||
| 190 | printf("program when this computer is idle.\n"); | ||
| 191 | #endif | ||
| 192 | |||
| 193 | #ifndef SIGALRM | ||
| 194 | printf("First we calculate the approximate speed ...\n"); | ||
| 195 | CAST_set_key(&sch,16,key); | ||
| 196 | count=10; | ||
| 197 | do { | ||
| 198 | long i; | ||
| 199 | CAST_LONG data[2]; | ||
| 200 | |||
| 201 | count*=2; | ||
| 202 | Time_F(START); | ||
| 203 | for (i=count; i; i--) | ||
| 204 | CAST_encrypt(data,&sch); | ||
| 205 | d=Time_F(STOP); | ||
| 206 | } while (d < 3.0); | ||
| 207 | ca=count/512; | ||
| 208 | cb=count; | ||
| 209 | cc=count*8/BUFSIZE+1; | ||
| 210 | printf("Doing CAST_set_key %ld times\n",ca); | ||
| 211 | #define COND(d) (count != (d)) | ||
| 212 | #define COUNT(d) (d) | ||
| 213 | #else | ||
| 214 | #define COND(c) (run) | ||
| 215 | #define COUNT(d) (count) | ||
| 216 | signal(SIGALRM,sig_done); | ||
| 217 | printf("Doing CAST_set_key for 10 seconds\n"); | ||
| 218 | alarm(10); | ||
| 219 | #endif | ||
| 220 | |||
| 221 | Time_F(START); | ||
| 222 | for (count=0,run=1; COND(ca); count+=4) | ||
| 223 | { | ||
| 224 | CAST_set_key(&sch,16,key); | ||
| 225 | CAST_set_key(&sch,16,key); | ||
| 226 | CAST_set_key(&sch,16,key); | ||
| 227 | CAST_set_key(&sch,16,key); | ||
| 228 | } | ||
| 229 | d=Time_F(STOP); | ||
| 230 | printf("%ld cast set_key's in %.2f seconds\n",count,d); | ||
| 231 | a=((double)COUNT(ca))/d; | ||
| 232 | |||
| 233 | #ifdef SIGALRM | ||
| 234 | printf("Doing CAST_encrypt's for 10 seconds\n"); | ||
| 235 | alarm(10); | ||
| 236 | #else | ||
| 237 | printf("Doing CAST_encrypt %ld times\n",cb); | ||
| 238 | #endif | ||
| 239 | Time_F(START); | ||
| 240 | for (count=0,run=1; COND(cb); count+=4) | ||
| 241 | { | ||
| 242 | CAST_LONG data[2]; | ||
| 243 | |||
| 244 | CAST_encrypt(data,&sch); | ||
| 245 | CAST_encrypt(data,&sch); | ||
| 246 | CAST_encrypt(data,&sch); | ||
| 247 | CAST_encrypt(data,&sch); | ||
| 248 | } | ||
| 249 | d=Time_F(STOP); | ||
| 250 | printf("%ld CAST_encrypt's in %.2f second\n",count,d); | ||
| 251 | b=((double)COUNT(cb)*8)/d; | ||
| 252 | |||
| 253 | #ifdef SIGALRM | ||
| 254 | printf("Doing CAST_cbc_encrypt on %ld byte blocks for 10 seconds\n", | ||
| 255 | BUFSIZE); | ||
| 256 | alarm(10); | ||
| 257 | #else | ||
| 258 | printf("Doing CAST_cbc_encrypt %ld times on %ld byte blocks\n",cc, | ||
| 259 | BUFSIZE); | ||
| 260 | #endif | ||
| 261 | Time_F(START); | ||
| 262 | for (count=0,run=1; COND(cc); count++) | ||
| 263 | CAST_cbc_encrypt(buf,buf,BUFSIZE,&sch, | ||
| 264 | &(key[0]),CAST_ENCRYPT); | ||
| 265 | d=Time_F(STOP); | ||
| 266 | printf("%ld CAST_cbc_encrypt's of %ld byte blocks in %.2f second\n", | ||
| 267 | count,BUFSIZE,d); | ||
| 268 | c=((double)COUNT(cc)*BUFSIZE)/d; | ||
| 269 | |||
| 270 | printf("CAST set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); | ||
| 271 | printf("CAST raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b); | ||
| 272 | printf("CAST cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); | ||
| 273 | exit(0); | ||
| 274 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 275 | return(0); | ||
| 276 | #endif | ||
| 277 | } | ||
| 278 | |||
diff --git a/src/lib/libcrypto/cast/castopts.c b/src/lib/libcrypto/cast/castopts.c new file mode 100644 index 0000000000..33b2c7b06f --- /dev/null +++ b/src/lib/libcrypto/cast/castopts.c | |||
| @@ -0,0 +1,342 @@ | |||
| 1 | /* crypto/cast/castopts.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. | ||
| 60 | * This is for machines with 64k code segment size restrictions. */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef _IRIX | ||
| 77 | #include <time.h> | ||
| 78 | #endif | ||
| 79 | #ifdef TIMES | ||
| 80 | #include <sys/types.h> | ||
| 81 | #include <sys/times.h> | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 85 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 86 | undefine TIMES, since that tells the rest of the program how things | ||
| 87 | should be handled. -- Richard Levitte */ | ||
| 88 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 89 | #undef TIMES | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef TIMES | ||
| 93 | #include <sys/timeb.h> | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(sun) || defined(__ultrix) | ||
| 97 | #define _POSIX_SOURCE | ||
| 98 | #include <limits.h> | ||
| 99 | #include <sys/param.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #include <openssl/cast.h> | ||
| 103 | |||
| 104 | #define CAST_DEFAULT_OPTIONS | ||
| 105 | |||
| 106 | #undef E_CAST | ||
| 107 | #define CAST_encrypt CAST_encrypt_normal | ||
| 108 | #define CAST_decrypt CAST_decrypt_normal | ||
| 109 | #define CAST_cbc_encrypt CAST_cbc_encrypt_normal | ||
| 110 | #undef HEADER_CAST_LOCL_H | ||
| 111 | #include "c_enc.c" | ||
| 112 | |||
| 113 | #define CAST_PTR | ||
| 114 | #undef CAST_PTR2 | ||
| 115 | #undef E_CAST | ||
| 116 | #undef CAST_encrypt | ||
| 117 | #undef CAST_decrypt | ||
| 118 | #undef CAST_cbc_encrypt | ||
| 119 | #define CAST_encrypt CAST_encrypt_ptr | ||
| 120 | #define CAST_decrypt CAST_decrypt_ptr | ||
| 121 | #define CAST_cbc_encrypt CAST_cbc_encrypt_ptr | ||
| 122 | #undef HEADER_CAST_LOCL_H | ||
| 123 | #include "c_enc.c" | ||
| 124 | |||
| 125 | #undef CAST_PTR | ||
| 126 | #define CAST_PTR2 | ||
| 127 | #undef E_CAST | ||
| 128 | #undef CAST_encrypt | ||
| 129 | #undef CAST_decrypt | ||
| 130 | #undef CAST_cbc_encrypt | ||
| 131 | #define CAST_encrypt CAST_encrypt_ptr2 | ||
| 132 | #define CAST_decrypt CAST_decrypt_ptr2 | ||
| 133 | #define CAST_cbc_encrypt CAST_cbc_encrypt_ptr2 | ||
| 134 | #undef HEADER_CAST_LOCL_H | ||
| 135 | #include "c_enc.c" | ||
| 136 | |||
| 137 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 138 | #ifndef HZ | ||
| 139 | # ifndef CLK_TCK | ||
| 140 | # ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ | ||
| 141 | # define HZ 100.0 | ||
| 142 | # else /* _BSD_CLK_TCK_ */ | ||
| 143 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 144 | # endif | ||
| 145 | # else /* CLK_TCK */ | ||
| 146 | # define HZ ((double)CLK_TCK) | ||
| 147 | # endif | ||
| 148 | #endif | ||
| 149 | |||
| 150 | #define BUFSIZE ((long)1024) | ||
| 151 | long run=0; | ||
| 152 | |||
| 153 | double Time_F(int s); | ||
| 154 | #ifdef SIGALRM | ||
| 155 | #if defined(__STDC__) || defined(sgi) | ||
| 156 | #define SIGRETTYPE void | ||
| 157 | #else | ||
| 158 | #define SIGRETTYPE int | ||
| 159 | #endif | ||
| 160 | |||
| 161 | SIGRETTYPE sig_done(int sig); | ||
| 162 | SIGRETTYPE sig_done(int sig) | ||
| 163 | { | ||
| 164 | signal(SIGALRM,sig_done); | ||
| 165 | run=0; | ||
| 166 | #ifdef LINT | ||
| 167 | sig=sig; | ||
| 168 | #endif | ||
| 169 | } | ||
| 170 | #endif | ||
| 171 | |||
| 172 | #define START 0 | ||
| 173 | #define STOP 1 | ||
| 174 | |||
| 175 | double Time_F(int s) | ||
| 176 | { | ||
| 177 | double ret; | ||
| 178 | #ifdef TIMES | ||
| 179 | static struct tms tstart,tend; | ||
| 180 | |||
| 181 | if (s == START) | ||
| 182 | { | ||
| 183 | times(&tstart); | ||
| 184 | return(0); | ||
| 185 | } | ||
| 186 | else | ||
| 187 | { | ||
| 188 | times(&tend); | ||
| 189 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 190 | return((ret == 0.0)?1e-6:ret); | ||
| 191 | } | ||
| 192 | #else /* !times() */ | ||
| 193 | static struct timeb tstart,tend; | ||
| 194 | long i; | ||
| 195 | |||
| 196 | if (s == START) | ||
| 197 | { | ||
| 198 | ftime(&tstart); | ||
| 199 | return(0); | ||
| 200 | } | ||
| 201 | else | ||
| 202 | { | ||
| 203 | ftime(&tend); | ||
| 204 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 205 | ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; | ||
| 206 | return((ret == 0.0)?1e-6:ret); | ||
| 207 | } | ||
| 208 | #endif | ||
| 209 | } | ||
| 210 | |||
| 211 | #ifdef SIGALRM | ||
| 212 | #define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); | ||
| 213 | #else | ||
| 214 | #define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); | ||
| 215 | #endif | ||
| 216 | |||
| 217 | #define time_it(func,name,index) \ | ||
| 218 | print_name(name); \ | ||
| 219 | Time_F(START); \ | ||
| 220 | for (count=0,run=1; COND(cb); count+=4) \ | ||
| 221 | { \ | ||
| 222 | unsigned long d[2]; \ | ||
| 223 | func(d,&sch); \ | ||
| 224 | func(d,&sch); \ | ||
| 225 | func(d,&sch); \ | ||
| 226 | func(d,&sch); \ | ||
| 227 | } \ | ||
| 228 | tm[index]=Time_F(STOP); \ | ||
| 229 | fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ | ||
| 230 | tm[index]=((double)COUNT(cb))/tm[index]; | ||
| 231 | |||
| 232 | #define print_it(name,index) \ | ||
| 233 | fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ | ||
| 234 | tm[index]*8,1.0e6/tm[index]); | ||
| 235 | |||
| 236 | int main(int argc, char **argv) | ||
| 237 | { | ||
| 238 | long count; | ||
| 239 | static unsigned char buf[BUFSIZE]; | ||
| 240 | static char key[16]={ 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, | ||
| 241 | 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | ||
| 242 | CAST_KEY sch; | ||
| 243 | double d,tm[16],max=0; | ||
| 244 | int rank[16]; | ||
| 245 | char *str[16]; | ||
| 246 | int max_idx=0,i,num=0,j; | ||
| 247 | #ifndef SIGALARM | ||
| 248 | long ca,cb,cc,cd,ce; | ||
| 249 | #endif | ||
| 250 | |||
| 251 | for (i=0; i<12; i++) | ||
| 252 | { | ||
| 253 | tm[i]=0.0; | ||
| 254 | rank[i]=0; | ||
| 255 | } | ||
| 256 | |||
| 257 | #ifndef TIMES | ||
| 258 | fprintf(stderr,"To get the most accurate results, try to run this\n"); | ||
| 259 | fprintf(stderr,"program when this computer is idle.\n"); | ||
| 260 | #endif | ||
| 261 | |||
| 262 | CAST_set_key(&sch,16,key); | ||
| 263 | |||
| 264 | #ifndef SIGALRM | ||
| 265 | fprintf(stderr,"First we calculate the approximate speed ...\n"); | ||
| 266 | count=10; | ||
| 267 | do { | ||
| 268 | long i; | ||
| 269 | unsigned long data[2]; | ||
| 270 | |||
| 271 | count*=2; | ||
| 272 | Time_F(START); | ||
| 273 | for (i=count; i; i--) | ||
| 274 | CAST_encrypt(data,&sch); | ||
| 275 | d=Time_F(STOP); | ||
| 276 | } while (d < 3.0); | ||
| 277 | ca=count; | ||
| 278 | cb=count*3; | ||
| 279 | cc=count*3*8/BUFSIZE+1; | ||
| 280 | cd=count*8/BUFSIZE+1; | ||
| 281 | |||
| 282 | ce=count/20+1; | ||
| 283 | #define COND(d) (count != (d)) | ||
| 284 | #define COUNT(d) (d) | ||
| 285 | #else | ||
| 286 | #define COND(c) (run) | ||
| 287 | #define COUNT(d) (count) | ||
| 288 | signal(SIGALRM,sig_done); | ||
| 289 | alarm(10); | ||
| 290 | #endif | ||
| 291 | |||
| 292 | time_it(CAST_encrypt_normal, "CAST_encrypt_normal ", 0); | ||
| 293 | time_it(CAST_encrypt_ptr, "CAST_encrypt_ptr ", 1); | ||
| 294 | time_it(CAST_encrypt_ptr2, "CAST_encrypt_ptr2 ", 2); | ||
| 295 | num+=3; | ||
| 296 | |||
| 297 | str[0]="<nothing>"; | ||
| 298 | print_it("CAST_encrypt_normal ",0); | ||
| 299 | max=tm[0]; | ||
| 300 | max_idx=0; | ||
| 301 | str[1]="ptr "; | ||
| 302 | print_it("CAST_encrypt_ptr ",1); | ||
| 303 | if (max < tm[1]) { max=tm[1]; max_idx=1; } | ||
| 304 | str[2]="ptr2 "; | ||
| 305 | print_it("CAST_encrypt_ptr2 ",2); | ||
| 306 | if (max < tm[2]) { max=tm[2]; max_idx=2; } | ||
| 307 | |||
| 308 | printf("options CAST ecb/s\n"); | ||
| 309 | printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]); | ||
| 310 | d=tm[max_idx]; | ||
| 311 | tm[max_idx]= -2.0; | ||
| 312 | max= -1.0; | ||
| 313 | for (;;) | ||
| 314 | { | ||
| 315 | for (i=0; i<3; i++) | ||
| 316 | { | ||
| 317 | if (max < tm[i]) { max=tm[i]; j=i; } | ||
| 318 | } | ||
| 319 | if (max < 0.0) break; | ||
| 320 | printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0); | ||
| 321 | tm[j]= -2.0; | ||
| 322 | max= -1.0; | ||
| 323 | } | ||
| 324 | |||
| 325 | switch (max_idx) | ||
| 326 | { | ||
| 327 | case 0: | ||
| 328 | printf("-DCAST_DEFAULT_OPTIONS\n"); | ||
| 329 | break; | ||
| 330 | case 1: | ||
| 331 | printf("-DCAST_PTR\n"); | ||
| 332 | break; | ||
| 333 | case 2: | ||
| 334 | printf("-DCAST_PTR2\n"); | ||
| 335 | break; | ||
| 336 | } | ||
| 337 | exit(0); | ||
| 338 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 339 | return(0); | ||
| 340 | #endif | ||
| 341 | } | ||
| 342 | |||
diff --git a/src/lib/libcrypto/cast/casts.cpp b/src/lib/libcrypto/cast/casts.cpp new file mode 100644 index 0000000000..8d7bd468d2 --- /dev/null +++ b/src/lib/libcrypto/cast/casts.cpp | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/cast.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | CAST_KEY key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; | ||
| 44 | |||
| 45 | CAST_set_key(&key, 16,d); | ||
| 46 | |||
| 47 | for (j=0; j<6; j++) | ||
| 48 | { | ||
| 49 | for (i=0; i<1000; i++) /**/ | ||
| 50 | { | ||
| 51 | CAST_encrypt(&data[0],&key); | ||
| 52 | GetTSC(s1); | ||
| 53 | CAST_encrypt(&data[0],&key); | ||
| 54 | CAST_encrypt(&data[0],&key); | ||
| 55 | CAST_encrypt(&data[0],&key); | ||
| 56 | GetTSC(e1); | ||
| 57 | GetTSC(s2); | ||
| 58 | CAST_encrypt(&data[0],&key); | ||
| 59 | CAST_encrypt(&data[0],&key); | ||
| 60 | CAST_encrypt(&data[0],&key); | ||
| 61 | CAST_encrypt(&data[0],&key); | ||
| 62 | GetTSC(e2); | ||
| 63 | CAST_encrypt(&data[0],&key); | ||
| 64 | } | ||
| 65 | |||
| 66 | printf("cast %d %d (%d)\n", | ||
| 67 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
diff --git a/src/lib/libcrypto/cast/casttest.c b/src/lib/libcrypto/cast/casttest.c new file mode 100644 index 0000000000..0d020d6975 --- /dev/null +++ b/src/lib/libcrypto/cast/casttest.c | |||
| @@ -0,0 +1,233 @@ | |||
| 1 | /* crypto/cast/casttest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | #include <openssl/opensslconf.h> /* To see if OPENSSL_NO_CAST is defined */ | ||
| 63 | |||
| 64 | #include "../e_os.h" | ||
| 65 | |||
| 66 | #ifdef OPENSSL_NO_CAST | ||
| 67 | int main(int argc, char *argv[]) | ||
| 68 | { | ||
| 69 | printf("No CAST support\n"); | ||
| 70 | return(0); | ||
| 71 | } | ||
| 72 | #else | ||
| 73 | #include <openssl/cast.h> | ||
| 74 | |||
| 75 | #define FULL_TEST | ||
| 76 | |||
| 77 | static unsigned char k[16]={ | ||
| 78 | 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78, | ||
| 79 | 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A | ||
| 80 | }; | ||
| 81 | |||
| 82 | static unsigned char in[8]={ 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; | ||
| 83 | |||
| 84 | static int k_len[3]={16,10,5}; | ||
| 85 | static unsigned char c[3][8]={ | ||
| 86 | {0x23,0x8B,0x4F,0xE5,0x84,0x7E,0x44,0xB2}, | ||
| 87 | {0xEB,0x6A,0x71,0x1A,0x2C,0x02,0x27,0x1B}, | ||
| 88 | {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E}, | ||
| 89 | }; | ||
| 90 | static unsigned char out[80]; | ||
| 91 | |||
| 92 | static unsigned char in_a[16]={ | ||
| 93 | 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78, | ||
| 94 | 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A}; | ||
| 95 | static unsigned char in_b[16]={ | ||
| 96 | 0x01,0x23,0x45,0x67,0x12,0x34,0x56,0x78, | ||
| 97 | 0x23,0x45,0x67,0x89,0x34,0x56,0x78,0x9A}; | ||
| 98 | |||
| 99 | static unsigned char c_a[16]={ | ||
| 100 | 0xEE,0xA9,0xD0,0xA2,0x49,0xFD,0x3B,0xA6, | ||
| 101 | 0xB3,0x43,0x6F,0xB8,0x9D,0x6D,0xCA,0x92}; | ||
| 102 | static unsigned char c_b[16]={ | ||
| 103 | 0xB2,0xC9,0x5E,0xB0,0x0C,0x31,0xAD,0x71, | ||
| 104 | 0x80,0xAC,0x05,0xB8,0xE8,0x3D,0x69,0x6E}; | ||
| 105 | |||
| 106 | #if 0 | ||
| 107 | char *text="Hello to all people out there"; | ||
| 108 | |||
| 109 | static unsigned char cfb_key[16]={ | ||
| 110 | 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96, | ||
| 111 | 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e, | ||
| 112 | }; | ||
| 113 | static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd}; | ||
| 114 | static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8]; | ||
| 115 | #define CFB_TEST_SIZE 24 | ||
| 116 | static unsigned char plain[CFB_TEST_SIZE]= | ||
| 117 | { | ||
| 118 | 0x4e,0x6f,0x77,0x20,0x69,0x73, | ||
| 119 | 0x20,0x74,0x68,0x65,0x20,0x74, | ||
| 120 | 0x69,0x6d,0x65,0x20,0x66,0x6f, | ||
| 121 | 0x72,0x20,0x61,0x6c,0x6c,0x20 | ||
| 122 | }; | ||
| 123 | static unsigned char cfb_cipher64[CFB_TEST_SIZE]={ | ||
| 124 | 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F, | ||
| 125 | 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A, | ||
| 126 | 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45 | ||
| 127 | |||
| 128 | /* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38, | ||
| 129 | 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9, | ||
| 130 | 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/ | ||
| 131 | }; | ||
| 132 | #endif | ||
| 133 | |||
| 134 | int main(int argc, char *argv[]) | ||
| 135 | { | ||
| 136 | #ifdef FULL_TEST | ||
| 137 | long l; | ||
| 138 | CAST_KEY key_b; | ||
| 139 | #endif | ||
| 140 | int i,z,err=0; | ||
| 141 | CAST_KEY key; | ||
| 142 | |||
| 143 | for (z=0; z<3; z++) | ||
| 144 | { | ||
| 145 | CAST_set_key(&key,k_len[z],k); | ||
| 146 | |||
| 147 | CAST_ecb_encrypt(in,out,&key,CAST_ENCRYPT); | ||
| 148 | if (memcmp(out,&(c[z][0]),8) != 0) | ||
| 149 | { | ||
| 150 | printf("ecb cast error encrypting for keysize %d\n",k_len[z]*8); | ||
| 151 | printf("got :"); | ||
| 152 | for (i=0; i<8; i++) | ||
| 153 | printf("%02X ",out[i]); | ||
| 154 | printf("\n"); | ||
| 155 | printf("expected:"); | ||
| 156 | for (i=0; i<8; i++) | ||
| 157 | printf("%02X ",c[z][i]); | ||
| 158 | err=20; | ||
| 159 | printf("\n"); | ||
| 160 | } | ||
| 161 | |||
| 162 | CAST_ecb_encrypt(out,out,&key,CAST_DECRYPT); | ||
| 163 | if (memcmp(out,in,8) != 0) | ||
| 164 | { | ||
| 165 | printf("ecb cast error decrypting for keysize %d\n",k_len[z]*8); | ||
| 166 | printf("got :"); | ||
| 167 | for (i=0; i<8; i++) | ||
| 168 | printf("%02X ",out[i]); | ||
| 169 | printf("\n"); | ||
| 170 | printf("expected:"); | ||
| 171 | for (i=0; i<8; i++) | ||
| 172 | printf("%02X ",in[i]); | ||
| 173 | printf("\n"); | ||
| 174 | err=3; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | if (err == 0) | ||
| 178 | printf("ecb cast5 ok\n"); | ||
| 179 | |||
| 180 | #ifdef FULL_TEST | ||
| 181 | { | ||
| 182 | unsigned char out_a[16],out_b[16]; | ||
| 183 | static char *hex="0123456789ABCDEF"; | ||
| 184 | |||
| 185 | printf("This test will take some time...."); | ||
| 186 | fflush(stdout); | ||
| 187 | memcpy(out_a,in_a,sizeof(in_a)); | ||
| 188 | memcpy(out_b,in_b,sizeof(in_b)); | ||
| 189 | i=1; | ||
| 190 | |||
| 191 | for (l=0; l<1000000L; l++) | ||
| 192 | { | ||
| 193 | CAST_set_key(&key_b,16,out_b); | ||
| 194 | CAST_ecb_encrypt(&(out_a[0]),&(out_a[0]),&key_b,CAST_ENCRYPT); | ||
| 195 | CAST_ecb_encrypt(&(out_a[8]),&(out_a[8]),&key_b,CAST_ENCRYPT); | ||
| 196 | CAST_set_key(&key,16,out_a); | ||
| 197 | CAST_ecb_encrypt(&(out_b[0]),&(out_b[0]),&key,CAST_ENCRYPT); | ||
| 198 | CAST_ecb_encrypt(&(out_b[8]),&(out_b[8]),&key,CAST_ENCRYPT); | ||
| 199 | if ((l & 0xffff) == 0xffff) | ||
| 200 | { | ||
| 201 | printf("%c",hex[i&0x0f]); | ||
| 202 | fflush(stdout); | ||
| 203 | i++; | ||
| 204 | } | ||
| 205 | } | ||
| 206 | |||
| 207 | if ( (memcmp(out_a,c_a,sizeof(c_a)) != 0) || | ||
| 208 | (memcmp(out_b,c_b,sizeof(c_b)) != 0)) | ||
| 209 | { | ||
| 210 | printf("\n"); | ||
| 211 | printf("Error\n"); | ||
| 212 | |||
| 213 | printf("A out ="); | ||
| 214 | for (i=0; i<16; i++) printf("%02X ",out_a[i]); | ||
| 215 | printf("\nactual="); | ||
| 216 | for (i=0; i<16; i++) printf("%02X ",c_a[i]); | ||
| 217 | printf("\n"); | ||
| 218 | |||
| 219 | printf("B out ="); | ||
| 220 | for (i=0; i<16; i++) printf("%02X ",out_b[i]); | ||
| 221 | printf("\nactual="); | ||
| 222 | for (i=0; i<16; i++) printf("%02X ",c_b[i]); | ||
| 223 | printf("\n"); | ||
| 224 | } | ||
| 225 | else | ||
| 226 | printf(" ok\n"); | ||
| 227 | } | ||
| 228 | #endif | ||
| 229 | |||
| 230 | EXIT(err); | ||
| 231 | return(err); | ||
| 232 | } | ||
| 233 | #endif | ||
diff --git a/src/lib/libcrypto/cms/Makefile b/src/lib/libcrypto/cms/Makefile new file mode 100644 index 0000000000..5837049725 --- /dev/null +++ b/src/lib/libcrypto/cms/Makefile | |||
| @@ -0,0 +1,264 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/cms/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= cms | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= cms_lib.c cms_asn1.c cms_att.c cms_io.c cms_smime.c cms_err.c \ | ||
| 21 | cms_sd.c cms_dd.c cms_cd.c cms_env.c cms_enc.c cms_ess.c | ||
| 22 | LIBOBJ= cms_lib.o cms_asn1.o cms_att.o cms_io.o cms_smime.o cms_err.o \ | ||
| 23 | cms_sd.o cms_dd.o cms_cd.o cms_env.o cms_enc.o cms_ess.o | ||
| 24 | |||
| 25 | SRC= $(LIBSRC) | ||
| 26 | |||
| 27 | EXHEADER= cms.h | ||
| 28 | HEADER= cms_lcl.h $(EXHEADER) | ||
| 29 | |||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 31 | |||
| 32 | top: | ||
| 33 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 34 | |||
| 35 | test: | ||
| 36 | |||
| 37 | all: lib | ||
| 38 | |||
| 39 | lib: $(LIBOBJ) | ||
| 40 | $(AR) $(LIB) $(LIBOBJ) | ||
| 41 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 42 | @touch lib | ||
| 43 | |||
| 44 | files: | ||
| 45 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 46 | |||
| 47 | links: | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 50 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 51 | |||
| 52 | install: | ||
| 53 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 54 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 55 | do \ | ||
| 56 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 57 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 58 | done; | ||
| 59 | |||
| 60 | tags: | ||
| 61 | ctags $(SRC) | ||
| 62 | |||
| 63 | tests: | ||
| 64 | |||
| 65 | lint: | ||
| 66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 67 | |||
| 68 | depend: | ||
| 69 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 70 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 71 | |||
| 72 | dclean: | ||
| 73 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 74 | mv -f Makefile.new $(MAKEFILE) | ||
| 75 | |||
| 76 | clean: | ||
| 77 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 78 | |||
| 79 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 80 | |||
| 81 | cms_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 82 | cms_asn1.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 83 | cms_asn1.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 84 | cms_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 85 | cms_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 86 | cms_asn1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 87 | cms_asn1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 88 | cms_asn1.o: ../../include/openssl/opensslconf.h | ||
| 89 | cms_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 90 | cms_asn1.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 91 | cms_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 92 | cms_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 93 | cms_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 94 | cms_asn1.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 95 | cms_asn1.o: cms.h cms_asn1.c cms_lcl.h | ||
| 96 | cms_att.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 97 | cms_att.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 98 | cms_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 99 | cms_att.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 100 | cms_att.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 101 | cms_att.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 102 | cms_att.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 103 | cms_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 104 | cms_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 105 | cms_att.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 106 | cms_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 107 | cms_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 108 | cms_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 109 | cms_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 110 | cms_att.o: cms.h cms_att.c cms_lcl.h | ||
| 111 | cms_cd.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 112 | cms_cd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 113 | cms_cd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 114 | cms_cd.o: ../../include/openssl/comp.h ../../include/openssl/conf.h | ||
| 115 | cms_cd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 116 | cms_cd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 117 | cms_cd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 118 | cms_cd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 119 | cms_cd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 120 | cms_cd.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 121 | cms_cd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 122 | cms_cd.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 123 | cms_cd.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 124 | cms_cd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 125 | cms_cd.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 126 | cms_cd.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_cd.c cms_lcl.h | ||
| 127 | cms_dd.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 128 | cms_dd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 129 | cms_dd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 130 | cms_dd.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 131 | cms_dd.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 132 | cms_dd.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 133 | cms_dd.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 134 | cms_dd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 135 | cms_dd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 136 | cms_dd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 137 | cms_dd.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 138 | cms_dd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 139 | cms_dd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 140 | cms_dd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 141 | cms_dd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 142 | cms_dd.o: ../cryptlib.h cms_dd.c cms_lcl.h | ||
| 143 | cms_enc.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 144 | cms_enc.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 145 | cms_enc.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 146 | cms_enc.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 147 | cms_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 148 | cms_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 149 | cms_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 150 | cms_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 151 | cms_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 152 | cms_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 153 | cms_enc.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 154 | cms_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 155 | cms_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 156 | cms_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 157 | cms_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 158 | cms_enc.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_enc.c cms_lcl.h | ||
| 159 | cms_env.o: ../../e_os.h ../../include/openssl/aes.h | ||
| 160 | cms_env.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 161 | cms_env.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 162 | cms_env.o: ../../include/openssl/cms.h ../../include/openssl/conf.h | ||
| 163 | cms_env.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 164 | cms_env.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 165 | cms_env.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 166 | cms_env.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 167 | cms_env.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 168 | cms_env.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 169 | cms_env.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 170 | cms_env.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 171 | cms_env.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 172 | cms_env.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 173 | cms_env.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 174 | cms_env.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 175 | cms_env.o: ../asn1/asn1_locl.h ../cryptlib.h cms_env.c cms_lcl.h | ||
| 176 | cms_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 177 | cms_err.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 178 | cms_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 179 | cms_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 180 | cms_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 181 | cms_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 182 | cms_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 183 | cms_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 184 | cms_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 185 | cms_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 186 | cms_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 187 | cms_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 188 | cms_err.o: cms_err.c | ||
| 189 | cms_ess.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 190 | cms_ess.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 191 | cms_ess.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 192 | cms_ess.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 193 | cms_ess.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 194 | cms_ess.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 195 | cms_ess.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 196 | cms_ess.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 197 | cms_ess.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 198 | cms_ess.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 199 | cms_ess.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 200 | cms_ess.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 201 | cms_ess.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 202 | cms_ess.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 203 | cms_ess.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 204 | cms_ess.o: ../../include/openssl/x509v3.h ../cryptlib.h cms_ess.c cms_lcl.h | ||
| 205 | cms_io.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 206 | cms_io.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 207 | cms_io.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 208 | cms_io.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 209 | cms_io.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 210 | cms_io.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 211 | cms_io.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 212 | cms_io.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 213 | cms_io.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 214 | cms_io.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 215 | cms_io.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 216 | cms_io.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 217 | cms_io.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h cms.h | ||
| 218 | cms_io.o: cms_io.c cms_lcl.h | ||
| 219 | cms_lib.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 220 | cms_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 221 | cms_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 222 | cms_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 223 | cms_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 224 | cms_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 225 | cms_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 226 | cms_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 227 | cms_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 228 | cms_lib.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 229 | cms_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 230 | cms_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 231 | cms_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h cms.h | ||
| 232 | cms_lib.o: cms_lcl.h cms_lib.c | ||
| 233 | cms_sd.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 234 | cms_sd.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 235 | cms_sd.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 236 | cms_sd.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 237 | cms_sd.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 238 | cms_sd.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 239 | cms_sd.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 240 | cms_sd.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 241 | cms_sd.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 242 | cms_sd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 243 | cms_sd.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 244 | cms_sd.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 245 | cms_sd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 246 | cms_sd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 247 | cms_sd.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 248 | cms_sd.o: ../asn1/asn1_locl.h ../cryptlib.h cms_lcl.h cms_sd.c | ||
| 249 | cms_smime.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 250 | cms_smime.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 251 | cms_smime.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 252 | cms_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 253 | cms_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 254 | cms_smime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 255 | cms_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 256 | cms_smime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 257 | cms_smime.o: ../../include/openssl/objects.h | ||
| 258 | cms_smime.o: ../../include/openssl/opensslconf.h | ||
| 259 | cms_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 260 | cms_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 261 | cms_smime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 262 | cms_smime.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 263 | cms_smime.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 264 | cms_smime.o: ../cryptlib.h cms_lcl.h cms_smime.c | ||
diff --git a/src/lib/libcrypto/comp/Makefile b/src/lib/libcrypto/comp/Makefile new file mode 100644 index 0000000000..efda832dce --- /dev/null +++ b/src/lib/libcrypto/comp/Makefile | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/comp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= comp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= comp_lib.c comp_err.c \ | ||
| 21 | c_rle.c c_zlib.c | ||
| 22 | |||
| 23 | LIBOBJ= comp_lib.o comp_err.o \ | ||
| 24 | c_rle.o c_zlib.o | ||
| 25 | |||
| 26 | SRC= $(LIBSRC) | ||
| 27 | |||
| 28 | EXHEADER= comp.h | ||
| 29 | HEADER= $(EXHEADER) | ||
| 30 | |||
| 31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 32 | |||
| 33 | top: | ||
| 34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 35 | |||
| 36 | all: lib | ||
| 37 | |||
| 38 | lib: $(LIBOBJ) | ||
| 39 | $(AR) $(LIB) $(LIBOBJ) | ||
| 40 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 41 | @touch lib | ||
| 42 | |||
| 43 | files: | ||
| 44 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 45 | |||
| 46 | links: | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 50 | |||
| 51 | install: | ||
| 52 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 53 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 54 | do \ | ||
| 55 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 56 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 57 | done; | ||
| 58 | |||
| 59 | tags: | ||
| 60 | ctags $(SRC) | ||
| 61 | |||
| 62 | tests: | ||
| 63 | |||
| 64 | lint: | ||
| 65 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 66 | |||
| 67 | depend: | ||
| 68 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 70 | |||
| 71 | dclean: | ||
| 72 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 73 | mv -f Makefile.new $(MAKEFILE) | ||
| 74 | |||
| 75 | clean: | ||
| 76 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 77 | |||
| 78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 79 | |||
| 80 | c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 81 | c_rle.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h | ||
| 82 | c_rle.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h | ||
| 83 | c_rle.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 84 | c_rle.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 85 | c_rle.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 86 | c_rle.o: ../../include/openssl/symhacks.h c_rle.c | ||
| 87 | c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 88 | c_zlib.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h | ||
| 89 | c_zlib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 90 | c_zlib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 91 | c_zlib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 92 | c_zlib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 93 | c_zlib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 94 | c_zlib.o: ../../include/openssl/symhacks.h c_zlib.c | ||
| 95 | comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h | ||
| 96 | comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 97 | comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 98 | comp_err.o: ../../include/openssl/opensslconf.h | ||
| 99 | comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 100 | comp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 101 | comp_err.o: ../../include/openssl/symhacks.h comp_err.c | ||
| 102 | comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 103 | comp_lib.o: ../../include/openssl/comp.h ../../include/openssl/crypto.h | ||
| 104 | comp_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/obj_mac.h | ||
| 105 | comp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 106 | comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 107 | comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 108 | comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c | ||
diff --git a/src/lib/libcrypto/comp/c_rle.c b/src/lib/libcrypto/comp/c_rle.c index 18bceae51e..efd366fa22 100644 --- a/src/lib/libcrypto/comp/c_rle.c +++ b/src/lib/libcrypto/comp/c_rle.c | |||
| @@ -46,7 +46,7 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | |||
| 46 | { | 46 | { |
| 47 | int i; | 47 | int i; |
| 48 | 48 | ||
| 49 | if (ilen == 0 || olen < (ilen-1)) | 49 | if (olen < (ilen-1)) |
| 50 | { | 50 | { |
| 51 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ | 51 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ |
| 52 | return(-1); | 52 | return(-1); |
| @@ -59,3 +59,4 @@ static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, | |||
| 59 | } | 59 | } |
| 60 | return(ilen-1); | 60 | return(ilen-1); |
| 61 | } | 61 | } |
| 62 | |||
diff --git a/src/lib/libcrypto/conf/Makefile b/src/lib/libcrypto/conf/Makefile new file mode 100644 index 0000000000..78bb324106 --- /dev/null +++ b/src/lib/libcrypto/conf/Makefile | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/conf/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= conf | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= conf_err.c conf_lib.c conf_api.c conf_def.c conf_mod.c \ | ||
| 21 | conf_mall.c conf_sap.c | ||
| 22 | |||
| 23 | LIBOBJ= conf_err.o conf_lib.o conf_api.o conf_def.o conf_mod.o \ | ||
| 24 | conf_mall.o conf_sap.o | ||
| 25 | |||
| 26 | SRC= $(LIBSRC) | ||
| 27 | |||
| 28 | EXHEADER= conf.h conf_api.h | ||
| 29 | HEADER= conf_def.h $(EXHEADER) | ||
| 30 | |||
| 31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 32 | |||
| 33 | top: | ||
| 34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 35 | |||
| 36 | all: lib | ||
| 37 | |||
| 38 | lib: $(LIBOBJ) | ||
| 39 | $(AR) $(LIB) $(LIBOBJ) | ||
| 40 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 41 | @touch lib | ||
| 42 | |||
| 43 | files: | ||
| 44 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 45 | |||
| 46 | links: | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 50 | |||
| 51 | install: | ||
| 52 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 53 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 54 | do \ | ||
| 55 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 56 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 57 | done; | ||
| 58 | |||
| 59 | tags: | ||
| 60 | ctags $(SRC) | ||
| 61 | |||
| 62 | tests: | ||
| 63 | |||
| 64 | lint: | ||
| 65 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 66 | |||
| 67 | depend: | ||
| 68 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 70 | |||
| 71 | dclean: | ||
| 72 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 73 | mv -f Makefile.new $(MAKEFILE) | ||
| 74 | |||
| 75 | clean: | ||
| 76 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 77 | |||
| 78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 79 | |||
| 80 | conf_api.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 81 | conf_api.o: ../../include/openssl/conf.h ../../include/openssl/conf_api.h | ||
| 82 | conf_api.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 83 | conf_api.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 84 | conf_api.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 85 | conf_api.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 86 | conf_api.o: ../../include/openssl/symhacks.h conf_api.c | ||
| 87 | conf_def.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 88 | conf_def.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 89 | conf_def.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h | ||
| 90 | conf_def.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 91 | conf_def.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 92 | conf_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 93 | conf_def.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 94 | conf_def.o: ../../include/openssl/symhacks.h ../cryptlib.h conf_def.c | ||
| 95 | conf_def.o: conf_def.h | ||
| 96 | conf_err.o: ../../include/openssl/bio.h ../../include/openssl/conf.h | ||
| 97 | conf_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 98 | conf_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 99 | conf_err.o: ../../include/openssl/opensslconf.h | ||
| 100 | conf_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 101 | conf_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 102 | conf_err.o: ../../include/openssl/symhacks.h conf_err.c | ||
| 103 | conf_lib.o: ../../include/openssl/bio.h ../../include/openssl/conf.h | ||
| 104 | conf_lib.o: ../../include/openssl/conf_api.h ../../include/openssl/crypto.h | ||
| 105 | conf_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 106 | conf_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 107 | conf_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 108 | conf_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 109 | conf_lib.o: ../../include/openssl/symhacks.h conf_lib.c | ||
| 110 | conf_mall.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 111 | conf_mall.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 112 | conf_mall.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 113 | conf_mall.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 114 | conf_mall.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 115 | conf_mall.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 116 | conf_mall.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 117 | conf_mall.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 118 | conf_mall.o: ../../include/openssl/objects.h | ||
| 119 | conf_mall.o: ../../include/openssl/opensslconf.h | ||
| 120 | conf_mall.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 121 | conf_mall.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 122 | conf_mall.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 123 | conf_mall.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 124 | conf_mall.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mall.c | ||
| 125 | conf_mod.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 126 | conf_mod.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 127 | conf_mod.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 128 | conf_mod.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 129 | conf_mod.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 130 | conf_mod.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 131 | conf_mod.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 132 | conf_mod.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 133 | conf_mod.o: ../../include/openssl/opensslconf.h | ||
| 134 | conf_mod.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 135 | conf_mod.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 136 | conf_mod.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 137 | conf_mod.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 138 | conf_mod.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_mod.c | ||
| 139 | conf_sap.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 140 | conf_sap.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 141 | conf_sap.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 142 | conf_sap.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 143 | conf_sap.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 144 | conf_sap.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 145 | conf_sap.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 146 | conf_sap.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 147 | conf_sap.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 148 | conf_sap.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 149 | conf_sap.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 150 | conf_sap.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 151 | conf_sap.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 152 | conf_sap.o: ../../include/openssl/x509_vfy.h ../cryptlib.h conf_sap.c | ||
diff --git a/src/lib/libcrypto/conf/cnf_save.c b/src/lib/libcrypto/conf/cnf_save.c new file mode 100644 index 0000000000..1439487526 --- /dev/null +++ b/src/lib/libcrypto/conf/cnf_save.c | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | /* crypto/conf/cnf_save.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/conf.h> | ||
| 61 | |||
| 62 | static void print_conf(CONF_VALUE *cv); | ||
| 63 | static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *); | ||
| 64 | |||
| 65 | main() | ||
| 66 | { | ||
| 67 | LHASH *conf; | ||
| 68 | long l; | ||
| 69 | |||
| 70 | conf=CONF_load(NULL,"../../apps/openssl.cnf",&l); | ||
| 71 | if (conf == NULL) | ||
| 72 | { | ||
| 73 | fprintf(stderr,"error loading config, line %ld\n",l); | ||
| 74 | exit(1); | ||
| 75 | } | ||
| 76 | |||
| 77 | lh_doall(conf,LHASH_DOALL_FN(print_conf)); | ||
| 78 | } | ||
| 79 | |||
| 80 | |||
| 81 | static void print_conf(CONF_VALUE *cv) | ||
| 82 | { | ||
| 83 | int i; | ||
| 84 | CONF_VALUE *v; | ||
| 85 | char *section; | ||
| 86 | char *name; | ||
| 87 | char *value; | ||
| 88 | STACK *s; | ||
| 89 | |||
| 90 | /* If it is a single entry, return */ | ||
| 91 | |||
| 92 | if (cv->name != NULL) return; | ||
| 93 | |||
| 94 | printf("[ %s ]\n",cv->section); | ||
| 95 | s=(STACK *)cv->value; | ||
| 96 | |||
| 97 | for (i=0; i<sk_num(s); i++) | ||
| 98 | { | ||
| 99 | v=(CONF_VALUE *)sk_value(s,i); | ||
| 100 | section=(v->section == NULL)?"None":v->section; | ||
| 101 | name=(v->name == NULL)?"None":v->name; | ||
| 102 | value=(v->value == NULL)?"None":v->value; | ||
| 103 | printf("%s=%s\n",name,value); | ||
| 104 | } | ||
| 105 | printf("\n"); | ||
| 106 | } | ||
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index f5fcbb9f6b..22617e5fa1 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
| @@ -64,7 +64,6 @@ | |||
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #include <assert.h> | 66 | #include <assert.h> |
| 67 | #include <stdlib.h> | ||
| 68 | #include <string.h> | 67 | #include <string.h> |
| 69 | #include <openssl/conf.h> | 68 | #include <openssl/conf.h> |
| 70 | #include <openssl/conf_api.h> | 69 | #include <openssl/conf_api.h> |
| @@ -286,7 +285,7 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | |||
| 286 | v->value=(char *)sk; | 285 | v->value=(char *)sk; |
| 287 | 286 | ||
| 288 | vv=lh_CONF_VALUE_insert(conf->data,v); | 287 | vv=lh_CONF_VALUE_insert(conf->data,v); |
| 289 | OPENSSL_assert(vv == NULL); | 288 | assert(vv == NULL); |
| 290 | ok=1; | 289 | ok=1; |
| 291 | err: | 290 | err: |
| 292 | if (!ok) | 291 | if (!ok) |
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index cf951320af..0b571b0394 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
| @@ -213,12 +213,13 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
| 213 | int bufnum=0,i,ii; | 213 | int bufnum=0,i,ii; |
| 214 | BUF_MEM *buff=NULL; | 214 | BUF_MEM *buff=NULL; |
| 215 | char *s,*p,*end; | 215 | char *s,*p,*end; |
| 216 | int again; | 216 | int again,n; |
| 217 | long eline=0; | 217 | long eline=0; |
| 218 | char btmp[DECIMAL_SIZE(eline)+1]; | 218 | char btmp[DECIMAL_SIZE(eline)+1]; |
| 219 | CONF_VALUE *v=NULL,*tv; | 219 | CONF_VALUE *v=NULL,*tv; |
| 220 | CONF_VALUE *sv=NULL; | 220 | CONF_VALUE *sv=NULL; |
| 221 | char *section=NULL,*buf; | 221 | char *section=NULL,*buf; |
| 222 | STACK_OF(CONF_VALUE) *section_sk=NULL,*ts; | ||
| 222 | char *start,*psection,*pname; | 223 | char *start,*psection,*pname; |
| 223 | void *h = (void *)(conf->data); | 224 | void *h = (void *)(conf->data); |
| 224 | 225 | ||
| @@ -249,6 +250,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
| 249 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | 250 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
| 250 | goto err; | 251 | goto err; |
| 251 | } | 252 | } |
| 253 | section_sk=(STACK_OF(CONF_VALUE) *)sv->value; | ||
| 252 | 254 | ||
| 253 | bufnum=0; | 255 | bufnum=0; |
| 254 | again=0; | 256 | again=0; |
| @@ -307,6 +309,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) | |||
| 307 | buf=buff->data; | 309 | buf=buff->data; |
| 308 | 310 | ||
| 309 | clear_comments(conf, buf); | 311 | clear_comments(conf, buf); |
| 312 | n=strlen(buf); | ||
| 310 | s=eat_ws(conf, buf); | 313 | s=eat_ws(conf, buf); |
| 311 | if (IS_EOF(conf,*s)) continue; /* blank line */ | 314 | if (IS_EOF(conf,*s)) continue; /* blank line */ |
| 312 | if (*s == '[') | 315 | if (*s == '[') |
| @@ -340,6 +343,7 @@ again: | |||
| 340 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | 343 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
| 341 | goto err; | 344 | goto err; |
| 342 | } | 345 | } |
| 346 | section_sk=(STACK_OF(CONF_VALUE) *)sv->value; | ||
| 343 | continue; | 347 | continue; |
| 344 | } | 348 | } |
| 345 | else | 349 | else |
| @@ -402,9 +406,13 @@ again: | |||
| 402 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | 406 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
| 403 | goto err; | 407 | goto err; |
| 404 | } | 408 | } |
| 409 | ts=(STACK_OF(CONF_VALUE) *)tv->value; | ||
| 405 | } | 410 | } |
| 406 | else | 411 | else |
| 412 | { | ||
| 407 | tv=sv; | 413 | tv=sv; |
| 414 | ts=section_sk; | ||
| 415 | } | ||
| 408 | #if 1 | 416 | #if 1 |
| 409 | if (_CONF_add_string(conf, tv, v) == 0) | 417 | if (_CONF_add_string(conf, tv, v) == 0) |
| 410 | { | 418 | { |
| @@ -457,6 +465,9 @@ err: | |||
| 457 | 465 | ||
| 458 | static void clear_comments(CONF *conf, char *p) | 466 | static void clear_comments(CONF *conf, char *p) |
| 459 | { | 467 | { |
| 468 | char *to; | ||
| 469 | |||
| 470 | to=p; | ||
| 460 | for (;;) | 471 | for (;;) |
| 461 | { | 472 | { |
| 462 | if (IS_FCOMMENT(conf,*p)) | 473 | if (IS_FCOMMENT(conf,*p)) |
diff --git a/src/lib/libcrypto/conf/test.c b/src/lib/libcrypto/conf/test.c new file mode 100644 index 0000000000..7fab85053e --- /dev/null +++ b/src/lib/libcrypto/conf/test.c | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | /* crypto/conf/test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/conf.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | |||
| 64 | main() | ||
| 65 | { | ||
| 66 | LHASH *conf; | ||
| 67 | long eline; | ||
| 68 | char *s,*s2; | ||
| 69 | |||
| 70 | #ifdef USE_WIN32 | ||
| 71 | CONF_set_default_method(CONF_WIN32); | ||
| 72 | #endif | ||
| 73 | conf=CONF_load(NULL,"ssleay.cnf",&eline); | ||
| 74 | if (conf == NULL) | ||
| 75 | { | ||
| 76 | ERR_load_crypto_strings(); | ||
| 77 | printf("unable to load configuration, line %ld\n",eline); | ||
| 78 | ERR_print_errors_fp(stderr); | ||
| 79 | exit(1); | ||
| 80 | } | ||
| 81 | lh_stats(conf,stdout); | ||
| 82 | lh_node_stats(conf,stdout); | ||
| 83 | lh_node_usage_stats(conf,stdout); | ||
| 84 | |||
| 85 | s=CONF_get_string(conf,NULL,"init2"); | ||
| 86 | printf("init2=%s\n",(s == NULL)?"NULL":s); | ||
| 87 | |||
| 88 | s=CONF_get_string(conf,NULL,"cipher1"); | ||
| 89 | printf("cipher1=%s\n",(s == NULL)?"NULL":s); | ||
| 90 | |||
| 91 | s=CONF_get_string(conf,"s_client","cipher1"); | ||
| 92 | printf("s_client:cipher1=%s\n",(s == NULL)?"NULL":s); | ||
| 93 | |||
| 94 | printf("---------------------------- DUMP ------------------------\n"); | ||
| 95 | CONF_dump_fp(conf, stdout); | ||
| 96 | |||
| 97 | exit(0); | ||
| 98 | } | ||
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c index 24fe123e14..b4449b86d6 100644 --- a/src/lib/libcrypto/cryptlib.c +++ b/src/lib/libcrypto/cryptlib.c | |||
| @@ -731,6 +731,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, | |||
| 731 | case DLL_THREAD_ATTACH: | 731 | case DLL_THREAD_ATTACH: |
| 732 | break; | 732 | break; |
| 733 | case DLL_THREAD_DETACH: | 733 | case DLL_THREAD_DETACH: |
| 734 | ERR_remove_state(0); | ||
| 734 | break; | 735 | break; |
| 735 | case DLL_PROCESS_DETACH: | 736 | case DLL_PROCESS_DETACH: |
| 736 | break; | 737 | break; |
| @@ -742,16 +743,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, | |||
| 742 | #if defined(_WIN32) && !defined(__CYGWIN__) | 743 | #if defined(_WIN32) && !defined(__CYGWIN__) |
| 743 | #include <tchar.h> | 744 | #include <tchar.h> |
| 744 | #include <signal.h> | 745 | #include <signal.h> |
| 745 | #ifdef __WATCOMC__ | ||
| 746 | #if defined(_UNICODE) || defined(__UNICODE__) | ||
| 747 | #define _vsntprintf _vsnwprintf | ||
| 748 | #else | ||
| 749 | #define _vsntprintf _vsnprintf | ||
| 750 | #endif | ||
| 751 | #endif | ||
| 752 | #ifdef _MSC_VER | ||
| 753 | #define alloca _alloca | ||
| 754 | #endif | ||
| 755 | 746 | ||
| 756 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 | 747 | #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 |
| 757 | int OPENSSL_isservice(void) | 748 | int OPENSSL_isservice(void) |
| @@ -782,7 +773,11 @@ int OPENSSL_isservice(void) | |||
| 782 | 773 | ||
| 783 | if (len>512) return -1; /* paranoia */ | 774 | if (len>512) return -1; /* paranoia */ |
| 784 | len++,len&=~1; /* paranoia */ | 775 | len++,len&=~1; /* paranoia */ |
| 776 | #ifdef _MSC_VER | ||
| 777 | name=(WCHAR *)_alloca(len+sizeof(WCHAR)); | ||
| 778 | #else | ||
| 785 | name=(WCHAR *)alloca(len+sizeof(WCHAR)); | 779 | name=(WCHAR *)alloca(len+sizeof(WCHAR)); |
| 780 | #endif | ||
| 786 | if (!GetUserObjectInformationW (h,UOI_NAME,name,len,&len)) | 781 | if (!GetUserObjectInformationW (h,UOI_NAME,name,len,&len)) |
| 787 | return -1; | 782 | return -1; |
| 788 | 783 | ||
| @@ -827,7 +822,11 @@ void OPENSSL_showfatal (const char *fmta,...) | |||
| 827 | size_t len_0=strlen(fmta)+1,i; | 822 | size_t len_0=strlen(fmta)+1,i; |
| 828 | WCHAR *fmtw; | 823 | WCHAR *fmtw; |
| 829 | 824 | ||
| 830 | fmtw = (WCHAR *)alloca(len_0*sizeof(WCHAR)); | 825 | #ifdef _MSC_VER |
| 826 | fmtw = (WCHAR *)_alloca (len_0*sizeof(WCHAR)); | ||
| 827 | #else | ||
| 828 | fmtw = (WCHAR *)alloca (len_0*sizeof(WCHAR)); | ||
| 829 | #endif | ||
| 831 | if (fmtw == NULL) { fmt=(const TCHAR *)L"no stack?"; break; } | 830 | if (fmtw == NULL) { fmt=(const TCHAR *)L"no stack?"; break; } |
| 832 | 831 | ||
| 833 | #ifndef OPENSSL_NO_MULTIBYTE | 832 | #ifndef OPENSSL_NO_MULTIBYTE |
diff --git a/src/lib/libcrypto/crypto-lib.com b/src/lib/libcrypto/crypto-lib.com new file mode 100644 index 0000000000..a4b6635091 --- /dev/null +++ b/src/lib/libcrypto/crypto-lib.com | |||
| @@ -0,0 +1,1336 @@ | |||
| 1 | $! | ||
| 2 | $! CRYPTO-LIB.COM | ||
| 3 | $! Written By: Robert Byer | ||
| 4 | $! Vice-President | ||
| 5 | $! A-Com Computing, Inc. | ||
| 6 | $! byer@mail.all-net.net | ||
| 7 | $! | ||
| 8 | $! Changes by Richard Levitte <richard@levitte.org> | ||
| 9 | $! Zoltan Arpadffy <arpadffy@polarhome.com> | ||
| 10 | $! | ||
| 11 | $! This command files compiles and creates the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" | ||
| 12 | $! library for OpenSSL. The "xxx" denotes the machine architecture, ALPHA, | ||
| 13 | $! IA64 or VAX. | ||
| 14 | $! | ||
| 15 | $! It was re-written so it would try to determine what "C" compiler to use | ||
| 16 | $! or you can specify which "C" compiler to use. | ||
| 17 | $! | ||
| 18 | $! Specify the following as P1 to build just that part or ALL to just | ||
| 19 | $! build everything. | ||
| 20 | $! | ||
| 21 | $! LIBRARY To just compile the [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library. | ||
| 22 | $! APPS To just compile the [.xxx.EXE.CRYPTO]*.EXE | ||
| 23 | $! ALL To do both LIBRARY and APPS | ||
| 24 | $! | ||
| 25 | $! Specify DEBUG or NODEBUG as P2 to compile with or without debugger | ||
| 26 | $! information. | ||
| 27 | $! | ||
| 28 | $! Specify which compiler at P3 to try to compile under. | ||
| 29 | $! | ||
| 30 | $! VAXC For VAX C. | ||
| 31 | $! DECC For DEC C. | ||
| 32 | $! GNUC For GNU C. | ||
| 33 | $! | ||
| 34 | $! If you don't specify a compiler, it will try to determine which | ||
| 35 | $! "C" compiler to use. | ||
| 36 | $! | ||
| 37 | $! P4, if defined, sets a TCP/IP library to use, through one of the following | ||
| 38 | $! keywords: | ||
| 39 | $! | ||
| 40 | $! UCX For UCX | ||
| 41 | $! TCPIP For TCPIP (post UCX) | ||
| 42 | $! SOCKETSHR For SOCKETSHR+NETLIB | ||
| 43 | $! | ||
| 44 | $! P5, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | ||
| 45 | $! | ||
| 46 | $! P6, if defined, sets a choice of crypto methods to compile. | ||
| 47 | $! WARNING: this should only be done to recompile some part of an already | ||
| 48 | $! fully compiled library. | ||
| 49 | $! | ||
| 50 | $! | ||
| 51 | $! Define A TCP/IP Library That We Will Need To Link To. | ||
| 52 | $! (That Is, If We Need To Link To One.) | ||
| 53 | $! | ||
| 54 | $ TCPIP_LIB = "" | ||
| 55 | $! | ||
| 56 | $! Check Which Architecture We Are Using. | ||
| 57 | $! | ||
| 58 | $ IF (F$GETSYI("CPU").LT.128) | ||
| 59 | $ THEN | ||
| 60 | $! | ||
| 61 | $! The Architecture Is VAX | ||
| 62 | $! | ||
| 63 | $ ARCH = "VAX" | ||
| 64 | $! | ||
| 65 | $! Else... | ||
| 66 | $! | ||
| 67 | $ ELSE | ||
| 68 | $! | ||
| 69 | $! The Architecture Is Alpha, IA64 or whatever comes in the future. | ||
| 70 | $! | ||
| 71 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") | ||
| 72 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
| 73 | $! | ||
| 74 | $! End The Architecture Check. | ||
| 75 | $! | ||
| 76 | $ ENDIF | ||
| 77 | $! | ||
| 78 | $! Define The Different Encryption Types. | ||
| 79 | $! NOTE: Some might think this list ugly. However, it's made this way to | ||
| 80 | $! reflect the SDIRS variable in [-]Makefile.org as closely as possible, | ||
| 81 | $! thereby making it fairly easy to verify that the lists are the same. | ||
| 82 | $! | ||
| 83 | $ ET_WHIRLPOOL = "WHRLPOOL" | ||
| 84 | $ IF ARCH .EQS. "VAX" THEN ET_WHIRLPOOL = "" | ||
| 85 | $ ENCRYPT_TYPES = "Basic,"+ - | ||
| 86 | "OBJECTS,"+ - | ||
| 87 | "MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,"+ET_WHIRLPOOL+","+ - | ||
| 88 | "DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,MODES,"+ - | ||
| 89 | "BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,"+ - | ||
| 90 | "BUFFER,BIO,STACK,LHASH,RAND,ERR,"+ - | ||
| 91 | "EVP,EVP_2,EVP_3,ASN1,ASN1_2,PEM,X509,X509V3,"+ - | ||
| 92 | "CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI,KRB5,"+ - | ||
| 93 | "STORE,CMS,PQUEUE,TS,JPAKE" | ||
| 94 | $! Define The OBJ Directory. | ||
| 95 | $! | ||
| 96 | $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.CRYPTO] | ||
| 97 | $! | ||
| 98 | $! Define The EXE Directory. | ||
| 99 | $! | ||
| 100 | $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.CRYPTO] | ||
| 101 | $! | ||
| 102 | $! Check To Make Sure We Have Valid Command Line Parameters. | ||
| 103 | $! | ||
| 104 | $ GOSUB CHECK_OPTIONS | ||
| 105 | $! | ||
| 106 | $! Initialise logical names and such | ||
| 107 | $! | ||
| 108 | $ GOSUB INITIALISE | ||
| 109 | $! | ||
| 110 | $! Tell The User What Kind of Machine We Run On. | ||
| 111 | $! | ||
| 112 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." | ||
| 113 | $! | ||
| 114 | $! | ||
| 115 | $! Check To See If The Architecture Specific OBJ Directory Exists. | ||
| 116 | $! | ||
| 117 | $ IF (F$PARSE(OBJ_DIR).EQS."") | ||
| 118 | $ THEN | ||
| 119 | $! | ||
| 120 | $! It Dosen't Exist, So Create It. | ||
| 121 | $! | ||
| 122 | $ CREATE/DIR 'OBJ_DIR' | ||
| 123 | $! | ||
| 124 | $! End The Architecture Specific OBJ Directory Check. | ||
| 125 | $! | ||
| 126 | $ ENDIF | ||
| 127 | $! | ||
| 128 | $! Check To See If The Architecture Specific Directory Exists. | ||
| 129 | $! | ||
| 130 | $ IF (F$PARSE(EXE_DIR).EQS."") | ||
| 131 | $ THEN | ||
| 132 | $! | ||
| 133 | $! It Dosen't Exist, So Create It. | ||
| 134 | $! | ||
| 135 | $ CREATE/DIRECTORY 'EXE_DIR' | ||
| 136 | $! | ||
| 137 | $! End The Architecture Specific Directory Check. | ||
| 138 | $! | ||
| 139 | $ ENDIF | ||
| 140 | $! | ||
| 141 | $! Define The Library Name. | ||
| 142 | $! | ||
| 143 | $ LIB_NAME := 'EXE_DIR'LIBCRYPTO.OLB | ||
| 144 | $! | ||
| 145 | $! Define The CRYPTO-LIB We Are To Use. | ||
| 146 | $! | ||
| 147 | $ CRYPTO_LIB := 'EXE_DIR'LIBCRYPTO.OLB | ||
| 148 | $! | ||
| 149 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library... | ||
| 150 | $! | ||
| 151 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
| 152 | $ THEN | ||
| 153 | $! | ||
| 154 | $! Guess Not, Create The Library. | ||
| 155 | $! | ||
| 156 | $ LIBRARY/CREATE/OBJECT 'LIB_NAME' | ||
| 157 | $! | ||
| 158 | $! End The Library Check. | ||
| 159 | $! | ||
| 160 | $ ENDIF | ||
| 161 | $! | ||
| 162 | $! Build our options file for the application | ||
| 163 | $! | ||
| 164 | $ GOSUB CHECK_OPT_FILE | ||
| 165 | $! | ||
| 166 | $! Define The Different Encryption "library" Strings. | ||
| 167 | $! | ||
| 168 | $ APPS_DES = "DES/DES,CBC3_ENC" | ||
| 169 | $ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE" | ||
| 170 | $ | ||
| 171 | $ LIB_ = "cryptlib,mem,mem_clr,mem_dbg,cversion,ex_data,cpt_err,ebcdic,uid,o_time,o_str,o_dir" | ||
| 172 | $ LIB_MD2 = "md2_dgst,md2_one" | ||
| 173 | $ LIB_MD4 = "md4_dgst,md4_one" | ||
| 174 | $ LIB_MD5 = "md5_dgst,md5_one" | ||
| 175 | $ LIB_SHA = "sha_dgst,sha1dgst,sha_one,sha1_one,sha256,sha512" | ||
| 176 | $ LIB_MDC2 = "mdc2dgst,mdc2_one" | ||
| 177 | $ LIB_HMAC = "hmac,hm_ameth,hm_pmeth" | ||
| 178 | $ LIB_RIPEMD = "rmd_dgst,rmd_one" | ||
| 179 | $ LIB_WHRLPOOL = "wp_dgst,wp_block" | ||
| 180 | $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - | ||
| 181 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - | ||
| 182 | "enc_read,enc_writ,ofb64enc,"+ - | ||
| 183 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - | ||
| 184 | "des_enc,fcrypt_b,"+ - | ||
| 185 | "fcrypt,xcbc_enc,rpc_enc,cbc_cksm,"+ - | ||
| 186 | "ede_cbcm_enc,des_old,des_old2,read2pwd" | ||
| 187 | $ LIB_RC2 = "rc2_ecb,rc2_skey,rc2_cbc,rc2cfb64,rc2ofb64" | ||
| 188 | $ LIB_RC4 = "rc4_skey,rc4_enc" | ||
| 189 | $ LIB_RC5 = "rc5_skey,rc5_ecb,rc5_enc,rc5cfb64,rc5ofb64" | ||
| 190 | $ LIB_IDEA = "i_cbc,i_cfb64,i_ofb64,i_ecb,i_skey" | ||
| 191 | $ LIB_BF = "bf_skey,bf_ecb,bf_enc,bf_cfb64,bf_ofb64" | ||
| 192 | $ LIB_CAST = "c_skey,c_ecb,c_enc,c_cfb64,c_ofb64" | ||
| 193 | $ LIB_CAMELLIA = "camellia,cmll_misc,cmll_ecb,cmll_cbc,cmll_ofb,"+ - | ||
| 194 | "cmll_cfb,cmll_ctr" | ||
| 195 | $ LIB_SEED = "seed,seed_ecb,seed_cbc,seed_cfb,seed_ofb" | ||
| 196 | $ LIB_MODES = "cbc128,ctr128,cfb128,ofb128" | ||
| 197 | $ LIB_BN_ASM = "[.asm]vms.mar,vms-helper" | ||
| 198 | $ IF F$TRNLNM("OPENSSL_NO_ASM") .OR. ARCH .NES. "VAX" THEN - | ||
| 199 | LIB_BN_ASM = "bn_asm" | ||
| 200 | $ LIB_BN = "bn_add,bn_div,bn_exp,bn_lib,bn_ctx,bn_mul,bn_mod,"+ - | ||
| 201 | "bn_print,bn_rand,bn_shift,bn_word,bn_blind,"+ - | ||
| 202 | "bn_kron,bn_sqrt,bn_gcd,bn_prime,bn_err,bn_sqr,"+LIB_BN_ASM+","+ - | ||
| 203 | "bn_recp,bn_mont,bn_mpi,bn_exp2,bn_gf2m,bn_nist,"+ - | ||
| 204 | "bn_depr,bn_const" | ||
| 205 | $ LIB_EC = "ec_lib,ecp_smpl,ecp_mont,ecp_nist,ec_cvt,ec_mult,"+ - | ||
| 206 | "ec_err,ec_curve,ec_check,ec_print,ec_asn1,ec_key,"+ - | ||
| 207 | "ec2_smpl,ec2_mult,ec_ameth,ec_pmeth,eck_prn" | ||
| 208 | $ LIB_RSA = "rsa_eay,rsa_gen,rsa_lib,rsa_sign,rsa_saos,rsa_err,"+ - | ||
| 209 | "rsa_pk1,rsa_ssl,rsa_none,rsa_oaep,rsa_chk,rsa_null,"+ - | ||
| 210 | "rsa_pss,rsa_x931,rsa_asn1,rsa_depr,rsa_ameth,rsa_prn,"+ - | ||
| 211 | "rsa_pmeth" | ||
| 212 | $ LIB_DSA = "dsa_gen,dsa_key,dsa_lib,dsa_asn1,dsa_vrf,dsa_sign,"+ - | ||
| 213 | "dsa_err,dsa_ossl,dsa_depr,dsa_ameth,dsa_pmeth,dsa_prn" | ||
| 214 | $ LIB_ECDSA = "ecs_lib,ecs_asn1,ecs_ossl,ecs_sign,ecs_vrf,ecs_err" | ||
| 215 | $ LIB_DH = "dh_asn1,dh_gen,dh_key,dh_lib,dh_check,dh_err,dh_depr,"+ - | ||
| 216 | "dh_ameth,dh_pmeth,dh_prn" | ||
| 217 | $ LIB_ECDH = "ech_lib,ech_ossl,ech_key,ech_err" | ||
| 218 | $ LIB_DSO = "dso_dl,dso_dlfcn,dso_err,dso_lib,dso_null,"+ - | ||
| 219 | "dso_openssl,dso_win32,dso_vms,dso_beos" | ||
| 220 | $ LIB_ENGINE = "eng_err,eng_lib,eng_list,eng_init,eng_ctrl,"+ - | ||
| 221 | "eng_table,eng_pkey,eng_fat,eng_all,"+ - | ||
| 222 | "tb_rsa,tb_dsa,tb_ecdsa,tb_dh,tb_ecdh,tb_rand,tb_store,"+ - | ||
| 223 | "tb_cipher,tb_digest,tb_pkmeth,tb_asnmth,"+ - | ||
| 224 | "eng_openssl,eng_dyn,eng_cnf,eng_cryptodev" | ||
| 225 | $ LIB_AES = "aes_core,aes_misc,aes_ecb,aes_cbc,aes_cfb,aes_ofb,aes_ctr,"+ - | ||
| 226 | "aes_ige,aes_wrap" | ||
| 227 | $ LIB_BUFFER = "buffer,buf_err" | ||
| 228 | $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ - | ||
| 229 | "bss_mem,bss_null,bss_fd,"+ - | ||
| 230 | "bss_file,bss_sock,bss_conn,"+ - | ||
| 231 | "bf_null,bf_buff,b_print,b_dump,"+ - | ||
| 232 | "b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ - | ||
| 233 | "bss_dgram,"+ - | ||
| 234 | "bf_lbuf" | ||
| 235 | $ LIB_STACK = "stack" | ||
| 236 | $ LIB_LHASH = "lhash,lh_stats" | ||
| 237 | $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,"+ - | ||
| 238 | "rand_vms" | ||
| 239 | $ LIB_ERR = "err,err_all,err_prn" | ||
| 240 | $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err,obj_xref" | ||
| 241 | $ LIB_EVP = "encode,digest,evp_enc,evp_key,evp_acnf,"+ - | ||
| 242 | "e_des,e_bf,e_idea,e_des3,e_camellia,"+ - | ||
| 243 | "e_rc4,e_aes,names,e_seed,"+ - | ||
| 244 | "e_xcbc_d,e_rc2,e_cast,e_rc5" | ||
| 245 | $ LIB_EVP_2 = "m_null,m_md2,m_md4,m_md5,m_sha,m_sha1,m_wp," + - | ||
| 246 | "m_dss,m_dss1,m_mdc2,m_ripemd,m_ecdsa,"+ - | ||
| 247 | "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ - | ||
| 248 | "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ - | ||
| 249 | "c_all,c_allc,c_alld,evp_lib,bio_ok,"+- | ||
| 250 | "evp_pkey,evp_pbe,p5_crpt,p5_crpt2" | ||
| 251 | $ LIB_EVP_3 = "e_old,pmeth_lib,pmeth_fn,pmeth_gn,m_sigver" | ||
| 252 | $ LIB_ASN1 = "a_object,a_bitstr,a_utctm,a_gentm,a_time,a_int,a_octet,"+ - | ||
| 253 | "a_print,a_type,a_set,a_dup,a_d2i_fp,a_i2d_fp,"+ - | ||
| 254 | "a_enum,a_utf8,a_sign,a_digest,a_verify,a_mbstr,a_strex,"+ - | ||
| 255 | "x_algor,x_val,x_pubkey,x_sig,x_req,x_attrib,x_bignum,"+ - | ||
| 256 | "x_long,x_name,x_x509,x_x509a,x_crl,x_info,x_spki,nsseq,"+ - | ||
| 257 | "x_nx509,d2i_pu,d2i_pr,i2d_pu,i2d_pr" | ||
| 258 | $ LIB_ASN1_2 = "t_req,t_x509,t_x509a,t_crl,t_pkey,t_spki,t_bitst,"+ - | ||
| 259 | "tasn_new,tasn_fre,tasn_enc,tasn_dec,tasn_utl,tasn_typ,"+ - | ||
| 260 | "tasn_prn,ameth_lib,"+ - | ||
| 261 | "f_int,f_string,n_pkey,"+ - | ||
| 262 | "f_enum,x_pkey,a_bool,x_exten,bio_asn1,bio_ndef,asn_mime,"+ - | ||
| 263 | "asn1_gen,asn1_par,asn1_lib,asn1_err,a_bytes,a_strnid,"+ - | ||
| 264 | "evp_asn1,asn_pack,p5_pbe,p5_pbev2,p8_pkey,asn_moid" | ||
| 265 | $ LIB_PEM = "pem_sign,pem_seal,pem_info,pem_lib,pem_all,pem_err,"+ - | ||
| 266 | "pem_x509,pem_xaux,pem_oth,pem_pk8,pem_pkey,pvkfmt" | ||
| 267 | $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - | ||
| 268 | "x509_obj,x509_req,x509spki,x509_vfy,"+ - | ||
| 269 | "x509_set,x509cset,x509rset,x509_err,"+ - | ||
| 270 | "x509name,x509_v3,x509_ext,x509_att,"+ - | ||
| 271 | "x509type,x509_lu,x_all,x509_txt,"+ - | ||
| 272 | "x509_trs,by_file,by_dir,x509_vpm" | ||
| 273 | $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - | ||
| 274 | "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - | ||
| 275 | "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info,"+ - | ||
| 276 | "v3_ocsp,v3_akeya,v3_pmaps,v3_pcons,v3_ncons,v3_pcia,v3_pci,"+ - | ||
| 277 | "pcy_cache,pcy_node,pcy_data,pcy_map,pcy_tree,pcy_lib,"+ - | ||
| 278 | "v3_asid,v3_addr" | ||
| 279 | $ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def,conf_mod,conf_mall,conf_sap" | ||
| 280 | $ LIB_TXT_DB = "txt_db" | ||
| 281 | $ LIB_PKCS7 = "pk7_asn1,pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,"+ - | ||
| 282 | "pk7_mime,bio_pk7" | ||
| 283 | $ LIB_PKCS12 = "p12_add,p12_asn,p12_attr,p12_crpt,p12_crt,p12_decr,"+ - | ||
| 284 | "p12_init,p12_key,p12_kiss,p12_mutl,"+ - | ||
| 285 | "p12_utl,p12_npas,pk12err,p12_p8d,p12_p8e" | ||
| 286 | $ LIB_COMP = "comp_lib,comp_err,"+ - | ||
| 287 | "c_rle,c_zlib" | ||
| 288 | $ LIB_OCSP = "ocsp_asn,ocsp_ext,ocsp_ht,ocsp_lib,ocsp_cl,"+ - | ||
| 289 | "ocsp_srv,ocsp_prn,ocsp_vfy,ocsp_err" | ||
| 290 | $ LIB_UI_COMPAT = ",ui_compat" | ||
| 291 | $ LIB_UI = "ui_err,ui_lib,ui_openssl,ui_util"+LIB_UI_COMPAT | ||
| 292 | $ LIB_KRB5 = "krb5_asn" | ||
| 293 | $ LIB_STORE = "str_err,str_lib,str_meth,str_mem" | ||
| 294 | $ LIB_CMS = "cms_lib,cms_asn1,cms_att,cms_io,cms_smime,cms_err,"+ - | ||
| 295 | "cms_sd,cms_dd,cms_cd,cms_env,cms_enc,cms_ess" | ||
| 296 | $ LIB_PQUEUE = "pqueue" | ||
| 297 | $ LIB_TS = "ts_err,ts_req_utils,ts_req_print,ts_rsp_utils,ts_rsp_print,"+ - | ||
| 298 | "ts_rsp_sign,ts_rsp_verify,ts_verify_ctx,ts_lib,ts_conf,"+ - | ||
| 299 | "ts_asn1" | ||
| 300 | $ LIB_JPAKE = "jpake,jpake_err" | ||
| 301 | $! | ||
| 302 | $! Setup exceptional compilations | ||
| 303 | $! | ||
| 304 | $ ! Add definitions for no threads on OpenVMS 7.1 and higher | ||
| 305 | $ COMPILEWITH_CC3 = ",bss_rtcp," | ||
| 306 | $ ! Disable the DOLLARID warning | ||
| 307 | $ COMPILEWITH_CC4 = ",a_utctm,bss_log,o_time,o_dir" | ||
| 308 | $ ! Disable disjoint optimization | ||
| 309 | $ COMPILEWITH_CC5 = ",md2_dgst,md4_dgst,md5_dgst,mdc2dgst," + - | ||
| 310 | "seed,sha_dgst,sha1dgst,rmd_dgst,bf_enc," | ||
| 311 | $ ! Disable the MIXLINKAGE warning | ||
| 312 | $ COMPILEWITH_CC6 = ",enc_read,set_key," | ||
| 313 | $! | ||
| 314 | $! Figure Out What Other Modules We Are To Build. | ||
| 315 | $! | ||
| 316 | $ BUILD_SET: | ||
| 317 | $! | ||
| 318 | $! Define A Module Counter. | ||
| 319 | $! | ||
| 320 | $ MODULE_COUNTER = 0 | ||
| 321 | $! | ||
| 322 | $! Top Of The Loop. | ||
| 323 | $! | ||
| 324 | $ MODULE_NEXT: | ||
| 325 | $! | ||
| 326 | $! Extract The Module Name From The Encryption List. | ||
| 327 | $! | ||
| 328 | $ MODULE_NAME = F$ELEMENT(MODULE_COUNTER,",",ENCRYPT_TYPES) | ||
| 329 | $ IF MODULE_NAME.EQS."Basic" THEN MODULE_NAME = "" | ||
| 330 | $ MODULE_NAME1 = MODULE_NAME | ||
| 331 | $! | ||
| 332 | $! Check To See If We Are At The End Of The Module List. | ||
| 333 | $! | ||
| 334 | $ IF (MODULE_NAME.EQS.",") | ||
| 335 | $ THEN | ||
| 336 | $! | ||
| 337 | $! We Are At The End Of The Module List, Go To MODULE_DONE. | ||
| 338 | $! | ||
| 339 | $ GOTO MODULE_DONE | ||
| 340 | $! | ||
| 341 | $! End The Module List Check. | ||
| 342 | $! | ||
| 343 | $ ENDIF | ||
| 344 | $! | ||
| 345 | $! Increment The Moudle Counter. | ||
| 346 | $! | ||
| 347 | $ MODULE_COUNTER = MODULE_COUNTER + 1 | ||
| 348 | $! | ||
| 349 | $! Create The Library and Apps Module Names. | ||
| 350 | $! | ||
| 351 | $ LIB_MODULE = "LIB_" + MODULE_NAME | ||
| 352 | $ APPS_MODULE = "APPS_" + MODULE_NAME | ||
| 353 | $ IF (F$EXTRACT(0,5,MODULE_NAME).EQS."ASN1_") | ||
| 354 | $ THEN | ||
| 355 | $ MODULE_NAME = "ASN1" | ||
| 356 | $ ENDIF | ||
| 357 | $ IF (F$EXTRACT(0,4,MODULE_NAME).EQS."EVP_") | ||
| 358 | $ THEN | ||
| 359 | $ MODULE_NAME = "EVP" | ||
| 360 | $ ENDIF | ||
| 361 | $! | ||
| 362 | $! Set state (can be LIB and APPS) | ||
| 363 | $! | ||
| 364 | $ STATE = "LIB" | ||
| 365 | $ IF BUILDALL .EQS. "APPS" THEN STATE = "APPS" | ||
| 366 | $! | ||
| 367 | $! Check if the library module name actually is defined | ||
| 368 | $! | ||
| 369 | $ IF F$TYPE('LIB_MODULE') .EQS. "" | ||
| 370 | $ THEN | ||
| 371 | $ WRITE SYS$ERROR "" | ||
| 372 | $ WRITE SYS$ERROR "The module ",MODULE_NAME1," does not exist. Continuing..." | ||
| 373 | $ WRITE SYS$ERROR "" | ||
| 374 | $ GOTO MODULE_NEXT | ||
| 375 | $ ENDIF | ||
| 376 | $! | ||
| 377 | $! Top Of The Module Loop. | ||
| 378 | $! | ||
| 379 | $ MODULE_AGAIN: | ||
| 380 | $! | ||
| 381 | $! Tell The User What Module We Are Building. | ||
| 382 | $! | ||
| 383 | $ IF (MODULE_NAME1.NES."") | ||
| 384 | $ THEN | ||
| 385 | $ IF STATE .EQS. "LIB" | ||
| 386 | $ THEN | ||
| 387 | $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Library Files. (",BUILDALL,",",STATE,")" | ||
| 388 | $ ELSE IF F$TYPE('APPS_MODULE') .NES. "" | ||
| 389 | $ THEN | ||
| 390 | $ WRITE SYS$OUTPUT "Compiling The ",MODULE_NAME1," Applications. (",BUILDALL,",",STATE,")" | ||
| 391 | $ ENDIF | ||
| 392 | $ ENDIF | ||
| 393 | $ ENDIF | ||
| 394 | $! | ||
| 395 | $! Define A File Counter And Set It To "0". | ||
| 396 | $! | ||
| 397 | $ FILE_COUNTER = 0 | ||
| 398 | $ APPLICATION = "" | ||
| 399 | $ APPLICATION_COUNTER = 0 | ||
| 400 | $! | ||
| 401 | $! Top Of The File Loop. | ||
| 402 | $! | ||
| 403 | $ NEXT_FILE: | ||
| 404 | $! | ||
| 405 | $! Look in the LIB_MODULE is we're in state LIB | ||
| 406 | $! | ||
| 407 | $ IF STATE .EQS. "LIB" | ||
| 408 | $ THEN | ||
| 409 | $! | ||
| 410 | $! O.K, Extract The File Name From The File List. | ||
| 411 | $! | ||
| 412 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_MODULE') | ||
| 413 | $! | ||
| 414 | $! else | ||
| 415 | $! | ||
| 416 | $ ELSE | ||
| 417 | $ FILE_NAME = "," | ||
| 418 | $! | ||
| 419 | $ IF F$TYPE('APPS_MODULE') .NES. "" | ||
| 420 | $ THEN | ||
| 421 | $! | ||
| 422 | $! Extract The File Name From The File List. | ||
| 423 | $! This part is a bit more complicated. | ||
| 424 | $! | ||
| 425 | $ IF APPLICATION .EQS. "" | ||
| 426 | $ THEN | ||
| 427 | $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE') | ||
| 428 | $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1 | ||
| 429 | $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION) | ||
| 430 | $ APPLICATION = F$ELEMENT(0,"/",APPLICATION) | ||
| 431 | $ FILE_COUNTER = 0 | ||
| 432 | $ ENDIF | ||
| 433 | $ | ||
| 434 | $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*" | ||
| 435 | $! SHOW SYMBOL APPLICATION* | ||
| 436 | $! | ||
| 437 | $ IF APPLICATION .NES. ";" | ||
| 438 | $ THEN | ||
| 439 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",APPLICATION_OBJECTS) | ||
| 440 | $ IF FILE_NAME .EQS. "," | ||
| 441 | $ THEN | ||
| 442 | $ APPLICATION = "" | ||
| 443 | $ GOTO NEXT_FILE | ||
| 444 | $ ENDIF | ||
| 445 | $ ENDIF | ||
| 446 | $ ENDIF | ||
| 447 | $ ENDIF | ||
| 448 | $! | ||
| 449 | $! Check To See If We Are At The End Of The File List. | ||
| 450 | $! | ||
| 451 | $ IF (FILE_NAME.EQS.",") | ||
| 452 | $ THEN | ||
| 453 | $! | ||
| 454 | $! We Are At The End Of The File List, Change State Or Goto FILE_DONE. | ||
| 455 | $! | ||
| 456 | $ IF STATE .EQS. "LIB" .AND. BUILDALL .NES. "LIBRARY" | ||
| 457 | $ THEN | ||
| 458 | $ STATE = "APPS" | ||
| 459 | $ GOTO MODULE_AGAIN | ||
| 460 | $ ELSE | ||
| 461 | $ GOTO FILE_DONE | ||
| 462 | $ ENDIF | ||
| 463 | $! | ||
| 464 | $! End The File List Check. | ||
| 465 | $! | ||
| 466 | $ ENDIF | ||
| 467 | $! | ||
| 468 | $! Increment The Counter. | ||
| 469 | $! | ||
| 470 | $ FILE_COUNTER = FILE_COUNTER + 1 | ||
| 471 | $! | ||
| 472 | $! Create The Source File Name. | ||
| 473 | $! | ||
| 474 | $ TMP_FILE_NAME = F$ELEMENT(1,"]",FILE_NAME) | ||
| 475 | $ IF TMP_FILE_NAME .EQS. "]" THEN TMP_FILE_NAME = FILE_NAME | ||
| 476 | $ IF F$ELEMENT(0,".",TMP_FILE_NAME) .EQS. TMP_FILE_NAME THEN - | ||
| 477 | FILE_NAME = FILE_NAME + ".c" | ||
| 478 | $ IF (MODULE_NAME.NES."") | ||
| 479 | $ THEN | ||
| 480 | $ SOURCE_FILE = "SYS$DISK:[." + MODULE_NAME+ "]" + FILE_NAME | ||
| 481 | $ ELSE | ||
| 482 | $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME | ||
| 483 | $ ENDIF | ||
| 484 | $ SOURCE_FILE = SOURCE_FILE - "][" | ||
| 485 | $! | ||
| 486 | $! Create The Object File Name. | ||
| 487 | $! | ||
| 488 | $ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ" | ||
| 489 | $ ON WARNING THEN GOTO NEXT_FILE | ||
| 490 | $! | ||
| 491 | $! Check To See If The File We Want To Compile Is Actually There. | ||
| 492 | $! | ||
| 493 | $ IF (F$SEARCH(SOURCE_FILE).EQS."") | ||
| 494 | $ THEN | ||
| 495 | $! | ||
| 496 | $! Tell The User That The File Doesn't Exist. | ||
| 497 | $! | ||
| 498 | $ WRITE SYS$OUTPUT "" | ||
| 499 | $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist." | ||
| 500 | $ WRITE SYS$OUTPUT "" | ||
| 501 | $! | ||
| 502 | $! Exit The Build. | ||
| 503 | $! | ||
| 504 | $ GOTO EXIT | ||
| 505 | $! | ||
| 506 | $! End The File Exist Check. | ||
| 507 | $! | ||
| 508 | $ ENDIF | ||
| 509 | $! | ||
| 510 | $! Tell The User We Are Compiling The File. | ||
| 511 | $! | ||
| 512 | $ IF (MODULE_NAME.EQS."") | ||
| 513 | $ THEN | ||
| 514 | $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME," File. (",BUILDALL,",",STATE,")" | ||
| 515 | $ ENDIF | ||
| 516 | $ IF (MODULE_NAME.NES."") | ||
| 517 | $ THEN | ||
| 518 | $ WRITE SYS$OUTPUT " ",FILE_NAME,"" | ||
| 519 | $ ENDIF | ||
| 520 | $! | ||
| 521 | $! Compile The File. | ||
| 522 | $! | ||
| 523 | $ ON ERROR THEN GOTO NEXT_FILE | ||
| 524 | $ FILE_NAME0 = F$ELEMENT(0,".",FILE_NAME) | ||
| 525 | $ IF FILE_NAME - ".mar" .NES. FILE_NAME | ||
| 526 | $ THEN | ||
| 527 | $ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 528 | $ ELSE | ||
| 529 | $ IF COMPILEWITH_CC3 - FILE_NAME0 .NES. COMPILEWITH_CC3 | ||
| 530 | $ THEN | ||
| 531 | $ CC3/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 532 | $ ELSE | ||
| 533 | $ IF COMPILEWITH_CC4 - FILE_NAME0 .NES. COMPILEWITH_CC4 | ||
| 534 | $ THEN | ||
| 535 | $ CC4/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 536 | $ ELSE | ||
| 537 | $ IF COMPILEWITH_CC5 - FILE_NAME0 .NES. COMPILEWITH_CC5 | ||
| 538 | $ THEN | ||
| 539 | $ CC5/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 540 | $ ELSE | ||
| 541 | $ IF COMPILEWITH_CC6 - FILE_NAME0 .NES. COMPILEWITH_CC6 | ||
| 542 | $ THEN | ||
| 543 | $ CC6/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 544 | $ ELSE | ||
| 545 | $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 546 | $ ENDIF | ||
| 547 | $ ENDIF | ||
| 548 | $ ENDIF | ||
| 549 | $ ENDIF | ||
| 550 | $ ENDIF | ||
| 551 | $ IF STATE .EQS. "LIB" | ||
| 552 | $ THEN | ||
| 553 | $! | ||
| 554 | $! Add It To The Library. | ||
| 555 | $! | ||
| 556 | $ LIBRARY/REPLACE 'LIB_NAME' 'OBJECT_FILE' | ||
| 557 | $! | ||
| 558 | $! Time To Clean Up The Object File. | ||
| 559 | $! | ||
| 560 | $ DELETE 'OBJECT_FILE';* | ||
| 561 | $ ENDIF | ||
| 562 | $! | ||
| 563 | $! Go Back And Do It Again. | ||
| 564 | $! | ||
| 565 | $ GOTO NEXT_FILE | ||
| 566 | $! | ||
| 567 | $! All Done With This Library Part. | ||
| 568 | $! | ||
| 569 | $ FILE_DONE: | ||
| 570 | $! | ||
| 571 | $! Time To Build Some Applications | ||
| 572 | $! | ||
| 573 | $ IF F$TYPE('APPS_MODULE') .NES. "" .AND. BUILDALL .NES. "LIBRARY" | ||
| 574 | $ THEN | ||
| 575 | $ APPLICATION_COUNTER = 0 | ||
| 576 | $ NEXT_APPLICATION: | ||
| 577 | $ APPLICATION = F$ELEMENT(APPLICATION_COUNTER,";",'APPS_MODULE') | ||
| 578 | $ IF APPLICATION .EQS. ";" THEN GOTO APPLICATION_DONE | ||
| 579 | $ | ||
| 580 | $ APPLICATION_COUNTER = APPLICATION_COUNTER + 1 | ||
| 581 | $ APPLICATION_OBJECTS = F$ELEMENT(1,"/",APPLICATION) | ||
| 582 | $ APPLICATION = F$ELEMENT(0,"/",APPLICATION) | ||
| 583 | $ | ||
| 584 | $! WRITE SYS$OUTPUT "DEBUG: SHOW SYMBOL APPLICATION*" | ||
| 585 | $! SHOW SYMBOL APPLICATION* | ||
| 586 | $! | ||
| 587 | $! Tell the user what happens | ||
| 588 | $! | ||
| 589 | $ WRITE SYS$OUTPUT " ",APPLICATION,".exe" | ||
| 590 | $! | ||
| 591 | $! Link The Program. | ||
| 592 | $! | ||
| 593 | $ ON ERROR THEN GOTO NEXT_APPLICATION | ||
| 594 | $! | ||
| 595 | $! Check To See If We Are To Link With A Specific TCP/IP Library. | ||
| 596 | $! | ||
| 597 | $ IF (TCPIP_LIB.NES."") | ||
| 598 | $ THEN | ||
| 599 | $! | ||
| 600 | $! Link With A TCP/IP Library. | ||
| 601 | $! | ||
| 602 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - | ||
| 603 | 'OBJ_DIR''APPLICATION_OBJECTS', - | ||
| 604 | 'CRYPTO_LIB'/LIBRARY, - | ||
| 605 | 'TCPIP_LIB','OPT_FILE'/OPTION | ||
| 606 | $! | ||
| 607 | $! Else... | ||
| 608 | $! | ||
| 609 | $ ELSE | ||
| 610 | $! | ||
| 611 | $! Don't Link With A TCP/IP Library. | ||
| 612 | $! | ||
| 613 | $ LINK/'DEBUGGER'/'TRACEBACK'/EXE='EXE_DIR''APPLICATION'.EXE - | ||
| 614 | 'OBJ_DIR''APPLICATION_OBJECTS',- | ||
| 615 | 'CRYPTO_LIB'/LIBRARY, - | ||
| 616 | 'OPT_FILE'/OPTION | ||
| 617 | $! | ||
| 618 | $! End The TCP/IP Library Check. | ||
| 619 | $! | ||
| 620 | $ ENDIF | ||
| 621 | $ GOTO NEXT_APPLICATION | ||
| 622 | $ APPLICATION_DONE: | ||
| 623 | $ ENDIF | ||
| 624 | $! | ||
| 625 | $! Go Back And Get The Next Module. | ||
| 626 | $! | ||
| 627 | $ GOTO MODULE_NEXT | ||
| 628 | $! | ||
| 629 | $! All Done With This Module. | ||
| 630 | $! | ||
| 631 | $ MODULE_DONE: | ||
| 632 | $! | ||
| 633 | $! Tell The User That We Are All Done. | ||
| 634 | $! | ||
| 635 | $ WRITE SYS$OUTPUT "All Done..." | ||
| 636 | $ EXIT: | ||
| 637 | $ GOSUB CLEANUP | ||
| 638 | $ EXIT | ||
| 639 | $! | ||
| 640 | $! Check For The Link Option FIle. | ||
| 641 | $! | ||
| 642 | $ CHECK_OPT_FILE: | ||
| 643 | $! | ||
| 644 | $! Check To See If We Need To Make A VAX C Option File. | ||
| 645 | $! | ||
| 646 | $ IF (COMPILER.EQS."VAXC") | ||
| 647 | $ THEN | ||
| 648 | $! | ||
| 649 | $! Check To See If We Already Have A VAX C Linker Option File. | ||
| 650 | $! | ||
| 651 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
| 652 | $ THEN | ||
| 653 | $! | ||
| 654 | $! We Need A VAX C Linker Option File. | ||
| 655 | $! | ||
| 656 | $ CREATE 'OPT_FILE' | ||
| 657 | $DECK | ||
| 658 | ! | ||
| 659 | ! Default System Options File To Link Agianst | ||
| 660 | ! The Sharable VAX C Runtime Library. | ||
| 661 | ! | ||
| 662 | SYS$SHARE:VAXCRTL.EXE/SHARE | ||
| 663 | $EOD | ||
| 664 | $! | ||
| 665 | $! End The Option File Check. | ||
| 666 | $! | ||
| 667 | $ ENDIF | ||
| 668 | $! | ||
| 669 | $! End The VAXC Check. | ||
| 670 | $! | ||
| 671 | $ ENDIF | ||
| 672 | $! | ||
| 673 | $! Check To See If We Need A GNU C Option File. | ||
| 674 | $! | ||
| 675 | $ IF (COMPILER.EQS."GNUC") | ||
| 676 | $ THEN | ||
| 677 | $! | ||
| 678 | $! Check To See If We Already Have A GNU C Linker Option File. | ||
| 679 | $! | ||
| 680 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
| 681 | $ THEN | ||
| 682 | $! | ||
| 683 | $! We Need A GNU C Linker Option File. | ||
| 684 | $! | ||
| 685 | $ CREATE 'OPT_FILE' | ||
| 686 | $DECK | ||
| 687 | ! | ||
| 688 | ! Default System Options File To Link Agianst | ||
| 689 | ! The Sharable C Runtime Library. | ||
| 690 | ! | ||
| 691 | GNU_CC:[000000]GCCLIB/LIBRARY | ||
| 692 | SYS$SHARE:VAXCRTL/SHARE | ||
| 693 | $EOD | ||
| 694 | $! | ||
| 695 | $! End The Option File Check. | ||
| 696 | $! | ||
| 697 | $ ENDIF | ||
| 698 | $! | ||
| 699 | $! End The GNU C Check. | ||
| 700 | $! | ||
| 701 | $ ENDIF | ||
| 702 | $! | ||
| 703 | $! Check To See If We Need A DEC C Option File. | ||
| 704 | $! | ||
| 705 | $ IF (COMPILER.EQS."DECC") | ||
| 706 | $ THEN | ||
| 707 | $! | ||
| 708 | $! Check To See If We Already Have A DEC C Linker Option File. | ||
| 709 | $! | ||
| 710 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
| 711 | $ THEN | ||
| 712 | $! | ||
| 713 | $! Figure Out If We Need A non-VAX Or A VAX Linker Option File. | ||
| 714 | $! | ||
| 715 | $ IF ARCH .EQS. "VAX" | ||
| 716 | $ THEN | ||
| 717 | $! | ||
| 718 | $! We Need A DEC C Linker Option File For VAX. | ||
| 719 | $! | ||
| 720 | $ CREATE 'OPT_FILE' | ||
| 721 | $DECK | ||
| 722 | ! | ||
| 723 | ! Default System Options File To Link Agianst | ||
| 724 | ! The Sharable DEC C Runtime Library. | ||
| 725 | ! | ||
| 726 | SYS$SHARE:DECC$SHR.EXE/SHARE | ||
| 727 | $EOD | ||
| 728 | $! | ||
| 729 | $! Else... | ||
| 730 | $! | ||
| 731 | $ ELSE | ||
| 732 | $! | ||
| 733 | $! Create The non-VAX Linker Option File. | ||
| 734 | $! | ||
| 735 | $ CREATE 'OPT_FILE' | ||
| 736 | $DECK | ||
| 737 | ! | ||
| 738 | ! Default System Options File For non-VAX To Link Agianst | ||
| 739 | ! The Sharable C Runtime Library. | ||
| 740 | ! | ||
| 741 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | ||
| 742 | SYS$SHARE:CMA$OPEN_RTL/SHARE | ||
| 743 | $EOD | ||
| 744 | $! | ||
| 745 | $! End The DEC C Option File Check. | ||
| 746 | $! | ||
| 747 | $ ENDIF | ||
| 748 | $! | ||
| 749 | $! End The Option File Search. | ||
| 750 | $! | ||
| 751 | $ ENDIF | ||
| 752 | $! | ||
| 753 | $! End The DEC C Check. | ||
| 754 | $! | ||
| 755 | $ ENDIF | ||
| 756 | $! | ||
| 757 | $! Tell The User What Linker Option File We Are Using. | ||
| 758 | $! | ||
| 759 | $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"." | ||
| 760 | $! | ||
| 761 | $! Time To RETURN. | ||
| 762 | $! | ||
| 763 | $ RETURN | ||
| 764 | $! | ||
| 765 | $! Check The User's Options. | ||
| 766 | $! | ||
| 767 | $ CHECK_OPTIONS: | ||
| 768 | $! | ||
| 769 | $! Check To See If P1 Is Blank. | ||
| 770 | $! | ||
| 771 | $ IF (P1.EQS."ALL") | ||
| 772 | $ THEN | ||
| 773 | $! | ||
| 774 | $! P1 Is Blank, So Build Everything. | ||
| 775 | $! | ||
| 776 | $ BUILDALL = "TRUE" | ||
| 777 | $! | ||
| 778 | $! Else... | ||
| 779 | $! | ||
| 780 | $ ELSE | ||
| 781 | $! | ||
| 782 | $! Else, Check To See If P1 Has A Valid Argument. | ||
| 783 | $! | ||
| 784 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."APPS") | ||
| 785 | $ THEN | ||
| 786 | $! | ||
| 787 | $! A Valid Argument. | ||
| 788 | $! | ||
| 789 | $ BUILDALL = P1 | ||
| 790 | $! | ||
| 791 | $! Else... | ||
| 792 | $! | ||
| 793 | $ ELSE | ||
| 794 | $! | ||
| 795 | $! Tell The User We Don't Know What They Want. | ||
| 796 | $! | ||
| 797 | $ WRITE SYS$OUTPUT "" | ||
| 798 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | ||
| 799 | $ WRITE SYS$OUTPUT "" | ||
| 800 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." | ||
| 801 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library." | ||
| 802 | $ WRITE SYS$OUTPUT " APPS : To Compile Just The [.xxx.EXE.CRYPTO]*.EXE Programs." | ||
| 803 | $ WRITE SYS$OUTPUT "" | ||
| 804 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For:" | ||
| 805 | $ WRITE SYS$OUTPUT "" | ||
| 806 | $ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture." | ||
| 807 | $ WRITE SYS$OUTPUT " IA64 : IA64 Architecture." | ||
| 808 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
| 809 | $ WRITE SYS$OUTPUT "" | ||
| 810 | $! | ||
| 811 | $! Time To EXIT. | ||
| 812 | $! | ||
| 813 | $ EXIT | ||
| 814 | $! | ||
| 815 | $! End The Valid Argument Check. | ||
| 816 | $! | ||
| 817 | $ ENDIF | ||
| 818 | $! | ||
| 819 | $! End The P1 Check. | ||
| 820 | $! | ||
| 821 | $ ENDIF | ||
| 822 | $! | ||
| 823 | $! Check To See If P2 Is Blank. | ||
| 824 | $! | ||
| 825 | $ IF (P2.EQS."NODEBUG") | ||
| 826 | $ THEN | ||
| 827 | $! | ||
| 828 | $! P2 Is NODEBUG, So Compile Without The Debugger Information. | ||
| 829 | $! | ||
| 830 | $ DEBUGGER = "NODEBUG" | ||
| 831 | $ TRACEBACK = "NOTRACEBACK" | ||
| 832 | $ GCC_OPTIMIZE = "OPTIMIZE" | ||
| 833 | $ CC_OPTIMIZE = "OPTIMIZE" | ||
| 834 | $ MACRO_OPTIMIZE = "OPTIMIZE" | ||
| 835 | $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." | ||
| 836 | $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." | ||
| 837 | $ ELSE | ||
| 838 | $! | ||
| 839 | $! Check To See If We Are To Compile With Debugger Information. | ||
| 840 | $! | ||
| 841 | $ IF (P2.EQS."DEBUG") | ||
| 842 | $ THEN | ||
| 843 | $! | ||
| 844 | $! Compile With Debugger Information. | ||
| 845 | $! | ||
| 846 | $ DEBUGGER = "DEBUG" | ||
| 847 | $ TRACEBACK = "TRACEBACK" | ||
| 848 | $ GCC_OPTIMIZE = "NOOPTIMIZE" | ||
| 849 | $ CC_OPTIMIZE = "NOOPTIMIZE" | ||
| 850 | $ MACRO_OPTIMIZE = "NOOPTIMIZE" | ||
| 851 | $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." | ||
| 852 | $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." | ||
| 853 | $ ELSE | ||
| 854 | $! | ||
| 855 | $! They Entered An Invalid Option.. | ||
| 856 | $! | ||
| 857 | $ WRITE SYS$OUTPUT "" | ||
| 858 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" | ||
| 859 | $ WRITE SYS$OUTPUT "" | ||
| 860 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." | ||
| 861 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." | ||
| 862 | $ WRITE SYS$OUTPUT "" | ||
| 863 | $! | ||
| 864 | $! Time To EXIT. | ||
| 865 | $! | ||
| 866 | $ EXIT | ||
| 867 | $! | ||
| 868 | $! End The Valid Argument Check. | ||
| 869 | $! | ||
| 870 | $ ENDIF | ||
| 871 | $! | ||
| 872 | $! End The P2 Check. | ||
| 873 | $! | ||
| 874 | $ ENDIF | ||
| 875 | $! | ||
| 876 | $! Special Threads For OpenVMS v7.1 Or Later | ||
| 877 | $! | ||
| 878 | $! Written By: Richard Levitte | ||
| 879 | $! richard@levitte.org | ||
| 880 | $! | ||
| 881 | $! | ||
| 882 | $! Check To See If We Have A Option For P5. | ||
| 883 | $! | ||
| 884 | $ IF (P5.EQS."") | ||
| 885 | $ THEN | ||
| 886 | $! | ||
| 887 | $! Get The Version Of VMS We Are Using. | ||
| 888 | $! | ||
| 889 | $ ISSEVEN := | ||
| 890 | $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION"))) | ||
| 891 | $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP)) | ||
| 892 | $! | ||
| 893 | $! Check To See If The VMS Version Is v7.1 Or Later. | ||
| 894 | $! | ||
| 895 | $ IF (TMP.GE.71) | ||
| 896 | $ THEN | ||
| 897 | $! | ||
| 898 | $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads. | ||
| 899 | $! | ||
| 900 | $ ISSEVEN := ,PTHREAD_USE_D4 | ||
| 901 | $! | ||
| 902 | $! End The VMS Version Check. | ||
| 903 | $! | ||
| 904 | $ ENDIF | ||
| 905 | $! | ||
| 906 | $! End The P5 Check. | ||
| 907 | $! | ||
| 908 | $ ENDIF | ||
| 909 | $! | ||
| 910 | $! Check To See If P3 Is Blank. | ||
| 911 | $! | ||
| 912 | $ IF (P3.EQS."") | ||
| 913 | $ THEN | ||
| 914 | $! | ||
| 915 | $! O.K., The User Didn't Specify A Compiler, Let's Try To | ||
| 916 | $! Find Out Which One To Use. | ||
| 917 | $! | ||
| 918 | $! Check To See If We Have GNU C. | ||
| 919 | $! | ||
| 920 | $ IF (F$TRNLNM("GNU_CC").NES."") | ||
| 921 | $ THEN | ||
| 922 | $! | ||
| 923 | $! Looks Like GNUC, Set To Use GNUC. | ||
| 924 | $! | ||
| 925 | $ P3 = "GNUC" | ||
| 926 | $! | ||
| 927 | $! Else... | ||
| 928 | $! | ||
| 929 | $ ELSE | ||
| 930 | $! | ||
| 931 | $! Check To See If We Have VAXC Or DECC. | ||
| 932 | $! | ||
| 933 | $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | ||
| 934 | $ THEN | ||
| 935 | $! | ||
| 936 | $! Looks Like DECC, Set To Use DECC. | ||
| 937 | $! | ||
| 938 | $ P3 = "DECC" | ||
| 939 | $! | ||
| 940 | $! Else... | ||
| 941 | $! | ||
| 942 | $ ELSE | ||
| 943 | $! | ||
| 944 | $! Looks Like VAXC, Set To Use VAXC. | ||
| 945 | $! | ||
| 946 | $ P3 = "VAXC" | ||
| 947 | $! | ||
| 948 | $! End The VAXC Compiler Check. | ||
| 949 | $! | ||
| 950 | $ ENDIF | ||
| 951 | $! | ||
| 952 | $! End The DECC & VAXC Compiler Check. | ||
| 953 | $! | ||
| 954 | $ ENDIF | ||
| 955 | $! | ||
| 956 | $! End The Compiler Check. | ||
| 957 | $! | ||
| 958 | $ ENDIF | ||
| 959 | $! | ||
| 960 | $! Check To See If We Have A Option For P4. | ||
| 961 | $! | ||
| 962 | $ IF (P4.EQS."") | ||
| 963 | $ THEN | ||
| 964 | $! | ||
| 965 | $! Find out what socket library we have available | ||
| 966 | $! | ||
| 967 | $ IF F$PARSE("SOCKETSHR:") .NES. "" | ||
| 968 | $ THEN | ||
| 969 | $! | ||
| 970 | $! We have SOCKETSHR, and it is my opinion that it's the best to use. | ||
| 971 | $! | ||
| 972 | $ P4 = "SOCKETSHR" | ||
| 973 | $! | ||
| 974 | $! Tell the user | ||
| 975 | $! | ||
| 976 | $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP" | ||
| 977 | $! | ||
| 978 | $! Else, let's look for something else | ||
| 979 | $! | ||
| 980 | $ ELSE | ||
| 981 | $! | ||
| 982 | $! Like UCX (the reason to do this before Multinet is that the UCX | ||
| 983 | $! emulation is easier to use...) | ||
| 984 | $! | ||
| 985 | $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" - | ||
| 986 | .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" - | ||
| 987 | .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. "" | ||
| 988 | $ THEN | ||
| 989 | $! | ||
| 990 | $! Last resort: a UCX or UCX-compatible library | ||
| 991 | $! | ||
| 992 | $ P4 = "UCX" | ||
| 993 | $! | ||
| 994 | $! Tell the user | ||
| 995 | $! | ||
| 996 | $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP" | ||
| 997 | $! | ||
| 998 | $! That was all... | ||
| 999 | $! | ||
| 1000 | $ ENDIF | ||
| 1001 | $ ENDIF | ||
| 1002 | $ ENDIF | ||
| 1003 | $! | ||
| 1004 | $! Set Up Initial CC Definitions, Possibly With User Ones | ||
| 1005 | $! | ||
| 1006 | $ CCDEFS = "TCPIP_TYPE_''P4',DSO_VMS" | ||
| 1007 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS | ||
| 1008 | $ CCEXTRAFLAGS = "" | ||
| 1009 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | ||
| 1010 | $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR" | ||
| 1011 | $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - | ||
| 1012 | CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS | ||
| 1013 | $! | ||
| 1014 | $! Check To See If The User Entered A Valid Paramter. | ||
| 1015 | $! | ||
| 1016 | $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC") | ||
| 1017 | $ THEN | ||
| 1018 | $! | ||
| 1019 | $! Check To See If The User Wanted DECC. | ||
| 1020 | $! | ||
| 1021 | $ IF (P3.EQS."DECC") | ||
| 1022 | $ THEN | ||
| 1023 | $! | ||
| 1024 | $! Looks Like DECC, Set To Use DECC. | ||
| 1025 | $! | ||
| 1026 | $ COMPILER = "DECC" | ||
| 1027 | $! | ||
| 1028 | $! Tell The User We Are Using DECC. | ||
| 1029 | $! | ||
| 1030 | $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler." | ||
| 1031 | $! | ||
| 1032 | $! Use DECC... | ||
| 1033 | $! | ||
| 1034 | $ CC = "CC" | ||
| 1035 | $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | ||
| 1036 | THEN CC = "CC/DECC" | ||
| 1037 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | ||
| 1038 | "/NOLIST/PREFIX=ALL" + - | ||
| 1039 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + - | ||
| 1040 | CCEXTRAFLAGS | ||
| 1041 | $! | ||
| 1042 | $! Define The Linker Options File Name. | ||
| 1043 | $! | ||
| 1044 | $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" | ||
| 1045 | $! | ||
| 1046 | $! End DECC Check. | ||
| 1047 | $! | ||
| 1048 | $ ENDIF | ||
| 1049 | $! | ||
| 1050 | $! Check To See If We Are To Use VAXC. | ||
| 1051 | $! | ||
| 1052 | $ IF (P3.EQS."VAXC") | ||
| 1053 | $ THEN | ||
| 1054 | $! | ||
| 1055 | $! Looks Like VAXC, Set To Use VAXC. | ||
| 1056 | $! | ||
| 1057 | $ COMPILER = "VAXC" | ||
| 1058 | $! | ||
| 1059 | $! Tell The User We Are Using VAX C. | ||
| 1060 | $! | ||
| 1061 | $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler." | ||
| 1062 | $! | ||
| 1063 | $! Compile Using VAXC. | ||
| 1064 | $! | ||
| 1065 | $ CC = "CC" | ||
| 1066 | $ IF ARCH.NES."VAX" | ||
| 1067 | $ THEN | ||
| 1068 | $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!" | ||
| 1069 | $ EXIT | ||
| 1070 | $ ENDIF | ||
| 1071 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | ||
| 1072 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | ||
| 1073 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + - | ||
| 1074 | CCEXTRAFLAGS | ||
| 1075 | $ CCDEFS = """VAXC""," + CCDEFS | ||
| 1076 | $! | ||
| 1077 | $! Define <sys> As SYS$COMMON:[SYSLIB] | ||
| 1078 | $! | ||
| 1079 | $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | ||
| 1080 | $! | ||
| 1081 | $! Define The Linker Options File Name. | ||
| 1082 | $! | ||
| 1083 | $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" | ||
| 1084 | $! | ||
| 1085 | $! End VAXC Check | ||
| 1086 | $! | ||
| 1087 | $ ENDIF | ||
| 1088 | $! | ||
| 1089 | $! Check To See If We Are To Use GNU C. | ||
| 1090 | $! | ||
| 1091 | $ IF (P3.EQS."GNUC") | ||
| 1092 | $ THEN | ||
| 1093 | $! | ||
| 1094 | $! Looks Like GNUC, Set To Use GNUC. | ||
| 1095 | $! | ||
| 1096 | $ COMPILER = "GNUC" | ||
| 1097 | $! | ||
| 1098 | $! Tell The User We Are Using GNUC. | ||
| 1099 | $! | ||
| 1100 | $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler." | ||
| 1101 | $! | ||
| 1102 | $! Use GNU C... | ||
| 1103 | $! | ||
| 1104 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - | ||
| 1105 | "/INCLUDE=(SYS$DISK:[],SYS$DISK:[._''ARCH'],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS],SYS$DISK:[.EVP],SYS$DISK:[.ASN1])" + - | ||
| 1106 | CCEXTRAFLAGS | ||
| 1107 | $! | ||
| 1108 | $! Define The Linker Options File Name. | ||
| 1109 | $! | ||
| 1110 | $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" | ||
| 1111 | $! | ||
| 1112 | $! End The GNU C Check. | ||
| 1113 | $! | ||
| 1114 | $ ENDIF | ||
| 1115 | $! | ||
| 1116 | $! Set up default defines | ||
| 1117 | $! | ||
| 1118 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS | ||
| 1119 | $! | ||
| 1120 | $! Finish up the definition of CC. | ||
| 1121 | $! | ||
| 1122 | $ IF COMPILER .EQS. "DECC" | ||
| 1123 | $ THEN | ||
| 1124 | $ IF CCDISABLEWARNINGS .EQS. "" | ||
| 1125 | $ THEN | ||
| 1126 | $ CC4DISABLEWARNINGS = "DOLLARID" | ||
| 1127 | $ CC6DISABLEWARNINGS = "MIXLINKAGE" | ||
| 1128 | $ ELSE | ||
| 1129 | $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID" | ||
| 1130 | $ CC6DISABLEWARNINGS = CCDISABLEWARNINGS + ",MIXLINKAGE" | ||
| 1131 | $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" | ||
| 1132 | $ ENDIF | ||
| 1133 | $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))" | ||
| 1134 | $ CC6DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC6DISABLEWARNINGS + "))" | ||
| 1135 | $ ELSE | ||
| 1136 | $ CCDISABLEWARNINGS = "" | ||
| 1137 | $ CC4DISABLEWARNINGS = "" | ||
| 1138 | $ CC6DISABLEWARNINGS = "" | ||
| 1139 | $ ENDIF | ||
| 1140 | $ CC3 = CC + "/DEFINE=(" + CCDEFS + ISSEVEN + ")" + CCDISABLEWARNINGS | ||
| 1141 | $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS | ||
| 1142 | $ IF ARCH .EQS. "VAX" .AND. COMPILER .EQS. "DECC" .AND. P2 .NES. "DEBUG" | ||
| 1143 | $ THEN | ||
| 1144 | $ CC5 = CC + "/OPTIMIZE=NODISJOINT" | ||
| 1145 | $ ELSE | ||
| 1146 | $ CC5 = CC + "/NOOPTIMIZE" | ||
| 1147 | $ ENDIF | ||
| 1148 | $ CC4 = CC - CCDISABLEWARNINGS + CC4DISABLEWARNINGS | ||
| 1149 | $ CC6 = CC - CCDISABLEWARNINGS + CC6DISABLEWARNINGS | ||
| 1150 | $! | ||
| 1151 | $! Show user the result | ||
| 1152 | $! | ||
| 1153 | $ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC | ||
| 1154 | $! | ||
| 1155 | $! Else The User Entered An Invalid Argument. | ||
| 1156 | $! | ||
| 1157 | $ ELSE | ||
| 1158 | $! | ||
| 1159 | $! Tell The User We Don't Know What They Want. | ||
| 1160 | $! | ||
| 1161 | $ WRITE SYS$OUTPUT "" | ||
| 1162 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" | ||
| 1163 | $ WRITE SYS$OUTPUT "" | ||
| 1164 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." | ||
| 1165 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." | ||
| 1166 | $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C." | ||
| 1167 | $ WRITE SYS$OUTPUT "" | ||
| 1168 | $! | ||
| 1169 | $! Time To EXIT. | ||
| 1170 | $! | ||
| 1171 | $ EXIT | ||
| 1172 | $! | ||
| 1173 | $! End The Valid Argument Check. | ||
| 1174 | $! | ||
| 1175 | $ ENDIF | ||
| 1176 | $! | ||
| 1177 | $! Build a MACRO command for the architecture at hand | ||
| 1178 | $! | ||
| 1179 | $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'" | ||
| 1180 | $ IF ARCH .NES. "VAX" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'" | ||
| 1181 | $! | ||
| 1182 | $! Show user the result | ||
| 1183 | $! | ||
| 1184 | $ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO | ||
| 1185 | $! | ||
| 1186 | $! Time to check the contents, and to make sure we get the correct library. | ||
| 1187 | $! | ||
| 1188 | $ IF P4.EQS."SOCKETSHR" .OR. P4.EQS."MULTINET" .OR. P4.EQS."UCX" - | ||
| 1189 | .OR. P4.EQS."TCPIP" .OR. P4.EQS."NONE" | ||
| 1190 | $ THEN | ||
| 1191 | $! | ||
| 1192 | $! Check to see if SOCKETSHR was chosen | ||
| 1193 | $! | ||
| 1194 | $ IF P4.EQS."SOCKETSHR" | ||
| 1195 | $ THEN | ||
| 1196 | $! | ||
| 1197 | $! Set the library to use SOCKETSHR | ||
| 1198 | $! | ||
| 1199 | $ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT" | ||
| 1200 | $! | ||
| 1201 | $! Done with SOCKETSHR | ||
| 1202 | $! | ||
| 1203 | $ ENDIF | ||
| 1204 | $! | ||
| 1205 | $! Check to see if MULTINET was chosen | ||
| 1206 | $! | ||
| 1207 | $ IF P4.EQS."MULTINET" | ||
| 1208 | $ THEN | ||
| 1209 | $! | ||
| 1210 | $! Set the library to use UCX emulation. | ||
| 1211 | $! | ||
| 1212 | $ P4 = "UCX" | ||
| 1213 | $! | ||
| 1214 | $! Done with MULTINET | ||
| 1215 | $! | ||
| 1216 | $ ENDIF | ||
| 1217 | $! | ||
| 1218 | $! Check to see if UCX was chosen | ||
| 1219 | $! | ||
| 1220 | $ IF P4.EQS."UCX" | ||
| 1221 | $ THEN | ||
| 1222 | $! | ||
| 1223 | $! Set the library to use UCX. | ||
| 1224 | $! | ||
| 1225 | $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT" | ||
| 1226 | $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" | ||
| 1227 | $ THEN | ||
| 1228 | $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT" | ||
| 1229 | $ ELSE | ||
| 1230 | $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN - | ||
| 1231 | TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT" | ||
| 1232 | $ ENDIF | ||
| 1233 | $! | ||
| 1234 | $! Done with UCX | ||
| 1235 | $! | ||
| 1236 | $ ENDIF | ||
| 1237 | $! | ||
| 1238 | $! Check to see if TCPIP was chosen | ||
| 1239 | $! | ||
| 1240 | $ IF P4.EQS."TCPIP" | ||
| 1241 | $ THEN | ||
| 1242 | $! | ||
| 1243 | $! Set the library to use TCPIP (post UCX). | ||
| 1244 | $! | ||
| 1245 | $ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT" | ||
| 1246 | $! | ||
| 1247 | $! Done with TCPIP | ||
| 1248 | $! | ||
| 1249 | $ ENDIF | ||
| 1250 | $! | ||
| 1251 | $! Check to see if NONE was chosen | ||
| 1252 | $! | ||
| 1253 | $ IF P4.EQS."NONE" | ||
| 1254 | $ THEN | ||
| 1255 | $! | ||
| 1256 | $! Do not use a TCPIP library. | ||
| 1257 | $! | ||
| 1258 | $ TCPIP_LIB = "" | ||
| 1259 | $! | ||
| 1260 | $! Done with TCPIP | ||
| 1261 | $! | ||
| 1262 | $ ENDIF | ||
| 1263 | $! | ||
| 1264 | $! Print info | ||
| 1265 | $! | ||
| 1266 | $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB | ||
| 1267 | $! | ||
| 1268 | $! Else The User Entered An Invalid Argument. | ||
| 1269 | $! | ||
| 1270 | $ ELSE | ||
| 1271 | $! | ||
| 1272 | $! Tell The User We Don't Know What They Want. | ||
| 1273 | $! | ||
| 1274 | $ WRITE SYS$OUTPUT "" | ||
| 1275 | $ WRITE SYS$OUTPUT "The Option ",P4," Is Invalid. The Valid Options Are:" | ||
| 1276 | $ WRITE SYS$OUTPUT "" | ||
| 1277 | $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library." | ||
| 1278 | $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library." | ||
| 1279 | $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library." | ||
| 1280 | $ WRITE SYS$OUTPUT "" | ||
| 1281 | $! | ||
| 1282 | $! Time To EXIT. | ||
| 1283 | $! | ||
| 1284 | $ EXIT | ||
| 1285 | $! | ||
| 1286 | $! Done with TCP/IP libraries | ||
| 1287 | $! | ||
| 1288 | $ ENDIF | ||
| 1289 | $! | ||
| 1290 | $! Check if the user wanted to compile just a subset of all the encryption | ||
| 1291 | $! methods. | ||
| 1292 | $! | ||
| 1293 | $ IF P6 .NES. "" | ||
| 1294 | $ THEN | ||
| 1295 | $ ENCRYPT_TYPES = P6 | ||
| 1296 | $ ENDIF | ||
| 1297 | $! | ||
| 1298 | $! Time To RETURN... | ||
| 1299 | $! | ||
| 1300 | $ RETURN | ||
| 1301 | $! | ||
| 1302 | $ INITIALISE: | ||
| 1303 | $! | ||
| 1304 | $! Save old value of the logical name OPENSSL | ||
| 1305 | $! | ||
| 1306 | $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE") | ||
| 1307 | $! | ||
| 1308 | $! Save directory information | ||
| 1309 | $! | ||
| 1310 | $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;" | ||
| 1311 | $ __HERE = F$EDIT(__HERE,"UPCASE") | ||
| 1312 | $ __TOP = __HERE - "CRYPTO]" | ||
| 1313 | $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]" | ||
| 1314 | $! | ||
| 1315 | $! Set up the logical name OPENSSL to point at the include directory | ||
| 1316 | $! | ||
| 1317 | $ DEFINE OPENSSL/NOLOG '__INCLUDE' | ||
| 1318 | $! | ||
| 1319 | $! Done | ||
| 1320 | $! | ||
| 1321 | $ RETURN | ||
| 1322 | $! | ||
| 1323 | $ CLEANUP: | ||
| 1324 | $! | ||
| 1325 | $! Restore the logical name OPENSSL if it had a value | ||
| 1326 | $! | ||
| 1327 | $ IF __SAVE_OPENSSL .EQS. "" | ||
| 1328 | $ THEN | ||
| 1329 | $ DEASSIGN OPENSSL | ||
| 1330 | $ ELSE | ||
| 1331 | $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL' | ||
| 1332 | $ ENDIF | ||
| 1333 | $! | ||
| 1334 | $! Done | ||
| 1335 | $! | ||
| 1336 | $ RETURN | ||
diff --git a/src/lib/libcrypto/des/DES.pm b/src/lib/libcrypto/des/DES.pm new file mode 100644 index 0000000000..6a175b6ca4 --- /dev/null +++ b/src/lib/libcrypto/des/DES.pm | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | package DES; | ||
| 2 | |||
| 3 | require Exporter; | ||
| 4 | require DynaLoader; | ||
| 5 | @ISA = qw(Exporter DynaLoader); | ||
| 6 | # Items to export into callers namespace by default | ||
| 7 | # (move infrequently used names to @EXPORT_OK below) | ||
| 8 | @EXPORT = qw( | ||
| 9 | ); | ||
| 10 | # Other items we are prepared to export if requested | ||
| 11 | @EXPORT_OK = qw( | ||
| 12 | crypt | ||
| 13 | ); | ||
| 14 | |||
| 15 | # Preloaded methods go here. Autoload methods go after __END__, and are | ||
| 16 | # processed by the autosplit program. | ||
| 17 | bootstrap DES; | ||
| 18 | 1; | ||
| 19 | __END__ | ||
diff --git a/src/lib/libcrypto/des/DES.xs b/src/lib/libcrypto/des/DES.xs new file mode 100644 index 0000000000..b8050b9edf --- /dev/null +++ b/src/lib/libcrypto/des/DES.xs | |||
| @@ -0,0 +1,268 @@ | |||
| 1 | #include "EXTERN.h" | ||
| 2 | #include "perl.h" | ||
| 3 | #include "XSUB.h" | ||
| 4 | #include "des.h" | ||
| 5 | |||
| 6 | #define deschar char | ||
| 7 | static STRLEN len; | ||
| 8 | |||
| 9 | static int | ||
| 10 | not_here(s) | ||
| 11 | char *s; | ||
| 12 | { | ||
| 13 | croak("%s not implemented on this architecture", s); | ||
| 14 | return -1; | ||
| 15 | } | ||
| 16 | |||
| 17 | MODULE = DES PACKAGE = DES PREFIX = des_ | ||
| 18 | |||
| 19 | char * | ||
| 20 | des_crypt(buf,salt) | ||
| 21 | char * buf | ||
| 22 | char * salt | ||
| 23 | |||
| 24 | void | ||
| 25 | des_set_odd_parity(key) | ||
| 26 | des_cblock * key | ||
| 27 | PPCODE: | ||
| 28 | { | ||
| 29 | SV *s; | ||
| 30 | |||
| 31 | s=sv_newmortal(); | ||
| 32 | sv_setpvn(s,(char *)key,8); | ||
| 33 | des_set_odd_parity((des_cblock *)SvPV(s,na)); | ||
| 34 | PUSHs(s); | ||
| 35 | } | ||
| 36 | |||
| 37 | int | ||
| 38 | des_is_weak_key(key) | ||
| 39 | des_cblock * key | ||
| 40 | |||
| 41 | des_key_schedule | ||
| 42 | des_set_key(key) | ||
| 43 | des_cblock * key | ||
| 44 | CODE: | ||
| 45 | des_set_key(key,RETVAL); | ||
| 46 | OUTPUT: | ||
| 47 | RETVAL | ||
| 48 | |||
| 49 | des_cblock | ||
| 50 | des_ecb_encrypt(input,ks,encrypt) | ||
| 51 | des_cblock * input | ||
| 52 | des_key_schedule * ks | ||
| 53 | int encrypt | ||
| 54 | CODE: | ||
| 55 | des_ecb_encrypt(input,&RETVAL,*ks,encrypt); | ||
| 56 | OUTPUT: | ||
| 57 | RETVAL | ||
| 58 | |||
| 59 | void | ||
| 60 | des_cbc_encrypt(input,ks,ivec,encrypt) | ||
| 61 | char * input | ||
| 62 | des_key_schedule * ks | ||
| 63 | des_cblock * ivec | ||
| 64 | int encrypt | ||
| 65 | PPCODE: | ||
| 66 | { | ||
| 67 | SV *s; | ||
| 68 | STRLEN len,l; | ||
| 69 | char *c; | ||
| 70 | |||
| 71 | l=SvCUR(ST(0)); | ||
| 72 | len=((((unsigned long)l)+7)/8)*8; | ||
| 73 | s=sv_newmortal(); | ||
| 74 | sv_setpvn(s,"",0); | ||
| 75 | SvGROW(s,len); | ||
| 76 | SvCUR_set(s,len); | ||
| 77 | c=(char *)SvPV(s,na); | ||
| 78 | des_cbc_encrypt((des_cblock *)input,(des_cblock *)c, | ||
| 79 | l,*ks,ivec,encrypt); | ||
| 80 | sv_setpvn(ST(2),(char *)c[len-8],8); | ||
| 81 | PUSHs(s); | ||
| 82 | } | ||
| 83 | |||
| 84 | void | ||
| 85 | des_cbc3_encrypt(input,ks1,ks2,ivec1,ivec2,encrypt) | ||
| 86 | char * input | ||
| 87 | des_key_schedule * ks1 | ||
| 88 | des_key_schedule * ks2 | ||
| 89 | des_cblock * ivec1 | ||
| 90 | des_cblock * ivec2 | ||
| 91 | int encrypt | ||
| 92 | PPCODE: | ||
| 93 | { | ||
| 94 | SV *s; | ||
| 95 | STRLEN len,l; | ||
| 96 | |||
| 97 | l=SvCUR(ST(0)); | ||
| 98 | len=((((unsigned long)l)+7)/8)*8; | ||
| 99 | s=sv_newmortal(); | ||
| 100 | sv_setpvn(s,"",0); | ||
| 101 | SvGROW(s,len); | ||
| 102 | SvCUR_set(s,len); | ||
| 103 | des_3cbc_encrypt((des_cblock *)input,(des_cblock *)SvPV(s,na), | ||
| 104 | l,*ks1,*ks2,ivec1,ivec2,encrypt); | ||
| 105 | sv_setpvn(ST(3),(char *)ivec1,8); | ||
| 106 | sv_setpvn(ST(4),(char *)ivec2,8); | ||
| 107 | PUSHs(s); | ||
| 108 | } | ||
| 109 | |||
| 110 | void | ||
| 111 | des_cbc_cksum(input,ks,ivec) | ||
| 112 | char * input | ||
| 113 | des_key_schedule * ks | ||
| 114 | des_cblock * ivec | ||
| 115 | PPCODE: | ||
| 116 | { | ||
| 117 | SV *s1,*s2; | ||
| 118 | STRLEN len,l; | ||
| 119 | des_cblock c; | ||
| 120 | unsigned long i1,i2; | ||
| 121 | |||
| 122 | s1=sv_newmortal(); | ||
| 123 | s2=sv_newmortal(); | ||
| 124 | l=SvCUR(ST(0)); | ||
| 125 | des_cbc_cksum((des_cblock *)input,(des_cblock *)c, | ||
| 126 | l,*ks,ivec); | ||
| 127 | i1=c[4]|(c[5]<<8)|(c[6]<<16)|(c[7]<<24); | ||
| 128 | i2=c[0]|(c[1]<<8)|(c[2]<<16)|(c[3]<<24); | ||
| 129 | sv_setiv(s1,i1); | ||
| 130 | sv_setiv(s2,i2); | ||
| 131 | sv_setpvn(ST(2),(char *)c,8); | ||
| 132 | PUSHs(s1); | ||
| 133 | PUSHs(s2); | ||
| 134 | } | ||
| 135 | |||
| 136 | void | ||
| 137 | des_cfb_encrypt(input,numbits,ks,ivec,encrypt) | ||
| 138 | char * input | ||
| 139 | int numbits | ||
| 140 | des_key_schedule * ks | ||
| 141 | des_cblock * ivec | ||
| 142 | int encrypt | ||
| 143 | PPCODE: | ||
| 144 | { | ||
| 145 | SV *s; | ||
| 146 | STRLEN len; | ||
| 147 | char *c; | ||
| 148 | |||
| 149 | len=SvCUR(ST(0)); | ||
| 150 | s=sv_newmortal(); | ||
| 151 | sv_setpvn(s,"",0); | ||
| 152 | SvGROW(s,len); | ||
| 153 | SvCUR_set(s,len); | ||
| 154 | c=(char *)SvPV(s,na); | ||
| 155 | des_cfb_encrypt((unsigned char *)input,(unsigned char *)c, | ||
| 156 | (int)numbits,(long)len,*ks,ivec,encrypt); | ||
| 157 | sv_setpvn(ST(3),(char *)ivec,8); | ||
| 158 | PUSHs(s); | ||
| 159 | } | ||
| 160 | |||
| 161 | des_cblock * | ||
| 162 | des_ecb3_encrypt(input,ks1,ks2,encrypt) | ||
| 163 | des_cblock * input | ||
| 164 | des_key_schedule * ks1 | ||
| 165 | des_key_schedule * ks2 | ||
| 166 | int encrypt | ||
| 167 | CODE: | ||
| 168 | { | ||
| 169 | des_cblock c; | ||
| 170 | |||
| 171 | des_ecb3_encrypt((des_cblock *)input,(des_cblock *)&c, | ||
| 172 | *ks1,*ks2,encrypt); | ||
| 173 | RETVAL= &c; | ||
| 174 | } | ||
| 175 | OUTPUT: | ||
| 176 | RETVAL | ||
| 177 | |||
| 178 | void | ||
| 179 | des_ofb_encrypt(input,numbits,ks,ivec) | ||
| 180 | unsigned char * input | ||
| 181 | int numbits | ||
| 182 | des_key_schedule * ks | ||
| 183 | des_cblock * ivec | ||
| 184 | PPCODE: | ||
| 185 | { | ||
| 186 | SV *s; | ||
| 187 | STRLEN len,l; | ||
| 188 | unsigned char *c; | ||
| 189 | |||
| 190 | len=SvCUR(ST(0)); | ||
| 191 | s=sv_newmortal(); | ||
| 192 | sv_setpvn(s,"",0); | ||
| 193 | SvGROW(s,len); | ||
| 194 | SvCUR_set(s,len); | ||
| 195 | c=(unsigned char *)SvPV(s,na); | ||
| 196 | des_ofb_encrypt((unsigned char *)input,(unsigned char *)c, | ||
| 197 | numbits,len,*ks,ivec); | ||
| 198 | sv_setpvn(ST(3),(char *)ivec,8); | ||
| 199 | PUSHs(s); | ||
| 200 | } | ||
| 201 | |||
| 202 | void | ||
| 203 | des_pcbc_encrypt(input,ks,ivec,encrypt) | ||
| 204 | char * input | ||
| 205 | des_key_schedule * ks | ||
| 206 | des_cblock * ivec | ||
| 207 | int encrypt | ||
| 208 | PPCODE: | ||
| 209 | { | ||
| 210 | SV *s; | ||
| 211 | STRLEN len,l; | ||
| 212 | char *c; | ||
| 213 | |||
| 214 | l=SvCUR(ST(0)); | ||
| 215 | len=((((unsigned long)l)+7)/8)*8; | ||
| 216 | s=sv_newmortal(); | ||
| 217 | sv_setpvn(s,"",0); | ||
| 218 | SvGROW(s,len); | ||
| 219 | SvCUR_set(s,len); | ||
| 220 | c=(char *)SvPV(s,na); | ||
| 221 | des_pcbc_encrypt((des_cblock *)input,(des_cblock *)c, | ||
| 222 | l,*ks,ivec,encrypt); | ||
| 223 | sv_setpvn(ST(2),(char *)c[len-8],8); | ||
| 224 | PUSHs(s); | ||
| 225 | } | ||
| 226 | |||
| 227 | des_cblock * | ||
| 228 | des_random_key() | ||
| 229 | CODE: | ||
| 230 | { | ||
| 231 | des_cblock c; | ||
| 232 | |||
| 233 | des_random_key(c); | ||
| 234 | RETVAL=&c; | ||
| 235 | } | ||
| 236 | OUTPUT: | ||
| 237 | RETVAL | ||
| 238 | |||
| 239 | des_cblock * | ||
| 240 | des_string_to_key(str) | ||
| 241 | char * str | ||
| 242 | CODE: | ||
| 243 | { | ||
| 244 | des_cblock c; | ||
| 245 | |||
| 246 | des_string_to_key(str,&c); | ||
| 247 | RETVAL=&c; | ||
| 248 | } | ||
| 249 | OUTPUT: | ||
| 250 | RETVAL | ||
| 251 | |||
| 252 | void | ||
| 253 | des_string_to_2keys(str) | ||
| 254 | char * str | ||
| 255 | PPCODE: | ||
| 256 | { | ||
| 257 | des_cblock c1,c2; | ||
| 258 | SV *s1,*s2; | ||
| 259 | |||
| 260 | des_string_to_2keys(str,&c1,&c2); | ||
| 261 | EXTEND(sp,2); | ||
| 262 | s1=sv_newmortal(); | ||
| 263 | sv_setpvn(s1,(char *)c1,8); | ||
| 264 | s2=sv_newmortal(); | ||
| 265 | sv_setpvn(s2,(char *)c2,8); | ||
| 266 | PUSHs(s1); | ||
| 267 | PUSHs(s2); | ||
| 268 | } | ||
diff --git a/src/lib/libcrypto/des/FILES0 b/src/lib/libcrypto/des/FILES0 new file mode 100644 index 0000000000..4c7ea2de7a --- /dev/null +++ b/src/lib/libcrypto/des/FILES0 | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* General stuff */ | ||
| 2 | COPYRIGHT - Copyright info. | ||
| 3 | MODES.DES - A description of the features of the different modes of DES. | ||
| 4 | FILES - This file. | ||
| 5 | INSTALL - How to make things compile. | ||
| 6 | Imakefile - For use with kerberos. | ||
| 7 | README - What this package is. | ||
| 8 | VERSION - Which version this is and what was changed. | ||
| 9 | KERBEROS - Kerberos version 4 notes. | ||
| 10 | Makefile.PL - An old makefile to build with perl5, not current. | ||
| 11 | Makefile.ssl - The SSLeay makefile | ||
| 12 | Makefile.uni - The normal unix makefile. | ||
| 13 | GNUmakefile - The makefile for use with glibc. | ||
| 14 | makefile.bc - A Borland C makefile | ||
| 15 | times - Some outputs from 'speed' on some machines. | ||
| 16 | vms.com - For use when compiling under VMS | ||
| 17 | |||
| 18 | /* My SunOS des(1) replacement */ | ||
| 19 | des.c - des(1) source code. | ||
| 20 | des.man - des(1) manual. | ||
| 21 | |||
| 22 | /* Testing and timing programs. */ | ||
| 23 | destest.c - Source for libdes.a test program. | ||
| 24 | speed.c - Source for libdes.a timing program. | ||
| 25 | rpw.c - Source for libdes.a testing password reading routines. | ||
| 26 | |||
| 27 | /* libdes.a source code */ | ||
| 28 | des_crypt.man - libdes.a manual page. | ||
| 29 | des.h - Public libdes.a header file. | ||
| 30 | ecb_enc.c - des_ecb_encrypt() source, this contains the basic DES code. | ||
| 31 | ecb3_enc.c - des_ecb3_encrypt() source. | ||
| 32 | cbc_ckm.c - des_cbc_cksum() source. | ||
| 33 | cbc_enc.c - des_cbc_encrypt() source. | ||
| 34 | ncbc_enc.c - des_cbc_encrypt() that is 'normal' in that it copies | ||
| 35 | the new iv values back in the passed iv vector. | ||
| 36 | ede_enc.c - des_ede3_cbc_encrypt() cbc mode des using triple DES. | ||
| 37 | cbc3_enc.c - des_3cbc_encrypt() source, don't use this function. | ||
| 38 | cfb_enc.c - des_cfb_encrypt() source. | ||
| 39 | cfb64enc.c - des_cfb64_encrypt() cfb in 64 bit mode but setup to be | ||
| 40 | used as a stream cipher. | ||
| 41 | cfb64ede.c - des_ede3_cfb64_encrypt() cfb in 64 bit mode but setup to be | ||
| 42 | used as a stream cipher and using triple DES. | ||
| 43 | ofb_enc.c - des_cfb_encrypt() source. | ||
| 44 | ofb64_enc.c - des_ofb_encrypt() ofb in 64 bit mode but setup to be | ||
| 45 | used as a stream cipher. | ||
| 46 | ofb64ede.c - des_ede3_ofb64_encrypt() ofb in 64 bit mode but setup to be | ||
| 47 | used as a stream cipher and using triple DES. | ||
| 48 | enc_read.c - des_enc_read() source. | ||
| 49 | enc_writ.c - des_enc_write() source. | ||
| 50 | pcbc_enc.c - des_pcbc_encrypt() source. | ||
| 51 | qud_cksm.c - quad_cksum() source. | ||
| 52 | rand_key.c - des_random_key() source. | ||
| 53 | read_pwd.c - Source for des_read_password() plus related functions. | ||
| 54 | set_key.c - Source for des_set_key(). | ||
| 55 | str2key.c - Covert a string of any length into a key. | ||
| 56 | fcrypt.c - A small, fast version of crypt(3). | ||
| 57 | des_locl.h - Internal libdes.a header file. | ||
| 58 | podd.h - Odd parity tables - used in des_set_key(). | ||
| 59 | sk.h - Lookup tables used in des_set_key(). | ||
| 60 | spr.h - What is left of the S tables - used in ecb_encrypt(). | ||
| 61 | des_ver.h - header file for the external definition of the | ||
| 62 | version string. | ||
| 63 | des.doc - SSLeay documentation for the library. | ||
| 64 | |||
| 65 | /* The perl scripts - you can ignore these files they are only | ||
| 66 | * included for the curious */ | ||
| 67 | des.pl - des in perl anyone? des_set_key and des_ecb_encrypt | ||
| 68 | both done in a perl library. | ||
| 69 | testdes.pl - Testing program for des.pl | ||
| 70 | doIP - Perl script used to develop IP xor/shift code. | ||
| 71 | doPC1 - Perl script used to develop PC1 xor/shift code. | ||
| 72 | doPC2 - Generates sk.h. | ||
| 73 | PC1 - Output of doPC1 should be the same as output from PC1. | ||
| 74 | PC2 - used in development of doPC2. | ||
| 75 | shifts.pl - Perl library used by my perl scripts. | ||
| 76 | |||
| 77 | /* I started making a perl5 dynamic library for libdes | ||
| 78 | * but did not fully finish, these files are part of that effort. */ | ||
| 79 | DES.pm | ||
| 80 | DES.pod | ||
| 81 | DES.xs | ||
| 82 | t | ||
| 83 | typemap | ||
| 84 | |||
| 85 | /* The following are for use with sun RPC implementaions. */ | ||
| 86 | rpc_des.h | ||
| 87 | rpc_enc.c | ||
| 88 | |||
| 89 | /* The following are contibuted by Mark Murray <mark@grondar.za>. They | ||
| 90 | * are not normally built into libdes due to machine specific routines | ||
| 91 | * contained in them. They are for use in the most recent incarnation of | ||
| 92 | * export kerberos v 4 (eBones). */ | ||
| 93 | supp.c | ||
| 94 | new_rkey.c | ||
| 95 | |||
| 96 | |||
diff --git a/src/lib/libcrypto/des/INSTALL b/src/lib/libcrypto/des/INSTALL new file mode 100644 index 0000000000..8aebdfe110 --- /dev/null +++ b/src/lib/libcrypto/des/INSTALL | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | Check the CC and CFLAGS lines in the makefile | ||
| 2 | |||
| 3 | If your C library does not support the times(3) function, change the | ||
| 4 | #define TIMES to | ||
| 5 | #undef TIMES in speed.c | ||
| 6 | If it does, check the HZ value for the times(3) function. | ||
| 7 | If your system does not define CLK_TCK it will be assumed to | ||
| 8 | be 100.0. | ||
| 9 | |||
| 10 | If possible use gcc v 2.7.? | ||
| 11 | Turn on the maximum optimising (normally '-O3 -fomit-frame-pointer' for gcc) | ||
| 12 | In recent times, some system compilers give better performace. | ||
| 13 | |||
| 14 | type 'make' | ||
| 15 | |||
| 16 | run './destest' to check things are ok. | ||
| 17 | run './rpw' to check the tty code for reading passwords works. | ||
| 18 | run './speed' to see how fast those optimisations make the library run :-) | ||
| 19 | run './des_opts' to determin the best compile time options. | ||
| 20 | |||
| 21 | The output from des_opts should be put in the makefile options and des_enc.c | ||
| 22 | should be rebuilt. For 64 bit computers, do not use the DES_PTR option. | ||
| 23 | For the DEC Alpha, edit des.h and change DES_LONG to 'unsigned int' | ||
| 24 | and then you can use the 'DES_PTR' option. | ||
| 25 | |||
| 26 | The file options.txt has the options listed for best speed on quite a | ||
| 27 | few systems. Look and the options (UNROLL, PTR, RISC2 etc) and then | ||
| 28 | turn on the relevant option in the Makefile. | ||
| 29 | |||
| 30 | There are some special Makefile targets that make life easier. | ||
| 31 | make cc - standard cc build | ||
| 32 | make gcc - standard gcc build | ||
| 33 | make x86-elf - x86 assembler (elf), linux-elf. | ||
| 34 | make x86-out - x86 assembler (a.out), FreeBSD | ||
| 35 | make x86-solaris- x86 assembler | ||
| 36 | make x86-bsdi - x86 assembler (a.out with primative assembler). | ||
| 37 | |||
| 38 | If at all possible use the assembler (for Windows NT/95, use | ||
| 39 | asm/win32.obj to link with). The x86 assembler is very very fast. | ||
| 40 | |||
| 41 | A make install will by default install | ||
| 42 | libdes.a in /usr/local/lib/libdes.a | ||
| 43 | des in /usr/local/bin/des | ||
| 44 | des_crypt.man in /usr/local/man/man3/des_crypt.3 | ||
| 45 | des.man in /usr/local/man/man1/des.1 | ||
| 46 | des.h in /usr/include/des.h | ||
| 47 | |||
| 48 | des(1) should be compatible with sunOS's but I have been unable to | ||
| 49 | test it. | ||
| 50 | |||
| 51 | These routines should compile on MSDOS, most 32bit and 64bit version | ||
| 52 | of Unix (BSD and SYSV) and VMS, without modification. | ||
| 53 | The only problems should be #include files that are in the wrong places. | ||
| 54 | |||
| 55 | These routines can be compiled under MSDOS. | ||
| 56 | I have successfully encrypted files using des(1) under MSDOS and then | ||
| 57 | decrypted the files on a SparcStation. | ||
| 58 | I have been able to compile and test the routines with | ||
| 59 | Microsoft C v 5.1 and Turbo C v 2.0. | ||
| 60 | The code in this library is in no way optimised for the 16bit | ||
| 61 | operation of MSDOS. | ||
| 62 | |||
| 63 | When building for glibc, ignore all of the above and just unpack into | ||
| 64 | glibc-1.??/des and then gmake as per normal. | ||
| 65 | |||
| 66 | As a final note on performace. Certain CPUs like sparcs and Alpha often give | ||
| 67 | a %10 speed difference depending on the link order. It is rather anoying | ||
| 68 | when one program reports 'x' DES encrypts a second and another reports | ||
| 69 | 'x*0.9' the speed. | ||
diff --git a/src/lib/libcrypto/des/Imakefile b/src/lib/libcrypto/des/Imakefile new file mode 100644 index 0000000000..1b9b5629e1 --- /dev/null +++ b/src/lib/libcrypto/des/Imakefile | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | # This Imakefile has not been tested for a while but it should still | ||
| 2 | # work when placed in the correct directory in the kerberos v 4 distribution | ||
| 3 | |||
| 4 | SRCS= cbc_cksm.c cbc_enc.c ecb_enc.c pcbc_enc.c \ | ||
| 5 | qud_cksm.c rand_key.c read_pwd.c set_key.c str2key.c \ | ||
| 6 | enc_read.c enc_writ.c fcrypt.c cfb_enc.c \ | ||
| 7 | ecb3_enc.c ofb_enc.c ofb64enc.c | ||
| 8 | |||
| 9 | OBJS= cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ | ||
| 10 | qud_cksm.o rand_key.o read_pwd.o set_key.o str2key.o \ | ||
| 11 | enc_read.o enc_writ.o fcrypt.o cfb_enc.o \ | ||
| 12 | ecb3_enc.o ofb_enc.o ofb64enc.o | ||
| 13 | |||
| 14 | GENERAL=COPYRIGHT FILES INSTALL Imakefile README VERSION makefile times \ | ||
| 15 | vms.com KERBEROS | ||
| 16 | DES= des.c des.man | ||
| 17 | TESTING=destest.c speed.c rpw.c | ||
| 18 | LIBDES= des_crypt.man des.h des_locl.h podd.h sk.h spr.h | ||
| 19 | |||
| 20 | PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl | ||
| 21 | |||
| 22 | CODE= $(GENERAL) $(DES) $(TESTING) $(SRCS) $(LIBDES) $(PERL) | ||
| 23 | |||
| 24 | SRCDIR=$(SRCTOP)/lib/des | ||
| 25 | |||
| 26 | DBG= -O | ||
| 27 | INCLUDE= -I$(SRCDIR) | ||
| 28 | CC= cc | ||
| 29 | |||
| 30 | library_obj_rule() | ||
| 31 | |||
| 32 | install_library_target(des,$(OBJS),$(SRCS),) | ||
| 33 | |||
| 34 | test(destest,libdes.a,) | ||
| 35 | test(rpw,libdes.a,) | ||
diff --git a/src/lib/libcrypto/des/KERBEROS b/src/lib/libcrypto/des/KERBEROS new file mode 100644 index 0000000000..f401b10014 --- /dev/null +++ b/src/lib/libcrypto/des/KERBEROS | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | [ This is an old file, I don't know if it is true anymore | ||
| 2 | but I will leave the file here - eay 21/11/95 ] | ||
| 3 | |||
| 4 | To use this library with Bones (kerberos without DES): | ||
| 5 | 1) Get my modified Bones - eBones. It can be found on | ||
| 6 | gondwana.ecr.mu.oz.au (128.250.1.63) /pub/athena/eBones-p9.tar.Z | ||
| 7 | and | ||
| 8 | nic.funet.fi (128.214.6.100) /pub/unix/security/Kerberos/eBones-p9.tar.Z | ||
| 9 | |||
| 10 | 2) Unpack this library in src/lib/des, makeing sure it is version | ||
| 11 | 3.00 or greater (libdes.tar.93-10-07.Z). This versions differences | ||
| 12 | from the version in comp.sources.misc volume 29 patchlevel2. | ||
| 13 | The primarily difference is that it should compile under kerberos :-). | ||
| 14 | It can be found at. | ||
| 15 | ftp.psy.uq.oz.au (130.102.32.1) /pub/DES/libdes.tar.93-10-07.Z | ||
| 16 | |||
| 17 | Now do a normal kerberos build and things should work. | ||
| 18 | |||
| 19 | One problem I found when I was build on my local sun. | ||
| 20 | --- | ||
| 21 | For sunOS 4.1.1 apply the following patch to src/util/ss/make_commands.c | ||
| 22 | |||
| 23 | *** make_commands.c.orig Fri Jul 3 04:18:35 1987 | ||
| 24 | --- make_commands.c Wed May 20 08:47:42 1992 | ||
| 25 | *************** | ||
| 26 | *** 98,104 **** | ||
| 27 | if (!rename(o_file, z_file)) { | ||
| 28 | if (!vfork()) { | ||
| 29 | chdir("/tmp"); | ||
| 30 | ! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r", "-n", | ||
| 31 | z_file+5, 0); | ||
| 32 | perror("/bin/ld"); | ||
| 33 | _exit(1); | ||
| 34 | --- 98,104 ---- | ||
| 35 | if (!rename(o_file, z_file)) { | ||
| 36 | if (!vfork()) { | ||
| 37 | chdir("/tmp"); | ||
| 38 | ! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r", | ||
| 39 | z_file+5, 0); | ||
| 40 | perror("/bin/ld"); | ||
| 41 | _exit(1); | ||
diff --git a/src/lib/libcrypto/des/Makefile b/src/lib/libcrypto/des/Makefile new file mode 100644 index 0000000000..ae982265fd --- /dev/null +++ b/src/lib/libcrypto/des/Makefile | |||
| @@ -0,0 +1,278 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/des/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= des | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES=-I$(TOP) -I../../include | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | RANLIB= ranlib | ||
| 14 | DES_ENC= des_enc.o fcrypt_b.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=destest.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC= cbc_cksm.c cbc_enc.c cfb64enc.c cfb_enc.c \ | ||
| 26 | ecb3_enc.c ecb_enc.c enc_read.c enc_writ.c \ | ||
| 27 | fcrypt.c ofb64enc.c ofb_enc.c pcbc_enc.c \ | ||
| 28 | qud_cksm.c rand_key.c rpc_enc.c set_key.c \ | ||
| 29 | des_enc.c fcrypt_b.c \ | ||
| 30 | xcbc_enc.c \ | ||
| 31 | str2key.c cfb64ede.c ofb64ede.c ede_cbcm_enc.c des_old.c des_old2.c \ | ||
| 32 | read2pwd.c | ||
| 33 | |||
| 34 | LIBOBJ= set_key.o ecb_enc.o cbc_enc.o \ | ||
| 35 | ecb3_enc.o cfb64enc.o cfb64ede.o cfb_enc.o ofb64ede.o \ | ||
| 36 | enc_read.o enc_writ.o ofb64enc.o \ | ||
| 37 | ofb_enc.o str2key.o pcbc_enc.o qud_cksm.o rand_key.o \ | ||
| 38 | ${DES_ENC} \ | ||
| 39 | fcrypt.o xcbc_enc.o rpc_enc.o cbc_cksm.o \ | ||
| 40 | ede_cbcm_enc.o des_old.o des_old2.o read2pwd.o | ||
| 41 | |||
| 42 | SRC= $(LIBSRC) | ||
| 43 | |||
| 44 | EXHEADER= des.h des_old.h | ||
| 45 | HEADER= des_locl.h rpc_des.h spr.h des_ver.h $(EXHEADER) | ||
| 46 | |||
| 47 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 48 | |||
| 49 | top: | ||
| 50 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 51 | |||
| 52 | all: lib | ||
| 53 | |||
| 54 | lib: $(LIBOBJ) | ||
| 55 | $(AR) $(LIB) $(LIBOBJ) | ||
| 56 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 57 | @touch lib | ||
| 58 | |||
| 59 | des: des.o cbc3_enc.o lib | ||
| 60 | $(CC) $(CFLAGS) -o des des.o cbc3_enc.o $(LIB) | ||
| 61 | |||
| 62 | des_enc-sparc.S: asm/des_enc.m4 | ||
| 63 | m4 -B 8192 asm/des_enc.m4 > des_enc-sparc.S | ||
| 64 | |||
| 65 | des-586.s: asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 66 | $(PERL) asm/des-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ | ||
| 67 | crypt586.s: asm/crypt586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 68 | $(PERL) asm/crypt586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ | ||
| 69 | |||
| 70 | files: | ||
| 71 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 72 | |||
| 73 | links: | ||
| 74 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 75 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 76 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 77 | |||
| 78 | # We need to use force because 'install' matches 'INSTALL' on case | ||
| 79 | # insensitive systems | ||
| 80 | FRC.install: | ||
| 81 | install: FRC.install | ||
| 82 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 83 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 84 | do \ | ||
| 85 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 86 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 87 | done; | ||
| 88 | |||
| 89 | tags: | ||
| 90 | ctags $(SRC) | ||
| 91 | |||
| 92 | tests: | ||
| 93 | |||
| 94 | lint: | ||
| 95 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 96 | |||
| 97 | depend: | ||
| 98 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 99 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 100 | |||
| 101 | dclean: | ||
| 102 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 103 | mv -f Makefile.new $(MAKEFILE) | ||
| 104 | |||
| 105 | clean: | ||
| 106 | rm -f *.s *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff | ||
| 107 | |||
| 108 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 109 | |||
| 110 | cbc_cksm.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 111 | cbc_cksm.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 112 | cbc_cksm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 113 | cbc_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 114 | cbc_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 115 | cbc_cksm.o: cbc_cksm.c des_locl.h | ||
| 116 | cbc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 117 | cbc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 118 | cbc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 119 | cbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 120 | cbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 121 | cbc_enc.o: cbc_enc.c des_locl.h ncbc_enc.c | ||
| 122 | cfb64ede.o: ../../e_os.h ../../include/openssl/des.h | ||
| 123 | cfb64ede.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 124 | cfb64ede.o: ../../include/openssl/opensslconf.h | ||
| 125 | cfb64ede.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 126 | cfb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 127 | cfb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 128 | cfb64ede.o: cfb64ede.c des_locl.h | ||
| 129 | cfb64enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 130 | cfb64enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 131 | cfb64enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 132 | cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 133 | cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 134 | cfb64enc.o: cfb64enc.c des_locl.h | ||
| 135 | cfb_enc.o: ../../e_os.h ../../include/openssl/des.h | ||
| 136 | cfb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 137 | cfb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/ossl_typ.h | ||
| 138 | cfb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 139 | cfb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 140 | cfb_enc.o: ../../include/openssl/ui_compat.h cfb_enc.c des_locl.h | ||
| 141 | des_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 142 | des_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 143 | des_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 144 | des_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 145 | des_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 146 | des_enc.o: des_enc.c des_locl.h ncbc_enc.c spr.h | ||
| 147 | des_old.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 148 | des_old.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 149 | des_old.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 150 | des_old.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 151 | des_old.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 152 | des_old.o: ../../include/openssl/ui_compat.h des_old.c | ||
| 153 | des_old2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 154 | des_old2.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 155 | des_old2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 156 | des_old2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 157 | des_old2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 158 | des_old2.o: ../../include/openssl/ui_compat.h des_old2.c | ||
| 159 | ecb3_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 160 | ecb3_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 161 | ecb3_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 162 | ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 163 | ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 164 | ecb3_enc.o: des_locl.h ecb3_enc.c | ||
| 165 | ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 166 | ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 167 | ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 168 | ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 169 | ecb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 170 | ecb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 171 | ecb_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h ecb_enc.c | ||
| 172 | ede_cbcm_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 173 | ede_cbcm_enc.o: ../../include/openssl/e_os2.h | ||
| 174 | ede_cbcm_enc.o: ../../include/openssl/opensslconf.h | ||
| 175 | ede_cbcm_enc.o: ../../include/openssl/ossl_typ.h | ||
| 176 | ede_cbcm_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 177 | ede_cbcm_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 178 | ede_cbcm_enc.o: ../../include/openssl/ui_compat.h des_locl.h ede_cbcm_enc.c | ||
| 179 | enc_read.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 180 | enc_read.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 181 | enc_read.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 182 | enc_read.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 183 | enc_read.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 184 | enc_read.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 185 | enc_read.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 186 | enc_read.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 187 | enc_read.o: ../../include/openssl/ui_compat.h ../cryptlib.h des_locl.h | ||
| 188 | enc_read.o: enc_read.c | ||
| 189 | enc_writ.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 190 | enc_writ.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 191 | enc_writ.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 192 | enc_writ.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 193 | enc_writ.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 194 | enc_writ.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 195 | enc_writ.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 196 | enc_writ.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 197 | enc_writ.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 198 | enc_writ.o: ../cryptlib.h des_locl.h enc_writ.c | ||
| 199 | fcrypt.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 200 | fcrypt.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 201 | fcrypt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 202 | fcrypt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 203 | fcrypt.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 204 | fcrypt.o: des_locl.h fcrypt.c | ||
| 205 | fcrypt_b.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 206 | fcrypt_b.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 207 | fcrypt_b.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 208 | fcrypt_b.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 209 | fcrypt_b.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 210 | fcrypt_b.o: des_locl.h fcrypt_b.c | ||
| 211 | ofb64ede.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 212 | ofb64ede.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 213 | ofb64ede.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 214 | ofb64ede.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 215 | ofb64ede.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 216 | ofb64ede.o: des_locl.h ofb64ede.c | ||
| 217 | ofb64enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 218 | ofb64enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 219 | ofb64enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 220 | ofb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 221 | ofb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 222 | ofb64enc.o: des_locl.h ofb64enc.c | ||
| 223 | ofb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 224 | ofb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 225 | ofb_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 226 | ofb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 227 | ofb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 228 | ofb_enc.o: des_locl.h ofb_enc.c | ||
| 229 | pcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 230 | pcbc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 231 | pcbc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 232 | pcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 233 | pcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 234 | pcbc_enc.o: des_locl.h pcbc_enc.c | ||
| 235 | qud_cksm.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 236 | qud_cksm.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 237 | qud_cksm.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 238 | qud_cksm.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 239 | qud_cksm.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 240 | qud_cksm.o: des_locl.h qud_cksm.c | ||
| 241 | rand_key.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 242 | rand_key.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 243 | rand_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 244 | rand_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 245 | rand_key.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 246 | rand_key.o: ../../include/openssl/ui_compat.h rand_key.c | ||
| 247 | read2pwd.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 248 | read2pwd.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 249 | read2pwd.o: ../../include/openssl/opensslconf.h | ||
| 250 | read2pwd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 251 | read2pwd.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 252 | read2pwd.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 253 | read2pwd.o: ../../include/openssl/ui_compat.h read2pwd.c | ||
| 254 | rpc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 255 | rpc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 256 | rpc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 257 | rpc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 258 | rpc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 259 | rpc_enc.o: des_locl.h des_ver.h rpc_des.h rpc_enc.c | ||
| 260 | set_key.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 261 | set_key.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 262 | set_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 263 | set_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 264 | set_key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 265 | set_key.o: des_locl.h set_key.c | ||
| 266 | str2key.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 267 | str2key.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 268 | str2key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 269 | str2key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 270 | str2key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 271 | str2key.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 272 | str2key.o: des_locl.h str2key.c | ||
| 273 | xcbc_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 274 | xcbc_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 275 | xcbc_enc.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 276 | xcbc_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 277 | xcbc_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 278 | xcbc_enc.o: des_locl.h xcbc_enc.c | ||
diff --git a/src/lib/libcrypto/des/README b/src/lib/libcrypto/des/README new file mode 100644 index 0000000000..621a5ab467 --- /dev/null +++ b/src/lib/libcrypto/des/README | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | |||
| 2 | libdes, Version 4.01 10-Jan-97 | ||
| 3 | |||
| 4 | Copyright (c) 1997, Eric Young | ||
| 5 | All rights reserved. | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify | ||
| 8 | it under the terms specified in COPYRIGHT. | ||
| 9 | |||
| 10 | -- | ||
| 11 | The primary ftp site for this library is | ||
| 12 | ftp://ftp.psy.uq.oz.au/pub/Crypto/DES/libdes-x.xx.tar.gz | ||
| 13 | libdes is now also shipped with SSLeay. Primary ftp site of | ||
| 14 | ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL/SSLeay-x.x.x.tar.gz | ||
| 15 | |||
| 16 | The best way to build this library is to build it as part of SSLeay. | ||
| 17 | |||
| 18 | This kit builds a DES encryption library and a DES encryption program. | ||
| 19 | It supports ecb, cbc, ofb, cfb, triple ecb, triple cbc, triple ofb, | ||
| 20 | triple cfb, desx, and MIT's pcbc encryption modes and also has a fast | ||
| 21 | implementation of crypt(3). | ||
| 22 | It contains support routines to read keys from a terminal, | ||
| 23 | generate a random key, generate a key from an arbitrary length string, | ||
| 24 | read/write encrypted data from/to a file descriptor. | ||
| 25 | |||
| 26 | The implementation was written so as to conform with the manual entry | ||
| 27 | for the des_crypt(3) library routines from MIT's project Athena. | ||
| 28 | |||
| 29 | destest should be run after compilation to test the des routines. | ||
| 30 | rpw should be run after compilation to test the read password routines. | ||
| 31 | The des program is a replacement for the sun des command. I believe it | ||
| 32 | conforms to the sun version. | ||
| 33 | |||
| 34 | The Imakefile is setup for use in the kerberos distribution. | ||
| 35 | |||
| 36 | These routines are best compiled with gcc or any other good | ||
| 37 | optimising compiler. | ||
| 38 | Just turn you optimiser up to the highest settings and run destest | ||
| 39 | after the build to make sure everything works. | ||
| 40 | |||
| 41 | I believe these routines are close to the fastest and most portable DES | ||
| 42 | routines that use small lookup tables (4.5k) that are publicly available. | ||
| 43 | The fcrypt routine is faster than ufc's fcrypt (when compiling with | ||
| 44 | gcc2 -O2) on the sparc 2 (1410 vs 1270) but is not so good on other machines | ||
| 45 | (on a sun3/260 168 vs 336). It is a function of CPU on chip cache size. | ||
| 46 | [ 10-Jan-97 and a function of an incorrect speed testing program in | ||
| 47 | ufc which gave much better test figures that reality ]. | ||
| 48 | |||
| 49 | It is worth noting that on sparc and Alpha CPUs, performance of the DES | ||
| 50 | library can vary by upto %10 due to the positioning of files after application | ||
| 51 | linkage. | ||
| 52 | |||
| 53 | Eric Young (eay@cryptsoft.com) | ||
| 54 | |||
diff --git a/src/lib/libcrypto/des/VERSION b/src/lib/libcrypto/des/VERSION new file mode 100644 index 0000000000..c7d01542bc --- /dev/null +++ b/src/lib/libcrypto/des/VERSION | |||
| @@ -0,0 +1,412 @@ | |||
| 1 | Fixed the weak key values which were wrong :-( | ||
| 2 | Defining SIGACTION causes sigaction() to be used instead of signal(). | ||
| 3 | SIGUSR1/SIGUSR2 are no longer mapped in the read tty stuff because it | ||
| 4 | can cause problems. This should hopefully not affect normal | ||
| 5 | applications. | ||
| 6 | |||
| 7 | Version 4.04 | ||
| 8 | Fixed a few tests in destest. Also added x86 assember for | ||
| 9 | des_ncbc_encrypt() which is the standard cbc mode function. | ||
| 10 | This makes a very very large performace difference. | ||
| 11 | Ariel Glenn ariel@columbia.edu reports that the terminal | ||
| 12 | 'turn echo off' can return (errno == EINVAL) under solaris | ||
| 13 | when redirection is used. So I now catch that as well as ENOTTY. | ||
| 14 | |||
| 15 | |||
| 16 | Version 4.03 | ||
| 17 | Left a static out of enc_write.c, which caused to buffer to be | ||
| 18 | continiously malloc()ed. Does anyone use these functions? I keep | ||
| 19 | on feeling like removing them since I only had these in there | ||
| 20 | for a version of kerberised login. Anyway, this was pointed out | ||
| 21 | by Theo de Raadt <deraadt@cvs.openbsd.org> | ||
| 22 | The 'n' bit ofb code was wrong, it was not shifting the shift | ||
| 23 | register. It worked correctly for n == 64. Thanks to | ||
| 24 | Gigi Ankeny <Gigi.Ankeny@Eng.Sun.COM> for pointing this one out. | ||
| 25 | |||
| 26 | Version 4.02 | ||
| 27 | I was doing 'if (memcmp(weak_keys[i],key,sizeof(key)) == 0)' | ||
| 28 | when checking for weak keys which is wrong :-(, pointed out by | ||
| 29 | Markus F.X.J. Oberhumer <markus.oberhumer@jk.uni-linz.ac.at>. | ||
| 30 | |||
| 31 | Version 4.01 | ||
| 32 | Even faster inner loop in the DES assembler for x86 and a modification | ||
| 33 | for IP/FP which is faster on x86. Both of these changes are | ||
| 34 | from Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk>. His | ||
| 35 | changes make the assembler run %40 faster on a pentium. This is just | ||
| 36 | a case of getting the instruction sequence 'just right'. | ||
| 37 | All credit to 'Svend' :-) | ||
| 38 | Quite a few special x86 'make' targets. | ||
| 39 | A libdes-l (lite) distribution. | ||
| 40 | |||
| 41 | Version 4.00 | ||
| 42 | After a bit of a pause, I'll up the major version number since this | ||
| 43 | is mostly a performace release. I've added x86 assembler and | ||
| 44 | added more options for performance. A %28 speedup for gcc | ||
| 45 | on a pentium and the assembler is a %50 speedup. | ||
| 46 | MIPS CPU's, sparc and Alpha are the main CPU's with speedups. | ||
| 47 | Run des_opts to work out which options should be used. | ||
| 48 | DES_RISC1/DES_RISC2 use alternative inner loops which use | ||
| 49 | more registers but should give speedups on any CPU that does | ||
| 50 | dual issue (pentium). DES_UNROLL unrolls the inner loop, | ||
| 51 | which costs in code size. | ||
| 52 | |||
| 53 | Version 3.26 | ||
| 54 | I've finally removed one of the shifts in D_ENCRYPT. This | ||
| 55 | meant I've changed the des_SPtrans table (spr.h), the set_key() | ||
| 56 | function and some things in des_enc.c. This has definitly | ||
| 57 | made things faster :-). I've known about this one for some | ||
| 58 | time but I've been too lazy to follow it up :-). | ||
| 59 | Noticed that in the D_ENCRYPT() macro, we can just do L^=(..)^(..)^.. | ||
| 60 | instead of L^=((..)|(..)|(..).. This should save a register at | ||
| 61 | least. | ||
| 62 | Assember for x86. The file to replace is des_enc.c, which is replaced | ||
| 63 | by one of the assembler files found in asm. Look at des/asm/readme | ||
| 64 | for more info. | ||
| 65 | |||
| 66 | /* Modification to fcrypt so it can be compiled to support | ||
| 67 | HPUX 10.x's long password format, define -DLONGCRYPT to use this. | ||
| 68 | Thanks to Jens Kupferschmidt <bt1cu@hpboot.rz.uni-leipzig.de>. */ | ||
| 69 | |||
| 70 | SIGWINCH case put in des_read_passwd() so the function does not | ||
| 71 | 'exit' if this function is recieved. | ||
| 72 | |||
| 73 | Version 3.25 17/07/96 | ||
| 74 | Modified read_pwd.c so that stdin can be read if not a tty. | ||
| 75 | Thanks to Jeff Barber <jeffb@issl.atl.hp.com> for the patches. | ||
| 76 | des_init_random_number_generator() shortened due to VMS linker | ||
| 77 | limits. | ||
| 78 | Added RSA's DESX cbc mode. It is a form of cbc encryption, with 2 | ||
| 79 | 8 byte quantites xored before and after encryption. | ||
| 80 | des_xcbc_encryption() - the name is funny to preserve the des_ | ||
| 81 | prefix on all functions. | ||
| 82 | |||
| 83 | Version 3.24 20/04/96 | ||
| 84 | The DES_PTR macro option checked and used by SSLeay configuration | ||
| 85 | |||
| 86 | Version 3.23 11/04/96 | ||
| 87 | Added DES_LONG. If defined to 'unsigned int' on the DEC Alpha, | ||
| 88 | it gives a %20 speedup :-) | ||
| 89 | Fixed the problem with des.pl under perl5. The patches were | ||
| 90 | sent by Ed Kubaitis (ejk@uiuc.edu). | ||
| 91 | if fcrypt.c, changed values to handle illegal salt values the way | ||
| 92 | normal crypt() implementations do. Some programs apparently use | ||
| 93 | them :-(. The patch was sent by Bjorn Gronvall <bg@sics.se> | ||
| 94 | |||
| 95 | Version 3.22 29/11/95 | ||
| 96 | Bug in des(1), an error with the uuencoding stuff when the | ||
| 97 | 'data' is small, thanks to Geoff Keating <keagchon@mehta.anu.edu.au> | ||
| 98 | for the patch. | ||
| 99 | |||
| 100 | Version 3.21 22/11/95 | ||
| 101 | After some emailing back and forth with | ||
| 102 | Colin Plumb <colin@nyx10.cs.du.edu>, I've tweaked a few things | ||
| 103 | and in a future version I will probably put in some of the | ||
| 104 | optimisation he suggested for use with the DES_USE_PTR option. | ||
| 105 | Extra routines from Mark Murray <mark@grondar.za> for use in | ||
| 106 | freeBSD. They mostly involve random number generation for use | ||
| 107 | with kerberos. They involve evil machine specific system calls | ||
| 108 | etc so I would normally suggest pushing this stuff into the | ||
| 109 | application and/or using RAND_seed()/RAND_bytes() if you are | ||
| 110 | using this DES library as part of SSLeay. | ||
| 111 | Redone the read_pw() function so that it is cleaner and | ||
| 112 | supports termios, thanks to Sameer Parekh <sameer@c2.org> | ||
| 113 | for the initial patches for this. | ||
| 114 | Renamed 3ecb_encrypt() to ecb3_encrypt(). This has been | ||
| 115 | done just to make things more consistent. | ||
| 116 | I have also now added triple DES versions of cfb and ofb. | ||
| 117 | |||
| 118 | Version 3.20 | ||
| 119 | Damn, Damn, Damn, as pointed out by Mike_Spreitzer.PARC@xerox.com, | ||
| 120 | my des_random_seed() function was only copying 4 bytes of the | ||
| 121 | passed seed into the init structure. It is now fixed to copy 8. | ||
| 122 | My own suggestion is to used something like MD5 :-) | ||
| 123 | |||
| 124 | Version 3.19 | ||
| 125 | While looking at my code one day, I though, why do I keep on | ||
| 126 | calling des_encrypt(in,out,ks,enc) when every function that | ||
| 127 | calls it has in and out the same. So I dropped the 'out' | ||
| 128 | parameter, people should not be using this function. | ||
| 129 | |||
| 130 | Version 3.18 30/08/95 | ||
| 131 | Fixed a few bit with the distribution and the filenames. | ||
| 132 | 3.17 had been munged via a move to DOS and back again. | ||
| 133 | NO CODE CHANGES | ||
| 134 | |||
| 135 | Version 3.17 14/07/95 | ||
| 136 | Fixed ede3 cbc which I had broken in 3.16. I have also | ||
| 137 | removed some unneeded variables in 7-8 of the routines. | ||
| 138 | |||
| 139 | Version 3.16 26/06/95 | ||
| 140 | Added des_encrypt2() which does not use IP/FP, used by triple | ||
| 141 | des routines. Tweaked things a bit elsewhere. %13 speedup on | ||
| 142 | sparc and %6 on a R4400 for ede3 cbc mode. | ||
| 143 | |||
| 144 | Version 3.15 06/06/95 | ||
| 145 | Added des_ncbc_encrypt(), it is des_cbc mode except that it is | ||
| 146 | 'normal' and copies the new iv value back over the top of the | ||
| 147 | passed parameter. | ||
| 148 | CHANGED des_ede3_cbc_encrypt() so that it too now overwrites | ||
| 149 | the iv. THIS WILL BREAK EXISTING CODE, but since this function | ||
| 150 | only new, I feel I can change it, not so with des_cbc_encrypt :-(. | ||
| 151 | I need to update the documentation. | ||
| 152 | |||
| 153 | Version 3.14 31/05/95 | ||
| 154 | New release upon the world, as part of my SSL implementation. | ||
| 155 | New copyright and usage stuff. Basically free for all to use | ||
| 156 | as long as you say it came from me :-) | ||
| 157 | |||
| 158 | Version 3.13 31/05/95 | ||
| 159 | A fix in speed.c, if HZ is not defined, I set it to 100.0 | ||
| 160 | which is reasonable for most unixes except SunOS 4.x. | ||
| 161 | I now have a #ifdef sun but timing for SunOS 4.x looked very | ||
| 162 | good :-(. At my last job where I used SunOS 4.x, it was | ||
| 163 | defined to be 60.0 (look at the old INSTALL documentation), at | ||
| 164 | the last release had it changed to 100.0 since I now work with | ||
| 165 | Solaris2 and SVR4 boxes. | ||
| 166 | Thanks to Rory Chisholm <rchishol@math.ethz.ch> for pointing this | ||
| 167 | one out. | ||
| 168 | |||
| 169 | Version 3.12 08/05/95 | ||
| 170 | As pointed out by The Crypt Keeper <tck@bend.UCSD.EDU>, | ||
| 171 | my D_ENCRYPT macro in crypt() had an un-necessary variable. | ||
| 172 | It has been removed. | ||
| 173 | |||
| 174 | Version 3.11 03/05/95 | ||
| 175 | Added des_ede3_cbc_encrypt() which is cbc mode des with 3 keys | ||
| 176 | and one iv. It is a standard and I needed it for my SSL code. | ||
| 177 | It makes more sense to use this for triple DES than | ||
| 178 | 3cbc_encrypt(). I have also added (or should I say tested :-) | ||
| 179 | cfb64_encrypt() which is cfb64 but it will encrypt a partial | ||
| 180 | number of bytes - 3 bytes in 3 bytes out. Again this is for | ||
| 181 | my SSL library, as a form of encryption to use with SSL | ||
| 182 | telnet. | ||
| 183 | |||
| 184 | Version 3.10 22/03/95 | ||
| 185 | Fixed a bug in 3cbc_encrypt() :-(. When making repeated calls | ||
| 186 | to cbc3_encrypt, the 2 iv values that were being returned to | ||
| 187 | be used in the next call were reversed :-(. | ||
| 188 | Many thanks to Bill Wade <wade@Stoner.COM> for pointing out | ||
| 189 | this error. | ||
| 190 | |||
| 191 | Version 3.09 01/02/95 | ||
| 192 | Fixed des_random_key to far more random, it was rather feeble | ||
| 193 | with regards to picking the initial seed. The problem was | ||
| 194 | pointed out by Olaf Kirch <okir@monad.swb.de>. | ||
| 195 | |||
| 196 | Version 3.08 14/12/94 | ||
| 197 | Added Makefile.PL so libdes can be built into perl5. | ||
| 198 | Changed des_locl.h so RAND is always defined. | ||
| 199 | |||
| 200 | Version 3.07 05/12/94 | ||
| 201 | Added GNUmake and stuff so the library can be build with | ||
| 202 | glibc. | ||
| 203 | |||
| 204 | Version 3.06 30/08/94 | ||
| 205 | Added rpc_enc.c which contains _des_crypt. This is for use in | ||
| 206 | secure_rpc v 4.0 | ||
| 207 | Finally fixed the cfb_enc problems. | ||
| 208 | Fixed a few parameter parsing bugs in des (-3 and -b), thanks | ||
| 209 | to Rob McMillan <R.McMillan@its.gu.edu.au> | ||
| 210 | |||
| 211 | Version 3.05 21/04/94 | ||
| 212 | for unsigned long l; gcc does not produce ((l>>34) == 0) | ||
| 213 | This causes bugs in cfb_enc. | ||
| 214 | Thanks to Hadmut Danisch <danisch@ira.uka.de> | ||
| 215 | |||
| 216 | Version 3.04 20/04/94 | ||
| 217 | Added a version number to des.c and libdes.a | ||
| 218 | |||
| 219 | Version 3.03 12/01/94 | ||
| 220 | Fixed a bug in non zero iv in 3cbc_enc. | ||
| 221 | |||
| 222 | Version 3.02 29/10/93 | ||
| 223 | I now work in a place where there are 6+ architectures and 14+ | ||
| 224 | OS versions :-). | ||
| 225 | Fixed TERMIO definition so the most sys V boxes will work :-) | ||
| 226 | |||
| 227 | Release upon comp.sources.misc | ||
| 228 | Version 3.01 08/10/93 | ||
| 229 | Added des_3cbc_encrypt() | ||
| 230 | |||
| 231 | Version 3.00 07/10/93 | ||
| 232 | Fixed up documentation. | ||
| 233 | quad_cksum definitely compatible with MIT's now. | ||
| 234 | |||
| 235 | Version 2.30 24/08/93 | ||
| 236 | Triple DES now defaults to triple cbc but can do triple ecb | ||
| 237 | with the -b flag. | ||
| 238 | Fixed some MSDOS uuen/uudecoding problems, thanks to | ||
| 239 | Added prototypes. | ||
| 240 | |||
| 241 | Version 2.22 29/06/93 | ||
| 242 | Fixed a bug in des_is_weak_key() which stopped it working :-( | ||
| 243 | thanks to engineering@MorningStar.Com. | ||
| 244 | |||
| 245 | Version 2.21 03/06/93 | ||
| 246 | des(1) with no arguments gives quite a bit of help. | ||
| 247 | Added -c (generate ckecksum) flag to des(1). | ||
| 248 | Added -3 (triple DES) flag to des(1). | ||
| 249 | Added cfb and ofb routines to the library. | ||
| 250 | |||
| 251 | Version 2.20 11/03/93 | ||
| 252 | Added -u (uuencode) flag to des(1). | ||
| 253 | I have been playing with byte order in quad_cksum to make it | ||
| 254 | compatible with MIT's version. All I can say is avid this | ||
| 255 | function if possible since MIT's output is endian dependent. | ||
| 256 | |||
| 257 | Version 2.12 14/10/92 | ||
| 258 | Added MSDOS specific macro in ecb_encrypt which gives a %70 | ||
| 259 | speed up when the code is compiled with turbo C. | ||
| 260 | |||
| 261 | Version 2.11 12/10/92 | ||
| 262 | Speedup in set_key (recoding of PC-1) | ||
| 263 | I now do it in 47 simple operations, down from 60. | ||
| 264 | Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) | ||
| 265 | for motivating me to look for a faster system :-) | ||
| 266 | The speedup is probably less that 1% but it is still 13 | ||
| 267 | instructions less :-). | ||
| 268 | |||
| 269 | Version 2.10 06/10/92 | ||
| 270 | The code now works on the 64bit ETA10 and CRAY without modifications or | ||
| 271 | #defines. I believe the code should work on any machine that | ||
| 272 | defines long, int or short to be 8 bytes long. | ||
| 273 | Thanks to Shabbir J. Safdar (shabby@mentor.cc.purdue.edu) | ||
| 274 | for helping me fix the code to run on 64bit machines (he had | ||
| 275 | access to an ETA10). | ||
| 276 | Thanks also to John Fletcher <john_fletcher@lccmail.ocf.llnl.gov> | ||
| 277 | for testing the routines on a CRAY. | ||
| 278 | read_password.c has been renamed to read_passwd.c | ||
| 279 | string_to_key.c has been renamed to string2key.c | ||
| 280 | |||
| 281 | Version 2.00 14/09/92 | ||
| 282 | Made mods so that the library should work on 64bit CPU's. | ||
| 283 | Removed all my uchar and ulong defs. To many different | ||
| 284 | versions of unix define them in their header files in too many | ||
| 285 | different combinations :-) | ||
| 286 | IRIX - Sillicon Graphics mods (mostly in read_password.c). | ||
| 287 | Thanks to Andrew Daviel (advax@erich.triumf.ca) | ||
| 288 | |||
| 289 | Version 1.99 26/08/92 | ||
| 290 | Fixed a bug or 2 in enc_read.c | ||
| 291 | Fixed a bug in enc_write.c | ||
| 292 | Fixed a pseudo bug in fcrypt.c (very obscure). | ||
| 293 | |||
| 294 | Version 1.98 31/07/92 | ||
| 295 | Support for the ETA10. This is a strange machine that defines | ||
| 296 | longs and ints as 8 bytes and shorts as 4 bytes. | ||
| 297 | Since I do evil things with long * that assume that they are 4 | ||
| 298 | bytes. Look in the Makefile for the option to compile for | ||
| 299 | this machine. quad_cksum appears to have problems but I | ||
| 300 | will don't have the time to fix it right now, and this is not | ||
| 301 | a function that uses DES and so will not effect the main uses | ||
| 302 | of the library. | ||
| 303 | |||
| 304 | Version 1.97 20/05/92 eay | ||
| 305 | Fixed the Imakefile and made some changes to des.h to fix some | ||
| 306 | problems when building this package with Kerberos v 4. | ||
| 307 | |||
| 308 | Version 1.96 18/05/92 eay | ||
| 309 | Fixed a small bug in string_to_key() where problems could | ||
| 310 | occur if des_check_key was set to true and the string | ||
| 311 | generated a weak key. | ||
| 312 | |||
| 313 | Patch2 posted to comp.sources.misc | ||
| 314 | Version 1.95 13/05/92 eay | ||
| 315 | Added an alternative version of the D_ENCRYPT macro in | ||
| 316 | ecb_encrypt and fcrypt. Depending on the compiler, one version or the | ||
| 317 | other will be faster. This was inspired by | ||
| 318 | Dana How <how@isl.stanford.edu>, and her pointers about doing the | ||
| 319 | *(ulong *)((uchar *)ptr+(value&0xfc)) | ||
| 320 | vs | ||
| 321 | ptr[value&0x3f] | ||
| 322 | to stop the C compiler doing a <<2 to convert the long array index. | ||
| 323 | |||
| 324 | Version 1.94 05/05/92 eay | ||
| 325 | Fixed an incompatibility between my string_to_key and the MIT | ||
| 326 | version. When the key is longer than 8 chars, I was wrapping | ||
| 327 | with a different method. To use the old version, define | ||
| 328 | OLD_STR_TO_KEY in the makefile. Thanks to | ||
| 329 | viktor@newsu.shearson.com (Viktor Dukhovni). | ||
| 330 | |||
| 331 | Version 1.93 28/04/92 eay | ||
| 332 | Fixed the VMS mods so that echo is now turned off in | ||
| 333 | read_password. Thanks again to brennan@coco.cchs.su.oz.AU. | ||
| 334 | MSDOS support added. The routines can be compiled with | ||
| 335 | Turbo C (v2.0) and MSC (v5.1). Make sure MSDOS is defined. | ||
| 336 | |||
| 337 | Patch1 posted to comp.sources.misc | ||
| 338 | Version 1.92 13/04/92 eay | ||
| 339 | Changed D_ENCRYPT so that the rotation of R occurs outside of | ||
| 340 | the loop. This required rotating all the longs in sp.h (now | ||
| 341 | called spr.h). Thanks to Richard Outerbridge <71755.204@CompuServe.COM> | ||
| 342 | speed.c has been changed so it will work without SIGALRM. If | ||
| 343 | times(3) is not present it will try to use ftime() instead. | ||
| 344 | |||
| 345 | Version 1.91 08/04/92 eay | ||
| 346 | Added -E/-D options to des(1) so it can use string_to_key. | ||
| 347 | Added SVR4 mods suggested by witr@rwwa.COM | ||
| 348 | Added VMS mods suggested by brennan@coco.cchs.su.oz.AU. If | ||
| 349 | anyone knows how to turn of tty echo in VMS please tell me or | ||
| 350 | implement it yourself :-). | ||
| 351 | Changed FILE *IN/*OUT to *DES_IN/*DES_OUT since it appears VMS | ||
| 352 | does not like IN/OUT being used. | ||
| 353 | |||
| 354 | Libdes posted to comp.sources.misc | ||
| 355 | Version 1.9 24/03/92 eay | ||
| 356 | Now contains a fast small crypt replacement. | ||
| 357 | Added des(1) command. | ||
| 358 | Added des_rw_mode so people can use cbc encryption with | ||
| 359 | enc_read and enc_write. | ||
| 360 | |||
| 361 | Version 1.8 15/10/91 eay | ||
| 362 | Bug in cbc_cksum. | ||
| 363 | Many thanks to Keith Reynolds (keithr@sco.COM) for pointing this | ||
| 364 | one out. | ||
| 365 | |||
| 366 | Version 1.7 24/09/91 eay | ||
| 367 | Fixed set_key :-) | ||
| 368 | set_key is 4 times faster and takes less space. | ||
| 369 | There are a few minor changes that could be made. | ||
| 370 | |||
| 371 | Version 1.6 19/09/1991 eay | ||
| 372 | Finally go IP and FP finished. | ||
| 373 | Now I need to fix set_key. | ||
| 374 | This version is quite a bit faster that 1.51 | ||
| 375 | |||
| 376 | Version 1.52 15/06/1991 eay | ||
| 377 | 20% speedup in ecb_encrypt by changing the E bit selection | ||
| 378 | to use 2 32bit words. This also required modification of the | ||
| 379 | sp table. There is still a way to speedup the IP and IP-1 | ||
| 380 | (hints from outer@sq.com) still working on this one :-(. | ||
| 381 | |||
| 382 | Version 1.51 07/06/1991 eay | ||
| 383 | Faster des_encrypt by loop unrolling | ||
| 384 | Fixed bug in quad_cksum.c (thanks to hughes@logos.ucs.indiana.edu) | ||
| 385 | |||
| 386 | Version 1.50 28/05/1991 eay | ||
| 387 | Optimised the code a bit more for the sparc. I have improved the | ||
| 388 | speed of the inner des_encrypt by speeding up the initial and | ||
| 389 | final permutations. | ||
| 390 | |||
| 391 | Version 1.40 23/10/1990 eay | ||
| 392 | Fixed des_random_key, it did not produce a random key :-( | ||
| 393 | |||
| 394 | Version 1.30 2/10/1990 eay | ||
| 395 | Have made des_quad_cksum the same as MIT's, the full package | ||
| 396 | should be compatible with MIT's | ||
| 397 | Have tested on a DECstation 3100 | ||
| 398 | Still need to fix des_set_key (make it faster). | ||
| 399 | Does des_cbc_encrypts at 70.5k/sec on a 3100. | ||
| 400 | |||
| 401 | Version 1.20 18/09/1990 eay | ||
| 402 | Fixed byte order dependencies. | ||
| 403 | Fixed (I hope) all the word alignment problems. | ||
| 404 | Speedup in des_ecb_encrypt. | ||
| 405 | |||
| 406 | Version 1.10 11/09/1990 eay | ||
| 407 | Added des_enc_read and des_enc_write. | ||
| 408 | Still need to fix des_quad_cksum. | ||
| 409 | Still need to document des_enc_read and des_enc_write. | ||
| 410 | |||
| 411 | Version 1.00 27/08/1990 eay | ||
| 412 | |||
diff --git a/src/lib/libcrypto/des/asm/readme b/src/lib/libcrypto/des/asm/readme new file mode 100644 index 0000000000..1beafe253b --- /dev/null +++ b/src/lib/libcrypto/des/asm/readme | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | First up, let me say I don't like writing in assembler. It is not portable, | ||
| 2 | dependant on the particular CPU architecture release and is generally a pig | ||
| 3 | to debug and get right. Having said that, the x86 architecture is probably | ||
| 4 | the most important for speed due to number of boxes and since | ||
| 5 | it appears to be the worst architecture to to get | ||
| 6 | good C compilers for. So due to this, I have lowered myself to do | ||
| 7 | assembler for the inner DES routines in libdes :-). | ||
| 8 | |||
| 9 | The file to implement in assembler is des_enc.c. Replace the following | ||
| 10 | 4 functions | ||
| 11 | des_encrypt1(DES_LONG data[2],des_key_schedule ks, int encrypt); | ||
| 12 | des_encrypt2(DES_LONG data[2],des_key_schedule ks, int encrypt); | ||
| 13 | des_encrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3); | ||
| 14 | des_decrypt3(DES_LONG data[2],des_key_schedule ks1,ks2,ks3); | ||
| 15 | |||
| 16 | They encrypt/decrypt the 64 bits held in 'data' using | ||
| 17 | the 'ks' key schedules. The only difference between the 4 functions is that | ||
| 18 | des_encrypt2() does not perform IP() or FP() on the data (this is an | ||
| 19 | optimization for when doing triple DES and des_encrypt3() and des_decrypt3() | ||
| 20 | perform triple des. The triple DES routines are in here because it does | ||
| 21 | make a big difference to have them located near the des_encrypt2 function | ||
| 22 | at link time.. | ||
| 23 | |||
| 24 | Now as we all know, there are lots of different operating systems running on | ||
| 25 | x86 boxes, and unfortunately they normally try to make sure their assembler | ||
| 26 | formating is not the same as the other peoples. | ||
| 27 | The 4 main formats I know of are | ||
| 28 | Microsoft Windows 95/Windows NT | ||
| 29 | Elf Includes Linux and FreeBSD(?). | ||
| 30 | a.out The older Linux. | ||
| 31 | Solaris Same as Elf but different comments :-(. | ||
| 32 | |||
| 33 | Now I was not overly keen to write 4 different copies of the same code, | ||
| 34 | so I wrote a few perl routines to output the correct assembler, given | ||
| 35 | a target assembler type. This code is ugly and is just a hack. | ||
| 36 | The libraries are x86unix.pl and x86ms.pl. | ||
| 37 | des586.pl, des686.pl and des-som[23].pl are the programs to actually | ||
| 38 | generate the assembler. | ||
| 39 | |||
| 40 | So to generate elf assembler | ||
| 41 | perl des-som3.pl elf >dx86-elf.s | ||
| 42 | For Windows 95/NT | ||
| 43 | perl des-som2.pl win32 >win32.asm | ||
| 44 | |||
| 45 | [ update 4 Jan 1996 ] | ||
| 46 | I have added another way to do things. | ||
| 47 | perl des-som3.pl cpp >dx86-cpp.s | ||
| 48 | generates a file that will be included by dx86unix.cpp when it is compiled. | ||
| 49 | To build for elf, a.out, solaris, bsdi etc, | ||
| 50 | cc -E -DELF asm/dx86unix.cpp | as -o asm/dx86-elf.o | ||
| 51 | cc -E -DSOL asm/dx86unix.cpp | as -o asm/dx86-sol.o | ||
| 52 | cc -E -DOUT asm/dx86unix.cpp | as -o asm/dx86-out.o | ||
| 53 | cc -E -DBSDI asm/dx86unix.cpp | as -o asm/dx86bsdi.o | ||
| 54 | This was done to cut down the number of files in the distribution. | ||
| 55 | |||
| 56 | Now the ugly part. I acquired my copy of Intels | ||
| 57 | "Optimization's For Intel's 32-Bit Processors" and found a few interesting | ||
| 58 | things. First, the aim of the exersize is to 'extract' one byte at a time | ||
| 59 | from a word and do an array lookup. This involves getting the byte from | ||
| 60 | the 4 locations in the word and moving it to a new word and doing the lookup. | ||
| 61 | The most obvious way to do this is | ||
| 62 | xor eax, eax # clear word | ||
| 63 | movb al, cl # get low byte | ||
| 64 | xor edi DWORD PTR 0x100+des_SP[eax] # xor in word | ||
| 65 | movb al, ch # get next byte | ||
| 66 | xor edi DWORD PTR 0x300+des_SP[eax] # xor in word | ||
| 67 | shr ecx 16 | ||
| 68 | which seems ok. For the pentium, this system appears to be the best. | ||
| 69 | One has to do instruction interleaving to keep both functional units | ||
| 70 | operating, but it is basically very efficient. | ||
| 71 | |||
| 72 | Now the crunch. When a full register is used after a partial write, eg. | ||
| 73 | mov al, cl | ||
| 74 | xor edi, DWORD PTR 0x100+des_SP[eax] | ||
| 75 | 386 - 1 cycle stall | ||
| 76 | 486 - 1 cycle stall | ||
| 77 | 586 - 0 cycle stall | ||
| 78 | 686 - at least 7 cycle stall (page 22 of the above mentioned document). | ||
| 79 | |||
| 80 | So the technique that produces the best results on a pentium, according to | ||
| 81 | the documentation, will produce hideous results on a pentium pro. | ||
| 82 | |||
| 83 | To get around this, des686.pl will generate code that is not as fast on | ||
| 84 | a pentium, should be very good on a pentium pro. | ||
| 85 | mov eax, ecx # copy word | ||
| 86 | shr ecx, 8 # line up next byte | ||
| 87 | and eax, 0fch # mask byte | ||
| 88 | xor edi DWORD PTR 0x100+des_SP[eax] # xor in array lookup | ||
| 89 | mov eax, ecx # get word | ||
| 90 | shr ecx 8 # line up next byte | ||
| 91 | and eax, 0fch # mask byte | ||
| 92 | xor edi DWORD PTR 0x300+des_SP[eax] # xor in array lookup | ||
| 93 | |||
| 94 | Due to the execution units in the pentium, this actually works quite well. | ||
| 95 | For a pentium pro it should be very good. This is the type of output | ||
| 96 | Visual C++ generates. | ||
| 97 | |||
| 98 | There is a third option. instead of using | ||
| 99 | mov al, ch | ||
| 100 | which is bad on the pentium pro, one may be able to use | ||
| 101 | movzx eax, ch | ||
| 102 | which may not incur the partial write penalty. On the pentium, | ||
| 103 | this instruction takes 4 cycles so is not worth using but on the | ||
| 104 | pentium pro it appears it may be worth while. I need access to one to | ||
| 105 | experiment :-). | ||
| 106 | |||
| 107 | eric (20 Oct 1996) | ||
| 108 | |||
| 109 | 22 Nov 1996 - I have asked people to run the 2 different version on pentium | ||
| 110 | pros and it appears that the intel documentation is wrong. The | ||
| 111 | mov al,bh is still faster on a pentium pro, so just use the des586.pl | ||
| 112 | install des686.pl | ||
| 113 | |||
| 114 | 3 Dec 1996 - I added des_encrypt3/des_decrypt3 because I have moved these | ||
| 115 | functions into des_enc.c because it does make a massive performance | ||
| 116 | difference on some boxes to have the functions code located close to | ||
| 117 | the des_encrypt2() function. | ||
| 118 | |||
| 119 | 9 Jan 1997 - des-som2.pl is now the correct perl script to use for | ||
| 120 | pentiums. It contains an inner loop from | ||
| 121 | Svend Olaf Mikkelsen <svolaf@inet.uni-c.dk> which does raw ecb DES calls at | ||
| 122 | 273,000 per second. He had a previous version at 250,000 and the best | ||
| 123 | I was able to get was 203,000. The content has not changed, this is all | ||
| 124 | due to instruction sequencing (and actual instructions choice) which is able | ||
| 125 | to keep both functional units of the pentium going. | ||
| 126 | We may have lost the ugly register usage restrictions when x86 went 32 bit | ||
| 127 | but for the pentium it has been replaced by evil instruction ordering tricks. | ||
| 128 | |||
| 129 | 13 Jan 1997 - des-som3.pl, more optimizations from Svend Olaf. | ||
| 130 | raw DES at 281,000 per second on a pentium 100. | ||
| 131 | |||
diff --git a/src/lib/libcrypto/des/cbc3_enc.c b/src/lib/libcrypto/des/cbc3_enc.c new file mode 100644 index 0000000000..b5db4e14f7 --- /dev/null +++ b/src/lib/libcrypto/des/cbc3_enc.c | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | /* crypto/des/cbc3_enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include "des_locl.h" | ||
| 60 | |||
| 61 | /* HAS BUGS! DON'T USE - this is only present for use in des.c */ | ||
| 62 | void DES_3cbc_encrypt(DES_cblock *input, DES_cblock *output, long length, | ||
| 63 | DES_key_schedule ks1, DES_key_schedule ks2, DES_cblock *iv1, | ||
| 64 | DES_cblock *iv2, int enc) | ||
| 65 | { | ||
| 66 | int off=((int)length-1)/8; | ||
| 67 | long l8=((length+7)/8)*8; | ||
| 68 | DES_cblock niv1,niv2; | ||
| 69 | |||
| 70 | if (enc == DES_ENCRYPT) | ||
| 71 | { | ||
| 72 | DES_cbc_encrypt((unsigned char*)input, | ||
| 73 | (unsigned char*)output,length,&ks1,iv1,enc); | ||
| 74 | if (length >= sizeof(DES_cblock)) | ||
| 75 | memcpy(niv1,output[off],sizeof(DES_cblock)); | ||
| 76 | DES_cbc_encrypt((unsigned char*)output, | ||
| 77 | (unsigned char*)output,l8,&ks2,iv1,!enc); | ||
| 78 | DES_cbc_encrypt((unsigned char*)output, | ||
| 79 | (unsigned char*)output,l8,&ks1,iv2,enc); | ||
| 80 | if (length >= sizeof(DES_cblock)) | ||
| 81 | memcpy(niv2,output[off],sizeof(DES_cblock)); | ||
| 82 | } | ||
| 83 | else | ||
| 84 | { | ||
| 85 | if (length >= sizeof(DES_cblock)) | ||
| 86 | memcpy(niv2,input[off],sizeof(DES_cblock)); | ||
| 87 | DES_cbc_encrypt((unsigned char*)input, | ||
| 88 | (unsigned char*)output,l8,&ks1,iv2,enc); | ||
| 89 | DES_cbc_encrypt((unsigned char*)output, | ||
| 90 | (unsigned char*)output,l8,&ks2,iv1,!enc); | ||
| 91 | if (length >= sizeof(DES_cblock)) | ||
| 92 | memcpy(niv1,output[off],sizeof(DES_cblock)); | ||
| 93 | DES_cbc_encrypt((unsigned char*)output, | ||
| 94 | (unsigned char*)output,length,&ks1,iv1,enc); | ||
| 95 | } | ||
| 96 | memcpy(*iv1,niv1,sizeof(DES_cblock)); | ||
| 97 | memcpy(*iv2,niv2,sizeof(DES_cblock)); | ||
| 98 | } | ||
| 99 | |||
diff --git a/src/lib/libcrypto/des/des-lib.com b/src/lib/libcrypto/des/des-lib.com new file mode 100644 index 0000000000..348f1c0470 --- /dev/null +++ b/src/lib/libcrypto/des/des-lib.com | |||
| @@ -0,0 +1,1005 @@ | |||
| 1 | $! | ||
| 2 | $! DES-LIB.COM | ||
| 3 | $! Written By: Robert Byer | ||
| 4 | $! Vice-President | ||
| 5 | $! A-Com Computing, Inc. | ||
| 6 | $! byer@mail.all-net.net | ||
| 7 | $! | ||
| 8 | $! Changes by Richard Levitte <richard@levitte.org> | ||
| 9 | $! | ||
| 10 | $! This command files compiles and creates the | ||
| 11 | $! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine | ||
| 12 | $! architecture of ALPHA, IA64 or VAX. | ||
| 13 | $! | ||
| 14 | $! It was re-written to try to determine which "C" compiler to try to use | ||
| 15 | $! or the user can specify a compiler in P3. | ||
| 16 | $! | ||
| 17 | $! Specify one of the following to build just that part, specify "ALL" to | ||
| 18 | $! just build everything. | ||
| 19 | $! | ||
| 20 | $! ALL To Just Build "Everything". | ||
| 21 | $! LIBRARY To Just Build The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library. | ||
| 22 | $! DESTEST To Just Build The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program. | ||
| 23 | $! SPEED To Just Build The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program. | ||
| 24 | $! RPW To Just Build The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program. | ||
| 25 | $! DES To Just Build The [.xxx.EXE.CRYPTO.DES]DES.EXE Program. | ||
| 26 | $! DES_OPTS To Just Build The [.xxx.EXE.CRYPTO.DES]DES_OPTS.EXE Program. | ||
| 27 | $! | ||
| 28 | $! Specify either DEBUG or NODEBUG as P2 to compile with or without | ||
| 29 | $! debugging information. | ||
| 30 | $! | ||
| 31 | $! Specify which compiler at P3 to try to compile under. | ||
| 32 | $! | ||
| 33 | $! VAXC For VAX C. | ||
| 34 | $! DECC For DEC C. | ||
| 35 | $! GNUC For GNU C. | ||
| 36 | $! | ||
| 37 | $! If you don't speficy a compiler, it will try to determine which | ||
| 38 | $! "C" compiler to try to use. | ||
| 39 | $! | ||
| 40 | $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up) | ||
| 41 | $! | ||
| 42 | $! | ||
| 43 | $! Make sure we know what architecture we run on. | ||
| 44 | $! | ||
| 45 | $! | ||
| 46 | $! Check Which Architecture We Are Using. | ||
| 47 | $! | ||
| 48 | $ IF (F$GETSYI("CPU").LT.128) | ||
| 49 | $ THEN | ||
| 50 | $! | ||
| 51 | $! The Architecture Is VAX | ||
| 52 | $! | ||
| 53 | $ ARCH := VAX | ||
| 54 | $! | ||
| 55 | $! Else... | ||
| 56 | $! | ||
| 57 | $ ELSE | ||
| 58 | $! | ||
| 59 | $! The Architecture Is Alpha, IA64 or whatever comes in the future. | ||
| 60 | $! | ||
| 61 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") | ||
| 62 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
| 63 | $! | ||
| 64 | $! End The Architecture Check. | ||
| 65 | $! | ||
| 66 | $ ENDIF | ||
| 67 | $! | ||
| 68 | $! Define The OBJ Directory Name. | ||
| 69 | $! | ||
| 70 | $ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES] | ||
| 71 | $! | ||
| 72 | $! Define The EXE Directory Name. | ||
| 73 | $! | ||
| 74 | $ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES] | ||
| 75 | $! | ||
| 76 | $! Check To Make Sure We Have Valid Command Line Parameters. | ||
| 77 | $! | ||
| 78 | $ GOSUB CHECK_OPTIONS | ||
| 79 | $! | ||
| 80 | $! Tell The User What Kind of Machine We Run On. | ||
| 81 | $! | ||
| 82 | $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine." | ||
| 83 | $! | ||
| 84 | $! Check To See If The Architecture Specific OBJ Directory Exists. | ||
| 85 | $! | ||
| 86 | $ IF (F$PARSE(OBJ_DIR).EQS."") | ||
| 87 | $ THEN | ||
| 88 | $! | ||
| 89 | $! It Dosen't Exist, So Create It. | ||
| 90 | $! | ||
| 91 | $ CREATE/DIR 'OBJ_DIR' | ||
| 92 | $! | ||
| 93 | $! End The Architecture Specific OBJ Directory Check. | ||
| 94 | $! | ||
| 95 | $ ENDIF | ||
| 96 | $! | ||
| 97 | $! Check To See If The Architecture Specific Directory Exists. | ||
| 98 | $! | ||
| 99 | $ IF (F$PARSE(EXE_DIR).EQS."") | ||
| 100 | $ THEN | ||
| 101 | $! | ||
| 102 | $! It Dosen't Exist, So Create It. | ||
| 103 | $! | ||
| 104 | $ CREATE/DIR 'EXE_DIR' | ||
| 105 | $! | ||
| 106 | $! End The Architecture Specific Directory Check. | ||
| 107 | $! | ||
| 108 | $ ENDIF | ||
| 109 | $! | ||
| 110 | $! Define The Library Name. | ||
| 111 | $! | ||
| 112 | $ LIB_NAME := 'EXE_DIR'LIBDES.OLB | ||
| 113 | $! | ||
| 114 | $! Check To See What We Are To Do. | ||
| 115 | $! | ||
| 116 | $ IF (BUILDALL.EQS."TRUE") | ||
| 117 | $ THEN | ||
| 118 | $! | ||
| 119 | $! Since Nothing Special Was Specified, Do Everything. | ||
| 120 | $! | ||
| 121 | $ GOSUB LIBRARY | ||
| 122 | $ GOSUB DESTEST | ||
| 123 | $ GOSUB SPEED | ||
| 124 | $ GOSUB RPW | ||
| 125 | $ GOSUB DES | ||
| 126 | $ GOSUB DES_OPTS | ||
| 127 | $! | ||
| 128 | $! Else... | ||
| 129 | $! | ||
| 130 | $ ELSE | ||
| 131 | $! | ||
| 132 | $! Build Just What The User Wants Us To Build. | ||
| 133 | $! | ||
| 134 | $ GOSUB 'BUILDALL' | ||
| 135 | $! | ||
| 136 | $! End The BUILDALL Check. | ||
| 137 | $! | ||
| 138 | $ ENDIF | ||
| 139 | $! | ||
| 140 | $! Time To EXIT. | ||
| 141 | $! | ||
| 142 | $ EXIT | ||
| 143 | $ LIBRARY: | ||
| 144 | $! | ||
| 145 | $! Tell The User That We Are Compiling. | ||
| 146 | $! | ||
| 147 | $ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files." | ||
| 148 | $! | ||
| 149 | $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" Library... | ||
| 150 | $! | ||
| 151 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
| 152 | $ THEN | ||
| 153 | $! | ||
| 154 | $! Guess Not, Create The Library. | ||
| 155 | $! | ||
| 156 | $ LIBRARY/CREATE/OBJECT 'LIB_NAME' | ||
| 157 | $! | ||
| 158 | $! End The Library Exist Check. | ||
| 159 | $! | ||
| 160 | $ ENDIF | ||
| 161 | $! | ||
| 162 | $! Define The DES Library Files. | ||
| 163 | $! | ||
| 164 | $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ - | ||
| 165 | "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ - | ||
| 166 | "enc_read,enc_writ,ofb64enc,"+ - | ||
| 167 | "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ - | ||
| 168 | "des_enc,fcrypt_b,read2pwd,"+ - | ||
| 169 | "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp" | ||
| 170 | $! | ||
| 171 | $! Define A File Counter And Set It To "0". | ||
| 172 | $! | ||
| 173 | $ FILE_COUNTER = 0 | ||
| 174 | $! | ||
| 175 | $! Top Of The File Loop. | ||
| 176 | $! | ||
| 177 | $ NEXT_FILE: | ||
| 178 | $! | ||
| 179 | $! O.K, Extract The File Name From The File List. | ||
| 180 | $! | ||
| 181 | $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_DES) | ||
| 182 | $! | ||
| 183 | $! Check To See If We Are At The End Of The File List. | ||
| 184 | $! | ||
| 185 | $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE | ||
| 186 | $! | ||
| 187 | $! Increment The Counter. | ||
| 188 | $! | ||
| 189 | $ FILE_COUNTER = FILE_COUNTER + 1 | ||
| 190 | $! | ||
| 191 | $! Create The Source File Name. | ||
| 192 | $! | ||
| 193 | $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C" | ||
| 194 | $! | ||
| 195 | $! Tell The User We Are Compiling The Source File. | ||
| 196 | $! | ||
| 197 | $ WRITE SYS$OUTPUT " ",FILE_NAME,".C" | ||
| 198 | $! | ||
| 199 | $! Create The Object File Name. | ||
| 200 | $! | ||
| 201 | $ OBJECT_FILE = OBJ_DIR + FILE_NAME + "." + ARCH + "OBJ" | ||
| 202 | $ ON WARNING THEN GOTO NEXT_FILE | ||
| 203 | $! | ||
| 204 | $! Check To See If The File We Want To Compile Actually Exists. | ||
| 205 | $! | ||
| 206 | $ IF (F$SEARCH(SOURCE_FILE).EQS."") | ||
| 207 | $ THEN | ||
| 208 | $! | ||
| 209 | $! Tell The User That The File Dosen't Exist. | ||
| 210 | $! | ||
| 211 | $ WRITE SYS$OUTPUT "" | ||
| 212 | $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist." | ||
| 213 | $ WRITE SYS$OUTPUT "" | ||
| 214 | $! | ||
| 215 | $! Exit The Build. | ||
| 216 | $! | ||
| 217 | $ EXIT | ||
| 218 | $! | ||
| 219 | $! End The File Exists Check. | ||
| 220 | $! | ||
| 221 | $ ENDIF | ||
| 222 | $! | ||
| 223 | $! Compile The File. | ||
| 224 | $! | ||
| 225 | $ ON ERROR THEN GOTO NEXT_FILE | ||
| 226 | $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' | ||
| 227 | $! | ||
| 228 | $! Add It To The Library. | ||
| 229 | $! | ||
| 230 | $ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE' | ||
| 231 | $! | ||
| 232 | $! Time To Clean Up The Object File. | ||
| 233 | $! | ||
| 234 | $ DELETE 'OBJECT_FILE';* | ||
| 235 | $! | ||
| 236 | $! Go Back And Do It Again. | ||
| 237 | $! | ||
| 238 | $ GOTO NEXT_FILE | ||
| 239 | $! | ||
| 240 | $! All Done With This Library Part. | ||
| 241 | $! | ||
| 242 | $ FILE_DONE: | ||
| 243 | $! | ||
| 244 | $! Tell The User That We Are All Done. | ||
| 245 | $! | ||
| 246 | $ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built." | ||
| 247 | $! | ||
| 248 | $! All Done, Time To Return. | ||
| 249 | $! | ||
| 250 | $ RETURN | ||
| 251 | $! | ||
| 252 | $! Compile The DESTEST Program. | ||
| 253 | $! | ||
| 254 | $ DESTEST: | ||
| 255 | $! | ||
| 256 | $! Check To See If We Have The Proper Libraries. | ||
| 257 | $! | ||
| 258 | $ GOSUB LIB_CHECK | ||
| 259 | $! | ||
| 260 | $! Check To See If We Have A Linker Option File. | ||
| 261 | $! | ||
| 262 | $ GOSUB CHECK_OPT_FILE | ||
| 263 | $! | ||
| 264 | $! Check To See If The File We Want To Compile Actually Exists. | ||
| 265 | $! | ||
| 266 | $ IF (F$SEARCH("SYS$DISK:[]DESTEST.C").EQS."") | ||
| 267 | $ THEN | ||
| 268 | $! | ||
| 269 | $! Tell The User That The File Dosen't Exist. | ||
| 270 | $! | ||
| 271 | $ WRITE SYS$OUTPUT "" | ||
| 272 | $ WRITE SYS$OUTPUT "The File DESTEST.C Dosen't Exist." | ||
| 273 | $ WRITE SYS$OUTPUT "" | ||
| 274 | $! | ||
| 275 | $! Exit The Build. | ||
| 276 | $! | ||
| 277 | $ EXIT | ||
| 278 | $! | ||
| 279 | $! End The DESTEST.C File Check. | ||
| 280 | $! | ||
| 281 | $ ENDIF | ||
| 282 | $! | ||
| 283 | $! Tell The User What We Are Building. | ||
| 284 | $! | ||
| 285 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DESTEST.EXE" | ||
| 286 | $! | ||
| 287 | $! Compile The DESTEST Program. | ||
| 288 | $! | ||
| 289 | $ CC/OBJECT='OBJ_DIR'DESTEST.OBJ SYS$DISK:[]DESTEST.C | ||
| 290 | $! | ||
| 291 | $! Link The DESTEST Program. | ||
| 292 | $! | ||
| 293 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DESTEST.EXE - | ||
| 294 | 'OBJ_DIR'DESTEST.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
| 295 | $! | ||
| 296 | $! All Done, Time To Return. | ||
| 297 | $! | ||
| 298 | $ RETURN | ||
| 299 | $! | ||
| 300 | $! Compile The SPEED Program. | ||
| 301 | $! | ||
| 302 | $ SPEED: | ||
| 303 | $! | ||
| 304 | $! Check To See If We Have The Proper Libraries. | ||
| 305 | $! | ||
| 306 | $ GOSUB LIB_CHECK | ||
| 307 | $! | ||
| 308 | $! Check To See If We Have A Linker Option File. | ||
| 309 | $! | ||
| 310 | $ GOSUB CHECK_OPT_FILE | ||
| 311 | $! | ||
| 312 | $! Check To See If The File We Want To Compile Actually Exists. | ||
| 313 | $! | ||
| 314 | $ IF (F$SEARCH("SYS$DISK:[]SPEED.C").EQS."") | ||
| 315 | $ THEN | ||
| 316 | $! | ||
| 317 | $! Tell The User That The File Dosen't Exist. | ||
| 318 | $! | ||
| 319 | $ WRITE SYS$OUTPUT "" | ||
| 320 | $ WRITE SYS$OUTPUT "The File SPEED.C Dosen't Exist." | ||
| 321 | $ WRITE SYS$OUTPUT "" | ||
| 322 | $! | ||
| 323 | $! Exit The Build. | ||
| 324 | $! | ||
| 325 | $ EXIT | ||
| 326 | $! | ||
| 327 | $! End The SPEED.C File Check. | ||
| 328 | $! | ||
| 329 | $ ENDIF | ||
| 330 | $! | ||
| 331 | $! Tell The User What We Are Building. | ||
| 332 | $! | ||
| 333 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"SPEED.EXE" | ||
| 334 | $! | ||
| 335 | $! Compile The SPEED Program. | ||
| 336 | $! | ||
| 337 | $ CC/OBJECT='OBJ_DIR'SPEED.OBJ SYS$DISK:[]SPEED.C | ||
| 338 | $! | ||
| 339 | $! Link The SPEED Program. | ||
| 340 | $! | ||
| 341 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'SPEED.EXE - | ||
| 342 | 'OBJ_DIR'SPEED.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
| 343 | $! | ||
| 344 | $! All Done, Time To Return. | ||
| 345 | $! | ||
| 346 | $ RETURN | ||
| 347 | $! | ||
| 348 | $! Compile The RPW Program. | ||
| 349 | $! | ||
| 350 | $ RPW: | ||
| 351 | $! | ||
| 352 | $! Check To See If We Have The Proper Libraries. | ||
| 353 | $! | ||
| 354 | $ GOSUB LIB_CHECK | ||
| 355 | $! | ||
| 356 | $! Check To See If We Have A Linker Option File. | ||
| 357 | $! | ||
| 358 | $ GOSUB CHECK_OPT_FILE | ||
| 359 | $! | ||
| 360 | $! Check To See If The File We Want To Compile Actually Exists. | ||
| 361 | $! | ||
| 362 | $ IF (F$SEARCH("SYS$DISK:[]RPW.C").EQS."") | ||
| 363 | $ THEN | ||
| 364 | $! | ||
| 365 | $! Tell The User That The File Dosen't Exist. | ||
| 366 | $! | ||
| 367 | $ WRITE SYS$OUTPUT "" | ||
| 368 | $ WRITE SYS$OUTPUT "The File RPW.C Dosen't Exist." | ||
| 369 | $ WRITE SYS$OUTPUT "" | ||
| 370 | $! | ||
| 371 | $! Exit The Build. | ||
| 372 | $! | ||
| 373 | $ EXIT | ||
| 374 | $! | ||
| 375 | $! End The RPW.C File Check. | ||
| 376 | $! | ||
| 377 | $ ENDIF | ||
| 378 | $! | ||
| 379 | $! Tell The User What We Are Building. | ||
| 380 | $! | ||
| 381 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RPW.EXE" | ||
| 382 | $! | ||
| 383 | $! Compile The RPW Program. | ||
| 384 | $! | ||
| 385 | $ CC/OBJECT='OBJ_DIR'RPW.OBJ SYS$DISK:[]RPW.C | ||
| 386 | $! | ||
| 387 | $! Link The RPW Program. | ||
| 388 | $! | ||
| 389 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'RPW.EXE - | ||
| 390 | 'OBJ_DIR'RPW.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
| 391 | $! | ||
| 392 | $! All Done, Time To Return. | ||
| 393 | $! | ||
| 394 | $ RETURN | ||
| 395 | $! | ||
| 396 | $! Compile The DES Program. | ||
| 397 | $! | ||
| 398 | $ DES: | ||
| 399 | $! | ||
| 400 | $! Check To See If We Have The Proper Libraries. | ||
| 401 | $! | ||
| 402 | $ GOSUB LIB_CHECK | ||
| 403 | $! | ||
| 404 | $! Check To See If We Have A Linker Option File. | ||
| 405 | $! | ||
| 406 | $ GOSUB CHECK_OPT_FILE | ||
| 407 | $! | ||
| 408 | $! Check To See If The File We Want To Compile Actually Exists. | ||
| 409 | $! | ||
| 410 | $ IF (F$SEARCH("SYS$DISK:[]DES.C").EQS."") | ||
| 411 | $ THEN | ||
| 412 | $! | ||
| 413 | $! Tell The User That The File Dosen't Exist. | ||
| 414 | $! | ||
| 415 | $ WRITE SYS$OUTPUT "" | ||
| 416 | $ WRITE SYS$OUTPUT "The File DES.C Dosen't Exist." | ||
| 417 | $ WRITE SYS$OUTPUT "" | ||
| 418 | $! | ||
| 419 | $! Exit The Build. | ||
| 420 | $! | ||
| 421 | $ EXIT | ||
| 422 | $! | ||
| 423 | $! End The DES.C File Check. | ||
| 424 | $! | ||
| 425 | $ ENDIF | ||
| 426 | $! | ||
| 427 | $! Tell The User What We Are Building. | ||
| 428 | $! | ||
| 429 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES.EXE" | ||
| 430 | $! | ||
| 431 | $! Compile The DES Program. | ||
| 432 | $! | ||
| 433 | $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]DES.C | ||
| 434 | $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]CBC3_ENC.C | ||
| 435 | $! | ||
| 436 | $! Link The DES Program. | ||
| 437 | $! | ||
| 438 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES.EXE - | ||
| 439 | 'OBJ_DIR'DES.OBJ,'OBJ_DIR'CBC3_ENC.OBJ,- | ||
| 440 | 'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
| 441 | $! | ||
| 442 | $! All Done, Time To Return. | ||
| 443 | $! | ||
| 444 | $ RETURN | ||
| 445 | $! | ||
| 446 | $! Compile The DES_OPTS Program. | ||
| 447 | $! | ||
| 448 | $ DES_OPTS: | ||
| 449 | $! | ||
| 450 | $! Check To See If We Have The Proper Libraries. | ||
| 451 | $! | ||
| 452 | $ GOSUB LIB_CHECK | ||
| 453 | $! | ||
| 454 | $! Check To See If We Have A Linker Option File. | ||
| 455 | $! | ||
| 456 | $ GOSUB CHECK_OPT_FILE | ||
| 457 | $! | ||
| 458 | $! Check To See If The File We Want To Compile Actually Exists. | ||
| 459 | $! | ||
| 460 | $ IF (F$SEARCH("SYS$DISK:[]DES_OPTS.C").EQS."") | ||
| 461 | $ THEN | ||
| 462 | $! | ||
| 463 | $! Tell The User That The File Dosen't Exist. | ||
| 464 | $! | ||
| 465 | $ WRITE SYS$OUTPUT "" | ||
| 466 | $ WRITE SYS$OUTPUT "The File DES_OPTS.C Dosen't Exist." | ||
| 467 | $ WRITE SYS$OUTPUT "" | ||
| 468 | $! | ||
| 469 | $! Exit The Build. | ||
| 470 | $! | ||
| 471 | $ EXIT | ||
| 472 | $! | ||
| 473 | $! End The DES_OPTS.C File Check. | ||
| 474 | $! | ||
| 475 | $ ENDIF | ||
| 476 | $! | ||
| 477 | $! Tell The User What We Are Building. | ||
| 478 | $! | ||
| 479 | $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES_OPTS.EXE" | ||
| 480 | $! | ||
| 481 | $! Compile The DES_OPTS Program. | ||
| 482 | $! | ||
| 483 | $ CC/OBJECT='OBJ_DIR'DES_OPTS.OBJ SYS$DISK:[]DES_OPTS.C | ||
| 484 | $! | ||
| 485 | $! Link The DES_OPTS Program. | ||
| 486 | $! | ||
| 487 | $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES_OPTS.EXE - | ||
| 488 | 'OBJ_DIR'DES_OPTS.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION | ||
| 489 | $! | ||
| 490 | $! All Done, Time To Return. | ||
| 491 | $! | ||
| 492 | $ RETURN | ||
| 493 | $ EXIT | ||
| 494 | $! | ||
| 495 | $! Check For The Link Option FIle. | ||
| 496 | $! | ||
| 497 | $ CHECK_OPT_FILE: | ||
| 498 | $! | ||
| 499 | $! Check To See If We Need To Make A VAX C Option File. | ||
| 500 | $! | ||
| 501 | $ IF (COMPILER.EQS."VAXC") | ||
| 502 | $ THEN | ||
| 503 | $! | ||
| 504 | $! Check To See If We Already Have A VAX C Linker Option File. | ||
| 505 | $! | ||
| 506 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
| 507 | $ THEN | ||
| 508 | $! | ||
| 509 | $! We Need A VAX C Linker Option File. | ||
| 510 | $! | ||
| 511 | $ CREATE 'OPT_FILE' | ||
| 512 | $DECK | ||
| 513 | ! | ||
| 514 | ! Default System Options File To Link Agianst | ||
| 515 | ! The Sharable VAX C Runtime Library. | ||
| 516 | ! | ||
| 517 | SYS$SHARE:VAXCRTL.EXE/SHARE | ||
| 518 | $EOD | ||
| 519 | $! | ||
| 520 | $! End The Option File Check. | ||
| 521 | $! | ||
| 522 | $ ENDIF | ||
| 523 | $! | ||
| 524 | $! End The VAXC Check. | ||
| 525 | $! | ||
| 526 | $ ENDIF | ||
| 527 | $! | ||
| 528 | $! Check To See If We Need A GNU C Option File. | ||
| 529 | $! | ||
| 530 | $ IF (COMPILER.EQS."GNUC") | ||
| 531 | $ THEN | ||
| 532 | $! | ||
| 533 | $! Check To See If We Already Have A GNU C Linker Option File. | ||
| 534 | $! | ||
| 535 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
| 536 | $ THEN | ||
| 537 | $! | ||
| 538 | $! We Need A GNU C Linker Option File. | ||
| 539 | $! | ||
| 540 | $ CREATE 'OPT_FILE' | ||
| 541 | $DECK | ||
| 542 | ! | ||
| 543 | ! Default System Options File To Link Agianst | ||
| 544 | ! The Sharable C Runtime Library. | ||
| 545 | ! | ||
| 546 | GNU_CC:[000000]GCCLIB/LIBRARY | ||
| 547 | SYS$SHARE:VAXCRTL/SHARE | ||
| 548 | $EOD | ||
| 549 | $! | ||
| 550 | $! End The Option File Check. | ||
| 551 | $! | ||
| 552 | $ ENDIF | ||
| 553 | $! | ||
| 554 | $! End The GNU C Check. | ||
| 555 | $! | ||
| 556 | $ ENDIF | ||
| 557 | $! | ||
| 558 | $! Check To See If We Need A DEC C Option File. | ||
| 559 | $! | ||
| 560 | $ IF (COMPILER.EQS."DECC") | ||
| 561 | $ THEN | ||
| 562 | $! | ||
| 563 | $! Check To See If We Already Have A DEC C Linker Option File. | ||
| 564 | $! | ||
| 565 | $ IF (F$SEARCH(OPT_FILE).EQS."") | ||
| 566 | $ THEN | ||
| 567 | $! | ||
| 568 | $! Figure Out If We Need An non-VAX Or A VAX Linker Option File. | ||
| 569 | $! | ||
| 570 | $ IF (F$GETSYI("CPU").LT.128) | ||
| 571 | $ THEN | ||
| 572 | $! | ||
| 573 | $! We Need A DEC C Linker Option File For VAX. | ||
| 574 | $! | ||
| 575 | $ CREATE 'OPT_FILE' | ||
| 576 | $DECK | ||
| 577 | ! | ||
| 578 | ! Default System Options File To Link Agianst | ||
| 579 | ! The Sharable DEC C Runtime Library. | ||
| 580 | ! | ||
| 581 | SYS$SHARE:DECC$SHR.EXE/SHARE | ||
| 582 | $EOD | ||
| 583 | $! | ||
| 584 | $! Else... | ||
| 585 | $! | ||
| 586 | $ ELSE | ||
| 587 | $! | ||
| 588 | $! Create The non-VAX Linker Option File. | ||
| 589 | $! | ||
| 590 | $ CREATE 'OPT_FILE' | ||
| 591 | $DECK | ||
| 592 | ! | ||
| 593 | ! Default System Options File For non-VAX To Link Agianst | ||
| 594 | ! The Sharable C Runtime Library. | ||
| 595 | ! | ||
| 596 | SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE | ||
| 597 | SYS$SHARE:CMA$OPEN_RTL/SHARE | ||
| 598 | $EOD | ||
| 599 | $! | ||
| 600 | $! End The DEC C Option File Check. | ||
| 601 | $! | ||
| 602 | $ ENDIF | ||
| 603 | $! | ||
| 604 | $! End The Option File Search. | ||
| 605 | $! | ||
| 606 | $ ENDIF | ||
| 607 | $! | ||
| 608 | $! End The DEC C Check. | ||
| 609 | $! | ||
| 610 | $ ENDIF | ||
| 611 | $! | ||
| 612 | $! Tell The User What Linker Option File We Are Using. | ||
| 613 | $! | ||
| 614 | $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"." | ||
| 615 | $! | ||
| 616 | $! Time To RETURN. | ||
| 617 | $! | ||
| 618 | $ RETURN | ||
| 619 | $! | ||
| 620 | $! Library Check. | ||
| 621 | $! | ||
| 622 | $ LIB_CHECK: | ||
| 623 | $! | ||
| 624 | $! Look For The Library LIBDES.OLB. | ||
| 625 | $! | ||
| 626 | $ IF (F$SEARCH(LIB_NAME).EQS."") | ||
| 627 | $ THEN | ||
| 628 | $! | ||
| 629 | $! Tell The User We Can't Find The [.xxx.CRYPTO.DES]LIBDES.OLB Library. | ||
| 630 | $! | ||
| 631 | $ WRITE SYS$OUTPUT "" | ||
| 632 | $ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"." | ||
| 633 | $ WRITE SYS$OUTPUT "We Can't Link Without It." | ||
| 634 | $ WRITE SYS$OUTPUT "" | ||
| 635 | $! | ||
| 636 | $! Since We Can't Link Without It, Exit. | ||
| 637 | $! | ||
| 638 | $ EXIT | ||
| 639 | $ ENDIF | ||
| 640 | $! | ||
| 641 | $! Time To Return. | ||
| 642 | $! | ||
| 643 | $ RETURN | ||
| 644 | $! | ||
| 645 | $! Check The User's Options. | ||
| 646 | $! | ||
| 647 | $ CHECK_OPTIONS: | ||
| 648 | $! | ||
| 649 | $! Check To See If We Are To "Just Build Everything". | ||
| 650 | $! | ||
| 651 | $ IF (P1.EQS."ALL") | ||
| 652 | $ THEN | ||
| 653 | $! | ||
| 654 | $! P1 Is "ALL", So Build Everything. | ||
| 655 | $! | ||
| 656 | $ BUILDALL = "TRUE" | ||
| 657 | $! | ||
| 658 | $! Else... | ||
| 659 | $! | ||
| 660 | $ ELSE | ||
| 661 | $! | ||
| 662 | $! Else, Check To See If P1 Has A Valid Argument. | ||
| 663 | $! | ||
| 664 | $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") - | ||
| 665 | .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS") | ||
| 666 | $ THEN | ||
| 667 | $! | ||
| 668 | $! A Valid Argument. | ||
| 669 | $! | ||
| 670 | $ BUILDALL = P1 | ||
| 671 | $! | ||
| 672 | $! Else... | ||
| 673 | $! | ||
| 674 | $ ELSE | ||
| 675 | $! | ||
| 676 | $! Tell The User We Don't Know What They Want. | ||
| 677 | $! | ||
| 678 | $ WRITE SYS$OUTPUT "" | ||
| 679 | $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:" | ||
| 680 | $ WRITE SYS$OUTPUT "" | ||
| 681 | $ WRITE SYS$OUTPUT " ALL : Just Build Everything." | ||
| 682 | $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library." | ||
| 683 | $ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program." | ||
| 684 | $ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program." | ||
| 685 | $ WRITE SYS$OUTPUT " RPW : To Compile Just The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program." | ||
| 686 | $ WRITE SYS$OUTPUT " DES : To Compile Just The [.xxx.EXE.CRYPTO.DES]DES.EXE Program." | ||
| 687 | $ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES]DES_OPTS.EXE Program." | ||
| 688 | $ WRITE SYS$OUTPUT "" | ||
| 689 | $ WRITE SYS$OUTPUT " Where 'xxx' Stands For: " | ||
| 690 | $ WRITE SYS$OUTPUT "" | ||
| 691 | $ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture." | ||
| 692 | $ WRITE SYS$OUTPUT " IA64 : IA64 Architecture." | ||
| 693 | $ WRITE SYS$OUTPUT " VAX : VAX Architecture." | ||
| 694 | $ WRITE SYS$OUTPUT "" | ||
| 695 | $! | ||
| 696 | $! Time To EXIT. | ||
| 697 | $! | ||
| 698 | $ EXIT | ||
| 699 | $! | ||
| 700 | $! End The Valid Argument Check. | ||
| 701 | $! | ||
| 702 | $ ENDIF | ||
| 703 | $! | ||
| 704 | $! End The P1 Check. | ||
| 705 | $! | ||
| 706 | $ ENDIF | ||
| 707 | $! | ||
| 708 | $! Check To See If We Are To Compile Without Debugger Information. | ||
| 709 | $! | ||
| 710 | $ IF (P2.EQS."NODEBUG") | ||
| 711 | $ THEN | ||
| 712 | $! | ||
| 713 | $! P2 Is Blank, So Compile Without Debugger Information. | ||
| 714 | $! | ||
| 715 | $ DEBUGGER = "NODEBUG" | ||
| 716 | $ TRACEBACK = "NOTRACEBACK" | ||
| 717 | $ GCC_OPTIMIZE = "OPTIMIZE" | ||
| 718 | $ CC_OPTIMIZE = "OPTIMIZE" | ||
| 719 | $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." | ||
| 720 | $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." | ||
| 721 | $! | ||
| 722 | $! Else... | ||
| 723 | $! | ||
| 724 | $ ELSE | ||
| 725 | $! | ||
| 726 | $! Check To See If We Are To Compile With Debugger Information. | ||
| 727 | $! | ||
| 728 | $ IF (P2.EQS."DEBUG") | ||
| 729 | $ THEN | ||
| 730 | $! | ||
| 731 | $! Compile With Debugger Information. | ||
| 732 | $! | ||
| 733 | $ DEBUGGER = "DEBUG" | ||
| 734 | $ TRACEBACK = "TRACEBACK" | ||
| 735 | $ GCC_OPTIMIZE = "NOOPTIMIZE" | ||
| 736 | $ CC_OPTIMIZE = "NOOPTIMIZE" | ||
| 737 | $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." | ||
| 738 | $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." | ||
| 739 | $! | ||
| 740 | $! Else... | ||
| 741 | $! | ||
| 742 | $ ELSE | ||
| 743 | $! | ||
| 744 | $! Tell The User Entered An Invalid Option.. | ||
| 745 | $! | ||
| 746 | $ WRITE SYS$OUTPUT "" | ||
| 747 | $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:" | ||
| 748 | $ WRITE SYS$OUTPUT "" | ||
| 749 | $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." | ||
| 750 | $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." | ||
| 751 | $ WRITE SYS$OUTPUT "" | ||
| 752 | $! | ||
| 753 | $! Time To EXIT. | ||
| 754 | $! | ||
| 755 | $ EXIT | ||
| 756 | $! | ||
| 757 | $! End The Valid Argument Check. | ||
| 758 | $! | ||
| 759 | $ ENDIF | ||
| 760 | $! | ||
| 761 | $! End The P2 Check. | ||
| 762 | $! | ||
| 763 | $ ENDIF | ||
| 764 | $! | ||
| 765 | $! Special Threads For OpenVMS v7.1 Or Later. | ||
| 766 | $! | ||
| 767 | $! Written By: Richard Levitte | ||
| 768 | $! richard@levitte.org | ||
| 769 | $! | ||
| 770 | $! | ||
| 771 | $! Check To See If We Have A Option For P4. | ||
| 772 | $! | ||
| 773 | $ IF (P4.EQS."") | ||
| 774 | $ THEN | ||
| 775 | $! | ||
| 776 | $! Get The Version Of VMS We Are Using. | ||
| 777 | $! | ||
| 778 | $ ISSEVEN := "" | ||
| 779 | $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION"))) | ||
| 780 | $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP)) | ||
| 781 | $! | ||
| 782 | $! Check To See If The VMS Version Is v7.1 Or Later. | ||
| 783 | $! | ||
| 784 | $ IF (TMP.GE.71) | ||
| 785 | $ THEN | ||
| 786 | $! | ||
| 787 | $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads. | ||
| 788 | $! | ||
| 789 | $ ISSEVEN := ,PTHREAD_USE_D4 | ||
| 790 | $! | ||
| 791 | $! End The VMS Version Check. | ||
| 792 | $! | ||
| 793 | $ ENDIF | ||
| 794 | $! | ||
| 795 | $! End The P4 Check. | ||
| 796 | $! | ||
| 797 | $ ENDIF | ||
| 798 | $! | ||
| 799 | $! Check To See If P3 Is Blank. | ||
| 800 | $! | ||
| 801 | $ IF (P3.EQS."") | ||
| 802 | $ THEN | ||
| 803 | $! | ||
| 804 | $! O.K., The User Didn't Specify A Compiler, Let's Try To | ||
| 805 | $! Find Out Which One To Use. | ||
| 806 | $! | ||
| 807 | $! Check To See If We Have GNU C. | ||
| 808 | $! | ||
| 809 | $ IF (F$TRNLNM("GNU_CC").NES."") | ||
| 810 | $ THEN | ||
| 811 | $! | ||
| 812 | $! Looks Like GNUC, Set To Use GNUC. | ||
| 813 | $! | ||
| 814 | $ P3 = "GNUC" | ||
| 815 | $! | ||
| 816 | $! Else... | ||
| 817 | $! | ||
| 818 | $ ELSE | ||
| 819 | $! | ||
| 820 | $! Check To See If We Have VAXC Or DECC. | ||
| 821 | $! | ||
| 822 | $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") | ||
| 823 | $ THEN | ||
| 824 | $! | ||
| 825 | $! Looks Like DECC, Set To Use DECC. | ||
| 826 | $! | ||
| 827 | $ P3 = "DECC" | ||
| 828 | $! | ||
| 829 | $! Else... | ||
| 830 | $! | ||
| 831 | $ ELSE | ||
| 832 | $! | ||
| 833 | $! Looks Like VAXC, Set To Use VAXC. | ||
| 834 | $! | ||
| 835 | $ P3 = "VAXC" | ||
| 836 | $! | ||
| 837 | $! End The VAXC Compiler Check. | ||
| 838 | $! | ||
| 839 | $ ENDIF | ||
| 840 | $! | ||
| 841 | $! End The DECC & VAXC Compiler Check. | ||
| 842 | $! | ||
| 843 | $ ENDIF | ||
| 844 | $! | ||
| 845 | $! End The Compiler Check. | ||
| 846 | $! | ||
| 847 | $ ENDIF | ||
| 848 | $! | ||
| 849 | $! Set Up Initial CC Definitions, Possibly With User Ones | ||
| 850 | $! | ||
| 851 | $ CCDEFS = "" | ||
| 852 | $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = USER_CCDEFS | ||
| 853 | $ CCEXTRAFLAGS = "" | ||
| 854 | $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS | ||
| 855 | $ CCDISABLEWARNINGS = "" | ||
| 856 | $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN - | ||
| 857 | CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS | ||
| 858 | $! | ||
| 859 | $! Check To See If The User Entered A Valid Paramter. | ||
| 860 | $! | ||
| 861 | $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC") | ||
| 862 | $ THEN | ||
| 863 | $! | ||
| 864 | $! Check To See If The User Wanted DECC. | ||
| 865 | $! | ||
| 866 | $ IF (P3.EQS."DECC") | ||
| 867 | $ THEN | ||
| 868 | $! | ||
| 869 | $! Looks Like DECC, Set To Use DECC. | ||
| 870 | $! | ||
| 871 | $ COMPILER = "DECC" | ||
| 872 | $! | ||
| 873 | $! Tell The User We Are Using DECC. | ||
| 874 | $! | ||
| 875 | $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler." | ||
| 876 | $! | ||
| 877 | $! Use DECC... | ||
| 878 | $! | ||
| 879 | $ CC = "CC" | ||
| 880 | $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - | ||
| 881 | THEN CC = "CC/DECC" | ||
| 882 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + - | ||
| 883 | "/NOLIST/PREFIX=ALL" + CCEXTRAFLAGS | ||
| 884 | $! | ||
| 885 | $! Define The Linker Options File Name. | ||
| 886 | $! | ||
| 887 | $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT" | ||
| 888 | $! | ||
| 889 | $! End DECC Check. | ||
| 890 | $! | ||
| 891 | $ ENDIF | ||
| 892 | $! | ||
| 893 | $! Check To See If We Are To Use VAXC. | ||
| 894 | $! | ||
| 895 | $ IF (P3.EQS."VAXC") | ||
| 896 | $ THEN | ||
| 897 | $! | ||
| 898 | $! Looks Like VAXC, Set To Use VAXC. | ||
| 899 | $! | ||
| 900 | $ COMPILER = "VAXC" | ||
| 901 | $! | ||
| 902 | $! Tell The User We Are Using VAX C. | ||
| 903 | $! | ||
| 904 | $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler." | ||
| 905 | $! | ||
| 906 | $! Compile Using VAXC. | ||
| 907 | $! | ||
| 908 | $ CC = "CC" | ||
| 909 | $ IF ARCH.NES."VAX" | ||
| 910 | $ THEN | ||
| 911 | $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!" | ||
| 912 | $ EXIT | ||
| 913 | $ ENDIF | ||
| 914 | $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" | ||
| 915 | $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | ||
| 916 | $ CCDEFS = """VAXC""," + CCDEFS | ||
| 917 | $! | ||
| 918 | $! Define <sys> As SYS$COMMON:[SYSLIB] | ||
| 919 | $! | ||
| 920 | $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] | ||
| 921 | $! | ||
| 922 | $! Define The Linker Options File Name. | ||
| 923 | $! | ||
| 924 | $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT" | ||
| 925 | $! | ||
| 926 | $! End VAXC Check | ||
| 927 | $! | ||
| 928 | $ ENDIF | ||
| 929 | $! | ||
| 930 | $! Check To See If We Are To Use GNU C. | ||
| 931 | $! | ||
| 932 | $ IF (P3.EQS."GNUC") | ||
| 933 | $ THEN | ||
| 934 | $! | ||
| 935 | $! Looks Like GNUC, Set To Use GNUC. | ||
| 936 | $! | ||
| 937 | $ COMPILER = "GNUC" | ||
| 938 | $! | ||
| 939 | $! Tell The User We Are Using GNUC. | ||
| 940 | $! | ||
| 941 | $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler." | ||
| 942 | $! | ||
| 943 | $! Use GNU C... | ||
| 944 | $! | ||
| 945 | $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS | ||
| 946 | $! | ||
| 947 | $! Define The Linker Options File Name. | ||
| 948 | $! | ||
| 949 | $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT" | ||
| 950 | $! | ||
| 951 | $! End The GNU C Check. | ||
| 952 | $! | ||
| 953 | $ ENDIF | ||
| 954 | $! | ||
| 955 | $! Set up default defines | ||
| 956 | $! | ||
| 957 | $ CCDEFS = """FLAT_INC=1""," + CCDEFS | ||
| 958 | $! | ||
| 959 | $! Finish up the definition of CC. | ||
| 960 | $! | ||
| 961 | $ IF COMPILER .EQS. "DECC" | ||
| 962 | $ THEN | ||
| 963 | $ IF CCDISABLEWARNINGS .EQS. "" | ||
| 964 | $ THEN | ||
| 965 | $ CC4DISABLEWARNINGS = "DOLLARID" | ||
| 966 | $ ELSE | ||
| 967 | $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID" | ||
| 968 | $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" | ||
| 969 | $ ENDIF | ||
| 970 | $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))" | ||
| 971 | $ ELSE | ||
| 972 | $ CCDISABLEWARNINGS = "" | ||
| 973 | $ CC4DISABLEWARNINGS = "" | ||
| 974 | $ ENDIF | ||
| 975 | $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS | ||
| 976 | $! | ||
| 977 | $! Show user the result | ||
| 978 | $! | ||
| 979 | $ WRITE SYS$OUTPUT "Main Compiling Command: ",CC | ||
| 980 | $! | ||
| 981 | $! Else The User Entered An Invalid Argument. | ||
| 982 | $! | ||
| 983 | $ ELSE | ||
| 984 | $! | ||
| 985 | $! Tell The User We Don't Know What They Want. | ||
| 986 | $! | ||
| 987 | $ WRITE SYS$OUTPUT "" | ||
| 988 | $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:" | ||
| 989 | $ WRITE SYS$OUTPUT "" | ||
| 990 | $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." | ||
| 991 | $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." | ||
| 992 | $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C." | ||
| 993 | $ WRITE SYS$OUTPUT "" | ||
| 994 | $! | ||
| 995 | $! Time To EXIT. | ||
| 996 | $! | ||
| 997 | $ EXIT | ||
| 998 | $! | ||
| 999 | $! End The P3 Check. | ||
| 1000 | $! | ||
| 1001 | $ ENDIF | ||
| 1002 | $! | ||
| 1003 | $! Time To RETURN... | ||
| 1004 | $! | ||
| 1005 | $ RETURN | ||
diff --git a/src/lib/libcrypto/des/des.c b/src/lib/libcrypto/des/des.c new file mode 100644 index 0000000000..343135ff9e --- /dev/null +++ b/src/lib/libcrypto/des/des.c | |||
| @@ -0,0 +1,932 @@ | |||
| 1 | /* crypto/des/des.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <openssl/opensslconf.h> | ||
| 63 | #ifndef OPENSSL_SYS_MSDOS | ||
| 64 | #ifndef OPENSSL_SYS_VMS | ||
| 65 | #include OPENSSL_UNISTD | ||
| 66 | #else /* OPENSSL_SYS_VMS */ | ||
| 67 | #ifdef __DECC | ||
| 68 | #include <unistd.h> | ||
| 69 | #else /* not __DECC */ | ||
| 70 | #include <math.h> | ||
| 71 | #endif /* __DECC */ | ||
| 72 | #endif /* OPENSSL_SYS_VMS */ | ||
| 73 | #else /* OPENSSL_SYS_MSDOS */ | ||
| 74 | #include <io.h> | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #include <time.h> | ||
| 78 | #include "des_ver.h" | ||
| 79 | |||
| 80 | #ifdef OPENSSL_SYS_VMS | ||
| 81 | #include <types.h> | ||
| 82 | #include <stat.h> | ||
| 83 | #else | ||
| 84 | #ifndef _IRIX | ||
| 85 | #include <sys/types.h> | ||
| 86 | #endif | ||
| 87 | #include <sys/stat.h> | ||
| 88 | #endif | ||
| 89 | #include <openssl/des.h> | ||
| 90 | #include <openssl/rand.h> | ||
| 91 | #include <openssl/ui_compat.h> | ||
| 92 | |||
| 93 | void usage(void); | ||
| 94 | void doencryption(void); | ||
| 95 | int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp); | ||
| 96 | void uufwriteEnd(FILE *fp); | ||
| 97 | int uufread(unsigned char *out,int size,unsigned int num,FILE *fp); | ||
| 98 | int uuencode(unsigned char *in,int num,unsigned char *out); | ||
| 99 | int uudecode(unsigned char *in,int num,unsigned char *out); | ||
| 100 | void DES_3cbc_encrypt(DES_cblock *input,DES_cblock *output,long length, | ||
| 101 | DES_key_schedule sk1,DES_key_schedule sk2, | ||
| 102 | DES_cblock *ivec1,DES_cblock *ivec2,int enc); | ||
| 103 | #ifdef OPENSSL_SYS_VMS | ||
| 104 | #define EXIT(a) exit(a&0x10000000L) | ||
| 105 | #else | ||
| 106 | #define EXIT(a) exit(a) | ||
| 107 | #endif | ||
| 108 | |||
| 109 | #define BUFSIZE (8*1024) | ||
| 110 | #define VERIFY 1 | ||
| 111 | #define KEYSIZ 8 | ||
| 112 | #define KEYSIZB 1024 /* should hit tty line limit first :-) */ | ||
| 113 | char key[KEYSIZB+1]; | ||
| 114 | int do_encrypt,longk=0; | ||
| 115 | FILE *DES_IN,*DES_OUT,*CKSUM_OUT; | ||
| 116 | char uuname[200]; | ||
| 117 | unsigned char uubuf[50]; | ||
| 118 | int uubufnum=0; | ||
| 119 | #define INUUBUFN (45*100) | ||
| 120 | #define OUTUUBUF (65*100) | ||
| 121 | unsigned char b[OUTUUBUF]; | ||
| 122 | unsigned char bb[300]; | ||
| 123 | DES_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
| 124 | char cksumname[200]=""; | ||
| 125 | |||
| 126 | int vflag,cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error; | ||
| 127 | |||
| 128 | int main(int argc, char **argv) | ||
| 129 | { | ||
| 130 | int i; | ||
| 131 | struct stat ins,outs; | ||
| 132 | char *p; | ||
| 133 | char *in=NULL,*out=NULL; | ||
| 134 | |||
| 135 | vflag=cflag=eflag=dflag=kflag=hflag=bflag=fflag=sflag=uflag=flag3=0; | ||
| 136 | error=0; | ||
| 137 | memset(key,0,sizeof(key)); | ||
| 138 | |||
| 139 | for (i=1; i<argc; i++) | ||
| 140 | { | ||
| 141 | p=argv[i]; | ||
| 142 | if ((p[0] == '-') && (p[1] != '\0')) | ||
| 143 | { | ||
| 144 | p++; | ||
| 145 | while (*p) | ||
| 146 | { | ||
| 147 | switch (*(p++)) | ||
| 148 | { | ||
| 149 | case '3': | ||
| 150 | flag3=1; | ||
| 151 | longk=1; | ||
| 152 | break; | ||
| 153 | case 'c': | ||
| 154 | cflag=1; | ||
| 155 | strncpy(cksumname,p,200); | ||
| 156 | cksumname[sizeof(cksumname)-1]='\0'; | ||
| 157 | p+=strlen(cksumname); | ||
| 158 | break; | ||
| 159 | case 'C': | ||
| 160 | cflag=1; | ||
| 161 | longk=1; | ||
| 162 | strncpy(cksumname,p,200); | ||
| 163 | cksumname[sizeof(cksumname)-1]='\0'; | ||
| 164 | p+=strlen(cksumname); | ||
| 165 | break; | ||
| 166 | case 'e': | ||
| 167 | eflag=1; | ||
| 168 | break; | ||
| 169 | case 'v': | ||
| 170 | vflag=1; | ||
| 171 | break; | ||
| 172 | case 'E': | ||
| 173 | eflag=1; | ||
| 174 | longk=1; | ||
| 175 | break; | ||
| 176 | case 'd': | ||
| 177 | dflag=1; | ||
| 178 | break; | ||
| 179 | case 'D': | ||
| 180 | dflag=1; | ||
| 181 | longk=1; | ||
| 182 | break; | ||
| 183 | case 'b': | ||
| 184 | bflag=1; | ||
| 185 | break; | ||
| 186 | case 'f': | ||
| 187 | fflag=1; | ||
| 188 | break; | ||
| 189 | case 's': | ||
| 190 | sflag=1; | ||
| 191 | break; | ||
| 192 | case 'u': | ||
| 193 | uflag=1; | ||
| 194 | strncpy(uuname,p,200); | ||
| 195 | uuname[sizeof(uuname)-1]='\0'; | ||
| 196 | p+=strlen(uuname); | ||
| 197 | break; | ||
| 198 | case 'h': | ||
| 199 | hflag=1; | ||
| 200 | break; | ||
| 201 | case 'k': | ||
| 202 | kflag=1; | ||
| 203 | if ((i+1) == argc) | ||
| 204 | { | ||
| 205 | fputs("must have a key with the -k option\n",stderr); | ||
| 206 | error=1; | ||
| 207 | } | ||
| 208 | else | ||
| 209 | { | ||
| 210 | int j; | ||
| 211 | |||
| 212 | i++; | ||
| 213 | strncpy(key,argv[i],KEYSIZB); | ||
| 214 | for (j=strlen(argv[i])-1; j>=0; j--) | ||
| 215 | argv[i][j]='\0'; | ||
| 216 | } | ||
| 217 | break; | ||
| 218 | default: | ||
| 219 | fprintf(stderr,"'%c' unknown flag\n",p[-1]); | ||
| 220 | error=1; | ||
| 221 | break; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | } | ||
| 225 | else | ||
| 226 | { | ||
| 227 | if (in == NULL) | ||
| 228 | in=argv[i]; | ||
| 229 | else if (out == NULL) | ||
| 230 | out=argv[i]; | ||
| 231 | else | ||
| 232 | error=1; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | if (error) usage(); | ||
| 236 | /* We either | ||
| 237 | * do checksum or | ||
| 238 | * do encrypt or | ||
| 239 | * do decrypt or | ||
| 240 | * do decrypt then ckecksum or | ||
| 241 | * do checksum then encrypt | ||
| 242 | */ | ||
| 243 | if (((eflag+dflag) == 1) || cflag) | ||
| 244 | { | ||
| 245 | if (eflag) do_encrypt=DES_ENCRYPT; | ||
| 246 | if (dflag) do_encrypt=DES_DECRYPT; | ||
| 247 | } | ||
| 248 | else | ||
| 249 | { | ||
| 250 | if (vflag) | ||
| 251 | { | ||
| 252 | #ifndef _Windows | ||
| 253 | fprintf(stderr,"des(1) built with %s\n",libdes_version); | ||
| 254 | #endif | ||
| 255 | EXIT(1); | ||
| 256 | } | ||
| 257 | else usage(); | ||
| 258 | } | ||
| 259 | |||
| 260 | #ifndef _Windows | ||
| 261 | if (vflag) fprintf(stderr,"des(1) built with %s\n",libdes_version); | ||
| 262 | #endif | ||
| 263 | if ( (in != NULL) && | ||
| 264 | (out != NULL) && | ||
| 265 | #ifndef OPENSSL_SYS_MSDOS | ||
| 266 | (stat(in,&ins) != -1) && | ||
| 267 | (stat(out,&outs) != -1) && | ||
| 268 | (ins.st_dev == outs.st_dev) && | ||
| 269 | (ins.st_ino == outs.st_ino)) | ||
| 270 | #else /* OPENSSL_SYS_MSDOS */ | ||
| 271 | (strcmp(in,out) == 0)) | ||
| 272 | #endif | ||
| 273 | { | ||
| 274 | fputs("input and output file are the same\n",stderr); | ||
| 275 | EXIT(3); | ||
| 276 | } | ||
| 277 | |||
| 278 | if (!kflag) | ||
| 279 | if (des_read_pw_string(key,KEYSIZB+1,"Enter key:",eflag?VERIFY:0)) | ||
| 280 | { | ||
| 281 | fputs("password error\n",stderr); | ||
| 282 | EXIT(2); | ||
| 283 | } | ||
| 284 | |||
| 285 | if (in == NULL) | ||
| 286 | DES_IN=stdin; | ||
| 287 | else if ((DES_IN=fopen(in,"r")) == NULL) | ||
| 288 | { | ||
| 289 | perror("opening input file"); | ||
| 290 | EXIT(4); | ||
| 291 | } | ||
| 292 | |||
| 293 | CKSUM_OUT=stdout; | ||
| 294 | if (out == NULL) | ||
| 295 | { | ||
| 296 | DES_OUT=stdout; | ||
| 297 | CKSUM_OUT=stderr; | ||
| 298 | } | ||
| 299 | else if ((DES_OUT=fopen(out,"w")) == NULL) | ||
| 300 | { | ||
| 301 | perror("opening output file"); | ||
| 302 | EXIT(5); | ||
| 303 | } | ||
| 304 | |||
| 305 | #ifdef OPENSSL_SYS_MSDOS | ||
| 306 | /* This should set the file to binary mode. */ | ||
| 307 | { | ||
| 308 | #include <fcntl.h> | ||
| 309 | if (!(uflag && dflag)) | ||
| 310 | setmode(fileno(DES_IN),O_BINARY); | ||
| 311 | if (!(uflag && eflag)) | ||
| 312 | setmode(fileno(DES_OUT),O_BINARY); | ||
| 313 | } | ||
| 314 | #endif | ||
| 315 | |||
| 316 | doencryption(); | ||
| 317 | fclose(DES_IN); | ||
| 318 | fclose(DES_OUT); | ||
| 319 | EXIT(0); | ||
| 320 | } | ||
| 321 | |||
| 322 | void usage(void) | ||
| 323 | { | ||
| 324 | char **u; | ||
| 325 | static const char *Usage[]={ | ||
| 326 | "des <options> [input-file [output-file]]", | ||
| 327 | "options:", | ||
| 328 | "-v : des(1) version number", | ||
| 329 | "-e : encrypt using SunOS compatible user key to DES key conversion.", | ||
| 330 | "-E : encrypt ", | ||
| 331 | "-d : decrypt using SunOS compatible user key to DES key conversion.", | ||
| 332 | "-D : decrypt ", | ||
| 333 | "-c[ckname] : generate a cbc_cksum using SunOS compatible user key to", | ||
| 334 | " DES key conversion and output to ckname (stdout default,", | ||
| 335 | " stderr if data being output on stdout). The checksum is", | ||
| 336 | " generated before encryption and after decryption if used", | ||
| 337 | " in conjunction with -[eEdD].", | ||
| 338 | "-C[ckname] : generate a cbc_cksum as for -c but compatible with -[ED].", | ||
| 339 | "-k key : use key 'key'", | ||
| 340 | "-h : the key that is entered will be a hexadecimal number", | ||
| 341 | " that is used directly as the des key", | ||
| 342 | "-u[uuname] : input file is uudecoded if -[dD] or output uuencoded data if -[eE]", | ||
| 343 | " (uuname is the filename to put in the uuencode header).", | ||
| 344 | "-b : encrypt using DES in ecb encryption mode, the default is cbc mode.", | ||
| 345 | "-3 : encrypt using triple DES encryption. This uses 2 keys", | ||
| 346 | " generated from the input key. If the input key is less", | ||
| 347 | " than 8 characters long, this is equivalent to normal", | ||
| 348 | " encryption. Default is triple cbc, -b makes it triple ecb.", | ||
| 349 | NULL | ||
| 350 | }; | ||
| 351 | for (u=(char **)Usage; *u; u++) | ||
| 352 | { | ||
| 353 | fputs(*u,stderr); | ||
| 354 | fputc('\n',stderr); | ||
| 355 | } | ||
| 356 | |||
| 357 | EXIT(1); | ||
| 358 | } | ||
| 359 | |||
| 360 | void doencryption(void) | ||
| 361 | { | ||
| 362 | #ifdef _LIBC | ||
| 363 | extern unsigned long time(); | ||
| 364 | #endif | ||
| 365 | |||
| 366 | register int i; | ||
| 367 | DES_key_schedule ks,ks2; | ||
| 368 | DES_cblock iv,iv2; | ||
| 369 | char *p; | ||
| 370 | int num=0,j,k,l,rem,ll,len,last,ex=0; | ||
| 371 | DES_cblock kk,k2; | ||
| 372 | FILE *O; | ||
| 373 | int Exit=0; | ||
| 374 | #ifndef OPENSSL_SYS_MSDOS | ||
| 375 | static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8]; | ||
| 376 | #else | ||
| 377 | static unsigned char *buf=NULL,*obuf=NULL; | ||
| 378 | |||
| 379 | if (buf == NULL) | ||
| 380 | { | ||
| 381 | if ( (( buf=OPENSSL_malloc(BUFSIZE+8)) == NULL) || | ||
| 382 | ((obuf=OPENSSL_malloc(BUFSIZE+8)) == NULL)) | ||
| 383 | { | ||
| 384 | fputs("Not enough memory\n",stderr); | ||
| 385 | Exit=10; | ||
| 386 | goto problems; | ||
| 387 | } | ||
| 388 | } | ||
| 389 | #endif | ||
| 390 | |||
| 391 | if (hflag) | ||
| 392 | { | ||
| 393 | j=(flag3?16:8); | ||
| 394 | p=key; | ||
| 395 | for (i=0; i<j; i++) | ||
| 396 | { | ||
| 397 | k=0; | ||
| 398 | if ((*p <= '9') && (*p >= '0')) | ||
| 399 | k=(*p-'0')<<4; | ||
| 400 | else if ((*p <= 'f') && (*p >= 'a')) | ||
| 401 | k=(*p-'a'+10)<<4; | ||
| 402 | else if ((*p <= 'F') && (*p >= 'A')) | ||
| 403 | k=(*p-'A'+10)<<4; | ||
| 404 | else | ||
| 405 | { | ||
| 406 | fputs("Bad hex key\n",stderr); | ||
| 407 | Exit=9; | ||
| 408 | goto problems; | ||
| 409 | } | ||
| 410 | p++; | ||
| 411 | if ((*p <= '9') && (*p >= '0')) | ||
| 412 | k|=(*p-'0'); | ||
| 413 | else if ((*p <= 'f') && (*p >= 'a')) | ||
| 414 | k|=(*p-'a'+10); | ||
| 415 | else if ((*p <= 'F') && (*p >= 'A')) | ||
| 416 | k|=(*p-'A'+10); | ||
| 417 | else | ||
| 418 | { | ||
| 419 | fputs("Bad hex key\n",stderr); | ||
| 420 | Exit=9; | ||
| 421 | goto problems; | ||
| 422 | } | ||
| 423 | p++; | ||
| 424 | if (i < 8) | ||
| 425 | kk[i]=k; | ||
| 426 | else | ||
| 427 | k2[i-8]=k; | ||
| 428 | } | ||
| 429 | DES_set_key_unchecked(&k2,&ks2); | ||
| 430 | OPENSSL_cleanse(k2,sizeof(k2)); | ||
| 431 | } | ||
| 432 | else if (longk || flag3) | ||
| 433 | { | ||
| 434 | if (flag3) | ||
| 435 | { | ||
| 436 | DES_string_to_2keys(key,&kk,&k2); | ||
| 437 | DES_set_key_unchecked(&k2,&ks2); | ||
| 438 | OPENSSL_cleanse(k2,sizeof(k2)); | ||
| 439 | } | ||
| 440 | else | ||
| 441 | DES_string_to_key(key,&kk); | ||
| 442 | } | ||
| 443 | else | ||
| 444 | for (i=0; i<KEYSIZ; i++) | ||
| 445 | { | ||
| 446 | l=0; | ||
| 447 | k=key[i]; | ||
| 448 | for (j=0; j<8; j++) | ||
| 449 | { | ||
| 450 | if (k&1) l++; | ||
| 451 | k>>=1; | ||
| 452 | } | ||
| 453 | if (l & 1) | ||
| 454 | kk[i]=key[i]&0x7f; | ||
| 455 | else | ||
| 456 | kk[i]=key[i]|0x80; | ||
| 457 | } | ||
| 458 | |||
| 459 | DES_set_key_unchecked(&kk,&ks); | ||
| 460 | OPENSSL_cleanse(key,sizeof(key)); | ||
| 461 | OPENSSL_cleanse(kk,sizeof(kk)); | ||
| 462 | /* woops - A bug that does not showup under unix :-( */ | ||
| 463 | memset(iv,0,sizeof(iv)); | ||
| 464 | memset(iv2,0,sizeof(iv2)); | ||
| 465 | |||
| 466 | l=1; | ||
| 467 | rem=0; | ||
| 468 | /* first read */ | ||
| 469 | if (eflag || (!dflag && cflag)) | ||
| 470 | { | ||
| 471 | for (;;) | ||
| 472 | { | ||
| 473 | num=l=fread(&(buf[rem]),1,BUFSIZE,DES_IN); | ||
| 474 | l+=rem; | ||
| 475 | num+=rem; | ||
| 476 | if (l < 0) | ||
| 477 | { | ||
| 478 | perror("read error"); | ||
| 479 | Exit=6; | ||
| 480 | goto problems; | ||
| 481 | } | ||
| 482 | |||
| 483 | rem=l%8; | ||
| 484 | len=l-rem; | ||
| 485 | if (feof(DES_IN)) | ||
| 486 | { | ||
| 487 | for (i=7-rem; i>0; i--) | ||
| 488 | RAND_pseudo_bytes(buf + l++, 1); | ||
| 489 | buf[l++]=rem; | ||
| 490 | ex=1; | ||
| 491 | len+=rem; | ||
| 492 | } | ||
| 493 | else | ||
| 494 | l-=rem; | ||
| 495 | |||
| 496 | if (cflag) | ||
| 497 | { | ||
| 498 | DES_cbc_cksum(buf,&cksum, | ||
| 499 | (long)len,&ks,&cksum); | ||
| 500 | if (!eflag) | ||
| 501 | { | ||
| 502 | if (feof(DES_IN)) break; | ||
| 503 | else continue; | ||
| 504 | } | ||
| 505 | } | ||
| 506 | |||
| 507 | if (bflag && !flag3) | ||
| 508 | for (i=0; i<l; i+=8) | ||
| 509 | DES_ecb_encrypt( | ||
| 510 | (DES_cblock *)&(buf[i]), | ||
| 511 | (DES_cblock *)&(obuf[i]), | ||
| 512 | &ks,do_encrypt); | ||
| 513 | else if (flag3 && bflag) | ||
| 514 | for (i=0; i<l; i+=8) | ||
| 515 | DES_ecb2_encrypt( | ||
| 516 | (DES_cblock *)&(buf[i]), | ||
| 517 | (DES_cblock *)&(obuf[i]), | ||
| 518 | &ks,&ks2,do_encrypt); | ||
| 519 | else if (flag3 && !bflag) | ||
| 520 | { | ||
| 521 | char tmpbuf[8]; | ||
| 522 | |||
| 523 | if (rem) memcpy(tmpbuf,&(buf[l]), | ||
| 524 | (unsigned int)rem); | ||
| 525 | DES_3cbc_encrypt( | ||
| 526 | (DES_cblock *)buf,(DES_cblock *)obuf, | ||
| 527 | (long)l,ks,ks2,&iv, | ||
| 528 | &iv2,do_encrypt); | ||
| 529 | if (rem) memcpy(&(buf[l]),tmpbuf, | ||
| 530 | (unsigned int)rem); | ||
| 531 | } | ||
| 532 | else | ||
| 533 | { | ||
| 534 | DES_cbc_encrypt( | ||
| 535 | buf,obuf, | ||
| 536 | (long)l,&ks,&iv,do_encrypt); | ||
| 537 | if (l >= 8) memcpy(iv,&(obuf[l-8]),8); | ||
| 538 | } | ||
| 539 | if (rem) memcpy(buf,&(buf[l]),(unsigned int)rem); | ||
| 540 | |||
| 541 | i=0; | ||
| 542 | while (i < l) | ||
| 543 | { | ||
| 544 | if (uflag) | ||
| 545 | j=uufwrite(obuf,1,(unsigned int)l-i, | ||
| 546 | DES_OUT); | ||
| 547 | else | ||
| 548 | j=fwrite(obuf,1,(unsigned int)l-i, | ||
| 549 | DES_OUT); | ||
| 550 | if (j == -1) | ||
| 551 | { | ||
| 552 | perror("Write error"); | ||
| 553 | Exit=7; | ||
| 554 | goto problems; | ||
| 555 | } | ||
| 556 | i+=j; | ||
| 557 | } | ||
| 558 | if (feof(DES_IN)) | ||
| 559 | { | ||
| 560 | if (uflag) uufwriteEnd(DES_OUT); | ||
| 561 | break; | ||
| 562 | } | ||
| 563 | } | ||
| 564 | } | ||
| 565 | else /* decrypt */ | ||
| 566 | { | ||
| 567 | ex=1; | ||
| 568 | for (;;) | ||
| 569 | { | ||
| 570 | if (ex) { | ||
| 571 | if (uflag) | ||
| 572 | l=uufread(buf,1,BUFSIZE,DES_IN); | ||
| 573 | else | ||
| 574 | l=fread(buf,1,BUFSIZE,DES_IN); | ||
| 575 | ex=0; | ||
| 576 | rem=l%8; | ||
| 577 | l-=rem; | ||
| 578 | } | ||
| 579 | if (l < 0) | ||
| 580 | { | ||
| 581 | perror("read error"); | ||
| 582 | Exit=6; | ||
| 583 | goto problems; | ||
| 584 | } | ||
| 585 | |||
| 586 | if (bflag && !flag3) | ||
| 587 | for (i=0; i<l; i+=8) | ||
| 588 | DES_ecb_encrypt( | ||
| 589 | (DES_cblock *)&(buf[i]), | ||
| 590 | (DES_cblock *)&(obuf[i]), | ||
| 591 | &ks,do_encrypt); | ||
| 592 | else if (flag3 && bflag) | ||
| 593 | for (i=0; i<l; i+=8) | ||
| 594 | DES_ecb2_encrypt( | ||
| 595 | (DES_cblock *)&(buf[i]), | ||
| 596 | (DES_cblock *)&(obuf[i]), | ||
| 597 | &ks,&ks2,do_encrypt); | ||
| 598 | else if (flag3 && !bflag) | ||
| 599 | { | ||
| 600 | DES_3cbc_encrypt( | ||
| 601 | (DES_cblock *)buf,(DES_cblock *)obuf, | ||
| 602 | (long)l,ks,ks2,&iv, | ||
| 603 | &iv2,do_encrypt); | ||
| 604 | } | ||
| 605 | else | ||
| 606 | { | ||
| 607 | DES_cbc_encrypt( | ||
| 608 | buf,obuf, | ||
| 609 | (long)l,&ks,&iv,do_encrypt); | ||
| 610 | if (l >= 8) memcpy(iv,&(buf[l-8]),8); | ||
| 611 | } | ||
| 612 | |||
| 613 | if (uflag) | ||
| 614 | ll=uufread(&(buf[rem]),1,BUFSIZE,DES_IN); | ||
| 615 | else | ||
| 616 | ll=fread(&(buf[rem]),1,BUFSIZE,DES_IN); | ||
| 617 | ll+=rem; | ||
| 618 | rem=ll%8; | ||
| 619 | ll-=rem; | ||
| 620 | if (feof(DES_IN) && (ll == 0)) | ||
| 621 | { | ||
| 622 | last=obuf[l-1]; | ||
| 623 | |||
| 624 | if ((last > 7) || (last < 0)) | ||
| 625 | { | ||
| 626 | fputs("The file was not decrypted correctly.\n", | ||
| 627 | stderr); | ||
| 628 | Exit=8; | ||
| 629 | last=0; | ||
| 630 | } | ||
| 631 | l=l-8+last; | ||
| 632 | } | ||
| 633 | i=0; | ||
| 634 | if (cflag) DES_cbc_cksum(obuf, | ||
| 635 | (DES_cblock *)cksum,(long)l/8*8,&ks, | ||
| 636 | (DES_cblock *)cksum); | ||
| 637 | while (i != l) | ||
| 638 | { | ||
| 639 | j=fwrite(obuf,1,(unsigned int)l-i,DES_OUT); | ||
| 640 | if (j == -1) | ||
| 641 | { | ||
| 642 | perror("Write error"); | ||
| 643 | Exit=7; | ||
| 644 | goto problems; | ||
| 645 | } | ||
| 646 | i+=j; | ||
| 647 | } | ||
| 648 | l=ll; | ||
| 649 | if ((l == 0) && feof(DES_IN)) break; | ||
| 650 | } | ||
| 651 | } | ||
| 652 | if (cflag) | ||
| 653 | { | ||
| 654 | l=0; | ||
| 655 | if (cksumname[0] != '\0') | ||
| 656 | { | ||
| 657 | if ((O=fopen(cksumname,"w")) != NULL) | ||
| 658 | { | ||
| 659 | CKSUM_OUT=O; | ||
| 660 | l=1; | ||
| 661 | } | ||
| 662 | } | ||
| 663 | for (i=0; i<8; i++) | ||
| 664 | fprintf(CKSUM_OUT,"%02X",cksum[i]); | ||
| 665 | fprintf(CKSUM_OUT,"\n"); | ||
| 666 | if (l) fclose(CKSUM_OUT); | ||
| 667 | } | ||
| 668 | problems: | ||
| 669 | OPENSSL_cleanse(buf,sizeof(buf)); | ||
| 670 | OPENSSL_cleanse(obuf,sizeof(obuf)); | ||
| 671 | OPENSSL_cleanse(&ks,sizeof(ks)); | ||
| 672 | OPENSSL_cleanse(&ks2,sizeof(ks2)); | ||
| 673 | OPENSSL_cleanse(iv,sizeof(iv)); | ||
| 674 | OPENSSL_cleanse(iv2,sizeof(iv2)); | ||
| 675 | OPENSSL_cleanse(kk,sizeof(kk)); | ||
| 676 | OPENSSL_cleanse(k2,sizeof(k2)); | ||
| 677 | OPENSSL_cleanse(uubuf,sizeof(uubuf)); | ||
| 678 | OPENSSL_cleanse(b,sizeof(b)); | ||
| 679 | OPENSSL_cleanse(bb,sizeof(bb)); | ||
| 680 | OPENSSL_cleanse(cksum,sizeof(cksum)); | ||
| 681 | if (Exit) EXIT(Exit); | ||
| 682 | } | ||
| 683 | |||
| 684 | /* We ignore this parameter but it should be > ~50 I believe */ | ||
| 685 | int uufwrite(unsigned char *data, int size, unsigned int num, FILE *fp) | ||
| 686 | { | ||
| 687 | int i,j,left,rem,ret=num; | ||
| 688 | static int start=1; | ||
| 689 | |||
| 690 | if (start) | ||
| 691 | { | ||
| 692 | fprintf(fp,"begin 600 %s\n", | ||
| 693 | (uuname[0] == '\0')?"text.d":uuname); | ||
| 694 | start=0; | ||
| 695 | } | ||
| 696 | |||
| 697 | if (uubufnum) | ||
| 698 | { | ||
| 699 | if (uubufnum+num < 45) | ||
| 700 | { | ||
| 701 | memcpy(&(uubuf[uubufnum]),data,(unsigned int)num); | ||
| 702 | uubufnum+=num; | ||
| 703 | return(num); | ||
| 704 | } | ||
| 705 | else | ||
| 706 | { | ||
| 707 | i=45-uubufnum; | ||
| 708 | memcpy(&(uubuf[uubufnum]),data,(unsigned int)i); | ||
| 709 | j=uuencode((unsigned char *)uubuf,45,b); | ||
| 710 | fwrite(b,1,(unsigned int)j,fp); | ||
| 711 | uubufnum=0; | ||
| 712 | data+=i; | ||
| 713 | num-=i; | ||
| 714 | } | ||
| 715 | } | ||
| 716 | |||
| 717 | for (i=0; i<(((int)num)-INUUBUFN); i+=INUUBUFN) | ||
| 718 | { | ||
| 719 | j=uuencode(&(data[i]),INUUBUFN,b); | ||
| 720 | fwrite(b,1,(unsigned int)j,fp); | ||
| 721 | } | ||
| 722 | rem=(num-i)%45; | ||
| 723 | left=(num-i-rem); | ||
| 724 | if (left) | ||
| 725 | { | ||
| 726 | j=uuencode(&(data[i]),left,b); | ||
| 727 | fwrite(b,1,(unsigned int)j,fp); | ||
| 728 | i+=left; | ||
| 729 | } | ||
| 730 | if (i != num) | ||
| 731 | { | ||
| 732 | memcpy(uubuf,&(data[i]),(unsigned int)rem); | ||
| 733 | uubufnum=rem; | ||
| 734 | } | ||
| 735 | return(ret); | ||
| 736 | } | ||
| 737 | |||
| 738 | void uufwriteEnd(FILE *fp) | ||
| 739 | { | ||
| 740 | int j; | ||
| 741 | static const char *end=" \nend\n"; | ||
| 742 | |||
| 743 | if (uubufnum != 0) | ||
| 744 | { | ||
| 745 | uubuf[uubufnum]='\0'; | ||
| 746 | uubuf[uubufnum+1]='\0'; | ||
| 747 | uubuf[uubufnum+2]='\0'; | ||
| 748 | j=uuencode(uubuf,uubufnum,b); | ||
| 749 | fwrite(b,1,(unsigned int)j,fp); | ||
| 750 | } | ||
| 751 | fwrite(end,1,strlen(end),fp); | ||
| 752 | } | ||
| 753 | |||
| 754 | /* int size: should always be > ~ 60; I actually ignore this parameter :-) */ | ||
| 755 | int uufread(unsigned char *out, int size, unsigned int num, FILE *fp) | ||
| 756 | { | ||
| 757 | int i,j,tot; | ||
| 758 | static int done=0; | ||
| 759 | static int valid=0; | ||
| 760 | static int start=1; | ||
| 761 | |||
| 762 | if (start) | ||
| 763 | { | ||
| 764 | for (;;) | ||
| 765 | { | ||
| 766 | b[0]='\0'; | ||
| 767 | fgets((char *)b,300,fp); | ||
| 768 | if (b[0] == '\0') | ||
| 769 | { | ||
| 770 | fprintf(stderr,"no 'begin' found in uuencoded input\n"); | ||
| 771 | return(-1); | ||
| 772 | } | ||
| 773 | if (strncmp((char *)b,"begin ",6) == 0) break; | ||
| 774 | } | ||
| 775 | start=0; | ||
| 776 | } | ||
| 777 | if (done) return(0); | ||
| 778 | tot=0; | ||
| 779 | if (valid) | ||
| 780 | { | ||
| 781 | memcpy(out,bb,(unsigned int)valid); | ||
| 782 | tot=valid; | ||
| 783 | valid=0; | ||
| 784 | } | ||
| 785 | for (;;) | ||
| 786 | { | ||
| 787 | b[0]='\0'; | ||
| 788 | fgets((char *)b,300,fp); | ||
| 789 | if (b[0] == '\0') break; | ||
| 790 | i=strlen((char *)b); | ||
| 791 | if ((b[0] == 'e') && (b[1] == 'n') && (b[2] == 'd')) | ||
| 792 | { | ||
| 793 | done=1; | ||
| 794 | while (!feof(fp)) | ||
| 795 | { | ||
| 796 | fgets((char *)b,300,fp); | ||
| 797 | } | ||
| 798 | break; | ||
| 799 | } | ||
| 800 | i=uudecode(b,i,bb); | ||
| 801 | if (i < 0) break; | ||
| 802 | if ((i+tot+8) > num) | ||
| 803 | { | ||
| 804 | /* num to copy to make it a multiple of 8 */ | ||
| 805 | j=(num/8*8)-tot-8; | ||
| 806 | memcpy(&(out[tot]),bb,(unsigned int)j); | ||
| 807 | tot+=j; | ||
| 808 | memcpy(bb,&(bb[j]),(unsigned int)i-j); | ||
| 809 | valid=i-j; | ||
| 810 | break; | ||
| 811 | } | ||
| 812 | memcpy(&(out[tot]),bb,(unsigned int)i); | ||
| 813 | tot+=i; | ||
| 814 | } | ||
| 815 | return(tot); | ||
| 816 | } | ||
| 817 | |||
| 818 | #define ccc2l(c,l) (l =((DES_LONG)(*((c)++)))<<16, \ | ||
| 819 | l|=((DES_LONG)(*((c)++)))<< 8, \ | ||
| 820 | l|=((DES_LONG)(*((c)++)))) | ||
| 821 | |||
| 822 | #define l2ccc(l,c) (*((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
| 823 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
| 824 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
| 825 | |||
| 826 | |||
| 827 | int uuencode(unsigned char *in, int num, unsigned char *out) | ||
| 828 | { | ||
| 829 | int j,i,n,tot=0; | ||
| 830 | DES_LONG l; | ||
| 831 | register unsigned char *p; | ||
| 832 | p=out; | ||
| 833 | |||
| 834 | for (j=0; j<num; j+=45) | ||
| 835 | { | ||
| 836 | if (j+45 > num) | ||
| 837 | i=(num-j); | ||
| 838 | else i=45; | ||
| 839 | *(p++)=i+' '; | ||
| 840 | for (n=0; n<i; n+=3) | ||
| 841 | { | ||
| 842 | ccc2l(in,l); | ||
| 843 | *(p++)=((l>>18)&0x3f)+' '; | ||
| 844 | *(p++)=((l>>12)&0x3f)+' '; | ||
| 845 | *(p++)=((l>> 6)&0x3f)+' '; | ||
| 846 | *(p++)=((l )&0x3f)+' '; | ||
| 847 | tot+=4; | ||
| 848 | } | ||
| 849 | *(p++)='\n'; | ||
| 850 | tot+=2; | ||
| 851 | } | ||
| 852 | *p='\0'; | ||
| 853 | l=0; | ||
| 854 | return(tot); | ||
| 855 | } | ||
| 856 | |||
| 857 | int uudecode(unsigned char *in, int num, unsigned char *out) | ||
| 858 | { | ||
| 859 | int j,i,k; | ||
| 860 | unsigned int n=0,space=0; | ||
| 861 | DES_LONG l; | ||
| 862 | DES_LONG w,x,y,z; | ||
| 863 | unsigned int blank=(unsigned int)'\n'-' '; | ||
| 864 | |||
| 865 | for (j=0; j<num; ) | ||
| 866 | { | ||
| 867 | n= *(in++)-' '; | ||
| 868 | if (n == blank) | ||
| 869 | { | ||
| 870 | n=0; | ||
| 871 | in--; | ||
| 872 | } | ||
| 873 | if (n > 60) | ||
| 874 | { | ||
| 875 | fprintf(stderr,"uuencoded line length too long\n"); | ||
| 876 | return(-1); | ||
| 877 | } | ||
| 878 | j++; | ||
| 879 | |||
| 880 | for (i=0; i<n; j+=4,i+=3) | ||
| 881 | { | ||
| 882 | /* the following is for cases where spaces are | ||
| 883 | * removed from lines. | ||
| 884 | */ | ||
| 885 | if (space) | ||
| 886 | { | ||
| 887 | w=x=y=z=0; | ||
| 888 | } | ||
| 889 | else | ||
| 890 | { | ||
| 891 | w= *(in++)-' '; | ||
| 892 | x= *(in++)-' '; | ||
| 893 | y= *(in++)-' '; | ||
| 894 | z= *(in++)-' '; | ||
| 895 | } | ||
| 896 | if ((w > 63) || (x > 63) || (y > 63) || (z > 63)) | ||
| 897 | { | ||
| 898 | k=0; | ||
| 899 | if (w == blank) k=1; | ||
| 900 | if (x == blank) k=2; | ||
| 901 | if (y == blank) k=3; | ||
| 902 | if (z == blank) k=4; | ||
| 903 | space=1; | ||
| 904 | switch (k) { | ||
| 905 | case 1: w=0; in--; | ||
| 906 | case 2: x=0; in--; | ||
| 907 | case 3: y=0; in--; | ||
| 908 | case 4: z=0; in--; | ||
| 909 | break; | ||
| 910 | case 0: | ||
| 911 | space=0; | ||
| 912 | fprintf(stderr,"bad uuencoded data values\n"); | ||
| 913 | w=x=y=z=0; | ||
| 914 | return(-1); | ||
| 915 | break; | ||
| 916 | } | ||
| 917 | } | ||
| 918 | l=(w<<18)|(x<<12)|(y<< 6)|(z ); | ||
| 919 | l2ccc(l,out); | ||
| 920 | } | ||
| 921 | if (*(in++) != '\n') | ||
| 922 | { | ||
| 923 | fprintf(stderr,"missing nl in uuencoded line\n"); | ||
| 924 | w=x=y=z=0; | ||
| 925 | return(-1); | ||
| 926 | } | ||
| 927 | j++; | ||
| 928 | } | ||
| 929 | *out='\0'; | ||
| 930 | w=x=y=z=0; | ||
| 931 | return(n); | ||
| 932 | } | ||
diff --git a/src/lib/libcrypto/des/des.h b/src/lib/libcrypto/des/des.h index 92b6663599..7318593699 100644 --- a/src/lib/libcrypto/des/des.h +++ b/src/lib/libcrypto/des/des.h | |||
| @@ -56,8 +56,8 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #ifndef HEADER_NEW_DES_H | 59 | #ifndef HEADER_DES_H |
| 60 | #define HEADER_NEW_DES_H | 60 | #define HEADER_DES_H |
| 61 | 61 | ||
| 62 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, | 62 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, |
| 63 | DES_LONG (via openssl/opensslconf.h */ | 63 | DES_LONG (via openssl/opensslconf.h */ |
| @@ -71,6 +71,8 @@ | |||
| 71 | # define OPENSSL_EXTERN OPENSSL_EXPORT | 71 | # define OPENSSL_EXTERN OPENSSL_EXPORT |
| 72 | #endif | 72 | #endif |
| 73 | 73 | ||
| 74 | #define des_SPtrans DES_SPtrans | ||
| 75 | |||
| 74 | #ifdef __cplusplus | 76 | #ifdef __cplusplus |
| 75 | extern "C" { | 77 | extern "C" { |
| 76 | #endif | 78 | #endif |
diff --git a/src/lib/libcrypto/des/des.pod b/src/lib/libcrypto/des/des.pod new file mode 100644 index 0000000000..bf479e83d2 --- /dev/null +++ b/src/lib/libcrypto/des/des.pod | |||
| @@ -0,0 +1,217 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | des - encrypt or decrypt data using Data Encryption Standard | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | B<des> | ||
| 10 | ( | ||
| 11 | B<-e> | ||
| 12 | | | ||
| 13 | B<-E> | ||
| 14 | ) | ( | ||
| 15 | B<-d> | ||
| 16 | | | ||
| 17 | B<-D> | ||
| 18 | ) | ( | ||
| 19 | B<->[B<cC>][B<ckname>] | ||
| 20 | ) | | ||
| 21 | [ | ||
| 22 | B<-b3hfs> | ||
| 23 | ] [ | ||
| 24 | B<-k> | ||
| 25 | I<key> | ||
| 26 | ] | ||
| 27 | ] [ | ||
| 28 | B<-u>[I<uuname>] | ||
| 29 | [ | ||
| 30 | I<input-file> | ||
| 31 | [ | ||
| 32 | I<output-file> | ||
| 33 | ] ] | ||
| 34 | |||
| 35 | =head1 NOTE | ||
| 36 | |||
| 37 | This page describes the B<des> stand-alone program, not the B<openssl des> | ||
| 38 | command. | ||
| 39 | |||
| 40 | =head1 DESCRIPTION | ||
| 41 | |||
| 42 | B<des> | ||
| 43 | encrypts and decrypts data using the | ||
| 44 | Data Encryption Standard algorithm. | ||
| 45 | One of | ||
| 46 | B<-e>, B<-E> | ||
| 47 | (for encrypt) or | ||
| 48 | B<-d>, B<-D> | ||
| 49 | (for decrypt) must be specified. | ||
| 50 | It is also possible to use | ||
| 51 | B<-c> | ||
| 52 | or | ||
| 53 | B<-C> | ||
| 54 | in conjunction or instead of the a encrypt/decrypt option to generate | ||
| 55 | a 16 character hexadecimal checksum, generated via the | ||
| 56 | I<des_cbc_cksum>. | ||
| 57 | |||
| 58 | Two standard encryption modes are supported by the | ||
| 59 | B<des> | ||
| 60 | program, Cipher Block Chaining (the default) and Electronic Code Book | ||
| 61 | (specified with | ||
| 62 | B<-b>). | ||
| 63 | |||
| 64 | The key used for the DES | ||
| 65 | algorithm is obtained by prompting the user unless the | ||
| 66 | B<-k> | ||
| 67 | I<key> | ||
| 68 | option is given. | ||
| 69 | If the key is an argument to the | ||
| 70 | B<des> | ||
| 71 | command, it is potentially visible to users executing | ||
| 72 | ps(1) | ||
| 73 | or a derivative. To minimise this possibility, | ||
| 74 | B<des> | ||
| 75 | takes care to destroy the key argument immediately upon entry. | ||
| 76 | If your shell keeps a history file be careful to make sure it is not | ||
| 77 | world readable. | ||
| 78 | |||
| 79 | Since this program attempts to maintain compatibility with sunOS's | ||
| 80 | des(1) command, there are 2 different methods used to convert the user | ||
| 81 | supplied key to a des key. | ||
| 82 | Whenever and one or more of | ||
| 83 | B<-E>, B<-D>, B<-C> | ||
| 84 | or | ||
| 85 | B<-3> | ||
| 86 | options are used, the key conversion procedure will not be compatible | ||
| 87 | with the sunOS des(1) version but will use all the user supplied | ||
| 88 | character to generate the des key. | ||
| 89 | B<des> | ||
| 90 | command reads from standard input unless | ||
| 91 | I<input-file> | ||
| 92 | is specified and writes to standard output unless | ||
| 93 | I<output-file> | ||
| 94 | is given. | ||
| 95 | |||
| 96 | =head1 OPTIONS | ||
| 97 | |||
| 98 | =over 4 | ||
| 99 | |||
| 100 | =item B<-b> | ||
| 101 | |||
| 102 | Select ECB | ||
| 103 | (eight bytes at a time) encryption mode. | ||
| 104 | |||
| 105 | =item B<-3> | ||
| 106 | |||
| 107 | Encrypt using triple encryption. | ||
| 108 | By default triple cbc encryption is used but if the | ||
| 109 | B<-b> | ||
| 110 | option is used then triple ECB encryption is performed. | ||
| 111 | If the key is less than 8 characters long, the flag has no effect. | ||
| 112 | |||
| 113 | =item B<-e> | ||
| 114 | |||
| 115 | Encrypt data using an 8 byte key in a manner compatible with sunOS | ||
| 116 | des(1). | ||
| 117 | |||
| 118 | =item B<-E> | ||
| 119 | |||
| 120 | Encrypt data using a key of nearly unlimited length (1024 bytes). | ||
| 121 | This will product a more secure encryption. | ||
| 122 | |||
| 123 | =item B<-d> | ||
| 124 | |||
| 125 | Decrypt data that was encrypted with the B<-e> option. | ||
| 126 | |||
| 127 | =item B<-D> | ||
| 128 | |||
| 129 | Decrypt data that was encrypted with the B<-E> option. | ||
| 130 | |||
| 131 | =item B<-c> | ||
| 132 | |||
| 133 | Generate a 16 character hexadecimal cbc checksum and output this to | ||
| 134 | stderr. | ||
| 135 | If a filename was specified after the | ||
| 136 | B<-c> | ||
| 137 | option, the checksum is output to that file. | ||
| 138 | The checksum is generated using a key generated in a sunOS compatible | ||
| 139 | manner. | ||
| 140 | |||
| 141 | =item B<-C> | ||
| 142 | |||
| 143 | A cbc checksum is generated in the same manner as described for the | ||
| 144 | B<-c> | ||
| 145 | option but the DES key is generated in the same manner as used for the | ||
| 146 | B<-E> | ||
| 147 | and | ||
| 148 | B<-D> | ||
| 149 | options | ||
| 150 | |||
| 151 | =item B<-f> | ||
| 152 | |||
| 153 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
| 154 | |||
| 155 | =item B<-s> | ||
| 156 | |||
| 157 | Does nothing - allowed for compatibility with sunOS des(1) command. | ||
| 158 | |||
| 159 | =item B<-k> I<key> | ||
| 160 | |||
| 161 | Use the encryption | ||
| 162 | I<key> | ||
| 163 | specified. | ||
| 164 | |||
| 165 | =item B<-h> | ||
| 166 | |||
| 167 | The | ||
| 168 | I<key> | ||
| 169 | is assumed to be a 16 character hexadecimal number. | ||
| 170 | If the | ||
| 171 | B<-3> | ||
| 172 | option is used the key is assumed to be a 32 character hexadecimal | ||
| 173 | number. | ||
| 174 | |||
| 175 | =item B<-u> | ||
| 176 | |||
| 177 | This flag is used to read and write uuencoded files. If decrypting, | ||
| 178 | the input file is assumed to contain uuencoded, DES encrypted data. | ||
| 179 | If encrypting, the characters following the B<-u> are used as the name of | ||
| 180 | the uuencoded file to embed in the begin line of the uuencoded | ||
| 181 | output. If there is no name specified after the B<-u>, the name text.des | ||
| 182 | will be embedded in the header. | ||
| 183 | |||
| 184 | =head1 SEE ALSO | ||
| 185 | |||
| 186 | ps(1), | ||
| 187 | L<des_crypt(3)|des_crypt(3)> | ||
| 188 | |||
| 189 | =head1 BUGS | ||
| 190 | |||
| 191 | The problem with using the | ||
| 192 | B<-e> | ||
| 193 | option is the short key length. | ||
| 194 | It would be better to use a real 56-bit key rather than an | ||
| 195 | ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII | ||
| 196 | radically reduces the time necessary for a brute-force cryptographic attack. | ||
| 197 | My attempt to remove this problem is to add an alternative text-key to | ||
| 198 | DES-key function. This alternative function (accessed via | ||
| 199 | B<-E>, B<-D>, B<-S> | ||
| 200 | and | ||
| 201 | B<-3>) | ||
| 202 | uses DES to help generate the key. | ||
| 203 | |||
| 204 | Be carefully when using the B<-u> option. Doing B<des -ud> I<filename> will | ||
| 205 | not decrypt filename (the B<-u> option will gobble the B<-d> option). | ||
| 206 | |||
| 207 | The VMS operating system operates in a world where files are always a | ||
| 208 | multiple of 512 bytes. This causes problems when encrypted data is | ||
| 209 | send from Unix to VMS since a 88 byte file will suddenly be padded | ||
| 210 | with 424 null bytes. To get around this problem, use the B<-u> option | ||
| 211 | to uuencode the data before it is send to the VMS system. | ||
| 212 | |||
| 213 | =head1 AUTHOR | ||
| 214 | |||
| 215 | Eric Young (eay@cryptsoft.com) | ||
| 216 | |||
| 217 | =cut | ||
diff --git a/src/lib/libcrypto/des/des3s.cpp b/src/lib/libcrypto/des/des3s.cpp new file mode 100644 index 0000000000..02d527c057 --- /dev/null +++ b/src/lib/libcrypto/des/des3s.cpp | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/des.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | des_key_schedule key1,key2,key3; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | |||
| 44 | for (j=0; j<6; j++) | ||
| 45 | { | ||
| 46 | for (i=0; i<1000; i++) /**/ | ||
| 47 | { | ||
| 48 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 49 | GetTSC(s1); | ||
| 50 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 51 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 52 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 53 | GetTSC(e1); | ||
| 54 | GetTSC(s2); | ||
| 55 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 56 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 57 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 58 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 59 | GetTSC(e2); | ||
| 60 | des_encrypt3(&data[0],key1,key2,key3); | ||
| 61 | } | ||
| 62 | |||
| 63 | printf("des %d %d (%d)\n", | ||
| 64 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
diff --git a/src/lib/libcrypto/des/des_enc.c b/src/lib/libcrypto/des/des_enc.c index 828feba208..5c47553a5a 100644 --- a/src/lib/libcrypto/des/des_enc.c +++ b/src/lib/libcrypto/des/des_enc.c | |||
| @@ -59,6 +59,8 @@ | |||
| 59 | #include "des_locl.h" | 59 | #include "des_locl.h" |
| 60 | #include "spr.h" | 60 | #include "spr.h" |
| 61 | 61 | ||
| 62 | #ifndef OPENBSD_DES_ASM | ||
| 63 | |||
| 62 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) | 64 | void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc) |
| 63 | { | 65 | { |
| 64 | register DES_LONG l,r,t,u; | 66 | register DES_LONG l,r,t,u; |
| @@ -240,6 +242,8 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc) | |||
| 240 | l=r=t=u=0; | 242 | l=r=t=u=0; |
| 241 | } | 243 | } |
| 242 | 244 | ||
| 245 | #endif /* OPENBSD_DES_ASM */ | ||
| 246 | |||
| 243 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, | 247 | void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, |
| 244 | DES_key_schedule *ks2, DES_key_schedule *ks3) | 248 | DES_key_schedule *ks2, DES_key_schedule *ks3) |
| 245 | { | 249 | { |
diff --git a/src/lib/libcrypto/des/des_old.c b/src/lib/libcrypto/des/des_old.c new file mode 100644 index 0000000000..7c33ed7a93 --- /dev/null +++ b/src/lib/libcrypto/des/des_old.c | |||
| @@ -0,0 +1,273 @@ | |||
| 1 | /* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | |||
| 3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 4 | * | ||
| 5 | * The function names in here are deprecated and are only present to | ||
| 6 | * provide an interface compatible with libdes. OpenSSL now provides | ||
| 7 | * functions where "des_" has been replaced with "DES_" in the names, | ||
| 8 | * to make it possible to make incompatible changes that are needed | ||
| 9 | * for C type security and other stuff. | ||
| 10 | * | ||
| 11 | * Please consider starting to use the DES_ functions rather than the | ||
| 12 | * des_ ones. The des_ functions will dissapear completely before | ||
| 13 | * OpenSSL 1.0! | ||
| 14 | * | ||
| 15 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 19 | * project 2001. | ||
| 20 | */ | ||
| 21 | /* ==================================================================== | ||
| 22 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
| 23 | * | ||
| 24 | * Redistribution and use in source and binary forms, with or without | ||
| 25 | * modification, are permitted provided that the following conditions | ||
| 26 | * are met: | ||
| 27 | * | ||
| 28 | * 1. Redistributions of source code must retain the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer. | ||
| 30 | * | ||
| 31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 32 | * notice, this list of conditions and the following disclaimer in | ||
| 33 | * the documentation and/or other materials provided with the | ||
| 34 | * distribution. | ||
| 35 | * | ||
| 36 | * 3. All advertising materials mentioning features or use of this | ||
| 37 | * software must display the following acknowledgment: | ||
| 38 | * "This product includes software developed by the OpenSSL Project | ||
| 39 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 40 | * | ||
| 41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 42 | * endorse or promote products derived from this software without | ||
| 43 | * prior written permission. For written permission, please contact | ||
| 44 | * openssl-core@openssl.org. | ||
| 45 | * | ||
| 46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 47 | * nor may "OpenSSL" appear in their names without prior written | ||
| 48 | * permission of the OpenSSL Project. | ||
| 49 | * | ||
| 50 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 51 | * acknowledgment: | ||
| 52 | * "This product includes software developed by the OpenSSL Project | ||
| 53 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 54 | * | ||
| 55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 67 | * ==================================================================== | ||
| 68 | * | ||
| 69 | * This product includes cryptographic software written by Eric Young | ||
| 70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 71 | * Hudson (tjh@cryptsoft.com). | ||
| 72 | * | ||
| 73 | */ | ||
| 74 | |||
| 75 | #define OPENSSL_DES_LIBDES_COMPATIBILITY | ||
| 76 | #include <openssl/des.h> | ||
| 77 | #include <openssl/rand.h> | ||
| 78 | |||
| 79 | const char *_ossl_old_des_options(void) | ||
| 80 | { | ||
| 81 | return DES_options(); | ||
| 82 | } | ||
| 83 | void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 84 | des_key_schedule ks1,des_key_schedule ks2, | ||
| 85 | des_key_schedule ks3, int enc) | ||
| 86 | { | ||
| 87 | DES_ecb3_encrypt((const_DES_cblock *)input, output, | ||
| 88 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
| 89 | (DES_key_schedule *)ks3, enc); | ||
| 90 | } | ||
| 91 | DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 92 | long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec) | ||
| 93 | { | ||
| 94 | return DES_cbc_cksum((unsigned char *)input, output, length, | ||
| 95 | (DES_key_schedule *)schedule, ivec); | ||
| 96 | } | ||
| 97 | void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 98 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
| 99 | { | ||
| 100 | DES_cbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
| 101 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
| 102 | } | ||
| 103 | void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 104 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
| 105 | { | ||
| 106 | DES_ncbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
| 107 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
| 108 | } | ||
| 109 | void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 110 | des_key_schedule schedule,_ossl_old_des_cblock *ivec, | ||
| 111 | _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc) | ||
| 112 | { | ||
| 113 | DES_xcbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
| 114 | length, (DES_key_schedule *)schedule, ivec, inw, outw, enc); | ||
| 115 | } | ||
| 116 | void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
| 117 | long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
| 118 | { | ||
| 119 | DES_cfb_encrypt(in, out, numbits, length, | ||
| 120 | (DES_key_schedule *)schedule, ivec, enc); | ||
| 121 | } | ||
| 122 | void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 123 | des_key_schedule ks,int enc) | ||
| 124 | { | ||
| 125 | DES_ecb_encrypt(input, output, (DES_key_schedule *)ks, enc); | ||
| 126 | } | ||
| 127 | void _ossl_old_des_encrypt(DES_LONG *data,des_key_schedule ks, int enc) | ||
| 128 | { | ||
| 129 | DES_encrypt1(data, (DES_key_schedule *)ks, enc); | ||
| 130 | } | ||
| 131 | void _ossl_old_des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc) | ||
| 132 | { | ||
| 133 | DES_encrypt2(data, (DES_key_schedule *)ks, enc); | ||
| 134 | } | ||
| 135 | void _ossl_old_des_encrypt3(DES_LONG *data, des_key_schedule ks1, | ||
| 136 | des_key_schedule ks2, des_key_schedule ks3) | ||
| 137 | { | ||
| 138 | DES_encrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
| 139 | (DES_key_schedule *)ks3); | ||
| 140 | } | ||
| 141 | void _ossl_old_des_decrypt3(DES_LONG *data, des_key_schedule ks1, | ||
| 142 | des_key_schedule ks2, des_key_schedule ks3) | ||
| 143 | { | ||
| 144 | DES_decrypt3(data, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
| 145 | (DES_key_schedule *)ks3); | ||
| 146 | } | ||
| 147 | void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, | ||
| 148 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
| 149 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc) | ||
| 150 | { | ||
| 151 | DES_ede3_cbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
| 152 | length, (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
| 153 | (DES_key_schedule *)ks3, ivec, enc); | ||
| 154 | } | ||
| 155 | void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
| 156 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
| 157 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc) | ||
| 158 | { | ||
| 159 | DES_ede3_cfb64_encrypt(in, out, length, | ||
| 160 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
| 161 | (DES_key_schedule *)ks3, ivec, num, enc); | ||
| 162 | } | ||
| 163 | void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
| 164 | long length, des_key_schedule ks1, des_key_schedule ks2, | ||
| 165 | des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num) | ||
| 166 | { | ||
| 167 | DES_ede3_ofb64_encrypt(in, out, length, | ||
| 168 | (DES_key_schedule *)ks1, (DES_key_schedule *)ks2, | ||
| 169 | (DES_key_schedule *)ks3, ivec, num); | ||
| 170 | } | ||
| 171 | |||
| 172 | #if 0 /* broken code, preserved just in case anyone specifically looks for this */ | ||
| 173 | void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), | ||
| 174 | _ossl_old_des_cblock (*out_white)) | ||
| 175 | { | ||
| 176 | DES_xwhite_in2out(des_key, in_white, out_white); | ||
| 177 | } | ||
| 178 | #endif | ||
| 179 | |||
| 180 | int _ossl_old_des_enc_read(int fd,char *buf,int len,des_key_schedule sched, | ||
| 181 | _ossl_old_des_cblock *iv) | ||
| 182 | { | ||
| 183 | return DES_enc_read(fd, buf, len, (DES_key_schedule *)sched, iv); | ||
| 184 | } | ||
| 185 | int _ossl_old_des_enc_write(int fd,char *buf,int len,des_key_schedule sched, | ||
| 186 | _ossl_old_des_cblock *iv) | ||
| 187 | { | ||
| 188 | return DES_enc_write(fd, buf, len, (DES_key_schedule *)sched, iv); | ||
| 189 | } | ||
| 190 | char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret) | ||
| 191 | { | ||
| 192 | return DES_fcrypt(buf, salt, ret); | ||
| 193 | } | ||
| 194 | char *_ossl_old_des_crypt(const char *buf,const char *salt) | ||
| 195 | { | ||
| 196 | return DES_crypt(buf, salt); | ||
| 197 | } | ||
| 198 | char *_ossl_old_crypt(const char *buf,const char *salt) | ||
| 199 | { | ||
| 200 | return DES_crypt(buf, salt); | ||
| 201 | } | ||
| 202 | void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
| 203 | int numbits,long length,des_key_schedule schedule,_ossl_old_des_cblock *ivec) | ||
| 204 | { | ||
| 205 | DES_ofb_encrypt(in, out, numbits, length, (DES_key_schedule *)schedule, | ||
| 206 | ivec); | ||
| 207 | } | ||
| 208 | void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 209 | des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc) | ||
| 210 | { | ||
| 211 | DES_pcbc_encrypt((unsigned char *)input, (unsigned char *)output, | ||
| 212 | length, (DES_key_schedule *)schedule, ivec, enc); | ||
| 213 | } | ||
| 214 | DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 215 | long length,int out_count,_ossl_old_des_cblock *seed) | ||
| 216 | { | ||
| 217 | return DES_quad_cksum((unsigned char *)input, output, length, | ||
| 218 | out_count, seed); | ||
| 219 | } | ||
| 220 | void _ossl_old_des_random_seed(_ossl_old_des_cblock key) | ||
| 221 | { | ||
| 222 | RAND_seed(key, sizeof(_ossl_old_des_cblock)); | ||
| 223 | } | ||
| 224 | void _ossl_old_des_random_key(_ossl_old_des_cblock ret) | ||
| 225 | { | ||
| 226 | DES_random_key((DES_cblock *)ret); | ||
| 227 | } | ||
| 228 | int _ossl_old_des_read_password(_ossl_old_des_cblock *key, const char *prompt, | ||
| 229 | int verify) | ||
| 230 | { | ||
| 231 | return DES_read_password(key, prompt, verify); | ||
| 232 | } | ||
| 233 | int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1, _ossl_old_des_cblock *key2, | ||
| 234 | const char *prompt, int verify) | ||
| 235 | { | ||
| 236 | return DES_read_2passwords(key1, key2, prompt, verify); | ||
| 237 | } | ||
| 238 | void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key) | ||
| 239 | { | ||
| 240 | DES_set_odd_parity(key); | ||
| 241 | } | ||
| 242 | int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key) | ||
| 243 | { | ||
| 244 | return DES_is_weak_key(key); | ||
| 245 | } | ||
| 246 | int _ossl_old_des_set_key(_ossl_old_des_cblock *key,des_key_schedule schedule) | ||
| 247 | { | ||
| 248 | return DES_set_key(key, (DES_key_schedule *)schedule); | ||
| 249 | } | ||
| 250 | int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,des_key_schedule schedule) | ||
| 251 | { | ||
| 252 | return DES_key_sched(key, (DES_key_schedule *)schedule); | ||
| 253 | } | ||
| 254 | void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key) | ||
| 255 | { | ||
| 256 | DES_string_to_key(str, key); | ||
| 257 | } | ||
| 258 | void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2) | ||
| 259 | { | ||
| 260 | DES_string_to_2keys(str, key1, key2); | ||
| 261 | } | ||
| 262 | void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
| 263 | des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc) | ||
| 264 | { | ||
| 265 | DES_cfb64_encrypt(in, out, length, (DES_key_schedule *)schedule, | ||
| 266 | ivec, num, enc); | ||
| 267 | } | ||
| 268 | void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
| 269 | des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num) | ||
| 270 | { | ||
| 271 | DES_ofb64_encrypt(in, out, length, (DES_key_schedule *)schedule, | ||
| 272 | ivec, num); | ||
| 273 | } | ||
diff --git a/src/lib/libcrypto/des/des_old.h b/src/lib/libcrypto/des/des_old.h new file mode 100644 index 0000000000..8665ba4e7e --- /dev/null +++ b/src/lib/libcrypto/des/des_old.h | |||
| @@ -0,0 +1,446 @@ | |||
| 1 | /* crypto/des/des_old.h -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | |||
| 3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 4 | * | ||
| 5 | * The function names in here are deprecated and are only present to | ||
| 6 | * provide an interface compatible with openssl 0.9.6 and older as | ||
| 7 | * well as libdes. OpenSSL now provides functions where "des_" has | ||
| 8 | * been replaced with "DES_" in the names, to make it possible to | ||
| 9 | * make incompatible changes that are needed for C type security and | ||
| 10 | * other stuff. | ||
| 11 | * | ||
| 12 | * This include files has two compatibility modes: | ||
| 13 | * | ||
| 14 | * - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API | ||
| 15 | * that is compatible with libdes and SSLeay. | ||
| 16 | * - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an | ||
| 17 | * API that is compatible with OpenSSL 0.9.5x to 0.9.6x. | ||
| 18 | * | ||
| 19 | * Note that these modes break earlier snapshots of OpenSSL, where | ||
| 20 | * libdes compatibility was the only available mode or (later on) the | ||
| 21 | * prefered compatibility mode. However, after much consideration | ||
| 22 | * (and more or less violent discussions with external parties), it | ||
| 23 | * was concluded that OpenSSL should be compatible with earlier versions | ||
| 24 | * of itself before anything else. Also, in all honesty, libdes is | ||
| 25 | * an old beast that shouldn't really be used any more. | ||
| 26 | * | ||
| 27 | * Please consider starting to use the DES_ functions rather than the | ||
| 28 | * des_ ones. The des_ functions will disappear completely before | ||
| 29 | * OpenSSL 1.0! | ||
| 30 | * | ||
| 31 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 32 | */ | ||
| 33 | |||
| 34 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 35 | * project 2001. | ||
| 36 | */ | ||
| 37 | /* ==================================================================== | ||
| 38 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | ||
| 39 | * | ||
| 40 | * Redistribution and use in source and binary forms, with or without | ||
| 41 | * modification, are permitted provided that the following conditions | ||
| 42 | * are met: | ||
| 43 | * | ||
| 44 | * 1. Redistributions of source code must retain the above copyright | ||
| 45 | * notice, this list of conditions and the following disclaimer. | ||
| 46 | * | ||
| 47 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 48 | * notice, this list of conditions and the following disclaimer in | ||
| 49 | * the documentation and/or other materials provided with the | ||
| 50 | * distribution. | ||
| 51 | * | ||
| 52 | * 3. All advertising materials mentioning features or use of this | ||
| 53 | * software must display the following acknowledgment: | ||
| 54 | * "This product includes software developed by the OpenSSL Project | ||
| 55 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 56 | * | ||
| 57 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 58 | * endorse or promote products derived from this software without | ||
| 59 | * prior written permission. For written permission, please contact | ||
| 60 | * openssl-core@openssl.org. | ||
| 61 | * | ||
| 62 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 63 | * nor may "OpenSSL" appear in their names without prior written | ||
| 64 | * permission of the OpenSSL Project. | ||
| 65 | * | ||
| 66 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 67 | * acknowledgment: | ||
| 68 | * "This product includes software developed by the OpenSSL Project | ||
| 69 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 70 | * | ||
| 71 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 72 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 73 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 74 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 75 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 76 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 77 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 78 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 79 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 80 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 81 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 82 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 83 | * ==================================================================== | ||
| 84 | * | ||
| 85 | * This product includes cryptographic software written by Eric Young | ||
| 86 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 87 | * Hudson (tjh@cryptsoft.com). | ||
| 88 | * | ||
| 89 | */ | ||
| 90 | |||
| 91 | #ifndef HEADER_DES_OLD_H | ||
| 92 | #define HEADER_DES_OLD_H | ||
| 93 | |||
| 94 | #include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */ | ||
| 95 | |||
| 96 | #ifdef OPENSSL_NO_DES | ||
| 97 | #error DES is disabled. | ||
| 98 | #endif | ||
| 99 | |||
| 100 | #ifndef HEADER_DES_H | ||
| 101 | #error You must include des.h, not des_old.h directly. | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #ifdef _KERBEROS_DES_H | ||
| 105 | #error <openssl/des_old.h> replaces <kerberos/des.h>. | ||
| 106 | #endif | ||
| 107 | |||
| 108 | #include <openssl/symhacks.h> | ||
| 109 | |||
| 110 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
| 111 | # undef OPENSSL_EXTERN | ||
| 112 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
| 113 | #endif | ||
| 114 | |||
| 115 | #ifdef __cplusplus | ||
| 116 | extern "C" { | ||
| 117 | #endif | ||
| 118 | |||
| 119 | #ifdef _ | ||
| 120 | #undef _ | ||
| 121 | #endif | ||
| 122 | |||
| 123 | typedef unsigned char _ossl_old_des_cblock[8]; | ||
| 124 | typedef struct _ossl_old_des_ks_struct | ||
| 125 | { | ||
| 126 | union { | ||
| 127 | _ossl_old_des_cblock _; | ||
| 128 | /* make sure things are correct size on machines with | ||
| 129 | * 8 byte longs */ | ||
| 130 | DES_LONG pad[2]; | ||
| 131 | } ks; | ||
| 132 | } _ossl_old_des_key_schedule[16]; | ||
| 133 | |||
| 134 | #ifndef OPENSSL_DES_LIBDES_COMPATIBILITY | ||
| 135 | #define des_cblock DES_cblock | ||
| 136 | #define const_des_cblock const_DES_cblock | ||
| 137 | #define des_key_schedule DES_key_schedule | ||
| 138 | #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ | ||
| 139 | DES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e)) | ||
| 140 | #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ | ||
| 141 | DES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e)) | ||
| 142 | #define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\ | ||
| 143 | DES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e)) | ||
| 144 | #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ | ||
| 145 | DES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e)) | ||
| 146 | #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ | ||
| 147 | DES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n)) | ||
| 148 | #define des_options()\ | ||
| 149 | DES_options() | ||
| 150 | #define des_cbc_cksum(i,o,l,k,iv)\ | ||
| 151 | DES_cbc_cksum((i),(o),(l),&(k),(iv)) | ||
| 152 | #define des_cbc_encrypt(i,o,l,k,iv,e)\ | ||
| 153 | DES_cbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
| 154 | #define des_ncbc_encrypt(i,o,l,k,iv,e)\ | ||
| 155 | DES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
| 156 | #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ | ||
| 157 | DES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e)) | ||
| 158 | #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ | ||
| 159 | DES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e)) | ||
| 160 | #define des_ecb_encrypt(i,o,k,e)\ | ||
| 161 | DES_ecb_encrypt((i),(o),&(k),(e)) | ||
| 162 | #define des_encrypt1(d,k,e)\ | ||
| 163 | DES_encrypt1((d),&(k),(e)) | ||
| 164 | #define des_encrypt2(d,k,e)\ | ||
| 165 | DES_encrypt2((d),&(k),(e)) | ||
| 166 | #define des_encrypt3(d,k1,k2,k3)\ | ||
| 167 | DES_encrypt3((d),&(k1),&(k2),&(k3)) | ||
| 168 | #define des_decrypt3(d,k1,k2,k3)\ | ||
| 169 | DES_decrypt3((d),&(k1),&(k2),&(k3)) | ||
| 170 | #define des_xwhite_in2out(k,i,o)\ | ||
| 171 | DES_xwhite_in2out((k),(i),(o)) | ||
| 172 | #define des_enc_read(f,b,l,k,iv)\ | ||
| 173 | DES_enc_read((f),(b),(l),&(k),(iv)) | ||
| 174 | #define des_enc_write(f,b,l,k,iv)\ | ||
| 175 | DES_enc_write((f),(b),(l),&(k),(iv)) | ||
| 176 | #define des_fcrypt(b,s,r)\ | ||
| 177 | DES_fcrypt((b),(s),(r)) | ||
| 178 | #if 0 | ||
| 179 | #define des_crypt(b,s)\ | ||
| 180 | DES_crypt((b),(s)) | ||
| 181 | #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__) | ||
| 182 | #define crypt(b,s)\ | ||
| 183 | DES_crypt((b),(s)) | ||
| 184 | #endif | ||
| 185 | #endif | ||
| 186 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | ||
| 187 | DES_ofb_encrypt((i),(o),(n),(l),&(k),(iv)) | ||
| 188 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | ||
| 189 | DES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e)) | ||
| 190 | #define des_quad_cksum(i,o,l,c,s)\ | ||
| 191 | DES_quad_cksum((i),(o),(l),(c),(s)) | ||
| 192 | #define des_random_seed(k)\ | ||
| 193 | _ossl_096_des_random_seed((k)) | ||
| 194 | #define des_random_key(r)\ | ||
| 195 | DES_random_key((r)) | ||
| 196 | #define des_read_password(k,p,v) \ | ||
| 197 | DES_read_password((k),(p),(v)) | ||
| 198 | #define des_read_2passwords(k1,k2,p,v) \ | ||
| 199 | DES_read_2passwords((k1),(k2),(p),(v)) | ||
| 200 | #define des_set_odd_parity(k)\ | ||
| 201 | DES_set_odd_parity((k)) | ||
| 202 | #define des_check_key_parity(k)\ | ||
| 203 | DES_check_key_parity((k)) | ||
| 204 | #define des_is_weak_key(k)\ | ||
| 205 | DES_is_weak_key((k)) | ||
| 206 | #define des_set_key(k,ks)\ | ||
| 207 | DES_set_key((k),&(ks)) | ||
| 208 | #define des_key_sched(k,ks)\ | ||
| 209 | DES_key_sched((k),&(ks)) | ||
| 210 | #define des_set_key_checked(k,ks)\ | ||
| 211 | DES_set_key_checked((k),&(ks)) | ||
| 212 | #define des_set_key_unchecked(k,ks)\ | ||
| 213 | DES_set_key_unchecked((k),&(ks)) | ||
| 214 | #define des_string_to_key(s,k)\ | ||
| 215 | DES_string_to_key((s),(k)) | ||
| 216 | #define des_string_to_2keys(s,k1,k2)\ | ||
| 217 | DES_string_to_2keys((s),(k1),(k2)) | ||
| 218 | #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ | ||
| 219 | DES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e)) | ||
| 220 | #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ | ||
| 221 | DES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n)) | ||
| 222 | |||
| 223 | |||
| 224 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
| 225 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
| 226 | |||
| 227 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
| 228 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
| 229 | |||
| 230 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
| 231 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
| 232 | |||
| 233 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
| 234 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
| 235 | |||
| 236 | #define des_check_key DES_check_key | ||
| 237 | #define des_rw_mode DES_rw_mode | ||
| 238 | #else /* libdes compatibility */ | ||
| 239 | /* Map all symbol names to _ossl_old_des_* form, so we avoid all | ||
| 240 | clashes with libdes */ | ||
| 241 | #define des_cblock _ossl_old_des_cblock | ||
| 242 | #define des_key_schedule _ossl_old_des_key_schedule | ||
| 243 | #define des_ecb3_encrypt(i,o,k1,k2,k3,e)\ | ||
| 244 | _ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e)) | ||
| 245 | #define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\ | ||
| 246 | _ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e)) | ||
| 247 | #define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\ | ||
| 248 | _ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e)) | ||
| 249 | #define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\ | ||
| 250 | _ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n)) | ||
| 251 | #define des_options()\ | ||
| 252 | _ossl_old_des_options() | ||
| 253 | #define des_cbc_cksum(i,o,l,k,iv)\ | ||
| 254 | _ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv)) | ||
| 255 | #define des_cbc_encrypt(i,o,l,k,iv,e)\ | ||
| 256 | _ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
| 257 | #define des_ncbc_encrypt(i,o,l,k,iv,e)\ | ||
| 258 | _ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
| 259 | #define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\ | ||
| 260 | _ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e)) | ||
| 261 | #define des_cfb_encrypt(i,o,n,l,k,iv,e)\ | ||
| 262 | _ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e)) | ||
| 263 | #define des_ecb_encrypt(i,o,k,e)\ | ||
| 264 | _ossl_old_des_ecb_encrypt((i),(o),(k),(e)) | ||
| 265 | #define des_encrypt(d,k,e)\ | ||
| 266 | _ossl_old_des_encrypt((d),(k),(e)) | ||
| 267 | #define des_encrypt2(d,k,e)\ | ||
| 268 | _ossl_old_des_encrypt2((d),(k),(e)) | ||
| 269 | #define des_encrypt3(d,k1,k2,k3)\ | ||
| 270 | _ossl_old_des_encrypt3((d),(k1),(k2),(k3)) | ||
| 271 | #define des_decrypt3(d,k1,k2,k3)\ | ||
| 272 | _ossl_old_des_decrypt3((d),(k1),(k2),(k3)) | ||
| 273 | #define des_xwhite_in2out(k,i,o)\ | ||
| 274 | _ossl_old_des_xwhite_in2out((k),(i),(o)) | ||
| 275 | #define des_enc_read(f,b,l,k,iv)\ | ||
| 276 | _ossl_old_des_enc_read((f),(b),(l),(k),(iv)) | ||
| 277 | #define des_enc_write(f,b,l,k,iv)\ | ||
| 278 | _ossl_old_des_enc_write((f),(b),(l),(k),(iv)) | ||
| 279 | #define des_fcrypt(b,s,r)\ | ||
| 280 | _ossl_old_des_fcrypt((b),(s),(r)) | ||
| 281 | #define des_crypt(b,s)\ | ||
| 282 | _ossl_old_des_crypt((b),(s)) | ||
| 283 | #if 0 | ||
| 284 | #define crypt(b,s)\ | ||
| 285 | _ossl_old_crypt((b),(s)) | ||
| 286 | #endif | ||
| 287 | #define des_ofb_encrypt(i,o,n,l,k,iv)\ | ||
| 288 | _ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv)) | ||
| 289 | #define des_pcbc_encrypt(i,o,l,k,iv,e)\ | ||
| 290 | _ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e)) | ||
| 291 | #define des_quad_cksum(i,o,l,c,s)\ | ||
| 292 | _ossl_old_des_quad_cksum((i),(o),(l),(c),(s)) | ||
| 293 | #define des_random_seed(k)\ | ||
| 294 | _ossl_old_des_random_seed((k)) | ||
| 295 | #define des_random_key(r)\ | ||
| 296 | _ossl_old_des_random_key((r)) | ||
| 297 | #define des_read_password(k,p,v) \ | ||
| 298 | _ossl_old_des_read_password((k),(p),(v)) | ||
| 299 | #define des_read_2passwords(k1,k2,p,v) \ | ||
| 300 | _ossl_old_des_read_2passwords((k1),(k2),(p),(v)) | ||
| 301 | #define des_set_odd_parity(k)\ | ||
| 302 | _ossl_old_des_set_odd_parity((k)) | ||
| 303 | #define des_is_weak_key(k)\ | ||
| 304 | _ossl_old_des_is_weak_key((k)) | ||
| 305 | #define des_set_key(k,ks)\ | ||
| 306 | _ossl_old_des_set_key((k),(ks)) | ||
| 307 | #define des_key_sched(k,ks)\ | ||
| 308 | _ossl_old_des_key_sched((k),(ks)) | ||
| 309 | #define des_string_to_key(s,k)\ | ||
| 310 | _ossl_old_des_string_to_key((s),(k)) | ||
| 311 | #define des_string_to_2keys(s,k1,k2)\ | ||
| 312 | _ossl_old_des_string_to_2keys((s),(k1),(k2)) | ||
| 313 | #define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\ | ||
| 314 | _ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e)) | ||
| 315 | #define des_ofb64_encrypt(i,o,l,ks,iv,n)\ | ||
| 316 | _ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n)) | ||
| 317 | |||
| 318 | |||
| 319 | #define des_ecb2_encrypt(i,o,k1,k2,e) \ | ||
| 320 | des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) | ||
| 321 | |||
| 322 | #define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ | ||
| 323 | des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) | ||
| 324 | |||
| 325 | #define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ | ||
| 326 | des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) | ||
| 327 | |||
| 328 | #define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ | ||
| 329 | des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) | ||
| 330 | |||
| 331 | #define des_check_key DES_check_key | ||
| 332 | #define des_rw_mode DES_rw_mode | ||
| 333 | #endif | ||
| 334 | |||
| 335 | const char *_ossl_old_des_options(void); | ||
| 336 | void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 337 | _ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2, | ||
| 338 | _ossl_old_des_key_schedule ks3, int enc); | ||
| 339 | DES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 340 | long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); | ||
| 341 | void _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 342 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
| 343 | void _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 344 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
| 345 | void _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 346 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec, | ||
| 347 | _ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc); | ||
| 348 | void _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, | ||
| 349 | long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
| 350 | void _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 351 | _ossl_old_des_key_schedule ks,int enc); | ||
| 352 | void _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); | ||
| 353 | void _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc); | ||
| 354 | void _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, | ||
| 355 | _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); | ||
| 356 | void _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1, | ||
| 357 | _ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3); | ||
| 358 | void _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, | ||
| 359 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
| 360 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc); | ||
| 361 | void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, | ||
| 362 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
| 363 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc); | ||
| 364 | void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, | ||
| 365 | long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, | ||
| 366 | _ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num); | ||
| 367 | #if 0 | ||
| 368 | void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white), | ||
| 369 | _ossl_old_des_cblock (*out_white)); | ||
| 370 | #endif | ||
| 371 | |||
| 372 | int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, | ||
| 373 | _ossl_old_des_cblock *iv); | ||
| 374 | int _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched, | ||
| 375 | _ossl_old_des_cblock *iv); | ||
| 376 | char *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret); | ||
| 377 | char *_ossl_old_des_crypt(const char *buf,const char *salt); | ||
| 378 | #if !defined(PERL5) && !defined(NeXT) | ||
| 379 | char *_ossl_old_crypt(const char *buf,const char *salt); | ||
| 380 | #endif | ||
| 381 | void _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out, | ||
| 382 | int numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec); | ||
| 383 | void _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length, | ||
| 384 | _ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc); | ||
| 385 | DES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output, | ||
| 386 | long length,int out_count,_ossl_old_des_cblock *seed); | ||
| 387 | void _ossl_old_des_random_seed(_ossl_old_des_cblock key); | ||
| 388 | void _ossl_old_des_random_key(_ossl_old_des_cblock ret); | ||
| 389 | int _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify); | ||
| 390 | int _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2, | ||
| 391 | const char *prompt,int verify); | ||
| 392 | void _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key); | ||
| 393 | int _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key); | ||
| 394 | int _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); | ||
| 395 | int _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule); | ||
| 396 | void _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key); | ||
| 397 | void _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2); | ||
| 398 | void _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
| 399 | _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc); | ||
| 400 | void _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, | ||
| 401 | _ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num); | ||
| 402 | |||
| 403 | void _ossl_096_des_random_seed(des_cblock *key); | ||
| 404 | |||
| 405 | /* The following definitions provide compatibility with the MIT Kerberos | ||
| 406 | * library. The _ossl_old_des_key_schedule structure is not binary compatible. */ | ||
| 407 | |||
| 408 | #define _KERBEROS_DES_H | ||
| 409 | |||
| 410 | #define KRBDES_ENCRYPT DES_ENCRYPT | ||
| 411 | #define KRBDES_DECRYPT DES_DECRYPT | ||
| 412 | |||
| 413 | #ifdef KERBEROS | ||
| 414 | # define ENCRYPT DES_ENCRYPT | ||
| 415 | # define DECRYPT DES_DECRYPT | ||
| 416 | #endif | ||
| 417 | |||
| 418 | #ifndef NCOMPAT | ||
| 419 | # define C_Block des_cblock | ||
| 420 | # define Key_schedule des_key_schedule | ||
| 421 | # define KEY_SZ DES_KEY_SZ | ||
| 422 | # define string_to_key des_string_to_key | ||
| 423 | # define read_pw_string des_read_pw_string | ||
| 424 | # define random_key des_random_key | ||
| 425 | # define pcbc_encrypt des_pcbc_encrypt | ||
| 426 | # define set_key des_set_key | ||
| 427 | # define key_sched des_key_sched | ||
| 428 | # define ecb_encrypt des_ecb_encrypt | ||
| 429 | # define cbc_encrypt des_cbc_encrypt | ||
| 430 | # define ncbc_encrypt des_ncbc_encrypt | ||
| 431 | # define xcbc_encrypt des_xcbc_encrypt | ||
| 432 | # define cbc_cksum des_cbc_cksum | ||
| 433 | # define quad_cksum des_quad_cksum | ||
| 434 | # define check_parity des_check_key_parity | ||
| 435 | #endif | ||
| 436 | |||
| 437 | #define des_fixup_key_parity DES_fixup_key_parity | ||
| 438 | |||
| 439 | #ifdef __cplusplus | ||
| 440 | } | ||
| 441 | #endif | ||
| 442 | |||
| 443 | /* for DES_read_pw_string et al */ | ||
| 444 | #include <openssl/ui_compat.h> | ||
| 445 | |||
| 446 | #endif | ||
diff --git a/src/lib/libcrypto/des/des_old2.c b/src/lib/libcrypto/des/des_old2.c new file mode 100644 index 0000000000..c8fa3ee135 --- /dev/null +++ b/src/lib/libcrypto/des/des_old2.c | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* crypto/des/des_old.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | |||
| 3 | /* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 4 | * | ||
| 5 | * The function names in here are deprecated and are only present to | ||
| 6 | * provide an interface compatible with OpenSSL 0.9.6c. OpenSSL now | ||
| 7 | * provides functions where "des_" has been replaced with "DES_" in | ||
| 8 | * the names, to make it possible to make incompatible changes that | ||
| 9 | * are needed for C type security and other stuff. | ||
| 10 | * | ||
| 11 | * Please consider starting to use the DES_ functions rather than the | ||
| 12 | * des_ ones. The des_ functions will dissapear completely before | ||
| 13 | * OpenSSL 1.0! | ||
| 14 | * | ||
| 15 | * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 19 | * project 2001. | ||
| 20 | */ | ||
| 21 | /* ==================================================================== | ||
| 22 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
| 23 | * | ||
| 24 | * Redistribution and use in source and binary forms, with or without | ||
| 25 | * modification, are permitted provided that the following conditions | ||
| 26 | * are met: | ||
| 27 | * | ||
| 28 | * 1. Redistributions of source code must retain the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer. | ||
| 30 | * | ||
| 31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 32 | * notice, this list of conditions and the following disclaimer in | ||
| 33 | * the documentation and/or other materials provided with the | ||
| 34 | * distribution. | ||
| 35 | * | ||
| 36 | * 3. All advertising materials mentioning features or use of this | ||
| 37 | * software must display the following acknowledgment: | ||
| 38 | * "This product includes software developed by the OpenSSL Project | ||
| 39 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 40 | * | ||
| 41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 42 | * endorse or promote products derived from this software without | ||
| 43 | * prior written permission. For written permission, please contact | ||
| 44 | * openssl-core@openssl.org. | ||
| 45 | * | ||
| 46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 47 | * nor may "OpenSSL" appear in their names without prior written | ||
| 48 | * permission of the OpenSSL Project. | ||
| 49 | * | ||
| 50 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 51 | * acknowledgment: | ||
| 52 | * "This product includes software developed by the OpenSSL Project | ||
| 53 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 54 | * | ||
| 55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 67 | * ==================================================================== | ||
| 68 | * | ||
| 69 | * This product includes cryptographic software written by Eric Young | ||
| 70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 71 | * Hudson (tjh@cryptsoft.com). | ||
| 72 | * | ||
| 73 | */ | ||
| 74 | |||
| 75 | #undef OPENSSL_DES_LIBDES_COMPATIBILITY | ||
| 76 | #include <openssl/des.h> | ||
| 77 | #include <openssl/rand.h> | ||
| 78 | |||
| 79 | void _ossl_096_des_random_seed(DES_cblock *key) | ||
| 80 | { | ||
| 81 | RAND_seed(key, sizeof(DES_cblock)); | ||
| 82 | } | ||
diff --git a/src/lib/libcrypto/des/des_opts.c b/src/lib/libcrypto/des/des_opts.c new file mode 100644 index 0000000000..2df82962c5 --- /dev/null +++ b/src/lib/libcrypto/des/des_opts.c | |||
| @@ -0,0 +1,608 @@ | |||
| 1 | /* crypto/des/des_opts.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. | ||
| 60 | * This is for machines with 64k code segment size restrictions. */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | #ifndef OPENSSL_SYS_MSDOS | ||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD | ||
| 70 | #else | ||
| 71 | #include <io.h> | ||
| 72 | extern void exit(); | ||
| 73 | #endif | ||
| 74 | |||
| 75 | #ifndef OPENSSL_SYS_NETWARE | ||
| 76 | #include <signal.h> | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #ifndef _IRIX | ||
| 80 | #include <time.h> | ||
| 81 | #endif | ||
| 82 | #ifdef TIMES | ||
| 83 | #include <sys/types.h> | ||
| 84 | #include <sys/times.h> | ||
| 85 | #endif | ||
| 86 | |||
| 87 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 88 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 89 | undefine TIMES, since that tells the rest of the program how things | ||
| 90 | should be handled. -- Richard Levitte */ | ||
| 91 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 92 | #undef TIMES | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #ifndef TIMES | ||
| 96 | #include <sys/timeb.h> | ||
| 97 | #endif | ||
| 98 | |||
| 99 | |||
| 100 | #if defined(sun) || defined(__ultrix) | ||
| 101 | #define _POSIX_SOURCE | ||
| 102 | #include <limits.h> | ||
| 103 | #include <sys/param.h> | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #include <openssl/des.h> | ||
| 107 | #include "spr.h" | ||
| 108 | |||
| 109 | #define DES_DEFAULT_OPTIONS | ||
| 110 | |||
| 111 | #if !defined(PART1) && !defined(PART2) && !defined(PART3) && !defined(PART4) | ||
| 112 | #define PART1 | ||
| 113 | #define PART2 | ||
| 114 | #define PART3 | ||
| 115 | #define PART4 | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #ifdef PART1 | ||
| 119 | |||
| 120 | #undef DES_UNROLL | ||
| 121 | #undef DES_RISC1 | ||
| 122 | #undef DES_RISC2 | ||
| 123 | #undef DES_PTR | ||
| 124 | #undef D_ENCRYPT | ||
| 125 | #define DES_encrypt1 des_encrypt_u4_cisc_idx | ||
| 126 | #define DES_encrypt2 des_encrypt2_u4_cisc_idx | ||
| 127 | #define DES_encrypt3 des_encrypt3_u4_cisc_idx | ||
| 128 | #define DES_decrypt3 des_decrypt3_u4_cisc_idx | ||
| 129 | #undef HEADER_DES_LOCL_H | ||
| 130 | #include "des_enc.c" | ||
| 131 | |||
| 132 | #define DES_UNROLL | ||
| 133 | #undef DES_RISC1 | ||
| 134 | #undef DES_RISC2 | ||
| 135 | #undef DES_PTR | ||
| 136 | #undef D_ENCRYPT | ||
| 137 | #undef DES_encrypt1 | ||
| 138 | #undef DES_encrypt2 | ||
| 139 | #undef DES_encrypt3 | ||
| 140 | #undef DES_decrypt3 | ||
| 141 | #define DES_encrypt1 des_encrypt_u16_cisc_idx | ||
| 142 | #define DES_encrypt2 des_encrypt2_u16_cisc_idx | ||
| 143 | #define DES_encrypt3 des_encrypt3_u16_cisc_idx | ||
| 144 | #define DES_decrypt3 des_decrypt3_u16_cisc_idx | ||
| 145 | #undef HEADER_DES_LOCL_H | ||
| 146 | #include "des_enc.c" | ||
| 147 | |||
| 148 | #undef DES_UNROLL | ||
| 149 | #define DES_RISC1 | ||
| 150 | #undef DES_RISC2 | ||
| 151 | #undef DES_PTR | ||
| 152 | #undef D_ENCRYPT | ||
| 153 | #undef DES_encrypt1 | ||
| 154 | #undef DES_encrypt2 | ||
| 155 | #undef DES_encrypt3 | ||
| 156 | #undef DES_decrypt3 | ||
| 157 | #define DES_encrypt1 des_encrypt_u4_risc1_idx | ||
| 158 | #define DES_encrypt2 des_encrypt2_u4_risc1_idx | ||
| 159 | #define DES_encrypt3 des_encrypt3_u4_risc1_idx | ||
| 160 | #define DES_decrypt3 des_decrypt3_u4_risc1_idx | ||
| 161 | #undef HEADER_DES_LOCL_H | ||
| 162 | #include "des_enc.c" | ||
| 163 | |||
| 164 | #endif | ||
| 165 | |||
| 166 | #ifdef PART2 | ||
| 167 | |||
| 168 | #undef DES_UNROLL | ||
| 169 | #undef DES_RISC1 | ||
| 170 | #define DES_RISC2 | ||
| 171 | #undef DES_PTR | ||
| 172 | #undef D_ENCRYPT | ||
| 173 | #undef DES_encrypt1 | ||
| 174 | #undef DES_encrypt2 | ||
| 175 | #undef DES_encrypt3 | ||
| 176 | #undef DES_decrypt3 | ||
| 177 | #define DES_encrypt1 des_encrypt_u4_risc2_idx | ||
| 178 | #define DES_encrypt2 des_encrypt2_u4_risc2_idx | ||
| 179 | #define DES_encrypt3 des_encrypt3_u4_risc2_idx | ||
| 180 | #define DES_decrypt3 des_decrypt3_u4_risc2_idx | ||
| 181 | #undef HEADER_DES_LOCL_H | ||
| 182 | #include "des_enc.c" | ||
| 183 | |||
| 184 | #define DES_UNROLL | ||
| 185 | #define DES_RISC1 | ||
| 186 | #undef DES_RISC2 | ||
| 187 | #undef DES_PTR | ||
| 188 | #undef D_ENCRYPT | ||
| 189 | #undef DES_encrypt1 | ||
| 190 | #undef DES_encrypt2 | ||
| 191 | #undef DES_encrypt3 | ||
| 192 | #undef DES_decrypt3 | ||
| 193 | #define DES_encrypt1 des_encrypt_u16_risc1_idx | ||
| 194 | #define DES_encrypt2 des_encrypt2_u16_risc1_idx | ||
| 195 | #define DES_encrypt3 des_encrypt3_u16_risc1_idx | ||
| 196 | #define DES_decrypt3 des_decrypt3_u16_risc1_idx | ||
| 197 | #undef HEADER_DES_LOCL_H | ||
| 198 | #include "des_enc.c" | ||
| 199 | |||
| 200 | #define DES_UNROLL | ||
| 201 | #undef DES_RISC1 | ||
| 202 | #define DES_RISC2 | ||
| 203 | #undef DES_PTR | ||
| 204 | #undef D_ENCRYPT | ||
| 205 | #undef DES_encrypt1 | ||
| 206 | #undef DES_encrypt2 | ||
| 207 | #undef DES_encrypt3 | ||
| 208 | #undef DES_decrypt3 | ||
| 209 | #define DES_encrypt1 des_encrypt_u16_risc2_idx | ||
| 210 | #define DES_encrypt2 des_encrypt2_u16_risc2_idx | ||
| 211 | #define DES_encrypt3 des_encrypt3_u16_risc2_idx | ||
| 212 | #define DES_decrypt3 des_decrypt3_u16_risc2_idx | ||
| 213 | #undef HEADER_DES_LOCL_H | ||
| 214 | #include "des_enc.c" | ||
| 215 | |||
| 216 | #endif | ||
| 217 | |||
| 218 | #ifdef PART3 | ||
| 219 | |||
| 220 | #undef DES_UNROLL | ||
| 221 | #undef DES_RISC1 | ||
| 222 | #undef DES_RISC2 | ||
| 223 | #define DES_PTR | ||
| 224 | #undef D_ENCRYPT | ||
| 225 | #undef DES_encrypt1 | ||
| 226 | #undef DES_encrypt2 | ||
| 227 | #undef DES_encrypt3 | ||
| 228 | #undef DES_decrypt3 | ||
| 229 | #define DES_encrypt1 des_encrypt_u4_cisc_ptr | ||
| 230 | #define DES_encrypt2 des_encrypt2_u4_cisc_ptr | ||
| 231 | #define DES_encrypt3 des_encrypt3_u4_cisc_ptr | ||
| 232 | #define DES_decrypt3 des_decrypt3_u4_cisc_ptr | ||
| 233 | #undef HEADER_DES_LOCL_H | ||
| 234 | #include "des_enc.c" | ||
| 235 | |||
| 236 | #define DES_UNROLL | ||
| 237 | #undef DES_RISC1 | ||
| 238 | #undef DES_RISC2 | ||
| 239 | #define DES_PTR | ||
| 240 | #undef D_ENCRYPT | ||
| 241 | #undef DES_encrypt1 | ||
| 242 | #undef DES_encrypt2 | ||
| 243 | #undef DES_encrypt3 | ||
| 244 | #undef DES_decrypt3 | ||
| 245 | #define DES_encrypt1 des_encrypt_u16_cisc_ptr | ||
| 246 | #define DES_encrypt2 des_encrypt2_u16_cisc_ptr | ||
| 247 | #define DES_encrypt3 des_encrypt3_u16_cisc_ptr | ||
| 248 | #define DES_decrypt3 des_decrypt3_u16_cisc_ptr | ||
| 249 | #undef HEADER_DES_LOCL_H | ||
| 250 | #include "des_enc.c" | ||
| 251 | |||
| 252 | #undef DES_UNROLL | ||
| 253 | #define DES_RISC1 | ||
| 254 | #undef DES_RISC2 | ||
| 255 | #define DES_PTR | ||
| 256 | #undef D_ENCRYPT | ||
| 257 | #undef DES_encrypt1 | ||
| 258 | #undef DES_encrypt2 | ||
| 259 | #undef DES_encrypt3 | ||
| 260 | #undef DES_decrypt3 | ||
| 261 | #define DES_encrypt1 des_encrypt_u4_risc1_ptr | ||
| 262 | #define DES_encrypt2 des_encrypt2_u4_risc1_ptr | ||
| 263 | #define DES_encrypt3 des_encrypt3_u4_risc1_ptr | ||
| 264 | #define DES_decrypt3 des_decrypt3_u4_risc1_ptr | ||
| 265 | #undef HEADER_DES_LOCL_H | ||
| 266 | #include "des_enc.c" | ||
| 267 | |||
| 268 | #endif | ||
| 269 | |||
| 270 | #ifdef PART4 | ||
| 271 | |||
| 272 | #undef DES_UNROLL | ||
| 273 | #undef DES_RISC1 | ||
| 274 | #define DES_RISC2 | ||
| 275 | #define DES_PTR | ||
| 276 | #undef D_ENCRYPT | ||
| 277 | #undef DES_encrypt1 | ||
| 278 | #undef DES_encrypt2 | ||
| 279 | #undef DES_encrypt3 | ||
| 280 | #undef DES_decrypt3 | ||
| 281 | #define DES_encrypt1 des_encrypt_u4_risc2_ptr | ||
| 282 | #define DES_encrypt2 des_encrypt2_u4_risc2_ptr | ||
| 283 | #define DES_encrypt3 des_encrypt3_u4_risc2_ptr | ||
| 284 | #define DES_decrypt3 des_decrypt3_u4_risc2_ptr | ||
| 285 | #undef HEADER_DES_LOCL_H | ||
| 286 | #include "des_enc.c" | ||
| 287 | |||
| 288 | #define DES_UNROLL | ||
| 289 | #define DES_RISC1 | ||
| 290 | #undef DES_RISC2 | ||
| 291 | #define DES_PTR | ||
| 292 | #undef D_ENCRYPT | ||
| 293 | #undef DES_encrypt1 | ||
| 294 | #undef DES_encrypt2 | ||
| 295 | #undef DES_encrypt3 | ||
| 296 | #undef DES_decrypt3 | ||
| 297 | #define DES_encrypt1 des_encrypt_u16_risc1_ptr | ||
| 298 | #define DES_encrypt2 des_encrypt2_u16_risc1_ptr | ||
| 299 | #define DES_encrypt3 des_encrypt3_u16_risc1_ptr | ||
| 300 | #define DES_decrypt3 des_decrypt3_u16_risc1_ptr | ||
| 301 | #undef HEADER_DES_LOCL_H | ||
| 302 | #include "des_enc.c" | ||
| 303 | |||
| 304 | #define DES_UNROLL | ||
| 305 | #undef DES_RISC1 | ||
| 306 | #define DES_RISC2 | ||
| 307 | #define DES_PTR | ||
| 308 | #undef D_ENCRYPT | ||
| 309 | #undef DES_encrypt1 | ||
| 310 | #undef DES_encrypt2 | ||
| 311 | #undef DES_encrypt3 | ||
| 312 | #undef DES_decrypt3 | ||
| 313 | #define DES_encrypt1 des_encrypt_u16_risc2_ptr | ||
| 314 | #define DES_encrypt2 des_encrypt2_u16_risc2_ptr | ||
| 315 | #define DES_encrypt3 des_encrypt3_u16_risc2_ptr | ||
| 316 | #define DES_decrypt3 des_decrypt3_u16_risc2_ptr | ||
| 317 | #undef HEADER_DES_LOCL_H | ||
| 318 | #include "des_enc.c" | ||
| 319 | |||
| 320 | #endif | ||
| 321 | |||
| 322 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 323 | #ifndef HZ | ||
| 324 | # ifndef CLK_TCK | ||
| 325 | # ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ | ||
| 326 | # define HZ 100.0 | ||
| 327 | # else /* _BSD_CLK_TCK_ */ | ||
| 328 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 329 | # endif | ||
| 330 | # else /* CLK_TCK */ | ||
| 331 | # define HZ ((double)CLK_TCK) | ||
| 332 | # endif | ||
| 333 | #endif | ||
| 334 | |||
| 335 | #define BUFSIZE ((long)1024) | ||
| 336 | long run=0; | ||
| 337 | |||
| 338 | double Time_F(int s); | ||
| 339 | #ifdef SIGALRM | ||
| 340 | #if defined(__STDC__) || defined(sgi) | ||
| 341 | #define SIGRETTYPE void | ||
| 342 | #else | ||
| 343 | #define SIGRETTYPE int | ||
| 344 | #endif | ||
| 345 | |||
| 346 | SIGRETTYPE sig_done(int sig); | ||
| 347 | SIGRETTYPE sig_done(int sig) | ||
| 348 | { | ||
| 349 | signal(SIGALRM,sig_done); | ||
| 350 | run=0; | ||
| 351 | #ifdef LINT | ||
| 352 | sig=sig; | ||
| 353 | #endif | ||
| 354 | } | ||
| 355 | #endif | ||
| 356 | |||
| 357 | #define START 0 | ||
| 358 | #define STOP 1 | ||
| 359 | |||
| 360 | double Time_F(int s) | ||
| 361 | { | ||
| 362 | double ret; | ||
| 363 | #ifdef TIMES | ||
| 364 | static struct tms tstart,tend; | ||
| 365 | |||
| 366 | if (s == START) | ||
| 367 | { | ||
| 368 | times(&tstart); | ||
| 369 | return(0); | ||
| 370 | } | ||
| 371 | else | ||
| 372 | { | ||
| 373 | times(&tend); | ||
| 374 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 375 | return((ret == 0.0)?1e-6:ret); | ||
| 376 | } | ||
| 377 | #else /* !times() */ | ||
| 378 | static struct timeb tstart,tend; | ||
| 379 | long i; | ||
| 380 | |||
| 381 | if (s == START) | ||
| 382 | { | ||
| 383 | ftime(&tstart); | ||
| 384 | return(0); | ||
| 385 | } | ||
| 386 | else | ||
| 387 | { | ||
| 388 | ftime(&tend); | ||
| 389 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 390 | ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; | ||
| 391 | return((ret == 0.0)?1e-6:ret); | ||
| 392 | } | ||
| 393 | #endif | ||
| 394 | } | ||
| 395 | |||
| 396 | #ifdef SIGALRM | ||
| 397 | #define print_name(name) fprintf(stderr,"Doing %s's for 10 seconds\n",name); alarm(10); | ||
| 398 | #else | ||
| 399 | #define print_name(name) fprintf(stderr,"Doing %s %ld times\n",name,cb); | ||
| 400 | #endif | ||
| 401 | |||
| 402 | #define time_it(func,name,index) \ | ||
| 403 | print_name(name); \ | ||
| 404 | Time_F(START); \ | ||
| 405 | for (count=0,run=1; COND(cb); count++) \ | ||
| 406 | { \ | ||
| 407 | unsigned long d[2]; \ | ||
| 408 | func(d,&sch,DES_ENCRYPT); \ | ||
| 409 | } \ | ||
| 410 | tm[index]=Time_F(STOP); \ | ||
| 411 | fprintf(stderr,"%ld %s's in %.2f second\n",count,name,tm[index]); \ | ||
| 412 | tm[index]=((double)COUNT(cb))/tm[index]; | ||
| 413 | |||
| 414 | #define print_it(name,index) \ | ||
| 415 | fprintf(stderr,"%s bytes per sec = %12.2f (%5.1fuS)\n",name, \ | ||
| 416 | tm[index]*8,1.0e6/tm[index]); | ||
| 417 | |||
| 418 | int main(int argc, char **argv) | ||
| 419 | { | ||
| 420 | long count; | ||
| 421 | static unsigned char buf[BUFSIZE]; | ||
| 422 | static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | ||
| 423 | static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; | ||
| 424 | static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; | ||
| 425 | DES_key_schedule sch,sch2,sch3; | ||
| 426 | double d,tm[16],max=0; | ||
| 427 | int rank[16]; | ||
| 428 | char *str[16]; | ||
| 429 | int max_idx=0,i,num=0,j; | ||
| 430 | #ifndef SIGALARM | ||
| 431 | long ca,cb,cc,cd,ce; | ||
| 432 | #endif | ||
| 433 | |||
| 434 | for (i=0; i<12; i++) | ||
| 435 | { | ||
| 436 | tm[i]=0.0; | ||
| 437 | rank[i]=0; | ||
| 438 | } | ||
| 439 | |||
| 440 | #ifndef TIMES | ||
| 441 | fprintf(stderr,"To get the most accurate results, try to run this\n"); | ||
| 442 | fprintf(stderr,"program when this computer is idle.\n"); | ||
| 443 | #endif | ||
| 444 | |||
| 445 | DES_set_key_unchecked(&key,&sch); | ||
| 446 | DES_set_key_unchecked(&key2,&sch2); | ||
| 447 | DES_set_key_unchecked(&key3,&sch3); | ||
| 448 | |||
| 449 | #ifndef SIGALRM | ||
| 450 | fprintf(stderr,"First we calculate the approximate speed ...\n"); | ||
| 451 | DES_set_key_unchecked(&key,sch); | ||
| 452 | count=10; | ||
| 453 | do { | ||
| 454 | long i; | ||
| 455 | unsigned long data[2]; | ||
| 456 | |||
| 457 | count*=2; | ||
| 458 | Time_F(START); | ||
| 459 | for (i=count; i; i--) | ||
| 460 | DES_encrypt1(data,&(sch[0]),DES_ENCRYPT); | ||
| 461 | d=Time_F(STOP); | ||
| 462 | } while (d < 3.0); | ||
| 463 | ca=count; | ||
| 464 | cb=count*3; | ||
| 465 | cc=count*3*8/BUFSIZE+1; | ||
| 466 | cd=count*8/BUFSIZE+1; | ||
| 467 | |||
| 468 | ce=count/20+1; | ||
| 469 | #define COND(d) (count != (d)) | ||
| 470 | #define COUNT(d) (d) | ||
| 471 | #else | ||
| 472 | #define COND(c) (run) | ||
| 473 | #define COUNT(d) (count) | ||
| 474 | signal(SIGALRM,sig_done); | ||
| 475 | alarm(10); | ||
| 476 | #endif | ||
| 477 | |||
| 478 | #ifdef PART1 | ||
| 479 | time_it(des_encrypt_u4_cisc_idx, "des_encrypt_u4_cisc_idx ", 0); | ||
| 480 | time_it(des_encrypt_u16_cisc_idx, "des_encrypt_u16_cisc_idx ", 1); | ||
| 481 | time_it(des_encrypt_u4_risc1_idx, "des_encrypt_u4_risc1_idx ", 2); | ||
| 482 | num+=3; | ||
| 483 | #endif | ||
| 484 | #ifdef PART2 | ||
| 485 | time_it(des_encrypt_u16_risc1_idx,"des_encrypt_u16_risc1_idx", 3); | ||
| 486 | time_it(des_encrypt_u4_risc2_idx, "des_encrypt_u4_risc2_idx ", 4); | ||
| 487 | time_it(des_encrypt_u16_risc2_idx,"des_encrypt_u16_risc2_idx", 5); | ||
| 488 | num+=3; | ||
| 489 | #endif | ||
| 490 | #ifdef PART3 | ||
| 491 | time_it(des_encrypt_u4_cisc_ptr, "des_encrypt_u4_cisc_ptr ", 6); | ||
| 492 | time_it(des_encrypt_u16_cisc_ptr, "des_encrypt_u16_cisc_ptr ", 7); | ||
| 493 | time_it(des_encrypt_u4_risc1_ptr, "des_encrypt_u4_risc1_ptr ", 8); | ||
| 494 | num+=3; | ||
| 495 | #endif | ||
| 496 | #ifdef PART4 | ||
| 497 | time_it(des_encrypt_u16_risc1_ptr,"des_encrypt_u16_risc1_ptr", 9); | ||
| 498 | time_it(des_encrypt_u4_risc2_ptr, "des_encrypt_u4_risc2_ptr ",10); | ||
| 499 | time_it(des_encrypt_u16_risc2_ptr,"des_encrypt_u16_risc2_ptr",11); | ||
| 500 | num+=3; | ||
| 501 | #endif | ||
| 502 | |||
| 503 | #ifdef PART1 | ||
| 504 | str[0]=" 4 c i"; | ||
| 505 | print_it("des_encrypt_u4_cisc_idx ",0); | ||
| 506 | max=tm[0]; | ||
| 507 | max_idx=0; | ||
| 508 | str[1]="16 c i"; | ||
| 509 | print_it("des_encrypt_u16_cisc_idx ",1); | ||
| 510 | if (max < tm[1]) { max=tm[1]; max_idx=1; } | ||
| 511 | str[2]=" 4 r1 i"; | ||
| 512 | print_it("des_encrypt_u4_risc1_idx ",2); | ||
| 513 | if (max < tm[2]) { max=tm[2]; max_idx=2; } | ||
| 514 | #endif | ||
| 515 | #ifdef PART2 | ||
| 516 | str[3]="16 r1 i"; | ||
| 517 | print_it("des_encrypt_u16_risc1_idx",3); | ||
| 518 | if (max < tm[3]) { max=tm[3]; max_idx=3; } | ||
| 519 | str[4]=" 4 r2 i"; | ||
| 520 | print_it("des_encrypt_u4_risc2_idx ",4); | ||
| 521 | if (max < tm[4]) { max=tm[4]; max_idx=4; } | ||
| 522 | str[5]="16 r2 i"; | ||
| 523 | print_it("des_encrypt_u16_risc2_idx",5); | ||
| 524 | if (max < tm[5]) { max=tm[5]; max_idx=5; } | ||
| 525 | #endif | ||
| 526 | #ifdef PART3 | ||
| 527 | str[6]=" 4 c p"; | ||
| 528 | print_it("des_encrypt_u4_cisc_ptr ",6); | ||
| 529 | if (max < tm[6]) { max=tm[6]; max_idx=6; } | ||
| 530 | str[7]="16 c p"; | ||
| 531 | print_it("des_encrypt_u16_cisc_ptr ",7); | ||
| 532 | if (max < tm[7]) { max=tm[7]; max_idx=7; } | ||
| 533 | str[8]=" 4 r1 p"; | ||
| 534 | print_it("des_encrypt_u4_risc1_ptr ",8); | ||
| 535 | if (max < tm[8]) { max=tm[8]; max_idx=8; } | ||
| 536 | #endif | ||
| 537 | #ifdef PART4 | ||
| 538 | str[9]="16 r1 p"; | ||
| 539 | print_it("des_encrypt_u16_risc1_ptr",9); | ||
| 540 | if (max < tm[9]) { max=tm[9]; max_idx=9; } | ||
| 541 | str[10]=" 4 r2 p"; | ||
| 542 | print_it("des_encrypt_u4_risc2_ptr ",10); | ||
| 543 | if (max < tm[10]) { max=tm[10]; max_idx=10; } | ||
| 544 | str[11]="16 r2 p"; | ||
| 545 | print_it("des_encrypt_u16_risc2_ptr",11); | ||
| 546 | if (max < tm[11]) { max=tm[11]; max_idx=11; } | ||
| 547 | #endif | ||
| 548 | printf("options des ecb/s\n"); | ||
| 549 | printf("%s %12.2f 100.0%%\n",str[max_idx],tm[max_idx]); | ||
| 550 | d=tm[max_idx]; | ||
| 551 | tm[max_idx]= -2.0; | ||
| 552 | max= -1.0; | ||
| 553 | for (;;) | ||
| 554 | { | ||
| 555 | for (i=0; i<12; i++) | ||
| 556 | { | ||
| 557 | if (max < tm[i]) { max=tm[i]; j=i; } | ||
| 558 | } | ||
| 559 | if (max < 0.0) break; | ||
| 560 | printf("%s %12.2f %4.1f%%\n",str[j],tm[j],tm[j]/d*100.0); | ||
| 561 | tm[j]= -2.0; | ||
| 562 | max= -1.0; | ||
| 563 | } | ||
| 564 | |||
| 565 | switch (max_idx) | ||
| 566 | { | ||
| 567 | case 0: | ||
| 568 | printf("-DDES_DEFAULT_OPTIONS\n"); | ||
| 569 | break; | ||
| 570 | case 1: | ||
| 571 | printf("-DDES_UNROLL\n"); | ||
| 572 | break; | ||
| 573 | case 2: | ||
| 574 | printf("-DDES_RISC1\n"); | ||
| 575 | break; | ||
| 576 | case 3: | ||
| 577 | printf("-DDES_UNROLL -DDES_RISC1\n"); | ||
| 578 | break; | ||
| 579 | case 4: | ||
| 580 | printf("-DDES_RISC2\n"); | ||
| 581 | break; | ||
| 582 | case 5: | ||
| 583 | printf("-DDES_UNROLL -DDES_RISC2\n"); | ||
| 584 | break; | ||
| 585 | case 6: | ||
| 586 | printf("-DDES_PTR\n"); | ||
| 587 | break; | ||
| 588 | case 7: | ||
| 589 | printf("-DDES_UNROLL -DDES_PTR\n"); | ||
| 590 | break; | ||
| 591 | case 8: | ||
| 592 | printf("-DDES_RISC1 -DDES_PTR\n"); | ||
| 593 | break; | ||
| 594 | case 9: | ||
| 595 | printf("-DDES_UNROLL -DDES_RISC1 -DDES_PTR\n"); | ||
| 596 | break; | ||
| 597 | case 10: | ||
| 598 | printf("-DDES_RISC2 -DDES_PTR\n"); | ||
| 599 | break; | ||
| 600 | case 11: | ||
| 601 | printf("-DDES_UNROLL -DDES_RISC2 -DDES_PTR\n"); | ||
| 602 | break; | ||
| 603 | } | ||
| 604 | exit(0); | ||
| 605 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 606 | return(0); | ||
| 607 | #endif | ||
| 608 | } | ||
diff --git a/src/lib/libcrypto/des/des_ver.h b/src/lib/libcrypto/des/des_ver.h new file mode 100644 index 0000000000..d1ada258a6 --- /dev/null +++ b/src/lib/libcrypto/des/des_ver.h | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* crypto/des/des_ver.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/e_os2.h> | ||
| 60 | |||
| 61 | #ifdef OPENSSL_BUILD_SHLIBCRYPTO | ||
| 62 | # undef OPENSSL_EXTERN | ||
| 63 | # define OPENSSL_EXTERN OPENSSL_EXPORT | ||
| 64 | #endif | ||
| 65 | |||
| 66 | /* The following macros make sure the names are different from libdes names */ | ||
| 67 | #define DES_version OSSL_DES_version | ||
| 68 | #define libdes_version OSSL_libdes_version | ||
| 69 | |||
| 70 | OPENSSL_EXTERN const char OSSL_DES_version[]; /* SSLeay version string */ | ||
| 71 | OPENSSL_EXTERN const char OSSL_libdes_version[]; /* old libdes version string */ | ||
diff --git a/src/lib/libcrypto/des/dess.cpp b/src/lib/libcrypto/des/dess.cpp new file mode 100644 index 0000000000..5549bab90a --- /dev/null +++ b/src/lib/libcrypto/des/dess.cpp | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/des.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | des_key_schedule key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | |||
| 44 | for (j=0; j<6; j++) | ||
| 45 | { | ||
| 46 | for (i=0; i<1000; i++) /**/ | ||
| 47 | { | ||
| 48 | des_encrypt1(&data[0],key,1); | ||
| 49 | GetTSC(s1); | ||
| 50 | des_encrypt1(&data[0],key,1); | ||
| 51 | des_encrypt1(&data[0],key,1); | ||
| 52 | des_encrypt1(&data[0],key,1); | ||
| 53 | GetTSC(e1); | ||
| 54 | GetTSC(s2); | ||
| 55 | des_encrypt1(&data[0],key,1); | ||
| 56 | des_encrypt1(&data[0],key,1); | ||
| 57 | des_encrypt1(&data[0],key,1); | ||
| 58 | des_encrypt1(&data[0],key,1); | ||
| 59 | GetTSC(e2); | ||
| 60 | des_encrypt1(&data[0],key,1); | ||
| 61 | } | ||
| 62 | |||
| 63 | printf("des %d %d (%d)\n", | ||
| 64 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
diff --git a/src/lib/libcrypto/des/destest.c b/src/lib/libcrypto/des/destest.c new file mode 100644 index 0000000000..64b92a34fe --- /dev/null +++ b/src/lib/libcrypto/des/destest.c | |||
| @@ -0,0 +1,952 @@ | |||
| 1 | /* crypto/des/destest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | |||
| 62 | #include <openssl/e_os2.h> | ||
| 63 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WINDOWS) | ||
| 64 | #ifndef OPENSSL_SYS_MSDOS | ||
| 65 | #define OPENSSL_SYS_MSDOS | ||
| 66 | #endif | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifndef OPENSSL_SYS_MSDOS | ||
| 70 | #if !defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VMS_DECC) | ||
| 71 | #include OPENSSL_UNISTD | ||
| 72 | #endif | ||
| 73 | #else | ||
| 74 | #include <io.h> | ||
| 75 | #endif | ||
| 76 | #include <string.h> | ||
| 77 | |||
| 78 | #ifdef OPENSSL_NO_DES | ||
| 79 | int main(int argc, char *argv[]) | ||
| 80 | { | ||
| 81 | printf("No DES support\n"); | ||
| 82 | return(0); | ||
| 83 | } | ||
| 84 | #else | ||
| 85 | #include <openssl/des.h> | ||
| 86 | |||
| 87 | #define crypt(c,s) (DES_crypt((c),(s))) | ||
| 88 | |||
| 89 | /* tisk tisk - the test keys don't all have odd parity :-( */ | ||
| 90 | /* test data */ | ||
| 91 | #define NUM_TESTS 34 | ||
| 92 | static unsigned char key_data[NUM_TESTS][8]={ | ||
| 93 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 94 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 95 | {0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 96 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 97 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 98 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 99 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 100 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}, | ||
| 101 | {0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57}, | ||
| 102 | {0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E}, | ||
| 103 | {0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86}, | ||
| 104 | {0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E}, | ||
| 105 | {0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6}, | ||
| 106 | {0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE}, | ||
| 107 | {0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6}, | ||
| 108 | {0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE}, | ||
| 109 | {0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16}, | ||
| 110 | {0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F}, | ||
| 111 | {0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46}, | ||
| 112 | {0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E}, | ||
| 113 | {0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76}, | ||
| 114 | {0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07}, | ||
| 115 | {0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F}, | ||
| 116 | {0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7}, | ||
| 117 | {0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF}, | ||
| 118 | {0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6}, | ||
| 119 | {0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF}, | ||
| 120 | {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, | ||
| 121 | {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E}, | ||
| 122 | {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, | ||
| 123 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 124 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 125 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 126 | {0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}}; | ||
| 127 | |||
| 128 | static unsigned char plain_data[NUM_TESTS][8]={ | ||
| 129 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 130 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 131 | {0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, | ||
| 132 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 133 | {0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11}, | ||
| 134 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 135 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 136 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 137 | {0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42}, | ||
| 138 | {0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA}, | ||
| 139 | {0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72}, | ||
| 140 | {0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A}, | ||
| 141 | {0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2}, | ||
| 142 | {0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A}, | ||
| 143 | {0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2}, | ||
| 144 | {0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A}, | ||
| 145 | {0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02}, | ||
| 146 | {0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A}, | ||
| 147 | {0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32}, | ||
| 148 | {0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA}, | ||
| 149 | {0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62}, | ||
| 150 | {0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2}, | ||
| 151 | {0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA}, | ||
| 152 | {0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92}, | ||
| 153 | {0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A}, | ||
| 154 | {0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2}, | ||
| 155 | {0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A}, | ||
| 156 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 157 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 158 | {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}, | ||
| 159 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 160 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 161 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 162 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}; | ||
| 163 | |||
| 164 | static unsigned char cipher_data[NUM_TESTS][8]={ | ||
| 165 | {0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7}, | ||
| 166 | {0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58}, | ||
| 167 | {0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B}, | ||
| 168 | {0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33}, | ||
| 169 | {0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D}, | ||
| 170 | {0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD}, | ||
| 171 | {0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7}, | ||
| 172 | {0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4}, | ||
| 173 | {0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B}, | ||
| 174 | {0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71}, | ||
| 175 | {0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A}, | ||
| 176 | {0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A}, | ||
| 177 | {0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95}, | ||
| 178 | {0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B}, | ||
| 179 | {0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09}, | ||
| 180 | {0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A}, | ||
| 181 | {0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F}, | ||
| 182 | {0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88}, | ||
| 183 | {0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77}, | ||
| 184 | {0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A}, | ||
| 185 | {0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56}, | ||
| 186 | {0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56}, | ||
| 187 | {0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56}, | ||
| 188 | {0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC}, | ||
| 189 | {0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A}, | ||
| 190 | {0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41}, | ||
| 191 | {0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93}, | ||
| 192 | {0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00}, | ||
| 193 | {0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06}, | ||
| 194 | {0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7}, | ||
| 195 | {0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51}, | ||
| 196 | {0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE}, | ||
| 197 | {0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D}, | ||
| 198 | {0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2}}; | ||
| 199 | |||
| 200 | static unsigned char cipher_ecb2[NUM_TESTS-1][8]={ | ||
| 201 | {0x92,0x95,0xB5,0x9B,0xB3,0x84,0x73,0x6E}, | ||
| 202 | {0x19,0x9E,0x9D,0x6D,0xF3,0x9A,0xA8,0x16}, | ||
| 203 | {0x2A,0x4B,0x4D,0x24,0x52,0x43,0x84,0x27}, | ||
| 204 | {0x35,0x84,0x3C,0x01,0x9D,0x18,0xC5,0xB6}, | ||
| 205 | {0x4A,0x5B,0x2F,0x42,0xAA,0x77,0x19,0x25}, | ||
| 206 | {0xA0,0x6B,0xA9,0xB8,0xCA,0x5B,0x17,0x8A}, | ||
| 207 | {0xAB,0x9D,0xB7,0xFB,0xED,0x95,0xF2,0x74}, | ||
| 208 | {0x3D,0x25,0x6C,0x23,0xA7,0x25,0x2F,0xD6}, | ||
| 209 | {0xB7,0x6F,0xAB,0x4F,0xBD,0xBD,0xB7,0x67}, | ||
| 210 | {0x8F,0x68,0x27,0xD6,0x9C,0xF4,0x1A,0x10}, | ||
| 211 | {0x82,0x57,0xA1,0xD6,0x50,0x5E,0x81,0x85}, | ||
| 212 | {0xA2,0x0F,0x0A,0xCD,0x80,0x89,0x7D,0xFA}, | ||
| 213 | {0xCD,0x2A,0x53,0x3A,0xDB,0x0D,0x7E,0xF3}, | ||
| 214 | {0xD2,0xC2,0xBE,0x27,0xE8,0x1B,0x68,0xE3}, | ||
| 215 | {0xE9,0x24,0xCF,0x4F,0x89,0x3C,0x5B,0x0A}, | ||
| 216 | {0xA7,0x18,0xC3,0x9F,0xFA,0x9F,0xD7,0x69}, | ||
| 217 | {0x77,0x2C,0x79,0xB1,0xD2,0x31,0x7E,0xB1}, | ||
| 218 | {0x49,0xAB,0x92,0x7F,0xD0,0x22,0x00,0xB7}, | ||
| 219 | {0xCE,0x1C,0x6C,0x7D,0x85,0xE3,0x4A,0x6F}, | ||
| 220 | {0xBE,0x91,0xD6,0xE1,0x27,0xB2,0xE9,0x87}, | ||
| 221 | {0x70,0x28,0xAE,0x8F,0xD1,0xF5,0x74,0x1A}, | ||
| 222 | {0xAA,0x37,0x80,0xBB,0xF3,0x22,0x1D,0xDE}, | ||
| 223 | {0xA6,0xC4,0xD2,0x5E,0x28,0x93,0xAC,0xB3}, | ||
| 224 | {0x22,0x07,0x81,0x5A,0xE4,0xB7,0x1A,0xAD}, | ||
| 225 | {0xDC,0xCE,0x05,0xE7,0x07,0xBD,0xF5,0x84}, | ||
| 226 | {0x26,0x1D,0x39,0x2C,0xB3,0xBA,0xA5,0x85}, | ||
| 227 | {0xB4,0xF7,0x0F,0x72,0xFB,0x04,0xF0,0xDC}, | ||
| 228 | {0x95,0xBA,0xA9,0x4E,0x87,0x36,0xF2,0x89}, | ||
| 229 | {0xD4,0x07,0x3A,0xF1,0x5A,0x17,0x82,0x0E}, | ||
| 230 | {0xEF,0x6F,0xAF,0xA7,0x66,0x1A,0x7E,0x89}, | ||
| 231 | {0xC1,0x97,0xF5,0x58,0x74,0x8A,0x20,0xE7}, | ||
| 232 | {0x43,0x34,0xCF,0xDA,0x22,0xC4,0x86,0xC8}, | ||
| 233 | {0x08,0xD7,0xB4,0xFB,0x62,0x9D,0x08,0x85}}; | ||
| 234 | |||
| 235 | static unsigned char cbc_key [8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; | ||
| 236 | static unsigned char cbc2_key[8]={0xf1,0xe0,0xd3,0xc2,0xb5,0xa4,0x97,0x86}; | ||
| 237 | static unsigned char cbc3_key[8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; | ||
| 238 | static unsigned char cbc_iv [8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; | ||
| 239 | /* Changed the following text constant to binary so it will work on ebcdic | ||
| 240 | * machines :-) */ | ||
| 241 | /* static char cbc_data[40]="7654321 Now is the time for \0001"; */ | ||
| 242 | static unsigned char cbc_data[40]={ | ||
| 243 | 0x37,0x36,0x35,0x34,0x33,0x32,0x31,0x20, | ||
| 244 | 0x4E,0x6F,0x77,0x20,0x69,0x73,0x20,0x74, | ||
| 245 | 0x68,0x65,0x20,0x74,0x69,0x6D,0x65,0x20, | ||
| 246 | 0x66,0x6F,0x72,0x20,0x00,0x31,0x00,0x00, | ||
| 247 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 248 | }; | ||
| 249 | |||
| 250 | static unsigned char cbc_ok[32]={ | ||
| 251 | 0xcc,0xd1,0x73,0xff,0xab,0x20,0x39,0xf4, | ||
| 252 | 0xac,0xd8,0xae,0xfd,0xdf,0xd8,0xa1,0xeb, | ||
| 253 | 0x46,0x8e,0x91,0x15,0x78,0x88,0xba,0x68, | ||
| 254 | 0x1d,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; | ||
| 255 | |||
| 256 | #ifdef SCREW_THE_PARITY | ||
| 257 | #error "SCREW_THE_PARITY is not ment to be defined." | ||
| 258 | #error "Original vectors are preserved for reference only." | ||
| 259 | static unsigned char cbc2_key[8]={0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87}; | ||
| 260 | static unsigned char xcbc_ok[32]={ | ||
| 261 | 0x86,0x74,0x81,0x0D,0x61,0xA4,0xA5,0x48, | ||
| 262 | 0xB9,0x93,0x03,0xE1,0xB8,0xBB,0xBD,0xBD, | ||
| 263 | 0x64,0x30,0x0B,0xB9,0x06,0x65,0x81,0x76, | ||
| 264 | 0x04,0x1D,0x77,0x62,0x17,0xCA,0x2B,0xD2, | ||
| 265 | }; | ||
| 266 | #else | ||
| 267 | static unsigned char xcbc_ok[32]={ | ||
| 268 | 0x84,0x6B,0x29,0x14,0x85,0x1E,0x9A,0x29, | ||
| 269 | 0x54,0x73,0x2F,0x8A,0xA0,0xA6,0x11,0xC1, | ||
| 270 | 0x15,0xCD,0xC2,0xD7,0x95,0x1B,0x10,0x53, | ||
| 271 | 0xA6,0x3C,0x5E,0x03,0xB2,0x1A,0xA3,0xC4, | ||
| 272 | }; | ||
| 273 | #endif | ||
| 274 | |||
| 275 | static unsigned char cbc3_ok[32]={ | ||
| 276 | 0x3F,0xE3,0x01,0xC9,0x62,0xAC,0x01,0xD0, | ||
| 277 | 0x22,0x13,0x76,0x3C,0x1C,0xBD,0x4C,0xDC, | ||
| 278 | 0x79,0x96,0x57,0xC0,0x64,0xEC,0xF5,0xD4, | ||
| 279 | 0x1C,0x67,0x38,0x12,0xCF,0xDE,0x96,0x75}; | ||
| 280 | |||
| 281 | static unsigned char pcbc_ok[32]={ | ||
| 282 | 0xcc,0xd1,0x73,0xff,0xab,0x20,0x39,0xf4, | ||
| 283 | 0x6d,0xec,0xb4,0x70,0xa0,0xe5,0x6b,0x15, | ||
| 284 | 0xae,0xa6,0xbf,0x61,0xed,0x7d,0x9c,0x9f, | ||
| 285 | 0xf7,0x17,0x46,0x3b,0x8a,0xb3,0xcc,0x88}; | ||
| 286 | |||
| 287 | static unsigned char cfb_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; | ||
| 288 | static unsigned char cfb_iv[8]={0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef}; | ||
| 289 | static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8]; | ||
| 290 | static unsigned char plain[24]= | ||
| 291 | { | ||
| 292 | 0x4e,0x6f,0x77,0x20,0x69,0x73, | ||
| 293 | 0x20,0x74,0x68,0x65,0x20,0x74, | ||
| 294 | 0x69,0x6d,0x65,0x20,0x66,0x6f, | ||
| 295 | 0x72,0x20,0x61,0x6c,0x6c,0x20 | ||
| 296 | }; | ||
| 297 | static unsigned char cfb_cipher8[24]= { | ||
| 298 | 0xf3,0x1f,0xda,0x07,0x01,0x14, 0x62,0xee,0x18,0x7f,0x43,0xd8, | ||
| 299 | 0x0a,0x7c,0xd9,0xb5,0xb0,0xd2, 0x90,0xda,0x6e,0x5b,0x9a,0x87 }; | ||
| 300 | static unsigned char cfb_cipher16[24]={ | ||
| 301 | 0xF3,0x09,0x87,0x87,0x7F,0x57, 0xF7,0x3C,0x36,0xB6,0xDB,0x70, | ||
| 302 | 0xD8,0xD5,0x34,0x19,0xD3,0x86, 0xB2,0x23,0xB7,0xB2,0xAD,0x1B }; | ||
| 303 | static unsigned char cfb_cipher32[24]={ | ||
| 304 | 0xF3,0x09,0x62,0x49,0xA4,0xDF, 0xA4,0x9F,0x33,0xDC,0x7B,0xAD, | ||
| 305 | 0x4C,0xC8,0x9F,0x64,0xE4,0x53, 0xE5,0xEC,0x67,0x20,0xDA,0xB6 }; | ||
| 306 | static unsigned char cfb_cipher48[24]={ | ||
| 307 | 0xF3,0x09,0x62,0x49,0xC7,0xF4, 0x30,0xB5,0x15,0xEC,0xBB,0x85, | ||
| 308 | 0x97,0x5A,0x13,0x8C,0x68,0x60, 0xE2,0x38,0x34,0x3C,0xDC,0x1F }; | ||
| 309 | static unsigned char cfb_cipher64[24]={ | ||
| 310 | 0xF3,0x09,0x62,0x49,0xC7,0xF4, 0x6E,0x51,0xA6,0x9E,0x83,0x9B, | ||
| 311 | 0x1A,0x92,0xF7,0x84,0x03,0x46, 0x71,0x33,0x89,0x8E,0xA6,0x22 }; | ||
| 312 | |||
| 313 | static unsigned char ofb_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; | ||
| 314 | static unsigned char ofb_iv[8]={0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef}; | ||
| 315 | static unsigned char ofb_buf1[24],ofb_buf2[24],ofb_tmp[8]; | ||
| 316 | static unsigned char ofb_cipher[24]= | ||
| 317 | { | ||
| 318 | 0xf3,0x09,0x62,0x49,0xc7,0xf4,0x6e,0x51, | ||
| 319 | 0x35,0xf2,0x4a,0x24,0x2e,0xeb,0x3d,0x3f, | ||
| 320 | 0x3d,0x6d,0x5b,0xe3,0x25,0x5a,0xf8,0xc3 | ||
| 321 | }; | ||
| 322 | |||
| 323 | #if 0 | ||
| 324 | static DES_LONG cbc_cksum_ret=0xB462FEF7L; | ||
| 325 | #else | ||
| 326 | static DES_LONG cbc_cksum_ret=0xF7FE62B4L; | ||
| 327 | #endif | ||
| 328 | static unsigned char cbc_cksum_data[8]={0x1D,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; | ||
| 329 | |||
| 330 | static char *pt(unsigned char *p); | ||
| 331 | static int cfb_test(int bits, unsigned char *cfb_cipher); | ||
| 332 | static int cfb64_test(unsigned char *cfb_cipher); | ||
| 333 | static int ede_cfb64_test(unsigned char *cfb_cipher); | ||
| 334 | int main(int argc, char *argv[]) | ||
| 335 | { | ||
| 336 | int j,err=0; | ||
| 337 | unsigned int i; | ||
| 338 | des_cblock in,out,outin,iv3,iv2; | ||
| 339 | des_key_schedule ks,ks2,ks3; | ||
| 340 | unsigned char cbc_in[40]; | ||
| 341 | unsigned char cbc_out[40]; | ||
| 342 | DES_LONG cs; | ||
| 343 | unsigned char cret[8]; | ||
| 344 | #ifdef _CRAY | ||
| 345 | struct { | ||
| 346 | int a:32; | ||
| 347 | int b:32; | ||
| 348 | } lqret[2]; | ||
| 349 | #else | ||
| 350 | DES_LONG lqret[4]; | ||
| 351 | #endif | ||
| 352 | int num; | ||
| 353 | char *str; | ||
| 354 | |||
| 355 | #ifndef OPENSSL_NO_DESCBCM | ||
| 356 | printf("Doing cbcm\n"); | ||
| 357 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) | ||
| 358 | { | ||
| 359 | printf("Key error %d\n",j); | ||
| 360 | err=1; | ||
| 361 | } | ||
| 362 | if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0) | ||
| 363 | { | ||
| 364 | printf("Key error %d\n",j); | ||
| 365 | err=1; | ||
| 366 | } | ||
| 367 | if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0) | ||
| 368 | { | ||
| 369 | printf("Key error %d\n",j); | ||
| 370 | err=1; | ||
| 371 | } | ||
| 372 | memset(cbc_out,0,40); | ||
| 373 | memset(cbc_in,0,40); | ||
| 374 | i=strlen((char *)cbc_data)+1; | ||
| 375 | /* i=((i+7)/8)*8; */ | ||
| 376 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 377 | memset(iv2,'\0',sizeof iv2); | ||
| 378 | |||
| 379 | DES_ede3_cbcm_encrypt(cbc_data,cbc_out,16L,&ks,&ks2,&ks3,&iv3,&iv2, | ||
| 380 | DES_ENCRYPT); | ||
| 381 | DES_ede3_cbcm_encrypt(&cbc_data[16],&cbc_out[16],i-16,&ks,&ks2,&ks3, | ||
| 382 | &iv3,&iv2,DES_ENCRYPT); | ||
| 383 | /* if (memcmp(cbc_out,cbc3_ok, | ||
| 384 | (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) | ||
| 385 | { | ||
| 386 | printf("des_ede3_cbc_encrypt encrypt error\n"); | ||
| 387 | err=1; | ||
| 388 | } | ||
| 389 | */ | ||
| 390 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 391 | memset(iv2,'\0',sizeof iv2); | ||
| 392 | DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT); | ||
| 393 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) | ||
| 394 | { | ||
| 395 | unsigned int n; | ||
| 396 | |||
| 397 | printf("des_ede3_cbcm_encrypt decrypt error\n"); | ||
| 398 | for(n=0 ; n < i ; ++n) | ||
| 399 | printf(" %02x",cbc_data[n]); | ||
| 400 | printf("\n"); | ||
| 401 | for(n=0 ; n < i ; ++n) | ||
| 402 | printf(" %02x",cbc_in[n]); | ||
| 403 | printf("\n"); | ||
| 404 | err=1; | ||
| 405 | } | ||
| 406 | #endif | ||
| 407 | |||
| 408 | printf("Doing ecb\n"); | ||
| 409 | for (i=0; i<NUM_TESTS; i++) | ||
| 410 | { | ||
| 411 | DES_set_key_unchecked(&key_data[i],&ks); | ||
| 412 | memcpy(in,plain_data[i],8); | ||
| 413 | memset(out,0,8); | ||
| 414 | memset(outin,0,8); | ||
| 415 | des_ecb_encrypt(&in,&out,ks,DES_ENCRYPT); | ||
| 416 | des_ecb_encrypt(&out,&outin,ks,DES_DECRYPT); | ||
| 417 | |||
| 418 | if (memcmp(out,cipher_data[i],8) != 0) | ||
| 419 | { | ||
| 420 | printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n", | ||
| 421 | i+1,pt(key_data[i]),pt(in),pt(cipher_data[i]), | ||
| 422 | pt(out)); | ||
| 423 | err=1; | ||
| 424 | } | ||
| 425 | if (memcmp(in,outin,8) != 0) | ||
| 426 | { | ||
| 427 | printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n", | ||
| 428 | i+1,pt(key_data[i]),pt(out),pt(in),pt(outin)); | ||
| 429 | err=1; | ||
| 430 | } | ||
| 431 | } | ||
| 432 | |||
| 433 | #ifndef LIBDES_LIT | ||
| 434 | printf("Doing ede ecb\n"); | ||
| 435 | for (i=0; i<(NUM_TESTS-2); i++) | ||
| 436 | { | ||
| 437 | DES_set_key_unchecked(&key_data[i],&ks); | ||
| 438 | DES_set_key_unchecked(&key_data[i+1],&ks2); | ||
| 439 | DES_set_key_unchecked(&key_data[i+2],&ks3); | ||
| 440 | memcpy(in,plain_data[i],8); | ||
| 441 | memset(out,0,8); | ||
| 442 | memset(outin,0,8); | ||
| 443 | des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT); | ||
| 444 | des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT); | ||
| 445 | |||
| 446 | if (memcmp(out,cipher_ecb2[i],8) != 0) | ||
| 447 | { | ||
| 448 | printf("Encryption error %2d\nk=%s p=%s o=%s act=%s\n", | ||
| 449 | i+1,pt(key_data[i]),pt(in),pt(cipher_ecb2[i]), | ||
| 450 | pt(out)); | ||
| 451 | err=1; | ||
| 452 | } | ||
| 453 | if (memcmp(in,outin,8) != 0) | ||
| 454 | { | ||
| 455 | printf("Decryption error %2d\nk=%s p=%s o=%s act=%s\n", | ||
| 456 | i+1,pt(key_data[i]),pt(out),pt(in),pt(outin)); | ||
| 457 | err=1; | ||
| 458 | } | ||
| 459 | } | ||
| 460 | #endif | ||
| 461 | |||
| 462 | printf("Doing cbc\n"); | ||
| 463 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) | ||
| 464 | { | ||
| 465 | printf("Key error %d\n",j); | ||
| 466 | err=1; | ||
| 467 | } | ||
| 468 | memset(cbc_out,0,40); | ||
| 469 | memset(cbc_in,0,40); | ||
| 470 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 471 | des_ncbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks, | ||
| 472 | &iv3,DES_ENCRYPT); | ||
| 473 | if (memcmp(cbc_out,cbc_ok,32) != 0) | ||
| 474 | { | ||
| 475 | printf("cbc_encrypt encrypt error\n"); | ||
| 476 | err=1; | ||
| 477 | } | ||
| 478 | |||
| 479 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 480 | des_ncbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks, | ||
| 481 | &iv3,DES_DECRYPT); | ||
| 482 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)) != 0) | ||
| 483 | { | ||
| 484 | printf("cbc_encrypt decrypt error\n"); | ||
| 485 | err=1; | ||
| 486 | } | ||
| 487 | |||
| 488 | #ifndef LIBDES_LIT | ||
| 489 | printf("Doing desx cbc\n"); | ||
| 490 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) | ||
| 491 | { | ||
| 492 | printf("Key error %d\n",j); | ||
| 493 | err=1; | ||
| 494 | } | ||
| 495 | memset(cbc_out,0,40); | ||
| 496 | memset(cbc_in,0,40); | ||
| 497 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 498 | des_xcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks, | ||
| 499 | &iv3,&cbc2_key,&cbc3_key, DES_ENCRYPT); | ||
| 500 | if (memcmp(cbc_out,xcbc_ok,32) != 0) | ||
| 501 | { | ||
| 502 | printf("des_xcbc_encrypt encrypt error\n"); | ||
| 503 | err=1; | ||
| 504 | } | ||
| 505 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 506 | des_xcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks, | ||
| 507 | &iv3,&cbc2_key,&cbc3_key, DES_DECRYPT); | ||
| 508 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) | ||
| 509 | { | ||
| 510 | printf("des_xcbc_encrypt decrypt error\n"); | ||
| 511 | err=1; | ||
| 512 | } | ||
| 513 | #endif | ||
| 514 | |||
| 515 | printf("Doing ede cbc\n"); | ||
| 516 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) | ||
| 517 | { | ||
| 518 | printf("Key error %d\n",j); | ||
| 519 | err=1; | ||
| 520 | } | ||
| 521 | if ((j=DES_set_key_checked(&cbc2_key,&ks2)) != 0) | ||
| 522 | { | ||
| 523 | printf("Key error %d\n",j); | ||
| 524 | err=1; | ||
| 525 | } | ||
| 526 | if ((j=DES_set_key_checked(&cbc3_key,&ks3)) != 0) | ||
| 527 | { | ||
| 528 | printf("Key error %d\n",j); | ||
| 529 | err=1; | ||
| 530 | } | ||
| 531 | memset(cbc_out,0,40); | ||
| 532 | memset(cbc_in,0,40); | ||
| 533 | i=strlen((char *)cbc_data)+1; | ||
| 534 | /* i=((i+7)/8)*8; */ | ||
| 535 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 536 | |||
| 537 | des_ede3_cbc_encrypt(cbc_data,cbc_out,16L,ks,ks2,ks3,&iv3, | ||
| 538 | DES_ENCRYPT); | ||
| 539 | des_ede3_cbc_encrypt(&(cbc_data[16]),&(cbc_out[16]),i-16,ks,ks2,ks3, | ||
| 540 | &iv3,DES_ENCRYPT); | ||
| 541 | if (memcmp(cbc_out,cbc3_ok, | ||
| 542 | (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0) | ||
| 543 | { | ||
| 544 | unsigned int n; | ||
| 545 | |||
| 546 | printf("des_ede3_cbc_encrypt encrypt error\n"); | ||
| 547 | for(n=0 ; n < i ; ++n) | ||
| 548 | printf(" %02x",cbc_out[n]); | ||
| 549 | printf("\n"); | ||
| 550 | for(n=0 ; n < i ; ++n) | ||
| 551 | printf(" %02x",cbc3_ok[n]); | ||
| 552 | printf("\n"); | ||
| 553 | err=1; | ||
| 554 | } | ||
| 555 | |||
| 556 | memcpy(iv3,cbc_iv,sizeof(cbc_iv)); | ||
| 557 | des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT); | ||
| 558 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) | ||
| 559 | { | ||
| 560 | unsigned int n; | ||
| 561 | |||
| 562 | printf("des_ede3_cbc_encrypt decrypt error\n"); | ||
| 563 | for(n=0 ; n < i ; ++n) | ||
| 564 | printf(" %02x",cbc_data[n]); | ||
| 565 | printf("\n"); | ||
| 566 | for(n=0 ; n < i ; ++n) | ||
| 567 | printf(" %02x",cbc_in[n]); | ||
| 568 | printf("\n"); | ||
| 569 | err=1; | ||
| 570 | } | ||
| 571 | |||
| 572 | #ifndef LIBDES_LIT | ||
| 573 | printf("Doing pcbc\n"); | ||
| 574 | if ((j=DES_set_key_checked(&cbc_key,&ks)) != 0) | ||
| 575 | { | ||
| 576 | printf("Key error %d\n",j); | ||
| 577 | err=1; | ||
| 578 | } | ||
| 579 | memset(cbc_out,0,40); | ||
| 580 | memset(cbc_in,0,40); | ||
| 581 | des_pcbc_encrypt(cbc_data,cbc_out,strlen((char *)cbc_data)+1,ks, | ||
| 582 | &cbc_iv,DES_ENCRYPT); | ||
| 583 | if (memcmp(cbc_out,pcbc_ok,32) != 0) | ||
| 584 | { | ||
| 585 | printf("pcbc_encrypt encrypt error\n"); | ||
| 586 | err=1; | ||
| 587 | } | ||
| 588 | des_pcbc_encrypt(cbc_out,cbc_in,strlen((char *)cbc_data)+1,ks,&cbc_iv, | ||
| 589 | DES_DECRYPT); | ||
| 590 | if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0) | ||
| 591 | { | ||
| 592 | printf("pcbc_encrypt decrypt error\n"); | ||
| 593 | err=1; | ||
| 594 | } | ||
| 595 | |||
| 596 | printf("Doing "); | ||
| 597 | printf("cfb8 "); | ||
| 598 | err+=cfb_test(8,cfb_cipher8); | ||
| 599 | printf("cfb16 "); | ||
| 600 | err+=cfb_test(16,cfb_cipher16); | ||
| 601 | printf("cfb32 "); | ||
| 602 | err+=cfb_test(32,cfb_cipher32); | ||
| 603 | printf("cfb48 "); | ||
| 604 | err+=cfb_test(48,cfb_cipher48); | ||
| 605 | printf("cfb64 "); | ||
| 606 | err+=cfb_test(64,cfb_cipher64); | ||
| 607 | |||
| 608 | printf("cfb64() "); | ||
| 609 | err+=cfb64_test(cfb_cipher64); | ||
| 610 | |||
| 611 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 612 | for (i=0; i<sizeof(plain); i++) | ||
| 613 | des_cfb_encrypt(&(plain[i]),&(cfb_buf1[i]), | ||
| 614 | 8,1,ks,&cfb_tmp,DES_ENCRYPT); | ||
| 615 | if (memcmp(cfb_cipher8,cfb_buf1,sizeof(plain)) != 0) | ||
| 616 | { | ||
| 617 | printf("cfb_encrypt small encrypt error\n"); | ||
| 618 | err=1; | ||
| 619 | } | ||
| 620 | |||
| 621 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 622 | for (i=0; i<sizeof(plain); i++) | ||
| 623 | des_cfb_encrypt(&(cfb_buf1[i]),&(cfb_buf2[i]), | ||
| 624 | 8,1,ks,&cfb_tmp,DES_DECRYPT); | ||
| 625 | if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) | ||
| 626 | { | ||
| 627 | printf("cfb_encrypt small decrypt error\n"); | ||
| 628 | err=1; | ||
| 629 | } | ||
| 630 | |||
| 631 | printf("ede_cfb64() "); | ||
| 632 | err+=ede_cfb64_test(cfb_cipher64); | ||
| 633 | |||
| 634 | printf("done\n"); | ||
| 635 | |||
| 636 | printf("Doing ofb\n"); | ||
| 637 | DES_set_key_checked(&ofb_key,&ks); | ||
| 638 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | ||
| 639 | des_ofb_encrypt(plain,ofb_buf1,64,sizeof(plain)/8,ks,&ofb_tmp); | ||
| 640 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) | ||
| 641 | { | ||
| 642 | printf("ofb_encrypt encrypt error\n"); | ||
| 643 | printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", | ||
| 644 | ofb_buf1[8+0], ofb_buf1[8+1], ofb_buf1[8+2], ofb_buf1[8+3], | ||
| 645 | ofb_buf1[8+4], ofb_buf1[8+5], ofb_buf1[8+6], ofb_buf1[8+7]); | ||
| 646 | printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", | ||
| 647 | ofb_buf1[8+0], ofb_cipher[8+1], ofb_cipher[8+2], ofb_cipher[8+3], | ||
| 648 | ofb_buf1[8+4], ofb_cipher[8+5], ofb_cipher[8+6], ofb_cipher[8+7]); | ||
| 649 | err=1; | ||
| 650 | } | ||
| 651 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | ||
| 652 | des_ofb_encrypt(ofb_buf1,ofb_buf2,64,sizeof(ofb_buf1)/8,ks,&ofb_tmp); | ||
| 653 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) | ||
| 654 | { | ||
| 655 | printf("ofb_encrypt decrypt error\n"); | ||
| 656 | printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", | ||
| 657 | ofb_buf2[8+0], ofb_buf2[8+1], ofb_buf2[8+2], ofb_buf2[8+3], | ||
| 658 | ofb_buf2[8+4], ofb_buf2[8+5], ofb_buf2[8+6], ofb_buf2[8+7]); | ||
| 659 | printf("%02X %02X %02X %02X %02X %02X %02X %02X\n", | ||
| 660 | plain[8+0], plain[8+1], plain[8+2], plain[8+3], | ||
| 661 | plain[8+4], plain[8+5], plain[8+6], plain[8+7]); | ||
| 662 | err=1; | ||
| 663 | } | ||
| 664 | |||
| 665 | printf("Doing ofb64\n"); | ||
| 666 | DES_set_key_checked(&ofb_key,&ks); | ||
| 667 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | ||
| 668 | memset(ofb_buf1,0,sizeof(ofb_buf1)); | ||
| 669 | memset(ofb_buf2,0,sizeof(ofb_buf1)); | ||
| 670 | num=0; | ||
| 671 | for (i=0; i<sizeof(plain); i++) | ||
| 672 | { | ||
| 673 | des_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,&ofb_tmp, | ||
| 674 | &num); | ||
| 675 | } | ||
| 676 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) | ||
| 677 | { | ||
| 678 | printf("ofb64_encrypt encrypt error\n"); | ||
| 679 | err=1; | ||
| 680 | } | ||
| 681 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | ||
| 682 | num=0; | ||
| 683 | des_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,&ofb_tmp, | ||
| 684 | &num); | ||
| 685 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) | ||
| 686 | { | ||
| 687 | printf("ofb64_encrypt decrypt error\n"); | ||
| 688 | err=1; | ||
| 689 | } | ||
| 690 | |||
| 691 | printf("Doing ede_ofb64\n"); | ||
| 692 | DES_set_key_checked(&ofb_key,&ks); | ||
| 693 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | ||
| 694 | memset(ofb_buf1,0,sizeof(ofb_buf1)); | ||
| 695 | memset(ofb_buf2,0,sizeof(ofb_buf1)); | ||
| 696 | num=0; | ||
| 697 | for (i=0; i<sizeof(plain); i++) | ||
| 698 | { | ||
| 699 | des_ede3_ofb64_encrypt(&(plain[i]),&(ofb_buf1[i]),1,ks,ks, | ||
| 700 | ks,&ofb_tmp,&num); | ||
| 701 | } | ||
| 702 | if (memcmp(ofb_cipher,ofb_buf1,sizeof(ofb_buf1)) != 0) | ||
| 703 | { | ||
| 704 | printf("ede_ofb64_encrypt encrypt error\n"); | ||
| 705 | err=1; | ||
| 706 | } | ||
| 707 | memcpy(ofb_tmp,ofb_iv,sizeof(ofb_iv)); | ||
| 708 | num=0; | ||
| 709 | des_ede3_ofb64_encrypt(ofb_buf1,ofb_buf2,sizeof(ofb_buf1),ks,ks,ks, | ||
| 710 | &ofb_tmp,&num); | ||
| 711 | if (memcmp(plain,ofb_buf2,sizeof(ofb_buf2)) != 0) | ||
| 712 | { | ||
| 713 | printf("ede_ofb64_encrypt decrypt error\n"); | ||
| 714 | err=1; | ||
| 715 | } | ||
| 716 | |||
| 717 | printf("Doing cbc_cksum\n"); | ||
| 718 | DES_set_key_checked(&cbc_key,&ks); | ||
| 719 | cs=des_cbc_cksum(cbc_data,&cret,strlen((char *)cbc_data),ks,&cbc_iv); | ||
| 720 | if (cs != cbc_cksum_ret) | ||
| 721 | { | ||
| 722 | printf("bad return value (%08lX), should be %08lX\n", | ||
| 723 | (unsigned long)cs,(unsigned long)cbc_cksum_ret); | ||
| 724 | err=1; | ||
| 725 | } | ||
| 726 | if (memcmp(cret,cbc_cksum_data,8) != 0) | ||
| 727 | { | ||
| 728 | printf("bad cbc_cksum block returned\n"); | ||
| 729 | err=1; | ||
| 730 | } | ||
| 731 | |||
| 732 | printf("Doing quad_cksum\n"); | ||
| 733 | cs=des_quad_cksum(cbc_data,(des_cblock *)lqret, | ||
| 734 | (long)strlen((char *)cbc_data),2,(des_cblock *)cbc_iv); | ||
| 735 | if (cs != 0x70d7a63aL) | ||
| 736 | { | ||
| 737 | printf("quad_cksum error, ret %08lx should be 70d7a63a\n", | ||
| 738 | (unsigned long)cs); | ||
| 739 | err=1; | ||
| 740 | } | ||
| 741 | #ifdef _CRAY | ||
| 742 | if (lqret[0].a != 0x327eba8dL) | ||
| 743 | { | ||
| 744 | printf("quad_cksum error, out[0] %08lx is not %08lx\n", | ||
| 745 | (unsigned long)lqret[0].a,0x327eba8dUL); | ||
| 746 | err=1; | ||
| 747 | } | ||
| 748 | if (lqret[0].b != 0x201a49ccL) | ||
| 749 | { | ||
| 750 | printf("quad_cksum error, out[1] %08lx is not %08lx\n", | ||
| 751 | (unsigned long)lqret[0].b,0x201a49ccUL); | ||
| 752 | err=1; | ||
| 753 | } | ||
| 754 | if (lqret[1].a != 0x70d7a63aL) | ||
| 755 | { | ||
| 756 | printf("quad_cksum error, out[2] %08lx is not %08lx\n", | ||
| 757 | (unsigned long)lqret[1].a,0x70d7a63aUL); | ||
| 758 | err=1; | ||
| 759 | } | ||
| 760 | if (lqret[1].b != 0x501c2c26L) | ||
| 761 | { | ||
| 762 | printf("quad_cksum error, out[3] %08lx is not %08lx\n", | ||
| 763 | (unsigned long)lqret[1].b,0x501c2c26UL); | ||
| 764 | err=1; | ||
| 765 | } | ||
| 766 | #else | ||
| 767 | if (lqret[0] != 0x327eba8dL) | ||
| 768 | { | ||
| 769 | printf("quad_cksum error, out[0] %08lx is not %08lx\n", | ||
| 770 | (unsigned long)lqret[0],0x327eba8dUL); | ||
| 771 | err=1; | ||
| 772 | } | ||
| 773 | if (lqret[1] != 0x201a49ccL) | ||
| 774 | { | ||
| 775 | printf("quad_cksum error, out[1] %08lx is not %08lx\n", | ||
| 776 | (unsigned long)lqret[1],0x201a49ccUL); | ||
| 777 | err=1; | ||
| 778 | } | ||
| 779 | if (lqret[2] != 0x70d7a63aL) | ||
| 780 | { | ||
| 781 | printf("quad_cksum error, out[2] %08lx is not %08lx\n", | ||
| 782 | (unsigned long)lqret[2],0x70d7a63aUL); | ||
| 783 | err=1; | ||
| 784 | } | ||
| 785 | if (lqret[3] != 0x501c2c26L) | ||
| 786 | { | ||
| 787 | printf("quad_cksum error, out[3] %08lx is not %08lx\n", | ||
| 788 | (unsigned long)lqret[3],0x501c2c26UL); | ||
| 789 | err=1; | ||
| 790 | } | ||
| 791 | #endif | ||
| 792 | #endif | ||
| 793 | |||
| 794 | printf("input word alignment test"); | ||
| 795 | for (i=0; i<4; i++) | ||
| 796 | { | ||
| 797 | printf(" %d",i); | ||
| 798 | des_ncbc_encrypt(&(cbc_out[i]),cbc_in, | ||
| 799 | strlen((char *)cbc_data)+1,ks, | ||
| 800 | &cbc_iv,DES_ENCRYPT); | ||
| 801 | } | ||
| 802 | printf("\noutput word alignment test"); | ||
| 803 | for (i=0; i<4; i++) | ||
| 804 | { | ||
| 805 | printf(" %d",i); | ||
| 806 | des_ncbc_encrypt(cbc_out,&(cbc_in[i]), | ||
| 807 | strlen((char *)cbc_data)+1,ks, | ||
| 808 | &cbc_iv,DES_ENCRYPT); | ||
| 809 | } | ||
| 810 | printf("\n"); | ||
| 811 | printf("fast crypt test "); | ||
| 812 | str=crypt("testing","ef"); | ||
| 813 | if (strcmp("efGnQx2725bI2",str) != 0) | ||
| 814 | { | ||
| 815 | printf("fast crypt error, %s should be efGnQx2725bI2\n",str); | ||
| 816 | err=1; | ||
| 817 | } | ||
| 818 | str=crypt("bca76;23","yA"); | ||
| 819 | if (strcmp("yA1Rp/1hZXIJk",str) != 0) | ||
| 820 | { | ||
| 821 | printf("fast crypt error, %s should be yA1Rp/1hZXIJk\n",str); | ||
| 822 | err=1; | ||
| 823 | } | ||
| 824 | #ifdef OPENSSL_SYS_NETWARE | ||
| 825 | if (err) printf("ERROR: %d\n", err); | ||
| 826 | #endif | ||
| 827 | printf("\n"); | ||
| 828 | return(err); | ||
| 829 | } | ||
| 830 | |||
| 831 | static char *pt(unsigned char *p) | ||
| 832 | { | ||
| 833 | static char bufs[10][20]; | ||
| 834 | static int bnum=0; | ||
| 835 | char *ret; | ||
| 836 | int i; | ||
| 837 | static char *f="0123456789ABCDEF"; | ||
| 838 | |||
| 839 | ret= &(bufs[bnum++][0]); | ||
| 840 | bnum%=10; | ||
| 841 | for (i=0; i<8; i++) | ||
| 842 | { | ||
| 843 | ret[i*2]=f[(p[i]>>4)&0xf]; | ||
| 844 | ret[i*2+1]=f[p[i]&0xf]; | ||
| 845 | } | ||
| 846 | ret[16]='\0'; | ||
| 847 | return(ret); | ||
| 848 | } | ||
| 849 | |||
| 850 | #ifndef LIBDES_LIT | ||
| 851 | |||
| 852 | static int cfb_test(int bits, unsigned char *cfb_cipher) | ||
| 853 | { | ||
| 854 | des_key_schedule ks; | ||
| 855 | int i,err=0; | ||
| 856 | |||
| 857 | DES_set_key_checked(&cfb_key,&ks); | ||
| 858 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 859 | des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,&cfb_tmp, | ||
| 860 | DES_ENCRYPT); | ||
| 861 | if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0) | ||
| 862 | { | ||
| 863 | err=1; | ||
| 864 | printf("cfb_encrypt encrypt error\n"); | ||
| 865 | for (i=0; i<24; i+=8) | ||
| 866 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 867 | } | ||
| 868 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 869 | des_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),ks,&cfb_tmp, | ||
| 870 | DES_DECRYPT); | ||
| 871 | if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) | ||
| 872 | { | ||
| 873 | err=1; | ||
| 874 | printf("cfb_encrypt decrypt error\n"); | ||
| 875 | for (i=0; i<24; i+=8) | ||
| 876 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 877 | } | ||
| 878 | return(err); | ||
| 879 | } | ||
| 880 | |||
| 881 | static int cfb64_test(unsigned char *cfb_cipher) | ||
| 882 | { | ||
| 883 | des_key_schedule ks; | ||
| 884 | int err=0,i,n; | ||
| 885 | |||
| 886 | DES_set_key_checked(&cfb_key,&ks); | ||
| 887 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 888 | n=0; | ||
| 889 | des_cfb64_encrypt(plain,cfb_buf1,12,ks,&cfb_tmp,&n,DES_ENCRYPT); | ||
| 890 | des_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]),sizeof(plain)-12,ks, | ||
| 891 | &cfb_tmp,&n,DES_ENCRYPT); | ||
| 892 | if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0) | ||
| 893 | { | ||
| 894 | err=1; | ||
| 895 | printf("cfb_encrypt encrypt error\n"); | ||
| 896 | for (i=0; i<24; i+=8) | ||
| 897 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 898 | } | ||
| 899 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 900 | n=0; | ||
| 901 | des_cfb64_encrypt(cfb_buf1,cfb_buf2,17,ks,&cfb_tmp,&n,DES_DECRYPT); | ||
| 902 | des_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), | ||
| 903 | sizeof(plain)-17,ks,&cfb_tmp,&n,DES_DECRYPT); | ||
| 904 | if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) | ||
| 905 | { | ||
| 906 | err=1; | ||
| 907 | printf("cfb_encrypt decrypt error\n"); | ||
| 908 | for (i=0; i<24; i+=8) | ||
| 909 | printf("%s\n",pt(&(cfb_buf2[i]))); | ||
| 910 | } | ||
| 911 | return(err); | ||
| 912 | } | ||
| 913 | |||
| 914 | static int ede_cfb64_test(unsigned char *cfb_cipher) | ||
| 915 | { | ||
| 916 | des_key_schedule ks; | ||
| 917 | int err=0,i,n; | ||
| 918 | |||
| 919 | DES_set_key_checked(&cfb_key,&ks); | ||
| 920 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 921 | n=0; | ||
| 922 | des_ede3_cfb64_encrypt(plain,cfb_buf1,12,ks,ks,ks,&cfb_tmp,&n, | ||
| 923 | DES_ENCRYPT); | ||
| 924 | des_ede3_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]), | ||
| 925 | sizeof(plain)-12,ks,ks,ks, | ||
| 926 | &cfb_tmp,&n,DES_ENCRYPT); | ||
| 927 | if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0) | ||
| 928 | { | ||
| 929 | err=1; | ||
| 930 | printf("ede_cfb_encrypt encrypt error\n"); | ||
| 931 | for (i=0; i<24; i+=8) | ||
| 932 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 933 | } | ||
| 934 | memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv)); | ||
| 935 | n=0; | ||
| 936 | des_ede3_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,ks,ks,ks, | ||
| 937 | &cfb_tmp,&n,DES_DECRYPT); | ||
| 938 | des_ede3_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), | ||
| 939 | sizeof(plain)-17,ks,ks,ks, | ||
| 940 | &cfb_tmp,&n,DES_DECRYPT); | ||
| 941 | if (memcmp(plain,cfb_buf2,sizeof(plain)) != 0) | ||
| 942 | { | ||
| 943 | err=1; | ||
| 944 | printf("ede_cfb_encrypt decrypt error\n"); | ||
| 945 | for (i=0; i<24; i+=8) | ||
| 946 | printf("%s\n",pt(&(cfb_buf2[i]))); | ||
| 947 | } | ||
| 948 | return(err); | ||
| 949 | } | ||
| 950 | |||
| 951 | #endif | ||
| 952 | #endif | ||
diff --git a/src/lib/libcrypto/des/fcrypt_b.c b/src/lib/libcrypto/des/fcrypt_b.c index 8822816938..87fc71eb26 100644 --- a/src/lib/libcrypto/des/fcrypt_b.c +++ b/src/lib/libcrypto/des/fcrypt_b.c | |||
| @@ -68,6 +68,8 @@ | |||
| 68 | #include "des_locl.h" | 68 | #include "des_locl.h" |
| 69 | #undef DES_FCRYPT | 69 | #undef DES_FCRYPT |
| 70 | 70 | ||
| 71 | #ifndef OPENBSD_DES_ASM | ||
| 72 | |||
| 71 | #undef PERM_OP | 73 | #undef PERM_OP |
| 72 | #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ | 74 | #define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ |
| 73 | (b)^=(t),\ | 75 | (b)^=(t),\ |
| @@ -141,3 +143,4 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0, | |||
| 141 | out[1]=l; | 143 | out[1]=l; |
| 142 | } | 144 | } |
| 143 | 145 | ||
| 146 | #endif /* OPENBSD_DES_ASM */ | ||
diff --git a/src/lib/libcrypto/des/makefile.bc b/src/lib/libcrypto/des/makefile.bc new file mode 100644 index 0000000000..1fe6d4915a --- /dev/null +++ b/src/lib/libcrypto/des/makefile.bc | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | # | ||
| 2 | # Origional BC Makefile from Teun <Teun.Nijssen@kub.nl> | ||
| 3 | # | ||
| 4 | # | ||
| 5 | CC = bcc | ||
| 6 | TLIB = tlib /0 /C | ||
| 7 | # note: the -3 flag produces code for 386, 486, Pentium etc; omit it for 286s | ||
| 8 | OPTIMIZE= -3 -O2 | ||
| 9 | #WINDOWS= -W | ||
| 10 | CFLAGS = -c -ml -d $(OPTIMIZE) $(WINDOWS) -DMSDOS | ||
| 11 | LFLAGS = -ml $(WINDOWS) | ||
| 12 | |||
| 13 | .c.obj: | ||
| 14 | $(CC) $(CFLAGS) $*.c | ||
| 15 | |||
| 16 | .obj.exe: | ||
| 17 | $(CC) $(LFLAGS) -e$*.exe $*.obj libdes.lib | ||
| 18 | |||
| 19 | all: $(LIB) destest.exe rpw.exe des.exe speed.exe | ||
| 20 | |||
| 21 | # "make clean": use a directory containing only libdes .exe and .obj files... | ||
| 22 | clean: | ||
| 23 | del *.exe | ||
| 24 | del *.obj | ||
| 25 | del libdes.lib | ||
| 26 | del libdes.rsp | ||
| 27 | |||
| 28 | OBJS= cbc_cksm.obj cbc_enc.obj ecb_enc.obj pcbc_enc.obj \ | ||
| 29 | qud_cksm.obj rand_key.obj set_key.obj str2key.obj \ | ||
| 30 | enc_read.obj enc_writ.obj fcrypt.obj cfb_enc.obj \ | ||
| 31 | ecb3_enc.obj ofb_enc.obj cbc3_enc.obj read_pwd.obj\ | ||
| 32 | cfb64enc.obj ofb64enc.obj ede_enc.obj cfb64ede.obj\ | ||
| 33 | ofb64ede.obj supp.obj | ||
| 34 | |||
| 35 | LIB= libdes.lib | ||
| 36 | |||
| 37 | $(LIB): $(OBJS) | ||
| 38 | del $(LIB) | ||
| 39 | makersp "+%s &\n" &&| | ||
| 40 | $(OBJS) | ||
| 41 | | >libdes.rsp | ||
| 42 | $(TLIB) libdes.lib @libdes.rsp,nul | ||
| 43 | del libdes.rsp | ||
| 44 | |||
| 45 | destest.exe: destest.obj libdes.lib | ||
| 46 | rpw.exe: rpw.obj libdes.lib | ||
| 47 | speed.exe: speed.obj libdes.lib | ||
| 48 | des.exe: des.obj libdes.lib | ||
| 49 | |||
| 50 | |||
diff --git a/src/lib/libcrypto/des/options.txt b/src/lib/libcrypto/des/options.txt new file mode 100644 index 0000000000..6e2b50f765 --- /dev/null +++ b/src/lib/libcrypto/des/options.txt | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | Note that the UNROLL option makes the 'inner' des loop unroll all 16 rounds | ||
| 2 | instead of the default 4. | ||
| 3 | RISC1 and RISC2 are 2 alternatives for the inner loop and | ||
| 4 | PTR means to use pointers arithmatic instead of arrays. | ||
| 5 | |||
| 6 | FreeBSD - Pentium Pro 200mhz - gcc 2.7.2.2 - assembler 577,000 4620k/s | ||
| 7 | IRIX 6.2 - R10000 195mhz - cc (-O3 -n32) - UNROLL RISC2 PTR 496,000 3968k/s | ||
| 8 | solaris 2.5.1 usparc 167mhz?? - SC4.0 - UNROLL RISC1 PTR [1] 459,400 3672k/s | ||
| 9 | FreeBSD - Pentium Pro 200mhz - gcc 2.7.2.2 - UNROLL RISC1 433,000 3468k/s | ||
| 10 | solaris 2.5.1 usparc 167mhz?? - gcc 2.7.2 - UNROLL 380,000 3041k/s | ||
| 11 | linux - pentium 100mhz - gcc 2.7.0 - assembler 281,000 2250k/s | ||
| 12 | NT 4.0 - pentium 100mhz - VC 4.2 - assembler 281,000 2250k/s | ||
| 13 | AIX 4.1? - PPC604 100mhz - cc - UNROLL 275,000 2200k/s | ||
| 14 | IRIX 5.3 - R4400 200mhz - gcc 2.6.3 - UNROLL RISC2 PTR 235,300 1882k/s | ||
| 15 | IRIX 5.3 - R4400 200mhz - cc - UNROLL RISC2 PTR 233,700 1869k/s | ||
| 16 | NT 4.0 - pentium 100mhz - VC 4.2 - UNROLL RISC1 PTR 191,000 1528k/s | ||
| 17 | DEC Alpha 165mhz?? - cc - RISC2 PTR [2] 181,000 1448k/s | ||
| 18 | linux - pentium 100mhz - gcc 2.7.0 - UNROLL RISC1 PTR 158,500 1268k/s | ||
| 19 | HPUX 10 - 9000/887 - cc - UNROLL [3] 148,000 1190k/s | ||
| 20 | solaris 2.5.1 - sparc 10 50mhz - gcc 2.7.2 - UNROLL 123,600 989k/s | ||
| 21 | IRIX 5.3 - R4000 100mhz - cc - UNROLL RISC2 PTR 101,000 808k/s | ||
| 22 | DGUX - 88100 50mhz(?) - gcc 2.6.3 - UNROLL 81,000 648k/s | ||
| 23 | solaris 2.4 486 50mhz - gcc 2.6.3 - assembler 65,000 522k/s | ||
| 24 | HPUX 10 - 9000/887 - k&r cc (default compiler) - UNROLL PTR 76,000 608k/s | ||
| 25 | solaris 2.4 486 50mhz - gcc 2.6.3 - UNROLL RISC2 43,500 344k/s | ||
| 26 | AIX - old slow one :-) - cc - 39,000 312k/s | ||
| 27 | |||
| 28 | Notes. | ||
| 29 | [1] For the ultra sparc, SunC 4.0 | ||
| 30 | cc -xtarget=ultra -xarch=v8plus -Xa -xO5, running 'des_opts' | ||
| 31 | gives a speed of 344,000 des/s while 'speed' gives 459,000 des/s. | ||
| 32 | I'll record the higher since it is coming from the library but it | ||
| 33 | is all rather weird. | ||
| 34 | [2] Similar to the ultra sparc ([1]), 181,000 for 'des_opts' vs 175,000. | ||
| 35 | [3] I was unable to get access to this machine when it was not heavily loaded. | ||
| 36 | As such, my timing program was never able to get more that %30 of the CPU. | ||
| 37 | This would cause the program to give much lower speed numbers because | ||
| 38 | it would be 'fighting' to stay in the cache with the other CPU burning | ||
| 39 | processes. | ||
diff --git a/src/lib/libcrypto/des/read2pwd.c b/src/lib/libcrypto/des/read2pwd.c new file mode 100644 index 0000000000..ee6969f76e --- /dev/null +++ b/src/lib/libcrypto/des/read2pwd.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* crypto/des/read2pwd.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 56 | * All rights reserved. | ||
| 57 | * | ||
| 58 | * This package is an SSL implementation written | ||
| 59 | * by Eric Young (eay@cryptsoft.com). | ||
| 60 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 61 | * | ||
| 62 | * This library is free for commercial and non-commercial use as long as | ||
| 63 | * the following conditions are aheared to. The following conditions | ||
| 64 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 65 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 66 | * included with this distribution is covered by the same copyright terms | ||
| 67 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 68 | * | ||
| 69 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 70 | * the code are not to be removed. | ||
| 71 | * If this package is used in a product, Eric Young should be given attribution | ||
| 72 | * as the author of the parts of the library used. | ||
| 73 | * This can be in the form of a textual message at program startup or | ||
| 74 | * in documentation (online or textual) provided with the package. | ||
| 75 | * | ||
| 76 | * Redistribution and use in source and binary forms, with or without | ||
| 77 | * modification, are permitted provided that the following conditions | ||
| 78 | * are met: | ||
| 79 | * 1. Redistributions of source code must retain the copyright | ||
| 80 | * notice, this list of conditions and the following disclaimer. | ||
| 81 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 82 | * notice, this list of conditions and the following disclaimer in the | ||
| 83 | * documentation and/or other materials provided with the distribution. | ||
| 84 | * 3. All advertising materials mentioning features or use of this software | ||
| 85 | * must display the following acknowledgement: | ||
| 86 | * "This product includes cryptographic software written by | ||
| 87 | * Eric Young (eay@cryptsoft.com)" | ||
| 88 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 89 | * being used are not cryptographic related :-). | ||
| 90 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 91 | * the apps directory (application code) you must include an acknowledgement: | ||
| 92 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 93 | * | ||
| 94 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 95 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 96 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 97 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 98 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 99 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 100 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 101 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 102 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 103 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 104 | * SUCH DAMAGE. | ||
| 105 | * | ||
| 106 | * The licence and distribution terms for any publically available version or | ||
| 107 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 108 | * copied and put under another distribution licence | ||
| 109 | * [including the GNU Public Licence.] | ||
| 110 | */ | ||
| 111 | |||
| 112 | #include <string.h> | ||
| 113 | #include <openssl/des.h> | ||
| 114 | #include <openssl/ui.h> | ||
| 115 | #include <openssl/crypto.h> | ||
| 116 | |||
| 117 | int DES_read_password(DES_cblock *key, const char *prompt, int verify) | ||
| 118 | { | ||
| 119 | int ok; | ||
| 120 | char buf[BUFSIZ],buff[BUFSIZ]; | ||
| 121 | |||
| 122 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) | ||
| 123 | DES_string_to_key(buf,key); | ||
| 124 | OPENSSL_cleanse(buf,BUFSIZ); | ||
| 125 | OPENSSL_cleanse(buff,BUFSIZ); | ||
| 126 | return(ok); | ||
| 127 | } | ||
| 128 | |||
| 129 | int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt, | ||
| 130 | int verify) | ||
| 131 | { | ||
| 132 | int ok; | ||
| 133 | char buf[BUFSIZ],buff[BUFSIZ]; | ||
| 134 | |||
| 135 | if ((ok=UI_UTIL_read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0) | ||
| 136 | DES_string_to_2keys(buf,key1,key2); | ||
| 137 | OPENSSL_cleanse(buf,BUFSIZ); | ||
| 138 | OPENSSL_cleanse(buff,BUFSIZ); | ||
| 139 | return(ok); | ||
| 140 | } | ||
diff --git a/src/lib/libcrypto/des/read_pwd.c b/src/lib/libcrypto/des/read_pwd.c new file mode 100644 index 0000000000..ce5fa00a37 --- /dev/null +++ b/src/lib/libcrypto/des/read_pwd.c | |||
| @@ -0,0 +1,521 @@ | |||
| 1 | /* crypto/des/read_pwd.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/e_os2.h> | ||
| 60 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_WIN32) | ||
| 61 | #ifdef OPENSSL_UNISTD | ||
| 62 | # include OPENSSL_UNISTD | ||
| 63 | #else | ||
| 64 | # include <unistd.h> | ||
| 65 | #endif | ||
| 66 | /* If unistd.h defines _POSIX_VERSION, we conclude that we | ||
| 67 | * are on a POSIX system and have sigaction and termios. */ | ||
| 68 | #if defined(_POSIX_VERSION) | ||
| 69 | |||
| 70 | # define SIGACTION | ||
| 71 | # if !defined(TERMIOS) && !defined(TERMIO) && !defined(SGTTY) | ||
| 72 | # define TERMIOS | ||
| 73 | # endif | ||
| 74 | |||
| 75 | #endif | ||
| 76 | #endif | ||
| 77 | |||
| 78 | /* #define SIGACTION */ /* Define this if you have sigaction() */ | ||
| 79 | |||
| 80 | #ifdef WIN16TTY | ||
| 81 | #undef OPENSSL_SYS_WIN16 | ||
| 82 | #undef _WINDOWS | ||
| 83 | #include <graph.h> | ||
| 84 | #endif | ||
| 85 | |||
| 86 | /* 06-Apr-92 Luke Brennan Support for VMS */ | ||
| 87 | #include "des_locl.h" | ||
| 88 | #include "cryptlib.h" | ||
| 89 | #include <signal.h> | ||
| 90 | #include <stdio.h> | ||
| 91 | #include <string.h> | ||
| 92 | #include <setjmp.h> | ||
| 93 | #include <errno.h> | ||
| 94 | |||
| 95 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ | ||
| 96 | #include <starlet.h> | ||
| 97 | #ifdef __DECC | ||
| 98 | #pragma message disable DOLLARID | ||
| 99 | #endif | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #ifdef WIN_CONSOLE_BUG | ||
| 103 | #include <windows.h> | ||
| 104 | #ifndef OPENSSL_SYS_WINCE | ||
| 105 | #include <wincon.h> | ||
| 106 | #endif | ||
| 107 | #endif | ||
| 108 | |||
| 109 | |||
| 110 | /* There are 5 types of terminal interface supported, | ||
| 111 | * TERMIO, TERMIOS, VMS, MSDOS and SGTTY | ||
| 112 | */ | ||
| 113 | |||
| 114 | #if defined(__sgi) && !defined(TERMIOS) | ||
| 115 | #define TERMIOS | ||
| 116 | #undef TERMIO | ||
| 117 | #undef SGTTY | ||
| 118 | #endif | ||
| 119 | |||
| 120 | #if defined(linux) && !defined(TERMIO) | ||
| 121 | #undef TERMIOS | ||
| 122 | #define TERMIO | ||
| 123 | #undef SGTTY | ||
| 124 | #endif | ||
| 125 | |||
| 126 | #ifdef _LIBC | ||
| 127 | #undef TERMIOS | ||
| 128 | #define TERMIO | ||
| 129 | #undef SGTTY | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #if !defined(TERMIO) && !defined(TERMIOS) && !defined(OPENSSL_SYS_VMS) && !defined(OPENSSL_SYS_MSDOS) && !defined(MAC_OS_pre_X) && !defined(MAC_OS_GUSI_SOURCE) | ||
| 133 | #undef TERMIOS | ||
| 134 | #undef TERMIO | ||
| 135 | #define SGTTY | ||
| 136 | #endif | ||
| 137 | |||
| 138 | #if defined(OPENSSL_SYS_VXWORKS) | ||
| 139 | #undef TERMIOS | ||
| 140 | #undef TERMIO | ||
| 141 | #undef SGTTY | ||
| 142 | #endif | ||
| 143 | |||
| 144 | #ifdef TERMIOS | ||
| 145 | #include <termios.h> | ||
| 146 | #define TTY_STRUCT struct termios | ||
| 147 | #define TTY_FLAGS c_lflag | ||
| 148 | #define TTY_get(tty,data) tcgetattr(tty,data) | ||
| 149 | #define TTY_set(tty,data) tcsetattr(tty,TCSANOW,data) | ||
| 150 | #endif | ||
| 151 | |||
| 152 | #ifdef TERMIO | ||
| 153 | #include <termio.h> | ||
| 154 | #define TTY_STRUCT struct termio | ||
| 155 | #define TTY_FLAGS c_lflag | ||
| 156 | #define TTY_get(tty,data) ioctl(tty,TCGETA,data) | ||
| 157 | #define TTY_set(tty,data) ioctl(tty,TCSETA,data) | ||
| 158 | #endif | ||
| 159 | |||
| 160 | #ifdef SGTTY | ||
| 161 | #include <sgtty.h> | ||
| 162 | #define TTY_STRUCT struct sgttyb | ||
| 163 | #define TTY_FLAGS sg_flags | ||
| 164 | #define TTY_get(tty,data) ioctl(tty,TIOCGETP,data) | ||
| 165 | #define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) | ||
| 166 | #endif | ||
| 167 | |||
| 168 | #if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && !defined(MAC_OS_pre_X) | ||
| 169 | #include <sys/ioctl.h> | ||
| 170 | #endif | ||
| 171 | |||
| 172 | #if defined(OPENSSL_SYS_MSDOS) && !defined(__CYGWIN32__) && !defined(OPENSSL_SYS_WINCE) | ||
| 173 | #include <conio.h> | ||
| 174 | #define fgets(a,b,c) noecho_fgets(a,b,c) | ||
| 175 | #endif | ||
| 176 | |||
| 177 | #ifdef OPENSSL_SYS_VMS | ||
| 178 | #include <ssdef.h> | ||
| 179 | #include <iodef.h> | ||
| 180 | #include <ttdef.h> | ||
| 181 | #include <descrip.h> | ||
| 182 | struct IOSB { | ||
| 183 | short iosb$w_value; | ||
| 184 | short iosb$w_count; | ||
| 185 | long iosb$l_info; | ||
| 186 | }; | ||
| 187 | #endif | ||
| 188 | |||
| 189 | #if defined(MAC_OS_pre_X) || defined(MAC_OS_GUSI_SOURCE) | ||
| 190 | /* | ||
| 191 | * This one needs work. As a matter of fact the code is unoperational | ||
| 192 | * and this is only a trick to get it compiled. | ||
| 193 | * <appro@fy.chalmers.se> | ||
| 194 | */ | ||
| 195 | #define TTY_STRUCT int | ||
| 196 | #endif | ||
| 197 | |||
| 198 | #ifndef NX509_SIG | ||
| 199 | #define NX509_SIG 32 | ||
| 200 | #endif | ||
| 201 | |||
| 202 | static void read_till_nl(FILE *); | ||
| 203 | static void recsig(int); | ||
| 204 | static void pushsig(void); | ||
| 205 | static void popsig(void); | ||
| 206 | #if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN16) | ||
| 207 | static int noecho_fgets(char *buf, int size, FILE *tty); | ||
| 208 | #endif | ||
| 209 | #ifdef SIGACTION | ||
| 210 | static struct sigaction savsig[NX509_SIG]; | ||
| 211 | #else | ||
| 212 | static void (*savsig[NX509_SIG])(int ); | ||
| 213 | #endif | ||
| 214 | static jmp_buf save; | ||
| 215 | |||
| 216 | int des_read_pw_string(char *buf, int length, const char *prompt, | ||
| 217 | int verify) | ||
| 218 | { | ||
| 219 | char buff[BUFSIZ]; | ||
| 220 | int ret; | ||
| 221 | |||
| 222 | ret=des_read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify); | ||
| 223 | OPENSSL_cleanse(buff,BUFSIZ); | ||
| 224 | return(ret); | ||
| 225 | } | ||
| 226 | |||
| 227 | #ifdef OPENSSL_SYS_WINCE | ||
| 228 | |||
| 229 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, int verify) | ||
| 230 | { | ||
| 231 | memset(buf,0,size); | ||
| 232 | memset(buff,0,size); | ||
| 233 | return(0); | ||
| 234 | } | ||
| 235 | |||
| 236 | #elif defined(OPENSSL_SYS_WIN16) | ||
| 237 | |||
| 238 | int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify) | ||
| 239 | { | ||
| 240 | memset(buf,0,size); | ||
| 241 | memset(buff,0,size); | ||
| 242 | return(0); | ||
| 243 | } | ||
| 244 | |||
| 245 | #else /* !OPENSSL_SYS_WINCE && !OPENSSL_SYS_WIN16 */ | ||
| 246 | |||
| 247 | static void read_till_nl(FILE *in) | ||
| 248 | { | ||
| 249 | #define SIZE 4 | ||
| 250 | char buf[SIZE+1]; | ||
| 251 | |||
| 252 | do { | ||
| 253 | fgets(buf,SIZE,in); | ||
| 254 | } while (strchr(buf,'\n') == NULL); | ||
| 255 | } | ||
| 256 | |||
| 257 | |||
| 258 | /* return 0 if ok, 1 (or -1) otherwise */ | ||
| 259 | int des_read_pw(char *buf, char *buff, int size, const char *prompt, | ||
| 260 | int verify) | ||
| 261 | { | ||
| 262 | #ifdef OPENSSL_SYS_VMS | ||
| 263 | struct IOSB iosb; | ||
| 264 | $DESCRIPTOR(terminal,"TT"); | ||
| 265 | long tty_orig[3], tty_new[3]; | ||
| 266 | long status; | ||
| 267 | unsigned short channel = 0; | ||
| 268 | #else | ||
| 269 | #if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__) | ||
| 270 | TTY_STRUCT tty_orig,tty_new; | ||
| 271 | #endif | ||
| 272 | #endif | ||
| 273 | int number; | ||
| 274 | int ok; | ||
| 275 | /* statics are simply to avoid warnings about longjmp clobbering | ||
| 276 | things */ | ||
| 277 | static int ps; | ||
| 278 | int is_a_tty; | ||
| 279 | static FILE *tty; | ||
| 280 | char *p; | ||
| 281 | |||
| 282 | if (setjmp(save)) | ||
| 283 | { | ||
| 284 | ok=0; | ||
| 285 | goto error; | ||
| 286 | } | ||
| 287 | |||
| 288 | number=5; | ||
| 289 | ok=0; | ||
| 290 | ps=0; | ||
| 291 | is_a_tty=1; | ||
| 292 | tty=NULL; | ||
| 293 | |||
| 294 | #ifdef OPENSSL_SYS_MSDOS | ||
| 295 | if ((tty=fopen("con","r")) == NULL) | ||
| 296 | tty=stdin; | ||
| 297 | #elif defined(MAC_OS_pre_X) || defined(OPENSSL_SYS_VXWORKS) | ||
| 298 | tty=stdin; | ||
| 299 | #else | ||
| 300 | #ifndef OPENSSL_SYS_MPE | ||
| 301 | if ((tty=fopen("/dev/tty","r")) == NULL) | ||
| 302 | #endif | ||
| 303 | tty=stdin; | ||
| 304 | #endif | ||
| 305 | |||
| 306 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) | ||
| 307 | if (TTY_get(fileno(tty),&tty_orig) == -1) | ||
| 308 | { | ||
| 309 | #ifdef ENOTTY | ||
| 310 | if (errno == ENOTTY) | ||
| 311 | is_a_tty=0; | ||
| 312 | else | ||
| 313 | #endif | ||
| 314 | #ifdef EINVAL | ||
| 315 | /* Ariel Glenn ariel@columbia.edu reports that solaris | ||
| 316 | * can return EINVAL instead. This should be ok */ | ||
| 317 | if (errno == EINVAL) | ||
| 318 | is_a_tty=0; | ||
| 319 | else | ||
| 320 | #endif | ||
| 321 | return(-1); | ||
| 322 | } | ||
| 323 | memcpy(&(tty_new),&(tty_orig),sizeof(tty_orig)); | ||
| 324 | #endif | ||
| 325 | #ifdef OPENSSL_SYS_VMS | ||
| 326 | status = sys$assign(&terminal,&channel,0,0); | ||
| 327 | if (status != SS$_NORMAL) | ||
| 328 | return(-1); | ||
| 329 | status=sys$qiow(0,channel,IO$_SENSEMODE,&iosb,0,0,tty_orig,12,0,0,0,0); | ||
| 330 | if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL)) | ||
| 331 | return(-1); | ||
| 332 | #endif | ||
| 333 | |||
| 334 | pushsig(); | ||
| 335 | ps=1; | ||
| 336 | |||
| 337 | #ifdef TTY_FLAGS | ||
| 338 | tty_new.TTY_FLAGS &= ~ECHO; | ||
| 339 | #endif | ||
| 340 | |||
| 341 | #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS) | ||
| 342 | if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1)) | ||
| 343 | #ifdef OPENSSL_SYS_MPE | ||
| 344 | ; /* MPE lies -- echo really has been disabled */ | ||
| 345 | #else | ||
| 346 | return(-1); | ||
| 347 | #endif | ||
| 348 | #endif | ||
| 349 | #ifdef OPENSSL_SYS_VMS | ||
| 350 | tty_new[0] = tty_orig[0]; | ||
| 351 | tty_new[1] = tty_orig[1] | TT$M_NOECHO; | ||
| 352 | tty_new[2] = tty_orig[2]; | ||
| 353 | status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0,tty_new,12,0,0,0,0); | ||
| 354 | if ((status != SS$_NORMAL) || (iosb.iosb$w_value != SS$_NORMAL)) | ||
| 355 | return(-1); | ||
| 356 | #endif | ||
| 357 | ps=2; | ||
| 358 | |||
| 359 | while ((!ok) && (number--)) | ||
| 360 | { | ||
| 361 | fputs(prompt,stderr); | ||
| 362 | fflush(stderr); | ||
| 363 | |||
| 364 | buf[0]='\0'; | ||
| 365 | fgets(buf,size,tty); | ||
| 366 | if (feof(tty)) goto error; | ||
| 367 | if (ferror(tty)) goto error; | ||
| 368 | if ((p=(char *)strchr(buf,'\n')) != NULL) | ||
| 369 | *p='\0'; | ||
| 370 | else read_till_nl(tty); | ||
| 371 | if (verify) | ||
| 372 | { | ||
| 373 | fprintf(stderr,"\nVerifying password - %s",prompt); | ||
| 374 | fflush(stderr); | ||
| 375 | buff[0]='\0'; | ||
| 376 | fgets(buff,size,tty); | ||
| 377 | if (feof(tty)) goto error; | ||
| 378 | if ((p=(char *)strchr(buff,'\n')) != NULL) | ||
| 379 | *p='\0'; | ||
| 380 | else read_till_nl(tty); | ||
| 381 | |||
| 382 | if (strcmp(buf,buff) != 0) | ||
| 383 | { | ||
| 384 | fprintf(stderr,"\nVerify failure"); | ||
| 385 | fflush(stderr); | ||
| 386 | break; | ||
| 387 | /* continue; */ | ||
| 388 | } | ||
| 389 | } | ||
| 390 | ok=1; | ||
| 391 | } | ||
| 392 | |||
| 393 | error: | ||
| 394 | fprintf(stderr,"\n"); | ||
| 395 | #if 0 | ||
| 396 | perror("fgets(tty)"); | ||
| 397 | #endif | ||
| 398 | /* What can we do if there is an error? */ | ||
| 399 | #if defined(TTY_set) && !defined(OPENSSL_SYS_VMS) | ||
| 400 | if (ps >= 2) TTY_set(fileno(tty),&tty_orig); | ||
| 401 | #endif | ||
| 402 | #ifdef OPENSSL_SYS_VMS | ||
| 403 | if (ps >= 2) | ||
| 404 | status = sys$qiow(0,channel,IO$_SETMODE,&iosb,0,0 | ||
| 405 | ,tty_orig,12,0,0,0,0); | ||
| 406 | #endif | ||
| 407 | |||
| 408 | if (ps >= 1) popsig(); | ||
| 409 | if (stdin != tty) fclose(tty); | ||
| 410 | #ifdef OPENSSL_SYS_VMS | ||
| 411 | status = sys$dassgn(channel); | ||
| 412 | #endif | ||
| 413 | return(!ok); | ||
| 414 | } | ||
| 415 | |||
| 416 | static void pushsig(void) | ||
| 417 | { | ||
| 418 | int i; | ||
| 419 | #ifdef SIGACTION | ||
| 420 | struct sigaction sa; | ||
| 421 | |||
| 422 | memset(&sa,0,sizeof sa); | ||
| 423 | sa.sa_handler=recsig; | ||
| 424 | #endif | ||
| 425 | |||
| 426 | for (i=1; i<NX509_SIG; i++) | ||
| 427 | { | ||
| 428 | #ifdef SIGUSR1 | ||
| 429 | if (i == SIGUSR1) | ||
| 430 | continue; | ||
| 431 | #endif | ||
| 432 | #ifdef SIGUSR2 | ||
| 433 | if (i == SIGUSR2) | ||
| 434 | continue; | ||
| 435 | #endif | ||
| 436 | #ifdef SIGACTION | ||
| 437 | sigaction(i,&sa,&savsig[i]); | ||
| 438 | #else | ||
| 439 | savsig[i]=signal(i,recsig); | ||
| 440 | #endif | ||
| 441 | } | ||
| 442 | |||
| 443 | #ifdef SIGWINCH | ||
| 444 | signal(SIGWINCH,SIG_DFL); | ||
| 445 | #endif | ||
| 446 | } | ||
| 447 | |||
| 448 | static void popsig(void) | ||
| 449 | { | ||
| 450 | int i; | ||
| 451 | |||
| 452 | for (i=1; i<NX509_SIG; i++) | ||
| 453 | { | ||
| 454 | #ifdef SIGUSR1 | ||
| 455 | if (i == SIGUSR1) | ||
| 456 | continue; | ||
| 457 | #endif | ||
| 458 | #ifdef SIGUSR2 | ||
| 459 | if (i == SIGUSR2) | ||
| 460 | continue; | ||
| 461 | #endif | ||
| 462 | #ifdef SIGACTION | ||
| 463 | sigaction(i,&savsig[i],NULL); | ||
| 464 | #else | ||
| 465 | signal(i,savsig[i]); | ||
| 466 | #endif | ||
| 467 | } | ||
| 468 | } | ||
| 469 | |||
| 470 | static void recsig(int i) | ||
| 471 | { | ||
| 472 | longjmp(save,1); | ||
| 473 | #ifdef LINT | ||
| 474 | i=i; | ||
| 475 | #endif | ||
| 476 | } | ||
| 477 | |||
| 478 | #ifdef OPENSSL_SYS_MSDOS | ||
| 479 | static int noecho_fgets(char *buf, int size, FILE *tty) | ||
| 480 | { | ||
| 481 | int i; | ||
| 482 | char *p; | ||
| 483 | |||
| 484 | p=buf; | ||
| 485 | for (;;) | ||
| 486 | { | ||
| 487 | if (size == 0) | ||
| 488 | { | ||
| 489 | *p='\0'; | ||
| 490 | break; | ||
| 491 | } | ||
| 492 | size--; | ||
| 493 | #ifdef WIN16TTY | ||
| 494 | i=_inchar(); | ||
| 495 | #else | ||
| 496 | i=getch(); | ||
| 497 | #endif | ||
| 498 | if (i == '\r') i='\n'; | ||
| 499 | *(p++)=i; | ||
| 500 | if (i == '\n') | ||
| 501 | { | ||
| 502 | *p='\0'; | ||
| 503 | break; | ||
| 504 | } | ||
| 505 | } | ||
| 506 | #ifdef WIN_CONSOLE_BUG | ||
| 507 | /* Win95 has several evil console bugs: one of these is that the | ||
| 508 | * last character read using getch() is passed to the next read: this is | ||
| 509 | * usually a CR so this can be trouble. No STDIO fix seems to work but | ||
| 510 | * flushing the console appears to do the trick. | ||
| 511 | */ | ||
| 512 | { | ||
| 513 | HANDLE inh; | ||
| 514 | inh = GetStdHandle(STD_INPUT_HANDLE); | ||
| 515 | FlushConsoleInputBuffer(inh); | ||
| 516 | } | ||
| 517 | #endif | ||
| 518 | return(strlen(buf)); | ||
| 519 | } | ||
| 520 | #endif | ||
| 521 | #endif /* !OPENSSL_SYS_WINCE && !WIN16 */ | ||
diff --git a/src/lib/libcrypto/des/rpc_des.h b/src/lib/libcrypto/des/rpc_des.h new file mode 100644 index 0000000000..8263c512ab --- /dev/null +++ b/src/lib/libcrypto/des/rpc_des.h | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | /* crypto/des/rpc_des.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ | ||
| 60 | /* | ||
| 61 | * Copyright (c) 2010, Oracle America, Inc. | ||
| 62 | * | ||
| 63 | * Redistribution and use in source and binary forms, with or without | ||
| 64 | * modification, are permitted provided that the following conditions are | ||
| 65 | * met: | ||
| 66 | * | ||
| 67 | * * Redistributions of source code must retain the above copyright | ||
| 68 | * notice, this list of conditions and the following disclaimer. | ||
| 69 | * * Redistributions in binary form must reproduce the above | ||
| 70 | * copyright notice, this list of conditions and the following | ||
| 71 | * disclaimer in the documentation and/or other materials | ||
| 72 | * provided with the distribution. | ||
| 73 | * * Neither the name of the "Oracle America, Inc." nor the names of its | ||
| 74 | * contributors may be used to endorse or promote products derived | ||
| 75 | * from this software without specific prior written permission. | ||
| 76 | * | ||
| 77 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 78 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 79 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 80 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 81 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
| 82 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 83 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
| 84 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 85 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
| 86 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 87 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 88 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 89 | */ | ||
| 90 | |||
| 91 | /* | ||
| 92 | * Generic DES driver interface | ||
| 93 | * Keep this file hardware independent! | ||
| 94 | */ | ||
| 95 | |||
| 96 | #define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ | ||
| 97 | #define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ | ||
| 98 | |||
| 99 | #ifdef HEADER_DES_H | ||
| 100 | #undef ENCRYPT | ||
| 101 | #undef DECRYPT | ||
| 102 | #endif | ||
| 103 | |||
| 104 | enum desdir { ENCRYPT, DECRYPT }; | ||
| 105 | enum desmode { CBC, ECB }; | ||
| 106 | |||
| 107 | /* | ||
| 108 | * parameters to ioctl call | ||
| 109 | */ | ||
| 110 | struct desparams { | ||
| 111 | unsigned char des_key[8]; /* key (with low bit parity) */ | ||
| 112 | enum desdir des_dir; /* direction */ | ||
| 113 | enum desmode des_mode; /* mode */ | ||
| 114 | unsigned char des_ivec[8]; /* input vector */ | ||
| 115 | unsigned des_len; /* number of bytes to crypt */ | ||
| 116 | union { | ||
| 117 | unsigned char UDES_data[DES_QUICKLEN]; | ||
| 118 | unsigned char *UDES_buf; | ||
| 119 | } UDES; | ||
| 120 | # define des_data UDES.UDES_data /* direct data here if quick */ | ||
| 121 | # define des_buf UDES.UDES_buf /* otherwise, pointer to data */ | ||
| 122 | }; | ||
| 123 | |||
| 124 | /* | ||
| 125 | * Encrypt an arbitrary sized buffer | ||
| 126 | */ | ||
| 127 | #define DESIOCBLOCK _IOWR('d', 6, struct desparams) | ||
| 128 | |||
| 129 | /* | ||
| 130 | * Encrypt of small amount of data, quickly | ||
| 131 | */ | ||
| 132 | #define DESIOCQUICK _IOWR('d', 7, struct desparams) | ||
| 133 | |||
diff --git a/src/lib/libcrypto/des/rpc_enc.c b/src/lib/libcrypto/des/rpc_enc.c new file mode 100644 index 0000000000..d937d08da5 --- /dev/null +++ b/src/lib/libcrypto/des/rpc_enc.c | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | /* crypto/des/rpc_enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include "rpc_des.h" | ||
| 60 | #include "des_locl.h" | ||
| 61 | #include "des_ver.h" | ||
| 62 | |||
| 63 | int _des_crypt(char *buf,int len,struct desparams *desp); | ||
| 64 | int _des_crypt(char *buf, int len, struct desparams *desp) | ||
| 65 | { | ||
| 66 | DES_key_schedule ks; | ||
| 67 | int enc; | ||
| 68 | |||
| 69 | DES_set_key_unchecked(&desp->des_key,&ks); | ||
| 70 | enc=(desp->des_dir == ENCRYPT)?DES_ENCRYPT:DES_DECRYPT; | ||
| 71 | |||
| 72 | if (desp->des_mode == CBC) | ||
| 73 | DES_ecb_encrypt((const_DES_cblock *)desp->UDES.UDES_buf, | ||
| 74 | (DES_cblock *)desp->UDES.UDES_buf,&ks, | ||
| 75 | enc); | ||
| 76 | else | ||
| 77 | { | ||
| 78 | DES_ncbc_encrypt(desp->UDES.UDES_buf,desp->UDES.UDES_buf, | ||
| 79 | len,&ks,&desp->des_ivec,enc); | ||
| 80 | #ifdef undef | ||
| 81 | /* len will always be %8 if called from common_crypt | ||
| 82 | * in secure_rpc. | ||
| 83 | * Libdes's cbc encrypt does not copy back the iv, | ||
| 84 | * so we have to do it here. */ | ||
| 85 | /* It does now :-) eay 20/09/95 */ | ||
| 86 | |||
| 87 | a=(char *)&(desp->UDES.UDES_buf[len-8]); | ||
| 88 | b=(char *)&(desp->des_ivec[0]); | ||
| 89 | |||
| 90 | *(a++)= *(b++); *(a++)= *(b++); | ||
| 91 | *(a++)= *(b++); *(a++)= *(b++); | ||
| 92 | *(a++)= *(b++); *(a++)= *(b++); | ||
| 93 | *(a++)= *(b++); *(a++)= *(b++); | ||
| 94 | #endif | ||
| 95 | } | ||
| 96 | return(1); | ||
| 97 | } | ||
| 98 | |||
diff --git a/src/lib/libcrypto/des/rpw.c b/src/lib/libcrypto/des/rpw.c new file mode 100644 index 0000000000..8a9473c4f9 --- /dev/null +++ b/src/lib/libcrypto/des/rpw.c | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | /* crypto/des/rpw.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/des.h> | ||
| 61 | |||
| 62 | int main(int argc, char *argv[]) | ||
| 63 | { | ||
| 64 | DES_cblock k,k1; | ||
| 65 | int i; | ||
| 66 | |||
| 67 | printf("read passwd\n"); | ||
| 68 | if ((i=des_read_password(&k,"Enter password:",0)) == 0) | ||
| 69 | { | ||
| 70 | printf("password = "); | ||
| 71 | for (i=0; i<8; i++) | ||
| 72 | printf("%02x ",k[i]); | ||
| 73 | } | ||
| 74 | else | ||
| 75 | printf("error %d\n",i); | ||
| 76 | printf("\n"); | ||
| 77 | printf("read 2passwds and verify\n"); | ||
| 78 | if ((i=des_read_2passwords(&k,&k1, | ||
| 79 | "Enter verified password:",1)) == 0) | ||
| 80 | { | ||
| 81 | printf("password1 = "); | ||
| 82 | for (i=0; i<8; i++) | ||
| 83 | printf("%02x ",k[i]); | ||
| 84 | printf("\n"); | ||
| 85 | printf("password2 = "); | ||
| 86 | for (i=0; i<8; i++) | ||
| 87 | printf("%02x ",k1[i]); | ||
| 88 | printf("\n"); | ||
| 89 | exit(1); | ||
| 90 | } | ||
| 91 | else | ||
| 92 | { | ||
| 93 | printf("error %d\n",i); | ||
| 94 | exit(0); | ||
| 95 | } | ||
| 96 | #ifdef LINT | ||
| 97 | return(0); | ||
| 98 | #endif | ||
| 99 | } | ||
diff --git a/src/lib/libcrypto/des/speed.c b/src/lib/libcrypto/des/speed.c new file mode 100644 index 0000000000..1616f4b7c9 --- /dev/null +++ b/src/lib/libcrypto/des/speed.c | |||
| @@ -0,0 +1,314 @@ | |||
| 1 | /* crypto/des/speed.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ | ||
| 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #define crypt(c,s) (des_crypt((c),(s))) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #ifndef _IRIX | ||
| 78 | #include <time.h> | ||
| 79 | #endif | ||
| 80 | #ifdef TIMES | ||
| 81 | #include <sys/types.h> | ||
| 82 | #include <sys/times.h> | ||
| 83 | #endif | ||
| 84 | |||
| 85 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 86 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 87 | undefine TIMES, since that tells the rest of the program how things | ||
| 88 | should be handled. -- Richard Levitte */ | ||
| 89 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 90 | #undef TIMES | ||
| 91 | #endif | ||
| 92 | |||
| 93 | #ifndef TIMES | ||
| 94 | #include <sys/timeb.h> | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #if defined(sun) || defined(__ultrix) | ||
| 98 | #define _POSIX_SOURCE | ||
| 99 | #include <limits.h> | ||
| 100 | #include <sys/param.h> | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #include <openssl/des.h> | ||
| 104 | |||
| 105 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 106 | #ifndef HZ | ||
| 107 | # ifndef CLK_TCK | ||
| 108 | # ifndef _BSD_CLK_TCK_ /* FreeBSD fix */ | ||
| 109 | # define HZ 100.0 | ||
| 110 | # else /* _BSD_CLK_TCK_ */ | ||
| 111 | # define HZ ((double)_BSD_CLK_TCK_) | ||
| 112 | # endif | ||
| 113 | # else /* CLK_TCK */ | ||
| 114 | # define HZ ((double)CLK_TCK) | ||
| 115 | # endif | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #define BUFSIZE ((long)1024) | ||
| 119 | long run=0; | ||
| 120 | |||
| 121 | double Time_F(int s); | ||
| 122 | #ifdef SIGALRM | ||
| 123 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) | ||
| 124 | #define SIGRETTYPE void | ||
| 125 | #else | ||
| 126 | #define SIGRETTYPE int | ||
| 127 | #endif | ||
| 128 | |||
| 129 | SIGRETTYPE sig_done(int sig); | ||
| 130 | SIGRETTYPE sig_done(int sig) | ||
| 131 | { | ||
| 132 | signal(SIGALRM,sig_done); | ||
| 133 | run=0; | ||
| 134 | #ifdef LINT | ||
| 135 | sig=sig; | ||
| 136 | #endif | ||
| 137 | } | ||
| 138 | #endif | ||
| 139 | |||
| 140 | #define START 0 | ||
| 141 | #define STOP 1 | ||
| 142 | |||
| 143 | double Time_F(int s) | ||
| 144 | { | ||
| 145 | double ret; | ||
| 146 | #ifdef TIMES | ||
| 147 | static struct tms tstart,tend; | ||
| 148 | |||
| 149 | if (s == START) | ||
| 150 | { | ||
| 151 | times(&tstart); | ||
| 152 | return(0); | ||
| 153 | } | ||
| 154 | else | ||
| 155 | { | ||
| 156 | times(&tend); | ||
| 157 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 158 | return((ret == 0.0)?1e-6:ret); | ||
| 159 | } | ||
| 160 | #else /* !times() */ | ||
| 161 | static struct timeb tstart,tend; | ||
| 162 | long i; | ||
| 163 | |||
| 164 | if (s == START) | ||
| 165 | { | ||
| 166 | ftime(&tstart); | ||
| 167 | return(0); | ||
| 168 | } | ||
| 169 | else | ||
| 170 | { | ||
| 171 | ftime(&tend); | ||
| 172 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 173 | ret=((double)(tend.time-tstart.time))+((double)i)/1e3; | ||
| 174 | return((ret == 0.0)?1e-6:ret); | ||
| 175 | } | ||
| 176 | #endif | ||
| 177 | } | ||
| 178 | |||
| 179 | int main(int argc, char **argv) | ||
| 180 | { | ||
| 181 | long count; | ||
| 182 | static unsigned char buf[BUFSIZE]; | ||
| 183 | static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; | ||
| 184 | static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; | ||
| 185 | static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; | ||
| 186 | DES_key_schedule sch,sch2,sch3; | ||
| 187 | double a,b,c,d,e; | ||
| 188 | #ifndef SIGALRM | ||
| 189 | long ca,cb,cc,cd,ce; | ||
| 190 | #endif | ||
| 191 | |||
| 192 | #ifndef TIMES | ||
| 193 | printf("To get the most accurate results, try to run this\n"); | ||
| 194 | printf("program when this computer is idle.\n"); | ||
| 195 | #endif | ||
| 196 | |||
| 197 | DES_set_key_unchecked(&key2,&sch2); | ||
| 198 | DES_set_key_unchecked(&key3,&sch3); | ||
| 199 | |||
| 200 | #ifndef SIGALRM | ||
| 201 | printf("First we calculate the approximate speed ...\n"); | ||
| 202 | DES_set_key_unchecked(&key,&sch); | ||
| 203 | count=10; | ||
| 204 | do { | ||
| 205 | long i; | ||
| 206 | DES_LONG data[2]; | ||
| 207 | |||
| 208 | count*=2; | ||
| 209 | Time_F(START); | ||
| 210 | for (i=count; i; i--) | ||
| 211 | DES_encrypt1(data,&sch,DES_ENCRYPT); | ||
| 212 | d=Time_F(STOP); | ||
| 213 | } while (d < 3.0); | ||
| 214 | ca=count; | ||
| 215 | cb=count*3; | ||
| 216 | cc=count*3*8/BUFSIZE+1; | ||
| 217 | cd=count*8/BUFSIZE+1; | ||
| 218 | ce=count/20+1; | ||
| 219 | printf("Doing set_key %ld times\n",ca); | ||
| 220 | #define COND(d) (count != (d)) | ||
| 221 | #define COUNT(d) (d) | ||
| 222 | #else | ||
| 223 | #define COND(c) (run) | ||
| 224 | #define COUNT(d) (count) | ||
| 225 | signal(SIGALRM,sig_done); | ||
| 226 | printf("Doing set_key for 10 seconds\n"); | ||
| 227 | alarm(10); | ||
| 228 | #endif | ||
| 229 | |||
| 230 | Time_F(START); | ||
| 231 | for (count=0,run=1; COND(ca); count++) | ||
| 232 | DES_set_key_unchecked(&key,&sch); | ||
| 233 | d=Time_F(STOP); | ||
| 234 | printf("%ld set_key's in %.2f seconds\n",count,d); | ||
| 235 | a=((double)COUNT(ca))/d; | ||
| 236 | |||
| 237 | #ifdef SIGALRM | ||
| 238 | printf("Doing DES_encrypt's for 10 seconds\n"); | ||
| 239 | alarm(10); | ||
| 240 | #else | ||
| 241 | printf("Doing DES_encrypt %ld times\n",cb); | ||
| 242 | #endif | ||
| 243 | Time_F(START); | ||
| 244 | for (count=0,run=1; COND(cb); count++) | ||
| 245 | { | ||
| 246 | DES_LONG data[2]; | ||
| 247 | |||
| 248 | DES_encrypt1(data,&sch,DES_ENCRYPT); | ||
| 249 | } | ||
| 250 | d=Time_F(STOP); | ||
| 251 | printf("%ld DES_encrypt's in %.2f second\n",count,d); | ||
| 252 | b=((double)COUNT(cb)*8)/d; | ||
| 253 | |||
| 254 | #ifdef SIGALRM | ||
| 255 | printf("Doing DES_cbc_encrypt on %ld byte blocks for 10 seconds\n", | ||
| 256 | BUFSIZE); | ||
| 257 | alarm(10); | ||
| 258 | #else | ||
| 259 | printf("Doing DES_cbc_encrypt %ld times on %ld byte blocks\n",cc, | ||
| 260 | BUFSIZE); | ||
| 261 | #endif | ||
| 262 | Time_F(START); | ||
| 263 | for (count=0,run=1; COND(cc); count++) | ||
| 264 | DES_ncbc_encrypt(buf,buf,BUFSIZE,&sch, | ||
| 265 | &key,DES_ENCRYPT); | ||
| 266 | d=Time_F(STOP); | ||
| 267 | printf("%ld DES_cbc_encrypt's of %ld byte blocks in %.2f second\n", | ||
| 268 | count,BUFSIZE,d); | ||
| 269 | c=((double)COUNT(cc)*BUFSIZE)/d; | ||
| 270 | |||
| 271 | #ifdef SIGALRM | ||
| 272 | printf("Doing DES_ede_cbc_encrypt on %ld byte blocks for 10 seconds\n", | ||
| 273 | BUFSIZE); | ||
| 274 | alarm(10); | ||
| 275 | #else | ||
| 276 | printf("Doing DES_ede_cbc_encrypt %ld times on %ld byte blocks\n",cd, | ||
| 277 | BUFSIZE); | ||
| 278 | #endif | ||
| 279 | Time_F(START); | ||
| 280 | for (count=0,run=1; COND(cd); count++) | ||
| 281 | DES_ede3_cbc_encrypt(buf,buf,BUFSIZE, | ||
| 282 | &sch, | ||
| 283 | &sch2, | ||
| 284 | &sch3, | ||
| 285 | &key, | ||
| 286 | DES_ENCRYPT); | ||
| 287 | d=Time_F(STOP); | ||
| 288 | printf("%ld DES_ede_cbc_encrypt's of %ld byte blocks in %.2f second\n", | ||
| 289 | count,BUFSIZE,d); | ||
| 290 | d=((double)COUNT(cd)*BUFSIZE)/d; | ||
| 291 | |||
| 292 | #ifdef SIGALRM | ||
| 293 | printf("Doing crypt for 10 seconds\n"); | ||
| 294 | alarm(10); | ||
| 295 | #else | ||
| 296 | printf("Doing crypt %ld times\n",ce); | ||
| 297 | #endif | ||
| 298 | Time_F(START); | ||
| 299 | for (count=0,run=1; COND(ce); count++) | ||
| 300 | crypt("testing1","ef"); | ||
| 301 | e=Time_F(STOP); | ||
| 302 | printf("%ld crypts in %.2f second\n",count,e); | ||
| 303 | e=((double)COUNT(ce))/e; | ||
| 304 | |||
| 305 | printf("set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); | ||
| 306 | printf("DES raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b); | ||
| 307 | printf("DES cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); | ||
| 308 | printf("DES ede cbc bytes per sec = %12.2f (%9.3fuS)\n",d,8.0e6/d); | ||
| 309 | printf("crypt per sec = %12.2f (%9.3fuS)\n",e,1.0e6/e); | ||
| 310 | exit(0); | ||
| 311 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 312 | return(0); | ||
| 313 | #endif | ||
| 314 | } | ||
diff --git a/src/lib/libcrypto/des/t/test b/src/lib/libcrypto/des/t/test new file mode 100644 index 0000000000..97acd0552e --- /dev/null +++ b/src/lib/libcrypto/des/t/test | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #!./perl | ||
| 2 | |||
| 3 | BEGIN { push(@INC, qw(../../../lib ../../lib ../lib lib)); } | ||
| 4 | |||
| 5 | use DES; | ||
| 6 | |||
| 7 | $key='00000000'; | ||
| 8 | $ks=DES::set_key($key); | ||
| 9 | @a=split(//,$ks); | ||
| 10 | foreach (@a) { printf "%02x-",ord($_); } | ||
| 11 | print "\n"; | ||
| 12 | |||
| 13 | |||
| 14 | $key=DES::random_key(); | ||
| 15 | print "($_)\n"; | ||
| 16 | @a=split(//,$key); | ||
| 17 | foreach (@a) { printf "%02x-",ord($_); } | ||
| 18 | print "\n"; | ||
| 19 | $str="this is and again into the breach"; | ||
| 20 | ($k1,$k2)=DES::string_to_2keys($str); | ||
| 21 | @a=split(//,$k1); | ||
| 22 | foreach (@a) { printf "%02x-",ord($_); } | ||
| 23 | print "\n"; | ||
| 24 | @a=split(//,$k2); | ||
| 25 | foreach (@a) { printf "%02x-",ord($_); } | ||
| 26 | print "\n"; | ||
| 27 | |||
diff --git a/src/lib/libcrypto/des/times/486-50.sol b/src/lib/libcrypto/des/times/486-50.sol new file mode 100644 index 0000000000..0de62d6db3 --- /dev/null +++ b/src/lib/libcrypto/des/times/486-50.sol | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | Solaris 2.4, 486 50mhz, gcc 2.6.3 | ||
| 2 | options des ecb/s | ||
| 3 | 16 r2 i 43552.51 100.0% | ||
| 4 | 16 r1 i 43487.45 99.9% | ||
| 5 | 16 c p 43003.23 98.7% | ||
| 6 | 16 r2 p 42339.00 97.2% | ||
| 7 | 16 c i 41900.91 96.2% | ||
| 8 | 16 r1 p 41360.64 95.0% | ||
| 9 | 4 c i 38728.48 88.9% | ||
| 10 | 4 c p 38225.63 87.8% | ||
| 11 | 4 r1 i 38085.79 87.4% | ||
| 12 | 4 r2 i 37825.64 86.9% | ||
| 13 | 4 r2 p 34611.00 79.5% | ||
| 14 | 4 r1 p 31802.00 73.0% | ||
| 15 | -DDES_UNROLL -DDES_RISC2 | ||
| 16 | |||
diff --git a/src/lib/libcrypto/des/times/586-100.lnx b/src/lib/libcrypto/des/times/586-100.lnx new file mode 100644 index 0000000000..4323914a11 --- /dev/null +++ b/src/lib/libcrypto/des/times/586-100.lnx | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | Pentium 100 | ||
| 2 | Linux 2 kernel | ||
| 3 | gcc 2.7.0 -O3 -fomit-frame-pointer | ||
| 4 | No X server running, just a console, it makes the top speed jump from 151,000 | ||
| 5 | to 158,000 :-). | ||
| 6 | options des ecb/s | ||
| 7 | assember 281000.00 177.1% | ||
| 8 | 16 r1 p 158667.40 100.0% | ||
| 9 | 16 r1 i 148471.70 93.6% | ||
| 10 | 16 r2 p 143961.80 90.7% | ||
| 11 | 16 r2 i 141689.20 89.3% | ||
| 12 | 4 r1 i 140100.00 88.3% | ||
| 13 | 4 r2 i 134049.40 84.5% | ||
| 14 | 16 c i 124145.20 78.2% | ||
| 15 | 16 c p 121584.20 76.6% | ||
| 16 | 4 c i 118116.00 74.4% | ||
| 17 | 4 r2 p 117977.90 74.4% | ||
| 18 | 4 c p 114971.40 72.5% | ||
| 19 | 4 r1 p 114578.40 72.2% | ||
| 20 | -DDES_UNROLL -DDES_RISC1 -DDES_PTR | ||
diff --git a/src/lib/libcrypto/des/times/686-200.fre b/src/lib/libcrypto/des/times/686-200.fre new file mode 100644 index 0000000000..7d83f6adee --- /dev/null +++ b/src/lib/libcrypto/des/times/686-200.fre | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | Pentium 100 | ||
| 2 | Free BSD 2.1.5 kernel | ||
| 3 | gcc 2.7.2.2 -O3 -fomit-frame-pointer | ||
| 4 | options des ecb/s | ||
| 5 | assember 578000.00 133.1% | ||
| 6 | 16 r2 i 434454.80 100.0% | ||
| 7 | 16 r1 i 433621.43 99.8% | ||
| 8 | 16 r2 p 431375.69 99.3% | ||
| 9 | 4 r1 i 423722.30 97.5% | ||
| 10 | 4 r2 i 422399.40 97.2% | ||
| 11 | 16 r1 p 421739.40 97.1% | ||
| 12 | 16 c i 399027.94 91.8% | ||
| 13 | 16 c p 372251.70 85.7% | ||
| 14 | 4 c i 365118.35 84.0% | ||
| 15 | 4 c p 352880.51 81.2% | ||
| 16 | 4 r2 p 255104.90 58.7% | ||
| 17 | 4 r1 p 251289.18 57.8% | ||
| 18 | -DDES_UNROLL -DDES_RISC2 | ||
diff --git a/src/lib/libcrypto/des/times/aix.cc b/src/lib/libcrypto/des/times/aix.cc new file mode 100644 index 0000000000..d96b74e2ce --- /dev/null +++ b/src/lib/libcrypto/des/times/aix.cc | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | From: Paco Garcia <pgarcia@cam.es> | ||
| 2 | |||
| 3 | This machine is a Bull Estrella Minitower Model MT604-100 | ||
| 4 | Processor : PPC604 | ||
| 5 | P.Speed : 100Mhz | ||
| 6 | Data/Instr Cache : 16 K | ||
| 7 | L2 Cache : 256 K | ||
| 8 | PCI BUS Speed : 33 Mhz | ||
| 9 | TransfRate PCI : 132 MB/s | ||
| 10 | Memory : 96 MB | ||
| 11 | |||
| 12 | options des ecb/s | ||
| 13 | 4 c p 275118.61 100.0% | ||
| 14 | 4 c i 273545.07 99.4% | ||
| 15 | 4 r2 p 270441.02 98.3% | ||
| 16 | 4 r1 p 253052.15 92.0% | ||
| 17 | 4 r2 i 240842.97 87.5% | ||
| 18 | 4 r1 i 240556.66 87.4% | ||
| 19 | 16 c i 224603.99 81.6% | ||
| 20 | 16 c p 224483.98 81.6% | ||
| 21 | 16 r2 p 215691.19 78.4% | ||
| 22 | 16 r1 p 208332.83 75.7% | ||
| 23 | 16 r1 i 199206.50 72.4% | ||
| 24 | 16 r2 i 198963.70 72.3% | ||
| 25 | -DDES_PTR | ||
| 26 | |||
diff --git a/src/lib/libcrypto/des/times/alpha.cc b/src/lib/libcrypto/des/times/alpha.cc new file mode 100644 index 0000000000..95c17efae7 --- /dev/null +++ b/src/lib/libcrypto/des/times/alpha.cc | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | cc -O2 | ||
| 2 | DES_LONG is 'unsigned int' | ||
| 3 | |||
| 4 | options des ecb/s | ||
| 5 | 4 r2 p 181146.14 100.0% | ||
| 6 | 16 r2 p 172102.94 95.0% | ||
| 7 | 4 r2 i 165424.11 91.3% | ||
| 8 | 16 c p 160468.64 88.6% | ||
| 9 | 4 c p 156653.59 86.5% | ||
| 10 | 4 c i 155245.18 85.7% | ||
| 11 | 4 r1 p 154729.68 85.4% | ||
| 12 | 16 r2 i 154137.69 85.1% | ||
| 13 | 16 r1 p 152357.96 84.1% | ||
| 14 | 16 c i 148743.91 82.1% | ||
| 15 | 4 r1 i 146695.59 81.0% | ||
| 16 | 16 r1 i 144961.00 80.0% | ||
| 17 | -DDES_RISC2 -DDES_PTR | ||
| 18 | |||
diff --git a/src/lib/libcrypto/des/times/hpux.cc b/src/lib/libcrypto/des/times/hpux.cc new file mode 100644 index 0000000000..3de856ddac --- /dev/null +++ b/src/lib/libcrypto/des/times/hpux.cc | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | HPUX 10 - 9000/887 - cc -D_HPUX_SOURCE -Aa +ESlit +O2 -Wl,-a,archive | ||
| 2 | |||
| 3 | options des ecb/s | ||
| 4 | 16 c i 149448.90 100.0% | ||
| 5 | 4 c i 145861.79 97.6% | ||
| 6 | 16 r2 i 141710.96 94.8% | ||
| 7 | 16 r1 i 139455.33 93.3% | ||
| 8 | 4 r2 i 138800.00 92.9% | ||
| 9 | 4 r1 i 136692.65 91.5% | ||
| 10 | 16 r2 p 110228.17 73.8% | ||
| 11 | 16 r1 p 109397.07 73.2% | ||
| 12 | 16 c p 109209.89 73.1% | ||
| 13 | 4 c p 108014.71 72.3% | ||
| 14 | 4 r2 p 107873.88 72.2% | ||
| 15 | 4 r1 p 107685.83 72.1% | ||
| 16 | -DDES_UNROLL | ||
| 17 | |||
diff --git a/src/lib/libcrypto/des/times/sparc.gcc b/src/lib/libcrypto/des/times/sparc.gcc new file mode 100644 index 0000000000..8eaa042104 --- /dev/null +++ b/src/lib/libcrypto/des/times/sparc.gcc | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | solaris 2.5.1 - sparc 10 50mhz - gcc 2.7.2 | ||
| 2 | |||
| 3 | options des ecb/s | ||
| 4 | 16 c i 124382.70 100.0% | ||
| 5 | 4 c i 118884.68 95.6% | ||
| 6 | 16 c p 112261.20 90.3% | ||
| 7 | 16 r2 i 111777.10 89.9% | ||
| 8 | 16 r2 p 108896.30 87.5% | ||
| 9 | 16 r1 p 108791.59 87.5% | ||
| 10 | 4 c p 107290.10 86.3% | ||
| 11 | 4 r1 p 104583.80 84.1% | ||
| 12 | 16 r1 i 104206.20 83.8% | ||
| 13 | 4 r2 p 103709.80 83.4% | ||
| 14 | 4 r2 i 98306.43 79.0% | ||
| 15 | 4 r1 i 91525.80 73.6% | ||
| 16 | -DDES_UNROLL | ||
| 17 | |||
diff --git a/src/lib/libcrypto/des/times/usparc.cc b/src/lib/libcrypto/des/times/usparc.cc new file mode 100644 index 0000000000..0864285ef6 --- /dev/null +++ b/src/lib/libcrypto/des/times/usparc.cc | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | solaris 2.5.1 usparc 167mhz?? - SC4.0 cc -fast -Xa -xO5 | ||
| 2 | |||
| 3 | For the ultra sparc, SunC 4.0 cc -fast -Xa -xO5, running 'des_opts' | ||
| 4 | gives a speed of 475,000 des/s while 'speed' gives 417,000 des/s. | ||
| 5 | I believe the difference is tied up in optimisation that the compiler | ||
| 6 | is able to perform when the code is 'inlined'. For 'speed', the DES | ||
| 7 | routines are being linked from a library. I'll record the higher | ||
| 8 | speed since if performance is everything, you can always inline | ||
| 9 | 'des_enc.c'. | ||
| 10 | |||
| 11 | [ 16-Jan-06 - I've been playing with the | ||
| 12 | '-xtarget=ultra -xarch=v8plus -Xa -xO5 -Xa' | ||
| 13 | and while it makes the des_opts numbers much slower, it makes the | ||
| 14 | actual 'speed' numbers look better which is a realistic version of | ||
| 15 | using the libraries. ] | ||
| 16 | |||
| 17 | options des ecb/s | ||
| 18 | 16 r1 p 475516.90 100.0% | ||
| 19 | 16 r2 p 439388.10 92.4% | ||
| 20 | 16 c i 427001.40 89.8% | ||
| 21 | 16 c p 419516.50 88.2% | ||
| 22 | 4 r2 p 409491.70 86.1% | ||
| 23 | 4 r1 p 404266.90 85.0% | ||
| 24 | 4 c p 398121.00 83.7% | ||
| 25 | 4 c i 370588.40 77.9% | ||
| 26 | 4 r1 i 362742.20 76.3% | ||
| 27 | 16 r2 i 331275.50 69.7% | ||
| 28 | 16 r1 i 324730.60 68.3% | ||
| 29 | 4 r2 i 63535.10 13.4% <-- very very weird, must be cache problems. | ||
| 30 | -DDES_UNROLL -DDES_RISC1 -DDES_PTR | ||
| 31 | |||
diff --git a/src/lib/libcrypto/des/typemap b/src/lib/libcrypto/des/typemap new file mode 100644 index 0000000000..a524f53634 --- /dev/null +++ b/src/lib/libcrypto/des/typemap | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | # | ||
| 2 | # DES SECTION | ||
| 3 | # | ||
| 4 | deschar * T_DESCHARP | ||
| 5 | des_cblock * T_CBLOCK | ||
| 6 | des_cblock T_CBLOCK | ||
| 7 | des_key_schedule T_SCHEDULE | ||
| 8 | des_key_schedule * T_SCHEDULE | ||
| 9 | |||
| 10 | INPUT | ||
| 11 | T_CBLOCK | ||
| 12 | $var=(des_cblock *)SvPV($arg,len); | ||
| 13 | if (len < DES_KEY_SZ) | ||
| 14 | { | ||
| 15 | croak(\"$var needs to be at least %u bytes long\",DES_KEY_SZ); | ||
| 16 | } | ||
| 17 | |||
| 18 | T_SCHEDULE | ||
| 19 | $var=(des_key_schedule *)SvPV($arg,len); | ||
| 20 | if (len < DES_SCHEDULE_SZ) | ||
| 21 | { | ||
| 22 | croak(\"$var needs to be at least %u bytes long\", | ||
| 23 | DES_SCHEDULE_SZ); | ||
| 24 | } | ||
| 25 | |||
| 26 | OUTPUT | ||
| 27 | T_CBLOCK | ||
| 28 | sv_setpvn($arg,(char *)$var,DES_KEY_SZ); | ||
| 29 | |||
| 30 | T_SCHEDULE | ||
| 31 | sv_setpvn($arg,(char *)$var,DES_SCHEDULE_SZ); | ||
| 32 | |||
| 33 | T_DESCHARP | ||
| 34 | sv_setpvn($arg,(char *)$var,len); | ||
diff --git a/src/lib/libcrypto/dh/Makefile b/src/lib/libcrypto/dh/Makefile new file mode 100644 index 0000000000..f23b4f7fde --- /dev/null +++ b/src/lib/libcrypto/dh/Makefile | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/dh/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= dh | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= dhtest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= dh_asn1.c dh_gen.c dh_key.c dh_lib.c dh_check.c dh_err.c dh_depr.c \ | ||
| 21 | dh_ameth.c dh_pmeth.c dh_prn.c | ||
| 22 | LIBOBJ= dh_asn1.o dh_gen.o dh_key.o dh_lib.o dh_check.o dh_err.o dh_depr.o \ | ||
| 23 | dh_ameth.o dh_pmeth.o dh_prn.o | ||
| 24 | |||
| 25 | SRC= $(LIBSRC) | ||
| 26 | |||
| 27 | EXHEADER= dh.h | ||
| 28 | HEADER= $(EXHEADER) | ||
| 29 | |||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 31 | |||
| 32 | top: | ||
| 33 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 34 | |||
| 35 | all: lib | ||
| 36 | |||
| 37 | lib: $(LIBOBJ) | ||
| 38 | $(AR) $(LIB) $(LIBOBJ) | ||
| 39 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 40 | @touch lib | ||
| 41 | |||
| 42 | files: | ||
| 43 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 44 | |||
| 45 | links: | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 49 | |||
| 50 | install: | ||
| 51 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 52 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 53 | do \ | ||
| 54 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 55 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 56 | done; | ||
| 57 | |||
| 58 | tags: | ||
| 59 | ctags $(SRC) | ||
| 60 | |||
| 61 | tests: | ||
| 62 | |||
| 63 | lint: | ||
| 64 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 65 | |||
| 66 | depend: | ||
| 67 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 68 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 69 | |||
| 70 | dclean: | ||
| 71 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 72 | mv -f Makefile.new $(MAKEFILE) | ||
| 73 | |||
| 74 | clean: | ||
| 75 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 76 | |||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 78 | |||
| 79 | dh_ameth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 80 | dh_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 81 | dh_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 82 | dh_ameth.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 83 | dh_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 84 | dh_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 85 | dh_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 86 | dh_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 87 | dh_ameth.o: ../../include/openssl/opensslconf.h | ||
| 88 | dh_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 89 | dh_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 90 | dh_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 91 | dh_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 92 | dh_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 93 | dh_ameth.o: dh_ameth.c | ||
| 94 | dh_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 95 | dh_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 96 | dh_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 97 | dh_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 98 | dh_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 99 | dh_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 100 | dh_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 101 | dh_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 102 | dh_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 103 | dh_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_asn1.c | ||
| 104 | dh_check.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 105 | dh_check.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 106 | dh_check.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 107 | dh_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 108 | dh_check.o: ../../include/openssl/opensslconf.h | ||
| 109 | dh_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 110 | dh_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 111 | dh_check.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_check.c | ||
| 112 | dh_depr.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 113 | dh_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 114 | dh_depr.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 115 | dh_depr.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 116 | dh_depr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 117 | dh_depr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 118 | dh_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 119 | dh_depr.o: ../cryptlib.h dh_depr.c | ||
| 120 | dh_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 121 | dh_err.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 122 | dh_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 123 | dh_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 124 | dh_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 125 | dh_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 126 | dh_err.o: dh_err.c | ||
| 127 | dh_gen.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 128 | dh_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 129 | dh_gen.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 130 | dh_gen.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 131 | dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 132 | dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 133 | dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 134 | dh_gen.o: ../cryptlib.h dh_gen.c | ||
| 135 | dh_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 136 | dh_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 137 | dh_key.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 138 | dh_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 139 | dh_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 140 | dh_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 141 | dh_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 142 | dh_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_key.c | ||
| 143 | dh_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 144 | dh_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 145 | dh_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 146 | dh_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 147 | dh_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 148 | dh_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 149 | dh_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 150 | dh_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 151 | dh_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 152 | dh_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 153 | dh_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 154 | dh_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 155 | dh_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 156 | dh_lib.o: ../cryptlib.h dh_lib.c | ||
| 157 | dh_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 158 | dh_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 159 | dh_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 160 | dh_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 161 | dh_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 162 | dh_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 163 | dh_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 164 | dh_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 165 | dh_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 166 | dh_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 167 | dh_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 168 | dh_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 169 | dh_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 170 | dh_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h | ||
| 171 | dh_pmeth.o: dh_pmeth.c | ||
| 172 | dh_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 173 | dh_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 174 | dh_prn.o: ../../include/openssl/dh.h ../../include/openssl/e_os2.h | ||
| 175 | dh_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 176 | dh_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 177 | dh_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 178 | dh_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 179 | dh_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 180 | dh_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h dh_prn.c | ||
diff --git a/src/lib/libcrypto/dh/dh1024.pem b/src/lib/libcrypto/dh/dh1024.pem new file mode 100644 index 0000000000..81d43f6a3e --- /dev/null +++ b/src/lib/libcrypto/dh/dh1024.pem | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | -----BEGIN DH PARAMETERS----- | ||
| 2 | MIGHAoGBAJf2QmHKtQXdKCjhPx1ottPb0PMTBH9A6FbaWMsTuKG/K3g6TG1Z1fkq | ||
| 3 | /Gz/PWk/eLI9TzFgqVAuPvr3q14a1aZeVUMTgo2oO5/y2UHe6VaJ+trqCTat3xlx | ||
| 4 | /mNbIK9HA2RgPC3gWfVLZQrY+gz3ASHHR5nXWHEyvpuZm7m3h+irAgEC | ||
| 5 | -----END DH PARAMETERS----- | ||
diff --git a/src/lib/libcrypto/dh/dh192.pem b/src/lib/libcrypto/dh/dh192.pem new file mode 100644 index 0000000000..521c07271d --- /dev/null +++ b/src/lib/libcrypto/dh/dh192.pem | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | -----BEGIN DH PARAMETERS----- | ||
| 2 | MB4CGQDUoLoCULb9LsYm5+/WN992xxbiLQlEuIsCAQM= | ||
| 3 | -----END DH PARAMETERS----- | ||
diff --git a/src/lib/libcrypto/dh/dh2048.pem b/src/lib/libcrypto/dh/dh2048.pem new file mode 100644 index 0000000000..295460f508 --- /dev/null +++ b/src/lib/libcrypto/dh/dh2048.pem | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | -----BEGIN DH PARAMETERS----- | ||
| 2 | MIIBCAKCAQEA7ZKJNYJFVcs7+6J2WmkEYb8h86tT0s0h2v94GRFS8Q7B4lW9aG9o | ||
| 3 | AFO5Imov5Jo0H2XMWTKKvbHbSe3fpxJmw/0hBHAY8H/W91hRGXKCeyKpNBgdL8sh | ||
| 4 | z22SrkO2qCnHJ6PLAMXy5fsKpFmFor2tRfCzrfnggTXu2YOzzK7q62bmqVdmufEo | ||
| 5 | pT8igNcLpvZxk5uBDvhakObMym9mX3rAEBoe8PwttggMYiiw7NuJKO4MqD1llGkW | ||
| 6 | aVM8U2ATsCun1IKHrRxynkE1/MJ86VHeYYX8GZt2YA8z+GuzylIOKcMH6JAWzMwA | ||
| 7 | Gbatw6QwizOhr9iMjZ0B26TE3X8LvW84wwIBAg== | ||
| 8 | -----END DH PARAMETERS----- | ||
| 9 | -----BEGIN DH PARAMETERS----- | ||
| 10 | MIIBCAKCAQEArtA3w73zP6Lu3EOQtwogiXt3AXXpuS6yD4BhzNS1pZFyPHk0/an5 | ||
| 11 | 8ydEkPhQZHKDW+BZJxxPLANaTudWo2YT8TgtvUdN6KSgMiEi6McwqDw+SADuvW+F | ||
| 12 | SKUYFxG6VFIxyEP6xBdf+vhJxEDbRG2EYsHDRRtJ76gp9cSKTHusf2R+4AAVGqnt | ||
| 13 | gRAbNqtcOar/7FSj+Pl8G3v0Bty0LcCSpbqgYlnv6z+rErQmmC6PPvSz97TDMCok | ||
| 14 | yKpCE9hFA1zkqK3TH4FmFvGeIaXJUIBZf4mArWuBTjWFW3nmhESRUn1VK3K3x42N | ||
| 15 | a5k6c2+EhrMFiLjxuH6JZoqL0/E93FF9SwIBAg== | ||
| 16 | -----END DH PARAMETERS----- | ||
diff --git a/src/lib/libcrypto/dh/dh4096.pem b/src/lib/libcrypto/dh/dh4096.pem new file mode 100644 index 0000000000..390943a21d --- /dev/null +++ b/src/lib/libcrypto/dh/dh4096.pem | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | -----BEGIN DH PARAMETERS----- | ||
| 2 | MIICCAKCAgEA/urRnb6vkPYc/KEGXWnbCIOaKitq7ySIq9dTH7s+Ri59zs77zty7 | ||
| 3 | vfVlSe6VFTBWgYjD2XKUFmtqq6CqXMhVX5ElUDoYDpAyTH85xqNFLzFC7nKrff/H | ||
| 4 | TFKNttp22cZE9V0IPpzedPfnQkE7aUdmF9JnDyv21Z/818O93u1B4r0szdnmEvEF | ||
| 5 | bKuIxEHX+bp0ZR7RqE1AeifXGJX3d6tsd2PMAObxwwsv55RGkn50vHO4QxtTARr1 | ||
| 6 | rRUV5j3B3oPMgC7Offxx+98Xn45B1/G0Prp11anDsR1PGwtaCYipqsvMwQUSJtyE | ||
| 7 | EOQWk+yFkeMe4vWv367eEi0Sd/wnC+TSXBE3pYvpYerJ8n1MceI5GQTdarJ77OW9 | ||
| 8 | bGTHmxRsLSCM1jpLdPja5jjb4siAa6EHc4qN9c/iFKS3PQPJEnX7pXKBRs5f7AF3 | ||
| 9 | W3RIGt+G9IVNZfXaS7Z/iCpgzgvKCs0VeqN38QsJGtC1aIkwOeyjPNy2G6jJ4yqH | ||
| 10 | ovXYt/0mc00vCWeSNS1wren0pR2EiLxX0ypjjgsU1mk/Z3b/+zVf7fZSIB+nDLjb | ||
| 11 | NPtUlJCVGnAeBK1J1nG3TQicqowOXoM6ISkdaXj5GPJdXHab2+S7cqhKGv5qC7rR | ||
| 12 | jT6sx7RUr0CNTxzLI7muV2/a4tGmj0PSdXQdsZ7tw7gbXlaWT1+MM2MCAQI= | ||
| 13 | -----END DH PARAMETERS----- | ||
| 14 | |||
diff --git a/src/lib/libcrypto/dh/dh512.pem b/src/lib/libcrypto/dh/dh512.pem new file mode 100644 index 0000000000..0a4d863ebe --- /dev/null +++ b/src/lib/libcrypto/dh/dh512.pem | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | -----BEGIN DH PARAMETERS----- | ||
| 2 | MEYCQQDaWDwW2YUiidDkr3VvTMqS3UvlM7gE+w/tlO+cikQD7VdGUNNpmdsp13Yn | ||
| 3 | a6LT1BLiGPTdHghM9tgAPnxHdOgzAgEC | ||
| 4 | -----END DH PARAMETERS----- | ||
diff --git a/src/lib/libcrypto/dh/dhtest.c b/src/lib/libcrypto/dh/dhtest.c new file mode 100644 index 0000000000..882f5c310a --- /dev/null +++ b/src/lib/libcrypto/dh/dhtest.c | |||
| @@ -0,0 +1,226 @@ | |||
| 1 | /* crypto/dh/dhtest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Until the key-gen callbacks are modified to use newer prototypes, we allow | ||
| 60 | * deprecated functions for openssl-internal code */ | ||
| 61 | #ifdef OPENSSL_NO_DEPRECATED | ||
| 62 | #undef OPENSSL_NO_DEPRECATED | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #include <stdio.h> | ||
| 66 | #include <stdlib.h> | ||
| 67 | #include <string.h> | ||
| 68 | |||
| 69 | #include "../e_os.h" | ||
| 70 | |||
| 71 | #include <openssl/crypto.h> | ||
| 72 | #include <openssl/bio.h> | ||
| 73 | #include <openssl/bn.h> | ||
| 74 | #include <openssl/rand.h> | ||
| 75 | #include <openssl/err.h> | ||
| 76 | |||
| 77 | #ifdef OPENSSL_NO_DH | ||
| 78 | int main(int argc, char *argv[]) | ||
| 79 | { | ||
| 80 | printf("No DH support\n"); | ||
| 81 | return(0); | ||
| 82 | } | ||
| 83 | #else | ||
| 84 | #include <openssl/dh.h> | ||
| 85 | |||
| 86 | #ifdef OPENSSL_SYS_WIN16 | ||
| 87 | #define MS_CALLBACK _far _loadds | ||
| 88 | #else | ||
| 89 | #define MS_CALLBACK | ||
| 90 | #endif | ||
| 91 | |||
| 92 | static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg); | ||
| 93 | |||
| 94 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 95 | |||
| 96 | int main(int argc, char *argv[]) | ||
| 97 | { | ||
| 98 | BN_GENCB _cb; | ||
| 99 | DH *a; | ||
| 100 | DH *b=NULL; | ||
| 101 | char buf[12]; | ||
| 102 | unsigned char *abuf=NULL,*bbuf=NULL; | ||
| 103 | int i,alen,blen,aout,bout,ret=1; | ||
| 104 | BIO *out; | ||
| 105 | |||
| 106 | CRYPTO_malloc_debug_init(); | ||
| 107 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
| 108 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 109 | |||
| 110 | #ifdef OPENSSL_SYS_WIN32 | ||
| 111 | CRYPTO_malloc_init(); | ||
| 112 | #endif | ||
| 113 | |||
| 114 | RAND_seed(rnd_seed, sizeof rnd_seed); | ||
| 115 | |||
| 116 | out=BIO_new(BIO_s_file()); | ||
| 117 | if (out == NULL) EXIT(1); | ||
| 118 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | ||
| 119 | |||
| 120 | BN_GENCB_set(&_cb, &cb, out); | ||
| 121 | if(((a = DH_new()) == NULL) || !DH_generate_parameters_ex(a, 64, | ||
| 122 | DH_GENERATOR_5, &_cb)) | ||
| 123 | goto err; | ||
| 124 | |||
| 125 | if (!DH_check(a, &i)) goto err; | ||
| 126 | if (i & DH_CHECK_P_NOT_PRIME) | ||
| 127 | BIO_puts(out, "p value is not prime\n"); | ||
| 128 | if (i & DH_CHECK_P_NOT_SAFE_PRIME) | ||
| 129 | BIO_puts(out, "p value is not a safe prime\n"); | ||
| 130 | if (i & DH_UNABLE_TO_CHECK_GENERATOR) | ||
| 131 | BIO_puts(out, "unable to check the generator value\n"); | ||
| 132 | if (i & DH_NOT_SUITABLE_GENERATOR) | ||
| 133 | BIO_puts(out, "the g value is not a generator\n"); | ||
| 134 | |||
| 135 | BIO_puts(out,"\np ="); | ||
| 136 | BN_print(out,a->p); | ||
| 137 | BIO_puts(out,"\ng ="); | ||
| 138 | BN_print(out,a->g); | ||
| 139 | BIO_puts(out,"\n"); | ||
| 140 | |||
| 141 | b=DH_new(); | ||
| 142 | if (b == NULL) goto err; | ||
| 143 | |||
| 144 | b->p=BN_dup(a->p); | ||
| 145 | b->g=BN_dup(a->g); | ||
| 146 | if ((b->p == NULL) || (b->g == NULL)) goto err; | ||
| 147 | |||
| 148 | /* Set a to run with normal modexp and b to use constant time */ | ||
| 149 | a->flags &= ~DH_FLAG_NO_EXP_CONSTTIME; | ||
| 150 | b->flags |= DH_FLAG_NO_EXP_CONSTTIME; | ||
| 151 | |||
| 152 | if (!DH_generate_key(a)) goto err; | ||
| 153 | BIO_puts(out,"pri 1="); | ||
| 154 | BN_print(out,a->priv_key); | ||
| 155 | BIO_puts(out,"\npub 1="); | ||
| 156 | BN_print(out,a->pub_key); | ||
| 157 | BIO_puts(out,"\n"); | ||
| 158 | |||
| 159 | if (!DH_generate_key(b)) goto err; | ||
| 160 | BIO_puts(out,"pri 2="); | ||
| 161 | BN_print(out,b->priv_key); | ||
| 162 | BIO_puts(out,"\npub 2="); | ||
| 163 | BN_print(out,b->pub_key); | ||
| 164 | BIO_puts(out,"\n"); | ||
| 165 | |||
| 166 | alen=DH_size(a); | ||
| 167 | abuf=(unsigned char *)OPENSSL_malloc(alen); | ||
| 168 | aout=DH_compute_key(abuf,b->pub_key,a); | ||
| 169 | |||
| 170 | BIO_puts(out,"key1 ="); | ||
| 171 | for (i=0; i<aout; i++) | ||
| 172 | { | ||
| 173 | sprintf(buf,"%02X",abuf[i]); | ||
| 174 | BIO_puts(out,buf); | ||
| 175 | } | ||
| 176 | BIO_puts(out,"\n"); | ||
| 177 | |||
| 178 | blen=DH_size(b); | ||
| 179 | bbuf=(unsigned char *)OPENSSL_malloc(blen); | ||
| 180 | bout=DH_compute_key(bbuf,a->pub_key,b); | ||
| 181 | |||
| 182 | BIO_puts(out,"key2 ="); | ||
| 183 | for (i=0; i<bout; i++) | ||
| 184 | { | ||
| 185 | sprintf(buf,"%02X",bbuf[i]); | ||
| 186 | BIO_puts(out,buf); | ||
| 187 | } | ||
| 188 | BIO_puts(out,"\n"); | ||
| 189 | if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0)) | ||
| 190 | { | ||
| 191 | fprintf(stderr,"Error in DH routines\n"); | ||
| 192 | ret=1; | ||
| 193 | } | ||
| 194 | else | ||
| 195 | ret=0; | ||
| 196 | err: | ||
| 197 | ERR_print_errors_fp(stderr); | ||
| 198 | |||
| 199 | if (abuf != NULL) OPENSSL_free(abuf); | ||
| 200 | if (bbuf != NULL) OPENSSL_free(bbuf); | ||
| 201 | if(b != NULL) DH_free(b); | ||
| 202 | if(a != NULL) DH_free(a); | ||
| 203 | BIO_free(out); | ||
| 204 | #ifdef OPENSSL_SYS_NETWARE | ||
| 205 | if (ret) printf("ERROR: %d\n", ret); | ||
| 206 | #endif | ||
| 207 | EXIT(ret); | ||
| 208 | return(ret); | ||
| 209 | } | ||
| 210 | |||
| 211 | static int MS_CALLBACK cb(int p, int n, BN_GENCB *arg) | ||
| 212 | { | ||
| 213 | char c='*'; | ||
| 214 | |||
| 215 | if (p == 0) c='.'; | ||
| 216 | if (p == 1) c='+'; | ||
| 217 | if (p == 2) c='*'; | ||
| 218 | if (p == 3) c='\n'; | ||
| 219 | BIO_write(arg->arg,&c,1); | ||
| 220 | (void)BIO_flush(arg->arg); | ||
| 221 | #ifdef LINT | ||
| 222 | p=n; | ||
| 223 | #endif | ||
| 224 | return 1; | ||
| 225 | } | ||
| 226 | #endif | ||
diff --git a/src/lib/libcrypto/dh/example b/src/lib/libcrypto/dh/example new file mode 100644 index 0000000000..16a33d2910 --- /dev/null +++ b/src/lib/libcrypto/dh/example | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From owner-cypherpunks@toad.com Mon Sep 25 10:50:51 1995 | ||
| 2 | Received: from minbne.mincom.oz.au by orb.mincom.oz.au with SMTP id AA10562 | ||
| 3 | (5.65c/IDA-1.4.4 for eay); Wed, 27 Sep 1995 19:41:55 +1000 | ||
| 4 | Received: by minbne.mincom.oz.au id AA19958 | ||
| 5 | (5.65c/IDA-1.4.4 for eay@orb.mincom.oz.au); Wed, 27 Sep 1995 19:34:59 +1000 | ||
| 6 | Received: from relay3.UU.NET by bunyip.cc.uq.oz.au with SMTP (PP); | ||
| 7 | Wed, 27 Sep 1995 19:13:05 +1000 | ||
| 8 | Received: from toad.com by relay3.UU.NET with SMTP id QQzizb16156; | ||
| 9 | Wed, 27 Sep 1995 04:48:46 -0400 | ||
| 10 | Received: by toad.com id AA07905; Tue, 26 Sep 95 06:31:45 PDT | ||
| 11 | Received: from by toad.com id AB07851; Tue, 26 Sep 95 06:31:40 PDT | ||
| 12 | Received: from servo.qualcomm.com (servo.qualcomm.com [129.46.128.14]) | ||
| 13 | by cygnus.com (8.6.12/8.6.9) with ESMTP id RAA18442 | ||
| 14 | for <cypherpunks@toad.com>; Mon, 25 Sep 1995 17:52:47 -0700 | ||
| 15 | Received: (karn@localhost) by servo.qualcomm.com (8.6.12/QC-BSD-2.5.1) | ||
| 16 | id RAA14732; Mon, 25 Sep 1995 17:50:51 -0700 | ||
| 17 | Date: Mon, 25 Sep 1995 17:50:51 -0700 | ||
| 18 | From: Phil Karn <karn@qualcomm.com> | ||
| 19 | Message-Id: <199509260050.RAA14732@servo.qualcomm.com> | ||
| 20 | To: cypherpunks@toad.com, ipsec-dev@eit.com | ||
| 21 | Subject: Primality verification needed | ||
| 22 | Sender: owner-cypherpunks@toad.com | ||
| 23 | Precedence: bulk | ||
| 24 | Status: RO | ||
| 25 | X-Status: | ||
| 26 | |||
| 27 | Hi. I've generated a 2047-bit "strong" prime number that I would like to | ||
| 28 | use with Diffie-Hellman key exchange. I assert that not only is this number | ||
| 29 | 'p' prime, but so is (p-1)/2. | ||
| 30 | |||
| 31 | I've used the mpz_probab_prime() function in the Gnu Math Package (GMP) version | ||
| 32 | 1.3.2 to test this number. This function uses the Miller-Rabin primality test. | ||
| 33 | However, to increase my confidence that this number really is a strong prime, | ||
| 34 | I'd like to ask others to confirm it with other tests. Here's the number in hex: | ||
| 35 | |||
| 36 | 72a925f760b2f954ed287f1b0953f3e6aef92e456172f9fe86fdd8822241b9c9788fbc289982743e | ||
| 37 | fbcd2ccf062b242d7a567ba8bbb40d79bca7b8e0b6c05f835a5b938d985816bc648985adcff5402a | ||
| 38 | a76756b36c845a840a1d059ce02707e19cf47af0b5a882f32315c19d1b86a56c5389c5e9bee16b65 | ||
| 39 | fde7b1a8d74a7675de9b707d4c5a4633c0290c95ff30a605aeb7ae864ff48370f13cf01d49adb9f2 | ||
| 40 | 3d19a439f753ee7703cf342d87f431105c843c78ca4df639931f3458fae8a94d1687e99a76ed99d0 | ||
| 41 | ba87189f42fd31ad8262c54a8cf5914ae6c28c540d714a5f6087a171fb74f4814c6f968d72386ef3 | ||
| 42 | 56a05180c3bec7ddd5ef6fe76b1f717b | ||
| 43 | |||
| 44 | The generator, g, for this prime is 2. | ||
| 45 | |||
| 46 | Thanks! | ||
| 47 | |||
| 48 | Phil Karn | ||
| 49 | |||
| 50 | |||
diff --git a/src/lib/libcrypto/dh/generate b/src/lib/libcrypto/dh/generate new file mode 100644 index 0000000000..5d407231df --- /dev/null +++ b/src/lib/libcrypto/dh/generate | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | From: stewarts@ix.netcom.com (Bill Stewart) | ||
| 2 | Newsgroups: sci.crypt | ||
| 3 | Subject: Re: Diffie-Hellman key exchange | ||
| 4 | Date: Wed, 11 Oct 1995 23:08:28 GMT | ||
| 5 | Organization: Freelance Information Architect | ||
| 6 | Lines: 32 | ||
| 7 | Message-ID: <45hir2$7l8@ixnews7.ix.netcom.com> | ||
| 8 | References: <458rhn$76m$1@mhadf.production.compuserve.com> | ||
| 9 | NNTP-Posting-Host: ix-pl4-16.ix.netcom.com | ||
| 10 | X-NETCOM-Date: Wed Oct 11 4:09:22 PM PDT 1995 | ||
| 11 | X-Newsreader: Forte Free Agent 1.0.82 | ||
| 12 | |||
| 13 | Kent Briggs <72124.3234@CompuServe.COM> wrote: | ||
| 14 | |||
| 15 | >I have a copy of the 1976 IEEE article describing the | ||
| 16 | >Diffie-Hellman public key exchange algorithm: y=a^x mod q. I'm | ||
| 17 | >looking for sources that give examples of secure a,q pairs and | ||
| 18 | >possible some source code that I could examine. | ||
| 19 | |||
| 20 | q should be prime, and ideally should be a "strong prime", | ||
| 21 | which means it's of the form 2n+1 where n is also prime. | ||
| 22 | q also needs to be long enough to prevent the attacks LaMacchia and | ||
| 23 | Odlyzko described (some variant on a factoring attack which generates | ||
| 24 | a large pile of simultaneous equations and then solves them); | ||
| 25 | long enough is about the same size as factoring, so 512 bits may not | ||
| 26 | be secure enough for most applications. (The 192 bits used by | ||
| 27 | "secure NFS" was certainly not long enough.) | ||
| 28 | |||
| 29 | a should be a generator for q, which means it needs to be | ||
| 30 | relatively prime to q-1. Usually a small prime like 2, 3 or 5 will | ||
| 31 | work. | ||
| 32 | |||
| 33 | .... | ||
| 34 | |||
| 35 | Date: Tue, 26 Sep 1995 13:52:36 MST | ||
| 36 | From: "Richard Schroeppel" <rcs@cs.arizona.edu> | ||
| 37 | To: karn | ||
| 38 | Cc: ho@cs.arizona.edu | ||
| 39 | Subject: random large primes | ||
| 40 | |||
| 41 | Since your prime is really random, proving it is hard. | ||
| 42 | My personal limit on rigorously proved primes is ~350 digits. | ||
| 43 | If you really want a proof, we should talk to Francois Morain, | ||
| 44 | or the Australian group. | ||
| 45 | |||
| 46 | If you want 2 to be a generator (mod P), then you need it | ||
| 47 | to be a non-square. If (P-1)/2 is also prime, then | ||
| 48 | non-square == primitive-root for bases << P. | ||
| 49 | |||
| 50 | In the case at hand, this means 2 is a generator iff P = 11 (mod 24). | ||
| 51 | If you want this, you should restrict your sieve accordingly. | ||
| 52 | |||
| 53 | 3 is a generator iff P = 5 (mod 12). | ||
| 54 | |||
| 55 | 5 is a generator iff P = 3 or 7 (mod 10). | ||
| 56 | |||
| 57 | 2 is perfectly usable as a base even if it's a non-generator, since | ||
| 58 | it still covers half the space of possible residues. And an | ||
| 59 | eavesdropper can always determine the low-bit of your exponent for | ||
| 60 | a generator anyway. | ||
| 61 | |||
| 62 | Rich rcs@cs.arizona.edu | ||
| 63 | |||
| 64 | |||
| 65 | |||
diff --git a/src/lib/libcrypto/dh/p1024.c b/src/lib/libcrypto/dh/p1024.c new file mode 100644 index 0000000000..368ceca4eb --- /dev/null +++ b/src/lib/libcrypto/dh/p1024.c | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /* crypto/dh/p1024.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/bn.h> | ||
| 61 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/dh.h> | ||
| 63 | #include <openssl/pem.h> | ||
| 64 | |||
| 65 | unsigned char data[]={0x97,0xF6,0x42,0x61,0xCA,0xB5,0x05,0xDD, | ||
| 66 | 0x28,0x28,0xE1,0x3F,0x1D,0x68,0xB6,0xD3, | ||
| 67 | 0xDB,0xD0,0xF3,0x13,0x04,0x7F,0x40,0xE8, | ||
| 68 | 0x56,0xDA,0x58,0xCB,0x13,0xB8,0xA1,0xBF, | ||
| 69 | 0x2B,0x78,0x3A,0x4C,0x6D,0x59,0xD5,0xF9, | ||
| 70 | 0x2A,0xFC,0x6C,0xFF,0x3D,0x69,0x3F,0x78, | ||
| 71 | 0xB2,0x3D,0x4F,0x31,0x60,0xA9,0x50,0x2E, | ||
| 72 | 0x3E,0xFA,0xF7,0xAB,0x5E,0x1A,0xD5,0xA6, | ||
| 73 | 0x5E,0x55,0x43,0x13,0x82,0x8D,0xA8,0x3B, | ||
| 74 | 0x9F,0xF2,0xD9,0x41,0xDE,0xE9,0x56,0x89, | ||
| 75 | 0xFA,0xDA,0xEA,0x09,0x36,0xAD,0xDF,0x19, | ||
| 76 | 0x71,0xFE,0x63,0x5B,0x20,0xAF,0x47,0x03, | ||
| 77 | 0x64,0x60,0x3C,0x2D,0xE0,0x59,0xF5,0x4B, | ||
| 78 | 0x65,0x0A,0xD8,0xFA,0x0C,0xF7,0x01,0x21, | ||
| 79 | 0xC7,0x47,0x99,0xD7,0x58,0x71,0x32,0xBE, | ||
| 80 | 0x9B,0x99,0x9B,0xB9,0xB7,0x87,0xE8,0xAB, | ||
| 81 | }; | ||
| 82 | |||
| 83 | main() | ||
| 84 | { | ||
| 85 | DH *dh; | ||
| 86 | |||
| 87 | dh=DH_new(); | ||
| 88 | dh->p=BN_bin2bn(data,sizeof(data),NULL); | ||
| 89 | dh->g=BN_new(); | ||
| 90 | BN_set_word(dh->g,2); | ||
| 91 | PEM_write_DHparams(stdout,dh); | ||
| 92 | } | ||
diff --git a/src/lib/libcrypto/dh/p192.c b/src/lib/libcrypto/dh/p192.c new file mode 100644 index 0000000000..7bdf40410e --- /dev/null +++ b/src/lib/libcrypto/dh/p192.c | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | /* crypto/dh/p192.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/bn.h> | ||
| 61 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/dh.h> | ||
| 63 | #include <openssl/pem.h> | ||
| 64 | |||
| 65 | unsigned char data[]={ | ||
| 66 | 0xD4,0xA0,0xBA,0x02,0x50,0xB6,0xFD,0x2E, | ||
| 67 | 0xC6,0x26,0xE7,0xEF,0xD6,0x37,0xDF,0x76, | ||
| 68 | 0xC7,0x16,0xE2,0x2D,0x09,0x44,0xB8,0x8B, | ||
| 69 | }; | ||
| 70 | |||
| 71 | main() | ||
| 72 | { | ||
| 73 | DH *dh; | ||
| 74 | |||
| 75 | dh=DH_new(); | ||
| 76 | dh->p=BN_bin2bn(data,sizeof(data),NULL); | ||
| 77 | dh->g=BN_new(); | ||
| 78 | BN_set_word(dh->g,3); | ||
| 79 | PEM_write_DHparams(stdout,dh); | ||
| 80 | } | ||
diff --git a/src/lib/libcrypto/dh/p512.c b/src/lib/libcrypto/dh/p512.c new file mode 100644 index 0000000000..a9b6aa83f0 --- /dev/null +++ b/src/lib/libcrypto/dh/p512.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* crypto/dh/p512.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/bn.h> | ||
| 61 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/dh.h> | ||
| 63 | #include <openssl/pem.h> | ||
| 64 | |||
| 65 | unsigned char data[]={ | ||
| 66 | 0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89, | ||
| 67 | 0xD0,0xE4,0xAF,0x75,0x6F,0x4C,0xCA,0x92, | ||
| 68 | 0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F, | ||
| 69 | 0xED,0x94,0xEF,0x9C,0x8A,0x44,0x03,0xED, | ||
| 70 | 0x57,0x46,0x50,0xD3,0x69,0x99,0xDB,0x29, | ||
| 71 | 0xD7,0x76,0x27,0x6B,0xA2,0xD3,0xD4,0x12, | ||
| 72 | 0xE2,0x18,0xF4,0xDD,0x1E,0x08,0x4C,0xF6, | ||
| 73 | 0xD8,0x00,0x3E,0x7C,0x47,0x74,0xE8,0x33, | ||
| 74 | }; | ||
| 75 | |||
| 76 | main() | ||
| 77 | { | ||
| 78 | DH *dh; | ||
| 79 | |||
| 80 | dh=DH_new(); | ||
| 81 | dh->p=BN_bin2bn(data,sizeof(data),NULL); | ||
| 82 | dh->g=BN_new(); | ||
| 83 | BN_set_word(dh->g,2); | ||
| 84 | PEM_write_DHparams(stdout,dh); | ||
| 85 | } | ||
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod index 5b477ac6ec..37a751b1c5 100644 --- a/src/lib/libcrypto/doc/EVP_DigestInit.pod +++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod | |||
| @@ -232,9 +232,9 @@ digest name passed on the command line. | |||
| 232 | 232 | ||
| 233 | =head1 SEE ALSO | 233 | =head1 SEE ALSO |
| 234 | 234 | ||
| 235 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | 235 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, |
| 236 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | 236 | L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD160(3)|RIPEMD160(3)>, |
| 237 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> | 237 | L<SHA1(3)|SHA1(3)> |
| 238 | 238 | ||
| 239 | =head1 HISTORY | 239 | =head1 HISTORY |
| 240 | 240 | ||
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod index 620a623ab6..781d43e401 100644 --- a/src/lib/libcrypto/doc/EVP_SignInit.pod +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod | |||
| @@ -89,10 +89,10 @@ The previous two bugs are fixed in the newer EVP_SignDigest*() function. | |||
| 89 | =head1 SEE ALSO | 89 | =head1 SEE ALSO |
| 90 | 90 | ||
| 91 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, | 91 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, |
| 92 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | 92 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, |
| 93 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | 93 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, |
| 94 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | 94 | L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD(3)|RIPEMD(3)>, |
| 95 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> | 95 | L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)> |
| 96 | 96 | ||
| 97 | =head1 HISTORY | 97 | =head1 HISTORY |
| 98 | 98 | ||
diff --git a/src/lib/libcrypto/doc/dsa.pod b/src/lib/libcrypto/doc/dsa.pod index da07d2b930..ae2e5d81f9 100644 --- a/src/lib/libcrypto/doc/dsa.pod +++ b/src/lib/libcrypto/doc/dsa.pod | |||
| @@ -101,8 +101,7 @@ Standard, DSS), ANSI X9.30 | |||
| 101 | =head1 SEE ALSO | 101 | =head1 SEE ALSO |
| 102 | 102 | ||
| 103 | L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | 103 | L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, |
| 104 | L<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<engine(3)|engine(3)>, | 104 | L<rsa(3)|rsa(3)>, L<SHA1(3)|SHA1(3)>, L<DSA_new(3)|DSA_new(3)>, |
| 105 | L<DSA_new(3)|DSA_new(3)>, | ||
| 106 | L<DSA_size(3)|DSA_size(3)>, | 105 | L<DSA_size(3)|DSA_size(3)>, |
| 107 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, | 106 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, |
| 108 | L<DSA_dup_DH(3)|DSA_dup_DH(3)>, | 107 | L<DSA_dup_DH(3)|DSA_dup_DH(3)>, |
diff --git a/src/lib/libcrypto/dsa/Makefile b/src/lib/libcrypto/dsa/Makefile new file mode 100644 index 0000000000..8073c4ecfe --- /dev/null +++ b/src/lib/libcrypto/dsa/Makefile | |||
| @@ -0,0 +1,208 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/dsa/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= dsa | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=dsatest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ | ||
| 21 | dsa_err.c dsa_ossl.c dsa_depr.c dsa_ameth.c dsa_pmeth.c dsa_prn.c | ||
| 22 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ | ||
| 23 | dsa_err.o dsa_ossl.o dsa_depr.o dsa_ameth.o dsa_pmeth.o dsa_prn.o | ||
| 24 | |||
| 25 | SRC= $(LIBSRC) | ||
| 26 | |||
| 27 | EXHEADER= dsa.h | ||
| 28 | HEADER= dsa_locl.h $(EXHEADER) | ||
| 29 | |||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 31 | |||
| 32 | top: | ||
| 33 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 34 | |||
| 35 | all: lib | ||
| 36 | |||
| 37 | lib: $(LIBOBJ) | ||
| 38 | $(AR) $(LIB) $(LIBOBJ) | ||
| 39 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 40 | @touch lib | ||
| 41 | |||
| 42 | files: | ||
| 43 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 44 | |||
| 45 | links: | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 49 | |||
| 50 | install: | ||
| 51 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 52 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 53 | do \ | ||
| 54 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 55 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 56 | done; | ||
| 57 | |||
| 58 | tags: | ||
| 59 | ctags $(SRC) | ||
| 60 | |||
| 61 | tests: | ||
| 62 | |||
| 63 | lint: | ||
| 64 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 65 | |||
| 66 | depend: | ||
| 67 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 68 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 69 | |||
| 70 | dclean: | ||
| 71 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 72 | mv -f Makefile.new $(MAKEFILE) | ||
| 73 | |||
| 74 | clean: | ||
| 75 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 76 | |||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 78 | |||
| 79 | dsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 80 | dsa_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 81 | dsa_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 82 | dsa_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 83 | dsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 84 | dsa_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 85 | dsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 86 | dsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 87 | dsa_ameth.o: ../../include/openssl/objects.h | ||
| 88 | dsa_ameth.o: ../../include/openssl/opensslconf.h | ||
| 89 | dsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 90 | dsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 91 | dsa_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 92 | dsa_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 93 | dsa_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 94 | dsa_ameth.o: dsa_ameth.c | ||
| 95 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 96 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 97 | dsa_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 98 | dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 99 | dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 100 | dsa_asn1.o: ../../include/openssl/opensslconf.h | ||
| 101 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 102 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 103 | dsa_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_asn1.c | ||
| 104 | dsa_depr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 105 | dsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 106 | dsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 107 | dsa_depr.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 108 | dsa_depr.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 109 | dsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 110 | dsa_depr.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 111 | dsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 112 | dsa_depr.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 113 | dsa_depr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 114 | dsa_depr.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_depr.c | ||
| 115 | dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 116 | dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 117 | dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 118 | dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 119 | dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 120 | dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 121 | dsa_err.o: dsa_err.c | ||
| 122 | dsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 123 | dsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 124 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 125 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 126 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 127 | dsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 128 | dsa_gen.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 129 | dsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 130 | dsa_gen.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 131 | dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 132 | dsa_gen.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_gen.c dsa_locl.h | ||
| 133 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 134 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 135 | dsa_key.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 136 | dsa_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 137 | dsa_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 138 | dsa_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 139 | dsa_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 140 | dsa_key.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_key.c | ||
| 141 | dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 142 | dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 143 | dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 144 | dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 145 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 146 | dsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 147 | dsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 148 | dsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 149 | dsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 150 | dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 151 | dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 152 | dsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 153 | dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 154 | dsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 155 | dsa_lib.o: ../cryptlib.h dsa_lib.c | ||
| 156 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 157 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 158 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 159 | dsa_ossl.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 160 | dsa_ossl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 161 | dsa_ossl.o: ../../include/openssl/opensslconf.h | ||
| 162 | dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 163 | dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 164 | dsa_ossl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 165 | dsa_ossl.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_ossl.c | ||
| 166 | dsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 167 | dsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 168 | dsa_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 169 | dsa_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 170 | dsa_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 171 | dsa_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 172 | dsa_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 173 | dsa_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 174 | dsa_pmeth.o: ../../include/openssl/objects.h | ||
| 175 | dsa_pmeth.o: ../../include/openssl/opensslconf.h | ||
| 176 | dsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 177 | dsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 178 | dsa_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 179 | dsa_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 180 | dsa_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h | ||
| 181 | dsa_pmeth.o: dsa_locl.h dsa_pmeth.c | ||
| 182 | dsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 183 | dsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 184 | dsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 185 | dsa_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 186 | dsa_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 187 | dsa_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 188 | dsa_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 189 | dsa_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 190 | dsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 191 | dsa_prn.o: ../cryptlib.h dsa_prn.c | ||
| 192 | dsa_sign.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 193 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 194 | dsa_sign.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 195 | dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 196 | dsa_sign.o: ../../include/openssl/opensslconf.h | ||
| 197 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 198 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 199 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 200 | dsa_sign.o: ../cryptlib.h dsa_sign.c | ||
| 201 | dsa_vrf.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 202 | dsa_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 203 | dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 204 | dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 205 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 206 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 207 | dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 208 | dsa_vrf.o: ../cryptlib.h dsa_vrf.c | ||
diff --git a/src/lib/libcrypto/dsa/README b/src/lib/libcrypto/dsa/README new file mode 100644 index 0000000000..6a7e9c170a --- /dev/null +++ b/src/lib/libcrypto/dsa/README | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | The stuff in here is based on patches supplied to me by | ||
| 2 | Steven Schoch <schoch@sheba.arc.nasa.gov> to do DSS. | ||
| 3 | I have since modified a them a little but a debt of gratitude | ||
| 4 | is due for doing the initial work. | ||
diff --git a/src/lib/libcrypto/dsa/dsa_gen.c b/src/lib/libcrypto/dsa/dsa_gen.c index cb0b4538a4..0fcd25f8b0 100644 --- a/src/lib/libcrypto/dsa/dsa_gen.c +++ b/src/lib/libcrypto/dsa/dsa_gen.c | |||
| @@ -120,7 +120,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, | |||
| 120 | BIGNUM *r0,*W,*X,*c,*test; | 120 | BIGNUM *r0,*W,*X,*c,*test; |
| 121 | BIGNUM *g=NULL,*q=NULL,*p=NULL; | 121 | BIGNUM *g=NULL,*q=NULL,*p=NULL; |
| 122 | BN_MONT_CTX *mont=NULL; | 122 | BN_MONT_CTX *mont=NULL; |
| 123 | int i, k, n=0, m=0, qsize = qbits >> 3; | 123 | int i, k,n=0,b,m=0, qsize = qbits >> 3; |
| 124 | int counter=0; | 124 | int counter=0; |
| 125 | int r=0; | 125 | int r=0; |
| 126 | BN_CTX *ctx=NULL; | 126 | BN_CTX *ctx=NULL; |
| @@ -232,6 +232,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, | |||
| 232 | /* "offset = 2" */ | 232 | /* "offset = 2" */ |
| 233 | 233 | ||
| 234 | n=(bits-1)/160; | 234 | n=(bits-1)/160; |
| 235 | b=(bits-1)-n*160; | ||
| 235 | 236 | ||
| 236 | for (;;) | 237 | for (;;) |
| 237 | { | 238 | { |
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index a3ddd7d281..4fead07e80 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
| @@ -148,6 +148,15 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
| 148 | 148 | ||
| 149 | s=BN_new(); | 149 | s=BN_new(); |
| 150 | if (s == NULL) goto err; | 150 | if (s == NULL) goto err; |
| 151 | |||
| 152 | /* reject a excessive digest length (currently at most | ||
| 153 | * dsa-with-SHA256 is supported) */ | ||
| 154 | if (dlen > SHA256_DIGEST_LENGTH) | ||
| 155 | { | ||
| 156 | reason=DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE; | ||
| 157 | goto err; | ||
| 158 | } | ||
| 159 | |||
| 151 | ctx=BN_CTX_new(); | 160 | ctx=BN_CTX_new(); |
| 152 | if (ctx == NULL) goto err; | 161 | if (ctx == NULL) goto err; |
| 153 | 162 | ||
| @@ -176,7 +185,7 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | |||
| 176 | if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */ | 185 | if (!BN_mod_mul(&xr,dsa->priv_key,r,dsa->q,ctx)) goto err;/* s = xr */ |
| 177 | if (!BN_add(s, &xr, &m)) goto err; /* s = m + xr */ | 186 | if (!BN_add(s, &xr, &m)) goto err; /* s = m + xr */ |
| 178 | if (BN_cmp(s,dsa->q) > 0) | 187 | if (BN_cmp(s,dsa->q) > 0) |
| 179 | if (!BN_sub(s,s,dsa->q)) goto err; | 188 | BN_sub(s,s,dsa->q); |
| 180 | if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err; | 189 | if (!BN_mod_mul(s,s,kinv,dsa->q,ctx)) goto err; |
| 181 | 190 | ||
| 182 | ret=DSA_SIG_new(); | 191 | ret=DSA_SIG_new(); |
| @@ -316,6 +325,15 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | |||
| 316 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE); | 325 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MODULUS_TOO_LARGE); |
| 317 | return -1; | 326 | return -1; |
| 318 | } | 327 | } |
| 328 | |||
| 329 | /* reject a excessive digest length (currently at most | ||
| 330 | * dsa-with-SHA256 is supported) */ | ||
| 331 | if (dgst_len > SHA256_DIGEST_LENGTH) | ||
| 332 | { | ||
| 333 | DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | ||
| 334 | return -1; | ||
| 335 | } | ||
| 336 | |||
| 319 | BN_init(&u1); | 337 | BN_init(&u1); |
| 320 | BN_init(&u2); | 338 | BN_init(&u2); |
| 321 | BN_init(&t1); | 339 | BN_init(&t1); |
diff --git a/src/lib/libcrypto/dsa/dsagen.c b/src/lib/libcrypto/dsa/dsagen.c new file mode 100644 index 0000000000..1b6a1cca0f --- /dev/null +++ b/src/lib/libcrypto/dsa/dsagen.c | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | /* crypto/dsa/dsagen.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <openssl/dsa.h> | ||
| 61 | |||
| 62 | #define TEST | ||
| 63 | #define GENUINE_DSA | ||
| 64 | |||
| 65 | #ifdef GENUINE_DSA | ||
| 66 | #define LAST_VALUE 0xbd | ||
| 67 | #else | ||
| 68 | #define LAST_VALUE 0xd3 | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #ifdef TEST | ||
| 72 | unsigned char seed[20]={ | ||
| 73 | 0xd5,0x01,0x4e,0x4b, | ||
| 74 | 0x60,0xef,0x2b,0xa8, | ||
| 75 | 0xb6,0x21,0x1b,0x40, | ||
| 76 | 0x62,0xba,0x32,0x24, | ||
| 77 | 0xe0,0x42,0x7d,LAST_VALUE}; | ||
| 78 | #endif | ||
| 79 | |||
| 80 | int cb(int p, int n) | ||
| 81 | { | ||
| 82 | char c='*'; | ||
| 83 | |||
| 84 | if (p == 0) c='.'; | ||
| 85 | if (p == 1) c='+'; | ||
| 86 | if (p == 2) c='*'; | ||
| 87 | if (p == 3) c='\n'; | ||
| 88 | printf("%c",c); | ||
| 89 | fflush(stdout); | ||
| 90 | } | ||
| 91 | |||
| 92 | main() | ||
| 93 | { | ||
| 94 | int i; | ||
| 95 | BIGNUM *n; | ||
| 96 | BN_CTX *ctx; | ||
| 97 | unsigned char seed_buf[20]; | ||
| 98 | DSA *dsa; | ||
| 99 | int counter,h; | ||
| 100 | BIO *bio_err=NULL; | ||
| 101 | |||
| 102 | if (bio_err == NULL) | ||
| 103 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
| 104 | |||
| 105 | memcpy(seed_buf,seed,20); | ||
| 106 | dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb,bio_err); | ||
| 107 | |||
| 108 | if (dsa == NULL) | ||
| 109 | DSA_print(bio_err,dsa,0); | ||
| 110 | } | ||
| 111 | |||
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c new file mode 100644 index 0000000000..edffd24e6b --- /dev/null +++ b/src/lib/libcrypto/dsa/dsatest.c | |||
| @@ -0,0 +1,259 @@ | |||
| 1 | /* crypto/dsa/dsatest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Until the key-gen callbacks are modified to use newer prototypes, we allow | ||
| 60 | * deprecated functions for openssl-internal code */ | ||
| 61 | #ifdef OPENSSL_NO_DEPRECATED | ||
| 62 | #undef OPENSSL_NO_DEPRECATED | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #include <stdio.h> | ||
| 66 | #include <stdlib.h> | ||
| 67 | #include <string.h> | ||
| 68 | #include <sys/types.h> | ||
| 69 | #include <sys/stat.h> | ||
| 70 | |||
| 71 | #include "../e_os.h" | ||
| 72 | |||
| 73 | #include <openssl/crypto.h> | ||
| 74 | #include <openssl/rand.h> | ||
| 75 | #include <openssl/bio.h> | ||
| 76 | #include <openssl/err.h> | ||
| 77 | #include <openssl/bn.h> | ||
| 78 | |||
| 79 | #ifdef OPENSSL_NO_DSA | ||
| 80 | int main(int argc, char *argv[]) | ||
| 81 | { | ||
| 82 | printf("No DSA support\n"); | ||
| 83 | return(0); | ||
| 84 | } | ||
| 85 | #else | ||
| 86 | #include <openssl/dsa.h> | ||
| 87 | |||
| 88 | #ifdef OPENSSL_SYS_WIN16 | ||
| 89 | #define MS_CALLBACK _far _loadds | ||
| 90 | #else | ||
| 91 | #define MS_CALLBACK | ||
| 92 | #endif | ||
| 93 | |||
| 94 | static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg); | ||
| 95 | |||
| 96 | /* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to | ||
| 97 | * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */ | ||
| 98 | static unsigned char seed[20]={ | ||
| 99 | 0xd5,0x01,0x4e,0x4b,0x60,0xef,0x2b,0xa8,0xb6,0x21,0x1b,0x40, | ||
| 100 | 0x62,0xba,0x32,0x24,0xe0,0x42,0x7d,0xd3, | ||
| 101 | }; | ||
| 102 | |||
| 103 | static unsigned char out_p[]={ | ||
| 104 | 0x8d,0xf2,0xa4,0x94,0x49,0x22,0x76,0xaa, | ||
| 105 | 0x3d,0x25,0x75,0x9b,0xb0,0x68,0x69,0xcb, | ||
| 106 | 0xea,0xc0,0xd8,0x3a,0xfb,0x8d,0x0c,0xf7, | ||
| 107 | 0xcb,0xb8,0x32,0x4f,0x0d,0x78,0x82,0xe5, | ||
| 108 | 0xd0,0x76,0x2f,0xc5,0xb7,0x21,0x0e,0xaf, | ||
| 109 | 0xc2,0xe9,0xad,0xac,0x32,0xab,0x7a,0xac, | ||
| 110 | 0x49,0x69,0x3d,0xfb,0xf8,0x37,0x24,0xc2, | ||
| 111 | 0xec,0x07,0x36,0xee,0x31,0xc8,0x02,0x91, | ||
| 112 | }; | ||
| 113 | |||
| 114 | static unsigned char out_q[]={ | ||
| 115 | 0xc7,0x73,0x21,0x8c,0x73,0x7e,0xc8,0xee, | ||
| 116 | 0x99,0x3b,0x4f,0x2d,0xed,0x30,0xf4,0x8e, | ||
| 117 | 0xda,0xce,0x91,0x5f, | ||
| 118 | }; | ||
| 119 | |||
| 120 | static unsigned char out_g[]={ | ||
| 121 | 0x62,0x6d,0x02,0x78,0x39,0xea,0x0a,0x13, | ||
| 122 | 0x41,0x31,0x63,0xa5,0x5b,0x4c,0xb5,0x00, | ||
| 123 | 0x29,0x9d,0x55,0x22,0x95,0x6c,0xef,0xcb, | ||
| 124 | 0x3b,0xff,0x10,0xf3,0x99,0xce,0x2c,0x2e, | ||
| 125 | 0x71,0xcb,0x9d,0xe5,0xfa,0x24,0xba,0xbf, | ||
| 126 | 0x58,0xe5,0xb7,0x95,0x21,0x92,0x5c,0x9c, | ||
| 127 | 0xc4,0x2e,0x9f,0x6f,0x46,0x4b,0x08,0x8c, | ||
| 128 | 0xc5,0x72,0xaf,0x53,0xe6,0xd7,0x88,0x02, | ||
| 129 | }; | ||
| 130 | |||
| 131 | static const unsigned char str1[]="12345678901234567890"; | ||
| 132 | |||
| 133 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 134 | |||
| 135 | static BIO *bio_err=NULL; | ||
| 136 | |||
| 137 | int main(int argc, char **argv) | ||
| 138 | { | ||
| 139 | BN_GENCB cb; | ||
| 140 | DSA *dsa=NULL; | ||
| 141 | int counter,ret=0,i,j; | ||
| 142 | unsigned char buf[256]; | ||
| 143 | unsigned long h; | ||
| 144 | unsigned char sig[256]; | ||
| 145 | unsigned int siglen; | ||
| 146 | |||
| 147 | if (bio_err == NULL) | ||
| 148 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
| 149 | |||
| 150 | CRYPTO_malloc_debug_init(); | ||
| 151 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
| 152 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 153 | |||
| 154 | ERR_load_crypto_strings(); | ||
| 155 | RAND_seed(rnd_seed, sizeof rnd_seed); | ||
| 156 | |||
| 157 | BIO_printf(bio_err,"test generation of DSA parameters\n"); | ||
| 158 | |||
| 159 | BN_GENCB_set(&cb, dsa_cb, bio_err); | ||
| 160 | if(((dsa = DSA_new()) == NULL) || !DSA_generate_parameters_ex(dsa, 512, | ||
| 161 | seed, 20, &counter, &h, &cb)) | ||
| 162 | goto end; | ||
| 163 | |||
| 164 | BIO_printf(bio_err,"seed\n"); | ||
| 165 | for (i=0; i<20; i+=4) | ||
| 166 | { | ||
| 167 | BIO_printf(bio_err,"%02X%02X%02X%02X ", | ||
| 168 | seed[i],seed[i+1],seed[i+2],seed[i+3]); | ||
| 169 | } | ||
| 170 | BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h); | ||
| 171 | |||
| 172 | DSA_print(bio_err,dsa,0); | ||
| 173 | if (counter != 105) | ||
| 174 | { | ||
| 175 | BIO_printf(bio_err,"counter should be 105\n"); | ||
| 176 | goto end; | ||
| 177 | } | ||
| 178 | if (h != 2) | ||
| 179 | { | ||
| 180 | BIO_printf(bio_err,"h should be 2\n"); | ||
| 181 | goto end; | ||
| 182 | } | ||
| 183 | |||
| 184 | i=BN_bn2bin(dsa->q,buf); | ||
| 185 | j=sizeof(out_q); | ||
| 186 | if ((i != j) || (memcmp(buf,out_q,i) != 0)) | ||
| 187 | { | ||
| 188 | BIO_printf(bio_err,"q value is wrong\n"); | ||
| 189 | goto end; | ||
| 190 | } | ||
| 191 | |||
| 192 | i=BN_bn2bin(dsa->p,buf); | ||
| 193 | j=sizeof(out_p); | ||
| 194 | if ((i != j) || (memcmp(buf,out_p,i) != 0)) | ||
| 195 | { | ||
| 196 | BIO_printf(bio_err,"p value is wrong\n"); | ||
| 197 | goto end; | ||
| 198 | } | ||
| 199 | |||
| 200 | i=BN_bn2bin(dsa->g,buf); | ||
| 201 | j=sizeof(out_g); | ||
| 202 | if ((i != j) || (memcmp(buf,out_g,i) != 0)) | ||
| 203 | { | ||
| 204 | BIO_printf(bio_err,"g value is wrong\n"); | ||
| 205 | goto end; | ||
| 206 | } | ||
| 207 | |||
| 208 | dsa->flags |= DSA_FLAG_NO_EXP_CONSTTIME; | ||
| 209 | DSA_generate_key(dsa); | ||
| 210 | DSA_sign(0, str1, 20, sig, &siglen, dsa); | ||
| 211 | if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1) | ||
| 212 | ret=1; | ||
| 213 | |||
| 214 | dsa->flags &= ~DSA_FLAG_NO_EXP_CONSTTIME; | ||
| 215 | DSA_generate_key(dsa); | ||
| 216 | DSA_sign(0, str1, 20, sig, &siglen, dsa); | ||
| 217 | if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1) | ||
| 218 | ret=1; | ||
| 219 | |||
| 220 | end: | ||
| 221 | if (!ret) | ||
| 222 | ERR_print_errors(bio_err); | ||
| 223 | if (dsa != NULL) DSA_free(dsa); | ||
| 224 | CRYPTO_cleanup_all_ex_data(); | ||
| 225 | ERR_remove_thread_state(NULL); | ||
| 226 | ERR_free_strings(); | ||
| 227 | CRYPTO_mem_leaks(bio_err); | ||
| 228 | if (bio_err != NULL) | ||
| 229 | { | ||
| 230 | BIO_free(bio_err); | ||
| 231 | bio_err = NULL; | ||
| 232 | } | ||
| 233 | #ifdef OPENSSL_SYS_NETWARE | ||
| 234 | if (!ret) printf("ERROR\n"); | ||
| 235 | #endif | ||
| 236 | EXIT(!ret); | ||
| 237 | return(0); | ||
| 238 | } | ||
| 239 | |||
| 240 | static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg) | ||
| 241 | { | ||
| 242 | char c='*'; | ||
| 243 | static int ok=0,num=0; | ||
| 244 | |||
| 245 | if (p == 0) { c='.'; num++; }; | ||
| 246 | if (p == 1) c='+'; | ||
| 247 | if (p == 2) { c='*'; ok++; } | ||
| 248 | if (p == 3) c='\n'; | ||
| 249 | BIO_write(arg->arg,&c,1); | ||
| 250 | (void)BIO_flush(arg->arg); | ||
| 251 | |||
| 252 | if (!ok && (p == 0) && (num > 1)) | ||
| 253 | { | ||
| 254 | BIO_printf((BIO *)arg,"error in dsatest\n"); | ||
| 255 | return 0; | ||
| 256 | } | ||
| 257 | return 1; | ||
| 258 | } | ||
| 259 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/fips186a.txt b/src/lib/libcrypto/dsa/fips186a.txt new file mode 100644 index 0000000000..3a2e0a0d51 --- /dev/null +++ b/src/lib/libcrypto/dsa/fips186a.txt | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | The origional FIPE 180 used SHA-0 (FIPS 180) for its appendix 5 | ||
| 2 | examples. This is an updated version that uses SHA-1 (FIPS 180-1) | ||
| 3 | supplied to me by Wei Dai | ||
| 4 | -- | ||
| 5 | APPENDIX 5. EXAMPLE OF THE DSA | ||
| 6 | |||
| 7 | |||
| 8 | This appendix is for informational purposes only and is not required to meet | ||
| 9 | the standard. | ||
| 10 | |||
| 11 | Let L = 512 (size of p). The values in this example are expressed in | ||
| 12 | hexadecimal notation. The p and q given here were generated by the prime | ||
| 13 | generation standard described in appendix 2 using the 160-bit SEED: | ||
| 14 | |||
| 15 | d5014e4b 60ef2ba8 b6211b40 62ba3224 e0427dd3 | ||
| 16 | |||
| 17 | With this SEED, the algorithm found p and q when the counter was at 105. | ||
| 18 | |||
| 19 | x was generated by the algorithm described in appendix 3, section 3.1, using | ||
| 20 | the SHA to construct G (as in appendix 3, section 3.3) and a 160-bit XSEED: | ||
| 21 | |||
| 22 | XSEED = | ||
| 23 | |||
| 24 | bd029bbe 7f51960b cf9edb2b 61f06f0f eb5a38b6 | ||
| 25 | |||
| 26 | t = | ||
| 27 | 67452301 EFCDAB89 98BADCFE 10325476 C3D2E1F0 | ||
| 28 | |||
| 29 | x = G(t,XSEED) mod q | ||
| 30 | |||
| 31 | k was generated by the algorithm described in appendix 3, section 3.2, using | ||
| 32 | the SHA to construct G (as in appendix 3, section 3.3) and a 160-bit KSEED: | ||
| 33 | |||
| 34 | KSEED = | ||
| 35 | |||
| 36 | 687a66d9 0648f993 867e121f 4ddf9ddb 01205584 | ||
| 37 | |||
| 38 | t = | ||
| 39 | EFCDAB89 98BADCFE 10325476 C3D2E1F0 67452301 | ||
| 40 | |||
| 41 | k = G(t,KSEED) mod q | ||
| 42 | |||
| 43 | Finally: | ||
| 44 | |||
| 45 | h = 2 | ||
| 46 | |||
| 47 | p = | ||
| 48 | 8df2a494 492276aa 3d25759b b06869cb eac0d83a fb8d0cf7 | ||
| 49 | cbb8324f 0d7882e5 d0762fc5 b7210eaf c2e9adac 32ab7aac | ||
| 50 | 49693dfb f83724c2 ec0736ee 31c80291 | ||
| 51 | |||
| 52 | |||
| 53 | q = | ||
| 54 | c773218c 737ec8ee 993b4f2d ed30f48e dace915f | ||
| 55 | |||
| 56 | |||
| 57 | g = | ||
| 58 | 626d0278 39ea0a13 413163a5 5b4cb500 299d5522 956cefcb | ||
| 59 | 3bff10f3 99ce2c2e 71cb9de5 fa24babf 58e5b795 21925c9c | ||
| 60 | c42e9f6f 464b088c c572af53 e6d78802 | ||
| 61 | |||
| 62 | |||
| 63 | x = | ||
| 64 | 2070b322 3dba372f de1c0ffc 7b2e3b49 8b260614 | ||
| 65 | |||
| 66 | |||
| 67 | k = | ||
| 68 | 358dad57 1462710f 50e254cf 1a376b2b deaadfbf | ||
| 69 | |||
| 70 | |||
| 71 | kinv = | ||
| 72 | |||
| 73 | 0d516729 8202e49b 4116ac10 4fc3f415 ae52f917 | ||
| 74 | |||
| 75 | M = ASCII form of "abc" (See FIPS PUB 180-1, Appendix A) | ||
| 76 | |||
| 77 | SHA(M) = | ||
| 78 | |||
| 79 | a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d | ||
| 80 | |||
| 81 | |||
| 82 | y = | ||
| 83 | |||
| 84 | 19131871 d75b1612 a819f29d 78d1b0d7 346f7aa7 7bb62a85 | ||
| 85 | 9bfd6c56 75da9d21 2d3a36ef 1672ef66 0b8c7c25 5cc0ec74 | ||
| 86 | 858fba33 f44c0669 9630a76b 030ee333 | ||
| 87 | |||
| 88 | |||
| 89 | r = | ||
| 90 | 8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0 | ||
| 91 | |||
| 92 | s = | ||
| 93 | 41e2345f 1f56df24 58f426d1 55b4ba2d b6dcd8c8 | ||
| 94 | |||
| 95 | |||
| 96 | w = | ||
| 97 | 9df4ece5 826be95f ed406d41 b43edc0b 1c18841b | ||
| 98 | |||
| 99 | |||
| 100 | u1 = | ||
| 101 | bf655bd0 46f0b35e c791b004 804afcbb 8ef7d69d | ||
| 102 | |||
| 103 | |||
| 104 | u2 = | ||
| 105 | 821a9263 12e97ade abcc8d08 2b527897 8a2df4b0 | ||
| 106 | |||
| 107 | |||
| 108 | gu1 mod p = | ||
| 109 | |||
| 110 | 51b1bf86 7888e5f3 af6fb476 9dd016bc fe667a65 aafc2753 | ||
| 111 | 9063bd3d 2b138b4c e02cc0c0 2ec62bb6 7306c63e 4db95bbf | ||
| 112 | 6f96662a 1987a21b e4ec1071 010b6069 | ||
| 113 | |||
| 114 | |||
| 115 | yu2 mod p = | ||
| 116 | |||
| 117 | 8b510071 2957e950 50d6b8fd 376a668e 4b0d633c 1e46e665 | ||
| 118 | 5c611a72 e2b28483 be52c74d 4b30de61 a668966e dc307a67 | ||
| 119 | c19441f4 22bf3c34 08aeba1f 0a4dbec7 | ||
| 120 | |||
| 121 | v = | ||
| 122 | 8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0 | ||
diff --git a/src/lib/libcrypto/dso/Makefile b/src/lib/libcrypto/dso/Makefile new file mode 100644 index 0000000000..fb2709ed63 --- /dev/null +++ b/src/lib/libcrypto/dso/Makefile | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/dso/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= dso | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ | ||
| 21 | dso_openssl.c dso_win32.c dso_vms.c dso_beos.c | ||
| 22 | LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \ | ||
| 23 | dso_openssl.o dso_win32.o dso_vms.o dso_beos.o | ||
| 24 | |||
| 25 | SRC= $(LIBSRC) | ||
| 26 | |||
| 27 | EXHEADER= dso.h | ||
| 28 | HEADER= $(EXHEADER) | ||
| 29 | |||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 31 | |||
| 32 | top: | ||
| 33 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 34 | |||
| 35 | all: lib | ||
| 36 | |||
| 37 | lib: $(LIBOBJ) | ||
| 38 | $(AR) $(LIB) $(LIBOBJ) | ||
| 39 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 40 | @touch lib | ||
| 41 | |||
| 42 | files: | ||
| 43 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 44 | |||
| 45 | links: | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 49 | |||
| 50 | install: | ||
| 51 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 52 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 53 | do \ | ||
| 54 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 55 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 56 | done; | ||
| 57 | |||
| 58 | tags: | ||
| 59 | ctags $(SRC) | ||
| 60 | |||
| 61 | tests: | ||
| 62 | |||
| 63 | lint: | ||
| 64 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 65 | |||
| 66 | depend: | ||
| 67 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 68 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 69 | |||
| 70 | dclean: | ||
| 71 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 72 | mv -f Makefile.new $(MAKEFILE) | ||
| 73 | |||
| 74 | clean: | ||
| 75 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 76 | |||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 78 | |||
| 79 | dso_beos.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 80 | dso_beos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 81 | dso_beos.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 82 | dso_beos.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 83 | dso_beos.o: ../../include/openssl/opensslconf.h | ||
| 84 | dso_beos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 85 | dso_beos.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 86 | dso_beos.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_beos.c | ||
| 87 | dso_dl.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 88 | dso_dl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 89 | dso_dl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 90 | dso_dl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 91 | dso_dl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 92 | dso_dl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 93 | dso_dl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 94 | dso_dl.o: ../cryptlib.h dso_dl.c | ||
| 95 | dso_dlfcn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 96 | dso_dlfcn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 97 | dso_dlfcn.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 98 | dso_dlfcn.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 99 | dso_dlfcn.o: ../../include/openssl/opensslconf.h | ||
| 100 | dso_dlfcn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 101 | dso_dlfcn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 102 | dso_dlfcn.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_dlfcn.c | ||
| 103 | dso_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 104 | dso_err.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 105 | dso_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 106 | dso_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 107 | dso_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 108 | dso_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 109 | dso_err.o: dso_err.c | ||
| 110 | dso_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 111 | dso_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 112 | dso_lib.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 113 | dso_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 114 | dso_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 115 | dso_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 116 | dso_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 117 | dso_lib.o: ../cryptlib.h dso_lib.c | ||
| 118 | dso_null.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 119 | dso_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 120 | dso_null.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 121 | dso_null.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 122 | dso_null.o: ../../include/openssl/opensslconf.h | ||
| 123 | dso_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 124 | dso_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 125 | dso_null.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_null.c | ||
| 126 | dso_openssl.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 127 | dso_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 128 | dso_openssl.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 129 | dso_openssl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 130 | dso_openssl.o: ../../include/openssl/opensslconf.h | ||
| 131 | dso_openssl.o: ../../include/openssl/opensslv.h | ||
| 132 | dso_openssl.o: ../../include/openssl/ossl_typ.h | ||
| 133 | dso_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 134 | dso_openssl.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_openssl.c | ||
| 135 | dso_vms.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 136 | dso_vms.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 137 | dso_vms.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 138 | dso_vms.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 139 | dso_vms.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 140 | dso_vms.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 141 | dso_vms.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 142 | dso_vms.o: ../cryptlib.h dso_vms.c | ||
| 143 | dso_win32.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 144 | dso_win32.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 145 | dso_win32.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 146 | dso_win32.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 147 | dso_win32.o: ../../include/openssl/opensslconf.h | ||
| 148 | dso_win32.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 149 | dso_win32.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 150 | dso_win32.o: ../../include/openssl/symhacks.h ../cryptlib.h dso_win32.c | ||
diff --git a/src/lib/libcrypto/dso/README b/src/lib/libcrypto/dso/README new file mode 100644 index 0000000000..d0bc9a89fb --- /dev/null +++ b/src/lib/libcrypto/dso/README | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | NOTES | ||
| 2 | ----- | ||
| 3 | |||
| 4 | I've checked out HPUX (well, version 11 at least) and shl_t is | ||
| 5 | a pointer type so it's safe to use in the way it has been in | ||
| 6 | dso_dl.c. On the other hand, HPUX11 support dlfcn too and | ||
| 7 | according to their man page, prefer developers to move to that. | ||
| 8 | I'll leave Richard's changes there as I guess dso_dl is needed | ||
| 9 | for HPUX10.20. | ||
| 10 | |||
| 11 | There is now a callback scheme in place where filename conversion can | ||
| 12 | (a) be turned off altogether through the use of the | ||
| 13 | DSO_FLAG_NO_NAME_TRANSLATION flag, | ||
| 14 | (b) be handled by default using the default DSO_METHOD's converter | ||
| 15 | (c) overriden per-DSO by setting the override callback | ||
| 16 | (d) a mix of (b) and (c) - eg. implement an override callback that; | ||
| 17 | (i) checks if we're win32 (if(strstr(dso->meth->name, "win32")....) | ||
| 18 | and if so, convert "blah" into "blah32.dll" (the default is | ||
| 19 | otherwise to make it "blah.dll"). | ||
| 20 | (ii) default to the normal behaviour - we're not on win32, eg. | ||
| 21 | finish with (return dso->meth->dso_name_converter(dso,NULL)). | ||
| 22 | |||
diff --git a/src/lib/libcrypto/dso/dso_beos.c b/src/lib/libcrypto/dso/dso_beos.c new file mode 100644 index 0000000000..553966e699 --- /dev/null +++ b/src/lib/libcrypto/dso/dso_beos.c | |||
| @@ -0,0 +1,270 @@ | |||
| 1 | /* dso_beos.c */ | ||
| 2 | /* Written by Marcin Konicki (ahwayakchih@neoni.net) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/dso.h> | ||
| 63 | |||
| 64 | #if !defined(OPENSSL_SYS_BEOS) | ||
| 65 | DSO_METHOD *DSO_METHOD_beos(void) | ||
| 66 | { | ||
| 67 | return NULL; | ||
| 68 | } | ||
| 69 | #else | ||
| 70 | |||
| 71 | #include <kernel/image.h> | ||
| 72 | |||
| 73 | static int beos_load(DSO *dso); | ||
| 74 | static int beos_unload(DSO *dso); | ||
| 75 | static void *beos_bind_var(DSO *dso, const char *symname); | ||
| 76 | static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname); | ||
| 77 | #if 0 | ||
| 78 | static int beos_unbind_var(DSO *dso, char *symname, void *symptr); | ||
| 79 | static int beos_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | ||
| 80 | static int beos_init(DSO *dso); | ||
| 81 | static int beos_finish(DSO *dso); | ||
| 82 | static long beos_ctrl(DSO *dso, int cmd, long larg, void *parg); | ||
| 83 | #endif | ||
| 84 | static char *beos_name_converter(DSO *dso, const char *filename); | ||
| 85 | |||
| 86 | static DSO_METHOD dso_meth_beos = { | ||
| 87 | "OpenSSL 'beos' shared library method", | ||
| 88 | beos_load, | ||
| 89 | beos_unload, | ||
| 90 | beos_bind_var, | ||
| 91 | beos_bind_func, | ||
| 92 | /* For now, "unbind" doesn't exist */ | ||
| 93 | #if 0 | ||
| 94 | NULL, /* unbind_var */ | ||
| 95 | NULL, /* unbind_func */ | ||
| 96 | #endif | ||
| 97 | NULL, /* ctrl */ | ||
| 98 | beos_name_converter, | ||
| 99 | NULL, /* init */ | ||
| 100 | NULL /* finish */ | ||
| 101 | }; | ||
| 102 | |||
| 103 | DSO_METHOD *DSO_METHOD_beos(void) | ||
| 104 | { | ||
| 105 | return(&dso_meth_beos); | ||
| 106 | } | ||
| 107 | |||
| 108 | /* For this DSO_METHOD, our meth_data STACK will contain; | ||
| 109 | * (i) a pointer to the handle (image_id) returned from | ||
| 110 | * load_add_on(). | ||
| 111 | */ | ||
| 112 | |||
| 113 | static int beos_load(DSO *dso) | ||
| 114 | { | ||
| 115 | image_id id; | ||
| 116 | /* See applicable comments from dso_dl.c */ | ||
| 117 | char *filename = DSO_convert_filename(dso, NULL); | ||
| 118 | |||
| 119 | if(filename == NULL) | ||
| 120 | { | ||
| 121 | DSOerr(DSO_F_BEOS_LOAD,DSO_R_NO_FILENAME); | ||
| 122 | goto err; | ||
| 123 | } | ||
| 124 | id = load_add_on(filename); | ||
| 125 | if(id < 1) | ||
| 126 | { | ||
| 127 | DSOerr(DSO_F_BEOS_LOAD,DSO_R_LOAD_FAILED); | ||
| 128 | ERR_add_error_data(3, "filename(", filename, ")"); | ||
| 129 | goto err; | ||
| 130 | } | ||
| 131 | if(!sk_push(dso->meth_data, (char *)id)) | ||
| 132 | { | ||
| 133 | DSOerr(DSO_F_BEOS_LOAD,DSO_R_STACK_ERROR); | ||
| 134 | goto err; | ||
| 135 | } | ||
| 136 | /* Success */ | ||
| 137 | dso->loaded_filename = filename; | ||
| 138 | return(1); | ||
| 139 | err: | ||
| 140 | /* Cleanup !*/ | ||
| 141 | if(filename != NULL) | ||
| 142 | OPENSSL_free(filename); | ||
| 143 | if(id > 0) | ||
| 144 | unload_add_on(id); | ||
| 145 | return(0); | ||
| 146 | } | ||
| 147 | |||
| 148 | static int beos_unload(DSO *dso) | ||
| 149 | { | ||
| 150 | image_id id; | ||
| 151 | if(dso == NULL) | ||
| 152 | { | ||
| 153 | DSOerr(DSO_F_BEOS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | ||
| 154 | return(0); | ||
| 155 | } | ||
| 156 | if(sk_num(dso->meth_data) < 1) | ||
| 157 | return(1); | ||
| 158 | id = (image_id)sk_pop(dso->meth_data); | ||
| 159 | if(id < 1) | ||
| 160 | { | ||
| 161 | DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_NULL_HANDLE); | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | if(unload_add_on(id) != B_OK) | ||
| 165 | { | ||
| 166 | DSOerr(DSO_F_BEOS_UNLOAD,DSO_R_UNLOAD_FAILED); | ||
| 167 | /* We should push the value back onto the stack in | ||
| 168 | * case of a retry. */ | ||
| 169 | sk_push(dso->meth_data, (char *)id); | ||
| 170 | return(0); | ||
| 171 | } | ||
| 172 | return(1); | ||
| 173 | } | ||
| 174 | |||
| 175 | static void *beos_bind_var(DSO *dso, const char *symname) | ||
| 176 | { | ||
| 177 | image_id id; | ||
| 178 | void *sym; | ||
| 179 | |||
| 180 | if((dso == NULL) || (symname == NULL)) | ||
| 181 | { | ||
| 182 | DSOerr(DSO_F_BEOS_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); | ||
| 183 | return(NULL); | ||
| 184 | } | ||
| 185 | if(sk_num(dso->meth_data) < 1) | ||
| 186 | { | ||
| 187 | DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_STACK_ERROR); | ||
| 188 | return(NULL); | ||
| 189 | } | ||
| 190 | id = (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | ||
| 191 | if(id < 1) | ||
| 192 | { | ||
| 193 | DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_NULL_HANDLE); | ||
| 194 | return(NULL); | ||
| 195 | } | ||
| 196 | if(get_image_symbol(id, symname, B_SYMBOL_TYPE_DATA, &sym) != B_OK) | ||
| 197 | { | ||
| 198 | DSOerr(DSO_F_BEOS_BIND_VAR,DSO_R_SYM_FAILURE); | ||
| 199 | ERR_add_error_data(3, "symname(", symname, ")"); | ||
| 200 | return(NULL); | ||
| 201 | } | ||
| 202 | return(sym); | ||
| 203 | } | ||
| 204 | |||
| 205 | static DSO_FUNC_TYPE beos_bind_func(DSO *dso, const char *symname) | ||
| 206 | { | ||
| 207 | image_id id; | ||
| 208 | void *sym; | ||
| 209 | |||
| 210 | if((dso == NULL) || (symname == NULL)) | ||
| 211 | { | ||
| 212 | DSOerr(DSO_F_BEOS_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); | ||
| 213 | return(NULL); | ||
| 214 | } | ||
| 215 | if(sk_num(dso->meth_data) < 1) | ||
| 216 | { | ||
| 217 | DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_STACK_ERROR); | ||
| 218 | return(NULL); | ||
| 219 | } | ||
| 220 | id = (image_id)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | ||
| 221 | if(id < 1) | ||
| 222 | { | ||
| 223 | DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_NULL_HANDLE); | ||
| 224 | return(NULL); | ||
| 225 | } | ||
| 226 | if(get_image_symbol(id, symname, B_SYMBOL_TYPE_TEXT, &sym) != B_OK) | ||
| 227 | { | ||
| 228 | DSOerr(DSO_F_BEOS_BIND_FUNC,DSO_R_SYM_FAILURE); | ||
| 229 | ERR_add_error_data(3, "symname(", symname, ")"); | ||
| 230 | return(NULL); | ||
| 231 | } | ||
| 232 | return((DSO_FUNC_TYPE)sym); | ||
| 233 | } | ||
| 234 | |||
| 235 | /* This one is the same as the one in dlfcn */ | ||
| 236 | static char *beos_name_converter(DSO *dso, const char *filename) | ||
| 237 | { | ||
| 238 | char *translated; | ||
| 239 | int len, rsize, transform; | ||
| 240 | |||
| 241 | len = strlen(filename); | ||
| 242 | rsize = len + 1; | ||
| 243 | transform = (strstr(filename, "/") == NULL); | ||
| 244 | if(transform) | ||
| 245 | { | ||
| 246 | /* We will convert this to "%s.so" or "lib%s.so" */ | ||
| 247 | rsize += 3; /* The length of ".so" */ | ||
| 248 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | ||
| 249 | rsize += 3; /* The length of "lib" */ | ||
| 250 | } | ||
| 251 | translated = OPENSSL_malloc(rsize); | ||
| 252 | if(translated == NULL) | ||
| 253 | { | ||
| 254 | DSOerr(DSO_F_BEOS_NAME_CONVERTER, | ||
| 255 | DSO_R_NAME_TRANSLATION_FAILED); | ||
| 256 | return(NULL); | ||
| 257 | } | ||
| 258 | if(transform) | ||
| 259 | { | ||
| 260 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | ||
| 261 | sprintf(translated, "lib%s.so", filename); | ||
| 262 | else | ||
| 263 | sprintf(translated, "%s.so", filename); | ||
| 264 | } | ||
| 265 | else | ||
| 266 | sprintf(translated, "%s", filename); | ||
| 267 | return(translated); | ||
| 268 | } | ||
| 269 | |||
| 270 | #endif | ||
diff --git a/src/lib/libcrypto/dso/dso_dl.c b/src/lib/libcrypto/dso/dso_dl.c new file mode 100644 index 0000000000..c3b4f6cf45 --- /dev/null +++ b/src/lib/libcrypto/dso/dso_dl.c | |||
| @@ -0,0 +1,395 @@ | |||
| 1 | /* dso_dl.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/dso.h> | ||
| 62 | |||
| 63 | #ifndef DSO_DL | ||
| 64 | DSO_METHOD *DSO_METHOD_dl(void) | ||
| 65 | { | ||
| 66 | return NULL; | ||
| 67 | } | ||
| 68 | #else | ||
| 69 | |||
| 70 | #include <dl.h> | ||
| 71 | |||
| 72 | /* Part of the hack in "dl_load" ... */ | ||
| 73 | #define DSO_MAX_TRANSLATED_SIZE 256 | ||
| 74 | |||
| 75 | static int dl_load(DSO *dso); | ||
| 76 | static int dl_unload(DSO *dso); | ||
| 77 | static void *dl_bind_var(DSO *dso, const char *symname); | ||
| 78 | static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname); | ||
| 79 | #if 0 | ||
| 80 | static int dl_unbind_var(DSO *dso, char *symname, void *symptr); | ||
| 81 | static int dl_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | ||
| 82 | static int dl_init(DSO *dso); | ||
| 83 | static int dl_finish(DSO *dso); | ||
| 84 | static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg); | ||
| 85 | #endif | ||
| 86 | static char *dl_name_converter(DSO *dso, const char *filename); | ||
| 87 | static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2); | ||
| 88 | static int dl_pathbyaddr(void *addr,char *path,int sz); | ||
| 89 | static void *dl_globallookup(const char *name); | ||
| 90 | |||
| 91 | static DSO_METHOD dso_meth_dl = { | ||
| 92 | "OpenSSL 'dl' shared library method", | ||
| 93 | dl_load, | ||
| 94 | dl_unload, | ||
| 95 | dl_bind_var, | ||
| 96 | dl_bind_func, | ||
| 97 | /* For now, "unbind" doesn't exist */ | ||
| 98 | #if 0 | ||
| 99 | NULL, /* unbind_var */ | ||
| 100 | NULL, /* unbind_func */ | ||
| 101 | #endif | ||
| 102 | NULL, /* ctrl */ | ||
| 103 | dl_name_converter, | ||
| 104 | dl_merger, | ||
| 105 | NULL, /* init */ | ||
| 106 | NULL, /* finish */ | ||
| 107 | dl_pathbyaddr, | ||
| 108 | dl_globallookup | ||
| 109 | }; | ||
| 110 | |||
| 111 | DSO_METHOD *DSO_METHOD_dl(void) | ||
| 112 | { | ||
| 113 | return(&dso_meth_dl); | ||
| 114 | } | ||
| 115 | |||
| 116 | /* For this DSO_METHOD, our meth_data STACK will contain; | ||
| 117 | * (i) the handle (shl_t) returned from shl_load(). | ||
| 118 | * NB: I checked on HPUX11 and shl_t is itself a pointer | ||
| 119 | * type so the cast is safe. | ||
| 120 | */ | ||
| 121 | |||
| 122 | static int dl_load(DSO *dso) | ||
| 123 | { | ||
| 124 | shl_t ptr = NULL; | ||
| 125 | /* We don't do any fancy retries or anything, just take the method's | ||
| 126 | * (or DSO's if it has the callback set) best translation of the | ||
| 127 | * platform-independant filename and try once with that. */ | ||
| 128 | char *filename= DSO_convert_filename(dso, NULL); | ||
| 129 | |||
| 130 | if(filename == NULL) | ||
| 131 | { | ||
| 132 | DSOerr(DSO_F_DL_LOAD,DSO_R_NO_FILENAME); | ||
| 133 | goto err; | ||
| 134 | } | ||
| 135 | ptr = shl_load(filename, BIND_IMMEDIATE | | ||
| 136 | (dso->flags&DSO_FLAG_NO_NAME_TRANSLATION?0:DYNAMIC_PATH), 0L); | ||
| 137 | if(ptr == NULL) | ||
| 138 | { | ||
| 139 | DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED); | ||
| 140 | ERR_add_error_data(4, "filename(", filename, "): ", | ||
| 141 | strerror(errno)); | ||
| 142 | goto err; | ||
| 143 | } | ||
| 144 | if(!sk_push(dso->meth_data, (char *)ptr)) | ||
| 145 | { | ||
| 146 | DSOerr(DSO_F_DL_LOAD,DSO_R_STACK_ERROR); | ||
| 147 | goto err; | ||
| 148 | } | ||
| 149 | /* Success, stick the converted filename we've loaded under into the DSO | ||
| 150 | * (it also serves as the indicator that we are currently loaded). */ | ||
| 151 | dso->loaded_filename = filename; | ||
| 152 | return(1); | ||
| 153 | err: | ||
| 154 | /* Cleanup! */ | ||
| 155 | if(filename != NULL) | ||
| 156 | OPENSSL_free(filename); | ||
| 157 | if(ptr != NULL) | ||
| 158 | shl_unload(ptr); | ||
| 159 | return(0); | ||
| 160 | } | ||
| 161 | |||
| 162 | static int dl_unload(DSO *dso) | ||
| 163 | { | ||
| 164 | shl_t ptr; | ||
| 165 | if(dso == NULL) | ||
| 166 | { | ||
| 167 | DSOerr(DSO_F_DL_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | ||
| 168 | return(0); | ||
| 169 | } | ||
| 170 | if(sk_num(dso->meth_data) < 1) | ||
| 171 | return(1); | ||
| 172 | /* Is this statement legal? */ | ||
| 173 | ptr = (shl_t)sk_pop(dso->meth_data); | ||
| 174 | if(ptr == NULL) | ||
| 175 | { | ||
| 176 | DSOerr(DSO_F_DL_UNLOAD,DSO_R_NULL_HANDLE); | ||
| 177 | /* Should push the value back onto the stack in | ||
| 178 | * case of a retry. */ | ||
| 179 | sk_push(dso->meth_data, (char *)ptr); | ||
| 180 | return(0); | ||
| 181 | } | ||
| 182 | shl_unload(ptr); | ||
| 183 | return(1); | ||
| 184 | } | ||
| 185 | |||
| 186 | static void *dl_bind_var(DSO *dso, const char *symname) | ||
| 187 | { | ||
| 188 | shl_t ptr; | ||
| 189 | void *sym; | ||
| 190 | |||
| 191 | if((dso == NULL) || (symname == NULL)) | ||
| 192 | { | ||
| 193 | DSOerr(DSO_F_DL_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); | ||
| 194 | return(NULL); | ||
| 195 | } | ||
| 196 | if(sk_num(dso->meth_data) < 1) | ||
| 197 | { | ||
| 198 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_STACK_ERROR); | ||
| 199 | return(NULL); | ||
| 200 | } | ||
| 201 | ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | ||
| 202 | if(ptr == NULL) | ||
| 203 | { | ||
| 204 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE); | ||
| 205 | return(NULL); | ||
| 206 | } | ||
| 207 | if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) | ||
| 208 | { | ||
| 209 | DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE); | ||
| 210 | ERR_add_error_data(4, "symname(", symname, "): ", | ||
| 211 | strerror(errno)); | ||
| 212 | return(NULL); | ||
| 213 | } | ||
| 214 | return(sym); | ||
| 215 | } | ||
| 216 | |||
| 217 | static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) | ||
| 218 | { | ||
| 219 | shl_t ptr; | ||
| 220 | void *sym; | ||
| 221 | |||
| 222 | if((dso == NULL) || (symname == NULL)) | ||
| 223 | { | ||
| 224 | DSOerr(DSO_F_DL_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); | ||
| 225 | return(NULL); | ||
| 226 | } | ||
| 227 | if(sk_num(dso->meth_data) < 1) | ||
| 228 | { | ||
| 229 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_STACK_ERROR); | ||
| 230 | return(NULL); | ||
| 231 | } | ||
| 232 | ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); | ||
| 233 | if(ptr == NULL) | ||
| 234 | { | ||
| 235 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE); | ||
| 236 | return(NULL); | ||
| 237 | } | ||
| 238 | if (shl_findsym(&ptr, symname, TYPE_UNDEFINED, &sym) < 0) | ||
| 239 | { | ||
| 240 | DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE); | ||
| 241 | ERR_add_error_data(4, "symname(", symname, "): ", | ||
| 242 | strerror(errno)); | ||
| 243 | return(NULL); | ||
| 244 | } | ||
| 245 | return((DSO_FUNC_TYPE)sym); | ||
| 246 | } | ||
| 247 | |||
| 248 | static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2) | ||
| 249 | { | ||
| 250 | char *merged; | ||
| 251 | |||
| 252 | if(!filespec1 && !filespec2) | ||
| 253 | { | ||
| 254 | DSOerr(DSO_F_DL_MERGER, | ||
| 255 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 256 | return(NULL); | ||
| 257 | } | ||
| 258 | /* If the first file specification is a rooted path, it rules. | ||
| 259 | same goes if the second file specification is missing. */ | ||
| 260 | if (!filespec2 || filespec1[0] == '/') | ||
| 261 | { | ||
| 262 | size_t len = strlen(filespec1) + 1; | ||
| 263 | merged = OPENSSL_malloc(len); | ||
| 264 | if(!merged) | ||
| 265 | { | ||
| 266 | DSOerr(DSO_F_DL_MERGER, | ||
| 267 | ERR_R_MALLOC_FAILURE); | ||
| 268 | return(NULL); | ||
| 269 | } | ||
| 270 | memcpy(merged, filespec1, len); | ||
| 271 | } | ||
| 272 | /* If the first file specification is missing, the second one rules. */ | ||
| 273 | else if (!filespec1) | ||
| 274 | { | ||
| 275 | size_t len = strlen(filespec2) + 1; | ||
| 276 | merged = OPENSSL_malloc(strlen(filespec2) + 1); | ||
| 277 | if(!merged) | ||
| 278 | { | ||
| 279 | DSOerr(DSO_F_DL_MERGER, | ||
| 280 | ERR_R_MALLOC_FAILURE); | ||
| 281 | return(NULL); | ||
| 282 | } | ||
| 283 | memcpy(merged, filespec2, len); | ||
| 284 | } | ||
| 285 | else | ||
| 286 | /* This part isn't as trivial as it looks. It assumes that | ||
| 287 | the second file specification really is a directory, and | ||
| 288 | makes no checks whatsoever. Therefore, the result becomes | ||
| 289 | the concatenation of filespec2 followed by a slash followed | ||
| 290 | by filespec1. */ | ||
| 291 | { | ||
| 292 | size_t spec2len, len; | ||
| 293 | |||
| 294 | spec2len = (filespec2 ? strlen(filespec2) : 0); | ||
| 295 | len = spec2len + (filespec1 ? strlen(filespec1) : 0); | ||
| 296 | |||
| 297 | if(filespec2 && filespec2[spec2len - 1] == '/') | ||
| 298 | { | ||
| 299 | spec2len--; | ||
| 300 | len--; | ||
| 301 | } | ||
| 302 | merged = OPENSSL_malloc(len + 2); | ||
| 303 | if(!merged) | ||
| 304 | { | ||
| 305 | DSOerr(DSO_F_DL_MERGER, | ||
| 306 | ERR_R_MALLOC_FAILURE); | ||
| 307 | return(NULL); | ||
| 308 | } | ||
| 309 | strlcpy(merged, filespec2, len + 2); | ||
| 310 | merged[spec2len] = '/'; | ||
| 311 | strlcpy(&merged[spec2len + 1], filespec1, 1 + len - spec2len); | ||
| 312 | } | ||
| 313 | return(merged); | ||
| 314 | } | ||
| 315 | |||
| 316 | /* This function is identical to the one in dso_dlfcn.c, but as it is highly | ||
| 317 | * unlikely that both the "dl" *and* "dlfcn" variants are being compiled at the | ||
| 318 | * same time, there's no great duplicating the code. Figuring out an elegant | ||
| 319 | * way to share one copy of the code would be more difficult and would not | ||
| 320 | * leave the implementations independant. */ | ||
| 321 | #if defined(__hpux) | ||
| 322 | static const char extension[] = ".sl"; | ||
| 323 | #else | ||
| 324 | static const char extension[] = ".so"; | ||
| 325 | #endif | ||
| 326 | static char *dl_name_converter(DSO *dso, const char *filename) | ||
| 327 | { | ||
| 328 | char *translated; | ||
| 329 | int len, rsize, transform; | ||
| 330 | |||
| 331 | len = strlen(filename); | ||
| 332 | rsize = len + 1; | ||
| 333 | transform = (strstr(filename, "/") == NULL); | ||
| 334 | { | ||
| 335 | /* We will convert this to "%s.s?" or "lib%s.s?" */ | ||
| 336 | rsize += strlen(extension);/* The length of ".s?" */ | ||
| 337 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | ||
| 338 | rsize += 3; /* The length of "lib" */ | ||
| 339 | } | ||
| 340 | translated = OPENSSL_malloc(rsize); | ||
| 341 | if(translated == NULL) | ||
| 342 | { | ||
| 343 | DSOerr(DSO_F_DL_NAME_CONVERTER, | ||
| 344 | DSO_R_NAME_TRANSLATION_FAILED); | ||
| 345 | return(NULL); | ||
| 346 | } | ||
| 347 | if(transform) | ||
| 348 | { | ||
| 349 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | ||
| 350 | sprintf(translated, "lib%s%s", filename, extension); | ||
| 351 | else | ||
| 352 | sprintf(translated, "%s%s", filename, extension); | ||
| 353 | } | ||
| 354 | else | ||
| 355 | sprintf(translated, "%s", filename); | ||
| 356 | return(translated); | ||
| 357 | } | ||
| 358 | |||
| 359 | static int dl_pathbyaddr(void *addr,char *path,int sz) | ||
| 360 | { | ||
| 361 | struct shl_descriptor inf; | ||
| 362 | int i,len; | ||
| 363 | |||
| 364 | if (addr == NULL) | ||
| 365 | { | ||
| 366 | union { int(*f)(void*,char*,int); void *p; } t = | ||
| 367 | { dl_pathbyaddr }; | ||
| 368 | addr = t.p; | ||
| 369 | } | ||
| 370 | |||
| 371 | for (i=-1;shl_get_r(i,&inf)==0;i++) | ||
| 372 | { | ||
| 373 | if (((size_t)addr >= inf.tstart && (size_t)addr < inf.tend) || | ||
| 374 | ((size_t)addr >= inf.dstart && (size_t)addr < inf.dend)) | ||
| 375 | { | ||
| 376 | len = (int)strlen(inf.filename); | ||
| 377 | if (sz <= 0) return len+1; | ||
| 378 | if (len >= sz) len=sz-1; | ||
| 379 | memcpy(path,inf.filename,len); | ||
| 380 | path[len++] = 0; | ||
| 381 | return len; | ||
| 382 | } | ||
| 383 | } | ||
| 384 | |||
| 385 | return -1; | ||
| 386 | } | ||
| 387 | |||
| 388 | static void *dl_globallookup(const char *name) | ||
| 389 | { | ||
| 390 | void *ret; | ||
| 391 | shl_t h = NULL; | ||
| 392 | |||
| 393 | return shl_findsym(&h,name,TYPE_UNDEFINED,&ret) ? NULL : ret; | ||
| 394 | } | ||
| 395 | #endif /* DSO_DL */ | ||
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index c2bc61760b..578a20d91d 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c | |||
| @@ -85,8 +85,7 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) | |||
| 85 | # define HAVE_DLINFO 1 | 85 | # define HAVE_DLINFO 1 |
| 86 | # if defined(_AIX) || defined(__CYGWIN__) || \ | 86 | # if defined(_AIX) || defined(__CYGWIN__) || \ |
| 87 | defined(__SCO_VERSION__) || defined(_SCO_ELF) || \ | 87 | defined(__SCO_VERSION__) || defined(_SCO_ELF) || \ |
| 88 | (defined(__osf__) && !defined(RTLD_NEXT)) || \ | 88 | (defined(__OpenBSD__) && (!defined(__ELF__) || !defined(RTLD_SELF))) |
| 89 | (defined(__OpenBSD__) && !defined(RTLD_SELF)) | ||
| 90 | # undef HAVE_DLINFO | 89 | # undef HAVE_DLINFO |
| 91 | # endif | 90 | # endif |
| 92 | #endif | 91 | #endif |
| @@ -296,6 +295,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 296 | const char *filespec2) | 295 | const char *filespec2) |
| 297 | { | 296 | { |
| 298 | char *merged; | 297 | char *merged; |
| 298 | size_t len; | ||
| 299 | 299 | ||
| 300 | if(!filespec1 && !filespec2) | 300 | if(!filespec1 && !filespec2) |
| 301 | { | 301 | { |
| @@ -307,17 +307,19 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 307 | same goes if the second file specification is missing. */ | 307 | same goes if the second file specification is missing. */ |
| 308 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) | 308 | if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) |
| 309 | { | 309 | { |
| 310 | merged = OPENSSL_malloc(strlen(filespec1) + 1); | 310 | len = strlen(filespec1) + 1; |
| 311 | merged = OPENSSL_malloc(len); | ||
| 311 | if(!merged) | 312 | if(!merged) |
| 312 | { | 313 | { |
| 313 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); | 314 | DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); |
| 314 | return(NULL); | 315 | return(NULL); |
| 315 | } | 316 | } |
| 316 | strcpy(merged, filespec1); | 317 | strlcpy(merged, filespec1, len); |
| 317 | } | 318 | } |
| 318 | /* If the first file specification is missing, the second one rules. */ | 319 | /* If the first file specification is missing, the second one rules. */ |
| 319 | else if (!filespec1) | 320 | else if (!filespec1) |
| 320 | { | 321 | { |
| 322 | len = strlen(filespec2) + 1; | ||
| 321 | merged = OPENSSL_malloc(strlen(filespec2) + 1); | 323 | merged = OPENSSL_malloc(strlen(filespec2) + 1); |
| 322 | if(!merged) | 324 | if(!merged) |
| 323 | { | 325 | { |
| @@ -325,7 +327,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 325 | ERR_R_MALLOC_FAILURE); | 327 | ERR_R_MALLOC_FAILURE); |
| 326 | return(NULL); | 328 | return(NULL); |
| 327 | } | 329 | } |
| 328 | strcpy(merged, filespec2); | 330 | strlcpy(merged, filespec2, len); |
| 329 | } | 331 | } |
| 330 | else | 332 | else |
| 331 | /* This part isn't as trivial as it looks. It assumes that | 333 | /* This part isn't as trivial as it looks. It assumes that |
| @@ -351,9 +353,9 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, | |||
| 351 | ERR_R_MALLOC_FAILURE); | 353 | ERR_R_MALLOC_FAILURE); |
| 352 | return(NULL); | 354 | return(NULL); |
| 353 | } | 355 | } |
| 354 | strcpy(merged, filespec2); | 356 | strlcpy(merged, filespec2, len + 2); |
| 355 | merged[spec2len] = '/'; | 357 | merged[spec2len] = '/'; |
| 356 | strcpy(&merged[spec2len + 1], filespec1); | 358 | strlcpy(&merged[spec2len + 1], filespec1, len + 1 - spec2len); |
| 357 | } | 359 | } |
| 358 | return(merged); | 360 | return(merged); |
| 359 | } | 361 | } |
| @@ -392,16 +394,16 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) | |||
| 392 | if(transform) | 394 | if(transform) |
| 393 | { | 395 | { |
| 394 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) | 396 | if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) |
| 395 | sprintf(translated, "lib%s" DSO_ext, filename); | 397 | snprintf(translated, rsize, "lib%s" DSO_ext, filename); |
| 396 | else | 398 | else |
| 397 | sprintf(translated, "%s" DSO_ext, filename); | 399 | snprintf(translated, rsize, "%s" DSO_ext, filename); |
| 398 | } | 400 | } |
| 399 | else | 401 | else |
| 400 | sprintf(translated, "%s", filename); | 402 | snprintf(translated, rsize, "%s", filename); |
| 401 | return(translated); | 403 | return(translated); |
| 402 | } | 404 | } |
| 403 | 405 | ||
| 404 | #ifdef __sgi | 406 | #if defined(__sgi) && !defined(__OpenBSD__) |
| 405 | /* | 407 | /* |
| 406 | This is a quote from IRIX manual for dladdr(3c): | 408 | This is a quote from IRIX manual for dladdr(3c): |
| 407 | 409 | ||
diff --git a/src/lib/libcrypto/dso/dso_vms.c b/src/lib/libcrypto/dso/dso_vms.c new file mode 100644 index 0000000000..321512772a --- /dev/null +++ b/src/lib/libcrypto/dso/dso_vms.c | |||
| @@ -0,0 +1,504 @@ | |||
| 1 | /* dso_vms.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <errno.h> | ||
| 62 | #include "cryptlib.h" | ||
| 63 | #include <openssl/dso.h> | ||
| 64 | #ifdef OPENSSL_SYS_VMS | ||
| 65 | #pragma message disable DOLLARID | ||
| 66 | #include <rms.h> | ||
| 67 | #include <lib$routines.h> | ||
| 68 | #include <stsdef.h> | ||
| 69 | #include <descrip.h> | ||
| 70 | #include <starlet.h> | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #ifndef OPENSSL_SYS_VMS | ||
| 74 | DSO_METHOD *DSO_METHOD_vms(void) | ||
| 75 | { | ||
| 76 | return NULL; | ||
| 77 | } | ||
| 78 | #else | ||
| 79 | #pragma message disable DOLLARID | ||
| 80 | |||
| 81 | static int vms_load(DSO *dso); | ||
| 82 | static int vms_unload(DSO *dso); | ||
| 83 | static void *vms_bind_var(DSO *dso, const char *symname); | ||
| 84 | static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname); | ||
| 85 | #if 0 | ||
| 86 | static int vms_unbind_var(DSO *dso, char *symname, void *symptr); | ||
| 87 | static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | ||
| 88 | static int vms_init(DSO *dso); | ||
| 89 | static int vms_finish(DSO *dso); | ||
| 90 | static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg); | ||
| 91 | #endif | ||
| 92 | static char *vms_name_converter(DSO *dso, const char *filename); | ||
| 93 | static char *vms_merger(DSO *dso, const char *filespec1, | ||
| 94 | const char *filespec2); | ||
| 95 | |||
| 96 | static DSO_METHOD dso_meth_vms = { | ||
| 97 | "OpenSSL 'VMS' shared library method", | ||
| 98 | vms_load, | ||
| 99 | NULL, /* unload */ | ||
| 100 | vms_bind_var, | ||
| 101 | vms_bind_func, | ||
| 102 | /* For now, "unbind" doesn't exist */ | ||
| 103 | #if 0 | ||
| 104 | NULL, /* unbind_var */ | ||
| 105 | NULL, /* unbind_func */ | ||
| 106 | #endif | ||
| 107 | NULL, /* ctrl */ | ||
| 108 | vms_name_converter, | ||
| 109 | vms_merger, | ||
| 110 | NULL, /* init */ | ||
| 111 | NULL /* finish */ | ||
| 112 | }; | ||
| 113 | |||
| 114 | /* On VMS, the only "handle" is the file name. LIB$FIND_IMAGE_SYMBOL depends | ||
| 115 | * on the reference to the file name being the same for all calls regarding | ||
| 116 | * one shared image, so we'll just store it in an instance of the following | ||
| 117 | * structure and put a pointer to that instance in the meth_data stack. | ||
| 118 | */ | ||
| 119 | typedef struct dso_internal_st | ||
| 120 | { | ||
| 121 | /* This should contain the name only, no directory, | ||
| 122 | * no extension, nothing but a name. */ | ||
| 123 | struct dsc$descriptor_s filename_dsc; | ||
| 124 | char filename[FILENAME_MAX+1]; | ||
| 125 | /* This contains whatever is not in filename, if needed. | ||
| 126 | * Normally not defined. */ | ||
| 127 | struct dsc$descriptor_s imagename_dsc; | ||
| 128 | char imagename[FILENAME_MAX+1]; | ||
| 129 | } DSO_VMS_INTERNAL; | ||
| 130 | |||
| 131 | |||
| 132 | DSO_METHOD *DSO_METHOD_vms(void) | ||
| 133 | { | ||
| 134 | return(&dso_meth_vms); | ||
| 135 | } | ||
| 136 | |||
| 137 | static int vms_load(DSO *dso) | ||
| 138 | { | ||
| 139 | void *ptr = NULL; | ||
| 140 | /* See applicable comments in dso_dl.c */ | ||
| 141 | char *filename = DSO_convert_filename(dso, NULL); | ||
| 142 | DSO_VMS_INTERNAL *p; | ||
| 143 | const char *sp1, *sp2; /* Search result */ | ||
| 144 | |||
| 145 | if(filename == NULL) | ||
| 146 | { | ||
| 147 | DSOerr(DSO_F_VMS_LOAD,DSO_R_NO_FILENAME); | ||
| 148 | goto err; | ||
| 149 | } | ||
| 150 | |||
| 151 | /* A file specification may look like this: | ||
| 152 | * | ||
| 153 | * node::dev:[dir-spec]name.type;ver | ||
| 154 | * | ||
| 155 | * or (for compatibility with TOPS-20): | ||
| 156 | * | ||
| 157 | * node::dev:<dir-spec>name.type;ver | ||
| 158 | * | ||
| 159 | * and the dir-spec uses '.' as separator. Also, a dir-spec | ||
| 160 | * may consist of several parts, with mixed use of [] and <>: | ||
| 161 | * | ||
| 162 | * [dir1.]<dir2> | ||
| 163 | * | ||
| 164 | * We need to split the file specification into the name and | ||
| 165 | * the rest (both before and after the name itself). | ||
| 166 | */ | ||
| 167 | /* Start with trying to find the end of a dir-spec, and save the | ||
| 168 | position of the byte after in sp1 */ | ||
| 169 | sp1 = strrchr(filename, ']'); | ||
| 170 | sp2 = strrchr(filename, '>'); | ||
| 171 | if (sp1 == NULL) sp1 = sp2; | ||
| 172 | if (sp2 != NULL && sp2 > sp1) sp1 = sp2; | ||
| 173 | if (sp1 == NULL) sp1 = strrchr(filename, ':'); | ||
| 174 | if (sp1 == NULL) | ||
| 175 | sp1 = filename; | ||
| 176 | else | ||
| 177 | sp1++; /* The byte after the found character */ | ||
| 178 | /* Now, let's see if there's a type, and save the position in sp2 */ | ||
| 179 | sp2 = strchr(sp1, '.'); | ||
| 180 | /* If we found it, that's where we'll cut. Otherwise, look for a | ||
| 181 | version number and save the position in sp2 */ | ||
| 182 | if (sp2 == NULL) sp2 = strchr(sp1, ';'); | ||
| 183 | /* If there was still nothing to find, set sp2 to point at the end of | ||
| 184 | the string */ | ||
| 185 | if (sp2 == NULL) sp2 = sp1 + strlen(sp1); | ||
| 186 | |||
| 187 | /* Check that we won't get buffer overflows */ | ||
| 188 | if (sp2 - sp1 > FILENAME_MAX | ||
| 189 | || (sp1 - filename) + strlen(sp2) > FILENAME_MAX) | ||
| 190 | { | ||
| 191 | DSOerr(DSO_F_VMS_LOAD,DSO_R_FILENAME_TOO_BIG); | ||
| 192 | goto err; | ||
| 193 | } | ||
| 194 | |||
| 195 | p = (DSO_VMS_INTERNAL *)OPENSSL_malloc(sizeof(DSO_VMS_INTERNAL)); | ||
| 196 | if(p == NULL) | ||
| 197 | { | ||
| 198 | DSOerr(DSO_F_VMS_LOAD,ERR_R_MALLOC_FAILURE); | ||
| 199 | goto err; | ||
| 200 | } | ||
| 201 | |||
| 202 | strncpy(p->filename, sp1, sp2-sp1); | ||
| 203 | p->filename[sp2-sp1] = '\0'; | ||
| 204 | |||
| 205 | strncpy(p->imagename, filename, sp1-filename); | ||
| 206 | p->imagename[sp1-filename] = '\0'; | ||
| 207 | strcat(p->imagename, sp2); | ||
| 208 | |||
| 209 | p->filename_dsc.dsc$w_length = strlen(p->filename); | ||
| 210 | p->filename_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 211 | p->filename_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
| 212 | p->filename_dsc.dsc$a_pointer = p->filename; | ||
| 213 | p->imagename_dsc.dsc$w_length = strlen(p->imagename); | ||
| 214 | p->imagename_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 215 | p->imagename_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
| 216 | p->imagename_dsc.dsc$a_pointer = p->imagename; | ||
| 217 | |||
| 218 | if(!sk_void_push(dso->meth_data, (char *)p)) | ||
| 219 | { | ||
| 220 | DSOerr(DSO_F_VMS_LOAD,DSO_R_STACK_ERROR); | ||
| 221 | goto err; | ||
| 222 | } | ||
| 223 | |||
| 224 | /* Success (for now, we lie. We actually do not know...) */ | ||
| 225 | dso->loaded_filename = filename; | ||
| 226 | return(1); | ||
| 227 | err: | ||
| 228 | /* Cleanup! */ | ||
| 229 | if(p != NULL) | ||
| 230 | OPENSSL_free(p); | ||
| 231 | if(filename != NULL) | ||
| 232 | OPENSSL_free(filename); | ||
| 233 | return(0); | ||
| 234 | } | ||
| 235 | |||
| 236 | /* Note that this doesn't actually unload the shared image, as there is no | ||
| 237 | * such thing in VMS. Next time it get loaded again, a new copy will | ||
| 238 | * actually be loaded. | ||
| 239 | */ | ||
| 240 | static int vms_unload(DSO *dso) | ||
| 241 | { | ||
| 242 | DSO_VMS_INTERNAL *p; | ||
| 243 | if(dso == NULL) | ||
| 244 | { | ||
| 245 | DSOerr(DSO_F_VMS_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | ||
| 246 | return(0); | ||
| 247 | } | ||
| 248 | if(sk_void_num(dso->meth_data) < 1) | ||
| 249 | return(1); | ||
| 250 | p = (DSO_VMS_INTERNAL *)sk_void_pop(dso->meth_data); | ||
| 251 | if(p == NULL) | ||
| 252 | { | ||
| 253 | DSOerr(DSO_F_VMS_UNLOAD,DSO_R_NULL_HANDLE); | ||
| 254 | return(0); | ||
| 255 | } | ||
| 256 | /* Cleanup */ | ||
| 257 | OPENSSL_free(p); | ||
| 258 | return(1); | ||
| 259 | } | ||
| 260 | |||
| 261 | /* We must do this in a separate function because of the way the exception | ||
| 262 | handler works (it makes this function return */ | ||
| 263 | static int do_find_symbol(DSO_VMS_INTERNAL *ptr, | ||
| 264 | struct dsc$descriptor_s *symname_dsc, void **sym, | ||
| 265 | unsigned long flags) | ||
| 266 | { | ||
| 267 | /* Make sure that signals are caught and returned instead of | ||
| 268 | aborting the program. The exception handler gets unestablished | ||
| 269 | automatically on return from this function. */ | ||
| 270 | lib$establish(lib$sig_to_ret); | ||
| 271 | |||
| 272 | if(ptr->imagename_dsc.dsc$w_length) | ||
| 273 | return lib$find_image_symbol(&ptr->filename_dsc, | ||
| 274 | symname_dsc, sym, | ||
| 275 | &ptr->imagename_dsc, flags); | ||
| 276 | else | ||
| 277 | return lib$find_image_symbol(&ptr->filename_dsc, | ||
| 278 | symname_dsc, sym, | ||
| 279 | 0, flags); | ||
| 280 | } | ||
| 281 | |||
| 282 | void vms_bind_sym(DSO *dso, const char *symname, void **sym) | ||
| 283 | { | ||
| 284 | DSO_VMS_INTERNAL *ptr; | ||
| 285 | int status; | ||
| 286 | #if 0 | ||
| 287 | int flags = (1<<4); /* LIB$M_FIS_MIXEDCASE, but this symbol isn't | ||
| 288 | defined in VMS older than 7.0 or so */ | ||
| 289 | #else | ||
| 290 | int flags = 0; | ||
| 291 | #endif | ||
| 292 | struct dsc$descriptor_s symname_dsc; | ||
| 293 | *sym = NULL; | ||
| 294 | |||
| 295 | symname_dsc.dsc$w_length = strlen(symname); | ||
| 296 | symname_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 297 | symname_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
| 298 | symname_dsc.dsc$a_pointer = (char *)symname; /* The cast is needed */ | ||
| 299 | |||
| 300 | if((dso == NULL) || (symname == NULL)) | ||
| 301 | { | ||
| 302 | DSOerr(DSO_F_VMS_BIND_SYM,ERR_R_PASSED_NULL_PARAMETER); | ||
| 303 | return; | ||
| 304 | } | ||
| 305 | if(sk_void_num(dso->meth_data) < 1) | ||
| 306 | { | ||
| 307 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_STACK_ERROR); | ||
| 308 | return; | ||
| 309 | } | ||
| 310 | ptr = (DSO_VMS_INTERNAL *)sk_void_value(dso->meth_data, | ||
| 311 | sk_void_num(dso->meth_data) - 1); | ||
| 312 | if(ptr == NULL) | ||
| 313 | { | ||
| 314 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_NULL_HANDLE); | ||
| 315 | return; | ||
| 316 | } | ||
| 317 | |||
| 318 | if(dso->flags & DSO_FLAG_UPCASE_SYMBOL) flags = 0; | ||
| 319 | |||
| 320 | status = do_find_symbol(ptr, &symname_dsc, sym, flags); | ||
| 321 | |||
| 322 | if(!$VMS_STATUS_SUCCESS(status)) | ||
| 323 | { | ||
| 324 | unsigned short length; | ||
| 325 | char errstring[257]; | ||
| 326 | struct dsc$descriptor_s errstring_dsc; | ||
| 327 | |||
| 328 | errstring_dsc.dsc$w_length = sizeof(errstring); | ||
| 329 | errstring_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 330 | errstring_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
| 331 | errstring_dsc.dsc$a_pointer = errstring; | ||
| 332 | |||
| 333 | *sym = NULL; | ||
| 334 | |||
| 335 | status = sys$getmsg(status, &length, &errstring_dsc, 1, 0); | ||
| 336 | |||
| 337 | if (!$VMS_STATUS_SUCCESS(status)) | ||
| 338 | lib$signal(status); /* This is really bad. Abort! */ | ||
| 339 | else | ||
| 340 | { | ||
| 341 | errstring[length] = '\0'; | ||
| 342 | |||
| 343 | DSOerr(DSO_F_VMS_BIND_SYM,DSO_R_SYM_FAILURE); | ||
| 344 | if (ptr->imagename_dsc.dsc$w_length) | ||
| 345 | ERR_add_error_data(9, | ||
| 346 | "Symbol ", symname, | ||
| 347 | " in ", ptr->filename, | ||
| 348 | " (", ptr->imagename, ")", | ||
| 349 | ": ", errstring); | ||
| 350 | else | ||
| 351 | ERR_add_error_data(6, | ||
| 352 | "Symbol ", symname, | ||
| 353 | " in ", ptr->filename, | ||
| 354 | ": ", errstring); | ||
| 355 | } | ||
| 356 | return; | ||
| 357 | } | ||
| 358 | return; | ||
| 359 | } | ||
| 360 | |||
| 361 | static void *vms_bind_var(DSO *dso, const char *symname) | ||
| 362 | { | ||
| 363 | void *sym = 0; | ||
| 364 | vms_bind_sym(dso, symname, &sym); | ||
| 365 | return sym; | ||
| 366 | } | ||
| 367 | |||
| 368 | static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname) | ||
| 369 | { | ||
| 370 | DSO_FUNC_TYPE sym = 0; | ||
| 371 | vms_bind_sym(dso, symname, (void **)&sym); | ||
| 372 | return sym; | ||
| 373 | } | ||
| 374 | |||
| 375 | static char *vms_merger(DSO *dso, const char *filespec1, const char *filespec2) | ||
| 376 | { | ||
| 377 | int status; | ||
| 378 | int filespec1len, filespec2len; | ||
| 379 | struct FAB fab; | ||
| 380 | #ifdef NAML$C_MAXRSS | ||
| 381 | struct NAML nam; | ||
| 382 | char esa[NAML$C_MAXRSS]; | ||
| 383 | #else | ||
| 384 | struct NAM nam; | ||
| 385 | char esa[NAM$C_MAXRSS]; | ||
| 386 | #endif | ||
| 387 | char *merged; | ||
| 388 | |||
| 389 | if (!filespec1) filespec1 = ""; | ||
| 390 | if (!filespec2) filespec2 = ""; | ||
| 391 | filespec1len = strlen(filespec1); | ||
| 392 | filespec2len = strlen(filespec2); | ||
| 393 | |||
| 394 | fab = cc$rms_fab; | ||
| 395 | #ifdef NAML$C_MAXRSS | ||
| 396 | nam = cc$rms_naml; | ||
| 397 | #else | ||
| 398 | nam = cc$rms_nam; | ||
| 399 | #endif | ||
| 400 | |||
| 401 | fab.fab$l_fna = (char *)filespec1; | ||
| 402 | fab.fab$b_fns = filespec1len; | ||
| 403 | fab.fab$l_dna = (char *)filespec2; | ||
| 404 | fab.fab$b_dns = filespec2len; | ||
| 405 | #ifdef NAML$C_MAXRSS | ||
| 406 | if (filespec1len > NAM$C_MAXRSS) | ||
| 407 | { | ||
| 408 | fab.fab$l_fna = 0; | ||
| 409 | fab.fab$b_fns = 0; | ||
| 410 | nam.naml$l_long_filename = (char *)filespec1; | ||
| 411 | nam.naml$l_long_filename_size = filespec1len; | ||
| 412 | } | ||
| 413 | if (filespec2len > NAM$C_MAXRSS) | ||
| 414 | { | ||
| 415 | fab.fab$l_dna = 0; | ||
| 416 | fab.fab$b_dns = 0; | ||
| 417 | nam.naml$l_long_defname = (char *)filespec2; | ||
| 418 | nam.naml$l_long_defname_size = filespec2len; | ||
| 419 | } | ||
| 420 | nam.naml$l_esa = esa; | ||
| 421 | nam.naml$b_ess = NAM$C_MAXRSS; | ||
| 422 | nam.naml$l_long_expand = esa; | ||
| 423 | nam.naml$l_long_expand_alloc = sizeof(esa); | ||
| 424 | nam.naml$b_nop = NAM$M_SYNCHK | NAM$M_PWD; | ||
| 425 | nam.naml$v_no_short_upcase = 1; | ||
| 426 | fab.fab$l_naml = &nam; | ||
| 427 | #else | ||
| 428 | nam.nam$l_esa = esa; | ||
| 429 | nam.nam$b_ess = NAM$C_MAXRSS; | ||
| 430 | nam.nam$b_nop = NAM$M_SYNCHK | NAM$M_PWD; | ||
| 431 | fab.fab$l_nam = &nam; | ||
| 432 | #endif | ||
| 433 | |||
| 434 | status = sys$parse(&fab, 0, 0); | ||
| 435 | |||
| 436 | if(!$VMS_STATUS_SUCCESS(status)) | ||
| 437 | { | ||
| 438 | unsigned short length; | ||
| 439 | char errstring[257]; | ||
| 440 | struct dsc$descriptor_s errstring_dsc; | ||
| 441 | |||
| 442 | errstring_dsc.dsc$w_length = sizeof(errstring); | ||
| 443 | errstring_dsc.dsc$b_dtype = DSC$K_DTYPE_T; | ||
| 444 | errstring_dsc.dsc$b_class = DSC$K_CLASS_S; | ||
| 445 | errstring_dsc.dsc$a_pointer = errstring; | ||
| 446 | |||
| 447 | status = sys$getmsg(status, &length, &errstring_dsc, 1, 0); | ||
| 448 | |||
| 449 | if (!$VMS_STATUS_SUCCESS(status)) | ||
| 450 | lib$signal(status); /* This is really bad. Abort! */ | ||
| 451 | else | ||
| 452 | { | ||
| 453 | errstring[length] = '\0'; | ||
| 454 | |||
| 455 | DSOerr(DSO_F_VMS_MERGER,DSO_R_FAILURE); | ||
| 456 | ERR_add_error_data(7, | ||
| 457 | "filespec \"", filespec1, "\", ", | ||
| 458 | "defaults \"", filespec2, "\": ", | ||
| 459 | errstring); | ||
| 460 | } | ||
| 461 | return(NULL); | ||
| 462 | } | ||
| 463 | #ifdef NAML$C_MAXRSS | ||
| 464 | if (nam.naml$l_long_expand_size) | ||
| 465 | { | ||
| 466 | merged = OPENSSL_malloc(nam.naml$l_long_expand_size + 1); | ||
| 467 | if(!merged) | ||
| 468 | goto malloc_err; | ||
| 469 | strncpy(merged, nam.naml$l_long_expand, | ||
| 470 | nam.naml$l_long_expand_size); | ||
| 471 | merged[nam.naml$l_long_expand_size] = '\0'; | ||
| 472 | } | ||
| 473 | else | ||
| 474 | { | ||
| 475 | merged = OPENSSL_malloc(nam.naml$b_esl + 1); | ||
| 476 | if(!merged) | ||
| 477 | goto malloc_err; | ||
| 478 | strncpy(merged, nam.naml$l_esa, | ||
| 479 | nam.naml$b_esl); | ||
| 480 | merged[nam.naml$b_esl] = '\0'; | ||
| 481 | } | ||
| 482 | #else | ||
| 483 | merged = OPENSSL_malloc(nam.nam$b_esl + 1); | ||
| 484 | if(!merged) | ||
| 485 | goto malloc_err; | ||
| 486 | strncpy(merged, nam.nam$l_esa, | ||
| 487 | nam.nam$b_esl); | ||
| 488 | merged[nam.nam$b_esl] = '\0'; | ||
| 489 | #endif | ||
| 490 | return(merged); | ||
| 491 | malloc_err: | ||
| 492 | DSOerr(DSO_F_VMS_MERGER, | ||
| 493 | ERR_R_MALLOC_FAILURE); | ||
| 494 | } | ||
| 495 | |||
| 496 | static char *vms_name_converter(DSO *dso, const char *filename) | ||
| 497 | { | ||
| 498 | int len = strlen(filename); | ||
| 499 | char *not_translated = OPENSSL_malloc(len+1); | ||
| 500 | strcpy(not_translated,filename); | ||
| 501 | return(not_translated); | ||
| 502 | } | ||
| 503 | |||
| 504 | #endif /* OPENSSL_SYS_VMS */ | ||
diff --git a/src/lib/libcrypto/dso/dso_win32.c b/src/lib/libcrypto/dso/dso_win32.c new file mode 100644 index 0000000000..6fb6c54181 --- /dev/null +++ b/src/lib/libcrypto/dso/dso_win32.c | |||
| @@ -0,0 +1,844 @@ | |||
| 1 | /* dso_win32.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/dso.h> | ||
| 63 | |||
| 64 | #if !defined(DSO_WIN32) | ||
| 65 | DSO_METHOD *DSO_METHOD_win32(void) | ||
| 66 | { | ||
| 67 | return NULL; | ||
| 68 | } | ||
| 69 | #else | ||
| 70 | |||
| 71 | #ifdef _WIN32_WCE | ||
| 72 | # if _WIN32_WCE < 300 | ||
| 73 | static FARPROC GetProcAddressA(HMODULE hModule,LPCSTR lpProcName) | ||
| 74 | { | ||
| 75 | WCHAR lpProcNameW[64]; | ||
| 76 | int i; | ||
| 77 | |||
| 78 | for (i=0;lpProcName[i] && i<64;i++) | ||
| 79 | lpProcNameW[i] = (WCHAR)lpProcName[i]; | ||
| 80 | if (i==64) return NULL; | ||
| 81 | lpProcNameW[i] = 0; | ||
| 82 | |||
| 83 | return GetProcAddressW(hModule,lpProcNameW); | ||
| 84 | } | ||
| 85 | # endif | ||
| 86 | # undef GetProcAddress | ||
| 87 | # define GetProcAddress GetProcAddressA | ||
| 88 | |||
| 89 | static HINSTANCE LoadLibraryA(LPCSTR lpLibFileName) | ||
| 90 | { | ||
| 91 | WCHAR *fnamw; | ||
| 92 | size_t len_0=strlen(lpLibFileName)+1,i; | ||
| 93 | |||
| 94 | #ifdef _MSC_VER | ||
| 95 | fnamw = (WCHAR *)_alloca (len_0*sizeof(WCHAR)); | ||
| 96 | #else | ||
| 97 | fnamw = (WCHAR *)alloca (len_0*sizeof(WCHAR)); | ||
| 98 | #endif | ||
| 99 | if (fnamw == NULL) | ||
| 100 | { | ||
| 101 | SetLastError(ERROR_NOT_ENOUGH_MEMORY); | ||
| 102 | return NULL; | ||
| 103 | } | ||
| 104 | |||
| 105 | #if defined(_WIN32_WCE) && _WIN32_WCE>=101 | ||
| 106 | if (!MultiByteToWideChar(CP_ACP,0,lpLibFileName,len_0,fnamw,len_0)) | ||
| 107 | #endif | ||
| 108 | for (i=0;i<len_0;i++) fnamw[i]=(WCHAR)lpLibFileName[i]; | ||
| 109 | |||
| 110 | return LoadLibraryW(fnamw); | ||
| 111 | } | ||
| 112 | #endif | ||
| 113 | |||
| 114 | /* Part of the hack in "win32_load" ... */ | ||
| 115 | #define DSO_MAX_TRANSLATED_SIZE 256 | ||
| 116 | |||
| 117 | static int win32_load(DSO *dso); | ||
| 118 | static int win32_unload(DSO *dso); | ||
| 119 | static void *win32_bind_var(DSO *dso, const char *symname); | ||
| 120 | static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname); | ||
| 121 | #if 0 | ||
| 122 | static int win32_unbind_var(DSO *dso, char *symname, void *symptr); | ||
| 123 | static int win32_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); | ||
| 124 | static int win32_init(DSO *dso); | ||
| 125 | static int win32_finish(DSO *dso); | ||
| 126 | static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg); | ||
| 127 | #endif | ||
| 128 | static char *win32_name_converter(DSO *dso, const char *filename); | ||
| 129 | static char *win32_merger(DSO *dso, const char *filespec1, | ||
| 130 | const char *filespec2); | ||
| 131 | static int win32_pathbyaddr(void *addr,char *path,int sz); | ||
| 132 | static void *win32_globallookup(const char *name); | ||
| 133 | |||
| 134 | static const char *openssl_strnchr(const char *string, int c, size_t len); | ||
| 135 | |||
| 136 | static DSO_METHOD dso_meth_win32 = { | ||
| 137 | "OpenSSL 'win32' shared library method", | ||
| 138 | win32_load, | ||
| 139 | win32_unload, | ||
| 140 | win32_bind_var, | ||
| 141 | win32_bind_func, | ||
| 142 | /* For now, "unbind" doesn't exist */ | ||
| 143 | #if 0 | ||
| 144 | NULL, /* unbind_var */ | ||
| 145 | NULL, /* unbind_func */ | ||
| 146 | #endif | ||
| 147 | NULL, /* ctrl */ | ||
| 148 | win32_name_converter, | ||
| 149 | win32_merger, | ||
| 150 | NULL, /* init */ | ||
| 151 | NULL, /* finish */ | ||
| 152 | win32_pathbyaddr, | ||
| 153 | win32_globallookup | ||
| 154 | }; | ||
| 155 | |||
| 156 | DSO_METHOD *DSO_METHOD_win32(void) | ||
| 157 | { | ||
| 158 | return(&dso_meth_win32); | ||
| 159 | } | ||
| 160 | |||
| 161 | /* For this DSO_METHOD, our meth_data STACK will contain; | ||
| 162 | * (i) a pointer to the handle (HINSTANCE) returned from | ||
| 163 | * LoadLibrary(), and copied. | ||
| 164 | */ | ||
| 165 | |||
| 166 | static int win32_load(DSO *dso) | ||
| 167 | { | ||
| 168 | HINSTANCE h = NULL, *p = NULL; | ||
| 169 | /* See applicable comments from dso_dl.c */ | ||
| 170 | char *filename = DSO_convert_filename(dso, NULL); | ||
| 171 | |||
| 172 | if(filename == NULL) | ||
| 173 | { | ||
| 174 | DSOerr(DSO_F_WIN32_LOAD,DSO_R_NO_FILENAME); | ||
| 175 | goto err; | ||
| 176 | } | ||
| 177 | h = LoadLibraryA(filename); | ||
| 178 | if(h == NULL) | ||
| 179 | { | ||
| 180 | DSOerr(DSO_F_WIN32_LOAD,DSO_R_LOAD_FAILED); | ||
| 181 | ERR_add_error_data(3, "filename(", filename, ")"); | ||
| 182 | goto err; | ||
| 183 | } | ||
| 184 | p = (HINSTANCE *)OPENSSL_malloc(sizeof(HINSTANCE)); | ||
| 185 | if(p == NULL) | ||
| 186 | { | ||
| 187 | DSOerr(DSO_F_WIN32_LOAD,ERR_R_MALLOC_FAILURE); | ||
| 188 | goto err; | ||
| 189 | } | ||
| 190 | *p = h; | ||
| 191 | if(!sk_void_push(dso->meth_data, p)) | ||
| 192 | { | ||
| 193 | DSOerr(DSO_F_WIN32_LOAD,DSO_R_STACK_ERROR); | ||
| 194 | goto err; | ||
| 195 | } | ||
| 196 | /* Success */ | ||
| 197 | dso->loaded_filename = filename; | ||
| 198 | return(1); | ||
| 199 | err: | ||
| 200 | /* Cleanup !*/ | ||
| 201 | if(filename != NULL) | ||
| 202 | OPENSSL_free(filename); | ||
| 203 | if(p != NULL) | ||
| 204 | OPENSSL_free(p); | ||
| 205 | if(h != NULL) | ||
| 206 | FreeLibrary(h); | ||
| 207 | return(0); | ||
| 208 | } | ||
| 209 | |||
| 210 | static int win32_unload(DSO *dso) | ||
| 211 | { | ||
| 212 | HINSTANCE *p; | ||
| 213 | if(dso == NULL) | ||
| 214 | { | ||
| 215 | DSOerr(DSO_F_WIN32_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); | ||
| 216 | return(0); | ||
| 217 | } | ||
| 218 | if(sk_void_num(dso->meth_data) < 1) | ||
| 219 | return(1); | ||
| 220 | p = sk_void_pop(dso->meth_data); | ||
| 221 | if(p == NULL) | ||
| 222 | { | ||
| 223 | DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_NULL_HANDLE); | ||
| 224 | return(0); | ||
| 225 | } | ||
| 226 | if(!FreeLibrary(*p)) | ||
| 227 | { | ||
| 228 | DSOerr(DSO_F_WIN32_UNLOAD,DSO_R_UNLOAD_FAILED); | ||
| 229 | /* We should push the value back onto the stack in | ||
| 230 | * case of a retry. */ | ||
| 231 | sk_void_push(dso->meth_data, p); | ||
| 232 | return(0); | ||
| 233 | } | ||
| 234 | /* Cleanup */ | ||
| 235 | OPENSSL_free(p); | ||
| 236 | return(1); | ||
| 237 | } | ||
| 238 | |||
| 239 | /* Using GetProcAddress for variables? TODO: Check this out in | ||
| 240 | * the Win32 API docs, there's probably a variant for variables. */ | ||
| 241 | static void *win32_bind_var(DSO *dso, const char *symname) | ||
| 242 | { | ||
| 243 | HINSTANCE *ptr; | ||
| 244 | void *sym; | ||
| 245 | |||
| 246 | if((dso == NULL) || (symname == NULL)) | ||
| 247 | { | ||
| 248 | DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); | ||
| 249 | return(NULL); | ||
| 250 | } | ||
| 251 | if(sk_void_num(dso->meth_data) < 1) | ||
| 252 | { | ||
| 253 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR); | ||
| 254 | return(NULL); | ||
| 255 | } | ||
| 256 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); | ||
| 257 | if(ptr == NULL) | ||
| 258 | { | ||
| 259 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE); | ||
| 260 | return(NULL); | ||
| 261 | } | ||
| 262 | sym = GetProcAddress(*ptr, symname); | ||
| 263 | if(sym == NULL) | ||
| 264 | { | ||
| 265 | DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_SYM_FAILURE); | ||
| 266 | ERR_add_error_data(3, "symname(", symname, ")"); | ||
| 267 | return(NULL); | ||
| 268 | } | ||
| 269 | return(sym); | ||
| 270 | } | ||
| 271 | |||
| 272 | static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) | ||
| 273 | { | ||
| 274 | HINSTANCE *ptr; | ||
| 275 | void *sym; | ||
| 276 | |||
| 277 | if((dso == NULL) || (symname == NULL)) | ||
| 278 | { | ||
| 279 | DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); | ||
| 280 | return(NULL); | ||
| 281 | } | ||
| 282 | if(sk_void_num(dso->meth_data) < 1) | ||
| 283 | { | ||
| 284 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR); | ||
| 285 | return(NULL); | ||
| 286 | } | ||
| 287 | ptr = sk_void_value(dso->meth_data, sk_void_num(dso->meth_data) - 1); | ||
| 288 | if(ptr == NULL) | ||
| 289 | { | ||
| 290 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE); | ||
| 291 | return(NULL); | ||
| 292 | } | ||
| 293 | sym = GetProcAddress(*ptr, symname); | ||
| 294 | if(sym == NULL) | ||
| 295 | { | ||
| 296 | DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_SYM_FAILURE); | ||
| 297 | ERR_add_error_data(3, "symname(", symname, ")"); | ||
| 298 | return(NULL); | ||
| 299 | } | ||
| 300 | return((DSO_FUNC_TYPE)sym); | ||
| 301 | } | ||
| 302 | |||
| 303 | struct file_st | ||
| 304 | { | ||
| 305 | const char *node; int nodelen; | ||
| 306 | const char *device; int devicelen; | ||
| 307 | const char *predir; int predirlen; | ||
| 308 | const char *dir; int dirlen; | ||
| 309 | const char *file; int filelen; | ||
| 310 | }; | ||
| 311 | |||
| 312 | static struct file_st *win32_splitter(DSO *dso, const char *filename, | ||
| 313 | int assume_last_is_dir) | ||
| 314 | { | ||
| 315 | struct file_st *result = NULL; | ||
| 316 | enum { IN_NODE, IN_DEVICE, IN_FILE } position; | ||
| 317 | const char *start = filename; | ||
| 318 | char last; | ||
| 319 | |||
| 320 | if (!filename) | ||
| 321 | { | ||
| 322 | DSOerr(DSO_F_WIN32_SPLITTER,DSO_R_NO_FILENAME); | ||
| 323 | /*goto err;*/ | ||
| 324 | return(NULL); | ||
| 325 | } | ||
| 326 | |||
| 327 | result = OPENSSL_malloc(sizeof(struct file_st)); | ||
| 328 | if(result == NULL) | ||
| 329 | { | ||
| 330 | DSOerr(DSO_F_WIN32_SPLITTER, | ||
| 331 | ERR_R_MALLOC_FAILURE); | ||
| 332 | return(NULL); | ||
| 333 | } | ||
| 334 | |||
| 335 | memset(result, 0, sizeof(struct file_st)); | ||
| 336 | position = IN_DEVICE; | ||
| 337 | |||
| 338 | if((filename[0] == '\\' && filename[1] == '\\') | ||
| 339 | || (filename[0] == '/' && filename[1] == '/')) | ||
| 340 | { | ||
| 341 | position = IN_NODE; | ||
| 342 | filename += 2; | ||
| 343 | start = filename; | ||
| 344 | result->node = start; | ||
| 345 | } | ||
| 346 | |||
| 347 | do | ||
| 348 | { | ||
| 349 | last = filename[0]; | ||
| 350 | switch(last) | ||
| 351 | { | ||
| 352 | case ':': | ||
| 353 | if(position != IN_DEVICE) | ||
| 354 | { | ||
| 355 | DSOerr(DSO_F_WIN32_SPLITTER, | ||
| 356 | DSO_R_INCORRECT_FILE_SYNTAX); | ||
| 357 | /*goto err;*/ | ||
| 358 | OPENSSL_free(result); | ||
| 359 | return(NULL); | ||
| 360 | } | ||
| 361 | result->device = start; | ||
| 362 | result->devicelen = (int)(filename - start); | ||
| 363 | position = IN_FILE; | ||
| 364 | start = ++filename; | ||
| 365 | result->dir = start; | ||
| 366 | break; | ||
| 367 | case '\\': | ||
| 368 | case '/': | ||
| 369 | if(position == IN_NODE) | ||
| 370 | { | ||
| 371 | result->nodelen = (int)(filename - start); | ||
| 372 | position = IN_FILE; | ||
| 373 | start = ++filename; | ||
| 374 | result->dir = start; | ||
| 375 | } | ||
| 376 | else if(position == IN_DEVICE) | ||
| 377 | { | ||
| 378 | position = IN_FILE; | ||
| 379 | filename++; | ||
| 380 | result->dir = start; | ||
| 381 | result->dirlen = (int)(filename - start); | ||
| 382 | start = filename; | ||
| 383 | } | ||
| 384 | else | ||
| 385 | { | ||
| 386 | filename++; | ||
| 387 | result->dirlen += (int)(filename - start); | ||
| 388 | start = filename; | ||
| 389 | } | ||
| 390 | break; | ||
| 391 | case '\0': | ||
| 392 | if(position == IN_NODE) | ||
| 393 | { | ||
| 394 | result->nodelen = (int)(filename - start); | ||
| 395 | } | ||
| 396 | else | ||
| 397 | { | ||
| 398 | if(filename - start > 0) | ||
| 399 | { | ||
| 400 | if (assume_last_is_dir) | ||
| 401 | { | ||
| 402 | if (position == IN_DEVICE) | ||
| 403 | { | ||
| 404 | result->dir = start; | ||
| 405 | result->dirlen = 0; | ||
| 406 | } | ||
| 407 | result->dirlen += | ||
| 408 | (int)(filename - start); | ||
| 409 | } | ||
| 410 | else | ||
| 411 | { | ||
| 412 | result->file = start; | ||
| 413 | result->filelen = | ||
| 414 | (int)(filename - start); | ||
| 415 | } | ||
| 416 | } | ||
| 417 | } | ||
| 418 | break; | ||
| 419 | default: | ||
| 420 | filename++; | ||
| 421 | break; | ||
| 422 | } | ||
| 423 | } | ||
| 424 | while(last); | ||
| 425 | |||
| 426 | if(!result->nodelen) result->node = NULL; | ||
| 427 | if(!result->devicelen) result->device = NULL; | ||
| 428 | if(!result->dirlen) result->dir = NULL; | ||
| 429 | if(!result->filelen) result->file = NULL; | ||
| 430 | |||
| 431 | return(result); | ||
| 432 | } | ||
| 433 | |||
| 434 | static char *win32_joiner(DSO *dso, const struct file_st *file_split) | ||
| 435 | { | ||
| 436 | int len = 0, offset = 0; | ||
| 437 | char *result = NULL; | ||
| 438 | const char *start; | ||
| 439 | |||
| 440 | if(!file_split) | ||
| 441 | { | ||
| 442 | DSOerr(DSO_F_WIN32_JOINER, | ||
| 443 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 444 | return(NULL); | ||
| 445 | } | ||
| 446 | if(file_split->node) | ||
| 447 | { | ||
| 448 | len += 2 + file_split->nodelen; /* 2 for starting \\ */ | ||
| 449 | if(file_split->predir || file_split->dir || file_split->file) | ||
| 450 | len++; /* 1 for ending \ */ | ||
| 451 | } | ||
| 452 | else if(file_split->device) | ||
| 453 | { | ||
| 454 | len += file_split->devicelen + 1; /* 1 for ending : */ | ||
| 455 | } | ||
| 456 | len += file_split->predirlen; | ||
| 457 | if(file_split->predir && (file_split->dir || file_split->file)) | ||
| 458 | { | ||
| 459 | len++; /* 1 for ending \ */ | ||
| 460 | } | ||
| 461 | len += file_split->dirlen; | ||
| 462 | if(file_split->dir && file_split->file) | ||
| 463 | { | ||
| 464 | len++; /* 1 for ending \ */ | ||
| 465 | } | ||
| 466 | len += file_split->filelen; | ||
| 467 | |||
| 468 | if(!len) | ||
| 469 | { | ||
| 470 | DSOerr(DSO_F_WIN32_JOINER, DSO_R_EMPTY_FILE_STRUCTURE); | ||
| 471 | return(NULL); | ||
| 472 | } | ||
| 473 | |||
| 474 | result = OPENSSL_malloc(len + 1); | ||
| 475 | if (!result) | ||
| 476 | { | ||
| 477 | DSOerr(DSO_F_WIN32_JOINER, | ||
| 478 | ERR_R_MALLOC_FAILURE); | ||
| 479 | return(NULL); | ||
| 480 | } | ||
| 481 | |||
| 482 | if(file_split->node) | ||
| 483 | { | ||
| 484 | strcpy(&result[offset], "\\\\"); offset += 2; | ||
| 485 | strncpy(&result[offset], file_split->node, | ||
| 486 | file_split->nodelen); offset += file_split->nodelen; | ||
| 487 | if(file_split->predir || file_split->dir || file_split->file) | ||
| 488 | { | ||
| 489 | result[offset] = '\\'; offset++; | ||
| 490 | } | ||
| 491 | } | ||
| 492 | else if(file_split->device) | ||
| 493 | { | ||
| 494 | strncpy(&result[offset], file_split->device, | ||
| 495 | file_split->devicelen); offset += file_split->devicelen; | ||
| 496 | result[offset] = ':'; offset++; | ||
| 497 | } | ||
| 498 | start = file_split->predir; | ||
| 499 | while(file_split->predirlen > (start - file_split->predir)) | ||
| 500 | { | ||
| 501 | const char *end = openssl_strnchr(start, '/', | ||
| 502 | file_split->predirlen - (start - file_split->predir)); | ||
| 503 | if(!end) | ||
| 504 | end = start | ||
| 505 | + file_split->predirlen | ||
| 506 | - (start - file_split->predir); | ||
| 507 | strncpy(&result[offset], start, | ||
| 508 | end - start); offset += (int)(end - start); | ||
| 509 | result[offset] = '\\'; offset++; | ||
| 510 | start = end + 1; | ||
| 511 | } | ||
| 512 | #if 0 /* Not needed, since the directory converter above already appeneded | ||
| 513 | a backslash */ | ||
| 514 | if(file_split->predir && (file_split->dir || file_split->file)) | ||
| 515 | { | ||
| 516 | result[offset] = '\\'; offset++; | ||
| 517 | } | ||
| 518 | #endif | ||
| 519 | start = file_split->dir; | ||
| 520 | while(file_split->dirlen > (start - file_split->dir)) | ||
| 521 | { | ||
| 522 | const char *end = openssl_strnchr(start, '/', | ||
| 523 | file_split->dirlen - (start - file_split->dir)); | ||
| 524 | if(!end) | ||
| 525 | end = start | ||
| 526 | + file_split->dirlen | ||
| 527 | - (start - file_split->dir); | ||
| 528 | strncpy(&result[offset], start, | ||
| 529 | end - start); offset += (int)(end - start); | ||
| 530 | result[offset] = '\\'; offset++; | ||
| 531 | start = end + 1; | ||
| 532 | } | ||
| 533 | #if 0 /* Not needed, since the directory converter above already appeneded | ||
| 534 | a backslash */ | ||
| 535 | if(file_split->dir && file_split->file) | ||
| 536 | { | ||
| 537 | result[offset] = '\\'; offset++; | ||
| 538 | } | ||
| 539 | #endif | ||
| 540 | strncpy(&result[offset], file_split->file, | ||
| 541 | file_split->filelen); offset += file_split->filelen; | ||
| 542 | result[offset] = '\0'; | ||
| 543 | return(result); | ||
| 544 | } | ||
| 545 | |||
| 546 | static char *win32_merger(DSO *dso, const char *filespec1, const char *filespec2) | ||
| 547 | { | ||
| 548 | char *merged = NULL; | ||
| 549 | struct file_st *filespec1_split = NULL; | ||
| 550 | struct file_st *filespec2_split = NULL; | ||
| 551 | |||
| 552 | if(!filespec1 && !filespec2) | ||
| 553 | { | ||
| 554 | DSOerr(DSO_F_WIN32_MERGER, | ||
| 555 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 556 | return(NULL); | ||
| 557 | } | ||
| 558 | if (!filespec2) | ||
| 559 | { | ||
| 560 | merged = OPENSSL_malloc(strlen(filespec1) + 1); | ||
| 561 | if(!merged) | ||
| 562 | { | ||
| 563 | DSOerr(DSO_F_WIN32_MERGER, | ||
| 564 | ERR_R_MALLOC_FAILURE); | ||
| 565 | return(NULL); | ||
| 566 | } | ||
| 567 | strcpy(merged, filespec1); | ||
| 568 | } | ||
| 569 | else if (!filespec1) | ||
| 570 | { | ||
| 571 | merged = OPENSSL_malloc(strlen(filespec2) + 1); | ||
| 572 | if(!merged) | ||
| 573 | { | ||
| 574 | DSOerr(DSO_F_WIN32_MERGER, | ||
| 575 | ERR_R_MALLOC_FAILURE); | ||
| 576 | return(NULL); | ||
| 577 | } | ||
| 578 | strcpy(merged, filespec2); | ||
| 579 | } | ||
| 580 | else | ||
| 581 | { | ||
| 582 | filespec1_split = win32_splitter(dso, filespec1, 0); | ||
| 583 | if (!filespec1_split) | ||
| 584 | { | ||
| 585 | DSOerr(DSO_F_WIN32_MERGER, | ||
| 586 | ERR_R_MALLOC_FAILURE); | ||
| 587 | return(NULL); | ||
| 588 | } | ||
| 589 | filespec2_split = win32_splitter(dso, filespec2, 1); | ||
| 590 | if (!filespec2_split) | ||
| 591 | { | ||
| 592 | DSOerr(DSO_F_WIN32_MERGER, | ||
| 593 | ERR_R_MALLOC_FAILURE); | ||
| 594 | OPENSSL_free(filespec1_split); | ||
| 595 | return(NULL); | ||
| 596 | } | ||
| 597 | |||
| 598 | /* Fill in into filespec1_split */ | ||
| 599 | if (!filespec1_split->node && !filespec1_split->device) | ||
| 600 | { | ||
| 601 | filespec1_split->node = filespec2_split->node; | ||
| 602 | filespec1_split->nodelen = filespec2_split->nodelen; | ||
| 603 | filespec1_split->device = filespec2_split->device; | ||
| 604 | filespec1_split->devicelen = filespec2_split->devicelen; | ||
| 605 | } | ||
| 606 | if (!filespec1_split->dir) | ||
| 607 | { | ||
| 608 | filespec1_split->dir = filespec2_split->dir; | ||
| 609 | filespec1_split->dirlen = filespec2_split->dirlen; | ||
| 610 | } | ||
| 611 | else if (filespec1_split->dir[0] != '\\' | ||
| 612 | && filespec1_split->dir[0] != '/') | ||
| 613 | { | ||
| 614 | filespec1_split->predir = filespec2_split->dir; | ||
| 615 | filespec1_split->predirlen = filespec2_split->dirlen; | ||
| 616 | } | ||
| 617 | if (!filespec1_split->file) | ||
| 618 | { | ||
| 619 | filespec1_split->file = filespec2_split->file; | ||
| 620 | filespec1_split->filelen = filespec2_split->filelen; | ||
| 621 | } | ||
| 622 | |||
| 623 | merged = win32_joiner(dso, filespec1_split); | ||
| 624 | } | ||
| 625 | OPENSSL_free(filespec1_split); | ||
| 626 | OPENSSL_free(filespec2_split); | ||
| 627 | return(merged); | ||
| 628 | } | ||
| 629 | |||
| 630 | static char *win32_name_converter(DSO *dso, const char *filename) | ||
| 631 | { | ||
| 632 | char *translated; | ||
| 633 | int len, transform; | ||
| 634 | |||
| 635 | len = strlen(filename); | ||
| 636 | transform = ((strstr(filename, "/") == NULL) && | ||
| 637 | (strstr(filename, "\\") == NULL) && | ||
| 638 | (strstr(filename, ":") == NULL)); | ||
| 639 | if(transform) | ||
| 640 | /* We will convert this to "%s.dll" */ | ||
| 641 | translated = OPENSSL_malloc(len + 5); | ||
| 642 | else | ||
| 643 | /* We will simply duplicate filename */ | ||
| 644 | translated = OPENSSL_malloc(len + 1); | ||
| 645 | if(translated == NULL) | ||
| 646 | { | ||
| 647 | DSOerr(DSO_F_WIN32_NAME_CONVERTER, | ||
| 648 | DSO_R_NAME_TRANSLATION_FAILED); | ||
| 649 | return(NULL); | ||
| 650 | } | ||
| 651 | if(transform) | ||
| 652 | sprintf(translated, "%s.dll", filename); | ||
| 653 | else | ||
| 654 | sprintf(translated, "%s", filename); | ||
| 655 | return(translated); | ||
| 656 | } | ||
| 657 | |||
| 658 | static const char *openssl_strnchr(const char *string, int c, size_t len) | ||
| 659 | { | ||
| 660 | size_t i; | ||
| 661 | const char *p; | ||
| 662 | for (i = 0, p = string; i < len && *p; i++, p++) | ||
| 663 | { | ||
| 664 | if (*p == c) | ||
| 665 | return p; | ||
| 666 | } | ||
| 667 | return NULL; | ||
| 668 | } | ||
| 669 | |||
| 670 | #include <tlhelp32.h> | ||
| 671 | #ifdef _WIN32_WCE | ||
| 672 | # define DLLNAME "TOOLHELP.DLL" | ||
| 673 | #else | ||
| 674 | # ifdef MODULEENTRY32 | ||
| 675 | # undef MODULEENTRY32 /* unmask the ASCII version! */ | ||
| 676 | # endif | ||
| 677 | # define DLLNAME "KERNEL32.DLL" | ||
| 678 | #endif | ||
| 679 | |||
| 680 | typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); | ||
| 681 | typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); | ||
| 682 | typedef BOOL (WINAPI *MODULE32)(HANDLE, MODULEENTRY32 *); | ||
| 683 | |||
| 684 | static int win32_pathbyaddr(void *addr,char *path,int sz) | ||
| 685 | { | ||
| 686 | HMODULE dll; | ||
| 687 | HANDLE hModuleSnap = INVALID_HANDLE_VALUE; | ||
| 688 | MODULEENTRY32 me32; | ||
| 689 | CREATETOOLHELP32SNAPSHOT create_snap; | ||
| 690 | CLOSETOOLHELP32SNAPSHOT close_snap; | ||
| 691 | MODULE32 module_first, module_next; | ||
| 692 | int len; | ||
| 693 | |||
| 694 | if (addr == NULL) | ||
| 695 | { | ||
| 696 | union { int(*f)(void*,char*,int); void *p; } t = | ||
| 697 | { win32_pathbyaddr }; | ||
| 698 | addr = t.p; | ||
| 699 | } | ||
| 700 | |||
| 701 | dll = LoadLibrary(TEXT(DLLNAME)); | ||
| 702 | if (dll == NULL) | ||
| 703 | { | ||
| 704 | DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED); | ||
| 705 | return -1; | ||
| 706 | } | ||
| 707 | |||
| 708 | create_snap = (CREATETOOLHELP32SNAPSHOT) | ||
| 709 | GetProcAddress(dll,"CreateToolhelp32Snapshot"); | ||
| 710 | if (create_snap == NULL) | ||
| 711 | { | ||
| 712 | FreeLibrary(dll); | ||
| 713 | DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED); | ||
| 714 | return -1; | ||
| 715 | } | ||
| 716 | /* We take the rest for granted... */ | ||
| 717 | #ifdef _WIN32_WCE | ||
| 718 | close_snap = (CLOSETOOLHELP32SNAPSHOT) | ||
| 719 | GetProcAddress(dll,"CloseToolhelp32Snapshot"); | ||
| 720 | #else | ||
| 721 | close_snap = (CLOSETOOLHELP32SNAPSHOT)CloseHandle; | ||
| 722 | #endif | ||
| 723 | module_first = (MODULE32)GetProcAddress(dll,"Module32First"); | ||
| 724 | module_next = (MODULE32)GetProcAddress(dll,"Module32Next"); | ||
| 725 | |||
| 726 | hModuleSnap = (*create_snap)(TH32CS_SNAPMODULE,0); | ||
| 727 | if( hModuleSnap == INVALID_HANDLE_VALUE ) | ||
| 728 | { | ||
| 729 | FreeLibrary(dll); | ||
| 730 | DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_UNSUPPORTED); | ||
| 731 | return -1; | ||
| 732 | } | ||
| 733 | |||
| 734 | me32.dwSize = sizeof(me32); | ||
| 735 | |||
| 736 | if(!(*module_first)(hModuleSnap,&me32)) | ||
| 737 | { | ||
| 738 | (*close_snap)(hModuleSnap); | ||
| 739 | FreeLibrary(dll); | ||
| 740 | DSOerr(DSO_F_WIN32_PATHBYADDR,DSO_R_FAILURE); | ||
| 741 | return -1; | ||
| 742 | } | ||
| 743 | |||
| 744 | do { | ||
| 745 | if ((BYTE *)addr >= me32.modBaseAddr && | ||
| 746 | (BYTE *)addr < me32.modBaseAddr+me32.modBaseSize) | ||
| 747 | { | ||
| 748 | (*close_snap)(hModuleSnap); | ||
| 749 | FreeLibrary(dll); | ||
| 750 | #ifdef _WIN32_WCE | ||
| 751 | # if _WIN32_WCE >= 101 | ||
| 752 | return WideCharToMultiByte(CP_ACP,0,me32.szExePath,-1, | ||
| 753 | path,sz,NULL,NULL); | ||
| 754 | # else | ||
| 755 | len = (int)wcslen(me32.szExePath); | ||
| 756 | if (sz <= 0) return len+1; | ||
| 757 | if (len >= sz) len=sz-1; | ||
| 758 | for(i=0;i<len;i++) | ||
| 759 | path[i] = (char)me32.szExePath[i]; | ||
| 760 | path[len++] = 0; | ||
| 761 | return len; | ||
| 762 | # endif | ||
| 763 | #else | ||
| 764 | len = (int)strlen(me32.szExePath); | ||
| 765 | if (sz <= 0) return len+1; | ||
| 766 | if (len >= sz) len=sz-1; | ||
| 767 | memcpy(path,me32.szExePath,len); | ||
| 768 | path[len++] = 0; | ||
| 769 | return len; | ||
| 770 | #endif | ||
| 771 | } | ||
| 772 | } while((*module_next)(hModuleSnap, &me32)); | ||
| 773 | |||
| 774 | (*close_snap)(hModuleSnap); | ||
| 775 | FreeLibrary(dll); | ||
| 776 | return 0; | ||
| 777 | } | ||
| 778 | |||
| 779 | static void *win32_globallookup(const char *name) | ||
| 780 | { | ||
| 781 | HMODULE dll; | ||
| 782 | HANDLE hModuleSnap = INVALID_HANDLE_VALUE; | ||
| 783 | MODULEENTRY32 me32; | ||
| 784 | CREATETOOLHELP32SNAPSHOT create_snap; | ||
| 785 | CLOSETOOLHELP32SNAPSHOT close_snap; | ||
| 786 | MODULE32 module_first, module_next; | ||
| 787 | FARPROC ret=NULL; | ||
| 788 | |||
| 789 | dll = LoadLibrary(TEXT(DLLNAME)); | ||
| 790 | if (dll == NULL) | ||
| 791 | { | ||
| 792 | DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED); | ||
| 793 | return NULL; | ||
| 794 | } | ||
| 795 | |||
| 796 | create_snap = (CREATETOOLHELP32SNAPSHOT) | ||
| 797 | GetProcAddress(dll,"CreateToolhelp32Snapshot"); | ||
| 798 | if (create_snap == NULL) | ||
| 799 | { | ||
| 800 | FreeLibrary(dll); | ||
| 801 | DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED); | ||
| 802 | return NULL; | ||
| 803 | } | ||
| 804 | /* We take the rest for granted... */ | ||
| 805 | #ifdef _WIN32_WCE | ||
| 806 | close_snap = (CLOSETOOLHELP32SNAPSHOT) | ||
| 807 | GetProcAddress(dll,"CloseToolhelp32Snapshot"); | ||
| 808 | #else | ||
| 809 | close_snap = (CLOSETOOLHELP32SNAPSHOT)CloseHandle; | ||
| 810 | #endif | ||
| 811 | module_first = (MODULE32)GetProcAddress(dll,"Module32First"); | ||
| 812 | module_next = (MODULE32)GetProcAddress(dll,"Module32Next"); | ||
| 813 | |||
| 814 | hModuleSnap = (*create_snap)(TH32CS_SNAPMODULE,0); | ||
| 815 | if( hModuleSnap == INVALID_HANDLE_VALUE ) | ||
| 816 | { | ||
| 817 | FreeLibrary(dll); | ||
| 818 | DSOerr(DSO_F_WIN32_GLOBALLOOKUP,DSO_R_UNSUPPORTED); | ||
| 819 | return NULL; | ||
| 820 | } | ||
| 821 | |||
| 822 | me32.dwSize = sizeof(me32); | ||
| 823 | |||
| 824 | if (!(*module_first)(hModuleSnap,&me32)) | ||
| 825 | { | ||
| 826 | (*close_snap)(hModuleSnap); | ||
| 827 | FreeLibrary(dll); | ||
| 828 | return NULL; | ||
| 829 | } | ||
| 830 | |||
| 831 | do { | ||
| 832 | if ((ret = GetProcAddress(me32.hModule,name))) | ||
| 833 | { | ||
| 834 | (*close_snap)(hModuleSnap); | ||
| 835 | FreeLibrary(dll); | ||
| 836 | return ret; | ||
| 837 | } | ||
| 838 | } while((*module_next)(hModuleSnap,&me32)); | ||
| 839 | |||
| 840 | (*close_snap)(hModuleSnap); | ||
| 841 | FreeLibrary(dll); | ||
| 842 | return NULL; | ||
| 843 | } | ||
| 844 | #endif /* DSO_WIN32 */ | ||
diff --git a/src/lib/libcrypto/ebcdic.c b/src/lib/libcrypto/ebcdic.c new file mode 100644 index 0000000000..43e53bcaf7 --- /dev/null +++ b/src/lib/libcrypto/ebcdic.c | |||
| @@ -0,0 +1,221 @@ | |||
| 1 | /* crypto/ebcdic.c */ | ||
| 2 | |||
| 3 | #ifndef CHARSET_EBCDIC | ||
| 4 | |||
| 5 | #include <openssl/e_os2.h> | ||
| 6 | #if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX) | ||
| 7 | static void *dummy=&dummy; | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #else /*CHARSET_EBCDIC*/ | ||
| 11 | |||
| 12 | #include "ebcdic.h" | ||
| 13 | /* Initial Port for Apache-1.3 by <Martin.Kraemer@Mch.SNI.De> | ||
| 14 | * Adapted for OpenSSL-0.9.4 by <Martin.Kraemer@Mch.SNI.De> | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifdef _OSD_POSIX | ||
| 18 | /* | ||
| 19 | "BS2000 OSD" is a POSIX subsystem on a main frame. | ||
| 20 | It is made by Siemens AG, Germany, for their BS2000 mainframe machines. | ||
| 21 | Within the POSIX subsystem, the same character set was chosen as in | ||
| 22 | "native BS2000", namely EBCDIC. (EDF04) | ||
| 23 | |||
| 24 | The name "ASCII" in these routines is misleading: actually, conversion | ||
| 25 | is not between EBCDIC and ASCII, but EBCDIC(EDF04) and ISO-8859.1; | ||
| 26 | that means that (western european) national characters are preserved. | ||
| 27 | |||
| 28 | This table is identical to the one used by rsh/rcp/ftp and other POSIX tools. | ||
| 29 | */ | ||
| 30 | |||
| 31 | /* Here's the bijective ebcdic-to-ascii table: */ | ||
| 32 | const unsigned char os_toascii[256] = { | ||
| 33 | /*00*/ 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, | ||
| 34 | 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ | ||
| 35 | /*10*/ 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, | ||
| 36 | 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ | ||
| 37 | /*20*/ 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, | ||
| 38 | 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /*................*/ | ||
| 39 | /*30*/ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, | ||
| 40 | 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /*................*/ | ||
| 41 | /*40*/ 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, | ||
| 42 | 0xe7, 0xf1, 0x60, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* .........`.<(+|*/ | ||
| 43 | /*50*/ 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, | ||
| 44 | 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x9f, /*&.........!$*);.*/ | ||
| 45 | /*60*/ 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, | ||
| 46 | 0xc7, 0xd1, 0x5e, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /*-/........^,%_>?*/ | ||
| 47 | /*70*/ 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, | ||
| 48 | 0xcc, 0xa8, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /*..........:#@'="*/ | ||
| 49 | /*80*/ 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, | ||
| 50 | 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /*.abcdefghi......*/ | ||
| 51 | /*90*/ 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, | ||
| 52 | 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /*.jklmnopqr......*/ | ||
| 53 | /*a0*/ 0xb5, 0xaf, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, | ||
| 54 | 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0xdd, 0xde, 0xae, /*..stuvwxyz......*/ | ||
| 55 | /*b0*/ 0xa2, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, | ||
| 56 | 0xbd, 0xbe, 0xac, 0x5b, 0x5c, 0x5d, 0xb4, 0xd7, /*...........[\]..*/ | ||
| 57 | /*c0*/ 0xf9, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, | ||
| 58 | 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /*.ABCDEFGHI......*/ | ||
| 59 | /*d0*/ 0xa6, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, | ||
| 60 | 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xdb, 0xfa, 0xff, /*.JKLMNOPQR......*/ | ||
| 61 | /*e0*/ 0xd9, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, | ||
| 62 | 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /*..STUVWXYZ......*/ | ||
| 63 | /*f0*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, | ||
| 64 | 0x38, 0x39, 0xb3, 0x7b, 0xdc, 0x7d, 0xda, 0x7e /*0123456789.{.}.~*/ | ||
| 65 | }; | ||
| 66 | |||
| 67 | |||
| 68 | /* The ascii-to-ebcdic table: */ | ||
| 69 | const unsigned char os_toebcdic[256] = { | ||
| 70 | /*00*/ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, | ||
| 71 | 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /*................*/ | ||
| 72 | /*10*/ 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, | ||
| 73 | 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /*................*/ | ||
| 74 | /*20*/ 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, | ||
| 75 | 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ | ||
| 76 | /*30*/ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, | ||
| 77 | 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /*0123456789:;<=>?*/ | ||
| 78 | /*40*/ 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, | ||
| 79 | 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /*@ABCDEFGHIJKLMNO*/ | ||
| 80 | /*50*/ 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, | ||
| 81 | 0xe7, 0xe8, 0xe9, 0xbb, 0xbc, 0xbd, 0x6a, 0x6d, /*PQRSTUVWXYZ[\]^_*/ | ||
| 82 | /*60*/ 0x4a, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | ||
| 83 | 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /*`abcdefghijklmno*/ | ||
| 84 | /*70*/ 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, | ||
| 85 | 0xa7, 0xa8, 0xa9, 0xfb, 0x4f, 0xfd, 0xff, 0x07, /*pqrstuvwxyz{|}~.*/ | ||
| 86 | /*80*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, | ||
| 87 | 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /*................*/ | ||
| 88 | /*90*/ 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, | ||
| 89 | 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0x5f, /*................*/ | ||
| 90 | /*a0*/ 0x41, 0xaa, 0xb0, 0xb1, 0x9f, 0xb2, 0xd0, 0xb5, | ||
| 91 | 0x79, 0xb4, 0x9a, 0x8a, 0xba, 0xca, 0xaf, 0xa1, /*................*/ | ||
| 92 | /*b0*/ 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, | ||
| 93 | 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /*................*/ | ||
| 94 | /*c0*/ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, | ||
| 95 | 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /*................*/ | ||
| 96 | /*d0*/ 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, | ||
| 97 | 0x80, 0xe0, 0xfe, 0xdd, 0xfc, 0xad, 0xae, 0x59, /*................*/ | ||
| 98 | /*e0*/ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, | ||
| 99 | 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /*................*/ | ||
| 100 | /*f0*/ 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, | ||
| 101 | 0x70, 0xc0, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /*................*/ | ||
| 102 | }; | ||
| 103 | |||
| 104 | #else /*_OSD_POSIX*/ | ||
| 105 | |||
| 106 | /* | ||
| 107 | This code does basic character mapping for IBM's TPF and OS/390 operating systems. | ||
| 108 | It is a modified version of the BS2000 table. | ||
| 109 | |||
| 110 | Bijective EBCDIC (character set IBM-1047) to US-ASCII table: | ||
| 111 | This table is bijective - there are no ambigous or duplicate characters. | ||
| 112 | */ | ||
| 113 | const unsigned char os_toascii[256] = { | ||
| 114 | 0x00, 0x01, 0x02, 0x03, 0x85, 0x09, 0x86, 0x7f, /* 00-0f: */ | ||
| 115 | 0x87, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ | ||
| 116 | 0x10, 0x11, 0x12, 0x13, 0x8f, 0x0a, 0x08, 0x97, /* 10-1f: */ | ||
| 117 | 0x18, 0x19, 0x9c, 0x9d, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ | ||
| 118 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x92, 0x17, 0x1b, /* 20-2f: */ | ||
| 119 | 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07, /* ................ */ | ||
| 120 | 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, /* 30-3f: */ | ||
| 121 | 0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a, /* ................ */ | ||
| 122 | 0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5, /* 40-4f: */ | ||
| 123 | 0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c, /* ...........<(+| */ | ||
| 124 | 0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef, /* 50-5f: */ | ||
| 125 | 0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e, /* &.........!$*);^ */ | ||
| 126 | 0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5, /* 60-6f: */ | ||
| 127 | 0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f, /* -/.........,%_>? */ | ||
| 128 | 0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, /* 70-7f: */ | ||
| 129 | 0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22, /* .........`:#@'=" */ | ||
| 130 | 0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 80-8f: */ | ||
| 131 | 0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1, /* .abcdefghi...... */ | ||
| 132 | 0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, /* 90-9f: */ | ||
| 133 | 0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4, /* .jklmnopqr...... */ | ||
| 134 | 0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, /* a0-af: */ | ||
| 135 | 0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae, /* .~stuvwxyz...[.. */ | ||
| 136 | 0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc, /* b0-bf: */ | ||
| 137 | 0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7, /* .............].. */ | ||
| 138 | 0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* c0-cf: */ | ||
| 139 | 0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5, /* {ABCDEFGHI...... */ | ||
| 140 | 0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, /* d0-df: */ | ||
| 141 | 0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff, /* }JKLMNOPQR...... */ | ||
| 142 | 0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, /* e0-ef: */ | ||
| 143 | 0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5, /* \.STUVWXYZ...... */ | ||
| 144 | 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* f0-ff: */ | ||
| 145 | 0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f /* 0123456789...... */ | ||
| 146 | }; | ||
| 147 | |||
| 148 | |||
| 149 | /* | ||
| 150 | The US-ASCII to EBCDIC (character set IBM-1047) table: | ||
| 151 | This table is bijective (no ambiguous or duplicate characters) | ||
| 152 | */ | ||
| 153 | const unsigned char os_toebcdic[256] = { | ||
| 154 | 0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, /* 00-0f: */ | ||
| 155 | 0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* ................ */ | ||
| 156 | 0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, /* 10-1f: */ | ||
| 157 | 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f, /* ................ */ | ||
| 158 | 0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d, /* 20-2f: */ | ||
| 159 | 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61, /* !"#$%&'()*+,-./ */ | ||
| 160 | 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 30-3f: */ | ||
| 161 | 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f, /* 0123456789:;<=>? */ | ||
| 162 | 0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 40-4f: */ | ||
| 163 | 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, /* @ABCDEFGHIJKLMNO */ | ||
| 164 | 0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, /* 50-5f: */ | ||
| 165 | 0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d, /* PQRSTUVWXYZ[\]^_ */ | ||
| 166 | 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 60-6f: */ | ||
| 167 | 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, /* `abcdefghijklmno */ | ||
| 168 | 0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, /* 70-7f: */ | ||
| 169 | 0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07, /* pqrstuvwxyz{|}~. */ | ||
| 170 | 0x20, 0x21, 0x22, 0x23, 0x24, 0x04, 0x06, 0x08, /* 80-8f: */ | ||
| 171 | 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x14, /* ................ */ | ||
| 172 | 0x30, 0x31, 0x25, 0x33, 0x34, 0x35, 0x36, 0x17, /* 90-9f: */ | ||
| 173 | 0x38, 0x39, 0x3a, 0x3b, 0x1a, 0x1b, 0x3e, 0xff, /* ................ */ | ||
| 174 | 0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5, /* a0-af: */ | ||
| 175 | 0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc, /* ................ */ | ||
| 176 | 0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3, /* b0-bf: */ | ||
| 177 | 0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab, /* ................ */ | ||
| 178 | 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68, /* c0-cf: */ | ||
| 179 | 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77, /* ................ */ | ||
| 180 | 0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf, /* d0-df: */ | ||
| 181 | 0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59, /* ................ */ | ||
| 182 | 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48, /* e0-ef: */ | ||
| 183 | 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57, /* ................ */ | ||
| 184 | 0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1, /* f0-ff: */ | ||
| 185 | 0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf /* ................ */ | ||
| 186 | }; | ||
| 187 | #endif /*_OSD_POSIX*/ | ||
| 188 | |||
| 189 | /* Translate a memory block from EBCDIC (host charset) to ASCII (net charset) | ||
| 190 | * dest and srce may be identical, or separate memory blocks, but | ||
| 191 | * should not overlap. These functions intentionally have an interface | ||
| 192 | * compatible to memcpy(3). | ||
| 193 | */ | ||
| 194 | |||
| 195 | void * | ||
| 196 | ebcdic2ascii(void *dest, const void *srce, size_t count) | ||
| 197 | { | ||
| 198 | unsigned char *udest = dest; | ||
| 199 | const unsigned char *usrce = srce; | ||
| 200 | |||
| 201 | while (count-- != 0) { | ||
| 202 | *udest++ = os_toascii[*usrce++]; | ||
| 203 | } | ||
| 204 | |||
| 205 | return dest; | ||
| 206 | } | ||
| 207 | |||
| 208 | void * | ||
| 209 | ascii2ebcdic(void *dest, const void *srce, size_t count) | ||
| 210 | { | ||
| 211 | unsigned char *udest = dest; | ||
| 212 | const unsigned char *usrce = srce; | ||
| 213 | |||
| 214 | while (count-- != 0) { | ||
| 215 | *udest++ = os_toebcdic[*usrce++]; | ||
| 216 | } | ||
| 217 | |||
| 218 | return dest; | ||
| 219 | } | ||
| 220 | |||
| 221 | #endif | ||
diff --git a/src/lib/libcrypto/ebcdic.h b/src/lib/libcrypto/ebcdic.h new file mode 100644 index 0000000000..6d65afcf9e --- /dev/null +++ b/src/lib/libcrypto/ebcdic.h | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | /* crypto/ebcdic.h */ | ||
| 2 | |||
| 3 | #ifndef HEADER_EBCDIC_H | ||
| 4 | #define HEADER_EBCDIC_H | ||
| 5 | |||
| 6 | #include <sys/types.h> | ||
| 7 | |||
| 8 | /* Avoid name clashes with other applications */ | ||
| 9 | #define os_toascii _openssl_os_toascii | ||
| 10 | #define os_toebcdic _openssl_os_toebcdic | ||
| 11 | #define ebcdic2ascii _openssl_ebcdic2ascii | ||
| 12 | #define ascii2ebcdic _openssl_ascii2ebcdic | ||
| 13 | |||
| 14 | extern const unsigned char os_toascii[256]; | ||
| 15 | extern const unsigned char os_toebcdic[256]; | ||
| 16 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); | ||
| 17 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); | ||
| 18 | |||
| 19 | #endif | ||
diff --git a/src/lib/libcrypto/ec/Makefile b/src/lib/libcrypto/ec/Makefile new file mode 100644 index 0000000000..db380ed16f --- /dev/null +++ b/src/lib/libcrypto/ec/Makefile | |||
| @@ -0,0 +1,231 @@ | |||
| 1 | # | ||
| 2 | # crypto/ec/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ec | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=ectest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c\ | ||
| 21 | ec_err.c ec_curve.c ec_check.c ec_print.c ec_asn1.c ec_key.c\ | ||
| 22 | ec2_smpl.c ec2_mult.c ec_ameth.c ec_pmeth.c eck_prn.c | ||
| 23 | |||
| 24 | LIBOBJ= ec_lib.o ecp_smpl.o ecp_mont.o ecp_nist.o ec_cvt.o ec_mult.o\ | ||
| 25 | ec_err.o ec_curve.o ec_check.o ec_print.o ec_asn1.o ec_key.o\ | ||
| 26 | ec2_smpl.o ec2_mult.o ec_ameth.o ec_pmeth.o eck_prn.o | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= ec.h | ||
| 31 | HEADER= ec_lcl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | files: | ||
| 46 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 47 | |||
| 48 | links: | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 50 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 52 | |||
| 53 | install: | ||
| 54 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 55 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 56 | do \ | ||
| 57 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 58 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 59 | done; | ||
| 60 | |||
| 61 | tags: | ||
| 62 | ctags $(SRC) | ||
| 63 | |||
| 64 | tests: | ||
| 65 | |||
| 66 | lint: | ||
| 67 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 68 | |||
| 69 | depend: | ||
| 70 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 71 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 72 | |||
| 73 | dclean: | ||
| 74 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 75 | mv -f Makefile.new $(MAKEFILE) | ||
| 76 | |||
| 77 | clean: | ||
| 78 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 79 | |||
| 80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 81 | |||
| 82 | ec2_mult.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 83 | ec2_mult.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 84 | ec2_mult.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 85 | ec2_mult.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 86 | ec2_mult.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 87 | ec2_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 88 | ec2_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 89 | ec2_mult.o: ../../include/openssl/symhacks.h ec2_mult.c ec_lcl.h | ||
| 90 | ec2_smpl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 91 | ec2_smpl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 92 | ec2_smpl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 93 | ec2_smpl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 94 | ec2_smpl.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 95 | ec2_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 96 | ec2_smpl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 97 | ec2_smpl.o: ../../include/openssl/symhacks.h ec2_smpl.c ec_lcl.h | ||
| 98 | ec_ameth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 99 | ec_ameth.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 100 | ec_ameth.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h | ||
| 101 | ec_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | ec_ameth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 103 | ec_ameth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 104 | ec_ameth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 105 | ec_ameth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 106 | ec_ameth.o: ../../include/openssl/opensslconf.h | ||
| 107 | ec_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 108 | ec_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 109 | ec_ameth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 110 | ec_ameth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 111 | ec_ameth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 112 | ec_ameth.o: ec_ameth.c | ||
| 113 | ec_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 114 | ec_asn1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 115 | ec_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 116 | ec_asn1.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 117 | ec_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 118 | ec_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 119 | ec_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 120 | ec_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 121 | ec_asn1.o: ../../include/openssl/symhacks.h ec_asn1.c ec_lcl.h | ||
| 122 | ec_check.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 123 | ec_check.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 124 | ec_check.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 125 | ec_check.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 126 | ec_check.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 127 | ec_check.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 128 | ec_check.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 129 | ec_check.o: ../../include/openssl/symhacks.h ec_check.c ec_lcl.h | ||
| 130 | ec_curve.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 131 | ec_curve.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 132 | ec_curve.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 133 | ec_curve.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 134 | ec_curve.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 135 | ec_curve.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 136 | ec_curve.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 137 | ec_curve.o: ../../include/openssl/symhacks.h ec_curve.c ec_lcl.h | ||
| 138 | ec_cvt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 139 | ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 140 | ec_cvt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 141 | ec_cvt.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 142 | ec_cvt.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 143 | ec_cvt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 144 | ec_cvt.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 145 | ec_cvt.o: ../../include/openssl/symhacks.h ec_cvt.c ec_lcl.h | ||
| 146 | ec_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 147 | ec_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 148 | ec_err.o: ../../include/openssl/ec.h ../../include/openssl/err.h | ||
| 149 | ec_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 150 | ec_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 151 | ec_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 152 | ec_err.o: ../../include/openssl/symhacks.h ec_err.c | ||
| 153 | ec_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 154 | ec_key.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 155 | ec_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 156 | ec_key.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 157 | ec_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 158 | ec_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 159 | ec_key.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 160 | ec_key.o: ../../include/openssl/symhacks.h ec_key.c ec_lcl.h | ||
| 161 | ec_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 162 | ec_lib.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 163 | ec_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 164 | ec_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 165 | ec_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 166 | ec_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 167 | ec_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 168 | ec_lib.o: ../../include/openssl/symhacks.h ec_lcl.h ec_lib.c | ||
| 169 | ec_mult.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 170 | ec_mult.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 171 | ec_mult.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 172 | ec_mult.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 173 | ec_mult.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 174 | ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 175 | ec_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 176 | ec_mult.o: ../../include/openssl/symhacks.h ec_lcl.h ec_mult.c | ||
| 177 | ec_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 178 | ec_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 179 | ec_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 180 | ec_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 181 | ec_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 182 | ec_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 183 | ec_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 184 | ec_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 185 | ec_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 186 | ec_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 187 | ec_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 188 | ec_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 189 | ec_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h | ||
| 190 | ec_pmeth.o: ec_pmeth.c | ||
| 191 | ec_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 192 | ec_print.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 193 | ec_print.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 194 | ec_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 195 | ec_print.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 196 | ec_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 197 | ec_print.o: ../../include/openssl/symhacks.h ec_lcl.h ec_print.c | ||
| 198 | eck_prn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 199 | eck_prn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 200 | eck_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 201 | eck_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 202 | eck_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 203 | eck_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 204 | eck_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 205 | eck_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 206 | eck_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 207 | eck_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h eck_prn.c | ||
| 208 | ecp_mont.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 209 | ecp_mont.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 210 | ecp_mont.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 211 | ecp_mont.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 212 | ecp_mont.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 213 | ecp_mont.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 214 | ecp_mont.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 215 | ecp_mont.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_mont.c | ||
| 216 | ecp_nist.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 217 | ecp_nist.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 218 | ecp_nist.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 219 | ecp_nist.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 220 | ecp_nist.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 221 | ecp_nist.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 222 | ecp_nist.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 223 | ecp_nist.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_nist.c | ||
| 224 | ecp_smpl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 225 | ecp_smpl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 226 | ecp_smpl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 227 | ecp_smpl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 228 | ecp_smpl.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h | ||
| 229 | ecp_smpl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 230 | ecp_smpl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 231 | ecp_smpl.o: ../../include/openssl/symhacks.h ec_lcl.h ecp_smpl.c | ||
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index af94458ca7..cf357b462a 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
| @@ -937,9 +937,6 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT | |||
| 937 | { | 937 | { |
| 938 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 938 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; |
| 939 | } | 939 | } |
| 940 | |||
| 941 | if (EC_POINT_is_at_infinity(group, b)) | ||
| 942 | return 1; | ||
| 943 | 940 | ||
| 944 | if (a->Z_is_one && b->Z_is_one) | 941 | if (a->Z_is_one && b->Z_is_one) |
| 945 | { | 942 | { |
diff --git a/src/lib/libcrypto/ec/ec_mult.c b/src/lib/libcrypto/ec/ec_mult.c index 19f21675fb..f05df5332e 100644 --- a/src/lib/libcrypto/ec/ec_mult.c +++ b/src/lib/libcrypto/ec/ec_mult.c | |||
| @@ -169,13 +169,11 @@ static void ec_pre_comp_clear_free(void *pre_) | |||
| 169 | EC_POINT **p; | 169 | EC_POINT **p; |
| 170 | 170 | ||
| 171 | for (p = pre->points; *p != NULL; p++) | 171 | for (p = pre->points; *p != NULL; p++) |
| 172 | { | ||
| 173 | EC_POINT_clear_free(*p); | 172 | EC_POINT_clear_free(*p); |
| 174 | OPENSSL_cleanse(p, sizeof *p); | 173 | OPENSSL_cleanse(pre->points, sizeof pre->points); |
| 175 | } | ||
| 176 | OPENSSL_free(pre->points); | 174 | OPENSSL_free(pre->points); |
| 177 | } | 175 | } |
| 178 | OPENSSL_cleanse(pre, sizeof *pre); | 176 | OPENSSL_cleanse(pre, sizeof pre); |
| 179 | OPENSSL_free(pre); | 177 | OPENSSL_free(pre); |
| 180 | } | 178 | } |
| 181 | 179 | ||
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index 66a92e2a90..4d26f8bdf6 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
| @@ -1406,9 +1406,6 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT * | |||
| 1406 | { | 1406 | { |
| 1407 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 1407 | return EC_POINT_is_at_infinity(group, b) ? 0 : 1; |
| 1408 | } | 1408 | } |
| 1409 | |||
| 1410 | if (EC_POINT_is_at_infinity(group, b)) | ||
| 1411 | return 1; | ||
| 1412 | 1409 | ||
| 1413 | if (a->Z_is_one && b->Z_is_one) | 1410 | if (a->Z_is_one && b->Z_is_one) |
| 1414 | { | 1411 | { |
diff --git a/src/lib/libcrypto/ec/ectest.c b/src/lib/libcrypto/ec/ectest.c new file mode 100644 index 0000000000..7509cb9c7c --- /dev/null +++ b/src/lib/libcrypto/ec/ectest.c | |||
| @@ -0,0 +1,1334 @@ | |||
| 1 | /* crypto/ec/ectest.c */ | ||
| 2 | /* | ||
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 60 | * | ||
| 61 | * Portions of the attached software ("Contribution") are developed by | ||
| 62 | * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. | ||
| 63 | * | ||
| 64 | * The Contribution is licensed pursuant to the OpenSSL open source | ||
| 65 | * license provided above. | ||
| 66 | * | ||
| 67 | * The elliptic curve binary polynomial software is originally written by | ||
| 68 | * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. | ||
| 69 | * | ||
| 70 | */ | ||
| 71 | |||
| 72 | #include <stdio.h> | ||
| 73 | #include <stdlib.h> | ||
| 74 | #ifdef FLAT_INC | ||
| 75 | #include "e_os.h" | ||
| 76 | #else | ||
| 77 | #include "../e_os.h" | ||
| 78 | #endif | ||
| 79 | #include <string.h> | ||
| 80 | #include <time.h> | ||
| 81 | |||
| 82 | |||
| 83 | #ifdef OPENSSL_NO_EC | ||
| 84 | int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; } | ||
| 85 | #else | ||
| 86 | |||
| 87 | |||
| 88 | #include <openssl/ec.h> | ||
| 89 | #ifndef OPENSSL_NO_ENGINE | ||
| 90 | #include <openssl/engine.h> | ||
| 91 | #endif | ||
| 92 | #include <openssl/err.h> | ||
| 93 | #include <openssl/obj_mac.h> | ||
| 94 | #include <openssl/objects.h> | ||
| 95 | #include <openssl/rand.h> | ||
| 96 | #include <openssl/bn.h> | ||
| 97 | |||
| 98 | #if defined(_MSC_VER) && defined(_MIPS_) && (_MSC_VER/100==12) | ||
| 99 | /* suppress "too big too optimize" warning */ | ||
| 100 | #pragma warning(disable:4959) | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #define ABORT do { \ | ||
| 104 | fflush(stdout); \ | ||
| 105 | fprintf(stderr, "%s:%d: ABORT\n", __FILE__, __LINE__); \ | ||
| 106 | ERR_print_errors_fp(stderr); \ | ||
| 107 | EXIT(1); \ | ||
| 108 | } while (0) | ||
| 109 | |||
| 110 | void prime_field_tests(void); | ||
| 111 | void char2_field_tests(void); | ||
| 112 | void internal_curve_test(void); | ||
| 113 | |||
| 114 | #define TIMING_BASE_PT 0 | ||
| 115 | #define TIMING_RAND_PT 1 | ||
| 116 | #define TIMING_SIMUL 2 | ||
| 117 | |||
| 118 | #if 0 | ||
| 119 | static void timings(EC_GROUP *group, int type, BN_CTX *ctx) | ||
| 120 | { | ||
| 121 | clock_t clck; | ||
| 122 | int i, j; | ||
| 123 | BIGNUM *s; | ||
| 124 | BIGNUM *r[10], *r0[10]; | ||
| 125 | EC_POINT *P; | ||
| 126 | |||
| 127 | s = BN_new(); | ||
| 128 | if (s == NULL) ABORT; | ||
| 129 | |||
| 130 | fprintf(stdout, "Timings for %d-bit field, ", EC_GROUP_get_degree(group)); | ||
| 131 | if (!EC_GROUP_get_order(group, s, ctx)) ABORT; | ||
| 132 | fprintf(stdout, "%d-bit scalars ", (int)BN_num_bits(s)); | ||
| 133 | fflush(stdout); | ||
| 134 | |||
| 135 | P = EC_POINT_new(group); | ||
| 136 | if (P == NULL) ABORT; | ||
| 137 | EC_POINT_copy(P, EC_GROUP_get0_generator(group)); | ||
| 138 | |||
| 139 | for (i = 0; i < 10; i++) | ||
| 140 | { | ||
| 141 | if ((r[i] = BN_new()) == NULL) ABORT; | ||
| 142 | if (!BN_pseudo_rand(r[i], BN_num_bits(s), 0, 0)) ABORT; | ||
| 143 | if (type != TIMING_BASE_PT) | ||
| 144 | { | ||
| 145 | if ((r0[i] = BN_new()) == NULL) ABORT; | ||
| 146 | if (!BN_pseudo_rand(r0[i], BN_num_bits(s), 0, 0)) ABORT; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | clck = clock(); | ||
| 151 | for (i = 0; i < 10; i++) | ||
| 152 | { | ||
| 153 | for (j = 0; j < 10; j++) | ||
| 154 | { | ||
| 155 | if (!EC_POINT_mul(group, P, (type != TIMING_RAND_PT) ? r[i] : NULL, | ||
| 156 | (type != TIMING_BASE_PT) ? P : NULL, (type != TIMING_BASE_PT) ? r0[i] : NULL, ctx)) ABORT; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | clck = clock() - clck; | ||
| 160 | |||
| 161 | fprintf(stdout, "\n"); | ||
| 162 | |||
| 163 | #ifdef CLOCKS_PER_SEC | ||
| 164 | /* "To determine the time in seconds, the value returned | ||
| 165 | * by the clock function should be divided by the value | ||
| 166 | * of the macro CLOCKS_PER_SEC." | ||
| 167 | * -- ISO/IEC 9899 */ | ||
| 168 | # define UNIT "s" | ||
| 169 | #else | ||
| 170 | /* "`CLOCKS_PER_SEC' undeclared (first use this function)" | ||
| 171 | * -- cc on NeXTstep/OpenStep */ | ||
| 172 | # define UNIT "units" | ||
| 173 | # define CLOCKS_PER_SEC 1 | ||
| 174 | #endif | ||
| 175 | |||
| 176 | if (type == TIMING_BASE_PT) { | ||
| 177 | fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j, | ||
| 178 | "base point multiplications", (double)clck/CLOCKS_PER_SEC); | ||
| 179 | } else if (type == TIMING_RAND_PT) { | ||
| 180 | fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j, | ||
| 181 | "random point multiplications", (double)clck/CLOCKS_PER_SEC); | ||
| 182 | } else if (type == TIMING_SIMUL) { | ||
| 183 | fprintf(stdout, "%i %s in %.2f " UNIT "\n", i*j, | ||
| 184 | "s*P+t*Q operations", (double)clck/CLOCKS_PER_SEC); | ||
| 185 | } | ||
| 186 | fprintf(stdout, "average: %.4f " UNIT "\n", (double)clck/(CLOCKS_PER_SEC*i*j)); | ||
| 187 | |||
| 188 | EC_POINT_free(P); | ||
| 189 | BN_free(s); | ||
| 190 | for (i = 0; i < 10; i++) | ||
| 191 | { | ||
| 192 | BN_free(r[i]); | ||
| 193 | if (type != TIMING_BASE_PT) BN_free(r0[i]); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | #endif | ||
| 197 | |||
| 198 | void prime_field_tests() | ||
| 199 | { | ||
| 200 | BN_CTX *ctx = NULL; | ||
| 201 | BIGNUM *p, *a, *b; | ||
| 202 | EC_GROUP *group; | ||
| 203 | EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 = NULL, *P_384 = NULL, *P_521 = NULL; | ||
| 204 | EC_POINT *P, *Q, *R; | ||
| 205 | BIGNUM *x, *y, *z; | ||
| 206 | unsigned char buf[100]; | ||
| 207 | size_t i, len; | ||
| 208 | int k; | ||
| 209 | |||
| 210 | #if 1 /* optional */ | ||
| 211 | ctx = BN_CTX_new(); | ||
| 212 | if (!ctx) ABORT; | ||
| 213 | #endif | ||
| 214 | |||
| 215 | p = BN_new(); | ||
| 216 | a = BN_new(); | ||
| 217 | b = BN_new(); | ||
| 218 | if (!p || !a || !b) ABORT; | ||
| 219 | |||
| 220 | if (!BN_hex2bn(&p, "17")) ABORT; | ||
| 221 | if (!BN_hex2bn(&a, "1")) ABORT; | ||
| 222 | if (!BN_hex2bn(&b, "1")) ABORT; | ||
| 223 | |||
| 224 | group = EC_GROUP_new(EC_GFp_mont_method()); /* applications should use EC_GROUP_new_curve_GFp | ||
| 225 | * so that the library gets to choose the EC_METHOD */ | ||
| 226 | if (!group) ABORT; | ||
| 227 | |||
| 228 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 229 | |||
| 230 | { | ||
| 231 | EC_GROUP *tmp; | ||
| 232 | tmp = EC_GROUP_new(EC_GROUP_method_of(group)); | ||
| 233 | if (!tmp) ABORT; | ||
| 234 | if (!EC_GROUP_copy(tmp, group)) ABORT; | ||
| 235 | EC_GROUP_free(group); | ||
| 236 | group = tmp; | ||
| 237 | } | ||
| 238 | |||
| 239 | if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 240 | |||
| 241 | fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 = x^3 + a*x + b (mod 0x"); | ||
| 242 | BN_print_fp(stdout, p); | ||
| 243 | fprintf(stdout, ")\n a = 0x"); | ||
| 244 | BN_print_fp(stdout, a); | ||
| 245 | fprintf(stdout, "\n b = 0x"); | ||
| 246 | BN_print_fp(stdout, b); | ||
| 247 | fprintf(stdout, "\n"); | ||
| 248 | |||
| 249 | P = EC_POINT_new(group); | ||
| 250 | Q = EC_POINT_new(group); | ||
| 251 | R = EC_POINT_new(group); | ||
| 252 | if (!P || !Q || !R) ABORT; | ||
| 253 | |||
| 254 | if (!EC_POINT_set_to_infinity(group, P)) ABORT; | ||
| 255 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 256 | |||
| 257 | buf[0] = 0; | ||
| 258 | if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT; | ||
| 259 | |||
| 260 | if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; | ||
| 261 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 262 | |||
| 263 | x = BN_new(); | ||
| 264 | y = BN_new(); | ||
| 265 | z = BN_new(); | ||
| 266 | if (!x || !y || !z) ABORT; | ||
| 267 | |||
| 268 | if (!BN_hex2bn(&x, "D")) ABORT; | ||
| 269 | if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT; | ||
| 270 | if (!EC_POINT_is_on_curve(group, Q, ctx)) | ||
| 271 | { | ||
| 272 | if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT; | ||
| 273 | fprintf(stderr, "Point is not on curve: x = 0x"); | ||
| 274 | BN_print_fp(stderr, x); | ||
| 275 | fprintf(stderr, ", y = 0x"); | ||
| 276 | BN_print_fp(stderr, y); | ||
| 277 | fprintf(stderr, "\n"); | ||
| 278 | ABORT; | ||
| 279 | } | ||
| 280 | |||
| 281 | fprintf(stdout, "A cyclic subgroup:\n"); | ||
| 282 | k = 100; | ||
| 283 | do | ||
| 284 | { | ||
| 285 | if (k-- == 0) ABORT; | ||
| 286 | |||
| 287 | if (EC_POINT_is_at_infinity(group, P)) | ||
| 288 | fprintf(stdout, " point at infinity\n"); | ||
| 289 | else | ||
| 290 | { | ||
| 291 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 292 | |||
| 293 | fprintf(stdout, " x = 0x"); | ||
| 294 | BN_print_fp(stdout, x); | ||
| 295 | fprintf(stdout, ", y = 0x"); | ||
| 296 | BN_print_fp(stdout, y); | ||
| 297 | fprintf(stdout, "\n"); | ||
| 298 | } | ||
| 299 | |||
| 300 | if (!EC_POINT_copy(R, P)) ABORT; | ||
| 301 | if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; | ||
| 302 | |||
| 303 | #if 0 /* optional */ | ||
| 304 | { | ||
| 305 | EC_POINT *points[3]; | ||
| 306 | |||
| 307 | points[0] = R; | ||
| 308 | points[1] = Q; | ||
| 309 | points[2] = P; | ||
| 310 | if (!EC_POINTs_make_affine(group, 2, points, ctx)) ABORT; | ||
| 311 | } | ||
| 312 | #endif | ||
| 313 | |||
| 314 | } | ||
| 315 | while (!EC_POINT_is_at_infinity(group, P)); | ||
| 316 | |||
| 317 | if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT; | ||
| 318 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 319 | |||
| 320 | len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx); | ||
| 321 | if (len == 0) ABORT; | ||
| 322 | if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; | ||
| 323 | if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; | ||
| 324 | fprintf(stdout, "Generator as octect string, compressed form:\n "); | ||
| 325 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | ||
| 326 | |||
| 327 | len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx); | ||
| 328 | if (len == 0) ABORT; | ||
| 329 | if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; | ||
| 330 | if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; | ||
| 331 | fprintf(stdout, "\nGenerator as octect string, uncompressed form:\n "); | ||
| 332 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | ||
| 333 | |||
| 334 | len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx); | ||
| 335 | if (len == 0) ABORT; | ||
| 336 | if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; | ||
| 337 | if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; | ||
| 338 | fprintf(stdout, "\nGenerator as octect string, hybrid form:\n "); | ||
| 339 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | ||
| 340 | |||
| 341 | if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) ABORT; | ||
| 342 | fprintf(stdout, "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x"); | ||
| 343 | BN_print_fp(stdout, x); | ||
| 344 | fprintf(stdout, ", Y = 0x"); | ||
| 345 | BN_print_fp(stdout, y); | ||
| 346 | fprintf(stdout, ", Z = 0x"); | ||
| 347 | BN_print_fp(stdout, z); | ||
| 348 | fprintf(stdout, "\n"); | ||
| 349 | |||
| 350 | if (!EC_POINT_invert(group, P, ctx)) ABORT; | ||
| 351 | if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; | ||
| 352 | |||
| 353 | |||
| 354 | /* Curve secp160r1 (Certicom Research SEC 2 Version 1.0, section 2.4.2, 2000) | ||
| 355 | * -- not a NIST curve, but commonly used */ | ||
| 356 | |||
| 357 | if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF")) ABORT; | ||
| 358 | if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; | ||
| 359 | if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC")) ABORT; | ||
| 360 | if (!BN_hex2bn(&b, "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45")) ABORT; | ||
| 361 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 362 | |||
| 363 | if (!BN_hex2bn(&x, "4A96B5688EF573284664698968C38BB913CBFC82")) ABORT; | ||
| 364 | if (!BN_hex2bn(&y, "23a628553168947d59dcc912042351377ac5fb32")) ABORT; | ||
| 365 | if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 366 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 367 | if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257")) ABORT; | ||
| 368 | if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; | ||
| 369 | |||
| 370 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 371 | fprintf(stdout, "\nSEC2 curve secp160r1 -- Generator:\n x = 0x"); | ||
| 372 | BN_print_fp(stdout, x); | ||
| 373 | fprintf(stdout, "\n y = 0x"); | ||
| 374 | BN_print_fp(stdout, y); | ||
| 375 | fprintf(stdout, "\n"); | ||
| 376 | /* G_y value taken from the standard: */ | ||
| 377 | if (!BN_hex2bn(&z, "23a628553168947d59dcc912042351377ac5fb32")) ABORT; | ||
| 378 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 379 | |||
| 380 | fprintf(stdout, "verify degree ..."); | ||
| 381 | if (EC_GROUP_get_degree(group) != 160) ABORT; | ||
| 382 | fprintf(stdout, " ok\n"); | ||
| 383 | |||
| 384 | fprintf(stdout, "verify group order ..."); | ||
| 385 | fflush(stdout); | ||
| 386 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; | ||
| 387 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 388 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 389 | fprintf(stdout, "."); | ||
| 390 | fflush(stdout); | ||
| 391 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | ||
| 392 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 393 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 394 | fprintf(stdout, " ok\n"); | ||
| 395 | |||
| 396 | if (!(P_160 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; | ||
| 397 | if (!EC_GROUP_copy(P_160, group)) ABORT; | ||
| 398 | |||
| 399 | |||
| 400 | /* Curve P-192 (FIPS PUB 186-2, App. 6) */ | ||
| 401 | |||
| 402 | if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")) ABORT; | ||
| 403 | if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; | ||
| 404 | if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC")) ABORT; | ||
| 405 | if (!BN_hex2bn(&b, "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1")) ABORT; | ||
| 406 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 407 | |||
| 408 | if (!BN_hex2bn(&x, "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")) ABORT; | ||
| 409 | if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT; | ||
| 410 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 411 | if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831")) ABORT; | ||
| 412 | if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; | ||
| 413 | |||
| 414 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 415 | fprintf(stdout, "\nNIST curve P-192 -- Generator:\n x = 0x"); | ||
| 416 | BN_print_fp(stdout, x); | ||
| 417 | fprintf(stdout, "\n y = 0x"); | ||
| 418 | BN_print_fp(stdout, y); | ||
| 419 | fprintf(stdout, "\n"); | ||
| 420 | /* G_y value taken from the standard: */ | ||
| 421 | if (!BN_hex2bn(&z, "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811")) ABORT; | ||
| 422 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 423 | |||
| 424 | fprintf(stdout, "verify degree ..."); | ||
| 425 | if (EC_GROUP_get_degree(group) != 192) ABORT; | ||
| 426 | fprintf(stdout, " ok\n"); | ||
| 427 | |||
| 428 | fprintf(stdout, "verify group order ..."); | ||
| 429 | fflush(stdout); | ||
| 430 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; | ||
| 431 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 432 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 433 | fprintf(stdout, "."); | ||
| 434 | fflush(stdout); | ||
| 435 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | ||
| 436 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 437 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 438 | fprintf(stdout, " ok\n"); | ||
| 439 | |||
| 440 | if (!(P_192 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; | ||
| 441 | if (!EC_GROUP_copy(P_192, group)) ABORT; | ||
| 442 | |||
| 443 | |||
| 444 | /* Curve P-224 (FIPS PUB 186-2, App. 6) */ | ||
| 445 | |||
| 446 | if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")) ABORT; | ||
| 447 | if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; | ||
| 448 | if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE")) ABORT; | ||
| 449 | if (!BN_hex2bn(&b, "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4")) ABORT; | ||
| 450 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 451 | |||
| 452 | if (!BN_hex2bn(&x, "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21")) ABORT; | ||
| 453 | if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT; | ||
| 454 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 455 | if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D")) ABORT; | ||
| 456 | if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; | ||
| 457 | |||
| 458 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 459 | fprintf(stdout, "\nNIST curve P-224 -- Generator:\n x = 0x"); | ||
| 460 | BN_print_fp(stdout, x); | ||
| 461 | fprintf(stdout, "\n y = 0x"); | ||
| 462 | BN_print_fp(stdout, y); | ||
| 463 | fprintf(stdout, "\n"); | ||
| 464 | /* G_y value taken from the standard: */ | ||
| 465 | if (!BN_hex2bn(&z, "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34")) ABORT; | ||
| 466 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 467 | |||
| 468 | fprintf(stdout, "verify degree ..."); | ||
| 469 | if (EC_GROUP_get_degree(group) != 224) ABORT; | ||
| 470 | fprintf(stdout, " ok\n"); | ||
| 471 | |||
| 472 | fprintf(stdout, "verify group order ..."); | ||
| 473 | fflush(stdout); | ||
| 474 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; | ||
| 475 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 476 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 477 | fprintf(stdout, "."); | ||
| 478 | fflush(stdout); | ||
| 479 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | ||
| 480 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 481 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 482 | fprintf(stdout, " ok\n"); | ||
| 483 | |||
| 484 | if (!(P_224 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; | ||
| 485 | if (!EC_GROUP_copy(P_224, group)) ABORT; | ||
| 486 | |||
| 487 | |||
| 488 | /* Curve P-256 (FIPS PUB 186-2, App. 6) */ | ||
| 489 | |||
| 490 | if (!BN_hex2bn(&p, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")) ABORT; | ||
| 491 | if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; | ||
| 492 | if (!BN_hex2bn(&a, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC")) ABORT; | ||
| 493 | if (!BN_hex2bn(&b, "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B")) ABORT; | ||
| 494 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 495 | |||
| 496 | if (!BN_hex2bn(&x, "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296")) ABORT; | ||
| 497 | if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT; | ||
| 498 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 499 | if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E" | ||
| 500 | "84F3B9CAC2FC632551")) ABORT; | ||
| 501 | if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; | ||
| 502 | |||
| 503 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 504 | fprintf(stdout, "\nNIST curve P-256 -- Generator:\n x = 0x"); | ||
| 505 | BN_print_fp(stdout, x); | ||
| 506 | fprintf(stdout, "\n y = 0x"); | ||
| 507 | BN_print_fp(stdout, y); | ||
| 508 | fprintf(stdout, "\n"); | ||
| 509 | /* G_y value taken from the standard: */ | ||
| 510 | if (!BN_hex2bn(&z, "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5")) ABORT; | ||
| 511 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 512 | |||
| 513 | fprintf(stdout, "verify degree ..."); | ||
| 514 | if (EC_GROUP_get_degree(group) != 256) ABORT; | ||
| 515 | fprintf(stdout, " ok\n"); | ||
| 516 | |||
| 517 | fprintf(stdout, "verify group order ..."); | ||
| 518 | fflush(stdout); | ||
| 519 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; | ||
| 520 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 521 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 522 | fprintf(stdout, "."); | ||
| 523 | fflush(stdout); | ||
| 524 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | ||
| 525 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 526 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 527 | fprintf(stdout, " ok\n"); | ||
| 528 | |||
| 529 | if (!(P_256 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; | ||
| 530 | if (!EC_GROUP_copy(P_256, group)) ABORT; | ||
| 531 | |||
| 532 | |||
| 533 | /* Curve P-384 (FIPS PUB 186-2, App. 6) */ | ||
| 534 | |||
| 535 | if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 536 | "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")) ABORT; | ||
| 537 | if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; | ||
| 538 | if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 539 | "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC")) ABORT; | ||
| 540 | if (!BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141" | ||
| 541 | "120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF")) ABORT; | ||
| 542 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 543 | |||
| 544 | if (!BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B" | ||
| 545 | "9859F741E082542A385502F25DBF55296C3A545E3872760AB7")) ABORT; | ||
| 546 | if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT; | ||
| 547 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 548 | if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 549 | "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")) ABORT; | ||
| 550 | if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; | ||
| 551 | |||
| 552 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 553 | fprintf(stdout, "\nNIST curve P-384 -- Generator:\n x = 0x"); | ||
| 554 | BN_print_fp(stdout, x); | ||
| 555 | fprintf(stdout, "\n y = 0x"); | ||
| 556 | BN_print_fp(stdout, y); | ||
| 557 | fprintf(stdout, "\n"); | ||
| 558 | /* G_y value taken from the standard: */ | ||
| 559 | if (!BN_hex2bn(&z, "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A14" | ||
| 560 | "7CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F")) ABORT; | ||
| 561 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 562 | |||
| 563 | fprintf(stdout, "verify degree ..."); | ||
| 564 | if (EC_GROUP_get_degree(group) != 384) ABORT; | ||
| 565 | fprintf(stdout, " ok\n"); | ||
| 566 | |||
| 567 | fprintf(stdout, "verify group order ..."); | ||
| 568 | fflush(stdout); | ||
| 569 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; | ||
| 570 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 571 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 572 | fprintf(stdout, "."); | ||
| 573 | fflush(stdout); | ||
| 574 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | ||
| 575 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 576 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 577 | fprintf(stdout, " ok\n"); | ||
| 578 | |||
| 579 | if (!(P_384 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; | ||
| 580 | if (!EC_GROUP_copy(P_384, group)) ABORT; | ||
| 581 | |||
| 582 | |||
| 583 | /* Curve P-521 (FIPS PUB 186-2, App. 6) */ | ||
| 584 | |||
| 585 | if (!BN_hex2bn(&p, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 586 | "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 587 | "FFFFFFFFFFFFFFFFFFFFFFFFFFFF")) ABORT; | ||
| 588 | if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; | ||
| 589 | if (!BN_hex2bn(&a, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 590 | "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 591 | "FFFFFFFFFFFFFFFFFFFFFFFFFFFC")) ABORT; | ||
| 592 | if (!BN_hex2bn(&b, "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B" | ||
| 593 | "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573" | ||
| 594 | "DF883D2C34F1EF451FD46B503F00")) ABORT; | ||
| 595 | if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; | ||
| 596 | |||
| 597 | if (!BN_hex2bn(&x, "C6858E06B70404E9CD9E3ECB662395B4429C648139053F" | ||
| 598 | "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B" | ||
| 599 | "3C1856A429BF97E7E31C2E5BD66")) ABORT; | ||
| 600 | if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT; | ||
| 601 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 602 | if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" | ||
| 603 | "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5" | ||
| 604 | "C9B8899C47AEBB6FB71E91386409")) ABORT; | ||
| 605 | if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; | ||
| 606 | |||
| 607 | if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; | ||
| 608 | fprintf(stdout, "\nNIST curve P-521 -- Generator:\n x = 0x"); | ||
| 609 | BN_print_fp(stdout, x); | ||
| 610 | fprintf(stdout, "\n y = 0x"); | ||
| 611 | BN_print_fp(stdout, y); | ||
| 612 | fprintf(stdout, "\n"); | ||
| 613 | /* G_y value taken from the standard: */ | ||
| 614 | if (!BN_hex2bn(&z, "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579" | ||
| 615 | "B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C" | ||
| 616 | "7086A272C24088BE94769FD16650")) ABORT; | ||
| 617 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 618 | |||
| 619 | fprintf(stdout, "verify degree ..."); | ||
| 620 | if (EC_GROUP_get_degree(group) != 521) ABORT; | ||
| 621 | fprintf(stdout, " ok\n"); | ||
| 622 | |||
| 623 | fprintf(stdout, "verify group order ..."); | ||
| 624 | fflush(stdout); | ||
| 625 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; | ||
| 626 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 627 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 628 | fprintf(stdout, "."); | ||
| 629 | fflush(stdout); | ||
| 630 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; | ||
| 631 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; | ||
| 632 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 633 | fprintf(stdout, " ok\n"); | ||
| 634 | |||
| 635 | if (!(P_521 = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; | ||
| 636 | if (!EC_GROUP_copy(P_521, group)) ABORT; | ||
| 637 | |||
| 638 | |||
| 639 | /* more tests using the last curve */ | ||
| 640 | |||
| 641 | if (!EC_POINT_copy(Q, P)) ABORT; | ||
| 642 | if (EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 643 | if (!EC_POINT_dbl(group, P, P, ctx)) ABORT; | ||
| 644 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 645 | if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */ | ||
| 646 | |||
| 647 | if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT; | ||
| 648 | if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT; | ||
| 649 | if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */ | ||
| 650 | |||
| 651 | { | ||
| 652 | const EC_POINT *points[4]; | ||
| 653 | const BIGNUM *scalars[4]; | ||
| 654 | BIGNUM scalar3; | ||
| 655 | |||
| 656 | if (EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 657 | points[0] = Q; | ||
| 658 | points[1] = Q; | ||
| 659 | points[2] = Q; | ||
| 660 | points[3] = Q; | ||
| 661 | |||
| 662 | if (!BN_add(y, z, BN_value_one())) ABORT; | ||
| 663 | if (BN_is_odd(y)) ABORT; | ||
| 664 | if (!BN_rshift1(y, y)) ABORT; | ||
| 665 | scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */ | ||
| 666 | scalars[1] = y; | ||
| 667 | |||
| 668 | fprintf(stdout, "combined multiplication ..."); | ||
| 669 | fflush(stdout); | ||
| 670 | |||
| 671 | /* z is still the group order */ | ||
| 672 | if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; | ||
| 673 | if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT; | ||
| 674 | if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; | ||
| 675 | if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT; | ||
| 676 | |||
| 677 | fprintf(stdout, "."); | ||
| 678 | fflush(stdout); | ||
| 679 | |||
| 680 | if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT; | ||
| 681 | if (!BN_add(z, z, y)) ABORT; | ||
| 682 | BN_set_negative(z, 1); | ||
| 683 | scalars[0] = y; | ||
| 684 | scalars[1] = z; /* z = -(order + y) */ | ||
| 685 | |||
| 686 | if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; | ||
| 687 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 688 | |||
| 689 | fprintf(stdout, "."); | ||
| 690 | fflush(stdout); | ||
| 691 | |||
| 692 | if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT; | ||
| 693 | if (!BN_add(z, x, y)) ABORT; | ||
| 694 | BN_set_negative(z, 1); | ||
| 695 | scalars[0] = x; | ||
| 696 | scalars[1] = y; | ||
| 697 | scalars[2] = z; /* z = -(x+y) */ | ||
| 698 | |||
| 699 | BN_init(&scalar3); | ||
| 700 | BN_zero(&scalar3); | ||
| 701 | scalars[3] = &scalar3; | ||
| 702 | |||
| 703 | if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT; | ||
| 704 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 705 | |||
| 706 | fprintf(stdout, " ok\n\n"); | ||
| 707 | |||
| 708 | BN_free(&scalar3); | ||
| 709 | } | ||
| 710 | |||
| 711 | |||
| 712 | #if 0 | ||
| 713 | timings(P_160, TIMING_BASE_PT, ctx); | ||
| 714 | timings(P_160, TIMING_RAND_PT, ctx); | ||
| 715 | timings(P_160, TIMING_SIMUL, ctx); | ||
| 716 | timings(P_192, TIMING_BASE_PT, ctx); | ||
| 717 | timings(P_192, TIMING_RAND_PT, ctx); | ||
| 718 | timings(P_192, TIMING_SIMUL, ctx); | ||
| 719 | timings(P_224, TIMING_BASE_PT, ctx); | ||
| 720 | timings(P_224, TIMING_RAND_PT, ctx); | ||
| 721 | timings(P_224, TIMING_SIMUL, ctx); | ||
| 722 | timings(P_256, TIMING_BASE_PT, ctx); | ||
| 723 | timings(P_256, TIMING_RAND_PT, ctx); | ||
| 724 | timings(P_256, TIMING_SIMUL, ctx); | ||
| 725 | timings(P_384, TIMING_BASE_PT, ctx); | ||
| 726 | timings(P_384, TIMING_RAND_PT, ctx); | ||
| 727 | timings(P_384, TIMING_SIMUL, ctx); | ||
| 728 | timings(P_521, TIMING_BASE_PT, ctx); | ||
| 729 | timings(P_521, TIMING_RAND_PT, ctx); | ||
| 730 | timings(P_521, TIMING_SIMUL, ctx); | ||
| 731 | #endif | ||
| 732 | |||
| 733 | |||
| 734 | if (ctx) | ||
| 735 | BN_CTX_free(ctx); | ||
| 736 | BN_free(p); BN_free(a); BN_free(b); | ||
| 737 | EC_GROUP_free(group); | ||
| 738 | EC_POINT_free(P); | ||
| 739 | EC_POINT_free(Q); | ||
| 740 | EC_POINT_free(R); | ||
| 741 | BN_free(x); BN_free(y); BN_free(z); | ||
| 742 | |||
| 743 | if (P_160) EC_GROUP_free(P_160); | ||
| 744 | if (P_192) EC_GROUP_free(P_192); | ||
| 745 | if (P_224) EC_GROUP_free(P_224); | ||
| 746 | if (P_256) EC_GROUP_free(P_256); | ||
| 747 | if (P_384) EC_GROUP_free(P_384); | ||
| 748 | if (P_521) EC_GROUP_free(P_521); | ||
| 749 | |||
| 750 | } | ||
| 751 | |||
| 752 | /* Change test based on whether binary point compression is enabled or not. */ | ||
| 753 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
| 754 | #define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
| 755 | if (!BN_hex2bn(&x, _x)) ABORT; \ | ||
| 756 | if (!EC_POINT_set_compressed_coordinates_GF2m(group, P, x, _y_bit, ctx)) ABORT; \ | ||
| 757 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \ | ||
| 758 | if (!BN_hex2bn(&z, _order)) ABORT; \ | ||
| 759 | if (!BN_hex2bn(&cof, _cof)) ABORT; \ | ||
| 760 | if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \ | ||
| 761 | if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \ | ||
| 762 | fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \ | ||
| 763 | BN_print_fp(stdout, x); \ | ||
| 764 | fprintf(stdout, "\n y = 0x"); \ | ||
| 765 | BN_print_fp(stdout, y); \ | ||
| 766 | fprintf(stdout, "\n"); \ | ||
| 767 | /* G_y value taken from the standard: */ \ | ||
| 768 | if (!BN_hex2bn(&z, _y)) ABORT; \ | ||
| 769 | if (0 != BN_cmp(y, z)) ABORT; | ||
| 770 | #else | ||
| 771 | #define CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
| 772 | if (!BN_hex2bn(&x, _x)) ABORT; \ | ||
| 773 | if (!BN_hex2bn(&y, _y)) ABORT; \ | ||
| 774 | if (!EC_POINT_set_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; \ | ||
| 775 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; \ | ||
| 776 | if (!BN_hex2bn(&z, _order)) ABORT; \ | ||
| 777 | if (!BN_hex2bn(&cof, _cof)) ABORT; \ | ||
| 778 | if (!EC_GROUP_set_generator(group, P, z, cof)) ABORT; \ | ||
| 779 | fprintf(stdout, "\n%s -- Generator:\n x = 0x", _name); \ | ||
| 780 | BN_print_fp(stdout, x); \ | ||
| 781 | fprintf(stdout, "\n y = 0x"); \ | ||
| 782 | BN_print_fp(stdout, y); \ | ||
| 783 | fprintf(stdout, "\n"); | ||
| 784 | #endif | ||
| 785 | |||
| 786 | #define CHAR2_CURVE_TEST(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
| 787 | if (!BN_hex2bn(&p, _p)) ABORT; \ | ||
| 788 | if (!BN_hex2bn(&a, _a)) ABORT; \ | ||
| 789 | if (!BN_hex2bn(&b, _b)) ABORT; \ | ||
| 790 | if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; \ | ||
| 791 | CHAR2_CURVE_TEST_INTERNAL(_name, _p, _a, _b, _x, _y, _y_bit, _order, _cof, _degree, _variable) \ | ||
| 792 | fprintf(stdout, "verify degree ..."); \ | ||
| 793 | if (EC_GROUP_get_degree(group) != _degree) ABORT; \ | ||
| 794 | fprintf(stdout, " ok\n"); \ | ||
| 795 | fprintf(stdout, "verify group order ..."); \ | ||
| 796 | fflush(stdout); \ | ||
| 797 | if (!EC_GROUP_get_order(group, z, ctx)) ABORT; \ | ||
| 798 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \ | ||
| 799 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \ | ||
| 800 | fprintf(stdout, "."); \ | ||
| 801 | fflush(stdout); \ | ||
| 802 | if (!EC_GROUP_precompute_mult(group, ctx)) ABORT; \ | ||
| 803 | if (!EC_POINT_mul(group, Q, z, NULL, NULL, ctx)) ABORT; \ | ||
| 804 | if (!EC_POINT_is_at_infinity(group, Q)) ABORT; \ | ||
| 805 | fprintf(stdout, " ok\n"); \ | ||
| 806 | if (!(_variable = EC_GROUP_new(EC_GROUP_method_of(group)))) ABORT; \ | ||
| 807 | if (!EC_GROUP_copy(_variable, group)) ABORT; | ||
| 808 | |||
| 809 | void char2_field_tests() | ||
| 810 | { | ||
| 811 | BN_CTX *ctx = NULL; | ||
| 812 | BIGNUM *p, *a, *b; | ||
| 813 | EC_GROUP *group; | ||
| 814 | EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 = NULL, *C2_K571 = NULL; | ||
| 815 | EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 = NULL, *C2_B571 = NULL; | ||
| 816 | EC_POINT *P, *Q, *R; | ||
| 817 | BIGNUM *x, *y, *z, *cof; | ||
| 818 | unsigned char buf[100]; | ||
| 819 | size_t i, len; | ||
| 820 | int k; | ||
| 821 | |||
| 822 | #if 1 /* optional */ | ||
| 823 | ctx = BN_CTX_new(); | ||
| 824 | if (!ctx) ABORT; | ||
| 825 | #endif | ||
| 826 | |||
| 827 | p = BN_new(); | ||
| 828 | a = BN_new(); | ||
| 829 | b = BN_new(); | ||
| 830 | if (!p || !a || !b) ABORT; | ||
| 831 | |||
| 832 | if (!BN_hex2bn(&p, "13")) ABORT; | ||
| 833 | if (!BN_hex2bn(&a, "3")) ABORT; | ||
| 834 | if (!BN_hex2bn(&b, "1")) ABORT; | ||
| 835 | |||
| 836 | group = EC_GROUP_new(EC_GF2m_simple_method()); /* applications should use EC_GROUP_new_curve_GF2m | ||
| 837 | * so that the library gets to choose the EC_METHOD */ | ||
| 838 | if (!group) ABORT; | ||
| 839 | if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; | ||
| 840 | |||
| 841 | { | ||
| 842 | EC_GROUP *tmp; | ||
| 843 | tmp = EC_GROUP_new(EC_GROUP_method_of(group)); | ||
| 844 | if (!tmp) ABORT; | ||
| 845 | if (!EC_GROUP_copy(tmp, group)) ABORT; | ||
| 846 | EC_GROUP_free(group); | ||
| 847 | group = tmp; | ||
| 848 | } | ||
| 849 | |||
| 850 | if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx)) ABORT; | ||
| 851 | |||
| 852 | fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 + x*y = x^3 + a*x^2 + b (mod 0x"); | ||
| 853 | BN_print_fp(stdout, p); | ||
| 854 | fprintf(stdout, ")\n a = 0x"); | ||
| 855 | BN_print_fp(stdout, a); | ||
| 856 | fprintf(stdout, "\n b = 0x"); | ||
| 857 | BN_print_fp(stdout, b); | ||
| 858 | fprintf(stdout, "\n(0x... means binary polynomial)\n"); | ||
| 859 | |||
| 860 | P = EC_POINT_new(group); | ||
| 861 | Q = EC_POINT_new(group); | ||
| 862 | R = EC_POINT_new(group); | ||
| 863 | if (!P || !Q || !R) ABORT; | ||
| 864 | |||
| 865 | if (!EC_POINT_set_to_infinity(group, P)) ABORT; | ||
| 866 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 867 | |||
| 868 | buf[0] = 0; | ||
| 869 | if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT; | ||
| 870 | |||
| 871 | if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; | ||
| 872 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 873 | |||
| 874 | x = BN_new(); | ||
| 875 | y = BN_new(); | ||
| 876 | z = BN_new(); | ||
| 877 | cof = BN_new(); | ||
| 878 | if (!x || !y || !z || !cof) ABORT; | ||
| 879 | |||
| 880 | if (!BN_hex2bn(&x, "6")) ABORT; | ||
| 881 | /* Change test based on whether binary point compression is enabled or not. */ | ||
| 882 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
| 883 | if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx)) ABORT; | ||
| 884 | #else | ||
| 885 | if (!BN_hex2bn(&y, "8")) ABORT; | ||
| 886 | if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT; | ||
| 887 | #endif | ||
| 888 | if (!EC_POINT_is_on_curve(group, Q, ctx)) | ||
| 889 | { | ||
| 890 | /* Change test based on whether binary point compression is enabled or not. */ | ||
| 891 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
| 892 | if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT; | ||
| 893 | #endif | ||
| 894 | fprintf(stderr, "Point is not on curve: x = 0x"); | ||
| 895 | BN_print_fp(stderr, x); | ||
| 896 | fprintf(stderr, ", y = 0x"); | ||
| 897 | BN_print_fp(stderr, y); | ||
| 898 | fprintf(stderr, "\n"); | ||
| 899 | ABORT; | ||
| 900 | } | ||
| 901 | |||
| 902 | fprintf(stdout, "A cyclic subgroup:\n"); | ||
| 903 | k = 100; | ||
| 904 | do | ||
| 905 | { | ||
| 906 | if (k-- == 0) ABORT; | ||
| 907 | |||
| 908 | if (EC_POINT_is_at_infinity(group, P)) | ||
| 909 | fprintf(stdout, " point at infinity\n"); | ||
| 910 | else | ||
| 911 | { | ||
| 912 | if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; | ||
| 913 | |||
| 914 | fprintf(stdout, " x = 0x"); | ||
| 915 | BN_print_fp(stdout, x); | ||
| 916 | fprintf(stdout, ", y = 0x"); | ||
| 917 | BN_print_fp(stdout, y); | ||
| 918 | fprintf(stdout, "\n"); | ||
| 919 | } | ||
| 920 | |||
| 921 | if (!EC_POINT_copy(R, P)) ABORT; | ||
| 922 | if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; | ||
| 923 | } | ||
| 924 | while (!EC_POINT_is_at_infinity(group, P)); | ||
| 925 | |||
| 926 | if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT; | ||
| 927 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 928 | |||
| 929 | /* Change test based on whether binary point compression is enabled or not. */ | ||
| 930 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
| 931 | len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx); | ||
| 932 | if (len == 0) ABORT; | ||
| 933 | if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; | ||
| 934 | if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; | ||
| 935 | fprintf(stdout, "Generator as octet string, compressed form:\n "); | ||
| 936 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | ||
| 937 | #endif | ||
| 938 | |||
| 939 | len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx); | ||
| 940 | if (len == 0) ABORT; | ||
| 941 | if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; | ||
| 942 | if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; | ||
| 943 | fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n "); | ||
| 944 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | ||
| 945 | |||
| 946 | /* Change test based on whether binary point compression is enabled or not. */ | ||
| 947 | #ifdef OPENSSL_EC_BIN_PT_COMP | ||
| 948 | len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx); | ||
| 949 | if (len == 0) ABORT; | ||
| 950 | if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; | ||
| 951 | if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; | ||
| 952 | fprintf(stdout, "\nGenerator as octet string, hybrid form:\n "); | ||
| 953 | for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); | ||
| 954 | #endif | ||
| 955 | |||
| 956 | fprintf(stdout, "\n"); | ||
| 957 | |||
| 958 | if (!EC_POINT_invert(group, P, ctx)) ABORT; | ||
| 959 | if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; | ||
| 960 | |||
| 961 | |||
| 962 | /* Curve K-163 (FIPS PUB 186-2, App. 6) */ | ||
| 963 | CHAR2_CURVE_TEST | ||
| 964 | ( | ||
| 965 | "NIST curve K-163", | ||
| 966 | "0800000000000000000000000000000000000000C9", | ||
| 967 | "1", | ||
| 968 | "1", | ||
| 969 | "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8", | ||
| 970 | "0289070FB05D38FF58321F2E800536D538CCDAA3D9", | ||
| 971 | 1, | ||
| 972 | "04000000000000000000020108A2E0CC0D99F8A5EF", | ||
| 973 | "2", | ||
| 974 | 163, | ||
| 975 | C2_K163 | ||
| 976 | ); | ||
| 977 | |||
| 978 | /* Curve B-163 (FIPS PUB 186-2, App. 6) */ | ||
| 979 | CHAR2_CURVE_TEST | ||
| 980 | ( | ||
| 981 | "NIST curve B-163", | ||
| 982 | "0800000000000000000000000000000000000000C9", | ||
| 983 | "1", | ||
| 984 | "020A601907B8C953CA1481EB10512F78744A3205FD", | ||
| 985 | "03F0EBA16286A2D57EA0991168D4994637E8343E36", | ||
| 986 | "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1", | ||
| 987 | 1, | ||
| 988 | "040000000000000000000292FE77E70C12A4234C33", | ||
| 989 | "2", | ||
| 990 | 163, | ||
| 991 | C2_B163 | ||
| 992 | ); | ||
| 993 | |||
| 994 | /* Curve K-233 (FIPS PUB 186-2, App. 6) */ | ||
| 995 | CHAR2_CURVE_TEST | ||
| 996 | ( | ||
| 997 | "NIST curve K-233", | ||
| 998 | "020000000000000000000000000000000000000004000000000000000001", | ||
| 999 | "0", | ||
| 1000 | "1", | ||
| 1001 | "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126", | ||
| 1002 | "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3", | ||
| 1003 | 0, | ||
| 1004 | "008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF", | ||
| 1005 | "4", | ||
| 1006 | 233, | ||
| 1007 | C2_K233 | ||
| 1008 | ); | ||
| 1009 | |||
| 1010 | /* Curve B-233 (FIPS PUB 186-2, App. 6) */ | ||
| 1011 | CHAR2_CURVE_TEST | ||
| 1012 | ( | ||
| 1013 | "NIST curve B-233", | ||
| 1014 | "020000000000000000000000000000000000000004000000000000000001", | ||
| 1015 | "000000000000000000000000000000000000000000000000000000000001", | ||
| 1016 | "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD", | ||
| 1017 | "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B", | ||
| 1018 | "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052", | ||
| 1019 | 1, | ||
| 1020 | "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7", | ||
| 1021 | "2", | ||
| 1022 | 233, | ||
| 1023 | C2_B233 | ||
| 1024 | ); | ||
| 1025 | |||
| 1026 | /* Curve K-283 (FIPS PUB 186-2, App. 6) */ | ||
| 1027 | CHAR2_CURVE_TEST | ||
| 1028 | ( | ||
| 1029 | "NIST curve K-283", | ||
| 1030 | "0800000000000000000000000000000000000000000000000000000000000000000010A1", | ||
| 1031 | "0", | ||
| 1032 | "1", | ||
| 1033 | "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836", | ||
| 1034 | "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259", | ||
| 1035 | 0, | ||
| 1036 | "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61", | ||
| 1037 | "4", | ||
| 1038 | 283, | ||
| 1039 | C2_K283 | ||
| 1040 | ); | ||
| 1041 | |||
| 1042 | /* Curve B-283 (FIPS PUB 186-2, App. 6) */ | ||
| 1043 | CHAR2_CURVE_TEST | ||
| 1044 | ( | ||
| 1045 | "NIST curve B-283", | ||
| 1046 | "0800000000000000000000000000000000000000000000000000000000000000000010A1", | ||
| 1047 | "000000000000000000000000000000000000000000000000000000000000000000000001", | ||
| 1048 | "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5", | ||
| 1049 | "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053", | ||
| 1050 | "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4", | ||
| 1051 | 1, | ||
| 1052 | "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307", | ||
| 1053 | "2", | ||
| 1054 | 283, | ||
| 1055 | C2_B283 | ||
| 1056 | ); | ||
| 1057 | |||
| 1058 | /* Curve K-409 (FIPS PUB 186-2, App. 6) */ | ||
| 1059 | CHAR2_CURVE_TEST | ||
| 1060 | ( | ||
| 1061 | "NIST curve K-409", | ||
| 1062 | "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001", | ||
| 1063 | "0", | ||
| 1064 | "1", | ||
| 1065 | "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746", | ||
| 1066 | "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B", | ||
| 1067 | 1, | ||
| 1068 | "007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF", | ||
| 1069 | "4", | ||
| 1070 | 409, | ||
| 1071 | C2_K409 | ||
| 1072 | ); | ||
| 1073 | |||
| 1074 | /* Curve B-409 (FIPS PUB 186-2, App. 6) */ | ||
| 1075 | CHAR2_CURVE_TEST | ||
| 1076 | ( | ||
| 1077 | "NIST curve B-409", | ||
| 1078 | "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001", | ||
| 1079 | "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", | ||
| 1080 | "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F", | ||
| 1081 | "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7", | ||
| 1082 | "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706", | ||
| 1083 | 1, | ||
| 1084 | "010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173", | ||
| 1085 | "2", | ||
| 1086 | 409, | ||
| 1087 | C2_B409 | ||
| 1088 | ); | ||
| 1089 | |||
| 1090 | /* Curve K-571 (FIPS PUB 186-2, App. 6) */ | ||
| 1091 | CHAR2_CURVE_TEST | ||
| 1092 | ( | ||
| 1093 | "NIST curve K-571", | ||
| 1094 | "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425", | ||
| 1095 | "0", | ||
| 1096 | "1", | ||
| 1097 | "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972", | ||
| 1098 | "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3", | ||
| 1099 | 0, | ||
| 1100 | "020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001", | ||
| 1101 | "4", | ||
| 1102 | 571, | ||
| 1103 | C2_K571 | ||
| 1104 | ); | ||
| 1105 | |||
| 1106 | /* Curve B-571 (FIPS PUB 186-2, App. 6) */ | ||
| 1107 | CHAR2_CURVE_TEST | ||
| 1108 | ( | ||
| 1109 | "NIST curve B-571", | ||
| 1110 | "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425", | ||
| 1111 | "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", | ||
| 1112 | "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A", | ||
| 1113 | "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19", | ||
| 1114 | "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B", | ||
| 1115 | 1, | ||
| 1116 | "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47", | ||
| 1117 | "2", | ||
| 1118 | 571, | ||
| 1119 | C2_B571 | ||
| 1120 | ); | ||
| 1121 | |||
| 1122 | /* more tests using the last curve */ | ||
| 1123 | |||
| 1124 | if (!EC_POINT_copy(Q, P)) ABORT; | ||
| 1125 | if (EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 1126 | if (!EC_POINT_dbl(group, P, P, ctx)) ABORT; | ||
| 1127 | if (!EC_POINT_is_on_curve(group, P, ctx)) ABORT; | ||
| 1128 | if (!EC_POINT_invert(group, Q, ctx)) ABORT; /* P = -2Q */ | ||
| 1129 | |||
| 1130 | if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT; | ||
| 1131 | if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT; | ||
| 1132 | if (!EC_POINT_is_at_infinity(group, R)) ABORT; /* R = P + 2Q */ | ||
| 1133 | |||
| 1134 | { | ||
| 1135 | const EC_POINT *points[3]; | ||
| 1136 | const BIGNUM *scalars[3]; | ||
| 1137 | |||
| 1138 | if (EC_POINT_is_at_infinity(group, Q)) ABORT; | ||
| 1139 | points[0] = Q; | ||
| 1140 | points[1] = Q; | ||
| 1141 | points[2] = Q; | ||
| 1142 | |||
| 1143 | if (!BN_add(y, z, BN_value_one())) ABORT; | ||
| 1144 | if (BN_is_odd(y)) ABORT; | ||
| 1145 | if (!BN_rshift1(y, y)) ABORT; | ||
| 1146 | scalars[0] = y; /* (group order + 1)/2, so y*Q + y*Q = Q */ | ||
| 1147 | scalars[1] = y; | ||
| 1148 | |||
| 1149 | fprintf(stdout, "combined multiplication ..."); | ||
| 1150 | fflush(stdout); | ||
| 1151 | |||
| 1152 | /* z is still the group order */ | ||
| 1153 | if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; | ||
| 1154 | if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT; | ||
| 1155 | if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; | ||
| 1156 | if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT; | ||
| 1157 | |||
| 1158 | fprintf(stdout, "."); | ||
| 1159 | fflush(stdout); | ||
| 1160 | |||
| 1161 | if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT; | ||
| 1162 | if (!BN_add(z, z, y)) ABORT; | ||
| 1163 | BN_set_negative(z, 1); | ||
| 1164 | scalars[0] = y; | ||
| 1165 | scalars[1] = z; /* z = -(order + y) */ | ||
| 1166 | |||
| 1167 | if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; | ||
| 1168 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 1169 | |||
| 1170 | fprintf(stdout, "."); | ||
| 1171 | fflush(stdout); | ||
| 1172 | |||
| 1173 | if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT; | ||
| 1174 | if (!BN_add(z, x, y)) ABORT; | ||
| 1175 | BN_set_negative(z, 1); | ||
| 1176 | scalars[0] = x; | ||
| 1177 | scalars[1] = y; | ||
| 1178 | scalars[2] = z; /* z = -(x+y) */ | ||
| 1179 | |||
| 1180 | if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT; | ||
| 1181 | if (!EC_POINT_is_at_infinity(group, P)) ABORT; | ||
| 1182 | |||
| 1183 | fprintf(stdout, " ok\n\n"); | ||
| 1184 | } | ||
| 1185 | |||
| 1186 | |||
| 1187 | #if 0 | ||
| 1188 | timings(C2_K163, TIMING_BASE_PT, ctx); | ||
| 1189 | timings(C2_K163, TIMING_RAND_PT, ctx); | ||
| 1190 | timings(C2_K163, TIMING_SIMUL, ctx); | ||
| 1191 | timings(C2_B163, TIMING_BASE_PT, ctx); | ||
| 1192 | timings(C2_B163, TIMING_RAND_PT, ctx); | ||
| 1193 | timings(C2_B163, TIMING_SIMUL, ctx); | ||
| 1194 | timings(C2_K233, TIMING_BASE_PT, ctx); | ||
| 1195 | timings(C2_K233, TIMING_RAND_PT, ctx); | ||
| 1196 | timings(C2_K233, TIMING_SIMUL, ctx); | ||
| 1197 | timings(C2_B233, TIMING_BASE_PT, ctx); | ||
| 1198 | timings(C2_B233, TIMING_RAND_PT, ctx); | ||
| 1199 | timings(C2_B233, TIMING_SIMUL, ctx); | ||
| 1200 | timings(C2_K283, TIMING_BASE_PT, ctx); | ||
| 1201 | timings(C2_K283, TIMING_RAND_PT, ctx); | ||
| 1202 | timings(C2_K283, TIMING_SIMUL, ctx); | ||
| 1203 | timings(C2_B283, TIMING_BASE_PT, ctx); | ||
| 1204 | timings(C2_B283, TIMING_RAND_PT, ctx); | ||
| 1205 | timings(C2_B283, TIMING_SIMUL, ctx); | ||
| 1206 | timings(C2_K409, TIMING_BASE_PT, ctx); | ||
| 1207 | timings(C2_K409, TIMING_RAND_PT, ctx); | ||
| 1208 | timings(C2_K409, TIMING_SIMUL, ctx); | ||
| 1209 | timings(C2_B409, TIMING_BASE_PT, ctx); | ||
| 1210 | timings(C2_B409, TIMING_RAND_PT, ctx); | ||
| 1211 | timings(C2_B409, TIMING_SIMUL, ctx); | ||
| 1212 | timings(C2_K571, TIMING_BASE_PT, ctx); | ||
| 1213 | timings(C2_K571, TIMING_RAND_PT, ctx); | ||
| 1214 | timings(C2_K571, TIMING_SIMUL, ctx); | ||
| 1215 | timings(C2_B571, TIMING_BASE_PT, ctx); | ||
| 1216 | timings(C2_B571, TIMING_RAND_PT, ctx); | ||
| 1217 | timings(C2_B571, TIMING_SIMUL, ctx); | ||
| 1218 | #endif | ||
| 1219 | |||
| 1220 | |||
| 1221 | if (ctx) | ||
| 1222 | BN_CTX_free(ctx); | ||
| 1223 | BN_free(p); BN_free(a); BN_free(b); | ||
| 1224 | EC_GROUP_free(group); | ||
| 1225 | EC_POINT_free(P); | ||
| 1226 | EC_POINT_free(Q); | ||
| 1227 | EC_POINT_free(R); | ||
| 1228 | BN_free(x); BN_free(y); BN_free(z); BN_free(cof); | ||
| 1229 | |||
| 1230 | if (C2_K163) EC_GROUP_free(C2_K163); | ||
| 1231 | if (C2_B163) EC_GROUP_free(C2_B163); | ||
| 1232 | if (C2_K233) EC_GROUP_free(C2_K233); | ||
| 1233 | if (C2_B233) EC_GROUP_free(C2_B233); | ||
| 1234 | if (C2_K283) EC_GROUP_free(C2_K283); | ||
| 1235 | if (C2_B283) EC_GROUP_free(C2_B283); | ||
| 1236 | if (C2_K409) EC_GROUP_free(C2_K409); | ||
| 1237 | if (C2_B409) EC_GROUP_free(C2_B409); | ||
| 1238 | if (C2_K571) EC_GROUP_free(C2_K571); | ||
| 1239 | if (C2_B571) EC_GROUP_free(C2_B571); | ||
| 1240 | |||
| 1241 | } | ||
| 1242 | |||
| 1243 | void internal_curve_test(void) | ||
| 1244 | { | ||
| 1245 | EC_builtin_curve *curves = NULL; | ||
| 1246 | size_t crv_len = 0, n = 0; | ||
| 1247 | int ok = 1; | ||
| 1248 | |||
| 1249 | crv_len = EC_get_builtin_curves(NULL, 0); | ||
| 1250 | |||
| 1251 | curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len); | ||
| 1252 | |||
| 1253 | if (curves == NULL) | ||
| 1254 | return; | ||
| 1255 | |||
| 1256 | if (!EC_get_builtin_curves(curves, crv_len)) | ||
| 1257 | { | ||
| 1258 | OPENSSL_free(curves); | ||
| 1259 | return; | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | fprintf(stdout, "testing internal curves: "); | ||
| 1263 | |||
| 1264 | for (n = 0; n < crv_len; n++) | ||
| 1265 | { | ||
| 1266 | EC_GROUP *group = NULL; | ||
| 1267 | int nid = curves[n].nid; | ||
| 1268 | if ((group = EC_GROUP_new_by_curve_name(nid)) == NULL) | ||
| 1269 | { | ||
| 1270 | ok = 0; | ||
| 1271 | fprintf(stdout, "\nEC_GROUP_new_curve_name() failed with" | ||
| 1272 | " curve %s\n", OBJ_nid2sn(nid)); | ||
| 1273 | /* try next curve */ | ||
| 1274 | continue; | ||
| 1275 | } | ||
| 1276 | if (!EC_GROUP_check(group, NULL)) | ||
| 1277 | { | ||
| 1278 | ok = 0; | ||
| 1279 | fprintf(stdout, "\nEC_GROUP_check() failed with" | ||
| 1280 | " curve %s\n", OBJ_nid2sn(nid)); | ||
| 1281 | EC_GROUP_free(group); | ||
| 1282 | /* try the next curve */ | ||
| 1283 | continue; | ||
| 1284 | } | ||
| 1285 | fprintf(stdout, "."); | ||
| 1286 | fflush(stdout); | ||
| 1287 | EC_GROUP_free(group); | ||
| 1288 | } | ||
| 1289 | if (ok) | ||
| 1290 | fprintf(stdout, " ok\n"); | ||
| 1291 | else | ||
| 1292 | fprintf(stdout, " failed\n"); | ||
| 1293 | OPENSSL_free(curves); | ||
| 1294 | return; | ||
| 1295 | } | ||
| 1296 | |||
| 1297 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 1298 | |||
| 1299 | int main(int argc, char *argv[]) | ||
| 1300 | { | ||
| 1301 | |||
| 1302 | /* enable memory leak checking unless explicitly disabled */ | ||
| 1303 | if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) | ||
| 1304 | { | ||
| 1305 | CRYPTO_malloc_debug_init(); | ||
| 1306 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | ||
| 1307 | } | ||
| 1308 | else | ||
| 1309 | { | ||
| 1310 | /* OPENSSL_DEBUG_MEMORY=off */ | ||
| 1311 | CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); | ||
| 1312 | } | ||
| 1313 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 1314 | ERR_load_crypto_strings(); | ||
| 1315 | |||
| 1316 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or BN_generate_prime may fail */ | ||
| 1317 | |||
| 1318 | prime_field_tests(); | ||
| 1319 | puts(""); | ||
| 1320 | char2_field_tests(); | ||
| 1321 | /* test the internal curves */ | ||
| 1322 | internal_curve_test(); | ||
| 1323 | |||
| 1324 | #ifndef OPENSSL_NO_ENGINE | ||
| 1325 | ENGINE_cleanup(); | ||
| 1326 | #endif | ||
| 1327 | CRYPTO_cleanup_all_ex_data(); | ||
| 1328 | ERR_free_strings(); | ||
| 1329 | ERR_remove_thread_state(NULL); | ||
| 1330 | CRYPTO_mem_leaks_fp(stderr); | ||
| 1331 | |||
| 1332 | return 0; | ||
| 1333 | } | ||
| 1334 | #endif | ||
diff --git a/src/lib/libcrypto/ecdh/Makefile b/src/lib/libcrypto/ecdh/Makefile new file mode 100644 index 0000000000..65d8904ee8 --- /dev/null +++ b/src/lib/libcrypto/ecdh/Makefile | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | # | ||
| 2 | # crypto/ecdh/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ecdh | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g -Wall | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=ecdhtest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= ech_lib.c ech_ossl.c ech_key.c ech_err.c | ||
| 21 | |||
| 22 | LIBOBJ= ech_lib.o ech_ossl.o ech_key.o ech_err.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | EXHEADER= ecdh.h | ||
| 27 | HEADER= ech_locl.h $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | |||
| 73 | clean: | ||
| 74 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 75 | |||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 77 | |||
| 78 | ech_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 79 | ech_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 80 | ech_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 81 | ech_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 82 | ech_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 83 | ech_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 84 | ech_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 85 | ech_err.o: ech_err.c | ||
| 86 | ech_key.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 87 | ech_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 88 | ech_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 89 | ech_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 90 | ech_key.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | ||
| 91 | ech_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 92 | ech_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 93 | ech_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 94 | ech_key.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 95 | ech_key.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 96 | ech_key.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 97 | ech_key.o: ../../include/openssl/x509_vfy.h ech_key.c ech_locl.h | ||
| 98 | ech_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 99 | ech_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 100 | ech_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 101 | ech_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 102 | ech_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 103 | ech_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 104 | ech_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 105 | ech_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 106 | ech_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 107 | ech_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 108 | ech_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 109 | ech_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 110 | ech_lib.o: ech_lib.c ech_locl.h | ||
| 111 | ech_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 112 | ech_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 113 | ech_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 114 | ech_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 115 | ech_ossl.o: ../../include/openssl/ecdh.h ../../include/openssl/err.h | ||
| 116 | ech_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 117 | ech_ossl.o: ../../include/openssl/opensslconf.h | ||
| 118 | ech_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 119 | ech_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 120 | ech_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 121 | ech_ossl.o: ../cryptlib.h ech_locl.h ech_ossl.c | ||
diff --git a/src/lib/libcrypto/ecdh/ecdhtest.c b/src/lib/libcrypto/ecdh/ecdhtest.c new file mode 100644 index 0000000000..212a87efa4 --- /dev/null +++ b/src/lib/libcrypto/ecdh/ecdhtest.c | |||
| @@ -0,0 +1,368 @@ | |||
| 1 | /* crypto/ecdh/ecdhtest.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 4 | * | ||
| 5 | * The Elliptic Curve Public-Key Crypto Library (ECC Code) included | ||
| 6 | * herein is developed by SUN MICROSYSTEMS, INC., and is contributed | ||
| 7 | * to the OpenSSL project. | ||
| 8 | * | ||
| 9 | * The ECC Code is licensed pursuant to the OpenSSL open source | ||
| 10 | * license provided below. | ||
| 11 | * | ||
| 12 | * The ECDH software is originally written by Douglas Stebila of | ||
| 13 | * Sun Microsystems Laboratories. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | /* ==================================================================== | ||
| 17 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | ||
| 18 | * | ||
| 19 | * Redistribution and use in source and binary forms, with or without | ||
| 20 | * modification, are permitted provided that the following conditions | ||
| 21 | * are met: | ||
| 22 | * | ||
| 23 | * 1. Redistributions of source code must retain the above copyright | ||
| 24 | * notice, this list of conditions and the following disclaimer. | ||
| 25 | * | ||
| 26 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer in | ||
| 28 | * the documentation and/or other materials provided with the | ||
| 29 | * distribution. | ||
| 30 | * | ||
| 31 | * 3. All advertising materials mentioning features or use of this | ||
| 32 | * software must display the following acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 37 | * endorse or promote products derived from this software without | ||
| 38 | * prior written permission. For written permission, please contact | ||
| 39 | * openssl-core@openssl.org. | ||
| 40 | * | ||
| 41 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 42 | * nor may "OpenSSL" appear in their names without prior written | ||
| 43 | * permission of the OpenSSL Project. | ||
| 44 | * | ||
| 45 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 46 | * acknowledgment: | ||
| 47 | * "This product includes software developed by the OpenSSL Project | ||
| 48 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 49 | * | ||
| 50 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 51 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 52 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 53 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 54 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 56 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 57 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 59 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 61 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 62 | * ==================================================================== | ||
| 63 | * | ||
| 64 | * This product includes cryptographic software written by Eric Young | ||
| 65 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 66 | * Hudson (tjh@cryptsoft.com). | ||
| 67 | * | ||
| 68 | */ | ||
| 69 | |||
| 70 | #include <stdio.h> | ||
| 71 | #include <stdlib.h> | ||
| 72 | #include <string.h> | ||
| 73 | |||
| 74 | #include "../e_os.h" | ||
| 75 | |||
| 76 | #include <openssl/opensslconf.h> /* for OPENSSL_NO_ECDH */ | ||
| 77 | #include <openssl/crypto.h> | ||
| 78 | #include <openssl/bio.h> | ||
| 79 | #include <openssl/bn.h> | ||
| 80 | #include <openssl/objects.h> | ||
| 81 | #include <openssl/rand.h> | ||
| 82 | #include <openssl/sha.h> | ||
| 83 | #include <openssl/err.h> | ||
| 84 | |||
| 85 | #ifdef OPENSSL_NO_ECDH | ||
| 86 | int main(int argc, char *argv[]) | ||
| 87 | { | ||
| 88 | printf("No ECDH support\n"); | ||
| 89 | return(0); | ||
| 90 | } | ||
| 91 | #else | ||
| 92 | #include <openssl/ec.h> | ||
| 93 | #include <openssl/ecdh.h> | ||
| 94 | |||
| 95 | #ifdef OPENSSL_SYS_WIN16 | ||
| 96 | #define MS_CALLBACK _far _loadds | ||
| 97 | #else | ||
| 98 | #define MS_CALLBACK | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #if 0 | ||
| 102 | static void MS_CALLBACK cb(int p, int n, void *arg); | ||
| 103 | #endif | ||
| 104 | |||
| 105 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 106 | |||
| 107 | |||
| 108 | static const int KDF1_SHA1_len = 20; | ||
| 109 | static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) | ||
| 110 | { | ||
| 111 | #ifndef OPENSSL_NO_SHA | ||
| 112 | if (*outlen < SHA_DIGEST_LENGTH) | ||
| 113 | return NULL; | ||
| 114 | else | ||
| 115 | *outlen = SHA_DIGEST_LENGTH; | ||
| 116 | return SHA1(in, inlen, out); | ||
| 117 | #else | ||
| 118 | return NULL; | ||
| 119 | #endif | ||
| 120 | } | ||
| 121 | |||
| 122 | |||
| 123 | static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out) | ||
| 124 | { | ||
| 125 | EC_KEY *a=NULL; | ||
| 126 | EC_KEY *b=NULL; | ||
| 127 | BIGNUM *x_a=NULL, *y_a=NULL, | ||
| 128 | *x_b=NULL, *y_b=NULL; | ||
| 129 | char buf[12]; | ||
| 130 | unsigned char *abuf=NULL,*bbuf=NULL; | ||
| 131 | int i,alen,blen,aout,bout,ret=0; | ||
| 132 | const EC_GROUP *group; | ||
| 133 | |||
| 134 | a = EC_KEY_new_by_curve_name(nid); | ||
| 135 | b = EC_KEY_new_by_curve_name(nid); | ||
| 136 | if (a == NULL || b == NULL) | ||
| 137 | goto err; | ||
| 138 | |||
| 139 | group = EC_KEY_get0_group(a); | ||
| 140 | |||
| 141 | if ((x_a=BN_new()) == NULL) goto err; | ||
| 142 | if ((y_a=BN_new()) == NULL) goto err; | ||
| 143 | if ((x_b=BN_new()) == NULL) goto err; | ||
| 144 | if ((y_b=BN_new()) == NULL) goto err; | ||
| 145 | |||
| 146 | BIO_puts(out,"Testing key generation with "); | ||
| 147 | BIO_puts(out,text); | ||
| 148 | #ifdef NOISY | ||
| 149 | BIO_puts(out,"\n"); | ||
| 150 | #else | ||
| 151 | (void)BIO_flush(out); | ||
| 152 | #endif | ||
| 153 | |||
| 154 | if (!EC_KEY_generate_key(a)) goto err; | ||
| 155 | |||
| 156 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == NID_X9_62_prime_field) | ||
| 157 | { | ||
| 158 | if (!EC_POINT_get_affine_coordinates_GFp(group, | ||
| 159 | EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | if (!EC_POINT_get_affine_coordinates_GF2m(group, | ||
| 164 | EC_KEY_get0_public_key(a), x_a, y_a, ctx)) goto err; | ||
| 165 | } | ||
| 166 | #ifdef NOISY | ||
| 167 | BIO_puts(out," pri 1="); | ||
| 168 | BN_print(out,a->priv_key); | ||
| 169 | BIO_puts(out,"\n pub 1="); | ||
| 170 | BN_print(out,x_a); | ||
| 171 | BIO_puts(out,","); | ||
| 172 | BN_print(out,y_a); | ||
| 173 | BIO_puts(out,"\n"); | ||
| 174 | #else | ||
| 175 | BIO_printf(out," ."); | ||
| 176 | (void)BIO_flush(out); | ||
| 177 | #endif | ||
| 178 | |||
| 179 | if (!EC_KEY_generate_key(b)) goto err; | ||
| 180 | |||
| 181 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == NID_X9_62_prime_field) | ||
| 182 | { | ||
| 183 | if (!EC_POINT_get_affine_coordinates_GFp(group, | ||
| 184 | EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err; | ||
| 185 | } | ||
| 186 | else | ||
| 187 | { | ||
| 188 | if (!EC_POINT_get_affine_coordinates_GF2m(group, | ||
| 189 | EC_KEY_get0_public_key(b), x_b, y_b, ctx)) goto err; | ||
| 190 | } | ||
| 191 | |||
| 192 | #ifdef NOISY | ||
| 193 | BIO_puts(out," pri 2="); | ||
| 194 | BN_print(out,b->priv_key); | ||
| 195 | BIO_puts(out,"\n pub 2="); | ||
| 196 | BN_print(out,x_b); | ||
| 197 | BIO_puts(out,","); | ||
| 198 | BN_print(out,y_b); | ||
| 199 | BIO_puts(out,"\n"); | ||
| 200 | #else | ||
| 201 | BIO_printf(out,"."); | ||
| 202 | (void)BIO_flush(out); | ||
| 203 | #endif | ||
| 204 | |||
| 205 | alen=KDF1_SHA1_len; | ||
| 206 | abuf=(unsigned char *)OPENSSL_malloc(alen); | ||
| 207 | aout=ECDH_compute_key(abuf,alen,EC_KEY_get0_public_key(b),a,KDF1_SHA1); | ||
| 208 | |||
| 209 | #ifdef NOISY | ||
| 210 | BIO_puts(out," key1 ="); | ||
| 211 | for (i=0; i<aout; i++) | ||
| 212 | { | ||
| 213 | sprintf(buf,"%02X",abuf[i]); | ||
| 214 | BIO_puts(out,buf); | ||
| 215 | } | ||
| 216 | BIO_puts(out,"\n"); | ||
| 217 | #else | ||
| 218 | BIO_printf(out,"."); | ||
| 219 | (void)BIO_flush(out); | ||
| 220 | #endif | ||
| 221 | |||
| 222 | blen=KDF1_SHA1_len; | ||
| 223 | bbuf=(unsigned char *)OPENSSL_malloc(blen); | ||
| 224 | bout=ECDH_compute_key(bbuf,blen,EC_KEY_get0_public_key(a),b,KDF1_SHA1); | ||
| 225 | |||
| 226 | #ifdef NOISY | ||
| 227 | BIO_puts(out," key2 ="); | ||
| 228 | for (i=0; i<bout; i++) | ||
| 229 | { | ||
| 230 | sprintf(buf,"%02X",bbuf[i]); | ||
| 231 | BIO_puts(out,buf); | ||
| 232 | } | ||
| 233 | BIO_puts(out,"\n"); | ||
| 234 | #else | ||
| 235 | BIO_printf(out,"."); | ||
| 236 | (void)BIO_flush(out); | ||
| 237 | #endif | ||
| 238 | |||
| 239 | if ((aout < 4) || (bout != aout) || (memcmp(abuf,bbuf,aout) != 0)) | ||
| 240 | { | ||
| 241 | #ifndef NOISY | ||
| 242 | BIO_printf(out, " failed\n\n"); | ||
| 243 | BIO_printf(out, "key a:\n"); | ||
| 244 | BIO_printf(out, "private key: "); | ||
| 245 | BN_print(out, EC_KEY_get0_private_key(a)); | ||
| 246 | BIO_printf(out, "\n"); | ||
| 247 | BIO_printf(out, "public key (x,y): "); | ||
| 248 | BN_print(out, x_a); | ||
| 249 | BIO_printf(out, ","); | ||
| 250 | BN_print(out, y_a); | ||
| 251 | BIO_printf(out, "\nkey b:\n"); | ||
| 252 | BIO_printf(out, "private key: "); | ||
| 253 | BN_print(out, EC_KEY_get0_private_key(b)); | ||
| 254 | BIO_printf(out, "\n"); | ||
| 255 | BIO_printf(out, "public key (x,y): "); | ||
| 256 | BN_print(out, x_b); | ||
| 257 | BIO_printf(out, ","); | ||
| 258 | BN_print(out, y_b); | ||
| 259 | BIO_printf(out, "\n"); | ||
| 260 | BIO_printf(out, "generated key a: "); | ||
| 261 | for (i=0; i<bout; i++) | ||
| 262 | { | ||
| 263 | sprintf(buf, "%02X", bbuf[i]); | ||
| 264 | BIO_puts(out, buf); | ||
| 265 | } | ||
| 266 | BIO_printf(out, "\n"); | ||
| 267 | BIO_printf(out, "generated key b: "); | ||
| 268 | for (i=0; i<aout; i++) | ||
| 269 | { | ||
| 270 | sprintf(buf, "%02X", abuf[i]); | ||
| 271 | BIO_puts(out,buf); | ||
| 272 | } | ||
| 273 | BIO_printf(out, "\n"); | ||
| 274 | #endif | ||
| 275 | fprintf(stderr,"Error in ECDH routines\n"); | ||
| 276 | ret=0; | ||
| 277 | } | ||
| 278 | else | ||
| 279 | { | ||
| 280 | #ifndef NOISY | ||
| 281 | BIO_printf(out, " ok\n"); | ||
| 282 | #endif | ||
| 283 | ret=1; | ||
| 284 | } | ||
| 285 | err: | ||
| 286 | ERR_print_errors_fp(stderr); | ||
| 287 | |||
| 288 | if (abuf != NULL) OPENSSL_free(abuf); | ||
| 289 | if (bbuf != NULL) OPENSSL_free(bbuf); | ||
| 290 | if (x_a) BN_free(x_a); | ||
| 291 | if (y_a) BN_free(y_a); | ||
| 292 | if (x_b) BN_free(x_b); | ||
| 293 | if (y_b) BN_free(y_b); | ||
| 294 | if (b) EC_KEY_free(b); | ||
| 295 | if (a) EC_KEY_free(a); | ||
| 296 | return(ret); | ||
| 297 | } | ||
| 298 | |||
| 299 | int main(int argc, char *argv[]) | ||
| 300 | { | ||
| 301 | BN_CTX *ctx=NULL; | ||
| 302 | int ret=1; | ||
| 303 | BIO *out; | ||
| 304 | |||
| 305 | CRYPTO_malloc_debug_init(); | ||
| 306 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
| 307 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 308 | |||
| 309 | #ifdef OPENSSL_SYS_WIN32 | ||
| 310 | CRYPTO_malloc_init(); | ||
| 311 | #endif | ||
| 312 | |||
| 313 | RAND_seed(rnd_seed, sizeof rnd_seed); | ||
| 314 | |||
| 315 | out=BIO_new(BIO_s_file()); | ||
| 316 | if (out == NULL) EXIT(1); | ||
| 317 | BIO_set_fp(out,stdout,BIO_NOCLOSE); | ||
| 318 | |||
| 319 | if ((ctx=BN_CTX_new()) == NULL) goto err; | ||
| 320 | |||
| 321 | /* NIST PRIME CURVES TESTS */ | ||
| 322 | if (!test_ecdh_curve(NID_X9_62_prime192v1, "NIST Prime-Curve P-192", ctx, out)) goto err; | ||
| 323 | if (!test_ecdh_curve(NID_secp224r1, "NIST Prime-Curve P-224", ctx, out)) goto err; | ||
| 324 | if (!test_ecdh_curve(NID_X9_62_prime256v1, "NIST Prime-Curve P-256", ctx, out)) goto err; | ||
| 325 | if (!test_ecdh_curve(NID_secp384r1, "NIST Prime-Curve P-384", ctx, out)) goto err; | ||
| 326 | if (!test_ecdh_curve(NID_secp521r1, "NIST Prime-Curve P-521", ctx, out)) goto err; | ||
| 327 | /* NIST BINARY CURVES TESTS */ | ||
| 328 | if (!test_ecdh_curve(NID_sect163k1, "NIST Binary-Curve K-163", ctx, out)) goto err; | ||
| 329 | if (!test_ecdh_curve(NID_sect163r2, "NIST Binary-Curve B-163", ctx, out)) goto err; | ||
| 330 | if (!test_ecdh_curve(NID_sect233k1, "NIST Binary-Curve K-233", ctx, out)) goto err; | ||
| 331 | if (!test_ecdh_curve(NID_sect233r1, "NIST Binary-Curve B-233", ctx, out)) goto err; | ||
| 332 | if (!test_ecdh_curve(NID_sect283k1, "NIST Binary-Curve K-283", ctx, out)) goto err; | ||
| 333 | if (!test_ecdh_curve(NID_sect283r1, "NIST Binary-Curve B-283", ctx, out)) goto err; | ||
| 334 | if (!test_ecdh_curve(NID_sect409k1, "NIST Binary-Curve K-409", ctx, out)) goto err; | ||
| 335 | if (!test_ecdh_curve(NID_sect409r1, "NIST Binary-Curve B-409", ctx, out)) goto err; | ||
| 336 | if (!test_ecdh_curve(NID_sect571k1, "NIST Binary-Curve K-571", ctx, out)) goto err; | ||
| 337 | if (!test_ecdh_curve(NID_sect571r1, "NIST Binary-Curve B-571", ctx, out)) goto err; | ||
| 338 | |||
| 339 | ret = 0; | ||
| 340 | |||
| 341 | err: | ||
| 342 | ERR_print_errors_fp(stderr); | ||
| 343 | if (ctx) BN_CTX_free(ctx); | ||
| 344 | BIO_free(out); | ||
| 345 | CRYPTO_cleanup_all_ex_data(); | ||
| 346 | ERR_remove_thread_state(NULL); | ||
| 347 | CRYPTO_mem_leaks_fp(stderr); | ||
| 348 | EXIT(ret); | ||
| 349 | return(ret); | ||
| 350 | } | ||
| 351 | |||
| 352 | #if 0 | ||
| 353 | static void MS_CALLBACK cb(int p, int n, void *arg) | ||
| 354 | { | ||
| 355 | char c='*'; | ||
| 356 | |||
| 357 | if (p == 0) c='.'; | ||
| 358 | if (p == 1) c='+'; | ||
| 359 | if (p == 2) c='*'; | ||
| 360 | if (p == 3) c='\n'; | ||
| 361 | BIO_write((BIO *)arg,&c,1); | ||
| 362 | (void)BIO_flush((BIO *)arg); | ||
| 363 | #ifdef LINT | ||
| 364 | p=n; | ||
| 365 | #endif | ||
| 366 | } | ||
| 367 | #endif | ||
| 368 | #endif | ||
diff --git a/src/lib/libcrypto/ecdh/ech_ossl.c b/src/lib/libcrypto/ecdh/ech_ossl.c new file mode 100644 index 0000000000..2a40ff12df --- /dev/null +++ b/src/lib/libcrypto/ecdh/ech_ossl.c | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | /* crypto/ecdh/ech_ossl.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 4 | * | ||
| 5 | * The Elliptic Curve Public-Key Crypto Library (ECC Code) included | ||
| 6 | * herein is developed by SUN MICROSYSTEMS, INC., and is contributed | ||
| 7 | * to the OpenSSL project. | ||
| 8 | * | ||
| 9 | * The ECC Code is licensed pursuant to the OpenSSL open source | ||
| 10 | * license provided below. | ||
| 11 | * | ||
| 12 | * The ECDH software is originally written by Douglas Stebila of | ||
| 13 | * Sun Microsystems Laboratories. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | /* ==================================================================== | ||
| 17 | * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | ||
| 18 | * | ||
| 19 | * Redistribution and use in source and binary forms, with or without | ||
| 20 | * modification, are permitted provided that the following conditions | ||
| 21 | * are met: | ||
| 22 | * | ||
| 23 | * 1. Redistributions of source code must retain the above copyright | ||
| 24 | * notice, this list of conditions and the following disclaimer. | ||
| 25 | * | ||
| 26 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer in | ||
| 28 | * the documentation and/or other materials provided with the | ||
| 29 | * distribution. | ||
| 30 | * | ||
| 31 | * 3. All advertising materials mentioning features or use of this | ||
| 32 | * software must display the following acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 37 | * endorse or promote products derived from this software without | ||
| 38 | * prior written permission. For written permission, please contact | ||
| 39 | * openssl-core@OpenSSL.org. | ||
| 40 | * | ||
| 41 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 42 | * nor may "OpenSSL" appear in their names without prior written | ||
| 43 | * permission of the OpenSSL Project. | ||
| 44 | * | ||
| 45 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 46 | * acknowledgment: | ||
| 47 | * "This product includes software developed by the OpenSSL Project | ||
| 48 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 49 | * | ||
| 50 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 51 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 52 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 53 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 54 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 56 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 57 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 59 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 61 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 62 | * ==================================================================== | ||
| 63 | * | ||
| 64 | * This product includes cryptographic software written by Eric Young | ||
| 65 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 66 | * Hudson (tjh@cryptsoft.com). | ||
| 67 | * | ||
| 68 | */ | ||
| 69 | |||
| 70 | |||
| 71 | #include <string.h> | ||
| 72 | #include <limits.h> | ||
| 73 | |||
| 74 | #include "cryptlib.h" | ||
| 75 | |||
| 76 | #include "ech_locl.h" | ||
| 77 | #include <openssl/err.h> | ||
| 78 | #include <openssl/sha.h> | ||
| 79 | #include <openssl/obj_mac.h> | ||
| 80 | #include <openssl/bn.h> | ||
| 81 | |||
| 82 | static int ecdh_compute_key(void *out, size_t len, const EC_POINT *pub_key, | ||
| 83 | EC_KEY *ecdh, | ||
| 84 | void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); | ||
| 85 | |||
| 86 | static ECDH_METHOD openssl_ecdh_meth = { | ||
| 87 | "OpenSSL ECDH method", | ||
| 88 | ecdh_compute_key, | ||
| 89 | #if 0 | ||
| 90 | NULL, /* init */ | ||
| 91 | NULL, /* finish */ | ||
| 92 | #endif | ||
| 93 | 0, /* flags */ | ||
| 94 | NULL /* app_data */ | ||
| 95 | }; | ||
| 96 | |||
| 97 | const ECDH_METHOD *ECDH_OpenSSL(void) | ||
| 98 | { | ||
| 99 | return &openssl_ecdh_meth; | ||
| 100 | } | ||
| 101 | |||
| 102 | |||
| 103 | /* This implementation is based on the following primitives in the IEEE 1363 standard: | ||
| 104 | * - ECKAS-DH1 | ||
| 105 | * - ECSVDP-DH | ||
| 106 | * Finally an optional KDF is applied. | ||
| 107 | */ | ||
| 108 | static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | ||
| 109 | EC_KEY *ecdh, | ||
| 110 | void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)) | ||
| 111 | { | ||
| 112 | BN_CTX *ctx; | ||
| 113 | EC_POINT *tmp=NULL; | ||
| 114 | BIGNUM *x=NULL, *y=NULL; | ||
| 115 | const BIGNUM *priv_key; | ||
| 116 | const EC_GROUP* group; | ||
| 117 | int ret= -1; | ||
| 118 | size_t buflen, len; | ||
| 119 | unsigned char *buf=NULL; | ||
| 120 | |||
| 121 | if (outlen > INT_MAX) | ||
| 122 | { | ||
| 123 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); /* sort of, anyway */ | ||
| 124 | return -1; | ||
| 125 | } | ||
| 126 | |||
| 127 | if ((ctx = BN_CTX_new()) == NULL) goto err; | ||
| 128 | BN_CTX_start(ctx); | ||
| 129 | x = BN_CTX_get(ctx); | ||
| 130 | y = BN_CTX_get(ctx); | ||
| 131 | |||
| 132 | priv_key = EC_KEY_get0_private_key(ecdh); | ||
| 133 | if (priv_key == NULL) | ||
| 134 | { | ||
| 135 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_NO_PRIVATE_VALUE); | ||
| 136 | goto err; | ||
| 137 | } | ||
| 138 | |||
| 139 | group = EC_KEY_get0_group(ecdh); | ||
| 140 | if ((tmp=EC_POINT_new(group)) == NULL) | ||
| 141 | { | ||
| 142 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); | ||
| 143 | goto err; | ||
| 144 | } | ||
| 145 | |||
| 146 | if (!EC_POINT_mul(group, tmp, NULL, pub_key, priv_key, ctx)) | ||
| 147 | { | ||
| 148 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE); | ||
| 149 | goto err; | ||
| 150 | } | ||
| 151 | |||
| 152 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) == NID_X9_62_prime_field) | ||
| 153 | { | ||
| 154 | if (!EC_POINT_get_affine_coordinates_GFp(group, tmp, x, y, ctx)) | ||
| 155 | { | ||
| 156 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE); | ||
| 157 | goto err; | ||
| 158 | } | ||
| 159 | } | ||
| 160 | else | ||
| 161 | { | ||
| 162 | if (!EC_POINT_get_affine_coordinates_GF2m(group, tmp, x, y, ctx)) | ||
| 163 | { | ||
| 164 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE); | ||
| 165 | goto err; | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | buflen = (EC_GROUP_get_degree(group) + 7)/8; | ||
| 170 | len = BN_num_bytes(x); | ||
| 171 | if (len > buflen) | ||
| 172 | { | ||
| 173 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR); | ||
| 174 | goto err; | ||
| 175 | } | ||
| 176 | if ((buf = OPENSSL_malloc(buflen)) == NULL) | ||
| 177 | { | ||
| 178 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE); | ||
| 179 | goto err; | ||
| 180 | } | ||
| 181 | |||
| 182 | memset(buf, 0, buflen - len); | ||
| 183 | if (len != (size_t)BN_bn2bin(x, buf + buflen - len)) | ||
| 184 | { | ||
| 185 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_BN_LIB); | ||
| 186 | goto err; | ||
| 187 | } | ||
| 188 | |||
| 189 | if (KDF != 0) | ||
| 190 | { | ||
| 191 | if (KDF(buf, buflen, out, &outlen) == NULL) | ||
| 192 | { | ||
| 193 | ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_KDF_FAILED); | ||
| 194 | goto err; | ||
| 195 | } | ||
| 196 | ret = outlen; | ||
| 197 | } | ||
| 198 | else | ||
| 199 | { | ||
| 200 | /* no KDF, just copy as much as we can */ | ||
| 201 | if (outlen > buflen) | ||
| 202 | outlen = buflen; | ||
| 203 | memcpy(out, buf, outlen); | ||
| 204 | ret = outlen; | ||
| 205 | } | ||
| 206 | |||
| 207 | err: | ||
| 208 | if (tmp) EC_POINT_free(tmp); | ||
| 209 | if (ctx) BN_CTX_end(ctx); | ||
| 210 | if (ctx) BN_CTX_free(ctx); | ||
| 211 | if (buf) OPENSSL_free(buf); | ||
| 212 | return(ret); | ||
| 213 | } | ||
diff --git a/src/lib/libcrypto/ecdsa/Makefile b/src/lib/libcrypto/ecdsa/Makefile new file mode 100644 index 0000000000..e89e0c010c --- /dev/null +++ b/src/lib/libcrypto/ecdsa/Makefile | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | # | ||
| 2 | # crypto/ecdsa/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ecdsa | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g -Wall | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=ecdsatest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= ecs_lib.c ecs_asn1.c ecs_ossl.c ecs_sign.c ecs_vrf.c ecs_err.c | ||
| 21 | |||
| 22 | LIBOBJ= ecs_lib.o ecs_asn1.o ecs_ossl.o ecs_sign.o ecs_vrf.o ecs_err.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | EXHEADER= ecdsa.h | ||
| 27 | HEADER= ecs_locl.h $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | |||
| 73 | clean: | ||
| 74 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 75 | |||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 77 | |||
| 78 | ecs_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 79 | ecs_asn1.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 80 | ecs_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 81 | ecs_asn1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 82 | ecs_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 83 | ecs_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 84 | ecs_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 85 | ecs_asn1.o: ../../include/openssl/symhacks.h ecs_asn1.c ecs_locl.h | ||
| 86 | ecs_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 87 | ecs_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 88 | ecs_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdsa.h | ||
| 89 | ecs_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 90 | ecs_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 91 | ecs_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 92 | ecs_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 93 | ecs_err.o: ecs_err.c | ||
| 94 | ecs_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 95 | ecs_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 96 | ecs_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 97 | ecs_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 98 | ecs_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 99 | ecs_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 100 | ecs_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 101 | ecs_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 102 | ecs_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 103 | ecs_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 104 | ecs_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 105 | ecs_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 106 | ecs_lib.o: ../../include/openssl/x509_vfy.h ecs_lib.c ecs_locl.h | ||
| 107 | ecs_ossl.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 108 | ecs_ossl.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 109 | ecs_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 110 | ecs_ossl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 111 | ecs_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 112 | ecs_ossl.o: ../../include/openssl/opensslconf.h | ||
| 113 | ecs_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 114 | ecs_ossl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 115 | ecs_ossl.o: ../../include/openssl/symhacks.h ecs_locl.h ecs_ossl.c | ||
| 116 | ecs_sign.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 117 | ecs_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 118 | ecs_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 119 | ecs_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 120 | ecs_sign.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | ||
| 121 | ecs_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 122 | ecs_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 123 | ecs_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 124 | ecs_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 125 | ecs_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 126 | ecs_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 127 | ecs_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 128 | ecs_sign.o: ecs_locl.h ecs_sign.c | ||
| 129 | ecs_vrf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 130 | ecs_vrf.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 131 | ecs_vrf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 132 | ecs_vrf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 133 | ecs_vrf.o: ../../include/openssl/engine.h ../../include/openssl/evp.h | ||
| 134 | ecs_vrf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 135 | ecs_vrf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 136 | ecs_vrf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 137 | ecs_vrf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 138 | ecs_vrf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 139 | ecs_vrf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 140 | ecs_vrf.o: ../../include/openssl/x509_vfy.h ecs_locl.h ecs_vrf.c | ||
diff --git a/src/lib/libcrypto/ecdsa/ecdsatest.c b/src/lib/libcrypto/ecdsa/ecdsatest.c new file mode 100644 index 0000000000..26a4a9ee7c --- /dev/null +++ b/src/lib/libcrypto/ecdsa/ecdsatest.c | |||
| @@ -0,0 +1,499 @@ | |||
| 1 | /* crypto/ecdsa/ecdsatest.c */ | ||
| 2 | /* | ||
| 3 | * Written by Nils Larsch for the OpenSSL project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
| 60 | * | ||
| 61 | * Portions of the attached software ("Contribution") are developed by | ||
| 62 | * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project. | ||
| 63 | * | ||
| 64 | * The Contribution is licensed pursuant to the OpenSSL open source | ||
| 65 | * license provided above. | ||
| 66 | * | ||
| 67 | * The elliptic curve binary polynomial software is originally written by | ||
| 68 | * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories. | ||
| 69 | * | ||
| 70 | */ | ||
| 71 | |||
| 72 | #include <stdio.h> | ||
| 73 | #include <stdlib.h> | ||
| 74 | #include <string.h> | ||
| 75 | |||
| 76 | #include <openssl/opensslconf.h> /* To see if OPENSSL_NO_ECDSA is defined */ | ||
| 77 | |||
| 78 | #ifdef OPENSSL_NO_ECDSA | ||
| 79 | int main(int argc, char * argv[]) | ||
| 80 | { | ||
| 81 | puts("Elliptic curves are disabled."); | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | #else | ||
| 85 | |||
| 86 | #include <openssl/crypto.h> | ||
| 87 | #include <openssl/bio.h> | ||
| 88 | #include <openssl/evp.h> | ||
| 89 | #include <openssl/bn.h> | ||
| 90 | #include <openssl/ecdsa.h> | ||
| 91 | #ifndef OPENSSL_NO_ENGINE | ||
| 92 | #include <openssl/engine.h> | ||
| 93 | #endif | ||
| 94 | #include <openssl/err.h> | ||
| 95 | #include <openssl/rand.h> | ||
| 96 | |||
| 97 | static const char rnd_seed[] = "string to make the random number generator " | ||
| 98 | "think it has entropy"; | ||
| 99 | |||
| 100 | /* declaration of the test functions */ | ||
| 101 | int x9_62_tests(BIO *); | ||
| 102 | int x9_62_test_internal(BIO *out, int nid, const char *r, const char *s); | ||
| 103 | int test_builtin(BIO *); | ||
| 104 | |||
| 105 | /* functions to change the RAND_METHOD */ | ||
| 106 | int change_rand(void); | ||
| 107 | int restore_rand(void); | ||
| 108 | int fbytes(unsigned char *buf, int num); | ||
| 109 | |||
| 110 | RAND_METHOD fake_rand; | ||
| 111 | const RAND_METHOD *old_rand; | ||
| 112 | |||
| 113 | int change_rand(void) | ||
| 114 | { | ||
| 115 | /* save old rand method */ | ||
| 116 | if ((old_rand = RAND_get_rand_method()) == NULL) | ||
| 117 | return 0; | ||
| 118 | |||
| 119 | fake_rand.seed = old_rand->seed; | ||
| 120 | fake_rand.cleanup = old_rand->cleanup; | ||
| 121 | fake_rand.add = old_rand->add; | ||
| 122 | fake_rand.status = old_rand->status; | ||
| 123 | /* use own random function */ | ||
| 124 | fake_rand.bytes = fbytes; | ||
| 125 | fake_rand.pseudorand = old_rand->bytes; | ||
| 126 | /* set new RAND_METHOD */ | ||
| 127 | if (!RAND_set_rand_method(&fake_rand)) | ||
| 128 | return 0; | ||
| 129 | return 1; | ||
| 130 | } | ||
| 131 | |||
| 132 | int restore_rand(void) | ||
| 133 | { | ||
| 134 | if (!RAND_set_rand_method(old_rand)) | ||
| 135 | return 0; | ||
| 136 | else | ||
| 137 | return 1; | ||
| 138 | } | ||
| 139 | |||
| 140 | static int fbytes_counter = 0; | ||
| 141 | static const char *numbers[8] = { | ||
| 142 | "651056770906015076056810763456358567190100156695615665659", | ||
| 143 | "6140507067065001063065065565667405560006161556565665656654", | ||
| 144 | "8763001015071075675010661307616710783570106710677817767166" | ||
| 145 | "71676178726717", | ||
| 146 | "7000000175690566466555057817571571075705015757757057795755" | ||
| 147 | "55657156756655", | ||
| 148 | "1275552191113212300012030439187146164646146646466749494799", | ||
| 149 | "1542725565216523985789236956265265265235675811949404040041", | ||
| 150 | "1456427555219115346513212300075341203043918714616464614664" | ||
| 151 | "64667494947990", | ||
| 152 | "1712787255652165239672857892369562652652652356758119494040" | ||
| 153 | "40041670216363"}; | ||
| 154 | |||
| 155 | int fbytes(unsigned char *buf, int num) | ||
| 156 | { | ||
| 157 | int ret; | ||
| 158 | BIGNUM *tmp = NULL; | ||
| 159 | |||
| 160 | if (fbytes_counter >= 8) | ||
| 161 | return 0; | ||
| 162 | tmp = BN_new(); | ||
| 163 | if (!tmp) | ||
| 164 | return 0; | ||
| 165 | if (!BN_dec2bn(&tmp, numbers[fbytes_counter])) | ||
| 166 | { | ||
| 167 | BN_free(tmp); | ||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | fbytes_counter ++; | ||
| 171 | if (num != BN_num_bytes(tmp) || !BN_bn2bin(tmp, buf)) | ||
| 172 | ret = 0; | ||
| 173 | else | ||
| 174 | ret = 1; | ||
| 175 | if (tmp) | ||
| 176 | BN_free(tmp); | ||
| 177 | return ret; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* some tests from the X9.62 draft */ | ||
| 181 | int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in) | ||
| 182 | { | ||
| 183 | int ret = 0; | ||
| 184 | const char message[] = "abc"; | ||
| 185 | unsigned char digest[20]; | ||
| 186 | unsigned int dgst_len = 0; | ||
| 187 | EVP_MD_CTX md_ctx; | ||
| 188 | EC_KEY *key = NULL; | ||
| 189 | ECDSA_SIG *signature = NULL; | ||
| 190 | BIGNUM *r = NULL, *s = NULL; | ||
| 191 | |||
| 192 | EVP_MD_CTX_init(&md_ctx); | ||
| 193 | /* get the message digest */ | ||
| 194 | EVP_DigestInit(&md_ctx, EVP_ecdsa()); | ||
| 195 | EVP_DigestUpdate(&md_ctx, (const void*)message, 3); | ||
| 196 | EVP_DigestFinal(&md_ctx, digest, &dgst_len); | ||
| 197 | |||
| 198 | BIO_printf(out, "testing %s: ", OBJ_nid2sn(nid)); | ||
| 199 | /* create the key */ | ||
| 200 | if ((key = EC_KEY_new_by_curve_name(nid)) == NULL) | ||
| 201 | goto x962_int_err; | ||
| 202 | if (!EC_KEY_generate_key(key)) | ||
| 203 | goto x962_int_err; | ||
| 204 | BIO_printf(out, "."); | ||
| 205 | (void)BIO_flush(out); | ||
| 206 | /* create the signature */ | ||
| 207 | signature = ECDSA_do_sign(digest, 20, key); | ||
| 208 | if (signature == NULL) | ||
| 209 | goto x962_int_err; | ||
| 210 | BIO_printf(out, "."); | ||
| 211 | (void)BIO_flush(out); | ||
| 212 | /* compare the created signature with the expected signature */ | ||
| 213 | if ((r = BN_new()) == NULL || (s = BN_new()) == NULL) | ||
| 214 | goto x962_int_err; | ||
| 215 | if (!BN_dec2bn(&r, r_in) || | ||
| 216 | !BN_dec2bn(&s, s_in)) | ||
| 217 | goto x962_int_err; | ||
| 218 | if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s)) | ||
| 219 | goto x962_int_err; | ||
| 220 | BIO_printf(out, "."); | ||
| 221 | (void)BIO_flush(out); | ||
| 222 | /* verify the signature */ | ||
| 223 | if (ECDSA_do_verify(digest, 20, signature, key) != 1) | ||
| 224 | goto x962_int_err; | ||
| 225 | BIO_printf(out, "."); | ||
| 226 | (void)BIO_flush(out); | ||
| 227 | |||
| 228 | BIO_printf(out, " ok\n"); | ||
| 229 | ret = 1; | ||
| 230 | x962_int_err: | ||
| 231 | if (!ret) | ||
| 232 | BIO_printf(out, " failed\n"); | ||
| 233 | if (key) | ||
| 234 | EC_KEY_free(key); | ||
| 235 | if (signature) | ||
| 236 | ECDSA_SIG_free(signature); | ||
| 237 | if (r) | ||
| 238 | BN_free(r); | ||
| 239 | if (s) | ||
| 240 | BN_free(s); | ||
| 241 | EVP_MD_CTX_cleanup(&md_ctx); | ||
| 242 | return ret; | ||
| 243 | } | ||
| 244 | |||
| 245 | int x9_62_tests(BIO *out) | ||
| 246 | { | ||
| 247 | int ret = 0; | ||
| 248 | |||
| 249 | BIO_printf(out, "some tests from X9.62:\n"); | ||
| 250 | |||
| 251 | /* set own rand method */ | ||
| 252 | if (!change_rand()) | ||
| 253 | goto x962_err; | ||
| 254 | |||
| 255 | if (!x9_62_test_internal(out, NID_X9_62_prime192v1, | ||
| 256 | "3342403536405981729393488334694600415596881826869351677613", | ||
| 257 | "5735822328888155254683894997897571951568553642892029982342")) | ||
| 258 | goto x962_err; | ||
| 259 | if (!x9_62_test_internal(out, NID_X9_62_prime239v1, | ||
| 260 | "3086361431751678114926225473006680188549593787585317781474" | ||
| 261 | "62058306432176", | ||
| 262 | "3238135532097973577080787768312505059318910517550078427819" | ||
| 263 | "78505179448783")) | ||
| 264 | goto x962_err; | ||
| 265 | if (!x9_62_test_internal(out, NID_X9_62_c2tnb191v1, | ||
| 266 | "87194383164871543355722284926904419997237591535066528048", | ||
| 267 | "308992691965804947361541664549085895292153777025772063598")) | ||
| 268 | goto x962_err; | ||
| 269 | if (!x9_62_test_internal(out, NID_X9_62_c2tnb239v1, | ||
| 270 | "2159633321041961198501834003903461262881815148684178964245" | ||
| 271 | "5876922391552", | ||
| 272 | "1970303740007316867383349976549972270528498040721988191026" | ||
| 273 | "49413465737174")) | ||
| 274 | goto x962_err; | ||
| 275 | |||
| 276 | ret = 1; | ||
| 277 | x962_err: | ||
| 278 | if (!restore_rand()) | ||
| 279 | ret = 0; | ||
| 280 | return ret; | ||
| 281 | } | ||
| 282 | |||
| 283 | int test_builtin(BIO *out) | ||
| 284 | { | ||
| 285 | EC_builtin_curve *curves = NULL; | ||
| 286 | size_t crv_len = 0, n = 0; | ||
| 287 | EC_KEY *eckey = NULL, *wrong_eckey = NULL; | ||
| 288 | EC_GROUP *group; | ||
| 289 | unsigned char digest[20], wrong_digest[20]; | ||
| 290 | unsigned char *signature = NULL; | ||
| 291 | unsigned int sig_len; | ||
| 292 | int nid, ret = 0; | ||
| 293 | |||
| 294 | /* fill digest values with some random data */ | ||
| 295 | if (!RAND_pseudo_bytes(digest, 20) || | ||
| 296 | !RAND_pseudo_bytes(wrong_digest, 20)) | ||
| 297 | { | ||
| 298 | BIO_printf(out, "ERROR: unable to get random data\n"); | ||
| 299 | goto builtin_err; | ||
| 300 | } | ||
| 301 | |||
| 302 | /* create and verify a ecdsa signature with every availble curve | ||
| 303 | * (with ) */ | ||
| 304 | BIO_printf(out, "\ntesting ECDSA_sign() and ECDSA_verify() " | ||
| 305 | "with some internal curves:\n"); | ||
| 306 | |||
| 307 | /* get a list of all internal curves */ | ||
| 308 | crv_len = EC_get_builtin_curves(NULL, 0); | ||
| 309 | |||
| 310 | curves = OPENSSL_malloc(sizeof(EC_builtin_curve) * crv_len); | ||
| 311 | |||
| 312 | if (curves == NULL) | ||
| 313 | { | ||
| 314 | BIO_printf(out, "malloc error\n"); | ||
| 315 | goto builtin_err; | ||
| 316 | } | ||
| 317 | |||
| 318 | if (!EC_get_builtin_curves(curves, crv_len)) | ||
| 319 | { | ||
| 320 | BIO_printf(out, "unable to get internal curves\n"); | ||
| 321 | goto builtin_err; | ||
| 322 | } | ||
| 323 | |||
| 324 | /* now create and verify a signature for every curve */ | ||
| 325 | for (n = 0; n < crv_len; n++) | ||
| 326 | { | ||
| 327 | unsigned char dirt, offset; | ||
| 328 | |||
| 329 | nid = curves[n].nid; | ||
| 330 | if (nid == NID_ipsec4) | ||
| 331 | continue; | ||
| 332 | /* create new ecdsa key (== EC_KEY) */ | ||
| 333 | if ((eckey = EC_KEY_new()) == NULL) | ||
| 334 | goto builtin_err; | ||
| 335 | group = EC_GROUP_new_by_curve_name(nid); | ||
| 336 | if (group == NULL) | ||
| 337 | goto builtin_err; | ||
| 338 | if (EC_KEY_set_group(eckey, group) == 0) | ||
| 339 | goto builtin_err; | ||
| 340 | EC_GROUP_free(group); | ||
| 341 | if (EC_GROUP_get_degree(EC_KEY_get0_group(eckey)) < 160) | ||
| 342 | /* drop the curve */ | ||
| 343 | { | ||
| 344 | EC_KEY_free(eckey); | ||
| 345 | eckey = NULL; | ||
| 346 | continue; | ||
| 347 | } | ||
| 348 | BIO_printf(out, "%s: ", OBJ_nid2sn(nid)); | ||
| 349 | /* create key */ | ||
| 350 | if (!EC_KEY_generate_key(eckey)) | ||
| 351 | { | ||
| 352 | BIO_printf(out, " failed\n"); | ||
| 353 | goto builtin_err; | ||
| 354 | } | ||
| 355 | /* create second key */ | ||
| 356 | if ((wrong_eckey = EC_KEY_new()) == NULL) | ||
| 357 | goto builtin_err; | ||
| 358 | group = EC_GROUP_new_by_curve_name(nid); | ||
| 359 | if (group == NULL) | ||
| 360 | goto builtin_err; | ||
| 361 | if (EC_KEY_set_group(wrong_eckey, group) == 0) | ||
| 362 | goto builtin_err; | ||
| 363 | EC_GROUP_free(group); | ||
| 364 | if (!EC_KEY_generate_key(wrong_eckey)) | ||
| 365 | { | ||
| 366 | BIO_printf(out, " failed\n"); | ||
| 367 | goto builtin_err; | ||
| 368 | } | ||
| 369 | |||
| 370 | BIO_printf(out, "."); | ||
| 371 | (void)BIO_flush(out); | ||
| 372 | /* check key */ | ||
| 373 | if (!EC_KEY_check_key(eckey)) | ||
| 374 | { | ||
| 375 | BIO_printf(out, " failed\n"); | ||
| 376 | goto builtin_err; | ||
| 377 | } | ||
| 378 | BIO_printf(out, "."); | ||
| 379 | (void)BIO_flush(out); | ||
| 380 | /* create signature */ | ||
| 381 | sig_len = ECDSA_size(eckey); | ||
| 382 | if ((signature = OPENSSL_malloc(sig_len)) == NULL) | ||
| 383 | goto builtin_err; | ||
| 384 | if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey)) | ||
| 385 | { | ||
| 386 | BIO_printf(out, " failed\n"); | ||
| 387 | goto builtin_err; | ||
| 388 | } | ||
| 389 | BIO_printf(out, "."); | ||
| 390 | (void)BIO_flush(out); | ||
| 391 | /* verify signature */ | ||
| 392 | if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) != 1) | ||
| 393 | { | ||
| 394 | BIO_printf(out, " failed\n"); | ||
| 395 | goto builtin_err; | ||
| 396 | } | ||
| 397 | BIO_printf(out, "."); | ||
| 398 | (void)BIO_flush(out); | ||
| 399 | /* verify signature with the wrong key */ | ||
| 400 | if (ECDSA_verify(0, digest, 20, signature, sig_len, | ||
| 401 | wrong_eckey) == 1) | ||
| 402 | { | ||
| 403 | BIO_printf(out, " failed\n"); | ||
| 404 | goto builtin_err; | ||
| 405 | } | ||
| 406 | BIO_printf(out, "."); | ||
| 407 | (void)BIO_flush(out); | ||
| 408 | /* wrong digest */ | ||
| 409 | if (ECDSA_verify(0, wrong_digest, 20, signature, sig_len, | ||
| 410 | eckey) == 1) | ||
| 411 | { | ||
| 412 | BIO_printf(out, " failed\n"); | ||
| 413 | goto builtin_err; | ||
| 414 | } | ||
| 415 | BIO_printf(out, "."); | ||
| 416 | (void)BIO_flush(out); | ||
| 417 | /* modify a single byte of the signature */ | ||
| 418 | offset = signature[10] % sig_len; | ||
| 419 | dirt = signature[11]; | ||
| 420 | signature[offset] ^= dirt ? dirt : 1; | ||
| 421 | if (ECDSA_verify(0, digest, 20, signature, sig_len, eckey) == 1) | ||
| 422 | { | ||
| 423 | BIO_printf(out, " failed\n"); | ||
| 424 | goto builtin_err; | ||
| 425 | } | ||
| 426 | BIO_printf(out, "."); | ||
| 427 | (void)BIO_flush(out); | ||
| 428 | |||
| 429 | BIO_printf(out, " ok\n"); | ||
| 430 | /* cleanup */ | ||
| 431 | OPENSSL_free(signature); | ||
| 432 | signature = NULL; | ||
| 433 | EC_KEY_free(eckey); | ||
| 434 | eckey = NULL; | ||
| 435 | EC_KEY_free(wrong_eckey); | ||
| 436 | wrong_eckey = NULL; | ||
| 437 | } | ||
| 438 | |||
| 439 | ret = 1; | ||
| 440 | builtin_err: | ||
| 441 | if (eckey) | ||
| 442 | EC_KEY_free(eckey); | ||
| 443 | if (wrong_eckey) | ||
| 444 | EC_KEY_free(wrong_eckey); | ||
| 445 | if (signature) | ||
| 446 | OPENSSL_free(signature); | ||
| 447 | if (curves) | ||
| 448 | OPENSSL_free(curves); | ||
| 449 | |||
| 450 | return ret; | ||
| 451 | } | ||
| 452 | |||
| 453 | int main(void) | ||
| 454 | { | ||
| 455 | int ret = 1; | ||
| 456 | BIO *out; | ||
| 457 | |||
| 458 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
| 459 | |||
| 460 | /* enable memory leak checking unless explicitly disabled */ | ||
| 461 | if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && | ||
| 462 | (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) | ||
| 463 | { | ||
| 464 | CRYPTO_malloc_debug_init(); | ||
| 465 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | ||
| 466 | } | ||
| 467 | else | ||
| 468 | { | ||
| 469 | /* OPENSSL_DEBUG_MEMORY=off */ | ||
| 470 | CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); | ||
| 471 | } | ||
| 472 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 473 | |||
| 474 | ERR_load_crypto_strings(); | ||
| 475 | |||
| 476 | /* initialize the prng */ | ||
| 477 | RAND_seed(rnd_seed, sizeof(rnd_seed)); | ||
| 478 | |||
| 479 | /* the tests */ | ||
| 480 | if (!x9_62_tests(out)) goto err; | ||
| 481 | if (!test_builtin(out)) goto err; | ||
| 482 | |||
| 483 | ret = 0; | ||
| 484 | err: | ||
| 485 | if (ret) | ||
| 486 | BIO_printf(out, "\nECDSA test failed\n"); | ||
| 487 | else | ||
| 488 | BIO_printf(out, "\nECDSA test passed\n"); | ||
| 489 | if (ret) | ||
| 490 | ERR_print_errors(out); | ||
| 491 | CRYPTO_cleanup_all_ex_data(); | ||
| 492 | ERR_remove_thread_state(NULL); | ||
| 493 | ERR_free_strings(); | ||
| 494 | CRYPTO_mem_leaks(out); | ||
| 495 | if (out != NULL) | ||
| 496 | BIO_free(out); | ||
| 497 | return ret; | ||
| 498 | } | ||
| 499 | #endif | ||
diff --git a/src/lib/libcrypto/engine/Makefile b/src/lib/libcrypto/engine/Makefile new file mode 100644 index 0000000000..9c214824eb --- /dev/null +++ b/src/lib/libcrypto/engine/Makefile | |||
| @@ -0,0 +1,417 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/engine/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= engine | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= enginetest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= eng_err.c eng_lib.c eng_list.c eng_init.c eng_ctrl.c \ | ||
| 21 | eng_table.c eng_pkey.c eng_fat.c eng_all.c \ | ||
| 22 | tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \ | ||
| 23 | tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c \ | ||
| 24 | eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c | ||
| 25 | LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \ | ||
| 26 | eng_table.o eng_pkey.o eng_fat.o eng_all.o \ | ||
| 27 | tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \ | ||
| 28 | tb_cipher.o tb_digest.o tb_pkmeth.o tb_asnmth.o \ | ||
| 29 | eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o | ||
| 30 | |||
| 31 | SRC= $(LIBSRC) | ||
| 32 | |||
| 33 | EXHEADER= engine.h | ||
| 34 | HEADER= $(EXHEADER) | ||
| 35 | |||
| 36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 37 | |||
| 38 | top: | ||
| 39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 40 | |||
| 41 | all: lib | ||
| 42 | |||
| 43 | lib: $(LIBOBJ) | ||
| 44 | $(AR) $(LIB) $(LIBOBJ) | ||
| 45 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 46 | @touch lib | ||
| 47 | |||
| 48 | files: | ||
| 49 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 55 | |||
| 56 | install: | ||
| 57 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 58 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 59 | do \ | ||
| 60 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 61 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 62 | done; | ||
| 63 | |||
| 64 | tags: | ||
| 65 | ctags $(SRC) | ||
| 66 | |||
| 67 | tests: | ||
| 68 | |||
| 69 | lint: | ||
| 70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 71 | |||
| 72 | depend: | ||
| 73 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 75 | |||
| 76 | dclean: | ||
| 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 78 | mv -f Makefile.new $(MAKEFILE) | ||
| 79 | |||
| 80 | clean: | ||
| 81 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | eng_all.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 86 | eng_all.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 87 | eng_all.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 88 | eng_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 89 | eng_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 90 | eng_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 91 | eng_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 92 | eng_all.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 93 | eng_all.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 94 | eng_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 95 | eng_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 96 | eng_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 97 | eng_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_all.c eng_int.h | ||
| 98 | eng_cnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 99 | eng_cnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 100 | eng_cnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 101 | eng_cnf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 102 | eng_cnf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 103 | eng_cnf.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 104 | eng_cnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 105 | eng_cnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 106 | eng_cnf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 107 | eng_cnf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 108 | eng_cnf.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 109 | eng_cnf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 110 | eng_cnf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 111 | eng_cnf.o: ../cryptlib.h eng_cnf.c eng_int.h | ||
| 112 | eng_cryptodev.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 113 | eng_cryptodev.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 114 | eng_cryptodev.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 115 | eng_cryptodev.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 116 | eng_cryptodev.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 117 | eng_cryptodev.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 118 | eng_cryptodev.o: ../../include/openssl/obj_mac.h | ||
| 119 | eng_cryptodev.o: ../../include/openssl/objects.h | ||
| 120 | eng_cryptodev.o: ../../include/openssl/opensslconf.h | ||
| 121 | eng_cryptodev.o: ../../include/openssl/opensslv.h | ||
| 122 | eng_cryptodev.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 123 | eng_cryptodev.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 124 | eng_cryptodev.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 125 | eng_cryptodev.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 126 | eng_cryptodev.o: eng_cryptodev.c | ||
| 127 | eng_ctrl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 128 | eng_ctrl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 129 | eng_ctrl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 130 | eng_ctrl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 131 | eng_ctrl.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 132 | eng_ctrl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 133 | eng_ctrl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 134 | eng_ctrl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 135 | eng_ctrl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 136 | eng_ctrl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 137 | eng_ctrl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 138 | eng_ctrl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 139 | eng_ctrl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_ctrl.c eng_int.h | ||
| 140 | eng_dyn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 141 | eng_dyn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 142 | eng_dyn.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h | ||
| 143 | eng_dyn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 144 | eng_dyn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 145 | eng_dyn.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 146 | eng_dyn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 147 | eng_dyn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 148 | eng_dyn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 149 | eng_dyn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 150 | eng_dyn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 151 | eng_dyn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 152 | eng_dyn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 153 | eng_dyn.o: ../cryptlib.h eng_dyn.c eng_int.h | ||
| 154 | eng_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 155 | eng_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 156 | eng_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 157 | eng_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 158 | eng_err.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 159 | eng_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 160 | eng_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 161 | eng_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 162 | eng_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 163 | eng_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 164 | eng_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 165 | eng_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 166 | eng_err.o: eng_err.c | ||
| 167 | eng_fat.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 168 | eng_fat.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 169 | eng_fat.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 170 | eng_fat.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 171 | eng_fat.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 172 | eng_fat.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 173 | eng_fat.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 174 | eng_fat.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 175 | eng_fat.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 176 | eng_fat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 177 | eng_fat.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 178 | eng_fat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 179 | eng_fat.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 180 | eng_fat.o: ../cryptlib.h eng_fat.c eng_int.h | ||
| 181 | eng_init.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 182 | eng_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 183 | eng_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 184 | eng_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 185 | eng_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 186 | eng_init.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 187 | eng_init.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 188 | eng_init.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 189 | eng_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 190 | eng_init.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 191 | eng_init.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 192 | eng_init.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 193 | eng_init.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_init.c eng_int.h | ||
| 194 | eng_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 195 | eng_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 196 | eng_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 197 | eng_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 198 | eng_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 199 | eng_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 200 | eng_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 201 | eng_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 202 | eng_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 203 | eng_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 204 | eng_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 205 | eng_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 206 | eng_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 207 | eng_lib.o: ../cryptlib.h eng_int.h eng_lib.c | ||
| 208 | eng_list.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 209 | eng_list.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 210 | eng_list.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 211 | eng_list.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 212 | eng_list.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 213 | eng_list.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 214 | eng_list.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 215 | eng_list.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 216 | eng_list.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 217 | eng_list.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 218 | eng_list.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 219 | eng_list.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 220 | eng_list.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_list.c | ||
| 221 | eng_openssl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 222 | eng_openssl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 223 | eng_openssl.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 224 | eng_openssl.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 225 | eng_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 226 | eng_openssl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 227 | eng_openssl.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 228 | eng_openssl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 229 | eng_openssl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 230 | eng_openssl.o: ../../include/openssl/opensslconf.h | ||
| 231 | eng_openssl.o: ../../include/openssl/opensslv.h | ||
| 232 | eng_openssl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 233 | eng_openssl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 234 | eng_openssl.o: ../../include/openssl/rand.h ../../include/openssl/rc4.h | ||
| 235 | eng_openssl.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 236 | eng_openssl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 237 | eng_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 238 | eng_openssl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_openssl.c | ||
| 239 | eng_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 240 | eng_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 241 | eng_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 242 | eng_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 243 | eng_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 244 | eng_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 245 | eng_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 246 | eng_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 247 | eng_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 248 | eng_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 249 | eng_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 250 | eng_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 251 | eng_pkey.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h eng_pkey.c | ||
| 252 | eng_table.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 253 | eng_table.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 254 | eng_table.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 255 | eng_table.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 256 | eng_table.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 257 | eng_table.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 258 | eng_table.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 259 | eng_table.o: ../../include/openssl/objects.h | ||
| 260 | eng_table.o: ../../include/openssl/opensslconf.h | ||
| 261 | eng_table.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 262 | eng_table.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 263 | eng_table.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 264 | eng_table.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 265 | eng_table.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h | ||
| 266 | eng_table.o: eng_table.c | ||
| 267 | tb_asnmth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 268 | tb_asnmth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 269 | tb_asnmth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 270 | tb_asnmth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 271 | tb_asnmth.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 272 | tb_asnmth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 273 | tb_asnmth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 274 | tb_asnmth.o: ../../include/openssl/objects.h | ||
| 275 | tb_asnmth.o: ../../include/openssl/opensslconf.h | ||
| 276 | tb_asnmth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 277 | tb_asnmth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 278 | tb_asnmth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 279 | tb_asnmth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 280 | tb_asnmth.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 281 | tb_asnmth.o: eng_int.h tb_asnmth.c | ||
| 282 | tb_cipher.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 283 | tb_cipher.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 284 | tb_cipher.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 285 | tb_cipher.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 286 | tb_cipher.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 287 | tb_cipher.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 288 | tb_cipher.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 289 | tb_cipher.o: ../../include/openssl/objects.h | ||
| 290 | tb_cipher.o: ../../include/openssl/opensslconf.h | ||
| 291 | tb_cipher.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 292 | tb_cipher.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 293 | tb_cipher.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 294 | tb_cipher.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 295 | tb_cipher.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h | ||
| 296 | tb_cipher.o: tb_cipher.c | ||
| 297 | tb_dh.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 298 | tb_dh.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 299 | tb_dh.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 300 | tb_dh.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 301 | tb_dh.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 302 | tb_dh.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 303 | tb_dh.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 304 | tb_dh.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 305 | tb_dh.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 306 | tb_dh.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 307 | tb_dh.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 308 | tb_dh.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 309 | tb_dh.o: ../cryptlib.h eng_int.h tb_dh.c | ||
| 310 | tb_digest.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 311 | tb_digest.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 312 | tb_digest.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 313 | tb_digest.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 314 | tb_digest.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 315 | tb_digest.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 316 | tb_digest.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 317 | tb_digest.o: ../../include/openssl/objects.h | ||
| 318 | tb_digest.o: ../../include/openssl/opensslconf.h | ||
| 319 | tb_digest.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 320 | tb_digest.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 321 | tb_digest.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 322 | tb_digest.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 323 | tb_digest.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h | ||
| 324 | tb_digest.o: tb_digest.c | ||
| 325 | tb_dsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 326 | tb_dsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 327 | tb_dsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 328 | tb_dsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 329 | tb_dsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 330 | tb_dsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 331 | tb_dsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 332 | tb_dsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 333 | tb_dsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 334 | tb_dsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 335 | tb_dsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 336 | tb_dsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 337 | tb_dsa.o: ../cryptlib.h eng_int.h tb_dsa.c | ||
| 338 | tb_ecdh.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 339 | tb_ecdh.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 340 | tb_ecdh.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 341 | tb_ecdh.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 342 | tb_ecdh.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 343 | tb_ecdh.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 344 | tb_ecdh.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 345 | tb_ecdh.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 346 | tb_ecdh.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 347 | tb_ecdh.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 348 | tb_ecdh.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 349 | tb_ecdh.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 350 | tb_ecdh.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecdh.c | ||
| 351 | tb_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 352 | tb_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 353 | tb_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 354 | tb_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 355 | tb_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 356 | tb_ecdsa.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 357 | tb_ecdsa.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 358 | tb_ecdsa.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 359 | tb_ecdsa.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 360 | tb_ecdsa.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 361 | tb_ecdsa.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 362 | tb_ecdsa.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 363 | tb_ecdsa.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_ecdsa.c | ||
| 364 | tb_pkmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 365 | tb_pkmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 366 | tb_pkmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 367 | tb_pkmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 368 | tb_pkmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 369 | tb_pkmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 370 | tb_pkmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 371 | tb_pkmeth.o: ../../include/openssl/objects.h | ||
| 372 | tb_pkmeth.o: ../../include/openssl/opensslconf.h | ||
| 373 | tb_pkmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 374 | tb_pkmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 375 | tb_pkmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 376 | tb_pkmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 377 | tb_pkmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h | ||
| 378 | tb_pkmeth.o: tb_pkmeth.c | ||
| 379 | tb_rand.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 380 | tb_rand.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 381 | tb_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 382 | tb_rand.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 383 | tb_rand.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 384 | tb_rand.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 385 | tb_rand.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 386 | tb_rand.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 387 | tb_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 388 | tb_rand.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 389 | tb_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 390 | tb_rand.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 391 | tb_rand.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_rand.c | ||
| 392 | tb_rsa.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 393 | tb_rsa.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 394 | tb_rsa.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 395 | tb_rsa.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 396 | tb_rsa.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 397 | tb_rsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 398 | tb_rsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 399 | tb_rsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 400 | tb_rsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 401 | tb_rsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 402 | tb_rsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 403 | tb_rsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 404 | tb_rsa.o: ../cryptlib.h eng_int.h tb_rsa.c | ||
| 405 | tb_store.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 406 | tb_store.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 407 | tb_store.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 408 | tb_store.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 409 | tb_store.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 410 | tb_store.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 411 | tb_store.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 412 | tb_store.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 413 | tb_store.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 414 | tb_store.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 415 | tb_store.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 416 | tb_store.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 417 | tb_store.o: ../../include/openssl/x509_vfy.h ../cryptlib.h eng_int.h tb_store.c | ||
diff --git a/src/lib/libcrypto/engine/eng_aesni.c b/src/lib/libcrypto/engine/eng_aesni.c new file mode 100644 index 0000000000..5fdb33bfde --- /dev/null +++ b/src/lib/libcrypto/engine/eng_aesni.c | |||
| @@ -0,0 +1,570 @@ | |||
| 1 | /* | ||
| 2 | * Support for Intel AES-NI intruction set | ||
| 3 | * Author: Huang Ying <ying.huang@intel.com> | ||
| 4 | * | ||
| 5 | * Intel AES-NI is a new set of Single Instruction Multiple Data | ||
| 6 | * (SIMD) instructions that are going to be introduced in the next | ||
| 7 | * generation of Intel processor, as of 2009. These instructions | ||
| 8 | * enable fast and secure data encryption and decryption, using the | ||
| 9 | * Advanced Encryption Standard (AES), defined by FIPS Publication | ||
| 10 | * number 197. The architecture introduces six instructions that | ||
| 11 | * offer full hardware support for AES. Four of them support high | ||
| 12 | * performance data encryption and decryption, and the other two | ||
| 13 | * instructions support the AES key expansion procedure. | ||
| 14 | * | ||
| 15 | * The white paper can be downloaded from: | ||
| 16 | * http://softwarecommunity.intel.com/isn/downloads/intelavx/AES-Instructions-Set_WP.pdf | ||
| 17 | * | ||
| 18 | * This file is based on engines/e_padlock.c | ||
| 19 | */ | ||
| 20 | |||
| 21 | /* ==================================================================== | ||
| 22 | * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. | ||
| 23 | * | ||
| 24 | * Redistribution and use in source and binary forms, with or without | ||
| 25 | * modification, are permitted provided that the following conditions | ||
| 26 | * are met: | ||
| 27 | * | ||
| 28 | * 1. Redistributions of source code must retain the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer. | ||
| 30 | * | ||
| 31 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 32 | * notice, this list of conditions and the following disclaimer in | ||
| 33 | * the documentation and/or other materials provided with the | ||
| 34 | * distribution. | ||
| 35 | * | ||
| 36 | * 3. All advertising materials mentioning features or use of this | ||
| 37 | * software must display the following acknowledgment: | ||
| 38 | * "This product includes software developed by the OpenSSL Project | ||
| 39 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 40 | * | ||
| 41 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 42 | * endorse or promote products derived from this software without | ||
| 43 | * prior written permission. For written permission, please contact | ||
| 44 | * licensing@OpenSSL.org. | ||
| 45 | * | ||
| 46 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 47 | * nor may "OpenSSL" appear in their names without prior written | ||
| 48 | * permission of the OpenSSL Project. | ||
| 49 | * | ||
| 50 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 51 | * acknowledgment: | ||
| 52 | * "This product includes software developed by the OpenSSL Project | ||
| 53 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 54 | * | ||
| 55 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 56 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 58 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 59 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 60 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 61 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 62 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 63 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 64 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 65 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 66 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 67 | * ==================================================================== | ||
| 68 | * | ||
| 69 | * This product includes cryptographic software written by Eric Young | ||
| 70 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 71 | * Hudson (tjh@cryptsoft.com). | ||
| 72 | * | ||
| 73 | */ | ||
| 74 | |||
| 75 | |||
| 76 | #include <openssl/opensslconf.h> | ||
| 77 | |||
| 78 | #if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AES_NI) && !defined(OPENSSL_NO_AES) | ||
| 79 | |||
| 80 | #include <stdio.h> | ||
| 81 | #include <assert.h> | ||
| 82 | #include "cryptlib.h" | ||
| 83 | #include <openssl/dso.h> | ||
| 84 | #include <openssl/engine.h> | ||
| 85 | #include <openssl/evp.h> | ||
| 86 | #include <openssl/aes.h> | ||
| 87 | #include <openssl/err.h> | ||
| 88 | |||
| 89 | /* AES-NI is available *ONLY* on some x86 CPUs. Not only that it | ||
| 90 | doesn't exist elsewhere, but it even can't be compiled on other | ||
| 91 | platforms! */ | ||
| 92 | #undef COMPILE_HW_AESNI | ||
| 93 | #if (defined(__x86_64) || defined(__x86_64__) || \ | ||
| 94 | defined(_M_AMD64) || defined(_M_X64) || \ | ||
| 95 | defined(OPENSSL_IA32_SSE2)) && !defined(OPENSSL_NO_ASM) && !defined(__i386__) | ||
| 96 | #define COMPILE_HW_AESNI | ||
| 97 | #endif | ||
| 98 | static ENGINE *ENGINE_aesni (void); | ||
| 99 | |||
| 100 | void ENGINE_load_aesni (void) | ||
| 101 | { | ||
| 102 | /* On non-x86 CPUs it just returns. */ | ||
| 103 | #ifdef COMPILE_HW_AESNI | ||
| 104 | ENGINE *toadd = ENGINE_aesni(); | ||
| 105 | if (!toadd) return; | ||
| 106 | ENGINE_add (toadd); | ||
| 107 | ENGINE_register_complete (toadd); | ||
| 108 | ENGINE_free (toadd); | ||
| 109 | ERR_clear_error (); | ||
| 110 | #endif | ||
| 111 | } | ||
| 112 | |||
| 113 | #ifdef COMPILE_HW_AESNI | ||
| 114 | int aesni_set_encrypt_key(const unsigned char *userKey, int bits, | ||
| 115 | AES_KEY *key); | ||
| 116 | int aesni_set_decrypt_key(const unsigned char *userKey, int bits, | ||
| 117 | AES_KEY *key); | ||
| 118 | |||
| 119 | void aesni_encrypt(const unsigned char *in, unsigned char *out, | ||
| 120 | const AES_KEY *key); | ||
| 121 | void aesni_decrypt(const unsigned char *in, unsigned char *out, | ||
| 122 | const AES_KEY *key); | ||
| 123 | |||
| 124 | void aesni_ecb_encrypt(const unsigned char *in, | ||
| 125 | unsigned char *out, | ||
| 126 | size_t length, | ||
| 127 | const AES_KEY *key, | ||
| 128 | int enc); | ||
| 129 | void aesni_cbc_encrypt(const unsigned char *in, | ||
| 130 | unsigned char *out, | ||
| 131 | size_t length, | ||
| 132 | const AES_KEY *key, | ||
| 133 | unsigned char *ivec, int enc); | ||
| 134 | |||
| 135 | /* Function for ENGINE detection and control */ | ||
| 136 | static int aesni_init(ENGINE *e); | ||
| 137 | |||
| 138 | /* Cipher Stuff */ | ||
| 139 | static int aesni_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
| 140 | const int **nids, int nid); | ||
| 141 | |||
| 142 | #define AESNI_MIN_ALIGN 16 | ||
| 143 | #define AESNI_ALIGN(x) \ | ||
| 144 | ((void *)(((unsigned long)(x)+AESNI_MIN_ALIGN-1)&~(AESNI_MIN_ALIGN-1))) | ||
| 145 | |||
| 146 | /* Engine names */ | ||
| 147 | static const char aesni_id[] = "aesni", | ||
| 148 | aesni_name[] = "Intel AES-NI engine", | ||
| 149 | no_aesni_name[] = "Intel AES-NI engine (no-aesni)"; | ||
| 150 | |||
| 151 | |||
| 152 | /* The input and output encrypted as though 128bit cfb mode is being | ||
| 153 | * used. The extra state information to record how much of the | ||
| 154 | * 128bit block we have used is contained in *num; | ||
| 155 | */ | ||
| 156 | static void aesni_cfb128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 157 | unsigned int len, const void *key, | ||
| 158 | unsigned char ivec[16], int *num, | ||
| 159 | int enc) | ||
| 160 | { | ||
| 161 | unsigned int n; | ||
| 162 | size_t l = 0; | ||
| 163 | |||
| 164 | assert(in && out && key && ivec && num); | ||
| 165 | |||
| 166 | n = *num; | ||
| 167 | |||
| 168 | if (enc) { | ||
| 169 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 170 | if (16%sizeof(size_t) == 0) do { /* always true actually */ | ||
| 171 | while (n && len) { | ||
| 172 | *(out++) = ivec[n] ^= *(in++); | ||
| 173 | --len; | ||
| 174 | n = (n+1) % 16; | ||
| 175 | } | ||
| 176 | while (len>=16) { | ||
| 177 | aesni_encrypt(ivec, ivec, key); | ||
| 178 | for (n=0; n<16; n+=sizeof(size_t)) { | ||
| 179 | *(size_t*)(out+n) = | ||
| 180 | *(size_t*)(ivec+n) ^= *(size_t*)(in+n); | ||
| 181 | } | ||
| 182 | len -= 16; | ||
| 183 | out += 16; | ||
| 184 | in += 16; | ||
| 185 | } | ||
| 186 | n = 0; | ||
| 187 | if (len) { | ||
| 188 | aesni_encrypt(ivec, ivec, key); | ||
| 189 | while (len--) { | ||
| 190 | out[n] = ivec[n] ^= in[n]; | ||
| 191 | ++n; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | *num = n; | ||
| 195 | return; | ||
| 196 | } while (0); | ||
| 197 | /* the rest would be commonly eliminated by x86* compiler */ | ||
| 198 | #endif | ||
| 199 | while (l<len) { | ||
| 200 | if (n == 0) { | ||
| 201 | aesni_encrypt(ivec, ivec, key); | ||
| 202 | } | ||
| 203 | out[l] = ivec[n] ^= in[l]; | ||
| 204 | ++l; | ||
| 205 | n = (n+1) % 16; | ||
| 206 | } | ||
| 207 | *num = n; | ||
| 208 | } else { | ||
| 209 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 210 | if (16%sizeof(size_t) == 0) do { /* always true actually */ | ||
| 211 | while (n && len) { | ||
| 212 | unsigned char c; | ||
| 213 | *(out++) = ivec[n] ^ (c = *(in++)); ivec[n] = c; | ||
| 214 | --len; | ||
| 215 | n = (n+1) % 16; | ||
| 216 | } | ||
| 217 | while (len>=16) { | ||
| 218 | aesni_encrypt(ivec, ivec, key); | ||
| 219 | for (n=0; n<16; n+=sizeof(size_t)) { | ||
| 220 | size_t t = *(size_t*)(in+n); | ||
| 221 | *(size_t*)(out+n) = *(size_t*)(ivec+n) ^ t; | ||
| 222 | *(size_t*)(ivec+n) = t; | ||
| 223 | } | ||
| 224 | len -= 16; | ||
| 225 | out += 16; | ||
| 226 | in += 16; | ||
| 227 | } | ||
| 228 | n = 0; | ||
| 229 | if (len) { | ||
| 230 | aesni_encrypt(ivec, ivec, key); | ||
| 231 | while (len--) { | ||
| 232 | unsigned char c; | ||
| 233 | out[n] = ivec[n] ^ (c = in[n]); ivec[n] = c; | ||
| 234 | ++n; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | *num = n; | ||
| 238 | return; | ||
| 239 | } while (0); | ||
| 240 | /* the rest would be commonly eliminated by x86* compiler */ | ||
| 241 | #endif | ||
| 242 | while (l<len) { | ||
| 243 | unsigned char c; | ||
| 244 | if (n == 0) { | ||
| 245 | aesni_encrypt(ivec, ivec, key); | ||
| 246 | } | ||
| 247 | out[l] = ivec[n] ^ (c = in[l]); ivec[n] = c; | ||
| 248 | ++l; | ||
| 249 | n = (n+1) % 16; | ||
| 250 | } | ||
| 251 | *num=n; | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | /* The input and output encrypted as though 128bit ofb mode is being | ||
| 256 | * used. The extra state information to record how much of the | ||
| 257 | * 128bit block we have used is contained in *num; | ||
| 258 | */ | ||
| 259 | static void aesni_ofb128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 260 | unsigned int len, const void *key, | ||
| 261 | unsigned char ivec[16], int *num) | ||
| 262 | { | ||
| 263 | unsigned int n; | ||
| 264 | size_t l=0; | ||
| 265 | |||
| 266 | assert(in && out && key && ivec && num); | ||
| 267 | |||
| 268 | n = *num; | ||
| 269 | |||
| 270 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 271 | if (16%sizeof(size_t) == 0) do { /* always true actually */ | ||
| 272 | while (n && len) { | ||
| 273 | *(out++) = *(in++) ^ ivec[n]; | ||
| 274 | --len; | ||
| 275 | n = (n+1) % 16; | ||
| 276 | } | ||
| 277 | while (len>=16) { | ||
| 278 | aesni_encrypt(ivec, ivec, key); | ||
| 279 | for (n=0; n<16; n+=sizeof(size_t)) | ||
| 280 | *(size_t*)(out+n) = | ||
| 281 | *(size_t*)(in+n) ^ *(size_t*)(ivec+n); | ||
| 282 | len -= 16; | ||
| 283 | out += 16; | ||
| 284 | in += 16; | ||
| 285 | } | ||
| 286 | n = 0; | ||
| 287 | if (len) { | ||
| 288 | aesni_encrypt(ivec, ivec, key); | ||
| 289 | while (len--) { | ||
| 290 | out[n] = in[n] ^ ivec[n]; | ||
| 291 | ++n; | ||
| 292 | } | ||
| 293 | } | ||
| 294 | *num = n; | ||
| 295 | return; | ||
| 296 | } while(0); | ||
| 297 | /* the rest would be commonly eliminated by x86* compiler */ | ||
| 298 | #endif | ||
| 299 | while (l<len) { | ||
| 300 | if (n==0) { | ||
| 301 | aesni_encrypt(ivec, ivec, key); | ||
| 302 | } | ||
| 303 | out[l] = in[l] ^ ivec[n]; | ||
| 304 | ++l; | ||
| 305 | n = (n+1) % 16; | ||
| 306 | } | ||
| 307 | |||
| 308 | *num=n; | ||
| 309 | } | ||
| 310 | /* ===== Engine "management" functions ===== */ | ||
| 311 | |||
| 312 | #if defined(_WIN32) | ||
| 313 | typedef unsigned __int64 IA32CAP; | ||
| 314 | #else | ||
| 315 | typedef unsigned long long IA32CAP; | ||
| 316 | #endif | ||
| 317 | |||
| 318 | /* Prepare the ENGINE structure for registration */ | ||
| 319 | static int | ||
| 320 | aesni_bind_helper(ENGINE *e) | ||
| 321 | { | ||
| 322 | int engage; | ||
| 323 | if (sizeof(OPENSSL_ia32cap_P) > 4) { | ||
| 324 | engage = ((IA32CAP)OPENSSL_ia32cap_P >> 57) & 1; | ||
| 325 | } else { | ||
| 326 | IA32CAP OPENSSL_ia32_cpuid(void); | ||
| 327 | engage = (OPENSSL_ia32_cpuid() >> 57) & 1; | ||
| 328 | } | ||
| 329 | |||
| 330 | /* Register everything or return with an error */ | ||
| 331 | if (!ENGINE_set_id(e, aesni_id) || | ||
| 332 | !ENGINE_set_name(e, engage ? aesni_name : no_aesni_name) || | ||
| 333 | |||
| 334 | !ENGINE_set_init_function(e, aesni_init) || | ||
| 335 | (engage && !ENGINE_set_ciphers (e, aesni_ciphers)) | ||
| 336 | ) | ||
| 337 | return 0; | ||
| 338 | |||
| 339 | /* Everything looks good */ | ||
| 340 | return 1; | ||
| 341 | } | ||
| 342 | |||
| 343 | /* Constructor */ | ||
| 344 | static ENGINE * | ||
| 345 | ENGINE_aesni(void) | ||
| 346 | { | ||
| 347 | ENGINE *eng = ENGINE_new(); | ||
| 348 | |||
| 349 | if (!eng) { | ||
| 350 | return NULL; | ||
| 351 | } | ||
| 352 | |||
| 353 | if (!aesni_bind_helper(eng)) { | ||
| 354 | ENGINE_free(eng); | ||
| 355 | return NULL; | ||
| 356 | } | ||
| 357 | |||
| 358 | return eng; | ||
| 359 | } | ||
| 360 | |||
| 361 | /* Check availability of the engine */ | ||
| 362 | static int | ||
| 363 | aesni_init(ENGINE *e) | ||
| 364 | { | ||
| 365 | return 1; | ||
| 366 | } | ||
| 367 | |||
| 368 | #if defined(NID_aes_128_cfb128) && ! defined (NID_aes_128_cfb) | ||
| 369 | #define NID_aes_128_cfb NID_aes_128_cfb128 | ||
| 370 | #endif | ||
| 371 | |||
| 372 | #if defined(NID_aes_128_ofb128) && ! defined (NID_aes_128_ofb) | ||
| 373 | #define NID_aes_128_ofb NID_aes_128_ofb128 | ||
| 374 | #endif | ||
| 375 | |||
| 376 | #if defined(NID_aes_192_cfb128) && ! defined (NID_aes_192_cfb) | ||
| 377 | #define NID_aes_192_cfb NID_aes_192_cfb128 | ||
| 378 | #endif | ||
| 379 | |||
| 380 | #if defined(NID_aes_192_ofb128) && ! defined (NID_aes_192_ofb) | ||
| 381 | #define NID_aes_192_ofb NID_aes_192_ofb128 | ||
| 382 | #endif | ||
| 383 | |||
| 384 | #if defined(NID_aes_256_cfb128) && ! defined (NID_aes_256_cfb) | ||
| 385 | #define NID_aes_256_cfb NID_aes_256_cfb128 | ||
| 386 | #endif | ||
| 387 | |||
| 388 | #if defined(NID_aes_256_ofb128) && ! defined (NID_aes_256_ofb) | ||
| 389 | #define NID_aes_256_ofb NID_aes_256_ofb128 | ||
| 390 | #endif | ||
| 391 | |||
| 392 | /* List of supported ciphers. */ | ||
| 393 | static int aesni_cipher_nids[] = { | ||
| 394 | NID_aes_128_ecb, | ||
| 395 | NID_aes_128_cbc, | ||
| 396 | NID_aes_128_cfb, | ||
| 397 | NID_aes_128_ofb, | ||
| 398 | |||
| 399 | NID_aes_192_ecb, | ||
| 400 | NID_aes_192_cbc, | ||
| 401 | NID_aes_192_cfb, | ||
| 402 | NID_aes_192_ofb, | ||
| 403 | |||
| 404 | NID_aes_256_ecb, | ||
| 405 | NID_aes_256_cbc, | ||
| 406 | NID_aes_256_cfb, | ||
| 407 | NID_aes_256_ofb, | ||
| 408 | }; | ||
| 409 | static int aesni_cipher_nids_num = | ||
| 410 | (sizeof(aesni_cipher_nids)/sizeof(aesni_cipher_nids[0])); | ||
| 411 | |||
| 412 | typedef struct | ||
| 413 | { | ||
| 414 | AES_KEY ks; | ||
| 415 | unsigned int _pad1[3]; | ||
| 416 | } AESNI_KEY; | ||
| 417 | |||
| 418 | static int | ||
| 419 | aesni_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *user_key, | ||
| 420 | const unsigned char *iv, int enc) | ||
| 421 | { | ||
| 422 | int ret; | ||
| 423 | AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | ||
| 424 | |||
| 425 | if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE | ||
| 426 | || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE | ||
| 427 | || enc) | ||
| 428 | ret=aesni_set_encrypt_key(user_key, ctx->key_len * 8, key); | ||
| 429 | else | ||
| 430 | ret=aesni_set_decrypt_key(user_key, ctx->key_len * 8, key); | ||
| 431 | |||
| 432 | if(ret < 0) { | ||
| 433 | EVPerr(EVP_F_AESNI_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED); | ||
| 434 | return 0; | ||
| 435 | } | ||
| 436 | |||
| 437 | return 1; | ||
| 438 | } | ||
| 439 | |||
| 440 | static int aesni_cipher_ecb(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 441 | const unsigned char *in, size_t inl) | ||
| 442 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | ||
| 443 | aesni_ecb_encrypt(in, out, inl, key, ctx->encrypt); | ||
| 444 | return 1; | ||
| 445 | } | ||
| 446 | static int aesni_cipher_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 447 | const unsigned char *in, size_t inl) | ||
| 448 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | ||
| 449 | aesni_cbc_encrypt(in, out, inl, key, | ||
| 450 | ctx->iv, ctx->encrypt); | ||
| 451 | return 1; | ||
| 452 | } | ||
| 453 | static int aesni_cipher_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 454 | const unsigned char *in, size_t inl) | ||
| 455 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | ||
| 456 | |||
| 457 | aesni_cfb128_encrypt(in, out, inl, key, ctx->iv, | ||
| 458 | &ctx->num, ctx->encrypt); | ||
| 459 | return 1; | ||
| 460 | } | ||
| 461 | static int aesni_cipher_ofb(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 462 | const unsigned char *in, size_t inl) | ||
| 463 | { AES_KEY *key = AESNI_ALIGN(ctx->cipher_data); | ||
| 464 | aesni_ofb128_encrypt(in, out, inl, key, ctx->iv, &ctx->num); | ||
| 465 | return 1; | ||
| 466 | } | ||
| 467 | |||
| 468 | #define AES_BLOCK_SIZE 16 | ||
| 469 | |||
| 470 | #define EVP_CIPHER_block_size_ECB AES_BLOCK_SIZE | ||
| 471 | #define EVP_CIPHER_block_size_CBC AES_BLOCK_SIZE | ||
| 472 | #define EVP_CIPHER_block_size_OFB 1 | ||
| 473 | #define EVP_CIPHER_block_size_CFB 1 | ||
| 474 | |||
| 475 | /* Declaring so many ciphers by hand would be a pain. | ||
| 476 | Instead introduce a bit of preprocessor magic :-) */ | ||
| 477 | #define DECLARE_AES_EVP(ksize,lmode,umode) \ | ||
| 478 | static const EVP_CIPHER aesni_##ksize##_##lmode = { \ | ||
| 479 | NID_aes_##ksize##_##lmode, \ | ||
| 480 | EVP_CIPHER_block_size_##umode, \ | ||
| 481 | ksize / 8, \ | ||
| 482 | AES_BLOCK_SIZE, \ | ||
| 483 | 0 | EVP_CIPH_##umode##_MODE, \ | ||
| 484 | aesni_init_key, \ | ||
| 485 | aesni_cipher_##lmode, \ | ||
| 486 | NULL, \ | ||
| 487 | sizeof(AESNI_KEY), \ | ||
| 488 | EVP_CIPHER_set_asn1_iv, \ | ||
| 489 | EVP_CIPHER_get_asn1_iv, \ | ||
| 490 | NULL, \ | ||
| 491 | NULL \ | ||
| 492 | } | ||
| 493 | |||
| 494 | DECLARE_AES_EVP(128,ecb,ECB); | ||
| 495 | DECLARE_AES_EVP(128,cbc,CBC); | ||
| 496 | DECLARE_AES_EVP(128,cfb,CFB); | ||
| 497 | DECLARE_AES_EVP(128,ofb,OFB); | ||
| 498 | |||
| 499 | DECLARE_AES_EVP(192,ecb,ECB); | ||
| 500 | DECLARE_AES_EVP(192,cbc,CBC); | ||
| 501 | DECLARE_AES_EVP(192,cfb,CFB); | ||
| 502 | DECLARE_AES_EVP(192,ofb,OFB); | ||
| 503 | |||
| 504 | DECLARE_AES_EVP(256,ecb,ECB); | ||
| 505 | DECLARE_AES_EVP(256,cbc,CBC); | ||
| 506 | DECLARE_AES_EVP(256,cfb,CFB); | ||
| 507 | DECLARE_AES_EVP(256,ofb,OFB); | ||
| 508 | |||
| 509 | static int | ||
| 510 | aesni_ciphers (ENGINE *e, const EVP_CIPHER **cipher, | ||
| 511 | const int **nids, int nid) | ||
| 512 | { | ||
| 513 | /* No specific cipher => return a list of supported nids ... */ | ||
| 514 | if (!cipher) { | ||
| 515 | *nids = aesni_cipher_nids; | ||
| 516 | return aesni_cipher_nids_num; | ||
| 517 | } | ||
| 518 | |||
| 519 | /* ... or the requested "cipher" otherwise */ | ||
| 520 | switch (nid) { | ||
| 521 | case NID_aes_128_ecb: | ||
| 522 | *cipher = &aesni_128_ecb; | ||
| 523 | break; | ||
| 524 | case NID_aes_128_cbc: | ||
| 525 | *cipher = &aesni_128_cbc; | ||
| 526 | break; | ||
| 527 | case NID_aes_128_cfb: | ||
| 528 | *cipher = &aesni_128_cfb; | ||
| 529 | break; | ||
| 530 | case NID_aes_128_ofb: | ||
| 531 | *cipher = &aesni_128_ofb; | ||
| 532 | break; | ||
| 533 | |||
| 534 | case NID_aes_192_ecb: | ||
| 535 | *cipher = &aesni_192_ecb; | ||
| 536 | break; | ||
| 537 | case NID_aes_192_cbc: | ||
| 538 | *cipher = &aesni_192_cbc; | ||
| 539 | break; | ||
| 540 | case NID_aes_192_cfb: | ||
| 541 | *cipher = &aesni_192_cfb; | ||
| 542 | break; | ||
| 543 | case NID_aes_192_ofb: | ||
| 544 | *cipher = &aesni_192_ofb; | ||
| 545 | break; | ||
| 546 | |||
| 547 | case NID_aes_256_ecb: | ||
| 548 | *cipher = &aesni_256_ecb; | ||
| 549 | break; | ||
| 550 | case NID_aes_256_cbc: | ||
| 551 | *cipher = &aesni_256_cbc; | ||
| 552 | break; | ||
| 553 | case NID_aes_256_cfb: | ||
| 554 | *cipher = &aesni_256_cfb; | ||
| 555 | break; | ||
| 556 | case NID_aes_256_ofb: | ||
| 557 | *cipher = &aesni_256_ofb; | ||
| 558 | break; | ||
| 559 | |||
| 560 | default: | ||
| 561 | /* Sorry, we don't support this NID */ | ||
| 562 | *cipher = NULL; | ||
| 563 | return 0; | ||
| 564 | } | ||
| 565 | return 1; | ||
| 566 | } | ||
| 567 | |||
| 568 | #endif /* COMPILE_HW_AESNI */ | ||
| 569 | #endif /* !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AESNI) && !defined(OPENSSL_NO_AES) */ | ||
| 570 | |||
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c index 22c120454f..79d1f2beff 100644 --- a/src/lib/libcrypto/engine/eng_all.c +++ b/src/lib/libcrypto/engine/eng_all.c | |||
| @@ -71,6 +71,11 @@ void ENGINE_load_builtin_engines(void) | |||
| 71 | #if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) | 71 | #if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV)) |
| 72 | ENGINE_load_cryptodev(); | 72 | ENGINE_load_cryptodev(); |
| 73 | #endif | 73 | #endif |
| 74 | |||
| 75 | #if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_AESNI) | ||
| 76 | ENGINE_load_aesni(); | ||
| 77 | #endif | ||
| 78 | |||
| 74 | ENGINE_load_dynamic(); | 79 | ENGINE_load_dynamic(); |
| 75 | #ifndef OPENSSL_NO_STATIC_ENGINE | 80 | #ifndef OPENSSL_NO_STATIC_ENGINE |
| 76 | #ifndef OPENSSL_NO_HW | 81 | #ifndef OPENSSL_NO_HW |
diff --git a/src/lib/libcrypto/engine/eng_cryptodev.c b/src/lib/libcrypto/engine/eng_cryptodev.c new file mode 100644 index 0000000000..10b3856b4e --- /dev/null +++ b/src/lib/libcrypto/engine/eng_cryptodev.c | |||
| @@ -0,0 +1,1418 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2002 Bob Beck <beck@openbsd.org> | ||
| 3 | * Copyright (c) 2002 Theo de Raadt | ||
| 4 | * Copyright (c) 2002 Markus Friedl | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * Redistribution and use in source and binary forms, with or without | ||
| 8 | * modification, are permitted provided that the following conditions | ||
| 9 | * are met: | ||
| 10 | * 1. Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * | ||
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY | ||
| 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY | ||
| 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | * | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <openssl/objects.h> | ||
| 30 | #include <openssl/engine.h> | ||
| 31 | #include <openssl/evp.h> | ||
| 32 | #include <openssl/bn.h> | ||
| 33 | |||
| 34 | #if (defined(__unix__) || defined(unix)) && !defined(USG) && \ | ||
| 35 | (defined(__OpenBSD__) || defined(__FreeBSD__)) | ||
| 36 | #include <sys/param.h> | ||
| 37 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | ||
| 38 | # define HAVE_CRYPTODEV | ||
| 39 | # endif | ||
| 40 | # if (OpenBSD >= 200110) | ||
| 41 | # define HAVE_SYSLOG_R | ||
| 42 | # endif | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #ifndef HAVE_CRYPTODEV | ||
| 46 | |||
| 47 | void | ||
| 48 | ENGINE_load_cryptodev(void) | ||
| 49 | { | ||
| 50 | /* This is a NOP on platforms without /dev/crypto */ | ||
| 51 | return; | ||
| 52 | } | ||
| 53 | |||
| 54 | #else | ||
| 55 | |||
| 56 | #include <sys/types.h> | ||
| 57 | #include <crypto/cryptodev.h> | ||
| 58 | #include <crypto/dh/dh.h> | ||
| 59 | #include <crypto/dsa/dsa.h> | ||
| 60 | #include <crypto/err/err.h> | ||
| 61 | #include <crypto/rsa/rsa.h> | ||
| 62 | #include <sys/ioctl.h> | ||
| 63 | #include <errno.h> | ||
| 64 | #include <stdio.h> | ||
| 65 | #include <unistd.h> | ||
| 66 | #include <fcntl.h> | ||
| 67 | #include <stdarg.h> | ||
| 68 | #include <syslog.h> | ||
| 69 | #include <errno.h> | ||
| 70 | #include <string.h> | ||
| 71 | |||
| 72 | struct dev_crypto_state { | ||
| 73 | struct session_op d_sess; | ||
| 74 | int d_fd; | ||
| 75 | |||
| 76 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 77 | char dummy_mac_key[HASH_MAX_LEN]; | ||
| 78 | |||
| 79 | unsigned char digest_res[HASH_MAX_LEN]; | ||
| 80 | char *mac_data; | ||
| 81 | int mac_len; | ||
| 82 | |||
| 83 | int copy; | ||
| 84 | #endif | ||
| 85 | }; | ||
| 86 | |||
| 87 | static u_int32_t cryptodev_asymfeat = 0; | ||
| 88 | |||
| 89 | static int get_asym_dev_crypto(void); | ||
| 90 | static int open_dev_crypto(void); | ||
| 91 | static int get_dev_crypto(void); | ||
| 92 | static int get_cryptodev_ciphers(const int **cnids); | ||
| 93 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 94 | static int get_cryptodev_digests(const int **cnids); | ||
| 95 | #endif | ||
| 96 | static int cryptodev_usable_ciphers(const int **nids); | ||
| 97 | static int cryptodev_usable_digests(const int **nids); | ||
| 98 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 99 | const unsigned char *in, size_t inl); | ||
| 100 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 101 | const unsigned char *iv, int enc); | ||
| 102 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | ||
| 103 | static int cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
| 104 | const int **nids, int nid); | ||
| 105 | static int cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | ||
| 106 | const int **nids, int nid); | ||
| 107 | static int bn2crparam(const BIGNUM *a, struct crparam *crp); | ||
| 108 | static int crparam2bn(struct crparam *crp, BIGNUM *a); | ||
| 109 | static void zapparams(struct crypt_kop *kop); | ||
| 110 | static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, | ||
| 111 | int slen, BIGNUM *s); | ||
| 112 | |||
| 113 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, | ||
| 114 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 115 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, | ||
| 116 | RSA *rsa, BN_CTX *ctx); | ||
| 117 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx); | ||
| 118 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 119 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 120 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | ||
| 121 | BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p, | ||
| 122 | BN_CTX *ctx, BN_MONT_CTX *mont); | ||
| 123 | static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, | ||
| 124 | int dlen, DSA *dsa); | ||
| 125 | static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len, | ||
| 126 | DSA_SIG *sig, DSA *dsa); | ||
| 127 | static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 128 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 129 | BN_MONT_CTX *m_ctx); | ||
| 130 | static int cryptodev_dh_compute_key(unsigned char *key, | ||
| 131 | const BIGNUM *pub_key, DH *dh); | ||
| 132 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | ||
| 133 | void (*f)(void)); | ||
| 134 | void ENGINE_load_cryptodev(void); | ||
| 135 | |||
| 136 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | ||
| 137 | { 0, NULL, NULL, 0 } | ||
| 138 | }; | ||
| 139 | |||
| 140 | static struct { | ||
| 141 | int id; | ||
| 142 | int nid; | ||
| 143 | int ivmax; | ||
| 144 | int keylen; | ||
| 145 | } ciphers[] = { | ||
| 146 | { CRYPTO_ARC4, NID_rc4, 0, 16, }, | ||
| 147 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, | ||
| 148 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | ||
| 149 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, | ||
| 150 | { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, }, | ||
| 151 | { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, }, | ||
| 152 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | ||
| 153 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, | ||
| 154 | { 0, NID_undef, 0, 0, }, | ||
| 155 | }; | ||
| 156 | |||
| 157 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 158 | static struct { | ||
| 159 | int id; | ||
| 160 | int nid; | ||
| 161 | int keylen; | ||
| 162 | } digests[] = { | ||
| 163 | { CRYPTO_MD5_HMAC, NID_hmacWithMD5, 16}, | ||
| 164 | { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, 20}, | ||
| 165 | { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, 16/*?*/}, | ||
| 166 | { CRYPTO_MD5_KPDK, NID_undef, 0}, | ||
| 167 | { CRYPTO_SHA1_KPDK, NID_undef, 0}, | ||
| 168 | { CRYPTO_MD5, NID_md5, 16}, | ||
| 169 | { CRYPTO_SHA1, NID_sha1, 20}, | ||
| 170 | { 0, NID_undef, 0}, | ||
| 171 | }; | ||
| 172 | #endif | ||
| 173 | |||
| 174 | /* | ||
| 175 | * Return a fd if /dev/crypto seems usable, 0 otherwise. | ||
| 176 | */ | ||
| 177 | static int | ||
| 178 | open_dev_crypto(void) | ||
| 179 | { | ||
| 180 | static int fd = -1; | ||
| 181 | |||
| 182 | if (fd == -1) { | ||
| 183 | if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1) | ||
| 184 | return (-1); | ||
| 185 | /* close on exec */ | ||
| 186 | if (fcntl(fd, F_SETFD, 1) == -1) { | ||
| 187 | close(fd); | ||
| 188 | fd = -1; | ||
| 189 | return (-1); | ||
| 190 | } | ||
| 191 | } | ||
| 192 | return (fd); | ||
| 193 | } | ||
| 194 | |||
| 195 | static int | ||
| 196 | get_dev_crypto(void) | ||
| 197 | { | ||
| 198 | int fd, retfd; | ||
| 199 | |||
| 200 | if ((fd = open_dev_crypto()) == -1) | ||
| 201 | return (-1); | ||
| 202 | if (ioctl(fd, CRIOGET, &retfd) == -1) | ||
| 203 | return (-1); | ||
| 204 | |||
| 205 | /* close on exec */ | ||
| 206 | if (fcntl(retfd, F_SETFD, 1) == -1) { | ||
| 207 | close(retfd); | ||
| 208 | return (-1); | ||
| 209 | } | ||
| 210 | return (retfd); | ||
| 211 | } | ||
| 212 | |||
| 213 | /* Caching version for asym operations */ | ||
| 214 | static int | ||
| 215 | get_asym_dev_crypto(void) | ||
| 216 | { | ||
| 217 | static int fd = -1; | ||
| 218 | |||
| 219 | if (fd == -1) | ||
| 220 | fd = get_dev_crypto(); | ||
| 221 | return fd; | ||
| 222 | } | ||
| 223 | |||
| 224 | /* | ||
| 225 | * Find out what ciphers /dev/crypto will let us have a session for. | ||
| 226 | * XXX note, that some of these openssl doesn't deal with yet! | ||
| 227 | * returning them here is harmless, as long as we return NULL | ||
| 228 | * when asked for a handler in the cryptodev_engine_ciphers routine | ||
| 229 | */ | ||
| 230 | static int | ||
| 231 | get_cryptodev_ciphers(const int **cnids) | ||
| 232 | { | ||
| 233 | static int nids[CRYPTO_ALGORITHM_MAX]; | ||
| 234 | struct session_op sess; | ||
| 235 | int fd, i, count = 0; | ||
| 236 | |||
| 237 | if ((fd = get_dev_crypto()) < 0) { | ||
| 238 | *cnids = NULL; | ||
| 239 | return (0); | ||
| 240 | } | ||
| 241 | memset(&sess, 0, sizeof(sess)); | ||
| 242 | sess.key = (caddr_t)"123456789abcdefghijklmno"; | ||
| 243 | |||
| 244 | for (i = 0; ciphers[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | ||
| 245 | if (ciphers[i].nid == NID_undef) | ||
| 246 | continue; | ||
| 247 | sess.cipher = ciphers[i].id; | ||
| 248 | sess.keylen = ciphers[i].keylen; | ||
| 249 | sess.mac = 0; | ||
| 250 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && | ||
| 251 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | ||
| 252 | nids[count++] = ciphers[i].nid; | ||
| 253 | } | ||
| 254 | close(fd); | ||
| 255 | |||
| 256 | if (count > 0) | ||
| 257 | *cnids = nids; | ||
| 258 | else | ||
| 259 | *cnids = NULL; | ||
| 260 | return (count); | ||
| 261 | } | ||
| 262 | |||
| 263 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 264 | /* | ||
| 265 | * Find out what digests /dev/crypto will let us have a session for. | ||
| 266 | * XXX note, that some of these openssl doesn't deal with yet! | ||
| 267 | * returning them here is harmless, as long as we return NULL | ||
| 268 | * when asked for a handler in the cryptodev_engine_digests routine | ||
| 269 | */ | ||
| 270 | static int | ||
| 271 | get_cryptodev_digests(const int **cnids) | ||
| 272 | { | ||
| 273 | static int nids[CRYPTO_ALGORITHM_MAX]; | ||
| 274 | struct session_op sess; | ||
| 275 | int fd, i, count = 0; | ||
| 276 | |||
| 277 | if ((fd = get_dev_crypto()) < 0) { | ||
| 278 | *cnids = NULL; | ||
| 279 | return (0); | ||
| 280 | } | ||
| 281 | memset(&sess, 0, sizeof(sess)); | ||
| 282 | sess.mackey = (caddr_t)"123456789abcdefghijklmno"; | ||
| 283 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | ||
| 284 | if (digests[i].nid == NID_undef) | ||
| 285 | continue; | ||
| 286 | sess.mac = digests[i].id; | ||
| 287 | sess.mackeylen = digests[i].keylen; | ||
| 288 | sess.cipher = 0; | ||
| 289 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && | ||
| 290 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | ||
| 291 | nids[count++] = digests[i].nid; | ||
| 292 | } | ||
| 293 | close(fd); | ||
| 294 | |||
| 295 | if (count > 0) | ||
| 296 | *cnids = nids; | ||
| 297 | else | ||
| 298 | *cnids = NULL; | ||
| 299 | return (count); | ||
| 300 | } | ||
| 301 | #endif /* 0 */ | ||
| 302 | |||
| 303 | /* | ||
| 304 | * Find the useable ciphers|digests from dev/crypto - this is the first | ||
| 305 | * thing called by the engine init crud which determines what it | ||
| 306 | * can use for ciphers from this engine. We want to return | ||
| 307 | * only what we can do, anythine else is handled by software. | ||
| 308 | * | ||
| 309 | * If we can't initialize the device to do anything useful for | ||
| 310 | * any reason, we want to return a NULL array, and 0 length, | ||
| 311 | * which forces everything to be done is software. By putting | ||
| 312 | * the initalization of the device in here, we ensure we can | ||
| 313 | * use this engine as the default, and if for whatever reason | ||
| 314 | * /dev/crypto won't do what we want it will just be done in | ||
| 315 | * software | ||
| 316 | * | ||
| 317 | * This can (should) be greatly expanded to perhaps take into | ||
| 318 | * account speed of the device, and what we want to do. | ||
| 319 | * (although the disabling of particular alg's could be controlled | ||
| 320 | * by the device driver with sysctl's.) - this is where we | ||
| 321 | * want most of the decisions made about what we actually want | ||
| 322 | * to use from /dev/crypto. | ||
| 323 | */ | ||
| 324 | static int | ||
| 325 | cryptodev_usable_ciphers(const int **nids) | ||
| 326 | { | ||
| 327 | return (get_cryptodev_ciphers(nids)); | ||
| 328 | } | ||
| 329 | |||
| 330 | static int | ||
| 331 | cryptodev_usable_digests(const int **nids) | ||
| 332 | { | ||
| 333 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 334 | return (get_cryptodev_digests(nids)); | ||
| 335 | #else | ||
| 336 | /* | ||
| 337 | * XXXX just disable all digests for now, because it sucks. | ||
| 338 | * we need a better way to decide this - i.e. I may not | ||
| 339 | * want digests on slow cards like hifn on fast machines, | ||
| 340 | * but might want them on slow or loaded machines, etc. | ||
| 341 | * will also want them when using crypto cards that don't | ||
| 342 | * suck moose gonads - would be nice to be able to decide something | ||
| 343 | * as reasonable default without having hackery that's card dependent. | ||
| 344 | * of course, the default should probably be just do everything, | ||
| 345 | * with perhaps a sysctl to turn algoritms off (or have them off | ||
| 346 | * by default) on cards that generally suck like the hifn. | ||
| 347 | */ | ||
| 348 | *nids = NULL; | ||
| 349 | return (0); | ||
| 350 | #endif | ||
| 351 | } | ||
| 352 | |||
| 353 | static int | ||
| 354 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 355 | const unsigned char *in, size_t inl) | ||
| 356 | { | ||
| 357 | struct crypt_op cryp; | ||
| 358 | struct dev_crypto_state *state = ctx->cipher_data; | ||
| 359 | struct session_op *sess = &state->d_sess; | ||
| 360 | const void *iiv; | ||
| 361 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; | ||
| 362 | |||
| 363 | if (state->d_fd < 0) | ||
| 364 | return (0); | ||
| 365 | if (!inl) | ||
| 366 | return (1); | ||
| 367 | if ((inl % ctx->cipher->block_size) != 0) | ||
| 368 | return (0); | ||
| 369 | |||
| 370 | memset(&cryp, 0, sizeof(cryp)); | ||
| 371 | |||
| 372 | cryp.ses = sess->ses; | ||
| 373 | cryp.flags = 0; | ||
| 374 | cryp.len = inl; | ||
| 375 | cryp.src = (caddr_t) in; | ||
| 376 | cryp.dst = (caddr_t) out; | ||
| 377 | cryp.mac = 0; | ||
| 378 | |||
| 379 | cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT; | ||
| 380 | |||
| 381 | if (ctx->cipher->iv_len) { | ||
| 382 | cryp.iv = (caddr_t) ctx->iv; | ||
| 383 | if (!ctx->encrypt) { | ||
| 384 | iiv = in + inl - ctx->cipher->iv_len; | ||
| 385 | memcpy(save_iv, iiv, ctx->cipher->iv_len); | ||
| 386 | } | ||
| 387 | } else | ||
| 388 | cryp.iv = NULL; | ||
| 389 | |||
| 390 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) == -1) { | ||
| 391 | /* XXX need better errror handling | ||
| 392 | * this can fail for a number of different reasons. | ||
| 393 | */ | ||
| 394 | return (0); | ||
| 395 | } | ||
| 396 | |||
| 397 | if (ctx->cipher->iv_len) { | ||
| 398 | if (ctx->encrypt) | ||
| 399 | iiv = out + inl - ctx->cipher->iv_len; | ||
| 400 | else | ||
| 401 | iiv = save_iv; | ||
| 402 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); | ||
| 403 | } | ||
| 404 | return (1); | ||
| 405 | } | ||
| 406 | |||
| 407 | static int | ||
| 408 | cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 409 | const unsigned char *iv, int enc) | ||
| 410 | { | ||
| 411 | struct dev_crypto_state *state = ctx->cipher_data; | ||
| 412 | struct session_op *sess = &state->d_sess; | ||
| 413 | int cipher = -1, i; | ||
| 414 | |||
| 415 | for (i = 0; ciphers[i].id; i++) | ||
| 416 | if (ctx->cipher->nid == ciphers[i].nid && | ||
| 417 | ctx->cipher->iv_len <= ciphers[i].ivmax && | ||
| 418 | ctx->key_len == ciphers[i].keylen) { | ||
| 419 | cipher = ciphers[i].id; | ||
| 420 | break; | ||
| 421 | } | ||
| 422 | |||
| 423 | if (!ciphers[i].id) { | ||
| 424 | state->d_fd = -1; | ||
| 425 | return (0); | ||
| 426 | } | ||
| 427 | |||
| 428 | memset(sess, 0, sizeof(struct session_op)); | ||
| 429 | |||
| 430 | if ((state->d_fd = get_dev_crypto()) < 0) | ||
| 431 | return (0); | ||
| 432 | |||
| 433 | sess->key = (caddr_t)key; | ||
| 434 | sess->keylen = ctx->key_len; | ||
| 435 | sess->cipher = cipher; | ||
| 436 | |||
| 437 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { | ||
| 438 | close(state->d_fd); | ||
| 439 | state->d_fd = -1; | ||
| 440 | return (0); | ||
| 441 | } | ||
| 442 | return (1); | ||
| 443 | } | ||
| 444 | |||
| 445 | /* | ||
| 446 | * free anything we allocated earlier when initting a | ||
| 447 | * session, and close the session. | ||
| 448 | */ | ||
| 449 | static int | ||
| 450 | cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | ||
| 451 | { | ||
| 452 | int ret = 0; | ||
| 453 | struct dev_crypto_state *state = ctx->cipher_data; | ||
| 454 | struct session_op *sess = &state->d_sess; | ||
| 455 | |||
| 456 | if (state->d_fd < 0) | ||
| 457 | return (0); | ||
| 458 | |||
| 459 | /* XXX if this ioctl fails, someting's wrong. the invoker | ||
| 460 | * may have called us with a bogus ctx, or we could | ||
| 461 | * have a device that for whatever reason just doesn't | ||
| 462 | * want to play ball - it's not clear what's right | ||
| 463 | * here - should this be an error? should it just | ||
| 464 | * increase a counter, hmm. For right now, we return | ||
| 465 | * 0 - I don't believe that to be "right". we could | ||
| 466 | * call the gorpy openssl lib error handlers that | ||
| 467 | * print messages to users of the library. hmm.. | ||
| 468 | */ | ||
| 469 | |||
| 470 | if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) == -1) { | ||
| 471 | ret = 0; | ||
| 472 | } else { | ||
| 473 | ret = 1; | ||
| 474 | } | ||
| 475 | close(state->d_fd); | ||
| 476 | state->d_fd = -1; | ||
| 477 | |||
| 478 | return (ret); | ||
| 479 | } | ||
| 480 | |||
| 481 | /* | ||
| 482 | * libcrypto EVP stuff - this is how we get wired to EVP so the engine | ||
| 483 | * gets called when libcrypto requests a cipher NID. | ||
| 484 | */ | ||
| 485 | |||
| 486 | /* RC4 */ | ||
| 487 | const EVP_CIPHER cryptodev_rc4 = { | ||
| 488 | NID_rc4, | ||
| 489 | 1, 16, 0, | ||
| 490 | EVP_CIPH_VARIABLE_LENGTH, | ||
| 491 | cryptodev_init_key, | ||
| 492 | cryptodev_cipher, | ||
| 493 | cryptodev_cleanup, | ||
| 494 | sizeof(struct dev_crypto_state), | ||
| 495 | NULL, | ||
| 496 | NULL, | ||
| 497 | NULL | ||
| 498 | }; | ||
| 499 | |||
| 500 | /* DES CBC EVP */ | ||
| 501 | const EVP_CIPHER cryptodev_des_cbc = { | ||
| 502 | NID_des_cbc, | ||
| 503 | 8, 8, 8, | ||
| 504 | EVP_CIPH_CBC_MODE, | ||
| 505 | cryptodev_init_key, | ||
| 506 | cryptodev_cipher, | ||
| 507 | cryptodev_cleanup, | ||
| 508 | sizeof(struct dev_crypto_state), | ||
| 509 | EVP_CIPHER_set_asn1_iv, | ||
| 510 | EVP_CIPHER_get_asn1_iv, | ||
| 511 | NULL | ||
| 512 | }; | ||
| 513 | |||
| 514 | /* 3DES CBC EVP */ | ||
| 515 | const EVP_CIPHER cryptodev_3des_cbc = { | ||
| 516 | NID_des_ede3_cbc, | ||
| 517 | 8, 24, 8, | ||
| 518 | EVP_CIPH_CBC_MODE, | ||
| 519 | cryptodev_init_key, | ||
| 520 | cryptodev_cipher, | ||
| 521 | cryptodev_cleanup, | ||
| 522 | sizeof(struct dev_crypto_state), | ||
| 523 | EVP_CIPHER_set_asn1_iv, | ||
| 524 | EVP_CIPHER_get_asn1_iv, | ||
| 525 | NULL | ||
| 526 | }; | ||
| 527 | |||
| 528 | const EVP_CIPHER cryptodev_bf_cbc = { | ||
| 529 | NID_bf_cbc, | ||
| 530 | 8, 16, 8, | ||
| 531 | EVP_CIPH_CBC_MODE, | ||
| 532 | cryptodev_init_key, | ||
| 533 | cryptodev_cipher, | ||
| 534 | cryptodev_cleanup, | ||
| 535 | sizeof(struct dev_crypto_state), | ||
| 536 | EVP_CIPHER_set_asn1_iv, | ||
| 537 | EVP_CIPHER_get_asn1_iv, | ||
| 538 | NULL | ||
| 539 | }; | ||
| 540 | |||
| 541 | const EVP_CIPHER cryptodev_cast_cbc = { | ||
| 542 | NID_cast5_cbc, | ||
| 543 | 8, 16, 8, | ||
| 544 | EVP_CIPH_CBC_MODE, | ||
| 545 | cryptodev_init_key, | ||
| 546 | cryptodev_cipher, | ||
| 547 | cryptodev_cleanup, | ||
| 548 | sizeof(struct dev_crypto_state), | ||
| 549 | EVP_CIPHER_set_asn1_iv, | ||
| 550 | EVP_CIPHER_get_asn1_iv, | ||
| 551 | NULL | ||
| 552 | }; | ||
| 553 | |||
| 554 | const EVP_CIPHER cryptodev_aes_cbc = { | ||
| 555 | NID_aes_128_cbc, | ||
| 556 | 16, 16, 16, | ||
| 557 | EVP_CIPH_CBC_MODE, | ||
| 558 | cryptodev_init_key, | ||
| 559 | cryptodev_cipher, | ||
| 560 | cryptodev_cleanup, | ||
| 561 | sizeof(struct dev_crypto_state), | ||
| 562 | EVP_CIPHER_set_asn1_iv, | ||
| 563 | EVP_CIPHER_get_asn1_iv, | ||
| 564 | NULL | ||
| 565 | }; | ||
| 566 | |||
| 567 | const EVP_CIPHER cryptodev_aes_192_cbc = { | ||
| 568 | NID_aes_192_cbc, | ||
| 569 | 16, 24, 16, | ||
| 570 | EVP_CIPH_CBC_MODE, | ||
| 571 | cryptodev_init_key, | ||
| 572 | cryptodev_cipher, | ||
| 573 | cryptodev_cleanup, | ||
| 574 | sizeof(struct dev_crypto_state), | ||
| 575 | EVP_CIPHER_set_asn1_iv, | ||
| 576 | EVP_CIPHER_get_asn1_iv, | ||
| 577 | NULL | ||
| 578 | }; | ||
| 579 | |||
| 580 | const EVP_CIPHER cryptodev_aes_256_cbc = { | ||
| 581 | NID_aes_256_cbc, | ||
| 582 | 16, 32, 16, | ||
| 583 | EVP_CIPH_CBC_MODE, | ||
| 584 | cryptodev_init_key, | ||
| 585 | cryptodev_cipher, | ||
| 586 | cryptodev_cleanup, | ||
| 587 | sizeof(struct dev_crypto_state), | ||
| 588 | EVP_CIPHER_set_asn1_iv, | ||
| 589 | EVP_CIPHER_get_asn1_iv, | ||
| 590 | NULL | ||
| 591 | }; | ||
| 592 | |||
| 593 | /* | ||
| 594 | * Registered by the ENGINE when used to find out how to deal with | ||
| 595 | * a particular NID in the ENGINE. this says what we'll do at the | ||
| 596 | * top level - note, that list is restricted by what we answer with | ||
| 597 | */ | ||
| 598 | static int | ||
| 599 | cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
| 600 | const int **nids, int nid) | ||
| 601 | { | ||
| 602 | if (!cipher) | ||
| 603 | return (cryptodev_usable_ciphers(nids)); | ||
| 604 | |||
| 605 | switch (nid) { | ||
| 606 | case NID_rc4: | ||
| 607 | *cipher = &cryptodev_rc4; | ||
| 608 | break; | ||
| 609 | case NID_des_ede3_cbc: | ||
| 610 | *cipher = &cryptodev_3des_cbc; | ||
| 611 | break; | ||
| 612 | case NID_des_cbc: | ||
| 613 | *cipher = &cryptodev_des_cbc; | ||
| 614 | break; | ||
| 615 | case NID_bf_cbc: | ||
| 616 | *cipher = &cryptodev_bf_cbc; | ||
| 617 | break; | ||
| 618 | case NID_cast5_cbc: | ||
| 619 | *cipher = &cryptodev_cast_cbc; | ||
| 620 | break; | ||
| 621 | case NID_aes_128_cbc: | ||
| 622 | *cipher = &cryptodev_aes_cbc; | ||
| 623 | break; | ||
| 624 | case NID_aes_192_cbc: | ||
| 625 | *cipher = &cryptodev_aes_192_cbc; | ||
| 626 | break; | ||
| 627 | case NID_aes_256_cbc: | ||
| 628 | *cipher = &cryptodev_aes_256_cbc; | ||
| 629 | break; | ||
| 630 | default: | ||
| 631 | *cipher = NULL; | ||
| 632 | break; | ||
| 633 | } | ||
| 634 | return (*cipher != NULL); | ||
| 635 | } | ||
| 636 | |||
| 637 | |||
| 638 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 639 | |||
| 640 | /* convert digest type to cryptodev */ | ||
| 641 | static int | ||
| 642 | digest_nid_to_cryptodev(int nid) | ||
| 643 | { | ||
| 644 | int i; | ||
| 645 | |||
| 646 | for (i = 0; digests[i].id; i++) | ||
| 647 | if (digests[i].nid == nid) | ||
| 648 | return (digests[i].id); | ||
| 649 | return (0); | ||
| 650 | } | ||
| 651 | |||
| 652 | |||
| 653 | static int | ||
| 654 | digest_key_length(int nid) | ||
| 655 | { | ||
| 656 | int i; | ||
| 657 | |||
| 658 | for (i = 0; digests[i].id; i++) | ||
| 659 | if (digests[i].nid == nid) | ||
| 660 | return digests[i].keylen; | ||
| 661 | return (0); | ||
| 662 | } | ||
| 663 | |||
| 664 | |||
| 665 | static int cryptodev_digest_init(EVP_MD_CTX *ctx) | ||
| 666 | { | ||
| 667 | struct dev_crypto_state *state = ctx->md_data; | ||
| 668 | struct session_op *sess = &state->d_sess; | ||
| 669 | int digest; | ||
| 670 | |||
| 671 | if ((digest = digest_nid_to_cryptodev(ctx->digest->type)) == NID_undef){ | ||
| 672 | printf("cryptodev_digest_init: Can't get digest \n"); | ||
| 673 | return (0); | ||
| 674 | } | ||
| 675 | |||
| 676 | memset(state, 0, sizeof(struct dev_crypto_state)); | ||
| 677 | |||
| 678 | if ((state->d_fd = get_dev_crypto()) < 0) { | ||
| 679 | printf("cryptodev_digest_init: Can't get Dev \n"); | ||
| 680 | return (0); | ||
| 681 | } | ||
| 682 | |||
| 683 | sess->mackey = state->dummy_mac_key; | ||
| 684 | sess->mackeylen = digest_key_length(ctx->digest->type); | ||
| 685 | sess->mac = digest; | ||
| 686 | |||
| 687 | if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) { | ||
| 688 | close(state->d_fd); | ||
| 689 | state->d_fd = -1; | ||
| 690 | printf("cryptodev_digest_init: Open session failed\n"); | ||
| 691 | return (0); | ||
| 692 | } | ||
| 693 | |||
| 694 | return (1); | ||
| 695 | } | ||
| 696 | |||
| 697 | static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, | ||
| 698 | size_t count) | ||
| 699 | { | ||
| 700 | struct crypt_op cryp; | ||
| 701 | struct dev_crypto_state *state = ctx->md_data; | ||
| 702 | struct session_op *sess = &state->d_sess; | ||
| 703 | |||
| 704 | if (!data || state->d_fd < 0) { | ||
| 705 | printf("cryptodev_digest_update: illegal inputs \n"); | ||
| 706 | return (0); | ||
| 707 | } | ||
| 708 | |||
| 709 | if (!count) { | ||
| 710 | return (0); | ||
| 711 | } | ||
| 712 | |||
| 713 | if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) { | ||
| 714 | /* if application doesn't support one buffer */ | ||
| 715 | state->mac_data = OPENSSL_realloc(state->mac_data, state->mac_len + count); | ||
| 716 | |||
| 717 | if (!state->mac_data) { | ||
| 718 | printf("cryptodev_digest_update: realloc failed\n"); | ||
| 719 | return (0); | ||
| 720 | } | ||
| 721 | |||
| 722 | memcpy(state->mac_data + state->mac_len, data, count); | ||
| 723 | state->mac_len += count; | ||
| 724 | |||
| 725 | return (1); | ||
| 726 | } | ||
| 727 | |||
| 728 | memset(&cryp, 0, sizeof(cryp)); | ||
| 729 | |||
| 730 | cryp.ses = sess->ses; | ||
| 731 | cryp.flags = 0; | ||
| 732 | cryp.len = count; | ||
| 733 | cryp.src = (caddr_t) data; | ||
| 734 | cryp.dst = NULL; | ||
| 735 | cryp.mac = (caddr_t) state->digest_res; | ||
| 736 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { | ||
| 737 | printf("cryptodev_digest_update: digest failed\n"); | ||
| 738 | return (0); | ||
| 739 | } | ||
| 740 | return (1); | ||
| 741 | } | ||
| 742 | |||
| 743 | |||
| 744 | static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
| 745 | { | ||
| 746 | struct crypt_op cryp; | ||
| 747 | struct dev_crypto_state *state = ctx->md_data; | ||
| 748 | struct session_op *sess = &state->d_sess; | ||
| 749 | |||
| 750 | int ret = 1; | ||
| 751 | |||
| 752 | if (!md || state->d_fd < 0) { | ||
| 753 | printf("cryptodev_digest_final: illegal input\n"); | ||
| 754 | return(0); | ||
| 755 | } | ||
| 756 | |||
| 757 | if (! (ctx->flags & EVP_MD_CTX_FLAG_ONESHOT) ) { | ||
| 758 | /* if application doesn't support one buffer */ | ||
| 759 | memset(&cryp, 0, sizeof(cryp)); | ||
| 760 | |||
| 761 | cryp.ses = sess->ses; | ||
| 762 | cryp.flags = 0; | ||
| 763 | cryp.len = state->mac_len; | ||
| 764 | cryp.src = state->mac_data; | ||
| 765 | cryp.dst = NULL; | ||
| 766 | cryp.mac = (caddr_t)md; | ||
| 767 | |||
| 768 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { | ||
| 769 | printf("cryptodev_digest_final: digest failed\n"); | ||
| 770 | return (0); | ||
| 771 | } | ||
| 772 | |||
| 773 | return 1; | ||
| 774 | } | ||
| 775 | |||
| 776 | memcpy(md, state->digest_res, ctx->digest->md_size); | ||
| 777 | |||
| 778 | return (ret); | ||
| 779 | } | ||
| 780 | |||
| 781 | |||
| 782 | static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx) | ||
| 783 | { | ||
| 784 | int ret = 1; | ||
| 785 | struct dev_crypto_state *state = ctx->md_data; | ||
| 786 | struct session_op *sess = &state->d_sess; | ||
| 787 | |||
| 788 | if (state->d_fd < 0) { | ||
| 789 | printf("cryptodev_digest_cleanup: illegal input\n"); | ||
| 790 | return (0); | ||
| 791 | } | ||
| 792 | |||
| 793 | if (state->mac_data) { | ||
| 794 | OPENSSL_free(state->mac_data); | ||
| 795 | state->mac_data = NULL; | ||
| 796 | state->mac_len = 0; | ||
| 797 | } | ||
| 798 | |||
| 799 | if (state->copy) | ||
| 800 | return 1; | ||
| 801 | |||
| 802 | if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) { | ||
| 803 | printf("cryptodev_digest_cleanup: failed to close session\n"); | ||
| 804 | ret = 0; | ||
| 805 | } else { | ||
| 806 | ret = 1; | ||
| 807 | } | ||
| 808 | close(state->d_fd); | ||
| 809 | state->d_fd = -1; | ||
| 810 | |||
| 811 | return (ret); | ||
| 812 | } | ||
| 813 | |||
| 814 | static int cryptodev_digest_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from) | ||
| 815 | { | ||
| 816 | struct dev_crypto_state *fstate = from->md_data; | ||
| 817 | struct dev_crypto_state *dstate = to->md_data; | ||
| 818 | |||
| 819 | memcpy(dstate, fstate, sizeof(struct dev_crypto_state)); | ||
| 820 | |||
| 821 | if (fstate->mac_len != 0) { | ||
| 822 | dstate->mac_data = OPENSSL_malloc(fstate->mac_len); | ||
| 823 | memcpy(dstate->mac_data, fstate->mac_data, fstate->mac_len); | ||
| 824 | } | ||
| 825 | |||
| 826 | dstate->copy = 1; | ||
| 827 | |||
| 828 | return 1; | ||
| 829 | } | ||
| 830 | |||
| 831 | |||
| 832 | const EVP_MD cryptodev_sha1 = { | ||
| 833 | NID_sha1, | ||
| 834 | NID_undef, | ||
| 835 | SHA_DIGEST_LENGTH, | ||
| 836 | EVP_MD_FLAG_ONESHOT, | ||
| 837 | cryptodev_digest_init, | ||
| 838 | cryptodev_digest_update, | ||
| 839 | cryptodev_digest_final, | ||
| 840 | cryptodev_digest_copy, | ||
| 841 | cryptodev_digest_cleanup, | ||
| 842 | EVP_PKEY_NULL_method, | ||
| 843 | SHA_CBLOCK, | ||
| 844 | sizeof(struct dev_crypto_state), | ||
| 845 | }; | ||
| 846 | |||
| 847 | const EVP_MD cryptodev_md5 = { | ||
| 848 | NID_md5, | ||
| 849 | NID_undef, | ||
| 850 | 16 /* MD5_DIGEST_LENGTH */, | ||
| 851 | EVP_MD_FLAG_ONESHOT, | ||
| 852 | cryptodev_digest_init, | ||
| 853 | cryptodev_digest_update, | ||
| 854 | cryptodev_digest_final, | ||
| 855 | cryptodev_digest_copy, | ||
| 856 | cryptodev_digest_cleanup, | ||
| 857 | EVP_PKEY_NULL_method, | ||
| 858 | 64 /* MD5_CBLOCK */, | ||
| 859 | sizeof(struct dev_crypto_state), | ||
| 860 | }; | ||
| 861 | |||
| 862 | #endif /* USE_CRYPTODEV_DIGESTS */ | ||
| 863 | |||
| 864 | |||
| 865 | static int | ||
| 866 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | ||
| 867 | const int **nids, int nid) | ||
| 868 | { | ||
| 869 | if (!digest) | ||
| 870 | return (cryptodev_usable_digests(nids)); | ||
| 871 | |||
| 872 | switch (nid) { | ||
| 873 | #ifdef USE_CRYPTODEV_DIGESTS | ||
| 874 | case NID_md5: | ||
| 875 | *digest = &cryptodev_md5; | ||
| 876 | break; | ||
| 877 | case NID_sha1: | ||
| 878 | *digest = &cryptodev_sha1; | ||
| 879 | break; | ||
| 880 | default: | ||
| 881 | #endif /* USE_CRYPTODEV_DIGESTS */ | ||
| 882 | *digest = NULL; | ||
| 883 | break; | ||
| 884 | } | ||
| 885 | return (*digest != NULL); | ||
| 886 | } | ||
| 887 | |||
| 888 | /* | ||
| 889 | * Convert a BIGNUM to the representation that /dev/crypto needs. | ||
| 890 | * Upon completion of use, the caller is responsible for freeing | ||
| 891 | * crp->crp_p. | ||
| 892 | */ | ||
| 893 | static int | ||
| 894 | bn2crparam(const BIGNUM *a, struct crparam *crp) | ||
| 895 | { | ||
| 896 | int i, j, k; | ||
| 897 | ssize_t bytes, bits; | ||
| 898 | u_char *b; | ||
| 899 | |||
| 900 | crp->crp_p = NULL; | ||
| 901 | crp->crp_nbits = 0; | ||
| 902 | |||
| 903 | bits = BN_num_bits(a); | ||
| 904 | bytes = (bits + 7) / 8; | ||
| 905 | |||
| 906 | b = malloc(bytes); | ||
| 907 | if (b == NULL) | ||
| 908 | return (1); | ||
| 909 | memset(b, 0, bytes); | ||
| 910 | |||
| 911 | crp->crp_p = (caddr_t) b; | ||
| 912 | crp->crp_nbits = bits; | ||
| 913 | |||
| 914 | for (i = 0, j = 0; i < a->top; i++) { | ||
| 915 | for (k = 0; k < BN_BITS2 / 8; k++) { | ||
| 916 | if ((j + k) >= bytes) | ||
| 917 | return (0); | ||
| 918 | b[j + k] = a->d[i] >> (k * 8); | ||
| 919 | } | ||
| 920 | j += BN_BITS2 / 8; | ||
| 921 | } | ||
| 922 | return (0); | ||
| 923 | } | ||
| 924 | |||
| 925 | /* Convert a /dev/crypto parameter to a BIGNUM */ | ||
| 926 | static int | ||
| 927 | crparam2bn(struct crparam *crp, BIGNUM *a) | ||
| 928 | { | ||
| 929 | u_int8_t *pd; | ||
| 930 | int i, bytes; | ||
| 931 | |||
| 932 | bytes = (crp->crp_nbits + 7) / 8; | ||
| 933 | |||
| 934 | if (bytes == 0) | ||
| 935 | return (-1); | ||
| 936 | |||
| 937 | if ((pd = (u_int8_t *) malloc(bytes)) == NULL) | ||
| 938 | return (-1); | ||
| 939 | |||
| 940 | for (i = 0; i < bytes; i++) | ||
| 941 | pd[i] = crp->crp_p[bytes - i - 1]; | ||
| 942 | |||
| 943 | BN_bin2bn(pd, bytes, a); | ||
| 944 | free(pd); | ||
| 945 | |||
| 946 | return (0); | ||
| 947 | } | ||
| 948 | |||
| 949 | static void | ||
| 950 | zapparams(struct crypt_kop *kop) | ||
| 951 | { | ||
| 952 | int i; | ||
| 953 | |||
| 954 | for (i = 0; i < kop->crk_iparams + kop->crk_oparams; i++) { | ||
| 955 | if (kop->crk_param[i].crp_p) | ||
| 956 | free(kop->crk_param[i].crp_p); | ||
| 957 | kop->crk_param[i].crp_p = NULL; | ||
| 958 | kop->crk_param[i].crp_nbits = 0; | ||
| 959 | } | ||
| 960 | } | ||
| 961 | |||
| 962 | static int | ||
| 963 | cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s) | ||
| 964 | { | ||
| 965 | int fd, ret = -1; | ||
| 966 | |||
| 967 | if ((fd = get_asym_dev_crypto()) < 0) | ||
| 968 | return (ret); | ||
| 969 | |||
| 970 | if (r) { | ||
| 971 | kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char)); | ||
| 972 | kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8; | ||
| 973 | kop->crk_oparams++; | ||
| 974 | } | ||
| 975 | if (s) { | ||
| 976 | kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char)); | ||
| 977 | kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8; | ||
| 978 | kop->crk_oparams++; | ||
| 979 | } | ||
| 980 | |||
| 981 | if (ioctl(fd, CIOCKEY, kop) == 0) { | ||
| 982 | if (r) | ||
| 983 | crparam2bn(&kop->crk_param[kop->crk_iparams], r); | ||
| 984 | if (s) | ||
| 985 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); | ||
| 986 | ret = 0; | ||
| 987 | } | ||
| 988 | |||
| 989 | return (ret); | ||
| 990 | } | ||
| 991 | |||
| 992 | static int | ||
| 993 | cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 994 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 995 | { | ||
| 996 | struct crypt_kop kop; | ||
| 997 | int ret = 1; | ||
| 998 | |||
| 999 | /* Currently, we know we can do mod exp iff we can do any | ||
| 1000 | * asymmetric operations at all. | ||
| 1001 | */ | ||
| 1002 | if (cryptodev_asymfeat == 0) { | ||
| 1003 | ret = BN_mod_exp(r, a, p, m, ctx); | ||
| 1004 | return (ret); | ||
| 1005 | } | ||
| 1006 | |||
| 1007 | memset(&kop, 0, sizeof kop); | ||
| 1008 | kop.crk_op = CRK_MOD_EXP; | ||
| 1009 | |||
| 1010 | /* inputs: a^p % m */ | ||
| 1011 | if (bn2crparam(a, &kop.crk_param[0])) | ||
| 1012 | goto err; | ||
| 1013 | if (bn2crparam(p, &kop.crk_param[1])) | ||
| 1014 | goto err; | ||
| 1015 | if (bn2crparam(m, &kop.crk_param[2])) | ||
| 1016 | goto err; | ||
| 1017 | kop.crk_iparams = 3; | ||
| 1018 | |||
| 1019 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL)) { | ||
| 1020 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1021 | printf("OCF asym process failed, Running in software\n"); | ||
| 1022 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | ||
| 1023 | |||
| 1024 | } else if (ECANCELED == kop.crk_status) { | ||
| 1025 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1026 | printf("OCF hardware operation cancelled. Running in Software\n"); | ||
| 1027 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | ||
| 1028 | } | ||
| 1029 | /* else cryptodev operation worked ok ==> ret = 1*/ | ||
| 1030 | |||
| 1031 | err: | ||
| 1032 | zapparams(&kop); | ||
| 1033 | return (ret); | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | static int | ||
| 1037 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | ||
| 1038 | { | ||
| 1039 | int r; | ||
| 1040 | ctx = BN_CTX_new(); | ||
| 1041 | r = cryptodev_bn_mod_exp(r0, I, rsa->d, rsa->n, ctx, NULL); | ||
| 1042 | BN_CTX_free(ctx); | ||
| 1043 | return (r); | ||
| 1044 | } | ||
| 1045 | |||
| 1046 | static int | ||
| 1047 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | ||
| 1048 | { | ||
| 1049 | struct crypt_kop kop; | ||
| 1050 | int ret = 1; | ||
| 1051 | |||
| 1052 | if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) { | ||
| 1053 | /* XXX 0 means failure?? */ | ||
| 1054 | return (0); | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | memset(&kop, 0, sizeof kop); | ||
| 1058 | kop.crk_op = CRK_MOD_EXP_CRT; | ||
| 1059 | /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */ | ||
| 1060 | if (bn2crparam(rsa->p, &kop.crk_param[0])) | ||
| 1061 | goto err; | ||
| 1062 | if (bn2crparam(rsa->q, &kop.crk_param[1])) | ||
| 1063 | goto err; | ||
| 1064 | if (bn2crparam(I, &kop.crk_param[2])) | ||
| 1065 | goto err; | ||
| 1066 | if (bn2crparam(rsa->dmp1, &kop.crk_param[3])) | ||
| 1067 | goto err; | ||
| 1068 | if (bn2crparam(rsa->dmq1, &kop.crk_param[4])) | ||
| 1069 | goto err; | ||
| 1070 | if (bn2crparam(rsa->iqmp, &kop.crk_param[5])) | ||
| 1071 | goto err; | ||
| 1072 | kop.crk_iparams = 6; | ||
| 1073 | |||
| 1074 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL)) { | ||
| 1075 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1076 | printf("OCF asym process failed, running in Software\n"); | ||
| 1077 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 1078 | |||
| 1079 | } else if (ECANCELED == kop.crk_status) { | ||
| 1080 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1081 | printf("OCF hardware operation cancelled. Running in Software\n"); | ||
| 1082 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 1083 | } | ||
| 1084 | /* else cryptodev operation worked ok ==> ret = 1*/ | ||
| 1085 | |||
| 1086 | err: | ||
| 1087 | zapparams(&kop); | ||
| 1088 | return (ret); | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | static RSA_METHOD cryptodev_rsa = { | ||
| 1092 | "cryptodev RSA method", | ||
| 1093 | NULL, /* rsa_pub_enc */ | ||
| 1094 | NULL, /* rsa_pub_dec */ | ||
| 1095 | NULL, /* rsa_priv_enc */ | ||
| 1096 | NULL, /* rsa_priv_dec */ | ||
| 1097 | NULL, | ||
| 1098 | NULL, | ||
| 1099 | NULL, /* init */ | ||
| 1100 | NULL, /* finish */ | ||
| 1101 | 0, /* flags */ | ||
| 1102 | NULL, /* app_data */ | ||
| 1103 | NULL, /* rsa_sign */ | ||
| 1104 | NULL /* rsa_verify */ | ||
| 1105 | }; | ||
| 1106 | |||
| 1107 | static int | ||
| 1108 | cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
| 1109 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 1110 | { | ||
| 1111 | return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx)); | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | static int | ||
| 1115 | cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | ||
| 1116 | BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p, | ||
| 1117 | BN_CTX *ctx, BN_MONT_CTX *mont) | ||
| 1118 | { | ||
| 1119 | BIGNUM t2; | ||
| 1120 | int ret = 0; | ||
| 1121 | |||
| 1122 | BN_init(&t2); | ||
| 1123 | |||
| 1124 | /* v = ( g^u1 * y^u2 mod p ) mod q */ | ||
| 1125 | /* let t1 = g ^ u1 mod p */ | ||
| 1126 | ret = 0; | ||
| 1127 | |||
| 1128 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) | ||
| 1129 | goto err; | ||
| 1130 | |||
| 1131 | /* let t2 = y ^ u2 mod p */ | ||
| 1132 | if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont)) | ||
| 1133 | goto err; | ||
| 1134 | /* let u1 = t1 * t2 mod p */ | ||
| 1135 | if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx)) | ||
| 1136 | goto err; | ||
| 1137 | |||
| 1138 | BN_copy(t1,u1); | ||
| 1139 | |||
| 1140 | ret = 1; | ||
| 1141 | err: | ||
| 1142 | BN_free(&t2); | ||
| 1143 | return(ret); | ||
| 1144 | } | ||
| 1145 | |||
| 1146 | static DSA_SIG * | ||
| 1147 | cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | ||
| 1148 | { | ||
| 1149 | struct crypt_kop kop; | ||
| 1150 | BIGNUM *r = NULL, *s = NULL; | ||
| 1151 | DSA_SIG *dsaret = NULL; | ||
| 1152 | |||
| 1153 | if ((r = BN_new()) == NULL) | ||
| 1154 | goto err; | ||
| 1155 | if ((s = BN_new()) == NULL) { | ||
| 1156 | BN_free(r); | ||
| 1157 | goto err; | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | memset(&kop, 0, sizeof kop); | ||
| 1161 | kop.crk_op = CRK_DSA_SIGN; | ||
| 1162 | |||
| 1163 | /* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */ | ||
| 1164 | kop.crk_param[0].crp_p = (caddr_t)dgst; | ||
| 1165 | kop.crk_param[0].crp_nbits = dlen * 8; | ||
| 1166 | if (bn2crparam(dsa->p, &kop.crk_param[1])) | ||
| 1167 | goto err; | ||
| 1168 | if (bn2crparam(dsa->q, &kop.crk_param[2])) | ||
| 1169 | goto err; | ||
| 1170 | if (bn2crparam(dsa->g, &kop.crk_param[3])) | ||
| 1171 | goto err; | ||
| 1172 | if (bn2crparam(dsa->priv_key, &kop.crk_param[4])) | ||
| 1173 | goto err; | ||
| 1174 | kop.crk_iparams = 5; | ||
| 1175 | |||
| 1176 | if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r, | ||
| 1177 | BN_num_bytes(dsa->q), s) == 0) { | ||
| 1178 | dsaret = DSA_SIG_new(); | ||
| 1179 | dsaret->r = r; | ||
| 1180 | dsaret->s = s; | ||
| 1181 | } else { | ||
| 1182 | const DSA_METHOD *meth = DSA_OpenSSL(); | ||
| 1183 | BN_free(r); | ||
| 1184 | BN_free(s); | ||
| 1185 | dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa); | ||
| 1186 | } | ||
| 1187 | err: | ||
| 1188 | kop.crk_param[0].crp_p = NULL; | ||
| 1189 | zapparams(&kop); | ||
| 1190 | return (dsaret); | ||
| 1191 | } | ||
| 1192 | |||
| 1193 | static int | ||
| 1194 | cryptodev_dsa_verify(const unsigned char *dgst, int dlen, | ||
| 1195 | DSA_SIG *sig, DSA *dsa) | ||
| 1196 | { | ||
| 1197 | struct crypt_kop kop; | ||
| 1198 | int dsaret = 1; | ||
| 1199 | |||
| 1200 | memset(&kop, 0, sizeof kop); | ||
| 1201 | kop.crk_op = CRK_DSA_VERIFY; | ||
| 1202 | |||
| 1203 | /* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */ | ||
| 1204 | kop.crk_param[0].crp_p = (caddr_t)dgst; | ||
| 1205 | kop.crk_param[0].crp_nbits = dlen * 8; | ||
| 1206 | if (bn2crparam(dsa->p, &kop.crk_param[1])) | ||
| 1207 | goto err; | ||
| 1208 | if (bn2crparam(dsa->q, &kop.crk_param[2])) | ||
| 1209 | goto err; | ||
| 1210 | if (bn2crparam(dsa->g, &kop.crk_param[3])) | ||
| 1211 | goto err; | ||
| 1212 | if (bn2crparam(dsa->pub_key, &kop.crk_param[4])) | ||
| 1213 | goto err; | ||
| 1214 | if (bn2crparam(sig->r, &kop.crk_param[5])) | ||
| 1215 | goto err; | ||
| 1216 | if (bn2crparam(sig->s, &kop.crk_param[6])) | ||
| 1217 | goto err; | ||
| 1218 | kop.crk_iparams = 7; | ||
| 1219 | |||
| 1220 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { | ||
| 1221 | /*OCF success value is 0, if not zero, change dsaret to fail*/ | ||
| 1222 | if(0 != kop.crk_status) dsaret = 0; | ||
| 1223 | } else { | ||
| 1224 | const DSA_METHOD *meth = DSA_OpenSSL(); | ||
| 1225 | |||
| 1226 | dsaret = (meth->dsa_do_verify)(dgst, dlen, sig, dsa); | ||
| 1227 | } | ||
| 1228 | err: | ||
| 1229 | kop.crk_param[0].crp_p = NULL; | ||
| 1230 | zapparams(&kop); | ||
| 1231 | return (dsaret); | ||
| 1232 | } | ||
| 1233 | |||
| 1234 | static DSA_METHOD cryptodev_dsa = { | ||
| 1235 | "cryptodev DSA method", | ||
| 1236 | NULL, | ||
| 1237 | NULL, /* dsa_sign_setup */ | ||
| 1238 | NULL, | ||
| 1239 | NULL, /* dsa_mod_exp */ | ||
| 1240 | NULL, | ||
| 1241 | NULL, /* init */ | ||
| 1242 | NULL, /* finish */ | ||
| 1243 | 0, /* flags */ | ||
| 1244 | NULL /* app_data */ | ||
| 1245 | }; | ||
| 1246 | |||
| 1247 | static int | ||
| 1248 | cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 1249 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 1250 | BN_MONT_CTX *m_ctx) | ||
| 1251 | { | ||
| 1252 | return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx)); | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | static int | ||
| 1256 | cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | ||
| 1257 | { | ||
| 1258 | struct crypt_kop kop; | ||
| 1259 | int dhret = 1; | ||
| 1260 | int fd, keylen; | ||
| 1261 | |||
| 1262 | if ((fd = get_asym_dev_crypto()) < 0) { | ||
| 1263 | const DH_METHOD *meth = DH_OpenSSL(); | ||
| 1264 | |||
| 1265 | return ((meth->compute_key)(key, pub_key, dh)); | ||
| 1266 | } | ||
| 1267 | |||
| 1268 | keylen = BN_num_bits(dh->p); | ||
| 1269 | |||
| 1270 | memset(&kop, 0, sizeof kop); | ||
| 1271 | kop.crk_op = CRK_DH_COMPUTE_KEY; | ||
| 1272 | |||
| 1273 | /* inputs: dh->priv_key pub_key dh->p key */ | ||
| 1274 | if (bn2crparam(dh->priv_key, &kop.crk_param[0])) | ||
| 1275 | goto err; | ||
| 1276 | if (bn2crparam(pub_key, &kop.crk_param[1])) | ||
| 1277 | goto err; | ||
| 1278 | if (bn2crparam(dh->p, &kop.crk_param[2])) | ||
| 1279 | goto err; | ||
| 1280 | kop.crk_iparams = 3; | ||
| 1281 | |||
| 1282 | kop.crk_param[3].crp_p = (caddr_t) key; | ||
| 1283 | kop.crk_param[3].crp_nbits = keylen * 8; | ||
| 1284 | kop.crk_oparams = 1; | ||
| 1285 | |||
| 1286 | if (ioctl(fd, CIOCKEY, &kop) == -1) { | ||
| 1287 | const DH_METHOD *meth = DH_OpenSSL(); | ||
| 1288 | |||
| 1289 | dhret = (meth->compute_key)(key, pub_key, dh); | ||
| 1290 | } | ||
| 1291 | err: | ||
| 1292 | kop.crk_param[3].crp_p = NULL; | ||
| 1293 | zapparams(&kop); | ||
| 1294 | return (dhret); | ||
| 1295 | } | ||
| 1296 | |||
| 1297 | static DH_METHOD cryptodev_dh = { | ||
| 1298 | "cryptodev DH method", | ||
| 1299 | NULL, /* cryptodev_dh_generate_key */ | ||
| 1300 | NULL, | ||
| 1301 | NULL, | ||
| 1302 | NULL, | ||
| 1303 | NULL, | ||
| 1304 | 0, /* flags */ | ||
| 1305 | NULL /* app_data */ | ||
| 1306 | }; | ||
| 1307 | |||
| 1308 | /* | ||
| 1309 | * ctrl right now is just a wrapper that doesn't do much | ||
| 1310 | * but I expect we'll want some options soon. | ||
| 1311 | */ | ||
| 1312 | static int | ||
| 1313 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) | ||
| 1314 | { | ||
| 1315 | #ifdef HAVE_SYSLOG_R | ||
| 1316 | struct syslog_data sd = SYSLOG_DATA_INIT; | ||
| 1317 | #endif | ||
| 1318 | |||
| 1319 | switch (cmd) { | ||
| 1320 | default: | ||
| 1321 | #ifdef HAVE_SYSLOG_R | ||
| 1322 | syslog_r(LOG_ERR, &sd, | ||
| 1323 | "cryptodev_ctrl: unknown command %d", cmd); | ||
| 1324 | #else | ||
| 1325 | syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd); | ||
| 1326 | #endif | ||
| 1327 | break; | ||
| 1328 | } | ||
| 1329 | return (1); | ||
| 1330 | } | ||
| 1331 | |||
| 1332 | void | ||
| 1333 | ENGINE_load_cryptodev(void) | ||
| 1334 | { | ||
| 1335 | ENGINE *engine = ENGINE_new(); | ||
| 1336 | int fd; | ||
| 1337 | |||
| 1338 | if (engine == NULL) | ||
| 1339 | return; | ||
| 1340 | if ((fd = get_dev_crypto()) < 0) { | ||
| 1341 | ENGINE_free(engine); | ||
| 1342 | return; | ||
| 1343 | } | ||
| 1344 | |||
| 1345 | /* | ||
| 1346 | * find out what asymmetric crypto algorithms we support | ||
| 1347 | */ | ||
| 1348 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | ||
| 1349 | close(fd); | ||
| 1350 | ENGINE_free(engine); | ||
| 1351 | return; | ||
| 1352 | } | ||
| 1353 | close(fd); | ||
| 1354 | |||
| 1355 | if (!ENGINE_set_id(engine, "cryptodev") || | ||
| 1356 | !ENGINE_set_name(engine, "BSD cryptodev engine") || | ||
| 1357 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || | ||
| 1358 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || | ||
| 1359 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || | ||
| 1360 | !ENGINE_set_cmd_defns(engine, cryptodev_defns)) { | ||
| 1361 | ENGINE_free(engine); | ||
| 1362 | return; | ||
| 1363 | } | ||
| 1364 | |||
| 1365 | if (ENGINE_set_RSA(engine, &cryptodev_rsa)) { | ||
| 1366 | const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay(); | ||
| 1367 | |||
| 1368 | cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp; | ||
| 1369 | cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp; | ||
| 1370 | cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc; | ||
| 1371 | cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec; | ||
| 1372 | cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc; | ||
| 1373 | cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec; | ||
| 1374 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
| 1375 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; | ||
| 1376 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) | ||
| 1377 | cryptodev_rsa.rsa_mod_exp = | ||
| 1378 | cryptodev_rsa_mod_exp; | ||
| 1379 | else | ||
| 1380 | cryptodev_rsa.rsa_mod_exp = | ||
| 1381 | cryptodev_rsa_nocrt_mod_exp; | ||
| 1382 | } | ||
| 1383 | } | ||
| 1384 | |||
| 1385 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { | ||
| 1386 | const DSA_METHOD *meth = DSA_OpenSSL(); | ||
| 1387 | |||
| 1388 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); | ||
| 1389 | if (cryptodev_asymfeat & CRF_DSA_SIGN) | ||
| 1390 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; | ||
| 1391 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
| 1392 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; | ||
| 1393 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; | ||
| 1394 | } | ||
| 1395 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) | ||
| 1396 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; | ||
| 1397 | } | ||
| 1398 | |||
| 1399 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ | ||
| 1400 | const DH_METHOD *dh_meth = DH_OpenSSL(); | ||
| 1401 | |||
| 1402 | cryptodev_dh.generate_key = dh_meth->generate_key; | ||
| 1403 | cryptodev_dh.compute_key = dh_meth->compute_key; | ||
| 1404 | cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp; | ||
| 1405 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
| 1406 | cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh; | ||
| 1407 | if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY) | ||
| 1408 | cryptodev_dh.compute_key = | ||
| 1409 | cryptodev_dh_compute_key; | ||
| 1410 | } | ||
| 1411 | } | ||
| 1412 | |||
| 1413 | ENGINE_add(engine); | ||
| 1414 | ENGINE_free(engine); | ||
| 1415 | ERR_clear_error(); | ||
| 1416 | } | ||
| 1417 | |||
| 1418 | #endif /* HAVE_CRYPTODEV */ | ||
diff --git a/src/lib/libcrypto/engine/engine.h b/src/lib/libcrypto/engine/engine.h index 943aeae215..8ad11b15d7 100644 --- a/src/lib/libcrypto/engine/engine.h +++ b/src/lib/libcrypto/engine/engine.h | |||
| @@ -344,6 +344,7 @@ void ENGINE_load_gost(void); | |||
| 344 | #endif | 344 | #endif |
| 345 | #endif | 345 | #endif |
| 346 | void ENGINE_load_cryptodev(void); | 346 | void ENGINE_load_cryptodev(void); |
| 347 | void ENGINE_load_aesni(void); | ||
| 347 | void ENGINE_load_builtin_engines(void); | 348 | void ENGINE_load_builtin_engines(void); |
| 348 | 349 | ||
| 349 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation | 350 | /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation |
| @@ -677,7 +678,6 @@ typedef struct st_dynamic_fns { | |||
| 677 | * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */ | 678 | * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */ |
| 678 | typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); | 679 | typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version); |
| 679 | #define IMPLEMENT_DYNAMIC_CHECK_FN() \ | 680 | #define IMPLEMENT_DYNAMIC_CHECK_FN() \ |
| 680 | OPENSSL_EXPORT unsigned long v_check(unsigned long v); \ | ||
| 681 | OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ | 681 | OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \ |
| 682 | if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ | 682 | if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \ |
| 683 | return 0; } | 683 | return 0; } |
| @@ -701,8 +701,6 @@ typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id, | |||
| 701 | const dynamic_fns *fns); | 701 | const dynamic_fns *fns); |
| 702 | #define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ | 702 | #define IMPLEMENT_DYNAMIC_BIND_FN(fn) \ |
| 703 | OPENSSL_EXPORT \ | 703 | OPENSSL_EXPORT \ |
| 704 | int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \ | ||
| 705 | OPENSSL_EXPORT \ | ||
| 706 | int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ | 704 | int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \ |
| 707 | if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ | 705 | if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \ |
| 708 | if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ | 706 | if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \ |
diff --git a/src/lib/libcrypto/engine/enginetest.c b/src/lib/libcrypto/engine/enginetest.c new file mode 100644 index 0000000000..f4d70e7e0a --- /dev/null +++ b/src/lib/libcrypto/engine/enginetest.c | |||
| @@ -0,0 +1,283 @@ | |||
| 1 | /* crypto/engine/enginetest.c */ | ||
| 2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <openssl/e_os2.h> | ||
| 62 | |||
| 63 | #ifdef OPENSSL_NO_ENGINE | ||
| 64 | int main(int argc, char *argv[]) | ||
| 65 | { | ||
| 66 | printf("No ENGINE support\n"); | ||
| 67 | return(0); | ||
| 68 | } | ||
| 69 | #else | ||
| 70 | #include <openssl/buffer.h> | ||
| 71 | #include <openssl/crypto.h> | ||
| 72 | #include <openssl/engine.h> | ||
| 73 | #include <openssl/err.h> | ||
| 74 | |||
| 75 | static void display_engine_list(void) | ||
| 76 | { | ||
| 77 | ENGINE *h; | ||
| 78 | int loop; | ||
| 79 | |||
| 80 | h = ENGINE_get_first(); | ||
| 81 | loop = 0; | ||
| 82 | printf("listing available engine types\n"); | ||
| 83 | while(h) | ||
| 84 | { | ||
| 85 | printf("engine %i, id = \"%s\", name = \"%s\"\n", | ||
| 86 | loop++, ENGINE_get_id(h), ENGINE_get_name(h)); | ||
| 87 | h = ENGINE_get_next(h); | ||
| 88 | } | ||
| 89 | printf("end of list\n"); | ||
| 90 | /* ENGINE_get_first() increases the struct_ref counter, so we | ||
| 91 | must call ENGINE_free() to decrease it again */ | ||
| 92 | ENGINE_free(h); | ||
| 93 | } | ||
| 94 | |||
| 95 | int main(int argc, char *argv[]) | ||
| 96 | { | ||
| 97 | ENGINE *block[512]; | ||
| 98 | char buf[256]; | ||
| 99 | const char *id, *name; | ||
| 100 | ENGINE *ptr; | ||
| 101 | int loop; | ||
| 102 | int to_return = 1; | ||
| 103 | ENGINE *new_h1 = NULL; | ||
| 104 | ENGINE *new_h2 = NULL; | ||
| 105 | ENGINE *new_h3 = NULL; | ||
| 106 | ENGINE *new_h4 = NULL; | ||
| 107 | |||
| 108 | /* enable memory leak checking unless explicitly disabled */ | ||
| 109 | if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 == strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off")))) | ||
| 110 | { | ||
| 111 | CRYPTO_malloc_debug_init(); | ||
| 112 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | ||
| 113 | } | ||
| 114 | else | ||
| 115 | { | ||
| 116 | /* OPENSSL_DEBUG_MEMORY=off */ | ||
| 117 | CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0); | ||
| 118 | } | ||
| 119 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 120 | ERR_load_crypto_strings(); | ||
| 121 | |||
| 122 | memset(block, 0, 512 * sizeof(ENGINE *)); | ||
| 123 | if(((new_h1 = ENGINE_new()) == NULL) || | ||
| 124 | !ENGINE_set_id(new_h1, "test_id0") || | ||
| 125 | !ENGINE_set_name(new_h1, "First test item") || | ||
| 126 | ((new_h2 = ENGINE_new()) == NULL) || | ||
| 127 | !ENGINE_set_id(new_h2, "test_id1") || | ||
| 128 | !ENGINE_set_name(new_h2, "Second test item") || | ||
| 129 | ((new_h3 = ENGINE_new()) == NULL) || | ||
| 130 | !ENGINE_set_id(new_h3, "test_id2") || | ||
| 131 | !ENGINE_set_name(new_h3, "Third test item") || | ||
| 132 | ((new_h4 = ENGINE_new()) == NULL) || | ||
| 133 | !ENGINE_set_id(new_h4, "test_id3") || | ||
| 134 | !ENGINE_set_name(new_h4, "Fourth test item")) | ||
| 135 | { | ||
| 136 | printf("Couldn't set up test ENGINE structures\n"); | ||
| 137 | goto end; | ||
| 138 | } | ||
| 139 | printf("\nenginetest beginning\n\n"); | ||
| 140 | display_engine_list(); | ||
| 141 | if(!ENGINE_add(new_h1)) | ||
| 142 | { | ||
| 143 | printf("Add failed!\n"); | ||
| 144 | goto end; | ||
| 145 | } | ||
| 146 | display_engine_list(); | ||
| 147 | ptr = ENGINE_get_first(); | ||
| 148 | if(!ENGINE_remove(ptr)) | ||
| 149 | { | ||
| 150 | printf("Remove failed!\n"); | ||
| 151 | goto end; | ||
| 152 | } | ||
| 153 | if (ptr) | ||
| 154 | ENGINE_free(ptr); | ||
| 155 | display_engine_list(); | ||
| 156 | if(!ENGINE_add(new_h3) || !ENGINE_add(new_h2)) | ||
| 157 | { | ||
| 158 | printf("Add failed!\n"); | ||
| 159 | goto end; | ||
| 160 | } | ||
| 161 | display_engine_list(); | ||
| 162 | if(!ENGINE_remove(new_h2)) | ||
| 163 | { | ||
| 164 | printf("Remove failed!\n"); | ||
| 165 | goto end; | ||
| 166 | } | ||
| 167 | display_engine_list(); | ||
| 168 | if(!ENGINE_add(new_h4)) | ||
| 169 | { | ||
| 170 | printf("Add failed!\n"); | ||
| 171 | goto end; | ||
| 172 | } | ||
| 173 | display_engine_list(); | ||
| 174 | if(ENGINE_add(new_h3)) | ||
| 175 | { | ||
| 176 | printf("Add *should* have failed but didn't!\n"); | ||
| 177 | goto end; | ||
| 178 | } | ||
| 179 | else | ||
| 180 | printf("Add that should fail did.\n"); | ||
| 181 | ERR_clear_error(); | ||
| 182 | if(ENGINE_remove(new_h2)) | ||
| 183 | { | ||
| 184 | printf("Remove *should* have failed but didn't!\n"); | ||
| 185 | goto end; | ||
| 186 | } | ||
| 187 | else | ||
| 188 | printf("Remove that should fail did.\n"); | ||
| 189 | ERR_clear_error(); | ||
| 190 | if(!ENGINE_remove(new_h3)) | ||
| 191 | { | ||
| 192 | printf("Remove failed!\n"); | ||
| 193 | goto end; | ||
| 194 | } | ||
| 195 | display_engine_list(); | ||
| 196 | if(!ENGINE_remove(new_h4)) | ||
| 197 | { | ||
| 198 | printf("Remove failed!\n"); | ||
| 199 | goto end; | ||
| 200 | } | ||
| 201 | display_engine_list(); | ||
| 202 | /* Depending on whether there's any hardware support compiled | ||
| 203 | * in, this remove may be destined to fail. */ | ||
| 204 | ptr = ENGINE_get_first(); | ||
| 205 | if(ptr) | ||
| 206 | if(!ENGINE_remove(ptr)) | ||
| 207 | printf("Remove failed!i - probably no hardware " | ||
| 208 | "support present.\n"); | ||
| 209 | if (ptr) | ||
| 210 | ENGINE_free(ptr); | ||
| 211 | display_engine_list(); | ||
| 212 | if(!ENGINE_add(new_h1) || !ENGINE_remove(new_h1)) | ||
| 213 | { | ||
| 214 | printf("Couldn't add and remove to an empty list!\n"); | ||
| 215 | goto end; | ||
| 216 | } | ||
| 217 | else | ||
| 218 | printf("Successfully added and removed to an empty list!\n"); | ||
| 219 | printf("About to beef up the engine-type list\n"); | ||
| 220 | for(loop = 0; loop < 512; loop++) | ||
| 221 | { | ||
| 222 | sprintf(buf, "id%i", loop); | ||
| 223 | id = BUF_strdup(buf); | ||
| 224 | sprintf(buf, "Fake engine type %i", loop); | ||
| 225 | name = BUF_strdup(buf); | ||
| 226 | if(((block[loop] = ENGINE_new()) == NULL) || | ||
| 227 | !ENGINE_set_id(block[loop], id) || | ||
| 228 | !ENGINE_set_name(block[loop], name)) | ||
| 229 | { | ||
| 230 | printf("Couldn't create block of ENGINE structures.\n" | ||
| 231 | "I'll probably also core-dump now, damn.\n"); | ||
| 232 | goto end; | ||
| 233 | } | ||
| 234 | } | ||
| 235 | for(loop = 0; loop < 512; loop++) | ||
| 236 | { | ||
| 237 | if(!ENGINE_add(block[loop])) | ||
| 238 | { | ||
| 239 | printf("\nAdding stopped at %i, (%s,%s)\n", | ||
| 240 | loop, ENGINE_get_id(block[loop]), | ||
| 241 | ENGINE_get_name(block[loop])); | ||
| 242 | goto cleanup_loop; | ||
| 243 | } | ||
| 244 | else | ||
| 245 | printf("."); fflush(stdout); | ||
| 246 | } | ||
| 247 | cleanup_loop: | ||
| 248 | printf("\nAbout to empty the engine-type list\n"); | ||
| 249 | while((ptr = ENGINE_get_first()) != NULL) | ||
| 250 | { | ||
| 251 | if(!ENGINE_remove(ptr)) | ||
| 252 | { | ||
| 253 | printf("\nRemove failed!\n"); | ||
| 254 | goto end; | ||
| 255 | } | ||
| 256 | ENGINE_free(ptr); | ||
| 257 | printf("."); fflush(stdout); | ||
| 258 | } | ||
| 259 | for(loop = 0; loop < 512; loop++) | ||
| 260 | { | ||
| 261 | OPENSSL_free((void *)ENGINE_get_id(block[loop])); | ||
| 262 | OPENSSL_free((void *)ENGINE_get_name(block[loop])); | ||
| 263 | } | ||
| 264 | printf("\nTests completed happily\n"); | ||
| 265 | to_return = 0; | ||
| 266 | end: | ||
| 267 | if(to_return) | ||
| 268 | ERR_print_errors_fp(stderr); | ||
| 269 | if(new_h1) ENGINE_free(new_h1); | ||
| 270 | if(new_h2) ENGINE_free(new_h2); | ||
| 271 | if(new_h3) ENGINE_free(new_h3); | ||
| 272 | if(new_h4) ENGINE_free(new_h4); | ||
| 273 | for(loop = 0; loop < 512; loop++) | ||
| 274 | if(block[loop]) | ||
| 275 | ENGINE_free(block[loop]); | ||
| 276 | ENGINE_cleanup(); | ||
| 277 | CRYPTO_cleanup_all_ex_data(); | ||
| 278 | ERR_free_strings(); | ||
| 279 | ERR_remove_thread_state(NULL); | ||
| 280 | CRYPTO_mem_leaks_fp(stderr); | ||
| 281 | return to_return; | ||
| 282 | } | ||
| 283 | #endif | ||
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c new file mode 100644 index 0000000000..0e80ca051a --- /dev/null +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
| @@ -0,0 +1,1367 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2002-2004 Theo de Raadt | ||
| 3 | * Copyright (c) 2002 Bob Beck <beck@openbsd.org> | ||
| 4 | * Copyright (c) 2002 Markus Friedl | ||
| 5 | * All rights reserved. | ||
| 6 | * | ||
| 7 | * Redistribution and use in source and binary forms, with or without | ||
| 8 | * modification, are permitted provided that the following conditions | ||
| 9 | * are met: | ||
| 10 | * 1. Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in the | ||
| 14 | * documentation and/or other materials provided with the distribution. | ||
| 15 | * | ||
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY | ||
| 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
| 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY | ||
| 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
| 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
| 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 26 | * | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <openssl/objects.h> | ||
| 30 | #include <openssl/engine.h> | ||
| 31 | #include <openssl/evp.h> | ||
| 32 | |||
| 33 | #if (defined(__unix__) || defined(unix)) && !defined(USG) | ||
| 34 | #include <sys/param.h> | ||
| 35 | # if (OpenBSD >= 200112) || ((__FreeBSD_version >= 470101 && __FreeBSD_version < 500000) || __FreeBSD_version >= 500041) | ||
| 36 | # define HAVE_CRYPTODEV | ||
| 37 | # endif | ||
| 38 | # if (OpenBSD >= 200110) | ||
| 39 | # define HAVE_SYSLOG_R | ||
| 40 | # endif | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #ifndef HAVE_CRYPTODEV | ||
| 44 | |||
| 45 | void | ||
| 46 | ENGINE_load_cryptodev(void) | ||
| 47 | { | ||
| 48 | /* This is a NOP on platforms without /dev/crypto */ | ||
| 49 | return; | ||
| 50 | } | ||
| 51 | |||
| 52 | #else | ||
| 53 | |||
| 54 | #include <sys/types.h> | ||
| 55 | #include <crypto/cryptodev.h> | ||
| 56 | #include <sys/ioctl.h> | ||
| 57 | |||
| 58 | #include <errno.h> | ||
| 59 | #include <fcntl.h> | ||
| 60 | #include <limits.h> | ||
| 61 | #include <stdarg.h> | ||
| 62 | #include <stdio.h> | ||
| 63 | #include <string.h> | ||
| 64 | #include <syslog.h> | ||
| 65 | #include <unistd.h> | ||
| 66 | |||
| 67 | #if defined(__i386__) || defined(__amd64__) | ||
| 68 | #include <sys/sysctl.h> | ||
| 69 | #include <machine/cpu.h> | ||
| 70 | #include <machine/specialreg.h> | ||
| 71 | |||
| 72 | #include <ssl/aes.h> | ||
| 73 | |||
| 74 | static int check_viac3aes(void); | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #define CRYPTO_VIAC3_MAX 3 | ||
| 78 | |||
| 79 | struct dev_crypto_state { | ||
| 80 | struct session_op d_sess; | ||
| 81 | int d_fd; | ||
| 82 | }; | ||
| 83 | |||
| 84 | struct dev_crypto_cipher { | ||
| 85 | int c_id; | ||
| 86 | int c_nid; | ||
| 87 | int c_ivmax; | ||
| 88 | int c_keylen; | ||
| 89 | }; | ||
| 90 | |||
| 91 | static u_int32_t cryptodev_asymfeat = 0; | ||
| 92 | |||
| 93 | static int get_asym_dev_crypto(void); | ||
| 94 | static int open_dev_crypto(void); | ||
| 95 | static int get_dev_crypto(void); | ||
| 96 | static struct dev_crypto_cipher *cipher_nid_to_cryptodev(int nid); | ||
| 97 | static int get_cryptodev_ciphers(const int **cnids); | ||
| 98 | /*static int get_cryptodev_digests(const int **cnids);*/ | ||
| 99 | static int cryptodev_usable_ciphers(const int **nids); | ||
| 100 | static int cryptodev_usable_digests(const int **nids); | ||
| 101 | static int cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 102 | const unsigned char *in, size_t inl); | ||
| 103 | static int cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 104 | const unsigned char *iv, int enc); | ||
| 105 | static int cryptodev_cleanup(EVP_CIPHER_CTX *ctx); | ||
| 106 | static int cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
| 107 | const int **nids, int nid); | ||
| 108 | static int cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | ||
| 109 | const int **nids, int nid); | ||
| 110 | static int bn2crparam(const BIGNUM *a, struct crparam *crp); | ||
| 111 | static int crparam2bn(struct crparam *crp, BIGNUM *a); | ||
| 112 | static void zapparams(struct crypt_kop *kop); | ||
| 113 | static int cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, | ||
| 114 | int slen, BIGNUM *s); | ||
| 115 | |||
| 116 | static int cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, | ||
| 117 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 118 | static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, | ||
| 119 | RSA *rsa, BN_CTX *ctx); | ||
| 120 | static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, | ||
| 121 | BN_CTX *ctx); | ||
| 122 | static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
| 123 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
| 124 | static int cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | ||
| 125 | BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p, | ||
| 126 | BN_CTX *ctx, BN_MONT_CTX *mont); | ||
| 127 | static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, | ||
| 128 | int dlen, DSA *dsa); | ||
| 129 | static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len, | ||
| 130 | DSA_SIG *sig, DSA *dsa); | ||
| 131 | static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 132 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 133 | BN_MONT_CTX *m_ctx); | ||
| 134 | static int cryptodev_dh_compute_key(unsigned char *key, | ||
| 135 | const BIGNUM *pub_key, DH *dh); | ||
| 136 | static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, | ||
| 137 | void (*f)()); | ||
| 138 | void ENGINE_load_cryptodev(void); | ||
| 139 | |||
| 140 | static const ENGINE_CMD_DEFN cryptodev_defns[] = { | ||
| 141 | { 0, NULL, NULL, 0 } | ||
| 142 | }; | ||
| 143 | |||
| 144 | static struct dev_crypto_cipher ciphers[] = { | ||
| 145 | { CRYPTO_DES_CBC, NID_des_cbc, 8, 8, }, | ||
| 146 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | ||
| 147 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, | ||
| 148 | { CRYPTO_AES_CBC, NID_aes_192_cbc, 16, 24, }, | ||
| 149 | { CRYPTO_AES_CBC, NID_aes_256_cbc, 16, 32, }, | ||
| 150 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | ||
| 151 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, | ||
| 152 | { 0, NID_undef, 0, 0, }, | ||
| 153 | }; | ||
| 154 | |||
| 155 | #if 0 /* UNUSED */ | ||
| 156 | static struct { | ||
| 157 | int id; | ||
| 158 | int nid; | ||
| 159 | } digests[] = { | ||
| 160 | { CRYPTO_SHA1_HMAC, NID_hmacWithSHA1, }, | ||
| 161 | { CRYPTO_RIPEMD160_HMAC, NID_ripemd160, }, | ||
| 162 | { CRYPTO_MD5_KPDK, NID_undef, }, | ||
| 163 | { CRYPTO_SHA1_KPDK, NID_undef, }, | ||
| 164 | { CRYPTO_MD5, NID_md5, }, | ||
| 165 | { CRYPTO_SHA1, NID_undef, }, | ||
| 166 | { 0, NID_undef, }, | ||
| 167 | }; | ||
| 168 | #endif | ||
| 169 | |||
| 170 | /* | ||
| 171 | * Return a fd if /dev/crypto seems usable, -1 otherwise. | ||
| 172 | */ | ||
| 173 | static int | ||
| 174 | open_dev_crypto(void) | ||
| 175 | { | ||
| 176 | static int fd = -1; | ||
| 177 | |||
| 178 | if (fd == -1) { | ||
| 179 | if ((fd = open("/dev/crypto", O_RDWR, 0)) == -1) | ||
| 180 | return (-1); | ||
| 181 | /* close on exec */ | ||
| 182 | if (fcntl(fd, F_SETFD, 1) == -1) { | ||
| 183 | close(fd); | ||
| 184 | fd = -1; | ||
| 185 | return (-1); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | return (fd); | ||
| 189 | } | ||
| 190 | |||
| 191 | static int | ||
| 192 | get_dev_crypto(void) | ||
| 193 | { | ||
| 194 | int fd, retfd; | ||
| 195 | |||
| 196 | if ((fd = open_dev_crypto()) == -1) | ||
| 197 | return (-1); | ||
| 198 | if (ioctl(fd, CRIOGET, &retfd) == -1) { | ||
| 199 | close(fd); | ||
| 200 | return (-1); | ||
| 201 | } | ||
| 202 | |||
| 203 | /* close on exec */ | ||
| 204 | if (fcntl(retfd, F_SETFD, 1) == -1) { | ||
| 205 | close(retfd); | ||
| 206 | return (-1); | ||
| 207 | } | ||
| 208 | return (retfd); | ||
| 209 | } | ||
| 210 | |||
| 211 | /* Caching version for asym operations */ | ||
| 212 | static int | ||
| 213 | get_asym_dev_crypto(void) | ||
| 214 | { | ||
| 215 | static int fd = -1; | ||
| 216 | |||
| 217 | if (fd == -1) | ||
| 218 | fd = get_dev_crypto(); | ||
| 219 | return fd; | ||
| 220 | } | ||
| 221 | |||
| 222 | /* convert libcrypto nids to cryptodev */ | ||
| 223 | static struct dev_crypto_cipher * | ||
| 224 | cipher_nid_to_cryptodev(int nid) | ||
| 225 | { | ||
| 226 | int i; | ||
| 227 | |||
| 228 | for (i = 0; ciphers[i].c_id; i++) | ||
| 229 | if (ciphers[i].c_nid == nid) | ||
| 230 | return (&ciphers[i]); | ||
| 231 | return (NULL); | ||
| 232 | } | ||
| 233 | |||
| 234 | /* | ||
| 235 | * Find out what ciphers /dev/crypto will let us have a session for. | ||
| 236 | * XXX note, that some of these openssl doesn't deal with yet! | ||
| 237 | * returning them here is harmless, as long as we return NULL | ||
| 238 | * when asked for a handler in the cryptodev_engine_ciphers routine | ||
| 239 | */ | ||
| 240 | static int | ||
| 241 | get_cryptodev_ciphers(const int **cnids) | ||
| 242 | { | ||
| 243 | static int nids[CRYPTO_ALGORITHM_MAX + CRYPTO_VIAC3_MAX + 1]; | ||
| 244 | struct session_op sess; | ||
| 245 | int fd, i, count = 0; | ||
| 246 | |||
| 247 | if ((fd = get_dev_crypto()) < 0) { | ||
| 248 | *cnids = NULL; | ||
| 249 | return (0); | ||
| 250 | } | ||
| 251 | memset(&sess, 0, sizeof(sess)); | ||
| 252 | sess.key = (caddr_t)"123456781234567812345678"; | ||
| 253 | |||
| 254 | for (i = 0; ciphers[i].c_id && count <= CRYPTO_ALGORITHM_MAX; i++) { | ||
| 255 | if (ciphers[i].c_nid == NID_undef) | ||
| 256 | continue; | ||
| 257 | sess.cipher = ciphers[i].c_id; | ||
| 258 | sess.keylen = ciphers[i].c_keylen; | ||
| 259 | sess.mac = 0; | ||
| 260 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && | ||
| 261 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | ||
| 262 | nids[count++] = ciphers[i].c_nid; | ||
| 263 | } | ||
| 264 | close(fd); | ||
| 265 | |||
| 266 | #if defined(__i386__) || defined(__amd64__) | ||
| 267 | /* | ||
| 268 | * Always check for the VIA C3 AES instructions; | ||
| 269 | * even if /dev/crypto is disabled. | ||
| 270 | */ | ||
| 271 | if (check_viac3aes() >= 1) { | ||
| 272 | int have_NID_aes_128_cbc = 0; | ||
| 273 | int have_NID_aes_192_cbc = 0; | ||
| 274 | int have_NID_aes_256_cbc = 0; | ||
| 275 | |||
| 276 | for (i = 0; i < count; i++) { | ||
| 277 | if (nids[i] == NID_aes_128_cbc) | ||
| 278 | have_NID_aes_128_cbc = 1; | ||
| 279 | if (nids[i] == NID_aes_192_cbc) | ||
| 280 | have_NID_aes_192_cbc = 1; | ||
| 281 | if (nids[i] == NID_aes_256_cbc) | ||
| 282 | have_NID_aes_256_cbc = 1; | ||
| 283 | } | ||
| 284 | if (!have_NID_aes_128_cbc) | ||
| 285 | nids[count++] = NID_aes_128_cbc; | ||
| 286 | if (!have_NID_aes_192_cbc) | ||
| 287 | nids[count++] = NID_aes_192_cbc; | ||
| 288 | if (!have_NID_aes_256_cbc) | ||
| 289 | nids[count++] = NID_aes_256_cbc; | ||
| 290 | } | ||
| 291 | #endif | ||
| 292 | |||
| 293 | if (count > 0) | ||
| 294 | *cnids = nids; | ||
| 295 | else | ||
| 296 | *cnids = NULL; | ||
| 297 | return (count); | ||
| 298 | } | ||
| 299 | |||
| 300 | /* | ||
| 301 | * Find out what digests /dev/crypto will let us have a session for. | ||
| 302 | * XXX note, that some of these openssl doesn't deal with yet! | ||
| 303 | * returning them here is harmless, as long as we return NULL | ||
| 304 | * when asked for a handler in the cryptodev_engine_digests routine | ||
| 305 | */ | ||
| 306 | #if 0 /* UNUSED */ | ||
| 307 | static int | ||
| 308 | get_cryptodev_digests(const int **cnids) | ||
| 309 | { | ||
| 310 | static int nids[CRYPTO_ALGORITHM_MAX]; | ||
| 311 | struct session_op sess; | ||
| 312 | int fd, i, count = 0; | ||
| 313 | |||
| 314 | if ((fd = get_dev_crypto()) < 0) { | ||
| 315 | *cnids = NULL; | ||
| 316 | return (0); | ||
| 317 | } | ||
| 318 | memset(&sess, 0, sizeof(sess)); | ||
| 319 | for (i = 0; digests[i].id && count < CRYPTO_ALGORITHM_MAX; i++) { | ||
| 320 | if (digests[i].nid == NID_undef) | ||
| 321 | continue; | ||
| 322 | sess.mac = digests[i].id; | ||
| 323 | sess.cipher = 0; | ||
| 324 | if (ioctl(fd, CIOCGSESSION, &sess) != -1 && | ||
| 325 | ioctl(fd, CIOCFSESSION, &sess.ses) != -1) | ||
| 326 | nids[count++] = digests[i].nid; | ||
| 327 | } | ||
| 328 | close(fd); | ||
| 329 | |||
| 330 | if (count > 0) | ||
| 331 | *cnids = nids; | ||
| 332 | else | ||
| 333 | *cnids = NULL; | ||
| 334 | return (count); | ||
| 335 | } | ||
| 336 | #endif | ||
| 337 | |||
| 338 | /* | ||
| 339 | * Find the useable ciphers|digests from dev/crypto - this is the first | ||
| 340 | * thing called by the engine init crud which determines what it | ||
| 341 | * can use for ciphers from this engine. We want to return | ||
| 342 | * only what we can do, anythine else is handled by software. | ||
| 343 | * | ||
| 344 | * If we can't initialize the device to do anything useful for | ||
| 345 | * any reason, we want to return a NULL array, and 0 length, | ||
| 346 | * which forces everything to be done is software. By putting | ||
| 347 | * the initalization of the device in here, we ensure we can | ||
| 348 | * use this engine as the default, and if for whatever reason | ||
| 349 | * /dev/crypto won't do what we want it will just be done in | ||
| 350 | * software | ||
| 351 | * | ||
| 352 | * This can (should) be greatly expanded to perhaps take into | ||
| 353 | * account speed of the device, and what we want to do. | ||
| 354 | * (although the disabling of particular alg's could be controlled | ||
| 355 | * by the device driver with sysctl's.) - this is where we | ||
| 356 | * want most of the decisions made about what we actually want | ||
| 357 | * to use from /dev/crypto. | ||
| 358 | */ | ||
| 359 | static int | ||
| 360 | cryptodev_usable_ciphers(const int **nids) | ||
| 361 | { | ||
| 362 | return (get_cryptodev_ciphers(nids)); | ||
| 363 | } | ||
| 364 | |||
| 365 | static int | ||
| 366 | cryptodev_usable_digests(const int **nids) | ||
| 367 | { | ||
| 368 | /* | ||
| 369 | * XXXX just disable all digests for now, because it sucks. | ||
| 370 | * we need a better way to decide this - i.e. I may not | ||
| 371 | * want digests on slow cards like hifn on fast machines, | ||
| 372 | * but might want them on slow or loaded machines, etc. | ||
| 373 | * will also want them when using crypto cards that don't | ||
| 374 | * suck moose gonads - would be nice to be able to decide something | ||
| 375 | * as reasonable default without having hackery that's card dependent. | ||
| 376 | * of course, the default should probably be just do everything, | ||
| 377 | * with perhaps a sysctl to turn algoritms off (or have them off | ||
| 378 | * by default) on cards that generally suck like the hifn. | ||
| 379 | */ | ||
| 380 | *nids = NULL; | ||
| 381 | return (0); | ||
| 382 | } | ||
| 383 | |||
| 384 | static int | ||
| 385 | cryptodev_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 386 | const unsigned char *in, size_t inl) | ||
| 387 | { | ||
| 388 | struct crypt_op cryp; | ||
| 389 | struct dev_crypto_state *state = ctx->cipher_data; | ||
| 390 | struct session_op *sess = &state->d_sess; | ||
| 391 | void *iiv; | ||
| 392 | unsigned char save_iv[EVP_MAX_IV_LENGTH]; | ||
| 393 | |||
| 394 | if (state->d_fd < 0) | ||
| 395 | return (0); | ||
| 396 | if (!inl) | ||
| 397 | return (1); | ||
| 398 | if ((inl % ctx->cipher->block_size) != 0) | ||
| 399 | return (0); | ||
| 400 | |||
| 401 | memset(&cryp, 0, sizeof(cryp)); | ||
| 402 | |||
| 403 | cryp.ses = sess->ses; | ||
| 404 | cryp.flags = 0; | ||
| 405 | cryp.len = inl; | ||
| 406 | cryp.src = (caddr_t) in; | ||
| 407 | cryp.dst = (caddr_t) out; | ||
| 408 | cryp.mac = 0; | ||
| 409 | |||
| 410 | cryp.op = ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT; | ||
| 411 | |||
| 412 | if (ctx->cipher->iv_len) { | ||
| 413 | cryp.iv = (caddr_t) ctx->iv; | ||
| 414 | if (!ctx->encrypt) { | ||
| 415 | iiv = (void *) in + inl - ctx->cipher->iv_len; | ||
| 416 | memcpy(save_iv, iiv, ctx->cipher->iv_len); | ||
| 417 | } | ||
| 418 | } else | ||
| 419 | cryp.iv = NULL; | ||
| 420 | |||
| 421 | if (ioctl(state->d_fd, CIOCCRYPT, &cryp) == -1) { | ||
| 422 | /* XXX need better errror handling | ||
| 423 | * this can fail for a number of different reasons. | ||
| 424 | */ | ||
| 425 | return (0); | ||
| 426 | } | ||
| 427 | |||
| 428 | if (ctx->cipher->iv_len) { | ||
| 429 | if (ctx->encrypt) | ||
| 430 | iiv = (void *) out + inl - ctx->cipher->iv_len; | ||
| 431 | else | ||
| 432 | iiv = save_iv; | ||
| 433 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); | ||
| 434 | } | ||
| 435 | return (1); | ||
| 436 | } | ||
| 437 | |||
| 438 | static int | ||
| 439 | cryptodev_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 440 | const unsigned char *iv, int enc) | ||
| 441 | { | ||
| 442 | struct dev_crypto_state *state = ctx->cipher_data; | ||
| 443 | struct session_op *sess = &state->d_sess; | ||
| 444 | struct dev_crypto_cipher *cipher; | ||
| 445 | |||
| 446 | if ((cipher = cipher_nid_to_cryptodev(ctx->cipher->nid)) == NULL) | ||
| 447 | return (0); | ||
| 448 | |||
| 449 | if (ctx->cipher->iv_len > cipher->c_ivmax) | ||
| 450 | return (0); | ||
| 451 | |||
| 452 | if (ctx->key_len != cipher->c_keylen) | ||
| 453 | return (0); | ||
| 454 | |||
| 455 | memset(sess, 0, sizeof(struct session_op)); | ||
| 456 | |||
| 457 | if ((state->d_fd = get_dev_crypto()) < 0) | ||
| 458 | return (0); | ||
| 459 | |||
| 460 | sess->key = (unsigned char *)key; | ||
| 461 | sess->keylen = ctx->key_len; | ||
| 462 | sess->cipher = cipher->c_id; | ||
| 463 | |||
| 464 | if (ioctl(state->d_fd, CIOCGSESSION, sess) == -1) { | ||
| 465 | close(state->d_fd); | ||
| 466 | state->d_fd = -1; | ||
| 467 | return (0); | ||
| 468 | } | ||
| 469 | return (1); | ||
| 470 | } | ||
| 471 | |||
| 472 | /* | ||
| 473 | * free anything we allocated earlier when initting a | ||
| 474 | * session, and close the session. | ||
| 475 | */ | ||
| 476 | static int | ||
| 477 | cryptodev_cleanup(EVP_CIPHER_CTX *ctx) | ||
| 478 | { | ||
| 479 | int ret = 0; | ||
| 480 | struct dev_crypto_state *state = ctx->cipher_data; | ||
| 481 | struct session_op *sess = &state->d_sess; | ||
| 482 | |||
| 483 | if (state->d_fd < 0) | ||
| 484 | return (0); | ||
| 485 | |||
| 486 | /* XXX if this ioctl fails, someting's wrong. the invoker | ||
| 487 | * may have called us with a bogus ctx, or we could | ||
| 488 | * have a device that for whatever reason just doesn't | ||
| 489 | * want to play ball - it's not clear what's right | ||
| 490 | * here - should this be an error? should it just | ||
| 491 | * increase a counter, hmm. For right now, we return | ||
| 492 | * 0 - I don't believe that to be "right". we could | ||
| 493 | * call the gorpy openssl lib error handlers that | ||
| 494 | * print messages to users of the library. hmm.. | ||
| 495 | */ | ||
| 496 | |||
| 497 | if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) == -1) { | ||
| 498 | ret = 0; | ||
| 499 | } else { | ||
| 500 | ret = 1; | ||
| 501 | } | ||
| 502 | close(state->d_fd); | ||
| 503 | state->d_fd = -1; | ||
| 504 | |||
| 505 | return (ret); | ||
| 506 | } | ||
| 507 | |||
| 508 | /* | ||
| 509 | * libcrypto EVP stuff - this is how we get wired to EVP so the engine | ||
| 510 | * gets called when libcrypto requests a cipher NID. | ||
| 511 | */ | ||
| 512 | |||
| 513 | /* DES CBC EVP */ | ||
| 514 | const EVP_CIPHER cryptodev_des_cbc = { | ||
| 515 | NID_des_cbc, | ||
| 516 | 8, 8, 8, | ||
| 517 | EVP_CIPH_CBC_MODE, | ||
| 518 | cryptodev_init_key, | ||
| 519 | cryptodev_cipher, | ||
| 520 | cryptodev_cleanup, | ||
| 521 | sizeof(struct dev_crypto_state), | ||
| 522 | EVP_CIPHER_set_asn1_iv, | ||
| 523 | EVP_CIPHER_get_asn1_iv, | ||
| 524 | NULL | ||
| 525 | }; | ||
| 526 | |||
| 527 | /* 3DES CBC EVP */ | ||
| 528 | const EVP_CIPHER cryptodev_3des_cbc = { | ||
| 529 | NID_des_ede3_cbc, | ||
| 530 | 8, 24, 8, | ||
| 531 | EVP_CIPH_CBC_MODE, | ||
| 532 | cryptodev_init_key, | ||
| 533 | cryptodev_cipher, | ||
| 534 | cryptodev_cleanup, | ||
| 535 | sizeof(struct dev_crypto_state), | ||
| 536 | EVP_CIPHER_set_asn1_iv, | ||
| 537 | EVP_CIPHER_get_asn1_iv, | ||
| 538 | NULL | ||
| 539 | }; | ||
| 540 | |||
| 541 | const EVP_CIPHER cryptodev_bf_cbc = { | ||
| 542 | NID_bf_cbc, | ||
| 543 | 8, 16, 8, | ||
| 544 | EVP_CIPH_CBC_MODE, | ||
| 545 | cryptodev_init_key, | ||
| 546 | cryptodev_cipher, | ||
| 547 | cryptodev_cleanup, | ||
| 548 | sizeof(struct dev_crypto_state), | ||
| 549 | EVP_CIPHER_set_asn1_iv, | ||
| 550 | EVP_CIPHER_get_asn1_iv, | ||
| 551 | NULL | ||
| 552 | }; | ||
| 553 | |||
| 554 | const EVP_CIPHER cryptodev_cast_cbc = { | ||
| 555 | NID_cast5_cbc, | ||
| 556 | 8, 16, 8, | ||
| 557 | EVP_CIPH_CBC_MODE, | ||
| 558 | cryptodev_init_key, | ||
| 559 | cryptodev_cipher, | ||
| 560 | cryptodev_cleanup, | ||
| 561 | sizeof(struct dev_crypto_state), | ||
| 562 | EVP_CIPHER_set_asn1_iv, | ||
| 563 | EVP_CIPHER_get_asn1_iv, | ||
| 564 | NULL | ||
| 565 | }; | ||
| 566 | |||
| 567 | EVP_CIPHER cryptodev_aes_128_cbc = { | ||
| 568 | NID_aes_128_cbc, | ||
| 569 | 16, 16, 16, | ||
| 570 | EVP_CIPH_CBC_MODE, | ||
| 571 | cryptodev_init_key, | ||
| 572 | cryptodev_cipher, | ||
| 573 | cryptodev_cleanup, | ||
| 574 | sizeof(struct dev_crypto_state), | ||
| 575 | EVP_CIPHER_set_asn1_iv, | ||
| 576 | EVP_CIPHER_get_asn1_iv, | ||
| 577 | NULL | ||
| 578 | }; | ||
| 579 | |||
| 580 | EVP_CIPHER cryptodev_aes_192_cbc = { | ||
| 581 | NID_aes_192_cbc, | ||
| 582 | 16, 24, 16, | ||
| 583 | EVP_CIPH_CBC_MODE, | ||
| 584 | cryptodev_init_key, | ||
| 585 | cryptodev_cipher, | ||
| 586 | cryptodev_cleanup, | ||
| 587 | sizeof(struct dev_crypto_state), | ||
| 588 | EVP_CIPHER_set_asn1_iv, | ||
| 589 | EVP_CIPHER_get_asn1_iv, | ||
| 590 | NULL | ||
| 591 | }; | ||
| 592 | |||
| 593 | EVP_CIPHER cryptodev_aes_256_cbc = { | ||
| 594 | NID_aes_256_cbc, | ||
| 595 | 16, 32, 16, | ||
| 596 | EVP_CIPH_CBC_MODE, | ||
| 597 | cryptodev_init_key, | ||
| 598 | cryptodev_cipher, | ||
| 599 | cryptodev_cleanup, | ||
| 600 | sizeof(struct dev_crypto_state), | ||
| 601 | EVP_CIPHER_set_asn1_iv, | ||
| 602 | EVP_CIPHER_get_asn1_iv, | ||
| 603 | NULL | ||
| 604 | }; | ||
| 605 | |||
| 606 | #if defined(__i386__) || defined(__amd64__) | ||
| 607 | |||
| 608 | static inline void | ||
| 609 | viac3_xcrypt_cbc(int *cw, const void *src, void *dst, void *key, int rep, | ||
| 610 | void *iv) | ||
| 611 | { | ||
| 612 | #ifdef notdef | ||
| 613 | printf("cw %p[%x %x %x %x] src %p dst %p key %p rep %x iv %p\n", | ||
| 614 | cw, cw[0], cw[1], cw[2], cw[3], | ||
| 615 | src, dst, key, rep, iv); | ||
| 616 | #endif | ||
| 617 | #if defined(__i386__) | ||
| 618 | |||
| 619 | /* | ||
| 620 | * Clear bit 30 of EFLAGS. | ||
| 621 | */ | ||
| 622 | __asm __volatile("pushfl; popfl"); | ||
| 623 | |||
| 624 | /* | ||
| 625 | * Cannot simply place key into "b" register, since the compiler | ||
| 626 | * -pic mode uses that register; so instead we must dance a little. | ||
| 627 | */ | ||
| 628 | __asm __volatile("pushl %%ebx; movl %0, %%ebx; rep xcrypt-cbc; popl %%ebx" : | ||
| 629 | : "m" (key), "a" (iv), "c" (rep), "d" (cw), "S" (src), "D" (dst) | ||
| 630 | : "memory", "cc"); | ||
| 631 | #else | ||
| 632 | |||
| 633 | /* | ||
| 634 | * Clear bit 30 of EFLAGS. | ||
| 635 | */ | ||
| 636 | __asm __volatile("pushfq; popfq"); | ||
| 637 | __asm __volatile("rep xcrypt-cbc" : | ||
| 638 | : "b" (key), "a" (iv), "c" (rep), "d" (cw), "S" (src), "D" (dst) | ||
| 639 | : "memory", "cc"); | ||
| 640 | #endif | ||
| 641 | |||
| 642 | } | ||
| 643 | |||
| 644 | #define ISUNALIGNED(x) ((long)(x)) & 15 | ||
| 645 | #define DOALIGN(v) ((void *)(((long)(v) + 15) & ~15)) | ||
| 646 | |||
| 647 | static int | ||
| 648 | xcrypt_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 649 | const unsigned char *in, size_t inl) | ||
| 650 | { | ||
| 651 | unsigned char *save_iv_store[EVP_MAX_IV_LENGTH + 15]; | ||
| 652 | unsigned char *save_iv = DOALIGN(save_iv_store); | ||
| 653 | unsigned char *ivs_store[EVP_MAX_IV_LENGTH + 15]; | ||
| 654 | unsigned char *ivs = DOALIGN(ivs_store); | ||
| 655 | void *iiv, *iv = NULL, *ivp = NULL; | ||
| 656 | const void *usein = in; | ||
| 657 | void *useout = out, *spare; | ||
| 658 | int cws[4 + 3], *cw = DOALIGN(cws); | ||
| 659 | |||
| 660 | if (!inl) | ||
| 661 | return (1); | ||
| 662 | if ((inl % ctx->cipher->block_size) != 0) | ||
| 663 | return (0); | ||
| 664 | if (inl > UINT_MAX) | ||
| 665 | return (0); | ||
| 666 | |||
| 667 | if (ISUNALIGNED(in) || ISUNALIGNED(out)) { | ||
| 668 | spare = malloc(inl); | ||
| 669 | if (spare == NULL) | ||
| 670 | return (0); | ||
| 671 | |||
| 672 | if (ISUNALIGNED(in)) { | ||
| 673 | bcopy(in, spare, inl); | ||
| 674 | usein = spare; | ||
| 675 | } | ||
| 676 | if (ISUNALIGNED(out)) | ||
| 677 | useout = spare; | ||
| 678 | } | ||
| 679 | |||
| 680 | cw[0] = C3_CRYPT_CWLO_ALG_AES | C3_CRYPT_CWLO_KEYGEN_SW | | ||
| 681 | C3_CRYPT_CWLO_NORMAL; | ||
| 682 | cw[0] |= ctx->encrypt ? C3_CRYPT_CWLO_ENCRYPT : C3_CRYPT_CWLO_DECRYPT; | ||
| 683 | cw[1] = cw[2] = cw[3] = 0; | ||
| 684 | |||
| 685 | switch (ctx->key_len * 8) { | ||
| 686 | case 128: | ||
| 687 | cw[0] |= C3_CRYPT_CWLO_KEY128; | ||
| 688 | break; | ||
| 689 | case 192: | ||
| 690 | cw[0] |= C3_CRYPT_CWLO_KEY192; | ||
| 691 | break; | ||
| 692 | case 256: | ||
| 693 | cw[0] |= C3_CRYPT_CWLO_KEY256; | ||
| 694 | break; | ||
| 695 | } | ||
| 696 | |||
| 697 | if (ctx->cipher->iv_len) { | ||
| 698 | iv = (caddr_t) ctx->iv; | ||
| 699 | if (!ctx->encrypt) { | ||
| 700 | iiv = (void *) in + inl - ctx->cipher->iv_len; | ||
| 701 | memcpy(save_iv, iiv, ctx->cipher->iv_len); | ||
| 702 | } | ||
| 703 | } | ||
| 704 | |||
| 705 | ivp = iv; | ||
| 706 | if (ISUNALIGNED(iv)) { | ||
| 707 | bcopy(iv, ivs, ctx->cipher->iv_len); | ||
| 708 | ivp = ivs; | ||
| 709 | } | ||
| 710 | |||
| 711 | viac3_xcrypt_cbc(cw, usein, useout, ctx->cipher_data, inl / 16, ivp); | ||
| 712 | |||
| 713 | if (ISUNALIGNED(in) || ISUNALIGNED(out)) { | ||
| 714 | if (ISUNALIGNED(out)) | ||
| 715 | bcopy(spare, out, inl); | ||
| 716 | free(spare); | ||
| 717 | } | ||
| 718 | |||
| 719 | if (ivp == ivs) | ||
| 720 | bcopy(ivp, iv, ctx->cipher->iv_len); | ||
| 721 | |||
| 722 | if (ctx->cipher->iv_len) { | ||
| 723 | if (ctx->encrypt) | ||
| 724 | iiv = (void *) out + inl - ctx->cipher->iv_len; | ||
| 725 | else | ||
| 726 | iiv = save_iv; | ||
| 727 | memcpy(ctx->iv, iiv, ctx->cipher->iv_len); | ||
| 728 | } | ||
| 729 | return (1); | ||
| 730 | } | ||
| 731 | |||
| 732 | static int | ||
| 733 | xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 734 | const unsigned char *iv, int enc) | ||
| 735 | { | ||
| 736 | AES_KEY *k = ctx->cipher_data; | ||
| 737 | #ifndef AES_ASM | ||
| 738 | int i; | ||
| 739 | #endif | ||
| 740 | |||
| 741 | bzero(k, sizeof *k); | ||
| 742 | if (enc) | ||
| 743 | AES_set_encrypt_key(key, ctx->key_len * 8, k); | ||
| 744 | else | ||
| 745 | AES_set_decrypt_key(key, ctx->key_len * 8, k); | ||
| 746 | |||
| 747 | #ifndef AES_ASM | ||
| 748 | /* | ||
| 749 | * XXX Damn OpenSSL byte swaps the expanded key!! | ||
| 750 | * | ||
| 751 | * XXX But only if we're using the C implementation of AES | ||
| 752 | */ | ||
| 753 | for (i = 0; i < 4 * (AES_MAXNR + 1); i++) | ||
| 754 | k->rd_key[i] = htonl(k->rd_key[i]); | ||
| 755 | #endif | ||
| 756 | |||
| 757 | return (1); | ||
| 758 | } | ||
| 759 | |||
| 760 | static int | ||
| 761 | xcrypt_cleanup(EVP_CIPHER_CTX *ctx) | ||
| 762 | { | ||
| 763 | bzero(ctx->cipher_data, ctx->cipher->ctx_size); | ||
| 764 | return (1); | ||
| 765 | } | ||
| 766 | |||
| 767 | static int | ||
| 768 | check_viac3aes(void) | ||
| 769 | { | ||
| 770 | int mib[2] = { CTL_MACHDEP, CPU_XCRYPT }, value; | ||
| 771 | size_t size = sizeof(value); | ||
| 772 | |||
| 773 | if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &value, &size, | ||
| 774 | NULL, 0) < 0) | ||
| 775 | return (0); | ||
| 776 | if (value == 0) | ||
| 777 | return (0); | ||
| 778 | |||
| 779 | if (value & C3_HAS_AES) { | ||
| 780 | cryptodev_aes_128_cbc.init = xcrypt_init_key; | ||
| 781 | cryptodev_aes_128_cbc.do_cipher = xcrypt_cipher; | ||
| 782 | cryptodev_aes_128_cbc.cleanup = xcrypt_cleanup; | ||
| 783 | cryptodev_aes_128_cbc.ctx_size = sizeof(AES_KEY); | ||
| 784 | |||
| 785 | cryptodev_aes_192_cbc.init = xcrypt_init_key; | ||
| 786 | cryptodev_aes_192_cbc.do_cipher = xcrypt_cipher; | ||
| 787 | cryptodev_aes_192_cbc.cleanup = xcrypt_cleanup; | ||
| 788 | cryptodev_aes_192_cbc.ctx_size = sizeof(AES_KEY); | ||
| 789 | |||
| 790 | cryptodev_aes_256_cbc.init = xcrypt_init_key; | ||
| 791 | cryptodev_aes_256_cbc.do_cipher = xcrypt_cipher; | ||
| 792 | cryptodev_aes_256_cbc.cleanup = xcrypt_cleanup; | ||
| 793 | cryptodev_aes_256_cbc.ctx_size = sizeof(AES_KEY); | ||
| 794 | } | ||
| 795 | return (value); | ||
| 796 | } | ||
| 797 | #endif /* __i386__ || __amd64__ */ | ||
| 798 | |||
| 799 | /* | ||
| 800 | * Registered by the ENGINE when used to find out how to deal with | ||
| 801 | * a particular NID in the ENGINE. this says what we'll do at the | ||
| 802 | * top level - note, that list is restricted by what we answer with | ||
| 803 | */ | ||
| 804 | static int | ||
| 805 | cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, | ||
| 806 | const int **nids, int nid) | ||
| 807 | { | ||
| 808 | if (!cipher) | ||
| 809 | return (cryptodev_usable_ciphers(nids)); | ||
| 810 | |||
| 811 | switch (nid) { | ||
| 812 | case NID_des_ede3_cbc: | ||
| 813 | *cipher = &cryptodev_3des_cbc; | ||
| 814 | break; | ||
| 815 | case NID_des_cbc: | ||
| 816 | *cipher = &cryptodev_des_cbc; | ||
| 817 | break; | ||
| 818 | case NID_bf_cbc: | ||
| 819 | *cipher = &cryptodev_bf_cbc; | ||
| 820 | break; | ||
| 821 | case NID_cast5_cbc: | ||
| 822 | *cipher = &cryptodev_cast_cbc; | ||
| 823 | break; | ||
| 824 | case NID_aes_128_cbc: | ||
| 825 | *cipher = &cryptodev_aes_128_cbc; | ||
| 826 | break; | ||
| 827 | case NID_aes_192_cbc: | ||
| 828 | *cipher = &cryptodev_aes_192_cbc; | ||
| 829 | break; | ||
| 830 | case NID_aes_256_cbc: | ||
| 831 | *cipher = &cryptodev_aes_256_cbc; | ||
| 832 | break; | ||
| 833 | default: | ||
| 834 | *cipher = NULL; | ||
| 835 | break; | ||
| 836 | } | ||
| 837 | return (*cipher != NULL); | ||
| 838 | } | ||
| 839 | |||
| 840 | static int | ||
| 841 | cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, | ||
| 842 | const int **nids, int nid) | ||
| 843 | { | ||
| 844 | if (!digest) | ||
| 845 | return (cryptodev_usable_digests(nids)); | ||
| 846 | |||
| 847 | switch (nid) { | ||
| 848 | case NID_md5: | ||
| 849 | *digest = NULL; /* need to make a clean md5 critter */ | ||
| 850 | break; | ||
| 851 | default: | ||
| 852 | *digest = NULL; | ||
| 853 | break; | ||
| 854 | } | ||
| 855 | return (*digest != NULL); | ||
| 856 | } | ||
| 857 | |||
| 858 | /* | ||
| 859 | * Convert a BIGNUM to the representation that /dev/crypto needs. | ||
| 860 | * Upon completion of use, the caller is responsible for freeing | ||
| 861 | * crp->crp_p. | ||
| 862 | */ | ||
| 863 | static int | ||
| 864 | bn2crparam(const BIGNUM *a, struct crparam *crp) | ||
| 865 | { | ||
| 866 | int i, j, k; | ||
| 867 | ssize_t bytes, bits; | ||
| 868 | u_char *b; | ||
| 869 | |||
| 870 | crp->crp_p = NULL; | ||
| 871 | crp->crp_nbits = 0; | ||
| 872 | |||
| 873 | bits = BN_num_bits(a); | ||
| 874 | bytes = (bits + 7) / 8; | ||
| 875 | |||
| 876 | b = malloc(bytes); | ||
| 877 | if (b == NULL) | ||
| 878 | return (1); | ||
| 879 | |||
| 880 | crp->crp_p = b; | ||
| 881 | crp->crp_nbits = bits; | ||
| 882 | |||
| 883 | for (i = 0, j = 0; i < a->top; i++) { | ||
| 884 | for (k = 0; k < BN_BITS2 / 8; k++) { | ||
| 885 | if ((j + k) >= bytes) | ||
| 886 | return (0); | ||
| 887 | b[j + k] = a->d[i] >> (k * 8); | ||
| 888 | } | ||
| 889 | j += BN_BITS2 / 8; | ||
| 890 | } | ||
| 891 | return (0); | ||
| 892 | } | ||
| 893 | |||
| 894 | /* Convert a /dev/crypto parameter to a BIGNUM */ | ||
| 895 | static int | ||
| 896 | crparam2bn(struct crparam *crp, BIGNUM *a) | ||
| 897 | { | ||
| 898 | u_int8_t *pd; | ||
| 899 | int i, bytes; | ||
| 900 | |||
| 901 | bytes = (crp->crp_nbits + 7) / 8; | ||
| 902 | |||
| 903 | if (bytes == 0) | ||
| 904 | return (-1); | ||
| 905 | |||
| 906 | if ((pd = (u_int8_t *) malloc(bytes)) == NULL) | ||
| 907 | return (-1); | ||
| 908 | |||
| 909 | for (i = 0; i < bytes; i++) | ||
| 910 | pd[i] = crp->crp_p[bytes - i - 1]; | ||
| 911 | |||
| 912 | BN_bin2bn(pd, bytes, a); | ||
| 913 | free(pd); | ||
| 914 | |||
| 915 | return (0); | ||
| 916 | } | ||
| 917 | |||
| 918 | static void | ||
| 919 | zapparams(struct crypt_kop *kop) | ||
| 920 | { | ||
| 921 | int i; | ||
| 922 | |||
| 923 | for (i = 0; i <= kop->crk_iparams + kop->crk_oparams; i++) { | ||
| 924 | if (kop->crk_param[i].crp_p) | ||
| 925 | free(kop->crk_param[i].crp_p); | ||
| 926 | kop->crk_param[i].crp_p = NULL; | ||
| 927 | kop->crk_param[i].crp_nbits = 0; | ||
| 928 | } | ||
| 929 | } | ||
| 930 | |||
| 931 | static int | ||
| 932 | cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s) | ||
| 933 | { | ||
| 934 | int fd, ret = -1; | ||
| 935 | |||
| 936 | if ((fd = get_asym_dev_crypto()) < 0) | ||
| 937 | return (ret); | ||
| 938 | |||
| 939 | if (r) { | ||
| 940 | kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char)); | ||
| 941 | kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8; | ||
| 942 | kop->crk_oparams++; | ||
| 943 | } | ||
| 944 | if (s) { | ||
| 945 | kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char)); | ||
| 946 | kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8; | ||
| 947 | kop->crk_oparams++; | ||
| 948 | } | ||
| 949 | |||
| 950 | if (ioctl(fd, CIOCKEY, kop) == 0) { | ||
| 951 | if (r) | ||
| 952 | crparam2bn(&kop->crk_param[kop->crk_iparams], r); | ||
| 953 | if (s) | ||
| 954 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); | ||
| 955 | ret = 0; | ||
| 956 | } | ||
| 957 | |||
| 958 | return (ret); | ||
| 959 | } | ||
| 960 | |||
| 961 | static int | ||
| 962 | cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
| 963 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) | ||
| 964 | { | ||
| 965 | struct crypt_kop kop; | ||
| 966 | int ret = 1; | ||
| 967 | |||
| 968 | /* Currently, we know we can do mod exp iff we can do any | ||
| 969 | * asymmetric operations at all. | ||
| 970 | */ | ||
| 971 | if (cryptodev_asymfeat == 0) { | ||
| 972 | ret = BN_mod_exp(r, a, p, m, ctx); | ||
| 973 | return (ret); | ||
| 974 | } | ||
| 975 | |||
| 976 | memset(&kop, 0, sizeof kop); | ||
| 977 | kop.crk_op = CRK_MOD_EXP; | ||
| 978 | |||
| 979 | /* inputs: a^p % m */ | ||
| 980 | if (bn2crparam(a, &kop.crk_param[0])) | ||
| 981 | goto err; | ||
| 982 | if (bn2crparam(p, &kop.crk_param[1])) | ||
| 983 | goto err; | ||
| 984 | if (bn2crparam(m, &kop.crk_param[2])) | ||
| 985 | goto err; | ||
| 986 | kop.crk_iparams = 3; | ||
| 987 | |||
| 988 | if (cryptodev_asym(&kop, BN_num_bytes(m), r, 0, NULL) == -1) { | ||
| 989 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 990 | ret = meth->bn_mod_exp(r, a, p, m, ctx, in_mont); | ||
| 991 | } | ||
| 992 | err: | ||
| 993 | zapparams(&kop); | ||
| 994 | return (ret); | ||
| 995 | } | ||
| 996 | |||
| 997 | static int | ||
| 998 | cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, | ||
| 999 | BN_CTX *ctx) | ||
| 1000 | { | ||
| 1001 | return (RSA_PKCS1_SSLeay()->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 1002 | } | ||
| 1003 | |||
| 1004 | static int | ||
| 1005 | cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | ||
| 1006 | { | ||
| 1007 | struct crypt_kop kop; | ||
| 1008 | int ret = 1; | ||
| 1009 | |||
| 1010 | if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) { | ||
| 1011 | /* XXX 0 means failure?? */ | ||
| 1012 | return (0); | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | memset(&kop, 0, sizeof kop); | ||
| 1016 | kop.crk_op = CRK_MOD_EXP_CRT; | ||
| 1017 | /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */ | ||
| 1018 | if (bn2crparam(rsa->p, &kop.crk_param[0])) | ||
| 1019 | goto err; | ||
| 1020 | if (bn2crparam(rsa->q, &kop.crk_param[1])) | ||
| 1021 | goto err; | ||
| 1022 | if (bn2crparam(I, &kop.crk_param[2])) | ||
| 1023 | goto err; | ||
| 1024 | if (bn2crparam(rsa->dmp1, &kop.crk_param[3])) | ||
| 1025 | goto err; | ||
| 1026 | if (bn2crparam(rsa->dmq1, &kop.crk_param[4])) | ||
| 1027 | goto err; | ||
| 1028 | if (bn2crparam(rsa->iqmp, &kop.crk_param[5])) | ||
| 1029 | goto err; | ||
| 1030 | kop.crk_iparams = 6; | ||
| 1031 | |||
| 1032 | if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL) == -1) { | ||
| 1033 | const RSA_METHOD *meth = RSA_PKCS1_SSLeay(); | ||
| 1034 | ret = (*meth->rsa_mod_exp)(r0, I, rsa, ctx); | ||
| 1035 | } | ||
| 1036 | err: | ||
| 1037 | zapparams(&kop); | ||
| 1038 | return (ret); | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | static RSA_METHOD cryptodev_rsa = { | ||
| 1042 | "cryptodev RSA method", | ||
| 1043 | NULL, /* rsa_pub_enc */ | ||
| 1044 | NULL, /* rsa_pub_dec */ | ||
| 1045 | NULL, /* rsa_priv_enc */ | ||
| 1046 | NULL, /* rsa_priv_dec */ | ||
| 1047 | NULL, | ||
| 1048 | NULL, | ||
| 1049 | NULL, /* init */ | ||
| 1050 | NULL, /* finish */ | ||
| 1051 | 0, /* flags */ | ||
| 1052 | NULL, /* app_data */ | ||
| 1053 | NULL, /* rsa_sign */ | ||
| 1054 | NULL /* rsa_verify */ | ||
| 1055 | }; | ||
| 1056 | |||
| 1057 | static int | ||
| 1058 | cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
| 1059 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) | ||
| 1060 | { | ||
| 1061 | return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx)); | ||
| 1062 | } | ||
| 1063 | |||
| 1064 | static int | ||
| 1065 | cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | ||
| 1066 | BIGNUM *u1, BIGNUM *pub_key, BIGNUM *u2, BIGNUM *p, | ||
| 1067 | BN_CTX *ctx, BN_MONT_CTX *mont) | ||
| 1068 | { | ||
| 1069 | BIGNUM t2; | ||
| 1070 | int ret = 0; | ||
| 1071 | |||
| 1072 | BN_init(&t2); | ||
| 1073 | |||
| 1074 | /* v = ( g^u1 * y^u2 mod p ) mod q */ | ||
| 1075 | /* let t1 = g ^ u1 mod p */ | ||
| 1076 | ret = 0; | ||
| 1077 | |||
| 1078 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) | ||
| 1079 | goto err; | ||
| 1080 | |||
| 1081 | /* let t2 = y ^ u2 mod p */ | ||
| 1082 | if (!dsa->meth->bn_mod_exp(dsa,&t2,dsa->pub_key,u2,dsa->p,ctx,mont)) | ||
| 1083 | goto err; | ||
| 1084 | /* let u1 = t1 * t2 mod p */ | ||
| 1085 | if (!BN_mod_mul(u1,t1,&t2,dsa->p,ctx)) | ||
| 1086 | goto err; | ||
| 1087 | |||
| 1088 | BN_copy(t1,u1); | ||
| 1089 | |||
| 1090 | ret = 1; | ||
| 1091 | err: | ||
| 1092 | BN_free(&t2); | ||
| 1093 | return(ret); | ||
| 1094 | } | ||
| 1095 | |||
| 1096 | static DSA_SIG * | ||
| 1097 | cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | ||
| 1098 | { | ||
| 1099 | struct crypt_kop kop; | ||
| 1100 | BIGNUM *r = NULL, *s = NULL; | ||
| 1101 | DSA_SIG *dsaret = NULL; | ||
| 1102 | |||
| 1103 | if ((r = BN_new()) == NULL) | ||
| 1104 | goto err; | ||
| 1105 | if ((s = BN_new()) == NULL) { | ||
| 1106 | BN_free(r); | ||
| 1107 | goto err; | ||
| 1108 | } | ||
| 1109 | |||
| 1110 | memset(&kop, 0, sizeof kop); | ||
| 1111 | kop.crk_op = CRK_DSA_SIGN; | ||
| 1112 | |||
| 1113 | /* inputs: dgst dsa->p dsa->q dsa->g dsa->priv_key */ | ||
| 1114 | kop.crk_param[0].crp_p = (caddr_t)dgst; | ||
| 1115 | kop.crk_param[0].crp_nbits = dlen * 8; | ||
| 1116 | if (bn2crparam(dsa->p, &kop.crk_param[1])) | ||
| 1117 | goto err; | ||
| 1118 | if (bn2crparam(dsa->q, &kop.crk_param[2])) | ||
| 1119 | goto err; | ||
| 1120 | if (bn2crparam(dsa->g, &kop.crk_param[3])) | ||
| 1121 | goto err; | ||
| 1122 | if (bn2crparam(dsa->priv_key, &kop.crk_param[4])) | ||
| 1123 | goto err; | ||
| 1124 | kop.crk_iparams = 5; | ||
| 1125 | |||
| 1126 | if (cryptodev_asym(&kop, BN_num_bytes(dsa->q), r, | ||
| 1127 | BN_num_bytes(dsa->q), s) == 0) { | ||
| 1128 | dsaret = DSA_SIG_new(); | ||
| 1129 | dsaret->r = r; | ||
| 1130 | dsaret->s = s; | ||
| 1131 | } else { | ||
| 1132 | const DSA_METHOD *meth = DSA_OpenSSL(); | ||
| 1133 | BN_free(r); | ||
| 1134 | BN_free(s); | ||
| 1135 | dsaret = (meth->dsa_do_sign)(dgst, dlen, dsa); | ||
| 1136 | } | ||
| 1137 | err: | ||
| 1138 | kop.crk_param[0].crp_p = NULL; | ||
| 1139 | zapparams(&kop); | ||
| 1140 | return (dsaret); | ||
| 1141 | } | ||
| 1142 | |||
| 1143 | static int | ||
| 1144 | cryptodev_dsa_verify(const unsigned char *dgst, int dlen, | ||
| 1145 | DSA_SIG *sig, DSA *dsa) | ||
| 1146 | { | ||
| 1147 | struct crypt_kop kop; | ||
| 1148 | int dsaret = 1; | ||
| 1149 | |||
| 1150 | memset(&kop, 0, sizeof kop); | ||
| 1151 | kop.crk_op = CRK_DSA_VERIFY; | ||
| 1152 | |||
| 1153 | /* inputs: dgst dsa->p dsa->q dsa->g dsa->pub_key sig->r sig->s */ | ||
| 1154 | kop.crk_param[0].crp_p = (caddr_t)dgst; | ||
| 1155 | kop.crk_param[0].crp_nbits = dlen * 8; | ||
| 1156 | if (bn2crparam(dsa->p, &kop.crk_param[1])) | ||
| 1157 | goto err; | ||
| 1158 | if (bn2crparam(dsa->q, &kop.crk_param[2])) | ||
| 1159 | goto err; | ||
| 1160 | if (bn2crparam(dsa->g, &kop.crk_param[3])) | ||
| 1161 | goto err; | ||
| 1162 | if (bn2crparam(dsa->pub_key, &kop.crk_param[4])) | ||
| 1163 | goto err; | ||
| 1164 | if (bn2crparam(sig->r, &kop.crk_param[5])) | ||
| 1165 | goto err; | ||
| 1166 | if (bn2crparam(sig->s, &kop.crk_param[6])) | ||
| 1167 | goto err; | ||
| 1168 | kop.crk_iparams = 7; | ||
| 1169 | |||
| 1170 | if (cryptodev_asym(&kop, 0, NULL, 0, NULL) == 0) { | ||
| 1171 | dsaret = kop.crk_status; | ||
| 1172 | } else { | ||
| 1173 | const DSA_METHOD *meth = DSA_OpenSSL(); | ||
| 1174 | |||
| 1175 | dsaret = (meth->dsa_do_verify)(dgst, dlen, sig, dsa); | ||
| 1176 | } | ||
| 1177 | err: | ||
| 1178 | kop.crk_param[0].crp_p = NULL; | ||
| 1179 | zapparams(&kop); | ||
| 1180 | return (dsaret); | ||
| 1181 | } | ||
| 1182 | |||
| 1183 | static DSA_METHOD cryptodev_dsa = { | ||
| 1184 | "cryptodev DSA method", | ||
| 1185 | NULL, | ||
| 1186 | NULL, /* dsa_sign_setup */ | ||
| 1187 | NULL, | ||
| 1188 | NULL, /* dsa_mod_exp */ | ||
| 1189 | NULL, | ||
| 1190 | NULL, /* init */ | ||
| 1191 | NULL, /* finish */ | ||
| 1192 | 0, /* flags */ | ||
| 1193 | NULL /* app_data */ | ||
| 1194 | }; | ||
| 1195 | |||
| 1196 | static int | ||
| 1197 | cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a, | ||
| 1198 | const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, | ||
| 1199 | BN_MONT_CTX *m_ctx) | ||
| 1200 | { | ||
| 1201 | return (cryptodev_bn_mod_exp(r, a, p, m, ctx, m_ctx)); | ||
| 1202 | } | ||
| 1203 | |||
| 1204 | static int | ||
| 1205 | cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) | ||
| 1206 | { | ||
| 1207 | struct crypt_kop kop; | ||
| 1208 | int dhret = 1; | ||
| 1209 | int fd, keylen; | ||
| 1210 | |||
| 1211 | if ((fd = get_asym_dev_crypto()) < 0) { | ||
| 1212 | const DH_METHOD *meth = DH_OpenSSL(); | ||
| 1213 | |||
| 1214 | return ((meth->compute_key)(key, pub_key, dh)); | ||
| 1215 | } | ||
| 1216 | |||
| 1217 | keylen = BN_num_bits(dh->p); | ||
| 1218 | |||
| 1219 | memset(&kop, 0, sizeof kop); | ||
| 1220 | kop.crk_op = CRK_DH_COMPUTE_KEY; | ||
| 1221 | |||
| 1222 | /* inputs: dh->priv_key pub_key dh->p key */ | ||
| 1223 | if (bn2crparam(dh->priv_key, &kop.crk_param[0])) | ||
| 1224 | goto err; | ||
| 1225 | if (bn2crparam(pub_key, &kop.crk_param[1])) | ||
| 1226 | goto err; | ||
| 1227 | if (bn2crparam(dh->p, &kop.crk_param[2])) | ||
| 1228 | goto err; | ||
| 1229 | kop.crk_iparams = 3; | ||
| 1230 | |||
| 1231 | kop.crk_param[3].crp_p = key; | ||
| 1232 | kop.crk_param[3].crp_nbits = keylen * 8; | ||
| 1233 | kop.crk_oparams = 1; | ||
| 1234 | |||
| 1235 | if (ioctl(fd, CIOCKEY, &kop) == -1) { | ||
| 1236 | const DH_METHOD *meth = DH_OpenSSL(); | ||
| 1237 | |||
| 1238 | dhret = (meth->compute_key)(key, pub_key, dh); | ||
| 1239 | } | ||
| 1240 | err: | ||
| 1241 | kop.crk_param[3].crp_p = NULL; | ||
| 1242 | zapparams(&kop); | ||
| 1243 | return (dhret); | ||
| 1244 | } | ||
| 1245 | |||
| 1246 | static DH_METHOD cryptodev_dh = { | ||
| 1247 | "cryptodev DH method", | ||
| 1248 | NULL, /* cryptodev_dh_generate_key */ | ||
| 1249 | NULL, | ||
| 1250 | NULL, | ||
| 1251 | NULL, | ||
| 1252 | NULL, | ||
| 1253 | 0, /* flags */ | ||
| 1254 | NULL /* app_data */ | ||
| 1255 | }; | ||
| 1256 | |||
| 1257 | /* | ||
| 1258 | * ctrl right now is just a wrapper that doesn't do much | ||
| 1259 | * but I expect we'll want some options soon. | ||
| 1260 | */ | ||
| 1261 | static int | ||
| 1262 | cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | ||
| 1263 | { | ||
| 1264 | #ifdef HAVE_SYSLOG_R | ||
| 1265 | struct syslog_data sd = SYSLOG_DATA_INIT; | ||
| 1266 | #endif | ||
| 1267 | |||
| 1268 | switch (cmd) { | ||
| 1269 | default: | ||
| 1270 | #ifdef HAVE_SYSLOG_R | ||
| 1271 | syslog_r(LOG_ERR, &sd, | ||
| 1272 | "cryptodev_ctrl: unknown command %d", cmd); | ||
| 1273 | #else | ||
| 1274 | syslog(LOG_ERR, "cryptodev_ctrl: unknown command %d", cmd); | ||
| 1275 | #endif | ||
| 1276 | break; | ||
| 1277 | } | ||
| 1278 | return (1); | ||
| 1279 | } | ||
| 1280 | |||
| 1281 | void | ||
| 1282 | ENGINE_load_cryptodev(void) | ||
| 1283 | { | ||
| 1284 | ENGINE *engine = ENGINE_new(); | ||
| 1285 | int fd; | ||
| 1286 | |||
| 1287 | if (engine == NULL) | ||
| 1288 | return; | ||
| 1289 | if ((fd = get_dev_crypto()) < 0) { | ||
| 1290 | ENGINE_free(engine); | ||
| 1291 | return; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | /* | ||
| 1295 | * find out what asymmetric crypto algorithms we support | ||
| 1296 | */ | ||
| 1297 | if (ioctl(fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | ||
| 1298 | close(fd); | ||
| 1299 | ENGINE_free(engine); | ||
| 1300 | return; | ||
| 1301 | } | ||
| 1302 | close(fd); | ||
| 1303 | |||
| 1304 | if (!ENGINE_set_id(engine, "cryptodev") || | ||
| 1305 | !ENGINE_set_name(engine, "BSD cryptodev engine") || | ||
| 1306 | !ENGINE_set_ciphers(engine, cryptodev_engine_ciphers) || | ||
| 1307 | !ENGINE_set_digests(engine, cryptodev_engine_digests) || | ||
| 1308 | !ENGINE_set_ctrl_function(engine, cryptodev_ctrl) || | ||
| 1309 | !ENGINE_set_cmd_defns(engine, cryptodev_defns)) { | ||
| 1310 | ENGINE_free(engine); | ||
| 1311 | return; | ||
| 1312 | } | ||
| 1313 | |||
| 1314 | if (ENGINE_set_RSA(engine, &cryptodev_rsa)) { | ||
| 1315 | const RSA_METHOD *rsa_meth = RSA_PKCS1_SSLeay(); | ||
| 1316 | |||
| 1317 | cryptodev_rsa.bn_mod_exp = rsa_meth->bn_mod_exp; | ||
| 1318 | cryptodev_rsa.rsa_mod_exp = rsa_meth->rsa_mod_exp; | ||
| 1319 | cryptodev_rsa.rsa_pub_enc = rsa_meth->rsa_pub_enc; | ||
| 1320 | cryptodev_rsa.rsa_pub_dec = rsa_meth->rsa_pub_dec; | ||
| 1321 | cryptodev_rsa.rsa_priv_enc = rsa_meth->rsa_priv_enc; | ||
| 1322 | cryptodev_rsa.rsa_priv_dec = rsa_meth->rsa_priv_dec; | ||
| 1323 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
| 1324 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; | ||
| 1325 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) | ||
| 1326 | cryptodev_rsa.rsa_mod_exp = | ||
| 1327 | cryptodev_rsa_mod_exp; | ||
| 1328 | else | ||
| 1329 | cryptodev_rsa.rsa_mod_exp = | ||
| 1330 | cryptodev_rsa_nocrt_mod_exp; | ||
| 1331 | } | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { | ||
| 1335 | const DSA_METHOD *meth = DSA_OpenSSL(); | ||
| 1336 | |||
| 1337 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); | ||
| 1338 | if (cryptodev_asymfeat & CRF_DSA_SIGN) | ||
| 1339 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; | ||
| 1340 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
| 1341 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; | ||
| 1342 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; | ||
| 1343 | } | ||
| 1344 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) | ||
| 1345 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; | ||
| 1346 | } | ||
| 1347 | |||
| 1348 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ | ||
| 1349 | const DH_METHOD *dh_meth = DH_OpenSSL(); | ||
| 1350 | |||
| 1351 | cryptodev_dh.generate_key = dh_meth->generate_key; | ||
| 1352 | cryptodev_dh.compute_key = dh_meth->compute_key; | ||
| 1353 | cryptodev_dh.bn_mod_exp = dh_meth->bn_mod_exp; | ||
| 1354 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | ||
| 1355 | cryptodev_dh.bn_mod_exp = cryptodev_mod_exp_dh; | ||
| 1356 | if (cryptodev_asymfeat & CRF_DH_COMPUTE_KEY) | ||
| 1357 | cryptodev_dh.compute_key = | ||
| 1358 | cryptodev_dh_compute_key; | ||
| 1359 | } | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | ENGINE_add(engine); | ||
| 1363 | ENGINE_free(engine); | ||
| 1364 | ERR_clear_error(); | ||
| 1365 | } | ||
| 1366 | |||
| 1367 | #endif /* HAVE_CRYPTODEV */ | ||
diff --git a/src/lib/libcrypto/err/Makefile b/src/lib/libcrypto/err/Makefile new file mode 100644 index 0000000000..862b23ba17 --- /dev/null +++ b/src/lib/libcrypto/err/Makefile | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/err/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= err | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=err.c err_all.c err_prn.c | ||
| 21 | LIBOBJ=err.o err_all.o err_prn.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= err.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 78 | err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 79 | err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 80 | err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 81 | err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 82 | err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 83 | err.o: ../cryptlib.h err.c | ||
| 84 | err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 85 | err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 86 | err_all.o: ../../include/openssl/cms.h ../../include/openssl/comp.h | ||
| 87 | err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 88 | err_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 89 | err_all.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 90 | err_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 91 | err_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 92 | err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 93 | err_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 94 | err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 95 | err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 96 | err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h | ||
| 97 | err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 98 | err_all.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 99 | err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 100 | err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 101 | err_all.o: ../../include/openssl/ts.h ../../include/openssl/ui.h | ||
| 102 | err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 103 | err_all.o: ../../include/openssl/x509v3.h err_all.c | ||
| 104 | err_prn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 105 | err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 106 | err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 107 | err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 108 | err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 109 | err_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 110 | err_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h err_prn.c | ||
diff --git a/src/lib/libcrypto/evp/Makefile b/src/lib/libcrypto/evp/Makefile new file mode 100644 index 0000000000..82825e5299 --- /dev/null +++ b/src/lib/libcrypto/evp/Makefile | |||
| @@ -0,0 +1,733 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/evp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= evp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=evp_test.c | ||
| 17 | TESTDATA=evptests.txt | ||
| 18 | APPS= | ||
| 19 | |||
| 20 | LIB=$(TOP)/libcrypto.a | ||
| 21 | LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \ | ||
| 22 | e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c\ | ||
| 23 | e_rc4.c e_aes.c names.c e_seed.c \ | ||
| 24 | e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \ | ||
| 25 | m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c \ | ||
| 26 | m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\ | ||
| 27 | p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \ | ||
| 28 | bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \ | ||
| 29 | c_all.c c_allc.c c_alld.c evp_lib.c bio_ok.c \ | ||
| 30 | evp_pkey.c evp_pbe.c p5_crpt.c p5_crpt2.c \ | ||
| 31 | e_old.c pmeth_lib.c pmeth_fn.c pmeth_gn.c m_sigver.c | ||
| 32 | |||
| 33 | LIBOBJ= encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \ | ||
| 34 | e_des.o e_bf.o e_idea.o e_des3.o e_camellia.o\ | ||
| 35 | e_rc4.o e_aes.o names.o e_seed.o \ | ||
| 36 | e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \ | ||
| 37 | m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o m_wp.o \ | ||
| 38 | m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\ | ||
| 39 | p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \ | ||
| 40 | bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \ | ||
| 41 | c_all.o c_allc.o c_alld.o evp_lib.o bio_ok.o \ | ||
| 42 | evp_pkey.o evp_pbe.o p5_crpt.o p5_crpt2.o \ | ||
| 43 | e_old.o pmeth_lib.o pmeth_fn.o pmeth_gn.o m_sigver.o | ||
| 44 | |||
| 45 | SRC= $(LIBSRC) | ||
| 46 | |||
| 47 | EXHEADER= evp.h | ||
| 48 | HEADER= evp_locl.h $(EXHEADER) | ||
| 49 | |||
| 50 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 51 | |||
| 52 | top: | ||
| 53 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 54 | |||
| 55 | all: lib | ||
| 56 | |||
| 57 | lib: $(LIBOBJ) | ||
| 58 | $(AR) $(LIB) $(LIBOBJ) | ||
| 59 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 60 | @touch lib | ||
| 61 | |||
| 62 | files: | ||
| 63 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 64 | |||
| 65 | links: | ||
| 66 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 67 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 68 | cp $(TESTDATA) ../../test | ||
| 69 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 70 | |||
| 71 | install: | ||
| 72 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 73 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 74 | do \ | ||
| 75 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 76 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 77 | done; | ||
| 78 | |||
| 79 | tags: | ||
| 80 | ctags $(SRC) | ||
| 81 | |||
| 82 | tests: | ||
| 83 | |||
| 84 | lint: | ||
| 85 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 86 | |||
| 87 | depend: | ||
| 88 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 89 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 90 | |||
| 91 | dclean: | ||
| 92 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 93 | mv -f Makefile.new $(MAKEFILE) | ||
| 94 | |||
| 95 | clean: | ||
| 96 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 97 | |||
| 98 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 99 | |||
| 100 | bio_b64.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 101 | bio_b64.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 102 | bio_b64.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 103 | bio_b64.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 104 | bio_b64.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 105 | bio_b64.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 106 | bio_b64.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 107 | bio_b64.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 108 | bio_b64.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_b64.c | ||
| 109 | bio_enc.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 110 | bio_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 111 | bio_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 112 | bio_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 113 | bio_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 114 | bio_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 115 | bio_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 116 | bio_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 117 | bio_enc.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_enc.c | ||
| 118 | bio_md.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 119 | bio_md.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 120 | bio_md.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 121 | bio_md.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 122 | bio_md.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 123 | bio_md.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 124 | bio_md.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 125 | bio_md.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 126 | bio_md.o: ../cryptlib.h bio_md.c | ||
| 127 | bio_ok.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 128 | bio_ok.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 129 | bio_ok.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 130 | bio_ok.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 131 | bio_ok.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 132 | bio_ok.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 133 | bio_ok.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 134 | bio_ok.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 135 | bio_ok.o: ../../include/openssl/symhacks.h ../cryptlib.h bio_ok.c | ||
| 136 | c_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 137 | c_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 138 | c_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 139 | c_all.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 140 | c_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 141 | c_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 142 | c_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 143 | c_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 144 | c_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 145 | c_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 146 | c_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 147 | c_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 148 | c_all.o: ../cryptlib.h c_all.c | ||
| 149 | c_allc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 150 | c_allc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 151 | c_allc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 152 | c_allc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 153 | c_allc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 154 | c_allc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 155 | c_allc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 156 | c_allc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 157 | c_allc.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 158 | c_allc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 159 | c_allc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 160 | c_allc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 161 | c_allc.o: ../cryptlib.h c_allc.c | ||
| 162 | c_alld.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 163 | c_alld.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 164 | c_alld.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 165 | c_alld.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 166 | c_alld.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 167 | c_alld.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 168 | c_alld.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 169 | c_alld.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 170 | c_alld.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 171 | c_alld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 172 | c_alld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 173 | c_alld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 174 | c_alld.o: ../cryptlib.h c_alld.c | ||
| 175 | digest.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 176 | digest.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 177 | digest.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 178 | digest.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 179 | digest.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 180 | digest.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 181 | digest.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 182 | digest.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 183 | digest.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 184 | digest.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 185 | digest.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 186 | digest.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 187 | digest.o: ../cryptlib.h digest.c | ||
| 188 | e_aes.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 189 | e_aes.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 190 | e_aes.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 191 | e_aes.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 192 | e_aes.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 193 | e_aes.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 194 | e_aes.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 195 | e_aes.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h e_aes.c | ||
| 196 | e_aes.o: evp_locl.h | ||
| 197 | e_bf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 198 | e_bf.o: ../../include/openssl/blowfish.h ../../include/openssl/buffer.h | ||
| 199 | e_bf.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 200 | e_bf.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 201 | e_bf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 202 | e_bf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 203 | e_bf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 204 | e_bf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 205 | e_bf.o: ../../include/openssl/symhacks.h ../cryptlib.h e_bf.c evp_locl.h | ||
| 206 | e_camellia.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 207 | e_camellia.o: ../../include/openssl/camellia.h ../../include/openssl/crypto.h | ||
| 208 | e_camellia.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 209 | e_camellia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 210 | e_camellia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 211 | e_camellia.o: ../../include/openssl/opensslconf.h | ||
| 212 | e_camellia.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 213 | e_camellia.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 214 | e_camellia.o: ../../include/openssl/symhacks.h e_camellia.c evp_locl.h | ||
| 215 | e_cast.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 216 | e_cast.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
| 217 | e_cast.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 218 | e_cast.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 219 | e_cast.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 220 | e_cast.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 221 | e_cast.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 222 | e_cast.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 223 | e_cast.o: ../../include/openssl/symhacks.h ../cryptlib.h e_cast.c evp_locl.h | ||
| 224 | e_des.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 225 | e_des.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 226 | e_des.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 227 | e_des.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 228 | e_des.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 229 | e_des.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 230 | e_des.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 231 | e_des.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 232 | e_des.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 233 | e_des.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 234 | e_des.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des.c evp_locl.h | ||
| 235 | e_des3.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 236 | e_des3.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 237 | e_des3.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 238 | e_des3.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 239 | e_des3.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 240 | e_des3.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 241 | e_des3.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 242 | e_des3.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 243 | e_des3.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 244 | e_des3.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 245 | e_des3.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_des3.c evp_locl.h | ||
| 246 | e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 247 | e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 248 | e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 249 | e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 250 | e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 251 | e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 252 | e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 253 | e_idea.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 254 | e_idea.o: ../../include/openssl/symhacks.h ../cryptlib.h e_idea.c evp_locl.h | ||
| 255 | e_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 256 | e_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 257 | e_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 258 | e_null.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 259 | e_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 260 | e_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 261 | e_null.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 262 | e_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 263 | e_null.o: ../cryptlib.h e_null.c | ||
| 264 | e_old.o: e_old.c | ||
| 265 | e_rc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 266 | e_rc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 267 | e_rc2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 268 | e_rc2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 269 | e_rc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 270 | e_rc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 271 | e_rc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc2.h | ||
| 272 | e_rc2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 273 | e_rc2.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc2.c evp_locl.h | ||
| 274 | e_rc4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 275 | e_rc4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 276 | e_rc4.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 277 | e_rc4.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 278 | e_rc4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 279 | e_rc4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 280 | e_rc4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rc4.h | ||
| 281 | e_rc4.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 282 | e_rc4.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc4.c | ||
| 283 | e_rc5.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 284 | e_rc5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 285 | e_rc5.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 286 | e_rc5.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 287 | e_rc5.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 288 | e_rc5.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 289 | e_rc5.o: ../../include/openssl/symhacks.h ../cryptlib.h e_rc5.c | ||
| 290 | e_seed.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 291 | e_seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 292 | e_seed.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 293 | e_seed.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 294 | e_seed.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 295 | e_seed.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 296 | e_seed.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 297 | e_seed.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 298 | e_seed.o: e_seed.c evp_locl.h | ||
| 299 | e_xcbc_d.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 300 | e_xcbc_d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 301 | e_xcbc_d.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 302 | e_xcbc_d.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 303 | e_xcbc_d.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 304 | e_xcbc_d.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 305 | e_xcbc_d.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 306 | e_xcbc_d.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 307 | e_xcbc_d.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 308 | e_xcbc_d.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 309 | e_xcbc_d.o: ../../include/openssl/ui_compat.h ../cryptlib.h e_xcbc_d.c | ||
| 310 | e_xcbc_d.o: evp_locl.h | ||
| 311 | encode.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 312 | encode.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 313 | encode.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 314 | encode.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 315 | encode.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 316 | encode.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 317 | encode.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 318 | encode.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 319 | encode.o: ../cryptlib.h encode.c | ||
| 320 | evp_acnf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 321 | evp_acnf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 322 | evp_acnf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 323 | evp_acnf.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 324 | evp_acnf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 325 | evp_acnf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 326 | evp_acnf.o: ../../include/openssl/opensslconf.h | ||
| 327 | evp_acnf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 328 | evp_acnf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 329 | evp_acnf.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_acnf.c | ||
| 330 | evp_enc.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 331 | evp_enc.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 332 | evp_enc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 333 | evp_enc.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 334 | evp_enc.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 335 | evp_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 336 | evp_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 337 | evp_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 338 | evp_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 339 | evp_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 340 | evp_enc.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 341 | evp_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 342 | evp_enc.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 343 | evp_enc.o: ../cryptlib.h evp_enc.c evp_locl.h | ||
| 344 | evp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 345 | evp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 346 | evp_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 347 | evp_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 348 | evp_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 349 | evp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 350 | evp_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 351 | evp_err.o: ../../include/openssl/symhacks.h evp_err.c | ||
| 352 | evp_key.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 353 | evp_key.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 354 | evp_key.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 355 | evp_key.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 356 | evp_key.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 357 | evp_key.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 358 | evp_key.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 359 | evp_key.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 360 | evp_key.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 361 | evp_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 362 | evp_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 363 | evp_key.o: ../../include/openssl/ui.h ../../include/openssl/x509.h | ||
| 364 | evp_key.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_key.c | ||
| 365 | evp_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 366 | evp_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 367 | evp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 368 | evp_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 369 | evp_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 370 | evp_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 371 | evp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 372 | evp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 373 | evp_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_lib.c | ||
| 374 | evp_pbe.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 375 | evp_pbe.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 376 | evp_pbe.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 377 | evp_pbe.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 378 | evp_pbe.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 379 | evp_pbe.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 380 | evp_pbe.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 381 | evp_pbe.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 382 | evp_pbe.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 383 | evp_pbe.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 384 | evp_pbe.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 385 | evp_pbe.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 386 | evp_pbe.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_pbe.c | ||
| 387 | evp_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 388 | evp_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 389 | evp_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 390 | evp_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 391 | evp_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 392 | evp_pkey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 393 | evp_pkey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 394 | evp_pkey.o: ../../include/openssl/opensslconf.h | ||
| 395 | evp_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 396 | evp_pkey.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 397 | evp_pkey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 398 | evp_pkey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 399 | evp_pkey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 400 | evp_pkey.o: ../asn1/asn1_locl.h ../cryptlib.h evp_pkey.c | ||
| 401 | m_dss.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 402 | m_dss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 403 | m_dss.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 404 | m_dss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 405 | m_dss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 406 | m_dss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 407 | m_dss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 408 | m_dss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 409 | m_dss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 410 | m_dss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 411 | m_dss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 412 | m_dss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 413 | m_dss.o: ../cryptlib.h m_dss.c | ||
| 414 | m_dss1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 415 | m_dss1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 416 | m_dss1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 417 | m_dss1.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 418 | m_dss1.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 419 | m_dss1.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 420 | m_dss1.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 421 | m_dss1.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 422 | m_dss1.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 423 | m_dss1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 424 | m_dss1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 425 | m_dss1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 426 | m_dss1.o: ../cryptlib.h m_dss1.c | ||
| 427 | m_ecdsa.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 428 | m_ecdsa.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 429 | m_ecdsa.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 430 | m_ecdsa.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 431 | m_ecdsa.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 432 | m_ecdsa.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 433 | m_ecdsa.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 434 | m_ecdsa.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 435 | m_ecdsa.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 436 | m_ecdsa.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 437 | m_ecdsa.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 438 | m_ecdsa.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 439 | m_ecdsa.o: ../cryptlib.h m_ecdsa.c | ||
| 440 | m_md2.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 441 | m_md2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 442 | m_md2.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 443 | m_md2.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 444 | m_md2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 445 | m_md2.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 446 | m_md2.o: ../../include/openssl/symhacks.h ../cryptlib.h m_md2.c | ||
| 447 | m_md4.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 448 | m_md4.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 449 | m_md4.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 450 | m_md4.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 451 | m_md4.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 452 | m_md4.o: ../../include/openssl/lhash.h ../../include/openssl/md4.h | ||
| 453 | m_md4.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 454 | m_md4.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 455 | m_md4.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 456 | m_md4.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 457 | m_md4.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 458 | m_md4.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 459 | m_md4.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md4.c | ||
| 460 | m_md5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 461 | m_md5.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 462 | m_md5.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 463 | m_md5.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 464 | m_md5.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 465 | m_md5.o: ../../include/openssl/lhash.h ../../include/openssl/md5.h | ||
| 466 | m_md5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 467 | m_md5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 468 | m_md5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 469 | m_md5.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 470 | m_md5.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 471 | m_md5.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 472 | m_md5.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_md5.c | ||
| 473 | m_mdc2.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 474 | m_mdc2.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 475 | m_mdc2.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 476 | m_mdc2.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 477 | m_mdc2.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 478 | m_mdc2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 479 | m_mdc2.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h | ||
| 480 | m_mdc2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 481 | m_mdc2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 482 | m_mdc2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 483 | m_mdc2.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 484 | m_mdc2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 485 | m_mdc2.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 486 | m_mdc2.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 487 | m_mdc2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_mdc2.c | ||
| 488 | m_null.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 489 | m_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 490 | m_null.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 491 | m_null.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 492 | m_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 493 | m_null.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 494 | m_null.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 495 | m_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 496 | m_null.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 497 | m_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 498 | m_null.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 499 | m_null.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_null.c | ||
| 500 | m_ripemd.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 501 | m_ripemd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 502 | m_ripemd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 503 | m_ripemd.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 504 | m_ripemd.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 505 | m_ripemd.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 506 | m_ripemd.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 507 | m_ripemd.o: ../../include/openssl/opensslconf.h | ||
| 508 | m_ripemd.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 509 | m_ripemd.o: ../../include/openssl/pkcs7.h ../../include/openssl/ripemd.h | ||
| 510 | m_ripemd.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 511 | m_ripemd.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 512 | m_ripemd.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 513 | m_ripemd.o: ../../include/openssl/x509_vfy.h ../cryptlib.h m_ripemd.c | ||
| 514 | m_sha.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 515 | m_sha.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 516 | m_sha.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 517 | m_sha.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 518 | m_sha.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 519 | m_sha.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 520 | m_sha.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 521 | m_sha.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 522 | m_sha.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 523 | m_sha.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 524 | m_sha.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 525 | m_sha.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 526 | m_sha.o: ../cryptlib.h m_sha.c | ||
| 527 | m_sha1.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 528 | m_sha1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 529 | m_sha1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 530 | m_sha1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 531 | m_sha1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 532 | m_sha1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 533 | m_sha1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 534 | m_sha1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 535 | m_sha1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 536 | m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 537 | m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 538 | m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 539 | m_sha1.o: ../cryptlib.h m_sha1.c | ||
| 540 | m_sigver.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 541 | m_sigver.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 542 | m_sigver.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 543 | m_sigver.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 544 | m_sigver.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 545 | m_sigver.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 546 | m_sigver.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 547 | m_sigver.o: ../../include/openssl/opensslconf.h | ||
| 548 | m_sigver.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 549 | m_sigver.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 550 | m_sigver.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 551 | m_sigver.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 552 | m_sigver.o: ../../include/openssl/x509_vfy.h ../cryptlib.h evp_locl.h | ||
| 553 | m_sigver.o: m_sigver.c | ||
| 554 | m_wp.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 555 | m_wp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 556 | m_wp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 557 | m_wp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 558 | m_wp.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 559 | m_wp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 560 | m_wp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 561 | m_wp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 562 | m_wp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 563 | m_wp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 564 | m_wp.o: ../../include/openssl/symhacks.h ../../include/openssl/whrlpool.h | ||
| 565 | m_wp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 566 | m_wp.o: ../cryptlib.h m_wp.c | ||
| 567 | names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 568 | names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 569 | names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 570 | names.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 571 | names.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 572 | names.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 573 | names.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 574 | names.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 575 | names.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 576 | names.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 577 | names.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 578 | names.o: ../../include/openssl/x509_vfy.h ../cryptlib.h names.c | ||
| 579 | p5_crpt.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 580 | p5_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 581 | p5_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 582 | p5_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 583 | p5_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 584 | p5_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 585 | p5_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 586 | p5_crpt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 587 | p5_crpt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 588 | p5_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 589 | p5_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 590 | p5_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 591 | p5_crpt.o: ../cryptlib.h p5_crpt.c | ||
| 592 | p5_crpt2.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 593 | p5_crpt2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 594 | p5_crpt2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 595 | p5_crpt2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 596 | p5_crpt2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 597 | p5_crpt2.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h | ||
| 598 | p5_crpt2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 599 | p5_crpt2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 600 | p5_crpt2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 601 | p5_crpt2.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 602 | p5_crpt2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 603 | p5_crpt2.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 604 | p5_crpt2.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p5_crpt2.c | ||
| 605 | p_dec.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 606 | p_dec.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 607 | p_dec.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 608 | p_dec.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 609 | p_dec.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 610 | p_dec.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 611 | p_dec.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 612 | p_dec.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 613 | p_dec.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 614 | p_dec.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 615 | p_dec.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 616 | p_dec.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 617 | p_dec.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_dec.c | ||
| 618 | p_enc.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 619 | p_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 620 | p_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 621 | p_enc.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 622 | p_enc.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 623 | p_enc.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 624 | p_enc.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 625 | p_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 626 | p_enc.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 627 | p_enc.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 628 | p_enc.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 629 | p_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 630 | p_enc.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_enc.c | ||
| 631 | p_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 632 | p_lib.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
| 633 | p_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 634 | p_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 635 | p_lib.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 636 | p_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 637 | p_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 638 | p_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 639 | p_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 640 | p_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 641 | p_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 642 | p_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 643 | p_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 644 | p_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 645 | p_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 646 | p_lib.o: ../asn1/asn1_locl.h ../cryptlib.h p_lib.c | ||
| 647 | p_open.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 648 | p_open.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 649 | p_open.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 650 | p_open.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 651 | p_open.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 652 | p_open.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 653 | p_open.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 654 | p_open.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 655 | p_open.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 656 | p_open.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 657 | p_open.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 658 | p_open.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 659 | p_open.o: ../cryptlib.h p_open.c | ||
| 660 | p_seal.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 661 | p_seal.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 662 | p_seal.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 663 | p_seal.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 664 | p_seal.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 665 | p_seal.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 666 | p_seal.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 667 | p_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 668 | p_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 669 | p_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 670 | p_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 671 | p_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 672 | p_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_seal.c | ||
| 673 | p_sign.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 674 | p_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 675 | p_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 676 | p_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 677 | p_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 678 | p_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 679 | p_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 680 | p_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 681 | p_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 682 | p_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 683 | p_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 684 | p_sign.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_sign.c | ||
| 685 | p_verify.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 686 | p_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 687 | p_verify.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 688 | p_verify.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 689 | p_verify.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 690 | p_verify.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 691 | p_verify.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 692 | p_verify.o: ../../include/openssl/opensslconf.h | ||
| 693 | p_verify.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 694 | p_verify.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 695 | p_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 696 | p_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 697 | p_verify.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p_verify.c | ||
| 698 | pmeth_fn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 699 | pmeth_fn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 700 | pmeth_fn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 701 | pmeth_fn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 702 | pmeth_fn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 703 | pmeth_fn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 704 | pmeth_fn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 705 | pmeth_fn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 706 | pmeth_fn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h | ||
| 707 | pmeth_fn.o: pmeth_fn.c | ||
| 708 | pmeth_gn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 709 | pmeth_gn.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 710 | pmeth_gn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 711 | pmeth_gn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 712 | pmeth_gn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 713 | pmeth_gn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 714 | pmeth_gn.o: ../../include/openssl/opensslconf.h | ||
| 715 | pmeth_gn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 716 | pmeth_gn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 717 | pmeth_gn.o: ../../include/openssl/symhacks.h ../cryptlib.h evp_locl.h | ||
| 718 | pmeth_gn.o: pmeth_gn.c | ||
| 719 | pmeth_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 720 | pmeth_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 721 | pmeth_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 722 | pmeth_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 723 | pmeth_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 724 | pmeth_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 725 | pmeth_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 726 | pmeth_lib.o: ../../include/openssl/objects.h | ||
| 727 | pmeth_lib.o: ../../include/openssl/opensslconf.h | ||
| 728 | pmeth_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 729 | pmeth_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 730 | pmeth_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 731 | pmeth_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 732 | pmeth_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 733 | pmeth_lib.o: evp_locl.h pmeth_lib.c | ||
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c new file mode 100644 index 0000000000..98bc1ab409 --- /dev/null +++ b/src/lib/libcrypto/evp/bio_ok.c | |||
| @@ -0,0 +1,575 @@ | |||
| 1 | /* crypto/evp/bio_ok.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* | ||
| 60 | From: Arne Ansper <arne@cyber.ee> | ||
| 61 | |||
| 62 | Why BIO_f_reliable? | ||
| 63 | |||
| 64 | I wrote function which took BIO* as argument, read data from it | ||
| 65 | and processed it. Then I wanted to store the input file in | ||
| 66 | encrypted form. OK I pushed BIO_f_cipher to the BIO stack | ||
| 67 | and everything was OK. BUT if user types wrong password | ||
| 68 | BIO_f_cipher outputs only garbage and my function crashes. Yes | ||
| 69 | I can and I should fix my function, but BIO_f_cipher is | ||
| 70 | easy way to add encryption support to many existing applications | ||
| 71 | and it's hard to debug and fix them all. | ||
| 72 | |||
| 73 | So I wanted another BIO which would catch the incorrect passwords and | ||
| 74 | file damages which cause garbage on BIO_f_cipher's output. | ||
| 75 | |||
| 76 | The easy way is to push the BIO_f_md and save the checksum at | ||
| 77 | the end of the file. However there are several problems with this | ||
| 78 | approach: | ||
| 79 | |||
| 80 | 1) you must somehow separate checksum from actual data. | ||
| 81 | 2) you need lot's of memory when reading the file, because you | ||
| 82 | must read to the end of the file and verify the checksum before | ||
| 83 | letting the application to read the data. | ||
| 84 | |||
| 85 | BIO_f_reliable tries to solve both problems, so that you can | ||
| 86 | read and write arbitrary long streams using only fixed amount | ||
| 87 | of memory. | ||
| 88 | |||
| 89 | BIO_f_reliable splits data stream into blocks. Each block is prefixed | ||
| 90 | with it's length and suffixed with it's digest. So you need only | ||
| 91 | several Kbytes of memory to buffer single block before verifying | ||
| 92 | it's digest. | ||
| 93 | |||
| 94 | BIO_f_reliable goes further and adds several important capabilities: | ||
| 95 | |||
| 96 | 1) the digest of the block is computed over the whole stream | ||
| 97 | -- so nobody can rearrange the blocks or remove or replace them. | ||
| 98 | |||
| 99 | 2) to detect invalid passwords right at the start BIO_f_reliable | ||
| 100 | adds special prefix to the stream. In order to avoid known plain-text | ||
| 101 | attacks this prefix is generated as follows: | ||
| 102 | |||
| 103 | *) digest is initialized with random seed instead of | ||
| 104 | standardized one. | ||
| 105 | *) same seed is written to output | ||
| 106 | *) well-known text is then hashed and the output | ||
| 107 | of the digest is also written to output. | ||
| 108 | |||
| 109 | reader can now read the seed from stream, hash the same string | ||
| 110 | and then compare the digest output. | ||
| 111 | |||
| 112 | Bad things: BIO_f_reliable knows what's going on in EVP_Digest. I | ||
| 113 | initially wrote and tested this code on x86 machine and wrote the | ||
| 114 | digests out in machine-dependent order :( There are people using | ||
| 115 | this code and I cannot change this easily without making existing | ||
| 116 | data files unreadable. | ||
| 117 | |||
| 118 | */ | ||
| 119 | |||
| 120 | #include <stdio.h> | ||
| 121 | #include <errno.h> | ||
| 122 | #include <assert.h> | ||
| 123 | #include "cryptlib.h" | ||
| 124 | #include <openssl/buffer.h> | ||
| 125 | #include <openssl/bio.h> | ||
| 126 | #include <openssl/evp.h> | ||
| 127 | #include <openssl/rand.h> | ||
| 128 | |||
| 129 | static int ok_write(BIO *h, const char *buf, int num); | ||
| 130 | static int ok_read(BIO *h, char *buf, int size); | ||
| 131 | static long ok_ctrl(BIO *h, int cmd, long arg1, void *arg2); | ||
| 132 | static int ok_new(BIO *h); | ||
| 133 | static int ok_free(BIO *data); | ||
| 134 | static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); | ||
| 135 | |||
| 136 | static void sig_out(BIO* b); | ||
| 137 | static void sig_in(BIO* b); | ||
| 138 | static void block_out(BIO* b); | ||
| 139 | static void block_in(BIO* b); | ||
| 140 | #define OK_BLOCK_SIZE (1024*4) | ||
| 141 | #define OK_BLOCK_BLOCK 4 | ||
| 142 | #define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE) | ||
| 143 | #define WELLKNOWN "The quick brown fox jumped over the lazy dog's back." | ||
| 144 | |||
| 145 | typedef struct ok_struct | ||
| 146 | { | ||
| 147 | size_t buf_len; | ||
| 148 | size_t buf_off; | ||
| 149 | size_t buf_len_save; | ||
| 150 | size_t buf_off_save; | ||
| 151 | int cont; /* <= 0 when finished */ | ||
| 152 | int finished; | ||
| 153 | EVP_MD_CTX md; | ||
| 154 | int blockout; /* output block is ready */ | ||
| 155 | int sigio; /* must process signature */ | ||
| 156 | unsigned char buf[IOBS]; | ||
| 157 | } BIO_OK_CTX; | ||
| 158 | |||
| 159 | static BIO_METHOD methods_ok= | ||
| 160 | { | ||
| 161 | BIO_TYPE_CIPHER,"reliable", | ||
| 162 | ok_write, | ||
| 163 | ok_read, | ||
| 164 | NULL, /* ok_puts, */ | ||
| 165 | NULL, /* ok_gets, */ | ||
| 166 | ok_ctrl, | ||
| 167 | ok_new, | ||
| 168 | ok_free, | ||
| 169 | ok_callback_ctrl, | ||
| 170 | }; | ||
| 171 | |||
| 172 | BIO_METHOD *BIO_f_reliable(void) | ||
| 173 | { | ||
| 174 | return(&methods_ok); | ||
| 175 | } | ||
| 176 | |||
| 177 | static int ok_new(BIO *bi) | ||
| 178 | { | ||
| 179 | BIO_OK_CTX *ctx; | ||
| 180 | |||
| 181 | ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX)); | ||
| 182 | if (ctx == NULL) return(0); | ||
| 183 | |||
| 184 | ctx->buf_len=0; | ||
| 185 | ctx->buf_off=0; | ||
| 186 | ctx->buf_len_save=0; | ||
| 187 | ctx->buf_off_save=0; | ||
| 188 | ctx->cont=1; | ||
| 189 | ctx->finished=0; | ||
| 190 | ctx->blockout= 0; | ||
| 191 | ctx->sigio=1; | ||
| 192 | |||
| 193 | EVP_MD_CTX_init(&ctx->md); | ||
| 194 | |||
| 195 | bi->init=0; | ||
| 196 | bi->ptr=(char *)ctx; | ||
| 197 | bi->flags=0; | ||
| 198 | return(1); | ||
| 199 | } | ||
| 200 | |||
| 201 | static int ok_free(BIO *a) | ||
| 202 | { | ||
| 203 | if (a == NULL) return(0); | ||
| 204 | EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md); | ||
| 205 | OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX)); | ||
| 206 | OPENSSL_free(a->ptr); | ||
| 207 | a->ptr=NULL; | ||
| 208 | a->init=0; | ||
| 209 | a->flags=0; | ||
| 210 | return(1); | ||
| 211 | } | ||
| 212 | |||
| 213 | static int ok_read(BIO *b, char *out, int outl) | ||
| 214 | { | ||
| 215 | int ret=0,i,n; | ||
| 216 | BIO_OK_CTX *ctx; | ||
| 217 | |||
| 218 | if (out == NULL) return(0); | ||
| 219 | ctx=(BIO_OK_CTX *)b->ptr; | ||
| 220 | |||
| 221 | if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0); | ||
| 222 | |||
| 223 | while(outl > 0) | ||
| 224 | { | ||
| 225 | |||
| 226 | /* copy clean bytes to output buffer */ | ||
| 227 | if (ctx->blockout) | ||
| 228 | { | ||
| 229 | i=ctx->buf_len-ctx->buf_off; | ||
| 230 | if (i > outl) i=outl; | ||
| 231 | memcpy(out,&(ctx->buf[ctx->buf_off]),i); | ||
| 232 | ret+=i; | ||
| 233 | out+=i; | ||
| 234 | outl-=i; | ||
| 235 | ctx->buf_off+=i; | ||
| 236 | |||
| 237 | /* all clean bytes are out */ | ||
| 238 | if (ctx->buf_len == ctx->buf_off) | ||
| 239 | { | ||
| 240 | ctx->buf_off=0; | ||
| 241 | |||
| 242 | /* copy start of the next block into proper place */ | ||
| 243 | if(ctx->buf_len_save- ctx->buf_off_save > 0) | ||
| 244 | { | ||
| 245 | ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save; | ||
| 246 | memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]), | ||
| 247 | ctx->buf_len); | ||
| 248 | } | ||
| 249 | else | ||
| 250 | { | ||
| 251 | ctx->buf_len=0; | ||
| 252 | } | ||
| 253 | ctx->blockout= 0; | ||
| 254 | } | ||
| 255 | } | ||
| 256 | |||
| 257 | /* output buffer full -- cancel */ | ||
| 258 | if (outl == 0) break; | ||
| 259 | |||
| 260 | /* no clean bytes in buffer -- fill it */ | ||
| 261 | n=IOBS- ctx->buf_len; | ||
| 262 | i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n); | ||
| 263 | |||
| 264 | if (i <= 0) break; /* nothing new */ | ||
| 265 | |||
| 266 | ctx->buf_len+= i; | ||
| 267 | |||
| 268 | /* no signature yet -- check if we got one */ | ||
| 269 | if (ctx->sigio == 1) sig_in(b); | ||
| 270 | |||
| 271 | /* signature ok -- check if we got block */ | ||
| 272 | if (ctx->sigio == 0) block_in(b); | ||
| 273 | |||
| 274 | /* invalid block -- cancel */ | ||
| 275 | if (ctx->cont <= 0) break; | ||
| 276 | |||
| 277 | } | ||
| 278 | |||
| 279 | BIO_clear_retry_flags(b); | ||
| 280 | BIO_copy_next_retry(b); | ||
| 281 | return(ret); | ||
| 282 | } | ||
| 283 | |||
| 284 | static int ok_write(BIO *b, const char *in, int inl) | ||
| 285 | { | ||
| 286 | int ret=0,n,i; | ||
| 287 | BIO_OK_CTX *ctx; | ||
| 288 | |||
| 289 | if (inl <= 0) return inl; | ||
| 290 | |||
| 291 | ctx=(BIO_OK_CTX *)b->ptr; | ||
| 292 | ret=inl; | ||
| 293 | |||
| 294 | if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0); | ||
| 295 | |||
| 296 | if(ctx->sigio) sig_out(b); | ||
| 297 | |||
| 298 | do{ | ||
| 299 | BIO_clear_retry_flags(b); | ||
| 300 | n=ctx->buf_len-ctx->buf_off; | ||
| 301 | while (ctx->blockout && n > 0) | ||
| 302 | { | ||
| 303 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 304 | if (i <= 0) | ||
| 305 | { | ||
| 306 | BIO_copy_next_retry(b); | ||
| 307 | if(!BIO_should_retry(b)) | ||
| 308 | ctx->cont= 0; | ||
| 309 | return(i); | ||
| 310 | } | ||
| 311 | ctx->buf_off+=i; | ||
| 312 | n-=i; | ||
| 313 | } | ||
| 314 | |||
| 315 | /* at this point all pending data has been written */ | ||
| 316 | ctx->blockout= 0; | ||
| 317 | if (ctx->buf_len == ctx->buf_off) | ||
| 318 | { | ||
| 319 | ctx->buf_len=OK_BLOCK_BLOCK; | ||
| 320 | ctx->buf_off=0; | ||
| 321 | } | ||
| 322 | |||
| 323 | if ((in == NULL) || (inl <= 0)) return(0); | ||
| 324 | |||
| 325 | n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ? | ||
| 326 | (int)(OK_BLOCK_SIZE+OK_BLOCK_BLOCK-ctx->buf_len) : inl; | ||
| 327 | |||
| 328 | memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n); | ||
| 329 | ctx->buf_len+= n; | ||
| 330 | inl-=n; | ||
| 331 | in+=n; | ||
| 332 | |||
| 333 | if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) | ||
| 334 | { | ||
| 335 | block_out(b); | ||
| 336 | } | ||
| 337 | }while(inl > 0); | ||
| 338 | |||
| 339 | BIO_clear_retry_flags(b); | ||
| 340 | BIO_copy_next_retry(b); | ||
| 341 | return(ret); | ||
| 342 | } | ||
| 343 | |||
| 344 | static long ok_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 345 | { | ||
| 346 | BIO_OK_CTX *ctx; | ||
| 347 | EVP_MD *md; | ||
| 348 | const EVP_MD **ppmd; | ||
| 349 | long ret=1; | ||
| 350 | int i; | ||
| 351 | |||
| 352 | ctx=b->ptr; | ||
| 353 | |||
| 354 | switch (cmd) | ||
| 355 | { | ||
| 356 | case BIO_CTRL_RESET: | ||
| 357 | ctx->buf_len=0; | ||
| 358 | ctx->buf_off=0; | ||
| 359 | ctx->buf_len_save=0; | ||
| 360 | ctx->buf_off_save=0; | ||
| 361 | ctx->cont=1; | ||
| 362 | ctx->finished=0; | ||
| 363 | ctx->blockout= 0; | ||
| 364 | ctx->sigio=1; | ||
| 365 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 366 | break; | ||
| 367 | case BIO_CTRL_EOF: /* More to read */ | ||
| 368 | if (ctx->cont <= 0) | ||
| 369 | ret=1; | ||
| 370 | else | ||
| 371 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 372 | break; | ||
| 373 | case BIO_CTRL_PENDING: /* More to read in buffer */ | ||
| 374 | case BIO_CTRL_WPENDING: /* More to read in buffer */ | ||
| 375 | ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0; | ||
| 376 | if (ret <= 0) | ||
| 377 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 378 | break; | ||
| 379 | case BIO_CTRL_FLUSH: | ||
| 380 | /* do a final write */ | ||
| 381 | if(ctx->blockout == 0) | ||
| 382 | block_out(b); | ||
| 383 | |||
| 384 | while (ctx->blockout) | ||
| 385 | { | ||
| 386 | i=ok_write(b,NULL,0); | ||
| 387 | if (i < 0) | ||
| 388 | { | ||
| 389 | ret=i; | ||
| 390 | break; | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | ctx->finished=1; | ||
| 395 | ctx->buf_off=ctx->buf_len=0; | ||
| 396 | ctx->cont=(int)ret; | ||
| 397 | |||
| 398 | /* Finally flush the underlying BIO */ | ||
| 399 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 400 | break; | ||
| 401 | case BIO_C_DO_STATE_MACHINE: | ||
| 402 | BIO_clear_retry_flags(b); | ||
| 403 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 404 | BIO_copy_next_retry(b); | ||
| 405 | break; | ||
| 406 | case BIO_CTRL_INFO: | ||
| 407 | ret=(long)ctx->cont; | ||
| 408 | break; | ||
| 409 | case BIO_C_SET_MD: | ||
| 410 | md=ptr; | ||
| 411 | EVP_DigestInit_ex(&ctx->md, md, NULL); | ||
| 412 | b->init=1; | ||
| 413 | break; | ||
| 414 | case BIO_C_GET_MD: | ||
| 415 | if (b->init) | ||
| 416 | { | ||
| 417 | ppmd=ptr; | ||
| 418 | *ppmd=ctx->md.digest; | ||
| 419 | } | ||
| 420 | else | ||
| 421 | ret=0; | ||
| 422 | break; | ||
| 423 | default: | ||
| 424 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 425 | break; | ||
| 426 | } | ||
| 427 | return(ret); | ||
| 428 | } | ||
| 429 | |||
| 430 | static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) | ||
| 431 | { | ||
| 432 | long ret=1; | ||
| 433 | |||
| 434 | if (b->next_bio == NULL) return(0); | ||
| 435 | switch (cmd) | ||
| 436 | { | ||
| 437 | default: | ||
| 438 | ret=BIO_callback_ctrl(b->next_bio,cmd,fp); | ||
| 439 | break; | ||
| 440 | } | ||
| 441 | return(ret); | ||
| 442 | } | ||
| 443 | |||
| 444 | static void longswap(void *_ptr, size_t len) | ||
| 445 | { const union { long one; char little; } is_endian = {1}; | ||
| 446 | |||
| 447 | if (is_endian.little) { | ||
| 448 | size_t i; | ||
| 449 | unsigned char *p=_ptr,c; | ||
| 450 | |||
| 451 | for(i= 0;i < len;i+= 4) { | ||
| 452 | c=p[0],p[0]=p[3],p[3]=c; | ||
| 453 | c=p[1],p[1]=p[2],p[2]=c; | ||
| 454 | } | ||
| 455 | } | ||
| 456 | } | ||
| 457 | |||
| 458 | static void sig_out(BIO* b) | ||
| 459 | { | ||
| 460 | BIO_OK_CTX *ctx; | ||
| 461 | EVP_MD_CTX *md; | ||
| 462 | |||
| 463 | ctx=b->ptr; | ||
| 464 | md=&ctx->md; | ||
| 465 | |||
| 466 | if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return; | ||
| 467 | |||
| 468 | EVP_DigestInit_ex(md, md->digest, NULL); | ||
| 469 | /* FIXME: there's absolutely no guarantee this makes any sense at all, | ||
| 470 | * particularly now EVP_MD_CTX has been restructured. | ||
| 471 | */ | ||
| 472 | RAND_pseudo_bytes(md->md_data, md->digest->md_size); | ||
| 473 | memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size); | ||
| 474 | longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size); | ||
| 475 | ctx->buf_len+= md->digest->md_size; | ||
| 476 | |||
| 477 | EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)); | ||
| 478 | EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL); | ||
| 479 | ctx->buf_len+= md->digest->md_size; | ||
| 480 | ctx->blockout= 1; | ||
| 481 | ctx->sigio= 0; | ||
| 482 | } | ||
| 483 | |||
| 484 | static void sig_in(BIO* b) | ||
| 485 | { | ||
| 486 | BIO_OK_CTX *ctx; | ||
| 487 | EVP_MD_CTX *md; | ||
| 488 | unsigned char tmp[EVP_MAX_MD_SIZE]; | ||
| 489 | int ret= 0; | ||
| 490 | |||
| 491 | ctx=b->ptr; | ||
| 492 | md=&ctx->md; | ||
| 493 | |||
| 494 | if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return; | ||
| 495 | |||
| 496 | EVP_DigestInit_ex(md, md->digest, NULL); | ||
| 497 | memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size); | ||
| 498 | longswap(md->md_data, md->digest->md_size); | ||
| 499 | ctx->buf_off+= md->digest->md_size; | ||
| 500 | |||
| 501 | EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)); | ||
| 502 | EVP_DigestFinal_ex(md, tmp, NULL); | ||
| 503 | ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0; | ||
| 504 | ctx->buf_off+= md->digest->md_size; | ||
| 505 | if(ret == 1) | ||
| 506 | { | ||
| 507 | ctx->sigio= 0; | ||
| 508 | if(ctx->buf_len != ctx->buf_off) | ||
| 509 | { | ||
| 510 | memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off); | ||
| 511 | } | ||
| 512 | ctx->buf_len-= ctx->buf_off; | ||
| 513 | ctx->buf_off= 0; | ||
| 514 | } | ||
| 515 | else | ||
| 516 | { | ||
| 517 | ctx->cont= 0; | ||
| 518 | } | ||
| 519 | } | ||
| 520 | |||
| 521 | static void block_out(BIO* b) | ||
| 522 | { | ||
| 523 | BIO_OK_CTX *ctx; | ||
| 524 | EVP_MD_CTX *md; | ||
| 525 | unsigned long tl; | ||
| 526 | |||
| 527 | ctx=b->ptr; | ||
| 528 | md=&ctx->md; | ||
| 529 | |||
| 530 | tl= ctx->buf_len- OK_BLOCK_BLOCK; | ||
| 531 | ctx->buf[0]=(unsigned char)(tl>>24); | ||
| 532 | ctx->buf[1]=(unsigned char)(tl>>16); | ||
| 533 | ctx->buf[2]=(unsigned char)(tl>>8); | ||
| 534 | ctx->buf[3]=(unsigned char)(tl); | ||
| 535 | EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl); | ||
| 536 | EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL); | ||
| 537 | ctx->buf_len+= md->digest->md_size; | ||
| 538 | ctx->blockout= 1; | ||
| 539 | } | ||
| 540 | |||
| 541 | static void block_in(BIO* b) | ||
| 542 | { | ||
| 543 | BIO_OK_CTX *ctx; | ||
| 544 | EVP_MD_CTX *md; | ||
| 545 | unsigned long tl= 0; | ||
| 546 | unsigned char tmp[EVP_MAX_MD_SIZE]; | ||
| 547 | |||
| 548 | ctx=b->ptr; | ||
| 549 | md=&ctx->md; | ||
| 550 | |||
| 551 | assert(sizeof(tl)>=OK_BLOCK_BLOCK); /* always true */ | ||
| 552 | tl =ctx->buf[0]; tl<<=8; | ||
| 553 | tl|=ctx->buf[1]; tl<<=8; | ||
| 554 | tl|=ctx->buf[2]; tl<<=8; | ||
| 555 | tl|=ctx->buf[3]; | ||
| 556 | |||
| 557 | if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return; | ||
| 558 | |||
| 559 | EVP_DigestUpdate(md, (unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl); | ||
| 560 | EVP_DigestFinal_ex(md, tmp, NULL); | ||
| 561 | if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0) | ||
| 562 | { | ||
| 563 | /* there might be parts from next block lurking around ! */ | ||
| 564 | ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size; | ||
| 565 | ctx->buf_len_save= ctx->buf_len; | ||
| 566 | ctx->buf_off= OK_BLOCK_BLOCK; | ||
| 567 | ctx->buf_len= tl+ OK_BLOCK_BLOCK; | ||
| 568 | ctx->blockout= 1; | ||
| 569 | } | ||
| 570 | else | ||
| 571 | { | ||
| 572 | ctx->cont= 0; | ||
| 573 | } | ||
| 574 | } | ||
| 575 | |||
diff --git a/src/lib/libcrypto/evp/c_allc.c b/src/lib/libcrypto/evp/c_allc.c new file mode 100644 index 0000000000..c5f9268378 --- /dev/null +++ b/src/lib/libcrypto/evp/c_allc.c | |||
| @@ -0,0 +1,224 @@ | |||
| 1 | /* crypto/evp/c_allc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/pkcs12.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | |||
| 65 | void OpenSSL_add_all_ciphers(void) | ||
| 66 | { | ||
| 67 | |||
| 68 | #ifndef OPENSSL_NO_DES | ||
| 69 | EVP_add_cipher(EVP_des_cfb()); | ||
| 70 | EVP_add_cipher(EVP_des_cfb1()); | ||
| 71 | EVP_add_cipher(EVP_des_cfb8()); | ||
| 72 | EVP_add_cipher(EVP_des_ede_cfb()); | ||
| 73 | EVP_add_cipher(EVP_des_ede3_cfb()); | ||
| 74 | EVP_add_cipher(EVP_des_ede3_cfb1()); | ||
| 75 | EVP_add_cipher(EVP_des_ede3_cfb8()); | ||
| 76 | |||
| 77 | EVP_add_cipher(EVP_des_ofb()); | ||
| 78 | EVP_add_cipher(EVP_des_ede_ofb()); | ||
| 79 | EVP_add_cipher(EVP_des_ede3_ofb()); | ||
| 80 | |||
| 81 | EVP_add_cipher(EVP_desx_cbc()); | ||
| 82 | EVP_add_cipher_alias(SN_desx_cbc,"DESX"); | ||
| 83 | EVP_add_cipher_alias(SN_desx_cbc,"desx"); | ||
| 84 | |||
| 85 | EVP_add_cipher(EVP_des_cbc()); | ||
| 86 | EVP_add_cipher_alias(SN_des_cbc,"DES"); | ||
| 87 | EVP_add_cipher_alias(SN_des_cbc,"des"); | ||
| 88 | EVP_add_cipher(EVP_des_ede_cbc()); | ||
| 89 | EVP_add_cipher(EVP_des_ede3_cbc()); | ||
| 90 | EVP_add_cipher_alias(SN_des_ede3_cbc,"DES3"); | ||
| 91 | EVP_add_cipher_alias(SN_des_ede3_cbc,"des3"); | ||
| 92 | |||
| 93 | EVP_add_cipher(EVP_des_ecb()); | ||
| 94 | EVP_add_cipher(EVP_des_ede()); | ||
| 95 | EVP_add_cipher(EVP_des_ede3()); | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #ifndef OPENSSL_NO_RC4 | ||
| 99 | EVP_add_cipher(EVP_rc4()); | ||
| 100 | EVP_add_cipher(EVP_rc4_40()); | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #ifndef OPENSSL_NO_IDEA | ||
| 104 | EVP_add_cipher(EVP_idea_ecb()); | ||
| 105 | EVP_add_cipher(EVP_idea_cfb()); | ||
| 106 | EVP_add_cipher(EVP_idea_ofb()); | ||
| 107 | EVP_add_cipher(EVP_idea_cbc()); | ||
| 108 | EVP_add_cipher_alias(SN_idea_cbc,"IDEA"); | ||
| 109 | EVP_add_cipher_alias(SN_idea_cbc,"idea"); | ||
| 110 | #endif | ||
| 111 | |||
| 112 | #ifndef OPENSSL_NO_SEED | ||
| 113 | EVP_add_cipher(EVP_seed_ecb()); | ||
| 114 | EVP_add_cipher(EVP_seed_cfb()); | ||
| 115 | EVP_add_cipher(EVP_seed_ofb()); | ||
| 116 | EVP_add_cipher(EVP_seed_cbc()); | ||
| 117 | EVP_add_cipher_alias(SN_seed_cbc,"SEED"); | ||
| 118 | EVP_add_cipher_alias(SN_seed_cbc,"seed"); | ||
| 119 | #endif | ||
| 120 | |||
| 121 | #ifndef OPENSSL_NO_RC2 | ||
| 122 | EVP_add_cipher(EVP_rc2_ecb()); | ||
| 123 | EVP_add_cipher(EVP_rc2_cfb()); | ||
| 124 | EVP_add_cipher(EVP_rc2_ofb()); | ||
| 125 | EVP_add_cipher(EVP_rc2_cbc()); | ||
| 126 | EVP_add_cipher(EVP_rc2_40_cbc()); | ||
| 127 | EVP_add_cipher(EVP_rc2_64_cbc()); | ||
| 128 | EVP_add_cipher_alias(SN_rc2_cbc,"RC2"); | ||
| 129 | EVP_add_cipher_alias(SN_rc2_cbc,"rc2"); | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #ifndef OPENSSL_NO_BF | ||
| 133 | EVP_add_cipher(EVP_bf_ecb()); | ||
| 134 | EVP_add_cipher(EVP_bf_cfb()); | ||
| 135 | EVP_add_cipher(EVP_bf_ofb()); | ||
| 136 | EVP_add_cipher(EVP_bf_cbc()); | ||
| 137 | EVP_add_cipher_alias(SN_bf_cbc,"BF"); | ||
| 138 | EVP_add_cipher_alias(SN_bf_cbc,"bf"); | ||
| 139 | EVP_add_cipher_alias(SN_bf_cbc,"blowfish"); | ||
| 140 | #endif | ||
| 141 | |||
| 142 | #ifndef OPENSSL_NO_CAST | ||
| 143 | EVP_add_cipher(EVP_cast5_ecb()); | ||
| 144 | EVP_add_cipher(EVP_cast5_cfb()); | ||
| 145 | EVP_add_cipher(EVP_cast5_ofb()); | ||
| 146 | EVP_add_cipher(EVP_cast5_cbc()); | ||
| 147 | EVP_add_cipher_alias(SN_cast5_cbc,"CAST"); | ||
| 148 | EVP_add_cipher_alias(SN_cast5_cbc,"cast"); | ||
| 149 | EVP_add_cipher_alias(SN_cast5_cbc,"CAST-cbc"); | ||
| 150 | EVP_add_cipher_alias(SN_cast5_cbc,"cast-cbc"); | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #ifndef OPENSSL_NO_RC5 | ||
| 154 | EVP_add_cipher(EVP_rc5_32_12_16_ecb()); | ||
| 155 | EVP_add_cipher(EVP_rc5_32_12_16_cfb()); | ||
| 156 | EVP_add_cipher(EVP_rc5_32_12_16_ofb()); | ||
| 157 | EVP_add_cipher(EVP_rc5_32_12_16_cbc()); | ||
| 158 | EVP_add_cipher_alias(SN_rc5_cbc,"rc5"); | ||
| 159 | EVP_add_cipher_alias(SN_rc5_cbc,"RC5"); | ||
| 160 | #endif | ||
| 161 | |||
| 162 | #ifndef OPENSSL_NO_AES | ||
| 163 | EVP_add_cipher(EVP_aes_128_ecb()); | ||
| 164 | EVP_add_cipher(EVP_aes_128_cbc()); | ||
| 165 | EVP_add_cipher(EVP_aes_128_cfb()); | ||
| 166 | EVP_add_cipher(EVP_aes_128_cfb1()); | ||
| 167 | EVP_add_cipher(EVP_aes_128_cfb8()); | ||
| 168 | EVP_add_cipher(EVP_aes_128_ofb()); | ||
| 169 | #if 0 | ||
| 170 | EVP_add_cipher(EVP_aes_128_ctr()); | ||
| 171 | #endif | ||
| 172 | EVP_add_cipher_alias(SN_aes_128_cbc,"AES128"); | ||
| 173 | EVP_add_cipher_alias(SN_aes_128_cbc,"aes128"); | ||
| 174 | EVP_add_cipher(EVP_aes_192_ecb()); | ||
| 175 | EVP_add_cipher(EVP_aes_192_cbc()); | ||
| 176 | EVP_add_cipher(EVP_aes_192_cfb()); | ||
| 177 | EVP_add_cipher(EVP_aes_192_cfb1()); | ||
| 178 | EVP_add_cipher(EVP_aes_192_cfb8()); | ||
| 179 | EVP_add_cipher(EVP_aes_192_ofb()); | ||
| 180 | #if 0 | ||
| 181 | EVP_add_cipher(EVP_aes_192_ctr()); | ||
| 182 | #endif | ||
| 183 | EVP_add_cipher_alias(SN_aes_192_cbc,"AES192"); | ||
| 184 | EVP_add_cipher_alias(SN_aes_192_cbc,"aes192"); | ||
| 185 | EVP_add_cipher(EVP_aes_256_ecb()); | ||
| 186 | EVP_add_cipher(EVP_aes_256_cbc()); | ||
| 187 | EVP_add_cipher(EVP_aes_256_cfb()); | ||
| 188 | EVP_add_cipher(EVP_aes_256_cfb1()); | ||
| 189 | EVP_add_cipher(EVP_aes_256_cfb8()); | ||
| 190 | EVP_add_cipher(EVP_aes_256_ofb()); | ||
| 191 | #if 0 | ||
| 192 | EVP_add_cipher(EVP_aes_256_ctr()); | ||
| 193 | #endif | ||
| 194 | EVP_add_cipher_alias(SN_aes_256_cbc,"AES256"); | ||
| 195 | EVP_add_cipher_alias(SN_aes_256_cbc,"aes256"); | ||
| 196 | #endif | ||
| 197 | |||
| 198 | #ifndef OPENSSL_NO_CAMELLIA | ||
| 199 | EVP_add_cipher(EVP_camellia_128_ecb()); | ||
| 200 | EVP_add_cipher(EVP_camellia_128_cbc()); | ||
| 201 | EVP_add_cipher(EVP_camellia_128_cfb()); | ||
| 202 | EVP_add_cipher(EVP_camellia_128_cfb1()); | ||
| 203 | EVP_add_cipher(EVP_camellia_128_cfb8()); | ||
| 204 | EVP_add_cipher(EVP_camellia_128_ofb()); | ||
| 205 | EVP_add_cipher_alias(SN_camellia_128_cbc,"CAMELLIA128"); | ||
| 206 | EVP_add_cipher_alias(SN_camellia_128_cbc,"camellia128"); | ||
| 207 | EVP_add_cipher(EVP_camellia_192_ecb()); | ||
| 208 | EVP_add_cipher(EVP_camellia_192_cbc()); | ||
| 209 | EVP_add_cipher(EVP_camellia_192_cfb()); | ||
| 210 | EVP_add_cipher(EVP_camellia_192_cfb1()); | ||
| 211 | EVP_add_cipher(EVP_camellia_192_cfb8()); | ||
| 212 | EVP_add_cipher(EVP_camellia_192_ofb()); | ||
| 213 | EVP_add_cipher_alias(SN_camellia_192_cbc,"CAMELLIA192"); | ||
| 214 | EVP_add_cipher_alias(SN_camellia_192_cbc,"camellia192"); | ||
| 215 | EVP_add_cipher(EVP_camellia_256_ecb()); | ||
| 216 | EVP_add_cipher(EVP_camellia_256_cbc()); | ||
| 217 | EVP_add_cipher(EVP_camellia_256_cfb()); | ||
| 218 | EVP_add_cipher(EVP_camellia_256_cfb1()); | ||
| 219 | EVP_add_cipher(EVP_camellia_256_cfb8()); | ||
| 220 | EVP_add_cipher(EVP_camellia_256_ofb()); | ||
| 221 | EVP_add_cipher_alias(SN_camellia_256_cbc,"CAMELLIA256"); | ||
| 222 | EVP_add_cipher_alias(SN_camellia_256_cbc,"camellia256"); | ||
| 223 | #endif | ||
| 224 | } | ||
diff --git a/src/lib/libcrypto/evp/c_alld.c b/src/lib/libcrypto/evp/c_alld.c new file mode 100644 index 0000000000..311e1fe2f8 --- /dev/null +++ b/src/lib/libcrypto/evp/c_alld.c | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | /* crypto/evp/c_alld.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/pkcs12.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | |||
| 65 | void OpenSSL_add_all_digests(void) | ||
| 66 | { | ||
| 67 | #ifndef OPENSSL_NO_MD4 | ||
| 68 | EVP_add_digest(EVP_md4()); | ||
| 69 | #endif | ||
| 70 | #ifndef OPENSSL_NO_MD5 | ||
| 71 | EVP_add_digest(EVP_md5()); | ||
| 72 | EVP_add_digest_alias(SN_md5,"ssl2-md5"); | ||
| 73 | EVP_add_digest_alias(SN_md5,"ssl3-md5"); | ||
| 74 | #endif | ||
| 75 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | ||
| 76 | EVP_add_digest(EVP_sha()); | ||
| 77 | #ifndef OPENSSL_NO_DSA | ||
| 78 | EVP_add_digest(EVP_dss()); | ||
| 79 | #endif | ||
| 80 | #endif | ||
| 81 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) | ||
| 82 | EVP_add_digest(EVP_sha1()); | ||
| 83 | EVP_add_digest_alias(SN_sha1,"ssl3-sha1"); | ||
| 84 | EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA); | ||
| 85 | #ifndef OPENSSL_NO_DSA | ||
| 86 | EVP_add_digest(EVP_dss1()); | ||
| 87 | EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2); | ||
| 88 | EVP_add_digest_alias(SN_dsaWithSHA1,"DSS1"); | ||
| 89 | EVP_add_digest_alias(SN_dsaWithSHA1,"dss1"); | ||
| 90 | #endif | ||
| 91 | #ifndef OPENSSL_NO_ECDSA | ||
| 92 | EVP_add_digest(EVP_ecdsa()); | ||
| 93 | #endif | ||
| 94 | #endif | ||
| 95 | #if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES) | ||
| 96 | EVP_add_digest(EVP_mdc2()); | ||
| 97 | #endif | ||
| 98 | #ifndef OPENSSL_NO_RIPEMD | ||
| 99 | EVP_add_digest(EVP_ripemd160()); | ||
| 100 | EVP_add_digest_alias(SN_ripemd160,"ripemd"); | ||
| 101 | EVP_add_digest_alias(SN_ripemd160,"rmd160"); | ||
| 102 | #endif | ||
| 103 | #ifndef OPENSSL_NO_SHA256 | ||
| 104 | EVP_add_digest(EVP_sha224()); | ||
| 105 | EVP_add_digest(EVP_sha256()); | ||
| 106 | #endif | ||
| 107 | #ifndef OPENSSL_NO_SHA512 | ||
| 108 | EVP_add_digest(EVP_sha384()); | ||
| 109 | EVP_add_digest(EVP_sha512()); | ||
| 110 | #endif | ||
| 111 | #ifndef OPENSSL_NO_WHIRLPOOL | ||
| 112 | EVP_add_digest(EVP_whirlpool()); | ||
| 113 | #endif | ||
| 114 | } | ||
diff --git a/src/lib/libcrypto/evp/e_acss.c b/src/lib/libcrypto/evp/e_acss.c new file mode 100644 index 0000000000..9084a63d51 --- /dev/null +++ b/src/lib/libcrypto/evp/e_acss.c | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* $Id: e_acss.c,v 1.3 2010/10/01 23:33:22 djm Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2004 The OpenBSD project | ||
| 4 | * | ||
| 5 | * Permission to use, copy, modify, and distribute this software for any | ||
| 6 | * purpose with or without fee is hereby granted, provided that the above | ||
| 7 | * copyright notice and this permission notice appear in all copies. | ||
| 8 | * | ||
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef OPENSSL_NO_ACSS | ||
| 19 | |||
| 20 | #include "cryptlib.h" | ||
| 21 | #include <openssl/evp.h> | ||
| 22 | #include <openssl/objects.h> | ||
| 23 | #include "evp_locl.h" | ||
| 24 | #include <openssl/acss.h> | ||
| 25 | |||
| 26 | typedef struct { | ||
| 27 | ACSS_KEY ks; | ||
| 28 | } EVP_ACSS_KEY; | ||
| 29 | |||
| 30 | #define data(ctx) EVP_C_DATA(EVP_ACSS_KEY,ctx) | ||
| 31 | |||
| 32 | static int acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 33 | const unsigned char *iv, int enc); | ||
| 34 | static int acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
| 35 | const unsigned char *in, size_t inl); | ||
| 36 | static int acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | ||
| 37 | static const EVP_CIPHER acss_cipher = { | ||
| 38 | NID_undef, | ||
| 39 | 1,5,0, | ||
| 40 | 0, | ||
| 41 | acss_init_key, | ||
| 42 | acss_ciph, | ||
| 43 | NULL, | ||
| 44 | sizeof(EVP_ACSS_KEY), | ||
| 45 | NULL, | ||
| 46 | NULL, | ||
| 47 | acss_ctrl, | ||
| 48 | NULL | ||
| 49 | }; | ||
| 50 | |||
| 51 | const | ||
| 52 | EVP_CIPHER *EVP_acss(void) | ||
| 53 | { | ||
| 54 | return(&acss_cipher); | ||
| 55 | } | ||
| 56 | |||
| 57 | static int | ||
| 58 | acss_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 59 | const unsigned char *iv, int enc) | ||
| 60 | { | ||
| 61 | acss_setkey(&data(ctx)->ks,key,enc,ACSS_MODE1); | ||
| 62 | return 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | static int | ||
| 66 | acss_ciph(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, | ||
| 67 | size_t inl) | ||
| 68 | { | ||
| 69 | acss(&data(ctx)->ks,inl,in,out); | ||
| 70 | return 1; | ||
| 71 | } | ||
| 72 | |||
| 73 | static int | ||
| 74 | acss_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) | ||
| 75 | { | ||
| 76 | switch(type) { | ||
| 77 | case EVP_CTRL_SET_ACSS_MODE: | ||
| 78 | data(ctx)->ks.mode = arg; | ||
| 79 | return 1; | ||
| 80 | |||
| 81 | default: | ||
| 82 | return -1; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_dsa.c b/src/lib/libcrypto/evp/e_dsa.c new file mode 100644 index 0000000000..b96f2738b3 --- /dev/null +++ b/src/lib/libcrypto/evp/e_dsa.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* crypto/evp/e_dsa.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/objects.h> | ||
| 63 | #include <openssl/x509.h> | ||
| 64 | |||
| 65 | static EVP_PKEY_METHOD dss_method= | ||
| 66 | { | ||
| 67 | DSA_sign, | ||
| 68 | DSA_verify, | ||
| 69 | {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3,NULL}, | ||
| 70 | }; | ||
| 71 | |||
diff --git a/src/lib/libcrypto/evp/e_rc5.c b/src/lib/libcrypto/evp/e_rc5.c new file mode 100644 index 0000000000..19a10c6402 --- /dev/null +++ b/src/lib/libcrypto/evp/e_rc5.c | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | /* crypto/evp/e_rc5.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_RC5 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include "evp_locl.h" | ||
| 67 | #include <openssl/rc5.h> | ||
| 68 | |||
| 69 | static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 70 | const unsigned char *iv,int enc); | ||
| 71 | static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); | ||
| 72 | |||
| 73 | typedef struct | ||
| 74 | { | ||
| 75 | int rounds; /* number of rounds */ | ||
| 76 | RC5_32_KEY ks; /* key schedule */ | ||
| 77 | } EVP_RC5_KEY; | ||
| 78 | |||
| 79 | #define data(ctx) EVP_C_DATA(EVP_RC5_KEY,ctx) | ||
| 80 | |||
| 81 | IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, ks, RC5_32, EVP_RC5_KEY, NID_rc5, | ||
| 82 | 8, RC5_32_KEY_LENGTH, 8, 64, | ||
| 83 | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, | ||
| 84 | r_32_12_16_init_key, NULL, | ||
| 85 | NULL, NULL, rc5_ctrl) | ||
| 86 | |||
| 87 | static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) | ||
| 88 | { | ||
| 89 | switch(type) | ||
| 90 | { | ||
| 91 | case EVP_CTRL_INIT: | ||
| 92 | data(c)->rounds = RC5_12_ROUNDS; | ||
| 93 | return 1; | ||
| 94 | |||
| 95 | case EVP_CTRL_GET_RC5_ROUNDS: | ||
| 96 | *(int *)ptr = data(c)->rounds; | ||
| 97 | return 1; | ||
| 98 | |||
| 99 | case EVP_CTRL_SET_RC5_ROUNDS: | ||
| 100 | switch(arg) | ||
| 101 | { | ||
| 102 | case RC5_8_ROUNDS: | ||
| 103 | case RC5_12_ROUNDS: | ||
| 104 | case RC5_16_ROUNDS: | ||
| 105 | data(c)->rounds = arg; | ||
| 106 | return 1; | ||
| 107 | |||
| 108 | default: | ||
| 109 | EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS); | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | default: | ||
| 114 | return -1; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 119 | const unsigned char *iv, int enc) | ||
| 120 | { | ||
| 121 | RC5_32_set_key(&data(ctx)->ks,EVP_CIPHER_CTX_key_length(ctx), | ||
| 122 | key,data(ctx)->rounds); | ||
| 123 | return 1; | ||
| 124 | } | ||
| 125 | |||
| 126 | #endif | ||
diff --git a/src/lib/libcrypto/evp/e_seed.c b/src/lib/libcrypto/evp/e_seed.c new file mode 100644 index 0000000000..2d1759d276 --- /dev/null +++ b/src/lib/libcrypto/evp/e_seed.c | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | /* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | #include <openssl/opensslconf.h> | ||
| 57 | #ifndef OPENSSL_NO_SEED | ||
| 58 | #include <openssl/evp.h> | ||
| 59 | #include <openssl/err.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <assert.h> | ||
| 62 | #include <openssl/seed.h> | ||
| 63 | #include "evp_locl.h" | ||
| 64 | |||
| 65 | static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); | ||
| 66 | |||
| 67 | typedef struct | ||
| 68 | { | ||
| 69 | SEED_KEY_SCHEDULE ks; | ||
| 70 | } EVP_SEED_KEY; | ||
| 71 | |||
| 72 | IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed, | ||
| 73 | 16, 16, 16, 128, | ||
| 74 | 0, seed_init_key, 0, 0, 0, 0) | ||
| 75 | |||
| 76 | static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, | ||
| 77 | const unsigned char *iv, int enc) | ||
| 78 | { | ||
| 79 | SEED_set_key(key, ctx->cipher_data); | ||
| 80 | return 1; | ||
| 81 | } | ||
| 82 | |||
| 83 | #endif | ||
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c index 28546a84bc..b42c747249 100644 --- a/src/lib/libcrypto/evp/encode.c +++ b/src/lib/libcrypto/evp/encode.c | |||
| @@ -235,7 +235,7 @@ void EVP_DecodeInit(EVP_ENCODE_CTX *ctx) | |||
| 235 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | 235 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
| 236 | const unsigned char *in, int inl) | 236 | const unsigned char *in, int inl) |
| 237 | { | 237 | { |
| 238 | int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,exp_nl; | 238 | int seof= -1,eof=0,rv= -1,ret=0,i,v,tmp,n,ln,tmp2,exp_nl; |
| 239 | unsigned char *d; | 239 | unsigned char *d; |
| 240 | 240 | ||
| 241 | n=ctx->num; | 241 | n=ctx->num; |
| @@ -319,6 +319,7 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | |||
| 319 | * lines. We process the line and then need to | 319 | * lines. We process the line and then need to |
| 320 | * accept the '\n' */ | 320 | * accept the '\n' */ |
| 321 | if ((v != B64_EOF) && (n >= 64)) exp_nl=1; | 321 | if ((v != B64_EOF) && (n >= 64)) exp_nl=1; |
| 322 | tmp2=v; | ||
| 322 | if (n > 0) | 323 | if (n > 0) |
| 323 | { | 324 | { |
| 324 | v=EVP_DecodeBlock(out,d,n); | 325 | v=EVP_DecodeBlock(out,d,n); |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 9f9795e2d9..da93e945f5 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -358,6 +358,7 @@ struct evp_cipher_st | |||
| 358 | #define EVP_CTRL_RAND_KEY 0x6 | 358 | #define EVP_CTRL_RAND_KEY 0x6 |
| 359 | #define EVP_CTRL_PBE_PRF_NID 0x7 | 359 | #define EVP_CTRL_PBE_PRF_NID 0x7 |
| 360 | #define EVP_CTRL_COPY 0x8 | 360 | #define EVP_CTRL_COPY 0x8 |
| 361 | #define EVP_CTRL_SET_ACSS_MODE 0x9 | ||
| 361 | 362 | ||
| 362 | typedef struct evp_cipher_info_st | 363 | typedef struct evp_cipher_info_st |
| 363 | { | 364 | { |
| @@ -765,6 +766,9 @@ const EVP_CIPHER *EVP_aes_256_ofb(void); | |||
| 765 | const EVP_CIPHER *EVP_aes_256_ctr(void); | 766 | const EVP_CIPHER *EVP_aes_256_ctr(void); |
| 766 | #endif | 767 | #endif |
| 767 | #endif | 768 | #endif |
| 769 | #ifndef OPENSSL_NO_ACSS | ||
| 770 | const EVP_CIPHER *EVP_acss(void); | ||
| 771 | #endif | ||
| 768 | #ifndef OPENSSL_NO_CAMELLIA | 772 | #ifndef OPENSSL_NO_CAMELLIA |
| 769 | const EVP_CIPHER *EVP_camellia_128_ecb(void); | 773 | const EVP_CIPHER *EVP_camellia_128_ecb(void); |
| 770 | const EVP_CIPHER *EVP_camellia_128_cbc(void); | 774 | const EVP_CIPHER *EVP_camellia_128_cbc(void); |
| @@ -1190,6 +1194,7 @@ void ERR_load_EVP_strings(void); | |||
| 1190 | /* Error codes for the EVP functions. */ | 1194 | /* Error codes for the EVP functions. */ |
| 1191 | 1195 | ||
| 1192 | /* Function codes. */ | 1196 | /* Function codes. */ |
| 1197 | #define EVP_F_AESNI_INIT_KEY 165 | ||
| 1193 | #define EVP_F_AES_INIT_KEY 133 | 1198 | #define EVP_F_AES_INIT_KEY 133 |
| 1194 | #define EVP_F_CAMELLIA_INIT_KEY 159 | 1199 | #define EVP_F_CAMELLIA_INIT_KEY 159 |
| 1195 | #define EVP_F_D2I_PKEY 100 | 1200 | #define EVP_F_D2I_PKEY 100 |
diff --git a/src/lib/libcrypto/evp/evp_acnf.c b/src/lib/libcrypto/evp/evp_acnf.c new file mode 100644 index 0000000000..643a1864e8 --- /dev/null +++ b/src/lib/libcrypto/evp/evp_acnf.c | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | /* evp_acnf.c */ | ||
| 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 2001. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include "cryptlib.h" | ||
| 60 | #include <openssl/evp.h> | ||
| 61 | #include <openssl/conf.h> | ||
| 62 | |||
| 63 | |||
| 64 | /* Load all algorithms and configure OpenSSL. | ||
| 65 | * This function is called automatically when | ||
| 66 | * OPENSSL_LOAD_CONF is set. | ||
| 67 | */ | ||
| 68 | |||
| 69 | void OPENSSL_add_all_algorithms_conf(void) | ||
| 70 | { | ||
| 71 | OPENSSL_add_all_algorithms_noconf(); | ||
| 72 | OPENSSL_config(NULL); | ||
| 73 | } | ||
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index c268d25cb4..bead6a2170 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
| @@ -204,7 +204,6 @@ skip_to_init: | |||
| 204 | case EVP_CIPH_OFB_MODE: | 204 | case EVP_CIPH_OFB_MODE: |
| 205 | 205 | ||
| 206 | ctx->num = 0; | 206 | ctx->num = 0; |
| 207 | /* fall-through */ | ||
| 208 | 207 | ||
| 209 | case EVP_CIPH_CBC_MODE: | 208 | case EVP_CIPH_CBC_MODE: |
| 210 | 209 | ||
diff --git a/src/lib/libcrypto/evp/evp_err.c b/src/lib/libcrypto/evp/evp_err.c index d8bfec0959..6b585c7483 100644 --- a/src/lib/libcrypto/evp/evp_err.c +++ b/src/lib/libcrypto/evp/evp_err.c | |||
| @@ -70,6 +70,7 @@ | |||
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA EVP_str_functs[]= | 71 | static ERR_STRING_DATA EVP_str_functs[]= |
| 72 | { | 72 | { |
| 73 | {ERR_FUNC(EVP_F_AESNI_INIT_KEY), "AESNI_INIT_KEY"}, | ||
| 73 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, | 74 | {ERR_FUNC(EVP_F_AES_INIT_KEY), "AES_INIT_KEY"}, |
| 74 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, | 75 | {ERR_FUNC(EVP_F_CAMELLIA_INIT_KEY), "CAMELLIA_INIT_KEY"}, |
| 75 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, | 76 | {ERR_FUNC(EVP_F_D2I_PKEY), "D2I_PKEY"}, |
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c new file mode 100644 index 0000000000..902efac975 --- /dev/null +++ b/src/lib/libcrypto/evp/evp_test.c | |||
| @@ -0,0 +1,449 @@ | |||
| 1 | /* Written by Ben Laurie, 2001 */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | */ | ||
| 49 | |||
| 50 | #include <stdio.h> | ||
| 51 | #include <string.h> | ||
| 52 | |||
| 53 | #include "../e_os.h" | ||
| 54 | |||
| 55 | #include <openssl/opensslconf.h> | ||
| 56 | #include <openssl/evp.h> | ||
| 57 | #ifndef OPENSSL_NO_ENGINE | ||
| 58 | #include <openssl/engine.h> | ||
| 59 | #endif | ||
| 60 | #include <openssl/err.h> | ||
| 61 | #include <openssl/conf.h> | ||
| 62 | |||
| 63 | static void hexdump(FILE *f,const char *title,const unsigned char *s,int l) | ||
| 64 | { | ||
| 65 | int n=0; | ||
| 66 | |||
| 67 | fprintf(f,"%s",title); | ||
| 68 | for( ; n < l ; ++n) | ||
| 69 | { | ||
| 70 | if((n%16) == 0) | ||
| 71 | fprintf(f,"\n%04x",n); | ||
| 72 | fprintf(f," %02x",s[n]); | ||
| 73 | } | ||
| 74 | fprintf(f,"\n"); | ||
| 75 | } | ||
| 76 | |||
| 77 | static int convert(unsigned char *s) | ||
| 78 | { | ||
| 79 | unsigned char *d; | ||
| 80 | |||
| 81 | for(d=s ; *s ; s+=2,++d) | ||
| 82 | { | ||
| 83 | unsigned int n; | ||
| 84 | |||
| 85 | if(!s[1]) | ||
| 86 | { | ||
| 87 | fprintf(stderr,"Odd number of hex digits!"); | ||
| 88 | EXIT(4); | ||
| 89 | } | ||
| 90 | sscanf((char *)s,"%2x",&n); | ||
| 91 | *d=(unsigned char)n; | ||
| 92 | } | ||
| 93 | return s-d; | ||
| 94 | } | ||
| 95 | |||
| 96 | static char *sstrsep(char **string, const char *delim) | ||
| 97 | { | ||
| 98 | char isdelim[256]; | ||
| 99 | char *token = *string; | ||
| 100 | |||
| 101 | if (**string == 0) | ||
| 102 | return NULL; | ||
| 103 | |||
| 104 | memset(isdelim, 0, 256); | ||
| 105 | isdelim[0] = 1; | ||
| 106 | |||
| 107 | while (*delim) | ||
| 108 | { | ||
| 109 | isdelim[(unsigned char)(*delim)] = 1; | ||
| 110 | delim++; | ||
| 111 | } | ||
| 112 | |||
| 113 | while (!isdelim[(unsigned char)(**string)]) | ||
| 114 | { | ||
| 115 | (*string)++; | ||
| 116 | } | ||
| 117 | |||
| 118 | if (**string) | ||
| 119 | { | ||
| 120 | **string = 0; | ||
| 121 | (*string)++; | ||
| 122 | } | ||
| 123 | |||
| 124 | return token; | ||
| 125 | } | ||
| 126 | |||
| 127 | static unsigned char *ustrsep(char **p,const char *sep) | ||
| 128 | { return (unsigned char *)sstrsep(p,sep); } | ||
| 129 | |||
| 130 | static int test1_exit(int ec) | ||
| 131 | { | ||
| 132 | EXIT(ec); | ||
| 133 | return(0); /* To keep some compilers quiet */ | ||
| 134 | } | ||
| 135 | |||
| 136 | static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | ||
| 137 | const unsigned char *iv,int in, | ||
| 138 | const unsigned char *plaintext,int pn, | ||
| 139 | const unsigned char *ciphertext,int cn, | ||
| 140 | int encdec) | ||
| 141 | { | ||
| 142 | EVP_CIPHER_CTX ctx; | ||
| 143 | unsigned char out[4096]; | ||
| 144 | int outl,outl2; | ||
| 145 | |||
| 146 | printf("Testing cipher %s%s\n",EVP_CIPHER_name(c), | ||
| 147 | (encdec == 1 ? "(encrypt)" : (encdec == 0 ? "(decrypt)" : "(encrypt/decrypt)"))); | ||
| 148 | hexdump(stdout,"Key",key,kn); | ||
| 149 | if(in) | ||
| 150 | hexdump(stdout,"IV",iv,in); | ||
| 151 | hexdump(stdout,"Plaintext",plaintext,pn); | ||
| 152 | hexdump(stdout,"Ciphertext",ciphertext,cn); | ||
| 153 | |||
| 154 | if(kn != c->key_len) | ||
| 155 | { | ||
| 156 | fprintf(stderr,"Key length doesn't match, got %d expected %lu\n",kn, | ||
| 157 | (unsigned long)c->key_len); | ||
| 158 | test1_exit(5); | ||
| 159 | } | ||
| 160 | EVP_CIPHER_CTX_init(&ctx); | ||
| 161 | if (encdec != 0) | ||
| 162 | { | ||
| 163 | if(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv)) | ||
| 164 | { | ||
| 165 | fprintf(stderr,"EncryptInit failed\n"); | ||
| 166 | ERR_print_errors_fp(stderr); | ||
| 167 | test1_exit(10); | ||
| 168 | } | ||
| 169 | EVP_CIPHER_CTX_set_padding(&ctx,0); | ||
| 170 | |||
| 171 | if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn)) | ||
| 172 | { | ||
| 173 | fprintf(stderr,"Encrypt failed\n"); | ||
| 174 | ERR_print_errors_fp(stderr); | ||
| 175 | test1_exit(6); | ||
| 176 | } | ||
| 177 | if(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2)) | ||
| 178 | { | ||
| 179 | fprintf(stderr,"EncryptFinal failed\n"); | ||
| 180 | ERR_print_errors_fp(stderr); | ||
| 181 | test1_exit(7); | ||
| 182 | } | ||
| 183 | |||
| 184 | if(outl+outl2 != cn) | ||
| 185 | { | ||
| 186 | fprintf(stderr,"Ciphertext length mismatch got %d expected %d\n", | ||
| 187 | outl+outl2,cn); | ||
| 188 | test1_exit(8); | ||
| 189 | } | ||
| 190 | |||
| 191 | if(memcmp(out,ciphertext,cn)) | ||
| 192 | { | ||
| 193 | fprintf(stderr,"Ciphertext mismatch\n"); | ||
| 194 | hexdump(stderr,"Got",out,cn); | ||
| 195 | hexdump(stderr,"Expected",ciphertext,cn); | ||
| 196 | test1_exit(9); | ||
| 197 | } | ||
| 198 | } | ||
| 199 | |||
| 200 | if (encdec <= 0) | ||
| 201 | { | ||
| 202 | if(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv)) | ||
| 203 | { | ||
| 204 | fprintf(stderr,"DecryptInit failed\n"); | ||
| 205 | ERR_print_errors_fp(stderr); | ||
| 206 | test1_exit(11); | ||
| 207 | } | ||
| 208 | EVP_CIPHER_CTX_set_padding(&ctx,0); | ||
| 209 | |||
| 210 | if(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn)) | ||
| 211 | { | ||
| 212 | fprintf(stderr,"Decrypt failed\n"); | ||
| 213 | ERR_print_errors_fp(stderr); | ||
| 214 | test1_exit(6); | ||
| 215 | } | ||
| 216 | if(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2)) | ||
| 217 | { | ||
| 218 | fprintf(stderr,"DecryptFinal failed\n"); | ||
| 219 | ERR_print_errors_fp(stderr); | ||
| 220 | test1_exit(7); | ||
| 221 | } | ||
| 222 | |||
| 223 | if(outl+outl2 != pn) | ||
| 224 | { | ||
| 225 | fprintf(stderr,"Plaintext length mismatch got %d expected %d\n", | ||
| 226 | outl+outl2,pn); | ||
| 227 | test1_exit(8); | ||
| 228 | } | ||
| 229 | |||
| 230 | if(memcmp(out,plaintext,pn)) | ||
| 231 | { | ||
| 232 | fprintf(stderr,"Plaintext mismatch\n"); | ||
| 233 | hexdump(stderr,"Got",out,pn); | ||
| 234 | hexdump(stderr,"Expected",plaintext,pn); | ||
| 235 | test1_exit(9); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
| 240 | |||
| 241 | printf("\n"); | ||
| 242 | } | ||
| 243 | |||
| 244 | static int test_cipher(const char *cipher,const unsigned char *key,int kn, | ||
| 245 | const unsigned char *iv,int in, | ||
| 246 | const unsigned char *plaintext,int pn, | ||
| 247 | const unsigned char *ciphertext,int cn, | ||
| 248 | int encdec) | ||
| 249 | { | ||
| 250 | const EVP_CIPHER *c; | ||
| 251 | |||
| 252 | c=EVP_get_cipherbyname(cipher); | ||
| 253 | if(!c) | ||
| 254 | return 0; | ||
| 255 | |||
| 256 | test1(c,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec); | ||
| 257 | |||
| 258 | return 1; | ||
| 259 | } | ||
| 260 | |||
| 261 | static int test_digest(const char *digest, | ||
| 262 | const unsigned char *plaintext,int pn, | ||
| 263 | const unsigned char *ciphertext, unsigned int cn) | ||
| 264 | { | ||
| 265 | const EVP_MD *d; | ||
| 266 | EVP_MD_CTX ctx; | ||
| 267 | unsigned char md[EVP_MAX_MD_SIZE]; | ||
| 268 | unsigned int mdn; | ||
| 269 | |||
| 270 | d=EVP_get_digestbyname(digest); | ||
| 271 | if(!d) | ||
| 272 | return 0; | ||
| 273 | |||
| 274 | printf("Testing digest %s\n",EVP_MD_name(d)); | ||
| 275 | hexdump(stdout,"Plaintext",plaintext,pn); | ||
| 276 | hexdump(stdout,"Digest",ciphertext,cn); | ||
| 277 | |||
| 278 | EVP_MD_CTX_init(&ctx); | ||
| 279 | if(!EVP_DigestInit_ex(&ctx,d, NULL)) | ||
| 280 | { | ||
| 281 | fprintf(stderr,"DigestInit failed\n"); | ||
| 282 | ERR_print_errors_fp(stderr); | ||
| 283 | EXIT(100); | ||
| 284 | } | ||
| 285 | if(!EVP_DigestUpdate(&ctx,plaintext,pn)) | ||
| 286 | { | ||
| 287 | fprintf(stderr,"DigestUpdate failed\n"); | ||
| 288 | ERR_print_errors_fp(stderr); | ||
| 289 | EXIT(101); | ||
| 290 | } | ||
| 291 | if(!EVP_DigestFinal_ex(&ctx,md,&mdn)) | ||
| 292 | { | ||
| 293 | fprintf(stderr,"DigestFinal failed\n"); | ||
| 294 | ERR_print_errors_fp(stderr); | ||
| 295 | EXIT(101); | ||
| 296 | } | ||
| 297 | EVP_MD_CTX_cleanup(&ctx); | ||
| 298 | |||
| 299 | if(mdn != cn) | ||
| 300 | { | ||
| 301 | fprintf(stderr,"Digest length mismatch, got %d expected %d\n",mdn,cn); | ||
| 302 | EXIT(102); | ||
| 303 | } | ||
| 304 | |||
| 305 | if(memcmp(md,ciphertext,cn)) | ||
| 306 | { | ||
| 307 | fprintf(stderr,"Digest mismatch\n"); | ||
| 308 | hexdump(stderr,"Got",md,cn); | ||
| 309 | hexdump(stderr,"Expected",ciphertext,cn); | ||
| 310 | EXIT(103); | ||
| 311 | } | ||
| 312 | |||
| 313 | printf("\n"); | ||
| 314 | |||
| 315 | EVP_MD_CTX_cleanup(&ctx); | ||
| 316 | |||
| 317 | return 1; | ||
| 318 | } | ||
| 319 | |||
| 320 | int main(int argc,char **argv) | ||
| 321 | { | ||
| 322 | const char *szTestFile; | ||
| 323 | FILE *f; | ||
| 324 | |||
| 325 | if(argc != 2) | ||
| 326 | { | ||
| 327 | fprintf(stderr,"%s <test file>\n",argv[0]); | ||
| 328 | EXIT(1); | ||
| 329 | } | ||
| 330 | CRYPTO_malloc_debug_init(); | ||
| 331 | CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); | ||
| 332 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 333 | |||
| 334 | szTestFile=argv[1]; | ||
| 335 | |||
| 336 | f=fopen(szTestFile,"r"); | ||
| 337 | if(!f) | ||
| 338 | { | ||
| 339 | perror(szTestFile); | ||
| 340 | EXIT(2); | ||
| 341 | } | ||
| 342 | |||
| 343 | /* Load up the software EVP_CIPHER and EVP_MD definitions */ | ||
| 344 | OpenSSL_add_all_ciphers(); | ||
| 345 | OpenSSL_add_all_digests(); | ||
| 346 | #ifndef OPENSSL_NO_ENGINE | ||
| 347 | /* Load all compiled-in ENGINEs */ | ||
| 348 | ENGINE_load_builtin_engines(); | ||
| 349 | #endif | ||
| 350 | #if 0 | ||
| 351 | OPENSSL_config(); | ||
| 352 | #endif | ||
| 353 | #ifndef OPENSSL_NO_ENGINE | ||
| 354 | /* Register all available ENGINE implementations of ciphers and digests. | ||
| 355 | * This could perhaps be changed to "ENGINE_register_all_complete()"? */ | ||
| 356 | ENGINE_register_all_ciphers(); | ||
| 357 | ENGINE_register_all_digests(); | ||
| 358 | /* If we add command-line options, this statement should be switchable. | ||
| 359 | * It'll prevent ENGINEs being ENGINE_init()ialised for cipher/digest use if | ||
| 360 | * they weren't already initialised. */ | ||
| 361 | /* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */ | ||
| 362 | #endif | ||
| 363 | |||
| 364 | for( ; ; ) | ||
| 365 | { | ||
| 366 | char line[4096]; | ||
| 367 | char *p; | ||
| 368 | char *cipher; | ||
| 369 | unsigned char *iv,*key,*plaintext,*ciphertext; | ||
| 370 | int encdec; | ||
| 371 | int kn,in,pn,cn; | ||
| 372 | |||
| 373 | if(!fgets((char *)line,sizeof line,f)) | ||
| 374 | break; | ||
| 375 | if(line[0] == '#' || line[0] == '\n') | ||
| 376 | continue; | ||
| 377 | p=line; | ||
| 378 | cipher=sstrsep(&p,":"); | ||
| 379 | key=ustrsep(&p,":"); | ||
| 380 | iv=ustrsep(&p,":"); | ||
| 381 | plaintext=ustrsep(&p,":"); | ||
| 382 | ciphertext=ustrsep(&p,":"); | ||
| 383 | if (p[-1] == '\n') { | ||
| 384 | p[-1] = '\0'; | ||
| 385 | encdec = -1; | ||
| 386 | } else { | ||
| 387 | encdec = atoi(sstrsep(&p,"\n")); | ||
| 388 | } | ||
| 389 | |||
| 390 | |||
| 391 | kn=convert(key); | ||
| 392 | in=convert(iv); | ||
| 393 | pn=convert(plaintext); | ||
| 394 | cn=convert(ciphertext); | ||
| 395 | |||
| 396 | if(!test_cipher(cipher,key,kn,iv,in,plaintext,pn,ciphertext,cn,encdec) | ||
| 397 | && !test_digest(cipher,plaintext,pn,ciphertext,cn)) | ||
| 398 | { | ||
| 399 | #ifdef OPENSSL_NO_AES | ||
| 400 | if (strstr(cipher, "AES") == cipher) | ||
| 401 | { | ||
| 402 | fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); | ||
| 403 | continue; | ||
| 404 | } | ||
| 405 | #endif | ||
| 406 | #ifdef OPENSSL_NO_DES | ||
| 407 | if (strstr(cipher, "DES") == cipher) | ||
| 408 | { | ||
| 409 | fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); | ||
| 410 | continue; | ||
| 411 | } | ||
| 412 | #endif | ||
| 413 | #ifdef OPENSSL_NO_RC4 | ||
| 414 | if (strstr(cipher, "RC4") == cipher) | ||
| 415 | { | ||
| 416 | fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); | ||
| 417 | continue; | ||
| 418 | } | ||
| 419 | #endif | ||
| 420 | #ifdef OPENSSL_NO_CAMELLIA | ||
| 421 | if (strstr(cipher, "CAMELLIA") == cipher) | ||
| 422 | { | ||
| 423 | fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); | ||
| 424 | continue; | ||
| 425 | } | ||
| 426 | #endif | ||
| 427 | #ifdef OPENSSL_NO_SEED | ||
| 428 | if (strstr(cipher, "SEED") == cipher) | ||
| 429 | { | ||
| 430 | fprintf(stdout, "Cipher disabled, skipping %s\n", cipher); | ||
| 431 | continue; | ||
| 432 | } | ||
| 433 | #endif | ||
| 434 | fprintf(stderr,"Can't find %s\n",cipher); | ||
| 435 | EXIT(3); | ||
| 436 | } | ||
| 437 | } | ||
| 438 | |||
| 439 | #ifndef OPENSSL_NO_ENGINE | ||
| 440 | ENGINE_cleanup(); | ||
| 441 | #endif | ||
| 442 | EVP_cleanup(); | ||
| 443 | CRYPTO_cleanup_all_ex_data(); | ||
| 444 | ERR_remove_thread_state(NULL); | ||
| 445 | ERR_free_strings(); | ||
| 446 | CRYPTO_mem_leaks_fp(stderr); | ||
| 447 | |||
| 448 | return 0; | ||
| 449 | } | ||
diff --git a/src/lib/libcrypto/evp/evptests.txt b/src/lib/libcrypto/evp/evptests.txt new file mode 100644 index 0000000000..beb12144b6 --- /dev/null +++ b/src/lib/libcrypto/evp/evptests.txt | |||
| @@ -0,0 +1,321 @@ | |||
| 1 | #cipher:key:iv:plaintext:ciphertext:0/1(decrypt/encrypt) | ||
| 2 | #digest:::input:output | ||
| 3 | |||
| 4 | # SHA(1) tests (from shatest.c) | ||
| 5 | SHA1:::616263:a9993e364706816aba3e25717850c26c9cd0d89d | ||
| 6 | |||
| 7 | # MD5 tests (from md5test.c) | ||
| 8 | MD5::::d41d8cd98f00b204e9800998ecf8427e | ||
| 9 | MD5:::61:0cc175b9c0f1b6a831c399e269772661 | ||
| 10 | MD5:::616263:900150983cd24fb0d6963f7d28e17f72 | ||
| 11 | MD5:::6d65737361676520646967657374:f96b697d7cb7938d525a2f31aaf161d0 | ||
| 12 | MD5:::6162636465666768696a6b6c6d6e6f707172737475767778797a:c3fcd3d76192e4007dfb496cca67e13b | ||
| 13 | MD5:::4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a30313233343536373839:d174ab98d277d9f5a5611c2c9f419d9f | ||
| 14 | MD5:::3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930:57edf4a22be3c955ac49da2e2107b67a | ||
| 15 | |||
| 16 | # AES 128 ECB tests (from FIPS-197 test vectors, encrypt) | ||
| 17 | |||
| 18 | AES-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:69C4E0D86A7B0430D8CDB78070B4C55A:1 | ||
| 19 | |||
| 20 | # AES 192 ECB tests (from FIPS-197 test vectors, encrypt) | ||
| 21 | |||
| 22 | AES-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:1 | ||
| 23 | |||
| 24 | # AES 256 ECB tests (from FIPS-197 test vectors, encrypt) | ||
| 25 | |||
| 26 | AES-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:1 | ||
| 27 | |||
| 28 | # AES 128 ECB tests (from NIST test vectors, encrypt) | ||
| 29 | |||
| 30 | #AES-128-ECB:00000000000000000000000000000000::00000000000000000000000000000000:C34C052CC0DA8D73451AFE5F03BE297F:1 | ||
| 31 | |||
| 32 | # AES 128 ECB tests (from NIST test vectors, decrypt) | ||
| 33 | |||
| 34 | #AES-128-ECB:00000000000000000000000000000000::44416AC2D1F53C583303917E6BE9EBE0:00000000000000000000000000000000:0 | ||
| 35 | |||
| 36 | # AES 192 ECB tests (from NIST test vectors, decrypt) | ||
| 37 | |||
| 38 | #AES-192-ECB:000000000000000000000000000000000000000000000000::48E31E9E256718F29229319C19F15BA4:00000000000000000000000000000000:0 | ||
| 39 | |||
| 40 | # AES 256 ECB tests (from NIST test vectors, decrypt) | ||
| 41 | |||
| 42 | #AES-256-ECB:0000000000000000000000000000000000000000000000000000000000000000::058CCFFDBBCB382D1F6F56585D8A4ADE:00000000000000000000000000000000:0 | ||
| 43 | |||
| 44 | # AES 128 CBC tests (from NIST test vectors, encrypt) | ||
| 45 | |||
| 46 | #AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:8A05FC5E095AF4848A08D328D3688E3D:1 | ||
| 47 | |||
| 48 | # AES 192 CBC tests (from NIST test vectors, encrypt) | ||
| 49 | |||
| 50 | #AES-192-CBC:000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:7BD966D53AD8C1BB85D2ADFAE87BB104:1 | ||
| 51 | |||
| 52 | # AES 256 CBC tests (from NIST test vectors, encrypt) | ||
| 53 | |||
| 54 | #AES-256-CBC:0000000000000000000000000000000000000000000000000000000000000000:00000000000000000000000000000000:00000000000000000000000000000000:FE3C53653E2F45B56FCD88B2CC898FF0:1 | ||
| 55 | |||
| 56 | # AES 128 CBC tests (from NIST test vectors, decrypt) | ||
| 57 | |||
| 58 | #AES-128-CBC:00000000000000000000000000000000:00000000000000000000000000000000:FACA37E0B0C85373DF706E73F7C9AF86:00000000000000000000000000000000:0 | ||
| 59 | |||
| 60 | # AES tests from NIST document SP800-38A | ||
| 61 | # For all ECB encrypts and decrypts, the transformed sequence is | ||
| 62 | # AES-bits-ECB:key::plaintext:ciphertext:encdec | ||
| 63 | # ECB-AES128.Encrypt and ECB-AES128.Decrypt | ||
| 64 | AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:3AD77BB40D7A3660A89ECAF32466EF97 | ||
| 65 | AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:F5D3D58503B9699DE785895A96FDBAAF | ||
| 66 | AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:43B1CD7F598ECE23881B00E3ED030688 | ||
| 67 | AES-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:7B0C785E27E8AD3F8223207104725DD4 | ||
| 68 | # ECB-AES192.Encrypt and ECB-AES192.Decrypt | ||
| 69 | AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:BD334F1D6E45F25FF712A214571FA5CC | ||
| 70 | AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:974104846D0AD3AD7734ECB3ECEE4EEF | ||
| 71 | AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:EF7AFD2270E2E60ADCE0BA2FACE6444E | ||
| 72 | AES-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:9A4B41BA738D6C72FB16691603C18E0E | ||
| 73 | # ECB-AES256.Encrypt and ECB-AES256.Decrypt | ||
| 74 | AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:F3EED1BDB5D2A03C064B5A7E3DB181F8 | ||
| 75 | AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:591CCB10D410ED26DC5BA74A31362870 | ||
| 76 | AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:B6ED21B99CA6F4F9F153E7B1BEAFED1D | ||
| 77 | AES-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:23304B7A39F9F3FF067D8D8F9E24ECC7 | ||
| 78 | # For all CBC encrypts and decrypts, the transformed sequence is | ||
| 79 | # AES-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec | ||
| 80 | # CBC-AES128.Encrypt and CBC-AES128.Decrypt | ||
| 81 | AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:7649ABAC8119B246CEE98E9B12E9197D | ||
| 82 | AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:7649ABAC8119B246CEE98E9B12E9197D:AE2D8A571E03AC9C9EB76FAC45AF8E51:5086CB9B507219EE95DB113A917678B2 | ||
| 83 | AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:5086CB9B507219EE95DB113A917678B2:30C81C46A35CE411E5FBC1191A0A52EF:73BED6B8E3C1743B7116E69E22229516 | ||
| 84 | AES-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:73BED6B8E3C1743B7116E69E22229516:F69F2445DF4F9B17AD2B417BE66C3710:3FF1CAA1681FAC09120ECA307586E1A7 | ||
| 85 | # CBC-AES192.Encrypt and CBC-AES192.Decrypt | ||
| 86 | AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:4F021DB243BC633D7178183A9FA071E8 | ||
| 87 | AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:4F021DB243BC633D7178183A9FA071E8:AE2D8A571E03AC9C9EB76FAC45AF8E51:B4D9ADA9AD7DEDF4E5E738763F69145A | ||
| 88 | AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:B4D9ADA9AD7DEDF4E5E738763F69145A:30C81C46A35CE411E5FBC1191A0A52EF:571B242012FB7AE07FA9BAAC3DF102E0 | ||
| 89 | AES-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:571B242012FB7AE07FA9BAAC3DF102E0:F69F2445DF4F9B17AD2B417BE66C3710:08B0E27988598881D920A9E64F5615CD | ||
| 90 | # CBC-AES256.Encrypt and CBC-AES256.Decrypt | ||
| 91 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:F58C4C04D6E5F1BA779EABFB5F7BFBD6 | ||
| 92 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:F58C4C04D6E5F1BA779EABFB5F7BFBD6:AE2D8A571E03AC9C9EB76FAC45AF8E51:9CFC4E967EDB808D679F777BC6702C7D | ||
| 93 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:9CFC4E967EDB808D679F777BC6702C7D:30C81C46A35CE411E5FBC1191A0A52EF:39F23369A9D9BACFA530E26304231461 | ||
| 94 | AES-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39F23369A9D9BACFA530E26304231461:F69F2445DF4F9B17AD2B417BE66C3710:B2EB05E2C39BE9FCDA6C19078C6A9D1B | ||
| 95 | # We don't support CFB{1,8}-AESxxx.{En,De}crypt | ||
| 96 | # For all CFB128 encrypts and decrypts, the transformed sequence is | ||
| 97 | # AES-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec | ||
| 98 | # CFB128-AES128.Encrypt | ||
| 99 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1 | ||
| 100 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:1 | ||
| 101 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:1 | ||
| 102 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:1 | ||
| 103 | # CFB128-AES128.Decrypt | ||
| 104 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0 | ||
| 105 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:3B3FD92EB72DAD20333449F8E83CFB4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:C8A64537A0B3A93FCDE3CDAD9F1CE58B:0 | ||
| 106 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:C8A64537A0B3A93FCDE3CDAD9F1CE58B:30C81C46A35CE411E5FBC1191A0A52EF:26751F67A3CBB140B1808CF187A4F4DF:0 | ||
| 107 | AES-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:26751F67A3CBB140B1808CF187A4F4DF:F69F2445DF4F9B17AD2B417BE66C3710:C04B05357C5D1C0EEAC4C66F9FF7F2E6:0 | ||
| 108 | # CFB128-AES192.Encrypt | ||
| 109 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1 | ||
| 110 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:1 | ||
| 111 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:1 | ||
| 112 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:1 | ||
| 113 | # CFB128-AES192.Decrypt | ||
| 114 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0 | ||
| 115 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:CDC80D6FDDF18CAB34C25909C99A4174:AE2D8A571E03AC9C9EB76FAC45AF8E51:67CE7F7F81173621961A2B70171D3D7A:0 | ||
| 116 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:67CE7F7F81173621961A2B70171D3D7A:30C81C46A35CE411E5FBC1191A0A52EF:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:0 | ||
| 117 | AES-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2E1E8A1DD59B88B1C8E60FED1EFAC4C9:F69F2445DF4F9B17AD2B417BE66C3710:C05F9F9CA9834FA042AE8FBA584B09FF:0 | ||
| 118 | # CFB128-AES256.Encrypt | ||
| 119 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1 | ||
| 120 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:1 | ||
| 121 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:1 | ||
| 122 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:1 | ||
| 123 | # CFB128-AES256.Decrypt | ||
| 124 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0 | ||
| 125 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DC7E84BFDA79164B7ECD8486985D3860:AE2D8A571E03AC9C9EB76FAC45AF8E51:39FFED143B28B1C832113C6331E5407B:0 | ||
| 126 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:39FFED143B28B1C832113C6331E5407B:30C81C46A35CE411E5FBC1191A0A52EF:DF10132415E54B92A13ED0A8267AE2F9:0 | ||
| 127 | AES-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:DF10132415E54B92A13ED0A8267AE2F9:F69F2445DF4F9B17AD2B417BE66C3710:75A385741AB9CEF82031623D55B1E471:0 | ||
| 128 | # For all OFB encrypts and decrypts, the transformed sequence is | ||
| 129 | # AES-bits-CFB:key:IV/output':plaintext:ciphertext:encdec | ||
| 130 | # OFB-AES128.Encrypt | ||
| 131 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:1 | ||
| 132 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:1 | ||
| 133 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:1 | ||
| 134 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:1 | ||
| 135 | # OFB-AES128.Decrypt | ||
| 136 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:3B3FD92EB72DAD20333449F8E83CFB4A:0 | ||
| 137 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:7789508D16918F03F53C52DAC54ED825:0 | ||
| 138 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:9740051E9C5FECF64344F7A82260EDCC:0 | ||
| 139 | AES-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:304C6528F659C77866A510D9C1D6AE5E:0 | ||
| 140 | # OFB-AES192.Encrypt | ||
| 141 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:1 | ||
| 142 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:1 | ||
| 143 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:1 | ||
| 144 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:1 | ||
| 145 | # OFB-AES192.Decrypt | ||
| 146 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CDC80D6FDDF18CAB34C25909C99A4174:0 | ||
| 147 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:FCC28B8D4C63837C09E81700C1100401:0 | ||
| 148 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:8D9A9AEAC0F6596F559C6D4DAF59A5F2:0 | ||
| 149 | AES-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:6D9F200857CA6C3E9CAC524BD9ACC92A:0 | ||
| 150 | # OFB-AES256.Encrypt | ||
| 151 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:1 | ||
| 152 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:1 | ||
| 153 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:1 | ||
| 154 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:1 | ||
| 155 | # OFB-AES256.Decrypt | ||
| 156 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:DC7E84BFDA79164B7ECD8486985D3860:0 | ||
| 157 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:4FEBDC6740D20B3AC88F6AD82A4FB08D:0 | ||
| 158 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:71AB47A086E86EEDF39D1C5BBA97C408:0 | ||
| 159 | AES-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0126141D67F37BE8538F5A8BE740E484:0 | ||
| 160 | |||
| 161 | # DES ECB tests (from destest) | ||
| 162 | |||
| 163 | DES-ECB:0000000000000000::0000000000000000:8CA64DE9C1B123A7 | ||
| 164 | DES-ECB:FFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFF:7359B2163E4EDC58 | ||
| 165 | DES-ECB:3000000000000000::1000000000000001:958E6E627A05557B | ||
| 166 | DES-ECB:1111111111111111::1111111111111111:F40379AB9E0EC533 | ||
| 167 | DES-ECB:0123456789ABCDEF::1111111111111111:17668DFC7292532D | ||
| 168 | DES-ECB:1111111111111111::0123456789ABCDEF:8A5AE1F81AB8F2DD | ||
| 169 | DES-ECB:FEDCBA9876543210::0123456789ABCDEF:ED39D950FA74BCC4 | ||
| 170 | |||
| 171 | # DESX-CBC tests (from destest) | ||
| 172 | DESX-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:846B2914851E9A2954732F8AA0A611C115CDC2D7951B1053A63C5E03B21AA3C4 | ||
| 173 | |||
| 174 | # DES EDE3 CBC tests (from destest) | ||
| 175 | DES-EDE3-CBC:0123456789abcdeff1e0d3c2b5a49786fedcba9876543210:fedcba9876543210:37363534333231204E6F77206973207468652074696D6520666F722000000000:3FE301C962AC01D02213763C1CBD4CDC799657C064ECF5D41C673812CFDE9675 | ||
| 176 | |||
| 177 | # RC4 tests (from rc4test) | ||
| 178 | RC4:0123456789abcdef0123456789abcdef::0123456789abcdef:75b7878099e0c596 | ||
| 179 | RC4:0123456789abcdef0123456789abcdef::0000000000000000:7494c2e7104b0879 | ||
| 180 | RC4:00000000000000000000000000000000::0000000000000000:de188941a3375d3a | ||
| 181 | RC4:ef012345ef012345ef012345ef012345::0000000000000000000000000000000000000000:d6a141a7ec3c38dfbd615a1162e1c7ba36b67858 | ||
| 182 | RC4:0123456789abcdef0123456789abcdef::123456789ABCDEF0123456789ABCDEF0123456789ABCDEF012345678:66a0949f8af7d6891f7f832ba833c00c892ebe30143ce28740011ecf | ||
| 183 | RC4:ef012345ef012345ef012345ef012345::00000000000000000000:d6a141a7ec3c38dfbd61 | ||
| 184 | |||
| 185 | |||
| 186 | # Camellia tests from RFC3713 | ||
| 187 | # For all ECB encrypts and decrypts, the transformed sequence is | ||
| 188 | # CAMELLIA-bits-ECB:key::plaintext:ciphertext:encdec | ||
| 189 | CAMELLIA-128-ECB:0123456789abcdeffedcba9876543210::0123456789abcdeffedcba9876543210:67673138549669730857065648eabe43 | ||
| 190 | CAMELLIA-192-ECB:0123456789abcdeffedcba98765432100011223344556677::0123456789abcdeffedcba9876543210:b4993401b3e996f84ee5cee7d79b09b9 | ||
| 191 | CAMELLIA-256-ECB:0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff::0123456789abcdeffedcba9876543210:9acc237dff16d76c20ef7c919e3a7509 | ||
| 192 | |||
| 193 | # ECB-CAMELLIA128.Encrypt | ||
| 194 | CAMELLIA-128-ECB:000102030405060708090A0B0C0D0E0F::00112233445566778899AABBCCDDEEFF:77CF412067AF8270613529149919546F:1 | ||
| 195 | CAMELLIA-192-ECB:000102030405060708090A0B0C0D0E0F1011121314151617::00112233445566778899AABBCCDDEEFF:B22F3C36B72D31329EEE8ADDC2906C68:1 | ||
| 196 | CAMELLIA-256-ECB:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F::00112233445566778899AABBCCDDEEFF:2EDF1F3418D53B88841FC8985FB1ECF2:1 | ||
| 197 | |||
| 198 | # ECB-CAMELLIA128.Encrypt and ECB-CAMELLIA128.Decrypt | ||
| 199 | CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::6BC1BEE22E409F96E93D7E117393172A:432FC5DCD628115B7C388D770B270C96 | ||
| 200 | CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::AE2D8A571E03AC9C9EB76FAC45AF8E51:0BE1F14023782A22E8384C5ABB7FAB2B | ||
| 201 | CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::30C81C46A35CE411E5FBC1191A0A52EF:A0A1ABCD1893AB6FE0FE5B65DF5F8636 | ||
| 202 | CAMELLIA-128-ECB:2B7E151628AED2A6ABF7158809CF4F3C::F69F2445DF4F9B17AD2B417BE66C3710:E61925E0D5DFAA9BB29F815B3076E51A | ||
| 203 | |||
| 204 | # ECB-CAMELLIA192.Encrypt and ECB-CAMELLIA192.Decrypt | ||
| 205 | CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::6BC1BEE22E409F96E93D7E117393172A:CCCC6C4E138B45848514D48D0D3439D3 | ||
| 206 | CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::AE2D8A571E03AC9C9EB76FAC45AF8E51:5713C62C14B2EC0F8393B6AFD6F5785A | ||
| 207 | CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::30C81C46A35CE411E5FBC1191A0A52EF:B40ED2B60EB54D09D030CF511FEEF366 | ||
| 208 | CAMELLIA-192-ECB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B::F69F2445DF4F9B17AD2B417BE66C3710:909DBD95799096748CB27357E73E1D26 | ||
| 209 | |||
| 210 | # ECB-CAMELLIA256.Encrypt and ECB-CAMELLIA256.Decrypt | ||
| 211 | CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::6BC1BEE22E409F96E93D7E117393172A:BEFD219B112FA00098919CD101C9CCFA | ||
| 212 | CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::AE2D8A571E03AC9C9EB76FAC45AF8E51:C91D3A8F1AEA08A9386CF4B66C0169EA | ||
| 213 | CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::30C81C46A35CE411E5FBC1191A0A52EF:A623D711DC5F25A51BB8A80D56397D28 | ||
| 214 | CAMELLIA-256-ECB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4::F69F2445DF4F9B17AD2B417BE66C3710:7960109FB6DC42947FCFE59EA3C5EB6B | ||
| 215 | |||
| 216 | # For all CBC encrypts and decrypts, the transformed sequence is | ||
| 217 | # CAMELLIA-bits-CBC:key:IV/ciphertext':plaintext:ciphertext:encdec | ||
| 218 | # CBC-CAMELLIA128.Encrypt and CBC-CAMELLIA128.Decrypt | ||
| 219 | CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:1607CF494B36BBF00DAEB0B503C831AB | ||
| 220 | CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:1607CF494B36BBF00DAEB0B503C831AB:AE2D8A571E03AC9C9EB76FAC45AF8E51:A2F2CF671629EF7840C5A5DFB5074887 | ||
| 221 | CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:A2F2CF671629EF7840C5A5DFB5074887:30C81C46A35CE411E5FBC1191A0A52EF:0F06165008CF8B8B5A63586362543E54 | ||
| 222 | CAMELLIA-128-CBC:2B7E151628AED2A6ABF7158809CF4F3C:36A84CDAFD5F9A85ADA0F0A993D6D577:F69F2445DF4F9B17AD2B417BE66C3710:74C64268CDB8B8FAF5B34E8AF3732980 | ||
| 223 | |||
| 224 | # CBC-CAMELLIA192.Encrypt and CBC-CAMELLIA192.Decrypt | ||
| 225 | CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:2A4830AB5AC4A1A2405955FD2195CF93 | ||
| 226 | CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:2A4830AB5AC4A1A2405955FD2195CF93:AE2D8A571E03AC9C9EB76FAC45AF8E51:5D5A869BD14CE54264F892A6DD2EC3D5 | ||
| 227 | CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:5D5A869BD14CE54264F892A6DD2EC3D5:30C81C46A35CE411E5FBC1191A0A52EF:37D359C3349836D884E310ADDF68C449 | ||
| 228 | CAMELLIA-192-CBC:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:37D359C3349836D884E310ADDF68C449:F69F2445DF4F9B17AD2B417BE66C3710:01FAAA930B4AB9916E9668E1428C6B08 | ||
| 229 | |||
| 230 | # CBC-CAMELLIA256.Encrypt and CBC-CAMELLIA256.Decrypt | ||
| 231 | CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:E6CFA35FC02B134A4D2C0B6737AC3EDA | ||
| 232 | CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E6CFA35FC02B134A4D2C0B6737AC3EDA:AE2D8A571E03AC9C9EB76FAC45AF8E51:36CBEB73BD504B4070B1B7DE2B21EB50 | ||
| 233 | CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:36CBEB73BD504B4070B1B7DE2B21EB50:30C81C46A35CE411E5FBC1191A0A52EF:E31A6055297D96CA3330CDF1B1860A83 | ||
| 234 | CAMELLIA-256-CBC:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E31A6055297D96CA3330CDF1B1860A83:F69F2445DF4F9B17AD2B417BE66C3710:5D563F6D1CCCF236051C0C5C1C58F28F | ||
| 235 | |||
| 236 | # We don't support CFB{1,8}-CAMELLIAxxx.{En,De}crypt | ||
| 237 | # For all CFB128 encrypts and decrypts, the transformed sequence is | ||
| 238 | # CAMELLIA-bits-CFB:key:IV/ciphertext':plaintext:ciphertext:encdec | ||
| 239 | # CFB128-CAMELLIA128.Encrypt | ||
| 240 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1 | ||
| 241 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:1 | ||
| 242 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:1 | ||
| 243 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:1 | ||
| 244 | |||
| 245 | # CFB128-CAMELLIA128.Decrypt | ||
| 246 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0 | ||
| 247 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:14F7646187817EB586599146B82BD719:AE2D8A571E03AC9C9EB76FAC45AF8E51:A53D28BB82DF741103EA4F921A44880B:0 | ||
| 248 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:A53D28BB82DF741103EA4F921A44880B:30C81C46A35CE411E5FBC1191A0A52EF:9C2157A664626D1DEF9EA420FDE69B96:0 | ||
| 249 | CAMELLIA-128-CFB:2B7E151628AED2A6ABF7158809CF4F3C:9C2157A664626D1DEF9EA420FDE69B96:F69F2445DF4F9B17AD2B417BE66C3710:742A25F0542340C7BAEF24CA8482BB09:0 | ||
| 250 | |||
| 251 | # CFB128-CAMELLIA192.Encrypt | ||
| 252 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1 | ||
| 253 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:1 | ||
| 254 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:1 | ||
| 255 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:1 | ||
| 256 | |||
| 257 | # CFB128-CAMELLIA192.Decrypt | ||
| 258 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0 | ||
| 259 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:C832BB9780677DAA82D9B6860DCD565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:86F8491627906D780C7A6D46EA331F98:0 | ||
| 260 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:86F8491627906D780C7A6D46EA331F98:30C81C46A35CE411E5FBC1191A0A52EF:69511CCE594CF710CB98BB63D7221F01:0 | ||
| 261 | CAMELLIA-192-CFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:69511CCE594CF710CB98BB63D7221F01:F69F2445DF4F9B17AD2B417BE66C3710:D5B5378A3ABED55803F25565D8907B84:0 | ||
| 262 | |||
| 263 | # CFB128-CAMELLIA256.Encrypt | ||
| 264 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1 | ||
| 265 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:1 | ||
| 266 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:1 | ||
| 267 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:1 | ||
| 268 | |||
| 269 | # CFB128-CAMELLIA256.Decrypt | ||
| 270 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0 | ||
| 271 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:CF6107BB0CEA7D7FB1BD31F5E7B06C93:AE2D8A571E03AC9C9EB76FAC45AF8E51:89BEDB4CCDD864EA11BA4CBE849B5E2B:0 | ||
| 272 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:89BEDB4CCDD864EA11BA4CBE849B5E2B:30C81C46A35CE411E5FBC1191A0A52EF:555FC3F34BDD2D54C62D9E3BF338C1C4:0 | ||
| 273 | CAMELLIA-256-CFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:555FC3F34BDD2D54C62D9E3BF338C1C4:F69F2445DF4F9B17AD2B417BE66C3710:5953ADCE14DB8C7F39F1BD39F359BFFA:0 | ||
| 274 | |||
| 275 | # For all OFB encrypts and decrypts, the transformed sequence is | ||
| 276 | # CAMELLIA-bits-OFB:key:IV/output':plaintext:ciphertext:encdec | ||
| 277 | # OFB-CAMELLIA128.Encrypt | ||
| 278 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:1 | ||
| 279 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:1 | ||
| 280 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:1 | ||
| 281 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:1 | ||
| 282 | |||
| 283 | # OFB-CAMELLIA128.Decrypt | ||
| 284 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:14F7646187817EB586599146B82BD719:0 | ||
| 285 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:50FE67CC996D32B6DA0937E99BAFEC60:AE2D8A571E03AC9C9EB76FAC45AF8E51:25623DB569CA51E01482649977E28D84:0 | ||
| 286 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:D9A4DADA0892239F6B8B3D7680E15674:30C81C46A35CE411E5FBC1191A0A52EF:C776634A60729DC657D12B9FCA801E98:0 | ||
| 287 | CAMELLIA-128-OFB:2B7E151628AED2A6ABF7158809CF4F3C:A78819583F0308E7A6BF36B1386ABF23:F69F2445DF4F9B17AD2B417BE66C3710:D776379BE0E50825E681DA1A4C980E8E:0 | ||
| 288 | |||
| 289 | # OFB-CAMELLIA192.Encrypt | ||
| 290 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:1 | ||
| 291 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:1 | ||
| 292 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:1 | ||
| 293 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:1 | ||
| 294 | |||
| 295 | # OFB-CAMELLIA192.Decrypt | ||
| 296 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:C832BB9780677DAA82D9B6860DCD565E:0 | ||
| 297 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:A609B38DF3B1133DDDFF2718BA09565E:AE2D8A571E03AC9C9EB76FAC45AF8E51:8ECEB7D0350D72C7F78562AEBDF99339:0 | ||
| 298 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:52EF01DA52602FE0975F78AC84BF8A50:30C81C46A35CE411E5FBC1191A0A52EF:BDD62DBBB9700846C53B507F544696F0:0 | ||
| 299 | CAMELLIA-192-OFB:8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:BD5286AC63AABD7EB067AC54B553F71D:F69F2445DF4F9B17AD2B417BE66C3710:E28014E046B802F385C4C2E13EAD4A72:0 | ||
| 300 | |||
| 301 | # OFB-CAMELLIA256.Encrypt | ||
| 302 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:1 | ||
| 303 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:1 | ||
| 304 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:1 | ||
| 305 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:1 | ||
| 306 | |||
| 307 | # OFB-CAMELLIA256.Decrypt | ||
| 308 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:000102030405060708090A0B0C0D0E0F:6BC1BEE22E409F96E93D7E117393172A:CF6107BB0CEA7D7FB1BD31F5E7B06C93:0 | ||
| 309 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:B7BF3A5DF43989DD97F0FA97EBCE2F4A:AE2D8A571E03AC9C9EB76FAC45AF8E51:127AD97E8E3994E4820027D7BA109368:0 | ||
| 310 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:E1C656305ED1A7A6563805746FE03EDC:30C81C46A35CE411E5FBC1191A0A52EF:6BFF6265A6A6B7A535BC65A80B17214E:0 | ||
| 311 | CAMELLIA-256-OFB:603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:41635BE625B48AFC1666DD42A09D96E7:F69F2445DF4F9B17AD2B417BE66C3710:0A4A0404E26AA78A27CB271E8BF3CF20:0 | ||
| 312 | |||
| 313 | # SEED test vectors from RFC4269 | ||
| 314 | SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:0 | ||
| 315 | SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:0 | ||
| 316 | SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:0 | ||
| 317 | SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:0 | ||
| 318 | SEED-ECB:00000000000000000000000000000000::000102030405060708090A0B0C0D0E0F:5EBAC6E0054E166819AFF1CC6D346CDB:1 | ||
| 319 | SEED-ECB:000102030405060708090A0B0C0D0E0F::00000000000000000000000000000000:C11F22F20140505084483597E4370F43:1 | ||
| 320 | SEED-ECB:4706480851E61BE85D74BFB3FD956185::83A2F8A288641FB9A4E9A5CC2F131C7D:EE54D13EBCAE706D226BC3142CD40D4A:1 | ||
| 321 | SEED-ECB:28DBC3BC49FFD87DCFA509B11D422BE7::B41E6BE2EBA84A148E2EED84593C5EC7:9B9B7BFCD1813CB95D0B3618F40F5122:1 | ||
diff --git a/src/lib/libcrypto/evp/m_md2.c b/src/lib/libcrypto/evp/m_md2.c new file mode 100644 index 0000000000..5ce849f161 --- /dev/null +++ b/src/lib/libcrypto/evp/m_md2.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* crypto/evp/m_md2.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_MD2 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #include <openssl/md2.h> | ||
| 68 | #ifndef OPENSSL_NO_RSA | ||
| 69 | #include <openssl/rsa.h> | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static int init(EVP_MD_CTX *ctx) | ||
| 73 | { return MD2_Init(ctx->md_data); } | ||
| 74 | |||
| 75 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 76 | { return MD2_Update(ctx->md_data,data,count); } | ||
| 77 | |||
| 78 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 79 | { return MD2_Final(md,ctx->md_data); } | ||
| 80 | |||
| 81 | static const EVP_MD md2_md= | ||
| 82 | { | ||
| 83 | NID_md2, | ||
| 84 | NID_md2WithRSAEncryption, | ||
| 85 | MD2_DIGEST_LENGTH, | ||
| 86 | 0, | ||
| 87 | init, | ||
| 88 | update, | ||
| 89 | final, | ||
| 90 | NULL, | ||
| 91 | NULL, | ||
| 92 | EVP_PKEY_RSA_method, | ||
| 93 | MD2_BLOCK, | ||
| 94 | sizeof(EVP_MD *)+sizeof(MD2_CTX), | ||
| 95 | }; | ||
| 96 | |||
| 97 | const EVP_MD *EVP_md2(void) | ||
| 98 | { | ||
| 99 | return(&md2_md); | ||
| 100 | } | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_mdc2.c b/src/lib/libcrypto/evp/m_mdc2.c new file mode 100644 index 0000000000..b08d559803 --- /dev/null +++ b/src/lib/libcrypto/evp/m_mdc2.c | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | /* crypto/evp/m_mdc2.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #ifndef OPENSSL_NO_MDC2 | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #include <openssl/mdc2.h> | ||
| 68 | #ifndef OPENSSL_NO_RSA | ||
| 69 | #include <openssl/rsa.h> | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static int init(EVP_MD_CTX *ctx) | ||
| 73 | { return MDC2_Init(ctx->md_data); } | ||
| 74 | |||
| 75 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 76 | { return MDC2_Update(ctx->md_data,data,count); } | ||
| 77 | |||
| 78 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 79 | { return MDC2_Final(md,ctx->md_data); } | ||
| 80 | |||
| 81 | static const EVP_MD mdc2_md= | ||
| 82 | { | ||
| 83 | NID_mdc2, | ||
| 84 | NID_mdc2WithRSA, | ||
| 85 | MDC2_DIGEST_LENGTH, | ||
| 86 | 0, | ||
| 87 | init, | ||
| 88 | update, | ||
| 89 | final, | ||
| 90 | NULL, | ||
| 91 | NULL, | ||
| 92 | EVP_PKEY_RSA_ASN1_OCTET_STRING_method, | ||
| 93 | MDC2_BLOCK, | ||
| 94 | sizeof(EVP_MD *)+sizeof(MDC2_CTX), | ||
| 95 | }; | ||
| 96 | |||
| 97 | const EVP_MD *EVP_mdc2(void) | ||
| 98 | { | ||
| 99 | return(&mdc2_md); | ||
| 100 | } | ||
| 101 | #endif | ||
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c new file mode 100644 index 0000000000..acccc8f92d --- /dev/null +++ b/src/lib/libcrypto/evp/m_sha.c | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* crypto/evp/m_sha.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | ||
| 63 | |||
| 64 | #include <openssl/evp.h> | ||
| 65 | #include <openssl/objects.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #ifndef OPENSSL_NO_RSA | ||
| 68 | #include <openssl/rsa.h> | ||
| 69 | #endif | ||
| 70 | |||
| 71 | static int init(EVP_MD_CTX *ctx) | ||
| 72 | { return SHA_Init(ctx->md_data); } | ||
| 73 | |||
| 74 | static int update(EVP_MD_CTX *ctx,const void *data,size_t count) | ||
| 75 | { return SHA_Update(ctx->md_data,data,count); } | ||
| 76 | |||
| 77 | static int final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 78 | { return SHA_Final(md,ctx->md_data); } | ||
| 79 | |||
| 80 | static const EVP_MD sha_md= | ||
| 81 | { | ||
| 82 | NID_sha, | ||
| 83 | NID_shaWithRSAEncryption, | ||
| 84 | SHA_DIGEST_LENGTH, | ||
| 85 | 0, | ||
| 86 | init, | ||
| 87 | update, | ||
| 88 | final, | ||
| 89 | NULL, | ||
| 90 | NULL, | ||
| 91 | EVP_PKEY_RSA_method, | ||
| 92 | SHA_CBLOCK, | ||
| 93 | sizeof(EVP_MD *)+sizeof(SHA_CTX), | ||
| 94 | }; | ||
| 95 | |||
| 96 | const EVP_MD *EVP_sha(void) | ||
| 97 | { | ||
| 98 | return(&sha_md); | ||
| 99 | } | ||
| 100 | #endif | ||
diff --git a/src/lib/libcrypto/evp/openbsd_hw.c b/src/lib/libcrypto/evp/openbsd_hw.c new file mode 100644 index 0000000000..3831a5731e --- /dev/null +++ b/src/lib/libcrypto/evp/openbsd_hw.c | |||
| @@ -0,0 +1,446 @@ | |||
| 1 | /* Written by Ben Laurie, 2001 */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | */ | ||
| 49 | |||
| 50 | #include <openssl/evp.h> | ||
| 51 | #include <openssl/objects.h> | ||
| 52 | #include <openssl/rsa.h> | ||
| 53 | #include "evp_locl.h" | ||
| 54 | |||
| 55 | /* This stuff should now all be supported through | ||
| 56 | * crypto/engine/hw_openbsd_dev_crypto.c unless I botched it up */ | ||
| 57 | static void *dummy=&dummy; | ||
| 58 | |||
| 59 | #if 0 | ||
| 60 | |||
| 61 | /* check flag after OpenSSL headers to ensure make depend works */ | ||
| 62 | #ifdef OPENSSL_OPENBSD_DEV_CRYPTO | ||
| 63 | |||
| 64 | #include <fcntl.h> | ||
| 65 | #include <stdio.h> | ||
| 66 | #include <errno.h> | ||
| 67 | #include <sys/ioctl.h> | ||
| 68 | #include <crypto/cryptodev.h> | ||
| 69 | #include <unistd.h> | ||
| 70 | #include <assert.h> | ||
| 71 | |||
| 72 | /* longest key supported in hardware */ | ||
| 73 | #define MAX_HW_KEY 24 | ||
| 74 | #define MAX_HW_IV 8 | ||
| 75 | |||
| 76 | #define MD5_DIGEST_LENGTH 16 | ||
| 77 | #define MD5_CBLOCK 64 | ||
| 78 | |||
| 79 | static int fd; | ||
| 80 | static int dev_failed; | ||
| 81 | |||
| 82 | typedef struct session_op session_op; | ||
| 83 | |||
| 84 | #define CDATA(ctx) EVP_C_DATA(session_op,ctx) | ||
| 85 | |||
| 86 | static void err(const char *str) | ||
| 87 | { | ||
| 88 | fprintf(stderr,"%s: errno %d\n",str,errno); | ||
| 89 | } | ||
| 90 | |||
| 91 | static int dev_crypto_init(session_op *ses) | ||
| 92 | { | ||
| 93 | if(dev_failed) | ||
| 94 | return 0; | ||
| 95 | if(!fd) | ||
| 96 | { | ||
| 97 | int cryptodev_fd; | ||
| 98 | |||
| 99 | if ((cryptodev_fd=open("/dev/crypto",O_RDWR,0)) < 0) | ||
| 100 | { | ||
| 101 | err("/dev/crypto"); | ||
| 102 | dev_failed=1; | ||
| 103 | return 0; | ||
| 104 | } | ||
| 105 | if (ioctl(cryptodev_fd,CRIOGET,&fd) == -1) | ||
| 106 | { | ||
| 107 | err("CRIOGET failed"); | ||
| 108 | close(cryptodev_fd); | ||
| 109 | dev_failed=1; | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | close(cryptodev_fd); | ||
| 113 | } | ||
| 114 | assert(ses); | ||
| 115 | memset(ses,'\0',sizeof *ses); | ||
| 116 | |||
| 117 | return 1; | ||
| 118 | } | ||
| 119 | |||
| 120 | static int dev_crypto_cleanup(EVP_CIPHER_CTX *ctx) | ||
| 121 | { | ||
| 122 | if(ioctl(fd,CIOCFSESSION,&CDATA(ctx)->ses) == -1) | ||
| 123 | err("CIOCFSESSION failed"); | ||
| 124 | |||
| 125 | OPENSSL_free(CDATA(ctx)->key); | ||
| 126 | |||
| 127 | return 1; | ||
| 128 | } | ||
| 129 | |||
| 130 | static int dev_crypto_init_key(EVP_CIPHER_CTX *ctx,int cipher, | ||
| 131 | const unsigned char *key,int klen) | ||
| 132 | { | ||
| 133 | if(!dev_crypto_init(CDATA(ctx))) | ||
| 134 | return 0; | ||
| 135 | |||
| 136 | CDATA(ctx)->key=OPENSSL_malloc(MAX_HW_KEY); | ||
| 137 | |||
| 138 | assert(ctx->cipher->iv_len <= MAX_HW_IV); | ||
| 139 | |||
| 140 | memcpy(CDATA(ctx)->key,key,klen); | ||
| 141 | |||
| 142 | CDATA(ctx)->cipher=cipher; | ||
| 143 | CDATA(ctx)->keylen=klen; | ||
| 144 | |||
| 145 | if (ioctl(fd,CIOCGSESSION,CDATA(ctx)) == -1) | ||
| 146 | { | ||
| 147 | err("CIOCGSESSION failed"); | ||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | return 1; | ||
| 151 | } | ||
| 152 | |||
| 153 | static int dev_crypto_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out, | ||
| 154 | const unsigned char *in,unsigned int inl) | ||
| 155 | { | ||
| 156 | struct crypt_op cryp; | ||
| 157 | unsigned char lb[MAX_HW_IV]; | ||
| 158 | |||
| 159 | if(!inl) | ||
| 160 | return 1; | ||
| 161 | |||
| 162 | assert(CDATA(ctx)); | ||
| 163 | assert(!dev_failed); | ||
| 164 | |||
| 165 | memset(&cryp,'\0',sizeof cryp); | ||
| 166 | cryp.ses=CDATA(ctx)->ses; | ||
| 167 | cryp.op=ctx->encrypt ? COP_ENCRYPT : COP_DECRYPT; | ||
| 168 | cryp.flags=0; | ||
| 169 | cryp.len=inl; | ||
| 170 | assert((inl&(ctx->cipher->block_size-1)) == 0); | ||
| 171 | cryp.src=(caddr_t)in; | ||
| 172 | cryp.dst=(caddr_t)out; | ||
| 173 | cryp.mac=0; | ||
| 174 | if(ctx->cipher->iv_len) | ||
| 175 | cryp.iv=(caddr_t)ctx->iv; | ||
| 176 | |||
| 177 | if(!ctx->encrypt) | ||
| 178 | memcpy(lb,&in[cryp.len-ctx->cipher->iv_len],ctx->cipher->iv_len); | ||
| 179 | |||
| 180 | if(ioctl(fd, CIOCCRYPT, &cryp) == -1) | ||
| 181 | { | ||
| 182 | if(errno == EINVAL) /* buffers are misaligned */ | ||
| 183 | { | ||
| 184 | unsigned int cinl=0; | ||
| 185 | char *cin=NULL; | ||
| 186 | char *cout=NULL; | ||
| 187 | |||
| 188 | /* NB: this can only make cinl != inl with stream ciphers */ | ||
| 189 | cinl=(inl+3)/4*4; | ||
| 190 | |||
| 191 | if(((unsigned long)in&3) || cinl != inl) | ||
| 192 | { | ||
| 193 | cin=OPENSSL_malloc(cinl); | ||
| 194 | memcpy(cin,in,inl); | ||
| 195 | cryp.src=cin; | ||
| 196 | } | ||
| 197 | |||
| 198 | if(((unsigned long)out&3) || cinl != inl) | ||
| 199 | { | ||
| 200 | cout=OPENSSL_malloc(cinl); | ||
| 201 | cryp.dst=cout; | ||
| 202 | } | ||
| 203 | |||
| 204 | cryp.len=cinl; | ||
| 205 | |||
| 206 | if(ioctl(fd, CIOCCRYPT, &cryp) == -1) | ||
| 207 | { | ||
| 208 | err("CIOCCRYPT(2) failed"); | ||
| 209 | printf("src=%p dst=%p\n",cryp.src,cryp.dst); | ||
| 210 | abort(); | ||
| 211 | return 0; | ||
| 212 | } | ||
| 213 | |||
| 214 | if(cout) | ||
| 215 | { | ||
| 216 | memcpy(out,cout,inl); | ||
| 217 | OPENSSL_free(cout); | ||
| 218 | } | ||
| 219 | if(cin) | ||
| 220 | OPENSSL_free(cin); | ||
| 221 | } | ||
| 222 | else | ||
| 223 | { | ||
| 224 | err("CIOCCRYPT failed"); | ||
| 225 | abort(); | ||
| 226 | return 0; | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 230 | if(ctx->encrypt) | ||
| 231 | memcpy(ctx->iv,&out[cryp.len-ctx->cipher->iv_len],ctx->cipher->iv_len); | ||
| 232 | else | ||
| 233 | memcpy(ctx->iv,lb,ctx->cipher->iv_len); | ||
| 234 | |||
| 235 | return 1; | ||
| 236 | } | ||
| 237 | |||
| 238 | static int dev_crypto_des_ede3_init_key(EVP_CIPHER_CTX *ctx, | ||
| 239 | const unsigned char *key, | ||
| 240 | const unsigned char *iv, int enc) | ||
| 241 | { return dev_crypto_init_key(ctx,CRYPTO_3DES_CBC,key,24); } | ||
| 242 | |||
| 243 | #define dev_crypto_des_ede3_cbc_cipher dev_crypto_cipher | ||
| 244 | |||
| 245 | BLOCK_CIPHER_def_cbc(dev_crypto_des_ede3, session_op, NID_des_ede3, 8, 24, 8, | ||
| 246 | 0, dev_crypto_des_ede3_init_key, | ||
| 247 | dev_crypto_cleanup, | ||
| 248 | EVP_CIPHER_set_asn1_iv, | ||
| 249 | EVP_CIPHER_get_asn1_iv, | ||
| 250 | NULL) | ||
| 251 | |||
| 252 | static int dev_crypto_rc4_init_key(EVP_CIPHER_CTX *ctx, | ||
| 253 | const unsigned char *key, | ||
| 254 | const unsigned char *iv, int enc) | ||
| 255 | { return dev_crypto_init_key(ctx,CRYPTO_ARC4,key,16); } | ||
| 256 | |||
| 257 | static const EVP_CIPHER r4_cipher= | ||
| 258 | { | ||
| 259 | NID_rc4, | ||
| 260 | 1,16,0, /* FIXME: key should be up to 256 bytes */ | ||
| 261 | EVP_CIPH_VARIABLE_LENGTH, | ||
| 262 | dev_crypto_rc4_init_key, | ||
| 263 | dev_crypto_cipher, | ||
| 264 | dev_crypto_cleanup, | ||
| 265 | sizeof(session_op), | ||
| 266 | NULL, | ||
| 267 | NULL, | ||
| 268 | NULL | ||
| 269 | }; | ||
| 270 | |||
| 271 | const EVP_CIPHER *EVP_dev_crypto_rc4(void) | ||
| 272 | { return &r4_cipher; } | ||
| 273 | |||
| 274 | typedef struct | ||
| 275 | { | ||
| 276 | session_op sess; | ||
| 277 | char *data; | ||
| 278 | int len; | ||
| 279 | unsigned char md[EVP_MAX_MD_SIZE]; | ||
| 280 | } MD_DATA; | ||
| 281 | |||
| 282 | static int dev_crypto_init_digest(MD_DATA *md_data,int mac) | ||
| 283 | { | ||
| 284 | if(!dev_crypto_init(&md_data->sess)) | ||
| 285 | return 0; | ||
| 286 | |||
| 287 | md_data->len=0; | ||
| 288 | md_data->data=NULL; | ||
| 289 | |||
| 290 | md_data->sess.mac=mac; | ||
| 291 | |||
| 292 | if (ioctl(fd,CIOCGSESSION,&md_data->sess) == -1) | ||
| 293 | { | ||
| 294 | err("CIOCGSESSION failed"); | ||
| 295 | return 0; | ||
| 296 | } | ||
| 297 | return 1; | ||
| 298 | } | ||
| 299 | |||
| 300 | static int dev_crypto_cleanup_digest(MD_DATA *md_data) | ||
| 301 | { | ||
| 302 | if (ioctl(fd,CIOCFSESSION,&md_data->sess.ses) == -1) | ||
| 303 | { | ||
| 304 | err("CIOCFSESSION failed"); | ||
| 305 | return 0; | ||
| 306 | } | ||
| 307 | |||
| 308 | return 1; | ||
| 309 | } | ||
| 310 | |||
| 311 | /* FIXME: if device can do chained MACs, then don't accumulate */ | ||
| 312 | /* FIXME: move accumulation to the framework */ | ||
| 313 | static int dev_crypto_md5_init(EVP_MD_CTX *ctx) | ||
| 314 | { return dev_crypto_init_digest(ctx->md_data,CRYPTO_MD5); } | ||
| 315 | |||
| 316 | static int do_digest(int ses,unsigned char *md,const void *data,int len) | ||
| 317 | { | ||
| 318 | struct crypt_op cryp; | ||
| 319 | static unsigned char md5zero[16]= | ||
| 320 | { | ||
| 321 | 0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04, | ||
| 322 | 0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,0x7e | ||
| 323 | }; | ||
| 324 | |||
| 325 | /* some cards can't do zero length */ | ||
| 326 | if(!len) | ||
| 327 | { | ||
| 328 | memcpy(md,md5zero,16); | ||
| 329 | return 1; | ||
| 330 | } | ||
| 331 | |||
| 332 | memset(&cryp,'\0',sizeof cryp); | ||
| 333 | cryp.ses=ses; | ||
| 334 | cryp.op=COP_ENCRYPT;/* required to do the MAC rather than check it */ | ||
| 335 | cryp.len=len; | ||
| 336 | cryp.src=(caddr_t)data; | ||
| 337 | cryp.dst=(caddr_t)data; // FIXME!!! | ||
| 338 | cryp.mac=(caddr_t)md; | ||
| 339 | |||
| 340 | if(ioctl(fd, CIOCCRYPT, &cryp) == -1) | ||
| 341 | { | ||
| 342 | if(errno == EINVAL) /* buffer is misaligned */ | ||
| 343 | { | ||
| 344 | char *dcopy; | ||
| 345 | |||
| 346 | dcopy=OPENSSL_malloc(len); | ||
| 347 | memcpy(dcopy,data,len); | ||
| 348 | cryp.src=dcopy; | ||
| 349 | cryp.dst=cryp.src; // FIXME!!! | ||
| 350 | |||
| 351 | if(ioctl(fd, CIOCCRYPT, &cryp) == -1) | ||
| 352 | { | ||
| 353 | err("CIOCCRYPT(MAC2) failed"); | ||
| 354 | abort(); | ||
| 355 | return 0; | ||
| 356 | } | ||
| 357 | OPENSSL_free(dcopy); | ||
| 358 | } | ||
| 359 | else | ||
| 360 | { | ||
| 361 | err("CIOCCRYPT(MAC) failed"); | ||
| 362 | abort(); | ||
| 363 | return 0; | ||
| 364 | } | ||
| 365 | } | ||
| 366 | // printf("done\n"); | ||
| 367 | |||
| 368 | return 1; | ||
| 369 | } | ||
| 370 | |||
| 371 | static int dev_crypto_md5_update(EVP_MD_CTX *ctx,const void *data, | ||
| 372 | unsigned long len) | ||
| 373 | { | ||
| 374 | MD_DATA *md_data=ctx->md_data; | ||
| 375 | |||
| 376 | if(ctx->flags&EVP_MD_CTX_FLAG_ONESHOT) | ||
| 377 | return do_digest(md_data->sess.ses,md_data->md,data,len); | ||
| 378 | |||
| 379 | md_data->data=OPENSSL_realloc(md_data->data,md_data->len+len); | ||
| 380 | memcpy(md_data->data+md_data->len,data,len); | ||
| 381 | md_data->len+=len; | ||
| 382 | |||
| 383 | return 1; | ||
| 384 | } | ||
| 385 | |||
| 386 | static int dev_crypto_md5_final(EVP_MD_CTX *ctx,unsigned char *md) | ||
| 387 | { | ||
| 388 | int ret; | ||
| 389 | MD_DATA *md_data=ctx->md_data; | ||
| 390 | |||
| 391 | if(ctx->flags&EVP_MD_CTX_FLAG_ONESHOT) | ||
| 392 | { | ||
| 393 | memcpy(md,md_data->md,MD5_DIGEST_LENGTH); | ||
| 394 | ret=1; | ||
| 395 | } | ||
| 396 | else | ||
| 397 | { | ||
| 398 | ret=do_digest(md_data->sess.ses,md,md_data->data,md_data->len); | ||
| 399 | OPENSSL_free(md_data->data); | ||
| 400 | md_data->data=NULL; | ||
| 401 | md_data->len=0; | ||
| 402 | } | ||
| 403 | |||
| 404 | return ret; | ||
| 405 | } | ||
| 406 | |||
| 407 | static int dev_crypto_md5_copy(EVP_MD_CTX *to,const EVP_MD_CTX *from) | ||
| 408 | { | ||
| 409 | const MD_DATA *from_md=from->md_data; | ||
| 410 | MD_DATA *to_md=to->md_data; | ||
| 411 | |||
| 412 | // How do we copy sessions? | ||
| 413 | assert(from->digest->flags&EVP_MD_FLAG_ONESHOT); | ||
| 414 | |||
| 415 | to_md->data=OPENSSL_malloc(from_md->len); | ||
| 416 | memcpy(to_md->data,from_md->data,from_md->len); | ||
| 417 | |||
| 418 | return 1; | ||
| 419 | } | ||
| 420 | |||
| 421 | static int dev_crypto_md5_cleanup(EVP_MD_CTX *ctx) | ||
| 422 | { | ||
| 423 | return dev_crypto_cleanup_digest(ctx->md_data); | ||
| 424 | } | ||
| 425 | |||
| 426 | static const EVP_MD md5_md= | ||
| 427 | { | ||
| 428 | NID_md5, | ||
| 429 | NID_md5WithRSAEncryption, | ||
| 430 | MD5_DIGEST_LENGTH, | ||
| 431 | EVP_MD_FLAG_ONESHOT, // XXX: set according to device info... | ||
| 432 | dev_crypto_md5_init, | ||
| 433 | dev_crypto_md5_update, | ||
| 434 | dev_crypto_md5_final, | ||
| 435 | dev_crypto_md5_copy, | ||
| 436 | dev_crypto_md5_cleanup, | ||
| 437 | EVP_PKEY_RSA_method, | ||
| 438 | MD5_CBLOCK, | ||
| 439 | sizeof(MD_DATA), | ||
| 440 | }; | ||
| 441 | |||
| 442 | const EVP_MD *EVP_dev_crypto_md5(void) | ||
| 443 | { return &md5_md; } | ||
| 444 | |||
| 445 | #endif | ||
| 446 | #endif | ||
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c index e26ccd0d08..1916c61699 100644 --- a/src/lib/libcrypto/evp/p_lib.c +++ b/src/lib/libcrypto/evp/p_lib.c | |||
| @@ -411,10 +411,7 @@ void EVP_PKEY_free(EVP_PKEY *x) | |||
| 411 | static void EVP_PKEY_free_it(EVP_PKEY *x) | 411 | static void EVP_PKEY_free_it(EVP_PKEY *x) |
| 412 | { | 412 | { |
| 413 | if (x->ameth && x->ameth->pkey_free) | 413 | if (x->ameth && x->ameth->pkey_free) |
| 414 | { | ||
| 415 | x->ameth->pkey_free(x); | 414 | x->ameth->pkey_free(x); |
| 416 | x->pkey.ptr = NULL; | ||
| 417 | } | ||
| 418 | #ifndef OPENSSL_NO_ENGINE | 415 | #ifndef OPENSSL_NO_ENGINE |
| 419 | if (x->engine) | 416 | if (x->engine) |
| 420 | { | 417 | { |
diff --git a/src/lib/libcrypto/evp/p_sign.c b/src/lib/libcrypto/evp/p_sign.c index bb893f5bde..8df6d48a7e 100644 --- a/src/lib/libcrypto/evp/p_sign.c +++ b/src/lib/libcrypto/evp/p_sign.c | |||
| @@ -81,7 +81,7 @@ int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen, | |||
| 81 | unsigned char m[EVP_MAX_MD_SIZE]; | 81 | unsigned char m[EVP_MAX_MD_SIZE]; |
| 82 | unsigned int m_len; | 82 | unsigned int m_len; |
| 83 | int i,ok=0,v; | 83 | int i,ok=0,v; |
| 84 | EVP_MD_CTX tmp_ctx; | 84 | MS_STATIC EVP_MD_CTX tmp_ctx; |
| 85 | 85 | ||
| 86 | *siglen=0; | 86 | *siglen=0; |
| 87 | EVP_MD_CTX_init(&tmp_ctx); | 87 | EVP_MD_CTX_init(&tmp_ctx); |
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c index 41d4b67130..8db46412f3 100644 --- a/src/lib/libcrypto/evp/p_verify.c +++ b/src/lib/libcrypto/evp/p_verify.c | |||
| @@ -68,7 +68,7 @@ int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
| 68 | unsigned char m[EVP_MAX_MD_SIZE]; | 68 | unsigned char m[EVP_MAX_MD_SIZE]; |
| 69 | unsigned int m_len; | 69 | unsigned int m_len; |
| 70 | int i,ok=0,v; | 70 | int i,ok=0,v; |
| 71 | EVP_MD_CTX tmp_ctx; | 71 | MS_STATIC EVP_MD_CTX tmp_ctx; |
| 72 | 72 | ||
| 73 | EVP_MD_CTX_init(&tmp_ctx); | 73 | EVP_MD_CTX_init(&tmp_ctx); |
| 74 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); | 74 | EVP_MD_CTX_copy_ex(&tmp_ctx,ctx); |
diff --git a/src/lib/libcrypto/hmac/Makefile b/src/lib/libcrypto/hmac/Makefile new file mode 100644 index 0000000000..0e91709f64 --- /dev/null +++ b/src/lib/libcrypto/hmac/Makefile | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/md/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= hmac | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=hmactest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=hmac.c hm_ameth.c hm_pmeth.c | ||
| 21 | LIBOBJ=hmac.o hm_ameth.o hm_pmeth.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= hmac.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | hm_ameth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 78 | hm_ameth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 79 | hm_ameth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 80 | hm_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 81 | hm_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 82 | hm_ameth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 83 | hm_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 84 | hm_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 85 | hm_ameth.o: ../../include/openssl/symhacks.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 86 | hm_ameth.o: hm_ameth.c | ||
| 87 | hm_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 88 | hm_pmeth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 89 | hm_pmeth.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 90 | hm_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 91 | hm_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 92 | hm_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 93 | hm_pmeth.o: ../../include/openssl/hmac.h ../../include/openssl/lhash.h | ||
| 94 | hm_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 95 | hm_pmeth.o: ../../include/openssl/opensslconf.h | ||
| 96 | hm_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 97 | hm_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 98 | hm_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 99 | hm_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 100 | hm_pmeth.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 101 | hm_pmeth.o: ../cryptlib.h ../evp/evp_locl.h hm_pmeth.c | ||
| 102 | hmac.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 103 | hmac.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 104 | hmac.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 105 | hmac.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h | ||
| 106 | hmac.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 107 | hmac.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 108 | hmac.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 109 | hmac.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 110 | hmac.o: ../../include/openssl/symhacks.h ../cryptlib.h hmac.c | ||
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 6c98fc43a3..45015fe754 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
| @@ -138,9 +138,12 @@ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) | |||
| 138 | 138 | ||
| 139 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) | 139 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) |
| 140 | { | 140 | { |
| 141 | int j; | ||
| 141 | unsigned int i; | 142 | unsigned int i; |
| 142 | unsigned char buf[EVP_MAX_MD_SIZE]; | 143 | unsigned char buf[EVP_MAX_MD_SIZE]; |
| 143 | 144 | ||
| 145 | j=EVP_MD_block_size(ctx->md); | ||
| 146 | |||
| 144 | if (!EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i)) | 147 | if (!EVP_DigestFinal_ex(&ctx->md_ctx,buf,&i)) |
| 145 | goto err; | 148 | goto err; |
| 146 | if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx)) | 149 | if (!EVP_MD_CTX_copy_ex(&ctx->md_ctx,&ctx->o_ctx)) |
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c new file mode 100644 index 0000000000..1b906b81af --- /dev/null +++ b/src/lib/libcrypto/hmac/hmactest.c | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | /* crypto/hmac/hmactest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_HMAC | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No HMAC support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/hmac.h> | ||
| 73 | #ifndef OPENSSL_NO_MD5 | ||
| 74 | #include <openssl/md5.h> | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #ifdef CHARSET_EBCDIC | ||
| 78 | #include <openssl/ebcdic.h> | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #ifndef OPENSSL_NO_MD5 | ||
| 82 | static struct test_st | ||
| 83 | { | ||
| 84 | unsigned char key[16]; | ||
| 85 | int key_len; | ||
| 86 | unsigned char data[64]; | ||
| 87 | int data_len; | ||
| 88 | unsigned char *digest; | ||
| 89 | } test[4]={ | ||
| 90 | { "", | ||
| 91 | 0, | ||
| 92 | "More text test vectors to stuff up EBCDIC machines :-)", | ||
| 93 | 54, | ||
| 94 | (unsigned char *)"e9139d1e6ee064ef8cf514fc7dc83e86", | ||
| 95 | },{ {0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b, | ||
| 96 | 0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,}, | ||
| 97 | 16, | ||
| 98 | "Hi There", | ||
| 99 | 8, | ||
| 100 | (unsigned char *)"9294727a3638bb1c13f48ef8158bfc9d", | ||
| 101 | },{ "Jefe", | ||
| 102 | 4, | ||
| 103 | "what do ya want for nothing?", | ||
| 104 | 28, | ||
| 105 | (unsigned char *)"750c783e6ab0b503eaa86e310a5db738", | ||
| 106 | },{ | ||
| 107 | {0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa, | ||
| 108 | 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,}, | ||
| 109 | 16, | ||
| 110 | {0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd, | ||
| 111 | 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd, | ||
| 112 | 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd, | ||
| 113 | 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd, | ||
| 114 | 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd, | ||
| 115 | 0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd, | ||
| 116 | 0xdd,0xdd}, | ||
| 117 | 50, | ||
| 118 | (unsigned char *)"56be34521d144c88dbb8c733f0e8b3f6", | ||
| 119 | }, | ||
| 120 | }; | ||
| 121 | #endif | ||
| 122 | |||
| 123 | static char *pt(unsigned char *md); | ||
| 124 | int main(int argc, char *argv[]) | ||
| 125 | { | ||
| 126 | #ifndef OPENSSL_NO_MD5 | ||
| 127 | int i; | ||
| 128 | char *p; | ||
| 129 | #endif | ||
| 130 | int err=0; | ||
| 131 | |||
| 132 | #ifdef OPENSSL_NO_MD5 | ||
| 133 | printf("test skipped: MD5 disabled\n"); | ||
| 134 | #else | ||
| 135 | |||
| 136 | #ifdef CHARSET_EBCDIC | ||
| 137 | ebcdic2ascii(test[0].data, test[0].data, test[0].data_len); | ||
| 138 | ebcdic2ascii(test[1].data, test[1].data, test[1].data_len); | ||
| 139 | ebcdic2ascii(test[2].key, test[2].key, test[2].key_len); | ||
| 140 | ebcdic2ascii(test[2].data, test[2].data, test[2].data_len); | ||
| 141 | #endif | ||
| 142 | |||
| 143 | for (i=0; i<4; i++) | ||
| 144 | { | ||
| 145 | p=pt(HMAC(EVP_md5(), | ||
| 146 | test[i].key, test[i].key_len, | ||
| 147 | test[i].data, test[i].data_len, | ||
| 148 | NULL,NULL)); | ||
| 149 | |||
| 150 | if (strcmp(p,(char *)test[i].digest) != 0) | ||
| 151 | { | ||
| 152 | printf("error calculating HMAC on %d entry'\n",i); | ||
| 153 | printf("got %s instead of %s\n",p,test[i].digest); | ||
| 154 | err++; | ||
| 155 | } | ||
| 156 | else | ||
| 157 | printf("test %d ok\n",i); | ||
| 158 | } | ||
| 159 | #endif /* OPENSSL_NO_MD5 */ | ||
| 160 | EXIT(err); | ||
| 161 | return(0); | ||
| 162 | } | ||
| 163 | |||
| 164 | #ifndef OPENSSL_NO_MD5 | ||
| 165 | static char *pt(unsigned char *md) | ||
| 166 | { | ||
| 167 | int i; | ||
| 168 | static char buf[80]; | ||
| 169 | |||
| 170 | for (i=0; i<MD5_DIGEST_LENGTH; i++) | ||
| 171 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 172 | return(buf); | ||
| 173 | } | ||
| 174 | #endif | ||
| 175 | #endif | ||
diff --git a/src/lib/libcrypto/idea/Makefile b/src/lib/libcrypto/idea/Makefile new file mode 100644 index 0000000000..b2e7add666 --- /dev/null +++ b/src/lib/libcrypto/idea/Makefile | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/idea/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= idea | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=ideatest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=i_cbc.c i_cfb64.c i_ofb64.c i_ecb.c i_skey.c | ||
| 21 | LIBOBJ=i_cbc.o i_cfb64.o i_ofb64.o i_ecb.o i_skey.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= idea.h | ||
| 26 | HEADER= idea_lcl.h $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | i_cbc.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 78 | i_cbc.o: i_cbc.c idea_lcl.h | ||
| 79 | i_cfb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 80 | i_cfb64.o: i_cfb64.c idea_lcl.h | ||
| 81 | i_ecb.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 82 | i_ecb.o: ../../include/openssl/opensslv.h i_ecb.c idea_lcl.h | ||
| 83 | i_ofb64.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 84 | i_ofb64.o: i_ofb64.c idea_lcl.h | ||
| 85 | i_skey.o: ../../include/openssl/idea.h ../../include/openssl/opensslconf.h | ||
| 86 | i_skey.o: i_skey.c idea_lcl.h | ||
diff --git a/src/lib/libcrypto/idea/ideatest.c b/src/lib/libcrypto/idea/ideatest.c new file mode 100644 index 0000000000..e6ffc7025e --- /dev/null +++ b/src/lib/libcrypto/idea/ideatest.c | |||
| @@ -0,0 +1,235 @@ | |||
| 1 | /* crypto/idea/ideatest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_IDEA | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No IDEA support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/idea.h> | ||
| 73 | |||
| 74 | unsigned char k[16]={ | ||
| 75 | 0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x04, | ||
| 76 | 0x00,0x05,0x00,0x06,0x00,0x07,0x00,0x08}; | ||
| 77 | |||
| 78 | unsigned char in[8]={0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x03}; | ||
| 79 | unsigned char c[8]={0x11,0xFB,0xED,0x2B,0x01,0x98,0x6D,0xE5}; | ||
| 80 | unsigned char out[80]; | ||
| 81 | |||
| 82 | char *text="Hello to all people out there"; | ||
| 83 | |||
| 84 | static unsigned char cfb_key[16]={ | ||
| 85 | 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96, | ||
| 86 | 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e, | ||
| 87 | }; | ||
| 88 | static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd}; | ||
| 89 | static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8]; | ||
| 90 | #define CFB_TEST_SIZE 24 | ||
| 91 | static unsigned char plain[CFB_TEST_SIZE]= | ||
| 92 | { | ||
| 93 | 0x4e,0x6f,0x77,0x20,0x69,0x73, | ||
| 94 | 0x20,0x74,0x68,0x65,0x20,0x74, | ||
| 95 | 0x69,0x6d,0x65,0x20,0x66,0x6f, | ||
| 96 | 0x72,0x20,0x61,0x6c,0x6c,0x20 | ||
| 97 | }; | ||
| 98 | static unsigned char cfb_cipher64[CFB_TEST_SIZE]={ | ||
| 99 | 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F, | ||
| 100 | 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A, | ||
| 101 | 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45 | ||
| 102 | |||
| 103 | /* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38, | ||
| 104 | 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9, | ||
| 105 | 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/ | ||
| 106 | }; | ||
| 107 | |||
| 108 | static int cfb64_test(unsigned char *cfb_cipher); | ||
| 109 | static char *pt(unsigned char *p); | ||
| 110 | int main(int argc, char *argv[]) | ||
| 111 | { | ||
| 112 | int i,err=0; | ||
| 113 | IDEA_KEY_SCHEDULE key,dkey; | ||
| 114 | unsigned char iv[8]; | ||
| 115 | |||
| 116 | idea_set_encrypt_key(k,&key); | ||
| 117 | idea_ecb_encrypt(in,out,&key); | ||
| 118 | if (memcmp(out,c,8) != 0) | ||
| 119 | { | ||
| 120 | printf("ecb idea error encrypting\n"); | ||
| 121 | printf("got :"); | ||
| 122 | for (i=0; i<8; i++) | ||
| 123 | printf("%02X ",out[i]); | ||
| 124 | printf("\n"); | ||
| 125 | printf("expected:"); | ||
| 126 | for (i=0; i<8; i++) | ||
| 127 | printf("%02X ",c[i]); | ||
| 128 | err=20; | ||
| 129 | printf("\n"); | ||
| 130 | } | ||
| 131 | |||
| 132 | idea_set_decrypt_key(&key,&dkey); | ||
| 133 | idea_ecb_encrypt(c,out,&dkey); | ||
| 134 | if (memcmp(out,in,8) != 0) | ||
| 135 | { | ||
| 136 | printf("ecb idea error decrypting\n"); | ||
| 137 | printf("got :"); | ||
| 138 | for (i=0; i<8; i++) | ||
| 139 | printf("%02X ",out[i]); | ||
| 140 | printf("\n"); | ||
| 141 | printf("expected:"); | ||
| 142 | for (i=0; i<8; i++) | ||
| 143 | printf("%02X ",in[i]); | ||
| 144 | printf("\n"); | ||
| 145 | err=3; | ||
| 146 | } | ||
| 147 | |||
| 148 | if (err == 0) printf("ecb idea ok\n"); | ||
| 149 | |||
| 150 | memcpy(iv,k,8); | ||
| 151 | idea_cbc_encrypt((unsigned char *)text,out,strlen(text)+1,&key,iv,1); | ||
| 152 | memcpy(iv,k,8); | ||
| 153 | idea_cbc_encrypt(out,out,8,&dkey,iv,0); | ||
| 154 | idea_cbc_encrypt(&(out[8]),&(out[8]),strlen(text)+1-8,&dkey,iv,0); | ||
| 155 | if (memcmp(text,out,strlen(text)+1) != 0) | ||
| 156 | { | ||
| 157 | printf("cbc idea bad\n"); | ||
| 158 | err=4; | ||
| 159 | } | ||
| 160 | else | ||
| 161 | printf("cbc idea ok\n"); | ||
| 162 | |||
| 163 | printf("cfb64 idea "); | ||
| 164 | if (cfb64_test(cfb_cipher64)) | ||
| 165 | { | ||
| 166 | printf("bad\n"); | ||
| 167 | err=5; | ||
| 168 | } | ||
| 169 | else | ||
| 170 | printf("ok\n"); | ||
| 171 | |||
| 172 | #ifdef OPENSSL_SYS_NETWARE | ||
| 173 | if (err) printf("ERROR: %d\n", err); | ||
| 174 | #endif | ||
| 175 | EXIT(err); | ||
| 176 | return(err); | ||
| 177 | } | ||
| 178 | |||
| 179 | static int cfb64_test(unsigned char *cfb_cipher) | ||
| 180 | { | ||
| 181 | IDEA_KEY_SCHEDULE eks,dks; | ||
| 182 | int err=0,i,n; | ||
| 183 | |||
| 184 | idea_set_encrypt_key(cfb_key,&eks); | ||
| 185 | idea_set_decrypt_key(&eks,&dks); | ||
| 186 | memcpy(cfb_tmp,cfb_iv,8); | ||
| 187 | n=0; | ||
| 188 | idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks, | ||
| 189 | cfb_tmp,&n,IDEA_ENCRYPT); | ||
| 190 | idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]), | ||
| 191 | (long)CFB_TEST_SIZE-12,&eks, | ||
| 192 | cfb_tmp,&n,IDEA_ENCRYPT); | ||
| 193 | if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0) | ||
| 194 | { | ||
| 195 | err=1; | ||
| 196 | printf("idea_cfb64_encrypt encrypt error\n"); | ||
| 197 | for (i=0; i<CFB_TEST_SIZE; i+=8) | ||
| 198 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 199 | } | ||
| 200 | memcpy(cfb_tmp,cfb_iv,8); | ||
| 201 | n=0; | ||
| 202 | idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks, | ||
| 203 | cfb_tmp,&n,IDEA_DECRYPT); | ||
| 204 | idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), | ||
| 205 | (long)CFB_TEST_SIZE-17,&dks, | ||
| 206 | cfb_tmp,&n,IDEA_DECRYPT); | ||
| 207 | if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0) | ||
| 208 | { | ||
| 209 | err=1; | ||
| 210 | printf("idea_cfb_encrypt decrypt error\n"); | ||
| 211 | for (i=0; i<24; i+=8) | ||
| 212 | printf("%s\n",pt(&(cfb_buf2[i]))); | ||
| 213 | } | ||
| 214 | return(err); | ||
| 215 | } | ||
| 216 | |||
| 217 | static char *pt(unsigned char *p) | ||
| 218 | { | ||
| 219 | static char bufs[10][20]; | ||
| 220 | static int bnum=0; | ||
| 221 | char *ret; | ||
| 222 | int i; | ||
| 223 | static char *f="0123456789ABCDEF"; | ||
| 224 | |||
| 225 | ret= &(bufs[bnum++][0]); | ||
| 226 | bnum%=10; | ||
| 227 | for (i=0; i<8; i++) | ||
| 228 | { | ||
| 229 | ret[i*2]=f[(p[i]>>4)&0xf]; | ||
| 230 | ret[i*2+1]=f[p[i]&0xf]; | ||
| 231 | } | ||
| 232 | ret[16]='\0'; | ||
| 233 | return(ret); | ||
| 234 | } | ||
| 235 | #endif | ||
diff --git a/src/lib/libcrypto/idea/version b/src/lib/libcrypto/idea/version new file mode 100644 index 0000000000..3f22293795 --- /dev/null +++ b/src/lib/libcrypto/idea/version | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | 1.1 07/12/95 - eay | ||
| 2 | Many thanks to Rhys Weatherley <rweather@us.oracle.com> | ||
| 3 | for pointing out that I was assuming little endian byte | ||
| 4 | order for all quantities what idea actually used | ||
| 5 | bigendian. No where in the spec does it mention | ||
| 6 | this, it is all in terms of 16 bit numbers and even the example | ||
| 7 | does not use byte streams for the input example :-(. | ||
| 8 | If you byte swap each pair of input, keys and iv, the functions | ||
| 9 | would produce the output as the old version :-(. | ||
| 10 | |||
| 11 | 1.0 ??/??/95 - eay | ||
| 12 | First version. | ||
diff --git a/src/lib/libcrypto/install.com b/src/lib/libcrypto/install.com new file mode 100644 index 0000000000..ad3e4d48c7 --- /dev/null +++ b/src/lib/libcrypto/install.com | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | $! INSTALL.COM -- Installs the files in a given directory tree | ||
| 2 | $! | ||
| 3 | $! Author: Richard Levitte <richard@levitte.org> | ||
| 4 | $! Time of creation: 22-MAY-1998 10:13 | ||
| 5 | $! | ||
| 6 | $! Changes by Zoltan Arpadffy <zoli@polarhome.com> | ||
| 7 | $! | ||
| 8 | $! P1 root of the directory tree | ||
| 9 | $! | ||
| 10 | $ IF P1 .EQS. "" | ||
| 11 | $ THEN | ||
| 12 | $ WRITE SYS$OUTPUT "First argument missing." | ||
| 13 | $ WRITE SYS$OUTPUT - | ||
| 14 | "It should be the directory where you want things installed." | ||
| 15 | $ EXIT | ||
| 16 | $ ENDIF | ||
| 17 | $ | ||
| 18 | $ IF (F$GETSYI("CPU").LT.128) | ||
| 19 | $ THEN | ||
| 20 | $ ARCH := VAX | ||
| 21 | $ ELSE | ||
| 22 | $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") | ||
| 23 | $ IF (ARCH .EQS. "") THEN ARCH = "UNK" | ||
| 24 | $ ENDIF | ||
| 25 | $ | ||
| 26 | $ ROOT = F$PARSE(P1,"[]A.;0",,,"SYNTAX_ONLY,NO_CONCEAL") - "A.;0" | ||
| 27 | $ ROOT_DEV = F$PARSE(ROOT,,,"DEVICE","SYNTAX_ONLY") | ||
| 28 | $ ROOT_DIR = F$PARSE(ROOT,,,"DIRECTORY","SYNTAX_ONLY") - | ||
| 29 | - "[000000." - "][" - "[" - "]" | ||
| 30 | $ ROOT = ROOT_DEV + "[" + ROOT_DIR | ||
| 31 | $ | ||
| 32 | $ DEFINE/NOLOG WRK_SSLROOT 'ROOT'.] /TRANS=CONC | ||
| 33 | $ DEFINE/NOLOG WRK_SSLLIB WRK_SSLROOT:['ARCH'_LIB] | ||
| 34 | $ DEFINE/NOLOG WRK_SSLINCLUDE WRK_SSLROOT:[INCLUDE] | ||
| 35 | $ | ||
| 36 | $ IF F$PARSE("WRK_SSLROOT:[000000]") .EQS. "" THEN - | ||
| 37 | CREATE/DIR/LOG WRK_SSLROOT:[000000] | ||
| 38 | $ IF F$PARSE("WRK_SSLLIB:") .EQS. "" THEN - | ||
| 39 | CREATE/DIR/LOG WRK_SSLLIB: | ||
| 40 | $ IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN - | ||
| 41 | CREATE/DIR/LOG WRK_SSLINCLUDE: | ||
| 42 | $ | ||
| 43 | $ SDIRS := ,- | ||
| 44 | _'ARCH',- | ||
| 45 | OBJECTS,- | ||
| 46 | MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,WHRLPOOL,- | ||
| 47 | DES,AES,RC2,RC4,RC5,IDEA,BF,CAST,CAMELLIA,SEED,- | ||
| 48 | BN,EC,RSA,DSA,ECDSA,DH,ECDH,DSO,ENGINE,- | ||
| 49 | BUFFER,BIO,STACK,LHASH,RAND,ERR,- | ||
| 50 | EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,- | ||
| 51 | UI,KRB5,- | ||
| 52 | STORE,CMS,PQUEUE,TS,JPAKE | ||
| 53 | $ EXHEADER_ := crypto.h,opensslv.h,ebcdic.h,symhacks.h,ossl_typ.h | ||
| 54 | $ EXHEADER__'ARCH' := opensslconf.h | ||
| 55 | $ EXHEADER_OBJECTS := objects.h,obj_mac.h | ||
| 56 | $ EXHEADER_MD2 := md2.h | ||
| 57 | $ EXHEADER_MD4 := md4.h | ||
| 58 | $ EXHEADER_MD5 := md5.h | ||
| 59 | $ EXHEADER_SHA := sha.h | ||
| 60 | $ EXHEADER_MDC2 := mdc2.h | ||
| 61 | $ EXHEADER_HMAC := hmac.h | ||
| 62 | $ EXHEADER_RIPEMD := ripemd.h | ||
| 63 | $ EXHEADER_WHRLPOOL := whrlpool.h | ||
| 64 | $ EXHEADER_DES := des.h,des_old.h | ||
| 65 | $ EXHEADER_AES := aes.h | ||
| 66 | $ EXHEADER_RC2 := rc2.h | ||
| 67 | $ EXHEADER_RC4 := rc4.h | ||
| 68 | $ EXHEADER_RC5 := rc5.h | ||
| 69 | $ EXHEADER_IDEA := idea.h | ||
| 70 | $ EXHEADER_BF := blowfish.h | ||
| 71 | $ EXHEADER_CAST := cast.h | ||
| 72 | $ EXHEADER_CAMELLIA := camellia.h | ||
| 73 | $ EXHEADER_SEED := seed.h | ||
| 74 | $ EXHEADER_MODES := modes.h | ||
| 75 | $ EXHEADER_BN := bn.h | ||
| 76 | $ EXHEADER_EC := ec.h | ||
| 77 | $ EXHEADER_RSA := rsa.h | ||
| 78 | $ EXHEADER_DSA := dsa.h | ||
| 79 | $ EXHEADER_ECDSA := ecdsa.h | ||
| 80 | $ EXHEADER_DH := dh.h | ||
| 81 | $ EXHEADER_ECDH := ecdh.h | ||
| 82 | $ EXHEADER_DSO := dso.h | ||
| 83 | $ EXHEADER_ENGINE := engine.h | ||
| 84 | $ EXHEADER_BUFFER := buffer.h | ||
| 85 | $ EXHEADER_BIO := bio.h | ||
| 86 | $ EXHEADER_STACK := stack.h,safestack.h | ||
| 87 | $ EXHEADER_LHASH := lhash.h | ||
| 88 | $ EXHEADER_RAND := rand.h | ||
| 89 | $ EXHEADER_ERR := err.h | ||
| 90 | $ EXHEADER_EVP := evp.h | ||
| 91 | $ EXHEADER_ASN1 := asn1.h,asn1_mac.h,asn1t.h | ||
| 92 | $ EXHEADER_PEM := pem.h,pem2.h | ||
| 93 | $ EXHEADER_X509 := x509.h,x509_vfy.h | ||
| 94 | $ EXHEADER_X509V3 := x509v3.h | ||
| 95 | $ EXHEADER_CONF := conf.h,conf_api.h | ||
| 96 | $ EXHEADER_TXT_DB := txt_db.h | ||
| 97 | $ EXHEADER_PKCS7 := pkcs7.h | ||
| 98 | $ EXHEADER_PKCS12 := pkcs12.h | ||
| 99 | $ EXHEADER_COMP := comp.h | ||
| 100 | $ EXHEADER_OCSP := ocsp.h | ||
| 101 | $ EXHEADER_UI := ui.h,ui_compat.h | ||
| 102 | $ EXHEADER_KRB5 := krb5_asn.h | ||
| 103 | $! EXHEADER_STORE := store.h,str_compat.h | ||
| 104 | $ EXHEADER_STORE := store.h | ||
| 105 | $ EXHEADER_CMS := cms.h | ||
| 106 | $ EXHEADER_PQUEUE := pqueue.h | ||
| 107 | $ EXHEADER_TS := ts.h | ||
| 108 | $ EXHEADER_JPAKE := jpake.h | ||
| 109 | $ LIBS := LIBCRYPTO | ||
| 110 | $ | ||
| 111 | $ EXE_DIR := [-.'ARCH'.EXE.CRYPTO] | ||
| 112 | $ | ||
| 113 | $ I = 0 | ||
| 114 | $ LOOP_SDIRS: | ||
| 115 | $ D = F$EDIT(F$ELEMENT(I, ",", SDIRS),"TRIM") | ||
| 116 | $ I = I + 1 | ||
| 117 | $ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END | ||
| 118 | $ tmp = EXHEADER_'D' | ||
| 119 | $ IF D .EQS. "" | ||
| 120 | $ THEN | ||
| 121 | $ COPY 'tmp' WRK_SSLINCLUDE: /LOG | ||
| 122 | $ ELSE | ||
| 123 | $ IF D .EQS. "_''ARCH'" | ||
| 124 | $ THEN | ||
| 125 | $ COPY [-.'ARCH'.CRYPTO]'tmp' WRK_SSLINCLUDE: /LOG | ||
| 126 | $ ELSE | ||
| 127 | $ COPY [.'D']'tmp' WRK_SSLINCLUDE: /LOG | ||
| 128 | $ ENDIF | ||
| 129 | $ ENDIF | ||
| 130 | $ SET FILE/PROT=WORLD:RE WRK_SSLINCLUDE:'tmp' | ||
| 131 | $ GOTO LOOP_SDIRS | ||
| 132 | $ LOOP_SDIRS_END: | ||
| 133 | $ | ||
| 134 | $ I = 0 | ||
| 135 | $ LOOP_LIB: | ||
| 136 | $ E = F$EDIT(F$ELEMENT(I, ",", LIBS),"TRIM") | ||
| 137 | $ I = I + 1 | ||
| 138 | $ IF E .EQS. "," THEN GOTO LOOP_LIB_END | ||
| 139 | $ SET NOON | ||
| 140 | $ IF F$SEARCH(EXE_DIR+E+".OLB") .NES. "" | ||
| 141 | $ THEN | ||
| 142 | $ COPY 'EXE_DIR''E'.OLB WRK_SSLLIB:'E'.OLB/log | ||
| 143 | $ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.OLB | ||
| 144 | $ ENDIF | ||
| 145 | $ ! Preparing for the time when we have shareable images | ||
| 146 | $ IF F$SEARCH(EXE_DIR+E+".EXE") .NES. "" | ||
| 147 | $ THEN | ||
| 148 | $ COPY 'EXE_DIR''E'.EXE WRK_SSLLIB:'E'.EXE/log | ||
| 149 | $ SET FILE/PROT=W:RE WRK_SSLLIB:'E'.EXE | ||
| 150 | $ ENDIF | ||
| 151 | $ SET ON | ||
| 152 | $ GOTO LOOP_LIB | ||
| 153 | $ LOOP_LIB_END: | ||
| 154 | $ | ||
| 155 | $ EXIT | ||
diff --git a/src/lib/libcrypto/jpake/Makefile b/src/lib/libcrypto/jpake/Makefile new file mode 100644 index 0000000000..110c49ce0b --- /dev/null +++ b/src/lib/libcrypto/jpake/Makefile | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | DIR=jpake | ||
| 2 | TOP=../.. | ||
| 3 | |||
| 4 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 5 | |||
| 6 | LIB=$(TOP)/libcrypto.a | ||
| 7 | LIBOBJ=jpake.o jpake_err.o | ||
| 8 | LIBSRC=jpake.c jpake_err.c | ||
| 9 | |||
| 10 | EXHEADER=jpake.h | ||
| 11 | TEST=jpaketest.c | ||
| 12 | |||
| 13 | top: | ||
| 14 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 15 | |||
| 16 | all: lib | ||
| 17 | |||
| 18 | lib: $(LIBOBJ) | ||
| 19 | $(AR) $(LIB) $(LIBOBJ) | ||
| 20 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 21 | @touch lib | ||
| 22 | |||
| 23 | links: | ||
| 24 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 25 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 26 | |||
| 27 | install: | ||
| 28 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 29 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 30 | do \ | ||
| 31 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 32 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 33 | done; | ||
| 34 | |||
| 35 | depend: | ||
| 36 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 37 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 38 | |||
| 39 | dclean: | ||
| 40 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 41 | mv -f Makefile.new $(MAKEFILE) | ||
| 42 | |||
| 43 | clean: | ||
| 44 | rm -f *.s *.o *.obj des lib tags core .pure .nfs* *.old *.bak fluff | ||
| 45 | |||
| 46 | jpaketest: top jpaketest.c $(LIB) | ||
| 47 | $(CC) $(CFLAGS) -Wall -Werror -g -o jpaketest jpaketest.c $(LIB) | ||
| 48 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 49 | |||
| 50 | jpake.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 51 | jpake.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 52 | jpake.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 53 | jpake.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 54 | jpake.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 55 | jpake.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 56 | jpake.o: ../../include/openssl/symhacks.h jpake.c jpake.h | ||
| 57 | jpake_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 58 | jpake_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 59 | jpake_err.o: ../../include/openssl/err.h ../../include/openssl/jpake.h | ||
| 60 | jpake_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 61 | jpake_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 62 | jpake_err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 63 | jpake_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 64 | jpake_err.o: jpake_err.c | ||
diff --git a/src/lib/libcrypto/jpake/jpake.c b/src/lib/libcrypto/jpake/jpake.c new file mode 100644 index 0000000000..8e4b633ccc --- /dev/null +++ b/src/lib/libcrypto/jpake/jpake.c | |||
| @@ -0,0 +1,511 @@ | |||
| 1 | #include "jpake.h" | ||
| 2 | |||
| 3 | #include <openssl/crypto.h> | ||
| 4 | #include <openssl/sha.h> | ||
| 5 | #include <openssl/err.h> | ||
| 6 | #include <memory.h> | ||
| 7 | |||
| 8 | /* | ||
| 9 | * In the definition, (xa, xb, xc, xd) are Alice's (x1, x2, x3, x4) or | ||
| 10 | * Bob's (x3, x4, x1, x2). If you see what I mean. | ||
| 11 | */ | ||
| 12 | |||
| 13 | typedef struct | ||
| 14 | { | ||
| 15 | char *name; /* Must be unique */ | ||
| 16 | char *peer_name; | ||
| 17 | BIGNUM *p; | ||
| 18 | BIGNUM *g; | ||
| 19 | BIGNUM *q; | ||
| 20 | BIGNUM *gxc; /* Alice's g^{x3} or Bob's g^{x1} */ | ||
| 21 | BIGNUM *gxd; /* Alice's g^{x4} or Bob's g^{x2} */ | ||
| 22 | } JPAKE_CTX_PUBLIC; | ||
| 23 | |||
| 24 | struct JPAKE_CTX | ||
| 25 | { | ||
| 26 | JPAKE_CTX_PUBLIC p; | ||
| 27 | BIGNUM *secret; /* The shared secret */ | ||
| 28 | BN_CTX *ctx; | ||
| 29 | BIGNUM *xa; /* Alice's x1 or Bob's x3 */ | ||
| 30 | BIGNUM *xb; /* Alice's x2 or Bob's x4 */ | ||
| 31 | BIGNUM *key; /* The calculated (shared) key */ | ||
| 32 | }; | ||
| 33 | |||
| 34 | static void JPAKE_ZKP_init(JPAKE_ZKP *zkp) | ||
| 35 | { | ||
| 36 | zkp->gr = BN_new(); | ||
| 37 | zkp->b = BN_new(); | ||
| 38 | } | ||
| 39 | |||
| 40 | static void JPAKE_ZKP_release(JPAKE_ZKP *zkp) | ||
| 41 | { | ||
| 42 | BN_free(zkp->b); | ||
| 43 | BN_free(zkp->gr); | ||
| 44 | } | ||
| 45 | |||
| 46 | /* Two birds with one stone - make the global name as expected */ | ||
| 47 | #define JPAKE_STEP_PART_init JPAKE_STEP2_init | ||
| 48 | #define JPAKE_STEP_PART_release JPAKE_STEP2_release | ||
| 49 | |||
| 50 | void JPAKE_STEP_PART_init(JPAKE_STEP_PART *p) | ||
| 51 | { | ||
| 52 | p->gx = BN_new(); | ||
| 53 | JPAKE_ZKP_init(&p->zkpx); | ||
| 54 | } | ||
| 55 | |||
| 56 | void JPAKE_STEP_PART_release(JPAKE_STEP_PART *p) | ||
| 57 | { | ||
| 58 | JPAKE_ZKP_release(&p->zkpx); | ||
| 59 | BN_free(p->gx); | ||
| 60 | } | ||
| 61 | |||
| 62 | void JPAKE_STEP1_init(JPAKE_STEP1 *s1) | ||
| 63 | { | ||
| 64 | JPAKE_STEP_PART_init(&s1->p1); | ||
| 65 | JPAKE_STEP_PART_init(&s1->p2); | ||
| 66 | } | ||
| 67 | |||
| 68 | void JPAKE_STEP1_release(JPAKE_STEP1 *s1) | ||
| 69 | { | ||
| 70 | JPAKE_STEP_PART_release(&s1->p2); | ||
| 71 | JPAKE_STEP_PART_release(&s1->p1); | ||
| 72 | } | ||
| 73 | |||
| 74 | static void JPAKE_CTX_init(JPAKE_CTX *ctx, const char *name, | ||
| 75 | const char *peer_name, const BIGNUM *p, | ||
| 76 | const BIGNUM *g, const BIGNUM *q, | ||
| 77 | const BIGNUM *secret) | ||
| 78 | { | ||
| 79 | ctx->p.name = OPENSSL_strdup(name); | ||
| 80 | ctx->p.peer_name = OPENSSL_strdup(peer_name); | ||
| 81 | ctx->p.p = BN_dup(p); | ||
| 82 | ctx->p.g = BN_dup(g); | ||
| 83 | ctx->p.q = BN_dup(q); | ||
| 84 | ctx->secret = BN_dup(secret); | ||
| 85 | |||
| 86 | ctx->p.gxc = BN_new(); | ||
| 87 | ctx->p.gxd = BN_new(); | ||
| 88 | |||
| 89 | ctx->xa = BN_new(); | ||
| 90 | ctx->xb = BN_new(); | ||
| 91 | ctx->key = BN_new(); | ||
| 92 | ctx->ctx = BN_CTX_new(); | ||
| 93 | } | ||
| 94 | |||
| 95 | static void JPAKE_CTX_release(JPAKE_CTX *ctx) | ||
| 96 | { | ||
| 97 | BN_CTX_free(ctx->ctx); | ||
| 98 | BN_clear_free(ctx->key); | ||
| 99 | BN_clear_free(ctx->xb); | ||
| 100 | BN_clear_free(ctx->xa); | ||
| 101 | |||
| 102 | BN_free(ctx->p.gxd); | ||
| 103 | BN_free(ctx->p.gxc); | ||
| 104 | |||
| 105 | BN_clear_free(ctx->secret); | ||
| 106 | BN_free(ctx->p.q); | ||
| 107 | BN_free(ctx->p.g); | ||
| 108 | BN_free(ctx->p.p); | ||
| 109 | OPENSSL_free(ctx->p.peer_name); | ||
| 110 | OPENSSL_free(ctx->p.name); | ||
| 111 | |||
| 112 | memset(ctx, '\0', sizeof *ctx); | ||
| 113 | } | ||
| 114 | |||
| 115 | JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name, | ||
| 116 | const BIGNUM *p, const BIGNUM *g, const BIGNUM *q, | ||
| 117 | const BIGNUM *secret) | ||
| 118 | { | ||
| 119 | JPAKE_CTX *ctx = OPENSSL_malloc(sizeof *ctx); | ||
| 120 | |||
| 121 | JPAKE_CTX_init(ctx, name, peer_name, p, g, q, secret); | ||
| 122 | |||
| 123 | return ctx; | ||
| 124 | } | ||
| 125 | |||
| 126 | void JPAKE_CTX_free(JPAKE_CTX *ctx) | ||
| 127 | { | ||
| 128 | JPAKE_CTX_release(ctx); | ||
| 129 | OPENSSL_free(ctx); | ||
| 130 | } | ||
| 131 | |||
| 132 | static void hashlength(SHA_CTX *sha, size_t l) | ||
| 133 | { | ||
| 134 | unsigned char b[2]; | ||
| 135 | |||
| 136 | OPENSSL_assert(l <= 0xffff); | ||
| 137 | b[0] = l >> 8; | ||
| 138 | b[1] = l&0xff; | ||
| 139 | SHA1_Update(sha, b, 2); | ||
| 140 | } | ||
| 141 | |||
| 142 | static void hashstring(SHA_CTX *sha, const char *string) | ||
| 143 | { | ||
| 144 | size_t l = strlen(string); | ||
| 145 | |||
| 146 | hashlength(sha, l); | ||
| 147 | SHA1_Update(sha, string, l); | ||
| 148 | } | ||
| 149 | |||
| 150 | static void hashbn(SHA_CTX *sha, const BIGNUM *bn) | ||
| 151 | { | ||
| 152 | size_t l = BN_num_bytes(bn); | ||
| 153 | unsigned char *bin = OPENSSL_malloc(l); | ||
| 154 | |||
| 155 | hashlength(sha, l); | ||
| 156 | BN_bn2bin(bn, bin); | ||
| 157 | SHA1_Update(sha, bin, l); | ||
| 158 | OPENSSL_free(bin); | ||
| 159 | } | ||
| 160 | |||
| 161 | /* h=hash(g, g^r, g^x, name) */ | ||
| 162 | static void zkp_hash(BIGNUM *h, const BIGNUM *zkpg, const JPAKE_STEP_PART *p, | ||
| 163 | const char *proof_name) | ||
| 164 | { | ||
| 165 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 166 | SHA_CTX sha; | ||
| 167 | |||
| 168 | /* | ||
| 169 | * XXX: hash should not allow moving of the boundaries - Java code | ||
| 170 | * is flawed in this respect. Length encoding seems simplest. | ||
| 171 | */ | ||
| 172 | SHA1_Init(&sha); | ||
| 173 | hashbn(&sha, zkpg); | ||
| 174 | OPENSSL_assert(!BN_is_zero(p->zkpx.gr)); | ||
| 175 | hashbn(&sha, p->zkpx.gr); | ||
| 176 | hashbn(&sha, p->gx); | ||
| 177 | hashstring(&sha, proof_name); | ||
| 178 | SHA1_Final(md, &sha); | ||
| 179 | BN_bin2bn(md, SHA_DIGEST_LENGTH, h); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* | ||
| 183 | * Prove knowledge of x | ||
| 184 | * Note that p->gx has already been calculated | ||
| 185 | */ | ||
| 186 | static void generate_zkp(JPAKE_STEP_PART *p, const BIGNUM *x, | ||
| 187 | const BIGNUM *zkpg, JPAKE_CTX *ctx) | ||
| 188 | { | ||
| 189 | BIGNUM *r = BN_new(); | ||
| 190 | BIGNUM *h = BN_new(); | ||
| 191 | BIGNUM *t = BN_new(); | ||
| 192 | |||
| 193 | /* | ||
| 194 | * r in [0,q) | ||
| 195 | * XXX: Java chooses r in [0, 2^160) - i.e. distribution not uniform | ||
| 196 | */ | ||
| 197 | BN_rand_range(r, ctx->p.q); | ||
| 198 | /* g^r */ | ||
| 199 | BN_mod_exp(p->zkpx.gr, zkpg, r, ctx->p.p, ctx->ctx); | ||
| 200 | |||
| 201 | /* h=hash... */ | ||
| 202 | zkp_hash(h, zkpg, p, ctx->p.name); | ||
| 203 | |||
| 204 | /* b = r - x*h */ | ||
| 205 | BN_mod_mul(t, x, h, ctx->p.q, ctx->ctx); | ||
| 206 | BN_mod_sub(p->zkpx.b, r, t, ctx->p.q, ctx->ctx); | ||
| 207 | |||
| 208 | /* cleanup */ | ||
| 209 | BN_free(t); | ||
| 210 | BN_free(h); | ||
| 211 | BN_free(r); | ||
| 212 | } | ||
| 213 | |||
| 214 | static int verify_zkp(const JPAKE_STEP_PART *p, const BIGNUM *zkpg, | ||
| 215 | JPAKE_CTX *ctx) | ||
| 216 | { | ||
| 217 | BIGNUM *h = BN_new(); | ||
| 218 | BIGNUM *t1 = BN_new(); | ||
| 219 | BIGNUM *t2 = BN_new(); | ||
| 220 | BIGNUM *t3 = BN_new(); | ||
| 221 | int ret = 0; | ||
| 222 | |||
| 223 | zkp_hash(h, zkpg, p, ctx->p.peer_name); | ||
| 224 | |||
| 225 | /* t1 = g^b */ | ||
| 226 | BN_mod_exp(t1, zkpg, p->zkpx.b, ctx->p.p, ctx->ctx); | ||
| 227 | /* t2 = (g^x)^h = g^{hx} */ | ||
| 228 | BN_mod_exp(t2, p->gx, h, ctx->p.p, ctx->ctx); | ||
| 229 | /* t3 = t1 * t2 = g^{hx} * g^b = g^{hx+b} = g^r (allegedly) */ | ||
| 230 | BN_mod_mul(t3, t1, t2, ctx->p.p, ctx->ctx); | ||
| 231 | |||
| 232 | /* verify t3 == g^r */ | ||
| 233 | if(BN_cmp(t3, p->zkpx.gr) == 0) | ||
| 234 | ret = 1; | ||
| 235 | else | ||
| 236 | JPAKEerr(JPAKE_F_VERIFY_ZKP, JPAKE_R_ZKP_VERIFY_FAILED); | ||
| 237 | |||
| 238 | /* cleanup */ | ||
| 239 | BN_free(t3); | ||
| 240 | BN_free(t2); | ||
| 241 | BN_free(t1); | ||
| 242 | BN_free(h); | ||
| 243 | |||
| 244 | return ret; | ||
| 245 | } | ||
| 246 | |||
| 247 | static void generate_step_part(JPAKE_STEP_PART *p, const BIGNUM *x, | ||
| 248 | const BIGNUM *g, JPAKE_CTX *ctx) | ||
| 249 | { | ||
| 250 | BN_mod_exp(p->gx, g, x, ctx->p.p, ctx->ctx); | ||
| 251 | generate_zkp(p, x, g, ctx); | ||
| 252 | } | ||
| 253 | |||
| 254 | /* Generate each party's random numbers. xa is in [0, q), xb is in [1, q). */ | ||
| 255 | static void genrand(JPAKE_CTX *ctx) | ||
| 256 | { | ||
| 257 | BIGNUM *qm1; | ||
| 258 | |||
| 259 | /* xa in [0, q) */ | ||
| 260 | BN_rand_range(ctx->xa, ctx->p.q); | ||
| 261 | |||
| 262 | /* q-1 */ | ||
| 263 | qm1 = BN_new(); | ||
| 264 | BN_copy(qm1, ctx->p.q); | ||
| 265 | BN_sub_word(qm1, 1); | ||
| 266 | |||
| 267 | /* ... and xb in [0, q-1) */ | ||
| 268 | BN_rand_range(ctx->xb, qm1); | ||
| 269 | /* [1, q) */ | ||
| 270 | BN_add_word(ctx->xb, 1); | ||
| 271 | |||
| 272 | /* cleanup */ | ||
| 273 | BN_free(qm1); | ||
| 274 | } | ||
| 275 | |||
| 276 | int JPAKE_STEP1_generate(JPAKE_STEP1 *send, JPAKE_CTX *ctx) | ||
| 277 | { | ||
| 278 | genrand(ctx); | ||
| 279 | generate_step_part(&send->p1, ctx->xa, ctx->p.g, ctx); | ||
| 280 | generate_step_part(&send->p2, ctx->xb, ctx->p.g, ctx); | ||
| 281 | |||
| 282 | return 1; | ||
| 283 | } | ||
| 284 | |||
| 285 | /* g^x is a legal value */ | ||
| 286 | static int is_legal(const BIGNUM *gx, const JPAKE_CTX *ctx) | ||
| 287 | { | ||
| 288 | BIGNUM *t; | ||
| 289 | int res; | ||
| 290 | |||
| 291 | if(BN_is_negative(gx) || BN_is_zero(gx) || BN_cmp(gx, ctx->p.p) >= 0) | ||
| 292 | return 0; | ||
| 293 | |||
| 294 | t = BN_new(); | ||
| 295 | BN_mod_exp(t, gx, ctx->p.q, ctx->p.p, ctx->ctx); | ||
| 296 | res = BN_is_one(t); | ||
| 297 | BN_free(t); | ||
| 298 | |||
| 299 | return res; | ||
| 300 | } | ||
| 301 | |||
| 302 | int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received) | ||
| 303 | { | ||
| 304 | if(!is_legal(received->p1.gx, ctx)) | ||
| 305 | { | ||
| 306 | JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL); | ||
| 307 | return 0; | ||
| 308 | } | ||
| 309 | |||
| 310 | if(!is_legal(received->p2.gx, ctx)) | ||
| 311 | { | ||
| 312 | JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL); | ||
| 313 | return 0; | ||
| 314 | } | ||
| 315 | |||
| 316 | /* verify their ZKP(xc) */ | ||
| 317 | if(!verify_zkp(&received->p1, ctx->p.g, ctx)) | ||
| 318 | { | ||
| 319 | JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X3_FAILED); | ||
| 320 | return 0; | ||
| 321 | } | ||
| 322 | |||
| 323 | /* verify their ZKP(xd) */ | ||
| 324 | if(!verify_zkp(&received->p2, ctx->p.g, ctx)) | ||
| 325 | { | ||
| 326 | JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_VERIFY_X4_FAILED); | ||
| 327 | return 0; | ||
| 328 | } | ||
| 329 | |||
| 330 | /* g^xd != 1 */ | ||
| 331 | if(BN_is_one(received->p2.gx)) | ||
| 332 | { | ||
| 333 | JPAKEerr(JPAKE_F_JPAKE_STEP1_PROCESS, JPAKE_R_G_TO_THE_X4_IS_ONE); | ||
| 334 | return 0; | ||
| 335 | } | ||
| 336 | |||
| 337 | /* Save the bits we need for later */ | ||
| 338 | BN_copy(ctx->p.gxc, received->p1.gx); | ||
| 339 | BN_copy(ctx->p.gxd, received->p2.gx); | ||
| 340 | |||
| 341 | return 1; | ||
| 342 | } | ||
| 343 | |||
| 344 | |||
| 345 | int JPAKE_STEP2_generate(JPAKE_STEP2 *send, JPAKE_CTX *ctx) | ||
| 346 | { | ||
| 347 | BIGNUM *t1 = BN_new(); | ||
| 348 | BIGNUM *t2 = BN_new(); | ||
| 349 | |||
| 350 | /* | ||
| 351 | * X = g^{(xa + xc + xd) * xb * s} | ||
| 352 | * t1 = g^xa | ||
| 353 | */ | ||
| 354 | BN_mod_exp(t1, ctx->p.g, ctx->xa, ctx->p.p, ctx->ctx); | ||
| 355 | /* t2 = t1 * g^{xc} = g^{xa} * g^{xc} = g^{xa + xc} */ | ||
| 356 | BN_mod_mul(t2, t1, ctx->p.gxc, ctx->p.p, ctx->ctx); | ||
| 357 | /* t1 = t2 * g^{xd} = g^{xa + xc + xd} */ | ||
| 358 | BN_mod_mul(t1, t2, ctx->p.gxd, ctx->p.p, ctx->ctx); | ||
| 359 | /* t2 = xb * s */ | ||
| 360 | BN_mod_mul(t2, ctx->xb, ctx->secret, ctx->p.q, ctx->ctx); | ||
| 361 | |||
| 362 | /* | ||
| 363 | * ZKP(xb * s) | ||
| 364 | * XXX: this is kinda funky, because we're using | ||
| 365 | * | ||
| 366 | * g' = g^{xa + xc + xd} | ||
| 367 | * | ||
| 368 | * as the generator, which means X is g'^{xb * s} | ||
| 369 | * X = t1^{t2} = t1^{xb * s} = g^{(xa + xc + xd) * xb * s} | ||
| 370 | */ | ||
| 371 | generate_step_part(send, t2, t1, ctx); | ||
| 372 | |||
| 373 | /* cleanup */ | ||
| 374 | BN_free(t1); | ||
| 375 | BN_free(t2); | ||
| 376 | |||
| 377 | return 1; | ||
| 378 | } | ||
| 379 | |||
| 380 | /* gx = g^{xc + xa + xb} * xd * s */ | ||
| 381 | static int compute_key(JPAKE_CTX *ctx, const BIGNUM *gx) | ||
| 382 | { | ||
| 383 | BIGNUM *t1 = BN_new(); | ||
| 384 | BIGNUM *t2 = BN_new(); | ||
| 385 | BIGNUM *t3 = BN_new(); | ||
| 386 | |||
| 387 | /* | ||
| 388 | * K = (gx/g^{xb * xd * s})^{xb} | ||
| 389 | * = (g^{(xc + xa + xb) * xd * s - xb * xd *s})^{xb} | ||
| 390 | * = (g^{(xa + xc) * xd * s})^{xb} | ||
| 391 | * = g^{(xa + xc) * xb * xd * s} | ||
| 392 | * [which is the same regardless of who calculates it] | ||
| 393 | */ | ||
| 394 | |||
| 395 | /* t1 = (g^{xd})^{xb} = g^{xb * xd} */ | ||
| 396 | BN_mod_exp(t1, ctx->p.gxd, ctx->xb, ctx->p.p, ctx->ctx); | ||
| 397 | /* t2 = -s = q-s */ | ||
| 398 | BN_sub(t2, ctx->p.q, ctx->secret); | ||
| 399 | /* t3 = t1^t2 = g^{-xb * xd * s} */ | ||
| 400 | BN_mod_exp(t3, t1, t2, ctx->p.p, ctx->ctx); | ||
| 401 | /* t1 = gx * t3 = X/g^{xb * xd * s} */ | ||
| 402 | BN_mod_mul(t1, gx, t3, ctx->p.p, ctx->ctx); | ||
| 403 | /* K = t1^{xb} */ | ||
| 404 | BN_mod_exp(ctx->key, t1, ctx->xb, ctx->p.p, ctx->ctx); | ||
| 405 | |||
| 406 | /* cleanup */ | ||
| 407 | BN_free(t3); | ||
| 408 | BN_free(t2); | ||
| 409 | BN_free(t1); | ||
| 410 | |||
| 411 | return 1; | ||
| 412 | } | ||
| 413 | |||
| 414 | int JPAKE_STEP2_process(JPAKE_CTX *ctx, const JPAKE_STEP2 *received) | ||
| 415 | { | ||
| 416 | BIGNUM *t1 = BN_new(); | ||
| 417 | BIGNUM *t2 = BN_new(); | ||
| 418 | int ret = 0; | ||
| 419 | |||
| 420 | /* | ||
| 421 | * g' = g^{xc + xa + xb} [from our POV] | ||
| 422 | * t1 = xa + xb | ||
| 423 | */ | ||
| 424 | BN_mod_add(t1, ctx->xa, ctx->xb, ctx->p.q, ctx->ctx); | ||
| 425 | /* t2 = g^{t1} = g^{xa+xb} */ | ||
| 426 | BN_mod_exp(t2, ctx->p.g, t1, ctx->p.p, ctx->ctx); | ||
| 427 | /* t1 = g^{xc} * t2 = g^{xc + xa + xb} */ | ||
| 428 | BN_mod_mul(t1, ctx->p.gxc, t2, ctx->p.p, ctx->ctx); | ||
| 429 | |||
| 430 | if(verify_zkp(received, t1, ctx)) | ||
| 431 | ret = 1; | ||
| 432 | else | ||
| 433 | JPAKEerr(JPAKE_F_JPAKE_STEP2_PROCESS, JPAKE_R_VERIFY_B_FAILED); | ||
| 434 | |||
| 435 | compute_key(ctx, received->gx); | ||
| 436 | |||
| 437 | /* cleanup */ | ||
| 438 | BN_free(t2); | ||
| 439 | BN_free(t1); | ||
| 440 | |||
| 441 | return ret; | ||
| 442 | } | ||
| 443 | |||
| 444 | static void quickhashbn(unsigned char *md, const BIGNUM *bn) | ||
| 445 | { | ||
| 446 | SHA_CTX sha; | ||
| 447 | |||
| 448 | SHA1_Init(&sha); | ||
| 449 | hashbn(&sha, bn); | ||
| 450 | SHA1_Final(md, &sha); | ||
| 451 | } | ||
| 452 | |||
| 453 | void JPAKE_STEP3A_init(JPAKE_STEP3A *s3a) | ||
| 454 | {} | ||
| 455 | |||
| 456 | int JPAKE_STEP3A_generate(JPAKE_STEP3A *send, JPAKE_CTX *ctx) | ||
| 457 | { | ||
| 458 | quickhashbn(send->hhk, ctx->key); | ||
| 459 | SHA1(send->hhk, sizeof send->hhk, send->hhk); | ||
| 460 | |||
| 461 | return 1; | ||
| 462 | } | ||
| 463 | |||
| 464 | int JPAKE_STEP3A_process(JPAKE_CTX *ctx, const JPAKE_STEP3A *received) | ||
| 465 | { | ||
| 466 | unsigned char hhk[SHA_DIGEST_LENGTH]; | ||
| 467 | |||
| 468 | quickhashbn(hhk, ctx->key); | ||
| 469 | SHA1(hhk, sizeof hhk, hhk); | ||
| 470 | if(memcmp(hhk, received->hhk, sizeof hhk)) | ||
| 471 | { | ||
| 472 | JPAKEerr(JPAKE_F_JPAKE_STEP3A_PROCESS, JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH); | ||
| 473 | return 0; | ||
| 474 | } | ||
| 475 | return 1; | ||
| 476 | } | ||
| 477 | |||
| 478 | void JPAKE_STEP3A_release(JPAKE_STEP3A *s3a) | ||
| 479 | {} | ||
| 480 | |||
| 481 | void JPAKE_STEP3B_init(JPAKE_STEP3B *s3b) | ||
| 482 | {} | ||
| 483 | |||
| 484 | int JPAKE_STEP3B_generate(JPAKE_STEP3B *send, JPAKE_CTX *ctx) | ||
| 485 | { | ||
| 486 | quickhashbn(send->hk, ctx->key); | ||
| 487 | |||
| 488 | return 1; | ||
| 489 | } | ||
| 490 | |||
| 491 | int JPAKE_STEP3B_process(JPAKE_CTX *ctx, const JPAKE_STEP3B *received) | ||
| 492 | { | ||
| 493 | unsigned char hk[SHA_DIGEST_LENGTH]; | ||
| 494 | |||
| 495 | quickhashbn(hk, ctx->key); | ||
| 496 | if(memcmp(hk, received->hk, sizeof hk)) | ||
| 497 | { | ||
| 498 | JPAKEerr(JPAKE_F_JPAKE_STEP3B_PROCESS, JPAKE_R_HASH_OF_KEY_MISMATCH); | ||
| 499 | return 0; | ||
| 500 | } | ||
| 501 | return 1; | ||
| 502 | } | ||
| 503 | |||
| 504 | void JPAKE_STEP3B_release(JPAKE_STEP3B *s3b) | ||
| 505 | {} | ||
| 506 | |||
| 507 | const BIGNUM *JPAKE_get_shared_key(JPAKE_CTX *ctx) | ||
| 508 | { | ||
| 509 | return ctx->key; | ||
| 510 | } | ||
| 511 | |||
diff --git a/src/lib/libcrypto/jpake/jpake.h b/src/lib/libcrypto/jpake/jpake.h new file mode 100644 index 0000000000..fd143b4d9b --- /dev/null +++ b/src/lib/libcrypto/jpake/jpake.h | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | /* | ||
| 2 | * Implement J-PAKE, as described in | ||
| 3 | * http://grouper.ieee.org/groups/1363/Research/contributions/hao-ryan-2008.pdf | ||
| 4 | * | ||
| 5 | * With hints from http://www.cl.cam.ac.uk/~fh240/software/JPAKE2.java. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef HEADER_JPAKE_H | ||
| 9 | #define HEADER_JPAKE_H | ||
| 10 | |||
| 11 | #include <openssl/opensslconf.h> | ||
| 12 | |||
| 13 | #ifdef OPENSSL_NO_JPAKE | ||
| 14 | #error JPAKE is disabled. | ||
| 15 | #endif | ||
| 16 | |||
| 17 | #ifdef __cplusplus | ||
| 18 | extern "C" { | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #include <openssl/bn.h> | ||
| 22 | #include <openssl/sha.h> | ||
| 23 | |||
| 24 | typedef struct JPAKE_CTX JPAKE_CTX; | ||
| 25 | |||
| 26 | /* Note that "g" in the ZKPs is not necessarily the J-PAKE g. */ | ||
| 27 | typedef struct | ||
| 28 | { | ||
| 29 | BIGNUM *gr; /* g^r (r random) */ | ||
| 30 | BIGNUM *b; /* b = r - x*h, h=hash(g, g^r, g^x, name) */ | ||
| 31 | } JPAKE_ZKP; | ||
| 32 | |||
| 33 | typedef struct | ||
| 34 | { | ||
| 35 | BIGNUM *gx; /* g^x in step 1, g^(xa + xc + xd) * xb * s in step 2 */ | ||
| 36 | JPAKE_ZKP zkpx; /* ZKP(x) or ZKP(xb * s) */ | ||
| 37 | } JPAKE_STEP_PART; | ||
| 38 | |||
| 39 | typedef struct | ||
| 40 | { | ||
| 41 | JPAKE_STEP_PART p1; /* g^x3, ZKP(x3) or g^x1, ZKP(x1) */ | ||
| 42 | JPAKE_STEP_PART p2; /* g^x4, ZKP(x4) or g^x2, ZKP(x2) */ | ||
| 43 | } JPAKE_STEP1; | ||
| 44 | |||
| 45 | typedef JPAKE_STEP_PART JPAKE_STEP2; | ||
| 46 | |||
| 47 | typedef struct | ||
| 48 | { | ||
| 49 | unsigned char hhk[SHA_DIGEST_LENGTH]; | ||
| 50 | } JPAKE_STEP3A; | ||
| 51 | |||
| 52 | typedef struct | ||
| 53 | { | ||
| 54 | unsigned char hk[SHA_DIGEST_LENGTH]; | ||
| 55 | } JPAKE_STEP3B; | ||
| 56 | |||
| 57 | /* Parameters are copied */ | ||
| 58 | JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name, | ||
| 59 | const BIGNUM *p, const BIGNUM *g, const BIGNUM *q, | ||
| 60 | const BIGNUM *secret); | ||
| 61 | void JPAKE_CTX_free(JPAKE_CTX *ctx); | ||
| 62 | |||
| 63 | /* | ||
| 64 | * Note that JPAKE_STEP1 can be used multiple times before release | ||
| 65 | * without another init. | ||
| 66 | */ | ||
| 67 | void JPAKE_STEP1_init(JPAKE_STEP1 *s1); | ||
| 68 | int JPAKE_STEP1_generate(JPAKE_STEP1 *send, JPAKE_CTX *ctx); | ||
| 69 | int JPAKE_STEP1_process(JPAKE_CTX *ctx, const JPAKE_STEP1 *received); | ||
| 70 | void JPAKE_STEP1_release(JPAKE_STEP1 *s1); | ||
| 71 | |||
| 72 | /* | ||
| 73 | * Note that JPAKE_STEP2 can be used multiple times before release | ||
| 74 | * without another init. | ||
| 75 | */ | ||
| 76 | void JPAKE_STEP2_init(JPAKE_STEP2 *s2); | ||
| 77 | int JPAKE_STEP2_generate(JPAKE_STEP2 *send, JPAKE_CTX *ctx); | ||
| 78 | int JPAKE_STEP2_process(JPAKE_CTX *ctx, const JPAKE_STEP2 *received); | ||
| 79 | void JPAKE_STEP2_release(JPAKE_STEP2 *s2); | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Optionally verify the shared key. If the shared secrets do not | ||
| 83 | * match, the two ends will disagree about the shared key, but | ||
| 84 | * otherwise the protocol will succeed. | ||
| 85 | */ | ||
| 86 | void JPAKE_STEP3A_init(JPAKE_STEP3A *s3a); | ||
| 87 | int JPAKE_STEP3A_generate(JPAKE_STEP3A *send, JPAKE_CTX *ctx); | ||
| 88 | int JPAKE_STEP3A_process(JPAKE_CTX *ctx, const JPAKE_STEP3A *received); | ||
| 89 | void JPAKE_STEP3A_release(JPAKE_STEP3A *s3a); | ||
| 90 | |||
| 91 | void JPAKE_STEP3B_init(JPAKE_STEP3B *s3b); | ||
| 92 | int JPAKE_STEP3B_generate(JPAKE_STEP3B *send, JPAKE_CTX *ctx); | ||
| 93 | int JPAKE_STEP3B_process(JPAKE_CTX *ctx, const JPAKE_STEP3B *received); | ||
| 94 | void JPAKE_STEP3B_release(JPAKE_STEP3B *s3b); | ||
| 95 | |||
| 96 | /* | ||
| 97 | * the return value belongs to the library and will be released when | ||
| 98 | * ctx is released, and will change when a new handshake is performed. | ||
| 99 | */ | ||
| 100 | const BIGNUM *JPAKE_get_shared_key(JPAKE_CTX *ctx); | ||
| 101 | |||
| 102 | /* BEGIN ERROR CODES */ | ||
| 103 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 104 | * made after this point may be overwritten when the script is next run. | ||
| 105 | */ | ||
| 106 | void ERR_load_JPAKE_strings(void); | ||
| 107 | |||
| 108 | /* Error codes for the JPAKE functions. */ | ||
| 109 | |||
| 110 | /* Function codes. */ | ||
| 111 | #define JPAKE_F_JPAKE_STEP1_PROCESS 101 | ||
| 112 | #define JPAKE_F_JPAKE_STEP2_PROCESS 102 | ||
| 113 | #define JPAKE_F_JPAKE_STEP3A_PROCESS 103 | ||
| 114 | #define JPAKE_F_JPAKE_STEP3B_PROCESS 104 | ||
| 115 | #define JPAKE_F_VERIFY_ZKP 100 | ||
| 116 | |||
| 117 | /* Reason codes. */ | ||
| 118 | #define JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL 108 | ||
| 119 | #define JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL 109 | ||
| 120 | #define JPAKE_R_G_TO_THE_X4_IS_ONE 105 | ||
| 121 | #define JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH 106 | ||
| 122 | #define JPAKE_R_HASH_OF_KEY_MISMATCH 107 | ||
| 123 | #define JPAKE_R_VERIFY_B_FAILED 102 | ||
| 124 | #define JPAKE_R_VERIFY_X3_FAILED 103 | ||
| 125 | #define JPAKE_R_VERIFY_X4_FAILED 104 | ||
| 126 | #define JPAKE_R_ZKP_VERIFY_FAILED 100 | ||
| 127 | |||
| 128 | #ifdef __cplusplus | ||
| 129 | } | ||
| 130 | #endif | ||
| 131 | #endif | ||
diff --git a/src/lib/libcrypto/jpake/jpake_err.c b/src/lib/libcrypto/jpake/jpake_err.c new file mode 100644 index 0000000000..a9a9dee75c --- /dev/null +++ b/src/lib/libcrypto/jpake/jpake_err.c | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | /* crypto/jpake/jpake_err.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@OpenSSL.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
| 57 | * made to it will be overwritten when the script next updates this file, | ||
| 58 | * only reason strings will be preserved. | ||
| 59 | */ | ||
| 60 | |||
| 61 | #include <stdio.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/jpake.h> | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | |||
| 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_JPAKE,func,0) | ||
| 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_JPAKE,0,reason) | ||
| 70 | |||
| 71 | static ERR_STRING_DATA JPAKE_str_functs[]= | ||
| 72 | { | ||
| 73 | {ERR_FUNC(JPAKE_F_JPAKE_STEP1_PROCESS), "JPAKE_STEP1_process"}, | ||
| 74 | {ERR_FUNC(JPAKE_F_JPAKE_STEP2_PROCESS), "JPAKE_STEP2_process"}, | ||
| 75 | {ERR_FUNC(JPAKE_F_JPAKE_STEP3A_PROCESS), "JPAKE_STEP3A_process"}, | ||
| 76 | {ERR_FUNC(JPAKE_F_JPAKE_STEP3B_PROCESS), "JPAKE_STEP3B_process"}, | ||
| 77 | {ERR_FUNC(JPAKE_F_VERIFY_ZKP), "VERIFY_ZKP"}, | ||
| 78 | {0,NULL} | ||
| 79 | }; | ||
| 80 | |||
| 81 | static ERR_STRING_DATA JPAKE_str_reasons[]= | ||
| 82 | { | ||
| 83 | {ERR_REASON(JPAKE_R_G_TO_THE_X3_IS_NOT_LEGAL),"g to the x3 is not legal"}, | ||
| 84 | {ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_NOT_LEGAL),"g to the x4 is not legal"}, | ||
| 85 | {ERR_REASON(JPAKE_R_G_TO_THE_X4_IS_ONE) ,"g to the x4 is one"}, | ||
| 86 | {ERR_REASON(JPAKE_R_HASH_OF_HASH_OF_KEY_MISMATCH),"hash of hash of key mismatch"}, | ||
| 87 | {ERR_REASON(JPAKE_R_HASH_OF_KEY_MISMATCH),"hash of key mismatch"}, | ||
| 88 | {ERR_REASON(JPAKE_R_VERIFY_B_FAILED) ,"verify b failed"}, | ||
| 89 | {ERR_REASON(JPAKE_R_VERIFY_X3_FAILED) ,"verify x3 failed"}, | ||
| 90 | {ERR_REASON(JPAKE_R_VERIFY_X4_FAILED) ,"verify x4 failed"}, | ||
| 91 | {ERR_REASON(JPAKE_R_ZKP_VERIFY_FAILED) ,"zkp verify failed"}, | ||
| 92 | {0,NULL} | ||
| 93 | }; | ||
| 94 | |||
| 95 | #endif | ||
| 96 | |||
| 97 | void ERR_load_JPAKE_strings(void) | ||
| 98 | { | ||
| 99 | #ifndef OPENSSL_NO_ERR | ||
| 100 | |||
| 101 | if (ERR_func_error_string(JPAKE_str_functs[0].error) == NULL) | ||
| 102 | { | ||
| 103 | ERR_load_strings(0,JPAKE_str_functs); | ||
| 104 | ERR_load_strings(0,JPAKE_str_reasons); | ||
| 105 | } | ||
| 106 | #endif | ||
| 107 | } | ||
diff --git a/src/lib/libcrypto/jpake/jpaketest.c b/src/lib/libcrypto/jpake/jpaketest.c new file mode 100644 index 0000000000..eaba75ed8a --- /dev/null +++ b/src/lib/libcrypto/jpake/jpaketest.c | |||
| @@ -0,0 +1,192 @@ | |||
| 1 | #include <openssl/opensslconf.h> | ||
| 2 | |||
| 3 | #ifdef OPENSSL_NO_JPAKE | ||
| 4 | |||
| 5 | #include <stdio.h> | ||
| 6 | |||
| 7 | int main(int argc, char *argv[]) | ||
| 8 | { | ||
| 9 | printf("No J-PAKE support\n"); | ||
| 10 | return(0); | ||
| 11 | } | ||
| 12 | |||
| 13 | #else | ||
| 14 | |||
| 15 | #include <openssl/jpake.h> | ||
| 16 | #include <openssl/err.h> | ||
| 17 | |||
| 18 | static void showbn(const char *name, const BIGNUM *bn) | ||
| 19 | { | ||
| 20 | fputs(name, stdout); | ||
| 21 | fputs(" = ", stdout); | ||
| 22 | BN_print_fp(stdout, bn); | ||
| 23 | putc('\n', stdout); | ||
| 24 | } | ||
| 25 | |||
| 26 | static int run_jpake(JPAKE_CTX *alice, JPAKE_CTX *bob) | ||
| 27 | { | ||
| 28 | JPAKE_STEP1 alice_s1; | ||
| 29 | JPAKE_STEP1 bob_s1; | ||
| 30 | JPAKE_STEP2 alice_s2; | ||
| 31 | JPAKE_STEP2 bob_s2; | ||
| 32 | JPAKE_STEP3A alice_s3a; | ||
| 33 | JPAKE_STEP3B bob_s3b; | ||
| 34 | |||
| 35 | /* Alice -> Bob: step 1 */ | ||
| 36 | puts("A->B s1"); | ||
| 37 | JPAKE_STEP1_init(&alice_s1); | ||
| 38 | JPAKE_STEP1_generate(&alice_s1, alice); | ||
| 39 | if(!JPAKE_STEP1_process(bob, &alice_s1)) | ||
| 40 | { | ||
| 41 | printf("Bob fails to process Alice's step 1\n"); | ||
| 42 | ERR_print_errors_fp(stdout); | ||
| 43 | return 1; | ||
| 44 | } | ||
| 45 | JPAKE_STEP1_release(&alice_s1); | ||
| 46 | |||
| 47 | /* Bob -> Alice: step 1 */ | ||
| 48 | puts("B->A s1"); | ||
| 49 | JPAKE_STEP1_init(&bob_s1); | ||
| 50 | JPAKE_STEP1_generate(&bob_s1, bob); | ||
| 51 | if(!JPAKE_STEP1_process(alice, &bob_s1)) | ||
| 52 | { | ||
| 53 | printf("Alice fails to process Bob's step 1\n"); | ||
| 54 | ERR_print_errors_fp(stdout); | ||
| 55 | return 2; | ||
| 56 | } | ||
| 57 | JPAKE_STEP1_release(&bob_s1); | ||
| 58 | |||
| 59 | /* Alice -> Bob: step 2 */ | ||
| 60 | puts("A->B s2"); | ||
| 61 | JPAKE_STEP2_init(&alice_s2); | ||
| 62 | JPAKE_STEP2_generate(&alice_s2, alice); | ||
| 63 | if(!JPAKE_STEP2_process(bob, &alice_s2)) | ||
| 64 | { | ||
| 65 | printf("Bob fails to process Alice's step 2\n"); | ||
| 66 | ERR_print_errors_fp(stdout); | ||
| 67 | return 3; | ||
| 68 | } | ||
| 69 | JPAKE_STEP2_release(&alice_s2); | ||
| 70 | |||
| 71 | /* Bob -> Alice: step 2 */ | ||
| 72 | puts("B->A s2"); | ||
| 73 | JPAKE_STEP2_init(&bob_s2); | ||
| 74 | JPAKE_STEP2_generate(&bob_s2, bob); | ||
| 75 | if(!JPAKE_STEP2_process(alice, &bob_s2)) | ||
| 76 | { | ||
| 77 | printf("Alice fails to process Bob's step 2\n"); | ||
| 78 | ERR_print_errors_fp(stdout); | ||
| 79 | return 4; | ||
| 80 | } | ||
| 81 | JPAKE_STEP2_release(&bob_s2); | ||
| 82 | |||
| 83 | showbn("Alice's key", JPAKE_get_shared_key(alice)); | ||
| 84 | showbn("Bob's key ", JPAKE_get_shared_key(bob)); | ||
| 85 | |||
| 86 | /* Alice -> Bob: step 3a */ | ||
| 87 | puts("A->B s3a"); | ||
| 88 | JPAKE_STEP3A_init(&alice_s3a); | ||
| 89 | JPAKE_STEP3A_generate(&alice_s3a, alice); | ||
| 90 | if(!JPAKE_STEP3A_process(bob, &alice_s3a)) | ||
| 91 | { | ||
| 92 | printf("Bob fails to process Alice's step 3a\n"); | ||
| 93 | ERR_print_errors_fp(stdout); | ||
| 94 | return 5; | ||
| 95 | } | ||
| 96 | JPAKE_STEP3A_release(&alice_s3a); | ||
| 97 | |||
| 98 | /* Bob -> Alice: step 3b */ | ||
| 99 | puts("B->A s3b"); | ||
| 100 | JPAKE_STEP3B_init(&bob_s3b); | ||
| 101 | JPAKE_STEP3B_generate(&bob_s3b, bob); | ||
| 102 | if(!JPAKE_STEP3B_process(alice, &bob_s3b)) | ||
| 103 | { | ||
| 104 | printf("Alice fails to process Bob's step 3b\n"); | ||
| 105 | ERR_print_errors_fp(stdout); | ||
| 106 | return 6; | ||
| 107 | } | ||
| 108 | JPAKE_STEP3B_release(&bob_s3b); | ||
| 109 | |||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | int main(int argc, char **argv) | ||
| 114 | { | ||
| 115 | JPAKE_CTX *alice; | ||
| 116 | JPAKE_CTX *bob; | ||
| 117 | BIGNUM *p = NULL; | ||
| 118 | BIGNUM *g = NULL; | ||
| 119 | BIGNUM *q = NULL; | ||
| 120 | BIGNUM *secret = BN_new(); | ||
| 121 | BIO *bio_err; | ||
| 122 | |||
| 123 | bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); | ||
| 124 | |||
| 125 | CRYPTO_malloc_debug_init(); | ||
| 126 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
| 127 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 128 | |||
| 129 | ERR_load_crypto_strings(); | ||
| 130 | |||
| 131 | /* | ||
| 132 | BN_hex2bn(&p, "fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7"); | ||
| 133 | BN_hex2bn(&g, "f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a"); | ||
| 134 | BN_hex2bn(&q, "9760508f15230bccb292b982a2eb840bf0581cf5"); | ||
| 135 | */ | ||
| 136 | /* | ||
| 137 | p = BN_new(); | ||
| 138 | BN_generate_prime(p, 1024, 1, NULL, NULL, NULL, NULL); | ||
| 139 | */ | ||
| 140 | /* Use a safe prime for p (that we found earlier) */ | ||
| 141 | BN_hex2bn(&p, "F9E5B365665EA7A05A9C534502780FEE6F1AB5BD4F49947FD036DBD7E905269AF46EF28B0FC07487EE4F5D20FB3C0AF8E700F3A2FA3414970CBED44FEDFF80CE78D800F184BB82435D137AADA2C6C16523247930A63B85661D1FC817A51ACD96168E95898A1F83A79FFB529368AA7833ABD1B0C3AEDDB14D2E1A2F71D99F763F"); | ||
| 142 | showbn("p", p); | ||
| 143 | g = BN_new(); | ||
| 144 | BN_set_word(g, 2); | ||
| 145 | showbn("g", g); | ||
| 146 | q = BN_new(); | ||
| 147 | BN_rshift1(q, p); | ||
| 148 | showbn("q", q); | ||
| 149 | |||
| 150 | BN_rand(secret, 32, -1, 0); | ||
| 151 | |||
| 152 | /* A normal run, expect this to work... */ | ||
| 153 | alice = JPAKE_CTX_new("Alice", "Bob", p, g, q, secret); | ||
| 154 | bob = JPAKE_CTX_new("Bob", "Alice", p, g, q, secret); | ||
| 155 | |||
| 156 | if(run_jpake(alice, bob) != 0) | ||
| 157 | { | ||
| 158 | fprintf(stderr, "Plain JPAKE run failed\n"); | ||
| 159 | return 1; | ||
| 160 | } | ||
| 161 | |||
| 162 | JPAKE_CTX_free(bob); | ||
| 163 | JPAKE_CTX_free(alice); | ||
| 164 | |||
| 165 | /* Now give Alice and Bob different secrets */ | ||
| 166 | alice = JPAKE_CTX_new("Alice", "Bob", p, g, q, secret); | ||
| 167 | BN_add_word(secret, 1); | ||
| 168 | bob = JPAKE_CTX_new("Bob", "Alice", p, g, q, secret); | ||
| 169 | |||
| 170 | if(run_jpake(alice, bob) != 5) | ||
| 171 | { | ||
| 172 | fprintf(stderr, "Mismatched secret JPAKE run failed\n"); | ||
| 173 | return 1; | ||
| 174 | } | ||
| 175 | |||
| 176 | JPAKE_CTX_free(bob); | ||
| 177 | JPAKE_CTX_free(alice); | ||
| 178 | |||
| 179 | BN_free(secret); | ||
| 180 | BN_free(q); | ||
| 181 | BN_free(g); | ||
| 182 | BN_free(p); | ||
| 183 | |||
| 184 | CRYPTO_cleanup_all_ex_data(); | ||
| 185 | ERR_remove_thread_state(NULL); | ||
| 186 | ERR_free_strings(); | ||
| 187 | CRYPTO_mem_leaks(bio_err); | ||
| 188 | |||
| 189 | return 0; | ||
| 190 | } | ||
| 191 | |||
| 192 | #endif | ||
diff --git a/src/lib/libcrypto/krb5/Makefile b/src/lib/libcrypto/krb5/Makefile new file mode 100644 index 0000000000..14077390d6 --- /dev/null +++ b/src/lib/libcrypto/krb5/Makefile | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/krb5/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= krb5 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile README | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= krb5_asn.c | ||
| 21 | |||
| 22 | LIBOBJ= krb5_asn.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | EXHEADER= krb5_asn.h | ||
| 27 | HEADER= $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | |||
| 73 | clean: | ||
| 74 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 75 | |||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 77 | |||
| 78 | krb5_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 79 | krb5_asn.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 80 | krb5_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/krb5_asn.h | ||
| 81 | krb5_asn.o: ../../include/openssl/opensslconf.h | ||
| 82 | krb5_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 83 | krb5_asn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 84 | krb5_asn.o: ../../include/openssl/symhacks.h krb5_asn.c | ||
diff --git a/src/lib/libcrypto/lhash/Makefile b/src/lib/libcrypto/lhash/Makefile new file mode 100644 index 0000000000..82bddac474 --- /dev/null +++ b/src/lib/libcrypto/lhash/Makefile | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/lhash/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= lhash | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=lhash.c lh_stats.c | ||
| 21 | LIBOBJ=lhash.o lh_stats.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= lhash.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | lh_stats.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 78 | lh_stats.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 79 | lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 80 | lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 81 | lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 82 | lh_stats.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 83 | lh_stats.o: ../../include/openssl/symhacks.h ../cryptlib.h lh_stats.c | ||
| 84 | lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 85 | lhash.o: ../../include/openssl/e_os2.h ../../include/openssl/lhash.h | ||
| 86 | lhash.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 87 | lhash.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 88 | lhash.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h lhash.c | ||
diff --git a/src/lib/libcrypto/lhash/lh_test.c b/src/lib/libcrypto/lhash/lh_test.c new file mode 100644 index 0000000000..85700c859b --- /dev/null +++ b/src/lib/libcrypto/lhash/lh_test.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* crypto/lhash/lh_test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <openssl/lhash.h> | ||
| 63 | |||
| 64 | main() | ||
| 65 | { | ||
| 66 | LHASH *conf; | ||
| 67 | char buf[256]; | ||
| 68 | int i; | ||
| 69 | |||
| 70 | conf=lh_new(lh_strhash,strcmp); | ||
| 71 | for (;;) | ||
| 72 | { | ||
| 73 | char *p; | ||
| 74 | |||
| 75 | buf[0]='\0'; | ||
| 76 | fgets(buf,256,stdin); | ||
| 77 | if (buf[0] == '\0') break; | ||
| 78 | i=strlen(buf); | ||
| 79 | p=OPENSSL_malloc(i+1); | ||
| 80 | memcpy(p,buf,i+1); | ||
| 81 | lh_insert(conf,p); | ||
| 82 | } | ||
| 83 | |||
| 84 | lh_node_stats(conf,stdout); | ||
| 85 | lh_stats(conf,stdout); | ||
| 86 | lh_node_usage_stats(conf,stdout); | ||
| 87 | exit(0); | ||
| 88 | } | ||
diff --git a/src/lib/libcrypto/lhash/num.pl b/src/lib/libcrypto/lhash/num.pl new file mode 100644 index 0000000000..30fedf9cd5 --- /dev/null +++ b/src/lib/libcrypto/lhash/num.pl | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | #node 10 -> 4 | ||
| 4 | |||
| 5 | while (<>) | ||
| 6 | { | ||
| 7 | next unless /^node/; | ||
| 8 | chop; | ||
| 9 | @a=split; | ||
| 10 | $num{$a[3]}++; | ||
| 11 | } | ||
| 12 | |||
| 13 | @a=sort {$a <=> $b } keys %num; | ||
| 14 | foreach (0 .. $a[$#a]) | ||
| 15 | { | ||
| 16 | printf "%4d:%4d\n",$_,$num{$_}; | ||
| 17 | } | ||
diff --git a/src/lib/libcrypto/md2/Makefile b/src/lib/libcrypto/md2/Makefile new file mode 100644 index 0000000000..17f878aeb7 --- /dev/null +++ b/src/lib/libcrypto/md2/Makefile | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/md/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= md2 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=md2test.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=md2_dgst.c md2_one.c | ||
| 21 | LIBOBJ=md2_dgst.o md2_one.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= md2.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | md2_dgst.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 78 | md2_dgst.o: ../../include/openssl/md2.h ../../include/openssl/opensslconf.h | ||
| 79 | md2_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 80 | md2_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 81 | md2_dgst.o: ../../include/openssl/symhacks.h md2_dgst.c | ||
| 82 | md2_one.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 83 | md2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 84 | md2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 85 | md2_one.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 86 | md2_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 87 | md2_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 88 | md2_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 89 | md2_one.o: ../cryptlib.h md2_one.c | ||
diff --git a/src/lib/libcrypto/md2/md2.c b/src/lib/libcrypto/md2/md2.c new file mode 100644 index 0000000000..f4d6f62264 --- /dev/null +++ b/src/lib/libcrypto/md2/md2.c | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | /* crypto/md2/md2.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/md2.h> | ||
| 62 | |||
| 63 | #define BUFSIZE 1024*16 | ||
| 64 | |||
| 65 | void do_fp(FILE *f); | ||
| 66 | void pt(unsigned char *md); | ||
| 67 | int read(int, void *, unsigned int); | ||
| 68 | void exit(int); | ||
| 69 | int main(int argc, char *argv[]) | ||
| 70 | { | ||
| 71 | int i,err=0; | ||
| 72 | FILE *IN; | ||
| 73 | |||
| 74 | if (argc == 1) | ||
| 75 | { | ||
| 76 | do_fp(stdin); | ||
| 77 | } | ||
| 78 | else | ||
| 79 | { | ||
| 80 | for (i=1; i<argc; i++) | ||
| 81 | { | ||
| 82 | IN=fopen(argv[i],"r"); | ||
| 83 | if (IN == NULL) | ||
| 84 | { | ||
| 85 | perror(argv[i]); | ||
| 86 | err++; | ||
| 87 | continue; | ||
| 88 | } | ||
| 89 | printf("MD2(%s)= ",argv[i]); | ||
| 90 | do_fp(IN); | ||
| 91 | fclose(IN); | ||
| 92 | } | ||
| 93 | } | ||
| 94 | exit(err); | ||
| 95 | return(err); | ||
| 96 | } | ||
| 97 | |||
| 98 | void do_fp(FILE *f) | ||
| 99 | { | ||
| 100 | MD2_CTX c; | ||
| 101 | unsigned char md[MD2_DIGEST_LENGTH]; | ||
| 102 | int fd,i; | ||
| 103 | static unsigned char buf[BUFSIZE]; | ||
| 104 | |||
| 105 | fd=fileno(f); | ||
| 106 | MD2_Init(&c); | ||
| 107 | for (;;) | ||
| 108 | { | ||
| 109 | i=read(fd,buf,BUFSIZE); | ||
| 110 | if (i <= 0) break; | ||
| 111 | MD2_Update(&c,buf,(unsigned long)i); | ||
| 112 | } | ||
| 113 | MD2_Final(&(md[0]),&c); | ||
| 114 | pt(md); | ||
| 115 | } | ||
| 116 | |||
| 117 | void pt(unsigned char *md) | ||
| 118 | { | ||
| 119 | int i; | ||
| 120 | |||
| 121 | for (i=0; i<MD2_DIGEST_LENGTH; i++) | ||
| 122 | printf("%02x",md[i]); | ||
| 123 | printf("\n"); | ||
| 124 | } | ||
diff --git a/src/lib/libcrypto/md2/md2.h b/src/lib/libcrypto/md2/md2.h new file mode 100644 index 0000000000..a46120e7d4 --- /dev/null +++ b/src/lib/libcrypto/md2/md2.h | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /* crypto/md/md2.h */ | ||
| 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_MD2_H | ||
| 60 | #define HEADER_MD2_H | ||
| 61 | |||
| 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */ | ||
| 63 | #ifdef OPENSSL_NO_MD2 | ||
| 64 | #error MD2 is disabled. | ||
| 65 | #endif | ||
| 66 | #include <stddef.h> | ||
| 67 | |||
| 68 | #define MD2_DIGEST_LENGTH 16 | ||
| 69 | #define MD2_BLOCK 16 | ||
| 70 | |||
| 71 | #ifdef __cplusplus | ||
| 72 | extern "C" { | ||
| 73 | #endif | ||
| 74 | |||
| 75 | typedef struct MD2state_st | ||
| 76 | { | ||
| 77 | unsigned int num; | ||
| 78 | unsigned char data[MD2_BLOCK]; | ||
| 79 | MD2_INT cksm[MD2_BLOCK]; | ||
| 80 | MD2_INT state[MD2_BLOCK]; | ||
| 81 | } MD2_CTX; | ||
| 82 | |||
| 83 | const char *MD2_options(void); | ||
| 84 | int MD2_Init(MD2_CTX *c); | ||
| 85 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); | ||
| 86 | int MD2_Final(unsigned char *md, MD2_CTX *c); | ||
| 87 | unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md); | ||
| 88 | #ifdef __cplusplus | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #endif | ||
diff --git a/src/lib/libcrypto/md2/md2_dgst.c b/src/lib/libcrypto/md2/md2_dgst.c new file mode 100644 index 0000000000..c57b3da288 --- /dev/null +++ b/src/lib/libcrypto/md2/md2_dgst.c | |||
| @@ -0,0 +1,227 @@ | |||
| 1 | /* crypto/md2/md2_dgst.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <openssl/md2.h> | ||
| 63 | #include <openssl/opensslv.h> | ||
| 64 | #include <openssl/crypto.h> | ||
| 65 | |||
| 66 | const char MD2_version[]="MD2" OPENSSL_VERSION_PTEXT; | ||
| 67 | |||
| 68 | /* Implemented from RFC1319 The MD2 Message-Digest Algorithm | ||
| 69 | */ | ||
| 70 | |||
| 71 | #define UCHAR unsigned char | ||
| 72 | |||
| 73 | static void md2_block(MD2_CTX *c, const unsigned char *d); | ||
| 74 | /* The magic S table - I have converted it to hex since it is | ||
| 75 | * basically just a random byte string. */ | ||
| 76 | static const MD2_INT S[256]={ | ||
| 77 | 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, | ||
| 78 | 0x3D, 0x36, 0x54, 0xA1, 0xEC, 0xF0, 0x06, 0x13, | ||
| 79 | 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, | ||
| 80 | 0x98, 0x93, 0x2B, 0xD9, 0xBC, 0x4C, 0x82, 0xCA, | ||
| 81 | 0x1E, 0x9B, 0x57, 0x3C, 0xFD, 0xD4, 0xE0, 0x16, | ||
| 82 | 0x67, 0x42, 0x6F, 0x18, 0x8A, 0x17, 0xE5, 0x12, | ||
| 83 | 0xBE, 0x4E, 0xC4, 0xD6, 0xDA, 0x9E, 0xDE, 0x49, | ||
| 84 | 0xA0, 0xFB, 0xF5, 0x8E, 0xBB, 0x2F, 0xEE, 0x7A, | ||
| 85 | 0xA9, 0x68, 0x79, 0x91, 0x15, 0xB2, 0x07, 0x3F, | ||
| 86 | 0x94, 0xC2, 0x10, 0x89, 0x0B, 0x22, 0x5F, 0x21, | ||
| 87 | 0x80, 0x7F, 0x5D, 0x9A, 0x5A, 0x90, 0x32, 0x27, | ||
| 88 | 0x35, 0x3E, 0xCC, 0xE7, 0xBF, 0xF7, 0x97, 0x03, | ||
| 89 | 0xFF, 0x19, 0x30, 0xB3, 0x48, 0xA5, 0xB5, 0xD1, | ||
| 90 | 0xD7, 0x5E, 0x92, 0x2A, 0xAC, 0x56, 0xAA, 0xC6, | ||
| 91 | 0x4F, 0xB8, 0x38, 0xD2, 0x96, 0xA4, 0x7D, 0xB6, | ||
| 92 | 0x76, 0xFC, 0x6B, 0xE2, 0x9C, 0x74, 0x04, 0xF1, | ||
| 93 | 0x45, 0x9D, 0x70, 0x59, 0x64, 0x71, 0x87, 0x20, | ||
| 94 | 0x86, 0x5B, 0xCF, 0x65, 0xE6, 0x2D, 0xA8, 0x02, | ||
| 95 | 0x1B, 0x60, 0x25, 0xAD, 0xAE, 0xB0, 0xB9, 0xF6, | ||
| 96 | 0x1C, 0x46, 0x61, 0x69, 0x34, 0x40, 0x7E, 0x0F, | ||
| 97 | 0x55, 0x47, 0xA3, 0x23, 0xDD, 0x51, 0xAF, 0x3A, | ||
| 98 | 0xC3, 0x5C, 0xF9, 0xCE, 0xBA, 0xC5, 0xEA, 0x26, | ||
| 99 | 0x2C, 0x53, 0x0D, 0x6E, 0x85, 0x28, 0x84, 0x09, | ||
| 100 | 0xD3, 0xDF, 0xCD, 0xF4, 0x41, 0x81, 0x4D, 0x52, | ||
| 101 | 0x6A, 0xDC, 0x37, 0xC8, 0x6C, 0xC1, 0xAB, 0xFA, | ||
| 102 | 0x24, 0xE1, 0x7B, 0x08, 0x0C, 0xBD, 0xB1, 0x4A, | ||
| 103 | 0x78, 0x88, 0x95, 0x8B, 0xE3, 0x63, 0xE8, 0x6D, | ||
| 104 | 0xE9, 0xCB, 0xD5, 0xFE, 0x3B, 0x00, 0x1D, 0x39, | ||
| 105 | 0xF2, 0xEF, 0xB7, 0x0E, 0x66, 0x58, 0xD0, 0xE4, | ||
| 106 | 0xA6, 0x77, 0x72, 0xF8, 0xEB, 0x75, 0x4B, 0x0A, | ||
| 107 | 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, | ||
| 108 | 0xDB, 0x99, 0x8D, 0x33, 0x9F, 0x11, 0x83, 0x14, | ||
| 109 | }; | ||
| 110 | |||
| 111 | const char *MD2_options(void) | ||
| 112 | { | ||
| 113 | if (sizeof(MD2_INT) == 1) | ||
| 114 | return("md2(char)"); | ||
| 115 | else | ||
| 116 | return("md2(int)"); | ||
| 117 | } | ||
| 118 | |||
| 119 | int MD2_Init(MD2_CTX *c) | ||
| 120 | { | ||
| 121 | c->num=0; | ||
| 122 | memset(c->state,0,sizeof c->state); | ||
| 123 | memset(c->cksm,0,sizeof c->cksm); | ||
| 124 | memset(c->data,0,sizeof c->data); | ||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len) | ||
| 129 | { | ||
| 130 | register UCHAR *p; | ||
| 131 | |||
| 132 | if (len == 0) return 1; | ||
| 133 | |||
| 134 | p=c->data; | ||
| 135 | if (c->num != 0) | ||
| 136 | { | ||
| 137 | if ((c->num+len) >= MD2_BLOCK) | ||
| 138 | { | ||
| 139 | memcpy(&(p[c->num]),data,MD2_BLOCK-c->num); | ||
| 140 | md2_block(c,c->data); | ||
| 141 | data+=(MD2_BLOCK - c->num); | ||
| 142 | len-=(MD2_BLOCK - c->num); | ||
| 143 | c->num=0; | ||
| 144 | /* drop through and do the rest */ | ||
| 145 | } | ||
| 146 | else | ||
| 147 | { | ||
| 148 | memcpy(&(p[c->num]),data,len); | ||
| 149 | /* data+=len; */ | ||
| 150 | c->num+=(int)len; | ||
| 151 | return 1; | ||
| 152 | } | ||
| 153 | } | ||
| 154 | /* we now can process the input data in blocks of MD2_BLOCK | ||
| 155 | * chars and save the leftovers to c->data. */ | ||
| 156 | while (len >= MD2_BLOCK) | ||
| 157 | { | ||
| 158 | md2_block(c,data); | ||
| 159 | data+=MD2_BLOCK; | ||
| 160 | len-=MD2_BLOCK; | ||
| 161 | } | ||
| 162 | memcpy(p,data,len); | ||
| 163 | c->num=(int)len; | ||
| 164 | return 1; | ||
| 165 | } | ||
| 166 | |||
| 167 | static void md2_block(MD2_CTX *c, const unsigned char *d) | ||
| 168 | { | ||
| 169 | register MD2_INT t,*sp1,*sp2; | ||
| 170 | register int i,j; | ||
| 171 | MD2_INT state[48]; | ||
| 172 | |||
| 173 | sp1=c->state; | ||
| 174 | sp2=c->cksm; | ||
| 175 | j=sp2[MD2_BLOCK-1]; | ||
| 176 | for (i=0; i<16; i++) | ||
| 177 | { | ||
| 178 | state[i]=sp1[i]; | ||
| 179 | state[i+16]=t=d[i]; | ||
| 180 | state[i+32]=(t^sp1[i]); | ||
| 181 | j=sp2[i]^=S[t^j]; | ||
| 182 | } | ||
| 183 | t=0; | ||
| 184 | for (i=0; i<18; i++) | ||
| 185 | { | ||
| 186 | for (j=0; j<48; j+=8) | ||
| 187 | { | ||
| 188 | t= state[j+ 0]^=S[t]; | ||
| 189 | t= state[j+ 1]^=S[t]; | ||
| 190 | t= state[j+ 2]^=S[t]; | ||
| 191 | t= state[j+ 3]^=S[t]; | ||
| 192 | t= state[j+ 4]^=S[t]; | ||
| 193 | t= state[j+ 5]^=S[t]; | ||
| 194 | t= state[j+ 6]^=S[t]; | ||
| 195 | t= state[j+ 7]^=S[t]; | ||
| 196 | } | ||
| 197 | t=(t+i)&0xff; | ||
| 198 | } | ||
| 199 | memcpy(sp1,state,16*sizeof(MD2_INT)); | ||
| 200 | OPENSSL_cleanse(state,48*sizeof(MD2_INT)); | ||
| 201 | } | ||
| 202 | |||
| 203 | int MD2_Final(unsigned char *md, MD2_CTX *c) | ||
| 204 | { | ||
| 205 | int i,v; | ||
| 206 | register UCHAR *cp; | ||
| 207 | register MD2_INT *p1,*p2; | ||
| 208 | |||
| 209 | cp=c->data; | ||
| 210 | p1=c->state; | ||
| 211 | p2=c->cksm; | ||
| 212 | v=MD2_BLOCK-c->num; | ||
| 213 | for (i=c->num; i<MD2_BLOCK; i++) | ||
| 214 | cp[i]=(UCHAR)v; | ||
| 215 | |||
| 216 | md2_block(c,cp); | ||
| 217 | |||
| 218 | for (i=0; i<MD2_BLOCK; i++) | ||
| 219 | cp[i]=(UCHAR)p2[i]; | ||
| 220 | md2_block(c,cp); | ||
| 221 | |||
| 222 | for (i=0; i<16; i++) | ||
| 223 | md[i]=(UCHAR)(p1[i]&0xff); | ||
| 224 | memset((char *)&c,0,sizeof(c)); | ||
| 225 | return 1; | ||
| 226 | } | ||
| 227 | |||
diff --git a/src/lib/libcrypto/md2/md2_one.c b/src/lib/libcrypto/md2/md2_one.c new file mode 100644 index 0000000000..f7fef5cc0a --- /dev/null +++ b/src/lib/libcrypto/md2/md2_one.c | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* crypto/md2/md2_one.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/md2.h> | ||
| 62 | |||
| 63 | /* This is a separate file so that #defines in cryptlib.h can | ||
| 64 | * map my MD functions to different names */ | ||
| 65 | |||
| 66 | unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md) | ||
| 67 | { | ||
| 68 | MD2_CTX c; | ||
| 69 | static unsigned char m[MD2_DIGEST_LENGTH]; | ||
| 70 | |||
| 71 | if (md == NULL) md=m; | ||
| 72 | if (!MD2_Init(&c)) | ||
| 73 | return NULL; | ||
| 74 | #ifndef CHARSET_EBCDIC | ||
| 75 | MD2_Update(&c,d,n); | ||
| 76 | #else | ||
| 77 | { | ||
| 78 | char temp[1024]; | ||
| 79 | unsigned long chunk; | ||
| 80 | |||
| 81 | while (n > 0) | ||
| 82 | { | ||
| 83 | chunk = (n > sizeof(temp)) ? sizeof(temp) : n; | ||
| 84 | ebcdic2ascii(temp, d, chunk); | ||
| 85 | MD2_Update(&c,temp,chunk); | ||
| 86 | n -= chunk; | ||
| 87 | d += chunk; | ||
| 88 | } | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | MD2_Final(md,&c); | ||
| 92 | OPENSSL_cleanse(&c,sizeof(c)); /* Security consideration */ | ||
| 93 | return(md); | ||
| 94 | } | ||
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c new file mode 100644 index 0000000000..db5f5bc6d2 --- /dev/null +++ b/src/lib/libcrypto/md2/md2test.c | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | /* crypto/md2/md2test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_MD2 | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No MD2 support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/evp.h> | ||
| 73 | #include <openssl/md2.h> | ||
| 74 | |||
| 75 | #ifdef CHARSET_EBCDIC | ||
| 76 | #include <openssl/ebcdic.h> | ||
| 77 | #endif | ||
| 78 | |||
| 79 | static char *test[]={ | ||
| 80 | "", | ||
| 81 | "a", | ||
| 82 | "abc", | ||
| 83 | "message digest", | ||
| 84 | "abcdefghijklmnopqrstuvwxyz", | ||
| 85 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", | ||
| 86 | "12345678901234567890123456789012345678901234567890123456789012345678901234567890", | ||
| 87 | NULL, | ||
| 88 | }; | ||
| 89 | |||
| 90 | static char *ret[]={ | ||
| 91 | "8350e5a3e24c153df2275c9f80692773", | ||
| 92 | "32ec01ec4a6dac72c0ab96fb34c0b5d1", | ||
| 93 | "da853b0d3f88d99b30283a69e6ded6bb", | ||
| 94 | "ab4f496bfb2a530b219ff33031fe06b0", | ||
| 95 | "4e8ddff3650292ab5a4108c3aa47940b", | ||
| 96 | "da33def2a42df13975352846c30338cd", | ||
| 97 | "d5976f79d83d3a0dc9806c3c66f3efd8", | ||
| 98 | }; | ||
| 99 | |||
| 100 | static char *pt(unsigned char *md); | ||
| 101 | int main(int argc, char *argv[]) | ||
| 102 | { | ||
| 103 | int i,err=0; | ||
| 104 | char **P,**R; | ||
| 105 | char *p; | ||
| 106 | unsigned char md[MD2_DIGEST_LENGTH]; | ||
| 107 | |||
| 108 | P=test; | ||
| 109 | R=ret; | ||
| 110 | i=1; | ||
| 111 | while (*P != NULL) | ||
| 112 | { | ||
| 113 | EVP_Digest((unsigned char *)*P,strlen(*P),md,NULL,EVP_md2(), NULL); | ||
| 114 | p=pt(md); | ||
| 115 | if (strcmp(p,*R) != 0) | ||
| 116 | { | ||
| 117 | printf("error calculating MD2 on '%s'\n",*P); | ||
| 118 | printf("got %s instead of %s\n",p,*R); | ||
| 119 | err++; | ||
| 120 | } | ||
| 121 | else | ||
| 122 | printf("test %d ok\n",i); | ||
| 123 | i++; | ||
| 124 | R++; | ||
| 125 | P++; | ||
| 126 | } | ||
| 127 | #ifdef OPENSSL_SYS_NETWARE | ||
| 128 | if (err) printf("ERROR: %d\n", err); | ||
| 129 | #endif | ||
| 130 | EXIT(err); | ||
| 131 | return err; | ||
| 132 | } | ||
| 133 | |||
| 134 | static char *pt(unsigned char *md) | ||
| 135 | { | ||
| 136 | int i; | ||
| 137 | static char buf[80]; | ||
| 138 | |||
| 139 | for (i=0; i<MD2_DIGEST_LENGTH; i++) | ||
| 140 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 141 | return(buf); | ||
| 142 | } | ||
| 143 | #endif | ||
diff --git a/src/lib/libcrypto/md32_common.h b/src/lib/libcrypto/md32_common.h index bb7381952a..1cb783944e 100644 --- a/src/lib/libcrypto/md32_common.h +++ b/src/lib/libcrypto/md32_common.h | |||
| @@ -165,7 +165,7 @@ | |||
| 165 | asm ( \ | 165 | asm ( \ |
| 166 | "roll %1,%0" \ | 166 | "roll %1,%0" \ |
| 167 | : "=r"(ret) \ | 167 | : "=r"(ret) \ |
| 168 | : "I"(n), "0"((unsigned int)(a)) \ | 168 | : "I"(n), "0"(a) \ |
| 169 | : "cc"); \ | 169 | : "cc"); \ |
| 170 | ret; \ | 170 | ret; \ |
| 171 | }) | 171 | }) |
| @@ -383,7 +383,6 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c) | |||
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | #ifndef MD32_REG_T | 385 | #ifndef MD32_REG_T |
| 386 | #if defined(__alpha) || defined(__sparcv9) || defined(__mips) | ||
| 387 | #define MD32_REG_T long | 386 | #define MD32_REG_T long |
| 388 | /* | 387 | /* |
| 389 | * This comment was originaly written for MD5, which is why it | 388 | * This comment was originaly written for MD5, which is why it |
| @@ -401,15 +400,9 @@ int HASH_FINAL (unsigned char *md, HASH_CTX *c) | |||
| 401 | * Well, to be honest it should say that this *prevents* | 400 | * Well, to be honest it should say that this *prevents* |
| 402 | * performance degradation. | 401 | * performance degradation. |
| 403 | * <appro@fy.chalmers.se> | 402 | * <appro@fy.chalmers.se> |
| 404 | */ | 403 | * Apparently there're LP64 compilers that generate better |
| 405 | #else | 404 | * code if A-D are declared int. Most notably GCC-x86_64 |
| 406 | /* | 405 | * generates better code. |
| 407 | * Above is not absolute and there are LP64 compilers that | ||
| 408 | * generate better code if MD32_REG_T is defined int. The above | ||
| 409 | * pre-processor condition reflects the circumstances under which | ||
| 410 | * the conclusion was made and is subject to further extension. | ||
| 411 | * <appro@fy.chalmers.se> | 406 | * <appro@fy.chalmers.se> |
| 412 | */ | 407 | */ |
| 413 | #define MD32_REG_T int | ||
| 414 | #endif | ||
| 415 | #endif | 408 | #endif |
diff --git a/src/lib/libcrypto/md4/Makefile b/src/lib/libcrypto/md4/Makefile new file mode 100644 index 0000000000..c94a1398ed --- /dev/null +++ b/src/lib/libcrypto/md4/Makefile | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/md4/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= md4 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 15 | |||
| 16 | GENERAL=Makefile | ||
| 17 | TEST=md4test.c | ||
| 18 | APPS=md4.c | ||
| 19 | |||
| 20 | LIB=$(TOP)/libcrypto.a | ||
| 21 | LIBSRC=md4_dgst.c md4_one.c | ||
| 22 | LIBOBJ=md4_dgst.o md4_one.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | EXHEADER= md4.h | ||
| 27 | HEADER= md4_locl.h $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | rm -f ../../include/openssl/$(EXHEADER) ../../test/$(TEST) ../../apps/$(APPS) | ||
| 73 | |||
| 74 | clean: | ||
| 75 | rm -f asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 76 | |||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 78 | |||
| 79 | md4_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md4.h | ||
| 80 | md4_dgst.o: ../../include/openssl/opensslconf.h | ||
| 81 | md4_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md4_dgst.c | ||
| 82 | md4_dgst.o: md4_locl.h | ||
| 83 | md4_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 84 | md4_one.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h | ||
| 85 | md4_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 86 | md4_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 87 | md4_one.o: ../../include/openssl/symhacks.h md4_one.c | ||
diff --git a/src/lib/libcrypto/md4/md4.c b/src/lib/libcrypto/md4/md4.c new file mode 100644 index 0000000000..141415ad4d --- /dev/null +++ b/src/lib/libcrypto/md4/md4.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* crypto/md4/md4.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/md4.h> | ||
| 62 | |||
| 63 | #define BUFSIZE 1024*16 | ||
| 64 | |||
| 65 | void do_fp(FILE *f); | ||
| 66 | void pt(unsigned char *md); | ||
| 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) | ||
| 68 | int read(int, void *, unsigned int); | ||
| 69 | #endif | ||
| 70 | |||
| 71 | int main(int argc, char **argv) | ||
| 72 | { | ||
| 73 | int i,err=0; | ||
| 74 | FILE *IN; | ||
| 75 | |||
| 76 | if (argc == 1) | ||
| 77 | { | ||
| 78 | do_fp(stdin); | ||
| 79 | } | ||
| 80 | else | ||
| 81 | { | ||
| 82 | for (i=1; i<argc; i++) | ||
| 83 | { | ||
| 84 | IN=fopen(argv[i],"r"); | ||
| 85 | if (IN == NULL) | ||
| 86 | { | ||
| 87 | perror(argv[i]); | ||
| 88 | err++; | ||
| 89 | continue; | ||
| 90 | } | ||
| 91 | printf("MD4(%s)= ",argv[i]); | ||
| 92 | do_fp(IN); | ||
| 93 | fclose(IN); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | exit(err); | ||
| 97 | } | ||
| 98 | |||
| 99 | void do_fp(FILE *f) | ||
| 100 | { | ||
| 101 | MD4_CTX c; | ||
| 102 | unsigned char md[MD4_DIGEST_LENGTH]; | ||
| 103 | int fd; | ||
| 104 | int i; | ||
| 105 | static unsigned char buf[BUFSIZE]; | ||
| 106 | |||
| 107 | fd=fileno(f); | ||
| 108 | MD4_Init(&c); | ||
| 109 | for (;;) | ||
| 110 | { | ||
| 111 | i=read(fd,buf,sizeof buf); | ||
| 112 | if (i <= 0) break; | ||
| 113 | MD4_Update(&c,buf,(unsigned long)i); | ||
| 114 | } | ||
| 115 | MD4_Final(&(md[0]),&c); | ||
| 116 | pt(md); | ||
| 117 | } | ||
| 118 | |||
| 119 | void pt(unsigned char *md) | ||
| 120 | { | ||
| 121 | int i; | ||
| 122 | |||
| 123 | for (i=0; i<MD4_DIGEST_LENGTH; i++) | ||
| 124 | printf("%02x",md[i]); | ||
| 125 | printf("\n"); | ||
| 126 | } | ||
| 127 | |||
diff --git a/src/lib/libcrypto/md4/md4s.cpp b/src/lib/libcrypto/md4/md4s.cpp new file mode 100644 index 0000000000..c0ec97fc9f --- /dev/null +++ b/src/lib/libcrypto/md4/md4s.cpp | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/md4.h> | ||
| 36 | |||
| 37 | extern "C" { | ||
| 38 | void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num); | ||
| 39 | } | ||
| 40 | |||
| 41 | void main(int argc,char *argv[]) | ||
| 42 | { | ||
| 43 | unsigned char buffer[64*256]; | ||
| 44 | MD4_CTX ctx; | ||
| 45 | unsigned long s1,s2,e1,e2; | ||
| 46 | unsigned char k[16]; | ||
| 47 | unsigned long data[2]; | ||
| 48 | unsigned char iv[8]; | ||
| 49 | int i,num=0,numm; | ||
| 50 | int j=0; | ||
| 51 | |||
| 52 | if (argc >= 2) | ||
| 53 | num=atoi(argv[1]); | ||
| 54 | |||
| 55 | if (num == 0) num=16; | ||
| 56 | if (num > 250) num=16; | ||
| 57 | numm=num+2; | ||
| 58 | num*=64; | ||
| 59 | numm*=64; | ||
| 60 | |||
| 61 | for (j=0; j<6; j++) | ||
| 62 | { | ||
| 63 | for (i=0; i<10; i++) /**/ | ||
| 64 | { | ||
| 65 | md4_block_x86(&ctx,buffer,numm); | ||
| 66 | GetTSC(s1); | ||
| 67 | md4_block_x86(&ctx,buffer,numm); | ||
| 68 | GetTSC(e1); | ||
| 69 | GetTSC(s2); | ||
| 70 | md4_block_x86(&ctx,buffer,num); | ||
| 71 | GetTSC(e2); | ||
| 72 | md4_block_x86(&ctx,buffer,num); | ||
| 73 | } | ||
| 74 | printf("md4 (%d bytes) %d %d (%.2f)\n",num, | ||
| 75 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
diff --git a/src/lib/libcrypto/md4/md4test.c b/src/lib/libcrypto/md4/md4test.c new file mode 100644 index 0000000000..56591728a1 --- /dev/null +++ b/src/lib/libcrypto/md4/md4test.c | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | /* crypto/md4/md4test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_MD4 | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No MD4 support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/evp.h> | ||
| 73 | #include <openssl/md4.h> | ||
| 74 | |||
| 75 | static char *test[]={ | ||
| 76 | "", | ||
| 77 | "a", | ||
| 78 | "abc", | ||
| 79 | "message digest", | ||
| 80 | "abcdefghijklmnopqrstuvwxyz", | ||
| 81 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", | ||
| 82 | "12345678901234567890123456789012345678901234567890123456789012345678901234567890", | ||
| 83 | NULL, | ||
| 84 | }; | ||
| 85 | |||
| 86 | static char *ret[]={ | ||
| 87 | "31d6cfe0d16ae931b73c59d7e0c089c0", | ||
| 88 | "bde52cb31de33e46245e05fbdbd6fb24", | ||
| 89 | "a448017aaf21d8525fc10ae87aa6729d", | ||
| 90 | "d9130a8164549fe818874806e1c7014b", | ||
| 91 | "d79e1c308aa5bbcdeea8ed63df412da9", | ||
| 92 | "043f8582f241db351ce627e153e7f0e4", | ||
| 93 | "e33b4ddc9c38f2199c3e7b164fcc0536", | ||
| 94 | }; | ||
| 95 | |||
| 96 | static char *pt(unsigned char *md); | ||
| 97 | int main(int argc, char *argv[]) | ||
| 98 | { | ||
| 99 | int i,err=0; | ||
| 100 | char **P,**R; | ||
| 101 | char *p; | ||
| 102 | unsigned char md[MD4_DIGEST_LENGTH]; | ||
| 103 | |||
| 104 | P=test; | ||
| 105 | R=ret; | ||
| 106 | i=1; | ||
| 107 | while (*P != NULL) | ||
| 108 | { | ||
| 109 | EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md4(), NULL); | ||
| 110 | p=pt(md); | ||
| 111 | if (strcmp(p,(char *)*R) != 0) | ||
| 112 | { | ||
| 113 | printf("error calculating MD4 on '%s'\n",*P); | ||
| 114 | printf("got %s instead of %s\n",p,*R); | ||
| 115 | err++; | ||
| 116 | } | ||
| 117 | else | ||
| 118 | printf("test %d ok\n",i); | ||
| 119 | i++; | ||
| 120 | R++; | ||
| 121 | P++; | ||
| 122 | } | ||
| 123 | EXIT(err); | ||
| 124 | return(0); | ||
| 125 | } | ||
| 126 | |||
| 127 | static char *pt(unsigned char *md) | ||
| 128 | { | ||
| 129 | int i; | ||
| 130 | static char buf[80]; | ||
| 131 | |||
| 132 | for (i=0; i<MD4_DIGEST_LENGTH; i++) | ||
| 133 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 134 | return(buf); | ||
| 135 | } | ||
| 136 | #endif | ||
diff --git a/src/lib/libcrypto/md5/Makefile b/src/lib/libcrypto/md5/Makefile new file mode 100644 index 0000000000..9858d53d31 --- /dev/null +++ b/src/lib/libcrypto/md5/Makefile | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/md5/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= md5 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES=-I.. -I$(TOP) -I../../include | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | MD5_ASM_OBJ= | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=md5test.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=md5_dgst.c md5_one.c | ||
| 26 | LIBOBJ=md5_dgst.o md5_one.o $(MD5_ASM_OBJ) | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= md5.h | ||
| 31 | HEADER= md5_locl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | md5-586.s: asm/md5-586.pl ../perlasm/x86asm.pl | ||
| 46 | $(PERL) asm/md5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ | ||
| 47 | |||
| 48 | md5-x86_64.s: asm/md5-x86_64.pl | ||
| 49 | $(PERL) asm/md5-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 50 | |||
| 51 | md5-ia64.s: asm/md5-ia64.S | ||
| 52 | $(CC) $(CFLAGS) -E asm/md5-ia64.S | \ | ||
| 53 | $(PERL) -ne 's/;\s+/;\n/g; print;' > $@ | ||
| 54 | |||
| 55 | files: | ||
| 56 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 57 | |||
| 58 | links: | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 60 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 61 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 62 | |||
| 63 | install: | ||
| 64 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 65 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 66 | do \ | ||
| 67 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 68 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 69 | done; | ||
| 70 | |||
| 71 | tags: | ||
| 72 | ctags $(SRC) | ||
| 73 | |||
| 74 | tests: | ||
| 75 | |||
| 76 | lint: | ||
| 77 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 78 | |||
| 79 | depend: | ||
| 80 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 81 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 82 | |||
| 83 | dclean: | ||
| 84 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 85 | mv -f Makefile.new $(MAKEFILE) | ||
| 86 | |||
| 87 | clean: | ||
| 88 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 89 | |||
| 90 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 91 | |||
| 92 | md5_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/md5.h | ||
| 93 | md5_dgst.o: ../../include/openssl/opensslconf.h | ||
| 94 | md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c | ||
| 95 | md5_dgst.o: md5_locl.h | ||
| 96 | md5_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 97 | md5_one.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h | ||
| 98 | md5_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 99 | md5_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 100 | md5_one.o: ../../include/openssl/symhacks.h md5_one.c | ||
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c new file mode 100644 index 0000000000..563733abc5 --- /dev/null +++ b/src/lib/libcrypto/md5/md5.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* crypto/md5/md5.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/md5.h> | ||
| 62 | |||
| 63 | #define BUFSIZE 1024*16 | ||
| 64 | |||
| 65 | void do_fp(FILE *f); | ||
| 66 | void pt(unsigned char *md); | ||
| 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) | ||
| 68 | int read(int, void *, unsigned int); | ||
| 69 | #endif | ||
| 70 | |||
| 71 | int main(int argc, char **argv) | ||
| 72 | { | ||
| 73 | int i,err=0; | ||
| 74 | FILE *IN; | ||
| 75 | |||
| 76 | if (argc == 1) | ||
| 77 | { | ||
| 78 | do_fp(stdin); | ||
| 79 | } | ||
| 80 | else | ||
| 81 | { | ||
| 82 | for (i=1; i<argc; i++) | ||
| 83 | { | ||
| 84 | IN=fopen(argv[i],"r"); | ||
| 85 | if (IN == NULL) | ||
| 86 | { | ||
| 87 | perror(argv[i]); | ||
| 88 | err++; | ||
| 89 | continue; | ||
| 90 | } | ||
| 91 | printf("MD5(%s)= ",argv[i]); | ||
| 92 | do_fp(IN); | ||
| 93 | fclose(IN); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | exit(err); | ||
| 97 | } | ||
| 98 | |||
| 99 | void do_fp(FILE *f) | ||
| 100 | { | ||
| 101 | MD5_CTX c; | ||
| 102 | unsigned char md[MD5_DIGEST_LENGTH]; | ||
| 103 | int fd; | ||
| 104 | int i; | ||
| 105 | static unsigned char buf[BUFSIZE]; | ||
| 106 | |||
| 107 | fd=fileno(f); | ||
| 108 | MD5_Init(&c); | ||
| 109 | for (;;) | ||
| 110 | { | ||
| 111 | i=read(fd,buf,BUFSIZE); | ||
| 112 | if (i <= 0) break; | ||
| 113 | MD5_Update(&c,buf,(unsigned long)i); | ||
| 114 | } | ||
| 115 | MD5_Final(&(md[0]),&c); | ||
| 116 | pt(md); | ||
| 117 | } | ||
| 118 | |||
| 119 | void pt(unsigned char *md) | ||
| 120 | { | ||
| 121 | int i; | ||
| 122 | |||
| 123 | for (i=0; i<MD5_DIGEST_LENGTH; i++) | ||
| 124 | printf("%02x",md[i]); | ||
| 125 | printf("\n"); | ||
| 126 | } | ||
| 127 | |||
diff --git a/src/lib/libcrypto/md5/md5s.cpp b/src/lib/libcrypto/md5/md5s.cpp new file mode 100644 index 0000000000..dd343fd4e6 --- /dev/null +++ b/src/lib/libcrypto/md5/md5s.cpp | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/md5.h> | ||
| 36 | |||
| 37 | extern "C" { | ||
| 38 | void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num); | ||
| 39 | } | ||
| 40 | |||
| 41 | void main(int argc,char *argv[]) | ||
| 42 | { | ||
| 43 | unsigned char buffer[64*256]; | ||
| 44 | MD5_CTX ctx; | ||
| 45 | unsigned long s1,s2,e1,e2; | ||
| 46 | unsigned char k[16]; | ||
| 47 | unsigned long data[2]; | ||
| 48 | unsigned char iv[8]; | ||
| 49 | int i,num=0,numm; | ||
| 50 | int j=0; | ||
| 51 | |||
| 52 | if (argc >= 2) | ||
| 53 | num=atoi(argv[1]); | ||
| 54 | |||
| 55 | if (num == 0) num=16; | ||
| 56 | if (num > 250) num=16; | ||
| 57 | numm=num+2; | ||
| 58 | num*=64; | ||
| 59 | numm*=64; | ||
| 60 | |||
| 61 | for (j=0; j<6; j++) | ||
| 62 | { | ||
| 63 | for (i=0; i<10; i++) /**/ | ||
| 64 | { | ||
| 65 | md5_block_x86(&ctx,buffer,numm); | ||
| 66 | GetTSC(s1); | ||
| 67 | md5_block_x86(&ctx,buffer,numm); | ||
| 68 | GetTSC(e1); | ||
| 69 | GetTSC(s2); | ||
| 70 | md5_block_x86(&ctx,buffer,num); | ||
| 71 | GetTSC(e2); | ||
| 72 | md5_block_x86(&ctx,buffer,num); | ||
| 73 | } | ||
| 74 | printf("md5 (%d bytes) %d %d (%.2f)\n",num, | ||
| 75 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
diff --git a/src/lib/libcrypto/md5/md5test.c b/src/lib/libcrypto/md5/md5test.c new file mode 100644 index 0000000000..2b37190e32 --- /dev/null +++ b/src/lib/libcrypto/md5/md5test.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* crypto/md5/md5test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_MD5 | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No MD5 support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/evp.h> | ||
| 73 | #include <openssl/md5.h> | ||
| 74 | |||
| 75 | static char *test[]={ | ||
| 76 | "", | ||
| 77 | "a", | ||
| 78 | "abc", | ||
| 79 | "message digest", | ||
| 80 | "abcdefghijklmnopqrstuvwxyz", | ||
| 81 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", | ||
| 82 | "12345678901234567890123456789012345678901234567890123456789012345678901234567890", | ||
| 83 | NULL, | ||
| 84 | }; | ||
| 85 | |||
| 86 | static char *ret[]={ | ||
| 87 | "d41d8cd98f00b204e9800998ecf8427e", | ||
| 88 | "0cc175b9c0f1b6a831c399e269772661", | ||
| 89 | "900150983cd24fb0d6963f7d28e17f72", | ||
| 90 | "f96b697d7cb7938d525a2f31aaf161d0", | ||
| 91 | "c3fcd3d76192e4007dfb496cca67e13b", | ||
| 92 | "d174ab98d277d9f5a5611c2c9f419d9f", | ||
| 93 | "57edf4a22be3c955ac49da2e2107b67a", | ||
| 94 | }; | ||
| 95 | |||
| 96 | static char *pt(unsigned char *md); | ||
| 97 | int main(int argc, char *argv[]) | ||
| 98 | { | ||
| 99 | int i,err=0; | ||
| 100 | char **P,**R; | ||
| 101 | char *p; | ||
| 102 | unsigned char md[MD5_DIGEST_LENGTH]; | ||
| 103 | |||
| 104 | P=test; | ||
| 105 | R=ret; | ||
| 106 | i=1; | ||
| 107 | while (*P != NULL) | ||
| 108 | { | ||
| 109 | EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md5(), NULL); | ||
| 110 | p=pt(md); | ||
| 111 | if (strcmp(p,(char *)*R) != 0) | ||
| 112 | { | ||
| 113 | printf("error calculating MD5 on '%s'\n",*P); | ||
| 114 | printf("got %s instead of %s\n",p,*R); | ||
| 115 | err++; | ||
| 116 | } | ||
| 117 | else | ||
| 118 | printf("test %d ok\n",i); | ||
| 119 | i++; | ||
| 120 | R++; | ||
| 121 | P++; | ||
| 122 | } | ||
| 123 | |||
| 124 | #ifdef OPENSSL_SYS_NETWARE | ||
| 125 | if (err) printf("ERROR: %d\n", err); | ||
| 126 | #endif | ||
| 127 | EXIT(err); | ||
| 128 | return(0); | ||
| 129 | } | ||
| 130 | |||
| 131 | static char *pt(unsigned char *md) | ||
| 132 | { | ||
| 133 | int i; | ||
| 134 | static char buf[80]; | ||
| 135 | |||
| 136 | for (i=0; i<MD5_DIGEST_LENGTH; i++) | ||
| 137 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 138 | return(buf); | ||
| 139 | } | ||
| 140 | #endif | ||
diff --git a/src/lib/libcrypto/mdc2/Makefile b/src/lib/libcrypto/mdc2/Makefile new file mode 100644 index 0000000000..1d064f17a6 --- /dev/null +++ b/src/lib/libcrypto/mdc2/Makefile | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/mdc2/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= mdc2 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= mdc2test.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=mdc2dgst.c mdc2_one.c | ||
| 21 | LIBOBJ=mdc2dgst.o mdc2_one.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= mdc2.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | mdc2_one.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 78 | mdc2_one.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 79 | mdc2_one.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 80 | mdc2_one.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 81 | mdc2_one.o: ../../include/openssl/lhash.h ../../include/openssl/mdc2.h | ||
| 82 | mdc2_one.o: ../../include/openssl/opensslconf.h | ||
| 83 | mdc2_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 84 | mdc2_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 85 | mdc2_one.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 86 | mdc2_one.o: ../../include/openssl/ui_compat.h ../cryptlib.h mdc2_one.c | ||
| 87 | mdc2dgst.o: ../../include/openssl/des.h ../../include/openssl/des_old.h | ||
| 88 | mdc2dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/mdc2.h | ||
| 89 | mdc2dgst.o: ../../include/openssl/opensslconf.h | ||
| 90 | mdc2dgst.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 91 | mdc2dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 92 | mdc2dgst.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 93 | mdc2dgst.o: mdc2dgst.c | ||
diff --git a/src/lib/libcrypto/mdc2/mdc2.h b/src/lib/libcrypto/mdc2/mdc2.h new file mode 100644 index 0000000000..72778a5212 --- /dev/null +++ b/src/lib/libcrypto/mdc2/mdc2.h | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* crypto/mdc2/mdc2.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_MDC2_H | ||
| 60 | #define HEADER_MDC2_H | ||
| 61 | |||
| 62 | #include <openssl/des.h> | ||
| 63 | |||
| 64 | #ifdef __cplusplus | ||
| 65 | extern "C" { | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #ifdef OPENSSL_NO_MDC2 | ||
| 69 | #error MDC2 is disabled. | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #define MDC2_BLOCK 8 | ||
| 73 | #define MDC2_DIGEST_LENGTH 16 | ||
| 74 | |||
| 75 | typedef struct mdc2_ctx_st | ||
| 76 | { | ||
| 77 | unsigned int num; | ||
| 78 | unsigned char data[MDC2_BLOCK]; | ||
| 79 | DES_cblock h,hh; | ||
| 80 | int pad_type; /* either 1 or 2, default 1 */ | ||
| 81 | } MDC2_CTX; | ||
| 82 | |||
| 83 | |||
| 84 | int MDC2_Init(MDC2_CTX *c); | ||
| 85 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); | ||
| 86 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); | ||
| 87 | unsigned char *MDC2(const unsigned char *d, size_t n, | ||
| 88 | unsigned char *md); | ||
| 89 | |||
| 90 | #ifdef __cplusplus | ||
| 91 | } | ||
| 92 | #endif | ||
| 93 | |||
| 94 | #endif | ||
| 95 | |||
diff --git a/src/lib/libcrypto/mdc2/mdc2test.c b/src/lib/libcrypto/mdc2/mdc2test.c new file mode 100644 index 0000000000..017b31add2 --- /dev/null +++ b/src/lib/libcrypto/mdc2/mdc2test.c | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | /* crypto/mdc2/mdc2test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #if defined(OPENSSL_NO_DES) && !defined(OPENSSL_NO_MDC2) | ||
| 66 | #define OPENSSL_NO_MDC2 | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifdef OPENSSL_NO_MDC2 | ||
| 70 | int main(int argc, char *argv[]) | ||
| 71 | { | ||
| 72 | printf("No MDC2 support\n"); | ||
| 73 | return(0); | ||
| 74 | } | ||
| 75 | #else | ||
| 76 | #include <openssl/evp.h> | ||
| 77 | #include <openssl/mdc2.h> | ||
| 78 | |||
| 79 | #ifdef CHARSET_EBCDIC | ||
| 80 | #include <openssl/ebcdic.h> | ||
| 81 | #endif | ||
| 82 | |||
| 83 | static unsigned char pad1[16]={ | ||
| 84 | 0x42,0xE5,0x0C,0xD2,0x24,0xBA,0xCE,0xBA, | ||
| 85 | 0x76,0x0B,0xDD,0x2B,0xD4,0x09,0x28,0x1A | ||
| 86 | }; | ||
| 87 | |||
| 88 | static unsigned char pad2[16]={ | ||
| 89 | 0x2E,0x46,0x79,0xB5,0xAD,0xD9,0xCA,0x75, | ||
| 90 | 0x35,0xD8,0x7A,0xFE,0xAB,0x33,0xBE,0xE2 | ||
| 91 | }; | ||
| 92 | |||
| 93 | int main(int argc, char *argv[]) | ||
| 94 | { | ||
| 95 | int ret=0; | ||
| 96 | unsigned char md[MDC2_DIGEST_LENGTH]; | ||
| 97 | int i; | ||
| 98 | EVP_MD_CTX c; | ||
| 99 | static char *text="Now is the time for all "; | ||
| 100 | |||
| 101 | #ifdef CHARSET_EBCDIC | ||
| 102 | ebcdic2ascii(text,text,strlen(text)); | ||
| 103 | #endif | ||
| 104 | |||
| 105 | EVP_MD_CTX_init(&c); | ||
| 106 | EVP_DigestInit_ex(&c,EVP_mdc2(), NULL); | ||
| 107 | EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text)); | ||
| 108 | EVP_DigestFinal_ex(&c,&(md[0]),NULL); | ||
| 109 | |||
| 110 | if (memcmp(md,pad1,MDC2_DIGEST_LENGTH) != 0) | ||
| 111 | { | ||
| 112 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
| 113 | printf("%02X",md[i]); | ||
| 114 | printf(" <- generated\n"); | ||
| 115 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
| 116 | printf("%02X",pad1[i]); | ||
| 117 | printf(" <- correct\n"); | ||
| 118 | ret=1; | ||
| 119 | } | ||
| 120 | else | ||
| 121 | printf("pad1 - ok\n"); | ||
| 122 | |||
| 123 | EVP_DigestInit_ex(&c,EVP_mdc2(), NULL); | ||
| 124 | /* FIXME: use a ctl function? */ | ||
| 125 | ((MDC2_CTX *)c.md_data)->pad_type=2; | ||
| 126 | EVP_DigestUpdate(&c,(unsigned char *)text,strlen(text)); | ||
| 127 | EVP_DigestFinal_ex(&c,&(md[0]),NULL); | ||
| 128 | |||
| 129 | if (memcmp(md,pad2,MDC2_DIGEST_LENGTH) != 0) | ||
| 130 | { | ||
| 131 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
| 132 | printf("%02X",md[i]); | ||
| 133 | printf(" <- generated\n"); | ||
| 134 | for (i=0; i<MDC2_DIGEST_LENGTH; i++) | ||
| 135 | printf("%02X",pad2[i]); | ||
| 136 | printf(" <- correct\n"); | ||
| 137 | ret=1; | ||
| 138 | } | ||
| 139 | else | ||
| 140 | printf("pad2 - ok\n"); | ||
| 141 | |||
| 142 | EVP_MD_CTX_cleanup(&c); | ||
| 143 | #ifdef OPENSSL_SYS_NETWARE | ||
| 144 | if (ret) printf("ERROR: %d\n", ret); | ||
| 145 | #endif | ||
| 146 | EXIT(ret); | ||
| 147 | return(ret); | ||
| 148 | } | ||
| 149 | #endif | ||
diff --git a/src/lib/libcrypto/mem.c b/src/lib/libcrypto/mem.c new file mode 100644 index 0000000000..8f06d190a1 --- /dev/null +++ b/src/lib/libcrypto/mem.c | |||
| @@ -0,0 +1,415 @@ | |||
| 1 | /* crypto/mem.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/crypto.h> | ||
| 62 | #include "cryptlib.h" | ||
| 63 | |||
| 64 | |||
| 65 | static int allow_customize = 1; /* we provide flexible functions for */ | ||
| 66 | static int allow_customize_debug = 1;/* exchanging memory-related functions at | ||
| 67 | * run-time, but this must be done | ||
| 68 | * before any blocks are actually | ||
| 69 | * allocated; or we'll run into huge | ||
| 70 | * problems when malloc/free pairs | ||
| 71 | * don't match etc. */ | ||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | /* the following pointers may be changed as long as 'allow_customize' is set */ | ||
| 76 | |||
| 77 | static void *(*malloc_func)(size_t) = malloc; | ||
| 78 | static void *default_malloc_ex(size_t num, const char *file, int line) | ||
| 79 | { return malloc_func(num); } | ||
| 80 | static void *(*malloc_ex_func)(size_t, const char *file, int line) | ||
| 81 | = default_malloc_ex; | ||
| 82 | |||
| 83 | static void *(*realloc_func)(void *, size_t)= realloc; | ||
| 84 | static void *default_realloc_ex(void *str, size_t num, | ||
| 85 | const char *file, int line) | ||
| 86 | { return realloc_func(str,num); } | ||
| 87 | static void *(*realloc_ex_func)(void *, size_t, const char *file, int line) | ||
| 88 | = default_realloc_ex; | ||
| 89 | |||
| 90 | static void (*free_func)(void *) = free; | ||
| 91 | |||
| 92 | static void *(*malloc_locked_func)(size_t) = malloc; | ||
| 93 | static void *default_malloc_locked_ex(size_t num, const char *file, int line) | ||
| 94 | { return malloc_locked_func(num); } | ||
| 95 | static void *(*malloc_locked_ex_func)(size_t, const char *file, int line) | ||
| 96 | = default_malloc_locked_ex; | ||
| 97 | |||
| 98 | static void (*free_locked_func)(void *) = free; | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | /* may be changed as long as 'allow_customize_debug' is set */ | ||
| 103 | /* XXX use correct function pointer types */ | ||
| 104 | #ifdef CRYPTO_MDEBUG | ||
| 105 | /* use default functions from mem_dbg.c */ | ||
| 106 | static void (*malloc_debug_func)(void *,int,const char *,int,int) | ||
| 107 | = CRYPTO_dbg_malloc; | ||
| 108 | static void (*realloc_debug_func)(void *,void *,int,const char *,int,int) | ||
| 109 | = CRYPTO_dbg_realloc; | ||
| 110 | static void (*free_debug_func)(void *,int) = CRYPTO_dbg_free; | ||
| 111 | static void (*set_debug_options_func)(long) = CRYPTO_dbg_set_options; | ||
| 112 | static long (*get_debug_options_func)(void) = CRYPTO_dbg_get_options; | ||
| 113 | #else | ||
| 114 | /* applications can use CRYPTO_malloc_debug_init() to select above case | ||
| 115 | * at run-time */ | ||
| 116 | static void (*malloc_debug_func)(void *,int,const char *,int,int) = NULL; | ||
| 117 | static void (*realloc_debug_func)(void *,void *,int,const char *,int,int) | ||
| 118 | = NULL; | ||
| 119 | static void (*free_debug_func)(void *,int) = NULL; | ||
| 120 | static void (*set_debug_options_func)(long) = NULL; | ||
| 121 | static long (*get_debug_options_func)(void) = NULL; | ||
| 122 | #endif | ||
| 123 | |||
| 124 | |||
| 125 | int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), | ||
| 126 | void (*f)(void *)) | ||
| 127 | { | ||
| 128 | if (!allow_customize) | ||
| 129 | return 0; | ||
| 130 | if ((m == 0) || (r == 0) || (f == 0)) | ||
| 131 | return 0; | ||
| 132 | malloc_func=m; malloc_ex_func=default_malloc_ex; | ||
| 133 | realloc_func=r; realloc_ex_func=default_realloc_ex; | ||
| 134 | free_func=f; | ||
| 135 | malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex; | ||
| 136 | free_locked_func=f; | ||
| 137 | return 1; | ||
| 138 | } | ||
| 139 | |||
| 140 | int CRYPTO_set_mem_ex_functions( | ||
| 141 | void *(*m)(size_t,const char *,int), | ||
| 142 | void *(*r)(void *, size_t,const char *,int), | ||
| 143 | void (*f)(void *)) | ||
| 144 | { | ||
| 145 | if (!allow_customize) | ||
| 146 | return 0; | ||
| 147 | if ((m == 0) || (r == 0) || (f == 0)) | ||
| 148 | return 0; | ||
| 149 | malloc_func=0; malloc_ex_func=m; | ||
| 150 | realloc_func=0; realloc_ex_func=r; | ||
| 151 | free_func=f; | ||
| 152 | malloc_locked_func=0; malloc_locked_ex_func=m; | ||
| 153 | free_locked_func=f; | ||
| 154 | return 1; | ||
| 155 | } | ||
| 156 | |||
| 157 | int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *)) | ||
| 158 | { | ||
| 159 | if (!allow_customize) | ||
| 160 | return 0; | ||
| 161 | if ((m == NULL) || (f == NULL)) | ||
| 162 | return 0; | ||
| 163 | malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex; | ||
| 164 | free_locked_func=f; | ||
| 165 | return 1; | ||
| 166 | } | ||
| 167 | |||
| 168 | int CRYPTO_set_locked_mem_ex_functions( | ||
| 169 | void *(*m)(size_t,const char *,int), | ||
| 170 | void (*f)(void *)) | ||
| 171 | { | ||
| 172 | if (!allow_customize) | ||
| 173 | return 0; | ||
| 174 | if ((m == NULL) || (f == NULL)) | ||
| 175 | return 0; | ||
| 176 | malloc_locked_func=0; malloc_locked_ex_func=m; | ||
| 177 | free_func=f; | ||
| 178 | return 1; | ||
| 179 | } | ||
| 180 | |||
| 181 | int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int), | ||
| 182 | void (*r)(void *,void *,int,const char *,int,int), | ||
| 183 | void (*f)(void *,int), | ||
| 184 | void (*so)(long), | ||
| 185 | long (*go)(void)) | ||
| 186 | { | ||
| 187 | if (!allow_customize_debug) | ||
| 188 | return 0; | ||
| 189 | malloc_debug_func=m; | ||
| 190 | realloc_debug_func=r; | ||
| 191 | free_debug_func=f; | ||
| 192 | set_debug_options_func=so; | ||
| 193 | get_debug_options_func=go; | ||
| 194 | return 1; | ||
| 195 | } | ||
| 196 | |||
| 197 | |||
| 198 | void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), | ||
| 199 | void (**f)(void *)) | ||
| 200 | { | ||
| 201 | if (m != NULL) *m = (malloc_ex_func == default_malloc_ex) ? | ||
| 202 | malloc_func : 0; | ||
| 203 | if (r != NULL) *r = (realloc_ex_func == default_realloc_ex) ? | ||
| 204 | realloc_func : 0; | ||
| 205 | if (f != NULL) *f=free_func; | ||
| 206 | } | ||
| 207 | |||
| 208 | void CRYPTO_get_mem_ex_functions( | ||
| 209 | void *(**m)(size_t,const char *,int), | ||
| 210 | void *(**r)(void *, size_t,const char *,int), | ||
| 211 | void (**f)(void *)) | ||
| 212 | { | ||
| 213 | if (m != NULL) *m = (malloc_ex_func != default_malloc_ex) ? | ||
| 214 | malloc_ex_func : 0; | ||
| 215 | if (r != NULL) *r = (realloc_ex_func != default_realloc_ex) ? | ||
| 216 | realloc_ex_func : 0; | ||
| 217 | if (f != NULL) *f=free_func; | ||
| 218 | } | ||
| 219 | |||
| 220 | void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)) | ||
| 221 | { | ||
| 222 | if (m != NULL) *m = (malloc_locked_ex_func == default_malloc_locked_ex) ? | ||
| 223 | malloc_locked_func : 0; | ||
| 224 | if (f != NULL) *f=free_locked_func; | ||
| 225 | } | ||
| 226 | |||
| 227 | void CRYPTO_get_locked_mem_ex_functions( | ||
| 228 | void *(**m)(size_t,const char *,int), | ||
| 229 | void (**f)(void *)) | ||
| 230 | { | ||
| 231 | if (m != NULL) *m = (malloc_locked_ex_func != default_malloc_locked_ex) ? | ||
| 232 | malloc_locked_ex_func : 0; | ||
| 233 | if (f != NULL) *f=free_locked_func; | ||
| 234 | } | ||
| 235 | |||
| 236 | void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int), | ||
| 237 | void (**r)(void *,void *,int,const char *,int,int), | ||
| 238 | void (**f)(void *,int), | ||
| 239 | void (**so)(long), | ||
| 240 | long (**go)(void)) | ||
| 241 | { | ||
| 242 | if (m != NULL) *m=malloc_debug_func; | ||
| 243 | if (r != NULL) *r=realloc_debug_func; | ||
| 244 | if (f != NULL) *f=free_debug_func; | ||
| 245 | if (so != NULL) *so=set_debug_options_func; | ||
| 246 | if (go != NULL) *go=get_debug_options_func; | ||
| 247 | } | ||
| 248 | |||
| 249 | |||
| 250 | void *CRYPTO_malloc_locked(int num, const char *file, int line) | ||
| 251 | { | ||
| 252 | void *ret = NULL; | ||
| 253 | |||
| 254 | if (num <= 0) return NULL; | ||
| 255 | |||
| 256 | allow_customize = 0; | ||
| 257 | if (malloc_debug_func != NULL) | ||
| 258 | { | ||
| 259 | allow_customize_debug = 0; | ||
| 260 | malloc_debug_func(NULL, num, file, line, 0); | ||
| 261 | } | ||
| 262 | ret = malloc_locked_ex_func(num,file,line); | ||
| 263 | #ifdef LEVITTE_DEBUG_MEM | ||
| 264 | fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); | ||
| 265 | #endif | ||
| 266 | if (malloc_debug_func != NULL) | ||
| 267 | malloc_debug_func(ret, num, file, line, 1); | ||
| 268 | |||
| 269 | #ifndef OPENSSL_CPUID_OBJ | ||
| 270 | /* Create a dependency on the value of 'cleanse_ctr' so our memory | ||
| 271 | * sanitisation function can't be optimised out. NB: We only do | ||
| 272 | * this for >2Kb so the overhead doesn't bother us. */ | ||
| 273 | if(ret && (num > 2048)) | ||
| 274 | { extern unsigned char cleanse_ctr; | ||
| 275 | ((unsigned char *)ret)[0] = cleanse_ctr; | ||
| 276 | } | ||
| 277 | #endif | ||
| 278 | |||
| 279 | return ret; | ||
| 280 | } | ||
| 281 | |||
| 282 | void CRYPTO_free_locked(void *str) | ||
| 283 | { | ||
| 284 | if (free_debug_func != NULL) | ||
| 285 | free_debug_func(str, 0); | ||
| 286 | #ifdef LEVITTE_DEBUG_MEM | ||
| 287 | fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); | ||
| 288 | #endif | ||
| 289 | free_locked_func(str); | ||
| 290 | if (free_debug_func != NULL) | ||
| 291 | free_debug_func(NULL, 1); | ||
| 292 | } | ||
| 293 | |||
| 294 | void *CRYPTO_malloc(int num, const char *file, int line) | ||
| 295 | { | ||
| 296 | void *ret = NULL; | ||
| 297 | |||
| 298 | if (num <= 0) return NULL; | ||
| 299 | |||
| 300 | allow_customize = 0; | ||
| 301 | if (malloc_debug_func != NULL) | ||
| 302 | { | ||
| 303 | allow_customize_debug = 0; | ||
| 304 | malloc_debug_func(NULL, num, file, line, 0); | ||
| 305 | } | ||
| 306 | ret = malloc_ex_func(num,file,line); | ||
| 307 | #ifdef LEVITTE_DEBUG_MEM | ||
| 308 | fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); | ||
| 309 | #endif | ||
| 310 | if (malloc_debug_func != NULL) | ||
| 311 | malloc_debug_func(ret, num, file, line, 1); | ||
| 312 | |||
| 313 | #ifndef OPENSSL_CPUID_OBJ | ||
| 314 | /* Create a dependency on the value of 'cleanse_ctr' so our memory | ||
| 315 | * sanitisation function can't be optimised out. NB: We only do | ||
| 316 | * this for >2Kb so the overhead doesn't bother us. */ | ||
| 317 | if(ret && (num > 2048)) | ||
| 318 | { extern unsigned char cleanse_ctr; | ||
| 319 | ((unsigned char *)ret)[0] = cleanse_ctr; | ||
| 320 | } | ||
| 321 | #endif | ||
| 322 | |||
| 323 | return ret; | ||
| 324 | } | ||
| 325 | char *CRYPTO_strdup(const char *str, const char *file, int line) | ||
| 326 | { | ||
| 327 | size_t len = strlen(str)+1; | ||
| 328 | char *ret = CRYPTO_malloc(len, file, line); | ||
| 329 | |||
| 330 | memcpy(ret, str, len); | ||
| 331 | return ret; | ||
| 332 | } | ||
| 333 | |||
| 334 | void *CRYPTO_realloc(void *str, int num, const char *file, int line) | ||
| 335 | { | ||
| 336 | void *ret = NULL; | ||
| 337 | |||
| 338 | if (str == NULL) | ||
| 339 | return CRYPTO_malloc(num, file, line); | ||
| 340 | |||
| 341 | if (num <= 0) return NULL; | ||
| 342 | |||
| 343 | if (realloc_debug_func != NULL) | ||
| 344 | realloc_debug_func(str, NULL, num, file, line, 0); | ||
| 345 | ret = realloc_ex_func(str,num,file,line); | ||
| 346 | #ifdef LEVITTE_DEBUG_MEM | ||
| 347 | fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num); | ||
| 348 | #endif | ||
| 349 | if (realloc_debug_func != NULL) | ||
| 350 | realloc_debug_func(str, ret, num, file, line, 1); | ||
| 351 | |||
| 352 | return ret; | ||
| 353 | } | ||
| 354 | |||
| 355 | void *CRYPTO_realloc_clean(void *str, int old_len, int num, const char *file, | ||
| 356 | int line) | ||
| 357 | { | ||
| 358 | void *ret = NULL; | ||
| 359 | |||
| 360 | if (str == NULL) | ||
| 361 | return CRYPTO_malloc(num, file, line); | ||
| 362 | |||
| 363 | if (num <= 0) return NULL; | ||
| 364 | |||
| 365 | if (realloc_debug_func != NULL) | ||
| 366 | realloc_debug_func(str, NULL, num, file, line, 0); | ||
| 367 | ret=malloc_ex_func(num,file,line); | ||
| 368 | if(ret) | ||
| 369 | { | ||
| 370 | memcpy(ret,str,old_len); | ||
| 371 | OPENSSL_cleanse(str,old_len); | ||
| 372 | free_func(str); | ||
| 373 | } | ||
| 374 | #ifdef LEVITTE_DEBUG_MEM | ||
| 375 | fprintf(stderr, | ||
| 376 | "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", | ||
| 377 | str, ret, num); | ||
| 378 | #endif | ||
| 379 | if (realloc_debug_func != NULL) | ||
| 380 | realloc_debug_func(str, ret, num, file, line, 1); | ||
| 381 | |||
| 382 | return ret; | ||
| 383 | } | ||
| 384 | |||
| 385 | void CRYPTO_free(void *str) | ||
| 386 | { | ||
| 387 | if (free_debug_func != NULL) | ||
| 388 | free_debug_func(str, 0); | ||
| 389 | #ifdef LEVITTE_DEBUG_MEM | ||
| 390 | fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); | ||
| 391 | #endif | ||
| 392 | free_func(str); | ||
| 393 | if (free_debug_func != NULL) | ||
| 394 | free_debug_func(NULL, 1); | ||
| 395 | } | ||
| 396 | |||
| 397 | void *CRYPTO_remalloc(void *a, int num, const char *file, int line) | ||
| 398 | { | ||
| 399 | if (a != NULL) OPENSSL_free(a); | ||
| 400 | a=(char *)OPENSSL_malloc(num); | ||
| 401 | return(a); | ||
| 402 | } | ||
| 403 | |||
| 404 | void CRYPTO_set_mem_debug_options(long bits) | ||
| 405 | { | ||
| 406 | if (set_debug_options_func != NULL) | ||
| 407 | set_debug_options_func(bits); | ||
| 408 | } | ||
| 409 | |||
| 410 | long CRYPTO_get_mem_debug_options(void) | ||
| 411 | { | ||
| 412 | if (get_debug_options_func != NULL) | ||
| 413 | return get_debug_options_func(); | ||
| 414 | return 0; | ||
| 415 | } | ||
diff --git a/src/lib/libcrypto/modes/Makefile b/src/lib/libcrypto/modes/Makefile new file mode 100644 index 0000000000..6c85861b6c --- /dev/null +++ b/src/lib/libcrypto/modes/Makefile | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/modes/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= modes | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= cbc128.c ctr128.c cts128.c cfb128.c ofb128.c | ||
| 21 | LIBOBJ= cbc128.o ctr128.o cts128.o cfb128.o ofb128.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | #EXHEADER= store.h str_compat.h | ||
| 26 | EXHEADER= modes.h | ||
| 27 | HEADER= $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | |||
| 73 | clean: | ||
| 74 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 75 | |||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 77 | |||
| 78 | cbc128.o: cbc128.c modes.h | ||
| 79 | cfb128.o: cfb128.c modes.h | ||
| 80 | ctr128.o: ctr128.c modes.h | ||
| 81 | cts128.o: cts128.c modes.h | ||
| 82 | ofb128.o: modes.h ofb128.c | ||
diff --git a/src/lib/libcrypto/o_dir.c b/src/lib/libcrypto/o_dir.c new file mode 100644 index 0000000000..42891ea459 --- /dev/null +++ b/src/lib/libcrypto/o_dir.c | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | /* crypto/o_dir.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2004. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <errno.h> | ||
| 60 | #include <e_os.h> | ||
| 61 | |||
| 62 | /* The routines really come from the Levitte Programming, so to make | ||
| 63 | life simple, let's just use the raw files and hack the symbols to | ||
| 64 | fit our namespace. */ | ||
| 65 | #define LP_DIR_CTX OPENSSL_DIR_CTX | ||
| 66 | #define LP_dir_context_st OPENSSL_dir_context_st | ||
| 67 | #define LP_find_file OPENSSL_DIR_read | ||
| 68 | #define LP_find_file_end OPENSSL_DIR_end | ||
| 69 | |||
| 70 | #include "o_dir.h" | ||
| 71 | |||
| 72 | #define LPDIR_H | ||
| 73 | #if defined OPENSSL_SYS_UNIX || defined DJGPP | ||
| 74 | #include "LPdir_unix.c" | ||
| 75 | #elif defined OPENSSL_SYS_VMS | ||
| 76 | #include "LPdir_vms.c" | ||
| 77 | #elif defined OPENSSL_SYS_WIN32 | ||
| 78 | #include "LPdir_win32.c" | ||
| 79 | #elif defined OPENSSL_SYS_WINCE | ||
| 80 | #include "LPdir_wince.c" | ||
| 81 | #else | ||
| 82 | #include "LPdir_nyi.c" | ||
| 83 | #endif | ||
diff --git a/src/lib/libcrypto/o_dir.h b/src/lib/libcrypto/o_dir.h new file mode 100644 index 0000000000..4b725c0312 --- /dev/null +++ b/src/lib/libcrypto/o_dir.h | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | /* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Copied from Richard Levitte's (richard@levitte.org) LP library. All | ||
| 3 | * symbol names have been changed, with permission from the author. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* $LP: LPlib/source/LPdir.h,v 1.1 2004/06/14 08:56:04 _cvs_levitte Exp $ */ | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer. | ||
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer in the | ||
| 18 | * documentation and/or other materials provided with the distribution. | ||
| 19 | * | ||
| 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 30 | * SUCH DAMAGE. | ||
| 31 | */ | ||
| 32 | |||
| 33 | |||
| 34 | #ifndef O_DIR_H | ||
| 35 | #define O_DIR_H | ||
| 36 | |||
| 37 | #ifdef __cplusplus | ||
| 38 | extern "C" { | ||
| 39 | #endif | ||
| 40 | |||
| 41 | typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX; | ||
| 42 | |||
| 43 | /* returns NULL on error or end-of-directory. | ||
| 44 | If it is end-of-directory, errno will be zero */ | ||
| 45 | const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory); | ||
| 46 | /* returns 1 on success, 0 on error */ | ||
| 47 | int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx); | ||
| 48 | |||
| 49 | #ifdef __cplusplus | ||
| 50 | } | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #endif /* LPDIR_H */ | ||
diff --git a/src/lib/libcrypto/o_dir_test.c b/src/lib/libcrypto/o_dir_test.c new file mode 100644 index 0000000000..3d75ecb005 --- /dev/null +++ b/src/lib/libcrypto/o_dir_test.c | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | /* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Copied from Richard Levitte's (richard@levitte.org) LP library. All | ||
| 3 | * symbol names have been changed, with permission from the author. | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* $LP: LPlib/test/test_dir.c,v 1.1 2004/06/16 22:59:47 _cvs_levitte Exp $ */ | ||
| 7 | /* | ||
| 8 | * Copyright (c) 2004, Richard Levitte <richard@levitte.org> | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer. | ||
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer in the | ||
| 18 | * documentation and/or other materials provided with the distribution. | ||
| 19 | * | ||
| 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 30 | * SUCH DAMAGE. | ||
| 31 | */ | ||
| 32 | |||
| 33 | #include <stddef.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <stdio.h> | ||
| 36 | #include <errno.h> | ||
| 37 | #include "e_os2.h" | ||
| 38 | #include "o_dir.h" | ||
| 39 | |||
| 40 | #if defined OPENSSL_SYS_UNIX || defined OPENSSL_SYS_WIN32 || defined OPENSSL_SYS_WINCE | ||
| 41 | #define CURRDIR "." | ||
| 42 | #elif defined OPENSSL_SYS_VMS | ||
| 43 | #define CURRDIR "SYS$DISK:[]" | ||
| 44 | #else | ||
| 45 | #error "No supported platform defined!" | ||
| 46 | #endif | ||
| 47 | |||
| 48 | int main() | ||
| 49 | { | ||
| 50 | OPENSSL_DIR_CTX *ctx = NULL; | ||
| 51 | const char *result; | ||
| 52 | |||
| 53 | while((result = OPENSSL_DIR_read(&ctx, CURRDIR)) != NULL) | ||
| 54 | { | ||
| 55 | printf("%s\n", result); | ||
| 56 | } | ||
| 57 | |||
| 58 | if (errno) | ||
| 59 | { | ||
| 60 | perror("test_dir"); | ||
| 61 | exit(1); | ||
| 62 | } | ||
| 63 | |||
| 64 | if (!OPENSSL_DIR_end(&ctx)) | ||
| 65 | { | ||
| 66 | perror("test_dir"); | ||
| 67 | exit(2); | ||
| 68 | } | ||
| 69 | exit(0); | ||
| 70 | } | ||
diff --git a/src/lib/libcrypto/o_str.h b/src/lib/libcrypto/o_str.h new file mode 100644 index 0000000000..dfc98494c6 --- /dev/null +++ b/src/lib/libcrypto/o_str.h | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | /* crypto/o_str.h -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2003. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_O_STR_H | ||
| 60 | #define HEADER_O_STR_H | ||
| 61 | |||
| 62 | #include <stddef.h> /* to get size_t */ | ||
| 63 | |||
| 64 | int OPENSSL_strcasecmp(const char *str1, const char *str2); | ||
| 65 | int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n); | ||
| 66 | int OPENSSL_memcmp(const void *p1,const void *p2,size_t n); | ||
| 67 | |||
| 68 | #endif | ||
diff --git a/src/lib/libcrypto/o_time.c b/src/lib/libcrypto/o_time.c index 9030fdef7a..eecbdd19f0 100644 --- a/src/lib/libcrypto/o_time.c +++ b/src/lib/libcrypto/o_time.c | |||
| @@ -64,18 +64,12 @@ | |||
| 64 | #include "o_time.h" | 64 | #include "o_time.h" |
| 65 | 65 | ||
| 66 | #ifdef OPENSSL_SYS_VMS | 66 | #ifdef OPENSSL_SYS_VMS |
| 67 | # if __CRTL_VER >= 70000000 && \ | 67 | # include <libdtdef.h> |
| 68 | (defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE) | 68 | # include <lib$routines.h> |
| 69 | # define VMS_GMTIME_OK | 69 | # include <lnmdef.h> |
| 70 | # endif | 70 | # include <starlet.h> |
| 71 | # ifndef VMS_GMTIME_OK | 71 | # include <descrip.h> |
| 72 | # include <libdtdef.h> | 72 | # include <stdlib.h> |
| 73 | # include <lib$routines.h> | ||
| 74 | # include <lnmdef.h> | ||
| 75 | # include <starlet.h> | ||
| 76 | # include <descrip.h> | ||
| 77 | # include <stdlib.h> | ||
| 78 | # endif /* ndef VMS_GMTIME_OK */ | ||
| 79 | #endif | 73 | #endif |
| 80 | 74 | ||
| 81 | struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | 75 | struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) |
| @@ -87,7 +81,7 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
| 87 | so we don't even look at the return value */ | 81 | so we don't even look at the return value */ |
| 88 | gmtime_r(timer,result); | 82 | gmtime_r(timer,result); |
| 89 | ts = result; | 83 | ts = result; |
| 90 | #elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK) | 84 | #elif !defined(OPENSSL_SYS_VMS) |
| 91 | ts = gmtime(timer); | 85 | ts = gmtime(timer); |
| 92 | if (ts == NULL) | 86 | if (ts == NULL) |
| 93 | return NULL; | 87 | return NULL; |
| @@ -95,7 +89,7 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result) | |||
| 95 | memcpy(result, ts, sizeof(struct tm)); | 89 | memcpy(result, ts, sizeof(struct tm)); |
| 96 | ts = result; | 90 | ts = result; |
| 97 | #endif | 91 | #endif |
| 98 | #if defined( OPENSSL_SYS_VMS) && !defined( VMS_GMTIME_OK) | 92 | #ifdef OPENSSL_SYS_VMS |
| 99 | if (ts == NULL) | 93 | if (ts == NULL) |
| 100 | { | 94 | { |
| 101 | static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL"); | 95 | static $DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL"); |
diff --git a/src/lib/libcrypto/objects/Makefile b/src/lib/libcrypto/objects/Makefile new file mode 100644 index 0000000000..a8aedbd422 --- /dev/null +++ b/src/lib/libcrypto/objects/Makefile | |||
| @@ -0,0 +1,130 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/objects/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= objects | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | PERL= perl | ||
| 13 | |||
| 14 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 15 | |||
| 16 | GENERAL=Makefile README | ||
| 17 | TEST= | ||
| 18 | APPS= | ||
| 19 | |||
| 20 | LIB=$(TOP)/libcrypto.a | ||
| 21 | LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c | ||
| 22 | LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | EXHEADER= objects.h obj_mac.h | ||
| 27 | HEADER= $(EXHEADER) obj_dat.h obj_xref.h | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: obj_dat.h obj_xref.h lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | obj_dat.h: obj_dat.pl obj_mac.h | ||
| 42 | $(PERL) obj_dat.pl obj_mac.h obj_dat.h | ||
| 43 | |||
| 44 | # objects.pl both reads and writes obj_mac.num | ||
| 45 | obj_mac.h: objects.pl objects.txt obj_mac.num | ||
| 46 | $(PERL) objects.pl objects.txt obj_mac.num obj_mac.h | ||
| 47 | @sleep 1; touch obj_mac.h; sleep 1 | ||
| 48 | |||
| 49 | obj_xref.h: objxref.pl obj_xref.txt obj_mac.num | ||
| 50 | $(PERL) objxref.pl obj_mac.num obj_xref.txt > obj_xref.h | ||
| 51 | @sleep 1; touch obj_xref.h; sleep 1 | ||
| 52 | |||
| 53 | files: | ||
| 54 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 55 | |||
| 56 | links: | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 60 | |||
| 61 | install: | ||
| 62 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 63 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 64 | do \ | ||
| 65 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 66 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 67 | done; | ||
| 68 | |||
| 69 | tags: | ||
| 70 | ctags $(SRC) | ||
| 71 | |||
| 72 | tests: | ||
| 73 | |||
| 74 | lint: | ||
| 75 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 76 | |||
| 77 | depend: | ||
| 78 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 79 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 80 | |||
| 81 | dclean: | ||
| 82 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 83 | mv -f Makefile.new $(MAKEFILE) | ||
| 84 | |||
| 85 | clean: | ||
| 86 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 87 | |||
| 88 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 89 | |||
| 90 | o_names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 91 | o_names.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 92 | o_names.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 93 | o_names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 94 | o_names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 95 | o_names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 96 | o_names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 97 | o_names.o: o_names.c | ||
| 98 | obj_dat.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 99 | obj_dat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 100 | obj_dat.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 101 | obj_dat.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 102 | obj_dat.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 103 | obj_dat.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 104 | obj_dat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 105 | obj_dat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 106 | obj_dat.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_dat.c obj_dat.h | ||
| 107 | obj_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 108 | obj_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 109 | obj_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 110 | obj_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 111 | obj_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 112 | obj_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 113 | obj_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 114 | obj_err.o: obj_err.c | ||
| 115 | obj_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 116 | obj_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 117 | obj_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 118 | obj_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 119 | obj_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 120 | obj_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 121 | obj_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 122 | obj_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 123 | obj_lib.o: ../cryptlib.h obj_lib.c | ||
| 124 | obj_xref.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 125 | obj_xref.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 126 | obj_xref.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 127 | obj_xref.o: ../../include/openssl/opensslconf.h | ||
| 128 | obj_xref.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 129 | obj_xref.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 130 | obj_xref.o: ../../include/openssl/symhacks.h obj_xref.c obj_xref.h | ||
diff --git a/src/lib/libcrypto/objects/objects.pl b/src/lib/libcrypto/objects/objects.pl index 15c00bbd52..d2bf659d88 100644 --- a/src/lib/libcrypto/objects/objects.pl +++ b/src/lib/libcrypto/objects/objects.pl | |||
| @@ -110,12 +110,13 @@ print STDERR "Added OID $Cname\n"; | |||
| 110 | } | 110 | } |
| 111 | close IN; | 111 | close IN; |
| 112 | 112 | ||
| 113 | open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; | 113 | #XXX don't modify input files |
| 114 | foreach (sort { $a <=> $b } keys %nidn) | 114 | #open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; |
| 115 | { | 115 | #foreach (sort { $a <=> $b } keys %nidn) |
| 116 | print NUMOUT $nidn{$_},"\t\t",$_,"\n"; | 116 | # { |
| 117 | } | 117 | # print NUMOUT $nidn{$_},"\t\t",$_,"\n"; |
| 118 | close NUMOUT; | 118 | # } |
| 119 | #close NUMOUT; | ||
| 119 | 120 | ||
| 120 | open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]"; | 121 | open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]"; |
| 121 | print OUT <<'EOF'; | 122 | print OUT <<'EOF'; |
diff --git a/src/lib/libcrypto/ocsp/Makefile b/src/lib/libcrypto/ocsp/Makefile new file mode 100644 index 0000000000..60c414cf4d --- /dev/null +++ b/src/lib/libcrypto/ocsp/Makefile | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/ocsp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ocsp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile README | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= ocsp_asn.c ocsp_ext.c ocsp_ht.c ocsp_lib.c ocsp_cl.c \ | ||
| 21 | ocsp_srv.c ocsp_prn.c ocsp_vfy.c ocsp_err.c | ||
| 22 | |||
| 23 | LIBOBJ= ocsp_asn.o ocsp_ext.o ocsp_ht.o ocsp_lib.o ocsp_cl.o \ | ||
| 24 | ocsp_srv.o ocsp_prn.o ocsp_vfy.o ocsp_err.o | ||
| 25 | |||
| 26 | SRC= $(LIBSRC) | ||
| 27 | |||
| 28 | EXHEADER= ocsp.h | ||
| 29 | HEADER= $(EXHEADER) | ||
| 30 | |||
| 31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 32 | |||
| 33 | top: | ||
| 34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 35 | |||
| 36 | all: lib | ||
| 37 | |||
| 38 | lib: $(LIBOBJ) | ||
| 39 | $(AR) $(LIB) $(LIBOBJ) | ||
| 40 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 41 | @touch lib | ||
| 42 | |||
| 43 | files: | ||
| 44 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 45 | |||
| 46 | links: | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 50 | |||
| 51 | install: | ||
| 52 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 53 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 54 | do \ | ||
| 55 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 56 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 57 | done; | ||
| 58 | |||
| 59 | tags: | ||
| 60 | ctags $(SRC) | ||
| 61 | |||
| 62 | tests: | ||
| 63 | |||
| 64 | lint: | ||
| 65 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 66 | |||
| 67 | depend: | ||
| 68 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 70 | |||
| 71 | dclean: | ||
| 72 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 73 | mv -f Makefile.new $(MAKEFILE) | ||
| 74 | |||
| 75 | clean: | ||
| 76 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 77 | |||
| 78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 79 | |||
| 80 | ocsp_asn.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 81 | ocsp_asn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 82 | ocsp_asn.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 83 | ocsp_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 84 | ocsp_asn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 85 | ocsp_asn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 86 | ocsp_asn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 87 | ocsp_asn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 88 | ocsp_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 89 | ocsp_asn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 90 | ocsp_asn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 91 | ocsp_asn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 92 | ocsp_asn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 93 | ocsp_asn.o: ocsp_asn.c | ||
| 94 | ocsp_cl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 95 | ocsp_cl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 96 | ocsp_cl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 97 | ocsp_cl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 98 | ocsp_cl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 99 | ocsp_cl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 100 | ocsp_cl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 101 | ocsp_cl.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 102 | ocsp_cl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 103 | ocsp_cl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 104 | ocsp_cl.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 105 | ocsp_cl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 106 | ocsp_cl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 107 | ocsp_cl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 108 | ocsp_cl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 109 | ocsp_cl.o: ../cryptlib.h ocsp_cl.c | ||
| 110 | ocsp_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 111 | ocsp_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 112 | ocsp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 113 | ocsp_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 114 | ocsp_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 115 | ocsp_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 116 | ocsp_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 117 | ocsp_err.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 118 | ocsp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 119 | ocsp_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 120 | ocsp_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 121 | ocsp_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 122 | ocsp_err.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 123 | ocsp_err.o: ocsp_err.c | ||
| 124 | ocsp_ext.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 125 | ocsp_ext.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 126 | ocsp_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 127 | ocsp_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 128 | ocsp_ext.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 129 | ocsp_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 130 | ocsp_ext.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 131 | ocsp_ext.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 132 | ocsp_ext.o: ../../include/openssl/opensslconf.h | ||
| 133 | ocsp_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 134 | ocsp_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 135 | ocsp_ext.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 136 | ocsp_ext.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 137 | ocsp_ext.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 138 | ocsp_ext.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_ext.c | ||
| 139 | ocsp_ht.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 140 | ocsp_ht.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 141 | ocsp_ht.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 142 | ocsp_ht.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 143 | ocsp_ht.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 144 | ocsp_ht.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 145 | ocsp_ht.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 146 | ocsp_ht.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 147 | ocsp_ht.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 148 | ocsp_ht.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 149 | ocsp_ht.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 150 | ocsp_ht.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 151 | ocsp_ht.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 152 | ocsp_ht.o: ../../include/openssl/x509v3.h ocsp_ht.c | ||
| 153 | ocsp_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 154 | ocsp_lib.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 155 | ocsp_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 156 | ocsp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 157 | ocsp_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 158 | ocsp_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 159 | ocsp_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 160 | ocsp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 161 | ocsp_lib.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 162 | ocsp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 163 | ocsp_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 164 | ocsp_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 165 | ocsp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 166 | ocsp_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 167 | ocsp_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 168 | ocsp_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_lib.c | ||
| 169 | ocsp_prn.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 170 | ocsp_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 171 | ocsp_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 172 | ocsp_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 173 | ocsp_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 174 | ocsp_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 175 | ocsp_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 176 | ocsp_prn.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 177 | ocsp_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 178 | ocsp_prn.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 179 | ocsp_prn.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 180 | ocsp_prn.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 181 | ocsp_prn.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 182 | ocsp_prn.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 183 | ocsp_prn.o: ocsp_prn.c | ||
| 184 | ocsp_srv.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 185 | ocsp_srv.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 186 | ocsp_srv.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 187 | ocsp_srv.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 188 | ocsp_srv.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 189 | ocsp_srv.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 190 | ocsp_srv.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 191 | ocsp_srv.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 192 | ocsp_srv.o: ../../include/openssl/opensslconf.h | ||
| 193 | ocsp_srv.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 194 | ocsp_srv.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 195 | ocsp_srv.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 196 | ocsp_srv.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 197 | ocsp_srv.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 198 | ocsp_srv.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 199 | ocsp_srv.o: ../../include/openssl/x509v3.h ../cryptlib.h ocsp_srv.c | ||
| 200 | ocsp_vfy.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 201 | ocsp_vfy.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 202 | ocsp_vfy.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 203 | ocsp_vfy.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 204 | ocsp_vfy.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 205 | ocsp_vfy.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 206 | ocsp_vfy.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 207 | ocsp_vfy.o: ../../include/openssl/ocsp.h ../../include/openssl/opensslconf.h | ||
| 208 | ocsp_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 209 | ocsp_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 210 | ocsp_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 211 | ocsp_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 212 | ocsp_vfy.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 213 | ocsp_vfy.o: ocsp_vfy.c | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index af5fc16691..12bbfcffd1 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
| @@ -397,12 +397,11 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx) | |||
| 397 | 397 | ||
| 398 | 398 | ||
| 399 | case OHS_ASN1_HEADER: | 399 | case OHS_ASN1_HEADER: |
| 400 | /* Now reading ASN1 header: can read at least 2 bytes which | 400 | /* Now reading ASN1 header: can read at least 6 bytes which |
| 401 | * is enough for ASN1 SEQUENCE header and either length field | 401 | * is more than enough for any valid ASN1 SEQUENCE header |
| 402 | * or at least the length of the length field. | ||
| 403 | */ | 402 | */ |
| 404 | n = BIO_get_mem_data(rctx->mem, &p); | 403 | n = BIO_get_mem_data(rctx->mem, &p); |
| 405 | if (n < 2) | 404 | if (n < 6) |
| 406 | goto next_io; | 405 | goto next_io; |
| 407 | 406 | ||
| 408 | /* Check it is an ASN1 SEQUENCE */ | 407 | /* Check it is an ASN1 SEQUENCE */ |
| @@ -415,11 +414,6 @@ int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx) | |||
| 415 | /* Check out length field */ | 414 | /* Check out length field */ |
| 416 | if (*p & 0x80) | 415 | if (*p & 0x80) |
| 417 | { | 416 | { |
| 418 | /* If MSB set on initial length octet we can now | ||
| 419 | * always read 6 octets: make sure we have them. | ||
| 420 | */ | ||
| 421 | if (n < 6) | ||
| 422 | goto next_io; | ||
| 423 | n = *p & 0x7F; | 417 | n = *p & 0x7F; |
| 424 | /* Not NDEF or excessive length */ | 418 | /* Not NDEF or excessive length */ |
| 425 | if (!n || (n > 4)) | 419 | if (!n || (n > 4)) |
diff --git a/src/lib/libcrypto/ocsp/ocsp_lib.c b/src/lib/libcrypto/ocsp/ocsp_lib.c index e92b86c060..36905d76cd 100644 --- a/src/lib/libcrypto/ocsp/ocsp_lib.c +++ b/src/lib/libcrypto/ocsp/ocsp_lib.c | |||
| @@ -170,14 +170,14 @@ int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pss | |||
| 170 | 170 | ||
| 171 | char *host, *port; | 171 | char *host, *port; |
| 172 | 172 | ||
| 173 | *phost = NULL; | ||
| 174 | *pport = NULL; | ||
| 175 | *ppath = NULL; | ||
| 176 | |||
| 177 | /* dup the buffer since we are going to mess with it */ | 173 | /* dup the buffer since we are going to mess with it */ |
| 178 | buf = BUF_strdup(url); | 174 | buf = BUF_strdup(url); |
| 179 | if (!buf) goto mem_err; | 175 | if (!buf) goto mem_err; |
| 180 | 176 | ||
| 177 | *phost = NULL; | ||
| 178 | *pport = NULL; | ||
| 179 | *ppath = NULL; | ||
| 180 | |||
| 181 | /* Check for initial colon */ | 181 | /* Check for initial colon */ |
| 182 | p = strchr(buf, ':'); | 182 | p = strchr(buf, ':'); |
| 183 | 183 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_prn.c b/src/lib/libcrypto/ocsp/ocsp_prn.c index 87608ff399..1695c9c4ad 100644 --- a/src/lib/libcrypto/ocsp/ocsp_prn.c +++ b/src/lib/libcrypto/ocsp/ocsp_prn.c | |||
| @@ -182,6 +182,7 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags) | |||
| 182 | { | 182 | { |
| 183 | int i, ret = 0; | 183 | int i, ret = 0; |
| 184 | long l; | 184 | long l; |
| 185 | unsigned char *p; | ||
| 185 | OCSP_CERTID *cid = NULL; | 186 | OCSP_CERTID *cid = NULL; |
| 186 | OCSP_BASICRESP *br = NULL; | 187 | OCSP_BASICRESP *br = NULL; |
| 187 | OCSP_RESPID *rid = NULL; | 188 | OCSP_RESPID *rid = NULL; |
| @@ -206,6 +207,7 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags) | |||
| 206 | return 1; | 207 | return 1; |
| 207 | } | 208 | } |
| 208 | 209 | ||
| 210 | p = ASN1_STRING_data(rb->response); | ||
| 209 | i = ASN1_STRING_length(rb->response); | 211 | i = ASN1_STRING_length(rb->response); |
| 210 | if (!(br = OCSP_response_get1_basic(o))) goto err; | 212 | if (!(br = OCSP_response_get1_basic(o))) goto err; |
| 211 | rd = br->tbsResponseData; | 213 | rd = br->tbsResponseData; |
diff --git a/src/lib/libcrypto/opensslconf.h.in b/src/lib/libcrypto/opensslconf.h.in new file mode 100644 index 0000000000..97e3745563 --- /dev/null +++ b/src/lib/libcrypto/opensslconf.h.in | |||
| @@ -0,0 +1,154 @@ | |||
| 1 | /* crypto/opensslconf.h.in */ | ||
| 2 | |||
| 3 | /* Generate 80386 code? */ | ||
| 4 | #undef I386_ONLY | ||
| 5 | |||
| 6 | #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ | ||
| 7 | #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) | ||
| 8 | #define ENGINESDIR "/usr/local/lib/engines" | ||
| 9 | #define OPENSSLDIR "/usr/local/ssl" | ||
| 10 | #endif | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #undef OPENSSL_UNISTD | ||
| 14 | #define OPENSSL_UNISTD <unistd.h> | ||
| 15 | |||
| 16 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
| 17 | |||
| 18 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
| 19 | #define IDEA_INT unsigned int | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
| 23 | #define MD2_INT unsigned int | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
| 27 | /* I need to put in a mod for the alpha - eay */ | ||
| 28 | #define RC2_INT unsigned int | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #if defined(HEADER_RC4_H) | ||
| 32 | #if !defined(RC4_INT) | ||
| 33 | /* using int types make the structure larger but make the code faster | ||
| 34 | * on most boxes I have tested - up to %20 faster. */ | ||
| 35 | /* | ||
| 36 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
| 37 | * - Intel P6 because partial register stalls are very expensive; | ||
| 38 | * - elder Alpha because it lacks byte load/store instructions; | ||
| 39 | */ | ||
| 40 | #define RC4_INT unsigned int | ||
| 41 | #endif | ||
| 42 | #if !defined(RC4_CHUNK) | ||
| 43 | /* | ||
| 44 | * This enables code handling data aligned at natural CPU word | ||
| 45 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
| 46 | */ | ||
| 47 | #undef RC4_CHUNK | ||
| 48 | #endif | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
| 52 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
| 53 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
| 54 | #ifndef DES_LONG | ||
| 55 | #define DES_LONG unsigned long | ||
| 56 | #endif | ||
| 57 | #endif | ||
| 58 | |||
| 59 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
| 60 | #define CONFIG_HEADER_BN_H | ||
| 61 | #undef BN_LLONG | ||
| 62 | |||
| 63 | /* Should we define BN_DIV2W here? */ | ||
| 64 | |||
| 65 | /* Only one for the following should be defined */ | ||
| 66 | #undef SIXTY_FOUR_BIT_LONG | ||
| 67 | #undef SIXTY_FOUR_BIT | ||
| 68 | #define THIRTY_TWO_BIT | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) | ||
| 72 | #define CONFIG_HEADER_RC4_LOCL_H | ||
| 73 | /* if this is defined data[i] is used instead of *data, this is a %20 | ||
| 74 | * speedup on x86 */ | ||
| 75 | #undef RC4_INDEX | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
| 79 | #define CONFIG_HEADER_BF_LOCL_H | ||
| 80 | #undef BF_PTR | ||
| 81 | #endif /* HEADER_BF_LOCL_H */ | ||
| 82 | |||
| 83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
| 84 | #define CONFIG_HEADER_DES_LOCL_H | ||
| 85 | #ifndef DES_DEFAULT_OPTIONS | ||
| 86 | /* the following is tweaked from a config script, that is why it is a | ||
| 87 | * protected undef/define */ | ||
| 88 | #ifndef DES_PTR | ||
| 89 | #undef DES_PTR | ||
| 90 | #endif | ||
| 91 | |||
| 92 | /* This helps C compiler generate the correct code for multiple functional | ||
| 93 | * units. It reduces register dependancies at the expense of 2 more | ||
| 94 | * registers */ | ||
| 95 | #ifndef DES_RISC1 | ||
| 96 | #undef DES_RISC1 | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #ifndef DES_RISC2 | ||
| 100 | #undef DES_RISC2 | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
| 104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
| 105 | #endif | ||
| 106 | |||
| 107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
| 108 | * Very mucy CPU dependant */ | ||
| 109 | #ifndef DES_UNROLL | ||
| 110 | #undef DES_UNROLL | ||
| 111 | #endif | ||
| 112 | |||
| 113 | /* These default values were supplied by | ||
| 114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
| 115 | * They are only used if nothing else has been defined */ | ||
| 116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
| 117 | /* Special defines which change the way the code is built depending on the | ||
| 118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
| 119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
| 120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
| 121 | there's no way to tell at compile time what it is you're running on */ | ||
| 122 | |||
| 123 | #if defined( sun ) /* Newer Sparc's */ | ||
| 124 | # define DES_PTR | ||
| 125 | # define DES_RISC1 | ||
| 126 | # define DES_UNROLL | ||
| 127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
| 128 | # define DES_PTR | ||
| 129 | # define DES_RISC2 | ||
| 130 | # define DES_UNROLL | ||
| 131 | #elif defined( __osf1__ ) /* Alpha */ | ||
| 132 | # define DES_PTR | ||
| 133 | # define DES_RISC2 | ||
| 134 | #elif defined ( _AIX ) /* RS6000 */ | ||
| 135 | /* Unknown */ | ||
| 136 | #elif defined( __hpux ) /* HP-PA */ | ||
| 137 | /* Unknown */ | ||
| 138 | #elif defined( __aux ) /* 68K */ | ||
| 139 | /* Unknown */ | ||
| 140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
| 141 | # define DES_UNROLL | ||
| 142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
| 143 | # define DES_PTR | ||
| 144 | # define DES_RISC2 | ||
| 145 | # define DES_UNROLL | ||
| 146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
| 147 | # define DES_PTR | ||
| 148 | # define DES_RISC1 | ||
| 149 | # define DES_UNROLL | ||
| 150 | #endif /* Systems-specific speed defines */ | ||
| 151 | #endif | ||
| 152 | |||
| 153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
| 154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/opensslv.h b/src/lib/libcrypto/opensslv.h index 310a3387be..2fb110fa0e 100644 --- a/src/lib/libcrypto/opensslv.h +++ b/src/lib/libcrypto/opensslv.h | |||
| @@ -25,11 +25,11 @@ | |||
| 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for | 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for |
| 26 | * major minor fix final patch/beta) | 26 | * major minor fix final patch/beta) |
| 27 | */ | 27 | */ |
| 28 | #define OPENSSL_VERSION_NUMBER 0x1000005fL | 28 | #define OPENSSL_VERSION_NUMBER 0x1000001fL |
| 29 | #ifdef OPENSSL_FIPS | 29 | #ifdef OPENSSL_FIPS |
| 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0e-fips 6 Sep 2011" | 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0a-fips 1 Jun 2010" |
| 31 | #else | 31 | #else |
| 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0e 6 Sep 2011" | 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.0a 1 Jun 2010" |
| 33 | #endif | 33 | #endif |
| 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT | 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT |
| 35 | 35 | ||
diff --git a/src/lib/libcrypto/pem/Makefile b/src/lib/libcrypto/pem/Makefile new file mode 100644 index 0000000000..2cc7801529 --- /dev/null +++ b/src/lib/libcrypto/pem/Makefile | |||
| @@ -0,0 +1,258 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/pem/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pem | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= pem_sign.c pem_seal.c pem_info.c pem_lib.c pem_all.c pem_err.c \ | ||
| 21 | pem_x509.c pem_xaux.c pem_oth.c pem_pk8.c pem_pkey.c pvkfmt.c | ||
| 22 | |||
| 23 | LIBOBJ= pem_sign.o pem_seal.o pem_info.o pem_lib.o pem_all.o pem_err.o \ | ||
| 24 | pem_x509.o pem_xaux.o pem_oth.o pem_pk8.o pem_pkey.o pvkfmt.o | ||
| 25 | |||
| 26 | SRC= $(LIBSRC) | ||
| 27 | |||
| 28 | EXHEADER= pem.h pem2.h | ||
| 29 | HEADER= $(EXHEADER) | ||
| 30 | |||
| 31 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 32 | |||
| 33 | top: | ||
| 34 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 35 | |||
| 36 | all: lib | ||
| 37 | |||
| 38 | lib: $(LIBOBJ) | ||
| 39 | $(AR) $(LIB) $(LIBOBJ) | ||
| 40 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 41 | @touch lib | ||
| 42 | |||
| 43 | files: | ||
| 44 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 45 | |||
| 46 | links: $(EXHEADER) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 50 | |||
| 51 | install: | ||
| 52 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 53 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 54 | do \ | ||
| 55 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 56 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 57 | done; | ||
| 58 | |||
| 59 | tags: | ||
| 60 | ctags $(SRC) | ||
| 61 | |||
| 62 | tests: | ||
| 63 | |||
| 64 | lint: | ||
| 65 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 66 | |||
| 67 | depend: | ||
| 68 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 69 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 70 | |||
| 71 | dclean: | ||
| 72 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 73 | mv -f Makefile.new $(MAKEFILE) | ||
| 74 | |||
| 75 | clean: | ||
| 76 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 77 | |||
| 78 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 79 | |||
| 80 | pem_all.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 81 | pem_all.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 82 | pem_all.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 83 | pem_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 84 | pem_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 85 | pem_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 86 | pem_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 87 | pem_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 88 | pem_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 89 | pem_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 90 | pem_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 91 | pem_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 92 | pem_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 93 | pem_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 94 | pem_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_all.c | ||
| 95 | pem_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 96 | pem_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 97 | pem_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 98 | pem_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 99 | pem_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 100 | pem_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 101 | pem_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 102 | pem_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 103 | pem_err.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 104 | pem_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 105 | pem_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 106 | pem_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 107 | pem_err.o: ../../include/openssl/x509_vfy.h pem_err.c | ||
| 108 | pem_info.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 109 | pem_info.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 110 | pem_info.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 111 | pem_info.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 112 | pem_info.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 113 | pem_info.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 114 | pem_info.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 115 | pem_info.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 116 | pem_info.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 117 | pem_info.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 118 | pem_info.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 119 | pem_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 120 | pem_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 121 | pem_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 122 | pem_info.o: ../cryptlib.h pem_info.c | ||
| 123 | pem_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 124 | pem_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 125 | pem_lib.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 126 | pem_lib.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h | ||
| 127 | pem_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 128 | pem_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 129 | pem_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 130 | pem_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 131 | pem_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 132 | pem_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 133 | pem_lib.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 134 | pem_lib.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 135 | pem_lib.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 136 | pem_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 137 | pem_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 138 | pem_lib.o: ../../include/openssl/ui_compat.h ../../include/openssl/x509.h | ||
| 139 | pem_lib.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 140 | pem_lib.o: pem_lib.c | ||
| 141 | pem_oth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 142 | pem_oth.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 143 | pem_oth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 144 | pem_oth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 145 | pem_oth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 146 | pem_oth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 147 | pem_oth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 148 | pem_oth.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 149 | pem_oth.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 150 | pem_oth.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 151 | pem_oth.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 152 | pem_oth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 153 | pem_oth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 154 | pem_oth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_oth.c | ||
| 155 | pem_pk8.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 156 | pem_pk8.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 157 | pem_pk8.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 158 | pem_pk8.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 159 | pem_pk8.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 160 | pem_pk8.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 161 | pem_pk8.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 162 | pem_pk8.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 163 | pem_pk8.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 164 | pem_pk8.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h | ||
| 165 | pem_pk8.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 166 | pem_pk8.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 167 | pem_pk8.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 168 | pem_pk8.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 169 | pem_pk8.o: ../cryptlib.h pem_pk8.c | ||
| 170 | pem_pkey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 171 | pem_pkey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 172 | pem_pkey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 173 | pem_pkey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 174 | pem_pkey.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 175 | pem_pkey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 176 | pem_pkey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 177 | pem_pkey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 178 | pem_pkey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 179 | pem_pkey.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 180 | pem_pkey.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 181 | pem_pkey.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 182 | pem_pkey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 183 | pem_pkey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 184 | pem_pkey.o: ../../include/openssl/x509_vfy.h ../asn1/asn1_locl.h ../cryptlib.h | ||
| 185 | pem_pkey.o: pem_pkey.c | ||
| 186 | pem_seal.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 187 | pem_seal.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 188 | pem_seal.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 189 | pem_seal.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 190 | pem_seal.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 191 | pem_seal.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 192 | pem_seal.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 193 | pem_seal.o: ../../include/openssl/opensslconf.h | ||
| 194 | pem_seal.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 195 | pem_seal.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 196 | pem_seal.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 197 | pem_seal.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 198 | pem_seal.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 199 | pem_seal.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 200 | pem_seal.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_seal.c | ||
| 201 | pem_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 202 | pem_sign.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 203 | pem_sign.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 204 | pem_sign.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 205 | pem_sign.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 206 | pem_sign.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 207 | pem_sign.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 208 | pem_sign.o: ../../include/openssl/opensslconf.h | ||
| 209 | pem_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 210 | pem_sign.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 211 | pem_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 212 | pem_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 213 | pem_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 214 | pem_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 215 | pem_sign.o: ../cryptlib.h pem_sign.c | ||
| 216 | pem_x509.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 217 | pem_x509.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 218 | pem_x509.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 219 | pem_x509.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 220 | pem_x509.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 221 | pem_x509.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 222 | pem_x509.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 223 | pem_x509.o: ../../include/openssl/opensslconf.h | ||
| 224 | pem_x509.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 225 | pem_x509.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 226 | pem_x509.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 227 | pem_x509.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 228 | pem_x509.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 229 | pem_x509.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_x509.c | ||
| 230 | pem_xaux.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 231 | pem_xaux.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 232 | pem_xaux.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 233 | pem_xaux.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 234 | pem_xaux.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 235 | pem_xaux.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 236 | pem_xaux.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 237 | pem_xaux.o: ../../include/openssl/opensslconf.h | ||
| 238 | pem_xaux.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 239 | pem_xaux.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 240 | pem_xaux.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 241 | pem_xaux.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 242 | pem_xaux.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 243 | pem_xaux.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pem_xaux.c | ||
| 244 | pvkfmt.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 245 | pvkfmt.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 246 | pvkfmt.o: ../../include/openssl/crypto.h ../../include/openssl/dsa.h | ||
| 247 | pvkfmt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 248 | pvkfmt.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 249 | pvkfmt.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 250 | pvkfmt.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 251 | pvkfmt.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 252 | pvkfmt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 253 | pvkfmt.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 254 | pvkfmt.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 255 | pvkfmt.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 256 | pvkfmt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 257 | pvkfmt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 258 | pvkfmt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pvkfmt.c | ||
diff --git a/src/lib/libcrypto/pem/pem_lib.c b/src/lib/libcrypto/pem/pem_lib.c index cfc89a9921..42e4861bc1 100644 --- a/src/lib/libcrypto/pem/pem_lib.c +++ b/src/lib/libcrypto/pem/pem_lib.c | |||
| @@ -482,6 +482,7 @@ int PEM_do_header(EVP_CIPHER_INFO *cipher, unsigned char *data, long *plen, | |||
| 482 | 482 | ||
| 483 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) | 483 | int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) |
| 484 | { | 484 | { |
| 485 | int o; | ||
| 485 | const EVP_CIPHER *enc=NULL; | 486 | const EVP_CIPHER *enc=NULL; |
| 486 | char *p,c; | 487 | char *p,c; |
| 487 | char **header_pp = &header; | 488 | char **header_pp = &header; |
| @@ -521,6 +522,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher) | |||
| 521 | header++; | 522 | header++; |
| 522 | } | 523 | } |
| 523 | *header='\0'; | 524 | *header='\0'; |
| 525 | o=OBJ_sn2nid(p); | ||
| 524 | cipher->cipher=enc=EVP_get_cipherbyname(p); | 526 | cipher->cipher=enc=EVP_get_cipherbyname(p); |
| 525 | *header=c; | 527 | *header=c; |
| 526 | header++; | 528 | header++; |
diff --git a/src/lib/libcrypto/perlasm/cbc.pl b/src/lib/libcrypto/perlasm/cbc.pl index 6fc2510905..e43dc9ae15 100644 --- a/src/lib/libcrypto/perlasm/cbc.pl +++ b/src/lib/libcrypto/perlasm/cbc.pl | |||
| @@ -158,6 +158,7 @@ sub cbc | |||
| 158 | &jmp_ptr($count); | 158 | &jmp_ptr($count); |
| 159 | 159 | ||
| 160 | &set_label("ej7"); | 160 | &set_label("ej7"); |
| 161 | &xor("edx", "edx") if $ppro; # ppro friendly | ||
| 161 | &movb(&HB("edx"), &BP(6,$in,"",0)); | 162 | &movb(&HB("edx"), &BP(6,$in,"",0)); |
| 162 | &shl("edx",8); | 163 | &shl("edx",8); |
| 163 | &set_label("ej6"); | 164 | &set_label("ej6"); |
| @@ -169,6 +170,7 @@ sub cbc | |||
| 169 | &jmp(&label("ejend")); | 170 | &jmp(&label("ejend")); |
| 170 | &set_label("ej3"); | 171 | &set_label("ej3"); |
| 171 | &movb(&HB("ecx"), &BP(2,$in,"",0)); | 172 | &movb(&HB("ecx"), &BP(2,$in,"",0)); |
| 173 | &xor("ecx", "ecx") if $ppro; # ppro friendly | ||
| 172 | &shl("ecx",8); | 174 | &shl("ecx",8); |
| 173 | &set_label("ej2"); | 175 | &set_label("ej2"); |
| 174 | &movb(&HB("ecx"), &BP(1,$in,"",0)); | 176 | &movb(&HB("ecx"), &BP(1,$in,"",0)); |
diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl index e47116b74b..d66ad24095 100755 --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | |||
| @@ -66,7 +66,7 @@ if ($flavour =~ /\./) { $output = $flavour; undef $flavour; } | |||
| 66 | my ($outdev,$outino,@junk)=stat($output); | 66 | my ($outdev,$outino,@junk)=stat($output); |
| 67 | 67 | ||
| 68 | open STDOUT,">$output" || die "can't open $output: $!" | 68 | open STDOUT,">$output" || die "can't open $output: $!" |
| 69 | if ($stddev!=$outdev || $stdino!=$outino); | 69 | if (1 || $stddev!=$outdev || $stdino!=$outino); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); | 72 | my $gas=1; $gas=0 if ($output =~ /\.asm$/); |
| @@ -167,7 +167,7 @@ my %globals; | |||
| 167 | } elsif ($self->{op} =~ /^(pop|push)f/) { | 167 | } elsif ($self->{op} =~ /^(pop|push)f/) { |
| 168 | $self->{op} .= $self->{sz}; | 168 | $self->{op} .= $self->{sz}; |
| 169 | } elsif ($self->{op} eq "call" && $current_segment eq ".CRT\$XCU") { | 169 | } elsif ($self->{op} eq "call" && $current_segment eq ".CRT\$XCU") { |
| 170 | $self->{op} = "\tDQ"; | 170 | $self->{op} = "ALIGN\t8\n\tDQ"; |
| 171 | } | 171 | } |
| 172 | $self->{op}; | 172 | $self->{op}; |
| 173 | } | 173 | } |
| @@ -215,7 +215,8 @@ my %globals; | |||
| 215 | undef $ret; | 215 | undef $ret; |
| 216 | 216 | ||
| 217 | # optional * ---vvv--- appears in indirect jmp/call | 217 | # optional * ---vvv--- appears in indirect jmp/call |
| 218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/) { | 218 | if ($line =~ /^(\*?)([^\(,]*)\(([%\w,]+)\)/ && |
| 219 | !($line =~ /^PIC_(GOT|PLT)/)) { | ||
| 219 | $self->{asterisk} = $1; | 220 | $self->{asterisk} = $1; |
| 220 | $self->{label} = $2; | 221 | $self->{label} = $2; |
| 221 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); | 222 | ($self->{base},$self->{index},$self->{scale})=split(/,/,$3); |
| @@ -545,8 +546,6 @@ my %globals; | |||
| 545 | if ($line=~/\.([px])data/) { | 546 | if ($line=~/\.([px])data/) { |
| 546 | $v.=" rdata align="; | 547 | $v.=" rdata align="; |
| 547 | $v.=$1 eq "p"? 4 : 8; | 548 | $v.=$1 eq "p"? 4 : 8; |
| 548 | } elsif ($line=~/\.CRT\$/i) { | ||
| 549 | $v.=" rdata align=8"; | ||
| 550 | } | 549 | } |
| 551 | } else { | 550 | } else { |
| 552 | $v="$current_segment\tENDS\n" if ($current_segment); | 551 | $v="$current_segment\tENDS\n" if ($current_segment); |
| @@ -554,8 +553,6 @@ my %globals; | |||
| 554 | if ($line=~/\.([px])data/) { | 553 | if ($line=~/\.([px])data/) { |
| 555 | $v.=" READONLY"; | 554 | $v.=" READONLY"; |
| 556 | $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); | 555 | $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); |
| 557 | } elsif ($line=~/\.CRT\$/i) { | ||
| 558 | $v.=" READONLY DWORD"; | ||
| 559 | } | 556 | } |
| 560 | } | 557 | } |
| 561 | $current_segment = $line; | 558 | $current_segment = $line; |
| @@ -625,6 +622,8 @@ my %globals; | |||
| 625 | } | 622 | } |
| 626 | } | 623 | } |
| 627 | 624 | ||
| 625 | print "#include <machine/asm.h>\n"; | ||
| 626 | |||
| 628 | if ($nasm) { | 627 | if ($nasm) { |
| 629 | print <<___; | 628 | print <<___; |
| 630 | default rel | 629 | default rel |
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 28080caaa6..4756a28e59 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
| @@ -33,6 +33,13 @@ sub ::emit | |||
| 33 | else { push(@out,"\t$opcode\t".join(',',@_)."\n"); } | 33 | else { push(@out,"\t$opcode\t".join(',',@_)."\n"); } |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | sub ::emitraw | ||
| 37 | { my $opcode=shift; | ||
| 38 | |||
| 39 | if ($#_==-1) { push(@out,"$opcode\n"); } | ||
| 40 | else { push(@out,"$opcode\t".join(',',@_)."\n"); } | ||
| 41 | } | ||
| 42 | |||
| 36 | sub ::LB | 43 | sub ::LB |
| 37 | { $_[0] =~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'low byte'"; | 44 | { $_[0] =~ m/^e?([a-d])x$/o or die "$_[0] does not have a 'low byte'"; |
| 38 | $1."l"; | 45 | $1."l"; |
| @@ -167,7 +174,7 @@ sub ::asm_init | |||
| 167 | $filename=$fn; | 174 | $filename=$fn; |
| 168 | $i386=$cpu; | 175 | $i386=$cpu; |
| 169 | 176 | ||
| 170 | $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=0; | 177 | $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$openbsd=0; |
| 171 | if (($type eq "elf")) | 178 | if (($type eq "elf")) |
| 172 | { $elf=1; require "x86gas.pl"; } | 179 | { $elf=1; require "x86gas.pl"; } |
| 173 | elsif (($type eq "a\.out")) | 180 | elsif (($type eq "a\.out")) |
| @@ -184,6 +191,10 @@ sub ::asm_init | |||
| 184 | { $win32=1; require "x86masm.pl"; } | 191 | { $win32=1; require "x86masm.pl"; } |
| 185 | elsif (($type eq "macosx")) | 192 | elsif (($type eq "macosx")) |
| 186 | { $aout=1; $macosx=1; require "x86gas.pl"; } | 193 | { $aout=1; $macosx=1; require "x86gas.pl"; } |
| 194 | elsif (($type eq "openbsd-elf")) | ||
| 195 | { $openbsd=$elf=1; require "x86gas.pl"; } | ||
| 196 | elsif (($type eq "openbsd-a.out")) | ||
| 197 | { $openbsd=1; require "x86gas.pl"; } | ||
| 187 | else | 198 | else |
| 188 | { print STDERR <<"EOF"; | 199 | { print STDERR <<"EOF"; |
| 189 | Pick one target type from | 200 | Pick one target type from |
| @@ -191,6 +202,8 @@ Pick one target type from | |||
| 191 | a.out - DJGPP, elder OpenBSD, etc. | 202 | a.out - DJGPP, elder OpenBSD, etc. |
| 192 | coff - GAS/COFF such as Win32 targets | 203 | coff - GAS/COFF such as Win32 targets |
| 193 | win32n - Windows 95/Windows NT NASM format | 204 | win32n - Windows 95/Windows NT NASM format |
| 205 | openbsd-elf - OpenBSD elf | ||
| 206 | openbsd-a.out - OpenBSD a.out | ||
| 194 | nw-nasm - NetWare NASM format | 207 | nw-nasm - NetWare NASM format |
| 195 | macosx - Mac OS X | 208 | macosx - Mac OS X |
| 196 | EOF | 209 | EOF |
| @@ -200,6 +213,7 @@ EOF | |||
| 200 | $pic=0; | 213 | $pic=0; |
| 201 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } | 214 | for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } |
| 202 | 215 | ||
| 216 | ::emitraw("#include <machine/asm.h>\n") if $openbsd; | ||
| 203 | $filename =~ s/\.pl$//; | 217 | $filename =~ s/\.pl$//; |
| 204 | &file($filename); | 218 | &file($filename); |
| 205 | } | 219 | } |
diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl index 6eab727fd4..15e17f25d0 100644 --- a/src/lib/libcrypto/perlasm/x86gas.pl +++ b/src/lib/libcrypto/perlasm/x86gas.pl | |||
| @@ -180,7 +180,16 @@ sub ::align | |||
| 180 | sub ::picmeup | 180 | sub ::picmeup |
| 181 | { my($dst,$sym,$base,$reflabel)=@_; | 181 | { my($dst,$sym,$base,$reflabel)=@_; |
| 182 | 182 | ||
| 183 | if ($::pic && ($::elf || $::aout)) | 183 | if ($::openbsd) |
| 184 | { &::emitraw("#ifdef PIC"); | ||
| 185 | &::emitraw("PIC_PROLOGUE"); | ||
| 186 | &::mov($dst, &::DWP("PIC_GOT($sym)")); | ||
| 187 | &::emitraw("PIC_EPILOGUE"); | ||
| 188 | &::emitraw("#else /* PIC */"); | ||
| 189 | &::lea($dst,&::DWP($sym)); | ||
| 190 | &::emitraw("#endif /* PIC */"); | ||
| 191 | } | ||
| 192 | elsif ($::pic && ($::elf || $::aout)) | ||
| 184 | { if (!defined($base)) | 193 | { if (!defined($base)) |
| 185 | { &::call(&::label("PIC_me_up")); | 194 | { &::call(&::label("PIC_me_up")); |
| 186 | &::set_label("PIC_me_up"); | 195 | &::set_label("PIC_me_up"); |
| @@ -206,7 +215,18 @@ sub ::picmeup | |||
| 206 | sub ::initseg | 215 | sub ::initseg |
| 207 | { my $f=$nmdecor.shift; | 216 | { my $f=$nmdecor.shift; |
| 208 | 217 | ||
| 209 | if ($::elf) | 218 | if ($::openbsd) |
| 219 | { $initseg.=<<___; | ||
| 220 | .section .init | ||
| 221 | PIC_PROLOGUE | ||
| 222 | call PIC_PLT($f) | ||
| 223 | PIC_EPILOGUE | ||
| 224 | jmp .Linitalign | ||
| 225 | .align $align | ||
| 226 | .Linitalign: | ||
| 227 | ___ | ||
| 228 | } | ||
| 229 | elsif ($::elf) | ||
| 210 | { $initseg.=<<___; | 230 | { $initseg.=<<___; |
| 211 | .section .init | 231 | .section .init |
| 212 | call $f | 232 | call $f |
diff --git a/src/lib/libcrypto/perlasm/x86masm.pl b/src/lib/libcrypto/perlasm/x86masm.pl new file mode 100644 index 0000000000..3d50e4a786 --- /dev/null +++ b/src/lib/libcrypto/perlasm/x86masm.pl | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | package x86masm; | ||
| 4 | |||
| 5 | *out=\@::out; | ||
| 6 | |||
| 7 | $::lbdecor="\$L"; # local label decoration | ||
| 8 | $nmdecor="_"; # external name decoration | ||
| 9 | |||
| 10 | $initseg=""; | ||
| 11 | $segment=""; | ||
| 12 | |||
| 13 | sub ::generic | ||
| 14 | { my ($opcode,@arg)=@_; | ||
| 15 | |||
| 16 | # fix hexadecimal constants | ||
| 17 | for (@arg) { s/0x([0-9a-f]+)/0$1h/oi; } | ||
| 18 | |||
| 19 | if ($opcode !~ /movq/) | ||
| 20 | { # fix xmm references | ||
| 21 | $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i); | ||
| 22 | $arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i); | ||
| 23 | } | ||
| 24 | |||
| 25 | &::emit($opcode,@arg); | ||
| 26 | 1; | ||
| 27 | } | ||
| 28 | # | ||
| 29 | # opcodes not covered by ::generic above, mostly inconsistent namings... | ||
| 30 | # | ||
| 31 | sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); } | ||
| 32 | sub ::call_ptr { &::emit("call",@_); } | ||
| 33 | sub ::jmp_ptr { &::emit("jmp",@_); } | ||
| 34 | |||
| 35 | sub get_mem | ||
| 36 | { my($size,$addr,$reg1,$reg2,$idx)=@_; | ||
| 37 | my($post,$ret); | ||
| 38 | |||
| 39 | $ret .= "$size PTR " if ($size ne ""); | ||
| 40 | |||
| 41 | $addr =~ s/^\s+//; | ||
| 42 | # prepend global references with optional underscore | ||
| 43 | $addr =~ s/^([^\+\-0-9][^\+\-]*)/&::islabel($1) or "$nmdecor$1"/ige; | ||
| 44 | # put address arithmetic expression in parenthesis | ||
| 45 | $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/); | ||
| 46 | |||
| 47 | if (($addr ne "") && ($addr ne 0)) | ||
| 48 | { if ($addr !~ /^-/) { $ret .= "$addr"; } | ||
| 49 | else { $post=$addr; } | ||
| 50 | } | ||
| 51 | $ret .= "["; | ||
| 52 | |||
| 53 | if ($reg2 ne "") | ||
| 54 | { $idx!=0 or $idx=1; | ||
| 55 | $ret .= "$reg2*$idx"; | ||
| 56 | $ret .= "+$reg1" if ($reg1 ne ""); | ||
| 57 | } | ||
| 58 | else | ||
| 59 | { $ret .= "$reg1"; } | ||
| 60 | |||
| 61 | $ret .= "$post]"; | ||
| 62 | $ret =~ s/\+\]/]/; # in case $addr was the only argument | ||
| 63 | $ret =~ s/\[\s*\]//; | ||
| 64 | |||
| 65 | $ret; | ||
| 66 | } | ||
| 67 | sub ::BP { &get_mem("BYTE",@_); } | ||
| 68 | sub ::DWP { &get_mem("DWORD",@_); } | ||
| 69 | sub ::QWP { &get_mem("QWORD",@_); } | ||
| 70 | sub ::BC { "@_"; } | ||
| 71 | sub ::DWC { "@_"; } | ||
| 72 | |||
| 73 | sub ::file | ||
| 74 | { my $tmp=<<___; | ||
| 75 | TITLE $_[0].asm | ||
| 76 | IF \@Version LT 800 | ||
| 77 | ECHO MASM version 8.00 or later is strongly recommended. | ||
| 78 | ENDIF | ||
| 79 | .486 | ||
| 80 | .MODEL FLAT | ||
| 81 | OPTION DOTNAME | ||
| 82 | IF \@Version LT 800 | ||
| 83 | .text\$ SEGMENT PAGE 'CODE' | ||
| 84 | ELSE | ||
| 85 | .text\$ SEGMENT ALIGN(64) 'CODE' | ||
| 86 | ENDIF | ||
| 87 | ___ | ||
| 88 | push(@out,$tmp); | ||
| 89 | $segment = ".text\$"; | ||
| 90 | } | ||
| 91 | |||
| 92 | sub ::function_begin_B | ||
| 93 | { my $func=shift; | ||
| 94 | my $global=($func !~ /^_/); | ||
| 95 | my $begin="${::lbdecor}_${func}_begin"; | ||
| 96 | |||
| 97 | &::LABEL($func,$global?"$begin":"$nmdecor$func"); | ||
| 98 | $func="ALIGN\t16\n".$nmdecor.$func."\tPROC"; | ||
| 99 | |||
| 100 | if ($global) { $func.=" PUBLIC\n${begin}::\n"; } | ||
| 101 | else { $func.=" PRIVATE\n"; } | ||
| 102 | push(@out,$func); | ||
| 103 | $::stack=4; | ||
| 104 | } | ||
| 105 | sub ::function_end_B | ||
| 106 | { my $func=shift; | ||
| 107 | |||
| 108 | push(@out,"$nmdecor$func ENDP\n"); | ||
| 109 | $::stack=0; | ||
| 110 | &::wipe_labels(); | ||
| 111 | } | ||
| 112 | |||
| 113 | sub ::file_end | ||
| 114 | { my $xmmheader=<<___; | ||
| 115 | .686 | ||
| 116 | .XMM | ||
| 117 | IF \@Version LT 800 | ||
| 118 | XMMWORD STRUCT 16 | ||
| 119 | DQ 2 dup (?) | ||
| 120 | XMMWORD ENDS | ||
| 121 | ENDIF | ||
| 122 | ___ | ||
| 123 | if (grep {/\b[x]?mm[0-7]\b/i} @out) { | ||
| 124 | grep {s/\.[3-7]86/$xmmheader/} @out; | ||
| 125 | } | ||
| 126 | |||
| 127 | push(@out,"$segment ENDS\n"); | ||
| 128 | |||
| 129 | if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) | ||
| 130 | { my $comm=<<___; | ||
| 131 | .bss SEGMENT 'BSS' | ||
| 132 | COMM ${nmdecor}OPENSSL_ia32cap_P:DWORD | ||
| 133 | .bss ENDS | ||
| 134 | ___ | ||
| 135 | # comment out OPENSSL_ia32cap_P declarations | ||
| 136 | grep {s/(^EXTERN\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out; | ||
| 137 | push (@out,$comm); | ||
| 138 | } | ||
| 139 | push (@out,$initseg) if ($initseg); | ||
| 140 | push (@out,"END\n"); | ||
| 141 | } | ||
| 142 | |||
| 143 | sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } } | ||
| 144 | |||
| 145 | *::set_label_B = sub | ||
| 146 | { my $l=shift; push(@out,$l.($l=~/^\Q${::lbdecor}\E[0-9]{3}/?":\n":"::\n")); }; | ||
| 147 | |||
| 148 | sub ::external_label | ||
| 149 | { foreach(@_) | ||
| 150 | { push(@out, "EXTERN\t".&::LABEL($_,$nmdecor.$_).":NEAR\n"); } | ||
| 151 | } | ||
| 152 | |||
| 153 | sub ::public_label | ||
| 154 | { push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } | ||
| 155 | |||
| 156 | sub ::data_byte | ||
| 157 | { push(@out,("DB\t").join(',',@_)."\n"); } | ||
| 158 | |||
| 159 | sub ::data_word | ||
| 160 | { push(@out,("DD\t").join(',',@_)."\n"); } | ||
| 161 | |||
| 162 | sub ::align | ||
| 163 | { push(@out,"ALIGN\t$_[0]\n"); } | ||
| 164 | |||
| 165 | sub ::picmeup | ||
| 166 | { my($dst,$sym)=@_; | ||
| 167 | &::lea($dst,&::DWP($sym)); | ||
| 168 | } | ||
| 169 | |||
| 170 | sub ::initseg | ||
| 171 | { my $f=$nmdecor.shift; | ||
| 172 | |||
| 173 | $initseg.=<<___; | ||
| 174 | .CRT\$XCU SEGMENT DWORD PUBLIC 'DATA' | ||
| 175 | EXTERN $f:NEAR | ||
| 176 | DD $f | ||
| 177 | .CRT\$XCU ENDS | ||
| 178 | ___ | ||
| 179 | } | ||
| 180 | |||
| 181 | sub ::dataseg | ||
| 182 | { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; } | ||
| 183 | |||
| 184 | 1; | ||
diff --git a/src/lib/libcrypto/perlasm/x86nasm.pl b/src/lib/libcrypto/perlasm/x86nasm.pl new file mode 100644 index 0000000000..ce2bed9bb2 --- /dev/null +++ b/src/lib/libcrypto/perlasm/x86nasm.pl | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | package x86nasm; | ||
| 4 | |||
| 5 | *out=\@::out; | ||
| 6 | |||
| 7 | $::lbdecor="L\$"; # local label decoration | ||
| 8 | $nmdecor=$::netware?"":"_"; # external name decoration | ||
| 9 | $drdecor=$::mwerks?".":""; # directive decoration | ||
| 10 | |||
| 11 | $initseg=""; | ||
| 12 | |||
| 13 | sub ::generic | ||
| 14 | { my $opcode=shift; | ||
| 15 | my $tmp; | ||
| 16 | |||
| 17 | if (!$::mwerks) | ||
| 18 | { if ($opcode =~ m/^j/o && $#_==0) # optimize jumps | ||
| 19 | { $_[0] = "NEAR $_[0]"; } | ||
| 20 | elsif ($opcode eq "lea" && $#_==1) # wipe storage qualifier from lea | ||
| 21 | { $_[1] =~ s/^[^\[]*\[/\[/o; } | ||
| 22 | } | ||
| 23 | &::emit($opcode,@_); | ||
| 24 | 1; | ||
| 25 | } | ||
| 26 | # | ||
| 27 | # opcodes not covered by ::generic above, mostly inconsistent namings... | ||
| 28 | # | ||
| 29 | sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); } | ||
| 30 | sub ::call_ptr { &::emit("call",@_); } | ||
| 31 | sub ::jmp_ptr { &::emit("jmp",@_); } | ||
| 32 | |||
| 33 | sub get_mem | ||
| 34 | { my($size,$addr,$reg1,$reg2,$idx)=@_; | ||
| 35 | my($post,$ret); | ||
| 36 | |||
| 37 | if ($size ne "") | ||
| 38 | { $ret .= "$size"; | ||
| 39 | $ret .= " PTR" if ($::mwerks); | ||
| 40 | $ret .= " "; | ||
| 41 | } | ||
| 42 | $ret .= "["; | ||
| 43 | |||
| 44 | $addr =~ s/^\s+//; | ||
| 45 | # prepend global references with optional underscore | ||
| 46 | $addr =~ s/^([^\+\-0-9][^\+\-]*)/::islabel($1) or "$nmdecor$1"/ige; | ||
| 47 | # put address arithmetic expression in parenthesis | ||
| 48 | $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/); | ||
| 49 | |||
| 50 | if (($addr ne "") && ($addr ne 0)) | ||
| 51 | { if ($addr !~ /^-/) { $ret .= "$addr+"; } | ||
| 52 | else { $post=$addr; } | ||
| 53 | } | ||
| 54 | |||
| 55 | if ($reg2 ne "") | ||
| 56 | { $idx!=0 or $idx=1; | ||
| 57 | $ret .= "$reg2*$idx"; | ||
| 58 | $ret .= "+$reg1" if ($reg1 ne ""); | ||
| 59 | } | ||
| 60 | else | ||
| 61 | { $ret .= "$reg1"; } | ||
| 62 | |||
| 63 | $ret .= "$post]"; | ||
| 64 | $ret =~ s/\+\]/]/; # in case $addr was the only argument | ||
| 65 | |||
| 66 | $ret; | ||
| 67 | } | ||
| 68 | sub ::BP { &get_mem("BYTE",@_); } | ||
| 69 | sub ::DWP { &get_mem("DWORD",@_); } | ||
| 70 | sub ::QWP { &get_mem("",@_); } | ||
| 71 | sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; } | ||
| 72 | sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; } | ||
| 73 | |||
| 74 | sub ::file | ||
| 75 | { if ($::mwerks) { push(@out,".section\t.text,64\n"); } | ||
| 76 | else | ||
| 77 | { my $tmp=<<___; | ||
| 78 | %ifidn __OUTPUT_FORMAT__,obj | ||
| 79 | section code use32 class=code align=64 | ||
| 80 | %elifidn __OUTPUT_FORMAT__,win32 | ||
| 81 | \$\@feat.00 equ 1 | ||
| 82 | section .text code align=64 | ||
| 83 | %else | ||
| 84 | section .text code | ||
| 85 | %endif | ||
| 86 | ___ | ||
| 87 | push(@out,$tmp); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | sub ::function_begin_B | ||
| 92 | { my $func=shift; | ||
| 93 | my $global=($func !~ /^_/); | ||
| 94 | my $begin="${::lbdecor}_${func}_begin"; | ||
| 95 | |||
| 96 | $begin =~ s/^\@/./ if ($::mwerks); # the torture never stops | ||
| 97 | |||
| 98 | &::LABEL($func,$global?"$begin":"$nmdecor$func"); | ||
| 99 | $func=$nmdecor.$func; | ||
| 100 | |||
| 101 | push(@out,"${drdecor}global $func\n") if ($global); | ||
| 102 | push(@out,"${drdecor}align 16\n"); | ||
| 103 | push(@out,"$func:\n"); | ||
| 104 | push(@out,"$begin:\n") if ($global); | ||
| 105 | $::stack=4; | ||
| 106 | } | ||
| 107 | |||
| 108 | sub ::function_end_B | ||
| 109 | { $::stack=0; | ||
| 110 | &::wipe_labels(); | ||
| 111 | } | ||
| 112 | |||
| 113 | sub ::file_end | ||
| 114 | { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out) | ||
| 115 | { my $comm=<<___; | ||
| 116 | ${drdecor}segment .bss | ||
| 117 | ${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 4 | ||
| 118 | ___ | ||
| 119 | # comment out OPENSSL_ia32cap_P declarations | ||
| 120 | grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out; | ||
| 121 | push (@out,$comm) | ||
| 122 | } | ||
| 123 | push (@out,$initseg) if ($initseg); | ||
| 124 | } | ||
| 125 | |||
| 126 | sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } } | ||
| 127 | |||
| 128 | sub ::external_label | ||
| 129 | { foreach(@_) | ||
| 130 | { push(@out,"${drdecor}extern\t".&::LABEL($_,$nmdecor.$_)."\n"); } | ||
| 131 | } | ||
| 132 | |||
| 133 | sub ::public_label | ||
| 134 | { push(@out,"${drdecor}global\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); } | ||
| 135 | |||
| 136 | sub ::data_byte | ||
| 137 | { push(@out,(($::mwerks)?".byte\t":"db\t").join(',',@_)."\n"); } | ||
| 138 | |||
| 139 | sub ::data_word | ||
| 140 | { push(@out,(($::mwerks)?".long\t":"dd\t").join(',',@_)."\n"); } | ||
| 141 | |||
| 142 | sub ::align | ||
| 143 | { push(@out,"${drdecor}align\t$_[0]\n"); } | ||
| 144 | |||
| 145 | sub ::picmeup | ||
| 146 | { my($dst,$sym)=@_; | ||
| 147 | &::lea($dst,&::DWP($sym)); | ||
| 148 | } | ||
| 149 | |||
| 150 | sub ::initseg | ||
| 151 | { my $f=$nmdecor.shift; | ||
| 152 | if ($::win32) | ||
| 153 | { $initseg=<<___; | ||
| 154 | segment .CRT\$XCU data align=4 | ||
| 155 | extern $f | ||
| 156 | dd $f | ||
| 157 | ___ | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 161 | sub ::dataseg | ||
| 162 | { if ($mwerks) { push(@out,".section\t.data,4\n"); } | ||
| 163 | else { push(@out,"section\t.data align=4\n"); } | ||
| 164 | } | ||
| 165 | |||
| 166 | 1; | ||
diff --git a/src/lib/libcrypto/pkcs12/Makefile b/src/lib/libcrypto/pkcs12/Makefile new file mode 100644 index 0000000000..3a7498fe7a --- /dev/null +++ b/src/lib/libcrypto/pkcs12/Makefile | |||
| @@ -0,0 +1,286 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/pkcs12/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pkcs12 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= p12_add.c p12_asn.c p12_attr.c p12_crpt.c p12_crt.c p12_decr.c \ | ||
| 21 | p12_init.c p12_key.c p12_kiss.c p12_mutl.c\ | ||
| 22 | p12_utl.c p12_npas.c pk12err.c p12_p8d.c p12_p8e.c | ||
| 23 | LIBOBJ= p12_add.o p12_asn.o p12_attr.o p12_crpt.o p12_crt.o p12_decr.o \ | ||
| 24 | p12_init.o p12_key.o p12_kiss.o p12_mutl.o\ | ||
| 25 | p12_utl.o p12_npas.o pk12err.o p12_p8d.o p12_p8e.o | ||
| 26 | |||
| 27 | SRC= $(LIBSRC) | ||
| 28 | |||
| 29 | EXHEADER= pkcs12.h | ||
| 30 | HEADER= $(EXHEADER) | ||
| 31 | |||
| 32 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 33 | |||
| 34 | top: | ||
| 35 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 36 | |||
| 37 | test: | ||
| 38 | |||
| 39 | all: lib | ||
| 40 | |||
| 41 | lib: $(LIBOBJ) | ||
| 42 | $(AR) $(LIB) $(LIBOBJ) | ||
| 43 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 44 | @touch lib | ||
| 45 | |||
| 46 | files: | ||
| 47 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 53 | |||
| 54 | install: | ||
| 55 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 56 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 57 | do \ | ||
| 58 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 59 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 60 | done; | ||
| 61 | |||
| 62 | tags: | ||
| 63 | ctags $(SRC) | ||
| 64 | |||
| 65 | tests: | ||
| 66 | |||
| 67 | lint: | ||
| 68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 69 | |||
| 70 | depend: | ||
| 71 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 72 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 73 | |||
| 74 | dclean: | ||
| 75 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 76 | mv -f Makefile.new $(MAKEFILE) | ||
| 77 | |||
| 78 | clean: | ||
| 79 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 80 | |||
| 81 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 82 | |||
| 83 | p12_add.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 84 | p12_add.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 85 | p12_add.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 86 | p12_add.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 87 | p12_add.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 88 | p12_add.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 89 | p12_add.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 90 | p12_add.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 91 | p12_add.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 92 | p12_add.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 93 | p12_add.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 94 | p12_add.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 95 | p12_add.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_add.c | ||
| 96 | p12_asn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 97 | p12_asn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 98 | p12_asn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 99 | p12_asn.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 100 | p12_asn.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 101 | p12_asn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 102 | p12_asn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 103 | p12_asn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 104 | p12_asn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 105 | p12_asn.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 106 | p12_asn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 107 | p12_asn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 108 | p12_asn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 109 | p12_asn.o: ../cryptlib.h p12_asn.c | ||
| 110 | p12_attr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 111 | p12_attr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 112 | p12_attr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 113 | p12_attr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 114 | p12_attr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 115 | p12_attr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 116 | p12_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 117 | p12_attr.o: ../../include/openssl/opensslconf.h | ||
| 118 | p12_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 119 | p12_attr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 120 | p12_attr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 121 | p12_attr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 122 | p12_attr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 123 | p12_attr.o: ../cryptlib.h p12_attr.c | ||
| 124 | p12_crpt.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 125 | p12_crpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 126 | p12_crpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 127 | p12_crpt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 128 | p12_crpt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 129 | p12_crpt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 130 | p12_crpt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 131 | p12_crpt.o: ../../include/openssl/opensslconf.h | ||
| 132 | p12_crpt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 133 | p12_crpt.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 134 | p12_crpt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 135 | p12_crpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 136 | p12_crpt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 137 | p12_crpt.o: ../cryptlib.h p12_crpt.c | ||
| 138 | p12_crt.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 139 | p12_crt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 140 | p12_crt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 141 | p12_crt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 142 | p12_crt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 143 | p12_crt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 144 | p12_crt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 145 | p12_crt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 146 | p12_crt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 147 | p12_crt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 148 | p12_crt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 149 | p12_crt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 150 | p12_crt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_crt.c | ||
| 151 | p12_decr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 152 | p12_decr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 153 | p12_decr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 154 | p12_decr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 155 | p12_decr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 156 | p12_decr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 157 | p12_decr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 158 | p12_decr.o: ../../include/openssl/opensslconf.h | ||
| 159 | p12_decr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 160 | p12_decr.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 161 | p12_decr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 162 | p12_decr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 163 | p12_decr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 164 | p12_decr.o: ../cryptlib.h p12_decr.c | ||
| 165 | p12_init.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 166 | p12_init.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 167 | p12_init.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 168 | p12_init.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 169 | p12_init.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 170 | p12_init.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 171 | p12_init.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 172 | p12_init.o: ../../include/openssl/opensslconf.h | ||
| 173 | p12_init.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 174 | p12_init.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 175 | p12_init.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 176 | p12_init.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 177 | p12_init.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 178 | p12_init.o: ../cryptlib.h p12_init.c | ||
| 179 | p12_key.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 180 | p12_key.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 181 | p12_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 182 | p12_key.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 183 | p12_key.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 184 | p12_key.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 185 | p12_key.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 186 | p12_key.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 187 | p12_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 188 | p12_key.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 189 | p12_key.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 190 | p12_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 191 | p12_key.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 192 | p12_key.o: ../cryptlib.h p12_key.c | ||
| 193 | p12_kiss.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 194 | p12_kiss.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 195 | p12_kiss.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 196 | p12_kiss.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 197 | p12_kiss.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 198 | p12_kiss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 199 | p12_kiss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 200 | p12_kiss.o: ../../include/openssl/opensslconf.h | ||
| 201 | p12_kiss.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 202 | p12_kiss.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 203 | p12_kiss.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 204 | p12_kiss.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 205 | p12_kiss.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 206 | p12_kiss.o: ../cryptlib.h p12_kiss.c | ||
| 207 | p12_mutl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 208 | p12_mutl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 209 | p12_mutl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 210 | p12_mutl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 211 | p12_mutl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 212 | p12_mutl.o: ../../include/openssl/evp.h ../../include/openssl/hmac.h | ||
| 213 | p12_mutl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 214 | p12_mutl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 215 | p12_mutl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 216 | p12_mutl.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 217 | p12_mutl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 218 | p12_mutl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 219 | p12_mutl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 220 | p12_mutl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_mutl.c | ||
| 221 | p12_npas.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 222 | p12_npas.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 223 | p12_npas.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 224 | p12_npas.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 225 | p12_npas.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 226 | p12_npas.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 227 | p12_npas.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 228 | p12_npas.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 229 | p12_npas.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 230 | p12_npas.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 231 | p12_npas.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 232 | p12_npas.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 233 | p12_npas.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 234 | p12_npas.o: p12_npas.c | ||
| 235 | p12_p8d.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 236 | p12_p8d.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 237 | p12_p8d.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 238 | p12_p8d.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 239 | p12_p8d.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 240 | p12_p8d.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 241 | p12_p8d.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 242 | p12_p8d.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 243 | p12_p8d.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 244 | p12_p8d.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 245 | p12_p8d.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 246 | p12_p8d.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 247 | p12_p8d.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_p8d.c | ||
| 248 | p12_p8e.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 249 | p12_p8e.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 250 | p12_p8e.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 251 | p12_p8e.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 252 | p12_p8e.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 253 | p12_p8e.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 254 | p12_p8e.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 255 | p12_p8e.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 256 | p12_p8e.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 257 | p12_p8e.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 258 | p12_p8e.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 259 | p12_p8e.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 260 | p12_p8e.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_p8e.c | ||
| 261 | p12_utl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 262 | p12_utl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 263 | p12_utl.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 264 | p12_utl.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 265 | p12_utl.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 266 | p12_utl.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 267 | p12_utl.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 268 | p12_utl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 269 | p12_utl.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs12.h | ||
| 270 | p12_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 271 | p12_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 272 | p12_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 273 | p12_utl.o: ../../include/openssl/x509_vfy.h ../cryptlib.h p12_utl.c | ||
| 274 | pk12err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 275 | pk12err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 276 | pk12err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 277 | pk12err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 278 | pk12err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 279 | pk12err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 280 | pk12err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 281 | pk12err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 282 | pk12err.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 283 | pk12err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 284 | pk12err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 285 | pk12err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 286 | pk12err.o: pk12err.c | ||
diff --git a/src/lib/libcrypto/pkcs12/p12_key.c b/src/lib/libcrypto/pkcs12/p12_key.c index 424203f648..a29794bbbc 100644 --- a/src/lib/libcrypto/pkcs12/p12_key.c +++ b/src/lib/libcrypto/pkcs12/p12_key.c | |||
| @@ -107,7 +107,6 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 107 | unsigned char *B, *D, *I, *p, *Ai; | 107 | unsigned char *B, *D, *I, *p, *Ai; |
| 108 | int Slen, Plen, Ilen, Ijlen; | 108 | int Slen, Plen, Ilen, Ijlen; |
| 109 | int i, j, u, v; | 109 | int i, j, u, v; |
| 110 | int ret = 0; | ||
| 111 | BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ | 110 | BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ |
| 112 | EVP_MD_CTX ctx; | 111 | EVP_MD_CTX ctx; |
| 113 | #ifdef DEBUG_KEYGEN | 112 | #ifdef DEBUG_KEYGEN |
| @@ -145,8 +144,10 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 145 | I = OPENSSL_malloc (Ilen); | 144 | I = OPENSSL_malloc (Ilen); |
| 146 | Ij = BN_new(); | 145 | Ij = BN_new(); |
| 147 | Bpl1 = BN_new(); | 146 | Bpl1 = BN_new(); |
| 148 | if (!D || !Ai || !B || !I || !Ij || !Bpl1) | 147 | if (!D || !Ai || !B || !I || !Ij || !Bpl1) { |
| 149 | goto err; | 148 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); |
| 149 | return 0; | ||
| 150 | } | ||
| 150 | for (i = 0; i < v; i++) D[i] = id; | 151 | for (i = 0; i < v; i++) D[i] = id; |
| 151 | p = I; | 152 | p = I; |
| 152 | for (i = 0; i < Slen; i++) *p++ = salt[i % saltlen]; | 153 | for (i = 0; i < Slen; i++) *p++ = salt[i % saltlen]; |
| @@ -163,22 +164,28 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 163 | } | 164 | } |
| 164 | memcpy (out, Ai, min (n, u)); | 165 | memcpy (out, Ai, min (n, u)); |
| 165 | if (u >= n) { | 166 | if (u >= n) { |
| 167 | OPENSSL_free (Ai); | ||
| 168 | OPENSSL_free (B); | ||
| 169 | OPENSSL_free (D); | ||
| 170 | OPENSSL_free (I); | ||
| 171 | BN_free (Ij); | ||
| 172 | BN_free (Bpl1); | ||
| 173 | EVP_MD_CTX_cleanup(&ctx); | ||
| 166 | #ifdef DEBUG_KEYGEN | 174 | #ifdef DEBUG_KEYGEN |
| 167 | fprintf(stderr, "Output KEY (length %d)\n", tmpn); | 175 | fprintf(stderr, "Output KEY (length %d)\n", tmpn); |
| 168 | h__dump(tmpout, tmpn); | 176 | h__dump(tmpout, tmpn); |
| 169 | #endif | 177 | #endif |
| 170 | ret = 1; | 178 | return 1; |
| 171 | goto end; | ||
| 172 | } | 179 | } |
| 173 | n -= u; | 180 | n -= u; |
| 174 | out += u; | 181 | out += u; |
| 175 | for (j = 0; j < v; j++) B[j] = Ai[j % u]; | 182 | for (j = 0; j < v; j++) B[j] = Ai[j % u]; |
| 176 | /* Work out B + 1 first then can use B as tmp space */ | 183 | /* Work out B + 1 first then can use B as tmp space */ |
| 177 | if (!BN_bin2bn (B, v, Bpl1)) goto err; | 184 | BN_bin2bn (B, v, Bpl1); |
| 178 | if (!BN_add_word (Bpl1, 1)) goto err; | 185 | BN_add_word (Bpl1, 1); |
| 179 | for (j = 0; j < Ilen ; j+=v) { | 186 | for (j = 0; j < Ilen ; j+=v) { |
| 180 | if (!BN_bin2bn (I + j, v, Ij)) goto err; | 187 | BN_bin2bn (I + j, v, Ij); |
| 181 | if (!BN_add (Ij, Ij, Bpl1)) goto err; | 188 | BN_add (Ij, Ij, Bpl1); |
| 182 | BN_bn2bin (Ij, B); | 189 | BN_bn2bin (Ij, B); |
| 183 | Ijlen = BN_num_bytes (Ij); | 190 | Ijlen = BN_num_bytes (Ij); |
| 184 | /* If more than 2^(v*8) - 1 cut off MSB */ | 191 | /* If more than 2^(v*8) - 1 cut off MSB */ |
| @@ -194,19 +201,6 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, | |||
| 194 | } else BN_bn2bin (Ij, I + j); | 201 | } else BN_bn2bin (Ij, I + j); |
| 195 | } | 202 | } |
| 196 | } | 203 | } |
| 197 | |||
| 198 | err: | ||
| 199 | PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE); | ||
| 200 | |||
| 201 | end: | ||
| 202 | OPENSSL_free (Ai); | ||
| 203 | OPENSSL_free (B); | ||
| 204 | OPENSSL_free (D); | ||
| 205 | OPENSSL_free (I); | ||
| 206 | BN_free (Ij); | ||
| 207 | BN_free (Bpl1); | ||
| 208 | EVP_MD_CTX_cleanup(&ctx); | ||
| 209 | return ret; | ||
| 210 | } | 204 | } |
| 211 | #ifdef DEBUG_KEYGEN | 205 | #ifdef DEBUG_KEYGEN |
| 212 | void h__dump (unsigned char *p, int len) | 206 | void h__dump (unsigned char *p, int len) |
diff --git a/src/lib/libcrypto/pkcs7/Makefile b/src/lib/libcrypto/pkcs7/Makefile new file mode 100644 index 0000000000..56dc6823d1 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/Makefile | |||
| @@ -0,0 +1,194 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/pkcs7/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pkcs7 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | PEX_LIBS= | ||
| 14 | EX_LIBS= | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | |||
| 18 | GENERAL=Makefile README | ||
| 19 | TEST= | ||
| 20 | APPS= | ||
| 21 | |||
| 22 | LIB=$(TOP)/libcrypto.a | ||
| 23 | LIBSRC= pk7_asn1.c pk7_lib.c pkcs7err.c pk7_doit.c pk7_smime.c pk7_attr.c \ | ||
| 24 | pk7_mime.c bio_pk7.c | ||
| 25 | LIBOBJ= pk7_asn1.o pk7_lib.o pkcs7err.o pk7_doit.o pk7_smime.o pk7_attr.o \ | ||
| 26 | pk7_mime.o bio_pk7.o | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= pkcs7.h | ||
| 31 | HEADER= $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | test: | ||
| 39 | |||
| 40 | all: lib | ||
| 41 | |||
| 42 | testapps: enc dec sign verify | ||
| 43 | |||
| 44 | enc: enc.o lib | ||
| 45 | $(CC) $(CFLAGS) -o enc enc.o $(PEX_LIBS) $(LIB) $(EX_LIBS) | ||
| 46 | |||
| 47 | dec: dec.o lib | ||
| 48 | $(CC) $(CFLAGS) -o dec dec.o $(PEX_LIBS) $(LIB) $(EX_LIBS) | ||
| 49 | |||
| 50 | sign: sign.o lib | ||
| 51 | $(CC) $(CFLAGS) -o sign sign.o $(PEX_LIBS) $(LIB) $(EX_LIBS) | ||
| 52 | |||
| 53 | verify: verify.o example.o lib | ||
| 54 | $(CC) $(CFLAGS) -o verify verify.o $(PEX_LIBS) example.o $(LIB) $(EX_LIBS) | ||
| 55 | |||
| 56 | lib: $(LIBOBJ) | ||
| 57 | $(AR) $(LIB) $(LIBOBJ) | ||
| 58 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 59 | @touch lib | ||
| 60 | |||
| 61 | files: | ||
| 62 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 63 | |||
| 64 | links: | ||
| 65 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 66 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 67 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 68 | |||
| 69 | install: | ||
| 70 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 71 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 72 | do \ | ||
| 73 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 74 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 75 | done; | ||
| 76 | |||
| 77 | tags: | ||
| 78 | ctags $(SRC) | ||
| 79 | |||
| 80 | tests: | ||
| 81 | |||
| 82 | lint: | ||
| 83 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 84 | |||
| 85 | depend: | ||
| 86 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 87 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 88 | |||
| 89 | dclean: | ||
| 90 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 91 | mv -f Makefile.new $(MAKEFILE) | ||
| 92 | |||
| 93 | clean: | ||
| 94 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify | ||
| 95 | |||
| 96 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 97 | |||
| 98 | bio_pk7.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 99 | bio_pk7.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 100 | bio_pk7.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 101 | bio_pk7.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 102 | bio_pk7.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 103 | bio_pk7.o: ../../include/openssl/symhacks.h bio_pk7.c | ||
| 104 | pk7_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 105 | pk7_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 106 | pk7_asn1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 107 | pk7_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 108 | pk7_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 109 | pk7_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 110 | pk7_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 111 | pk7_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 112 | pk7_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 113 | pk7_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 114 | pk7_asn1.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 115 | pk7_asn1.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 116 | pk7_asn1.o: ../../include/openssl/x509_vfy.h ../cryptlib.h pk7_asn1.c | ||
| 117 | pk7_attr.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 118 | pk7_attr.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 119 | pk7_attr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 120 | pk7_attr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 121 | pk7_attr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 122 | pk7_attr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 123 | pk7_attr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 124 | pk7_attr.o: ../../include/openssl/opensslconf.h | ||
| 125 | pk7_attr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 126 | pk7_attr.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 127 | pk7_attr.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 128 | pk7_attr.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 129 | pk7_attr.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 130 | pk7_attr.o: ../../include/openssl/x509_vfy.h pk7_attr.c | ||
| 131 | pk7_doit.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 132 | pk7_doit.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 133 | pk7_doit.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 134 | pk7_doit.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 135 | pk7_doit.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 136 | pk7_doit.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 137 | pk7_doit.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 138 | pk7_doit.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 139 | pk7_doit.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 140 | pk7_doit.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 141 | pk7_doit.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 142 | pk7_doit.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 143 | pk7_doit.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 144 | pk7_doit.o: ../../include/openssl/x509v3.h ../cryptlib.h pk7_doit.c | ||
| 145 | pk7_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 146 | pk7_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 147 | pk7_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 148 | pk7_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 149 | pk7_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 150 | pk7_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 151 | pk7_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 152 | pk7_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 153 | pk7_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 154 | pk7_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 155 | pk7_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 156 | pk7_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 157 | pk7_lib.o: ../asn1/asn1_locl.h ../cryptlib.h pk7_lib.c | ||
| 158 | pk7_mime.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 159 | pk7_mime.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 160 | pk7_mime.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 161 | pk7_mime.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 162 | pk7_mime.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 163 | pk7_mime.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 164 | pk7_mime.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 165 | pk7_mime.o: ../../include/openssl/opensslconf.h | ||
| 166 | pk7_mime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 167 | pk7_mime.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 168 | pk7_mime.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 169 | pk7_mime.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 170 | pk7_mime.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 171 | pk7_mime.o: ../cryptlib.h pk7_mime.c | ||
| 172 | pk7_smime.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 173 | pk7_smime.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 174 | pk7_smime.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 175 | pk7_smime.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 176 | pk7_smime.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 177 | pk7_smime.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 178 | pk7_smime.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 179 | pk7_smime.o: ../../include/openssl/objects.h | ||
| 180 | pk7_smime.o: ../../include/openssl/opensslconf.h | ||
| 181 | pk7_smime.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 182 | pk7_smime.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 183 | pk7_smime.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 184 | pk7_smime.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 185 | pk7_smime.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 186 | pk7_smime.o: ../cryptlib.h pk7_smime.c | ||
| 187 | pkcs7err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 188 | pkcs7err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 189 | pkcs7err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 190 | pkcs7err.o: ../../include/openssl/opensslconf.h | ||
| 191 | pkcs7err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 192 | pkcs7err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 193 | pkcs7err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 194 | pkcs7err.o: pkcs7err.c | ||
diff --git a/src/lib/libcrypto/pkcs7/bio_ber.c b/src/lib/libcrypto/pkcs7/bio_ber.c new file mode 100644 index 0000000000..31973fcd1f --- /dev/null +++ b/src/lib/libcrypto/pkcs7/bio_ber.c | |||
| @@ -0,0 +1,466 @@ | |||
| 1 | /* crypto/evp/bio_ber.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <errno.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/buffer.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | static int ber_write(BIO *h,char *buf,int num); | ||
| 66 | static int ber_read(BIO *h,char *buf,int size); | ||
| 67 | /*static int ber_puts(BIO *h,char *str); */ | ||
| 68 | /*static int ber_gets(BIO *h,char *str,int size); */ | ||
| 69 | static long ber_ctrl(BIO *h,int cmd,long arg1,char *arg2); | ||
| 70 | static int ber_new(BIO *h); | ||
| 71 | static int ber_free(BIO *data); | ||
| 72 | static long ber_callback_ctrl(BIO *h,int cmd,void *(*fp)()); | ||
| 73 | #define BER_BUF_SIZE (32) | ||
| 74 | |||
| 75 | /* This is used to hold the state of the BER objects being read. */ | ||
| 76 | typedef struct ber_struct | ||
| 77 | { | ||
| 78 | int tag; | ||
| 79 | int class; | ||
| 80 | long length; | ||
| 81 | int inf; | ||
| 82 | int num_left; | ||
| 83 | int depth; | ||
| 84 | } BER_CTX; | ||
| 85 | |||
| 86 | typedef struct bio_ber_struct | ||
| 87 | { | ||
| 88 | int tag; | ||
| 89 | int class; | ||
| 90 | long length; | ||
| 91 | int inf; | ||
| 92 | |||
| 93 | /* most of the following are used when doing non-blocking IO */ | ||
| 94 | /* reading */ | ||
| 95 | long num_left; /* number of bytes still to read/write in block */ | ||
| 96 | int depth; /* used with indefinite encoding. */ | ||
| 97 | int finished; /* No more read data */ | ||
| 98 | |||
| 99 | /* writting */ | ||
| 100 | char *w_addr; | ||
| 101 | int w_offset; | ||
| 102 | int w_left; | ||
| 103 | |||
| 104 | int buf_len; | ||
| 105 | int buf_off; | ||
| 106 | unsigned char buf[BER_BUF_SIZE]; | ||
| 107 | } BIO_BER_CTX; | ||
| 108 | |||
| 109 | static BIO_METHOD methods_ber= | ||
| 110 | { | ||
| 111 | BIO_TYPE_CIPHER,"cipher", | ||
| 112 | ber_write, | ||
| 113 | ber_read, | ||
| 114 | NULL, /* ber_puts, */ | ||
| 115 | NULL, /* ber_gets, */ | ||
| 116 | ber_ctrl, | ||
| 117 | ber_new, | ||
| 118 | ber_free, | ||
| 119 | ber_callback_ctrl, | ||
| 120 | }; | ||
| 121 | |||
| 122 | BIO_METHOD *BIO_f_ber(void) | ||
| 123 | { | ||
| 124 | return(&methods_ber); | ||
| 125 | } | ||
| 126 | |||
| 127 | static int ber_new(BIO *bi) | ||
| 128 | { | ||
| 129 | BIO_BER_CTX *ctx; | ||
| 130 | |||
| 131 | ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX)); | ||
| 132 | if (ctx == NULL) return(0); | ||
| 133 | |||
| 134 | memset((char *)ctx,0,sizeof(BIO_BER_CTX)); | ||
| 135 | |||
| 136 | bi->init=0; | ||
| 137 | bi->ptr=(char *)ctx; | ||
| 138 | bi->flags=0; | ||
| 139 | return(1); | ||
| 140 | } | ||
| 141 | |||
| 142 | static int ber_free(BIO *a) | ||
| 143 | { | ||
| 144 | BIO_BER_CTX *b; | ||
| 145 | |||
| 146 | if (a == NULL) return(0); | ||
| 147 | b=(BIO_BER_CTX *)a->ptr; | ||
| 148 | OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX)); | ||
| 149 | OPENSSL_free(a->ptr); | ||
| 150 | a->ptr=NULL; | ||
| 151 | a->init=0; | ||
| 152 | a->flags=0; | ||
| 153 | return(1); | ||
| 154 | } | ||
| 155 | |||
| 156 | int bio_ber_get_header(BIO *bio, BIO_BER_CTX *ctx) | ||
| 157 | { | ||
| 158 | char buf[64]; | ||
| 159 | int i,j,n; | ||
| 160 | int ret; | ||
| 161 | unsigned char *p; | ||
| 162 | unsigned long length | ||
| 163 | int tag; | ||
| 164 | int class; | ||
| 165 | long max; | ||
| 166 | |||
| 167 | BIO_clear_retry_flags(b); | ||
| 168 | |||
| 169 | /* Pack the buffer down if there is a hole at the front */ | ||
| 170 | if (ctx->buf_off != 0) | ||
| 171 | { | ||
| 172 | p=ctx->buf; | ||
| 173 | j=ctx->buf_off; | ||
| 174 | n=ctx->buf_len-j; | ||
| 175 | for (i=0; i<n; i++) | ||
| 176 | { | ||
| 177 | p[0]=p[j]; | ||
| 178 | p++; | ||
| 179 | } | ||
| 180 | ctx->buf_len-j; | ||
| 181 | ctx->buf_off=0; | ||
| 182 | } | ||
| 183 | |||
| 184 | /* If there is more room, read some more data */ | ||
| 185 | i=BER_BUF_SIZE-ctx->buf_len; | ||
| 186 | if (i) | ||
| 187 | { | ||
| 188 | i=BIO_read(bio->next_bio,&(ctx->buf[ctx->buf_len]),i); | ||
| 189 | if (i <= 0) | ||
| 190 | { | ||
| 191 | BIO_copy_next_retry(b); | ||
| 192 | return(i); | ||
| 193 | } | ||
| 194 | else | ||
| 195 | ctx->buf_len+=i; | ||
| 196 | } | ||
| 197 | |||
| 198 | max=ctx->buf_len; | ||
| 199 | p=ctx->buf; | ||
| 200 | ret=ASN1_get_object(&p,&length,&tag,&class,max); | ||
| 201 | |||
| 202 | if (ret & 0x80) | ||
| 203 | { | ||
| 204 | if ((ctx->buf_len < BER_BUF_SIZE) && | ||
| 205 | (ERR_GET_REASON(ERR_peek_error()) == ASN1_R_TOO_LONG)) | ||
| 206 | { | ||
| 207 | ERR_clear_error(); /* clear the error */ | ||
| 208 | BIO_set_retry_read(b); | ||
| 209 | } | ||
| 210 | return(-1); | ||
| 211 | } | ||
| 212 | |||
| 213 | /* We have no error, we have a header, so make use of it */ | ||
| 214 | |||
| 215 | if ((ctx->tag >= 0) && (ctx->tag != tag)) | ||
| 216 | { | ||
| 217 | BIOerr(BIO_F_BIO_BER_GET_HEADER,BIO_R_TAG_MISMATCH); | ||
| 218 | sprintf(buf,"tag=%d, got %d",ctx->tag,tag); | ||
| 219 | ERR_add_error_data(1,buf); | ||
| 220 | return(-1); | ||
| 221 | } | ||
| 222 | if (ret & 0x01) | ||
| 223 | if (ret & V_ASN1_CONSTRUCTED) | ||
| 224 | } | ||
| 225 | |||
| 226 | static int ber_read(BIO *b, char *out, int outl) | ||
| 227 | { | ||
| 228 | int ret=0,i,n; | ||
| 229 | BIO_BER_CTX *ctx; | ||
| 230 | |||
| 231 | BIO_clear_retry_flags(b); | ||
| 232 | |||
| 233 | if (out == NULL) return(0); | ||
| 234 | ctx=(BIO_BER_CTX *)b->ptr; | ||
| 235 | |||
| 236 | if ((ctx == NULL) || (b->next_bio == NULL)) return(0); | ||
| 237 | |||
| 238 | if (ctx->finished) return(0); | ||
| 239 | |||
| 240 | again: | ||
| 241 | /* First see if we are half way through reading a block */ | ||
| 242 | if (ctx->num_left > 0) | ||
| 243 | { | ||
| 244 | if (ctx->num_left < outl) | ||
| 245 | n=ctx->num_left; | ||
| 246 | else | ||
| 247 | n=outl; | ||
| 248 | i=BIO_read(b->next_bio,out,n); | ||
| 249 | if (i <= 0) | ||
| 250 | { | ||
| 251 | BIO_copy_next_retry(b); | ||
| 252 | return(i); | ||
| 253 | } | ||
| 254 | ctx->num_left-=i; | ||
| 255 | outl-=i; | ||
| 256 | ret+=i; | ||
| 257 | if (ctx->num_left <= 0) | ||
| 258 | { | ||
| 259 | ctx->depth--; | ||
| 260 | if (ctx->depth <= 0) | ||
| 261 | ctx->finished=1; | ||
| 262 | } | ||
| 263 | if (outl <= 0) | ||
| 264 | return(ret); | ||
| 265 | else | ||
| 266 | goto again; | ||
| 267 | } | ||
| 268 | else /* we need to read another BER header */ | ||
| 269 | { | ||
| 270 | } | ||
| 271 | } | ||
| 272 | |||
| 273 | static int ber_write(BIO *b, char *in, int inl) | ||
| 274 | { | ||
| 275 | int ret=0,n,i; | ||
| 276 | BIO_ENC_CTX *ctx; | ||
| 277 | |||
| 278 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 279 | ret=inl; | ||
| 280 | |||
| 281 | BIO_clear_retry_flags(b); | ||
| 282 | n=ctx->buf_len-ctx->buf_off; | ||
| 283 | while (n > 0) | ||
| 284 | { | ||
| 285 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 286 | if (i <= 0) | ||
| 287 | { | ||
| 288 | BIO_copy_next_retry(b); | ||
| 289 | return(i); | ||
| 290 | } | ||
| 291 | ctx->buf_off+=i; | ||
| 292 | n-=i; | ||
| 293 | } | ||
| 294 | /* at this point all pending data has been written */ | ||
| 295 | |||
| 296 | if ((in == NULL) || (inl <= 0)) return(0); | ||
| 297 | |||
| 298 | ctx->buf_off=0; | ||
| 299 | while (inl > 0) | ||
| 300 | { | ||
| 301 | n=(inl > ENC_BLOCK_SIZE)?ENC_BLOCK_SIZE:inl; | ||
| 302 | EVP_CipherUpdate(&(ctx->cipher), | ||
| 303 | (unsigned char *)ctx->buf,&ctx->buf_len, | ||
| 304 | (unsigned char *)in,n); | ||
| 305 | inl-=n; | ||
| 306 | in+=n; | ||
| 307 | |||
| 308 | ctx->buf_off=0; | ||
| 309 | n=ctx->buf_len; | ||
| 310 | while (n > 0) | ||
| 311 | { | ||
| 312 | i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n); | ||
| 313 | if (i <= 0) | ||
| 314 | { | ||
| 315 | BIO_copy_next_retry(b); | ||
| 316 | return(i); | ||
| 317 | } | ||
| 318 | n-=i; | ||
| 319 | ctx->buf_off+=i; | ||
| 320 | } | ||
| 321 | ctx->buf_len=0; | ||
| 322 | ctx->buf_off=0; | ||
| 323 | } | ||
| 324 | BIO_copy_next_retry(b); | ||
| 325 | return(ret); | ||
| 326 | } | ||
| 327 | |||
| 328 | static long ber_ctrl(BIO *b, int cmd, long num, char *ptr) | ||
| 329 | { | ||
| 330 | BIO *dbio; | ||
| 331 | BIO_ENC_CTX *ctx,*dctx; | ||
| 332 | long ret=1; | ||
| 333 | int i; | ||
| 334 | |||
| 335 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 336 | |||
| 337 | switch (cmd) | ||
| 338 | { | ||
| 339 | case BIO_CTRL_RESET: | ||
| 340 | ctx->ok=1; | ||
| 341 | ctx->finished=0; | ||
| 342 | EVP_CipherInit_ex(&(ctx->cipher),NULL,NULL,NULL,NULL, | ||
| 343 | ctx->cipher.berrypt); | ||
| 344 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 345 | break; | ||
| 346 | case BIO_CTRL_EOF: /* More to read */ | ||
| 347 | if (ctx->cont <= 0) | ||
| 348 | ret=1; | ||
| 349 | else | ||
| 350 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 351 | break; | ||
| 352 | case BIO_CTRL_WPENDING: | ||
| 353 | ret=ctx->buf_len-ctx->buf_off; | ||
| 354 | if (ret <= 0) | ||
| 355 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 356 | break; | ||
| 357 | case BIO_CTRL_PENDING: /* More to read in buffer */ | ||
| 358 | ret=ctx->buf_len-ctx->buf_off; | ||
| 359 | if (ret <= 0) | ||
| 360 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 361 | break; | ||
| 362 | case BIO_CTRL_FLUSH: | ||
| 363 | /* do a final write */ | ||
| 364 | again: | ||
| 365 | while (ctx->buf_len != ctx->buf_off) | ||
| 366 | { | ||
| 367 | i=ber_write(b,NULL,0); | ||
| 368 | if (i < 0) | ||
| 369 | { | ||
| 370 | ret=i; | ||
| 371 | break; | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | if (!ctx->finished) | ||
| 376 | { | ||
| 377 | ctx->finished=1; | ||
| 378 | ctx->buf_off=0; | ||
| 379 | ret=EVP_CipherFinal_ex(&(ctx->cipher), | ||
| 380 | (unsigned char *)ctx->buf, | ||
| 381 | &(ctx->buf_len)); | ||
| 382 | ctx->ok=(int)ret; | ||
| 383 | if (ret <= 0) break; | ||
| 384 | |||
| 385 | /* push out the bytes */ | ||
| 386 | goto again; | ||
| 387 | } | ||
| 388 | |||
| 389 | /* Finally flush the underlying BIO */ | ||
| 390 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 391 | break; | ||
| 392 | case BIO_C_GET_CIPHER_STATUS: | ||
| 393 | ret=(long)ctx->ok; | ||
| 394 | break; | ||
| 395 | case BIO_C_DO_STATE_MACHINE: | ||
| 396 | BIO_clear_retry_flags(b); | ||
| 397 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 398 | BIO_copy_next_retry(b); | ||
| 399 | break; | ||
| 400 | |||
| 401 | case BIO_CTRL_DUP: | ||
| 402 | dbio=(BIO *)ptr; | ||
| 403 | dctx=(BIO_ENC_CTX *)dbio->ptr; | ||
| 404 | memcpy(&(dctx->cipher),&(ctx->cipher),sizeof(ctx->cipher)); | ||
| 405 | dbio->init=1; | ||
| 406 | break; | ||
| 407 | default: | ||
| 408 | ret=BIO_ctrl(b->next_bio,cmd,num,ptr); | ||
| 409 | break; | ||
| 410 | } | ||
| 411 | return(ret); | ||
| 412 | } | ||
| 413 | |||
| 414 | static long ber_callback_ctrl(BIO *b, int cmd, void *(*fp)()) | ||
| 415 | { | ||
| 416 | long ret=1; | ||
| 417 | |||
| 418 | if (b->next_bio == NULL) return(0); | ||
| 419 | switch (cmd) | ||
| 420 | { | ||
| 421 | default: | ||
| 422 | ret=BIO_callback_ctrl(b->next_bio,cmd,fp); | ||
| 423 | break; | ||
| 424 | } | ||
| 425 | return(ret); | ||
| 426 | } | ||
| 427 | |||
| 428 | /* | ||
| 429 | void BIO_set_cipher_ctx(b,c) | ||
| 430 | BIO *b; | ||
| 431 | EVP_CIPHER_ctx *c; | ||
| 432 | { | ||
| 433 | if (b == NULL) return; | ||
| 434 | |||
| 435 | if ((b->callback != NULL) && | ||
| 436 | (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0)) | ||
| 437 | return; | ||
| 438 | |||
| 439 | b->init=1; | ||
| 440 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 441 | memcpy(ctx->cipher,c,sizeof(EVP_CIPHER_CTX)); | ||
| 442 | |||
| 443 | if (b->callback != NULL) | ||
| 444 | b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L); | ||
| 445 | } | ||
| 446 | */ | ||
| 447 | |||
| 448 | void BIO_set_cipher(BIO *b, EVP_CIPHER *c, unsigned char *k, unsigned char *i, | ||
| 449 | int e) | ||
| 450 | { | ||
| 451 | BIO_ENC_CTX *ctx; | ||
| 452 | |||
| 453 | if (b == NULL) return; | ||
| 454 | |||
| 455 | if ((b->callback != NULL) && | ||
| 456 | (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0)) | ||
| 457 | return; | ||
| 458 | |||
| 459 | b->init=1; | ||
| 460 | ctx=(BIO_ENC_CTX *)b->ptr; | ||
| 461 | EVP_CipherInit_ex(&(ctx->cipher),c,NULL,k,i,e); | ||
| 462 | |||
| 463 | if (b->callback != NULL) | ||
| 464 | b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L); | ||
| 465 | } | ||
| 466 | |||
diff --git a/src/lib/libcrypto/pkcs7/dec.c b/src/lib/libcrypto/pkcs7/dec.c new file mode 100644 index 0000000000..6752ec568a --- /dev/null +++ b/src/lib/libcrypto/pkcs7/dec.c | |||
| @@ -0,0 +1,248 @@ | |||
| 1 | /* crypto/pkcs7/verify.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | #include <stdio.h> | ||
| 59 | #include <stdlib.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <openssl/bio.h> | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | #include <openssl/pem.h> | ||
| 64 | #include <openssl/err.h> | ||
| 65 | #include <openssl/asn1.h> | ||
| 66 | |||
| 67 | int verify_callback(int ok, X509_STORE_CTX *ctx); | ||
| 68 | |||
| 69 | BIO *bio_err=NULL; | ||
| 70 | |||
| 71 | int main(argc,argv) | ||
| 72 | int argc; | ||
| 73 | char *argv[]; | ||
| 74 | { | ||
| 75 | char *keyfile=NULL; | ||
| 76 | BIO *in; | ||
| 77 | EVP_PKEY *pkey; | ||
| 78 | X509 *x509; | ||
| 79 | PKCS7 *p7; | ||
| 80 | PKCS7_SIGNER_INFO *si; | ||
| 81 | X509_STORE_CTX cert_ctx; | ||
| 82 | X509_STORE *cert_store=NULL; | ||
| 83 | BIO *data,*detached=NULL,*p7bio=NULL; | ||
| 84 | char buf[1024*4]; | ||
| 85 | unsigned char *pp; | ||
| 86 | int i,printit=0; | ||
| 87 | STACK_OF(PKCS7_SIGNER_INFO) *sk; | ||
| 88 | |||
| 89 | OpenSSL_add_all_algorithms(); | ||
| 90 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
| 91 | |||
| 92 | data=BIO_new(BIO_s_file()); | ||
| 93 | pp=NULL; | ||
| 94 | while (argc > 1) | ||
| 95 | { | ||
| 96 | argc--; | ||
| 97 | argv++; | ||
| 98 | if (strcmp(argv[0],"-p") == 0) | ||
| 99 | { | ||
| 100 | printit=1; | ||
| 101 | } | ||
| 102 | else if ((strcmp(argv[0],"-k") == 0) && (argc >= 2)) { | ||
| 103 | keyfile = argv[1]; | ||
| 104 | argc-=1; | ||
| 105 | argv+=1; | ||
| 106 | } else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2)) | ||
| 107 | { | ||
| 108 | detached=BIO_new(BIO_s_file()); | ||
| 109 | if (!BIO_read_filename(detached,argv[1])) | ||
| 110 | goto err; | ||
| 111 | argc-=1; | ||
| 112 | argv+=1; | ||
| 113 | } | ||
| 114 | else break; | ||
| 115 | } | ||
| 116 | |||
| 117 | if (!BIO_read_filename(data,argv[0])) goto err; | ||
| 118 | |||
| 119 | if(!keyfile) { | ||
| 120 | fprintf(stderr, "No private key file specified\n"); | ||
| 121 | goto err; | ||
| 122 | } | ||
| 123 | |||
| 124 | if ((in=BIO_new_file(keyfile,"r")) == NULL) goto err; | ||
| 125 | if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err; | ||
| 126 | BIO_reset(in); | ||
| 127 | if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL) | ||
| 128 | goto err; | ||
| 129 | BIO_free(in); | ||
| 130 | |||
| 131 | if (pp == NULL) | ||
| 132 | BIO_set_fp(data,stdin,BIO_NOCLOSE); | ||
| 133 | |||
| 134 | |||
| 135 | /* Load the PKCS7 object from a file */ | ||
| 136 | if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err; | ||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | /* This stuff is being setup for certificate verification. | ||
| 141 | * When using SSL, it could be replaced with a | ||
| 142 | * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */ | ||
| 143 | cert_store=X509_STORE_new(); | ||
| 144 | X509_STORE_set_default_paths(cert_store); | ||
| 145 | X509_STORE_load_locations(cert_store,NULL,"../../certs"); | ||
| 146 | X509_STORE_set_verify_cb_func(cert_store,verify_callback); | ||
| 147 | |||
| 148 | ERR_clear_error(); | ||
| 149 | |||
| 150 | /* We need to process the data */ | ||
| 151 | /* We cannot support detached encryption */ | ||
| 152 | p7bio=PKCS7_dataDecode(p7,pkey,detached,x509); | ||
| 153 | |||
| 154 | if (p7bio == NULL) | ||
| 155 | { | ||
| 156 | printf("problems decoding\n"); | ||
| 157 | goto err; | ||
| 158 | } | ||
| 159 | |||
| 160 | /* We now have to 'read' from p7bio to calculate digests etc. */ | ||
| 161 | for (;;) | ||
| 162 | { | ||
| 163 | i=BIO_read(p7bio,buf,sizeof(buf)); | ||
| 164 | /* print it? */ | ||
| 165 | if (i <= 0) break; | ||
| 166 | fwrite(buf,1, i, stdout); | ||
| 167 | } | ||
| 168 | |||
| 169 | /* We can now verify signatures */ | ||
| 170 | sk=PKCS7_get_signer_info(p7); | ||
| 171 | if (sk == NULL) | ||
| 172 | { | ||
| 173 | fprintf(stderr, "there are no signatures on this data\n"); | ||
| 174 | } | ||
| 175 | else | ||
| 176 | { | ||
| 177 | /* Ok, first we need to, for each subject entry, | ||
| 178 | * see if we can verify */ | ||
| 179 | ERR_clear_error(); | ||
| 180 | for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++) | ||
| 181 | { | ||
| 182 | si=sk_PKCS7_SIGNER_INFO_value(sk,i); | ||
| 183 | i=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si); | ||
| 184 | if (i <= 0) | ||
| 185 | goto err; | ||
| 186 | else | ||
| 187 | fprintf(stderr,"Signature verified\n"); | ||
| 188 | } | ||
| 189 | } | ||
| 190 | X509_STORE_free(cert_store); | ||
| 191 | |||
| 192 | exit(0); | ||
| 193 | err: | ||
| 194 | ERR_load_crypto_strings(); | ||
| 195 | ERR_print_errors_fp(stderr); | ||
| 196 | exit(1); | ||
| 197 | } | ||
| 198 | |||
| 199 | /* should be X509 * but we can just have them as char *. */ | ||
| 200 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 201 | { | ||
| 202 | char buf[256]; | ||
| 203 | X509 *err_cert; | ||
| 204 | int err,depth; | ||
| 205 | |||
| 206 | err_cert=X509_STORE_CTX_get_current_cert(ctx); | ||
| 207 | err= X509_STORE_CTX_get_error(ctx); | ||
| 208 | depth= X509_STORE_CTX_get_error_depth(ctx); | ||
| 209 | |||
| 210 | X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256); | ||
| 211 | BIO_printf(bio_err,"depth=%d %s\n",depth,buf); | ||
| 212 | if (!ok) | ||
| 213 | { | ||
| 214 | BIO_printf(bio_err,"verify error:num=%d:%s\n",err, | ||
| 215 | X509_verify_cert_error_string(err)); | ||
| 216 | if (depth < 6) | ||
| 217 | { | ||
| 218 | ok=1; | ||
| 219 | X509_STORE_CTX_set_error(ctx,X509_V_OK); | ||
| 220 | } | ||
| 221 | else | ||
| 222 | { | ||
| 223 | ok=0; | ||
| 224 | X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG); | ||
| 225 | } | ||
| 226 | } | ||
| 227 | switch (ctx->error) | ||
| 228 | { | ||
| 229 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
| 230 | X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256); | ||
| 231 | BIO_printf(bio_err,"issuer= %s\n",buf); | ||
| 232 | break; | ||
| 233 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
| 234 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
| 235 | BIO_printf(bio_err,"notBefore="); | ||
| 236 | ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert)); | ||
| 237 | BIO_printf(bio_err,"\n"); | ||
| 238 | break; | ||
| 239 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
| 240 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
| 241 | BIO_printf(bio_err,"notAfter="); | ||
| 242 | ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert)); | ||
| 243 | BIO_printf(bio_err,"\n"); | ||
| 244 | break; | ||
| 245 | } | ||
| 246 | BIO_printf(bio_err,"verify return:%d\n",ok); | ||
| 247 | return(ok); | ||
| 248 | } | ||
diff --git a/src/lib/libcrypto/pkcs7/des.pem b/src/lib/libcrypto/pkcs7/des.pem new file mode 100644 index 0000000000..62d1657e3e --- /dev/null +++ b/src/lib/libcrypto/pkcs7/des.pem | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | |||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 3 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 4 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 5 | ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR+MA0GCSqGSIb3DQEBAQUABEC2vXI1xQDW6lUHM3zQ | ||
| 6 | /9uBEBOO5A3TtkrklAXq7v01gsIC21t52qSk36REXY+slhNZ0OQ349tgkTsoETHFLoEwMIHw | ||
| 7 | AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI | ||
| 8 | QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 9 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR9MA0G | ||
| 10 | CSqGSIb3DQEBAQUABEB8ujxbabxXUYJhopuDm3oDq4JNqX6Io4p3ro+ShqfIndsXTZ1v5a2N | ||
| 11 | WtLLCWlHn/habjBwZ/DgQgcKASbZ7QxNMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA | ||
| 12 | oAQIbsL5v1wX98KggAQoAaJ4WHm68fXY1WE5OIjfVBIDpO1K+i8dmKhjnAjrjoyZ9Bwc8rDL | ||
| 13 | lgQg4CXb805h5xl+GfvSwUaHJayte1m2mcOhs3J2YyqbQ+MEIMIiJQccmhO3oDKm36CFvYR8 | ||
| 14 | 5PjpclVcZyX2ngbwPFMnBAgy0clOAE6UKAAAAAAAAAAAAAA= | ||
| 15 | |||
diff --git a/src/lib/libcrypto/pkcs7/doc b/src/lib/libcrypto/pkcs7/doc new file mode 100644 index 0000000000..d2e8b7b2a3 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/doc | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | int PKCS7_set_content_type(PKCS7 *p7, int type); | ||
| 2 | Call to set the type of PKCS7 object we are working on | ||
| 3 | |||
| 4 | int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, | ||
| 5 | EVP_MD *dgst); | ||
| 6 | Use this to setup a signer info | ||
| 7 | There will also be functions to add signed and unsigned attributes. | ||
| 8 | |||
| 9 | int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i); | ||
| 10 | Add a signer info to the content. | ||
| 11 | |||
| 12 | int PKCS7_add_certificae(PKCS7 *p7, X509 *x509); | ||
| 13 | int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509); | ||
| 14 | |||
| 15 | ---- | ||
| 16 | |||
| 17 | p7=PKCS7_new(); | ||
| 18 | PKCS7_set_content_type(p7,NID_pkcs7_signed); | ||
| 19 | |||
| 20 | signer=PKCS7_SINGNER_INFO_new(); | ||
| 21 | PKCS7_SIGNER_INFO_set(signer,x509,pkey,EVP_md5()); | ||
| 22 | PKCS7_add_signer(py,signer); | ||
| 23 | |||
| 24 | we are now setup. | ||
diff --git a/src/lib/libcrypto/pkcs7/enc.c b/src/lib/libcrypto/pkcs7/enc.c new file mode 100644 index 0000000000..7417f8a4e0 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/enc.c | |||
| @@ -0,0 +1,174 @@ | |||
| 1 | /* crypto/pkcs7/enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | #include <stdio.h> | ||
| 59 | #include <string.h> | ||
| 60 | #include <openssl/bio.h> | ||
| 61 | #include <openssl/x509.h> | ||
| 62 | #include <openssl/pem.h> | ||
| 63 | #include <openssl/err.h> | ||
| 64 | |||
| 65 | int main(argc,argv) | ||
| 66 | int argc; | ||
| 67 | char *argv[]; | ||
| 68 | { | ||
| 69 | X509 *x509; | ||
| 70 | PKCS7 *p7; | ||
| 71 | BIO *in; | ||
| 72 | BIO *data,*p7bio; | ||
| 73 | char buf[1024*4]; | ||
| 74 | int i; | ||
| 75 | int nodetach=1; | ||
| 76 | char *keyfile = NULL; | ||
| 77 | const EVP_CIPHER *cipher=NULL; | ||
| 78 | STACK_OF(X509) *recips=NULL; | ||
| 79 | |||
| 80 | OpenSSL_add_all_algorithms(); | ||
| 81 | |||
| 82 | data=BIO_new(BIO_s_file()); | ||
| 83 | while(argc > 1) | ||
| 84 | { | ||
| 85 | if (strcmp(argv[1],"-nd") == 0) | ||
| 86 | { | ||
| 87 | nodetach=1; | ||
| 88 | argv++; argc--; | ||
| 89 | } | ||
| 90 | else if ((strcmp(argv[1],"-c") == 0) && (argc >= 2)) { | ||
| 91 | if(!(cipher = EVP_get_cipherbyname(argv[2]))) { | ||
| 92 | fprintf(stderr, "Unknown cipher %s\n", argv[2]); | ||
| 93 | goto err; | ||
| 94 | } | ||
| 95 | argc-=2; | ||
| 96 | argv+=2; | ||
| 97 | } else if ((strcmp(argv[1],"-k") == 0) && (argc >= 2)) { | ||
| 98 | keyfile = argv[2]; | ||
| 99 | argc-=2; | ||
| 100 | argv+=2; | ||
| 101 | if (!(in=BIO_new_file(keyfile,"r"))) goto err; | ||
| 102 | if (!(x509=PEM_read_bio_X509(in,NULL,NULL,NULL))) | ||
| 103 | goto err; | ||
| 104 | if(!recips) recips = sk_X509_new_null(); | ||
| 105 | sk_X509_push(recips, x509); | ||
| 106 | BIO_free(in); | ||
| 107 | } else break; | ||
| 108 | } | ||
| 109 | |||
| 110 | if(!recips) { | ||
| 111 | fprintf(stderr, "No recipients\n"); | ||
| 112 | goto err; | ||
| 113 | } | ||
| 114 | |||
| 115 | if (!BIO_read_filename(data,argv[1])) goto err; | ||
| 116 | |||
| 117 | p7=PKCS7_new(); | ||
| 118 | #if 0 | ||
| 119 | BIO_reset(in); | ||
| 120 | if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL)) == NULL) goto err; | ||
| 121 | BIO_free(in); | ||
| 122 | PKCS7_set_type(p7,NID_pkcs7_signedAndEnveloped); | ||
| 123 | |||
| 124 | if (PKCS7_add_signature(p7,x509,pkey,EVP_sha1()) == NULL) goto err; | ||
| 125 | /* we may want to add more */ | ||
| 126 | PKCS7_add_certificate(p7,x509); | ||
| 127 | #else | ||
| 128 | PKCS7_set_type(p7,NID_pkcs7_enveloped); | ||
| 129 | #endif | ||
| 130 | if(!cipher) { | ||
| 131 | #ifndef OPENSSL_NO_DES | ||
| 132 | cipher = EVP_des_ede3_cbc(); | ||
| 133 | #else | ||
| 134 | fprintf(stderr, "No cipher selected\n"); | ||
| 135 | goto err; | ||
| 136 | #endif | ||
| 137 | } | ||
| 138 | |||
| 139 | if (!PKCS7_set_cipher(p7,cipher)) goto err; | ||
| 140 | for(i = 0; i < sk_X509_num(recips); i++) { | ||
| 141 | if (!PKCS7_add_recipient(p7,sk_X509_value(recips, i))) goto err; | ||
| 142 | } | ||
| 143 | sk_X509_pop_free(recips, X509_free); | ||
| 144 | |||
| 145 | /* Set the content of the signed to 'data' */ | ||
| 146 | /* PKCS7_content_new(p7,NID_pkcs7_data); not used in envelope */ | ||
| 147 | |||
| 148 | /* could be used, but not in this version :-) | ||
| 149 | if (!nodetach) PKCS7_set_detached(p7,1); | ||
| 150 | */ | ||
| 151 | |||
| 152 | if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err; | ||
| 153 | |||
| 154 | for (;;) | ||
| 155 | { | ||
| 156 | i=BIO_read(data,buf,sizeof(buf)); | ||
| 157 | if (i <= 0) break; | ||
| 158 | BIO_write(p7bio,buf,i); | ||
| 159 | } | ||
| 160 | BIO_flush(p7bio); | ||
| 161 | |||
| 162 | if (!PKCS7_dataFinal(p7,p7bio)) goto err; | ||
| 163 | BIO_free(p7bio); | ||
| 164 | |||
| 165 | PEM_write_PKCS7(stdout,p7); | ||
| 166 | PKCS7_free(p7); | ||
| 167 | |||
| 168 | exit(0); | ||
| 169 | err: | ||
| 170 | ERR_load_crypto_strings(); | ||
| 171 | ERR_print_errors_fp(stderr); | ||
| 172 | exit(1); | ||
| 173 | } | ||
| 174 | |||
diff --git a/src/lib/libcrypto/pkcs7/es1.pem b/src/lib/libcrypto/pkcs7/es1.pem new file mode 100644 index 0000000000..47112a238f --- /dev/null +++ b/src/lib/libcrypto/pkcs7/es1.pem | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 3 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 4 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 5 | ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqGSIb3DQEBAQUABEDWak0y/5XZJhQJeCLo | ||
| 6 | KECcHXkTEbjzYkYNHIinbiPmRK4QbNfs9z2mA3z/c2ykQ4eAqFR2jyNrUMN/+I5XEiv6MIHw | ||
| 7 | AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI | ||
| 8 | QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 9 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR9MA0G | ||
| 10 | CSqGSIb3DQEBAQUABEAWg9+KgtCjc77Jdj1Ve4wGgHjVHbbSYEA1ZqKFDoi15vSr9hfpHmC4 | ||
| 11 | ycZzcRo16JkTfolefiHZzmyjVz94vSN6MIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA | ||
| 12 | oAQI7X4Tk4mcbV6ggASBsHl1mCaJ3RhXWlNPCgCRU53d7M5x6TDZRkvwdtdvW96m1lupT03F | ||
| 13 | XtonkBqk7oMkH7kGfs5/REQOPjx0QE2Ixmgt1W3szum82EZwA7pZNppcraK7W/odw/7bYZO+ | ||
| 14 | II3HPmRklE2N9qiu1LPaPUsnYogkO6SennyeL5tZ382vBweL/8pnG0qsbT1OBb65v+llnsjT | ||
| 15 | pa1T/p+fIx/iJJGE6K9fYFokC6gXLQ6ozXRdOu5oBDB8mPCYYvAqKycidM/MrGGUkpEtS4f0 | ||
| 16 | lS31PwQi5YTim8Ig3/TOwVpPX32i46FTuEIEIMHkD/OvpfwCCzXUHHJnKnKUAUvIsSY3vGBs | ||
| 17 | 8ezpUDfBBBj9LHDy32hZ2tQilkDefP5VM2LLdrWgamYEgfiyITQvn08Ul5lQOQxbFKBheFq5 | ||
| 18 | otCCN4MR+w5eq12xQu6y+f9z0159ag2ru87D0lLtUtXXtCELbO1nUkT2sJ0k/iDs9TOXr6Cx | ||
| 19 | go1XKYho83hlkXYiCteVizdAbgVGNsNRD4wtIdajsorET/LuJECgp11YeL9w1dlDB0HLEZfi | ||
| 20 | XCsUphH4jGagba3hDeUSibnjSiJlN0ukfuQurBBbI2UkBAujiEAubKPn7C1FZJRSw6CPPX5t | ||
| 21 | KEpmcqT1JNk6LO8Js6/1sCmmBh1VGCy1+EuTI9J1p7Dagf4nQ8cHitoCRpHuKZlFHnZyv7tw | ||
| 22 | Rn/KOhHaYP2VzAh40gQIvKMAAWh9oFsEEIMwIoOmLwLH5wf+8QdbDhoECH8HwZt9a12dBAjL | ||
| 23 | r4j2zlvtfgQIt7nmEM3wz1EECKlc3EIy1irCBBCAKINcermK3A+jI6ISN2RzBFA3dsh/xwMu | ||
| 24 | l61aWMBBZzEz/SF92k6n35KZhCC0d6fIVC/1WMv0fnCwQ8oEDynSre216VEFiYKBaQLJe5o/ | ||
| 25 | mTAxC7Ht3goXnuc+i1FItOkLrgRI/wyvTICEn2WsNZiMADnGaee2bqPnUopo+VMGexJEtCPk | ||
| 26 | l0ZNlDJGquPDkpUwaEtecVZzCNyVPYyyF4J/l8rmGDhDdYUIC8IKBEg/ip/E0BuubBLWVbv+ | ||
| 27 | HRl4QrnGpyCyeXRXXK603QP3sT1Zbbm1v5pI/loOhVHi724LmtXHSyp5qv9MDcxE1PoX10LY | ||
| 28 | gBRtlwwESPeCF8bK5jk4xIQMhK5NMHj1Y1KQWTZ9NGITBL4hjRq2qp4Qk5GIpGgOVPopAuCo | ||
| 29 | TIyPikpqBRNtLSPRSsDs6QPUPzWBh6JgxwRQblnDKKUkxUcnJiD4i9QtGa/ZabMn4KxtNOBL | ||
| 30 | 5JSh1nJkaLXCZY070131WWPAByLcd5TiXq8x84pmzV5NNk4tiMpoXhJNsx8e4rskQQlKd6ME | ||
| 31 | SCe2eYDHKcKPX3WJbUzhrJSQ92/aWnI2iUY8WQ+kSNyiZ2QUjyuUg9Z66g/0d2STlvPOBHT/ | ||
| 32 | y5ODP2CwbcWX4QmCbUc9TT66fQRIrRVuwvtOfnUueyGgYhJ3HpAJfVaB/7kap5bj7Fi/azW4 | ||
| 33 | 9JDfd1bC/W9h0Kyk7RO2gxvE0hIHc26mZJHTm9MNP5D328MnM2MdBEjKjQBtgrp+lFIii7MP | ||
| 34 | nGHFTKUkG4WAIZJCf/CsT+p6/SW0qG71Me/YcSw5STB24j+a+HgMV8RVIeUlkP4z0IWWrSoB | ||
| 35 | Gh4d/Z0EUMCVHs/HZ/bWgiyhtHpvuVAzidm8D81p1LJ5BQX5/5f/m+q5+fS/npL27dTEbNqs | ||
| 36 | LSB6ij3MZAi7LwHWpTn9zWnDajCMEj9vlaV7mcKtHK5iBEg85agFi1h3MvicqLtoFe5hVv9T | ||
| 37 | tG0j6CRkjkixPzivltlrf44KHv14gLM0XJxCGyq7vd3l8QYr3+9at0zNnX/yqTiBnsnE5dUE | ||
| 38 | SIgrYuz87M2gi/ER9PcDoTtONH3+CkcqVy03q/Sj8cVWD/b1KgEhqnNOfc8Ak9PctyR/ItcR | ||
| 39 | 8Me5XVn1GJKkQJk4O29fxvgNoAQIrIESvUWGshAEQByXiFoFTDUByjTlgjcy77H1lrH+y3P/ | ||
| 40 | wAInJjJAut9kCNyGJV0PA4kdPB5USWltuO6t8gk4Pd2YBMl09zqUWkAEUCjFrtZ3mapjcGZI | ||
| 41 | uQTASKR5LSjXoWxTT5gae/+64MerF/oCEeO3ehRTpjnPrsiRDo0rWIQTaj9+Nro8Z2xtWstw | ||
| 42 | RnfoAHIxV1lEamPwjsceBEi2SD9hiifFeO5ECiVoaE1FdXUXhU+jwYAMx6jHWO9hMkYzS9pM | ||
| 43 | Y3IyWR5ybtOjiQgkUdvRJPUPGf5DVVMPnymGX25aDh5PYpIESPbsM9akCpOOVuscywcUswmU | ||
| 44 | o7dXvlB48WWCfg/al3BQKAZbn5ZXtWNwpUZkrEdHsrxAVv3rxRcdkT3Z1fzUbIuYkLJN200o | ||
| 45 | WgRIJvn6RO8KEj7/HOg2sYuuM8nz1kR0TSgwX7/0y/7JfjBa0JIlP7o75sNJscE8oyoIMzuy | ||
| 46 | Dvn6/U9g3BCDXn83A/s+ke60qn9gBFC6NAeLOlXal1YVWYhMQNOqCyUfAjiXBTawaysQb1Mk | ||
| 47 | YgeNlF8xuEFcUQWIP+vNG7FJ5JPMaMRL4YEoaQ3sVFhYOERJR1cSb+8xt4QCYtBKQgRIUOmJ | ||
| 48 | CHW5o1hXJWJiTkZK2qWFcEMzTINSj5EpYFySr8aVBjkRnI7vxegRT/+XZZXoYedQ3UNsnGI3 | ||
| 49 | DdkWii5VzX0PNF6C60pfBEiVpausYuX7Wjb3Lfm8cBj7GgN69i6Pm2gxtobVcmpo2nS4D714 | ||
| 50 | ePyhlX9n8kJ6QAcqWMRj22smDPrHVGNTizfzHBh5zNllK9gESJizILOWI327og3ZWp+qUht5 | ||
| 51 | kNDJCzMK7Z09UAy+h+vq0VTQuEo3FgLzVdqkJujjSL4Nx97lXg51AovrEn3nd4evydwcjKLX | ||
| 52 | 1wRIo72NaeWuUEQ+rt1SlCsOJ7k1ioJSqhrPOfvwcaFcb4beVet1JWiy4yvowTjLDGbUje2s | ||
| 53 | xjrlVt4BJWI/uA6jbQsrxSe89ADZBAi5YAlR4qszeAQIXD3VSBVKbRUECNTtyvw9vvqXBAhb | ||
| 54 | IZNn4H4cxgQI+XW7GkfL+ekECCCCg2reMyGDBAh1PYqkg3lw3gQQkNlggEPU+BH8eh7Gm7n7 | ||
| 55 | 7AQIjC5EWbkil5cEEKcpuqwTWww/X89KnQAg8TcECJPomqHvrlZFBBiRSuIiHpmN+PaujXpv | ||
| 56 | qZV2VhjkB2j09GEECOIdv8AVOJgKBAjlHgIqAD9jZQQIXHbs44+wogcEIGGqTACRJxrhMcMG | ||
| 57 | X8drNjksIPt+snxTXUBIkTVpZWoABAh6unXPTyIr8QQgBF8xKoX27MWk7iTNmkSNZggZXa2a | ||
| 58 | DWCGHSYLngbSOHIECD9XmO6VsvTgBAjfqB70CEW4WwQIVIBkbCocznUEEHB/zFXy/sR4OYHe | ||
| 59 | UfbNPnIEEDWBB/NTCLMGE+o8BfyujcAECFik7GQnnF9VBBAhLXExQeWAofZNc6NtN7qZBCC1 | ||
| 60 | gVIS3ruTwKltmcrgx3heT3M8ZJhCfWa+6KzchnmKygQQ+1NL5sSzR4m/fdrqxHFyUAQYCT2x | ||
| 61 | PamQr3wK3h0lyZER+4H0zPM86AhFBBC3CkmvL2vjflMfujnzPBVpBBge9rMbI5+0q9DLrTiT | ||
| 62 | 5F3AIgXLpD8PQWAECHkHVo6RomV3BAgMbi8E271UeAQIqtS8wnI3XngECG3TWmOMb3/iBEha | ||
| 63 | y+mvCS6I3n3JfL8e1B5P4qX9/czJRaERLuKpGNjLiL4A+zxN0LZ0UHd0qfmJjwOTxAx3iJAC | ||
| 64 | lGXX4nB9ATYPUT5EU+o1Y4sECN01pP6vWNIdBDAsiE0Ts8/9ltJlqX2B3AoOM4qOt9EaCjXf | ||
| 65 | lB+aEmrhtjUwuZ6GqS5Ke7P6XnakTk4ECCLIMatNdootAAAAAAAAAAAAAA== | ||
| 66 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/example.c b/src/lib/libcrypto/pkcs7/example.c new file mode 100644 index 0000000000..2953d04b5c --- /dev/null +++ b/src/lib/libcrypto/pkcs7/example.c | |||
| @@ -0,0 +1,329 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <stdlib.h> | ||
| 3 | #include <string.h> | ||
| 4 | #include <openssl/pkcs7.h> | ||
| 5 | #include <openssl/asn1_mac.h> | ||
| 6 | #include <openssl/x509.h> | ||
| 7 | |||
| 8 | int add_signed_time(PKCS7_SIGNER_INFO *si) | ||
| 9 | { | ||
| 10 | ASN1_UTCTIME *sign_time; | ||
| 11 | |||
| 12 | /* The last parameter is the amount to add/subtract from the current | ||
| 13 | * time (in seconds) */ | ||
| 14 | sign_time=X509_gmtime_adj(NULL,0); | ||
| 15 | PKCS7_add_signed_attribute(si,NID_pkcs9_signingTime, | ||
| 16 | V_ASN1_UTCTIME,(char *)sign_time); | ||
| 17 | return(1); | ||
| 18 | } | ||
| 19 | |||
| 20 | ASN1_UTCTIME *get_signed_time(PKCS7_SIGNER_INFO *si) | ||
| 21 | { | ||
| 22 | ASN1_TYPE *so; | ||
| 23 | |||
| 24 | so=PKCS7_get_signed_attribute(si,NID_pkcs9_signingTime); | ||
| 25 | if (so->type == V_ASN1_UTCTIME) | ||
| 26 | return so->value.utctime; | ||
| 27 | return NULL; | ||
| 28 | } | ||
| 29 | |||
| 30 | static int signed_string_nid= -1; | ||
| 31 | |||
| 32 | void add_signed_string(PKCS7_SIGNER_INFO *si, char *str) | ||
| 33 | { | ||
| 34 | ASN1_OCTET_STRING *os; | ||
| 35 | |||
| 36 | /* To a an object of OID 1.2.3.4.5, which is an octet string */ | ||
| 37 | if (signed_string_nid == -1) | ||
| 38 | signed_string_nid= | ||
| 39 | OBJ_create("1.2.3.4.5","OID_example","Our example OID"); | ||
| 40 | os=ASN1_OCTET_STRING_new(); | ||
| 41 | ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str)); | ||
| 42 | /* When we add, we do not free */ | ||
| 43 | PKCS7_add_signed_attribute(si,signed_string_nid, | ||
| 44 | V_ASN1_OCTET_STRING,(char *)os); | ||
| 45 | } | ||
| 46 | |||
| 47 | int get_signed_string(PKCS7_SIGNER_INFO *si, char *buf, int len) | ||
| 48 | { | ||
| 49 | ASN1_TYPE *so; | ||
| 50 | ASN1_OCTET_STRING *os; | ||
| 51 | int i; | ||
| 52 | |||
| 53 | if (signed_string_nid == -1) | ||
| 54 | signed_string_nid= | ||
| 55 | OBJ_create("1.2.3.4.5","OID_example","Our example OID"); | ||
| 56 | /* To retrieve */ | ||
| 57 | so=PKCS7_get_signed_attribute(si,signed_string_nid); | ||
| 58 | if (so != NULL) | ||
| 59 | { | ||
| 60 | if (so->type == V_ASN1_OCTET_STRING) | ||
| 61 | { | ||
| 62 | os=so->value.octet_string; | ||
| 63 | i=os->length; | ||
| 64 | if ((i+1) > len) | ||
| 65 | i=len-1; | ||
| 66 | memcpy(buf,os->data,i); | ||
| 67 | return(i); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | return(0); | ||
| 71 | } | ||
| 72 | |||
| 73 | static int signed_seq2string_nid= -1; | ||
| 74 | /* ########################################### */ | ||
| 75 | int add_signed_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2) | ||
| 76 | { | ||
| 77 | /* To add an object of OID 1.9.999, which is a sequence containing | ||
| 78 | * 2 octet strings */ | ||
| 79 | unsigned char *p; | ||
| 80 | ASN1_OCTET_STRING *os1,*os2; | ||
| 81 | ASN1_STRING *seq; | ||
| 82 | unsigned char *data; | ||
| 83 | int i,total; | ||
| 84 | |||
| 85 | if (signed_seq2string_nid == -1) | ||
| 86 | signed_seq2string_nid= | ||
| 87 | OBJ_create("1.9.9999","OID_example","Our example OID"); | ||
| 88 | |||
| 89 | os1=ASN1_OCTET_STRING_new(); | ||
| 90 | os2=ASN1_OCTET_STRING_new(); | ||
| 91 | ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1)); | ||
| 92 | ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1)); | ||
| 93 | i =i2d_ASN1_OCTET_STRING(os1,NULL); | ||
| 94 | i+=i2d_ASN1_OCTET_STRING(os2,NULL); | ||
| 95 | total=ASN1_object_size(1,i,V_ASN1_SEQUENCE); | ||
| 96 | |||
| 97 | data=malloc(total); | ||
| 98 | p=data; | ||
| 99 | ASN1_put_object(&p,1,i,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
| 100 | i2d_ASN1_OCTET_STRING(os1,&p); | ||
| 101 | i2d_ASN1_OCTET_STRING(os2,&p); | ||
| 102 | |||
| 103 | seq=ASN1_STRING_new(); | ||
| 104 | ASN1_STRING_set(seq,data,total); | ||
| 105 | free(data); | ||
| 106 | ASN1_OCTET_STRING_free(os1); | ||
| 107 | ASN1_OCTET_STRING_free(os2); | ||
| 108 | |||
| 109 | PKCS7_add_signed_attribute(si,signed_seq2string_nid, | ||
| 110 | V_ASN1_SEQUENCE,(char *)seq); | ||
| 111 | return(1); | ||
| 112 | } | ||
| 113 | |||
| 114 | /* For this case, I will malloc the return strings */ | ||
| 115 | int get_signed_seq2string(PKCS7_SIGNER_INFO *si, char **str1, char **str2) | ||
| 116 | { | ||
| 117 | ASN1_TYPE *so; | ||
| 118 | |||
| 119 | if (signed_seq2string_nid == -1) | ||
| 120 | signed_seq2string_nid= | ||
| 121 | OBJ_create("1.9.9999","OID_example","Our example OID"); | ||
| 122 | /* To retrieve */ | ||
| 123 | so=PKCS7_get_signed_attribute(si,signed_seq2string_nid); | ||
| 124 | if (so && (so->type == V_ASN1_SEQUENCE)) | ||
| 125 | { | ||
| 126 | ASN1_const_CTX c; | ||
| 127 | ASN1_STRING *s; | ||
| 128 | long length; | ||
| 129 | ASN1_OCTET_STRING *os1,*os2; | ||
| 130 | |||
| 131 | s=so->value.sequence; | ||
| 132 | c.p=ASN1_STRING_data(s); | ||
| 133 | c.max=c.p+ASN1_STRING_length(s); | ||
| 134 | if (!asn1_GetSequence(&c,&length)) goto err; | ||
| 135 | /* Length is the length of the seqence */ | ||
| 136 | |||
| 137 | c.q=c.p; | ||
| 138 | if ((os1=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL) | ||
| 139 | goto err; | ||
| 140 | c.slen-=(c.p-c.q); | ||
| 141 | |||
| 142 | c.q=c.p; | ||
| 143 | if ((os2=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL) | ||
| 144 | goto err; | ||
| 145 | c.slen-=(c.p-c.q); | ||
| 146 | |||
| 147 | if (!asn1_const_Finish(&c)) goto err; | ||
| 148 | *str1=malloc(os1->length+1); | ||
| 149 | *str2=malloc(os2->length+1); | ||
| 150 | memcpy(*str1,os1->data,os1->length); | ||
| 151 | memcpy(*str2,os2->data,os2->length); | ||
| 152 | (*str1)[os1->length]='\0'; | ||
| 153 | (*str2)[os2->length]='\0'; | ||
| 154 | ASN1_OCTET_STRING_free(os1); | ||
| 155 | ASN1_OCTET_STRING_free(os2); | ||
| 156 | return(1); | ||
| 157 | } | ||
| 158 | err: | ||
| 159 | return(0); | ||
| 160 | } | ||
| 161 | |||
| 162 | |||
| 163 | /* ####################################### | ||
| 164 | * THE OTHER WAY TO DO THINGS | ||
| 165 | * ####################################### | ||
| 166 | */ | ||
| 167 | X509_ATTRIBUTE *create_time(void) | ||
| 168 | { | ||
| 169 | ASN1_UTCTIME *sign_time; | ||
| 170 | X509_ATTRIBUTE *ret; | ||
| 171 | |||
| 172 | /* The last parameter is the amount to add/subtract from the current | ||
| 173 | * time (in seconds) */ | ||
| 174 | sign_time=X509_gmtime_adj(NULL,0); | ||
| 175 | ret=X509_ATTRIBUTE_create(NID_pkcs9_signingTime, | ||
| 176 | V_ASN1_UTCTIME,(char *)sign_time); | ||
| 177 | return(ret); | ||
| 178 | } | ||
| 179 | |||
| 180 | ASN1_UTCTIME *sk_get_time(STACK_OF(X509_ATTRIBUTE) *sk) | ||
| 181 | { | ||
| 182 | ASN1_TYPE *so; | ||
| 183 | PKCS7_SIGNER_INFO si; | ||
| 184 | |||
| 185 | si.auth_attr=sk; | ||
| 186 | so=PKCS7_get_signed_attribute(&si,NID_pkcs9_signingTime); | ||
| 187 | if (so->type == V_ASN1_UTCTIME) | ||
| 188 | return so->value.utctime; | ||
| 189 | return NULL; | ||
| 190 | } | ||
| 191 | |||
| 192 | X509_ATTRIBUTE *create_string(char *str) | ||
| 193 | { | ||
| 194 | ASN1_OCTET_STRING *os; | ||
| 195 | X509_ATTRIBUTE *ret; | ||
| 196 | |||
| 197 | /* To a an object of OID 1.2.3.4.5, which is an octet string */ | ||
| 198 | if (signed_string_nid == -1) | ||
| 199 | signed_string_nid= | ||
| 200 | OBJ_create("1.2.3.4.5","OID_example","Our example OID"); | ||
| 201 | os=ASN1_OCTET_STRING_new(); | ||
| 202 | ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str)); | ||
| 203 | /* When we add, we do not free */ | ||
| 204 | ret=X509_ATTRIBUTE_create(signed_string_nid, | ||
| 205 | V_ASN1_OCTET_STRING,(char *)os); | ||
| 206 | return(ret); | ||
| 207 | } | ||
| 208 | |||
| 209 | int sk_get_string(STACK_OF(X509_ATTRIBUTE) *sk, char *buf, int len) | ||
| 210 | { | ||
| 211 | ASN1_TYPE *so; | ||
| 212 | ASN1_OCTET_STRING *os; | ||
| 213 | int i; | ||
| 214 | PKCS7_SIGNER_INFO si; | ||
| 215 | |||
| 216 | si.auth_attr=sk; | ||
| 217 | |||
| 218 | if (signed_string_nid == -1) | ||
| 219 | signed_string_nid= | ||
| 220 | OBJ_create("1.2.3.4.5","OID_example","Our example OID"); | ||
| 221 | /* To retrieve */ | ||
| 222 | so=PKCS7_get_signed_attribute(&si,signed_string_nid); | ||
| 223 | if (so != NULL) | ||
| 224 | { | ||
| 225 | if (so->type == V_ASN1_OCTET_STRING) | ||
| 226 | { | ||
| 227 | os=so->value.octet_string; | ||
| 228 | i=os->length; | ||
| 229 | if ((i+1) > len) | ||
| 230 | i=len-1; | ||
| 231 | memcpy(buf,os->data,i); | ||
| 232 | return(i); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | return(0); | ||
| 236 | } | ||
| 237 | |||
| 238 | X509_ATTRIBUTE *add_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2) | ||
| 239 | { | ||
| 240 | /* To add an object of OID 1.9.999, which is a sequence containing | ||
| 241 | * 2 octet strings */ | ||
| 242 | unsigned char *p; | ||
| 243 | ASN1_OCTET_STRING *os1,*os2; | ||
| 244 | ASN1_STRING *seq; | ||
| 245 | X509_ATTRIBUTE *ret; | ||
| 246 | unsigned char *data; | ||
| 247 | int i,total; | ||
| 248 | |||
| 249 | if (signed_seq2string_nid == -1) | ||
| 250 | signed_seq2string_nid= | ||
| 251 | OBJ_create("1.9.9999","OID_example","Our example OID"); | ||
| 252 | |||
| 253 | os1=ASN1_OCTET_STRING_new(); | ||
| 254 | os2=ASN1_OCTET_STRING_new(); | ||
| 255 | ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1)); | ||
| 256 | ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1)); | ||
| 257 | i =i2d_ASN1_OCTET_STRING(os1,NULL); | ||
| 258 | i+=i2d_ASN1_OCTET_STRING(os2,NULL); | ||
| 259 | total=ASN1_object_size(1,i,V_ASN1_SEQUENCE); | ||
| 260 | |||
| 261 | data=malloc(total); | ||
| 262 | p=data; | ||
| 263 | ASN1_put_object(&p,1,i,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL); | ||
| 264 | i2d_ASN1_OCTET_STRING(os1,&p); | ||
| 265 | i2d_ASN1_OCTET_STRING(os2,&p); | ||
| 266 | |||
| 267 | seq=ASN1_STRING_new(); | ||
| 268 | ASN1_STRING_set(seq,data,total); | ||
| 269 | free(data); | ||
| 270 | ASN1_OCTET_STRING_free(os1); | ||
| 271 | ASN1_OCTET_STRING_free(os2); | ||
| 272 | |||
| 273 | ret=X509_ATTRIBUTE_create(signed_seq2string_nid, | ||
| 274 | V_ASN1_SEQUENCE,(char *)seq); | ||
| 275 | return(ret); | ||
| 276 | } | ||
| 277 | |||
| 278 | /* For this case, I will malloc the return strings */ | ||
| 279 | int sk_get_seq2string(STACK_OF(X509_ATTRIBUTE) *sk, char **str1, char **str2) | ||
| 280 | { | ||
| 281 | ASN1_TYPE *so; | ||
| 282 | PKCS7_SIGNER_INFO si; | ||
| 283 | |||
| 284 | if (signed_seq2string_nid == -1) | ||
| 285 | signed_seq2string_nid= | ||
| 286 | OBJ_create("1.9.9999","OID_example","Our example OID"); | ||
| 287 | |||
| 288 | si.auth_attr=sk; | ||
| 289 | /* To retrieve */ | ||
| 290 | so=PKCS7_get_signed_attribute(&si,signed_seq2string_nid); | ||
| 291 | if (so->type == V_ASN1_SEQUENCE) | ||
| 292 | { | ||
| 293 | ASN1_const_CTX c; | ||
| 294 | ASN1_STRING *s; | ||
| 295 | long length; | ||
| 296 | ASN1_OCTET_STRING *os1,*os2; | ||
| 297 | |||
| 298 | s=so->value.sequence; | ||
| 299 | c.p=ASN1_STRING_data(s); | ||
| 300 | c.max=c.p+ASN1_STRING_length(s); | ||
| 301 | if (!asn1_GetSequence(&c,&length)) goto err; | ||
| 302 | /* Length is the length of the seqence */ | ||
| 303 | |||
| 304 | c.q=c.p; | ||
| 305 | if ((os1=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL) | ||
| 306 | goto err; | ||
| 307 | c.slen-=(c.p-c.q); | ||
| 308 | |||
| 309 | c.q=c.p; | ||
| 310 | if ((os2=d2i_ASN1_OCTET_STRING(NULL,&c.p,c.slen)) == NULL) | ||
| 311 | goto err; | ||
| 312 | c.slen-=(c.p-c.q); | ||
| 313 | |||
| 314 | if (!asn1_const_Finish(&c)) goto err; | ||
| 315 | *str1=malloc(os1->length+1); | ||
| 316 | *str2=malloc(os2->length+1); | ||
| 317 | memcpy(*str1,os1->data,os1->length); | ||
| 318 | memcpy(*str2,os2->data,os2->length); | ||
| 319 | (*str1)[os1->length]='\0'; | ||
| 320 | (*str2)[os2->length]='\0'; | ||
| 321 | ASN1_OCTET_STRING_free(os1); | ||
| 322 | ASN1_OCTET_STRING_free(os2); | ||
| 323 | return(1); | ||
| 324 | } | ||
| 325 | err: | ||
| 326 | return(0); | ||
| 327 | } | ||
| 328 | |||
| 329 | |||
diff --git a/src/lib/libcrypto/pkcs7/example.h b/src/lib/libcrypto/pkcs7/example.h new file mode 100644 index 0000000000..96167de188 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/example.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 3 | * | ||
| 4 | * Redistribution and use in source and binary forms, with or without | ||
| 5 | * modification, are permitted provided that the following conditions | ||
| 6 | * are met: | ||
| 7 | * | ||
| 8 | * 1. Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions and the following disclaimer. | ||
| 10 | * | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in | ||
| 13 | * the documentation and/or other materials provided with the | ||
| 14 | * distribution. | ||
| 15 | * | ||
| 16 | * 3. All advertising materials mentioning features or use of this | ||
| 17 | * software must display the following acknowledgment: | ||
| 18 | * "This product includes software developed by the OpenSSL Project | ||
| 19 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 20 | * | ||
| 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 22 | * endorse or promote products derived from this software without | ||
| 23 | * prior written permission. For written permission, please contact | ||
| 24 | * openssl-core@openssl.org. | ||
| 25 | * | ||
| 26 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 27 | * nor may "OpenSSL" appear in their names without prior written | ||
| 28 | * permission of the OpenSSL Project. | ||
| 29 | * | ||
| 30 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 31 | * acknowledgment: | ||
| 32 | * "This product includes software developed by the OpenSSL Project | ||
| 33 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 34 | * | ||
| 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 47 | * ==================================================================== | ||
| 48 | * | ||
| 49 | * This product includes cryptographic software written by Eric Young | ||
| 50 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 51 | * Hudson (tjh@cryptsoft.com). | ||
| 52 | * | ||
| 53 | */ | ||
| 54 | |||
| 55 | int add_signed_time(PKCS7_SIGNER_INFO *si); | ||
| 56 | ASN1_UTCTIME *get_signed_time(PKCS7_SIGNER_INFO *si); | ||
| 57 | int get_signed_seq2string(PKCS7_SIGNER_INFO *si, char **str1, char **str2); | ||
diff --git a/src/lib/libcrypto/pkcs7/info.pem b/src/lib/libcrypto/pkcs7/info.pem new file mode 100644 index 0000000000..989baf8709 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/info.pem | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA | ||
| 2 | subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com | ||
| 3 | serial :047D | ||
| 4 | |||
| 5 | Certificate: | ||
| 6 | Data: | ||
| 7 | Version: 3 (0x2) | ||
| 8 | Serial Number: 1149 (0x47d) | ||
| 9 | Signature Algorithm: md5withRSAEncryption | ||
| 10 | Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA | ||
| 11 | Validity | ||
| 12 | Not Before: May 13 05:40:58 1998 GMT | ||
| 13 | Not After : May 12 05:40:58 2000 GMT | ||
| 14 | Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com | ||
| 15 | Subject Public Key Info: | ||
| 16 | Public Key Algorithm: rsaEncryption | ||
| 17 | Modulus: | ||
| 18 | 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81: | ||
| 19 | 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc: | ||
| 20 | 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29: | ||
| 21 | fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f: | ||
| 22 | e7:e7:0c:4d:0b | ||
| 23 | Exponent: 65537 (0x10001) | ||
| 24 | X509v3 extensions: | ||
| 25 | Netscape Comment: | ||
| 26 | Generated with SSLeay | ||
| 27 | Signature Algorithm: md5withRSAEncryption | ||
| 28 | 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55: | ||
| 29 | f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97: | ||
| 30 | d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b: | ||
| 31 | 50:74:ad:92:cb:4e:90:e5:fa:7d | ||
| 32 | |||
| 33 | -----BEGIN CERTIFICATE----- | ||
| 34 | MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV | ||
| 35 | MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE | ||
| 36 | ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E | ||
| 37 | IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw | ||
| 38 | NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK | ||
| 39 | UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 40 | dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0 | ||
| 41 | aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG | ||
| 42 | 9w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf | ||
| 43 | lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB | ||
| 44 | hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA | ||
| 45 | UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8 | ||
| 46 | 4A3ZItobUHStkstOkOX6fQ== | ||
| 47 | -----END CERTIFICATE----- | ||
| 48 | |||
| 49 | -----BEGIN RSA PRIVATE KEY----- | ||
| 50 | MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9 | ||
| 51 | mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG | ||
| 52 | fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/ | ||
| 53 | zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29 | ||
| 54 | p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b | ||
| 55 | bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk | ||
| 56 | IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG | ||
| 57 | -----END RSA PRIVATE KEY----- | ||
diff --git a/src/lib/libcrypto/pkcs7/infokey.pem b/src/lib/libcrypto/pkcs7/infokey.pem new file mode 100644 index 0000000000..1e2acc954d --- /dev/null +++ b/src/lib/libcrypto/pkcs7/infokey.pem | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | -----BEGIN RSA PRIVATE KEY----- | ||
| 2 | MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9 | ||
| 3 | mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG | ||
| 4 | fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/ | ||
| 5 | zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29 | ||
| 6 | p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b | ||
| 7 | bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk | ||
| 8 | IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG | ||
| 9 | -----END RSA PRIVATE KEY----- | ||
diff --git a/src/lib/libcrypto/pkcs7/p7/a1 b/src/lib/libcrypto/pkcs7/p7/a1 new file mode 100644 index 0000000000..56ca943762 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/p7/a1 | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | j,H>_æá_DôzEîLœ VJ³ß觬¤””E3ûáYäx%_Àk | ||
| 2 | 3ê)DLScñ8%ôM \ No newline at end of file | ||
diff --git a/src/lib/libcrypto/pkcs7/p7/a2 b/src/lib/libcrypto/pkcs7/p7/a2 new file mode 100644 index 0000000000..23d8fb5e93 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/p7/a2 | |||
| @@ -0,0 +1 @@ | |||
| k~@a”,NâM͹¼ <O( KP—é¨ ¤K²>×U¿o_½BqrmÎ?Ù t?t÷ÏéId2‰Š \ No newline at end of file | |||
diff --git a/src/lib/libcrypto/pkcs7/p7/cert.p7c b/src/lib/libcrypto/pkcs7/p7/cert.p7c new file mode 100644 index 0000000000..2b75ec05f7 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/p7/cert.p7c | |||
| Binary files differ | |||
diff --git a/src/lib/libcrypto/pkcs7/p7/smime.p7m b/src/lib/libcrypto/pkcs7/p7/smime.p7m new file mode 100644 index 0000000000..2b6e6f82ba --- /dev/null +++ b/src/lib/libcrypto/pkcs7/p7/smime.p7m | |||
| Binary files differ | |||
diff --git a/src/lib/libcrypto/pkcs7/p7/smime.p7s b/src/lib/libcrypto/pkcs7/p7/smime.p7s new file mode 100644 index 0000000000..2b5d4fb0e3 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/p7/smime.p7s | |||
| Binary files differ | |||
diff --git a/src/lib/libcrypto/pkcs7/pk7_dgst.c b/src/lib/libcrypto/pkcs7/pk7_dgst.c new file mode 100644 index 0000000000..90edfa5001 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/pk7_dgst.c | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | /* crypto/pkcs7/pk7_dgst.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/rand.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | #include <openssl/x509.h> | ||
| 65 | #include <openssl/pkcs7.h> | ||
| 66 | |||
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index 3bf1a367bb..451de84489 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -422,6 +422,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 422 | X509_ALGOR *enc_alg=NULL; | 422 | X509_ALGOR *enc_alg=NULL; |
| 423 | STACK_OF(X509_ALGOR) *md_sk=NULL; | 423 | STACK_OF(X509_ALGOR) *md_sk=NULL; |
| 424 | STACK_OF(PKCS7_RECIP_INFO) *rsk=NULL; | 424 | STACK_OF(PKCS7_RECIP_INFO) *rsk=NULL; |
| 425 | X509_ALGOR *xalg=NULL; | ||
| 425 | PKCS7_RECIP_INFO *ri=NULL; | 426 | PKCS7_RECIP_INFO *ri=NULL; |
| 426 | 427 | ||
| 427 | i=OBJ_obj2nid(p7->type); | 428 | i=OBJ_obj2nid(p7->type); |
| @@ -444,6 +445,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 444 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE); | 445 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE); |
| 445 | goto err; | 446 | goto err; |
| 446 | } | 447 | } |
| 448 | xalg=p7->d.signed_and_enveloped->enc_data->algorithm; | ||
| 447 | break; | 449 | break; |
| 448 | case NID_pkcs7_enveloped: | 450 | case NID_pkcs7_enveloped: |
| 449 | rsk=p7->d.enveloped->recipientinfo; | 451 | rsk=p7->d.enveloped->recipientinfo; |
| @@ -455,6 +457,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert) | |||
| 455 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE); | 457 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CIPHER_TYPE); |
| 456 | goto err; | 458 | goto err; |
| 457 | } | 459 | } |
| 460 | xalg=p7->d.enveloped->enc_data->algorithm; | ||
| 458 | break; | 461 | break; |
| 459 | default: | 462 | default: |
| 460 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CONTENT_TYPE); | 463 | PKCS7err(PKCS7_F_PKCS7_DATADECODE,PKCS7_R_UNSUPPORTED_CONTENT_TYPE); |
diff --git a/src/lib/libcrypto/pkcs7/pk7_enc.c b/src/lib/libcrypto/pkcs7/pk7_enc.c new file mode 100644 index 0000000000..acbb189c59 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/pk7_enc.c | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | /* crypto/pkcs7/pk7_enc.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/evp.h> | ||
| 62 | #include <openssl/rand.h> | ||
| 63 | #include <openssl/objects.h> | ||
| 64 | #include <openssl/x509.h> | ||
| 65 | #include <openssl/pkcs7.h> | ||
| 66 | |||
| 67 | PKCS7_in_bio(PKCS7 *p7,BIO *in); | ||
| 68 | PKCS7_out_bio(PKCS7 *p7,BIO *out); | ||
| 69 | |||
| 70 | PKCS7_add_signer(PKCS7 *p7,X509 *cert,EVP_PKEY *key); | ||
| 71 | PKCS7_cipher(PKCS7 *p7,EVP_CIPHER *cipher); | ||
| 72 | |||
| 73 | PKCS7_Init(PKCS7 *p7); | ||
| 74 | PKCS7_Update(PKCS7 *p7); | ||
| 75 | PKCS7_Finish(PKCS7 *p7); | ||
| 76 | |||
diff --git a/src/lib/libcrypto/pkcs7/pk7_lib.c b/src/lib/libcrypto/pkcs7/pk7_lib.c index d411269b50..3ca0952792 100644 --- a/src/lib/libcrypto/pkcs7/pk7_lib.c +++ b/src/lib/libcrypto/pkcs7/pk7_lib.c | |||
| @@ -591,6 +591,7 @@ X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si) | |||
| 591 | int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) | 591 | int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) |
| 592 | { | 592 | { |
| 593 | int i; | 593 | int i; |
| 594 | ASN1_OBJECT *objtmp; | ||
| 594 | PKCS7_ENC_CONTENT *ec; | 595 | PKCS7_ENC_CONTENT *ec; |
| 595 | 596 | ||
| 596 | i=OBJ_obj2nid(p7->type); | 597 | i=OBJ_obj2nid(p7->type); |
| @@ -613,6 +614,7 @@ int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) | |||
| 613 | PKCS7err(PKCS7_F_PKCS7_SET_CIPHER,PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); | 614 | PKCS7err(PKCS7_F_PKCS7_SET_CIPHER,PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER); |
| 614 | return(0); | 615 | return(0); |
| 615 | } | 616 | } |
| 617 | objtmp = OBJ_nid2obj(i); | ||
| 616 | 618 | ||
| 617 | ec->cipher = cipher; | 619 | ec->cipher = cipher; |
| 618 | return 1; | 620 | return 1; |
diff --git a/src/lib/libcrypto/pkcs7/server.pem b/src/lib/libcrypto/pkcs7/server.pem new file mode 100644 index 0000000000..750aac2094 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/server.pem | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | issuer= /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) | ||
| 2 | subject=/C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Server test cert (512 bit) | ||
| 3 | -----BEGIN CERTIFICATE----- | ||
| 4 | MIIB6TCCAVICAQAwDQYJKoZIhvcNAQEEBQAwWzELMAkGA1UEBhMCQVUxEzARBgNV | ||
| 5 | BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMRswGQYD | ||
| 6 | VQQDExJUZXN0IENBICgxMDI0IGJpdCkwHhcNOTcwNjA5MTM1NzQ2WhcNOTgwNjA5 | ||
| 7 | MTM1NzQ2WjBjMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDEaMBgG | ||
| 8 | A1UEChMRQ3J5cHRTb2Z0IFB0eSBMdGQxIzAhBgNVBAMTGlNlcnZlciB0ZXN0IGNl | ||
| 9 | cnQgKDUxMiBiaXQpMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJ+zw4Qnlf8SMVIP | ||
| 10 | Fe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVDTGiXav6ooKXfX3j/7tdkuD8Ey2// | ||
| 11 | Kv7+ue0CAwEAATANBgkqhkiG9w0BAQQFAAOBgQB4TMR2CvacKE9wAsu9jyCX8YiW | ||
| 12 | mgCM+YoP6kt4Zkj2z5IRfm7WrycKsnpnOR+tGeqAjkCeZ6/36o9l91RvPnN1VJ/i | ||
| 13 | xQv2df0KFeMr00IkDdTNAdIWqFkSsZTAY2QAdgenb7MB1joejquYzO2DQIO7+wpH | ||
| 14 | irObpESxAZLySCmPPg== | ||
| 15 | -----END CERTIFICATE----- | ||
| 16 | -----BEGIN RSA PRIVATE KEY----- | ||
| 17 | MIIBPAIBAAJBAJ+zw4Qnlf8SMVIPFe9GEcStgOY2Ww/dgNdhjeD8ckUJNP5VZkVD | ||
| 18 | TGiXav6ooKXfX3j/7tdkuD8Ey2//Kv7+ue0CAwEAAQJAN6W31vDEP2DjdqhzCDDu | ||
| 19 | OA4NACqoiFqyblo7yc2tM4h4xMbC3Yx5UKMN9ZkCtX0gzrz6DyF47bdKcWBzNWCj | ||
| 20 | gQIhANEoojVt7hq+SQ6MCN6FTAysGgQf56Q3TYoJMoWvdiXVAiEAw3e3rc+VJpOz | ||
| 21 | rHuDo6bgpjUAAXM+v3fcpsfZSNO6V7kCIQCtbVjanpUwvZkMI9by02oUk9taki3b | ||
| 22 | PzPfAfNPYAbCJQIhAJXNQDWyqwn/lGmR11cqY2y9nZ1+5w3yHGatLrcDnQHxAiEA | ||
| 23 | vnlEGo8K85u+KwIOimM48ZG8oTk7iFdkqLJR1utT3aU= | ||
| 24 | -----END RSA PRIVATE KEY----- | ||
diff --git a/src/lib/libcrypto/pkcs7/sign.c b/src/lib/libcrypto/pkcs7/sign.c new file mode 100644 index 0000000000..8b59885f7e --- /dev/null +++ b/src/lib/libcrypto/pkcs7/sign.c | |||
| @@ -0,0 +1,154 @@ | |||
| 1 | /* crypto/pkcs7/sign.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | #include <stdio.h> | ||
| 59 | #include <string.h> | ||
| 60 | #include <openssl/bio.h> | ||
| 61 | #include <openssl/x509.h> | ||
| 62 | #include <openssl/pem.h> | ||
| 63 | #include <openssl/err.h> | ||
| 64 | |||
| 65 | int main(argc,argv) | ||
| 66 | int argc; | ||
| 67 | char *argv[]; | ||
| 68 | { | ||
| 69 | X509 *x509; | ||
| 70 | EVP_PKEY *pkey; | ||
| 71 | PKCS7 *p7; | ||
| 72 | PKCS7_SIGNER_INFO *si; | ||
| 73 | BIO *in; | ||
| 74 | BIO *data,*p7bio; | ||
| 75 | char buf[1024*4]; | ||
| 76 | int i; | ||
| 77 | int nodetach=0; | ||
| 78 | |||
| 79 | #ifndef OPENSSL_NO_MD2 | ||
| 80 | EVP_add_digest(EVP_md2()); | ||
| 81 | #endif | ||
| 82 | #ifndef OPENSSL_NO_MD5 | ||
| 83 | EVP_add_digest(EVP_md5()); | ||
| 84 | #endif | ||
| 85 | #ifndef OPENSSL_NO_SHA1 | ||
| 86 | EVP_add_digest(EVP_sha1()); | ||
| 87 | #endif | ||
| 88 | #ifndef OPENSSL_NO_MDC2 | ||
| 89 | EVP_add_digest(EVP_mdc2()); | ||
| 90 | #endif | ||
| 91 | |||
| 92 | data=BIO_new(BIO_s_file()); | ||
| 93 | again: | ||
| 94 | if (argc > 1) | ||
| 95 | { | ||
| 96 | if (strcmp(argv[1],"-nd") == 0) | ||
| 97 | { | ||
| 98 | nodetach=1; | ||
| 99 | argv++; argc--; | ||
| 100 | goto again; | ||
| 101 | } | ||
| 102 | if (!BIO_read_filename(data,argv[1])) | ||
| 103 | goto err; | ||
| 104 | } | ||
| 105 | else | ||
| 106 | BIO_set_fp(data,stdin,BIO_NOCLOSE); | ||
| 107 | |||
| 108 | if ((in=BIO_new_file("server.pem","r")) == NULL) goto err; | ||
| 109 | if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err; | ||
| 110 | BIO_reset(in); | ||
| 111 | if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL) goto err; | ||
| 112 | BIO_free(in); | ||
| 113 | |||
| 114 | p7=PKCS7_new(); | ||
| 115 | PKCS7_set_type(p7,NID_pkcs7_signed); | ||
| 116 | |||
| 117 | si=PKCS7_add_signature(p7,x509,pkey,EVP_sha1()); | ||
| 118 | if (si == NULL) goto err; | ||
| 119 | |||
| 120 | /* If you do this then you get signing time automatically added */ | ||
| 121 | PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT, | ||
| 122 | OBJ_nid2obj(NID_pkcs7_data)); | ||
| 123 | |||
| 124 | /* we may want to add more */ | ||
| 125 | PKCS7_add_certificate(p7,x509); | ||
| 126 | |||
| 127 | /* Set the content of the signed to 'data' */ | ||
| 128 | PKCS7_content_new(p7,NID_pkcs7_data); | ||
| 129 | |||
| 130 | if (!nodetach) | ||
| 131 | PKCS7_set_detached(p7,1); | ||
| 132 | |||
| 133 | if ((p7bio=PKCS7_dataInit(p7,NULL)) == NULL) goto err; | ||
| 134 | |||
| 135 | for (;;) | ||
| 136 | { | ||
| 137 | i=BIO_read(data,buf,sizeof(buf)); | ||
| 138 | if (i <= 0) break; | ||
| 139 | BIO_write(p7bio,buf,i); | ||
| 140 | } | ||
| 141 | |||
| 142 | if (!PKCS7_dataFinal(p7,p7bio)) goto err; | ||
| 143 | BIO_free(p7bio); | ||
| 144 | |||
| 145 | PEM_write_PKCS7(stdout,p7); | ||
| 146 | PKCS7_free(p7); | ||
| 147 | |||
| 148 | exit(0); | ||
| 149 | err: | ||
| 150 | ERR_load_crypto_strings(); | ||
| 151 | ERR_print_errors_fp(stderr); | ||
| 152 | exit(1); | ||
| 153 | } | ||
| 154 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/3des.pem b/src/lib/libcrypto/pkcs7/t/3des.pem new file mode 100644 index 0000000000..b2b5081a10 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/3des.pem | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 3 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 4 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 5 | ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR+MA0GCSqGSIb3DQEBAQUABEC2vXI1xQDW6lUHM3zQ | ||
| 6 | /9uBEBOO5A3TtkrklAXq7v01gsIC21t52qSk36REXY+slhNZ0OQ349tgkTsoETHFLoEwMIHw | ||
| 7 | AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI | ||
| 8 | QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 9 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR9MA0G | ||
| 10 | CSqGSIb3DQEBAQUABEB8ujxbabxXUYJhopuDm3oDq4JNqX6Io4p3ro+ShqfIndsXTZ1v5a2N | ||
| 11 | WtLLCWlHn/habjBwZ/DgQgcKASbZ7QxNMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA | ||
| 12 | oAQIbsL5v1wX98KggAQoAaJ4WHm68fXY1WE5OIjfVBIDpO1K+i8dmKhjnAjrjoyZ9Bwc8rDL | ||
| 13 | lgQg4CXb805h5xl+GfvSwUaHJayte1m2mcOhs3J2YyqbQ+MEIMIiJQccmhO3oDKm36CFvYR8 | ||
| 14 | 5PjpclVcZyX2ngbwPFMnBAgy0clOAE6UKAAAAAAAAAAAAAA= | ||
| 15 | -----END PKCS7----- | ||
| 16 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/3dess.pem b/src/lib/libcrypto/pkcs7/t/3dess.pem new file mode 100644 index 0000000000..23f013516a --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/3dess.pem | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC | ||
| 3 | BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR | ||
| 4 | BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv | ||
| 5 | ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE | ||
| 6 | AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow | ||
| 7 | gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu | ||
| 8 | ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG | ||
| 9 | A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m | ||
| 10 | dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh | ||
| 11 | hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg | ||
| 12 | hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP | ||
| 13 | igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds | ||
| 14 | syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 15 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 16 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 17 | ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB | ||
| 18 | kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l | ||
| 19 | MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB | ||
| 20 | TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB | ||
| 21 | BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf | ||
| 22 | mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s | ||
| 23 | 8o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx | ||
| 24 | ggF7MIIBdwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP | ||
| 25 | BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ | ||
| 26 | REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB | ||
| 27 | AgIEfjAJBgUrDgMCGgUAoHowGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAbBgkqhkiG9w0B | ||
| 28 | CQ8xDjAMMAoGCCqGSIb3DQMHMBwGCSqGSIb3DQEJBTEPFw05ODA1MTQwMzM5MzdaMCMGCSqG | ||
| 29 | SIb3DQEJBDEWBBQstNMnSV26ba8PapQEDhO21yNFrjANBgkqhkiG9w0BAQEFAARAW9Xb9YXv | ||
| 30 | BfcNkutgFX9Gr8iXhBVsNtGEVrjrpkQwpKa7jHI8SjAlLhk/4RFwDHf+ISB9Np3Z1WDWnLcA | ||
| 31 | 9CWR6g== | ||
| 32 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/t/c.pem b/src/lib/libcrypto/pkcs7/t/c.pem new file mode 100644 index 0000000000..a4b55e321a --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/c.pem | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA | ||
| 2 | subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com | ||
| 3 | serial :047D | ||
| 4 | |||
| 5 | Certificate: | ||
| 6 | Data: | ||
| 7 | Version: 3 (0x2) | ||
| 8 | Serial Number: 1149 (0x47d) | ||
| 9 | Signature Algorithm: md5withRSAEncryption | ||
| 10 | Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA | ||
| 11 | Validity | ||
| 12 | Not Before: May 13 05:40:58 1998 GMT | ||
| 13 | Not After : May 12 05:40:58 2000 GMT | ||
| 14 | Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com | ||
| 15 | Subject Public Key Info: | ||
| 16 | Public Key Algorithm: rsaEncryption | ||
| 17 | Modulus: | ||
| 18 | 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81: | ||
| 19 | 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc: | ||
| 20 | 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29: | ||
| 21 | fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f: | ||
| 22 | e7:e7:0c:4d:0b | ||
| 23 | Exponent: 65537 (0x10001) | ||
| 24 | X509v3 extensions: | ||
| 25 | Netscape Comment: | ||
| 26 | Generated with SSLeay | ||
| 27 | Signature Algorithm: md5withRSAEncryption | ||
| 28 | 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55: | ||
| 29 | f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97: | ||
| 30 | d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b: | ||
| 31 | 50:74:ad:92:cb:4e:90:e5:fa:7d | ||
| 32 | |||
| 33 | -----BEGIN CERTIFICATE----- | ||
| 34 | MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV | ||
| 35 | MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE | ||
| 36 | ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E | ||
| 37 | IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw | ||
| 38 | NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK | ||
| 39 | UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 40 | dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0 | ||
| 41 | aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG | ||
| 42 | 9w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf | ||
| 43 | lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB | ||
| 44 | hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA | ||
| 45 | UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8 | ||
| 46 | 4A3ZItobUHStkstOkOX6fQ== | ||
| 47 | -----END CERTIFICATE----- | ||
| 48 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/ff b/src/lib/libcrypto/pkcs7/t/ff new file mode 100644 index 0000000000..23f013516a --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/ff | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC | ||
| 3 | BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR | ||
| 4 | BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv | ||
| 5 | ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE | ||
| 6 | AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow | ||
| 7 | gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu | ||
| 8 | ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG | ||
| 9 | A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m | ||
| 10 | dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh | ||
| 11 | hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg | ||
| 12 | hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP | ||
| 13 | igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds | ||
| 14 | syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 15 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 16 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 17 | ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB | ||
| 18 | kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l | ||
| 19 | MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB | ||
| 20 | TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB | ||
| 21 | BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf | ||
| 22 | mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s | ||
| 23 | 8o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx | ||
| 24 | ggF7MIIBdwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP | ||
| 25 | BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ | ||
| 26 | REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB | ||
| 27 | AgIEfjAJBgUrDgMCGgUAoHowGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAbBgkqhkiG9w0B | ||
| 28 | CQ8xDjAMMAoGCCqGSIb3DQMHMBwGCSqGSIb3DQEJBTEPFw05ODA1MTQwMzM5MzdaMCMGCSqG | ||
| 29 | SIb3DQEJBDEWBBQstNMnSV26ba8PapQEDhO21yNFrjANBgkqhkiG9w0BAQEFAARAW9Xb9YXv | ||
| 30 | BfcNkutgFX9Gr8iXhBVsNtGEVrjrpkQwpKa7jHI8SjAlLhk/4RFwDHf+ISB9Np3Z1WDWnLcA | ||
| 31 | 9CWR6g== | ||
| 32 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-e b/src/lib/libcrypto/pkcs7/t/msie-e new file mode 100644 index 0000000000..aafae69fc9 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-e | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | |||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHCMIHMAgEAMHYwYjERMA8GA1UEBxMISW50ZXJuZXQxFzAV | ||
| 3 | BgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5k | ||
| 4 | aXZpZHVhbCBTdWJzY3JpYmVyAhBgQJiC3qfbCbjdj5INYLnKMA0GCSqGSIb3DQEBAQUABECMzu8y | ||
| 5 | wQ/qZbO8cAGMRBF+mPruv3+Dvb9aWNZ2k8njUgqF6mcdhVB2MkGcsG3memRXJBixvMYWVkU3qK4Z | ||
| 6 | VuKsMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UE | ||
| 7 | BxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 8 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqG | ||
| 9 | SIb3DQEBAQUABEBcWwYFHJbJGhiztt7lzue3Lc9CH5WAbyR+2BZ3uv+JxZfRs1PuaWPOwRa0Vgs3 | ||
| 10 | YwSJoRfxQj2Gk0wFqG1qt6d1MIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIAoAQI8vRlP/Nx | ||
| 11 | 2iSggASCAZhR5srxyspy7DfomRJ9ff8eMCtaNwEoEx7G25PZRonC57hBvGoScLtEPU3Wp9FEbPN7 | ||
| 12 | oJESeC+AqMTyTLNy8aQsyC5s53E9UkoIvg62ekYZBbXZqXsrxx4PhiiX3NH8GVh42phB0Chjw0nK | ||
| 13 | HZeRDmxGY3Cmk+J+l0uVKxbNIfJIKOguLBnhqmnKH/PrnzDt591u0ULy2aTLqRm+4/1Yat/QPb6J | ||
| 14 | eoKGwNPBbS9ogBdrCNCp9ZFg3Xar2AtQHzyTQIfYeH3SRQUpKmRm5U5o9p5emgEdT+ZfJm/J4tSH | ||
| 15 | OmbgAFsbHQakA4MBZ4J5qfDJhOA2g5lWk1hIeu5Dn/AaLRZd0yz3oY0Ieo/erPWx/bCqtBzYbMe9 | ||
| 16 | qSFTedKlbc9EGe3opOTdBZVzK8KH3w3zsy5luxKdOUG59YYb5F1IZiWGiDyuo/HuacX+griu5LeD | ||
| 17 | bEzOtZnko+TZXvWIko30fD79j3T4MRRhWXbgj2HKza+4vJ0mzcC/1+GPsJjAEAA/JgIEDU4w6/DI | ||
| 18 | /HQHhLAO3G+9xKD7MvmrzkoAAAAAAAAAAAAA | ||
| 19 | |||
| 20 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-e.pem b/src/lib/libcrypto/pkcs7/t/msie-e.pem new file mode 100644 index 0000000000..a2a5e24e74 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-e.pem | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIAGCSqGSIb3DQEHA6CAMIIDkAIBADGCAcIwgcwCAQAwdjBiMREwDwYDVQQHEwhJ | ||
| 3 | bnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlT | ||
| 4 | aWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXICEGBAmILep9sJ | ||
| 5 | uN2Pkg1gucowDQYJKoZIhvcNAQEBBQAEQIzO7zLBD+pls7xwAYxEEX6Y+u6/f4O9 | ||
| 6 | v1pY1naTyeNSCoXqZx2FUHYyQZywbeZ6ZFckGLG8xhZWRTeorhlW4qwwgfACAQAw | ||
| 7 | gZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH | ||
| 8 | EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsT | ||
| 9 | GURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBW | ||
| 10 | QUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQFxbBgUclskaGLO23uXO57ctz0If | ||
| 11 | lYBvJH7YFne6/4nFl9GzU+5pY87BFrRWCzdjBImhF/FCPYaTTAWobWq3p3UwggHD | ||
| 12 | BgkqhkiG9w0BBwEwGgYIKoZIhvcNAwIwDgICAKAECPL0ZT/zcdokgIIBmFHmyvHK | ||
| 13 | ynLsN+iZEn19/x4wK1o3ASgTHsbbk9lGicLnuEG8ahJwu0Q9Tdan0URs83ugkRJ4 | ||
| 14 | L4CoxPJMs3LxpCzILmzncT1SSgi+DrZ6RhkFtdmpeyvHHg+GKJfc0fwZWHjamEHQ | ||
| 15 | KGPDScodl5EObEZjcKaT4n6XS5UrFs0h8kgo6C4sGeGqacof8+ufMO3n3W7RQvLZ | ||
| 16 | pMupGb7j/Vhq39A9vol6gobA08FtL2iAF2sI0Kn1kWDddqvYC1AfPJNAh9h4fdJF | ||
| 17 | BSkqZGblTmj2nl6aAR1P5l8mb8ni1Ic6ZuAAWxsdBqQDgwFngnmp8MmE4DaDmVaT | ||
| 18 | WEh67kOf8BotFl3TLPehjQh6j96s9bH9sKq0HNhsx72pIVN50qVtz0QZ7eik5N0F | ||
| 19 | lXMrwoffDfOzLmW7Ep05Qbn1hhvkXUhmJYaIPK6j8e5pxf6CuK7kt4NsTM61meSj | ||
| 20 | 5Nle9YiSjfR8Pv2PdPgxFGFZduCPYcrNr7i8nSbNwL/X4Y+wmMAQAD8mAgQNTjDr | ||
| 21 | 8Mj8dAeEsA7cb73EoPsy+avOSgAAAAA= | ||
| 22 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-01 b/src/lib/libcrypto/pkcs7/t/msie-enc-01 new file mode 100644 index 0000000000..2c93ab6462 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-enc-01 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | |||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxgfMwgfACAQAwgZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYD | ||
| 3 | VQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0 | ||
| 4 | IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMT | ||
| 5 | EkRFTU8gWkVSTyBWQUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQKvMaW8xh6oF/X+CJivz | ||
| 6 | IZV7yHxlp4O3NHQtWG0A8MOZB+CtKlU7/6g5e/a9Du/TOqxRMqtYRp63pa2Q/mM4IYMwgAYJ | ||
| 7 | KoZIhvcNAQcBMBoGCCqGSIb3DQMCMA4CAgCgBAifz6RvzOPYlKCABIGwxtGA/FLBBRs1wbBP | ||
| 8 | gDCbSG0yCwjJNsFg89/k6xuXo8c5YTwsw8+XlIVq03navpew6XxxzY090rD2OJ0t6HA6GqrI | ||
| 9 | pd8WiSh/Atqn0yfLFmkLqgIAPRfzxUxqUocxLpQsLIFp2YNUGE+yps+UZmIjw/WHfdqrcWTm | ||
| 10 | STSvKuy3UkIJZCkGDBpTvqk4BFaHh4oTXEpgpNY+GKxjf9TDN9GQPqQZR7sgQki4t2g4/Saq | ||
| 11 | Kl4EMISgluk6swdND0tiHY7v5d6YR29ePCl2/STJ98eJpWkEEC22GNNvOy7ru/Rv2He4MgQg | ||
| 12 | optd7sk9MMd9xhJppg7CcH/yDx//HrtgpOcWmn6VxpgECFqon4uXkQtIBIH4PaNclFn7/hLx | ||
| 13 | Pw2VmBGaC0SYF3U1jyN96EBxdjqy8Aa6ByMXYDW5BcfqniD5mYXfw+b81lh1kutxaPaV4YJ9 | ||
| 14 | ZlRUW752N7VHo/fG0/fukoe5W9a8kIhgLpygllb/GP4oSF4wM6n1/OgRzZj2IWFiobKO4d/t | ||
| 15 | Mnh+C+PoEVAuFZcxQwi9GqvsK5OoIjVwNx0XcVSOl1TTYS9SwC7ugMBCab73JiruC24pL78Y | ||
| 16 | M+NaIpIQ3On4DokJA2ZHtjBjZIxF4tKA144RvFN6pBd6TVE5XM6KD/Vh9bjSmujtEAfdQ3Te | ||
| 17 | dvKJsbZuu0stErbvWcRy11I328l557EECAJT7d44OJ3rBBBj6bnnx6dDU2SRqp2CEoQaBAhK | ||
| 18 | RBuyhNxkygQIOY9/NhwqAJAECOvX0Zd0DqgoBAjobPpMHhVV3gQQWLU2vEoZ51BwzxdzCmxO | ||
| 19 | wwQI4oKfudaNqoAESKzBNAqv5kGumHOlMKsRfrs7jZCcSaOuEj97pYx08FLEgF23cav39MOQ | ||
| 20 | NUEM1dNU+EYslL4o3RoSHRjUgPU+2t9c0prS9A/bPARIEOP94PynaTNxwHi3VTK7SzuQmgzA | ||
| 21 | 4n942E9joSiqsQPlsKAb3sPUaLC3SuUxSjNBgfpvD0bmrA/5h+WZoYXvIogFpwjkSmnFBEie | ||
| 22 | 0lh5Ov1aRrvCw5/j3Q/W/4ZtN5U+aeVBJMtA8n0Mxd5kPxHbNVh4oGprZ6wEegV8ht3voyZa | ||
| 23 | mZ5Cyxc8ffMYnM/JJI6/oEYEUEMyyiS5FnYyvxKzfMtyn2lZ2st9nZGNNgMc9N62r5HgNbdD | ||
| 24 | FHuRdKKzV+8kQfuMc3mOPpK1t9TFY+QgrxiB5p6S7VooI97YtP3PbfknszCEBEh4PdXYbbaR | ||
| 25 | 3AacN3Q5kYYmWsq3WW6xgrg0mmEGosGvwSQxBBuiXZrxScCa4ivEq05UZwyShePvKduOvnUE | ||
| 26 | 2zDO6IXFLZxhTZAESEm9/FovLgGAiJ7iMGmYvsISLJScwG4n+wrSaQNQXizs9N3ykys54wBN | ||
| 27 | d/+BQ4F7pncHhDQ2Dyt5MekB8Y8iNOocUTFCu524vQRIaWCXmXP3vU7D21dp0XnAMzRQJ565 | ||
| 28 | JV3aHRoY7XDa4LePa7PP9ywyafOE5yCW7ndqx3J+2JhTDvSFsW8/q3H3iyeFhykuJVS6BFDK | ||
| 29 | 6CmKbnyyjOfE2iLGJmTFa905V2KrVDCmlEu/xyGMs80yTyZC+ySzM83FMVvLEQmSzcTNUZVp | ||
| 30 | DfA1kNXbXkPouBXXT6g8r8JCRljaKKABmgRIlMheOJQRUUU4cgvhMreXPayhq5Ao4VMSCkA5 | ||
| 31 | hYRCBczm4Di/MMohF0SxIsdRY6gY9CPnrBXAsY6h1RbR7Tw0iQZmeXi52DCiBEj0by+SYMAa | ||
| 32 | 9z0CReIzl8JLL6EVIFz8kFxlkGWjr4dnOzhhPOq/mCpp0WxbavDfdhE87MdXJZBnLwoT62QG | ||
| 33 | 955HlAoEQBOGJbcESCgd5XSirZ9Y3AbCfuKOqoMBvEUGn+w/pMaqnGvnr5FZhuBDKrhRXqtx | ||
| 34 | QsxA//drGUxsrZOuSL/0+fbvo7n2h1Z8Ny86jOvVZAQIAjw2l1Yc5RAESNc9i3I8pKEOVQf/ | ||
| 35 | UBczJ0NR9aTEF80dRg2lpXwD0ho4N0AvSiVbgxC7cPZHQwIqvq9LHRUs/4n+Vu3SVYU3cAxo | ||
| 36 | lUTiCGUSlARIF+TD57SI5+RI+MNtnD9rs4E1ml51YoHGWFj3UPriDmY0FKEwIgqtMXMY3fZ9 | ||
| 37 | Kq8d83bjDzxwbDX7WwR7KbSeJWT42pCz7kM+BEjjPsOnZHuusXT3x2rrsBnYtYsbt98mSFiS | ||
| 38 | KzTtFmXfkOBbCQdit1P76QnYJ1aXMGs6zP6GypQTadK/zYWvlm38QkVwueaJ0woESKW2pqKA | ||
| 39 | 70h2UMDHOrpepU1lj0YMzmotDHSTU3L909VvUMNg9uqfrQ6mSkb9j5Tl8oF2otOw5EzA1Yda | ||
| 40 | KPmgsv62RWLYl80wXQRQwG0e/mgG75jp9lOhJdVXqcYbQpS9viwVaVkwH+69mu/bQI4gjoEs | ||
| 41 | UYX6O71Re2z+cYhcm9UrK+DXuSFBXQOIlAFxKMW4B0apd6fU84FsZLMESOorXE5OE0A2B2ji | ||
| 42 | J8QI0Exk4hUvWrMNJfUZwFyS7E05xV9ORuX1xmsKqkT4tVR5Nqln4vhvAY860VBoloz0CDkd | ||
| 43 | 8seSBEjeMgRI9FvpYuflIeHg9urkwp6N+1f0DrJJhJY9ZQ0HTQhziJmIfvbEjNqCl7hEC28+ | ||
| 44 | F8I5tuViLgfSwcFFCvnS6WFoN4X6QdFdqMCbBEjdlI1c+IQGA/IuTDMJYCuQ/v+8BG5ZeWVH | ||
| 45 | icPZmXfRat9eFK1dGKAJef6+Tf9HPuDjSpDyffrifsp7Dc34lmm7GN1+ON3ZMtwEUNm6epb8 | ||
| 46 | 1RKWjoI7jIKUV/M2p/0eeGSqs4b06KF/VR6dBwsJVL5DpnTsp3MV4j/CAOlRdSPZ5++tsKbM | ||
| 47 | aplk+ceqQtpEFz1MYTtVV4+rlrWaBEA1okJyNZ5/tNOwM7B+XfOZ0xw+uyVi9v4byTZM2Qds | ||
| 48 | J+d3YGYLAugTGHISLqQEerD8/gGK+/SL06b2gNedXPHtBAiBKX+Mdy3wFQQIqE9gVgvrFNUE | ||
| 49 | CKKoTFoMGqnPBAjDPgLCklNfrwQI3Ek1vSq68w8ECBodu2FOZJVkBAgzwjfSr2N9WQQQTCoQ | ||
| 50 | KkAbrS9tnjXn1I3+ZwQIrPx3eINo/YUECIeYWCFskxlYBAiDUdvZXwD3vgQIkEyZbbZWbUUE | ||
| 51 | CH4+odl1Isk3BBj68fkqJ0fKJRWVLWuW/O3VE4BOPKwFlaIECFseVTdDUho8BAj+cOKvV2WA | ||
| 52 | hgQgaXr+wwq+ItblG0Qxz8IVUXX6PV2mIdHwz4SCCvnCsaIECJhBYxdfLI/XBCDswamPn9MR | ||
| 53 | yXi2HVQBineV+GtWVkIoZ2dCLFB9mQRMoAQI0nUR5a5AOJoECA+AunKlAlx8BAi5RtFeF4g1 | ||
| 54 | FQQIz/ie+16LlQcECOmNuVg5DXjMBAjH2nkfpXZgWwQIVdLuO/+kuHAECO/5rEHmyI9vBBD4 | ||
| 55 | 16BU4Rd3YerDQnHtrwOQBCCkho1XxK5Maz8KLCNi20wvcGt8wsIXlj2h5q9ITBq7IgQQvKVY | ||
| 56 | 4OfJ7bKbItP2dylwQgQYPIGxwkkbRXNraONYvN19G8UdF35rFOuIBAjf0sKz/618ZQQIxObr | ||
| 57 | xJkRe0sECIC+ssnjEb2NBBBI+XM4OntVWGsRV9Td3sFgBAinGwIroo8O0gQQMGAwgc9PaLaG | ||
| 58 | gBCiwSTrYQQIVHjfCQgOtygEUIoraFoANfhZgIShpOd/RRxFU4/7xZR5tMdGoYz/g0thR0lM | ||
| 59 | +Hi88FtFD4mAh/Oat4Ri8B7bv04aokjN2UHz6nPbHHjZ8zIqpbYTCy043GNZBAhOqjyB2JbD | ||
| 60 | NwQoR23XCYD9x6E20ChHJRXmaHwyMdYXKl5CUxypl7ois+sy2D7jDukS3wQIsTyyPgJi0GsA | ||
| 61 | AAAAAAAAAAAA | ||
| 62 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-01.pem b/src/lib/libcrypto/pkcs7/t/msie-enc-01.pem new file mode 100644 index 0000000000..9abf00b2f2 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-enc-01.pem | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIAGCSqGSIb3DQEHA6CAMIILyAIBADGB8zCB8AIBADCBmTCBkjELMAkGA1UEBhMC | ||
| 3 | QVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYD | ||
| 4 | VQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB | ||
| 5 | TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBAgIEbjANBgkq | ||
| 6 | hkiG9w0BAQEFAARAq8xpbzGHqgX9f4ImK/MhlXvIfGWng7c0dC1YbQDww5kH4K0q | ||
| 7 | VTv/qDl79r0O79M6rFEyq1hGnrelrZD+YzghgzCCCssGCSqGSIb3DQEHATAaBggq | ||
| 8 | hkiG9w0DAjAOAgIAoAQIn8+kb8zj2JSAggqgxtGA/FLBBRs1wbBPgDCbSG0yCwjJ | ||
| 9 | NsFg89/k6xuXo8c5YTwsw8+XlIVq03navpew6XxxzY090rD2OJ0t6HA6GqrIpd8W | ||
| 10 | iSh/Atqn0yfLFmkLqgIAPRfzxUxqUocxLpQsLIFp2YNUGE+yps+UZmIjw/WHfdqr | ||
| 11 | cWTmSTSvKuy3UkIJZCkGDBpTvqk4BFaHh4oTXEpgpNY+GKxjf9TDN9GQPqQZR7sg | ||
| 12 | Qki4t2g4/SaqKl6EoJbpOrMHTQ9LYh2O7+XemEdvXjwpdv0kyffHiaVpBBAtthjT | ||
| 13 | bzsu67v0b9h3uDKim13uyT0wx33GEmmmDsJwf/IPH/8eu2Ck5xaafpXGmFqon4uX | ||
| 14 | kQtIPaNclFn7/hLxPw2VmBGaC0SYF3U1jyN96EBxdjqy8Aa6ByMXYDW5BcfqniD5 | ||
| 15 | mYXfw+b81lh1kutxaPaV4YJ9ZlRUW752N7VHo/fG0/fukoe5W9a8kIhgLpygllb/ | ||
| 16 | GP4oSF4wM6n1/OgRzZj2IWFiobKO4d/tMnh+C+PoEVAuFZcxQwi9GqvsK5OoIjVw | ||
| 17 | Nx0XcVSOl1TTYS9SwC7ugMBCab73JiruC24pL78YM+NaIpIQ3On4DokJA2ZHtjBj | ||
| 18 | ZIxF4tKA144RvFN6pBd6TVE5XM6KD/Vh9bjSmujtEAfdQ3TedvKJsbZuu0stErbv | ||
| 19 | WcRy11I328l557ECU+3eODid62PpuefHp0NTZJGqnYIShBpKRBuyhNxkyjmPfzYc | ||
| 20 | KgCQ69fRl3QOqCjobPpMHhVV3li1NrxKGedQcM8XcwpsTsPigp+51o2qgKzBNAqv | ||
| 21 | 5kGumHOlMKsRfrs7jZCcSaOuEj97pYx08FLEgF23cav39MOQNUEM1dNU+EYslL4o | ||
| 22 | 3RoSHRjUgPU+2t9c0prS9A/bPBDj/eD8p2kzccB4t1Uyu0s7kJoMwOJ/eNhPY6Eo | ||
| 23 | qrED5bCgG97D1Giwt0rlMUozQYH6bw9G5qwP+YflmaGF7yKIBacI5EppxZ7SWHk6 | ||
| 24 | /VpGu8LDn+PdD9b/hm03lT5p5UEky0DyfQzF3mQ/Eds1WHigamtnrAR6BXyG3e+j | ||
| 25 | JlqZnkLLFzx98xicz8kkjr+gRkMyyiS5FnYyvxKzfMtyn2lZ2st9nZGNNgMc9N62 | ||
| 26 | r5HgNbdDFHuRdKKzV+8kQfuMc3mOPpK1t9TFY+QgrxiB5p6S7VooI97YtP3Pbfkn | ||
| 27 | szCEeD3V2G22kdwGnDd0OZGGJlrKt1lusYK4NJphBqLBr8EkMQQbol2a8UnAmuIr | ||
| 28 | xKtOVGcMkoXj7ynbjr51BNswzuiFxS2cYU2QSb38Wi8uAYCInuIwaZi+whIslJzA | ||
| 29 | bif7CtJpA1BeLOz03fKTKznjAE13/4FDgXumdweENDYPK3kx6QHxjyI06hxRMUK7 | ||
| 30 | nbi9aWCXmXP3vU7D21dp0XnAMzRQJ565JV3aHRoY7XDa4LePa7PP9ywyafOE5yCW | ||
| 31 | 7ndqx3J+2JhTDvSFsW8/q3H3iyeFhykuJVS6yugpim58soznxNoixiZkxWvdOVdi | ||
| 32 | q1QwppRLv8chjLPNMk8mQvskszPNxTFbyxEJks3EzVGVaQ3wNZDV215D6LgV10+o | ||
| 33 | PK/CQkZY2iigAZqUyF44lBFRRThyC+Eyt5c9rKGrkCjhUxIKQDmFhEIFzObgOL8w | ||
| 34 | yiEXRLEix1FjqBj0I+esFcCxjqHVFtHtPDSJBmZ5eLnYMKL0by+SYMAa9z0CReIz | ||
| 35 | l8JLL6EVIFz8kFxlkGWjr4dnOzhhPOq/mCpp0WxbavDfdhE87MdXJZBnLwoT62QG | ||
| 36 | 955HlAoEQBOGJbcoHeV0oq2fWNwGwn7ijqqDAbxFBp/sP6TGqpxr56+RWYbgQyq4 | ||
| 37 | UV6rcULMQP/3axlMbK2Trki/9Pn276O59odWfDcvOozr1WQCPDaXVhzlENc9i3I8 | ||
| 38 | pKEOVQf/UBczJ0NR9aTEF80dRg2lpXwD0ho4N0AvSiVbgxC7cPZHQwIqvq9LHRUs | ||
| 39 | /4n+Vu3SVYU3cAxolUTiCGUSlBfkw+e0iOfkSPjDbZw/a7OBNZpedWKBxlhY91D6 | ||
| 40 | 4g5mNBShMCIKrTFzGN32fSqvHfN24w88cGw1+1sEeym0niVk+NqQs+5DPuM+w6dk | ||
| 41 | e66xdPfHauuwGdi1ixu33yZIWJIrNO0WZd+Q4FsJB2K3U/vpCdgnVpcwazrM/obK | ||
| 42 | lBNp0r/Nha+WbfxCRXC55onTCqW2pqKA70h2UMDHOrpepU1lj0YMzmotDHSTU3L9 | ||
| 43 | 09VvUMNg9uqfrQ6mSkb9j5Tl8oF2otOw5EzA1YdaKPmgsv62RWLYl80wXcBtHv5o | ||
| 44 | Bu+Y6fZToSXVV6nGG0KUvb4sFWlZMB/uvZrv20COII6BLFGF+ju9UXts/nGIXJvV | ||
| 45 | Kyvg17khQV0DiJQBcSjFuAdGqXen1POBbGSz6itcTk4TQDYHaOInxAjQTGTiFS9a | ||
| 46 | sw0l9RnAXJLsTTnFX05G5fXGawqqRPi1VHk2qWfi+G8BjzrRUGiWjPQIOR3yx5IE | ||
| 47 | SN4y9FvpYuflIeHg9urkwp6N+1f0DrJJhJY9ZQ0HTQhziJmIfvbEjNqCl7hEC28+ | ||
| 48 | F8I5tuViLgfSwcFFCvnS6WFoN4X6QdFdqMCb3ZSNXPiEBgPyLkwzCWArkP7/vARu | ||
| 49 | WXllR4nD2Zl30WrfXhStXRigCXn+vk3/Rz7g40qQ8n364n7Kew3N+JZpuxjdfjjd | ||
| 50 | 2TLc2bp6lvzVEpaOgjuMgpRX8zan/R54ZKqzhvTooX9VHp0HCwlUvkOmdOyncxXi | ||
| 51 | P8IA6VF1I9nn762wpsxqmWT5x6pC2kQXPUxhO1VXj6uWtZo1okJyNZ5/tNOwM7B+ | ||
| 52 | XfOZ0xw+uyVi9v4byTZM2QdsJ+d3YGYLAugTGHISLqQEerD8/gGK+/SL06b2gNed | ||
| 53 | XPHtgSl/jHct8BWoT2BWC+sU1aKoTFoMGqnPwz4CwpJTX6/cSTW9KrrzDxodu2FO | ||
| 54 | ZJVkM8I30q9jfVlMKhAqQButL22eNefUjf5nrPx3eINo/YWHmFghbJMZWINR29lf | ||
| 55 | APe+kEyZbbZWbUV+PqHZdSLJN/rx+SonR8olFZUta5b87dUTgE48rAWVolseVTdD | ||
| 56 | Uho8/nDir1dlgIZpev7DCr4i1uUbRDHPwhVRdfo9XaYh0fDPhIIK+cKxophBYxdf | ||
| 57 | LI/X7MGpj5/TEcl4th1UAYp3lfhrVlZCKGdnQixQfZkETKDSdRHlrkA4mg+AunKl | ||
| 58 | Alx8uUbRXheINRXP+J77XouVB+mNuVg5DXjMx9p5H6V2YFtV0u47/6S4cO/5rEHm | ||
| 59 | yI9v+NegVOEXd2Hqw0Jx7a8DkKSGjVfErkxrPwosI2LbTC9wa3zCwheWPaHmr0hM | ||
| 60 | GrsivKVY4OfJ7bKbItP2dylwQjyBscJJG0Vza2jjWLzdfRvFHRd+axTriN/SwrP/ | ||
| 61 | rXxlxObrxJkRe0uAvrLJ4xG9jUj5czg6e1VYaxFX1N3ewWCnGwIroo8O0jBgMIHP | ||
| 62 | T2i2hoAQosEk62FUeN8JCA63KIoraFoANfhZgIShpOd/RRxFU4/7xZR5tMdGoYz/ | ||
| 63 | g0thR0lM+Hi88FtFD4mAh/Oat4Ri8B7bv04aokjN2UHz6nPbHHjZ8zIqpbYTCy04 | ||
| 64 | 3GNZTqo8gdiWwzdHbdcJgP3HoTbQKEclFeZofDIx1hcqXkJTHKmXuiKz6zLYPuMO | ||
| 65 | 6RLfsTyyPgJi0GsAAAAA | ||
| 66 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-02 b/src/lib/libcrypto/pkcs7/t/msie-enc-02 new file mode 100644 index 0000000000..7017055965 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-enc-02 | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | |||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHCMIHMAgEAMHYwYjERMA8GA1UEBxMISW50ZXJuZXQxFzAV | ||
| 3 | BgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5k | ||
| 4 | aXZpZHVhbCBTdWJzY3JpYmVyAhBgQJiC3qfbCbjdj5INYLnKMA0GCSqGSIb3DQEBAQUABEACr4tn | ||
| 5 | kSzvo3aIlHfJLGbfokNCV6FjdDP1vQhL+kdXONqcFCEf9ReETCvaHslIr/Wepc5j2hjZselzgqLn | ||
| 6 | rM1ZMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UE | ||
| 7 | BxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 8 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqG | ||
| 9 | SIb3DQEBAQUABEBanBxKOvUoRn3DiFY55lly2TPu2Cv+dI/GLrzW6qvnUMZPWGPGaUlPyWLMZrXJ | ||
| 10 | xGXZUiRJKTBwDu91fnodUEK9MIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIAoAQImxKZEDWP | ||
| 11 | EuOggASCBACBi1bX/qc3geqFyfRpX7JyIo/g4CDr62GlwvassAGlIO8zJ5Z/UDIIooeV6QS4D4OW | ||
| 12 | PymKd0WXhwcJI0yBcJTWEoxND27LM7CWFJpA07AoxVCRHTOPgm794NynLecNUOqVTFyS4CRuLhVG | ||
| 13 | PAk0nFZG/RE2yMtx4rAkSiVgOexES7wq/xWuoDSSmuTMNQOTbKfkEKqdFLkM/d62gD2wnaph7vKk | ||
| 14 | PPK82wdZP8rF3nUUC5c4ahbNoa8g+5B3tIF/Jz3ZZK3vGLU0IWO+i7W451dna13MglDDjXOeikNl | ||
| 15 | XLsQdAVo0nsjfGu+f66besJojPzysNA+IEZl6gNWUetl9lim4SqrxubUExdS2rmXnXXmEuEW/HC7 | ||
| 16 | dlTAeYq5Clqx5id6slhC2C2oegMww3XH9yxHw6OqzvXY6pVPEScEtBMQLgaKFQT+m2SRtbTVFG7c | ||
| 17 | QcnUODyVB1IbpQTF1DHeeOX1W/HfpWZym8dzkti6SCyeumHmqO406xDiIMVKtHOqM86nEHuAMZsr | ||
| 18 | cLy+ey6TEJvR6S4N8QRzng8JJDZDTJXQN6q84aEudsnOrw2KyOVwPpI6ey4qBsHUgQ8kAFy5lsQa | ||
| 19 | WV45h6exgUwbBcKLgPZGFj+OdD2RKJsTb83/UqbJS5Q/lGXhzBlnaYucyJxEprRxbntmcnOEPFJe | ||
| 20 | +tRDUwOTd7qlJljdhIJL+uDcooL9Ahgo6Cwep6tduekv2cSEohJeTE8Dvy34YRhMbLvnFNdmnpNy | ||
| 21 | rNZDYVVxxaKoyd2AfB8NPFZh1VdAYfI3R1QAQ2kXEef5NNIfVQfMzD9akJn4RP+Kv32Qaxm4FrnK | ||
| 22 | xmwRyGJShavIBc2ax+F1r1+NZXuSBHn5vfoRTxOk0ST4dXsw74dnlYUMRaSu4qqUdM9jsXSyeX4Z | ||
| 23 | gQgkR2bkaYO6ezFgenFIa7QWVw8rXZAEZ5aibCxbnY1VE41PYIvhlLdbFJhH9gY22s+fFAuwnzyA | ||
| 24 | SRjC40A9aAEItRlaPStWSGiqlLRgNkBBwdpv2l2YPBd2QzHx6ek6XGrvRJuAC+Nh62rtQKwpNH54 | ||
| 25 | YAOHW55maBFW2SQ3TF+cZ6NbbqhCmHTyyR7mcSYc9sXSVDWEhYKQ1iyU870zhHWVpvglZizZetJC | ||
| 26 | ZFjYex3b1ngVdcgargOvpPq9urCKKi2mbkqv/EFpzSWGXkKSpfCG/XfMnEOtkNrB8S06vnk2JcJB | ||
| 27 | OBqJot+uuSH5hOg0vTpxX2DuONJSiWSWyfRE/lTfJJFXwhod7SXclUyXPeSyibcSic2hVAzDmwjD | ||
| 28 | 31js/j2k02PI/agPhr3UQ8cMgcNAiaoCKbNaWfn6BGbCAbTchxzUlo2cSJiLlrX2IDZmfXbXmZCo | ||
| 29 | m1smWIG+BIIEALiuAxDb6dWLAYyVBoN9hYI4AiPeZAY9MtvQ6AV8o2/EFm6PvYGXy3Hei5830CH0 | ||
| 30 | PBeX7Kdd6ff1y33TW/l5qSkIL1ULTGR7okFfJePHDmq1dFt6/JOMptiQ8WSu7CsJQvZ9VTFXeYFc | ||
| 31 | ZqCPPZc1NrPegNK70Zf9QxWIbDAevJ5KLBf1c6j8pU2/6LnvDY6VjaTvYSgr7vTR8eVzH4Rm77W0 | ||
| 32 | iOHxg5VcODv6cGSVyuvbX8UAGo8Cmb58ERDtBDJBQXVpWKLNAuDJ9GX8n2zNkpjZLbPSkcmuhqGa | ||
| 33 | BJBE/BaCTkUQWlY9dIbRtEnxIU1mfbPPdx1Ppa8DqGDjSOsQdKcKYNNZtayEw++EIpmpdBNsKphC | ||
| 34 | fB8UEK2Wkk4ZVW+qyGoi/r0MFsvO1NmSOOZ0o/jy/YHmoeURHhPy97AO3eVTkEAa5CfJEJybmo56 | ||
| 35 | 7CDw/FwoGAUCgsoz7rlxzMudr/IhHIH+APinncxXlHO2ecvHD9i8DaHGA8tVifgsUhqQoZieULut | ||
| 36 | eF94O5UAxOkv41UZssYTwN4nYrN1QkesZl3BX4ORS4EE30/PQ23ARf3WZptZrCJevGm2ZYzGeh8x | ||
| 37 | g17mCDfiLO+bff4qP/4mC96Pu4ia6j4to5BwKIJS/+DCuoD8WeSKF4pugXQkMUiHdQnNnVP9Sp2O | ||
| 38 | /4ly5mO8JzrQC59V2bnTNBqPhpno8kfJvK5TypPSVC+bTzern3rJ6UceB3srcn9zxKx9GdNydJQj | ||
| 39 | yWjv8ec3n3d1nuQwhz5Q053NBhIjwoGg3Go7LO6i78ZOlpF7dcoAO13NfHLyNjnyHCaiWtVRTct9 | ||
| 40 | rLf5vN00urSn8YJngHk1eTKK8nHGIcOg6YdYDOD2nE5XwRijKmieG8Xa3eKRzfbL06GrBQENle6J | ||
| 41 | mC131bp3cRVxpjq+o6RAbGoMm4yICsL4eTarCQrsyHmoPHqr91UHo91avyxU7knWmEhX27ybmsrs | ||
| 42 | 8aeZwPHixL14TeyhruCqRVvkf1Ks7P+z8MPUboGNqQe2WLN8ktCGEr15O8MJR/em86G03Jfo4oaw | ||
| 43 | /DVUH5RwLT6acedOGuzMh/2r8BcmemhVQ8/cWvV4YJ0tOW4hzyVHC5hQf8sZ3LzxXLH6Ohnrbprh | ||
| 44 | xvrdbaSdChWZDDP0bCCbxEhkwuBkBeKZrMbwRTP+TPTPYLVTH/CmKLzKh/114tkGkyO3hHS4qExU | ||
| 45 | V39F2Sj4mylx+hD0+20D9pntpNi7htccGlOm6yNM69at/3+kLgJJyoIlaxLcCUYHNMifDt+T3p/t | ||
| 46 | 5U4XmD53uUQ6M8dvj/udqPekNSUfse15yrd9pjOt5PcJuqW28q0sFHf9pHIgz3XZFMe5PD7ppw6r | ||
| 47 | S+C6Ir4PrYIEggQA7ZDVtiCm+BbtNNB/UJm79/OQ5mp5bTI0kPmDeycaWTa0Ojpum+c/dpG/iJOB | ||
| 48 | DICj7jHOXSHT7JlGyX6aSFJUltucAnZvwzhPDmdDaIDiKSk85GqgdDWVfGosSCX9Ph/T3WpIxnwf | ||
| 49 | WSDRtIHkWTjly+pe4yy5K6/XISy/L5Zh/fhiI5fjHjgzmlibs2ru4nVw6hBhUvlSSe2BEs5d9h/y | ||
| 50 | NH8Wy3qvb2D3jh7hkepFtZJGNTHp8ZUC7Ns2JIpQYObsaxdI65i3mMOu7fRwI+0/4ejsWhP6KCEi | ||
| 51 | LgwvLg0qM82ma6YB7qHAHboaczRVEffDcJUG4a5uycB0DoZFn+uEaEFyili20hCn4hVfsqUQk2PT | ||
| 52 | 8Mo1tSl5e30xI1YJZrRgiJm9nHRX6fLizngP+ILJLPHZsPvlSVIfY+/v/FR8feKOjaGhyGF51BAx | ||
| 53 | aM2NIQ4jMP5/X+U5gQybi0E6u7rroDhaHsKmCMgXqszwXWCpedA/sEbeHpiTC59YlPPSlIOMc9vP | ||
| 54 | Ko/mQCfWy/9icUaIfKQldvkllUxxNkqu6AbIpHVscbAEzSPs5xbQXU8EZNNCDisFnnpY3nQ3eLnl | ||
| 55 | m89saTJxRb7NWHRMlmPv7qgD7uMIq3vdOGA7i5wT9MeoNIgK1/DsgH30s6RWjJy4YyyLmRTXPzbj | ||
| 56 | hbQVpEmiMRbEidIvUx2OjKVxVQIcgtLsa2lvHQ4XL1cpLr5GVtOgy0fMg5OCDUUDsvjgjgLQ3P2U | ||
| 57 | p2nVY5FM6/QpPc5DTLuuR9ekI2/c9Biz09RtcYDUQK2ajdo8h1IyKqHFoB7h48OXxXKKY94DY0TG | ||
| 58 | x6PonB/epj8orAw4QKmm5M0vXYwBOqRymCTHTqOJGObdLx1euFFyqguzHJOU2gAGZI0z9Lg1yRuF | ||
| 59 | yhdPZyuniIcmtLNxRZ1duYHErcAyX56qndmLXt7UVkATai/rIMuoJLfAsUnVuTUS5p7tJM754UZT | ||
| 60 | 7lTcXvDJgOUNnBRaIcxC3pxvbrYDJ2iFJ72xkxUP2p74gucqg25XnCVmQuLg6zDDxF6CLuw9isxy | ||
| 61 | Xg4pkneMN//7fpp8GYl9nyZm2yqYYM+jcw0fcVc64L+X4w/gL3H2UMGgxIHSJp7HIG7VKHtXrNyj | ||
| 62 | dPXXPVUsMsAAimqOr0Lr2sZWirfuivLaPTqhbkvG5PF7K3gT80AOIcd/6EIHBy2hZ7ukfjHmdP4L | ||
| 63 | yQOhTQklaKzGHI0mypq0uFLWJOUlZnVrMiLP1xrWkpC8Ro9eo6mfjjQ45z8adC43a47klwTEzvod | ||
| 64 | 3rNEFIGJJUEjAN3mbqie7IxoSJknBBJK0D9lZEQ8lZWlq7vuN8JdqPM6xh155jMVsPwjLK6Tzkj5 | ||
| 65 | BpRD9Tgm3u6HPQSCBADgkWEN75Mu9TGosXY0xm1k6K6sPv8L949CrLWo4r1I2LA072bTGvQP28Vs | ||
| 66 | hUA76jgcT1ocC++9PoktIK10YCq5w+FfMAQ04KeCXuAdmiY2iAT4Slea61PMCMta3mVGyLUZCLEm | ||
| 67 | P+I0UKR5mlO0fGEcjU9j8TmbjZqxNFqloLsU7oSi7Os0EtYHkdAVrExUyOc/ZDie6fBjdLTmLdCm | ||
| 68 | bE9JNwjlbXypdTZupGgLNhKGDIskUAAMwZYayI6YfSIMkNCeAYTnjOuGZZ1msCXGXsfMBR1sfUIj | ||
| 69 | 9UeGjwD8gq+UVVHX/oeoH/m0eJ5ppqi3+nUlgc9DvpYsC/Fg0G2KuYb9B+VJ+a4GMzQSPREoFtQp | ||
| 70 | B9dtLkBb7Ha/hpGWTIdqzW0eAo5llyN8FNvl2Fu2IcLaNmWFO69gLjRKQopp0dvFOuwAVI6fvGDj | ||
| 71 | p1WigoNbFZl8N+iiWmzKOjoG2ZLbez1clZCms/JPJrXhEMMOxWpVzkQyN336VWHmGgMcjaKCGSeA | ||
| 72 | 2nnESIGuiCXMrkHlGfabYIsKcHFCo2t13uXyZPf0zSPTkuD0Eh92wqC9pvA3gvrrCUfo9Mn3bs+e | ||
| 73 | KWKmDlpcs8mDn032oIg+zrQhIduMqXVn3evzeVM3B5MBOGMvg51/SXg7R+MC/463juQQEb9IVe/I | ||
| 74 | YGnO//oWm9lw/377Af/qH+FnN02obJw1FvesQIs9e5RHNQykKbO+vmVJQl1nd9DZWrHDNO7/80Yz | ||
| 75 | 2hCm7Tws5nSRN2iFlyRaYJHr7ypxkU2rCak2r6ua7XDwu1qU2RT3+qPjT1RuxQ2oTlHyGkKPMZGC | ||
| 76 | Rc+CSWz5aeeCmHZVwdb3nC8YpfsujMiYqygLeuQ82pjKuR7DIKGmnfcOLdv5F+Ek2Wyy0D98iSgk | ||
| 77 | +aoQGYLhL9llU13pn21uRsDY5uGcXiIw1IETFlTdgENEv8futZuJsegrp7fmFXyNoNyFNyypeDrM | ||
| 78 | 6ZqR4vKxFjg3tKKeVpkw/W4EAklzMxmNiazGNDBHsnYV3rwPlKa+HeeE2YxnsKwGLCNgRYUXTaJk | ||
| 79 | 461vS160z3dvh/mLfdZ7MYCkmO3bNE3ELUDAw7YQkSuo9ujzdFKte9LC34sjg9fOex3ThAg5Y50n | ||
| 80 | wYm4zBmGM7yEqL8O6QgnM6tIDFS9XryDaLNzcGhMWqMvhzO6sC/AA2WfLgwS517Cp03IkJQWqG9q | ||
| 81 | w52+E+GAtpioJfczEhlv9BrhjttdugRSjJrG8SYVYE4zG3Aur5eNBoGaALIOHOtPw8+JovQmIWcF | ||
| 82 | oaJ/WQuglFrWtew51IK6F8RiHAOBVavZOuZcO7tV+5enVfreOd0rX8ZOy4hYmHhmF1hOrrWOn+Ee | ||
| 83 | E0SYKonXN01BM9xMBIIBSLCvNAppnGPTUGjwbMJRg1VJ2KMiBWH5oJp8tyfIAxMuWFdtaLYbRSOD | ||
| 84 | XbOAshPVK8JAY8DQDkzqaCTAkLTfSRAt9yY6SbUpMsRv7xa8nMZNJBJzJT9b/wNjgiOJgaGuJMkV | ||
| 85 | 2g/DX2jfP3PrMM/Sbnz7edORXHj1Pa5XTT8nG5MS0FuZgvevdq3o/gVVAz+ZCKOH3ShMzZvfp01l | ||
| 86 | SX5gaJTflmU6cdNwtn2yZ6IScF7OrjUeA9iEoSVR9dQcA+4lB3RAG3LMwcnxXY35D7+PMJzHIZdF | ||
| 87 | cSnq+n03ACY2/E/T31iijRH29rvYHGI+mP/ieYs45iq4fTWo6i1HofeWLdP0fX7xW3XO0/hWYFiw | ||
| 88 | BxKu66whAbRhaib3XJNvetVs25ToYXyiDpjG+cd5rCMei8sGQwTBj9Zeh0URoeMW1inTP0JvCmMU | ||
| 89 | rZgAAAAAAAAAAAAA | ||
| 90 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-enc-02.pem b/src/lib/libcrypto/pkcs7/t/msie-enc-02.pem new file mode 100644 index 0000000000..279c5d830b --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-enc-02.pem | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIAGCSqGSIb3DQEHA6CAMIITQAIBADGCAcIwgcwCAQAwdjBiMREwDwYDVQQHEwhJ | ||
| 3 | bnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlT | ||
| 4 | aWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXICEGBAmILep9sJ | ||
| 5 | uN2Pkg1gucowDQYJKoZIhvcNAQEBBQAEQAKvi2eRLO+jdoiUd8ksZt+iQ0JXoWN0 | ||
| 6 | M/W9CEv6R1c42pwUIR/1F4RMK9oeyUiv9Z6lzmPaGNmx6XOCoueszVkwgfACAQAw | ||
| 7 | gZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH | ||
| 8 | EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsT | ||
| 9 | GURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBW | ||
| 10 | QUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQFqcHEo69ShGfcOIVjnmWXLZM+7Y | ||
| 11 | K/50j8YuvNbqq+dQxk9YY8ZpSU/JYsxmtcnEZdlSJEkpMHAO73V+eh1QQr0wghFz | ||
| 12 | BgkqhkiG9w0BBwEwGgYIKoZIhvcNAwIwDgICAKAECJsSmRA1jxLjgIIRSIGLVtf+ | ||
| 13 | pzeB6oXJ9GlfsnIij+DgIOvrYaXC9qywAaUg7zMnln9QMgiih5XpBLgPg5Y/KYp3 | ||
| 14 | RZeHBwkjTIFwlNYSjE0PbsszsJYUmkDTsCjFUJEdM4+Cbv3g3Kct5w1Q6pVMXJLg | ||
| 15 | JG4uFUY8CTScVkb9ETbIy3HisCRKJWA57ERLvCr/Fa6gNJKa5Mw1A5Nsp+QQqp0U | ||
| 16 | uQz93raAPbCdqmHu8qQ88rzbB1k/ysXedRQLlzhqFs2hryD7kHe0gX8nPdlkre8Y | ||
| 17 | tTQhY76LtbjnV2drXcyCUMONc56KQ2VcuxB0BWjSeyN8a75/rpt6wmiM/PKw0D4g | ||
| 18 | RmXqA1ZR62X2WKbhKqvG5tQTF1LauZeddeYS4Rb8cLt2VMB5irkKWrHmJ3qyWELY | ||
| 19 | Lah6AzDDdcf3LEfDo6rO9djqlU8RJwS0ExAuBooVBP6bZJG1tNUUbtxBydQ4PJUH | ||
| 20 | UhulBMXUMd545fVb8d+lZnKbx3OS2LpILJ66Yeao7jTrEOIgxUq0c6ozzqcQe4Ax | ||
| 21 | mytwvL57LpMQm9HpLg3xBHOeDwkkNkNMldA3qrzhoS52yc6vDYrI5XA+kjp7LioG | ||
| 22 | wdSBDyQAXLmWxBpZXjmHp7GBTBsFwouA9kYWP450PZEomxNvzf9SpslLlD+UZeHM | ||
| 23 | GWdpi5zInESmtHFue2Zyc4Q8Ul761ENTA5N3uqUmWN2Egkv64Nyigv0CGCjoLB6n | ||
| 24 | q1256S/ZxISiEl5MTwO/LfhhGExsu+cU12aek3Ks1kNhVXHFoqjJ3YB8Hw08VmHV | ||
| 25 | V0Bh8jdHVABDaRcR5/k00h9VB8zMP1qQmfhE/4q/fZBrGbgWucrGbBHIYlKFq8gF | ||
| 26 | zZrH4XWvX41le5IEefm9+hFPE6TRJPh1ezDvh2eVhQxFpK7iqpR0z2OxdLJ5fhmB | ||
| 27 | CCRHZuRpg7p7MWB6cUhrtBZXDytdkARnlqJsLFudjVUTjU9gi+GUt1sUmEf2Bjba | ||
| 28 | z58UC7CfPIBJGMLjQD1oAQi1GVo9K1ZIaKqUtGA2QEHB2m/aXZg8F3ZDMfHp6Tpc | ||
| 29 | au9Em4AL42Hrau1ArCk0fnhgA4dbnmZoEVbZJDdMX5xno1tuqEKYdPLJHuZxJhz2 | ||
| 30 | xdJUNYSFgpDWLJTzvTOEdZWm+CVmLNl60kJkWNh7HdvWeBV1yBquA6+k+r26sIoq | ||
| 31 | LaZuSq/8QWnNJYZeQpKl8Ib9d8ycQ62Q2sHxLTq+eTYlwkE4Gomi3665IfmE6DS9 | ||
| 32 | OnFfYO440lKJZJbJ9ET+VN8kkVfCGh3tJdyVTJc95LKJtxKJzaFUDMObCMPfWOz+ | ||
| 33 | PaTTY8j9qA+GvdRDxwyBw0CJqgIps1pZ+foEZsIBtNyHHNSWjZxImIuWtfYgNmZ9 | ||
| 34 | dteZkKibWyZYgb64rgMQ2+nViwGMlQaDfYWCOAIj3mQGPTLb0OgFfKNvxBZuj72B | ||
| 35 | l8tx3oufN9Ah9DwXl+ynXen39ct901v5eakpCC9VC0xke6JBXyXjxw5qtXRbevyT | ||
| 36 | jKbYkPFkruwrCUL2fVUxV3mBXGagjz2XNTaz3oDSu9GX/UMViGwwHryeSiwX9XOo | ||
| 37 | /KVNv+i57w2OlY2k72EoK+700fHlcx+EZu+1tIjh8YOVXDg7+nBklcrr21/FABqP | ||
| 38 | Apm+fBEQ7QQyQUF1aViizQLgyfRl/J9szZKY2S2z0pHJroahmgSQRPwWgk5FEFpW | ||
| 39 | PXSG0bRJ8SFNZn2zz3cdT6WvA6hg40jrEHSnCmDTWbWshMPvhCKZqXQTbCqYQnwf | ||
| 40 | FBCtlpJOGVVvqshqIv69DBbLztTZkjjmdKP48v2B5qHlER4T8vewDt3lU5BAGuQn | ||
| 41 | yRCcm5qOeuwg8PxcKBgFAoLKM+65cczLna/yIRyB/gD4p53MV5RztnnLxw/YvA2h | ||
| 42 | xgPLVYn4LFIakKGYnlC7rXhfeDuVAMTpL+NVGbLGE8DeJ2KzdUJHrGZdwV+DkUuB | ||
| 43 | BN9Pz0NtwEX91mabWawiXrxptmWMxnofMYNe5gg34izvm33+Kj/+Jgvej7uImuo+ | ||
| 44 | LaOQcCiCUv/gwrqA/FnkiheKboF0JDFIh3UJzZ1T/Uqdjv+JcuZjvCc60AufVdm5 | ||
| 45 | 0zQaj4aZ6PJHybyuU8qT0lQvm083q596yelHHgd7K3J/c8SsfRnTcnSUI8lo7/Hn | ||
| 46 | N593dZ7kMIc+UNOdzQYSI8KBoNxqOyzuou/GTpaRe3XKADtdzXxy8jY58hwmolrV | ||
| 47 | UU3Lfay3+bzdNLq0p/GCZ4B5NXkyivJxxiHDoOmHWAzg9pxOV8EYoyponhvF2t3i | ||
| 48 | kc32y9OhqwUBDZXuiZgtd9W6d3EVcaY6vqOkQGxqDJuMiArC+Hk2qwkK7Mh5qDx6 | ||
| 49 | q/dVB6PdWr8sVO5J1phIV9u8m5rK7PGnmcDx4sS9eE3soa7gqkVb5H9SrOz/s/DD | ||
| 50 | 1G6BjakHtlizfJLQhhK9eTvDCUf3pvOhtNyX6OKGsPw1VB+UcC0+mnHnThrszIf9 | ||
| 51 | q/AXJnpoVUPP3Fr1eGCdLTluIc8lRwuYUH/LGdy88Vyx+joZ626a4cb63W2knQoV | ||
| 52 | mQwz9Gwgm8RIZMLgZAXimazG8EUz/kz0z2C1Ux/wpii8yof9deLZBpMjt4R0uKhM | ||
| 53 | VFd/Rdko+JspcfoQ9PttA/aZ7aTYu4bXHBpTpusjTOvWrf9/pC4CScqCJWsS3AlG | ||
| 54 | BzTInw7fk96f7eVOF5g+d7lEOjPHb4/7naj3pDUlH7Htecq3faYzreT3CbqltvKt | ||
| 55 | LBR3/aRyIM912RTHuTw+6acOq0vguiK+D62C7ZDVtiCm+BbtNNB/UJm79/OQ5mp5 | ||
| 56 | bTI0kPmDeycaWTa0Ojpum+c/dpG/iJOBDICj7jHOXSHT7JlGyX6aSFJUltucAnZv | ||
| 57 | wzhPDmdDaIDiKSk85GqgdDWVfGosSCX9Ph/T3WpIxnwfWSDRtIHkWTjly+pe4yy5 | ||
| 58 | K6/XISy/L5Zh/fhiI5fjHjgzmlibs2ru4nVw6hBhUvlSSe2BEs5d9h/yNH8Wy3qv | ||
| 59 | b2D3jh7hkepFtZJGNTHp8ZUC7Ns2JIpQYObsaxdI65i3mMOu7fRwI+0/4ejsWhP6 | ||
| 60 | KCEiLgwvLg0qM82ma6YB7qHAHboaczRVEffDcJUG4a5uycB0DoZFn+uEaEFyili2 | ||
| 61 | 0hCn4hVfsqUQk2PT8Mo1tSl5e30xI1YJZrRgiJm9nHRX6fLizngP+ILJLPHZsPvl | ||
| 62 | SVIfY+/v/FR8feKOjaGhyGF51BAxaM2NIQ4jMP5/X+U5gQybi0E6u7rroDhaHsKm | ||
| 63 | CMgXqszwXWCpedA/sEbeHpiTC59YlPPSlIOMc9vPKo/mQCfWy/9icUaIfKQldvkl | ||
| 64 | lUxxNkqu6AbIpHVscbAEzSPs5xbQXU8EZNNCDisFnnpY3nQ3eLnlm89saTJxRb7N | ||
| 65 | WHRMlmPv7qgD7uMIq3vdOGA7i5wT9MeoNIgK1/DsgH30s6RWjJy4YyyLmRTXPzbj | ||
| 66 | hbQVpEmiMRbEidIvUx2OjKVxVQIcgtLsa2lvHQ4XL1cpLr5GVtOgy0fMg5OCDUUD | ||
| 67 | svjgjgLQ3P2Up2nVY5FM6/QpPc5DTLuuR9ekI2/c9Biz09RtcYDUQK2ajdo8h1Iy | ||
| 68 | KqHFoB7h48OXxXKKY94DY0TGx6PonB/epj8orAw4QKmm5M0vXYwBOqRymCTHTqOJ | ||
| 69 | GObdLx1euFFyqguzHJOU2gAGZI0z9Lg1yRuFyhdPZyuniIcmtLNxRZ1duYHErcAy | ||
| 70 | X56qndmLXt7UVkATai/rIMuoJLfAsUnVuTUS5p7tJM754UZT7lTcXvDJgOUNnBRa | ||
| 71 | IcxC3pxvbrYDJ2iFJ72xkxUP2p74gucqg25XnCVmQuLg6zDDxF6CLuw9isxyXg4p | ||
| 72 | kneMN//7fpp8GYl9nyZm2yqYYM+jcw0fcVc64L+X4w/gL3H2UMGgxIHSJp7HIG7V | ||
| 73 | KHtXrNyjdPXXPVUsMsAAimqOr0Lr2sZWirfuivLaPTqhbkvG5PF7K3gT80AOIcd/ | ||
| 74 | 6EIHBy2hZ7ukfjHmdP4LyQOhTQklaKzGHI0mypq0uFLWJOUlZnVrMiLP1xrWkpC8 | ||
| 75 | Ro9eo6mfjjQ45z8adC43a47klwTEzvod3rNEFIGJJUEjAN3mbqie7IxoSJknBBJK | ||
| 76 | 0D9lZEQ8lZWlq7vuN8JdqPM6xh155jMVsPwjLK6Tzkj5BpRD9Tgm3u6HPeCRYQ3v | ||
| 77 | ky71MaixdjTGbWTorqw+/wv3j0KstajivUjYsDTvZtMa9A/bxWyFQDvqOBxPWhwL | ||
| 78 | 770+iS0grXRgKrnD4V8wBDTgp4Je4B2aJjaIBPhKV5rrU8wIy1reZUbItRkIsSY/ | ||
| 79 | 4jRQpHmaU7R8YRyNT2PxOZuNmrE0WqWguxTuhKLs6zQS1geR0BWsTFTI5z9kOJ7p | ||
| 80 | 8GN0tOYt0KZsT0k3COVtfKl1Nm6kaAs2EoYMiyRQAAzBlhrIjph9IgyQ0J4BhOeM | ||
| 81 | 64ZlnWawJcZex8wFHWx9QiP1R4aPAPyCr5RVUdf+h6gf+bR4nmmmqLf6dSWBz0O+ | ||
| 82 | liwL8WDQbYq5hv0H5Un5rgYzNBI9ESgW1CkH120uQFvsdr+GkZZMh2rNbR4CjmWX | ||
| 83 | I3wU2+XYW7Yhwto2ZYU7r2AuNEpCimnR28U67ABUjp+8YOOnVaKCg1sVmXw36KJa | ||
| 84 | bMo6OgbZktt7PVyVkKaz8k8mteEQww7FalXORDI3ffpVYeYaAxyNooIZJ4DaecRI | ||
| 85 | ga6IJcyuQeUZ9ptgiwpwcUKja3Xe5fJk9/TNI9OS4PQSH3bCoL2m8DeC+usJR+j0 | ||
| 86 | yfduz54pYqYOWlyzyYOfTfagiD7OtCEh24ypdWfd6/N5UzcHkwE4Yy+DnX9JeDtH | ||
| 87 | 4wL/jreO5BARv0hV78hgac7/+hab2XD/fvsB/+of4Wc3TahsnDUW96xAiz17lEc1 | ||
| 88 | DKQps76+ZUlCXWd30NlascM07v/zRjPaEKbtPCzmdJE3aIWXJFpgkevvKnGRTasJ | ||
| 89 | qTavq5rtcPC7WpTZFPf6o+NPVG7FDahOUfIaQo8xkYJFz4JJbPlp54KYdlXB1vec | ||
| 90 | Lxil+y6MyJirKAt65DzamMq5HsMgoaad9w4t2/kX4STZbLLQP3yJKCT5qhAZguEv | ||
| 91 | 2WVTXemfbW5GwNjm4ZxeIjDUgRMWVN2AQ0S/x+61m4mx6Cunt+YVfI2g3IU3LKl4 | ||
| 92 | OszpmpHi8rEWODe0op5WmTD9bgQCSXMzGY2JrMY0MEeydhXevA+Upr4d54TZjGew | ||
| 93 | rAYsI2BFhRdNomTjrW9LXrTPd2+H+Yt91nsxgKSY7ds0TcQtQMDDthCRK6j26PN0 | ||
| 94 | Uq170sLfiyOD1857HdOECDljnSfBibjMGYYzvISovw7pCCczq0gMVL1evINos3Nw | ||
| 95 | aExaoy+HM7qwL8ADZZ8uDBLnXsKnTciQlBaob2rDnb4T4YC2mKgl9zMSGW/0GuGO | ||
| 96 | 2126BFKMmsbxJhVgTjMbcC6vl40GgZoAsg4c60/Dz4mi9CYhZwWhon9ZC6CUWta1 | ||
| 97 | 7DnUgroXxGIcA4FVq9k65lw7u1X7l6dV+t453Stfxk7LiFiYeGYXWE6utY6f4R4T | ||
| 98 | RJgqidc3TUEz3EywrzQKaZxj01Bo8GzCUYNVSdijIgVh+aCafLcnyAMTLlhXbWi2 | ||
| 99 | G0Ujg12zgLIT1SvCQGPA0A5M6mgkwJC030kQLfcmOkm1KTLEb+8WvJzGTSQScyU/ | ||
| 100 | W/8DY4IjiYGhriTJFdoPw19o3z9z6zDP0m58+3nTkVx49T2uV00/JxuTEtBbmYL3 | ||
| 101 | r3at6P4FVQM/mQijh90oTM2b36dNZUl+YGiU35ZlOnHTcLZ9smeiEnBezq41HgPY | ||
| 102 | hKElUfXUHAPuJQd0QBtyzMHJ8V2N+Q+/jzCcxyGXRXEp6vp9NwAmNvxP099Yoo0R | ||
| 103 | 9va72BxiPpj/4nmLOOYquH01qOotR6H3li3T9H1+8Vt1ztP4VmBYsAcSruusIQG0 | ||
| 104 | YWom91yTb3rVbNuU6GF8og6YxvnHeawjHovLBkMEwY/WXodFEaHjFtYp0z9Cbwpj | ||
| 105 | FK2YAAAAAA== | ||
| 106 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-s-a-e b/src/lib/libcrypto/pkcs7/t/msie-s-a-e new file mode 100644 index 0000000000..0067794d70 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-s-a-e | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | |||
| 2 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHCMIHMAgEAMHYwYjERMA8GA1UEBxMISW50ZXJuZXQxFzAV | ||
| 3 | BgNVBAoTDlZlcmlTaWduLCBJbmMuMTQwMgYDVQQLEytWZXJpU2lnbiBDbGFzcyAxIENBIC0gSW5k | ||
| 4 | aXZpZHVhbCBTdWJzY3JpYmVyAhBgQJiC3qfbCbjdj5INYLnKMA0GCSqGSIb3DQEBAQUABECjscaS | ||
| 5 | G0U299fqiEAgTqTFQBp8Ai6zzjl557cVb3k6z4QZ7CbqBjSXAjLbh5e7S5Hd/FrFcDnxl1Ka06ha | ||
| 6 | VHGPMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UE | ||
| 7 | BxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 8 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0GCSqG | ||
| 9 | SIb3DQEBAQUABECsyHXZ1xaiv0UQRvOmVYsaF38AL2XX75wxbCsz5/wOg7g3RP4aicZxaR4sBog0 | ||
| 10 | f2G1o9om/hu+A0rIYF/L4/GUMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIAoAQIsozQrnwj | ||
| 11 | cc2ggASCBAAQz/LPoJe/+iYWeTwSebz6Q9UeKZzQ2UWm7GLtEM3s3c9SCvpmkwIRdEhLjWaBJMyI | ||
| 12 | DiL7t1I1vMf9inB8LXgAcIEYkpNScjS8ERA9Ebb7ieNKSBg7w7B8ATHFxLSlDADqRgoZrB1Ctfgf | ||
| 13 | ximp3EgxTgnhtyQhZxXW7kBQyFRwumplrJXOp7albP7IothrOKncw30IJT1fwPxWNMItI9juXF0U | ||
| 14 | CbWVSjPzGBo4+XNXMvUO6MplOQEz/ywEQ9E8OZAQex1Zw9qq5ppsXB2pMsYV5sLJGikukMYKquiz | ||
| 15 | 3YK+tN6J8ahLcDUs+VGwqvZi17gpBTlbEP+ZmXJpnO63t1yTEB0V5AZcRKWUOhzlCBM5YUagqNoY | ||
| 16 | cpsmSvOK6bYzkUKOrzWpDCAtGZ/Dvul5dTZZmxs2WpM+iyeHXMxO3huy8K1brPTqt1f1sHhuq1jD | ||
| 17 | 1eXedaCjIgUW9qV18vNAQCof/Yb6T/1fxztf/jD7pPLQJ+7LJkKCAEHGcaizpoKqhYcttaEhLq1G | ||
| 18 | O+Ohqf7yFegMdTJ3wwP324w5ZYSU5fLo2Z34/Edf6EGvXyTIqVfAmEBALd6JGVdN5GlYYTxrL+eO | ||
| 19 | P80Z4ao4YKoxwEmRp5bmQsQ8B29QhOFKmC6eiG5B96qLMtp7Zmu1grDNxTd6OXShWVwYARD0/B1P | ||
| 20 | Sy0PAfk9Gb4fAkO9fZJDQYZ7s0mM5iOPEeSR7820TolOb+KfRabLA9d714jsc2jEykKlpP66Bh4j | ||
| 21 | aCsyqJ0uUQcE8SnzrKAqGwgWiCGQpiTa+HBiP6eRlRGOKQj5Y06vcNx6Ija4cGe6+yCN8HV8tCY0 | ||
| 22 | okZK98NQCl5t79R/ZB2c3NvBJH+/g3ulU48ikT3tVmDxE3mOZofZyGFEM99P+YCMScLDxTl3hzGy | ||
| 23 | 0YkI8U855P7qOAbcFfh2T5n+LSELwLhbkymEfZT917GWTfmypBWMvJx0WHeDhKwQYPdzbKgWETnc | ||
| 24 | yeKasaCW+oLdhBwrd6Ws2r4MA8cwiYXDLbwYmCxJA8VF++8kubF2HJOjSyMBS+QT2PSV/0D9UWoi | ||
| 25 | Vfk7R4OvWBJVvq7nV+lXS0O5igjExxlmx1OaBfg7+Cr/MbK4zVNrKSJn82NnKKt6LC6RaTmvFYay | ||
| 26 | 0sDFxQ7Xo+Th6tDNKmKWJt6Kegfjc+qTWJTKb3kL+UI8vS0zTLy1+M/rZ4ekos/JiS5rYIcAswvg | ||
| 27 | 58kBgp/0rc6upBeWjBaK5O0aLAeBQfLulo1axWX04OSVKmYeoAltyR6UO9ME3acurQyg7Ta24yqO | ||
| 28 | whi/PrIaEiO7dsWvFtzsshVzBLic02NlAkPkMUzliPYnZHWQglDAVxL5K2qhvK1OFCkQpIgBsBDM | ||
| 29 | 6KYRL/mkBIIEALIl927rIkaN37/BQIcxLcSa05YfC0Hl3mxWESt1A0D4lA37A9S8EbYmDfAYlMc0 | ||
| 30 | 3HhZGdZEtawfpJFyDHzNZceNWBch6nxeNZCY4YFdsbzuGS0RKpwNA9S/czOJ4p9ymBCxuhGepI3U | ||
| 31 | PKbC8C749Www1/wMdAot1n+K7M/PBGR8hWmaH5SS7U3yMwAB1fq2NDjx4ur+Um+MclSdN01MDXzG | ||
| 32 | EO+eAo1pdAY8479234l8dB2YVAhZ1ZlJ4KmbqMKJrGJXnQUEYS6/cTDRjsUocsoW7uGg1ci2GiHa | ||
| 33 | qjlkfpBfie3SdhFW/K8hwAH0HALs56oFN66wUkP/AaJAPfIUNhR6RpHKzZ9zCC42oB2mNawQRMnF | ||
| 34 | ETBl1s/SwMxLKRp7jAfKs4NZxSY6I9z/2dTpzS3tsHMjxVDuxkolvRNWBILEMeL1CBvip2HhmoUw | ||
| 35 | /Sz5NDgyzk1aQLV6DQNJ2RZLMZDRCtSwZSBu6lhhSgTJGazP0+NbqXXC5aQTrqrFIcWyDXz+ADle | ||
| 36 | kszzYM/gSaQTCALTwfDDaU9Ek3xVgW+XBtExtJ3U+0AN3l0j86rUIdIvp6eWdxWQqv9LtpoorKMD | ||
| 37 | KfUc5PYV09Z1JgsT4X51Zzq+74l5dz7udIM7UNbdTpmRm9PDj3TUbGCvNR9hqOEGTLbkvb1ZR24a | ||
| 38 | h6uGRl2znB25IpDAGRhNRb9is/pO2tvHwHTDMOjrgvZG/pNvXgSUxz0pRjUjXIcqBe2X2gcQfeal | ||
| 39 | r8gY76o83WEGL6ODryV9vTQVHt52+izgpYoBZaVlpgqbZl54c+OE0Zxf9RwXwDbcYu5Ku5E0MPL0 | ||
| 40 | qUjc0y2+Y6E4P5bAWaZGMGT+ORkyVUzcaWmM/+XlO7PER5wrWlCIMZCX1L/nvioY0q0CKqALn7DJ | ||
| 41 | QU+qenbwrb6uwS7uNZY6V86s0aDYpU7yRyqxC5SbuyNJb02gdxUCgpIscFaMUjMVRml4M4BIjX/b | ||
| 42 | U+HgHoVMUm8SnN9gRcT2izPrgOGVcMTJjfenzoCKoCPo9RjgGMctgB4DvKamErNU7OrilIfuoqzE | ||
| 43 | PNSeP9SPw/zkDmNvMebM499We9CVnsHUWqF00/ZJWoua77+0f1bLS/tmci1JBvIcMo/4SJvgH+KF | ||
| 44 | o0gijP9gqAPd5iCOnpnJlHUqRIym42SmyKEDuzdSwXKjAR6j7uXda39JyMJr8gGzEsu0jYRkAmj1 | ||
| 45 | YdiqwKXUcLMkcj1AKeU/PxTUVw0YKsv/rowrPYww3xQUWqNivrXB7GCHE3BzsYNdHsmziaGIXQbA | ||
| 46 | +EBHdkuKrM8BcC+fxhF/l/KUxngsD1E75IcUv8zFDF+sk4CBYHqks9S4JYlcubuizqsILbdGzIMN | ||
| 47 | Z7w34k0XT+sEggQAyzr8MHeIJGsT+AYnZr08PeTbyr01JEoT7lPYT6PzX4F63QKKDl+mB+PwLMzY | ||
| 48 | CXrxZcUmuay6/MV8w/f5T6vQXdoSw5puWodBYwVReYh1IaEN+jiTapm9YBVmcIsJPO6abHowknSV | ||
| 49 | OWSvST0AtAX57fFOTckm+facfBK9s9T1lUUgF44Bh5e8f9qKqfOV44nqdCOEyUm0Dao497ieN4Eg | ||
| 50 | XBLNvOZY9+irMiXjp0lcyFvhrJOczfyCr9EiiaiH1TfSzKGKsf2W84iKn/JH6x2eOo7xjwJ40BQD | ||
| 51 | c6S1cUNEuqBhP6by0FioOXYOKVyifpxk84Eb+F/4CNdTJTvCPwsiegdfsX/Q53DvKVtXp9Ycam5J | ||
| 52 | TmKRHXK/bMHF4ONv3p/O/kn/BqRx+fbbP2eMX8Z1F/ltHKfp6B+06HljUwQLBJs9XtCfqH5Zgdz9 | ||
| 53 | gad5WZF5ykFArmHDgeFlgggvbZ7z9vqnjN/TH68TxJzauYQ5vLHQ6wGXik4/4uq7/TqNmhxlQEM4 | ||
| 54 | zVkwsn203bUmKLyz+yl1zItDpn5zy1uXfGo99rBdUzdbdE9LmEFPMaFsaHd4a8oDaUroD7FgCbeD | ||
| 55 | JJVld3ac6F8+3QbExPs48OrgA1kI3/UwXr52ldjiYzTLfAGR9BjqNFTw45FUHuMf8TEM5hcHx56w | ||
| 56 | 95eKAqraDk28o9k+M2UKpcmrdlWoWzdqVVFeWGpM8x9Y9Nt0lf/4VUQgrXjqTkUCQkJyqTeTeGgH | ||
| 57 | rn3QBk2XAgpxZhaJs3InW0BkAlBmK99cMinUiJeFt5a4p5wPeXrVuh6V9m7Mpl9hzpogg++EZqah | ||
| 58 | fzzNnDgxOZfW342DX052PdgXo0NnkhCk005LvFt6M2mRn0fLgNVfyUZZoOp8cO5ZWbhXXlrhrgUt | ||
| 59 | j2zKPK6Q94Zj4kdXHBGpAkrB8ZQ4EGGODE0Dqusm8WPXzB+9236IMHPU7lFbyjBrFNI7O4jg+qRI | ||
| 60 | Ipi+7tX0FsilqEbmjG+OPwhZXrdqUqyF+rjKQuSRq7lOeDB4c6S2dq4OOny01i5HCbbyc9UvSHRm | ||
| 61 | hOhGqUlzHyHLo3W7j+26V/MhkDXJ+Tx+qfylv4pbliwTteJJj+CZwzjv29qb6lxYi+38Bw10ERap | ||
| 62 | m8UCRFBecVN7xXlcIfyeAl666Vi7EBJZv3EdFNrx1nlLwM65nYya7uj6L7IwJWotIUx8E0XH0/cU | ||
| 63 | xS/dG8bxf9L/8652h5gq3LI+wTNGuEX0DMuz7BGQG+NtgabrZ6SsKGthGa7eULTpz0McWTLRU0y/ | ||
| 64 | /tkckpm5pDnXSFbIMskwwjECz82UZBSPpigdN/Pjg5d+0yWu7s3VJxw4ENWPPpzZ+j7sOXmdvn9P | ||
| 65 | O1tQd60EO+3awASCBAAZQvWV3/yJ6FxPttbP+qeURpJoPEZfpN2UYZmd8HqtR0YbaOZ6Rln9nvpd | ||
| 66 | K9fylXdw9z2xeCbjDWUttJB4VqZxGJM8eCTC1VDVyAOsQ5n7SY55dMkQbU+o4Z/4J5m8+wz50BBI | ||
| 67 | LfruL1eZ6/CF6CdvxVRiJ10sXc0Tn2sVMXqkw7Adp1GYoCI9c6VFSFK74+n+y7LVFQ5HBnbQyKJc | ||
| 68 | dvdLOXwZOPaFHC5UNXRmOpcwdPqyXUe+xIsOMYbzdlAnI9eGDNeRDktUa/Rh0CbZCxjmJzoZEYOE | ||
| 69 | ZjsYZlEfp1Kb61t8z4m28hGLEg88T1Ihmxa2HeUWes1RpmgIOP+/2Lb3smj/l/fpSu4gabFgyCAV | ||
| 70 | H5HdCYMScUv8SVu55+tpeO8ELoHHQUXV4rr084O4budzhgNSOPyLGDl5sfDUXiyusPCxS4JVO/KY | ||
| 71 | 6V2Qrtg/q2wtmXpEkZnGT+Qi3WDzwt4W81alztnYMP17oGLmxX71KV9OEiMZjI4WaaGt+OOINLtR | ||
| 72 | qefioZ1NI2L1s5M0tybwTsyU9WERM+3pUwXIfJVsbMZRlNaO2OogcHbaR4UWvhOj+3CTG1sThiYQ | ||
| 73 | MxMnp1Rpqx3nhyzqLO3TRrkYvxnA3cdPBn9EeqpgBMg7X3hCiMV3Fl5cj/WOMhtHYgY7BgeCXo46 | ||
| 74 | EFVZ4+WroGZ46xGiRDiIblo8bzLd7QCxvukzxy3mUDgsZQ8pds4N28weSUhBk5MAPbfBpRvXUVJx | ||
| 75 | MhKqXucQU1Md1qSGLbuuIQuz9pAGp1JFUx/vEkCgm74daSoVWCZuB+1ZE4f48clvrBj51xMNf8CP | ||
| 76 | EFE7vySzVb6X2H1i5X3Z+Y3DdIcWw4Y2FClfcJk4Mwq8Cq2GALGFEge9YSEE9YmyuU6OFeU0ICon | ||
| 77 | iXAgZ72SM8fBwJPruLFbdsNYKW+oAfmPisXSWMcZmdSbfk0GYv+vKtu3eegSbWw1UsCVtZOh9E5Z | ||
| 78 | uQ83l59CBqO9sV/SFU3WrrJ0qNWxrmXu9nJn5Qf5iCRoFGYNHYHkIG5FS6N00GEDZxGkxmro2d++ | ||
| 79 | Adj5LVHc/b1cYWmrux+jEqI8ZK8cyTB0XMbBA/HYbx9NXazr7znP4/Mlv3pZToEcYt+lgLHAArtU | ||
| 80 | AdhybhbLIwNMq0gr6EwtDklBa3ns4Wx/rJU8H7LGs6gV8uqeaSketv+nz+sQhfctxZ1rx+5qzXfy | ||
| 81 | FOQVpO23KDQunBi1Bl9k61Di4q9JWcyADBXPHXJzp7mL8Fk7zdvMAEfuED1phdRm6GgDYoYUs4yQ | ||
| 82 | IrhSjFlWyk7hT8475xk3BIv++obvWSAv/3+pF6A6U2RXDChVmnG0JnPa9wYYtdzBmLfZKBjX+DjD | ||
| 83 | yEMsuhPsCzuN4R6tBIIBWCVRKmKwdkatmpsQBgDw48u0/Arffl5/DRlS9ee+QffFecUitDdCK+kt | ||
| 84 | X5L2fGYrL5g6SltncMIeV1ptx4nuSjC/O944q1KYtqvQiPFWJqEXIRMNbbYOC47sjLza0tEFrimN | ||
| 85 | wxcrWGSzsy5R9beFQ1aHPcMrDWfCoviNRk2qPtxuKIC5Qk2ZuOmJLjCiLwUGEb0/1Mpzv3MqQa7d | ||
| 86 | mRayXg3DZWJPajxNZv6eS357ElMvwGQmqafb2mlQJwWLsg9m9PG7uqEoyrqSc6MiuY+icLEFib9j | ||
| 87 | OfRQrx70rTSKUfTr4MtP0aZZAefjCrpVIyTekhFDOk0Nmx057eonlyGgmGpl5/Uo+t1J1Z11Ya/l | ||
| 88 | bNbfmebRISJeTVW0I8FhseAZMI1GSwp/ludJxSLYOgyRkh+GX134MexNo7O9F1SxLCfWaSG9Fc3s | ||
| 89 | 5ify04ua9/t8SGrYZPm/l3MkAAAAAAAAAAAAAA== | ||
| 90 | |||
| 91 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem b/src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem new file mode 100644 index 0000000000..55dbd8f80b --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/msie-s-a-e.pem | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | -----BEGIN PKCS7----- | ||
| 2 | MIAGCSqGSIb3DQEHA6CAMIITUAIBADGCAcIwgcwCAQAwdjBiMREwDwYDVQQHEwhJ | ||
| 3 | bnRlcm5ldDEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNDAyBgNVBAsTK1ZlcmlT | ||
| 4 | aWduIENsYXNzIDEgQ0EgLSBJbmRpdmlkdWFsIFN1YnNjcmliZXICEGBAmILep9sJ | ||
| 5 | uN2Pkg1gucowDQYJKoZIhvcNAQEBBQAEQKOxxpIbRTb31+qIQCBOpMVAGnwCLrPO | ||
| 6 | OXnntxVveTrPhBnsJuoGNJcCMtuHl7tLkd38WsVwOfGXUprTqFpUcY8wgfACAQAw | ||
| 7 | gZkwgZIxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQH | ||
| 8 | EwhCcmlzYmFuZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsT | ||
| 9 | GURFTU9OU1RSQVRJT04gQU5EIFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBW | ||
| 10 | QUxVRSBDQQICBG4wDQYJKoZIhvcNAQEBBQAEQKzIddnXFqK/RRBG86ZVixoXfwAv | ||
| 11 | ZdfvnDFsKzPn/A6DuDdE/hqJxnFpHiwGiDR/YbWj2ib+G74DSshgX8vj8ZQwghGD | ||
| 12 | BgkqhkiG9w0BBwEwGgYIKoZIhvcNAwIwDgICAKAECLKM0K58I3HNgIIRWBDP8s+g | ||
| 13 | l7/6JhZ5PBJ5vPpD1R4pnNDZRabsYu0Qzezdz1IK+maTAhF0SEuNZoEkzIgOIvu3 | ||
| 14 | UjW8x/2KcHwteABwgRiSk1JyNLwRED0RtvuJ40pIGDvDsHwBMcXEtKUMAOpGChms | ||
| 15 | HUK1+B/GKancSDFOCeG3JCFnFdbuQFDIVHC6amWslc6ntqVs/sii2Gs4qdzDfQgl | ||
| 16 | PV/A/FY0wi0j2O5cXRQJtZVKM/MYGjj5c1cy9Q7oymU5ATP/LARD0Tw5kBB7HVnD | ||
| 17 | 2qrmmmxcHakyxhXmwskaKS6Qxgqq6LPdgr603onxqEtwNSz5UbCq9mLXuCkFOVsQ | ||
| 18 | /5mZcmmc7re3XJMQHRXkBlxEpZQ6HOUIEzlhRqCo2hhymyZK84rptjORQo6vNakM | ||
| 19 | IC0Zn8O+6Xl1NlmbGzZakz6LJ4dczE7eG7LwrVus9Oq3V/WweG6rWMPV5d51oKMi | ||
| 20 | BRb2pXXy80BAKh/9hvpP/V/HO1/+MPuk8tAn7ssmQoIAQcZxqLOmgqqFhy21oSEu | ||
| 21 | rUY746Gp/vIV6Ax1MnfDA/fbjDllhJTl8ujZnfj8R1/oQa9fJMipV8CYQEAt3okZ | ||
| 22 | V03kaVhhPGsv544/zRnhqjhgqjHASZGnluZCxDwHb1CE4UqYLp6IbkH3qosy2ntm | ||
| 23 | a7WCsM3FN3o5dKFZXBgBEPT8HU9LLQ8B+T0Zvh8CQ719kkNBhnuzSYzmI48R5JHv | ||
| 24 | zbROiU5v4p9FpssD13vXiOxzaMTKQqWk/roGHiNoKzKonS5RBwTxKfOsoCobCBaI | ||
| 25 | IZCmJNr4cGI/p5GVEY4pCPljTq9w3HoiNrhwZ7r7II3wdXy0JjSiRkr3w1AKXm3v | ||
| 26 | 1H9kHZzc28Ekf7+De6VTjyKRPe1WYPETeY5mh9nIYUQz30/5gIxJwsPFOXeHMbLR | ||
| 27 | iQjxTznk/uo4BtwV+HZPmf4tIQvAuFuTKYR9lP3XsZZN+bKkFYy8nHRYd4OErBBg | ||
| 28 | 93NsqBYROdzJ4pqxoJb6gt2EHCt3pazavgwDxzCJhcMtvBiYLEkDxUX77yS5sXYc | ||
| 29 | k6NLIwFL5BPY9JX/QP1RaiJV+TtHg69YElW+rudX6VdLQ7mKCMTHGWbHU5oF+Dv4 | ||
| 30 | Kv8xsrjNU2spImfzY2coq3osLpFpOa8VhrLSwMXFDtej5OHq0M0qYpYm3op6B+Nz | ||
| 31 | 6pNYlMpveQv5Qjy9LTNMvLX4z+tnh6Siz8mJLmtghwCzC+DnyQGCn/Stzq6kF5aM | ||
| 32 | Fork7RosB4FB8u6WjVrFZfTg5JUqZh6gCW3JHpQ70wTdpy6tDKDtNrbjKo7CGL8+ | ||
| 33 | shoSI7t2xa8W3OyyFXMEuJzTY2UCQ+QxTOWI9idkdZCCUMBXEvkraqG8rU4UKRCk | ||
| 34 | iAGwEMzophEv+aSyJfdu6yJGjd+/wUCHMS3EmtOWHwtB5d5sVhErdQNA+JQN+wPU | ||
| 35 | vBG2Jg3wGJTHNNx4WRnWRLWsH6SRcgx8zWXHjVgXIep8XjWQmOGBXbG87hktESqc | ||
| 36 | DQPUv3MzieKfcpgQsboRnqSN1DymwvAu+PVsMNf8DHQKLdZ/iuzPzwRkfIVpmh+U | ||
| 37 | ku1N8jMAAdX6tjQ48eLq/lJvjHJUnTdNTA18xhDvngKNaXQGPOO/dt+JfHQdmFQI | ||
| 38 | WdWZSeCpm6jCiaxiV50FBGEuv3Ew0Y7FKHLKFu7hoNXIthoh2qo5ZH6QX4nt0nYR | ||
| 39 | VvyvIcAB9BwC7OeqBTeusFJD/wGiQD3yFDYUekaRys2fcwguNqAdpjWsEETJxREw | ||
| 40 | ZdbP0sDMSykae4wHyrODWcUmOiPc/9nU6c0t7bBzI8VQ7sZKJb0TVgSCxDHi9Qgb | ||
| 41 | 4qdh4ZqFMP0s+TQ4Ms5NWkC1eg0DSdkWSzGQ0QrUsGUgbupYYUoEyRmsz9PjW6l1 | ||
| 42 | wuWkE66qxSHFsg18/gA5XpLM82DP4EmkEwgC08Hww2lPRJN8VYFvlwbRMbSd1PtA | ||
| 43 | Dd5dI/Oq1CHSL6enlncVkKr/S7aaKKyjAyn1HOT2FdPWdSYLE+F+dWc6vu+JeXc+ | ||
| 44 | 7nSDO1DW3U6ZkZvTw4901GxgrzUfYajhBky25L29WUduGoerhkZds5wduSKQwBkY | ||
| 45 | TUW/YrP6Ttrbx8B0wzDo64L2Rv6Tb14ElMc9KUY1I1yHKgXtl9oHEH3mpa/IGO+q | ||
| 46 | PN1hBi+jg68lfb00FR7edvos4KWKAWWlZaYKm2ZeeHPjhNGcX/UcF8A23GLuSruR | ||
| 47 | NDDy9KlI3NMtvmOhOD+WwFmmRjBk/jkZMlVM3GlpjP/l5TuzxEecK1pQiDGQl9S/ | ||
| 48 | 574qGNKtAiqgC5+wyUFPqnp28K2+rsEu7jWWOlfOrNGg2KVO8kcqsQuUm7sjSW9N | ||
| 49 | oHcVAoKSLHBWjFIzFUZpeDOASI1/21Ph4B6FTFJvEpzfYEXE9osz64DhlXDEyY33 | ||
| 50 | p86AiqAj6PUY4BjHLYAeA7ymphKzVOzq4pSH7qKsxDzUnj/Uj8P85A5jbzHmzOPf | ||
| 51 | VnvQlZ7B1FqhdNP2SVqLmu+/tH9Wy0v7ZnItSQbyHDKP+Eib4B/ihaNIIoz/YKgD | ||
| 52 | 3eYgjp6ZyZR1KkSMpuNkpsihA7s3UsFyowEeo+7l3Wt/ScjCa/IBsxLLtI2EZAJo | ||
| 53 | 9WHYqsCl1HCzJHI9QCnlPz8U1FcNGCrL/66MKz2MMN8UFFqjYr61wexghxNwc7GD | ||
| 54 | XR7Js4mhiF0GwPhAR3ZLiqzPAXAvn8YRf5fylMZ4LA9RO+SHFL/MxQxfrJOAgWB6 | ||
| 55 | pLPUuCWJXLm7os6rCC23RsyDDWe8N+JNF0/ryzr8MHeIJGsT+AYnZr08PeTbyr01 | ||
| 56 | JEoT7lPYT6PzX4F63QKKDl+mB+PwLMzYCXrxZcUmuay6/MV8w/f5T6vQXdoSw5pu | ||
| 57 | WodBYwVReYh1IaEN+jiTapm9YBVmcIsJPO6abHowknSVOWSvST0AtAX57fFOTckm | ||
| 58 | +facfBK9s9T1lUUgF44Bh5e8f9qKqfOV44nqdCOEyUm0Dao497ieN4EgXBLNvOZY | ||
| 59 | 9+irMiXjp0lcyFvhrJOczfyCr9EiiaiH1TfSzKGKsf2W84iKn/JH6x2eOo7xjwJ4 | ||
| 60 | 0BQDc6S1cUNEuqBhP6by0FioOXYOKVyifpxk84Eb+F/4CNdTJTvCPwsiegdfsX/Q | ||
| 61 | 53DvKVtXp9Ycam5JTmKRHXK/bMHF4ONv3p/O/kn/BqRx+fbbP2eMX8Z1F/ltHKfp | ||
| 62 | 6B+06HljUwQLBJs9XtCfqH5Zgdz9gad5WZF5ykFArmHDgeFlgggvbZ7z9vqnjN/T | ||
| 63 | H68TxJzauYQ5vLHQ6wGXik4/4uq7/TqNmhxlQEM4zVkwsn203bUmKLyz+yl1zItD | ||
| 64 | pn5zy1uXfGo99rBdUzdbdE9LmEFPMaFsaHd4a8oDaUroD7FgCbeDJJVld3ac6F8+ | ||
| 65 | 3QbExPs48OrgA1kI3/UwXr52ldjiYzTLfAGR9BjqNFTw45FUHuMf8TEM5hcHx56w | ||
| 66 | 95eKAqraDk28o9k+M2UKpcmrdlWoWzdqVVFeWGpM8x9Y9Nt0lf/4VUQgrXjqTkUC | ||
| 67 | QkJyqTeTeGgHrn3QBk2XAgpxZhaJs3InW0BkAlBmK99cMinUiJeFt5a4p5wPeXrV | ||
| 68 | uh6V9m7Mpl9hzpogg++EZqahfzzNnDgxOZfW342DX052PdgXo0NnkhCk005LvFt6 | ||
| 69 | M2mRn0fLgNVfyUZZoOp8cO5ZWbhXXlrhrgUtj2zKPK6Q94Zj4kdXHBGpAkrB8ZQ4 | ||
| 70 | EGGODE0Dqusm8WPXzB+9236IMHPU7lFbyjBrFNI7O4jg+qRIIpi+7tX0FsilqEbm | ||
| 71 | jG+OPwhZXrdqUqyF+rjKQuSRq7lOeDB4c6S2dq4OOny01i5HCbbyc9UvSHRmhOhG | ||
| 72 | qUlzHyHLo3W7j+26V/MhkDXJ+Tx+qfylv4pbliwTteJJj+CZwzjv29qb6lxYi+38 | ||
| 73 | Bw10ERapm8UCRFBecVN7xXlcIfyeAl666Vi7EBJZv3EdFNrx1nlLwM65nYya7uj6 | ||
| 74 | L7IwJWotIUx8E0XH0/cUxS/dG8bxf9L/8652h5gq3LI+wTNGuEX0DMuz7BGQG+Nt | ||
| 75 | gabrZ6SsKGthGa7eULTpz0McWTLRU0y//tkckpm5pDnXSFbIMskwwjECz82UZBSP | ||
| 76 | pigdN/Pjg5d+0yWu7s3VJxw4ENWPPpzZ+j7sOXmdvn9PO1tQd60EO+3awBlC9ZXf | ||
| 77 | /InoXE+21s/6p5RGkmg8Rl+k3ZRhmZ3weq1HRhto5npGWf2e+l0r1/KVd3D3PbF4 | ||
| 78 | JuMNZS20kHhWpnEYkzx4JMLVUNXIA6xDmftJjnl0yRBtT6jhn/gnmbz7DPnQEEgt | ||
| 79 | +u4vV5nr8IXoJ2/FVGInXSxdzROfaxUxeqTDsB2nUZigIj1zpUVIUrvj6f7LstUV | ||
| 80 | DkcGdtDIolx290s5fBk49oUcLlQ1dGY6lzB0+rJdR77Eiw4xhvN2UCcj14YM15EO | ||
| 81 | S1Rr9GHQJtkLGOYnOhkRg4RmOxhmUR+nUpvrW3zPibbyEYsSDzxPUiGbFrYd5RZ6 | ||
| 82 | zVGmaAg4/7/YtveyaP+X9+lK7iBpsWDIIBUfkd0JgxJxS/xJW7nn62l47wQugcdB | ||
| 83 | RdXiuvTzg7hu53OGA1I4/IsYOXmx8NReLK6w8LFLglU78pjpXZCu2D+rbC2ZekSR | ||
| 84 | mcZP5CLdYPPC3hbzVqXO2dgw/XugYubFfvUpX04SIxmMjhZpoa3444g0u1Gp5+Kh | ||
| 85 | nU0jYvWzkzS3JvBOzJT1YREz7elTBch8lWxsxlGU1o7Y6iBwdtpHhRa+E6P7cJMb | ||
| 86 | WxOGJhAzEyenVGmrHeeHLOos7dNGuRi/GcDdx08Gf0R6qmAEyDtfeEKIxXcWXlyP | ||
| 87 | 9Y4yG0diBjsGB4JejjoQVVnj5augZnjrEaJEOIhuWjxvMt3tALG+6TPHLeZQOCxl | ||
| 88 | Dyl2zg3bzB5JSEGTkwA9t8GlG9dRUnEyEqpe5xBTUx3WpIYtu64hC7P2kAanUkVT | ||
| 89 | H+8SQKCbvh1pKhVYJm4H7VkTh/jxyW+sGPnXEw1/wI8QUTu/JLNVvpfYfWLlfdn5 | ||
| 90 | jcN0hxbDhjYUKV9wmTgzCrwKrYYAsYUSB71hIQT1ibK5To4V5TQgKieJcCBnvZIz | ||
| 91 | x8HAk+u4sVt2w1gpb6gB+Y+KxdJYxxmZ1Jt+TQZi/68q27d56BJtbDVSwJW1k6H0 | ||
| 92 | Tlm5DzeXn0IGo72xX9IVTdausnSo1bGuZe72cmflB/mIJGgUZg0dgeQgbkVLo3TQ | ||
| 93 | YQNnEaTGaujZ374B2PktUdz9vVxhaau7H6MSojxkrxzJMHRcxsED8dhvH01drOvv | ||
| 94 | Oc/j8yW/ellOgRxi36WAscACu1QB2HJuFssjA0yrSCvoTC0OSUFreezhbH+slTwf | ||
| 95 | ssazqBXy6p5pKR62/6fP6xCF9y3FnWvH7mrNd/IU5BWk7bcoNC6cGLUGX2TrUOLi | ||
| 96 | r0lZzIAMFc8dcnOnuYvwWTvN28wAR+4QPWmF1GboaANihhSzjJAiuFKMWVbKTuFP | ||
| 97 | zjvnGTcEi/76hu9ZIC//f6kXoDpTZFcMKFWacbQmc9r3Bhi13MGYt9koGNf4OMPI | ||
| 98 | Qyy6E+wLO43hHq0lUSpisHZGrZqbEAYA8OPLtPwK335efw0ZUvXnvkH3xXnFIrQ3 | ||
| 99 | QivpLV+S9nxmKy+YOkpbZ3DCHldabceJ7kowvzveOKtSmLar0IjxViahFyETDW22 | ||
| 100 | DguO7Iy82tLRBa4pjcMXK1hks7MuUfW3hUNWhz3DKw1nwqL4jUZNqj7cbiiAuUJN | ||
| 101 | mbjpiS4woi8FBhG9P9TKc79zKkGu3ZkWsl4Nw2ViT2o8TWb+nkt+exJTL8BkJqmn | ||
| 102 | 29ppUCcFi7IPZvTxu7qhKMq6knOjIrmPonCxBYm/Yzn0UK8e9K00ilH06+DLT9Gm | ||
| 103 | WQHn4wq6VSMk3pIRQzpNDZsdOe3qJ5choJhqZef1KPrdSdWddWGv5WzW35nm0SEi | ||
| 104 | Xk1VtCPBYbHgGTCNRksKf5bnScUi2DoMkZIfhl9d+DHsTaOzvRdUsSwn1mkhvRXN | ||
| 105 | 7OYn8tOLmvf7fEhq2GT5v5dzJAAAAAA= | ||
| 106 | -----END PKCS7----- | ||
diff --git a/src/lib/libcrypto/pkcs7/t/nav-smime b/src/lib/libcrypto/pkcs7/t/nav-smime new file mode 100644 index 0000000000..6ee4b597a1 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/nav-smime | |||
| @@ -0,0 +1,157 @@ | |||
| 1 | From angela@c2.net.au Thu May 14 13:32:27 1998 | ||
| 2 | X-UIDL: 83c94dd550e54329bf9571b72038b8c8 | ||
| 3 | Return-Path: angela@c2.net.au | ||
| 4 | Received: from cryptsoft.com (play.cryptsoft.com [203.56.44.3]) by pandora.cryptsoft.com (8.8.3/8.7.3) with ESMTP id NAA27838 for <tjh@cryptsoft.com>; Thu, 14 May 1998 13:32:26 +1000 (EST) | ||
| 5 | Message-ID: <355A6779.4B63E64C@cryptsoft.com> | ||
| 6 | Date: Thu, 14 May 1998 13:39:37 +1000 | ||
| 7 | From: Angela van Lent <angela@c2.net.au> | ||
| 8 | X-Mailer: Mozilla 4.03 [en] (Win95; U) | ||
| 9 | MIME-Version: 1.0 | ||
| 10 | To: tjh@cryptsoft.com | ||
| 11 | Subject: signed | ||
| 12 | Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms9A58844C95949ECC78A1C54C" | ||
| 13 | Content-Length: 2604 | ||
| 14 | Status: OR | ||
| 15 | |||
| 16 | This is a cryptographically signed message in MIME format. | ||
| 17 | |||
| 18 | --------------ms9A58844C95949ECC78A1C54C | ||
| 19 | Content-Type: text/plain; charset=us-ascii | ||
| 20 | Content-Transfer-Encoding: 7bit | ||
| 21 | |||
| 22 | signed body | ||
| 23 | |||
| 24 | --------------ms9A58844C95949ECC78A1C54C | ||
| 25 | Content-Type: application/x-pkcs7-signature; name="smime.p7s" | ||
| 26 | Content-Transfer-Encoding: base64 | ||
| 27 | Content-Disposition: attachment; filename="smime.p7s" | ||
| 28 | Content-Description: S/MIME Cryptographic Signature | ||
| 29 | |||
| 30 | MIIGHgYJKoZIhvcNAQcCoIIGDzCCBgsCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC | ||
| 31 | BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR | ||
| 32 | BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv | ||
| 33 | ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE | ||
| 34 | AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow | ||
| 35 | gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu | ||
| 36 | ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG | ||
| 37 | A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m | ||
| 38 | dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh | ||
| 39 | hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg | ||
| 40 | hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP | ||
| 41 | igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds | ||
| 42 | syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 43 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 44 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 45 | ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB | ||
| 46 | kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l | ||
| 47 | MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB | ||
| 48 | TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB | ||
| 49 | BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf | ||
| 50 | mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s | ||
| 51 | 8o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx | ||
| 52 | ggF7MIIBdwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP | ||
| 53 | BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ | ||
| 54 | REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB | ||
| 55 | AgIEfjAJBgUrDgMCGgUAoHowGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAbBgkqhkiG9w0B | ||
| 56 | CQ8xDjAMMAoGCCqGSIb3DQMHMBwGCSqGSIb3DQEJBTEPFw05ODA1MTQwMzM5MzdaMCMGCSqG | ||
| 57 | SIb3DQEJBDEWBBQstNMnSV26ba8PapQEDhO21yNFrjANBgkqhkiG9w0BAQEFAARAW9Xb9YXv | ||
| 58 | BfcNkutgFX9Gr8iXhBVsNtGEVrjrpkQwpKa7jHI8SjAlLhk/4RFwDHf+ISB9Np3Z1WDWnLcA | ||
| 59 | 9CWR6g== | ||
| 60 | --------------ms9A58844C95949ECC78A1C54C-- | ||
| 61 | |||
| 62 | |||
| 63 | From angela@c2.net.au Thu May 14 13:33:16 1998 | ||
| 64 | X-UIDL: 8f076c44ff7c5967fd5b00c4588a8731 | ||
| 65 | Return-Path: angela@c2.net.au | ||
| 66 | Received: from cryptsoft.com (play.cryptsoft.com [203.56.44.3]) by pandora.cryptsoft.com (8.8.3/8.7.3) with ESMTP id NAA27847 for <tjh@cryptsoft.com>; Thu, 14 May 1998 13:33:15 +1000 (EST) | ||
| 67 | Message-ID: <355A67AB.2AF38806@cryptsoft.com> | ||
| 68 | Date: Thu, 14 May 1998 13:40:27 +1000 | ||
| 69 | From: Angela van Lent <angela@c2.net.au> | ||
| 70 | X-Mailer: Mozilla 4.03 [en] (Win95; U) | ||
| 71 | MIME-Version: 1.0 | ||
| 72 | To: tjh@cryptsoft.com | ||
| 73 | Subject: signed | ||
| 74 | Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------msD7863B84BD61E02C407F2F5E" | ||
| 75 | Content-Length: 2679 | ||
| 76 | Status: OR | ||
| 77 | |||
| 78 | This is a cryptographically signed message in MIME format. | ||
| 79 | |||
| 80 | --------------msD7863B84BD61E02C407F2F5E | ||
| 81 | Content-Type: text/plain; charset=us-ascii | ||
| 82 | Content-Transfer-Encoding: 7bit | ||
| 83 | |||
| 84 | signed body 2 | ||
| 85 | |||
| 86 | --------------msD7863B84BD61E02C407F2F5E | ||
| 87 | Content-Type: application/x-pkcs7-signature; name="smime.p7s" | ||
| 88 | Content-Transfer-Encoding: base64 | ||
| 89 | Content-Disposition: attachment; filename="smime.p7s" | ||
| 90 | Content-Description: S/MIME Cryptographic Signature | ||
| 91 | |||
| 92 | MIIGVgYJKoZIhvcNAQcCoIIGRzCCBkMCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC | ||
| 93 | BGswggJTMIIB/aADAgECAgIEfjANBgkqhkiG9w0BAQQFADCBkjELMAkGA1UEBhMCQVUxEzAR | ||
| 94 | BgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNv | ||
| 95 | ZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UE | ||
| 96 | AxMSREVNTyBaRVJPIFZBTFVFIENBMB4XDTk4MDUxMzA2MjY1NloXDTAwMDUxMjA2MjY1Nlow | ||
| 97 | gaUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFu | ||
| 98 | ZTEaMBgGA1UEChMRQ3J5cHRzb2Z0IFB0eSBMdGQxEjAQBgNVBAsTCVNNSU1FIDAwMzEZMBcG | ||
| 99 | A1UEAxMQQW5nZWxhIHZhbiBMZWVudDEjMCEGCSqGSIb3DQEJARYUYW5nZWxhQGNyeXB0c29m | ||
| 100 | dC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEAuC3+7dAb2LhuO7gt2cTM8vsNjhG5JfDh | ||
| 101 | hX1Vl/wVGbKEEj0MA6vWEolvefQlxB+EzwCtR0YZ7eEC/T/4JoCyeQIDAQABoygwJjAkBglg | ||
| 102 | hkgBhvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EAUnSP | ||
| 103 | igs6TMFISTjw8cBtJYb98czgAVkVFjKyJQwYMH8FbDnCyx6NocM555nsyDstaw8fKR11Khds | ||
| 104 | syd3ikkrhDCCAhAwggG6AgEDMA0GCSqGSIb3DQEBBAUAMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 105 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 106 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 107 | ExJERU1PIFpFUk8gVkFMVUUgQ0EwHhcNOTgwMzAzMDc0MTMyWhcNMDgwMjI5MDc0MTMyWjCB | ||
| 108 | kjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAPBgNVBAcTCEJyaXNiYW5l | ||
| 109 | MRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZREVNT05TVFJBVElPTiBB | ||
| 110 | TkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENBMFwwDQYJKoZIhvcNAQEB | ||
| 111 | BQADSwAwSAJBAL+0E2fLej3FSCwe2A2iRnMuC3z12qHIp6Ky1wo2zZcxft7AI+RfkrWrSGtf | ||
| 112 | mfzBEuPrLdfulncC5Y1pNcM8RTUCAwEAATANBgkqhkiG9w0BAQQFAANBAGSbLMphL6F5pp3s | ||
| 113 | 8o0Xyh86FHFdpVOwYx09ELLkuG17V/P9pgIc0Eo/gDMbN+KT3IdgECf8S//pCRA6RrNjcXIx | ||
| 114 | ggGzMIIBrwIBATCBmTCBkjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClF1ZWVuc2xhbmQxETAP | ||
| 115 | BgNVBAcTCEJyaXNiYW5lMRowGAYDVQQKExFDcnlwdHNvZnQgUHR5IEx0ZDEiMCAGA1UECxMZ | ||
| 116 | REVNT05TVFJBVElPTiBBTkQgVEVTVElORzEbMBkGA1UEAxMSREVNTyBaRVJPIFZBTFVFIENB | ||
| 117 | AgIEfjAJBgUrDgMCGgUAoIGxMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcN | ||
| 118 | AQkFMQ8XDTk4MDUxNDAzNDAyN1owIwYJKoZIhvcNAQkEMRYEFOKcV8mNYJnM8rHQajcSEqJN | ||
| 119 | rwdDMFIGCSqGSIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMAcGBSsO | ||
| 120 | AwIHMA0GCCqGSIb3DQMCAgFAMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABEADPE/N | ||
| 121 | coH+zTFuX5YpolupTKxKK8eEjc48TuADuO8bIHHDE/fEYaWunlwDuTlcFJl1ig0idffPB1qC | ||
| 122 | Zp8SSVVY | ||
| 123 | --------------msD7863B84BD61E02C407F2F5E-- | ||
| 124 | |||
| 125 | |||
| 126 | From angela@c2.net.au Thu May 14 14:05:32 1998 | ||
| 127 | X-UIDL: a7d629b4b9acacaee8b39371b860a32a | ||
| 128 | Return-Path: angela@c2.net.au | ||
| 129 | Received: from cryptsoft.com (play.cryptsoft.com [203.56.44.3]) by pandora.cryptsoft.com (8.8.3/8.7.3) with ESMTP id OAA28033 for <tjh@cryptsoft.com>; Thu, 14 May 1998 14:05:32 +1000 (EST) | ||
| 130 | Message-ID: <355A6F3B.AC385981@cryptsoft.com> | ||
| 131 | Date: Thu, 14 May 1998 14:12:43 +1000 | ||
| 132 | From: Angela van Lent <angela@c2.net.au> | ||
| 133 | X-Mailer: Mozilla 4.03 [en] (Win95; U) | ||
| 134 | MIME-Version: 1.0 | ||
| 135 | To: tjh@cryptsoft.com | ||
| 136 | Subject: encrypted | ||
| 137 | Content-Type: application/x-pkcs7-mime; name="smime.p7m" | ||
| 138 | Content-Transfer-Encoding: base64 | ||
| 139 | Content-Disposition: attachment; filename="smime.p7m" | ||
| 140 | Content-Description: S/MIME Encrypted Message | ||
| 141 | Content-Length: 905 | ||
| 142 | Status: OR | ||
| 143 | |||
| 144 | MIAGCSqGSIb3DQEHA6CAMIACAQAxggHmMIHwAgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEG | ||
| 145 | A1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 146 | dCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNUUkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQD | ||
| 147 | ExJERU1PIFpFUk8gVkFMVUUgQ0ECAgR+MA0GCSqGSIb3DQEBAQUABEA92N29Yk39RUY2tIVd | ||
| 148 | exGT2MFX3J6H8LB8aDRJjw7843ALgJ5zXpM5+f80QkAWwEN2A6Pl3VxiCeKLi435zXVyMIHw | ||
| 149 | AgEAMIGZMIGSMQswCQYDVQQGEwJBVTETMBEGA1UECBMKUXVlZW5zbGFuZDERMA8GA1UEBxMI | ||
| 150 | QnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29mdCBQdHkgTHRkMSIwIAYDVQQLExlERU1PTlNU | ||
| 151 | UkFUSU9OIEFORCBURVNUSU5HMRswGQYDVQQDExJERU1PIFpFUk8gVkFMVUUgQ0ECAgRuMA0G | ||
| 152 | CSqGSIb3DQEBAQUABECR9IfyHtvnjFmZ8B2oUCEs1vxMsG0u1kxKE4RMPFyDqDCEARq7zXMg | ||
| 153 | nzSUI7Wgv5USSKDqcLRJeW+jvYURv/nJMIAGCSqGSIb3DQEHATAaBggqhkiG9w0DAjAOAgIA | ||
| 154 | oAQIrLqrij2ZMpeggAQoibtn6reRZWuWk5Iv5IAhgitr8EYE4w4ySQ7EMB6mTlBoFpccUMWX | ||
| 155 | BwQgQn1UoWCvYAlhDzURdbui64Dc0rS2wtj+kE/InS6y25EEEPe4NUKaF8/UlE+lo3LtILQE | ||
| 156 | CL3uV8k7m0iqAAAAAAAAAAAAAA== | ||
| 157 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/s.pem b/src/lib/libcrypto/pkcs7/t/s.pem new file mode 100644 index 0000000000..4fa925b182 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/s.pem | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | -----BEGIN RSA PRIVATE KEY----- | ||
| 2 | MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9 | ||
| 3 | mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG | ||
| 4 | fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/ | ||
| 5 | zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29 | ||
| 6 | p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b | ||
| 7 | bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk | ||
| 8 | IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG | ||
| 9 | -----END RSA PRIVATE KEY----- | ||
| 10 | issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA | ||
| 11 | subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com | ||
| 12 | serial :047D | ||
| 13 | |||
| 14 | Certificate: | ||
| 15 | Data: | ||
| 16 | Version: 3 (0x2) | ||
| 17 | Serial Number: 1149 (0x47d) | ||
| 18 | Signature Algorithm: md5withRSAEncryption | ||
| 19 | Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA | ||
| 20 | Validity | ||
| 21 | Not Before: May 13 05:40:58 1998 GMT | ||
| 22 | Not After : May 12 05:40:58 2000 GMT | ||
| 23 | Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com | ||
| 24 | Subject Public Key Info: | ||
| 25 | Public Key Algorithm: rsaEncryption | ||
| 26 | Modulus: | ||
| 27 | 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81: | ||
| 28 | 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc: | ||
| 29 | 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29: | ||
| 30 | fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f: | ||
| 31 | e7:e7:0c:4d:0b | ||
| 32 | Exponent: 65537 (0x10001) | ||
| 33 | X509v3 extensions: | ||
| 34 | Netscape Comment: | ||
| 35 | Generated with SSLeay | ||
| 36 | Signature Algorithm: md5withRSAEncryption | ||
| 37 | 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55: | ||
| 38 | f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97: | ||
| 39 | d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b: | ||
| 40 | 50:74:ad:92:cb:4e:90:e5:fa:7d | ||
| 41 | |||
| 42 | -----BEGIN CERTIFICATE----- | ||
| 43 | MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV | ||
| 44 | MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE | ||
| 45 | ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E | ||
| 46 | IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw | ||
| 47 | NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK | ||
| 48 | UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 49 | dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0 | ||
| 50 | aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG | ||
| 51 | 9w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf | ||
| 52 | lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB | ||
| 53 | hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA | ||
| 54 | UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8 | ||
| 55 | 4A3ZItobUHStkstOkOX6fQ== | ||
| 56 | -----END CERTIFICATE----- | ||
| 57 | |||
diff --git a/src/lib/libcrypto/pkcs7/t/server.pem b/src/lib/libcrypto/pkcs7/t/server.pem new file mode 100644 index 0000000000..989baf8709 --- /dev/null +++ b/src/lib/libcrypto/pkcs7/t/server.pem | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | issuer :/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=DEMONSTRATION AND TESTING/CN=DEMO ZERO VALUE CA | ||
| 2 | subject:/C=AU/SP=Queensland/L=Brisbane/O=Cryptsoft Pty Ltd/OU=SMIME 003/CN=Information/Email=info@cryptsoft.com | ||
| 3 | serial :047D | ||
| 4 | |||
| 5 | Certificate: | ||
| 6 | Data: | ||
| 7 | Version: 3 (0x2) | ||
| 8 | Serial Number: 1149 (0x47d) | ||
| 9 | Signature Algorithm: md5withRSAEncryption | ||
| 10 | Issuer: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=DEMONSTRATION AND TESTING, CN=DEMO ZERO VALUE CA | ||
| 11 | Validity | ||
| 12 | Not Before: May 13 05:40:58 1998 GMT | ||
| 13 | Not After : May 12 05:40:58 2000 GMT | ||
| 14 | Subject: C=AU, SP=Queensland, L=Brisbane, O=Cryptsoft Pty Ltd, OU=SMIME 003, CN=Information/Email=info@cryptsoft.com | ||
| 15 | Subject Public Key Info: | ||
| 16 | Public Key Algorithm: rsaEncryption | ||
| 17 | Modulus: | ||
| 18 | 00:ad:e7:23:89:ee:0d:87:b7:9c:32:44:4b:95:81: | ||
| 19 | 73:dd:22:80:4b:2d:c5:60:b8:fe:1e:18:63:ef:dc: | ||
| 20 | 89:89:22:df:95:3c:7a:db:3d:9a:06:a8:08:d6:29: | ||
| 21 | fd:ef:41:09:91:ed:bc:ad:98:f9:f6:28:90:62:6f: | ||
| 22 | e7:e7:0c:4d:0b | ||
| 23 | Exponent: 65537 (0x10001) | ||
| 24 | X509v3 extensions: | ||
| 25 | Netscape Comment: | ||
| 26 | Generated with SSLeay | ||
| 27 | Signature Algorithm: md5withRSAEncryption | ||
| 28 | 52:15:ea:88:f4:f0:f9:0b:ef:ce:d5:f8:83:40:61:16:5e:55: | ||
| 29 | f9:ce:2d:d1:8b:31:5c:03:c6:2d:10:7c:61:d5:5c:0a:42:97: | ||
| 30 | d1:fd:65:b6:b6:84:a5:39:ec:46:ec:fc:e0:0d:d9:22:da:1b: | ||
| 31 | 50:74:ad:92:cb:4e:90:e5:fa:7d | ||
| 32 | |||
| 33 | -----BEGIN CERTIFICATE----- | ||
| 34 | MIICTDCCAfagAwIBAgICBH0wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNVBAYTAkFV | ||
| 35 | MRMwEQYDVQQIEwpRdWVlbnNsYW5kMREwDwYDVQQHEwhCcmlzYmFuZTEaMBgGA1UE | ||
| 36 | ChMRQ3J5cHRzb2Z0IFB0eSBMdGQxIjAgBgNVBAsTGURFTU9OU1RSQVRJT04gQU5E | ||
| 37 | IFRFU1RJTkcxGzAZBgNVBAMTEkRFTU8gWkVSTyBWQUxVRSBDQTAeFw05ODA1MTMw | ||
| 38 | NTQwNThaFw0wMDA1MTIwNTQwNThaMIGeMQswCQYDVQQGEwJBVTETMBEGA1UECBMK | ||
| 39 | UXVlZW5zbGFuZDERMA8GA1UEBxMIQnJpc2JhbmUxGjAYBgNVBAoTEUNyeXB0c29m | ||
| 40 | dCBQdHkgTHRkMRIwEAYDVQQLEwlTTUlNRSAwMDMxFDASBgNVBAMTC0luZm9ybWF0 | ||
| 41 | aW9uMSEwHwYJKoZIhvcNAQkBFhJpbmZvQGNyeXB0c29mdC5jb20wXDANBgkqhkiG | ||
| 42 | 9w0BAQEFAANLADBIAkEArecjie4Nh7ecMkRLlYFz3SKASy3FYLj+Hhhj79yJiSLf | ||
| 43 | lTx62z2aBqgI1in970EJke28rZj59iiQYm/n5wxNCwIDAQABoygwJjAkBglghkgB | ||
| 44 | hvhCAQ0EFxYVR2VuZXJhdGVkIHdpdGggU1NMZWF5MA0GCSqGSIb3DQEBBAUAA0EA | ||
| 45 | UhXqiPTw+QvvztX4g0BhFl5V+c4t0YsxXAPGLRB8YdVcCkKX0f1ltraEpTnsRuz8 | ||
| 46 | 4A3ZItobUHStkstOkOX6fQ== | ||
| 47 | -----END CERTIFICATE----- | ||
| 48 | |||
| 49 | -----BEGIN RSA PRIVATE KEY----- | ||
| 50 | MIIBOgIBAAJBAK3nI4nuDYe3nDJES5WBc90igEstxWC4/h4YY+/ciYki35U8ets9 | ||
| 51 | mgaoCNYp/e9BCZHtvK2Y+fYokGJv5+cMTQsCAwEAAQJBAIHpvXvqEcOEoDRRHuIG | ||
| 52 | fkcB4jPHcr9KE9TpxabH6xs9beN6OJnkePXAHwaz5MnUgSnbpOKq+cw8miKjXwe/ | ||
| 53 | zVECIQDVLwncT2lRmXarEYHzb+q/0uaSvKhWKKt3kJasLNTrAwIhANDUc/ghut29 | ||
| 54 | p3jJYjurzUKuG774/5eLjPLsxPPIZzNZAiA/10hSq41UnGqHLEUIS9m2/EeEZe7b | ||
| 55 | bm567dfRU9OnVQIgDo8ROrZXSchEGbaog5J5r/Fle83uO8l93R3GqVxKXZkCIFfk | ||
| 56 | IPD5PIYQAyyod3hyKKza7ZP4CGY4oOfZetbkSGGG | ||
| 57 | -----END RSA PRIVATE KEY----- | ||
diff --git a/src/lib/libcrypto/pkcs7/verify.c b/src/lib/libcrypto/pkcs7/verify.c new file mode 100644 index 0000000000..b40f26032e --- /dev/null +++ b/src/lib/libcrypto/pkcs7/verify.c | |||
| @@ -0,0 +1,263 @@ | |||
| 1 | /* crypto/pkcs7/verify.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | #include <stdio.h> | ||
| 59 | #include <string.h> | ||
| 60 | #include <openssl/bio.h> | ||
| 61 | #include <openssl/asn1.h> | ||
| 62 | #include <openssl/x509.h> | ||
| 63 | #include <openssl/pem.h> | ||
| 64 | #include <openssl/err.h> | ||
| 65 | #include "example.h" | ||
| 66 | |||
| 67 | int verify_callback(int ok, X509_STORE_CTX *ctx); | ||
| 68 | |||
| 69 | BIO *bio_err=NULL; | ||
| 70 | BIO *bio_out=NULL; | ||
| 71 | |||
| 72 | int main(argc,argv) | ||
| 73 | int argc; | ||
| 74 | char *argv[]; | ||
| 75 | { | ||
| 76 | PKCS7 *p7; | ||
| 77 | PKCS7_SIGNER_INFO *si; | ||
| 78 | X509_STORE_CTX cert_ctx; | ||
| 79 | X509_STORE *cert_store=NULL; | ||
| 80 | BIO *data,*detached=NULL,*p7bio=NULL; | ||
| 81 | char buf[1024*4]; | ||
| 82 | char *pp; | ||
| 83 | int i,printit=0; | ||
| 84 | STACK_OF(PKCS7_SIGNER_INFO) *sk; | ||
| 85 | |||
| 86 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
| 87 | bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); | ||
| 88 | #ifndef OPENSSL_NO_MD2 | ||
| 89 | EVP_add_digest(EVP_md2()); | ||
| 90 | #endif | ||
| 91 | #ifndef OPENSSL_NO_MD5 | ||
| 92 | EVP_add_digest(EVP_md5()); | ||
| 93 | #endif | ||
| 94 | #ifndef OPENSSL_NO_SHA1 | ||
| 95 | EVP_add_digest(EVP_sha1()); | ||
| 96 | #endif | ||
| 97 | #ifndef OPENSSL_NO_MDC2 | ||
| 98 | EVP_add_digest(EVP_mdc2()); | ||
| 99 | #endif | ||
| 100 | |||
| 101 | data=BIO_new(BIO_s_file()); | ||
| 102 | |||
| 103 | pp=NULL; | ||
| 104 | while (argc > 1) | ||
| 105 | { | ||
| 106 | argc--; | ||
| 107 | argv++; | ||
| 108 | if (strcmp(argv[0],"-p") == 0) | ||
| 109 | { | ||
| 110 | printit=1; | ||
| 111 | } | ||
| 112 | else if ((strcmp(argv[0],"-d") == 0) && (argc >= 2)) | ||
| 113 | { | ||
| 114 | detached=BIO_new(BIO_s_file()); | ||
| 115 | if (!BIO_read_filename(detached,argv[1])) | ||
| 116 | goto err; | ||
| 117 | argc--; | ||
| 118 | argv++; | ||
| 119 | } | ||
| 120 | else | ||
| 121 | { | ||
| 122 | pp=argv[0]; | ||
| 123 | if (!BIO_read_filename(data,argv[0])) | ||
| 124 | goto err; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | if (pp == NULL) | ||
| 129 | BIO_set_fp(data,stdin,BIO_NOCLOSE); | ||
| 130 | |||
| 131 | |||
| 132 | /* Load the PKCS7 object from a file */ | ||
| 133 | if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err; | ||
| 134 | |||
| 135 | /* This stuff is being setup for certificate verification. | ||
| 136 | * When using SSL, it could be replaced with a | ||
| 137 | * cert_stre=SSL_CTX_get_cert_store(ssl_ctx); */ | ||
| 138 | cert_store=X509_STORE_new(); | ||
| 139 | X509_STORE_set_default_paths(cert_store); | ||
| 140 | X509_STORE_load_locations(cert_store,NULL,"../../certs"); | ||
| 141 | X509_STORE_set_verify_cb_func(cert_store,verify_callback); | ||
| 142 | |||
| 143 | ERR_clear_error(); | ||
| 144 | |||
| 145 | /* We need to process the data */ | ||
| 146 | if ((PKCS7_get_detached(p7) || detached)) | ||
| 147 | { | ||
| 148 | if (detached == NULL) | ||
| 149 | { | ||
| 150 | printf("no data to verify the signature on\n"); | ||
| 151 | exit(1); | ||
| 152 | } | ||
| 153 | else | ||
| 154 | p7bio=PKCS7_dataInit(p7,detached); | ||
| 155 | } | ||
| 156 | else | ||
| 157 | { | ||
| 158 | p7bio=PKCS7_dataInit(p7,NULL); | ||
| 159 | } | ||
| 160 | |||
| 161 | /* We now have to 'read' from p7bio to calculate digests etc. */ | ||
| 162 | for (;;) | ||
| 163 | { | ||
| 164 | i=BIO_read(p7bio,buf,sizeof(buf)); | ||
| 165 | /* print it? */ | ||
| 166 | if (i <= 0) break; | ||
| 167 | } | ||
| 168 | |||
| 169 | /* We can now verify signatures */ | ||
| 170 | sk=PKCS7_get_signer_info(p7); | ||
| 171 | if (sk == NULL) | ||
| 172 | { | ||
| 173 | printf("there are no signatures on this data\n"); | ||
| 174 | exit(1); | ||
| 175 | } | ||
| 176 | |||
| 177 | /* Ok, first we need to, for each subject entry, see if we can verify */ | ||
| 178 | for (i=0; i<sk_PKCS7_SIGNER_INFO_num(sk); i++) | ||
| 179 | { | ||
| 180 | ASN1_UTCTIME *tm; | ||
| 181 | char *str1,*str2; | ||
| 182 | int rc; | ||
| 183 | |||
| 184 | si=sk_PKCS7_SIGNER_INFO_value(sk,i); | ||
| 185 | rc=PKCS7_dataVerify(cert_store,&cert_ctx,p7bio,p7,si); | ||
| 186 | if (rc <= 0) | ||
| 187 | goto err; | ||
| 188 | printf("signer info\n"); | ||
| 189 | if ((tm=get_signed_time(si)) != NULL) | ||
| 190 | { | ||
| 191 | BIO_printf(bio_out,"Signed time:"); | ||
| 192 | ASN1_UTCTIME_print(bio_out,tm); | ||
| 193 | ASN1_UTCTIME_free(tm); | ||
| 194 | BIO_printf(bio_out,"\n"); | ||
| 195 | } | ||
| 196 | if (get_signed_seq2string(si,&str1,&str2)) | ||
| 197 | { | ||
| 198 | BIO_printf(bio_out,"String 1 is %s\n",str1); | ||
| 199 | BIO_printf(bio_out,"String 2 is %s\n",str2); | ||
| 200 | } | ||
| 201 | |||
| 202 | } | ||
| 203 | |||
| 204 | X509_STORE_free(cert_store); | ||
| 205 | |||
| 206 | printf("done\n"); | ||
| 207 | exit(0); | ||
| 208 | err: | ||
| 209 | ERR_load_crypto_strings(); | ||
| 210 | ERR_print_errors_fp(stderr); | ||
| 211 | exit(1); | ||
| 212 | } | ||
| 213 | |||
| 214 | /* should be X509 * but we can just have them as char *. */ | ||
| 215 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 216 | { | ||
| 217 | char buf[256]; | ||
| 218 | X509 *err_cert; | ||
| 219 | int err,depth; | ||
| 220 | |||
| 221 | err_cert=X509_STORE_CTX_get_current_cert(ctx); | ||
| 222 | err= X509_STORE_CTX_get_error(ctx); | ||
| 223 | depth= X509_STORE_CTX_get_error_depth(ctx); | ||
| 224 | |||
| 225 | X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256); | ||
| 226 | BIO_printf(bio_err,"depth=%d %s\n",depth,buf); | ||
| 227 | if (!ok) | ||
| 228 | { | ||
| 229 | BIO_printf(bio_err,"verify error:num=%d:%s\n",err, | ||
| 230 | X509_verify_cert_error_string(err)); | ||
| 231 | if (depth < 6) | ||
| 232 | { | ||
| 233 | ok=1; | ||
| 234 | X509_STORE_CTX_set_error(ctx,X509_V_OK); | ||
| 235 | } | ||
| 236 | else | ||
| 237 | { | ||
| 238 | ok=0; | ||
| 239 | X509_STORE_CTX_set_error(ctx,X509_V_ERR_CERT_CHAIN_TOO_LONG); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | switch (ctx->error) | ||
| 243 | { | ||
| 244 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
| 245 | X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert),buf,256); | ||
| 246 | BIO_printf(bio_err,"issuer= %s\n",buf); | ||
| 247 | break; | ||
| 248 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
| 249 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
| 250 | BIO_printf(bio_err,"notBefore="); | ||
| 251 | ASN1_UTCTIME_print(bio_err,X509_get_notBefore(ctx->current_cert)); | ||
| 252 | BIO_printf(bio_err,"\n"); | ||
| 253 | break; | ||
| 254 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
| 255 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
| 256 | BIO_printf(bio_err,"notAfter="); | ||
| 257 | ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ctx->current_cert)); | ||
| 258 | BIO_printf(bio_err,"\n"); | ||
| 259 | break; | ||
| 260 | } | ||
| 261 | BIO_printf(bio_err,"verify return:%d\n",ok); | ||
| 262 | return(ok); | ||
| 263 | } | ||
diff --git a/src/lib/libcrypto/pqueue/Makefile b/src/lib/libcrypto/pqueue/Makefile new file mode 100644 index 0000000000..fb36a0c876 --- /dev/null +++ b/src/lib/libcrypto/pqueue/Makefile | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/pqueue/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= pqueue | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=pqueue.c | ||
| 21 | LIBOBJ=pqueue.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= pqueue.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | pqueue.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 78 | pqueue.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 79 | pqueue.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 80 | pqueue.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 81 | pqueue.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 82 | pqueue.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 83 | pqueue.o: ../../include/openssl/symhacks.h ../cryptlib.h pqueue.c pqueue.h | ||
diff --git a/src/lib/libcrypto/pqueue/pq_test.c b/src/lib/libcrypto/pqueue/pq_test.c new file mode 100644 index 0000000000..8d496dfc65 --- /dev/null +++ b/src/lib/libcrypto/pqueue/pq_test.c | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* crypto/pqueue/pq_test.c */ | ||
| 2 | /* | ||
| 3 | * DTLS implementation written by Nagendra Modadugu | ||
| 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | ||
| 5 | */ | ||
| 6 | /* ==================================================================== | ||
| 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions | ||
| 11 | * are met: | ||
| 12 | * | ||
| 13 | * 1. Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * | ||
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer in | ||
| 18 | * the documentation and/or other materials provided with the | ||
| 19 | * distribution. | ||
| 20 | * | ||
| 21 | * 3. All advertising materials mentioning features or use of this | ||
| 22 | * software must display the following acknowledgment: | ||
| 23 | * "This product includes software developed by the OpenSSL Project | ||
| 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 25 | * | ||
| 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 27 | * endorse or promote products derived from this software without | ||
| 28 | * prior written permission. For written permission, please contact | ||
| 29 | * openssl-core@OpenSSL.org. | ||
| 30 | * | ||
| 31 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 32 | * nor may "OpenSSL" appear in their names without prior written | ||
| 33 | * permission of the OpenSSL Project. | ||
| 34 | * | ||
| 35 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 36 | * acknowledgment: | ||
| 37 | * "This product includes software developed by the OpenSSL Project | ||
| 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 39 | * | ||
| 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 52 | * ==================================================================== | ||
| 53 | * | ||
| 54 | * This product includes cryptographic software written by Eric Young | ||
| 55 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 56 | * Hudson (tjh@cryptsoft.com). | ||
| 57 | * | ||
| 58 | */ | ||
| 59 | |||
| 60 | #include "pqueue.h" | ||
| 61 | |||
| 62 | int | ||
| 63 | main(void) | ||
| 64 | { | ||
| 65 | pitem *item; | ||
| 66 | pqueue pq; | ||
| 67 | |||
| 68 | pq = pqueue_new(); | ||
| 69 | |||
| 70 | item = pitem_new(3, NULL); | ||
| 71 | pqueue_insert(pq, item); | ||
| 72 | |||
| 73 | item = pitem_new(1, NULL); | ||
| 74 | pqueue_insert(pq, item); | ||
| 75 | |||
| 76 | item = pitem_new(2, NULL); | ||
| 77 | pqueue_insert(pq, item); | ||
| 78 | |||
| 79 | item = pqueue_find(pq, 1); | ||
| 80 | fprintf(stderr, "found %ld\n", item->priority); | ||
| 81 | |||
| 82 | item = pqueue_find(pq, 2); | ||
| 83 | fprintf(stderr, "found %ld\n", item->priority); | ||
| 84 | |||
| 85 | item = pqueue_find(pq, 3); | ||
| 86 | fprintf(stderr, "found %ld\n", item ? item->priority: 0); | ||
| 87 | |||
| 88 | pqueue_print(pq); | ||
| 89 | |||
| 90 | for(item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) | ||
| 91 | pitem_free(item); | ||
| 92 | |||
| 93 | pqueue_free(pq); | ||
| 94 | return 0; | ||
| 95 | } | ||
diff --git a/src/lib/libcrypto/pqueue/pqueue.c b/src/lib/libcrypto/pqueue/pqueue.c new file mode 100644 index 0000000000..eab13a1250 --- /dev/null +++ b/src/lib/libcrypto/pqueue/pqueue.c | |||
| @@ -0,0 +1,252 @@ | |||
| 1 | /* crypto/pqueue/pqueue.c */ | ||
| 2 | /* | ||
| 3 | * DTLS implementation written by Nagendra Modadugu | ||
| 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | ||
| 5 | */ | ||
| 6 | /* ==================================================================== | ||
| 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions | ||
| 11 | * are met: | ||
| 12 | * | ||
| 13 | * 1. Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * | ||
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer in | ||
| 18 | * the documentation and/or other materials provided with the | ||
| 19 | * distribution. | ||
| 20 | * | ||
| 21 | * 3. All advertising materials mentioning features or use of this | ||
| 22 | * software must display the following acknowledgment: | ||
| 23 | * "This product includes software developed by the OpenSSL Project | ||
| 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 25 | * | ||
| 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 27 | * endorse or promote products derived from this software without | ||
| 28 | * prior written permission. For written permission, please contact | ||
| 29 | * openssl-core@OpenSSL.org. | ||
| 30 | * | ||
| 31 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 32 | * nor may "OpenSSL" appear in their names without prior written | ||
| 33 | * permission of the OpenSSL Project. | ||
| 34 | * | ||
| 35 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 36 | * acknowledgment: | ||
| 37 | * "This product includes software developed by the OpenSSL Project | ||
| 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 39 | * | ||
| 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 52 | * ==================================================================== | ||
| 53 | * | ||
| 54 | * This product includes cryptographic software written by Eric Young | ||
| 55 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 56 | * Hudson (tjh@cryptsoft.com). | ||
| 57 | * | ||
| 58 | */ | ||
| 59 | |||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/bn.h> | ||
| 62 | #include "pqueue.h" | ||
| 63 | |||
| 64 | typedef struct _pqueue | ||
| 65 | { | ||
| 66 | pitem *items; | ||
| 67 | int count; | ||
| 68 | } pqueue_s; | ||
| 69 | |||
| 70 | pitem * | ||
| 71 | pitem_new(unsigned char *prio64be, void *data) | ||
| 72 | { | ||
| 73 | pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem)); | ||
| 74 | if (item == NULL) return NULL; | ||
| 75 | |||
| 76 | memcpy(item->priority,prio64be,sizeof(item->priority)); | ||
| 77 | |||
| 78 | item->data = data; | ||
| 79 | item->next = NULL; | ||
| 80 | |||
| 81 | return item; | ||
| 82 | } | ||
| 83 | |||
| 84 | void | ||
| 85 | pitem_free(pitem *item) | ||
| 86 | { | ||
| 87 | if (item == NULL) return; | ||
| 88 | |||
| 89 | OPENSSL_free(item); | ||
| 90 | } | ||
| 91 | |||
| 92 | pqueue_s * | ||
| 93 | pqueue_new() | ||
| 94 | { | ||
| 95 | pqueue_s *pq = (pqueue_s *) OPENSSL_malloc(sizeof(pqueue_s)); | ||
| 96 | if (pq == NULL) return NULL; | ||
| 97 | |||
| 98 | memset(pq, 0x00, sizeof(pqueue_s)); | ||
| 99 | return pq; | ||
| 100 | } | ||
| 101 | |||
| 102 | void | ||
| 103 | pqueue_free(pqueue_s *pq) | ||
| 104 | { | ||
| 105 | if (pq == NULL) return; | ||
| 106 | |||
| 107 | OPENSSL_free(pq); | ||
| 108 | } | ||
| 109 | |||
| 110 | pitem * | ||
| 111 | pqueue_insert(pqueue_s *pq, pitem *item) | ||
| 112 | { | ||
| 113 | pitem *curr, *next; | ||
| 114 | |||
| 115 | if (pq->items == NULL) | ||
| 116 | { | ||
| 117 | pq->items = item; | ||
| 118 | return item; | ||
| 119 | } | ||
| 120 | |||
| 121 | for(curr = NULL, next = pq->items; | ||
| 122 | next != NULL; | ||
| 123 | curr = next, next = next->next) | ||
| 124 | { | ||
| 125 | /* we can compare 64-bit value in big-endian encoding | ||
| 126 | * with memcmp:-) */ | ||
| 127 | int cmp = memcmp(next->priority, item->priority,8); | ||
| 128 | if (cmp > 0) /* next > item */ | ||
| 129 | { | ||
| 130 | item->next = next; | ||
| 131 | |||
| 132 | if (curr == NULL) | ||
| 133 | pq->items = item; | ||
| 134 | else | ||
| 135 | curr->next = item; | ||
| 136 | |||
| 137 | return item; | ||
| 138 | } | ||
| 139 | |||
| 140 | else if (cmp == 0) /* duplicates not allowed */ | ||
| 141 | return NULL; | ||
| 142 | } | ||
| 143 | |||
| 144 | item->next = NULL; | ||
| 145 | curr->next = item; | ||
| 146 | |||
| 147 | return item; | ||
| 148 | } | ||
| 149 | |||
| 150 | pitem * | ||
| 151 | pqueue_peek(pqueue_s *pq) | ||
| 152 | { | ||
| 153 | return pq->items; | ||
| 154 | } | ||
| 155 | |||
| 156 | pitem * | ||
| 157 | pqueue_pop(pqueue_s *pq) | ||
| 158 | { | ||
| 159 | pitem *item = pq->items; | ||
| 160 | |||
| 161 | if (pq->items != NULL) | ||
| 162 | pq->items = pq->items->next; | ||
| 163 | |||
| 164 | return item; | ||
| 165 | } | ||
| 166 | |||
| 167 | pitem * | ||
| 168 | pqueue_find(pqueue_s *pq, unsigned char *prio64be) | ||
| 169 | { | ||
| 170 | pitem *next; | ||
| 171 | pitem *found = NULL; | ||
| 172 | |||
| 173 | if ( pq->items == NULL) | ||
| 174 | return NULL; | ||
| 175 | |||
| 176 | for ( next = pq->items; next->next != NULL; next = next->next) | ||
| 177 | { | ||
| 178 | if ( memcmp(next->priority, prio64be,8) == 0) | ||
| 179 | { | ||
| 180 | found = next; | ||
| 181 | break; | ||
| 182 | } | ||
| 183 | } | ||
| 184 | |||
| 185 | /* check the one last node */ | ||
| 186 | if ( memcmp(next->priority, prio64be,8) ==0) | ||
| 187 | found = next; | ||
| 188 | |||
| 189 | if ( ! found) | ||
| 190 | return NULL; | ||
| 191 | |||
| 192 | #if 0 /* find works in peek mode */ | ||
| 193 | if ( prev == NULL) | ||
| 194 | pq->items = next->next; | ||
| 195 | else | ||
| 196 | prev->next = next->next; | ||
| 197 | #endif | ||
| 198 | |||
| 199 | return found; | ||
| 200 | } | ||
| 201 | |||
| 202 | void | ||
| 203 | pqueue_print(pqueue_s *pq) | ||
| 204 | { | ||
| 205 | pitem *item = pq->items; | ||
| 206 | |||
| 207 | while(item != NULL) | ||
| 208 | { | ||
| 209 | printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", | ||
| 210 | item->priority[0],item->priority[1], | ||
| 211 | item->priority[2],item->priority[3], | ||
| 212 | item->priority[4],item->priority[5], | ||
| 213 | item->priority[6],item->priority[7]); | ||
| 214 | item = item->next; | ||
| 215 | } | ||
| 216 | } | ||
| 217 | |||
| 218 | pitem * | ||
| 219 | pqueue_iterator(pqueue_s *pq) | ||
| 220 | { | ||
| 221 | return pqueue_peek(pq); | ||
| 222 | } | ||
| 223 | |||
| 224 | pitem * | ||
| 225 | pqueue_next(pitem **item) | ||
| 226 | { | ||
| 227 | pitem *ret; | ||
| 228 | |||
| 229 | if ( item == NULL || *item == NULL) | ||
| 230 | return NULL; | ||
| 231 | |||
| 232 | |||
| 233 | /* *item != NULL */ | ||
| 234 | ret = *item; | ||
| 235 | *item = (*item)->next; | ||
| 236 | |||
| 237 | return ret; | ||
| 238 | } | ||
| 239 | |||
| 240 | int | ||
| 241 | pqueue_size(pqueue_s *pq) | ||
| 242 | { | ||
| 243 | pitem *item = pq->items; | ||
| 244 | int count = 0; | ||
| 245 | |||
| 246 | while(item != NULL) | ||
| 247 | { | ||
| 248 | count++; | ||
| 249 | item = item->next; | ||
| 250 | } | ||
| 251 | return count; | ||
| 252 | } | ||
diff --git a/src/lib/libcrypto/pqueue/pqueue.h b/src/lib/libcrypto/pqueue/pqueue.h new file mode 100644 index 0000000000..87fc9037c8 --- /dev/null +++ b/src/lib/libcrypto/pqueue/pqueue.h | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* crypto/pqueue/pqueue.h */ | ||
| 2 | /* | ||
| 3 | * DTLS implementation written by Nagendra Modadugu | ||
| 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. | ||
| 5 | */ | ||
| 6 | /* ==================================================================== | ||
| 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions | ||
| 11 | * are met: | ||
| 12 | * | ||
| 13 | * 1. Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * | ||
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 17 | * notice, this list of conditions and the following disclaimer in | ||
| 18 | * the documentation and/or other materials provided with the | ||
| 19 | * distribution. | ||
| 20 | * | ||
| 21 | * 3. All advertising materials mentioning features or use of this | ||
| 22 | * software must display the following acknowledgment: | ||
| 23 | * "This product includes software developed by the OpenSSL Project | ||
| 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 25 | * | ||
| 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 27 | * endorse or promote products derived from this software without | ||
| 28 | * prior written permission. For written permission, please contact | ||
| 29 | * openssl-core@OpenSSL.org. | ||
| 30 | * | ||
| 31 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 32 | * nor may "OpenSSL" appear in their names without prior written | ||
| 33 | * permission of the OpenSSL Project. | ||
| 34 | * | ||
| 35 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 36 | * acknowledgment: | ||
| 37 | * "This product includes software developed by the OpenSSL Project | ||
| 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 39 | * | ||
| 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 52 | * ==================================================================== | ||
| 53 | * | ||
| 54 | * This product includes cryptographic software written by Eric Young | ||
| 55 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 56 | * Hudson (tjh@cryptsoft.com). | ||
| 57 | * | ||
| 58 | */ | ||
| 59 | |||
| 60 | #ifndef HEADER_PQUEUE_H | ||
| 61 | #define HEADER_PQUEUE_H | ||
| 62 | |||
| 63 | #include <stdio.h> | ||
| 64 | #include <stdlib.h> | ||
| 65 | #include <string.h> | ||
| 66 | |||
| 67 | typedef struct _pqueue *pqueue; | ||
| 68 | |||
| 69 | typedef struct _pitem | ||
| 70 | { | ||
| 71 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ | ||
| 72 | void *data; | ||
| 73 | struct _pitem *next; | ||
| 74 | } pitem; | ||
| 75 | |||
| 76 | typedef struct _pitem *piterator; | ||
| 77 | |||
| 78 | pitem *pitem_new(unsigned char *prio64be, void *data); | ||
| 79 | void pitem_free(pitem *item); | ||
| 80 | |||
| 81 | pqueue pqueue_new(void); | ||
| 82 | void pqueue_free(pqueue pq); | ||
| 83 | |||
| 84 | pitem *pqueue_insert(pqueue pq, pitem *item); | ||
| 85 | pitem *pqueue_peek(pqueue pq); | ||
| 86 | pitem *pqueue_pop(pqueue pq); | ||
| 87 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); | ||
| 88 | pitem *pqueue_iterator(pqueue pq); | ||
| 89 | pitem *pqueue_next(piterator *iter); | ||
| 90 | |||
| 91 | void pqueue_print(pqueue pq); | ||
| 92 | int pqueue_size(pqueue pq); | ||
| 93 | |||
| 94 | #endif /* ! HEADER_PQUEUE_H */ | ||
diff --git a/src/lib/libcrypto/rand/Makefile b/src/lib/libcrypto/rand/Makefile new file mode 100644 index 0000000000..27694aa664 --- /dev/null +++ b/src/lib/libcrypto/rand/Makefile | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/rand/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rand | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= randtest.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=md_rand.c randfile.c rand_lib.c rand_err.c rand_egd.c \ | ||
| 21 | rand_win.c rand_unix.c rand_os2.c rand_nw.c | ||
| 22 | LIBOBJ=md_rand.o randfile.o rand_lib.o rand_err.o rand_egd.o \ | ||
| 23 | rand_win.o rand_unix.o rand_os2.o rand_nw.o | ||
| 24 | |||
| 25 | SRC= $(LIBSRC) | ||
| 26 | |||
| 27 | EXHEADER= rand.h | ||
| 28 | HEADER= $(EXHEADER) | ||
| 29 | |||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 31 | |||
| 32 | top: | ||
| 33 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 34 | |||
| 35 | all: lib | ||
| 36 | |||
| 37 | lib: $(LIBOBJ) | ||
| 38 | $(AR) $(LIB) $(LIBOBJ) | ||
| 39 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 40 | @touch lib | ||
| 41 | |||
| 42 | files: | ||
| 43 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 44 | |||
| 45 | links: | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 49 | |||
| 50 | install: | ||
| 51 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 52 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 53 | do \ | ||
| 54 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 55 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 56 | done; | ||
| 57 | |||
| 58 | tags: | ||
| 59 | ctags $(SRC) | ||
| 60 | |||
| 61 | tests: | ||
| 62 | |||
| 63 | lint: | ||
| 64 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 65 | |||
| 66 | depend: | ||
| 67 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 68 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 69 | |||
| 70 | dclean: | ||
| 71 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 72 | mv -f Makefile.new $(MAKEFILE) | ||
| 73 | |||
| 74 | clean: | ||
| 75 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 76 | |||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 78 | |||
| 79 | md_rand.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 80 | md_rand.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 81 | md_rand.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 82 | md_rand.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 83 | md_rand.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 84 | md_rand.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 85 | md_rand.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 86 | md_rand.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 87 | md_rand.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 88 | md_rand.o: md_rand.c rand_lcl.h | ||
| 89 | rand_egd.o: ../../include/openssl/buffer.h ../../include/openssl/e_os2.h | ||
| 90 | rand_egd.o: ../../include/openssl/opensslconf.h | ||
| 91 | rand_egd.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 92 | rand_egd.o: rand_egd.c | ||
| 93 | rand_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 94 | rand_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 95 | rand_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 96 | rand_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 97 | rand_err.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 98 | rand_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 99 | rand_err.o: rand_err.c | ||
| 100 | rand_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 101 | rand_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 102 | rand_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 103 | rand_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 104 | rand_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 105 | rand_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 106 | rand_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 107 | rand_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 108 | rand_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 109 | rand_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rand.h | ||
| 110 | rand_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 111 | rand_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 112 | rand_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 113 | rand_lib.o: ../cryptlib.h rand_lib.c | ||
| 114 | rand_nw.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 115 | rand_nw.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 116 | rand_nw.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 117 | rand_nw.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 118 | rand_nw.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 119 | rand_nw.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 120 | rand_nw.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 121 | rand_nw.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 122 | rand_nw.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 123 | rand_nw.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h rand_nw.c | ||
| 124 | rand_os2.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 125 | rand_os2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 126 | rand_os2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 127 | rand_os2.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 128 | rand_os2.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 129 | rand_os2.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 130 | rand_os2.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 131 | rand_os2.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 132 | rand_os2.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 133 | rand_os2.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h | ||
| 134 | rand_os2.o: rand_os2.c | ||
| 135 | rand_unix.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 136 | rand_unix.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 137 | rand_unix.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 138 | rand_unix.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 139 | rand_unix.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 140 | rand_unix.o: ../../include/openssl/objects.h | ||
| 141 | rand_unix.o: ../../include/openssl/opensslconf.h | ||
| 142 | rand_unix.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 143 | rand_unix.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 144 | rand_unix.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 145 | rand_unix.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h | ||
| 146 | rand_unix.o: rand_unix.c | ||
| 147 | rand_win.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 148 | rand_win.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 149 | rand_win.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 150 | rand_win.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 151 | rand_win.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 152 | rand_win.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 153 | rand_win.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 154 | rand_win.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 155 | rand_win.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 156 | rand_win.o: ../../include/openssl/symhacks.h ../cryptlib.h rand_lcl.h | ||
| 157 | rand_win.o: rand_win.c | ||
| 158 | randfile.o: ../../e_os.h ../../include/openssl/buffer.h | ||
| 159 | randfile.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 160 | randfile.o: ../../include/openssl/opensslconf.h | ||
| 161 | randfile.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 162 | randfile.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
| 163 | randfile.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 164 | randfile.o: randfile.c | ||
diff --git a/src/lib/libcrypto/rand/md_rand.c b/src/lib/libcrypto/rand/md_rand.c new file mode 100644 index 0000000000..88088ce73c --- /dev/null +++ b/src/lib/libcrypto/rand/md_rand.c | |||
| @@ -0,0 +1,590 @@ | |||
| 1 | /* crypto/rand/md_rand.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | |||
| 112 | #ifdef MD_RAND_DEBUG | ||
| 113 | # ifndef NDEBUG | ||
| 114 | # define NDEBUG | ||
| 115 | # endif | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #include <assert.h> | ||
| 119 | #include <stdio.h> | ||
| 120 | #include <string.h> | ||
| 121 | |||
| 122 | #include "e_os.h" | ||
| 123 | |||
| 124 | #include <openssl/rand.h> | ||
| 125 | #include "rand_lcl.h" | ||
| 126 | |||
| 127 | #include <openssl/crypto.h> | ||
| 128 | #include <openssl/err.h> | ||
| 129 | |||
| 130 | #ifdef BN_DEBUG | ||
| 131 | # define PREDICT | ||
| 132 | #endif | ||
| 133 | |||
| 134 | /* #define PREDICT 1 */ | ||
| 135 | |||
| 136 | #define STATE_SIZE 1023 | ||
| 137 | static int state_num=0,state_index=0; | ||
| 138 | static unsigned char state[STATE_SIZE+MD_DIGEST_LENGTH]; | ||
| 139 | static unsigned char md[MD_DIGEST_LENGTH]; | ||
| 140 | static long md_count[2]={0,0}; | ||
| 141 | static double entropy=0; | ||
| 142 | static int initialized=0; | ||
| 143 | |||
| 144 | static unsigned int crypto_lock_rand = 0; /* may be set only when a thread | ||
| 145 | * holds CRYPTO_LOCK_RAND | ||
| 146 | * (to prevent double locking) */ | ||
| 147 | /* access to lockin_thread is synchronized by CRYPTO_LOCK_RAND2 */ | ||
| 148 | static CRYPTO_THREADID locking_threadid; /* valid iff crypto_lock_rand is set */ | ||
| 149 | |||
| 150 | |||
| 151 | #ifdef PREDICT | ||
| 152 | int rand_predictable=0; | ||
| 153 | #endif | ||
| 154 | |||
| 155 | const char RAND_version[]="RAND" OPENSSL_VERSION_PTEXT; | ||
| 156 | |||
| 157 | static void ssleay_rand_cleanup(void); | ||
| 158 | static void ssleay_rand_seed(const void *buf, int num); | ||
| 159 | static void ssleay_rand_add(const void *buf, int num, double add_entropy); | ||
| 160 | static int ssleay_rand_bytes(unsigned char *buf, int num); | ||
| 161 | static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num); | ||
| 162 | static int ssleay_rand_status(void); | ||
| 163 | |||
| 164 | RAND_METHOD rand_ssleay_meth={ | ||
| 165 | ssleay_rand_seed, | ||
| 166 | ssleay_rand_bytes, | ||
| 167 | ssleay_rand_cleanup, | ||
| 168 | ssleay_rand_add, | ||
| 169 | ssleay_rand_pseudo_bytes, | ||
| 170 | ssleay_rand_status | ||
| 171 | }; | ||
| 172 | |||
| 173 | RAND_METHOD *RAND_SSLeay(void) | ||
| 174 | { | ||
| 175 | return(&rand_ssleay_meth); | ||
| 176 | } | ||
| 177 | |||
| 178 | static void ssleay_rand_cleanup(void) | ||
| 179 | { | ||
| 180 | OPENSSL_cleanse(state,sizeof(state)); | ||
| 181 | state_num=0; | ||
| 182 | state_index=0; | ||
| 183 | OPENSSL_cleanse(md,MD_DIGEST_LENGTH); | ||
| 184 | md_count[0]=0; | ||
| 185 | md_count[1]=0; | ||
| 186 | entropy=0; | ||
| 187 | initialized=0; | ||
| 188 | } | ||
| 189 | |||
| 190 | static void ssleay_rand_add(const void *buf, int num, double add) | ||
| 191 | { | ||
| 192 | int i,j,k,st_idx; | ||
| 193 | long md_c[2]; | ||
| 194 | unsigned char local_md[MD_DIGEST_LENGTH]; | ||
| 195 | EVP_MD_CTX m; | ||
| 196 | int do_not_lock; | ||
| 197 | |||
| 198 | /* | ||
| 199 | * (Based on the rand(3) manpage) | ||
| 200 | * | ||
| 201 | * The input is chopped up into units of 20 bytes (or less for | ||
| 202 | * the last block). Each of these blocks is run through the hash | ||
| 203 | * function as follows: The data passed to the hash function | ||
| 204 | * is the current 'md', the same number of bytes from the 'state' | ||
| 205 | * (the location determined by in incremented looping index) as | ||
| 206 | * the current 'block', the new key data 'block', and 'count' | ||
| 207 | * (which is incremented after each use). | ||
| 208 | * The result of this is kept in 'md' and also xored into the | ||
| 209 | * 'state' at the same locations that were used as input into the | ||
| 210 | * hash function. | ||
| 211 | */ | ||
| 212 | |||
| 213 | /* check if we already have the lock */ | ||
| 214 | if (crypto_lock_rand) | ||
| 215 | { | ||
| 216 | CRYPTO_THREADID cur; | ||
| 217 | CRYPTO_THREADID_current(&cur); | ||
| 218 | CRYPTO_r_lock(CRYPTO_LOCK_RAND2); | ||
| 219 | do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid, &cur); | ||
| 220 | CRYPTO_r_unlock(CRYPTO_LOCK_RAND2); | ||
| 221 | } | ||
| 222 | else | ||
| 223 | do_not_lock = 0; | ||
| 224 | |||
| 225 | if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 226 | st_idx=state_index; | ||
| 227 | |||
| 228 | /* use our own copies of the counters so that even | ||
| 229 | * if a concurrent thread seeds with exactly the | ||
| 230 | * same data and uses the same subarray there's _some_ | ||
| 231 | * difference */ | ||
| 232 | md_c[0] = md_count[0]; | ||
| 233 | md_c[1] = md_count[1]; | ||
| 234 | |||
| 235 | memcpy(local_md, md, sizeof md); | ||
| 236 | |||
| 237 | /* state_index <= state_num <= STATE_SIZE */ | ||
| 238 | state_index += num; | ||
| 239 | if (state_index >= STATE_SIZE) | ||
| 240 | { | ||
| 241 | state_index%=STATE_SIZE; | ||
| 242 | state_num=STATE_SIZE; | ||
| 243 | } | ||
| 244 | else if (state_num < STATE_SIZE) | ||
| 245 | { | ||
| 246 | if (state_index > state_num) | ||
| 247 | state_num=state_index; | ||
| 248 | } | ||
| 249 | /* state_index <= state_num <= STATE_SIZE */ | ||
| 250 | |||
| 251 | /* state[st_idx], ..., state[(st_idx + num - 1) % STATE_SIZE] | ||
| 252 | * are what we will use now, but other threads may use them | ||
| 253 | * as well */ | ||
| 254 | |||
| 255 | md_count[1] += (num / MD_DIGEST_LENGTH) + (num % MD_DIGEST_LENGTH > 0); | ||
| 256 | |||
| 257 | if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 258 | |||
| 259 | EVP_MD_CTX_init(&m); | ||
| 260 | for (i=0; i<num; i+=MD_DIGEST_LENGTH) | ||
| 261 | { | ||
| 262 | j=(num-i); | ||
| 263 | j=(j > MD_DIGEST_LENGTH)?MD_DIGEST_LENGTH:j; | ||
| 264 | |||
| 265 | MD_Init(&m); | ||
| 266 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | ||
| 267 | k=(st_idx+j)-STATE_SIZE; | ||
| 268 | if (k > 0) | ||
| 269 | { | ||
| 270 | MD_Update(&m,&(state[st_idx]),j-k); | ||
| 271 | MD_Update(&m,&(state[0]),k); | ||
| 272 | } | ||
| 273 | else | ||
| 274 | MD_Update(&m,&(state[st_idx]),j); | ||
| 275 | |||
| 276 | /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */ | ||
| 277 | MD_Update(&m,buf,j); | ||
| 278 | /* We know that line may cause programs such as | ||
| 279 | purify and valgrind to complain about use of | ||
| 280 | uninitialized data. The problem is not, it's | ||
| 281 | with the caller. Removing that line will make | ||
| 282 | sure you get really bad randomness and thereby | ||
| 283 | other problems such as very insecure keys. */ | ||
| 284 | |||
| 285 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | ||
| 286 | MD_Final(&m,local_md); | ||
| 287 | md_c[1]++; | ||
| 288 | |||
| 289 | buf=(const char *)buf + j; | ||
| 290 | |||
| 291 | for (k=0; k<j; k++) | ||
| 292 | { | ||
| 293 | /* Parallel threads may interfere with this, | ||
| 294 | * but always each byte of the new state is | ||
| 295 | * the XOR of some previous value of its | ||
| 296 | * and local_md (itermediate values may be lost). | ||
| 297 | * Alway using locking could hurt performance more | ||
| 298 | * than necessary given that conflicts occur only | ||
| 299 | * when the total seeding is longer than the random | ||
| 300 | * state. */ | ||
| 301 | state[st_idx++]^=local_md[k]; | ||
| 302 | if (st_idx >= STATE_SIZE) | ||
| 303 | st_idx=0; | ||
| 304 | } | ||
| 305 | } | ||
| 306 | EVP_MD_CTX_cleanup(&m); | ||
| 307 | |||
| 308 | if (!do_not_lock) CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 309 | /* Don't just copy back local_md into md -- this could mean that | ||
| 310 | * other thread's seeding remains without effect (except for | ||
| 311 | * the incremented counter). By XORing it we keep at least as | ||
| 312 | * much entropy as fits into md. */ | ||
| 313 | for (k = 0; k < (int)sizeof(md); k++) | ||
| 314 | { | ||
| 315 | md[k] ^= local_md[k]; | ||
| 316 | } | ||
| 317 | if (entropy < ENTROPY_NEEDED) /* stop counting when we have enough */ | ||
| 318 | entropy += add; | ||
| 319 | if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 320 | |||
| 321 | #if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) | ||
| 322 | assert(md_c[1] == md_count[1]); | ||
| 323 | #endif | ||
| 324 | } | ||
| 325 | |||
| 326 | static void ssleay_rand_seed(const void *buf, int num) | ||
| 327 | { | ||
| 328 | ssleay_rand_add(buf, num, (double)num); | ||
| 329 | } | ||
| 330 | |||
| 331 | static int ssleay_rand_bytes(unsigned char *buf, int num) | ||
| 332 | { | ||
| 333 | static volatile int stirred_pool = 0; | ||
| 334 | int i,j,k,st_num,st_idx; | ||
| 335 | int num_ceil; | ||
| 336 | int ok; | ||
| 337 | long md_c[2]; | ||
| 338 | unsigned char local_md[MD_DIGEST_LENGTH]; | ||
| 339 | EVP_MD_CTX m; | ||
| 340 | #ifndef GETPID_IS_MEANINGLESS | ||
| 341 | pid_t curr_pid = getpid(); | ||
| 342 | #endif | ||
| 343 | int do_stir_pool = 0; | ||
| 344 | |||
| 345 | #ifdef PREDICT | ||
| 346 | if (rand_predictable) | ||
| 347 | { | ||
| 348 | static unsigned char val=0; | ||
| 349 | |||
| 350 | for (i=0; i<num; i++) | ||
| 351 | buf[i]=val++; | ||
| 352 | return(1); | ||
| 353 | } | ||
| 354 | #endif | ||
| 355 | |||
| 356 | if (num <= 0) | ||
| 357 | return 1; | ||
| 358 | |||
| 359 | EVP_MD_CTX_init(&m); | ||
| 360 | /* round upwards to multiple of MD_DIGEST_LENGTH/2 */ | ||
| 361 | num_ceil = (1 + (num-1)/(MD_DIGEST_LENGTH/2)) * (MD_DIGEST_LENGTH/2); | ||
| 362 | |||
| 363 | /* | ||
| 364 | * (Based on the rand(3) manpage:) | ||
| 365 | * | ||
| 366 | * For each group of 10 bytes (or less), we do the following: | ||
| 367 | * | ||
| 368 | * Input into the hash function the local 'md' (which is initialized from | ||
| 369 | * the global 'md' before any bytes are generated), the bytes that are to | ||
| 370 | * be overwritten by the random bytes, and bytes from the 'state' | ||
| 371 | * (incrementing looping index). From this digest output (which is kept | ||
| 372 | * in 'md'), the top (up to) 10 bytes are returned to the caller and the | ||
| 373 | * bottom 10 bytes are xored into the 'state'. | ||
| 374 | * | ||
| 375 | * Finally, after we have finished 'num' random bytes for the | ||
| 376 | * caller, 'count' (which is incremented) and the local and global 'md' | ||
| 377 | * are fed into the hash function and the results are kept in the | ||
| 378 | * global 'md'. | ||
| 379 | */ | ||
| 380 | |||
| 381 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 382 | |||
| 383 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | ||
| 384 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | ||
| 385 | CRYPTO_THREADID_current(&locking_threadid); | ||
| 386 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND2); | ||
| 387 | crypto_lock_rand = 1; | ||
| 388 | |||
| 389 | if (!initialized) | ||
| 390 | { | ||
| 391 | RAND_poll(); | ||
| 392 | initialized = 1; | ||
| 393 | } | ||
| 394 | |||
| 395 | if (!stirred_pool) | ||
| 396 | do_stir_pool = 1; | ||
| 397 | |||
| 398 | ok = (entropy >= ENTROPY_NEEDED); | ||
| 399 | if (!ok) | ||
| 400 | { | ||
| 401 | /* If the PRNG state is not yet unpredictable, then seeing | ||
| 402 | * the PRNG output may help attackers to determine the new | ||
| 403 | * state; thus we have to decrease the entropy estimate. | ||
| 404 | * Once we've had enough initial seeding we don't bother to | ||
| 405 | * adjust the entropy count, though, because we're not ambitious | ||
| 406 | * to provide *information-theoretic* randomness. | ||
| 407 | * | ||
| 408 | * NOTE: This approach fails if the program forks before | ||
| 409 | * we have enough entropy. Entropy should be collected | ||
| 410 | * in a separate input pool and be transferred to the | ||
| 411 | * output pool only when the entropy limit has been reached. | ||
| 412 | */ | ||
| 413 | entropy -= num; | ||
| 414 | if (entropy < 0) | ||
| 415 | entropy = 0; | ||
| 416 | } | ||
| 417 | |||
| 418 | if (do_stir_pool) | ||
| 419 | { | ||
| 420 | /* In the output function only half of 'md' remains secret, | ||
| 421 | * so we better make sure that the required entropy gets | ||
| 422 | * 'evenly distributed' through 'state', our randomness pool. | ||
| 423 | * The input function (ssleay_rand_add) chains all of 'md', | ||
| 424 | * which makes it more suitable for this purpose. | ||
| 425 | */ | ||
| 426 | |||
| 427 | int n = STATE_SIZE; /* so that the complete pool gets accessed */ | ||
| 428 | while (n > 0) | ||
| 429 | { | ||
| 430 | #if MD_DIGEST_LENGTH > 20 | ||
| 431 | # error "Please adjust DUMMY_SEED." | ||
| 432 | #endif | ||
| 433 | #define DUMMY_SEED "...................." /* at least MD_DIGEST_LENGTH */ | ||
| 434 | /* Note that the seed does not matter, it's just that | ||
| 435 | * ssleay_rand_add expects to have something to hash. */ | ||
| 436 | ssleay_rand_add(DUMMY_SEED, MD_DIGEST_LENGTH, 0.0); | ||
| 437 | n -= MD_DIGEST_LENGTH; | ||
| 438 | } | ||
| 439 | if (ok) | ||
| 440 | stirred_pool = 1; | ||
| 441 | } | ||
| 442 | |||
| 443 | st_idx=state_index; | ||
| 444 | st_num=state_num; | ||
| 445 | md_c[0] = md_count[0]; | ||
| 446 | md_c[1] = md_count[1]; | ||
| 447 | memcpy(local_md, md, sizeof md); | ||
| 448 | |||
| 449 | state_index+=num_ceil; | ||
| 450 | if (state_index > state_num) | ||
| 451 | state_index %= state_num; | ||
| 452 | |||
| 453 | /* state[st_idx], ..., state[(st_idx + num_ceil - 1) % st_num] | ||
| 454 | * are now ours (but other threads may use them too) */ | ||
| 455 | |||
| 456 | md_count[0] += 1; | ||
| 457 | |||
| 458 | /* before unlocking, we must clear 'crypto_lock_rand' */ | ||
| 459 | crypto_lock_rand = 0; | ||
| 460 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 461 | |||
| 462 | while (num > 0) | ||
| 463 | { | ||
| 464 | /* num_ceil -= MD_DIGEST_LENGTH/2 */ | ||
| 465 | j=(num >= MD_DIGEST_LENGTH/2)?MD_DIGEST_LENGTH/2:num; | ||
| 466 | num-=j; | ||
| 467 | MD_Init(&m); | ||
| 468 | #ifndef GETPID_IS_MEANINGLESS | ||
| 469 | if (curr_pid) /* just in the first iteration to save time */ | ||
| 470 | { | ||
| 471 | MD_Update(&m,(unsigned char*)&curr_pid,sizeof curr_pid); | ||
| 472 | curr_pid = 0; | ||
| 473 | } | ||
| 474 | #endif | ||
| 475 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | ||
| 476 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | ||
| 477 | |||
| 478 | #ifndef PURIFY /* purify complains */ | ||
| 479 | /* DO NOT REMOVE THE FOLLOWING CALL TO MD_Update()! */ | ||
| 480 | MD_Update(&m,buf,j); | ||
| 481 | /* We know that line may cause programs such as | ||
| 482 | purify and valgrind to complain about use of | ||
| 483 | uninitialized data. */ | ||
| 484 | #endif | ||
| 485 | |||
| 486 | k=(st_idx+MD_DIGEST_LENGTH/2)-st_num; | ||
| 487 | if (k > 0) | ||
| 488 | { | ||
| 489 | MD_Update(&m,&(state[st_idx]),MD_DIGEST_LENGTH/2-k); | ||
| 490 | MD_Update(&m,&(state[0]),k); | ||
| 491 | } | ||
| 492 | else | ||
| 493 | MD_Update(&m,&(state[st_idx]),MD_DIGEST_LENGTH/2); | ||
| 494 | MD_Final(&m,local_md); | ||
| 495 | |||
| 496 | for (i=0; i<MD_DIGEST_LENGTH/2; i++) | ||
| 497 | { | ||
| 498 | state[st_idx++]^=local_md[i]; /* may compete with other threads */ | ||
| 499 | if (st_idx >= st_num) | ||
| 500 | st_idx=0; | ||
| 501 | if (i < j) | ||
| 502 | *(buf++)=local_md[i+MD_DIGEST_LENGTH/2]; | ||
| 503 | } | ||
| 504 | } | ||
| 505 | |||
| 506 | MD_Init(&m); | ||
| 507 | MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); | ||
| 508 | MD_Update(&m,local_md,MD_DIGEST_LENGTH); | ||
| 509 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 510 | MD_Update(&m,md,MD_DIGEST_LENGTH); | ||
| 511 | MD_Final(&m,md); | ||
| 512 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 513 | |||
| 514 | EVP_MD_CTX_cleanup(&m); | ||
| 515 | if (ok) | ||
| 516 | return(1); | ||
| 517 | else | ||
| 518 | { | ||
| 519 | RANDerr(RAND_F_SSLEAY_RAND_BYTES,RAND_R_PRNG_NOT_SEEDED); | ||
| 520 | ERR_add_error_data(1, "You need to read the OpenSSL FAQ, " | ||
| 521 | "http://www.openssl.org/support/faq.html"); | ||
| 522 | return(0); | ||
| 523 | } | ||
| 524 | } | ||
| 525 | |||
| 526 | /* pseudo-random bytes that are guaranteed to be unique but not | ||
| 527 | unpredictable */ | ||
| 528 | static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num) | ||
| 529 | { | ||
| 530 | int ret; | ||
| 531 | unsigned long err; | ||
| 532 | |||
| 533 | ret = RAND_bytes(buf, num); | ||
| 534 | if (ret == 0) | ||
| 535 | { | ||
| 536 | err = ERR_peek_error(); | ||
| 537 | if (ERR_GET_LIB(err) == ERR_LIB_RAND && | ||
| 538 | ERR_GET_REASON(err) == RAND_R_PRNG_NOT_SEEDED) | ||
| 539 | ERR_clear_error(); | ||
| 540 | } | ||
| 541 | return (ret); | ||
| 542 | } | ||
| 543 | |||
| 544 | static int ssleay_rand_status(void) | ||
| 545 | { | ||
| 546 | CRYPTO_THREADID cur; | ||
| 547 | int ret; | ||
| 548 | int do_not_lock; | ||
| 549 | |||
| 550 | CRYPTO_THREADID_current(&cur); | ||
| 551 | /* check if we already have the lock | ||
| 552 | * (could happen if a RAND_poll() implementation calls RAND_status()) */ | ||
| 553 | if (crypto_lock_rand) | ||
| 554 | { | ||
| 555 | CRYPTO_r_lock(CRYPTO_LOCK_RAND2); | ||
| 556 | do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid, &cur); | ||
| 557 | CRYPTO_r_unlock(CRYPTO_LOCK_RAND2); | ||
| 558 | } | ||
| 559 | else | ||
| 560 | do_not_lock = 0; | ||
| 561 | |||
| 562 | if (!do_not_lock) | ||
| 563 | { | ||
| 564 | CRYPTO_w_lock(CRYPTO_LOCK_RAND); | ||
| 565 | |||
| 566 | /* prevent ssleay_rand_bytes() from trying to obtain the lock again */ | ||
| 567 | CRYPTO_w_lock(CRYPTO_LOCK_RAND2); | ||
| 568 | CRYPTO_THREADID_cpy(&locking_threadid, &cur); | ||
| 569 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND2); | ||
| 570 | crypto_lock_rand = 1; | ||
| 571 | } | ||
| 572 | |||
| 573 | if (!initialized) | ||
| 574 | { | ||
| 575 | RAND_poll(); | ||
| 576 | initialized = 1; | ||
| 577 | } | ||
| 578 | |||
| 579 | ret = entropy >= ENTROPY_NEEDED; | ||
| 580 | |||
| 581 | if (!do_not_lock) | ||
| 582 | { | ||
| 583 | /* before unlocking, we must clear 'crypto_lock_rand' */ | ||
| 584 | crypto_lock_rand = 0; | ||
| 585 | |||
| 586 | CRYPTO_w_unlock(CRYPTO_LOCK_RAND); | ||
| 587 | } | ||
| 588 | |||
| 589 | return ret; | ||
| 590 | } | ||
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c new file mode 100644 index 0000000000..d53b916ebe --- /dev/null +++ b/src/lib/libcrypto/rand/rand_egd.c | |||
| @@ -0,0 +1,303 @@ | |||
| 1 | /* crypto/rand/rand_egd.c */ | ||
| 2 | /* Written by Ulf Moeller and Lutz Jaenicke for the OpenSSL project. */ | ||
| 3 | /* ==================================================================== | ||
| 4 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions | ||
| 8 | * are met: | ||
| 9 | * | ||
| 10 | * 1. Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * | ||
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer in | ||
| 15 | * the documentation and/or other materials provided with the | ||
| 16 | * distribution. | ||
| 17 | * | ||
| 18 | * 3. All advertising materials mentioning features or use of this | ||
| 19 | * software must display the following acknowledgment: | ||
| 20 | * "This product includes software developed by the OpenSSL Project | ||
| 21 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 22 | * | ||
| 23 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 24 | * endorse or promote products derived from this software without | ||
| 25 | * prior written permission. For written permission, please contact | ||
| 26 | * openssl-core@openssl.org. | ||
| 27 | * | ||
| 28 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 29 | * nor may "OpenSSL" appear in their names without prior written | ||
| 30 | * permission of the OpenSSL Project. | ||
| 31 | * | ||
| 32 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 33 | * acknowledgment: | ||
| 34 | * "This product includes software developed by the OpenSSL Project | ||
| 35 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 36 | * | ||
| 37 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 38 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 39 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 40 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 43 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 44 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 45 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 46 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 47 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 48 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 49 | * ==================================================================== | ||
| 50 | * | ||
| 51 | * This product includes cryptographic software written by Eric Young | ||
| 52 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 53 | * Hudson (tjh@cryptsoft.com). | ||
| 54 | * | ||
| 55 | */ | ||
| 56 | |||
| 57 | #include <openssl/e_os2.h> | ||
| 58 | #include <openssl/rand.h> | ||
| 59 | #include <openssl/buffer.h> | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Query the EGD <URL: http://www.lothar.com/tech/crypto/>. | ||
| 63 | * | ||
| 64 | * This module supplies three routines: | ||
| 65 | * | ||
| 66 | * RAND_query_egd_bytes(path, buf, bytes) | ||
| 67 | * will actually query "bytes" bytes of entropy form the egd-socket located | ||
| 68 | * at path and will write them to buf (if supplied) or will directly feed | ||
| 69 | * it to RAND_seed() if buf==NULL. | ||
| 70 | * The number of bytes is not limited by the maximum chunk size of EGD, | ||
| 71 | * which is 255 bytes. If more than 255 bytes are wanted, several chunks | ||
| 72 | * of entropy bytes are requested. The connection is left open until the | ||
| 73 | * query is competed. | ||
| 74 | * RAND_query_egd_bytes() returns with | ||
| 75 | * -1 if an error occured during connection or communication. | ||
| 76 | * num the number of bytes read from the EGD socket. This number is either | ||
| 77 | * the number of bytes requested or smaller, if the EGD pool is | ||
| 78 | * drained and the daemon signals that the pool is empty. | ||
| 79 | * This routine does not touch any RAND_status(). This is necessary, since | ||
| 80 | * PRNG functions may call it during initialization. | ||
| 81 | * | ||
| 82 | * RAND_egd_bytes(path, bytes) will query "bytes" bytes and have them | ||
| 83 | * used to seed the PRNG. | ||
| 84 | * RAND_egd_bytes() is a wrapper for RAND_query_egd_bytes() with buf=NULL. | ||
| 85 | * Unlike RAND_query_egd_bytes(), RAND_status() is used to test the | ||
| 86 | * seed status so that the return value can reflect the seed state: | ||
| 87 | * -1 if an error occured during connection or communication _or_ | ||
| 88 | * if the PRNG has still not received the required seeding. | ||
| 89 | * num the number of bytes read from the EGD socket. This number is either | ||
| 90 | * the number of bytes requested or smaller, if the EGD pool is | ||
| 91 | * drained and the daemon signals that the pool is empty. | ||
| 92 | * | ||
| 93 | * RAND_egd(path) will query 255 bytes and use the bytes retreived to seed | ||
| 94 | * the PRNG. | ||
| 95 | * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. | ||
| 96 | */ | ||
| 97 | |||
| 98 | #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS) | ||
| 99 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | ||
| 100 | { | ||
| 101 | return(-1); | ||
| 102 | } | ||
| 103 | int RAND_egd(const char *path) | ||
| 104 | { | ||
| 105 | return(-1); | ||
| 106 | } | ||
| 107 | |||
| 108 | int RAND_egd_bytes(const char *path,int bytes) | ||
| 109 | { | ||
| 110 | return(-1); | ||
| 111 | } | ||
| 112 | #else | ||
| 113 | #include <openssl/opensslconf.h> | ||
| 114 | #include OPENSSL_UNISTD | ||
| 115 | #include <sys/types.h> | ||
| 116 | #include <sys/socket.h> | ||
| 117 | #ifndef NO_SYS_UN_H | ||
| 118 | # ifdef OPENSSL_SYS_VXWORKS | ||
| 119 | # include <streams/un.h> | ||
| 120 | # else | ||
| 121 | # include <sys/un.h> | ||
| 122 | # endif | ||
| 123 | #else | ||
| 124 | struct sockaddr_un { | ||
| 125 | short sun_family; /* AF_UNIX */ | ||
| 126 | char sun_path[108]; /* path name (gag) */ | ||
| 127 | }; | ||
| 128 | #endif /* NO_SYS_UN_H */ | ||
| 129 | #include <string.h> | ||
| 130 | #include <errno.h> | ||
| 131 | |||
| 132 | #ifndef offsetof | ||
| 133 | # define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | ||
| 134 | #endif | ||
| 135 | |||
| 136 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) | ||
| 137 | { | ||
| 138 | int ret = 0; | ||
| 139 | struct sockaddr_un addr; | ||
| 140 | int len, num, numbytes; | ||
| 141 | int fd = -1; | ||
| 142 | int success; | ||
| 143 | unsigned char egdbuf[2], tempbuf[255], *retrievebuf; | ||
| 144 | |||
| 145 | memset(&addr, 0, sizeof(addr)); | ||
| 146 | addr.sun_family = AF_UNIX; | ||
| 147 | if (strlen(path) >= sizeof(addr.sun_path)) | ||
| 148 | return (-1); | ||
| 149 | BUF_strlcpy(addr.sun_path,path,sizeof addr.sun_path); | ||
| 150 | len = offsetof(struct sockaddr_un, sun_path) + strlen(path); | ||
| 151 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
| 152 | if (fd == -1) return (-1); | ||
| 153 | success = 0; | ||
| 154 | while (!success) | ||
| 155 | { | ||
| 156 | if (connect(fd, (struct sockaddr *)&addr, len) == 0) | ||
| 157 | success = 1; | ||
| 158 | else | ||
| 159 | { | ||
| 160 | switch (errno) | ||
| 161 | { | ||
| 162 | #ifdef EINTR | ||
| 163 | case EINTR: | ||
| 164 | #endif | ||
| 165 | #ifdef EAGAIN | ||
| 166 | case EAGAIN: | ||
| 167 | #endif | ||
| 168 | #ifdef EINPROGRESS | ||
| 169 | case EINPROGRESS: | ||
| 170 | #endif | ||
| 171 | #ifdef EALREADY | ||
| 172 | case EALREADY: | ||
| 173 | #endif | ||
| 174 | /* No error, try again */ | ||
| 175 | break; | ||
| 176 | #ifdef EISCONN | ||
| 177 | case EISCONN: | ||
| 178 | success = 1; | ||
| 179 | break; | ||
| 180 | #endif | ||
| 181 | default: | ||
| 182 | goto err; /* failure */ | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | |||
| 187 | while(bytes > 0) | ||
| 188 | { | ||
| 189 | egdbuf[0] = 1; | ||
| 190 | egdbuf[1] = bytes < 255 ? bytes : 255; | ||
| 191 | numbytes = 0; | ||
| 192 | while (numbytes != 2) | ||
| 193 | { | ||
| 194 | num = write(fd, egdbuf + numbytes, 2 - numbytes); | ||
| 195 | if (num >= 0) | ||
| 196 | numbytes += num; | ||
| 197 | else | ||
| 198 | { | ||
| 199 | switch (errno) | ||
| 200 | { | ||
| 201 | #ifdef EINTR | ||
| 202 | case EINTR: | ||
| 203 | #endif | ||
| 204 | #ifdef EAGAIN | ||
| 205 | case EAGAIN: | ||
| 206 | #endif | ||
| 207 | /* No error, try again */ | ||
| 208 | break; | ||
| 209 | default: | ||
| 210 | ret = -1; | ||
| 211 | goto err; /* failure */ | ||
| 212 | } | ||
| 213 | } | ||
| 214 | } | ||
| 215 | numbytes = 0; | ||
| 216 | while (numbytes != 1) | ||
| 217 | { | ||
| 218 | num = read(fd, egdbuf, 1); | ||
| 219 | if (num == 0) | ||
| 220 | goto err; /* descriptor closed */ | ||
| 221 | else if (num > 0) | ||
| 222 | numbytes += num; | ||
| 223 | else | ||
| 224 | { | ||
| 225 | switch (errno) | ||
| 226 | { | ||
| 227 | #ifdef EINTR | ||
| 228 | case EINTR: | ||
| 229 | #endif | ||
| 230 | #ifdef EAGAIN | ||
| 231 | case EAGAIN: | ||
| 232 | #endif | ||
| 233 | /* No error, try again */ | ||
| 234 | break; | ||
| 235 | default: | ||
| 236 | ret = -1; | ||
| 237 | goto err; /* failure */ | ||
| 238 | } | ||
| 239 | } | ||
| 240 | } | ||
| 241 | if(egdbuf[0] == 0) | ||
| 242 | goto err; | ||
| 243 | if (buf) | ||
| 244 | retrievebuf = buf + ret; | ||
| 245 | else | ||
| 246 | retrievebuf = tempbuf; | ||
| 247 | numbytes = 0; | ||
| 248 | while (numbytes != egdbuf[0]) | ||
| 249 | { | ||
| 250 | num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes); | ||
| 251 | if (num == 0) | ||
| 252 | goto err; /* descriptor closed */ | ||
| 253 | else if (num > 0) | ||
| 254 | numbytes += num; | ||
| 255 | else | ||
| 256 | { | ||
| 257 | switch (errno) | ||
| 258 | { | ||
| 259 | #ifdef EINTR | ||
| 260 | case EINTR: | ||
| 261 | #endif | ||
| 262 | #ifdef EAGAIN | ||
| 263 | case EAGAIN: | ||
| 264 | #endif | ||
| 265 | /* No error, try again */ | ||
| 266 | break; | ||
| 267 | default: | ||
| 268 | ret = -1; | ||
| 269 | goto err; /* failure */ | ||
| 270 | } | ||
| 271 | } | ||
| 272 | } | ||
| 273 | ret += egdbuf[0]; | ||
| 274 | bytes -= egdbuf[0]; | ||
| 275 | if (!buf) | ||
| 276 | RAND_seed(tempbuf, egdbuf[0]); | ||
| 277 | } | ||
| 278 | err: | ||
| 279 | if (fd != -1) close(fd); | ||
| 280 | return(ret); | ||
| 281 | } | ||
| 282 | |||
| 283 | |||
| 284 | int RAND_egd_bytes(const char *path, int bytes) | ||
| 285 | { | ||
| 286 | int num, ret = 0; | ||
| 287 | |||
| 288 | num = RAND_query_egd_bytes(path, NULL, bytes); | ||
| 289 | if (num < 1) goto err; | ||
| 290 | if (RAND_status() == 1) | ||
| 291 | ret = num; | ||
| 292 | err: | ||
| 293 | return(ret); | ||
| 294 | } | ||
| 295 | |||
| 296 | |||
| 297 | int RAND_egd(const char *path) | ||
| 298 | { | ||
| 299 | return (RAND_egd_bytes(path, 255)); | ||
| 300 | } | ||
| 301 | |||
| 302 | |||
| 303 | #endif | ||
diff --git a/src/lib/libcrypto/rand/rand_lcl.h b/src/lib/libcrypto/rand/rand_lcl.h new file mode 100644 index 0000000000..618a8ec899 --- /dev/null +++ b/src/lib/libcrypto/rand/rand_lcl.h | |||
| @@ -0,0 +1,158 @@ | |||
| 1 | /* crypto/rand/rand_lcl.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | |||
| 112 | #ifndef HEADER_RAND_LCL_H | ||
| 113 | #define HEADER_RAND_LCL_H | ||
| 114 | |||
| 115 | #define ENTROPY_NEEDED 32 /* require 256 bits = 32 bytes of randomness */ | ||
| 116 | |||
| 117 | |||
| 118 | #if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND) | ||
| 119 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) | ||
| 120 | #define USE_SHA1_RAND | ||
| 121 | #elif !defined(OPENSSL_NO_MD5) | ||
| 122 | #define USE_MD5_RAND | ||
| 123 | #elif !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES) | ||
| 124 | #define USE_MDC2_RAND | ||
| 125 | #elif !defined(OPENSSL_NO_MD2) | ||
| 126 | #define USE_MD2_RAND | ||
| 127 | #else | ||
| 128 | #error No message digest algorithm available | ||
| 129 | #endif | ||
| 130 | #endif | ||
| 131 | |||
| 132 | #include <openssl/evp.h> | ||
| 133 | #define MD_Update(a,b,c) EVP_DigestUpdate(a,b,c) | ||
| 134 | #define MD_Final(a,b) EVP_DigestFinal_ex(a,b,NULL) | ||
| 135 | #if defined(USE_MD5_RAND) | ||
| 136 | #include <openssl/md5.h> | ||
| 137 | #define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH | ||
| 138 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_md5(), NULL) | ||
| 139 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md5(), NULL) | ||
| 140 | #elif defined(USE_SHA1_RAND) | ||
| 141 | #include <openssl/sha.h> | ||
| 142 | #define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH | ||
| 143 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_sha1(), NULL) | ||
| 144 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_sha1(), NULL) | ||
| 145 | #elif defined(USE_MDC2_RAND) | ||
| 146 | #include <openssl/mdc2.h> | ||
| 147 | #define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH | ||
| 148 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_mdc2(), NULL) | ||
| 149 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_mdc2(), NULL) | ||
| 150 | #elif defined(USE_MD2_RAND) | ||
| 151 | #include <openssl/md2.h> | ||
| 152 | #define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH | ||
| 153 | #define MD_Init(a) EVP_DigestInit_ex(a,EVP_md2(), NULL) | ||
| 154 | #define MD(a,b,c) EVP_Digest(a,b,c,NULL,EVP_md2(), NULL) | ||
| 155 | #endif | ||
| 156 | |||
| 157 | |||
| 158 | #endif | ||
diff --git a/src/lib/libcrypto/rand/rand_nw.c b/src/lib/libcrypto/rand/rand_nw.c new file mode 100644 index 0000000000..8d5b8d2e32 --- /dev/null +++ b/src/lib/libcrypto/rand/rand_nw.c | |||
| @@ -0,0 +1,183 @@ | |||
| 1 | /* crypto/rand/rand_nw.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | |||
| 112 | #include "cryptlib.h" | ||
| 113 | #include <openssl/rand.h> | ||
| 114 | #include "rand_lcl.h" | ||
| 115 | |||
| 116 | #if defined (OPENSSL_SYS_NETWARE) | ||
| 117 | |||
| 118 | #if defined(NETWARE_LIBC) | ||
| 119 | #include <nks/thread.h> | ||
| 120 | #else | ||
| 121 | #include <nwthread.h> | ||
| 122 | #endif | ||
| 123 | |||
| 124 | extern int GetProcessSwitchCount(void); | ||
| 125 | #if !defined(NETWARE_LIBC) || (CURRENT_NDK_THRESHOLD < 509220000) | ||
| 126 | extern void *RunningProcess; /* declare here same as found in newer NDKs */ | ||
| 127 | extern unsigned long GetSuperHighResolutionTimer(void); | ||
| 128 | #endif | ||
| 129 | |||
| 130 | /* the FAQ indicates we need to provide at least 20 bytes (160 bits) of seed | ||
| 131 | */ | ||
| 132 | int RAND_poll(void) | ||
| 133 | { | ||
| 134 | unsigned long l; | ||
| 135 | unsigned long tsc; | ||
| 136 | int i; | ||
| 137 | |||
| 138 | /* There are several options to gather miscellaneous data | ||
| 139 | * but for now we will loop checking the time stamp counter (rdtsc) and | ||
| 140 | * the SuperHighResolutionTimer. Each iteration will collect 8 bytes | ||
| 141 | * of data but it is treated as only 1 byte of entropy. The call to | ||
| 142 | * ThreadSwitchWithDelay() will introduce additional variability into | ||
| 143 | * the data returned by rdtsc. | ||
| 144 | * | ||
| 145 | * Applications can agument the seed material by adding additional | ||
| 146 | * stuff with RAND_add() and should probably do so. | ||
| 147 | */ | ||
| 148 | l = GetProcessSwitchCount(); | ||
| 149 | RAND_add(&l,sizeof(l),1); | ||
| 150 | |||
| 151 | /* need to cast the void* to unsigned long here */ | ||
| 152 | l = (unsigned long)RunningProcess; | ||
| 153 | RAND_add(&l,sizeof(l),1); | ||
| 154 | |||
| 155 | for( i=2; i<ENTROPY_NEEDED; i++) | ||
| 156 | { | ||
| 157 | #ifdef __MWERKS__ | ||
| 158 | asm | ||
| 159 | { | ||
| 160 | rdtsc | ||
| 161 | mov tsc, eax | ||
| 162 | } | ||
| 163 | #elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | ||
| 164 | asm volatile("rdtsc":"=a"(tsc)::"edx"); | ||
| 165 | #endif | ||
| 166 | |||
| 167 | RAND_add(&tsc, sizeof(tsc), 1); | ||
| 168 | |||
| 169 | l = GetSuperHighResolutionTimer(); | ||
| 170 | RAND_add(&l, sizeof(l), 0); | ||
| 171 | |||
| 172 | # if defined(NETWARE_LIBC) | ||
| 173 | NXThreadYield(); | ||
| 174 | # else /* NETWARE_CLIB */ | ||
| 175 | ThreadSwitchWithDelay(); | ||
| 176 | # endif | ||
| 177 | } | ||
| 178 | |||
| 179 | return 1; | ||
| 180 | } | ||
| 181 | |||
| 182 | #endif | ||
| 183 | |||
diff --git a/src/lib/libcrypto/rand/rand_os2.c b/src/lib/libcrypto/rand/rand_os2.c new file mode 100644 index 0000000000..fc1e78b179 --- /dev/null +++ b/src/lib/libcrypto/rand/rand_os2.c | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /* crypto/rand/rand_os2.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | #include "cryptlib.h" | ||
| 57 | #include <openssl/rand.h> | ||
| 58 | #include "rand_lcl.h" | ||
| 59 | |||
| 60 | #ifdef OPENSSL_SYS_OS2 | ||
| 61 | |||
| 62 | #define INCL_DOSPROCESS | ||
| 63 | #define INCL_DOSPROFILE | ||
| 64 | #define INCL_DOSMISC | ||
| 65 | #define INCL_DOSMODULEMGR | ||
| 66 | #include <os2.h> | ||
| 67 | |||
| 68 | #define CMD_KI_RDCNT (0x63) | ||
| 69 | |||
| 70 | typedef struct _CPUUTIL { | ||
| 71 | ULONG ulTimeLow; /* Low 32 bits of time stamp */ | ||
| 72 | ULONG ulTimeHigh; /* High 32 bits of time stamp */ | ||
| 73 | ULONG ulIdleLow; /* Low 32 bits of idle time */ | ||
| 74 | ULONG ulIdleHigh; /* High 32 bits of idle time */ | ||
| 75 | ULONG ulBusyLow; /* Low 32 bits of busy time */ | ||
| 76 | ULONG ulBusyHigh; /* High 32 bits of busy time */ | ||
| 77 | ULONG ulIntrLow; /* Low 32 bits of interrupt time */ | ||
| 78 | ULONG ulIntrHigh; /* High 32 bits of interrupt time */ | ||
| 79 | } CPUUTIL; | ||
| 80 | |||
| 81 | #ifndef __KLIBC__ | ||
| 82 | APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1, ULONG ulParm2, ULONG ulParm3) = NULL; | ||
| 83 | APIRET APIENTRY(*DosQuerySysState) (ULONG func, ULONG arg1, ULONG pid, ULONG _res_, PVOID buf, ULONG bufsz) = NULL; | ||
| 84 | #endif | ||
| 85 | HMODULE hDoscalls = 0; | ||
| 86 | |||
| 87 | int RAND_poll(void) | ||
| 88 | { | ||
| 89 | char failed_module[20]; | ||
| 90 | QWORD qwTime; | ||
| 91 | ULONG SysVars[QSV_FOREGROUND_PROCESS]; | ||
| 92 | |||
| 93 | if (hDoscalls == 0) { | ||
| 94 | ULONG rc = DosLoadModule(failed_module, sizeof(failed_module), "DOSCALLS", &hDoscalls); | ||
| 95 | |||
| 96 | #ifndef __KLIBC__ | ||
| 97 | if (rc == 0) { | ||
| 98 | rc = DosQueryProcAddr(hDoscalls, 976, NULL, (PFN *)&DosPerfSysCall); | ||
| 99 | |||
| 100 | if (rc) | ||
| 101 | DosPerfSysCall = NULL; | ||
| 102 | |||
| 103 | rc = DosQueryProcAddr(hDoscalls, 368, NULL, (PFN *)&DosQuerySysState); | ||
| 104 | |||
| 105 | if (rc) | ||
| 106 | DosQuerySysState = NULL; | ||
| 107 | } | ||
| 108 | #endif | ||
| 109 | } | ||
| 110 | |||
| 111 | /* Sample the hi-res timer, runs at around 1.1 MHz */ | ||
| 112 | DosTmrQueryTime(&qwTime); | ||
| 113 | RAND_add(&qwTime, sizeof(qwTime), 2); | ||
| 114 | |||
| 115 | /* Sample a bunch of system variables, includes various process & memory statistics */ | ||
| 116 | DosQuerySysInfo(1, QSV_FOREGROUND_PROCESS, SysVars, sizeof(SysVars)); | ||
| 117 | RAND_add(SysVars, sizeof(SysVars), 4); | ||
| 118 | |||
| 119 | /* If available, sample CPU registers that count at CPU MHz | ||
| 120 | * Only fairly new CPUs (PPro & K6 onwards) & OS/2 versions support this | ||
| 121 | */ | ||
| 122 | if (DosPerfSysCall) { | ||
| 123 | CPUUTIL util; | ||
| 124 | |||
| 125 | if (DosPerfSysCall(CMD_KI_RDCNT, (ULONG)&util, 0, 0) == 0) { | ||
| 126 | RAND_add(&util, sizeof(util), 10); | ||
| 127 | } | ||
| 128 | else { | ||
| 129 | #ifndef __KLIBC__ | ||
| 130 | DosPerfSysCall = NULL; | ||
| 131 | #endif | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | /* DosQuerySysState() gives us a huge quantity of process, thread, memory & handle stats */ | ||
| 136 | if (DosQuerySysState) { | ||
| 137 | char *buffer = OPENSSL_malloc(256 * 1024); | ||
| 138 | |||
| 139 | if (DosQuerySysState(0x1F, 0, 0, 0, buffer, 256 * 1024) == 0) { | ||
| 140 | /* First 4 bytes in buffer is a pointer to the thread count | ||
| 141 | * there should be at least 1 byte of entropy per thread | ||
| 142 | */ | ||
| 143 | RAND_add(buffer, 256 * 1024, **(ULONG **)buffer); | ||
| 144 | } | ||
| 145 | |||
| 146 | OPENSSL_free(buffer); | ||
| 147 | return 1; | ||
| 148 | } | ||
| 149 | |||
| 150 | return 0; | ||
| 151 | } | ||
| 152 | |||
| 153 | #endif /* OPENSSL_SYS_OS2 */ | ||
diff --git a/src/lib/libcrypto/rand/rand_unix.c b/src/lib/libcrypto/rand/rand_unix.c new file mode 100644 index 0000000000..4bb9666e49 --- /dev/null +++ b/src/lib/libcrypto/rand/rand_unix.c | |||
| @@ -0,0 +1,385 @@ | |||
| 1 | /* crypto/rand/rand_unix.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | #include <stdio.h> | ||
| 112 | |||
| 113 | #define USE_SOCKETS | ||
| 114 | #include "e_os.h" | ||
| 115 | #include "cryptlib.h" | ||
| 116 | #include <openssl/rand.h> | ||
| 117 | #include "rand_lcl.h" | ||
| 118 | |||
| 119 | #if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)) | ||
| 120 | |||
| 121 | #include <sys/types.h> | ||
| 122 | #include <sys/time.h> | ||
| 123 | #include <sys/times.h> | ||
| 124 | #include <sys/stat.h> | ||
| 125 | #include <fcntl.h> | ||
| 126 | #include <unistd.h> | ||
| 127 | #include <time.h> | ||
| 128 | #if defined(OPENSSL_SYS_LINUX) /* should actually be available virtually everywhere */ | ||
| 129 | # include <poll.h> | ||
| 130 | #endif | ||
| 131 | #include <limits.h> | ||
| 132 | #ifndef FD_SETSIZE | ||
| 133 | # define FD_SETSIZE (8*sizeof(fd_set)) | ||
| 134 | #endif | ||
| 135 | |||
| 136 | #ifdef __VOS__ | ||
| 137 | int RAND_poll(void) | ||
| 138 | { | ||
| 139 | unsigned char buf[ENTROPY_NEEDED]; | ||
| 140 | pid_t curr_pid; | ||
| 141 | uid_t curr_uid; | ||
| 142 | static int first=1; | ||
| 143 | int i; | ||
| 144 | long rnd = 0; | ||
| 145 | struct timespec ts; | ||
| 146 | unsigned seed; | ||
| 147 | |||
| 148 | /* The VOS random() function starts from a static seed so its | ||
| 149 | initial value is predictable. If random() returns the | ||
| 150 | initial value, reseed it with dynamic data. The VOS | ||
| 151 | real-time clock has a granularity of 1 nsec so it should be | ||
| 152 | reasonably difficult to predict its exact value. Do not | ||
| 153 | gratuitously reseed the PRNG because other code in this | ||
| 154 | process or thread may be using it. */ | ||
| 155 | |||
| 156 | if (first) { | ||
| 157 | first = 0; | ||
| 158 | rnd = random (); | ||
| 159 | if (rnd == 1804289383) { | ||
| 160 | clock_gettime (CLOCK_REALTIME, &ts); | ||
| 161 | curr_pid = getpid(); | ||
| 162 | curr_uid = getuid(); | ||
| 163 | seed = ts.tv_sec ^ ts.tv_nsec ^ curr_pid ^ curr_uid; | ||
| 164 | srandom (seed); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | for (i = 0; i < sizeof(buf); i++) { | ||
| 169 | if (i % 4 == 0) | ||
| 170 | rnd = random(); | ||
| 171 | buf[i] = rnd; | ||
| 172 | rnd >>= 8; | ||
| 173 | } | ||
| 174 | RAND_add(buf, sizeof(buf), ENTROPY_NEEDED); | ||
| 175 | memset(buf, 0, sizeof(buf)); | ||
| 176 | |||
| 177 | return 1; | ||
| 178 | } | ||
| 179 | #elif defined __OpenBSD__ | ||
| 180 | int RAND_poll(void) | ||
| 181 | { | ||
| 182 | unsigned char buf[ENTROPY_NEEDED]; | ||
| 183 | |||
| 184 | arc4random_buf(buf, sizeof(buf)); | ||
| 185 | RAND_add(buf, sizeof(buf), sizeof(buf)); | ||
| 186 | memset(buf, 0, sizeof(buf)); | ||
| 187 | |||
| 188 | return 1; | ||
| 189 | } | ||
| 190 | #else /* !defined(__OpenBSD__) */ | ||
| 191 | int RAND_poll(void) | ||
| 192 | { | ||
| 193 | unsigned long l; | ||
| 194 | pid_t curr_pid = getpid(); | ||
| 195 | #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) | ||
| 196 | unsigned char tmpbuf[ENTROPY_NEEDED]; | ||
| 197 | int n = 0; | ||
| 198 | #endif | ||
| 199 | #ifdef DEVRANDOM | ||
| 200 | static const char *randomfiles[] = { DEVRANDOM }; | ||
| 201 | struct stat randomstats[sizeof(randomfiles)/sizeof(randomfiles[0])]; | ||
| 202 | int fd; | ||
| 203 | unsigned int i; | ||
| 204 | #endif | ||
| 205 | #ifdef DEVRANDOM_EGD | ||
| 206 | static const char *egdsockets[] = { DEVRANDOM_EGD, NULL }; | ||
| 207 | const char **egdsocket = NULL; | ||
| 208 | #endif | ||
| 209 | |||
| 210 | #ifdef DEVRANDOM | ||
| 211 | memset(randomstats,0,sizeof(randomstats)); | ||
| 212 | /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD | ||
| 213 | * have this. Use /dev/urandom if you can as /dev/random may block | ||
| 214 | * if it runs out of random entries. */ | ||
| 215 | |||
| 216 | for (i = 0; (i < sizeof(randomfiles)/sizeof(randomfiles[0])) && | ||
| 217 | (n < ENTROPY_NEEDED); i++) | ||
| 218 | { | ||
| 219 | if ((fd = open(randomfiles[i], O_RDONLY | ||
| 220 | #ifdef O_NONBLOCK | ||
| 221 | |O_NONBLOCK | ||
| 222 | #endif | ||
| 223 | #ifdef O_BINARY | ||
| 224 | |O_BINARY | ||
| 225 | #endif | ||
| 226 | #ifdef O_NOCTTY /* If it happens to be a TTY (god forbid), do not make it | ||
| 227 | our controlling tty */ | ||
| 228 | |O_NOCTTY | ||
| 229 | #endif | ||
| 230 | )) >= 0) | ||
| 231 | { | ||
| 232 | int usec = 10*1000; /* spend 10ms on each file */ | ||
| 233 | int r; | ||
| 234 | unsigned int j; | ||
| 235 | struct stat *st=&randomstats[i]; | ||
| 236 | |||
| 237 | /* Avoid using same input... Used to be O_NOFOLLOW | ||
| 238 | * above, but it's not universally appropriate... */ | ||
| 239 | if (fstat(fd,st) != 0) { close(fd); continue; } | ||
| 240 | for (j=0;j<i;j++) | ||
| 241 | { | ||
| 242 | if (randomstats[j].st_ino==st->st_ino && | ||
| 243 | randomstats[j].st_dev==st->st_dev) | ||
| 244 | break; | ||
| 245 | } | ||
| 246 | if (j<i) { close(fd); continue; } | ||
| 247 | |||
| 248 | do | ||
| 249 | { | ||
| 250 | int try_read = 0; | ||
| 251 | |||
| 252 | #if defined(OPENSSL_SYS_BEOS_R5) | ||
| 253 | /* select() is broken in BeOS R5, so we simply | ||
| 254 | * try to read something and snooze if we couldn't */ | ||
| 255 | try_read = 1; | ||
| 256 | |||
| 257 | #elif defined(OPENSSL_SYS_LINUX) | ||
| 258 | /* use poll() */ | ||
| 259 | struct pollfd pset; | ||
| 260 | |||
| 261 | pset.fd = fd; | ||
| 262 | pset.events = POLLIN; | ||
| 263 | pset.revents = 0; | ||
| 264 | |||
| 265 | if (poll(&pset, 1, usec / 1000) < 0) | ||
| 266 | usec = 0; | ||
| 267 | else | ||
| 268 | try_read = (pset.revents & POLLIN) != 0; | ||
| 269 | |||
| 270 | #else | ||
| 271 | /* use select() */ | ||
| 272 | fd_set fset; | ||
| 273 | struct timeval t; | ||
| 274 | |||
| 275 | t.tv_sec = 0; | ||
| 276 | t.tv_usec = usec; | ||
| 277 | |||
| 278 | if (FD_SETSIZE > 0 && (unsigned)fd >= FD_SETSIZE) | ||
| 279 | { | ||
| 280 | /* can't use select, so just try to read once anyway */ | ||
| 281 | try_read = 1; | ||
| 282 | } | ||
| 283 | else | ||
| 284 | { | ||
| 285 | FD_ZERO(&fset); | ||
| 286 | FD_SET(fd, &fset); | ||
| 287 | |||
| 288 | if (select(fd+1,&fset,NULL,NULL,&t) >= 0) | ||
| 289 | { | ||
| 290 | usec = t.tv_usec; | ||
| 291 | if (FD_ISSET(fd, &fset)) | ||
| 292 | try_read = 1; | ||
| 293 | } | ||
| 294 | else | ||
| 295 | usec = 0; | ||
| 296 | } | ||
| 297 | #endif | ||
| 298 | |||
| 299 | if (try_read) | ||
| 300 | { | ||
| 301 | r = read(fd,(unsigned char *)tmpbuf+n, ENTROPY_NEEDED-n); | ||
| 302 | if (r > 0) | ||
| 303 | n += r; | ||
| 304 | #if defined(OPENSSL_SYS_BEOS_R5) | ||
| 305 | if (r == 0) | ||
| 306 | snooze(t.tv_usec); | ||
| 307 | #endif | ||
| 308 | } | ||
| 309 | else | ||
| 310 | r = -1; | ||
| 311 | |||
| 312 | /* Some Unixen will update t in select(), some | ||
| 313 | won't. For those who won't, or if we | ||
| 314 | didn't use select() in the first place, | ||
| 315 | give up here, otherwise, we will do | ||
| 316 | this once again for the remaining | ||
| 317 | time. */ | ||
| 318 | if (usec == 10*1000) | ||
| 319 | usec = 0; | ||
| 320 | } | ||
| 321 | while ((r > 0 || | ||
| 322 | (errno == EINTR || errno == EAGAIN)) && usec != 0 && n < ENTROPY_NEEDED); | ||
| 323 | |||
| 324 | close(fd); | ||
| 325 | } | ||
| 326 | } | ||
| 327 | #endif /* defined(DEVRANDOM) */ | ||
| 328 | |||
| 329 | #ifdef DEVRANDOM_EGD | ||
| 330 | /* Use an EGD socket to read entropy from an EGD or PRNGD entropy | ||
| 331 | * collecting daemon. */ | ||
| 332 | |||
| 333 | for (egdsocket = egdsockets; *egdsocket && n < ENTROPY_NEEDED; egdsocket++) | ||
| 334 | { | ||
| 335 | int r; | ||
| 336 | |||
| 337 | r = RAND_query_egd_bytes(*egdsocket, (unsigned char *)tmpbuf+n, | ||
| 338 | ENTROPY_NEEDED-n); | ||
| 339 | if (r > 0) | ||
| 340 | n += r; | ||
| 341 | } | ||
| 342 | #endif /* defined(DEVRANDOM_EGD) */ | ||
| 343 | |||
| 344 | #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) | ||
| 345 | if (n > 0) | ||
| 346 | { | ||
| 347 | RAND_add(tmpbuf,sizeof tmpbuf,(double)n); | ||
| 348 | OPENSSL_cleanse(tmpbuf,n); | ||
| 349 | } | ||
| 350 | #endif | ||
| 351 | |||
| 352 | /* put in some default random data, we need more than just this */ | ||
| 353 | l=curr_pid; | ||
| 354 | RAND_add(&l,sizeof(l),0.0); | ||
| 355 | l=getuid(); | ||
| 356 | RAND_add(&l,sizeof(l),0.0); | ||
| 357 | |||
| 358 | l=time(NULL); | ||
| 359 | RAND_add(&l,sizeof(l),0.0); | ||
| 360 | |||
| 361 | #if defined(OPENSSL_SYS_BEOS) | ||
| 362 | { | ||
| 363 | system_info sysInfo; | ||
| 364 | get_system_info(&sysInfo); | ||
| 365 | RAND_add(&sysInfo,sizeof(sysInfo),0); | ||
| 366 | } | ||
| 367 | #endif | ||
| 368 | |||
| 369 | #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) | ||
| 370 | return 1; | ||
| 371 | #else | ||
| 372 | return 0; | ||
| 373 | #endif | ||
| 374 | } | ||
| 375 | |||
| 376 | #endif /* defined(__OpenBSD__) */ | ||
| 377 | #endif /* !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)) */ | ||
| 378 | |||
| 379 | |||
| 380 | #if defined(OPENSSL_SYS_VXWORKS) | ||
| 381 | int RAND_poll(void) | ||
| 382 | { | ||
| 383 | return 0; | ||
| 384 | } | ||
| 385 | #endif | ||
diff --git a/src/lib/libcrypto/rand/rand_vms.c b/src/lib/libcrypto/rand/rand_vms.c new file mode 100644 index 0000000000..1267a3acae --- /dev/null +++ b/src/lib/libcrypto/rand/rand_vms.c | |||
| @@ -0,0 +1,136 @@ | |||
| 1 | /* crypto/rand/rand_vms.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte <richard@levitte.org> for the OpenSSL | ||
| 3 | * project 2000. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/rand.h> | ||
| 60 | #include "rand_lcl.h" | ||
| 61 | |||
| 62 | #if defined(OPENSSL_SYS_VMS) | ||
| 63 | |||
| 64 | #include <descrip.h> | ||
| 65 | #include <jpidef.h> | ||
| 66 | #include <ssdef.h> | ||
| 67 | #include <starlet.h> | ||
| 68 | #ifdef __DECC | ||
| 69 | # pragma message disable DOLLARID | ||
| 70 | #endif | ||
| 71 | |||
| 72 | static struct items_data_st | ||
| 73 | { | ||
| 74 | short length, code; /* length is amount of bytes */ | ||
| 75 | } items_data[] = | ||
| 76 | { { 4, JPI$_BUFIO }, | ||
| 77 | { 4, JPI$_CPUTIM }, | ||
| 78 | { 4, JPI$_DIRIO }, | ||
| 79 | { 8, JPI$_LOGINTIM }, | ||
| 80 | { 4, JPI$_PAGEFLTS }, | ||
| 81 | { 4, JPI$_PID }, | ||
| 82 | { 4, JPI$_WSSIZE }, | ||
| 83 | { 0, 0 } | ||
| 84 | }; | ||
| 85 | |||
| 86 | int RAND_poll(void) | ||
| 87 | { | ||
| 88 | long pid, iosb[2]; | ||
| 89 | int status = 0; | ||
| 90 | struct | ||
| 91 | { | ||
| 92 | short length, code; | ||
| 93 | long *buffer; | ||
| 94 | int *retlen; | ||
| 95 | } item[32], *pitem; | ||
| 96 | unsigned char data_buffer[256]; | ||
| 97 | short total_length = 0; | ||
| 98 | struct items_data_st *pitems_data; | ||
| 99 | |||
| 100 | pitems_data = items_data; | ||
| 101 | pitem = item; | ||
| 102 | |||
| 103 | /* Setup */ | ||
| 104 | while (pitems_data->length | ||
| 105 | && (total_length + pitems_data->length <= 256)) | ||
| 106 | { | ||
| 107 | pitem->length = pitems_data->length; | ||
| 108 | pitem->code = pitems_data->code; | ||
| 109 | pitem->buffer = (long *)&data_buffer[total_length]; | ||
| 110 | pitem->retlen = 0; | ||
| 111 | total_length += pitems_data->length; | ||
| 112 | pitems_data++; | ||
| 113 | pitem++; | ||
| 114 | } | ||
| 115 | pitem->length = pitem->code = 0; | ||
| 116 | |||
| 117 | /* | ||
| 118 | * Scan through all the processes in the system and add entropy with | ||
| 119 | * results from the processes that were possible to look at. | ||
| 120 | * However, view the information as only half trustable. | ||
| 121 | */ | ||
| 122 | pid = -1; /* search context */ | ||
| 123 | while ((status = sys$getjpiw(0, &pid, 0, item, iosb, 0, 0)) | ||
| 124 | != SS$_NOMOREPROC) | ||
| 125 | { | ||
| 126 | if (status == SS$_NORMAL) | ||
| 127 | { | ||
| 128 | RAND_add(data_buffer, total_length, total_length/2); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | sys$gettim(iosb); | ||
| 132 | RAND_add((unsigned char *)iosb, sizeof(iosb), sizeof(iosb)/2); | ||
| 133 | return 1; | ||
| 134 | } | ||
| 135 | |||
| 136 | #endif | ||
diff --git a/src/lib/libcrypto/rand/rand_win.c b/src/lib/libcrypto/rand/rand_win.c new file mode 100644 index 0000000000..5d134e186b --- /dev/null +++ b/src/lib/libcrypto/rand/rand_win.c | |||
| @@ -0,0 +1,807 @@ | |||
| 1 | /* crypto/rand/rand_win.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | /* ==================================================================== | ||
| 59 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | ||
| 60 | * | ||
| 61 | * Redistribution and use in source and binary forms, with or without | ||
| 62 | * modification, are permitted provided that the following conditions | ||
| 63 | * are met: | ||
| 64 | * | ||
| 65 | * 1. Redistributions of source code must retain the above copyright | ||
| 66 | * notice, this list of conditions and the following disclaimer. | ||
| 67 | * | ||
| 68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 69 | * notice, this list of conditions and the following disclaimer in | ||
| 70 | * the documentation and/or other materials provided with the | ||
| 71 | * distribution. | ||
| 72 | * | ||
| 73 | * 3. All advertising materials mentioning features or use of this | ||
| 74 | * software must display the following acknowledgment: | ||
| 75 | * "This product includes software developed by the OpenSSL Project | ||
| 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 77 | * | ||
| 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 79 | * endorse or promote products derived from this software without | ||
| 80 | * prior written permission. For written permission, please contact | ||
| 81 | * openssl-core@openssl.org. | ||
| 82 | * | ||
| 83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 84 | * nor may "OpenSSL" appear in their names without prior written | ||
| 85 | * permission of the OpenSSL Project. | ||
| 86 | * | ||
| 87 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 88 | * acknowledgment: | ||
| 89 | * "This product includes software developed by the OpenSSL Project | ||
| 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 91 | * | ||
| 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 104 | * ==================================================================== | ||
| 105 | * | ||
| 106 | * This product includes cryptographic software written by Eric Young | ||
| 107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 108 | * Hudson (tjh@cryptsoft.com). | ||
| 109 | * | ||
| 110 | */ | ||
| 111 | |||
| 112 | #include "cryptlib.h" | ||
| 113 | #include <openssl/rand.h> | ||
| 114 | #include "rand_lcl.h" | ||
| 115 | |||
| 116 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | ||
| 117 | #include <windows.h> | ||
| 118 | #ifndef _WIN32_WINNT | ||
| 119 | # define _WIN32_WINNT 0x0400 | ||
| 120 | #endif | ||
| 121 | #include <wincrypt.h> | ||
| 122 | #include <tlhelp32.h> | ||
| 123 | |||
| 124 | /* Limit the time spent walking through the heap, processes, threads and modules to | ||
| 125 | a maximum of 1000 miliseconds each, unless CryptoGenRandom failed */ | ||
| 126 | #define MAXDELAY 1000 | ||
| 127 | |||
| 128 | /* Intel hardware RNG CSP -- available from | ||
| 129 | * http://developer.intel.com/design/security/rng/redist_license.htm | ||
| 130 | */ | ||
| 131 | #define PROV_INTEL_SEC 22 | ||
| 132 | #define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider" | ||
| 133 | |||
| 134 | static void readtimer(void); | ||
| 135 | static void readscreen(void); | ||
| 136 | |||
| 137 | /* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defined | ||
| 138 | when WINVER is 0x0500 and up, which currently only happens on Win2000. | ||
| 139 | Unfortunately, those are typedefs, so they're a little bit difficult to | ||
| 140 | detect properly. On the other hand, the macro CURSOR_SHOWING is defined | ||
| 141 | within the same conditional, so it can be use to detect the absence of said | ||
| 142 | typedefs. */ | ||
| 143 | |||
| 144 | #ifndef CURSOR_SHOWING | ||
| 145 | /* | ||
| 146 | * Information about the global cursor. | ||
| 147 | */ | ||
| 148 | typedef struct tagCURSORINFO | ||
| 149 | { | ||
| 150 | DWORD cbSize; | ||
| 151 | DWORD flags; | ||
| 152 | HCURSOR hCursor; | ||
| 153 | POINT ptScreenPos; | ||
| 154 | } CURSORINFO, *PCURSORINFO, *LPCURSORINFO; | ||
| 155 | |||
| 156 | #define CURSOR_SHOWING 0x00000001 | ||
| 157 | #endif /* CURSOR_SHOWING */ | ||
| 158 | |||
| 159 | #if !defined(OPENSSL_SYS_WINCE) | ||
| 160 | typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTW)(HCRYPTPROV *, LPCWSTR, LPCWSTR, | ||
| 161 | DWORD, DWORD); | ||
| 162 | typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); | ||
| 163 | typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); | ||
| 164 | |||
| 165 | typedef HWND (WINAPI *GETFOREGROUNDWINDOW)(VOID); | ||
| 166 | typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO); | ||
| 167 | typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT); | ||
| 168 | |||
| 169 | typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); | ||
| 170 | typedef BOOL (WINAPI *CLOSETOOLHELP32SNAPSHOT)(HANDLE); | ||
| 171 | typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, size_t); | ||
| 172 | typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); | ||
| 173 | typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); | ||
| 174 | typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); | ||
| 175 | typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32); | ||
| 176 | typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32); | ||
| 177 | |||
| 178 | #include <lmcons.h> | ||
| 179 | #include <lmstats.h> | ||
| 180 | #if 1 /* The NET API is Unicode only. It requires the use of the UNICODE | ||
| 181 | * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was | ||
| 182 | * was added to the Platform SDK to allow the NET API to be used in | ||
| 183 | * non-Unicode applications provided that Unicode strings were still | ||
| 184 | * used for input. LMSTR is defined as LPWSTR. | ||
| 185 | */ | ||
| 186 | typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET) | ||
| 187 | (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*); | ||
| 188 | typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE); | ||
| 189 | #endif /* 1 */ | ||
| 190 | #endif /* !OPENSSL_SYS_WINCE */ | ||
| 191 | |||
| 192 | int RAND_poll(void) | ||
| 193 | { | ||
| 194 | MEMORYSTATUS m; | ||
| 195 | HCRYPTPROV hProvider = 0; | ||
| 196 | DWORD w; | ||
| 197 | int good = 0; | ||
| 198 | |||
| 199 | /* Determine the OS version we are on so we can turn off things | ||
| 200 | * that do not work properly. | ||
| 201 | */ | ||
| 202 | OSVERSIONINFO osverinfo ; | ||
| 203 | osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ; | ||
| 204 | GetVersionEx( &osverinfo ) ; | ||
| 205 | |||
| 206 | #if defined(OPENSSL_SYS_WINCE) | ||
| 207 | # if defined(_WIN32_WCE) && _WIN32_WCE>=300 | ||
| 208 | /* Even though MSDN says _WIN32_WCE>=210, it doesn't seem to be available | ||
| 209 | * in commonly available implementations prior 300... */ | ||
| 210 | { | ||
| 211 | BYTE buf[64]; | ||
| 212 | /* poll the CryptoAPI PRNG */ | ||
| 213 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ | ||
| 214 | if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL, | ||
| 215 | CRYPT_VERIFYCONTEXT)) | ||
| 216 | { | ||
| 217 | if (CryptGenRandom(hProvider, sizeof(buf), buf)) | ||
| 218 | RAND_add(buf, sizeof(buf), sizeof(buf)); | ||
| 219 | CryptReleaseContext(hProvider, 0); | ||
| 220 | } | ||
| 221 | } | ||
| 222 | # endif | ||
| 223 | #else /* OPENSSL_SYS_WINCE */ | ||
| 224 | /* | ||
| 225 | * None of below libraries are present on Windows CE, which is | ||
| 226 | * why we #ifndef the whole section. This also excuses us from | ||
| 227 | * handling the GetProcAddress issue. The trouble is that in | ||
| 228 | * real Win32 API GetProcAddress is available in ANSI flavor | ||
| 229 | * only. In WinCE on the other hand GetProcAddress is a macro | ||
| 230 | * most commonly defined as GetProcAddressW, which accepts | ||
| 231 | * Unicode argument. If we were to call GetProcAddress under | ||
| 232 | * WinCE, I'd recommend to either redefine GetProcAddress as | ||
| 233 | * GetProcAddressA (there seem to be one in common CE spec) or | ||
| 234 | * implement own shim routine, which would accept ANSI argument | ||
| 235 | * and expand it to Unicode. | ||
| 236 | */ | ||
| 237 | { | ||
| 238 | /* load functions dynamically - not available on all systems */ | ||
| 239 | HMODULE advapi = LoadLibrary(TEXT("ADVAPI32.DLL")); | ||
| 240 | HMODULE kernel = LoadLibrary(TEXT("KERNEL32.DLL")); | ||
| 241 | HMODULE user = NULL; | ||
| 242 | HMODULE netapi = LoadLibrary(TEXT("NETAPI32.DLL")); | ||
| 243 | CRYPTACQUIRECONTEXTW acquire = NULL; | ||
| 244 | CRYPTGENRANDOM gen = NULL; | ||
| 245 | CRYPTRELEASECONTEXT release = NULL; | ||
| 246 | NETSTATGET netstatget = NULL; | ||
| 247 | NETFREE netfree = NULL; | ||
| 248 | BYTE buf[64]; | ||
| 249 | |||
| 250 | if (netapi) | ||
| 251 | { | ||
| 252 | netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); | ||
| 253 | netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); | ||
| 254 | } | ||
| 255 | |||
| 256 | if (netstatget && netfree) | ||
| 257 | { | ||
| 258 | LPBYTE outbuf; | ||
| 259 | /* NetStatisticsGet() is a Unicode only function | ||
| 260 | * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0 | ||
| 261 | * contains 17 fields. We treat each field as a source of | ||
| 262 | * one byte of entropy. | ||
| 263 | */ | ||
| 264 | |||
| 265 | if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) == 0) | ||
| 266 | { | ||
| 267 | RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45); | ||
| 268 | netfree(outbuf); | ||
| 269 | } | ||
| 270 | if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) == 0) | ||
| 271 | { | ||
| 272 | RAND_add(outbuf, sizeof(STAT_SERVER_0), 17); | ||
| 273 | netfree(outbuf); | ||
| 274 | } | ||
| 275 | } | ||
| 276 | |||
| 277 | if (netapi) | ||
| 278 | FreeLibrary(netapi); | ||
| 279 | |||
| 280 | /* It appears like this can cause an exception deep within ADVAPI32.DLL | ||
| 281 | * at random times on Windows 2000. Reported by Jeffrey Altman. | ||
| 282 | * Only use it on NT. | ||
| 283 | */ | ||
| 284 | /* Wolfgang Marczy <WMarczy@topcall.co.at> reports that | ||
| 285 | * the RegQueryValueEx call below can hang on NT4.0 (SP6). | ||
| 286 | * So we don't use this at all for now. */ | ||
| 287 | #if 0 | ||
| 288 | if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && | ||
| 289 | osverinfo.dwMajorVersion < 5) | ||
| 290 | { | ||
| 291 | /* Read Performance Statistics from NT/2000 registry | ||
| 292 | * The size of the performance data can vary from call | ||
| 293 | * to call so we must guess the size of the buffer to use | ||
| 294 | * and increase its size if we get an ERROR_MORE_DATA | ||
| 295 | * return instead of ERROR_SUCCESS. | ||
| 296 | */ | ||
| 297 | LONG rc=ERROR_MORE_DATA; | ||
| 298 | char * buf=NULL; | ||
| 299 | DWORD bufsz=0; | ||
| 300 | DWORD length; | ||
| 301 | |||
| 302 | while (rc == ERROR_MORE_DATA) | ||
| 303 | { | ||
| 304 | buf = realloc(buf,bufsz+8192); | ||
| 305 | if (!buf) | ||
| 306 | break; | ||
| 307 | bufsz += 8192; | ||
| 308 | |||
| 309 | length = bufsz; | ||
| 310 | rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, TEXT("Global"), | ||
| 311 | NULL, NULL, buf, &length); | ||
| 312 | } | ||
| 313 | if (rc == ERROR_SUCCESS) | ||
| 314 | { | ||
| 315 | /* For entropy count assume only least significant | ||
| 316 | * byte of each DWORD is random. | ||
| 317 | */ | ||
| 318 | RAND_add(&length, sizeof(length), 0); | ||
| 319 | RAND_add(buf, length, length / 4.0); | ||
| 320 | |||
| 321 | /* Close the Registry Key to allow Windows to cleanup/close | ||
| 322 | * the open handle | ||
| 323 | * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened | ||
| 324 | * when the RegQueryValueEx above is done. However, if | ||
| 325 | * it is not explicitly closed, it can cause disk | ||
| 326 | * partition manipulation problems. | ||
| 327 | */ | ||
| 328 | RegCloseKey(HKEY_PERFORMANCE_DATA); | ||
| 329 | } | ||
| 330 | if (buf) | ||
| 331 | free(buf); | ||
| 332 | } | ||
| 333 | #endif | ||
| 334 | |||
| 335 | if (advapi) | ||
| 336 | { | ||
| 337 | /* | ||
| 338 | * If it's available, then it's available in both ANSI | ||
| 339 | * and UNICODE flavors even in Win9x, documentation says. | ||
| 340 | * We favor Unicode... | ||
| 341 | */ | ||
| 342 | acquire = (CRYPTACQUIRECONTEXTW) GetProcAddress(advapi, | ||
| 343 | "CryptAcquireContextW"); | ||
| 344 | gen = (CRYPTGENRANDOM) GetProcAddress(advapi, | ||
| 345 | "CryptGenRandom"); | ||
| 346 | release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, | ||
| 347 | "CryptReleaseContext"); | ||
| 348 | } | ||
| 349 | |||
| 350 | if (acquire && gen && release) | ||
| 351 | { | ||
| 352 | /* poll the CryptoAPI PRNG */ | ||
| 353 | /* The CryptoAPI returns sizeof(buf) bytes of randomness */ | ||
| 354 | if (acquire(&hProvider, NULL, NULL, PROV_RSA_FULL, | ||
| 355 | CRYPT_VERIFYCONTEXT)) | ||
| 356 | { | ||
| 357 | if (gen(hProvider, sizeof(buf), buf) != 0) | ||
| 358 | { | ||
| 359 | RAND_add(buf, sizeof(buf), 0); | ||
| 360 | good = 1; | ||
| 361 | #if 0 | ||
| 362 | printf("randomness from PROV_RSA_FULL\n"); | ||
| 363 | #endif | ||
| 364 | } | ||
| 365 | release(hProvider, 0); | ||
| 366 | } | ||
| 367 | |||
| 368 | /* poll the Pentium PRG with CryptoAPI */ | ||
| 369 | if (acquire(&hProvider, 0, INTEL_DEF_PROV, PROV_INTEL_SEC, 0)) | ||
| 370 | { | ||
| 371 | if (gen(hProvider, sizeof(buf), buf) != 0) | ||
| 372 | { | ||
| 373 | RAND_add(buf, sizeof(buf), sizeof(buf)); | ||
| 374 | good = 1; | ||
| 375 | #if 0 | ||
| 376 | printf("randomness from PROV_INTEL_SEC\n"); | ||
| 377 | #endif | ||
| 378 | } | ||
| 379 | release(hProvider, 0); | ||
| 380 | } | ||
| 381 | } | ||
| 382 | |||
| 383 | if (advapi) | ||
| 384 | FreeLibrary(advapi); | ||
| 385 | |||
| 386 | if ((osverinfo.dwPlatformId != VER_PLATFORM_WIN32_NT || | ||
| 387 | !OPENSSL_isservice()) && | ||
| 388 | (user = LoadLibrary(TEXT("USER32.DLL")))) | ||
| 389 | { | ||
| 390 | GETCURSORINFO cursor; | ||
| 391 | GETFOREGROUNDWINDOW win; | ||
| 392 | GETQUEUESTATUS queue; | ||
| 393 | |||
| 394 | win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); | ||
| 395 | cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); | ||
| 396 | queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); | ||
| 397 | |||
| 398 | if (win) | ||
| 399 | { | ||
| 400 | /* window handle */ | ||
| 401 | HWND h = win(); | ||
| 402 | RAND_add(&h, sizeof(h), 0); | ||
| 403 | } | ||
| 404 | if (cursor) | ||
| 405 | { | ||
| 406 | /* unfortunately, its not safe to call GetCursorInfo() | ||
| 407 | * on NT4 even though it exists in SP3 (or SP6) and | ||
| 408 | * higher. | ||
| 409 | */ | ||
| 410 | if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && | ||
| 411 | osverinfo.dwMajorVersion < 5) | ||
| 412 | cursor = 0; | ||
| 413 | } | ||
| 414 | if (cursor) | ||
| 415 | { | ||
| 416 | /* cursor position */ | ||
| 417 | /* assume 2 bytes of entropy */ | ||
| 418 | CURSORINFO ci; | ||
| 419 | ci.cbSize = sizeof(CURSORINFO); | ||
| 420 | if (cursor(&ci)) | ||
| 421 | RAND_add(&ci, ci.cbSize, 2); | ||
| 422 | } | ||
| 423 | |||
| 424 | if (queue) | ||
| 425 | { | ||
| 426 | /* message queue status */ | ||
| 427 | /* assume 1 byte of entropy */ | ||
| 428 | w = queue(QS_ALLEVENTS); | ||
| 429 | RAND_add(&w, sizeof(w), 1); | ||
| 430 | } | ||
| 431 | |||
| 432 | FreeLibrary(user); | ||
| 433 | } | ||
| 434 | |||
| 435 | /* Toolhelp32 snapshot: enumerate processes, threads, modules and heap | ||
| 436 | * http://msdn.microsoft.com/library/psdk/winbase/toolhelp_5pfd.htm | ||
| 437 | * (Win 9x and 2000 only, not available on NT) | ||
| 438 | * | ||
| 439 | * This seeding method was proposed in Peter Gutmann, Software | ||
| 440 | * Generation of Practically Strong Random Numbers, | ||
| 441 | * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html | ||
| 442 | * revised version at http://www.cryptoengines.com/~peter/06_random.pdf | ||
| 443 | * (The assignment of entropy estimates below is arbitrary, but based | ||
| 444 | * on Peter's analysis the full poll appears to be safe. Additional | ||
| 445 | * interactive seeding is encouraged.) | ||
| 446 | */ | ||
| 447 | |||
| 448 | if (kernel) | ||
| 449 | { | ||
| 450 | CREATETOOLHELP32SNAPSHOT snap; | ||
| 451 | CLOSETOOLHELP32SNAPSHOT close_snap; | ||
| 452 | HANDLE handle; | ||
| 453 | |||
| 454 | HEAP32FIRST heap_first; | ||
| 455 | HEAP32NEXT heap_next; | ||
| 456 | HEAP32LIST heaplist_first, heaplist_next; | ||
| 457 | PROCESS32 process_first, process_next; | ||
| 458 | THREAD32 thread_first, thread_next; | ||
| 459 | MODULE32 module_first, module_next; | ||
| 460 | |||
| 461 | HEAPLIST32 hlist; | ||
| 462 | HEAPENTRY32 hentry; | ||
| 463 | PROCESSENTRY32 p; | ||
| 464 | THREADENTRY32 t; | ||
| 465 | MODULEENTRY32 m; | ||
| 466 | DWORD starttime = 0; | ||
| 467 | |||
| 468 | snap = (CREATETOOLHELP32SNAPSHOT) | ||
| 469 | GetProcAddress(kernel, "CreateToolhelp32Snapshot"); | ||
| 470 | close_snap = (CLOSETOOLHELP32SNAPSHOT) | ||
| 471 | GetProcAddress(kernel, "CloseToolhelp32Snapshot"); | ||
| 472 | heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); | ||
| 473 | heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); | ||
| 474 | heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); | ||
| 475 | heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); | ||
| 476 | process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); | ||
| 477 | process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); | ||
| 478 | thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); | ||
| 479 | thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); | ||
| 480 | module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); | ||
| 481 | module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); | ||
| 482 | |||
| 483 | if (snap && heap_first && heap_next && heaplist_first && | ||
| 484 | heaplist_next && process_first && process_next && | ||
| 485 | thread_first && thread_next && module_first && | ||
| 486 | module_next && (handle = snap(TH32CS_SNAPALL,0)) | ||
| 487 | != INVALID_HANDLE_VALUE) | ||
| 488 | { | ||
| 489 | /* heap list and heap walking */ | ||
| 490 | /* HEAPLIST32 contains 3 fields that will change with | ||
| 491 | * each entry. Consider each field a source of 1 byte | ||
| 492 | * of entropy. | ||
| 493 | * HEAPENTRY32 contains 5 fields that will change with | ||
| 494 | * each entry. Consider each field a source of 1 byte | ||
| 495 | * of entropy. | ||
| 496 | */ | ||
| 497 | ZeroMemory(&hlist, sizeof(HEAPLIST32)); | ||
| 498 | hlist.dwSize = sizeof(HEAPLIST32); | ||
| 499 | if (good) starttime = GetTickCount(); | ||
| 500 | #ifdef _MSC_VER | ||
| 501 | if (heaplist_first(handle, &hlist)) | ||
| 502 | { | ||
| 503 | /* | ||
| 504 | following discussion on dev ML, exception on WinCE (or other Win | ||
| 505 | platform) is theoretically of unknown origin; prevent infinite | ||
| 506 | loop here when this theoretical case occurs; otherwise cope with | ||
| 507 | the expected (MSDN documented) exception-throwing behaviour of | ||
| 508 | Heap32Next() on WinCE. | ||
| 509 | |||
| 510 | based on patch in original message by Tanguy Fautré (2009/03/02) | ||
| 511 | Subject: RAND_poll() and CreateToolhelp32Snapshot() stability | ||
| 512 | */ | ||
| 513 | int ex_cnt_limit = 42; | ||
| 514 | do | ||
| 515 | { | ||
| 516 | RAND_add(&hlist, hlist.dwSize, 3); | ||
| 517 | __try | ||
| 518 | { | ||
| 519 | ZeroMemory(&hentry, sizeof(HEAPENTRY32)); | ||
| 520 | hentry.dwSize = sizeof(HEAPENTRY32); | ||
| 521 | if (heap_first(&hentry, | ||
| 522 | hlist.th32ProcessID, | ||
| 523 | hlist.th32HeapID)) | ||
| 524 | { | ||
| 525 | int entrycnt = 80; | ||
| 526 | do | ||
| 527 | RAND_add(&hentry, | ||
| 528 | hentry.dwSize, 5); | ||
| 529 | while (heap_next(&hentry) | ||
| 530 | && (!good || (GetTickCount()-starttime)<MAXDELAY) | ||
| 531 | && --entrycnt > 0); | ||
| 532 | } | ||
| 533 | } | ||
| 534 | __except (EXCEPTION_EXECUTE_HANDLER) | ||
| 535 | { | ||
| 536 | /* ignore access violations when walking the heap list */ | ||
| 537 | ex_cnt_limit--; | ||
| 538 | } | ||
| 539 | } while (heaplist_next(handle, &hlist) | ||
| 540 | && (!good || (GetTickCount()-starttime)<MAXDELAY) | ||
| 541 | && ex_cnt_limit > 0); | ||
| 542 | } | ||
| 543 | |||
| 544 | #else | ||
| 545 | if (heaplist_first(handle, &hlist)) | ||
| 546 | { | ||
| 547 | do | ||
| 548 | { | ||
| 549 | RAND_add(&hlist, hlist.dwSize, 3); | ||
| 550 | hentry.dwSize = sizeof(HEAPENTRY32); | ||
| 551 | if (heap_first(&hentry, | ||
| 552 | hlist.th32ProcessID, | ||
| 553 | hlist.th32HeapID)) | ||
| 554 | { | ||
| 555 | int entrycnt = 80; | ||
| 556 | do | ||
| 557 | RAND_add(&hentry, | ||
| 558 | hentry.dwSize, 5); | ||
| 559 | while (heap_next(&hentry) | ||
| 560 | && --entrycnt > 0); | ||
| 561 | } | ||
| 562 | } while (heaplist_next(handle, &hlist) | ||
| 563 | && (!good || (GetTickCount()-starttime)<MAXDELAY)); | ||
| 564 | } | ||
| 565 | #endif | ||
| 566 | |||
| 567 | /* process walking */ | ||
| 568 | /* PROCESSENTRY32 contains 9 fields that will change | ||
| 569 | * with each entry. Consider each field a source of | ||
| 570 | * 1 byte of entropy. | ||
| 571 | */ | ||
| 572 | p.dwSize = sizeof(PROCESSENTRY32); | ||
| 573 | |||
| 574 | if (good) starttime = GetTickCount(); | ||
| 575 | if (process_first(handle, &p)) | ||
| 576 | do | ||
| 577 | RAND_add(&p, p.dwSize, 9); | ||
| 578 | while (process_next(handle, &p) && (!good || (GetTickCount()-starttime)<MAXDELAY)); | ||
| 579 | |||
| 580 | /* thread walking */ | ||
| 581 | /* THREADENTRY32 contains 6 fields that will change | ||
| 582 | * with each entry. Consider each field a source of | ||
| 583 | * 1 byte of entropy. | ||
| 584 | */ | ||
| 585 | t.dwSize = sizeof(THREADENTRY32); | ||
| 586 | if (good) starttime = GetTickCount(); | ||
| 587 | if (thread_first(handle, &t)) | ||
| 588 | do | ||
| 589 | RAND_add(&t, t.dwSize, 6); | ||
| 590 | while (thread_next(handle, &t) && (!good || (GetTickCount()-starttime)<MAXDELAY)); | ||
| 591 | |||
| 592 | /* module walking */ | ||
| 593 | /* MODULEENTRY32 contains 9 fields that will change | ||
| 594 | * with each entry. Consider each field a source of | ||
| 595 | * 1 byte of entropy. | ||
| 596 | */ | ||
| 597 | m.dwSize = sizeof(MODULEENTRY32); | ||
| 598 | if (good) starttime = GetTickCount(); | ||
| 599 | if (module_first(handle, &m)) | ||
| 600 | do | ||
| 601 | RAND_add(&m, m.dwSize, 9); | ||
| 602 | while (module_next(handle, &m) | ||
| 603 | && (!good || (GetTickCount()-starttime)<MAXDELAY)); | ||
| 604 | if (close_snap) | ||
| 605 | close_snap(handle); | ||
| 606 | else | ||
| 607 | CloseHandle(handle); | ||
| 608 | |||
| 609 | } | ||
| 610 | |||
| 611 | FreeLibrary(kernel); | ||
| 612 | } | ||
| 613 | } | ||
| 614 | #endif /* !OPENSSL_SYS_WINCE */ | ||
| 615 | |||
| 616 | /* timer data */ | ||
| 617 | readtimer(); | ||
| 618 | |||
| 619 | /* memory usage statistics */ | ||
| 620 | GlobalMemoryStatus(&m); | ||
| 621 | RAND_add(&m, sizeof(m), 1); | ||
| 622 | |||
| 623 | /* process ID */ | ||
| 624 | w = GetCurrentProcessId(); | ||
| 625 | RAND_add(&w, sizeof(w), 1); | ||
| 626 | |||
| 627 | #if 0 | ||
| 628 | printf("Exiting RAND_poll\n"); | ||
| 629 | #endif | ||
| 630 | |||
| 631 | return(1); | ||
| 632 | } | ||
| 633 | |||
| 634 | int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) | ||
| 635 | { | ||
| 636 | double add_entropy=0; | ||
| 637 | |||
| 638 | switch (iMsg) | ||
| 639 | { | ||
| 640 | case WM_KEYDOWN: | ||
| 641 | { | ||
| 642 | static WPARAM key; | ||
| 643 | if (key != wParam) | ||
| 644 | add_entropy = 0.05; | ||
| 645 | key = wParam; | ||
| 646 | } | ||
| 647 | break; | ||
| 648 | case WM_MOUSEMOVE: | ||
| 649 | { | ||
| 650 | static int lastx,lasty,lastdx,lastdy; | ||
| 651 | int x,y,dx,dy; | ||
| 652 | |||
| 653 | x=LOWORD(lParam); | ||
| 654 | y=HIWORD(lParam); | ||
| 655 | dx=lastx-x; | ||
| 656 | dy=lasty-y; | ||
| 657 | if (dx != 0 && dy != 0 && dx-lastdx != 0 && dy-lastdy != 0) | ||
| 658 | add_entropy=.2; | ||
| 659 | lastx=x, lasty=y; | ||
| 660 | lastdx=dx, lastdy=dy; | ||
| 661 | } | ||
| 662 | break; | ||
| 663 | } | ||
| 664 | |||
| 665 | readtimer(); | ||
| 666 | RAND_add(&iMsg, sizeof(iMsg), add_entropy); | ||
| 667 | RAND_add(&wParam, sizeof(wParam), 0); | ||
| 668 | RAND_add(&lParam, sizeof(lParam), 0); | ||
| 669 | |||
| 670 | return (RAND_status()); | ||
| 671 | } | ||
| 672 | |||
| 673 | |||
| 674 | void RAND_screen(void) /* function available for backward compatibility */ | ||
| 675 | { | ||
| 676 | RAND_poll(); | ||
| 677 | readscreen(); | ||
| 678 | } | ||
| 679 | |||
| 680 | |||
| 681 | /* feed timing information to the PRNG */ | ||
| 682 | static void readtimer(void) | ||
| 683 | { | ||
| 684 | DWORD w; | ||
| 685 | LARGE_INTEGER l; | ||
| 686 | static int have_perfc = 1; | ||
| 687 | #if defined(_MSC_VER) && defined(_M_X86) | ||
| 688 | static int have_tsc = 1; | ||
| 689 | DWORD cyclecount; | ||
| 690 | |||
| 691 | if (have_tsc) { | ||
| 692 | __try { | ||
| 693 | __asm { | ||
| 694 | _emit 0x0f | ||
| 695 | _emit 0x31 | ||
| 696 | mov cyclecount, eax | ||
| 697 | } | ||
| 698 | RAND_add(&cyclecount, sizeof(cyclecount), 1); | ||
| 699 | } __except(EXCEPTION_EXECUTE_HANDLER) { | ||
| 700 | have_tsc = 0; | ||
| 701 | } | ||
| 702 | } | ||
| 703 | #else | ||
| 704 | # define have_tsc 0 | ||
| 705 | #endif | ||
| 706 | |||
| 707 | if (have_perfc) { | ||
| 708 | if (QueryPerformanceCounter(&l) == 0) | ||
| 709 | have_perfc = 0; | ||
| 710 | else | ||
| 711 | RAND_add(&l, sizeof(l), 0); | ||
| 712 | } | ||
| 713 | |||
| 714 | if (!have_tsc && !have_perfc) { | ||
| 715 | w = GetTickCount(); | ||
| 716 | RAND_add(&w, sizeof(w), 0); | ||
| 717 | } | ||
| 718 | } | ||
| 719 | |||
| 720 | /* feed screen contents to PRNG */ | ||
| 721 | /***************************************************************************** | ||
| 722 | * | ||
| 723 | * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V. | ||
| 724 | * | ||
| 725 | * Code adapted from | ||
| 726 | * <URL:http://support.microsoft.com/default.aspx?scid=kb;[LN];97193>; | ||
| 727 | * the original copyright message is: | ||
| 728 | * | ||
| 729 | * (C) Copyright Microsoft Corp. 1993. All rights reserved. | ||
| 730 | * | ||
| 731 | * You have a royalty-free right to use, modify, reproduce and | ||
| 732 | * distribute the Sample Files (and/or any modified version) in | ||
| 733 | * any way you find useful, provided that you agree that | ||
| 734 | * Microsoft has no warranty obligations or liability for any | ||
| 735 | * Sample Application Files which are modified. | ||
| 736 | */ | ||
| 737 | |||
| 738 | static void readscreen(void) | ||
| 739 | { | ||
| 740 | #if !defined(OPENSSL_SYS_WINCE) && !defined(OPENSSL_SYS_WIN32_CYGWIN) | ||
| 741 | HDC hScrDC; /* screen DC */ | ||
| 742 | HDC hMemDC; /* memory DC */ | ||
| 743 | HBITMAP hBitmap; /* handle for our bitmap */ | ||
| 744 | HBITMAP hOldBitmap; /* handle for previous bitmap */ | ||
| 745 | BITMAP bm; /* bitmap properties */ | ||
| 746 | unsigned int size; /* size of bitmap */ | ||
| 747 | char *bmbits; /* contents of bitmap */ | ||
| 748 | int w; /* screen width */ | ||
| 749 | int h; /* screen height */ | ||
| 750 | int y; /* y-coordinate of screen lines to grab */ | ||
| 751 | int n = 16; /* number of screen lines to grab at a time */ | ||
| 752 | |||
| 753 | if (GetVersion() < 0x80000000 && OPENSSL_isservice()>0) | ||
| 754 | return; | ||
| 755 | |||
| 756 | /* Create a screen DC and a memory DC compatible to screen DC */ | ||
| 757 | hScrDC = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); | ||
| 758 | hMemDC = CreateCompatibleDC(hScrDC); | ||
| 759 | |||
| 760 | /* Get screen resolution */ | ||
| 761 | w = GetDeviceCaps(hScrDC, HORZRES); | ||
| 762 | h = GetDeviceCaps(hScrDC, VERTRES); | ||
| 763 | |||
| 764 | /* Create a bitmap compatible with the screen DC */ | ||
| 765 | hBitmap = CreateCompatibleBitmap(hScrDC, w, n); | ||
| 766 | |||
| 767 | /* Select new bitmap into memory DC */ | ||
| 768 | hOldBitmap = SelectObject(hMemDC, hBitmap); | ||
| 769 | |||
| 770 | /* Get bitmap properties */ | ||
| 771 | GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); | ||
| 772 | size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes; | ||
| 773 | |||
| 774 | bmbits = OPENSSL_malloc(size); | ||
| 775 | if (bmbits) { | ||
| 776 | /* Now go through the whole screen, repeatedly grabbing n lines */ | ||
| 777 | for (y = 0; y < h-n; y += n) | ||
| 778 | { | ||
| 779 | unsigned char md[MD_DIGEST_LENGTH]; | ||
| 780 | |||
| 781 | /* Bitblt screen DC to memory DC */ | ||
| 782 | BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY); | ||
| 783 | |||
| 784 | /* Copy bitmap bits from memory DC to bmbits */ | ||
| 785 | GetBitmapBits(hBitmap, size, bmbits); | ||
| 786 | |||
| 787 | /* Get the hash of the bitmap */ | ||
| 788 | MD(bmbits,size,md); | ||
| 789 | |||
| 790 | /* Seed the random generator with the hash value */ | ||
| 791 | RAND_add(md, MD_DIGEST_LENGTH, 0); | ||
| 792 | } | ||
| 793 | |||
| 794 | OPENSSL_free(bmbits); | ||
| 795 | } | ||
| 796 | |||
| 797 | /* Select old bitmap back into memory DC */ | ||
| 798 | hBitmap = SelectObject(hMemDC, hOldBitmap); | ||
| 799 | |||
| 800 | /* Clean up */ | ||
| 801 | DeleteObject(hBitmap); | ||
| 802 | DeleteDC(hMemDC); | ||
| 803 | DeleteDC(hScrDC); | ||
| 804 | #endif /* !OPENSSL_SYS_WINCE */ | ||
| 805 | } | ||
| 806 | |||
| 807 | #endif | ||
diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index bc7d9c5804..4ed40b7b70 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c | |||
| @@ -144,9 +144,7 @@ int RAND_load_file(const char *file, long bytes) | |||
| 144 | * I/O because we will waste system entropy. | 144 | * I/O because we will waste system entropy. |
| 145 | */ | 145 | */ |
| 146 | bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 2048 enough? */ | 146 | bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 2048 enough? */ |
| 147 | #ifndef OPENSSL_NO_SETVBUF_IONBF | ||
| 148 | setvbuf(in, NULL, _IONBF, 0); /* don't do buffered reads */ | 147 | setvbuf(in, NULL, _IONBF, 0); /* don't do buffered reads */ |
| 149 | #endif /* ndef OPENSSL_NO_SETVBUF_IONBF */ | ||
| 150 | } | 148 | } |
| 151 | #endif | 149 | #endif |
| 152 | for (;;) | 150 | for (;;) |
| @@ -271,6 +269,7 @@ err: | |||
| 271 | const char *RAND_file_name(char *buf, size_t size) | 269 | const char *RAND_file_name(char *buf, size_t size) |
| 272 | { | 270 | { |
| 273 | char *s=NULL; | 271 | char *s=NULL; |
| 272 | int ok = 0; | ||
| 274 | #ifdef __OpenBSD__ | 273 | #ifdef __OpenBSD__ |
| 275 | struct stat sb; | 274 | struct stat sb; |
| 276 | #endif | 275 | #endif |
| @@ -299,6 +298,7 @@ const char *RAND_file_name(char *buf, size_t size) | |||
| 299 | BUF_strlcat(buf,"/",size); | 298 | BUF_strlcat(buf,"/",size); |
| 300 | #endif | 299 | #endif |
| 301 | BUF_strlcat(buf,RFILE,size); | 300 | BUF_strlcat(buf,RFILE,size); |
| 301 | ok = 1; | ||
| 302 | } | 302 | } |
| 303 | else | 303 | else |
| 304 | buf[0] = '\0'; /* no file name */ | 304 | buf[0] = '\0'; /* no file name */ |
| @@ -312,7 +312,7 @@ const char *RAND_file_name(char *buf, size_t size) | |||
| 312 | * to something hopefully decent if that isn't available. | 312 | * to something hopefully decent if that isn't available. |
| 313 | */ | 313 | */ |
| 314 | 314 | ||
| 315 | if (!buf[0]) | 315 | if (!ok) |
| 316 | if (BUF_strlcpy(buf,"/dev/arandom",size) >= size) { | 316 | if (BUF_strlcpy(buf,"/dev/arandom",size) >= size) { |
| 317 | return(NULL); | 317 | return(NULL); |
| 318 | } | 318 | } |
diff --git a/src/lib/libcrypto/rand/randtest.c b/src/lib/libcrypto/rand/randtest.c new file mode 100644 index 0000000000..9e92a70b03 --- /dev/null +++ b/src/lib/libcrypto/rand/randtest.c | |||
| @@ -0,0 +1,219 @@ | |||
| 1 | /* crypto/rand/randtest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/rand.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | /* some FIPS 140-1 random number test */ | ||
| 66 | /* some simple tests */ | ||
| 67 | |||
| 68 | int main(int argc,char **argv) | ||
| 69 | { | ||
| 70 | unsigned char buf[2500]; | ||
| 71 | int i,j,k,s,sign,nsign,err=0; | ||
| 72 | unsigned long n1; | ||
| 73 | unsigned long n2[16]; | ||
| 74 | unsigned long runs[2][34]; | ||
| 75 | /*double d; */ | ||
| 76 | long d; | ||
| 77 | |||
| 78 | i = RAND_pseudo_bytes(buf,2500); | ||
| 79 | if (i < 0) | ||
| 80 | { | ||
| 81 | printf ("init failed, the rand method is not properly installed\n"); | ||
| 82 | err++; | ||
| 83 | goto err; | ||
| 84 | } | ||
| 85 | |||
| 86 | n1=0; | ||
| 87 | for (i=0; i<16; i++) n2[i]=0; | ||
| 88 | for (i=0; i<34; i++) runs[0][i]=runs[1][i]=0; | ||
| 89 | |||
| 90 | /* test 1 and 2 */ | ||
| 91 | sign=0; | ||
| 92 | nsign=0; | ||
| 93 | for (i=0; i<2500; i++) | ||
| 94 | { | ||
| 95 | j=buf[i]; | ||
| 96 | |||
| 97 | n2[j&0x0f]++; | ||
| 98 | n2[(j>>4)&0x0f]++; | ||
| 99 | |||
| 100 | for (k=0; k<8; k++) | ||
| 101 | { | ||
| 102 | s=(j&0x01); | ||
| 103 | if (s == sign) | ||
| 104 | nsign++; | ||
| 105 | else | ||
| 106 | { | ||
| 107 | if (nsign > 34) nsign=34; | ||
| 108 | if (nsign != 0) | ||
| 109 | { | ||
| 110 | runs[sign][nsign-1]++; | ||
| 111 | if (nsign > 6) | ||
| 112 | runs[sign][5]++; | ||
| 113 | } | ||
| 114 | sign=s; | ||
| 115 | nsign=1; | ||
| 116 | } | ||
| 117 | |||
| 118 | if (s) n1++; | ||
| 119 | j>>=1; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | if (nsign > 34) nsign=34; | ||
| 123 | if (nsign != 0) runs[sign][nsign-1]++; | ||
| 124 | |||
| 125 | /* test 1 */ | ||
| 126 | if (!((9654 < n1) && (n1 < 10346))) | ||
| 127 | { | ||
| 128 | printf("test 1 failed, X=%lu\n",n1); | ||
| 129 | err++; | ||
| 130 | } | ||
| 131 | printf("test 1 done\n"); | ||
| 132 | |||
| 133 | /* test 2 */ | ||
| 134 | #ifdef undef | ||
| 135 | d=0; | ||
| 136 | for (i=0; i<16; i++) | ||
| 137 | d+=n2[i]*n2[i]; | ||
| 138 | d=d*16.0/5000.0-5000.0; | ||
| 139 | if (!((1.03 < d) && (d < 57.4))) | ||
| 140 | { | ||
| 141 | printf("test 2 failed, X=%.2f\n",d); | ||
| 142 | err++; | ||
| 143 | } | ||
| 144 | #endif | ||
| 145 | d=0; | ||
| 146 | for (i=0; i<16; i++) | ||
| 147 | d+=n2[i]*n2[i]; | ||
| 148 | d=(d*8)/25-500000; | ||
| 149 | if (!((103 < d) && (d < 5740))) | ||
| 150 | { | ||
| 151 | printf("test 2 failed, X=%ld.%02ld\n",d/100L,d%100L); | ||
| 152 | err++; | ||
| 153 | } | ||
| 154 | printf("test 2 done\n"); | ||
| 155 | |||
| 156 | /* test 3 */ | ||
| 157 | for (i=0; i<2; i++) | ||
| 158 | { | ||
| 159 | if (!((2267 < runs[i][0]) && (runs[i][0] < 2733))) | ||
| 160 | { | ||
| 161 | printf("test 3 failed, bit=%d run=%d num=%lu\n", | ||
| 162 | i,1,runs[i][0]); | ||
| 163 | err++; | ||
| 164 | } | ||
| 165 | if (!((1079 < runs[i][1]) && (runs[i][1] < 1421))) | ||
| 166 | { | ||
| 167 | printf("test 3 failed, bit=%d run=%d num=%lu\n", | ||
| 168 | i,2,runs[i][1]); | ||
| 169 | err++; | ||
| 170 | } | ||
| 171 | if (!(( 502 < runs[i][2]) && (runs[i][2] < 748))) | ||
| 172 | { | ||
| 173 | printf("test 3 failed, bit=%d run=%d num=%lu\n", | ||
| 174 | i,3,runs[i][2]); | ||
| 175 | err++; | ||
| 176 | } | ||
| 177 | if (!(( 223 < runs[i][3]) && (runs[i][3] < 402))) | ||
| 178 | { | ||
| 179 | printf("test 3 failed, bit=%d run=%d num=%lu\n", | ||
| 180 | i,4,runs[i][3]); | ||
| 181 | err++; | ||
| 182 | } | ||
| 183 | if (!(( 90 < runs[i][4]) && (runs[i][4] < 223))) | ||
| 184 | { | ||
| 185 | printf("test 3 failed, bit=%d run=%d num=%lu\n", | ||
| 186 | i,5,runs[i][4]); | ||
| 187 | err++; | ||
| 188 | } | ||
| 189 | if (!(( 90 < runs[i][5]) && (runs[i][5] < 223))) | ||
| 190 | { | ||
| 191 | printf("test 3 failed, bit=%d run=%d num=%lu\n", | ||
| 192 | i,6,runs[i][5]); | ||
| 193 | err++; | ||
| 194 | } | ||
| 195 | } | ||
| 196 | printf("test 3 done\n"); | ||
| 197 | |||
| 198 | /* test 4 */ | ||
| 199 | if (runs[0][33] != 0) | ||
| 200 | { | ||
| 201 | printf("test 4 failed, bit=%d run=%d num=%lu\n", | ||
| 202 | 0,34,runs[0][33]); | ||
| 203 | err++; | ||
| 204 | } | ||
| 205 | if (runs[1][33] != 0) | ||
| 206 | { | ||
| 207 | printf("test 4 failed, bit=%d run=%d num=%lu\n", | ||
| 208 | 1,34,runs[1][33]); | ||
| 209 | err++; | ||
| 210 | } | ||
| 211 | printf("test 4 done\n"); | ||
| 212 | err: | ||
| 213 | err=((err)?1:0); | ||
| 214 | #ifdef OPENSSL_SYS_NETWARE | ||
| 215 | if (err) printf("ERROR: %d\n", err); | ||
| 216 | #endif | ||
| 217 | EXIT(err); | ||
| 218 | return(err); | ||
| 219 | } | ||
diff --git a/src/lib/libcrypto/rc2/Makefile b/src/lib/libcrypto/rc2/Makefile new file mode 100644 index 0000000000..73eac347e7 --- /dev/null +++ b/src/lib/libcrypto/rc2/Makefile | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/rc2/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rc2 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=rc2test.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=rc2_ecb.c rc2_skey.c rc2_cbc.c rc2cfb64.c rc2ofb64.c | ||
| 21 | LIBOBJ=rc2_ecb.o rc2_skey.o rc2_cbc.o rc2cfb64.o rc2ofb64.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= rc2.h | ||
| 26 | HEADER= rc2_locl.h $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 78 | rc2_cbc.o: rc2_cbc.c rc2_locl.h | ||
| 79 | rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 80 | rc2_ecb.o: ../../include/openssl/rc2.h rc2_ecb.c rc2_locl.h | ||
| 81 | rc2_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 82 | rc2_skey.o: rc2_locl.h rc2_skey.c | ||
| 83 | rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 84 | rc2cfb64.o: rc2_locl.h rc2cfb64.c | ||
| 85 | rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h | ||
| 86 | rc2ofb64.o: rc2_locl.h rc2ofb64.c | ||
diff --git a/src/lib/libcrypto/rc2/rc2speed.c b/src/lib/libcrypto/rc2/rc2speed.c new file mode 100644 index 0000000000..85cf6f65bf --- /dev/null +++ b/src/lib/libcrypto/rc2/rc2speed.c | |||
| @@ -0,0 +1,277 @@ | |||
| 1 | /* crypto/rc2/rc2speed.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ | ||
| 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef _IRIX | ||
| 77 | #include <time.h> | ||
| 78 | #endif | ||
| 79 | #ifdef TIMES | ||
| 80 | #include <sys/types.h> | ||
| 81 | #include <sys/times.h> | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 85 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 86 | undefine TIMES, since that tells the rest of the program how things | ||
| 87 | should be handled. -- Richard Levitte */ | ||
| 88 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 89 | #undef TIMES | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef TIMES | ||
| 93 | #include <sys/timeb.h> | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(sun) || defined(__ultrix) | ||
| 97 | #define _POSIX_SOURCE | ||
| 98 | #include <limits.h> | ||
| 99 | #include <sys/param.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #include <openssl/rc2.h> | ||
| 103 | |||
| 104 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 105 | #ifndef HZ | ||
| 106 | #ifndef CLK_TCK | ||
| 107 | #define HZ 100.0 | ||
| 108 | #else /* CLK_TCK */ | ||
| 109 | #define HZ ((double)CLK_TCK) | ||
| 110 | #endif /* CLK_TCK */ | ||
| 111 | #endif /* HZ */ | ||
| 112 | |||
| 113 | #define BUFSIZE ((long)1024) | ||
| 114 | long run=0; | ||
| 115 | |||
| 116 | double Time_F(int s); | ||
| 117 | #ifdef SIGALRM | ||
| 118 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) | ||
| 119 | #define SIGRETTYPE void | ||
| 120 | #else | ||
| 121 | #define SIGRETTYPE int | ||
| 122 | #endif | ||
| 123 | |||
| 124 | SIGRETTYPE sig_done(int sig); | ||
| 125 | SIGRETTYPE sig_done(int sig) | ||
| 126 | { | ||
| 127 | signal(SIGALRM,sig_done); | ||
| 128 | run=0; | ||
| 129 | #ifdef LINT | ||
| 130 | sig=sig; | ||
| 131 | #endif | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | |||
| 135 | #define START 0 | ||
| 136 | #define STOP 1 | ||
| 137 | |||
| 138 | double Time_F(int s) | ||
| 139 | { | ||
| 140 | double ret; | ||
| 141 | #ifdef TIMES | ||
| 142 | static struct tms tstart,tend; | ||
| 143 | |||
| 144 | if (s == START) | ||
| 145 | { | ||
| 146 | times(&tstart); | ||
| 147 | return(0); | ||
| 148 | } | ||
| 149 | else | ||
| 150 | { | ||
| 151 | times(&tend); | ||
| 152 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 153 | return((ret == 0.0)?1e-6:ret); | ||
| 154 | } | ||
| 155 | #else /* !times() */ | ||
| 156 | static struct timeb tstart,tend; | ||
| 157 | long i; | ||
| 158 | |||
| 159 | if (s == START) | ||
| 160 | { | ||
| 161 | ftime(&tstart); | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | else | ||
| 165 | { | ||
| 166 | ftime(&tend); | ||
| 167 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 168 | ret=((double)(tend.time-tstart.time))+((double)i)/1e3; | ||
| 169 | return((ret == 0.0)?1e-6:ret); | ||
| 170 | } | ||
| 171 | #endif | ||
| 172 | } | ||
| 173 | |||
| 174 | int main(int argc, char **argv) | ||
| 175 | { | ||
| 176 | long count; | ||
| 177 | static unsigned char buf[BUFSIZE]; | ||
| 178 | static unsigned char key[] ={ | ||
| 179 | 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, | ||
| 180 | 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, | ||
| 181 | }; | ||
| 182 | RC2_KEY sch; | ||
| 183 | double a,b,c,d; | ||
| 184 | #ifndef SIGALRM | ||
| 185 | long ca,cb,cc; | ||
| 186 | #endif | ||
| 187 | |||
| 188 | #ifndef TIMES | ||
| 189 | printf("To get the most accurate results, try to run this\n"); | ||
| 190 | printf("program when this computer is idle.\n"); | ||
| 191 | #endif | ||
| 192 | |||
| 193 | #ifndef SIGALRM | ||
| 194 | printf("First we calculate the approximate speed ...\n"); | ||
| 195 | RC2_set_key(&sch,16,key,128); | ||
| 196 | count=10; | ||
| 197 | do { | ||
| 198 | long i; | ||
| 199 | unsigned long data[2]; | ||
| 200 | |||
| 201 | count*=2; | ||
| 202 | Time_F(START); | ||
| 203 | for (i=count; i; i--) | ||
| 204 | RC2_encrypt(data,&sch); | ||
| 205 | d=Time_F(STOP); | ||
| 206 | } while (d < 3.0); | ||
| 207 | ca=count/512; | ||
| 208 | cb=count; | ||
| 209 | cc=count*8/BUFSIZE+1; | ||
| 210 | printf("Doing RC2_set_key %ld times\n",ca); | ||
| 211 | #define COND(d) (count != (d)) | ||
| 212 | #define COUNT(d) (d) | ||
| 213 | #else | ||
| 214 | #define COND(c) (run) | ||
| 215 | #define COUNT(d) (count) | ||
| 216 | signal(SIGALRM,sig_done); | ||
| 217 | printf("Doing RC2_set_key for 10 seconds\n"); | ||
| 218 | alarm(10); | ||
| 219 | #endif | ||
| 220 | |||
| 221 | Time_F(START); | ||
| 222 | for (count=0,run=1; COND(ca); count+=4) | ||
| 223 | { | ||
| 224 | RC2_set_key(&sch,16,key,128); | ||
| 225 | RC2_set_key(&sch,16,key,128); | ||
| 226 | RC2_set_key(&sch,16,key,128); | ||
| 227 | RC2_set_key(&sch,16,key,128); | ||
| 228 | } | ||
| 229 | d=Time_F(STOP); | ||
| 230 | printf("%ld RC2_set_key's in %.2f seconds\n",count,d); | ||
| 231 | a=((double)COUNT(ca))/d; | ||
| 232 | |||
| 233 | #ifdef SIGALRM | ||
| 234 | printf("Doing RC2_encrypt's for 10 seconds\n"); | ||
| 235 | alarm(10); | ||
| 236 | #else | ||
| 237 | printf("Doing RC2_encrypt %ld times\n",cb); | ||
| 238 | #endif | ||
| 239 | Time_F(START); | ||
| 240 | for (count=0,run=1; COND(cb); count+=4) | ||
| 241 | { | ||
| 242 | unsigned long data[2]; | ||
| 243 | |||
| 244 | RC2_encrypt(data,&sch); | ||
| 245 | RC2_encrypt(data,&sch); | ||
| 246 | RC2_encrypt(data,&sch); | ||
| 247 | RC2_encrypt(data,&sch); | ||
| 248 | } | ||
| 249 | d=Time_F(STOP); | ||
| 250 | printf("%ld RC2_encrypt's in %.2f second\n",count,d); | ||
| 251 | b=((double)COUNT(cb)*8)/d; | ||
| 252 | |||
| 253 | #ifdef SIGALRM | ||
| 254 | printf("Doing RC2_cbc_encrypt on %ld byte blocks for 10 seconds\n", | ||
| 255 | BUFSIZE); | ||
| 256 | alarm(10); | ||
| 257 | #else | ||
| 258 | printf("Doing RC2_cbc_encrypt %ld times on %ld byte blocks\n",cc, | ||
| 259 | BUFSIZE); | ||
| 260 | #endif | ||
| 261 | Time_F(START); | ||
| 262 | for (count=0,run=1; COND(cc); count++) | ||
| 263 | RC2_cbc_encrypt(buf,buf,BUFSIZE,&sch, | ||
| 264 | &(key[0]),RC2_ENCRYPT); | ||
| 265 | d=Time_F(STOP); | ||
| 266 | printf("%ld RC2_cbc_encrypt's of %ld byte blocks in %.2f second\n", | ||
| 267 | count,BUFSIZE,d); | ||
| 268 | c=((double)COUNT(cc)*BUFSIZE)/d; | ||
| 269 | |||
| 270 | printf("RC2 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); | ||
| 271 | printf("RC2 raw ecb bytes per sec = %12.2f (%9.3fuS)\n",b,8.0e6/b); | ||
| 272 | printf("RC2 cbc bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); | ||
| 273 | exit(0); | ||
| 274 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 275 | return(0); | ||
| 276 | #endif | ||
| 277 | } | ||
diff --git a/src/lib/libcrypto/rc2/rc2test.c b/src/lib/libcrypto/rc2/rc2test.c new file mode 100644 index 0000000000..0e117436bb --- /dev/null +++ b/src/lib/libcrypto/rc2/rc2test.c | |||
| @@ -0,0 +1,274 @@ | |||
| 1 | /* crypto/rc2/rc2test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* This has been a quickly hacked 'ideatest.c'. When I add tests for other | ||
| 60 | * RC2 modes, more of the code will be uncommented. */ | ||
| 61 | |||
| 62 | #include <stdio.h> | ||
| 63 | #include <string.h> | ||
| 64 | #include <stdlib.h> | ||
| 65 | |||
| 66 | #include "../e_os.h" | ||
| 67 | |||
| 68 | #ifdef OPENSSL_NO_RC2 | ||
| 69 | int main(int argc, char *argv[]) | ||
| 70 | { | ||
| 71 | printf("No RC2 support\n"); | ||
| 72 | return(0); | ||
| 73 | } | ||
| 74 | #else | ||
| 75 | #include <openssl/rc2.h> | ||
| 76 | |||
| 77 | static unsigned char RC2key[4][16]={ | ||
| 78 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 79 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 80 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 81 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, | ||
| 82 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 83 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 84 | {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, | ||
| 85 | 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F}, | ||
| 86 | }; | ||
| 87 | |||
| 88 | static unsigned char RC2plain[4][8]={ | ||
| 89 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 90 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 91 | {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}, | ||
| 92 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 93 | }; | ||
| 94 | |||
| 95 | static unsigned char RC2cipher[4][8]={ | ||
| 96 | {0x1C,0x19,0x8A,0x83,0x8D,0xF0,0x28,0xB7}, | ||
| 97 | {0x21,0x82,0x9C,0x78,0xA9,0xF9,0xC0,0x74}, | ||
| 98 | {0x13,0xDB,0x35,0x17,0xD3,0x21,0x86,0x9E}, | ||
| 99 | {0x50,0xDC,0x01,0x62,0xBD,0x75,0x7F,0x31}, | ||
| 100 | }; | ||
| 101 | /************/ | ||
| 102 | #ifdef undef | ||
| 103 | unsigned char k[16]={ | ||
| 104 | 0x00,0x01,0x00,0x02,0x00,0x03,0x00,0x04, | ||
| 105 | 0x00,0x05,0x00,0x06,0x00,0x07,0x00,0x08}; | ||
| 106 | |||
| 107 | unsigned char in[8]={0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x03}; | ||
| 108 | unsigned char c[8]={0x11,0xFB,0xED,0x2B,0x01,0x98,0x6D,0xE5}; | ||
| 109 | unsigned char out[80]; | ||
| 110 | |||
| 111 | char *text="Hello to all people out there"; | ||
| 112 | |||
| 113 | static unsigned char cfb_key[16]={ | ||
| 114 | 0xe1,0xf0,0xc3,0xd2,0xa5,0xb4,0x87,0x96, | ||
| 115 | 0x69,0x78,0x4b,0x5a,0x2d,0x3c,0x0f,0x1e, | ||
| 116 | }; | ||
| 117 | static unsigned char cfb_iv[80]={0x34,0x12,0x78,0x56,0xab,0x90,0xef,0xcd}; | ||
| 118 | static unsigned char cfb_buf1[40],cfb_buf2[40],cfb_tmp[8]; | ||
| 119 | #define CFB_TEST_SIZE 24 | ||
| 120 | static unsigned char plain[CFB_TEST_SIZE]= | ||
| 121 | { | ||
| 122 | 0x4e,0x6f,0x77,0x20,0x69,0x73, | ||
| 123 | 0x20,0x74,0x68,0x65,0x20,0x74, | ||
| 124 | 0x69,0x6d,0x65,0x20,0x66,0x6f, | ||
| 125 | 0x72,0x20,0x61,0x6c,0x6c,0x20 | ||
| 126 | }; | ||
| 127 | static unsigned char cfb_cipher64[CFB_TEST_SIZE]={ | ||
| 128 | 0x59,0xD8,0xE2,0x65,0x00,0x58,0x6C,0x3F, | ||
| 129 | 0x2C,0x17,0x25,0xD0,0x1A,0x38,0xB7,0x2A, | ||
| 130 | 0x39,0x61,0x37,0xDC,0x79,0xFB,0x9F,0x45 | ||
| 131 | |||
| 132 | /* 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38, | ||
| 133 | 0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9, | ||
| 134 | 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/ | ||
| 135 | }; | ||
| 136 | |||
| 137 | |||
| 138 | /*static int cfb64_test(unsigned char *cfb_cipher);*/ | ||
| 139 | static char *pt(unsigned char *p); | ||
| 140 | #endif | ||
| 141 | |||
| 142 | int main(int argc, char *argv[]) | ||
| 143 | { | ||
| 144 | int i,n,err=0; | ||
| 145 | RC2_KEY key; | ||
| 146 | unsigned char buf[8],buf2[8]; | ||
| 147 | |||
| 148 | for (n=0; n<4; n++) | ||
| 149 | { | ||
| 150 | RC2_set_key(&key,16,&(RC2key[n][0]),0 /* or 1024 */); | ||
| 151 | |||
| 152 | RC2_ecb_encrypt(&(RC2plain[n][0]),buf,&key,RC2_ENCRYPT); | ||
| 153 | if (memcmp(&(RC2cipher[n][0]),buf,8) != 0) | ||
| 154 | { | ||
| 155 | printf("ecb rc2 error encrypting\n"); | ||
| 156 | printf("got :"); | ||
| 157 | for (i=0; i<8; i++) | ||
| 158 | printf("%02X ",buf[i]); | ||
| 159 | printf("\n"); | ||
| 160 | printf("expected:"); | ||
| 161 | for (i=0; i<8; i++) | ||
| 162 | printf("%02X ",RC2cipher[n][i]); | ||
| 163 | err=20; | ||
| 164 | printf("\n"); | ||
| 165 | } | ||
| 166 | |||
| 167 | RC2_ecb_encrypt(buf,buf2,&key,RC2_DECRYPT); | ||
| 168 | if (memcmp(&(RC2plain[n][0]),buf2,8) != 0) | ||
| 169 | { | ||
| 170 | printf("ecb RC2 error decrypting\n"); | ||
| 171 | printf("got :"); | ||
| 172 | for (i=0; i<8; i++) | ||
| 173 | printf("%02X ",buf[i]); | ||
| 174 | printf("\n"); | ||
| 175 | printf("expected:"); | ||
| 176 | for (i=0; i<8; i++) | ||
| 177 | printf("%02X ",RC2plain[n][i]); | ||
| 178 | printf("\n"); | ||
| 179 | err=3; | ||
| 180 | } | ||
| 181 | } | ||
| 182 | |||
| 183 | if (err == 0) printf("ecb RC2 ok\n"); | ||
| 184 | #ifdef undef | ||
| 185 | memcpy(iv,k,8); | ||
| 186 | idea_cbc_encrypt((unsigned char *)text,out,strlen(text)+1,&key,iv,1); | ||
| 187 | memcpy(iv,k,8); | ||
| 188 | idea_cbc_encrypt(out,out,8,&dkey,iv,0); | ||
| 189 | idea_cbc_encrypt(&(out[8]),&(out[8]),strlen(text)+1-8,&dkey,iv,0); | ||
| 190 | if (memcmp(text,out,strlen(text)+1) != 0) | ||
| 191 | { | ||
| 192 | printf("cbc idea bad\n"); | ||
| 193 | err=4; | ||
| 194 | } | ||
| 195 | else | ||
| 196 | printf("cbc idea ok\n"); | ||
| 197 | |||
| 198 | printf("cfb64 idea "); | ||
| 199 | if (cfb64_test(cfb_cipher64)) | ||
| 200 | { | ||
| 201 | printf("bad\n"); | ||
| 202 | err=5; | ||
| 203 | } | ||
| 204 | else | ||
| 205 | printf("ok\n"); | ||
| 206 | #endif | ||
| 207 | |||
| 208 | #ifdef OPENSSL_SYS_NETWARE | ||
| 209 | if (err) printf("ERROR: %d\n", err); | ||
| 210 | #endif | ||
| 211 | EXIT(err); | ||
| 212 | return(err); | ||
| 213 | } | ||
| 214 | |||
| 215 | #ifdef undef | ||
| 216 | static int cfb64_test(unsigned char *cfb_cipher) | ||
| 217 | { | ||
| 218 | IDEA_KEY_SCHEDULE eks,dks; | ||
| 219 | int err=0,i,n; | ||
| 220 | |||
| 221 | idea_set_encrypt_key(cfb_key,&eks); | ||
| 222 | idea_set_decrypt_key(&eks,&dks); | ||
| 223 | memcpy(cfb_tmp,cfb_iv,8); | ||
| 224 | n=0; | ||
| 225 | idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks, | ||
| 226 | cfb_tmp,&n,IDEA_ENCRYPT); | ||
| 227 | idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]), | ||
| 228 | (long)CFB_TEST_SIZE-12,&eks, | ||
| 229 | cfb_tmp,&n,IDEA_ENCRYPT); | ||
| 230 | if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0) | ||
| 231 | { | ||
| 232 | err=1; | ||
| 233 | printf("idea_cfb64_encrypt encrypt error\n"); | ||
| 234 | for (i=0; i<CFB_TEST_SIZE; i+=8) | ||
| 235 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 236 | } | ||
| 237 | memcpy(cfb_tmp,cfb_iv,8); | ||
| 238 | n=0; | ||
| 239 | idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks, | ||
| 240 | cfb_tmp,&n,IDEA_DECRYPT); | ||
| 241 | idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), | ||
| 242 | (long)CFB_TEST_SIZE-17,&dks, | ||
| 243 | cfb_tmp,&n,IDEA_DECRYPT); | ||
| 244 | if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0) | ||
| 245 | { | ||
| 246 | err=1; | ||
| 247 | printf("idea_cfb_encrypt decrypt error\n"); | ||
| 248 | for (i=0; i<24; i+=8) | ||
| 249 | printf("%s\n",pt(&(cfb_buf2[i]))); | ||
| 250 | } | ||
| 251 | return(err); | ||
| 252 | } | ||
| 253 | |||
| 254 | static char *pt(unsigned char *p) | ||
| 255 | { | ||
| 256 | static char bufs[10][20]; | ||
| 257 | static int bnum=0; | ||
| 258 | char *ret; | ||
| 259 | int i; | ||
| 260 | static char *f="0123456789ABCDEF"; | ||
| 261 | |||
| 262 | ret= &(bufs[bnum++][0]); | ||
| 263 | bnum%=10; | ||
| 264 | for (i=0; i<8; i++) | ||
| 265 | { | ||
| 266 | ret[i*2]=f[(p[i]>>4)&0xf]; | ||
| 267 | ret[i*2+1]=f[p[i]&0xf]; | ||
| 268 | } | ||
| 269 | ret[16]='\0'; | ||
| 270 | return(ret); | ||
| 271 | } | ||
| 272 | |||
| 273 | #endif | ||
| 274 | #endif | ||
diff --git a/src/lib/libcrypto/rc2/tab.c b/src/lib/libcrypto/rc2/tab.c new file mode 100644 index 0000000000..25dc14eeba --- /dev/null +++ b/src/lib/libcrypto/rc2/tab.c | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | |||
| 3 | unsigned char ebits_to_num[256]={ | ||
| 4 | 0xbd,0x56,0xea,0xf2,0xa2,0xf1,0xac,0x2a, | ||
| 5 | 0xb0,0x93,0xd1,0x9c,0x1b,0x33,0xfd,0xd0, | ||
| 6 | 0x30,0x04,0xb6,0xdc,0x7d,0xdf,0x32,0x4b, | ||
| 7 | 0xf7,0xcb,0x45,0x9b,0x31,0xbb,0x21,0x5a, | ||
| 8 | 0x41,0x9f,0xe1,0xd9,0x4a,0x4d,0x9e,0xda, | ||
| 9 | 0xa0,0x68,0x2c,0xc3,0x27,0x5f,0x80,0x36, | ||
| 10 | 0x3e,0xee,0xfb,0x95,0x1a,0xfe,0xce,0xa8, | ||
| 11 | 0x34,0xa9,0x13,0xf0,0xa6,0x3f,0xd8,0x0c, | ||
| 12 | 0x78,0x24,0xaf,0x23,0x52,0xc1,0x67,0x17, | ||
| 13 | 0xf5,0x66,0x90,0xe7,0xe8,0x07,0xb8,0x60, | ||
| 14 | 0x48,0xe6,0x1e,0x53,0xf3,0x92,0xa4,0x72, | ||
| 15 | 0x8c,0x08,0x15,0x6e,0x86,0x00,0x84,0xfa, | ||
| 16 | 0xf4,0x7f,0x8a,0x42,0x19,0xf6,0xdb,0xcd, | ||
| 17 | 0x14,0x8d,0x50,0x12,0xba,0x3c,0x06,0x4e, | ||
| 18 | 0xec,0xb3,0x35,0x11,0xa1,0x88,0x8e,0x2b, | ||
| 19 | 0x94,0x99,0xb7,0x71,0x74,0xd3,0xe4,0xbf, | ||
| 20 | 0x3a,0xde,0x96,0x0e,0xbc,0x0a,0xed,0x77, | ||
| 21 | 0xfc,0x37,0x6b,0x03,0x79,0x89,0x62,0xc6, | ||
| 22 | 0xd7,0xc0,0xd2,0x7c,0x6a,0x8b,0x22,0xa3, | ||
| 23 | 0x5b,0x05,0x5d,0x02,0x75,0xd5,0x61,0xe3, | ||
| 24 | 0x18,0x8f,0x55,0x51,0xad,0x1f,0x0b,0x5e, | ||
| 25 | 0x85,0xe5,0xc2,0x57,0x63,0xca,0x3d,0x6c, | ||
| 26 | 0xb4,0xc5,0xcc,0x70,0xb2,0x91,0x59,0x0d, | ||
| 27 | 0x47,0x20,0xc8,0x4f,0x58,0xe0,0x01,0xe2, | ||
| 28 | 0x16,0x38,0xc4,0x6f,0x3b,0x0f,0x65,0x46, | ||
| 29 | 0xbe,0x7e,0x2d,0x7b,0x82,0xf9,0x40,0xb5, | ||
| 30 | 0x1d,0x73,0xf8,0xeb,0x26,0xc7,0x87,0x97, | ||
| 31 | 0x25,0x54,0xb1,0x28,0xaa,0x98,0x9d,0xa5, | ||
| 32 | 0x64,0x6d,0x7a,0xd4,0x10,0x81,0x44,0xef, | ||
| 33 | 0x49,0xd6,0xae,0x2e,0xdd,0x76,0x5c,0x2f, | ||
| 34 | 0xa7,0x1c,0xc9,0x09,0x69,0x9a,0x83,0xcf, | ||
| 35 | 0x29,0x39,0xb9,0xe9,0x4c,0xff,0x43,0xab, | ||
| 36 | }; | ||
| 37 | |||
| 38 | unsigned char num_to_ebits[256]={ | ||
| 39 | 0x5d,0xbe,0x9b,0x8b,0x11,0x99,0x6e,0x4d, | ||
| 40 | 0x59,0xf3,0x85,0xa6,0x3f,0xb7,0x83,0xc5, | ||
| 41 | 0xe4,0x73,0x6b,0x3a,0x68,0x5a,0xc0,0x47, | ||
| 42 | 0xa0,0x64,0x34,0x0c,0xf1,0xd0,0x52,0xa5, | ||
| 43 | 0xb9,0x1e,0x96,0x43,0x41,0xd8,0xd4,0x2c, | ||
| 44 | 0xdb,0xf8,0x07,0x77,0x2a,0xca,0xeb,0xef, | ||
| 45 | 0x10,0x1c,0x16,0x0d,0x38,0x72,0x2f,0x89, | ||
| 46 | 0xc1,0xf9,0x80,0xc4,0x6d,0xae,0x30,0x3d, | ||
| 47 | 0xce,0x20,0x63,0xfe,0xe6,0x1a,0xc7,0xb8, | ||
| 48 | 0x50,0xe8,0x24,0x17,0xfc,0x25,0x6f,0xbb, | ||
| 49 | 0x6a,0xa3,0x44,0x53,0xd9,0xa2,0x01,0xab, | ||
| 50 | 0xbc,0xb6,0x1f,0x98,0xee,0x9a,0xa7,0x2d, | ||
| 51 | 0x4f,0x9e,0x8e,0xac,0xe0,0xc6,0x49,0x46, | ||
| 52 | 0x29,0xf4,0x94,0x8a,0xaf,0xe1,0x5b,0xc3, | ||
| 53 | 0xb3,0x7b,0x57,0xd1,0x7c,0x9c,0xed,0x87, | ||
| 54 | 0x40,0x8c,0xe2,0xcb,0x93,0x14,0xc9,0x61, | ||
| 55 | 0x2e,0xe5,0xcc,0xf6,0x5e,0xa8,0x5c,0xd6, | ||
| 56 | 0x75,0x8d,0x62,0x95,0x58,0x69,0x76,0xa1, | ||
| 57 | 0x4a,0xb5,0x55,0x09,0x78,0x33,0x82,0xd7, | ||
| 58 | 0xdd,0x79,0xf5,0x1b,0x0b,0xde,0x26,0x21, | ||
| 59 | 0x28,0x74,0x04,0x97,0x56,0xdf,0x3c,0xf0, | ||
| 60 | 0x37,0x39,0xdc,0xff,0x06,0xa4,0xea,0x42, | ||
| 61 | 0x08,0xda,0xb4,0x71,0xb0,0xcf,0x12,0x7a, | ||
| 62 | 0x4e,0xfa,0x6c,0x1d,0x84,0x00,0xc8,0x7f, | ||
| 63 | 0x91,0x45,0xaa,0x2b,0xc2,0xb1,0x8f,0xd5, | ||
| 64 | 0xba,0xf2,0xad,0x19,0xb2,0x67,0x36,0xf7, | ||
| 65 | 0x0f,0x0a,0x92,0x7d,0xe3,0x9d,0xe9,0x90, | ||
| 66 | 0x3e,0x23,0x27,0x66,0x13,0xec,0x81,0x15, | ||
| 67 | 0xbd,0x22,0xbf,0x9f,0x7e,0xa9,0x51,0x4b, | ||
| 68 | 0x4c,0xfb,0x02,0xd3,0x70,0x86,0x31,0xe7, | ||
| 69 | 0x3b,0x05,0x03,0x54,0x60,0x48,0x65,0x18, | ||
| 70 | 0xd2,0xcd,0x5f,0x32,0x88,0x0e,0x35,0xfd, | ||
| 71 | }; | ||
| 72 | |||
| 73 | main() | ||
| 74 | { | ||
| 75 | int i,j; | ||
| 76 | |||
| 77 | for (i=0; i<256; i++) | ||
| 78 | { | ||
| 79 | for (j=0; j<256; j++) | ||
| 80 | if (ebits_to_num[j] == i) | ||
| 81 | { | ||
| 82 | printf("0x%02x,",j); | ||
| 83 | break; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | } | ||
diff --git a/src/lib/libcrypto/rc4/Makefile b/src/lib/libcrypto/rc4/Makefile new file mode 100644 index 0000000000..264451a213 --- /dev/null +++ b/src/lib/libcrypto/rc4/Makefile | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/rc4/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rc4 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | RC4_ENC=rc4_enc.o rc4_skey.o | ||
| 14 | |||
| 15 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 16 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 17 | AFLAGS= $(ASFLAGS) | ||
| 18 | |||
| 19 | GENERAL=Makefile | ||
| 20 | TEST=rc4test.c | ||
| 21 | APPS= | ||
| 22 | |||
| 23 | LIB=$(TOP)/libcrypto.a | ||
| 24 | LIBSRC=rc4_skey.c rc4_enc.c | ||
| 25 | LIBOBJ=$(RC4_ENC) | ||
| 26 | |||
| 27 | SRC= $(LIBSRC) | ||
| 28 | |||
| 29 | EXHEADER= rc4.h | ||
| 30 | HEADER= $(EXHEADER) rc4_locl.h | ||
| 31 | |||
| 32 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 33 | |||
| 34 | top: | ||
| 35 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 36 | |||
| 37 | all: lib | ||
| 38 | |||
| 39 | lib: $(LIBOBJ) | ||
| 40 | $(AR) $(LIB) $(LIBOBJ) | ||
| 41 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 42 | @touch lib | ||
| 43 | |||
| 44 | rc4-586.s: asm/rc4-586.pl ../perlasm/x86asm.pl | ||
| 45 | $(PERL) asm/rc4-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ | ||
| 46 | |||
| 47 | rc4-x86_64.s: asm/rc4-x86_64.pl | ||
| 48 | $(PERL) asm/rc4-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 49 | |||
| 50 | rc4-ia64.S: asm/rc4-ia64.pl | ||
| 51 | $(PERL) asm/rc4-ia64.pl $(CFLAGS) > $@ | ||
| 52 | |||
| 53 | rc4-s390x.s: asm/rc4-s390x.pl | ||
| 54 | $(PERL) asm/rc4-s390x.pl > $@ | ||
| 55 | |||
| 56 | rc4-ia64.s: rc4-ia64.S | ||
| 57 | @case `awk '/^#define RC4_INT/{print$$NF}' $(TOP)/include/openssl/opensslconf.h` in \ | ||
| 58 | int) set -x; $(CC) $(CFLAGS) -DSZ=4 -E rc4-ia64.S > $@ ;; \ | ||
| 59 | char) set -x; $(CC) $(CFLAGS) -DSZ=1 -E rc4-ia64.S > $@ ;; \ | ||
| 60 | *) exit 1 ;; \ | ||
| 61 | esac | ||
| 62 | |||
| 63 | files: | ||
| 64 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 65 | |||
| 66 | links: | ||
| 67 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 68 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 69 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 70 | |||
| 71 | install: | ||
| 72 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 73 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 74 | do \ | ||
| 75 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 76 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 77 | done; | ||
| 78 | |||
| 79 | tags: | ||
| 80 | ctags $(SRC) | ||
| 81 | |||
| 82 | tests: | ||
| 83 | |||
| 84 | lint: | ||
| 85 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 86 | |||
| 87 | depend: | ||
| 88 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 89 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 90 | |||
| 91 | dclean: | ||
| 92 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 93 | mv -f Makefile.new $(MAKEFILE) | ||
| 94 | |||
| 95 | clean: | ||
| 96 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 97 | |||
| 98 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 99 | |||
| 100 | rc4_enc.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 101 | rc4_enc.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 102 | rc4_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 103 | rc4_enc.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 104 | rc4_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 105 | rc4_enc.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h | ||
| 106 | rc4_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 107 | rc4_enc.o: ../cryptlib.h rc4_enc.c rc4_locl.h | ||
| 108 | rc4_skey.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 109 | rc4_skey.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 110 | rc4_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 111 | rc4_skey.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 112 | rc4_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 113 | rc4_skey.o: ../../include/openssl/rc4.h ../../include/openssl/safestack.h | ||
| 114 | rc4_skey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 115 | rc4_skey.o: ../cryptlib.h rc4_locl.h rc4_skey.c | ||
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl index 677be5fe25..544386bf53 100755 --- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | |||
| @@ -279,7 +279,7 @@ RC4_set_key: | |||
| 279 | xor %r10,%r10 | 279 | xor %r10,%r10 |
| 280 | xor %r11,%r11 | 280 | xor %r11,%r11 |
| 281 | 281 | ||
| 282 | mov OPENSSL_ia32cap_P(%rip),$idx#d | 282 | mov PIC_GOT(OPENSSL_ia32cap_P),$idx#d |
| 283 | bt \$20,$idx#d | 283 | bt \$20,$idx#d |
| 284 | jnc .Lw1stloop | 284 | jnc .Lw1stloop |
| 285 | bt \$30,$idx#d | 285 | bt \$30,$idx#d |
| @@ -346,7 +346,7 @@ RC4_set_key: | |||
| 346 | .align 16 | 346 | .align 16 |
| 347 | RC4_options: | 347 | RC4_options: |
| 348 | lea .Lopts(%rip),%rax | 348 | lea .Lopts(%rip),%rax |
| 349 | mov OPENSSL_ia32cap_P(%rip),%edx | 349 | mov PIC_GOT(OPENSSL_ia32cap_P),%edx |
| 350 | bt \$20,%edx | 350 | bt \$20,%edx |
| 351 | jnc .Ldone | 351 | jnc .Ldone |
| 352 | add \$12,%rax | 352 | add \$12,%rax |
diff --git a/src/lib/libcrypto/rc4/rc4.c b/src/lib/libcrypto/rc4/rc4.c new file mode 100644 index 0000000000..c900b26055 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4.c | |||
| @@ -0,0 +1,193 @@ | |||
| 1 | /* crypto/rc4/rc4.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <openssl/rc4.h> | ||
| 63 | #include <openssl/evp.h> | ||
| 64 | |||
| 65 | char *usage[]={ | ||
| 66 | "usage: rc4 args\n", | ||
| 67 | "\n", | ||
| 68 | " -in arg - input file - default stdin\n", | ||
| 69 | " -out arg - output file - default stdout\n", | ||
| 70 | " -key key - password\n", | ||
| 71 | NULL | ||
| 72 | }; | ||
| 73 | |||
| 74 | int main(int argc, char *argv[]) | ||
| 75 | { | ||
| 76 | FILE *in=NULL,*out=NULL; | ||
| 77 | char *infile=NULL,*outfile=NULL,*keystr=NULL; | ||
| 78 | RC4_KEY key; | ||
| 79 | char buf[BUFSIZ]; | ||
| 80 | int badops=0,i; | ||
| 81 | char **pp; | ||
| 82 | unsigned char md[MD5_DIGEST_LENGTH]; | ||
| 83 | |||
| 84 | argc--; | ||
| 85 | argv++; | ||
| 86 | while (argc >= 1) | ||
| 87 | { | ||
| 88 | if (strcmp(*argv,"-in") == 0) | ||
| 89 | { | ||
| 90 | if (--argc < 1) goto bad; | ||
| 91 | infile= *(++argv); | ||
| 92 | } | ||
| 93 | else if (strcmp(*argv,"-out") == 0) | ||
| 94 | { | ||
| 95 | if (--argc < 1) goto bad; | ||
| 96 | outfile= *(++argv); | ||
| 97 | } | ||
| 98 | else if (strcmp(*argv,"-key") == 0) | ||
| 99 | { | ||
| 100 | if (--argc < 1) goto bad; | ||
| 101 | keystr= *(++argv); | ||
| 102 | } | ||
| 103 | else | ||
| 104 | { | ||
| 105 | fprintf(stderr,"unknown option %s\n",*argv); | ||
| 106 | badops=1; | ||
| 107 | break; | ||
| 108 | } | ||
| 109 | argc--; | ||
| 110 | argv++; | ||
| 111 | } | ||
| 112 | |||
| 113 | if (badops) | ||
| 114 | { | ||
| 115 | bad: | ||
| 116 | for (pp=usage; (*pp != NULL); pp++) | ||
| 117 | fprintf(stderr,"%s",*pp); | ||
| 118 | exit(1); | ||
| 119 | } | ||
| 120 | |||
| 121 | if (infile == NULL) | ||
| 122 | in=stdin; | ||
| 123 | else | ||
| 124 | { | ||
| 125 | in=fopen(infile,"r"); | ||
| 126 | if (in == NULL) | ||
| 127 | { | ||
| 128 | perror("open"); | ||
| 129 | exit(1); | ||
| 130 | } | ||
| 131 | |||
| 132 | } | ||
| 133 | if (outfile == NULL) | ||
| 134 | out=stdout; | ||
| 135 | else | ||
| 136 | { | ||
| 137 | out=fopen(outfile,"w"); | ||
| 138 | if (out == NULL) | ||
| 139 | { | ||
| 140 | perror("open"); | ||
| 141 | exit(1); | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | #ifdef OPENSSL_SYS_MSDOS | ||
| 146 | /* This should set the file to binary mode. */ | ||
| 147 | { | ||
| 148 | #include <fcntl.h> | ||
| 149 | setmode(fileno(in),O_BINARY); | ||
| 150 | setmode(fileno(out),O_BINARY); | ||
| 151 | } | ||
| 152 | #endif | ||
| 153 | |||
| 154 | if (keystr == NULL) | ||
| 155 | { /* get key */ | ||
| 156 | i=EVP_read_pw_string(buf,BUFSIZ,"Enter RC4 password:",0); | ||
| 157 | if (i != 0) | ||
| 158 | { | ||
| 159 | OPENSSL_cleanse(buf,BUFSIZ); | ||
| 160 | fprintf(stderr,"bad password read\n"); | ||
| 161 | exit(1); | ||
| 162 | } | ||
| 163 | keystr=buf; | ||
| 164 | } | ||
| 165 | |||
| 166 | EVP_Digest((unsigned char *)keystr,strlen(keystr),md,NULL,EVP_md5(),NULL); | ||
| 167 | OPENSSL_cleanse(keystr,strlen(keystr)); | ||
| 168 | RC4_set_key(&key,MD5_DIGEST_LENGTH,md); | ||
| 169 | |||
| 170 | for(;;) | ||
| 171 | { | ||
| 172 | i=fread(buf,1,BUFSIZ,in); | ||
| 173 | if (i == 0) break; | ||
| 174 | if (i < 0) | ||
| 175 | { | ||
| 176 | perror("read"); | ||
| 177 | exit(1); | ||
| 178 | } | ||
| 179 | RC4(&key,(unsigned int)i,(unsigned char *)buf, | ||
| 180 | (unsigned char *)buf); | ||
| 181 | i=fwrite(buf,(unsigned int)i,1,out); | ||
| 182 | if (i != 1) | ||
| 183 | { | ||
| 184 | perror("write"); | ||
| 185 | exit(1); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | fclose(out); | ||
| 189 | fclose(in); | ||
| 190 | exit(0); | ||
| 191 | return(1); | ||
| 192 | } | ||
| 193 | |||
diff --git a/src/lib/libcrypto/rc4/rc4s.cpp b/src/lib/libcrypto/rc4/rc4s.cpp new file mode 100644 index 0000000000..3814fde997 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4s.cpp | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/rc4.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | unsigned char buffer[1024]; | ||
| 40 | RC4_KEY ctx; | ||
| 41 | unsigned long s1,s2,e1,e2; | ||
| 42 | unsigned char k[16]; | ||
| 43 | unsigned long data[2]; | ||
| 44 | unsigned char iv[8]; | ||
| 45 | int i,num=64,numm; | ||
| 46 | int j=0; | ||
| 47 | |||
| 48 | if (argc >= 2) | ||
| 49 | num=atoi(argv[1]); | ||
| 50 | |||
| 51 | if (num == 0) num=256; | ||
| 52 | if (num > 1024-16) num=1024-16; | ||
| 53 | numm=num+8; | ||
| 54 | |||
| 55 | for (j=0; j<6; j++) | ||
| 56 | { | ||
| 57 | for (i=0; i<10; i++) /**/ | ||
| 58 | { | ||
| 59 | RC4(&ctx,numm,buffer,buffer); | ||
| 60 | GetTSC(s1); | ||
| 61 | RC4(&ctx,numm,buffer,buffer); | ||
| 62 | GetTSC(e1); | ||
| 63 | GetTSC(s2); | ||
| 64 | RC4(&ctx,num,buffer,buffer); | ||
| 65 | GetTSC(e2); | ||
| 66 | RC4(&ctx,num,buffer,buffer); | ||
| 67 | } | ||
| 68 | |||
| 69 | printf("RC4 (%d bytes) %d %d (%d) - 8 bytes\n",num, | ||
| 70 | e1-s1,e2-s2,(e1-s1)-(e2-s2)); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
diff --git a/src/lib/libcrypto/rc4/rc4speed.c b/src/lib/libcrypto/rc4/rc4speed.c new file mode 100644 index 0000000000..0ebd38123d --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4speed.c | |||
| @@ -0,0 +1,253 @@ | |||
| 1 | /* crypto/rc4/rc4speed.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ | ||
| 60 | /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ | ||
| 61 | |||
| 62 | #if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) | ||
| 63 | #define TIMES | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #include <stdio.h> | ||
| 67 | |||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | #include OPENSSL_UNISTD_IO | ||
| 70 | OPENSSL_DECLARE_EXIT | ||
| 71 | |||
| 72 | #ifndef OPENSSL_SYS_NETWARE | ||
| 73 | #include <signal.h> | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifndef _IRIX | ||
| 77 | #include <time.h> | ||
| 78 | #endif | ||
| 79 | #ifdef TIMES | ||
| 80 | #include <sys/types.h> | ||
| 81 | #include <sys/times.h> | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Depending on the VMS version, the tms structure is perhaps defined. | ||
| 85 | The __TMS macro will show if it was. If it wasn't defined, we should | ||
| 86 | undefine TIMES, since that tells the rest of the program how things | ||
| 87 | should be handled. -- Richard Levitte */ | ||
| 88 | #if defined(OPENSSL_SYS_VMS_DECC) && !defined(__TMS) | ||
| 89 | #undef TIMES | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifndef TIMES | ||
| 93 | #include <sys/timeb.h> | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if defined(sun) || defined(__ultrix) | ||
| 97 | #define _POSIX_SOURCE | ||
| 98 | #include <limits.h> | ||
| 99 | #include <sys/param.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #include <openssl/rc4.h> | ||
| 103 | |||
| 104 | /* The following if from times(3) man page. It may need to be changed */ | ||
| 105 | #ifndef HZ | ||
| 106 | #ifndef CLK_TCK | ||
| 107 | #define HZ 100.0 | ||
| 108 | #else /* CLK_TCK */ | ||
| 109 | #define HZ ((double)CLK_TCK) | ||
| 110 | #endif | ||
| 111 | #endif | ||
| 112 | |||
| 113 | #define BUFSIZE ((long)1024) | ||
| 114 | long run=0; | ||
| 115 | |||
| 116 | double Time_F(int s); | ||
| 117 | #ifdef SIGALRM | ||
| 118 | #if defined(__STDC__) || defined(sgi) || defined(_AIX) | ||
| 119 | #define SIGRETTYPE void | ||
| 120 | #else | ||
| 121 | #define SIGRETTYPE int | ||
| 122 | #endif | ||
| 123 | |||
| 124 | SIGRETTYPE sig_done(int sig); | ||
| 125 | SIGRETTYPE sig_done(int sig) | ||
| 126 | { | ||
| 127 | signal(SIGALRM,sig_done); | ||
| 128 | run=0; | ||
| 129 | #ifdef LINT | ||
| 130 | sig=sig; | ||
| 131 | #endif | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | |||
| 135 | #define START 0 | ||
| 136 | #define STOP 1 | ||
| 137 | |||
| 138 | double Time_F(int s) | ||
| 139 | { | ||
| 140 | double ret; | ||
| 141 | #ifdef TIMES | ||
| 142 | static struct tms tstart,tend; | ||
| 143 | |||
| 144 | if (s == START) | ||
| 145 | { | ||
| 146 | times(&tstart); | ||
| 147 | return(0); | ||
| 148 | } | ||
| 149 | else | ||
| 150 | { | ||
| 151 | times(&tend); | ||
| 152 | ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; | ||
| 153 | return((ret == 0.0)?1e-6:ret); | ||
| 154 | } | ||
| 155 | #else /* !times() */ | ||
| 156 | static struct timeb tstart,tend; | ||
| 157 | long i; | ||
| 158 | |||
| 159 | if (s == START) | ||
| 160 | { | ||
| 161 | ftime(&tstart); | ||
| 162 | return(0); | ||
| 163 | } | ||
| 164 | else | ||
| 165 | { | ||
| 166 | ftime(&tend); | ||
| 167 | i=(long)tend.millitm-(long)tstart.millitm; | ||
| 168 | ret=((double)(tend.time-tstart.time))+((double)i)/1e3; | ||
| 169 | return((ret == 0.0)?1e-6:ret); | ||
| 170 | } | ||
| 171 | #endif | ||
| 172 | } | ||
| 173 | |||
| 174 | int main(int argc, char **argv) | ||
| 175 | { | ||
| 176 | long count; | ||
| 177 | static unsigned char buf[BUFSIZE]; | ||
| 178 | static unsigned char key[] ={ | ||
| 179 | 0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0, | ||
| 180 | 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10, | ||
| 181 | }; | ||
| 182 | RC4_KEY sch; | ||
| 183 | double a,b,c,d; | ||
| 184 | #ifndef SIGALRM | ||
| 185 | long ca,cb,cc; | ||
| 186 | #endif | ||
| 187 | |||
| 188 | #ifndef TIMES | ||
| 189 | printf("To get the most accurate results, try to run this\n"); | ||
| 190 | printf("program when this computer is idle.\n"); | ||
| 191 | #endif | ||
| 192 | |||
| 193 | #ifndef SIGALRM | ||
| 194 | printf("First we calculate the approximate speed ...\n"); | ||
| 195 | RC4_set_key(&sch,16,key); | ||
| 196 | count=10; | ||
| 197 | do { | ||
| 198 | long i; | ||
| 199 | unsigned long data[2]; | ||
| 200 | |||
| 201 | count*=2; | ||
| 202 | Time_F(START); | ||
| 203 | for (i=count; i; i--) | ||
| 204 | RC4(&sch,8,buf,buf); | ||
| 205 | d=Time_F(STOP); | ||
| 206 | } while (d < 3.0); | ||
| 207 | ca=count/512; | ||
| 208 | cc=count*8/BUFSIZE+1; | ||
| 209 | printf("Doing RC4_set_key %ld times\n",ca); | ||
| 210 | #define COND(d) (count != (d)) | ||
| 211 | #define COUNT(d) (d) | ||
| 212 | #else | ||
| 213 | #define COND(c) (run) | ||
| 214 | #define COUNT(d) (count) | ||
| 215 | signal(SIGALRM,sig_done); | ||
| 216 | printf("Doing RC4_set_key for 10 seconds\n"); | ||
| 217 | alarm(10); | ||
| 218 | #endif | ||
| 219 | |||
| 220 | Time_F(START); | ||
| 221 | for (count=0,run=1; COND(ca); count+=4) | ||
| 222 | { | ||
| 223 | RC4_set_key(&sch,16,key); | ||
| 224 | RC4_set_key(&sch,16,key); | ||
| 225 | RC4_set_key(&sch,16,key); | ||
| 226 | RC4_set_key(&sch,16,key); | ||
| 227 | } | ||
| 228 | d=Time_F(STOP); | ||
| 229 | printf("%ld RC4_set_key's in %.2f seconds\n",count,d); | ||
| 230 | a=((double)COUNT(ca))/d; | ||
| 231 | |||
| 232 | #ifdef SIGALRM | ||
| 233 | printf("Doing RC4 on %ld byte blocks for 10 seconds\n",BUFSIZE); | ||
| 234 | alarm(10); | ||
| 235 | #else | ||
| 236 | printf("Doing RC4 %ld times on %ld byte blocks\n",cc,BUFSIZE); | ||
| 237 | #endif | ||
| 238 | Time_F(START); | ||
| 239 | for (count=0,run=1; COND(cc); count++) | ||
| 240 | RC4(&sch,BUFSIZE,buf,buf); | ||
| 241 | d=Time_F(STOP); | ||
| 242 | printf("%ld RC4's of %ld byte blocks in %.2f second\n", | ||
| 243 | count,BUFSIZE,d); | ||
| 244 | c=((double)COUNT(cc)*BUFSIZE)/d; | ||
| 245 | |||
| 246 | printf("RC4 set_key per sec = %12.2f (%9.3fuS)\n",a,1.0e6/a); | ||
| 247 | printf("RC4 bytes per sec = %12.2f (%9.3fuS)\n",c,8.0e6/c); | ||
| 248 | exit(0); | ||
| 249 | #if defined(LINT) || defined(OPENSSL_SYS_MSDOS) | ||
| 250 | return(0); | ||
| 251 | #endif | ||
| 252 | } | ||
| 253 | |||
diff --git a/src/lib/libcrypto/rc4/rc4test.c b/src/lib/libcrypto/rc4/rc4test.c new file mode 100644 index 0000000000..633a79e758 --- /dev/null +++ b/src/lib/libcrypto/rc4/rc4test.c | |||
| @@ -0,0 +1,236 @@ | |||
| 1 | /* crypto/rc4/rc4test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_RC4 | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No RC4 support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/rc4.h> | ||
| 73 | #include <openssl/sha.h> | ||
| 74 | |||
| 75 | static unsigned char keys[7][30]={ | ||
| 76 | {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}, | ||
| 77 | {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}, | ||
| 78 | {8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 79 | {4,0xef,0x01,0x23,0x45}, | ||
| 80 | {8,0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}, | ||
| 81 | {4,0xef,0x01,0x23,0x45}, | ||
| 82 | }; | ||
| 83 | |||
| 84 | static unsigned char data_len[7]={8,8,8,20,28,10}; | ||
| 85 | static unsigned char data[7][30]={ | ||
| 86 | {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xff}, | ||
| 87 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, | ||
| 88 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, | ||
| 89 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 90 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 91 | 0x00,0x00,0x00,0x00,0xff}, | ||
| 92 | {0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0, | ||
| 93 | 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0, | ||
| 94 | 0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0, | ||
| 95 | 0x12,0x34,0x56,0x78,0xff}, | ||
| 96 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, | ||
| 97 | {0}, | ||
| 98 | }; | ||
| 99 | |||
| 100 | static unsigned char output[7][30]={ | ||
| 101 | {0x75,0xb7,0x87,0x80,0x99,0xe0,0xc5,0x96,0x00}, | ||
| 102 | {0x74,0x94,0xc2,0xe7,0x10,0x4b,0x08,0x79,0x00}, | ||
| 103 | {0xde,0x18,0x89,0x41,0xa3,0x37,0x5d,0x3a,0x00}, | ||
| 104 | {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf, | ||
| 105 | 0xbd,0x61,0x5a,0x11,0x62,0xe1,0xc7,0xba, | ||
| 106 | 0x36,0xb6,0x78,0x58,0x00}, | ||
| 107 | {0x66,0xa0,0x94,0x9f,0x8a,0xf7,0xd6,0x89, | ||
| 108 | 0x1f,0x7f,0x83,0x2b,0xa8,0x33,0xc0,0x0c, | ||
| 109 | 0x89,0x2e,0xbe,0x30,0x14,0x3c,0xe2,0x87, | ||
| 110 | 0x40,0x01,0x1e,0xcf,0x00}, | ||
| 111 | {0xd6,0xa1,0x41,0xa7,0xec,0x3c,0x38,0xdf,0xbd,0x61,0x00}, | ||
| 112 | {0}, | ||
| 113 | }; | ||
| 114 | |||
| 115 | int main(int argc, char *argv[]) | ||
| 116 | { | ||
| 117 | int i,err=0; | ||
| 118 | int j; | ||
| 119 | unsigned char *p; | ||
| 120 | RC4_KEY key; | ||
| 121 | unsigned char obuf[512]; | ||
| 122 | |||
| 123 | for (i=0; i<6; i++) | ||
| 124 | { | ||
| 125 | RC4_set_key(&key,keys[i][0],&(keys[i][1])); | ||
| 126 | memset(obuf,0x00,sizeof(obuf)); | ||
| 127 | RC4(&key,data_len[i],&(data[i][0]),obuf); | ||
| 128 | if (memcmp(obuf,output[i],data_len[i]+1) != 0) | ||
| 129 | { | ||
| 130 | printf("error calculating RC4\n"); | ||
| 131 | printf("output:"); | ||
| 132 | for (j=0; j<data_len[i]+1; j++) | ||
| 133 | printf(" %02x",obuf[j]); | ||
| 134 | printf("\n"); | ||
| 135 | printf("expect:"); | ||
| 136 | p= &(output[i][0]); | ||
| 137 | for (j=0; j<data_len[i]+1; j++) | ||
| 138 | printf(" %02x",*(p++)); | ||
| 139 | printf("\n"); | ||
| 140 | err++; | ||
| 141 | } | ||
| 142 | else | ||
| 143 | printf("test %d ok\n",i); | ||
| 144 | } | ||
| 145 | printf("test end processing "); | ||
| 146 | for (i=0; i<data_len[3]; i++) | ||
| 147 | { | ||
| 148 | RC4_set_key(&key,keys[3][0],&(keys[3][1])); | ||
| 149 | memset(obuf,0x00,sizeof(obuf)); | ||
| 150 | RC4(&key,i,&(data[3][0]),obuf); | ||
| 151 | if ((memcmp(obuf,output[3],i) != 0) || (obuf[i] != 0)) | ||
| 152 | { | ||
| 153 | printf("error in RC4 length processing\n"); | ||
| 154 | printf("output:"); | ||
| 155 | for (j=0; j<i+1; j++) | ||
| 156 | printf(" %02x",obuf[j]); | ||
| 157 | printf("\n"); | ||
| 158 | printf("expect:"); | ||
| 159 | p= &(output[3][0]); | ||
| 160 | for (j=0; j<i; j++) | ||
| 161 | printf(" %02x",*(p++)); | ||
| 162 | printf(" 00\n"); | ||
| 163 | err++; | ||
| 164 | } | ||
| 165 | else | ||
| 166 | { | ||
| 167 | printf("."); | ||
| 168 | fflush(stdout); | ||
| 169 | } | ||
| 170 | } | ||
| 171 | printf("done\n"); | ||
| 172 | printf("test multi-call "); | ||
| 173 | for (i=0; i<data_len[3]; i++) | ||
| 174 | { | ||
| 175 | RC4_set_key(&key,keys[3][0],&(keys[3][1])); | ||
| 176 | memset(obuf,0x00,sizeof(obuf)); | ||
| 177 | RC4(&key,i,&(data[3][0]),obuf); | ||
| 178 | RC4(&key,data_len[3]-i,&(data[3][i]),&(obuf[i])); | ||
| 179 | if (memcmp(obuf,output[3],data_len[3]+1) != 0) | ||
| 180 | { | ||
| 181 | printf("error in RC4 multi-call processing\n"); | ||
| 182 | printf("output:"); | ||
| 183 | for (j=0; j<data_len[3]+1; j++) | ||
| 184 | printf(" %02x",obuf[j]); | ||
| 185 | printf("\n"); | ||
| 186 | printf("expect:"); | ||
| 187 | p= &(output[3][0]); | ||
| 188 | for (j=0; j<data_len[3]+1; j++) | ||
| 189 | printf(" %02x",*(p++)); | ||
| 190 | err++; | ||
| 191 | } | ||
| 192 | else | ||
| 193 | { | ||
| 194 | printf("."); | ||
| 195 | fflush(stdout); | ||
| 196 | } | ||
| 197 | } | ||
| 198 | printf("done\n"); | ||
| 199 | printf("bulk test "); | ||
| 200 | { unsigned char buf[513]; | ||
| 201 | SHA_CTX c; | ||
| 202 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 203 | static unsigned char expected[]={ | ||
| 204 | 0xa4,0x7b,0xcc,0x00,0x3d,0xd0,0xbd,0xe1,0xac,0x5f, | ||
| 205 | 0x12,0x1e,0x45,0xbc,0xfb,0x1a,0xa1,0xf2,0x7f,0xc5 }; | ||
| 206 | |||
| 207 | RC4_set_key(&key,keys[0][0],&(keys[3][1])); | ||
| 208 | memset(buf,'\0',sizeof(buf)); | ||
| 209 | SHA1_Init(&c); | ||
| 210 | for (i=0;i<2571;i++) { | ||
| 211 | RC4(&key,sizeof(buf),buf,buf); | ||
| 212 | SHA1_Update(&c,buf,sizeof(buf)); | ||
| 213 | } | ||
| 214 | SHA1_Final(md,&c); | ||
| 215 | |||
| 216 | if (memcmp(md,expected,sizeof(md))) { | ||
| 217 | printf("error in RC4 bulk test\n"); | ||
| 218 | printf("output:"); | ||
| 219 | for (j=0; j<(int)sizeof(md); j++) | ||
| 220 | printf(" %02x",md[j]); | ||
| 221 | printf("\n"); | ||
| 222 | printf("expect:"); | ||
| 223 | for (j=0; j<(int)sizeof(md); j++) | ||
| 224 | printf(" %02x",expected[j]); | ||
| 225 | printf("\n"); | ||
| 226 | err++; | ||
| 227 | } | ||
| 228 | else printf("ok\n"); | ||
| 229 | } | ||
| 230 | #ifdef OPENSSL_SYS_NETWARE | ||
| 231 | if (err) printf("ERROR: %d\n", err); | ||
| 232 | #endif | ||
| 233 | EXIT(err); | ||
| 234 | return(0); | ||
| 235 | } | ||
| 236 | #endif | ||
diff --git a/src/lib/libcrypto/rc4/rrc4.doc b/src/lib/libcrypto/rc4/rrc4.doc new file mode 100644 index 0000000000..2f9a953c12 --- /dev/null +++ b/src/lib/libcrypto/rc4/rrc4.doc | |||
| @@ -0,0 +1,278 @@ | |||
| 1 | Newsgroups: sci.crypt,alt.security,comp.security.misc,alt.privacy | ||
| 2 | Path: ghost.dsi.unimi.it!univ-lyon1.fr!jussieu.fr!zaphod.crihan.fr!warwick!clyde.open.ac.uk!strath-cs!bnr.co.uk!bt!pipex!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!csusac!csus.edu!netcom.com!sterndark | ||
| 3 | From: sterndark@netcom.com (David Sterndark) | ||
| 4 | Subject: RC4 Algorithm revealed. | ||
| 5 | Message-ID: <sternCvKL4B.Hyy@netcom.com> | ||
| 6 | Sender: sterndark@netcom.com | ||
| 7 | Organization: NETCOM On-line Communication Services (408 261-4700 guest) | ||
| 8 | X-Newsreader: TIN [version 1.2 PL1] | ||
| 9 | Date: Wed, 14 Sep 1994 06:35:31 GMT | ||
| 10 | Lines: 263 | ||
| 11 | Xref: ghost.dsi.unimi.it sci.crypt:27332 alt.security:14732 comp.security.misc:11701 alt.privacy:16026 | ||
| 12 | |||
| 13 | I am shocked, shocked, I tell you, shocked, to discover | ||
| 14 | that the cypherpunks have illegaly and criminally revealed | ||
| 15 | a crucial RSA trade secret and harmed the security of | ||
| 16 | America by reverse engineering the RC4 algorithm and | ||
| 17 | publishing it to the world. | ||
| 18 | |||
| 19 | On Saturday morning an anonymous cypherpunk wrote: | ||
| 20 | |||
| 21 | |||
| 22 | SUBJECT: RC4 Source Code | ||
| 23 | |||
| 24 | |||
| 25 | I've tested this. It is compatible with the RC4 object module | ||
| 26 | that comes in the various RSA toolkits. | ||
| 27 | |||
| 28 | /* rc4.h */ | ||
| 29 | typedef struct rc4_key | ||
| 30 | { | ||
| 31 | unsigned char state[256]; | ||
| 32 | unsigned char x; | ||
| 33 | unsigned char y; | ||
| 34 | } rc4_key; | ||
| 35 | void prepare_key(unsigned char *key_data_ptr,int key_data_len, | ||
| 36 | rc4_key *key); | ||
| 37 | void rc4(unsigned char *buffer_ptr,int buffer_len,rc4_key * key); | ||
| 38 | |||
| 39 | |||
| 40 | /*rc4.c */ | ||
| 41 | #include "rc4.h" | ||
| 42 | static void swap_byte(unsigned char *a, unsigned char *b); | ||
| 43 | void prepare_key(unsigned char *key_data_ptr, int key_data_len, | ||
| 44 | rc4_key *key) | ||
| 45 | { | ||
| 46 | unsigned char swapByte; | ||
| 47 | unsigned char index1; | ||
| 48 | unsigned char index2; | ||
| 49 | unsigned char* state; | ||
| 50 | short counter; | ||
| 51 | |||
| 52 | state = &key->state[0]; | ||
| 53 | for(counter = 0; counter < 256; counter++) | ||
| 54 | state[counter] = counter; | ||
| 55 | key->x = 0; | ||
| 56 | key->y = 0; | ||
| 57 | index1 = 0; | ||
| 58 | index2 = 0; | ||
| 59 | for(counter = 0; counter < 256; counter++) | ||
| 60 | { | ||
| 61 | index2 = (key_data_ptr[index1] + state[counter] + | ||
| 62 | index2) % 256; | ||
| 63 | swap_byte(&state[counter], &state[index2]); | ||
| 64 | |||
| 65 | index1 = (index1 + 1) % key_data_len; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | void rc4(unsigned char *buffer_ptr, int buffer_len, rc4_key *key) | ||
| 70 | { | ||
| 71 | unsigned char x; | ||
| 72 | unsigned char y; | ||
| 73 | unsigned char* state; | ||
| 74 | unsigned char xorIndex; | ||
| 75 | short counter; | ||
| 76 | |||
| 77 | x = key->x; | ||
| 78 | y = key->y; | ||
| 79 | |||
| 80 | state = &key->state[0]; | ||
| 81 | for(counter = 0; counter < buffer_len; counter ++) | ||
| 82 | { | ||
| 83 | x = (x + 1) % 256; | ||
| 84 | y = (state[x] + y) % 256; | ||
| 85 | swap_byte(&state[x], &state[y]); | ||
| 86 | |||
| 87 | xorIndex = (state[x] + state[y]) % 256; | ||
| 88 | |||
| 89 | buffer_ptr[counter] ^= state[xorIndex]; | ||
| 90 | } | ||
| 91 | key->x = x; | ||
| 92 | key->y = y; | ||
| 93 | } | ||
| 94 | |||
| 95 | static void swap_byte(unsigned char *a, unsigned char *b) | ||
| 96 | { | ||
| 97 | unsigned char swapByte; | ||
| 98 | |||
| 99 | swapByte = *a; | ||
| 100 | *a = *b; | ||
| 101 | *b = swapByte; | ||
| 102 | } | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | Another cypherpunk, this one not anonymous, tested the | ||
| 107 | output from this algorithm against the output from | ||
| 108 | official RC4 object code | ||
| 109 | |||
| 110 | |||
| 111 | Date: Tue, 13 Sep 94 18:37:56 PDT | ||
| 112 | From: ekr@eit.COM (Eric Rescorla) | ||
| 113 | Message-Id: <9409140137.AA17743@eitech.eit.com> | ||
| 114 | Subject: RC4 compatibility testing | ||
| 115 | Cc: cypherpunks@toad.com | ||
| 116 | |||
| 117 | One data point: | ||
| 118 | |||
| 119 | I can't say anything about the internals of RC4 versus the | ||
| 120 | algorithm that Bill Sommerfeld is rightly calling 'Alleged RC4', | ||
| 121 | since I don't know anything about RC4's internals. | ||
| 122 | |||
| 123 | However, I do have a (legitimately acquired) copy of BSAFE2 and | ||
| 124 | so I'm able to compare the output of this algorithm to the output | ||
| 125 | of genuine RC4 as found in BSAFE. I chose a set of test vectors | ||
| 126 | and ran them through both algorithms. The algorithms appear to | ||
| 127 | give identical results, at least with these key/plaintext pairs. | ||
| 128 | |||
| 129 | I note that this is the algorithm _without_ Hal Finney's | ||
| 130 | proposed modification | ||
| 131 | |||
| 132 | (see <199409130605.XAA24133@jobe.shell.portal.com>). | ||
| 133 | |||
| 134 | The vectors I used (together with the ciphertext they produce) | ||
| 135 | follow at the end of this message. | ||
| 136 | |||
| 137 | -Ekr | ||
| 138 | |||
| 139 | Disclaimer: This posting does not reflect the opinions of EIT. | ||
| 140 | |||
| 141 | --------------------results follow-------------- | ||
| 142 | Test vector 0 | ||
| 143 | Key: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef | ||
| 144 | Input: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef | ||
| 145 | 0 Output: 0x75 0xb7 0x87 0x80 0x99 0xe0 0xc5 0x96 | ||
| 146 | |||
| 147 | Test vector 1 | ||
| 148 | Key: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef | ||
| 149 | Input: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 | ||
| 150 | 0 Output: 0x74 0x94 0xc2 0xe7 0x10 0x4b 0x08 0x79 | ||
| 151 | |||
| 152 | Test vector 2 | ||
| 153 | Key: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 | ||
| 154 | Input: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 | ||
| 155 | 0 Output: 0xde 0x18 0x89 0x41 0xa3 0x37 0x5d 0x3a | ||
| 156 | |||
| 157 | Test vector 3 | ||
| 158 | Key: 0xef 0x01 0x23 0x45 | ||
| 159 | Input: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 | ||
| 160 | 0 Output: 0xd6 0xa1 0x41 0xa7 0xec 0x3c 0x38 0xdf 0xbd 0x61 | ||
| 161 | |||
| 162 | Test vector 4 | ||
| 163 | Key: 0x01 0x23 0x45 0x67 0x89 0xab 0xcd 0xef | ||
| 164 | Input: 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 165 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 166 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 167 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 168 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 169 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 170 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 171 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 172 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 173 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 174 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 175 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 176 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 177 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 178 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 179 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 180 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 181 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 182 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 183 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 184 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 185 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 186 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 187 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 188 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 189 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 190 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 191 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 192 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 193 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 194 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 195 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 196 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 197 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 198 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 199 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 200 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 201 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 202 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 203 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 204 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 205 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 206 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 207 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 208 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 209 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 210 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 211 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 212 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 213 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 214 | 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 | ||
| 215 | 0x01 | ||
| 216 | 0 Output: 0x75 0x95 0xc3 0xe6 0x11 0x4a 0x09 0x78 0x0c 0x4a 0xd4 | ||
| 217 | 0x52 0x33 0x8e 0x1f 0xfd 0x9a 0x1b 0xe9 0x49 0x8f | ||
| 218 | 0x81 0x3d 0x76 0x53 0x34 0x49 0xb6 0x77 0x8d 0xca | ||
| 219 | 0xd8 0xc7 0x8a 0x8d 0x2b 0xa9 0xac 0x66 0x08 0x5d | ||
| 220 | 0x0e 0x53 0xd5 0x9c 0x26 0xc2 0xd1 0xc4 0x90 0xc1 | ||
| 221 | 0xeb 0xbe 0x0c 0xe6 0x6d 0x1b 0x6b 0x1b 0x13 0xb6 | ||
| 222 | 0xb9 0x19 0xb8 0x47 0xc2 0x5a 0x91 0x44 0x7a 0x95 | ||
| 223 | 0xe7 0x5e 0x4e 0xf1 0x67 0x79 0xcd 0xe8 0xbf 0x0a | ||
| 224 | 0x95 0x85 0x0e 0x32 0xaf 0x96 0x89 0x44 0x4f 0xd3 | ||
| 225 | 0x77 0x10 0x8f 0x98 0xfd 0xcb 0xd4 0xe7 0x26 0x56 | ||
| 226 | 0x75 0x00 0x99 0x0b 0xcc 0x7e 0x0c 0xa3 0xc4 0xaa | ||
| 227 | 0xa3 0x04 0xa3 0x87 0xd2 0x0f 0x3b 0x8f 0xbb 0xcd | ||
| 228 | 0x42 0xa1 0xbd 0x31 0x1d 0x7a 0x43 0x03 0xdd 0xa5 | ||
| 229 | 0xab 0x07 0x88 0x96 0xae 0x80 0xc1 0x8b 0x0a 0xf6 | ||
| 230 | 0x6d 0xff 0x31 0x96 0x16 0xeb 0x78 0x4e 0x49 0x5a | ||
| 231 | 0xd2 0xce 0x90 0xd7 0xf7 0x72 0xa8 0x17 0x47 0xb6 | ||
| 232 | 0x5f 0x62 0x09 0x3b 0x1e 0x0d 0xb9 0xe5 0xba 0x53 | ||
| 233 | 0x2f 0xaf 0xec 0x47 0x50 0x83 0x23 0xe6 0x71 0x32 | ||
| 234 | 0x7d 0xf9 0x44 0x44 0x32 0xcb 0x73 0x67 0xce 0xc8 | ||
| 235 | 0x2f 0x5d 0x44 0xc0 0xd0 0x0b 0x67 0xd6 0x50 0xa0 | ||
| 236 | 0x75 0xcd 0x4b 0x70 0xde 0xdd 0x77 0xeb 0x9b 0x10 | ||
| 237 | 0x23 0x1b 0x6b 0x5b 0x74 0x13 0x47 0x39 0x6d 0x62 | ||
| 238 | 0x89 0x74 0x21 0xd4 0x3d 0xf9 0xb4 0x2e 0x44 0x6e | ||
| 239 | 0x35 0x8e 0x9c 0x11 0xa9 0xb2 0x18 0x4e 0xcb 0xef | ||
| 240 | 0x0c 0xd8 0xe7 0xa8 0x77 0xef 0x96 0x8f 0x13 0x90 | ||
| 241 | 0xec 0x9b 0x3d 0x35 0xa5 0x58 0x5c 0xb0 0x09 0x29 | ||
| 242 | 0x0e 0x2f 0xcd 0xe7 0xb5 0xec 0x66 0xd9 0x08 0x4b | ||
| 243 | 0xe4 0x40 0x55 0xa6 0x19 0xd9 0xdd 0x7f 0xc3 0x16 | ||
| 244 | 0x6f 0x94 0x87 0xf7 0xcb 0x27 0x29 0x12 0x42 0x64 | ||
| 245 | 0x45 0x99 0x85 0x14 0xc1 0x5d 0x53 0xa1 0x8c 0x86 | ||
| 246 | 0x4c 0xe3 0xa2 0xb7 0x55 0x57 0x93 0x98 0x81 0x26 | ||
| 247 | 0x52 0x0e 0xac 0xf2 0xe3 0x06 0x6e 0x23 0x0c 0x91 | ||
| 248 | 0xbe 0xe4 0xdd 0x53 0x04 0xf5 0xfd 0x04 0x05 0xb3 | ||
| 249 | 0x5b 0xd9 0x9c 0x73 0x13 0x5d 0x3d 0x9b 0xc3 0x35 | ||
| 250 | 0xee 0x04 0x9e 0xf6 0x9b 0x38 0x67 0xbf 0x2d 0x7b | ||
| 251 | 0xd1 0xea 0xa5 0x95 0xd8 0xbf 0xc0 0x06 0x6f 0xf8 | ||
| 252 | 0xd3 0x15 0x09 0xeb 0x0c 0x6c 0xaa 0x00 0x6c 0x80 | ||
| 253 | 0x7a 0x62 0x3e 0xf8 0x4c 0x3d 0x33 0xc1 0x95 0xd2 | ||
| 254 | 0x3e 0xe3 0x20 0xc4 0x0d 0xe0 0x55 0x81 0x57 0xc8 | ||
| 255 | 0x22 0xd4 0xb8 0xc5 0x69 0xd8 0x49 0xae 0xd5 0x9d | ||
| 256 | 0x4e 0x0f 0xd7 0xf3 0x79 0x58 0x6b 0x4b 0x7f 0xf6 | ||
| 257 | 0x84 0xed 0x6a 0x18 0x9f 0x74 0x86 0xd4 0x9b 0x9c | ||
| 258 | 0x4b 0xad 0x9b 0xa2 0x4b 0x96 0xab 0xf9 0x24 0x37 | ||
| 259 | 0x2c 0x8a 0x8f 0xff 0xb1 0x0d 0x55 0x35 0x49 0x00 | ||
| 260 | 0xa7 0x7a 0x3d 0xb5 0xf2 0x05 0xe1 0xb9 0x9f 0xcd | ||
| 261 | 0x86 0x60 0x86 0x3a 0x15 0x9a 0xd4 0xab 0xe4 0x0f | ||
| 262 | 0xa4 0x89 0x34 0x16 0x3d 0xdd 0xe5 0x42 0xa6 0x58 | ||
| 263 | 0x55 0x40 0xfd 0x68 0x3c 0xbf 0xd8 0xc0 0x0f 0x12 | ||
| 264 | 0x12 0x9a 0x28 0x4d 0xea 0xcc 0x4c 0xde 0xfe 0x58 | ||
| 265 | 0xbe 0x71 0x37 0x54 0x1c 0x04 0x71 0x26 0xc8 0xd4 | ||
| 266 | 0x9e 0x27 0x55 0xab 0x18 0x1a 0xb7 0xe9 0x40 0xb0 | ||
| 267 | 0xc0 | ||
| 268 | |||
| 269 | |||
| 270 | |||
| 271 | -- | ||
| 272 | --------------------------------------------------------------------- | ||
| 273 | We have the right to defend ourselves and our | ||
| 274 | property, because of the kind of animals that we James A. Donald | ||
| 275 | are. True law derives from this right, not from | ||
| 276 | the arbitrary power of the omnipotent state. jamesd@netcom.com | ||
| 277 | |||
| 278 | |||
diff --git a/src/lib/libcrypto/rc5/Makefile b/src/lib/libcrypto/rc5/Makefile new file mode 100644 index 0000000000..8a8b00eb89 --- /dev/null +++ b/src/lib/libcrypto/rc5/Makefile | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/rc5/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rc5 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | RC5_ENC= rc5_enc.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=rc5test.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=rc5_skey.c rc5_ecb.c rc5_enc.c rc5cfb64.c rc5ofb64.c | ||
| 26 | LIBOBJ=rc5_skey.o rc5_ecb.o $(RC5_ENC) rc5cfb64.o rc5ofb64.o | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= rc5.h | ||
| 31 | HEADER= rc5_locl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | rc5-586.s: asm/rc5-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl | ||
| 46 | $(PERL) asm/rc5-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ | ||
| 47 | |||
| 48 | files: | ||
| 49 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 55 | |||
| 56 | install: | ||
| 57 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 58 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 59 | do \ | ||
| 60 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 61 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 62 | done; | ||
| 63 | |||
| 64 | tags: | ||
| 65 | ctags $(SRC) | ||
| 66 | |||
| 67 | tests: | ||
| 68 | |||
| 69 | lint: | ||
| 70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 71 | |||
| 72 | depend: | ||
| 73 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 75 | |||
| 76 | dclean: | ||
| 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 78 | mv -f Makefile.new $(MAKEFILE) | ||
| 79 | |||
| 80 | clean: | ||
| 81 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | rc5_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 86 | rc5_ecb.o: ../../include/openssl/rc5.h rc5_ecb.c rc5_locl.h | ||
| 87 | rc5_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h | ||
| 88 | rc5_enc.o: rc5_enc.c rc5_locl.h | ||
| 89 | rc5_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h | ||
| 90 | rc5_skey.o: rc5_locl.h rc5_skey.c | ||
| 91 | rc5cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h | ||
| 92 | rc5cfb64.o: rc5_locl.h rc5cfb64.c | ||
| 93 | rc5ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc5.h | ||
| 94 | rc5ofb64.o: rc5_locl.h rc5ofb64.c | ||
diff --git a/src/lib/libcrypto/rc5/rc5.h b/src/lib/libcrypto/rc5/rc5.h new file mode 100644 index 0000000000..4b3c153b50 --- /dev/null +++ b/src/lib/libcrypto/rc5/rc5.h | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | /* crypto/rc5/rc5.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_RC5_H | ||
| 60 | #define HEADER_RC5_H | ||
| 61 | |||
| 62 | #include <openssl/opensslconf.h> /* OPENSSL_NO_RC5 */ | ||
| 63 | |||
| 64 | #ifdef __cplusplus | ||
| 65 | extern "C" { | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #ifdef OPENSSL_NO_RC5 | ||
| 69 | #error RC5 is disabled. | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #define RC5_ENCRYPT 1 | ||
| 73 | #define RC5_DECRYPT 0 | ||
| 74 | |||
| 75 | /* 32 bit. For Alpha, things may get weird */ | ||
| 76 | #define RC5_32_INT unsigned long | ||
| 77 | |||
| 78 | #define RC5_32_BLOCK 8 | ||
| 79 | #define RC5_32_KEY_LENGTH 16 /* This is a default, max is 255 */ | ||
| 80 | |||
| 81 | /* This are the only values supported. Tweak the code if you want more | ||
| 82 | * The most supported modes will be | ||
| 83 | * RC5-32/12/16 | ||
| 84 | * RC5-32/16/8 | ||
| 85 | */ | ||
| 86 | #define RC5_8_ROUNDS 8 | ||
| 87 | #define RC5_12_ROUNDS 12 | ||
| 88 | #define RC5_16_ROUNDS 16 | ||
| 89 | |||
| 90 | typedef struct rc5_key_st | ||
| 91 | { | ||
| 92 | /* Number of rounds */ | ||
| 93 | int rounds; | ||
| 94 | RC5_32_INT data[2*(RC5_16_ROUNDS+1)]; | ||
| 95 | } RC5_32_KEY; | ||
| 96 | |||
| 97 | |||
| 98 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, | ||
| 99 | int rounds); | ||
| 100 | void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key, | ||
| 101 | int enc); | ||
| 102 | void RC5_32_encrypt(unsigned long *data,RC5_32_KEY *key); | ||
| 103 | void RC5_32_decrypt(unsigned long *data,RC5_32_KEY *key); | ||
| 104 | void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 105 | long length, RC5_32_KEY *ks, unsigned char *iv, | ||
| 106 | int enc); | ||
| 107 | void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, | ||
| 108 | long length, RC5_32_KEY *schedule, | ||
| 109 | unsigned char *ivec, int *num, int enc); | ||
| 110 | void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, | ||
| 111 | long length, RC5_32_KEY *schedule, | ||
| 112 | unsigned char *ivec, int *num); | ||
| 113 | |||
| 114 | #ifdef __cplusplus | ||
| 115 | } | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #endif | ||
diff --git a/src/lib/libcrypto/rc5/rc5_locl.h b/src/lib/libcrypto/rc5/rc5_locl.h new file mode 100644 index 0000000000..282dd38822 --- /dev/null +++ b/src/lib/libcrypto/rc5/rc5_locl.h | |||
| @@ -0,0 +1,207 @@ | |||
| 1 | /* crypto/rc5/rc5_locl.h */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdlib.h> | ||
| 60 | |||
| 61 | #undef c2l | ||
| 62 | #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ | ||
| 63 | l|=((unsigned long)(*((c)++)))<< 8L, \ | ||
| 64 | l|=((unsigned long)(*((c)++)))<<16L, \ | ||
| 65 | l|=((unsigned long)(*((c)++)))<<24L) | ||
| 66 | |||
| 67 | /* NOTE - c is not incremented as per c2l */ | ||
| 68 | #undef c2ln | ||
| 69 | #define c2ln(c,l1,l2,n) { \ | ||
| 70 | c+=n; \ | ||
| 71 | l1=l2=0; \ | ||
| 72 | switch (n) { \ | ||
| 73 | case 8: l2 =((unsigned long)(*(--(c))))<<24L; \ | ||
| 74 | case 7: l2|=((unsigned long)(*(--(c))))<<16L; \ | ||
| 75 | case 6: l2|=((unsigned long)(*(--(c))))<< 8L; \ | ||
| 76 | case 5: l2|=((unsigned long)(*(--(c)))); \ | ||
| 77 | case 4: l1 =((unsigned long)(*(--(c))))<<24L; \ | ||
| 78 | case 3: l1|=((unsigned long)(*(--(c))))<<16L; \ | ||
| 79 | case 2: l1|=((unsigned long)(*(--(c))))<< 8L; \ | ||
| 80 | case 1: l1|=((unsigned long)(*(--(c)))); \ | ||
| 81 | } \ | ||
| 82 | } | ||
| 83 | |||
| 84 | #undef l2c | ||
| 85 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
| 86 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
| 87 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
| 88 | *((c)++)=(unsigned char)(((l)>>24L)&0xff)) | ||
| 89 | |||
| 90 | /* NOTE - c is not incremented as per l2c */ | ||
| 91 | #undef l2cn | ||
| 92 | #define l2cn(l1,l2,c,n) { \ | ||
| 93 | c+=n; \ | ||
| 94 | switch (n) { \ | ||
| 95 | case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ | ||
| 96 | case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ | ||
| 97 | case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ | ||
| 98 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
| 99 | case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ | ||
| 100 | case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ | ||
| 101 | case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ | ||
| 102 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
| 103 | } \ | ||
| 104 | } | ||
| 105 | |||
| 106 | /* NOTE - c is not incremented as per n2l */ | ||
| 107 | #define n2ln(c,l1,l2,n) { \ | ||
| 108 | c+=n; \ | ||
| 109 | l1=l2=0; \ | ||
| 110 | switch (n) { \ | ||
| 111 | case 8: l2 =((unsigned long)(*(--(c)))) ; \ | ||
| 112 | case 7: l2|=((unsigned long)(*(--(c))))<< 8; \ | ||
| 113 | case 6: l2|=((unsigned long)(*(--(c))))<<16; \ | ||
| 114 | case 5: l2|=((unsigned long)(*(--(c))))<<24; \ | ||
| 115 | case 4: l1 =((unsigned long)(*(--(c)))) ; \ | ||
| 116 | case 3: l1|=((unsigned long)(*(--(c))))<< 8; \ | ||
| 117 | case 2: l1|=((unsigned long)(*(--(c))))<<16; \ | ||
| 118 | case 1: l1|=((unsigned long)(*(--(c))))<<24; \ | ||
| 119 | } \ | ||
| 120 | } | ||
| 121 | |||
| 122 | /* NOTE - c is not incremented as per l2n */ | ||
| 123 | #define l2nn(l1,l2,c,n) { \ | ||
| 124 | c+=n; \ | ||
| 125 | switch (n) { \ | ||
| 126 | case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
| 127 | case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ | ||
| 128 | case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ | ||
| 129 | case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ | ||
| 130 | case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
| 131 | case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ | ||
| 132 | case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ | ||
| 133 | case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ | ||
| 134 | } \ | ||
| 135 | } | ||
| 136 | |||
| 137 | #undef n2l | ||
| 138 | #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24L, \ | ||
| 139 | l|=((unsigned long)(*((c)++)))<<16L, \ | ||
| 140 | l|=((unsigned long)(*((c)++)))<< 8L, \ | ||
| 141 | l|=((unsigned long)(*((c)++)))) | ||
| 142 | |||
| 143 | #undef l2n | ||
| 144 | #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ | ||
| 145 | *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ | ||
| 146 | *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ | ||
| 147 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
| 148 | |||
| 149 | #if (defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)) || defined(__ICC) | ||
| 150 | #define ROTATE_l32(a,n) _lrotl(a,n) | ||
| 151 | #define ROTATE_r32(a,n) _lrotr(a,n) | ||
| 152 | #elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC) | ||
| 153 | # if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) | ||
| 154 | # define ROTATE_l32(a,n) ({ register unsigned int ret; \ | ||
| 155 | asm ("roll %%cl,%0" \ | ||
| 156 | : "=r"(ret) \ | ||
| 157 | : "c"(n),"0"(a) \ | ||
| 158 | : "cc"); \ | ||
| 159 | ret; \ | ||
| 160 | }) | ||
| 161 | # define ROTATE_r32(a,n) ({ register unsigned int ret; \ | ||
| 162 | asm ("rorl %%cl,%0" \ | ||
| 163 | : "=r"(ret) \ | ||
| 164 | : "c"(n),"0"(a) \ | ||
| 165 | : "cc"); \ | ||
| 166 | ret; \ | ||
| 167 | }) | ||
| 168 | # endif | ||
| 169 | #endif | ||
| 170 | #ifndef ROTATE_l32 | ||
| 171 | #define ROTATE_l32(a,n) (((a)<<(n&0x1f))|(((a)&0xffffffff)>>(32-(n&0x1f)))) | ||
| 172 | #endif | ||
| 173 | #ifndef ROTATE_r32 | ||
| 174 | #define ROTATE_r32(a,n) (((a)<<(32-(n&0x1f)))|(((a)&0xffffffff)>>(n&0x1f))) | ||
| 175 | #endif | ||
| 176 | |||
| 177 | #define RC5_32_MASK 0xffffffffL | ||
| 178 | |||
| 179 | #define RC5_16_P 0xB7E1 | ||
| 180 | #define RC5_16_Q 0x9E37 | ||
| 181 | #define RC5_32_P 0xB7E15163L | ||
| 182 | #define RC5_32_Q 0x9E3779B9L | ||
| 183 | #define RC5_64_P 0xB7E151628AED2A6BLL | ||
| 184 | #define RC5_64_Q 0x9E3779B97F4A7C15LL | ||
| 185 | |||
| 186 | #define E_RC5_32(a,b,s,n) \ | ||
| 187 | a^=b; \ | ||
| 188 | a=ROTATE_l32(a,b); \ | ||
| 189 | a+=s[n]; \ | ||
| 190 | a&=RC5_32_MASK; \ | ||
| 191 | b^=a; \ | ||
| 192 | b=ROTATE_l32(b,a); \ | ||
| 193 | b+=s[n+1]; \ | ||
| 194 | b&=RC5_32_MASK; | ||
| 195 | |||
| 196 | #define D_RC5_32(a,b,s,n) \ | ||
| 197 | b-=s[n+1]; \ | ||
| 198 | b&=RC5_32_MASK; \ | ||
| 199 | b=ROTATE_r32(b,a); \ | ||
| 200 | b^=a; \ | ||
| 201 | a-=s[n]; \ | ||
| 202 | a&=RC5_32_MASK; \ | ||
| 203 | a=ROTATE_r32(a,b); \ | ||
| 204 | a^=b; | ||
| 205 | |||
| 206 | |||
| 207 | |||
diff --git a/src/lib/libcrypto/rc5/rc5s.cpp b/src/lib/libcrypto/rc5/rc5s.cpp new file mode 100644 index 0000000000..1c5518bc80 --- /dev/null +++ b/src/lib/libcrypto/rc5/rc5s.cpp | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/rc5.h> | ||
| 36 | |||
| 37 | void main(int argc,char *argv[]) | ||
| 38 | { | ||
| 39 | RC5_32_KEY key; | ||
| 40 | unsigned long s1,s2,e1,e2; | ||
| 41 | unsigned long data[2]; | ||
| 42 | int i,j; | ||
| 43 | static unsigned char d[16]={0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF}; | ||
| 44 | |||
| 45 | RC5_32_set_key(&key, 16,d,12); | ||
| 46 | |||
| 47 | for (j=0; j<6; j++) | ||
| 48 | { | ||
| 49 | for (i=0; i<1000; i++) /**/ | ||
| 50 | { | ||
| 51 | RC5_32_encrypt(&data[0],&key); | ||
| 52 | GetTSC(s1); | ||
| 53 | RC5_32_encrypt(&data[0],&key); | ||
| 54 | RC5_32_encrypt(&data[0],&key); | ||
| 55 | RC5_32_encrypt(&data[0],&key); | ||
| 56 | GetTSC(e1); | ||
| 57 | GetTSC(s2); | ||
| 58 | RC5_32_encrypt(&data[0],&key); | ||
| 59 | RC5_32_encrypt(&data[0],&key); | ||
| 60 | RC5_32_encrypt(&data[0],&key); | ||
| 61 | RC5_32_encrypt(&data[0],&key); | ||
| 62 | GetTSC(e2); | ||
| 63 | RC5_32_encrypt(&data[0],&key); | ||
| 64 | } | ||
| 65 | |||
| 66 | printf("cast %d %d (%d)\n", | ||
| 67 | e1-s1,e2-s2,((e2-s2)-(e1-s1))); | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
diff --git a/src/lib/libcrypto/rc5/rc5test.c b/src/lib/libcrypto/rc5/rc5test.c new file mode 100644 index 0000000000..ce3d0cc16f --- /dev/null +++ b/src/lib/libcrypto/rc5/rc5test.c | |||
| @@ -0,0 +1,386 @@ | |||
| 1 | /* crypto/rc5/rc5test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* This has been a quickly hacked 'ideatest.c'. When I add tests for other | ||
| 60 | * RC5 modes, more of the code will be uncommented. */ | ||
| 61 | |||
| 62 | #include <stdio.h> | ||
| 63 | #include <string.h> | ||
| 64 | #include <stdlib.h> | ||
| 65 | |||
| 66 | #include "../e_os.h" | ||
| 67 | |||
| 68 | #ifdef OPENSSL_NO_RC5 | ||
| 69 | int main(int argc, char *argv[]) | ||
| 70 | { | ||
| 71 | printf("No RC5 support\n"); | ||
| 72 | return(0); | ||
| 73 | } | ||
| 74 | #else | ||
| 75 | #include <openssl/rc5.h> | ||
| 76 | |||
| 77 | static unsigned char RC5key[5][16]={ | ||
| 78 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
| 79 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 80 | {0x91,0x5f,0x46,0x19,0xbe,0x41,0xb2,0x51, | ||
| 81 | 0x63,0x55,0xa5,0x01,0x10,0xa9,0xce,0x91}, | ||
| 82 | {0x78,0x33,0x48,0xe7,0x5a,0xeb,0x0f,0x2f, | ||
| 83 | 0xd7,0xb1,0x69,0xbb,0x8d,0xc1,0x67,0x87}, | ||
| 84 | {0xdc,0x49,0xdb,0x13,0x75,0xa5,0x58,0x4f, | ||
| 85 | 0x64,0x85,0xb4,0x13,0xb5,0xf1,0x2b,0xaf}, | ||
| 86 | {0x52,0x69,0xf1,0x49,0xd4,0x1b,0xa0,0x15, | ||
| 87 | 0x24,0x97,0x57,0x4d,0x7f,0x15,0x31,0x25}, | ||
| 88 | }; | ||
| 89 | |||
| 90 | static unsigned char RC5plain[5][8]={ | ||
| 91 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 92 | {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D}, | ||
| 93 | {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52}, | ||
| 94 | {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92}, | ||
| 95 | {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC}, | ||
| 96 | }; | ||
| 97 | |||
| 98 | static unsigned char RC5cipher[5][8]={ | ||
| 99 | {0x21,0xA5,0xDB,0xEE,0x15,0x4B,0x8F,0x6D}, | ||
| 100 | {0xF7,0xC0,0x13,0xAC,0x5B,0x2B,0x89,0x52}, | ||
| 101 | {0x2F,0x42,0xB3,0xB7,0x03,0x69,0xFC,0x92}, | ||
| 102 | {0x65,0xC1,0x78,0xB2,0x84,0xD1,0x97,0xCC}, | ||
| 103 | {0xEB,0x44,0xE4,0x15,0xDA,0x31,0x98,0x24}, | ||
| 104 | }; | ||
| 105 | |||
| 106 | #define RC5_CBC_NUM 27 | ||
| 107 | static unsigned char rc5_cbc_cipher[RC5_CBC_NUM][8]={ | ||
| 108 | {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1e}, | ||
| 109 | {0x79,0x7b,0xba,0x4d,0x78,0x11,0x1d,0x1e}, | ||
| 110 | {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f}, | ||
| 111 | {0x7a,0x7b,0xba,0x4d,0x79,0x11,0x1d,0x1f}, | ||
| 112 | {0x8b,0x9d,0xed,0x91,0xce,0x77,0x94,0xa6}, | ||
| 113 | {0x2f,0x75,0x9f,0xe7,0xad,0x86,0xa3,0x78}, | ||
| 114 | {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88}, | ||
| 115 | {0xdc,0xa2,0x69,0x4b,0xf4,0x0e,0x07,0x88}, | ||
| 116 | {0xdc,0xfe,0x09,0x85,0x77,0xec,0xa5,0xff}, | ||
| 117 | {0x96,0x46,0xfb,0x77,0x63,0x8f,0x9c,0xa8}, | ||
| 118 | {0xb2,0xb3,0x20,0x9d,0xb6,0x59,0x4d,0xa4}, | ||
| 119 | {0x54,0x5f,0x7f,0x32,0xa5,0xfc,0x38,0x36}, | ||
| 120 | {0x82,0x85,0xe7,0xc1,0xb5,0xbc,0x74,0x02}, | ||
| 121 | {0xfc,0x58,0x6f,0x92,0xf7,0x08,0x09,0x34}, | ||
| 122 | {0xcf,0x27,0x0e,0xf9,0x71,0x7f,0xf7,0xc4}, | ||
| 123 | {0xe4,0x93,0xf1,0xc1,0xbb,0x4d,0x6e,0x8c}, | ||
| 124 | {0x5c,0x4c,0x04,0x1e,0x0f,0x21,0x7a,0xc3}, | ||
| 125 | {0x92,0x1f,0x12,0x48,0x53,0x73,0xb4,0xf7}, | ||
| 126 | {0x5b,0xa0,0xca,0x6b,0xbe,0x7f,0x5f,0xad}, | ||
| 127 | {0xc5,0x33,0x77,0x1c,0xd0,0x11,0x0e,0x63}, | ||
| 128 | {0x29,0x4d,0xdb,0x46,0xb3,0x27,0x8d,0x60}, | ||
| 129 | {0xda,0xd6,0xbd,0xa9,0xdf,0xe8,0xf7,0xe8}, | ||
| 130 | {0x97,0xe0,0x78,0x78,0x37,0xed,0x31,0x7f}, | ||
| 131 | {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78}, | ||
| 132 | {0x8f,0x34,0xc3,0xc6,0x81,0xc9,0x96,0x95}, | ||
| 133 | {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11}, | ||
| 134 | {0x7f,0xd1,0xa0,0x23,0xa5,0xbb,0xa2,0x17}, | ||
| 135 | }; | ||
| 136 | |||
| 137 | static unsigned char rc5_cbc_key[RC5_CBC_NUM][17]={ | ||
| 138 | { 1,0x00}, | ||
| 139 | { 1,0x00}, | ||
| 140 | { 1,0x00}, | ||
| 141 | { 1,0x00}, | ||
| 142 | { 1,0x00}, | ||
| 143 | { 1,0x11}, | ||
| 144 | { 1,0x00}, | ||
| 145 | { 4,0x00,0x00,0x00,0x00}, | ||
| 146 | { 1,0x00}, | ||
| 147 | { 1,0x00}, | ||
| 148 | { 1,0x00}, | ||
| 149 | { 1,0x00}, | ||
| 150 | { 4,0x01,0x02,0x03,0x04}, | ||
| 151 | { 4,0x01,0x02,0x03,0x04}, | ||
| 152 | { 4,0x01,0x02,0x03,0x04}, | ||
| 153 | { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 154 | { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 155 | { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 156 | { 8,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 157 | {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08, | ||
| 158 | 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 159 | {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08, | ||
| 160 | 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 161 | {16,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08, | ||
| 162 | 0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 163 | { 5,0x01,0x02,0x03,0x04,0x05}, | ||
| 164 | { 5,0x01,0x02,0x03,0x04,0x05}, | ||
| 165 | { 5,0x01,0x02,0x03,0x04,0x05}, | ||
| 166 | { 5,0x01,0x02,0x03,0x04,0x05}, | ||
| 167 | { 5,0x01,0x02,0x03,0x04,0x05}, | ||
| 168 | }; | ||
| 169 | |||
| 170 | static unsigned char rc5_cbc_plain[RC5_CBC_NUM][8]={ | ||
| 171 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 172 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 173 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 174 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, | ||
| 175 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 176 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 177 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 178 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 179 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 180 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 181 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 182 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 183 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 184 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 185 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 186 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 187 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 188 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 189 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 190 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 191 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 192 | {0x10,0x20,0x30,0x40,0x50,0x60,0x70,0x80}, | ||
| 193 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 194 | {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, | ||
| 195 | {0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08}, | ||
| 196 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 197 | {0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x01}, | ||
| 198 | }; | ||
| 199 | |||
| 200 | static int rc5_cbc_rounds[RC5_CBC_NUM]={ | ||
| 201 | 0, 0, 0, 0, 0, 1, 2, 2, | ||
| 202 | 8, 8,12,16, 8,12,16,12, | ||
| 203 | 8,12,16, 8,12,16,12, 8, | ||
| 204 | 8, 8, 8, | ||
| 205 | }; | ||
| 206 | |||
| 207 | static unsigned char rc5_cbc_iv[RC5_CBC_NUM][8]={ | ||
| 208 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 209 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 210 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, | ||
| 211 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 212 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 213 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 214 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 215 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 216 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 217 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 218 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 219 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 220 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 221 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 222 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 223 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 224 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 225 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 226 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 227 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 228 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 229 | {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}, | ||
| 230 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 231 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 232 | {0x78,0x75,0xdb,0xf6,0x73,0x8c,0x64,0x78}, | ||
| 233 | {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, | ||
| 234 | {0x7c,0xb3,0xf1,0xdf,0x34,0xf9,0x48,0x11}, | ||
| 235 | }; | ||
| 236 | |||
| 237 | int main(int argc, char *argv[]) | ||
| 238 | { | ||
| 239 | int i,n,err=0; | ||
| 240 | RC5_32_KEY key; | ||
| 241 | unsigned char buf[8],buf2[8],ivb[8]; | ||
| 242 | |||
| 243 | for (n=0; n<5; n++) | ||
| 244 | { | ||
| 245 | RC5_32_set_key(&key,16,&(RC5key[n][0]),12); | ||
| 246 | |||
| 247 | RC5_32_ecb_encrypt(&(RC5plain[n][0]),buf,&key,RC5_ENCRYPT); | ||
| 248 | if (memcmp(&(RC5cipher[n][0]),buf,8) != 0) | ||
| 249 | { | ||
| 250 | printf("ecb RC5 error encrypting (%d)\n",n+1); | ||
| 251 | printf("got :"); | ||
| 252 | for (i=0; i<8; i++) | ||
| 253 | printf("%02X ",buf[i]); | ||
| 254 | printf("\n"); | ||
| 255 | printf("expected:"); | ||
| 256 | for (i=0; i<8; i++) | ||
| 257 | printf("%02X ",RC5cipher[n][i]); | ||
| 258 | err=20; | ||
| 259 | printf("\n"); | ||
| 260 | } | ||
| 261 | |||
| 262 | RC5_32_ecb_encrypt(buf,buf2,&key,RC5_DECRYPT); | ||
| 263 | if (memcmp(&(RC5plain[n][0]),buf2,8) != 0) | ||
| 264 | { | ||
| 265 | printf("ecb RC5 error decrypting (%d)\n",n+1); | ||
| 266 | printf("got :"); | ||
| 267 | for (i=0; i<8; i++) | ||
| 268 | printf("%02X ",buf2[i]); | ||
| 269 | printf("\n"); | ||
| 270 | printf("expected:"); | ||
| 271 | for (i=0; i<8; i++) | ||
| 272 | printf("%02X ",RC5plain[n][i]); | ||
| 273 | printf("\n"); | ||
| 274 | err=3; | ||
| 275 | } | ||
| 276 | } | ||
| 277 | if (err == 0) printf("ecb RC5 ok\n"); | ||
| 278 | |||
| 279 | for (n=0; n<RC5_CBC_NUM; n++) | ||
| 280 | { | ||
| 281 | i=rc5_cbc_rounds[n]; | ||
| 282 | if (i < 8) continue; | ||
| 283 | |||
| 284 | RC5_32_set_key(&key,rc5_cbc_key[n][0],&(rc5_cbc_key[n][1]),i); | ||
| 285 | |||
| 286 | memcpy(ivb,&(rc5_cbc_iv[n][0]),8); | ||
| 287 | RC5_32_cbc_encrypt(&(rc5_cbc_plain[n][0]),buf,8, | ||
| 288 | &key,&(ivb[0]),RC5_ENCRYPT); | ||
| 289 | |||
| 290 | if (memcmp(&(rc5_cbc_cipher[n][0]),buf,8) != 0) | ||
| 291 | { | ||
| 292 | printf("cbc RC5 error encrypting (%d)\n",n+1); | ||
| 293 | printf("got :"); | ||
| 294 | for (i=0; i<8; i++) | ||
| 295 | printf("%02X ",buf[i]); | ||
| 296 | printf("\n"); | ||
| 297 | printf("expected:"); | ||
| 298 | for (i=0; i<8; i++) | ||
| 299 | printf("%02X ",rc5_cbc_cipher[n][i]); | ||
| 300 | err=30; | ||
| 301 | printf("\n"); | ||
| 302 | } | ||
| 303 | |||
| 304 | memcpy(ivb,&(rc5_cbc_iv[n][0]),8); | ||
| 305 | RC5_32_cbc_encrypt(buf,buf2,8, | ||
| 306 | &key,&(ivb[0]),RC5_DECRYPT); | ||
| 307 | if (memcmp(&(rc5_cbc_plain[n][0]),buf2,8) != 0) | ||
| 308 | { | ||
| 309 | printf("cbc RC5 error decrypting (%d)\n",n+1); | ||
| 310 | printf("got :"); | ||
| 311 | for (i=0; i<8; i++) | ||
| 312 | printf("%02X ",buf2[i]); | ||
| 313 | printf("\n"); | ||
| 314 | printf("expected:"); | ||
| 315 | for (i=0; i<8; i++) | ||
| 316 | printf("%02X ",rc5_cbc_plain[n][i]); | ||
| 317 | printf("\n"); | ||
| 318 | err=3; | ||
| 319 | } | ||
| 320 | } | ||
| 321 | if (err == 0) printf("cbc RC5 ok\n"); | ||
| 322 | |||
| 323 | EXIT(err); | ||
| 324 | return(err); | ||
| 325 | } | ||
| 326 | |||
| 327 | #ifdef undef | ||
| 328 | static int cfb64_test(unsigned char *cfb_cipher) | ||
| 329 | { | ||
| 330 | IDEA_KEY_SCHEDULE eks,dks; | ||
| 331 | int err=0,i,n; | ||
| 332 | |||
| 333 | idea_set_encrypt_key(cfb_key,&eks); | ||
| 334 | idea_set_decrypt_key(&eks,&dks); | ||
| 335 | memcpy(cfb_tmp,cfb_iv,8); | ||
| 336 | n=0; | ||
| 337 | idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks, | ||
| 338 | cfb_tmp,&n,IDEA_ENCRYPT); | ||
| 339 | idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]), | ||
| 340 | (long)CFB_TEST_SIZE-12,&eks, | ||
| 341 | cfb_tmp,&n,IDEA_ENCRYPT); | ||
| 342 | if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0) | ||
| 343 | { | ||
| 344 | err=1; | ||
| 345 | printf("idea_cfb64_encrypt encrypt error\n"); | ||
| 346 | for (i=0; i<CFB_TEST_SIZE; i+=8) | ||
| 347 | printf("%s\n",pt(&(cfb_buf1[i]))); | ||
| 348 | } | ||
| 349 | memcpy(cfb_tmp,cfb_iv,8); | ||
| 350 | n=0; | ||
| 351 | idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks, | ||
| 352 | cfb_tmp,&n,IDEA_DECRYPT); | ||
| 353 | idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), | ||
| 354 | (long)CFB_TEST_SIZE-17,&dks, | ||
| 355 | cfb_tmp,&n,IDEA_DECRYPT); | ||
| 356 | if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0) | ||
| 357 | { | ||
| 358 | err=1; | ||
| 359 | printf("idea_cfb_encrypt decrypt error\n"); | ||
| 360 | for (i=0; i<24; i+=8) | ||
| 361 | printf("%s\n",pt(&(cfb_buf2[i]))); | ||
| 362 | } | ||
| 363 | return(err); | ||
| 364 | } | ||
| 365 | |||
| 366 | static char *pt(unsigned char *p) | ||
| 367 | { | ||
| 368 | static char bufs[10][20]; | ||
| 369 | static int bnum=0; | ||
| 370 | char *ret; | ||
| 371 | int i; | ||
| 372 | static char *f="0123456789ABCDEF"; | ||
| 373 | |||
| 374 | ret= &(bufs[bnum++][0]); | ||
| 375 | bnum%=10; | ||
| 376 | for (i=0; i<8; i++) | ||
| 377 | { | ||
| 378 | ret[i*2]=f[(p[i]>>4)&0xf]; | ||
| 379 | ret[i*2+1]=f[p[i]&0xf]; | ||
| 380 | } | ||
| 381 | ret[16]='\0'; | ||
| 382 | return(ret); | ||
| 383 | } | ||
| 384 | |||
| 385 | #endif | ||
| 386 | #endif | ||
diff --git a/src/lib/libcrypto/ripemd/Makefile b/src/lib/libcrypto/ripemd/Makefile new file mode 100644 index 0000000000..d5b1067dbe --- /dev/null +++ b/src/lib/libcrypto/ripemd/Makefile | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/ripemd/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ripemd | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | RIP_ASM_OBJ= | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=rmdtest.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=rmd_dgst.c rmd_one.c | ||
| 26 | LIBOBJ=rmd_dgst.o rmd_one.o $(RMD160_ASM_OBJ) | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= ripemd.h | ||
| 31 | HEADER= rmd_locl.h rmdconst.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | rmd-586.s: asm/rmd-586.pl ../perlasm/x86asm.pl | ||
| 46 | $(PERL) asm/rmd-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@ | ||
| 47 | |||
| 48 | files: | ||
| 49 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 55 | |||
| 56 | install: | ||
| 57 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 58 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 59 | do \ | ||
| 60 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 61 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 62 | done; | ||
| 63 | |||
| 64 | tags: | ||
| 65 | ctags $(SRC) | ||
| 66 | |||
| 67 | tests: | ||
| 68 | |||
| 69 | lint: | ||
| 70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 71 | |||
| 72 | depend: | ||
| 73 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 75 | |||
| 76 | dclean: | ||
| 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 78 | mv -f Makefile.new $(MAKEFILE) | ||
| 79 | |||
| 80 | clean: | ||
| 81 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | rmd_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 86 | rmd_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ripemd.h | ||
| 87 | rmd_dgst.o: ../md32_common.h rmd_dgst.c rmd_locl.h rmdconst.h | ||
| 88 | rmd_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 89 | rmd_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 90 | rmd_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/ripemd.h | ||
| 91 | rmd_one.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 92 | rmd_one.o: ../../include/openssl/symhacks.h rmd_one.c | ||
diff --git a/src/lib/libcrypto/ripemd/asm/rips.cpp b/src/lib/libcrypto/ripemd/asm/rips.cpp new file mode 100644 index 0000000000..f7a13677a9 --- /dev/null +++ b/src/lib/libcrypto/ripemd/asm/rips.cpp | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | // | ||
| 2 | // gettsc.inl | ||
| 3 | // | ||
| 4 | // gives access to the Pentium's (secret) cycle counter | ||
| 5 | // | ||
| 6 | // This software was written by Leonard Janke (janke@unixg.ubc.ca) | ||
| 7 | // in 1996-7 and is entered, by him, into the public domain. | ||
| 8 | |||
| 9 | #if defined(__WATCOMC__) | ||
| 10 | void GetTSC(unsigned long&); | ||
| 11 | #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; | ||
| 12 | #elif defined(__GNUC__) | ||
| 13 | inline | ||
| 14 | void GetTSC(unsigned long& tsc) | ||
| 15 | { | ||
| 16 | asm volatile(".byte 15, 49\n\t" | ||
| 17 | : "=eax" (tsc) | ||
| 18 | : | ||
| 19 | : "%edx", "%eax"); | ||
| 20 | } | ||
| 21 | #elif defined(_MSC_VER) | ||
| 22 | inline | ||
| 23 | void GetTSC(unsigned long& tsc) | ||
| 24 | { | ||
| 25 | unsigned long a; | ||
| 26 | __asm _emit 0fh | ||
| 27 | __asm _emit 31h | ||
| 28 | __asm mov a, eax; | ||
| 29 | tsc=a; | ||
| 30 | } | ||
| 31 | #endif | ||
| 32 | |||
| 33 | #include <stdio.h> | ||
| 34 | #include <stdlib.h> | ||
| 35 | #include <openssl/ripemd.h> | ||
| 36 | |||
| 37 | #define ripemd160_block_x86 ripemd160_block_asm_host_order | ||
| 38 | |||
| 39 | extern "C" { | ||
| 40 | void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num); | ||
| 41 | } | ||
| 42 | |||
| 43 | void main(int argc,char *argv[]) | ||
| 44 | { | ||
| 45 | unsigned char buffer[64*256]; | ||
| 46 | RIPEMD160_CTX ctx; | ||
| 47 | unsigned long s1,s2,e1,e2; | ||
| 48 | unsigned char k[16]; | ||
| 49 | unsigned long data[2]; | ||
| 50 | unsigned char iv[8]; | ||
| 51 | int i,num=0,numm; | ||
| 52 | int j=0; | ||
| 53 | |||
| 54 | if (argc >= 2) | ||
| 55 | num=atoi(argv[1]); | ||
| 56 | |||
| 57 | if (num == 0) num=16; | ||
| 58 | if (num > 250) num=16; | ||
| 59 | numm=num+2; | ||
| 60 | #if 0 | ||
| 61 | num*=64; | ||
| 62 | numm*=64; | ||
| 63 | #endif | ||
| 64 | |||
| 65 | for (j=0; j<6; j++) | ||
| 66 | { | ||
| 67 | for (i=0; i<10; i++) /**/ | ||
| 68 | { | ||
| 69 | ripemd160_block_x86(&ctx,buffer,numm); | ||
| 70 | GetTSC(s1); | ||
| 71 | ripemd160_block_x86(&ctx,buffer,numm); | ||
| 72 | GetTSC(e1); | ||
| 73 | GetTSC(s2); | ||
| 74 | ripemd160_block_x86(&ctx,buffer,num); | ||
| 75 | GetTSC(e2); | ||
| 76 | ripemd160_block_x86(&ctx,buffer,num); | ||
| 77 | } | ||
| 78 | printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num*64, | ||
| 79 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
diff --git a/src/lib/libcrypto/ripemd/rmd160.c b/src/lib/libcrypto/ripemd/rmd160.c new file mode 100644 index 0000000000..b0ec574498 --- /dev/null +++ b/src/lib/libcrypto/ripemd/rmd160.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* crypto/ripemd/rmd160.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/ripemd.h> | ||
| 62 | |||
| 63 | #define BUFSIZE 1024*16 | ||
| 64 | |||
| 65 | void do_fp(FILE *f); | ||
| 66 | void pt(unsigned char *md); | ||
| 67 | #if !defined(_OSD_POSIX) && !defined(__DJGPP__) | ||
| 68 | int read(int, void *, unsigned int); | ||
| 69 | #endif | ||
| 70 | |||
| 71 | int main(int argc, char **argv) | ||
| 72 | { | ||
| 73 | int i,err=0; | ||
| 74 | FILE *IN; | ||
| 75 | |||
| 76 | if (argc == 1) | ||
| 77 | { | ||
| 78 | do_fp(stdin); | ||
| 79 | } | ||
| 80 | else | ||
| 81 | { | ||
| 82 | for (i=1; i<argc; i++) | ||
| 83 | { | ||
| 84 | IN=fopen(argv[i],"r"); | ||
| 85 | if (IN == NULL) | ||
| 86 | { | ||
| 87 | perror(argv[i]); | ||
| 88 | err++; | ||
| 89 | continue; | ||
| 90 | } | ||
| 91 | printf("RIPEMD160(%s)= ",argv[i]); | ||
| 92 | do_fp(IN); | ||
| 93 | fclose(IN); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | exit(err); | ||
| 97 | } | ||
| 98 | |||
| 99 | void do_fp(FILE *f) | ||
| 100 | { | ||
| 101 | RIPEMD160_CTX c; | ||
| 102 | unsigned char md[RIPEMD160_DIGEST_LENGTH]; | ||
| 103 | int fd; | ||
| 104 | int i; | ||
| 105 | static unsigned char buf[BUFSIZE]; | ||
| 106 | |||
| 107 | fd=fileno(f); | ||
| 108 | RIPEMD160_Init(&c); | ||
| 109 | for (;;) | ||
| 110 | { | ||
| 111 | i=read(fd,buf,BUFSIZE); | ||
| 112 | if (i <= 0) break; | ||
| 113 | RIPEMD160_Update(&c,buf,(unsigned long)i); | ||
| 114 | } | ||
| 115 | RIPEMD160_Final(&(md[0]),&c); | ||
| 116 | pt(md); | ||
| 117 | } | ||
| 118 | |||
| 119 | void pt(unsigned char *md) | ||
| 120 | { | ||
| 121 | int i; | ||
| 122 | |||
| 123 | for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++) | ||
| 124 | printf("%02x",md[i]); | ||
| 125 | printf("\n"); | ||
| 126 | } | ||
| 127 | |||
diff --git a/src/lib/libcrypto/ripemd/rmd_dgst.c b/src/lib/libcrypto/ripemd/rmd_dgst.c index 59b017f8c0..2097a66c03 100644 --- a/src/lib/libcrypto/ripemd/rmd_dgst.c +++ b/src/lib/libcrypto/ripemd/rmd_dgst.c | |||
| @@ -87,7 +87,7 @@ int RIPEMD160_Init(RIPEMD160_CTX *c) | |||
| 87 | void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) | 87 | void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) |
| 88 | { | 88 | { |
| 89 | const unsigned char *data=p; | 89 | const unsigned char *data=p; |
| 90 | register unsigned MD32_REG_T A,B,C,D,E; | 90 | register volatile unsigned MD32_REG_T A,B,C,D,E; |
| 91 | unsigned MD32_REG_T a,b,c,d,e,l; | 91 | unsigned MD32_REG_T a,b,c,d,e,l; |
| 92 | #ifndef MD32_XARRAY | 92 | #ifndef MD32_XARRAY |
| 93 | /* See comment in crypto/sha/sha_locl.h for details. */ | 93 | /* See comment in crypto/sha/sha_locl.h for details. */ |
diff --git a/src/lib/libcrypto/ripemd/rmdtest.c b/src/lib/libcrypto/ripemd/rmdtest.c new file mode 100644 index 0000000000..fb34e0e836 --- /dev/null +++ b/src/lib/libcrypto/ripemd/rmdtest.c | |||
| @@ -0,0 +1,145 @@ | |||
| 1 | /* crypto/ripemd/rmdtest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_RIPEMD | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No ripemd support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/ripemd.h> | ||
| 73 | #include <openssl/evp.h> | ||
| 74 | |||
| 75 | #ifdef CHARSET_EBCDIC | ||
| 76 | #include <openssl/ebcdic.h> | ||
| 77 | #endif | ||
| 78 | |||
| 79 | static char *test[]={ | ||
| 80 | "", | ||
| 81 | "a", | ||
| 82 | "abc", | ||
| 83 | "message digest", | ||
| 84 | "abcdefghijklmnopqrstuvwxyz", | ||
| 85 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", | ||
| 86 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", | ||
| 87 | "12345678901234567890123456789012345678901234567890123456789012345678901234567890", | ||
| 88 | NULL, | ||
| 89 | }; | ||
| 90 | |||
| 91 | static char *ret[]={ | ||
| 92 | "9c1185a5c5e9fc54612808977ee8f548b2258d31", | ||
| 93 | "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", | ||
| 94 | "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", | ||
| 95 | "5d0689ef49d2fae572b881b123a85ffa21595f36", | ||
| 96 | "f71c27109c692c1b56bbdceb5b9d2865b3708dbc", | ||
| 97 | "12a053384a9c0c88e405a06c27dcf49ada62eb2b", | ||
| 98 | "b0e20b6e3116640286ed3a87a5713079b21f5189", | ||
| 99 | "9b752e45573d4b39f4dbd3323cab82bf63326bfb", | ||
| 100 | }; | ||
| 101 | |||
| 102 | static char *pt(unsigned char *md); | ||
| 103 | int main(int argc, char *argv[]) | ||
| 104 | { | ||
| 105 | int i,err=0; | ||
| 106 | char **P,**R; | ||
| 107 | char *p; | ||
| 108 | unsigned char md[RIPEMD160_DIGEST_LENGTH]; | ||
| 109 | |||
| 110 | P=test; | ||
| 111 | R=ret; | ||
| 112 | i=1; | ||
| 113 | while (*P != NULL) | ||
| 114 | { | ||
| 115 | #ifdef CHARSET_EBCDIC | ||
| 116 | ebcdic2ascii((char *)*P, (char *)*P, strlen((char *)*P)); | ||
| 117 | #endif | ||
| 118 | EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL); | ||
| 119 | p=pt(md); | ||
| 120 | if (strcmp(p,(char *)*R) != 0) | ||
| 121 | { | ||
| 122 | printf("error calculating RIPEMD160 on '%s'\n",*P); | ||
| 123 | printf("got %s instead of %s\n",p,*R); | ||
| 124 | err++; | ||
| 125 | } | ||
| 126 | else | ||
| 127 | printf("test %d ok\n",i); | ||
| 128 | i++; | ||
| 129 | R++; | ||
| 130 | P++; | ||
| 131 | } | ||
| 132 | EXIT(err); | ||
| 133 | return(0); | ||
| 134 | } | ||
| 135 | |||
| 136 | static char *pt(unsigned char *md) | ||
| 137 | { | ||
| 138 | int i; | ||
| 139 | static char buf[80]; | ||
| 140 | |||
| 141 | for (i=0; i<RIPEMD160_DIGEST_LENGTH; i++) | ||
| 142 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 143 | return(buf); | ||
| 144 | } | ||
| 145 | #endif | ||
diff --git a/src/lib/libcrypto/rsa/Makefile b/src/lib/libcrypto/rsa/Makefile new file mode 100644 index 0000000000..bb64223e05 --- /dev/null +++ b/src/lib/libcrypto/rsa/Makefile | |||
| @@ -0,0 +1,287 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/rsa/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= rsa | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST=rsa_test.c | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c \ | ||
| 21 | rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c rsa_null.c \ | ||
| 22 | rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c \ | ||
| 23 | rsa_pmeth.c | ||
| 24 | LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o rsa_err.o \ | ||
| 25 | rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o rsa_chk.o rsa_null.o \ | ||
| 26 | rsa_pss.o rsa_x931.o rsa_asn1.o rsa_depr.o rsa_ameth.o rsa_prn.o \ | ||
| 27 | rsa_pmeth.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= rsa.h | ||
| 32 | HEADER= $(EXHEADER) | ||
| 33 | |||
| 34 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 35 | |||
| 36 | top: | ||
| 37 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 38 | |||
| 39 | all: lib | ||
| 40 | |||
| 41 | lib: $(LIBOBJ) | ||
| 42 | $(AR) $(LIB) $(LIBOBJ) | ||
| 43 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 44 | @touch lib | ||
| 45 | |||
| 46 | files: | ||
| 47 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 50 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 51 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 53 | |||
| 54 | install: | ||
| 55 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 56 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 57 | do \ | ||
| 58 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 59 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 60 | done; | ||
| 61 | |||
| 62 | tags: | ||
| 63 | ctags $(SRC) | ||
| 64 | |||
| 65 | tests: | ||
| 66 | |||
| 67 | lint: | ||
| 68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 69 | |||
| 70 | depend: | ||
| 71 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 72 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 73 | |||
| 74 | dclean: | ||
| 75 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 76 | mv -f Makefile.new $(MAKEFILE) | ||
| 77 | |||
| 78 | clean: | ||
| 79 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 80 | |||
| 81 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 82 | |||
| 83 | rsa_ameth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 84 | rsa_ameth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 85 | rsa_ameth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 86 | rsa_ameth.o: ../../include/openssl/cms.h ../../include/openssl/crypto.h | ||
| 87 | rsa_ameth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 88 | rsa_ameth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 89 | rsa_ameth.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 90 | rsa_ameth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 91 | rsa_ameth.o: ../../include/openssl/objects.h | ||
| 92 | rsa_ameth.o: ../../include/openssl/opensslconf.h | ||
| 93 | rsa_ameth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 94 | rsa_ameth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 95 | rsa_ameth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 96 | rsa_ameth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 97 | rsa_ameth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 98 | rsa_ameth.o: ../asn1/asn1_locl.h ../cryptlib.h rsa_ameth.c | ||
| 99 | rsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 100 | rsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 101 | rsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 102 | rsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 103 | rsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 104 | rsa_asn1.o: ../../include/openssl/opensslconf.h | ||
| 105 | rsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 106 | rsa_asn1.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 107 | rsa_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 108 | rsa_asn1.o: ../cryptlib.h rsa_asn1.c | ||
| 109 | rsa_chk.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 110 | rsa_chk.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h | ||
| 111 | rsa_chk.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 112 | rsa_chk.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 113 | rsa_chk.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 114 | rsa_chk.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 115 | rsa_chk.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 116 | rsa_chk.o: rsa_chk.c | ||
| 117 | rsa_depr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 118 | rsa_depr.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 119 | rsa_depr.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 120 | rsa_depr.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 121 | rsa_depr.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 122 | rsa_depr.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 123 | rsa_depr.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 124 | rsa_depr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 125 | rsa_depr.o: ../cryptlib.h rsa_depr.c | ||
| 126 | rsa_eay.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 127 | rsa_eay.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 128 | rsa_eay.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 129 | rsa_eay.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 130 | rsa_eay.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 131 | rsa_eay.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 132 | rsa_eay.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 133 | rsa_eay.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 134 | rsa_eay.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_eay.c | ||
| 135 | rsa_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 136 | rsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 137 | rsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 138 | rsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 139 | rsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rsa.h | ||
| 140 | rsa_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 141 | rsa_err.o: ../../include/openssl/symhacks.h rsa_err.c | ||
| 142 | rsa_gen.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 143 | rsa_gen.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 144 | rsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 145 | rsa_gen.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 146 | rsa_gen.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 147 | rsa_gen.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 148 | rsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 149 | rsa_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 150 | rsa_gen.o: ../cryptlib.h rsa_gen.c | ||
| 151 | rsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 152 | rsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 153 | rsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 154 | rsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 155 | rsa_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 156 | rsa_lib.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 157 | rsa_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 158 | rsa_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 159 | rsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 160 | rsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 161 | rsa_lib.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 162 | rsa_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 163 | rsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 164 | rsa_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 165 | rsa_lib.o: ../cryptlib.h rsa_lib.c | ||
| 166 | rsa_none.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 167 | rsa_none.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 168 | rsa_none.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 169 | rsa_none.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 170 | rsa_none.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 171 | rsa_none.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 172 | rsa_none.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 173 | rsa_none.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 174 | rsa_none.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_none.c | ||
| 175 | rsa_null.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 176 | rsa_null.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 177 | rsa_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 178 | rsa_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 179 | rsa_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 180 | rsa_null.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 181 | rsa_null.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 182 | rsa_null.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 183 | rsa_null.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_null.c | ||
| 184 | rsa_oaep.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 185 | rsa_oaep.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 186 | rsa_oaep.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 187 | rsa_oaep.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 188 | rsa_oaep.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 189 | rsa_oaep.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 190 | rsa_oaep.o: ../../include/openssl/opensslconf.h | ||
| 191 | rsa_oaep.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 192 | rsa_oaep.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 193 | rsa_oaep.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 194 | rsa_oaep.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 195 | rsa_oaep.o: ../cryptlib.h rsa_oaep.c | ||
| 196 | rsa_pk1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 197 | rsa_pk1.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 198 | rsa_pk1.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 199 | rsa_pk1.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 200 | rsa_pk1.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 201 | rsa_pk1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 202 | rsa_pk1.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 203 | rsa_pk1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 204 | rsa_pk1.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pk1.c | ||
| 205 | rsa_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 206 | rsa_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 207 | rsa_pmeth.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 208 | rsa_pmeth.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 209 | rsa_pmeth.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 210 | rsa_pmeth.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 211 | rsa_pmeth.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 212 | rsa_pmeth.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 213 | rsa_pmeth.o: ../../include/openssl/opensslconf.h | ||
| 214 | rsa_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 215 | rsa_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 216 | rsa_pmeth.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 217 | rsa_pmeth.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 218 | rsa_pmeth.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 219 | rsa_pmeth.o: ../cryptlib.h ../evp/evp_locl.h rsa_locl.h rsa_pmeth.c | ||
| 220 | rsa_prn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 221 | rsa_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 222 | rsa_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 223 | rsa_prn.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 224 | rsa_prn.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 225 | rsa_prn.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 226 | rsa_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 227 | rsa_prn.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 228 | rsa_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 229 | rsa_prn.o: ../cryptlib.h rsa_prn.c | ||
| 230 | rsa_pss.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 231 | rsa_pss.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 232 | rsa_pss.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 233 | rsa_pss.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 234 | rsa_pss.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 235 | rsa_pss.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 236 | rsa_pss.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 237 | rsa_pss.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
| 238 | rsa_pss.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 239 | rsa_pss.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 240 | rsa_pss.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_pss.c | ||
| 241 | rsa_saos.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 242 | rsa_saos.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 243 | rsa_saos.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 244 | rsa_saos.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 245 | rsa_saos.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 246 | rsa_saos.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 247 | rsa_saos.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 248 | rsa_saos.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 249 | rsa_saos.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 250 | rsa_saos.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 251 | rsa_saos.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 252 | rsa_saos.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 253 | rsa_saos.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 254 | rsa_saos.o: ../cryptlib.h rsa_saos.c | ||
| 255 | rsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 256 | rsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 257 | rsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 258 | rsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 259 | rsa_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 260 | rsa_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 261 | rsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 262 | rsa_sign.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 263 | rsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 264 | rsa_sign.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 265 | rsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 266 | rsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 267 | rsa_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 268 | rsa_sign.o: ../cryptlib.h rsa_locl.h rsa_sign.c | ||
| 269 | rsa_ssl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 270 | rsa_ssl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 271 | rsa_ssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 272 | rsa_ssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 273 | rsa_ssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 274 | rsa_ssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 275 | rsa_ssl.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 276 | rsa_ssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 277 | rsa_ssl.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_ssl.c | ||
| 278 | rsa_x931.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 279 | rsa_x931.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 280 | rsa_x931.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 281 | rsa_x931.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 282 | rsa_x931.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 283 | rsa_x931.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 284 | rsa_x931.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 285 | rsa_x931.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 286 | rsa_x931.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 287 | rsa_x931.o: ../../include/openssl/symhacks.h ../cryptlib.h rsa_x931.c | ||
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 7c941885f0..c5eaeeae6b 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
| @@ -675,7 +675,7 @@ static int RSA_eay_public_decrypt(int flen, const unsigned char *from, | |||
| 675 | rsa->_method_mod_n)) goto err; | 675 | rsa->_method_mod_n)) goto err; |
| 676 | 676 | ||
| 677 | if ((padding == RSA_X931_PADDING) && ((ret->d[0] & 0xf) != 12)) | 677 | if ((padding == RSA_X931_PADDING) && ((ret->d[0] & 0xf) != 12)) |
| 678 | if (!BN_sub(ret, rsa->n, ret)) goto err; | 678 | BN_sub(ret, rsa->n, ret); |
| 679 | 679 | ||
| 680 | p=buf; | 680 | p=buf; |
| 681 | i=BN_bn2bin(ret,p); | 681 | i=BN_bn2bin(ret,p); |
diff --git a/src/lib/libcrypto/rsa/rsa_null.c b/src/lib/libcrypto/rsa/rsa_null.c new file mode 100644 index 0000000000..2f2202f142 --- /dev/null +++ b/src/lib/libcrypto/rsa/rsa_null.c | |||
| @@ -0,0 +1,151 @@ | |||
| 1 | /* rsa_null.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include "cryptlib.h" | ||
| 61 | #include <openssl/bn.h> | ||
| 62 | #include <openssl/rsa.h> | ||
| 63 | #include <openssl/rand.h> | ||
| 64 | |||
| 65 | /* This is a dummy RSA implementation that just returns errors when called. | ||
| 66 | * It is designed to allow some RSA functions to work while stopping those | ||
| 67 | * covered by the RSA patent. That is RSA, encryption, decryption, signing | ||
| 68 | * and verify is not allowed but RSA key generation, key checking and other | ||
| 69 | * operations (like storing RSA keys) are permitted. | ||
| 70 | */ | ||
| 71 | |||
| 72 | static int RSA_null_public_encrypt(int flen, const unsigned char *from, | ||
| 73 | unsigned char *to, RSA *rsa,int padding); | ||
| 74 | static int RSA_null_private_encrypt(int flen, const unsigned char *from, | ||
| 75 | unsigned char *to, RSA *rsa,int padding); | ||
| 76 | static int RSA_null_public_decrypt(int flen, const unsigned char *from, | ||
| 77 | unsigned char *to, RSA *rsa,int padding); | ||
| 78 | static int RSA_null_private_decrypt(int flen, const unsigned char *from, | ||
| 79 | unsigned char *to, RSA *rsa,int padding); | ||
| 80 | #if 0 /* not currently used */ | ||
| 81 | static int RSA_null_mod_exp(const BIGNUM *r0, const BIGNUM *i, RSA *rsa); | ||
| 82 | #endif | ||
| 83 | static int RSA_null_init(RSA *rsa); | ||
| 84 | static int RSA_null_finish(RSA *rsa); | ||
| 85 | static RSA_METHOD rsa_null_meth={ | ||
| 86 | "Null RSA", | ||
| 87 | RSA_null_public_encrypt, | ||
| 88 | RSA_null_public_decrypt, | ||
| 89 | RSA_null_private_encrypt, | ||
| 90 | RSA_null_private_decrypt, | ||
| 91 | NULL, | ||
| 92 | NULL, | ||
| 93 | RSA_null_init, | ||
| 94 | RSA_null_finish, | ||
| 95 | 0, | ||
| 96 | NULL, | ||
| 97 | NULL, | ||
| 98 | NULL, | ||
| 99 | NULL | ||
| 100 | }; | ||
| 101 | |||
| 102 | const RSA_METHOD *RSA_null_method(void) | ||
| 103 | { | ||
| 104 | return(&rsa_null_meth); | ||
| 105 | } | ||
| 106 | |||
| 107 | static int RSA_null_public_encrypt(int flen, const unsigned char *from, | ||
| 108 | unsigned char *to, RSA *rsa, int padding) | ||
| 109 | { | ||
| 110 | RSAerr(RSA_F_RSA_NULL_PUBLIC_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); | ||
| 111 | return -1; | ||
| 112 | } | ||
| 113 | |||
| 114 | static int RSA_null_private_encrypt(int flen, const unsigned char *from, | ||
| 115 | unsigned char *to, RSA *rsa, int padding) | ||
| 116 | { | ||
| 117 | RSAerr(RSA_F_RSA_NULL_PRIVATE_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); | ||
| 118 | return -1; | ||
| 119 | } | ||
| 120 | |||
| 121 | static int RSA_null_private_decrypt(int flen, const unsigned char *from, | ||
| 122 | unsigned char *to, RSA *rsa, int padding) | ||
| 123 | { | ||
| 124 | RSAerr(RSA_F_RSA_NULL_PRIVATE_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); | ||
| 125 | return -1; | ||
| 126 | } | ||
| 127 | |||
| 128 | static int RSA_null_public_decrypt(int flen, const unsigned char *from, | ||
| 129 | unsigned char *to, RSA *rsa, int padding) | ||
| 130 | { | ||
| 131 | RSAerr(RSA_F_RSA_NULL_PUBLIC_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); | ||
| 132 | return -1; | ||
| 133 | } | ||
| 134 | |||
| 135 | #if 0 /* not currently used */ | ||
| 136 | static int RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) | ||
| 137 | { | ||
| 138 | ...err(RSA_F_RSA_NULL_MOD_EXP, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); | ||
| 139 | return -1; | ||
| 140 | } | ||
| 141 | #endif | ||
| 142 | |||
| 143 | static int RSA_null_init(RSA *rsa) | ||
| 144 | { | ||
| 145 | return(1); | ||
| 146 | } | ||
| 147 | |||
| 148 | static int RSA_null_finish(RSA *rsa) | ||
| 149 | { | ||
| 150 | return(1); | ||
| 151 | } | ||
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index 18d307ea9e..e238d10e5c 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
| @@ -189,40 +189,34 @@ int PKCS1_MGF1(unsigned char *mask, long len, | |||
| 189 | EVP_MD_CTX c; | 189 | EVP_MD_CTX c; |
| 190 | unsigned char md[EVP_MAX_MD_SIZE]; | 190 | unsigned char md[EVP_MAX_MD_SIZE]; |
| 191 | int mdlen; | 191 | int mdlen; |
| 192 | int rv = -1; | ||
| 193 | 192 | ||
| 194 | EVP_MD_CTX_init(&c); | 193 | EVP_MD_CTX_init(&c); |
| 195 | mdlen = EVP_MD_size(dgst); | 194 | mdlen = EVP_MD_size(dgst); |
| 196 | if (mdlen < 0) | 195 | if (mdlen < 0) |
| 197 | goto err; | 196 | return -1; |
| 198 | for (i = 0; outlen < len; i++) | 197 | for (i = 0; outlen < len; i++) |
| 199 | { | 198 | { |
| 200 | cnt[0] = (unsigned char)((i >> 24) & 255); | 199 | cnt[0] = (unsigned char)((i >> 24) & 255); |
| 201 | cnt[1] = (unsigned char)((i >> 16) & 255); | 200 | cnt[1] = (unsigned char)((i >> 16) & 255); |
| 202 | cnt[2] = (unsigned char)((i >> 8)) & 255; | 201 | cnt[2] = (unsigned char)((i >> 8)) & 255; |
| 203 | cnt[3] = (unsigned char)(i & 255); | 202 | cnt[3] = (unsigned char)(i & 255); |
| 204 | if (!EVP_DigestInit_ex(&c,dgst, NULL) | 203 | EVP_DigestInit_ex(&c,dgst, NULL); |
| 205 | || !EVP_DigestUpdate(&c, seed, seedlen) | 204 | EVP_DigestUpdate(&c, seed, seedlen); |
| 206 | || !EVP_DigestUpdate(&c, cnt, 4)) | 205 | EVP_DigestUpdate(&c, cnt, 4); |
| 207 | goto err; | ||
| 208 | if (outlen + mdlen <= len) | 206 | if (outlen + mdlen <= len) |
| 209 | { | 207 | { |
| 210 | if (!EVP_DigestFinal_ex(&c, mask + outlen, NULL)) | 208 | EVP_DigestFinal_ex(&c, mask + outlen, NULL); |
| 211 | goto err; | ||
| 212 | outlen += mdlen; | 209 | outlen += mdlen; |
| 213 | } | 210 | } |
| 214 | else | 211 | else |
| 215 | { | 212 | { |
| 216 | if (!EVP_DigestFinal_ex(&c, md, NULL)) | 213 | EVP_DigestFinal_ex(&c, md, NULL); |
| 217 | goto err; | ||
| 218 | memcpy(mask + outlen, md, len - outlen); | 214 | memcpy(mask + outlen, md, len - outlen); |
| 219 | outlen = len; | 215 | outlen = len; |
| 220 | } | 216 | } |
| 221 | } | 217 | } |
| 222 | rv = 0; | ||
| 223 | err: | ||
| 224 | EVP_MD_CTX_cleanup(&c); | 218 | EVP_MD_CTX_cleanup(&c); |
| 225 | return rv; | 219 | return 0; |
| 226 | } | 220 | } |
| 227 | 221 | ||
| 228 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, | 222 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, |
diff --git a/src/lib/libcrypto/rsa/rsa_test.c b/src/lib/libcrypto/rsa/rsa_test.c new file mode 100644 index 0000000000..c8705a0f6e --- /dev/null +++ b/src/lib/libcrypto/rsa/rsa_test.c | |||
| @@ -0,0 +1,340 @@ | |||
| 1 | /* test vectors from p1ovect1.txt */ | ||
| 2 | |||
| 3 | #include <stdio.h> | ||
| 4 | #include <string.h> | ||
| 5 | |||
| 6 | #include "e_os.h" | ||
| 7 | |||
| 8 | #include <openssl/crypto.h> | ||
| 9 | #include <openssl/err.h> | ||
| 10 | #include <openssl/rand.h> | ||
| 11 | #include <openssl/bn.h> | ||
| 12 | #ifdef OPENSSL_NO_RSA | ||
| 13 | int main(int argc, char *argv[]) | ||
| 14 | { | ||
| 15 | printf("No RSA support\n"); | ||
| 16 | return(0); | ||
| 17 | } | ||
| 18 | #else | ||
| 19 | #include <openssl/rsa.h> | ||
| 20 | |||
| 21 | #define SetKey \ | ||
| 22 | key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ | ||
| 23 | key->e = BN_bin2bn(e, sizeof(e)-1, key->e); \ | ||
| 24 | key->d = BN_bin2bn(d, sizeof(d)-1, key->d); \ | ||
| 25 | key->p = BN_bin2bn(p, sizeof(p)-1, key->p); \ | ||
| 26 | key->q = BN_bin2bn(q, sizeof(q)-1, key->q); \ | ||
| 27 | key->dmp1 = BN_bin2bn(dmp1, sizeof(dmp1)-1, key->dmp1); \ | ||
| 28 | key->dmq1 = BN_bin2bn(dmq1, sizeof(dmq1)-1, key->dmq1); \ | ||
| 29 | key->iqmp = BN_bin2bn(iqmp, sizeof(iqmp)-1, key->iqmp); \ | ||
| 30 | memcpy(c, ctext_ex, sizeof(ctext_ex) - 1); \ | ||
| 31 | return (sizeof(ctext_ex) - 1); | ||
| 32 | |||
| 33 | static int key1(RSA *key, unsigned char *c) | ||
| 34 | { | ||
| 35 | static unsigned char n[] = | ||
| 36 | "\x00\xAA\x36\xAB\xCE\x88\xAC\xFD\xFF\x55\x52\x3C\x7F\xC4\x52\x3F" | ||
| 37 | "\x90\xEF\xA0\x0D\xF3\x77\x4A\x25\x9F\x2E\x62\xB4\xC5\xD9\x9C\xB5" | ||
| 38 | "\xAD\xB3\x00\xA0\x28\x5E\x53\x01\x93\x0E\x0C\x70\xFB\x68\x76\x93" | ||
| 39 | "\x9C\xE6\x16\xCE\x62\x4A\x11\xE0\x08\x6D\x34\x1E\xBC\xAC\xA0\xA1" | ||
| 40 | "\xF5"; | ||
| 41 | |||
| 42 | static unsigned char e[] = "\x11"; | ||
| 43 | |||
| 44 | static unsigned char d[] = | ||
| 45 | "\x0A\x03\x37\x48\x62\x64\x87\x69\x5F\x5F\x30\xBC\x38\xB9\x8B\x44" | ||
| 46 | "\xC2\xCD\x2D\xFF\x43\x40\x98\xCD\x20\xD8\xA1\x38\xD0\x90\xBF\x64" | ||
| 47 | "\x79\x7C\x3F\xA7\xA2\xCD\xCB\x3C\xD1\xE0\xBD\xBA\x26\x54\xB4\xF9" | ||
| 48 | "\xDF\x8E\x8A\xE5\x9D\x73\x3D\x9F\x33\xB3\x01\x62\x4A\xFD\x1D\x51"; | ||
| 49 | |||
| 50 | static unsigned char p[] = | ||
| 51 | "\x00\xD8\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5" | ||
| 52 | "\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x12" | ||
| 53 | "\x0D"; | ||
| 54 | |||
| 55 | static unsigned char q[] = | ||
| 56 | "\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9" | ||
| 57 | "\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D" | ||
| 58 | "\x89"; | ||
| 59 | |||
| 60 | static unsigned char dmp1[] = | ||
| 61 | "\x59\x0B\x95\x72\xA2\xC2\xA9\xC4\x06\x05\x9D\xC2\xAB\x2F\x1D\xAF" | ||
| 62 | "\xEB\x7E\x8B\x4F\x10\xA7\x54\x9E\x8E\xED\xF5\xB4\xFC\xE0\x9E\x05"; | ||
| 63 | |||
| 64 | static unsigned char dmq1[] = | ||
| 65 | "\x00\x8E\x3C\x05\x21\xFE\x15\xE0\xEA\x06\xA3\x6F\xF0\xF1\x0C\x99" | ||
| 66 | "\x52\xC3\x5B\x7A\x75\x14\xFD\x32\x38\xB8\x0A\xAD\x52\x98\x62\x8D" | ||
| 67 | "\x51"; | ||
| 68 | |||
| 69 | static unsigned char iqmp[] = | ||
| 70 | "\x36\x3F\xF7\x18\x9D\xA8\xE9\x0B\x1D\x34\x1F\x71\xD0\x9B\x76\xA8" | ||
| 71 | "\xA9\x43\xE1\x1D\x10\xB2\x4D\x24\x9F\x2D\xEA\xFE\xF8\x0C\x18\x26"; | ||
| 72 | |||
| 73 | static unsigned char ctext_ex[] = | ||
| 74 | "\x1b\x8f\x05\xf9\xca\x1a\x79\x52\x6e\x53\xf3\xcc\x51\x4f\xdb\x89" | ||
| 75 | "\x2b\xfb\x91\x93\x23\x1e\x78\xb9\x92\xe6\x8d\x50\xa4\x80\xcb\x52" | ||
| 76 | "\x33\x89\x5c\x74\x95\x8d\x5d\x02\xab\x8c\x0f\xd0\x40\xeb\x58\x44" | ||
| 77 | "\xb0\x05\xc3\x9e\xd8\x27\x4a\x9d\xbf\xa8\x06\x71\x40\x94\x39\xd2"; | ||
| 78 | |||
| 79 | SetKey; | ||
| 80 | } | ||
| 81 | |||
| 82 | static int key2(RSA *key, unsigned char *c) | ||
| 83 | { | ||
| 84 | static unsigned char n[] = | ||
| 85 | "\x00\xA3\x07\x9A\x90\xDF\x0D\xFD\x72\xAC\x09\x0C\xCC\x2A\x78\xB8" | ||
| 86 | "\x74\x13\x13\x3E\x40\x75\x9C\x98\xFA\xF8\x20\x4F\x35\x8A\x0B\x26" | ||
| 87 | "\x3C\x67\x70\xE7\x83\xA9\x3B\x69\x71\xB7\x37\x79\xD2\x71\x7B\xE8" | ||
| 88 | "\x34\x77\xCF"; | ||
| 89 | |||
| 90 | static unsigned char e[] = "\x3"; | ||
| 91 | |||
| 92 | static unsigned char d[] = | ||
| 93 | "\x6C\xAF\xBC\x60\x94\xB3\xFE\x4C\x72\xB0\xB3\x32\xC6\xFB\x25\xA2" | ||
| 94 | "\xB7\x62\x29\x80\x4E\x68\x65\xFC\xA4\x5A\x74\xDF\x0F\x8F\xB8\x41" | ||
| 95 | "\x3B\x52\xC0\xD0\xE5\x3D\x9B\x59\x0F\xF1\x9B\xE7\x9F\x49\xDD\x21" | ||
| 96 | "\xE5\xEB"; | ||
| 97 | |||
| 98 | static unsigned char p[] = | ||
| 99 | "\x00\xCF\x20\x35\x02\x8B\x9D\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92" | ||
| 100 | "\xEA\x0D\xA3\xB4\x32\x04\xB5\xCF\xCE\x91"; | ||
| 101 | |||
| 102 | static unsigned char q[] = | ||
| 103 | "\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9" | ||
| 104 | "\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5F"; | ||
| 105 | |||
| 106 | static unsigned char dmp1[] = | ||
| 107 | "\x00\x8A\x15\x78\xAC\x5D\x13\xAF\x10\x2B\x22\xB9\x99\xCD\x74\x61" | ||
| 108 | "\xF1\x5E\x6D\x22\xCC\x03\x23\xDF\xDF\x0B"; | ||
| 109 | |||
| 110 | static unsigned char dmq1[] = | ||
| 111 | "\x00\x86\x55\x21\x4A\xC5\x4D\x8D\x4E\xCD\x61\x77\xF1\xC7\x36\x90" | ||
| 112 | "\xCE\x2A\x48\x2C\x8B\x05\x99\xCB\xE0\x3F"; | ||
| 113 | |||
| 114 | static unsigned char iqmp[] = | ||
| 115 | "\x00\x83\xEF\xEF\xB8\xA9\xA4\x0D\x1D\xB6\xED\x98\xAD\x84\xED\x13" | ||
| 116 | "\x35\xDC\xC1\x08\xF3\x22\xD0\x57\xCF\x8D"; | ||
| 117 | |||
| 118 | static unsigned char ctext_ex[] = | ||
| 119 | "\x14\xbd\xdd\x28\xc9\x83\x35\x19\x23\x80\xe8\xe5\x49\xb1\x58\x2a" | ||
| 120 | "\x8b\x40\xb4\x48\x6d\x03\xa6\xa5\x31\x1f\x1f\xd5\xf0\xa1\x80\xe4" | ||
| 121 | "\x17\x53\x03\x29\xa9\x34\x90\x74\xb1\x52\x13\x54\x29\x08\x24\x52" | ||
| 122 | "\x62\x51"; | ||
| 123 | |||
| 124 | SetKey; | ||
| 125 | } | ||
| 126 | |||
| 127 | static int key3(RSA *key, unsigned char *c) | ||
| 128 | { | ||
| 129 | static unsigned char n[] = | ||
| 130 | "\x00\xBB\xF8\x2F\x09\x06\x82\xCE\x9C\x23\x38\xAC\x2B\x9D\xA8\x71" | ||
| 131 | "\xF7\x36\x8D\x07\xEE\xD4\x10\x43\xA4\x40\xD6\xB6\xF0\x74\x54\xF5" | ||
| 132 | "\x1F\xB8\xDF\xBA\xAF\x03\x5C\x02\xAB\x61\xEA\x48\xCE\xEB\x6F\xCD" | ||
| 133 | "\x48\x76\xED\x52\x0D\x60\xE1\xEC\x46\x19\x71\x9D\x8A\x5B\x8B\x80" | ||
| 134 | "\x7F\xAF\xB8\xE0\xA3\xDF\xC7\x37\x72\x3E\xE6\xB4\xB7\xD9\x3A\x25" | ||
| 135 | "\x84\xEE\x6A\x64\x9D\x06\x09\x53\x74\x88\x34\xB2\x45\x45\x98\x39" | ||
| 136 | "\x4E\xE0\xAA\xB1\x2D\x7B\x61\xA5\x1F\x52\x7A\x9A\x41\xF6\xC1\x68" | ||
| 137 | "\x7F\xE2\x53\x72\x98\xCA\x2A\x8F\x59\x46\xF8\xE5\xFD\x09\x1D\xBD" | ||
| 138 | "\xCB"; | ||
| 139 | |||
| 140 | static unsigned char e[] = "\x11"; | ||
| 141 | |||
| 142 | static unsigned char d[] = | ||
| 143 | "\x00\xA5\xDA\xFC\x53\x41\xFA\xF2\x89\xC4\xB9\x88\xDB\x30\xC1\xCD" | ||
| 144 | "\xF8\x3F\x31\x25\x1E\x06\x68\xB4\x27\x84\x81\x38\x01\x57\x96\x41" | ||
| 145 | "\xB2\x94\x10\xB3\xC7\x99\x8D\x6B\xC4\x65\x74\x5E\x5C\x39\x26\x69" | ||
| 146 | "\xD6\x87\x0D\xA2\xC0\x82\xA9\x39\xE3\x7F\xDC\xB8\x2E\xC9\x3E\xDA" | ||
| 147 | "\xC9\x7F\xF3\xAD\x59\x50\xAC\xCF\xBC\x11\x1C\x76\xF1\xA9\x52\x94" | ||
| 148 | "\x44\xE5\x6A\xAF\x68\xC5\x6C\x09\x2C\xD3\x8D\xC3\xBE\xF5\xD2\x0A" | ||
| 149 | "\x93\x99\x26\xED\x4F\x74\xA1\x3E\xDD\xFB\xE1\xA1\xCE\xCC\x48\x94" | ||
| 150 | "\xAF\x94\x28\xC2\xB7\xB8\x88\x3F\xE4\x46\x3A\x4B\xC8\x5B\x1C\xB3" | ||
| 151 | "\xC1"; | ||
| 152 | |||
| 153 | static unsigned char p[] = | ||
| 154 | "\x00\xEE\xCF\xAE\x81\xB1\xB9\xB3\xC9\x08\x81\x0B\x10\xA1\xB5\x60" | ||
| 155 | "\x01\x99\xEB\x9F\x44\xAE\xF4\xFD\xA4\x93\xB8\x1A\x9E\x3D\x84\xF6" | ||
| 156 | "\x32\x12\x4E\xF0\x23\x6E\x5D\x1E\x3B\x7E\x28\xFA\xE7\xAA\x04\x0A" | ||
| 157 | "\x2D\x5B\x25\x21\x76\x45\x9D\x1F\x39\x75\x41\xBA\x2A\x58\xFB\x65" | ||
| 158 | "\x99"; | ||
| 159 | |||
| 160 | static unsigned char q[] = | ||
| 161 | "\x00\xC9\x7F\xB1\xF0\x27\xF4\x53\xF6\x34\x12\x33\xEA\xAA\xD1\xD9" | ||
| 162 | "\x35\x3F\x6C\x42\xD0\x88\x66\xB1\xD0\x5A\x0F\x20\x35\x02\x8B\x9D" | ||
| 163 | "\x86\x98\x40\xB4\x16\x66\xB4\x2E\x92\xEA\x0D\xA3\xB4\x32\x04\xB5" | ||
| 164 | "\xCF\xCE\x33\x52\x52\x4D\x04\x16\xA5\xA4\x41\xE7\x00\xAF\x46\x15" | ||
| 165 | "\x03"; | ||
| 166 | |||
| 167 | static unsigned char dmp1[] = | ||
| 168 | "\x54\x49\x4C\xA6\x3E\xBA\x03\x37\xE4\xE2\x40\x23\xFC\xD6\x9A\x5A" | ||
| 169 | "\xEB\x07\xDD\xDC\x01\x83\xA4\xD0\xAC\x9B\x54\xB0\x51\xF2\xB1\x3E" | ||
| 170 | "\xD9\x49\x09\x75\xEA\xB7\x74\x14\xFF\x59\xC1\xF7\x69\x2E\x9A\x2E" | ||
| 171 | "\x20\x2B\x38\xFC\x91\x0A\x47\x41\x74\xAD\xC9\x3C\x1F\x67\xC9\x81"; | ||
| 172 | |||
| 173 | static unsigned char dmq1[] = | ||
| 174 | "\x47\x1E\x02\x90\xFF\x0A\xF0\x75\x03\x51\xB7\xF8\x78\x86\x4C\xA9" | ||
| 175 | "\x61\xAD\xBD\x3A\x8A\x7E\x99\x1C\x5C\x05\x56\xA9\x4C\x31\x46\xA7" | ||
| 176 | "\xF9\x80\x3F\x8F\x6F\x8A\xE3\x42\xE9\x31\xFD\x8A\xE4\x7A\x22\x0D" | ||
| 177 | "\x1B\x99\xA4\x95\x84\x98\x07\xFE\x39\xF9\x24\x5A\x98\x36\xDA\x3D"; | ||
| 178 | |||
| 179 | static unsigned char iqmp[] = | ||
| 180 | "\x00\xB0\x6C\x4F\xDA\xBB\x63\x01\x19\x8D\x26\x5B\xDB\xAE\x94\x23" | ||
| 181 | "\xB3\x80\xF2\x71\xF7\x34\x53\x88\x50\x93\x07\x7F\xCD\x39\xE2\x11" | ||
| 182 | "\x9F\xC9\x86\x32\x15\x4F\x58\x83\xB1\x67\xA9\x67\xBF\x40\x2B\x4E" | ||
| 183 | "\x9E\x2E\x0F\x96\x56\xE6\x98\xEA\x36\x66\xED\xFB\x25\x79\x80\x39" | ||
| 184 | "\xF7"; | ||
| 185 | |||
| 186 | static unsigned char ctext_ex[] = | ||
| 187 | "\xb8\x24\x6b\x56\xa6\xed\x58\x81\xae\xb5\x85\xd9\xa2\x5b\x2a\xd7" | ||
| 188 | "\x90\xc4\x17\xe0\x80\x68\x1b\xf1\xac\x2b\xc3\xde\xb6\x9d\x8b\xce" | ||
| 189 | "\xf0\xc4\x36\x6f\xec\x40\x0a\xf0\x52\xa7\x2e\x9b\x0e\xff\xb5\xb3" | ||
| 190 | "\xf2\xf1\x92\xdb\xea\xca\x03\xc1\x27\x40\x05\x71\x13\xbf\x1f\x06" | ||
| 191 | "\x69\xac\x22\xe9\xf3\xa7\x85\x2e\x3c\x15\xd9\x13\xca\xb0\xb8\x86" | ||
| 192 | "\x3a\x95\xc9\x92\x94\xce\x86\x74\x21\x49\x54\x61\x03\x46\xf4\xd4" | ||
| 193 | "\x74\xb2\x6f\x7c\x48\xb4\x2e\xe6\x8e\x1f\x57\x2a\x1f\xc4\x02\x6a" | ||
| 194 | "\xc4\x56\xb4\xf5\x9f\x7b\x62\x1e\xa1\xb9\xd8\x8f\x64\x20\x2f\xb1"; | ||
| 195 | |||
| 196 | SetKey; | ||
| 197 | } | ||
| 198 | |||
| 199 | static int pad_unknown(void) | ||
| 200 | { | ||
| 201 | unsigned long l; | ||
| 202 | while ((l = ERR_get_error()) != 0) | ||
| 203 | if (ERR_GET_REASON(l) == RSA_R_UNKNOWN_PADDING_TYPE) | ||
| 204 | return(1); | ||
| 205 | return(0); | ||
| 206 | } | ||
| 207 | |||
| 208 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 209 | |||
| 210 | int main(int argc, char *argv[]) | ||
| 211 | { | ||
| 212 | int err=0; | ||
| 213 | int v; | ||
| 214 | RSA *key; | ||
| 215 | unsigned char ptext[256]; | ||
| 216 | unsigned char ctext[256]; | ||
| 217 | static unsigned char ptext_ex[] = "\x54\x85\x9b\x34\x2c\x49\xea\x2a"; | ||
| 218 | unsigned char ctext_ex[256]; | ||
| 219 | int plen; | ||
| 220 | int clen = 0; | ||
| 221 | int num; | ||
| 222 | int n; | ||
| 223 | |||
| 224 | CRYPTO_malloc_debug_init(); | ||
| 225 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
| 226 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
| 227 | |||
| 228 | RAND_seed(rnd_seed, sizeof rnd_seed); /* or OAEP may fail */ | ||
| 229 | |||
| 230 | plen = sizeof(ptext_ex) - 1; | ||
| 231 | |||
| 232 | for (v = 0; v < 6; v++) | ||
| 233 | { | ||
| 234 | key = RSA_new(); | ||
| 235 | switch (v%3) { | ||
| 236 | case 0: | ||
| 237 | clen = key1(key, ctext_ex); | ||
| 238 | break; | ||
| 239 | case 1: | ||
| 240 | clen = key2(key, ctext_ex); | ||
| 241 | break; | ||
| 242 | case 2: | ||
| 243 | clen = key3(key, ctext_ex); | ||
| 244 | break; | ||
| 245 | } | ||
| 246 | if (v/3 >= 1) key->flags |= RSA_FLAG_NO_CONSTTIME; | ||
| 247 | |||
| 248 | num = RSA_public_encrypt(plen, ptext_ex, ctext, key, | ||
| 249 | RSA_PKCS1_PADDING); | ||
| 250 | if (num != clen) | ||
| 251 | { | ||
| 252 | printf("PKCS#1 v1.5 encryption failed!\n"); | ||
| 253 | err=1; | ||
| 254 | goto oaep; | ||
| 255 | } | ||
| 256 | |||
| 257 | num = RSA_private_decrypt(num, ctext, ptext, key, | ||
| 258 | RSA_PKCS1_PADDING); | ||
| 259 | if (num != plen || memcmp(ptext, ptext_ex, num) != 0) | ||
| 260 | { | ||
| 261 | printf("PKCS#1 v1.5 decryption failed!\n"); | ||
| 262 | err=1; | ||
| 263 | } | ||
| 264 | else | ||
| 265 | printf("PKCS #1 v1.5 encryption/decryption ok\n"); | ||
| 266 | |||
| 267 | oaep: | ||
| 268 | ERR_clear_error(); | ||
| 269 | num = RSA_public_encrypt(plen, ptext_ex, ctext, key, | ||
| 270 | RSA_PKCS1_OAEP_PADDING); | ||
| 271 | if (num == -1 && pad_unknown()) | ||
| 272 | { | ||
| 273 | printf("No OAEP support\n"); | ||
| 274 | goto next; | ||
| 275 | } | ||
| 276 | if (num != clen) | ||
| 277 | { | ||
| 278 | printf("OAEP encryption failed!\n"); | ||
| 279 | err=1; | ||
| 280 | goto next; | ||
| 281 | } | ||
| 282 | |||
| 283 | num = RSA_private_decrypt(num, ctext, ptext, key, | ||
| 284 | RSA_PKCS1_OAEP_PADDING); | ||
| 285 | if (num != plen || memcmp(ptext, ptext_ex, num) != 0) | ||
| 286 | { | ||
| 287 | printf("OAEP decryption (encrypted data) failed!\n"); | ||
| 288 | err=1; | ||
| 289 | } | ||
| 290 | else if (memcmp(ctext, ctext_ex, num) == 0) | ||
| 291 | printf("OAEP test vector %d passed!\n", v); | ||
| 292 | |||
| 293 | /* Different ciphertexts (rsa_oaep.c without -DPKCS_TESTVECT). | ||
| 294 | Try decrypting ctext_ex */ | ||
| 295 | |||
| 296 | num = RSA_private_decrypt(clen, ctext_ex, ptext, key, | ||
| 297 | RSA_PKCS1_OAEP_PADDING); | ||
| 298 | |||
| 299 | if (num != plen || memcmp(ptext, ptext_ex, num) != 0) | ||
| 300 | { | ||
| 301 | printf("OAEP decryption (test vector data) failed!\n"); | ||
| 302 | err=1; | ||
| 303 | } | ||
| 304 | else | ||
| 305 | printf("OAEP encryption/decryption ok\n"); | ||
| 306 | |||
| 307 | /* Try decrypting corrupted ciphertexts */ | ||
| 308 | for(n = 0 ; n < clen ; ++n) | ||
| 309 | { | ||
| 310 | int b; | ||
| 311 | unsigned char saved = ctext[n]; | ||
| 312 | for(b = 0 ; b < 256 ; ++b) | ||
| 313 | { | ||
| 314 | if(b == saved) | ||
| 315 | continue; | ||
| 316 | ctext[n] = b; | ||
| 317 | num = RSA_private_decrypt(num, ctext, ptext, key, | ||
| 318 | RSA_PKCS1_OAEP_PADDING); | ||
| 319 | if(num > 0) | ||
| 320 | { | ||
| 321 | printf("Corrupt data decrypted!\n"); | ||
| 322 | err = 1; | ||
| 323 | } | ||
| 324 | } | ||
| 325 | } | ||
| 326 | next: | ||
| 327 | RSA_free(key); | ||
| 328 | } | ||
| 329 | |||
| 330 | CRYPTO_cleanup_all_ex_data(); | ||
| 331 | ERR_remove_thread_state(NULL); | ||
| 332 | |||
| 333 | CRYPTO_mem_leaks_fp(stderr); | ||
| 334 | |||
| 335 | #ifdef OPENSSL_SYS_NETWARE | ||
| 336 | if (err) printf("ERROR: %d\n", err); | ||
| 337 | #endif | ||
| 338 | return err; | ||
| 339 | } | ||
| 340 | #endif | ||
diff --git a/src/lib/libcrypto/seed/Makefile b/src/lib/libcrypto/seed/Makefile new file mode 100644 index 0000000000..4bc55e4916 --- /dev/null +++ b/src/lib/libcrypto/seed/Makefile | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | # | ||
| 2 | # crypto/seed/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= seed | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 15 | |||
| 16 | GENERAL=Makefile | ||
| 17 | TEST= | ||
| 18 | APPS= | ||
| 19 | |||
| 20 | LIB=$(TOP)/libcrypto.a | ||
| 21 | LIBSRC=seed.c seed_ecb.c seed_cbc.c seed_cfb.c seed_ofb.c | ||
| 22 | LIBOBJ=seed.o seed_ecb.o seed_cbc.o seed_cfb.o seed_ofb.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | EXHEADER= seed.h | ||
| 27 | HEADER= seed_locl.h $(EXHEADER) | ||
| 28 | |||
| 29 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 30 | |||
| 31 | top: | ||
| 32 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 33 | |||
| 34 | all: lib | ||
| 35 | |||
| 36 | lib: $(LIBOBJ) | ||
| 37 | $(AR) $(LIB) $(LIBOBJ) | ||
| 38 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 39 | @touch lib | ||
| 40 | |||
| 41 | files: | ||
| 42 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 43 | |||
| 44 | links: | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 48 | |||
| 49 | install: | ||
| 50 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 51 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 52 | do \ | ||
| 53 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 54 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 55 | done; | ||
| 56 | |||
| 57 | tags: | ||
| 58 | ctags $(SRC) | ||
| 59 | |||
| 60 | tests: | ||
| 61 | |||
| 62 | lint: | ||
| 63 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 64 | |||
| 65 | depend: | ||
| 66 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 67 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 68 | |||
| 69 | dclean: | ||
| 70 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 71 | mv -f Makefile.new $(MAKEFILE) | ||
| 72 | |||
| 73 | clean: | ||
| 74 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 75 | |||
| 76 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 77 | |||
| 78 | seed.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 79 | seed.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 80 | seed.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 81 | seed.o: ../../include/openssl/seed.h ../../include/openssl/stack.h | ||
| 82 | seed.o: ../../include/openssl/symhacks.h seed.c seed_locl.h | ||
| 83 | seed_cbc.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 84 | seed_cbc.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h | ||
| 85 | seed_cbc.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 86 | seed_cbc.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 87 | seed_cbc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 88 | seed_cbc.o: seed_cbc.c | ||
| 89 | seed_cfb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 90 | seed_cfb.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h | ||
| 91 | seed_cfb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 92 | seed_cfb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 93 | seed_cfb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 94 | seed_cfb.o: seed_cfb.c | ||
| 95 | seed_ecb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 96 | seed_ecb.o: ../../include/openssl/opensslconf.h | ||
| 97 | seed_ecb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 98 | seed_ecb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 99 | seed_ecb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 100 | seed_ecb.o: seed_ecb.c | ||
| 101 | seed_ofb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | seed_ofb.o: ../../include/openssl/modes.h ../../include/openssl/opensslconf.h | ||
| 103 | seed_ofb.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 104 | seed_ofb.o: ../../include/openssl/safestack.h ../../include/openssl/seed.h | ||
| 105 | seed_ofb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 106 | seed_ofb.o: seed_ofb.c | ||
diff --git a/src/lib/libcrypto/seed/seed.c b/src/lib/libcrypto/seed/seed.c new file mode 100644 index 0000000000..2bc384a19f --- /dev/null +++ b/src/lib/libcrypto/seed/seed.c | |||
| @@ -0,0 +1,325 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. | ||
| 3 | * | ||
| 4 | * Redistribution and use in source and binary forms, with or without | ||
| 5 | * modification, are permitted provided that the following conditions | ||
| 6 | * are met: | ||
| 7 | * 1. Redistributions of source code must retain the above copyright | ||
| 8 | * notice, this list of conditions and the following disclaimer. | ||
| 9 | * 2. Neither the name of author nor the names of its contributors may | ||
| 10 | * be used to endorse or promote products derived from this software | ||
| 11 | * without specific prior written permission. | ||
| 12 | * | ||
| 13 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
| 14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 16 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 23 | * SUCH DAMAGE. | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | #ifndef OPENSSL_NO_SEED | ||
| 27 | |||
| 28 | #include <stdio.h> | ||
| 29 | #include <stdlib.h> | ||
| 30 | #include <string.h> | ||
| 31 | #ifdef WIN32 | ||
| 32 | #include <memory.h> | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #include <openssl/seed.h> | ||
| 36 | #include "seed_locl.h" | ||
| 37 | |||
| 38 | static const seed_word SS[4][256] = { { | ||
| 39 | 0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124, | ||
| 40 | 0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360, | ||
| 41 | 0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314, | ||
| 42 | 0x2585a1a4, 0x0f8f838c, 0x03030300, 0x3b4b7378, 0x3b8bb3b8, 0x13031310, 0x12c2d2d0, 0x2ecee2ec, | ||
| 43 | 0x30407070, 0x0c8c808c, 0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4, 0x34447074, | ||
| 44 | 0x2ccce0ec, 0x15859194, 0x0b0b0308, 0x17475354, 0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x01010100, | ||
| 45 | 0x24042024, 0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0x0cccc0cc, 0x32c2f2f0, 0x19c9d1d8, | ||
| 46 | 0x2c0c202c, 0x27c7e3e4, 0x32427270, 0x03838380, 0x1b8b9398, 0x11c1d1d0, 0x06868284, 0x09c9c1c8, | ||
| 47 | 0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0x0d0d010c, 0x3686b2b4, 0x1e8e929c, 0x0f4f434c, | ||
| 48 | 0x3787b3b4, 0x1a4a5258, 0x06c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac, 0x15c5d1d4, | ||
| 49 | 0x21416160, 0x03c3c3c0, 0x3484b0b4, 0x01414140, 0x12425250, 0x3d4d717c, 0x0d8d818c, 0x08080008, | ||
| 50 | 0x1f0f131c, 0x19899198, 0x00000000, 0x19091118, 0x04040004, 0x13435350, 0x37c7f3f4, 0x21c1e1e0, | ||
| 51 | 0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324, 0x3080b0b0, 0x0b8b8388, 0x0e0e020c, 0x2b8ba3a8, | ||
| 52 | 0x2282a2a0, 0x2e4e626c, 0x13839390, 0x0d4d414c, 0x29496168, 0x3c4c707c, 0x09090108, 0x0a0a0208, | ||
| 53 | 0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0, 0x05c5c1c4, 0x07878384, 0x14041014, 0x3ecef2fc, 0x24446064, | ||
| 54 | 0x1eced2dc, 0x2e0e222c, 0x0b4b4348, 0x1a0a1218, 0x06060204, 0x21012120, 0x2b4b6368, 0x26466264, | ||
| 55 | 0x02020200, 0x35c5f1f4, 0x12829290, 0x0a8a8288, 0x0c0c000c, 0x3383b3b0, 0x3e4e727c, 0x10c0d0d0, | ||
| 56 | 0x3a4a7278, 0x07474344, 0x16869294, 0x25c5e1e4, 0x26062224, 0x00808080, 0x2d8da1ac, 0x1fcfd3dc, | ||
| 57 | 0x2181a1a0, 0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114, 0x22022220, 0x38083038, | ||
| 58 | 0x34c4f0f4, 0x2787a3a4, 0x05454144, 0x0c4c404c, 0x01818180, 0x29c9e1e8, 0x04848084, 0x17879394, | ||
| 59 | 0x35053134, 0x0bcbc3c8, 0x0ecec2cc, 0x3c0c303c, 0x31417170, 0x11011110, 0x07c7c3c4, 0x09898188, | ||
| 60 | 0x35457174, 0x3bcbf3f8, 0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x02828280, 0x04c4c0c4, | ||
| 61 | 0x3fcff3fc, 0x09494148, 0x39093138, 0x27476364, 0x00c0c0c0, 0x0fcfc3cc, 0x17c7d3d4, 0x3888b0b8, | ||
| 62 | 0x0f0f030c, 0x0e8e828c, 0x02424240, 0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4, | ||
| 63 | 0x34043034, 0x31c1f1f0, 0x08484048, 0x02c2c2c0, 0x2f4f636c, 0x3d0d313c, 0x2d0d212c, 0x00404040, | ||
| 64 | 0x3e8eb2bc, 0x3e0e323c, 0x3c8cb0bc, 0x01c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0x0e4e424c, 0x15455154, | ||
| 65 | 0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c, 0x1c8c909c, 0x18c8d0d8, 0x0a4a4248, 0x16465254, | ||
| 66 | 0x37477374, 0x2080a0a0, 0x2dcde1ec, 0x06464244, 0x3585b1b4, 0x2b0b2328, 0x25456164, 0x3acaf2f8, | ||
| 67 | 0x23c3e3e0, 0x3989b1b8, 0x3181b1b0, 0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0, | ||
| 68 | 0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4, 0x30c0f0f0, 0x0dcdc1cc, 0x08888088, | ||
| 69 | 0x16061214, 0x3a0a3238, 0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x07070304, 0x33033330, | ||
| 70 | 0x28c8e0e8, 0x1b0b1318, 0x05050104, 0x39497178, 0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298 | ||
| 71 | }, { | ||
| 72 | 0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2, 0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0, | ||
| 73 | 0xac2f8fa3, 0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63, 0x682b4b63, 0x581b4b53, | ||
| 74 | 0xc003c3c3, 0x60224262, 0x30330333, 0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3, | ||
| 75 | 0xd013c3d3, 0x90118191, 0x10110111, 0x04060602, 0x1c1c0c10, 0xbc3c8cb0, 0x34360632, 0x480b4b43, | ||
| 76 | 0xec2fcfe3, 0x88088880, 0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612, 0xf434c4f0, | ||
| 77 | 0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2, 0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890, | ||
| 78 | 0x28280820, 0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1, 0x0c0d0d01, 0xdc1fcfd3, | ||
| 79 | 0xd818c8d0, 0x282b0b23, 0x64264662, 0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272, | ||
| 80 | 0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373, 0x64274763, 0xac2c8ca0, 0x880b8b83, | ||
| 81 | 0xf437c7f3, 0xac2d8da1, 0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2, 0x34340430, | ||
| 82 | 0xd012c2d2, 0x080b0b03, 0xec2ecee2, 0xe829c9e1, 0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0, | ||
| 83 | 0x54174753, 0xac2e8ea2, 0x08080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1, 0x84068682, 0xb83989b1, | ||
| 84 | 0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1, 0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1, | ||
| 85 | 0xd011c1d1, 0x20200020, 0xd417c7d3, 0x00020202, 0x20220222, 0x04040400, 0x68284860, 0x70314171, | ||
| 86 | 0x04070703, 0xd81bcbd3, 0x9c1d8d91, 0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951, | ||
| 87 | 0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92, 0xa02383a3, 0xa82b8ba3, 0xd010c0d0, | ||
| 88 | 0x80018181, 0x0c0f0f03, 0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81, 0xbc3f8fb3, | ||
| 89 | 0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2, 0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41, | ||
| 90 | 0xc808c8c0, 0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0x0c0c0c00, 0x2c2e0e22, 0xb83a8ab2, 0x6c2e4e62, | ||
| 91 | 0x9c1f8f93, 0x581a4a52, 0xf032c2f2, 0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0, | ||
| 92 | 0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73, 0x34350531, 0x10100010, 0x00030303, | ||
| 93 | 0x64244460, 0x6c2d4d61, 0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2, 0x08090901, | ||
| 94 | 0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040, 0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x04050501, | ||
| 95 | 0xf83acaf2, 0x00010101, 0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652, 0x40034343, | ||
| 96 | 0x84058581, 0x14140410, 0x88098981, 0x981b8b93, 0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971, | ||
| 97 | 0x94178793, 0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80, 0x181b0b13, 0x5c1f4f53, | ||
| 98 | 0x74374773, 0x54144450, 0xb03282b2, 0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0x00000000, 0x44064642, | ||
| 99 | 0xec2dcde1, 0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2, 0xc809c9c1, 0xfc3dcdf1, | ||
| 100 | 0x30300030, 0x94158591, 0x64254561, 0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70, | ||
| 101 | 0x0c0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232, 0x84048480, 0x68294961, 0x90138393, | ||
| 102 | 0x34370733, 0xe427c7e3, 0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x080a0a02, 0x84078783, | ||
| 103 | 0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83, 0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3 | ||
| 104 | }, { | ||
| 105 | 0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3, 0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505, | ||
| 106 | 0x515c1d4d, 0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc, 0xc2c80aca, 0x63602343, | ||
| 107 | 0x20282808, 0x40440444, 0x20202000, 0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707, | ||
| 108 | 0xa1a42585, 0x838c0f8f, 0x03000303, 0x73783b4b, 0xb3b83b8b, 0x13101303, 0xd2d012c2, 0xe2ec2ece, | ||
| 109 | 0x70703040, 0x808c0c8c, 0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6, 0x70743444, | ||
| 110 | 0xe0ec2ccc, 0x91941585, 0x03080b0b, 0x53541747, 0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x01000101, | ||
| 111 | 0x20242404, 0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc, 0xf2f032c2, 0xd1d819c9, | ||
| 112 | 0x202c2c0c, 0xe3e427c7, 0x72703242, 0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9, | ||
| 113 | 0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x010c0d0d, 0xb2b43686, 0x929c1e8e, 0x434c0f4f, | ||
| 114 | 0xb3b43787, 0x52581a4a, 0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f, 0xd1d415c5, | ||
| 115 | 0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141, 0x52501242, 0x717c3d4d, 0x818c0d8d, 0x00080808, | ||
| 116 | 0x131c1f0f, 0x91981989, 0x00000000, 0x11181909, 0x00040404, 0x53501343, 0xf3f437c7, 0xe1e021c1, | ||
| 117 | 0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707, 0xb0b03080, 0x83880b8b, 0x020c0e0e, 0xa3a82b8b, | ||
| 118 | 0xa2a02282, 0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c, 0x01080909, 0x02080a0a, | ||
| 119 | 0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3, 0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444, | ||
| 120 | 0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x02040606, 0x21202101, 0x63682b4b, 0x62642646, | ||
| 121 | 0x02000202, 0xf1f435c5, 0x92901282, 0x82880a8a, 0x000c0c0c, 0xb3b03383, 0x727c3e4e, 0xd0d010c0, | ||
| 122 | 0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5, 0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf, | ||
| 123 | 0xa1a02181, 0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505, 0x22202202, 0x30383808, | ||
| 124 | 0xf0f434c4, 0xa3a42787, 0x41440545, 0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787, | ||
| 125 | 0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141, 0x11101101, 0xc3c407c7, 0x81880989, | ||
| 126 | 0x71743545, 0xf3f83bcb, 0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282, 0xc0c404c4, | ||
| 127 | 0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747, 0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888, | ||
| 128 | 0x030c0f0f, 0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c, 0xd3d81bcb, 0xa0a42484, | ||
| 129 | 0x30343404, 0xf1f031c1, 0x40480848, 0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040, | ||
| 130 | 0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a, 0xb2b83a8a, 0x424c0e4e, 0x51541545, | ||
| 131 | 0x33383b0b, 0xd0dc1ccc, 0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a, 0x52541646, | ||
| 132 | 0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646, 0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca, | ||
| 133 | 0xe3e023c3, 0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9, 0xe2e426c6, 0xb2b03282, | ||
| 134 | 0x31303101, 0xe2e82aca, 0x616c2d4d, 0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888, | ||
| 135 | 0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242, 0x21282909, 0x03040707, 0x33303303, | ||
| 136 | 0xe0e828c8, 0x13181b0b, 0x01040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a, 0x92981a8a | ||
| 137 | }, { | ||
| 138 | 0x08303838, 0xc8e0e828, 0x0d212c2d, 0x86a2a426, 0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838, | ||
| 139 | 0x8fa3ac2f, 0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f, 0x4b63682b, 0x4b53581b, | ||
| 140 | 0xc3c3c003, 0x42626022, 0x03333033, 0x85b1b435, 0x09212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427, | ||
| 141 | 0xc3d3d013, 0x81919011, 0x01111011, 0x06020406, 0x0c101c1c, 0x8cb0bc3c, 0x06323436, 0x4b43480b, | ||
| 142 | 0xcfe3ec2f, 0x88808808, 0x4c606c2c, 0x88a0a828, 0x07131417, 0xc4c0c404, 0x06121416, 0xc4f0f434, | ||
| 143 | 0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416, 0x0f333c3f, 0x0d313c3d, 0x8e828c0e, 0x88909818, | ||
| 144 | 0x08202828, 0x4e424c0e, 0xc6f2f436, 0x0e323c3e, 0x85a1a425, 0xc9f1f839, 0x0d010c0d, 0xcfd3dc1f, | ||
| 145 | 0xc8d0d818, 0x0b23282b, 0x46626426, 0x4a72783a, 0x07232427, 0x0f232c2f, 0xc1f1f031, 0x42727032, | ||
| 146 | 0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033, 0x47636427, 0x8ca0ac2c, 0x8b83880b, | ||
| 147 | 0xc7f3f437, 0x8da1ac2d, 0x80808000, 0x0f131c1f, 0xcac2c80a, 0x0c202c2c, 0x8aa2a82a, 0x04303434, | ||
| 148 | 0xc2d2d012, 0x0b03080b, 0xcee2ec2e, 0xc9e1e829, 0x4d515c1d, 0x84909414, 0x08101818, 0xc8f0f838, | ||
| 149 | 0x47535417, 0x8ea2ac2e, 0x08000808, 0xc5c1c405, 0x03131013, 0xcdc1cc0d, 0x86828406, 0x89b1b839, | ||
| 150 | 0xcff3fc3f, 0x4d717c3d, 0xc1c1c001, 0x01313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031, | ||
| 151 | 0xc1d1d011, 0x00202020, 0xc7d3d417, 0x02020002, 0x02222022, 0x04000404, 0x48606828, 0x41717031, | ||
| 152 | 0x07030407, 0xcbd3d81b, 0x8d919c1d, 0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819, | ||
| 153 | 0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a, 0x83a3a023, 0x8ba3a82b, 0xc0d0d010, | ||
| 154 | 0x81818001, 0x0f030c0f, 0x47434407, 0x0a12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d, 0x8fb3bc3f, | ||
| 155 | 0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022, 0x81a1a021, 0x43636023, 0x03232023, 0x4d414c0d, | ||
| 156 | 0xc8c0c808, 0x8e929c1e, 0x8c909c1c, 0x0a32383a, 0x0c000c0c, 0x0e222c2e, 0x8ab2b83a, 0x4e626c2e, | ||
| 157 | 0x8f939c1f, 0x4a52581a, 0xc2f2f032, 0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c, | ||
| 158 | 0x05111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f, 0x05313435, 0x00101010, 0x03030003, | ||
| 159 | 0x44606424, 0x4d616c2d, 0xc6c2c406, 0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x09010809, | ||
| 160 | 0x46727436, 0x09111819, 0xcef2fc3e, 0x40404000, 0x02121012, 0xc0e0e020, 0x8db1bc3d, 0x05010405, | ||
| 161 | 0xcaf2f83a, 0x01010001, 0xc0f0f030, 0x0a22282a, 0x4e525c1e, 0x89a1a829, 0x46525416, 0x43434003, | ||
| 162 | 0x85818405, 0x04101414, 0x89818809, 0x8b93981b, 0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839, | ||
| 163 | 0x87939417, 0xccf0fc3c, 0x0e121c1e, 0x82828002, 0x01212021, 0x8c808c0c, 0x0b13181b, 0x4f535c1f, | ||
| 164 | 0x47737437, 0x44505414, 0x82b2b032, 0x0d111c1d, 0x05212425, 0x4f434c0f, 0x00000000, 0x46424406, | ||
| 165 | 0xcde1ec2d, 0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a, 0xc9c1c809, 0xcdf1fc3d, | ||
| 166 | 0x00303030, 0x85919415, 0x45616425, 0x0c303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c, | ||
| 167 | 0x0e020c0e, 0x40505010, 0x09313839, 0x06222426, 0x02323032, 0x84808404, 0x49616829, 0x83939013, | ||
| 168 | 0x07333437, 0xc7e3e427, 0x04202424, 0x84a0a424, 0xcbc3c80b, 0x43535013, 0x0a02080a, 0x87838407, | ||
| 169 | 0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e, 0x0b33383b, 0x4a42480a, 0x87b3b437 | ||
| 170 | } }; | ||
| 171 | |||
| 172 | /* key schedule constants - golden ratio */ | ||
| 173 | #define KC0 0x9e3779b9 | ||
| 174 | #define KC1 0x3c6ef373 | ||
| 175 | #define KC2 0x78dde6e6 | ||
| 176 | #define KC3 0xf1bbcdcc | ||
| 177 | #define KC4 0xe3779b99 | ||
| 178 | #define KC5 0xc6ef3733 | ||
| 179 | #define KC6 0x8dde6e67 | ||
| 180 | #define KC7 0x1bbcdccf | ||
| 181 | #define KC8 0x3779b99e | ||
| 182 | #define KC9 0x6ef3733c | ||
| 183 | #define KC10 0xdde6e678 | ||
| 184 | #define KC11 0xbbcdccf1 | ||
| 185 | #define KC12 0x779b99e3 | ||
| 186 | #define KC13 0xef3733c6 | ||
| 187 | #define KC14 0xde6e678d | ||
| 188 | #define KC15 0xbcdccf1b | ||
| 189 | |||
| 190 | #if defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 191 | static const seed_word KC[] = { | ||
| 192 | KC0, KC1, KC2, KC3, KC4, KC5, KC6, KC7, | ||
| 193 | KC8, KC9, KC10, KC11, KC12, KC13, KC14, KC15 }; | ||
| 194 | #endif | ||
| 195 | |||
| 196 | void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks) | ||
| 197 | { | ||
| 198 | seed_word x1, x2, x3, x4; | ||
| 199 | seed_word t0, t1; | ||
| 200 | |||
| 201 | char2word(rawkey , x1); | ||
| 202 | char2word(rawkey+4 , x2); | ||
| 203 | char2word(rawkey+8 , x3); | ||
| 204 | char2word(rawkey+12, x4); | ||
| 205 | |||
| 206 | t0 = (x1 + x3 - KC0) & 0xffffffff; | ||
| 207 | t1 = (x2 - x4 + KC0) & 0xffffffff; KEYUPDATE_TEMP(t0, t1, &ks->data[0]); | ||
| 208 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC1); KEYUPDATE_TEMP(t0, t1, &ks->data[2]); | ||
| 209 | |||
| 210 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 211 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC2); KEYUPDATE_TEMP(t0, t1, &ks->data[4]); | ||
| 212 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC3); KEYUPDATE_TEMP(t0, t1, &ks->data[6]); | ||
| 213 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC4); KEYUPDATE_TEMP(t0, t1, &ks->data[8]); | ||
| 214 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC5); KEYUPDATE_TEMP(t0, t1, &ks->data[10]); | ||
| 215 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC6); KEYUPDATE_TEMP(t0, t1, &ks->data[12]); | ||
| 216 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC7); KEYUPDATE_TEMP(t0, t1, &ks->data[14]); | ||
| 217 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC8); KEYUPDATE_TEMP(t0, t1, &ks->data[16]); | ||
| 218 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC9); KEYUPDATE_TEMP(t0, t1, &ks->data[18]); | ||
| 219 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC10); KEYUPDATE_TEMP(t0, t1, &ks->data[20]); | ||
| 220 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC11); KEYUPDATE_TEMP(t0, t1, &ks->data[22]); | ||
| 221 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC12); KEYUPDATE_TEMP(t0, t1, &ks->data[24]); | ||
| 222 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC13); KEYUPDATE_TEMP(t0, t1, &ks->data[26]); | ||
| 223 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC14); KEYUPDATE_TEMP(t0, t1, &ks->data[28]); | ||
| 224 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC15); KEYUPDATE_TEMP(t0, t1, &ks->data[30]); | ||
| 225 | #else | ||
| 226 | { | ||
| 227 | int i; | ||
| 228 | for (i=2; i<16; i+=2) { | ||
| 229 | KEYSCHEDULE_UPDATE0(t0, t1, x1, x2, x3, x4, KC[i]); | ||
| 230 | KEYUPDATE_TEMP(t0, t1, &ks->data[i*2]); | ||
| 231 | KEYSCHEDULE_UPDATE1(t0, t1, x1, x2, x3, x4, KC[i+1]); | ||
| 232 | KEYUPDATE_TEMP(t0, t1, &ks->data[i*2+2]); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | #endif | ||
| 236 | } | ||
| 237 | |||
| 238 | void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks) | ||
| 239 | { | ||
| 240 | seed_word x1, x2, x3, x4; | ||
| 241 | seed_word t0, t1; | ||
| 242 | |||
| 243 | char2word(s, x1); | ||
| 244 | char2word(s+4, x2); | ||
| 245 | char2word(s+8, x3); | ||
| 246 | char2word(s+12, x4); | ||
| 247 | |||
| 248 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 249 | E_SEED(t0, t1, x1, x2, x3, x4, 0); | ||
| 250 | E_SEED(t0, t1, x3, x4, x1, x2, 2); | ||
| 251 | E_SEED(t0, t1, x1, x2, x3, x4, 4); | ||
| 252 | E_SEED(t0, t1, x3, x4, x1, x2, 6); | ||
| 253 | E_SEED(t0, t1, x1, x2, x3, x4, 8); | ||
| 254 | E_SEED(t0, t1, x3, x4, x1, x2, 10); | ||
| 255 | E_SEED(t0, t1, x1, x2, x3, x4, 12); | ||
| 256 | E_SEED(t0, t1, x3, x4, x1, x2, 14); | ||
| 257 | E_SEED(t0, t1, x1, x2, x3, x4, 16); | ||
| 258 | E_SEED(t0, t1, x3, x4, x1, x2, 18); | ||
| 259 | E_SEED(t0, t1, x1, x2, x3, x4, 20); | ||
| 260 | E_SEED(t0, t1, x3, x4, x1, x2, 22); | ||
| 261 | E_SEED(t0, t1, x1, x2, x3, x4, 24); | ||
| 262 | E_SEED(t0, t1, x3, x4, x1, x2, 26); | ||
| 263 | E_SEED(t0, t1, x1, x2, x3, x4, 28); | ||
| 264 | E_SEED(t0, t1, x3, x4, x1, x2, 30); | ||
| 265 | #else | ||
| 266 | { | ||
| 267 | int i; | ||
| 268 | for (i=0;i<30;i+=4) { | ||
| 269 | E_SEED(t0,t1,x1,x2,x3,x4,i); | ||
| 270 | E_SEED(t0,t1,x3,x4,x1,x2,i+2); | ||
| 271 | } | ||
| 272 | } | ||
| 273 | #endif | ||
| 274 | |||
| 275 | word2char(x3, d); | ||
| 276 | word2char(x4, d+4); | ||
| 277 | word2char(x1, d+8); | ||
| 278 | word2char(x2, d+12); | ||
| 279 | } | ||
| 280 | |||
| 281 | void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks) | ||
| 282 | { | ||
| 283 | seed_word x1, x2, x3, x4; | ||
| 284 | seed_word t0, t1; | ||
| 285 | |||
| 286 | char2word(s, x1); | ||
| 287 | char2word(s+4, x2); | ||
| 288 | char2word(s+8, x3); | ||
| 289 | char2word(s+12, x4); | ||
| 290 | |||
| 291 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | ||
| 292 | E_SEED(t0, t1, x1, x2, x3, x4, 30); | ||
| 293 | E_SEED(t0, t1, x3, x4, x1, x2, 28); | ||
| 294 | E_SEED(t0, t1, x1, x2, x3, x4, 26); | ||
| 295 | E_SEED(t0, t1, x3, x4, x1, x2, 24); | ||
| 296 | E_SEED(t0, t1, x1, x2, x3, x4, 22); | ||
| 297 | E_SEED(t0, t1, x3, x4, x1, x2, 20); | ||
| 298 | E_SEED(t0, t1, x1, x2, x3, x4, 18); | ||
| 299 | E_SEED(t0, t1, x3, x4, x1, x2, 16); | ||
| 300 | E_SEED(t0, t1, x1, x2, x3, x4, 14); | ||
| 301 | E_SEED(t0, t1, x3, x4, x1, x2, 12); | ||
| 302 | E_SEED(t0, t1, x1, x2, x3, x4, 10); | ||
| 303 | E_SEED(t0, t1, x3, x4, x1, x2, 8); | ||
| 304 | E_SEED(t0, t1, x1, x2, x3, x4, 6); | ||
| 305 | E_SEED(t0, t1, x3, x4, x1, x2, 4); | ||
| 306 | E_SEED(t0, t1, x1, x2, x3, x4, 2); | ||
| 307 | E_SEED(t0, t1, x3, x4, x1, x2, 0); | ||
| 308 | #else | ||
| 309 | { | ||
| 310 | int i; | ||
| 311 | for (i=30; i>0; i-=4) { | ||
| 312 | E_SEED(t0, t1, x1, x2, x3, x4, i); | ||
| 313 | E_SEED(t0, t1, x3, x4, x1, x2, i-2); | ||
| 314 | |||
| 315 | } | ||
| 316 | } | ||
| 317 | #endif | ||
| 318 | |||
| 319 | word2char(x3, d); | ||
| 320 | word2char(x4, d+4); | ||
| 321 | word2char(x1, d+8); | ||
| 322 | word2char(x2, d+12); | ||
| 323 | } | ||
| 324 | |||
| 325 | #endif /* OPENSSL_NO_SEED */ | ||
diff --git a/src/lib/libcrypto/seed/seed.h b/src/lib/libcrypto/seed/seed.h new file mode 100644 index 0000000000..6ffa5f024e --- /dev/null +++ b/src/lib/libcrypto/seed/seed.h | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. | ||
| 3 | * | ||
| 4 | * Redistribution and use in source and binary forms, with or without | ||
| 5 | * modification, are permitted provided that the following conditions | ||
| 6 | * are met: | ||
| 7 | * 1. Redistributions of source code must retain the above copyright | ||
| 8 | * notice, this list of conditions and the following disclaimer. | ||
| 9 | * 2. Neither the name of author nor the names of its contributors may | ||
| 10 | * be used to endorse or promote products derived from this software | ||
| 11 | * without specific prior written permission. | ||
| 12 | * | ||
| 13 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
| 14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 16 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 23 | * SUCH DAMAGE. | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | /* ==================================================================== | ||
| 27 | * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | ||
| 28 | * | ||
| 29 | * Redistribution and use in source and binary forms, with or without | ||
| 30 | * modification, are permitted provided that the following conditions | ||
| 31 | * are met: | ||
| 32 | * | ||
| 33 | * 1. Redistributions of source code must retain the above copyright | ||
| 34 | * notice, this list of conditions and the following disclaimer. | ||
| 35 | * | ||
| 36 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 37 | * notice, this list of conditions and the following disclaimer in | ||
| 38 | * the documentation and/or other materials provided with the | ||
| 39 | * distribution. | ||
| 40 | * | ||
| 41 | * 3. All advertising materials mentioning features or use of this | ||
| 42 | * software must display the following acknowledgment: | ||
| 43 | * "This product includes software developed by the OpenSSL Project | ||
| 44 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 45 | * | ||
| 46 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 47 | * endorse or promote products derived from this software without | ||
| 48 | * prior written permission. For written permission, please contact | ||
| 49 | * openssl-core@openssl.org. | ||
| 50 | * | ||
| 51 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 52 | * nor may "OpenSSL" appear in their names without prior written | ||
| 53 | * permission of the OpenSSL Project. | ||
| 54 | * | ||
| 55 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 56 | * acknowledgment: | ||
| 57 | * "This product includes software developed by the OpenSSL Project | ||
| 58 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 59 | * | ||
| 60 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 61 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 62 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 63 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 64 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 65 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 66 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 67 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 68 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 69 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 70 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 71 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 72 | * ==================================================================== | ||
| 73 | * | ||
| 74 | * This product includes cryptographic software written by Eric Young | ||
| 75 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 76 | * Hudson (tjh@cryptsoft.com). | ||
| 77 | * | ||
| 78 | */ | ||
| 79 | |||
| 80 | |||
| 81 | #ifndef HEADER_SEED_H | ||
| 82 | #define HEADER_SEED_H | ||
| 83 | |||
| 84 | #include <openssl/opensslconf.h> | ||
| 85 | #include <openssl/e_os2.h> | ||
| 86 | #include <openssl/crypto.h> | ||
| 87 | |||
| 88 | #ifdef OPENSSL_NO_SEED | ||
| 89 | #error SEED is disabled. | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #ifdef AES_LONG /* look whether we need 'long' to get 32 bits */ | ||
| 93 | # ifndef SEED_LONG | ||
| 94 | # define SEED_LONG 1 | ||
| 95 | # endif | ||
| 96 | #endif | ||
| 97 | |||
| 98 | #if !defined(NO_SYS_TYPES_H) | ||
| 99 | # include <sys/types.h> | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #define SEED_BLOCK_SIZE 16 | ||
| 103 | #define SEED_KEY_LENGTH 16 | ||
| 104 | |||
| 105 | |||
| 106 | #ifdef __cplusplus | ||
| 107 | extern "C" { | ||
| 108 | #endif | ||
| 109 | |||
| 110 | |||
| 111 | typedef struct seed_key_st { | ||
| 112 | #ifdef SEED_LONG | ||
| 113 | unsigned long data[32]; | ||
| 114 | #else | ||
| 115 | unsigned int data[32]; | ||
| 116 | #endif | ||
| 117 | } SEED_KEY_SCHEDULE; | ||
| 118 | |||
| 119 | |||
| 120 | void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], SEED_KEY_SCHEDULE *ks); | ||
| 121 | |||
| 122 | void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks); | ||
| 123 | void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], unsigned char d[SEED_BLOCK_SIZE], const SEED_KEY_SCHEDULE *ks); | ||
| 124 | |||
| 125 | void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc); | ||
| 126 | void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 127 | size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int enc); | ||
| 128 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 129 | size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc); | ||
| 130 | void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 131 | size_t len, const SEED_KEY_SCHEDULE *ks, unsigned char ivec[SEED_BLOCK_SIZE], int *num); | ||
| 132 | |||
| 133 | #ifdef __cplusplus | ||
| 134 | } | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #endif /* HEADER_SEED_H */ | ||
diff --git a/src/lib/libcrypto/seed/seed_cbc.c b/src/lib/libcrypto/seed/seed_cbc.c new file mode 100644 index 0000000000..6c3f9b527a --- /dev/null +++ b/src/lib/libcrypto/seed/seed_cbc.c | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /* crypto/seed/seed_cbc.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #include <openssl/seed.h> | ||
| 53 | #include <openssl/modes.h> | ||
| 54 | |||
| 55 | void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
| 56 | size_t len, const SEED_KEY_SCHEDULE *ks, | ||
| 57 | unsigned char ivec[SEED_BLOCK_SIZE], int enc) | ||
| 58 | { | ||
| 59 | if (enc) | ||
| 60 | CRYPTO_cbc128_encrypt(in,out,len,ks,ivec,(block128_f)SEED_encrypt); | ||
| 61 | else | ||
| 62 | CRYPTO_cbc128_decrypt(in,out,len,ks,ivec,(block128_f)SEED_decrypt); | ||
| 63 | } | ||
diff --git a/src/lib/libcrypto/seed/seed_cfb.c b/src/lib/libcrypto/seed/seed_cfb.c new file mode 100644 index 0000000000..694597dd06 --- /dev/null +++ b/src/lib/libcrypto/seed/seed_cfb.c | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | /* crypto/seed/seed_cfb.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 52 | * All rights reserved. | ||
| 53 | * | ||
| 54 | * This package is an SSL implementation written | ||
| 55 | * by Eric Young (eay@cryptsoft.com). | ||
| 56 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 57 | * | ||
| 58 | * This library is free for commercial and non-commercial use as long as | ||
| 59 | * the following conditions are aheared to. The following conditions | ||
| 60 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 61 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 62 | * included with this distribution is covered by the same copyright terms | ||
| 63 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 64 | * | ||
| 65 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 66 | * the code are not to be removed. | ||
| 67 | * If this package is used in a product, Eric Young should be given attribution | ||
| 68 | * as the author of the parts of the library used. | ||
| 69 | * This can be in the form of a textual message at program startup or | ||
| 70 | * in documentation (online or textual) provided with the package. | ||
| 71 | * | ||
| 72 | * Redistribution and use in source and binary forms, with or without | ||
| 73 | * modification, are permitted provided that the following conditions | ||
| 74 | * are met: | ||
| 75 | * 1. Redistributions of source code must retain the copyright | ||
| 76 | * notice, this list of conditions and the following disclaimer. | ||
| 77 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 78 | * notice, this list of conditions and the following disclaimer in the | ||
| 79 | * documentation and/or other materials provided with the distribution. | ||
| 80 | * 3. All advertising materials mentioning features or use of this software | ||
| 81 | * must display the following acknowledgement: | ||
| 82 | * "This product includes cryptographic software written by | ||
| 83 | * Eric Young (eay@cryptsoft.com)" | ||
| 84 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 85 | * being used are not cryptographic related :-). | ||
| 86 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 87 | * the apps directory (application code) you must include an acknowledgement: | ||
| 88 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 89 | * | ||
| 90 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 91 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 92 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 93 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 94 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 95 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 96 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 97 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 98 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 99 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 100 | * SUCH DAMAGE. | ||
| 101 | * | ||
| 102 | * The licence and distribution terms for any publically available version or | ||
| 103 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 104 | * copied and put under another distribution licence | ||
| 105 | * [including the GNU Public Licence.] | ||
| 106 | */ | ||
| 107 | |||
| 108 | #include <openssl/seed.h> | ||
| 109 | #include <openssl/modes.h> | ||
| 110 | |||
| 111 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 112 | size_t len, const SEED_KEY_SCHEDULE *ks, | ||
| 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num, int enc) | ||
| 114 | { | ||
| 115 | CRYPTO_cfb128_encrypt(in,out,len,ks,ivec,num,enc,(block128_f)SEED_encrypt); | ||
| 116 | } | ||
diff --git a/src/lib/libcrypto/seed/seed_ecb.c b/src/lib/libcrypto/seed/seed_ecb.c new file mode 100644 index 0000000000..e63f5ae14e --- /dev/null +++ b/src/lib/libcrypto/seed/seed_ecb.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* crypto/seed/seed_ecb.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | |||
| 52 | #include <openssl/seed.h> | ||
| 53 | |||
| 54 | void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, const SEED_KEY_SCHEDULE *ks, int enc) | ||
| 55 | { | ||
| 56 | if (enc) | ||
| 57 | SEED_encrypt(in, out, ks); | ||
| 58 | else | ||
| 59 | SEED_decrypt(in, out, ks); | ||
| 60 | } | ||
diff --git a/src/lib/libcrypto/seed/seed_locl.h b/src/lib/libcrypto/seed/seed_locl.h new file mode 100644 index 0000000000..fd456b6422 --- /dev/null +++ b/src/lib/libcrypto/seed/seed_locl.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. | ||
| 3 | * | ||
| 4 | * Redistribution and use in source and binary forms, with or without | ||
| 5 | * modification, are permitted provided that the following conditions | ||
| 6 | * are met: | ||
| 7 | * 1. Redistributions of source code must retain the above copyright | ||
| 8 | * notice, this list of conditions and the following disclaimer. | ||
| 9 | * 2. Neither the name of author nor the names of its contributors may | ||
| 10 | * be used to endorse or promote products derived from this software | ||
| 11 | * without specific prior written permission. | ||
| 12 | * | ||
| 13 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
| 14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 16 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 23 | * SUCH DAMAGE. | ||
| 24 | * | ||
| 25 | */ | ||
| 26 | #ifndef HEADER_SEED_LOCL_H | ||
| 27 | #define HEADER_SEED_LOCL_H | ||
| 28 | |||
| 29 | #include "openssl/e_os2.h" | ||
| 30 | #include <openssl/seed.h> | ||
| 31 | |||
| 32 | |||
| 33 | #ifdef SEED_LONG /* need 32-bit type */ | ||
| 34 | typedef unsigned long seed_word; | ||
| 35 | #else | ||
| 36 | typedef unsigned int seed_word; | ||
| 37 | #endif | ||
| 38 | |||
| 39 | |||
| 40 | #ifdef __cplusplus | ||
| 41 | extern "C" { | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #define G_FUNC(v) \ | ||
| 45 | SS[0][(unsigned char) (v) & 0xff] ^ SS[1][(unsigned char) ((v)>>8) & 0xff] ^ \ | ||
| 46 | SS[2][(unsigned char)((v)>>16) & 0xff] ^ SS[3][(unsigned char)((v)>>24) & 0xff] | ||
| 47 | |||
| 48 | #define char2word(c, i) \ | ||
| 49 | (i) = ((((seed_word)(c)[0]) << 24) | (((seed_word)(c)[1]) << 16) | (((seed_word)(c)[2]) << 8) | ((seed_word)(c)[3])) | ||
| 50 | |||
| 51 | #define word2char(l, c) \ | ||
| 52 | *((c)+0) = (unsigned char)((l)>>24) & 0xff; \ | ||
| 53 | *((c)+1) = (unsigned char)((l)>>16) & 0xff; \ | ||
| 54 | *((c)+2) = (unsigned char)((l)>> 8) & 0xff; \ | ||
| 55 | *((c)+3) = (unsigned char)((l)) & 0xff | ||
| 56 | |||
| 57 | #define KEYSCHEDULE_UPDATE0(T0, T1, X1, X2, X3, X4, KC) \ | ||
| 58 | (T0) = (X3); \ | ||
| 59 | (X3) = (((X3)<<8) ^ ((X4)>>24)) & 0xffffffff; \ | ||
| 60 | (X4) = (((X4)<<8) ^ ((T0)>>24)) & 0xffffffff; \ | ||
| 61 | (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \ | ||
| 62 | (T1) = ((X2) + (KC) - (X4)) & 0xffffffff | ||
| 63 | |||
| 64 | #define KEYSCHEDULE_UPDATE1(T0, T1, X1, X2, X3, X4, KC) \ | ||
| 65 | (T0) = (X1); \ | ||
| 66 | (X1) = (((X1)>>8) ^ ((X2)<<24)) & 0xffffffff; \ | ||
| 67 | (X2) = (((X2)>>8) ^ ((T0)<<24)) & 0xffffffff; \ | ||
| 68 | (T0) = ((X1) + (X3) - (KC)) & 0xffffffff; \ | ||
| 69 | (T1) = ((X2) + (KC) - (X4)) & 0xffffffff | ||
| 70 | |||
| 71 | #define KEYUPDATE_TEMP(T0, T1, K) \ | ||
| 72 | (K)[0] = G_FUNC((T0)); \ | ||
| 73 | (K)[1] = G_FUNC((T1)) | ||
| 74 | |||
| 75 | #define XOR_SEEDBLOCK(DST, SRC) \ | ||
| 76 | ((DST))[0] ^= ((SRC))[0]; \ | ||
| 77 | ((DST))[1] ^= ((SRC))[1]; \ | ||
| 78 | ((DST))[2] ^= ((SRC))[2]; \ | ||
| 79 | ((DST))[3] ^= ((SRC))[3] | ||
| 80 | |||
| 81 | #define MOV_SEEDBLOCK(DST, SRC) \ | ||
| 82 | ((DST))[0] = ((SRC))[0]; \ | ||
| 83 | ((DST))[1] = ((SRC))[1]; \ | ||
| 84 | ((DST))[2] = ((SRC))[2]; \ | ||
| 85 | ((DST))[3] = ((SRC))[3] | ||
| 86 | |||
| 87 | # define CHAR2WORD(C, I) \ | ||
| 88 | char2word((C), (I)[0]); \ | ||
| 89 | char2word((C+4), (I)[1]); \ | ||
| 90 | char2word((C+8), (I)[2]); \ | ||
| 91 | char2word((C+12), (I)[3]) | ||
| 92 | |||
| 93 | # define WORD2CHAR(I, C) \ | ||
| 94 | word2char((I)[0], (C)); \ | ||
| 95 | word2char((I)[1], (C+4)); \ | ||
| 96 | word2char((I)[2], (C+8)); \ | ||
| 97 | word2char((I)[3], (C+12)) | ||
| 98 | |||
| 99 | # define E_SEED(T0, T1, X1, X2, X3, X4, rbase) \ | ||
| 100 | (T0) = (X3) ^ (ks->data)[(rbase)]; \ | ||
| 101 | (T1) = (X4) ^ (ks->data)[(rbase)+1]; \ | ||
| 102 | (T1) ^= (T0); \ | ||
| 103 | (T1) = G_FUNC((T1)); \ | ||
| 104 | (T0) = ((T0) + (T1)) & 0xffffffff; \ | ||
| 105 | (T0) = G_FUNC((T0)); \ | ||
| 106 | (T1) = ((T1) + (T0)) & 0xffffffff; \ | ||
| 107 | (T1) = G_FUNC((T1)); \ | ||
| 108 | (T0) = ((T0) + (T1)) & 0xffffffff; \ | ||
| 109 | (X1) ^= (T0); \ | ||
| 110 | (X2) ^= (T1) | ||
| 111 | |||
| 112 | #ifdef __cplusplus | ||
| 113 | } | ||
| 114 | #endif | ||
| 115 | |||
| 116 | #endif /* HEADER_SEED_LOCL_H */ | ||
diff --git a/src/lib/libcrypto/seed/seed_ofb.c b/src/lib/libcrypto/seed/seed_ofb.c new file mode 100644 index 0000000000..3c8ba33bb9 --- /dev/null +++ b/src/lib/libcrypto/seed/seed_ofb.c | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | /* crypto/seed/seed_ofb.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@openssl.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | */ | ||
| 51 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 52 | * All rights reserved. | ||
| 53 | * | ||
| 54 | * This package is an SSL implementation written | ||
| 55 | * by Eric Young (eay@cryptsoft.com). | ||
| 56 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 57 | * | ||
| 58 | * This library is free for commercial and non-commercial use as long as | ||
| 59 | * the following conditions are aheared to. The following conditions | ||
| 60 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 61 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 62 | * included with this distribution is covered by the same copyright terms | ||
| 63 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 64 | * | ||
| 65 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 66 | * the code are not to be removed. | ||
| 67 | * If this package is used in a product, Eric Young should be given attribution | ||
| 68 | * as the author of the parts of the library used. | ||
| 69 | * This can be in the form of a textual message at program startup or | ||
| 70 | * in documentation (online or textual) provided with the package. | ||
| 71 | * | ||
| 72 | * Redistribution and use in source and binary forms, with or without | ||
| 73 | * modification, are permitted provided that the following conditions | ||
| 74 | * are met: | ||
| 75 | * 1. Redistributions of source code must retain the copyright | ||
| 76 | * notice, this list of conditions and the following disclaimer. | ||
| 77 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 78 | * notice, this list of conditions and the following disclaimer in the | ||
| 79 | * documentation and/or other materials provided with the distribution. | ||
| 80 | * 3. All advertising materials mentioning features or use of this software | ||
| 81 | * must display the following acknowledgement: | ||
| 82 | * "This product includes cryptographic software written by | ||
| 83 | * Eric Young (eay@cryptsoft.com)" | ||
| 84 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 85 | * being used are not cryptographic related :-). | ||
| 86 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 87 | * the apps directory (application code) you must include an acknowledgement: | ||
| 88 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 89 | * | ||
| 90 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 91 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 92 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 93 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 94 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 95 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 96 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 97 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 98 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 99 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 100 | * SUCH DAMAGE. | ||
| 101 | * | ||
| 102 | * The licence and distribution terms for any publically available version or | ||
| 103 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 104 | * copied and put under another distribution licence | ||
| 105 | * [including the GNU Public Licence.] | ||
| 106 | */ | ||
| 107 | |||
| 108 | #include <openssl/seed.h> | ||
| 109 | #include <openssl/modes.h> | ||
| 110 | |||
| 111 | void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, | ||
| 112 | size_t len, const SEED_KEY_SCHEDULE *ks, | ||
| 113 | unsigned char ivec[SEED_BLOCK_SIZE], int *num) | ||
| 114 | { | ||
| 115 | CRYPTO_ofb128_encrypt(in,out,len,ks,ivec,num,(block128_f)SEED_encrypt); | ||
| 116 | } | ||
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile new file mode 100644 index 0000000000..e6eccb05f9 --- /dev/null +++ b/src/lib/libcrypto/sha/Makefile | |||
| @@ -0,0 +1,145 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/sha/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= sha | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | SHA1_ASM_OBJ= | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=shatest.c sha1test.c sha256t.c sha512t.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha256.c sha512.c | ||
| 26 | LIBOBJ=sha_dgst.o sha1dgst.o sha_one.o sha1_one.o sha256.o sha512.o $(SHA1_ASM_OBJ) | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= sha.h | ||
| 31 | HEADER= sha_locl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | sha1-586.s: asm/sha1-586.pl ../perlasm/x86asm.pl | ||
| 46 | $(PERL) asm/sha1-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 47 | sha256-586.s: asm/sha256-586.pl ../perlasm/x86asm.pl | ||
| 48 | $(PERL) asm/sha256-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 49 | sha512-586.s: asm/sha512-586.pl ../perlasm/x86asm.pl | ||
| 50 | $(PERL) asm/sha512-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 51 | |||
| 52 | sha1-ia64.s: asm/sha1-ia64.pl | ||
| 53 | (cd asm; $(PERL) sha1-ia64.pl ../$@ $(CFLAGS)) | ||
| 54 | sha256-ia64.s: asm/sha512-ia64.pl | ||
| 55 | (cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS)) | ||
| 56 | sha512-ia64.s: asm/sha512-ia64.pl | ||
| 57 | (cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS)) | ||
| 58 | |||
| 59 | sha256-armv4.s: asm/sha256-armv4.pl | ||
| 60 | $(PERL) $< $@ | ||
| 61 | |||
| 62 | # Solaris make has to be explicitly told | ||
| 63 | sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 64 | sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@ | ||
| 65 | sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@ | ||
| 66 | sha1-sparcv9.s: asm/sha1-sparcv9.pl; $(PERL) asm/sha1-sparcv9.pl $@ $(CFLAGS) | ||
| 67 | sha256-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS) | ||
| 68 | sha512-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS) | ||
| 69 | |||
| 70 | sha1-ppc.s: asm/sha1-ppc.pl; $(PERL) asm/sha1-ppc.pl $(PERLASM_SCHEME) $@ | ||
| 71 | sha256-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@ | ||
| 72 | sha512-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@ | ||
| 73 | |||
| 74 | # GNU make "catch all" | ||
| 75 | sha1-%.s: asm/sha1-%.pl; $(PERL) $< $@ | ||
| 76 | sha256-%.s: asm/sha512-%.pl; $(PERL) $< $@ | ||
| 77 | sha512-%.s: asm/sha512-%.pl; $(PERL) $< $@ | ||
| 78 | |||
| 79 | files: | ||
| 80 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 81 | |||
| 82 | links: | ||
| 83 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 84 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 85 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 86 | |||
| 87 | install: | ||
| 88 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 89 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 90 | do \ | ||
| 91 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 92 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 93 | done; | ||
| 94 | |||
| 95 | tags: | ||
| 96 | ctags $(SRC) | ||
| 97 | |||
| 98 | tests: | ||
| 99 | |||
| 100 | lint: | ||
| 101 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 102 | |||
| 103 | depend: | ||
| 104 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 105 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 106 | |||
| 107 | dclean: | ||
| 108 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 109 | mv -f Makefile.new $(MAKEFILE) | ||
| 110 | |||
| 111 | clean: | ||
| 112 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 113 | |||
| 114 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 115 | |||
| 116 | sha1_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 117 | sha1_one.o: ../../include/openssl/opensslconf.h | ||
| 118 | sha1_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 119 | sha1_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 120 | sha1_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 121 | sha1_one.o: sha1_one.c | ||
| 122 | sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 123 | sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h | ||
| 124 | sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h | ||
| 125 | sha256.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 126 | sha256.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 127 | sha256.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 128 | sha256.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 129 | sha256.o: ../../include/openssl/symhacks.h ../md32_common.h sha256.c | ||
| 130 | sha512.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 131 | sha512.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 132 | sha512.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 133 | sha512.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 134 | sha512.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 135 | sha512.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 136 | sha512.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 137 | sha512.o: ../cryptlib.h sha512.c | ||
| 138 | sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 139 | sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h | ||
| 140 | sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h | ||
| 141 | sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 142 | sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 143 | sha_one.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 144 | sha_one.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 145 | sha_one.o: ../../include/openssl/symhacks.h sha_one.c | ||
diff --git a/src/lib/libcrypto/sha/asm/README b/src/lib/libcrypto/sha/asm/README new file mode 100644 index 0000000000..b7e755765f --- /dev/null +++ b/src/lib/libcrypto/sha/asm/README | |||
| @@ -0,0 +1 @@ | |||
| C2.pl works | |||
diff --git a/src/lib/libcrypto/sha/sha.c b/src/lib/libcrypto/sha/sha.c new file mode 100644 index 0000000000..42126551d1 --- /dev/null +++ b/src/lib/libcrypto/sha/sha.c | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | /* crypto/sha/sha.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/sha.h> | ||
| 62 | |||
| 63 | #define BUFSIZE 1024*16 | ||
| 64 | |||
| 65 | void do_fp(FILE *f); | ||
| 66 | void pt(unsigned char *md); | ||
| 67 | int read(int, void *, unsigned int); | ||
| 68 | int main(int argc, char **argv) | ||
| 69 | { | ||
| 70 | int i,err=0; | ||
| 71 | FILE *IN; | ||
| 72 | |||
| 73 | if (argc == 1) | ||
| 74 | { | ||
| 75 | do_fp(stdin); | ||
| 76 | } | ||
| 77 | else | ||
| 78 | { | ||
| 79 | for (i=1; i<argc; i++) | ||
| 80 | { | ||
| 81 | IN=fopen(argv[i],"r"); | ||
| 82 | if (IN == NULL) | ||
| 83 | { | ||
| 84 | perror(argv[i]); | ||
| 85 | err++; | ||
| 86 | continue; | ||
| 87 | } | ||
| 88 | printf("SHA(%s)= ",argv[i]); | ||
| 89 | do_fp(IN); | ||
| 90 | fclose(IN); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | exit(err); | ||
| 94 | } | ||
| 95 | |||
| 96 | void do_fp(FILE *f) | ||
| 97 | { | ||
| 98 | SHA_CTX c; | ||
| 99 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 100 | int fd; | ||
| 101 | int i; | ||
| 102 | unsigned char buf[BUFSIZE]; | ||
| 103 | |||
| 104 | fd=fileno(f); | ||
| 105 | SHA_Init(&c); | ||
| 106 | for (;;) | ||
| 107 | { | ||
| 108 | i=read(fd,buf,BUFSIZE); | ||
| 109 | if (i <= 0) break; | ||
| 110 | SHA_Update(&c,buf,(unsigned long)i); | ||
| 111 | } | ||
| 112 | SHA_Final(&(md[0]),&c); | ||
| 113 | pt(md); | ||
| 114 | } | ||
| 115 | |||
| 116 | void pt(unsigned char *md) | ||
| 117 | { | ||
| 118 | int i; | ||
| 119 | |||
| 120 | for (i=0; i<SHA_DIGEST_LENGTH; i++) | ||
| 121 | printf("%02x",md[i]); | ||
| 122 | printf("\n"); | ||
| 123 | } | ||
| 124 | |||
diff --git a/src/lib/libcrypto/sha/sha1.c b/src/lib/libcrypto/sha/sha1.c new file mode 100644 index 0000000000..d350c88ee4 --- /dev/null +++ b/src/lib/libcrypto/sha/sha1.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* crypto/sha/sha1.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <openssl/sha.h> | ||
| 62 | |||
| 63 | #define BUFSIZE 1024*16 | ||
| 64 | |||
| 65 | void do_fp(FILE *f); | ||
| 66 | void pt(unsigned char *md); | ||
| 67 | #ifndef _OSD_POSIX | ||
| 68 | int read(int, void *, unsigned int); | ||
| 69 | #endif | ||
| 70 | |||
| 71 | int main(int argc, char **argv) | ||
| 72 | { | ||
| 73 | int i,err=0; | ||
| 74 | FILE *IN; | ||
| 75 | |||
| 76 | if (argc == 1) | ||
| 77 | { | ||
| 78 | do_fp(stdin); | ||
| 79 | } | ||
| 80 | else | ||
| 81 | { | ||
| 82 | for (i=1; i<argc; i++) | ||
| 83 | { | ||
| 84 | IN=fopen(argv[i],"r"); | ||
| 85 | if (IN == NULL) | ||
| 86 | { | ||
| 87 | perror(argv[i]); | ||
| 88 | err++; | ||
| 89 | continue; | ||
| 90 | } | ||
| 91 | printf("SHA1(%s)= ",argv[i]); | ||
| 92 | do_fp(IN); | ||
| 93 | fclose(IN); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | exit(err); | ||
| 97 | } | ||
| 98 | |||
| 99 | void do_fp(FILE *f) | ||
| 100 | { | ||
| 101 | SHA_CTX c; | ||
| 102 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 103 | int fd; | ||
| 104 | int i; | ||
| 105 | unsigned char buf[BUFSIZE]; | ||
| 106 | |||
| 107 | fd=fileno(f); | ||
| 108 | SHA1_Init(&c); | ||
| 109 | for (;;) | ||
| 110 | { | ||
| 111 | i=read(fd,buf,BUFSIZE); | ||
| 112 | if (i <= 0) break; | ||
| 113 | SHA1_Update(&c,buf,(unsigned long)i); | ||
| 114 | } | ||
| 115 | SHA1_Final(&(md[0]),&c); | ||
| 116 | pt(md); | ||
| 117 | } | ||
| 118 | |||
| 119 | void pt(unsigned char *md) | ||
| 120 | { | ||
| 121 | int i; | ||
| 122 | |||
| 123 | for (i=0; i<SHA_DIGEST_LENGTH; i++) | ||
| 124 | printf("%02x",md[i]); | ||
| 125 | printf("\n"); | ||
| 126 | } | ||
| 127 | |||
diff --git a/src/lib/libcrypto/sha/sha1test.c b/src/lib/libcrypto/sha/sha1test.c new file mode 100644 index 0000000000..6feb3964c7 --- /dev/null +++ b/src/lib/libcrypto/sha/sha1test.c | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | /* crypto/sha/sha1test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #ifdef OPENSSL_NO_SHA | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No SHA support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/evp.h> | ||
| 73 | #include <openssl/sha.h> | ||
| 74 | |||
| 75 | #ifdef CHARSET_EBCDIC | ||
| 76 | #include <openssl/ebcdic.h> | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #undef SHA_0 /* FIPS 180 */ | ||
| 80 | #define SHA_1 /* FIPS 180-1 */ | ||
| 81 | |||
| 82 | static char *test[]={ | ||
| 83 | "abc", | ||
| 84 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", | ||
| 85 | NULL, | ||
| 86 | }; | ||
| 87 | |||
| 88 | #ifdef SHA_0 | ||
| 89 | static char *ret[]={ | ||
| 90 | "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880", | ||
| 91 | "d2516ee1acfa5baf33dfc1c471e438449ef134c8", | ||
| 92 | }; | ||
| 93 | static char *bigret= | ||
| 94 | "3232affa48628a26653b5aaa44541fd90d690603"; | ||
| 95 | #endif | ||
| 96 | #ifdef SHA_1 | ||
| 97 | static char *ret[]={ | ||
| 98 | "a9993e364706816aba3e25717850c26c9cd0d89d", | ||
| 99 | "84983e441c3bd26ebaae4aa1f95129e5e54670f1", | ||
| 100 | }; | ||
| 101 | static char *bigret= | ||
| 102 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; | ||
| 103 | #endif | ||
| 104 | |||
| 105 | static char *pt(unsigned char *md); | ||
| 106 | int main(int argc, char *argv[]) | ||
| 107 | { | ||
| 108 | int i,err=0; | ||
| 109 | char **P,**R; | ||
| 110 | static unsigned char buf[1000]; | ||
| 111 | char *p,*r; | ||
| 112 | EVP_MD_CTX c; | ||
| 113 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 114 | |||
| 115 | #ifdef CHARSET_EBCDIC | ||
| 116 | ebcdic2ascii(test[0], test[0], strlen(test[0])); | ||
| 117 | ebcdic2ascii(test[1], test[1], strlen(test[1])); | ||
| 118 | #endif | ||
| 119 | |||
| 120 | EVP_MD_CTX_init(&c); | ||
| 121 | P=test; | ||
| 122 | R=ret; | ||
| 123 | i=1; | ||
| 124 | while (*P != NULL) | ||
| 125 | { | ||
| 126 | EVP_Digest(*P,strlen((char *)*P),md,NULL,EVP_sha1(), NULL); | ||
| 127 | p=pt(md); | ||
| 128 | if (strcmp(p,(char *)*R) != 0) | ||
| 129 | { | ||
| 130 | printf("error calculating SHA1 on '%s'\n",*P); | ||
| 131 | printf("got %s instead of %s\n",p,*R); | ||
| 132 | err++; | ||
| 133 | } | ||
| 134 | else | ||
| 135 | printf("test %d ok\n",i); | ||
| 136 | i++; | ||
| 137 | R++; | ||
| 138 | P++; | ||
| 139 | } | ||
| 140 | |||
| 141 | memset(buf,'a',1000); | ||
| 142 | #ifdef CHARSET_EBCDIC | ||
| 143 | ebcdic2ascii(buf, buf, 1000); | ||
| 144 | #endif /*CHARSET_EBCDIC*/ | ||
| 145 | EVP_DigestInit_ex(&c,EVP_sha1(), NULL); | ||
| 146 | for (i=0; i<1000; i++) | ||
| 147 | EVP_DigestUpdate(&c,buf,1000); | ||
| 148 | EVP_DigestFinal_ex(&c,md,NULL); | ||
| 149 | p=pt(md); | ||
| 150 | |||
| 151 | r=bigret; | ||
| 152 | if (strcmp(p,r) != 0) | ||
| 153 | { | ||
| 154 | printf("error calculating SHA1 on 'a' * 1000\n"); | ||
| 155 | printf("got %s instead of %s\n",p,r); | ||
| 156 | err++; | ||
| 157 | } | ||
| 158 | else | ||
| 159 | printf("test 3 ok\n"); | ||
| 160 | |||
| 161 | #ifdef OPENSSL_SYS_NETWARE | ||
| 162 | if (err) printf("ERROR: %d\n", err); | ||
| 163 | #endif | ||
| 164 | EXIT(err); | ||
| 165 | EVP_MD_CTX_cleanup(&c); | ||
| 166 | return(0); | ||
| 167 | } | ||
| 168 | |||
| 169 | static char *pt(unsigned char *md) | ||
| 170 | { | ||
| 171 | int i; | ||
| 172 | static char buf[80]; | ||
| 173 | |||
| 174 | for (i=0; i<SHA_DIGEST_LENGTH; i++) | ||
| 175 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 176 | return(buf); | ||
| 177 | } | ||
| 178 | #endif | ||
diff --git a/src/lib/libcrypto/sha/sha256t.c b/src/lib/libcrypto/sha/sha256t.c new file mode 100644 index 0000000000..6b4a3bd001 --- /dev/null +++ b/src/lib/libcrypto/sha/sha256t.c | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | /* crypto/sha/sha256t.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. | ||
| 4 | * ==================================================================== | ||
| 5 | */ | ||
| 6 | #include <stdio.h> | ||
| 7 | #include <string.h> | ||
| 8 | #include <stdlib.h> | ||
| 9 | |||
| 10 | #include <openssl/sha.h> | ||
| 11 | #include <openssl/evp.h> | ||
| 12 | |||
| 13 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA256) | ||
| 14 | int main(int argc, char *argv[]) | ||
| 15 | { | ||
| 16 | printf("No SHA256 support\n"); | ||
| 17 | return(0); | ||
| 18 | } | ||
| 19 | #else | ||
| 20 | |||
| 21 | unsigned char app_b1[SHA256_DIGEST_LENGTH] = { | ||
| 22 | 0xba,0x78,0x16,0xbf,0x8f,0x01,0xcf,0xea, | ||
| 23 | 0x41,0x41,0x40,0xde,0x5d,0xae,0x22,0x23, | ||
| 24 | 0xb0,0x03,0x61,0xa3,0x96,0x17,0x7a,0x9c, | ||
| 25 | 0xb4,0x10,0xff,0x61,0xf2,0x00,0x15,0xad }; | ||
| 26 | |||
| 27 | unsigned char app_b2[SHA256_DIGEST_LENGTH] = { | ||
| 28 | 0x24,0x8d,0x6a,0x61,0xd2,0x06,0x38,0xb8, | ||
| 29 | 0xe5,0xc0,0x26,0x93,0x0c,0x3e,0x60,0x39, | ||
| 30 | 0xa3,0x3c,0xe4,0x59,0x64,0xff,0x21,0x67, | ||
| 31 | 0xf6,0xec,0xed,0xd4,0x19,0xdb,0x06,0xc1 }; | ||
| 32 | |||
| 33 | unsigned char app_b3[SHA256_DIGEST_LENGTH] = { | ||
| 34 | 0xcd,0xc7,0x6e,0x5c,0x99,0x14,0xfb,0x92, | ||
| 35 | 0x81,0xa1,0xc7,0xe2,0x84,0xd7,0x3e,0x67, | ||
| 36 | 0xf1,0x80,0x9a,0x48,0xa4,0x97,0x20,0x0e, | ||
| 37 | 0x04,0x6d,0x39,0xcc,0xc7,0x11,0x2c,0xd0 }; | ||
| 38 | |||
| 39 | unsigned char addenum_1[SHA224_DIGEST_LENGTH] = { | ||
| 40 | 0x23,0x09,0x7d,0x22,0x34,0x05,0xd8,0x22, | ||
| 41 | 0x86,0x42,0xa4,0x77,0xbd,0xa2,0x55,0xb3, | ||
| 42 | 0x2a,0xad,0xbc,0xe4,0xbd,0xa0,0xb3,0xf7, | ||
| 43 | 0xe3,0x6c,0x9d,0xa7 }; | ||
| 44 | |||
| 45 | unsigned char addenum_2[SHA224_DIGEST_LENGTH] = { | ||
| 46 | 0x75,0x38,0x8b,0x16,0x51,0x27,0x76,0xcc, | ||
| 47 | 0x5d,0xba,0x5d,0xa1,0xfd,0x89,0x01,0x50, | ||
| 48 | 0xb0,0xc6,0x45,0x5c,0xb4,0xf5,0x8b,0x19, | ||
| 49 | 0x52,0x52,0x25,0x25 }; | ||
| 50 | |||
| 51 | unsigned char addenum_3[SHA224_DIGEST_LENGTH] = { | ||
| 52 | 0x20,0x79,0x46,0x55,0x98,0x0c,0x91,0xd8, | ||
| 53 | 0xbb,0xb4,0xc1,0xea,0x97,0x61,0x8a,0x4b, | ||
| 54 | 0xf0,0x3f,0x42,0x58,0x19,0x48,0xb2,0xee, | ||
| 55 | 0x4e,0xe7,0xad,0x67 }; | ||
| 56 | |||
| 57 | int main (int argc,char **argv) | ||
| 58 | { unsigned char md[SHA256_DIGEST_LENGTH]; | ||
| 59 | int i; | ||
| 60 | EVP_MD_CTX evp; | ||
| 61 | |||
| 62 | fprintf(stdout,"Testing SHA-256 "); | ||
| 63 | |||
| 64 | EVP_Digest ("abc",3,md,NULL,EVP_sha256(),NULL); | ||
| 65 | if (memcmp(md,app_b1,sizeof(app_b1))) | ||
| 66 | { fflush(stdout); | ||
| 67 | fprintf(stderr,"\nTEST 1 of 3 failed.\n"); | ||
| 68 | return 1; | ||
| 69 | } | ||
| 70 | else | ||
| 71 | fprintf(stdout,"."); fflush(stdout); | ||
| 72 | |||
| 73 | EVP_Digest ("abcdbcde""cdefdefg""efghfghi""ghijhijk" | ||
| 74 | "ijkljklm""klmnlmno""mnopnopq",56,md,NULL,EVP_sha256(),NULL); | ||
| 75 | if (memcmp(md,app_b2,sizeof(app_b2))) | ||
| 76 | { fflush(stdout); | ||
| 77 | fprintf(stderr,"\nTEST 2 of 3 failed.\n"); | ||
| 78 | return 1; | ||
| 79 | } | ||
| 80 | else | ||
| 81 | fprintf(stdout,"."); fflush(stdout); | ||
| 82 | |||
| 83 | EVP_MD_CTX_init (&evp); | ||
| 84 | EVP_DigestInit_ex (&evp,EVP_sha256(),NULL); | ||
| 85 | for (i=0;i<1000000;i+=160) | ||
| 86 | EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 87 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 88 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 89 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 90 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", | ||
| 91 | (1000000-i)<160?1000000-i:160); | ||
| 92 | EVP_DigestFinal_ex (&evp,md,NULL); | ||
| 93 | EVP_MD_CTX_cleanup (&evp); | ||
| 94 | |||
| 95 | if (memcmp(md,app_b3,sizeof(app_b3))) | ||
| 96 | { fflush(stdout); | ||
| 97 | fprintf(stderr,"\nTEST 3 of 3 failed.\n"); | ||
| 98 | return 1; | ||
| 99 | } | ||
| 100 | else | ||
| 101 | fprintf(stdout,"."); fflush(stdout); | ||
| 102 | |||
| 103 | fprintf(stdout," passed.\n"); fflush(stdout); | ||
| 104 | |||
| 105 | fprintf(stdout,"Testing SHA-224 "); | ||
| 106 | |||
| 107 | EVP_Digest ("abc",3,md,NULL,EVP_sha224(),NULL); | ||
| 108 | if (memcmp(md,addenum_1,sizeof(addenum_1))) | ||
| 109 | { fflush(stdout); | ||
| 110 | fprintf(stderr,"\nTEST 1 of 3 failed.\n"); | ||
| 111 | return 1; | ||
| 112 | } | ||
| 113 | else | ||
| 114 | fprintf(stdout,"."); fflush(stdout); | ||
| 115 | |||
| 116 | EVP_Digest ("abcdbcde""cdefdefg""efghfghi""ghijhijk" | ||
| 117 | "ijkljklm""klmnlmno""mnopnopq",56,md,NULL,EVP_sha224(),NULL); | ||
| 118 | if (memcmp(md,addenum_2,sizeof(addenum_2))) | ||
| 119 | { fflush(stdout); | ||
| 120 | fprintf(stderr,"\nTEST 2 of 3 failed.\n"); | ||
| 121 | return 1; | ||
| 122 | } | ||
| 123 | else | ||
| 124 | fprintf(stdout,"."); fflush(stdout); | ||
| 125 | |||
| 126 | EVP_MD_CTX_init (&evp); | ||
| 127 | EVP_DigestInit_ex (&evp,EVP_sha224(),NULL); | ||
| 128 | for (i=0;i<1000000;i+=64) | ||
| 129 | EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 130 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", | ||
| 131 | (1000000-i)<64?1000000-i:64); | ||
| 132 | EVP_DigestFinal_ex (&evp,md,NULL); | ||
| 133 | EVP_MD_CTX_cleanup (&evp); | ||
| 134 | |||
| 135 | if (memcmp(md,addenum_3,sizeof(addenum_3))) | ||
| 136 | { fflush(stdout); | ||
| 137 | fprintf(stderr,"\nTEST 3 of 3 failed.\n"); | ||
| 138 | return 1; | ||
| 139 | } | ||
| 140 | else | ||
| 141 | fprintf(stdout,"."); fflush(stdout); | ||
| 142 | |||
| 143 | fprintf(stdout," passed.\n"); fflush(stdout); | ||
| 144 | |||
| 145 | return 0; | ||
| 146 | } | ||
| 147 | #endif | ||
diff --git a/src/lib/libcrypto/sha/sha512t.c b/src/lib/libcrypto/sha/sha512t.c new file mode 100644 index 0000000000..210041d435 --- /dev/null +++ b/src/lib/libcrypto/sha/sha512t.c | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | /* crypto/sha/sha512t.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. | ||
| 4 | * ==================================================================== | ||
| 5 | */ | ||
| 6 | #include <stdio.h> | ||
| 7 | #include <string.h> | ||
| 8 | #include <stdlib.h> | ||
| 9 | |||
| 10 | #include <openssl/sha.h> | ||
| 11 | #include <openssl/evp.h> | ||
| 12 | #include <openssl/crypto.h> | ||
| 13 | |||
| 14 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA512) | ||
| 15 | int main(int argc, char *argv[]) | ||
| 16 | { | ||
| 17 | printf("No SHA512 support\n"); | ||
| 18 | return(0); | ||
| 19 | } | ||
| 20 | #else | ||
| 21 | |||
| 22 | unsigned char app_c1[SHA512_DIGEST_LENGTH] = { | ||
| 23 | 0xdd,0xaf,0x35,0xa1,0x93,0x61,0x7a,0xba, | ||
| 24 | 0xcc,0x41,0x73,0x49,0xae,0x20,0x41,0x31, | ||
| 25 | 0x12,0xe6,0xfa,0x4e,0x89,0xa9,0x7e,0xa2, | ||
| 26 | 0x0a,0x9e,0xee,0xe6,0x4b,0x55,0xd3,0x9a, | ||
| 27 | 0x21,0x92,0x99,0x2a,0x27,0x4f,0xc1,0xa8, | ||
| 28 | 0x36,0xba,0x3c,0x23,0xa3,0xfe,0xeb,0xbd, | ||
| 29 | 0x45,0x4d,0x44,0x23,0x64,0x3c,0xe8,0x0e, | ||
| 30 | 0x2a,0x9a,0xc9,0x4f,0xa5,0x4c,0xa4,0x9f }; | ||
| 31 | |||
| 32 | unsigned char app_c2[SHA512_DIGEST_LENGTH] = { | ||
| 33 | 0x8e,0x95,0x9b,0x75,0xda,0xe3,0x13,0xda, | ||
| 34 | 0x8c,0xf4,0xf7,0x28,0x14,0xfc,0x14,0x3f, | ||
| 35 | 0x8f,0x77,0x79,0xc6,0xeb,0x9f,0x7f,0xa1, | ||
| 36 | 0x72,0x99,0xae,0xad,0xb6,0x88,0x90,0x18, | ||
| 37 | 0x50,0x1d,0x28,0x9e,0x49,0x00,0xf7,0xe4, | ||
| 38 | 0x33,0x1b,0x99,0xde,0xc4,0xb5,0x43,0x3a, | ||
| 39 | 0xc7,0xd3,0x29,0xee,0xb6,0xdd,0x26,0x54, | ||
| 40 | 0x5e,0x96,0xe5,0x5b,0x87,0x4b,0xe9,0x09 }; | ||
| 41 | |||
| 42 | unsigned char app_c3[SHA512_DIGEST_LENGTH] = { | ||
| 43 | 0xe7,0x18,0x48,0x3d,0x0c,0xe7,0x69,0x64, | ||
| 44 | 0x4e,0x2e,0x42,0xc7,0xbc,0x15,0xb4,0x63, | ||
| 45 | 0x8e,0x1f,0x98,0xb1,0x3b,0x20,0x44,0x28, | ||
| 46 | 0x56,0x32,0xa8,0x03,0xaf,0xa9,0x73,0xeb, | ||
| 47 | 0xde,0x0f,0xf2,0x44,0x87,0x7e,0xa6,0x0a, | ||
| 48 | 0x4c,0xb0,0x43,0x2c,0xe5,0x77,0xc3,0x1b, | ||
| 49 | 0xeb,0x00,0x9c,0x5c,0x2c,0x49,0xaa,0x2e, | ||
| 50 | 0x4e,0xad,0xb2,0x17,0xad,0x8c,0xc0,0x9b }; | ||
| 51 | |||
| 52 | unsigned char app_d1[SHA384_DIGEST_LENGTH] = { | ||
| 53 | 0xcb,0x00,0x75,0x3f,0x45,0xa3,0x5e,0x8b, | ||
| 54 | 0xb5,0xa0,0x3d,0x69,0x9a,0xc6,0x50,0x07, | ||
| 55 | 0x27,0x2c,0x32,0xab,0x0e,0xde,0xd1,0x63, | ||
| 56 | 0x1a,0x8b,0x60,0x5a,0x43,0xff,0x5b,0xed, | ||
| 57 | 0x80,0x86,0x07,0x2b,0xa1,0xe7,0xcc,0x23, | ||
| 58 | 0x58,0xba,0xec,0xa1,0x34,0xc8,0x25,0xa7 }; | ||
| 59 | |||
| 60 | unsigned char app_d2[SHA384_DIGEST_LENGTH] = { | ||
| 61 | 0x09,0x33,0x0c,0x33,0xf7,0x11,0x47,0xe8, | ||
| 62 | 0x3d,0x19,0x2f,0xc7,0x82,0xcd,0x1b,0x47, | ||
| 63 | 0x53,0x11,0x1b,0x17,0x3b,0x3b,0x05,0xd2, | ||
| 64 | 0x2f,0xa0,0x80,0x86,0xe3,0xb0,0xf7,0x12, | ||
| 65 | 0xfc,0xc7,0xc7,0x1a,0x55,0x7e,0x2d,0xb9, | ||
| 66 | 0x66,0xc3,0xe9,0xfa,0x91,0x74,0x60,0x39 }; | ||
| 67 | |||
| 68 | unsigned char app_d3[SHA384_DIGEST_LENGTH] = { | ||
| 69 | 0x9d,0x0e,0x18,0x09,0x71,0x64,0x74,0xcb, | ||
| 70 | 0x08,0x6e,0x83,0x4e,0x31,0x0a,0x4a,0x1c, | ||
| 71 | 0xed,0x14,0x9e,0x9c,0x00,0xf2,0x48,0x52, | ||
| 72 | 0x79,0x72,0xce,0xc5,0x70,0x4c,0x2a,0x5b, | ||
| 73 | 0x07,0xb8,0xb3,0xdc,0x38,0xec,0xc4,0xeb, | ||
| 74 | 0xae,0x97,0xdd,0xd8,0x7f,0x3d,0x89,0x85 }; | ||
| 75 | |||
| 76 | int main (int argc,char **argv) | ||
| 77 | { unsigned char md[SHA512_DIGEST_LENGTH]; | ||
| 78 | int i; | ||
| 79 | EVP_MD_CTX evp; | ||
| 80 | |||
| 81 | #ifdef OPENSSL_IA32_SSE2 | ||
| 82 | /* Alternative to this is to call OpenSSL_add_all_algorithms... | ||
| 83 | * The below code is retained exclusively for debugging purposes. */ | ||
| 84 | { char *env; | ||
| 85 | |||
| 86 | if ((env=getenv("OPENSSL_ia32cap"))) | ||
| 87 | OPENSSL_ia32cap = strtoul (env,NULL,0); | ||
| 88 | } | ||
| 89 | #endif | ||
| 90 | |||
| 91 | fprintf(stdout,"Testing SHA-512 "); | ||
| 92 | |||
| 93 | EVP_Digest ("abc",3,md,NULL,EVP_sha512(),NULL); | ||
| 94 | if (memcmp(md,app_c1,sizeof(app_c1))) | ||
| 95 | { fflush(stdout); | ||
| 96 | fprintf(stderr,"\nTEST 1 of 3 failed.\n"); | ||
| 97 | return 1; | ||
| 98 | } | ||
| 99 | else | ||
| 100 | fprintf(stdout,"."); fflush(stdout); | ||
| 101 | |||
| 102 | EVP_Digest ("abcdefgh""bcdefghi""cdefghij""defghijk" | ||
| 103 | "efghijkl""fghijklm""ghijklmn""hijklmno" | ||
| 104 | "ijklmnop""jklmnopq""klmnopqr""lmnopqrs" | ||
| 105 | "mnopqrst""nopqrstu",112,md,NULL,EVP_sha512(),NULL); | ||
| 106 | if (memcmp(md,app_c2,sizeof(app_c2))) | ||
| 107 | { fflush(stdout); | ||
| 108 | fprintf(stderr,"\nTEST 2 of 3 failed.\n"); | ||
| 109 | return 1; | ||
| 110 | } | ||
| 111 | else | ||
| 112 | fprintf(stdout,"."); fflush(stdout); | ||
| 113 | |||
| 114 | EVP_MD_CTX_init (&evp); | ||
| 115 | EVP_DigestInit_ex (&evp,EVP_sha512(),NULL); | ||
| 116 | for (i=0;i<1000000;i+=288) | ||
| 117 | EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 118 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 119 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 120 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 121 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 122 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 123 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 124 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 125 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", | ||
| 126 | (1000000-i)<288?1000000-i:288); | ||
| 127 | EVP_DigestFinal_ex (&evp,md,NULL); | ||
| 128 | EVP_MD_CTX_cleanup (&evp); | ||
| 129 | |||
| 130 | if (memcmp(md,app_c3,sizeof(app_c3))) | ||
| 131 | { fflush(stdout); | ||
| 132 | fprintf(stderr,"\nTEST 3 of 3 failed.\n"); | ||
| 133 | return 1; | ||
| 134 | } | ||
| 135 | else | ||
| 136 | fprintf(stdout,"."); fflush(stdout); | ||
| 137 | |||
| 138 | fprintf(stdout," passed.\n"); fflush(stdout); | ||
| 139 | |||
| 140 | fprintf(stdout,"Testing SHA-384 "); | ||
| 141 | |||
| 142 | EVP_Digest ("abc",3,md,NULL,EVP_sha384(),NULL); | ||
| 143 | if (memcmp(md,app_d1,sizeof(app_d1))) | ||
| 144 | { fflush(stdout); | ||
| 145 | fprintf(stderr,"\nTEST 1 of 3 failed.\n"); | ||
| 146 | return 1; | ||
| 147 | } | ||
| 148 | else | ||
| 149 | fprintf(stdout,"."); fflush(stdout); | ||
| 150 | |||
| 151 | EVP_Digest ("abcdefgh""bcdefghi""cdefghij""defghijk" | ||
| 152 | "efghijkl""fghijklm""ghijklmn""hijklmno" | ||
| 153 | "ijklmnop""jklmnopq""klmnopqr""lmnopqrs" | ||
| 154 | "mnopqrst""nopqrstu",112,md,NULL,EVP_sha384(),NULL); | ||
| 155 | if (memcmp(md,app_d2,sizeof(app_d2))) | ||
| 156 | { fflush(stdout); | ||
| 157 | fprintf(stderr,"\nTEST 2 of 3 failed.\n"); | ||
| 158 | return 1; | ||
| 159 | } | ||
| 160 | else | ||
| 161 | fprintf(stdout,"."); fflush(stdout); | ||
| 162 | |||
| 163 | EVP_MD_CTX_init (&evp); | ||
| 164 | EVP_DigestInit_ex (&evp,EVP_sha384(),NULL); | ||
| 165 | for (i=0;i<1000000;i+=64) | ||
| 166 | EVP_DigestUpdate (&evp, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 167 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", | ||
| 168 | (1000000-i)<64?1000000-i:64); | ||
| 169 | EVP_DigestFinal_ex (&evp,md,NULL); | ||
| 170 | EVP_MD_CTX_cleanup (&evp); | ||
| 171 | |||
| 172 | if (memcmp(md,app_d3,sizeof(app_d3))) | ||
| 173 | { fflush(stdout); | ||
| 174 | fprintf(stderr,"\nTEST 3 of 3 failed.\n"); | ||
| 175 | return 1; | ||
| 176 | } | ||
| 177 | else | ||
| 178 | fprintf(stdout,"."); fflush(stdout); | ||
| 179 | |||
| 180 | fprintf(stdout," passed.\n"); fflush(stdout); | ||
| 181 | |||
| 182 | return 0; | ||
| 183 | } | ||
| 184 | #endif | ||
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c new file mode 100644 index 0000000000..70eb56032c --- /dev/null +++ b/src/lib/libcrypto/sha/sha_dgst.c | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | /* crypto/sha/sha1dgst.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <openssl/opensslconf.h> | ||
| 60 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | ||
| 61 | |||
| 62 | #undef SHA_1 | ||
| 63 | #define SHA_0 | ||
| 64 | |||
| 65 | #include <openssl/opensslv.h> | ||
| 66 | |||
| 67 | const char SHA_version[]="SHA" OPENSSL_VERSION_PTEXT; | ||
| 68 | |||
| 69 | /* The implementation is in ../md32_common.h */ | ||
| 70 | |||
| 71 | #include "sha_locl.h" | ||
| 72 | |||
| 73 | #endif | ||
| 74 | |||
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c new file mode 100644 index 0000000000..3bae623ce8 --- /dev/null +++ b/src/lib/libcrypto/sha/sha_one.c | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* crypto/sha/sha_one.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <openssl/sha.h> | ||
| 62 | #include <openssl/crypto.h> | ||
| 63 | |||
| 64 | #ifndef OPENSSL_NO_SHA0 | ||
| 65 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md) | ||
| 66 | { | ||
| 67 | SHA_CTX c; | ||
| 68 | static unsigned char m[SHA_DIGEST_LENGTH]; | ||
| 69 | |||
| 70 | if (md == NULL) md=m; | ||
| 71 | if (!SHA_Init(&c)) | ||
| 72 | return NULL; | ||
| 73 | SHA_Update(&c,d,n); | ||
| 74 | SHA_Final(md,&c); | ||
| 75 | OPENSSL_cleanse(&c,sizeof(c)); | ||
| 76 | return(md); | ||
| 77 | } | ||
| 78 | #endif | ||
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c new file mode 100644 index 0000000000..27614646d1 --- /dev/null +++ b/src/lib/libcrypto/sha/shatest.c | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | /* crypto/sha/shatest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <string.h> | ||
| 61 | #include <stdlib.h> | ||
| 62 | |||
| 63 | #include "../e_os.h" | ||
| 64 | |||
| 65 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0) | ||
| 66 | int main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | printf("No SHA0 support\n"); | ||
| 69 | return(0); | ||
| 70 | } | ||
| 71 | #else | ||
| 72 | #include <openssl/evp.h> | ||
| 73 | #include <openssl/sha.h> | ||
| 74 | |||
| 75 | #ifdef CHARSET_EBCDIC | ||
| 76 | #include <openssl/ebcdic.h> | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #define SHA_0 /* FIPS 180 */ | ||
| 80 | #undef SHA_1 /* FIPS 180-1 */ | ||
| 81 | |||
| 82 | static char *test[]={ | ||
| 83 | "abc", | ||
| 84 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", | ||
| 85 | NULL, | ||
| 86 | }; | ||
| 87 | |||
| 88 | #ifdef SHA_0 | ||
| 89 | static char *ret[]={ | ||
| 90 | "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880", | ||
| 91 | "d2516ee1acfa5baf33dfc1c471e438449ef134c8", | ||
| 92 | }; | ||
| 93 | static char *bigret= | ||
| 94 | "3232affa48628a26653b5aaa44541fd90d690603"; | ||
| 95 | #endif | ||
| 96 | #ifdef SHA_1 | ||
| 97 | static char *ret[]={ | ||
| 98 | "a9993e364706816aba3e25717850c26c9cd0d89d", | ||
| 99 | "84983e441c3bd26ebaae4aa1f95129e5e54670f1", | ||
| 100 | }; | ||
| 101 | static char *bigret= | ||
| 102 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; | ||
| 103 | #endif | ||
| 104 | |||
| 105 | static char *pt(unsigned char *md); | ||
| 106 | int main(int argc, char *argv[]) | ||
| 107 | { | ||
| 108 | int i,err=0; | ||
| 109 | char **P,**R; | ||
| 110 | static unsigned char buf[1000]; | ||
| 111 | char *p,*r; | ||
| 112 | EVP_MD_CTX c; | ||
| 113 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
| 114 | |||
| 115 | #ifdef CHARSET_EBCDIC | ||
| 116 | ebcdic2ascii(test[0], test[0], strlen(test[0])); | ||
| 117 | ebcdic2ascii(test[1], test[1], strlen(test[1])); | ||
| 118 | #endif | ||
| 119 | |||
| 120 | EVP_MD_CTX_init(&c); | ||
| 121 | P=test; | ||
| 122 | R=ret; | ||
| 123 | i=1; | ||
| 124 | while (*P != NULL) | ||
| 125 | { | ||
| 126 | EVP_Digest(*P,strlen(*P),md,NULL,EVP_sha(), NULL); | ||
| 127 | p=pt(md); | ||
| 128 | if (strcmp(p,*R) != 0) | ||
| 129 | { | ||
| 130 | printf("error calculating SHA on '%s'\n",*P); | ||
| 131 | printf("got %s instead of %s\n",p,*R); | ||
| 132 | err++; | ||
| 133 | } | ||
| 134 | else | ||
| 135 | printf("test %d ok\n",i); | ||
| 136 | i++; | ||
| 137 | R++; | ||
| 138 | P++; | ||
| 139 | } | ||
| 140 | |||
| 141 | memset(buf,'a',1000); | ||
| 142 | #ifdef CHARSET_EBCDIC | ||
| 143 | ebcdic2ascii(buf, buf, 1000); | ||
| 144 | #endif /*CHARSET_EBCDIC*/ | ||
| 145 | EVP_DigestInit_ex(&c,EVP_sha(), NULL); | ||
| 146 | for (i=0; i<1000; i++) | ||
| 147 | EVP_DigestUpdate(&c,buf,1000); | ||
| 148 | EVP_DigestFinal_ex(&c,md,NULL); | ||
| 149 | p=pt(md); | ||
| 150 | |||
| 151 | r=bigret; | ||
| 152 | if (strcmp(p,r) != 0) | ||
| 153 | { | ||
| 154 | printf("error calculating SHA on '%s'\n",p); | ||
| 155 | printf("got %s instead of %s\n",p,r); | ||
| 156 | err++; | ||
| 157 | } | ||
| 158 | else | ||
| 159 | printf("test 3 ok\n"); | ||
| 160 | |||
| 161 | #ifdef OPENSSL_SYS_NETWARE | ||
| 162 | if (err) printf("ERROR: %d\n", err); | ||
| 163 | #endif | ||
| 164 | EVP_MD_CTX_cleanup(&c); | ||
| 165 | EXIT(err); | ||
| 166 | return(0); | ||
| 167 | } | ||
| 168 | |||
| 169 | static char *pt(unsigned char *md) | ||
| 170 | { | ||
| 171 | int i; | ||
| 172 | static char buf[80]; | ||
| 173 | |||
| 174 | for (i=0; i<SHA_DIGEST_LENGTH; i++) | ||
| 175 | sprintf(&(buf[i*2]),"%02x",md[i]); | ||
| 176 | return(buf); | ||
| 177 | } | ||
| 178 | #endif | ||
diff --git a/src/lib/libcrypto/stack/Makefile b/src/lib/libcrypto/stack/Makefile new file mode 100644 index 0000000000..5327692ac8 --- /dev/null +++ b/src/lib/libcrypto/stack/Makefile | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/stack/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= stack | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=stack.c | ||
| 21 | LIBOBJ=stack.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= stack.h safestack.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | stack.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 78 | stack.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 79 | stack.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 80 | stack.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 81 | stack.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 82 | stack.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 83 | stack.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 84 | stack.o: ../../include/openssl/symhacks.h ../cryptlib.h stack.c | ||
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h index 3e76aa58f5..891cb84a51 100644 --- a/src/lib/libcrypto/stack/safestack.h +++ b/src/lib/libcrypto/stack/safestack.h | |||
| @@ -179,8 +179,7 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) | |||
| 179 | sk_is_sorted(CHECKED_STACK_OF(type, st)) | 179 | sk_is_sorted(CHECKED_STACK_OF(type, st)) |
| 180 | 180 | ||
| 181 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 181 | #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
| 182 | (STACK_OF(type) *)d2i_ASN1_SET( \ | 182 | (STACK_OF(type) *)d2i_ASN1_SET((STACK_OF(OPENSSL_BLOCK) **)CHECKED_STACK_OF(type, st), \ |
| 183 | (STACK_OF(OPENSSL_BLOCK) **)CHECKED_PTR_OF(STACK_OF(type)*, st), \ | ||
| 184 | pp, length, \ | 183 | pp, length, \ |
| 185 | CHECKED_D2I_OF(type, d2i_func), \ | 184 | CHECKED_D2I_OF(type, d2i_func), \ |
| 186 | CHECKED_SK_FREE_FUNC(type, free_func), \ | 185 | CHECKED_SK_FREE_FUNC(type, free_func), \ |
| @@ -2031,79 +2030,79 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) | |||
| 2031 | #define sk_void_sort(st) SKM_sk_sort(void, (st)) | 2030 | #define sk_void_sort(st) SKM_sk_sort(void, (st)) |
| 2032 | #define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st)) | 2031 | #define sk_void_is_sorted(st) SKM_sk_is_sorted(void, (st)) |
| 2033 | 2032 | ||
| 2034 | #define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp))) | 2033 | #define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp))) |
| 2035 | #define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null()) | 2034 | #define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null()) |
| 2036 | #define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) | 2035 | #define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val)) |
| 2037 | #define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) | 2036 | #define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val)) |
| 2038 | #define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_STACK_OF(OPENSSL_STRING, st), i)) | 2037 | #define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), i)) |
| 2039 | #define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st) | 2038 | #define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st) |
| 2040 | #define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func)) | 2039 | #define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func)) |
| 2041 | #define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val), i) | 2040 | #define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val), i) |
| 2042 | #define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st) | 2041 | #define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st) |
| 2043 | #define sk_OPENSSL_STRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_STRING, st), i, CHECKED_PTR_OF(char, val)) | 2042 | #define sk_OPENSSL_BLOCK_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), i, CHECKED_PTR_OF(void, val)) |
| 2044 | #define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st)) | 2043 | #define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st)) |
| 2045 | #define sk_OPENSSL_STRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, val)) | 2044 | #define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, val)) |
| 2046 | #define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val)) | 2045 | #define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val)) |
| 2047 | #define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i)) | 2046 | #define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i)) |
| 2048 | #define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_PTR_OF(char, ptr)) | 2047 | #define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_PTR_OF(void, ptr)) |
| 2049 | #define sk_OPENSSL_STRING_set_cmp_func(st, cmp) \ | 2048 | #define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \ |
| 2050 | ((int (*)(const char * const *,const char * const *)) \ | 2049 | ((int (*)(const void * const *,const void * const *)) \ |
| 2051 | sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_STRING, st), CHECKED_SK_CMP_FUNC(char, cmp))) | 2050 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_SK_CMP_FUNC(void, cmp))) |
| 2052 | #define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st) | 2051 | #define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st) |
| 2053 | #define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st)) | 2052 | #define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st)) |
| 2054 | #define sk_OPENSSL_STRING_pop(st) (char *)sk_pop(CHECKED_STACK_OF(OPENSSL_STRING, st)) | 2053 | #define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_BLOCK), st)) |
| 2055 | #define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st)) | 2054 | #define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st)) |
| 2056 | #define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st)) | 2055 | #define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st)) |
| 2057 | 2056 | ||
| 2058 | 2057 | ||
| 2059 | #define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) | 2058 | #define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) |
| 2060 | #define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null()) | 2059 | #define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null()) |
| 2061 | #define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val)) | 2060 | #define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val)) |
| 2062 | #define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val)) | 2061 | #define sk_OPENSSL_PSTRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val)) |
| 2063 | #define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i)) | 2062 | #define sk_OPENSSL_PSTRING_value(st, i) ((OPENSSL_PSTRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), i)) |
| 2064 | #define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st) | 2063 | #define sk_OPENSSL_PSTRING_num(st) SKM_sk_num(OPENSSL_PSTRING, st) |
| 2065 | #define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_func)) | 2064 | #define sk_OPENSSL_PSTRING_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_SK_FREE_FUNC2(OPENSSL_PSTRING, free_func)) |
| 2066 | #define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val), i) | 2065 | #define sk_OPENSSL_PSTRING_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val), i) |
| 2067 | #define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st) | 2066 | #define sk_OPENSSL_PSTRING_free(st) SKM_sk_free(OPENSSL_PSTRING, st) |
| 2068 | #define sk_OPENSSL_PSTRING_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_PSTRING, st), i, CHECKED_PTR_OF(OPENSSL_STRING, val)) | 2067 | #define sk_OPENSSL_PSTRING_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), i, CHECKED_PTR_OF(OPENSSL_STRING, val)) |
| 2069 | #define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st)) | 2068 | #define sk_OPENSSL_PSTRING_zero(st) SKM_sk_zero(OPENSSL_PSTRING, (st)) |
| 2070 | #define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val)) | 2069 | #define sk_OPENSSL_PSTRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, val)) |
| 2071 | #define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_STRING, val)) | 2070 | #define sk_OPENSSL_PSTRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_CONST_PTR_OF(OPENSSL_STRING, val)) |
| 2072 | #define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i)) | 2071 | #define sk_OPENSSL_PSTRING_delete(st, i) SKM_sk_delete(OPENSSL_PSTRING, (st), (i)) |
| 2073 | #define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, ptr)) | 2072 | #define sk_OPENSSL_PSTRING_delete_ptr(st, ptr) (OPENSSL_PSTRING *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_PTR_OF(OPENSSL_STRING, ptr)) |
| 2074 | #define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp) \ | 2073 | #define sk_OPENSSL_PSTRING_set_cmp_func(st, cmp) \ |
| 2075 | ((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \ | 2074 | ((int (*)(const OPENSSL_STRING * const *,const OPENSSL_STRING * const *)) \ |
| 2076 | sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) | 2075 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st), CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp))) |
| 2077 | #define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st) | 2076 | #define sk_OPENSSL_PSTRING_dup(st) SKM_sk_dup(OPENSSL_PSTRING, st) |
| 2078 | #define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st)) | 2077 | #define sk_OPENSSL_PSTRING_shift(st) SKM_sk_shift(OPENSSL_PSTRING, (st)) |
| 2079 | #define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop(CHECKED_STACK_OF(OPENSSL_PSTRING, st)) | 2078 | #define sk_OPENSSL_PSTRING_pop(st) (OPENSSL_STRING *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_PSTRING), st)) |
| 2080 | #define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st)) | 2079 | #define sk_OPENSSL_PSTRING_sort(st) SKM_sk_sort(OPENSSL_PSTRING, (st)) |
| 2081 | #define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st)) | 2080 | #define sk_OPENSSL_PSTRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_PSTRING, (st)) |
| 2082 | 2081 | ||
| 2083 | 2082 | ||
| 2084 | #define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp))) | 2083 | #define sk_OPENSSL_STRING_new(cmp) ((STACK_OF(OPENSSL_STRING) *)sk_new(CHECKED_SK_CMP_FUNC(char, cmp))) |
| 2085 | #define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null()) | 2084 | #define sk_OPENSSL_STRING_new_null() ((STACK_OF(OPENSSL_STRING) *)sk_new_null()) |
| 2086 | #define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) | 2085 | #define sk_OPENSSL_STRING_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val)) |
| 2087 | #define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) | 2086 | #define sk_OPENSSL_STRING_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val)) |
| 2088 | #define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i)) | 2087 | #define sk_OPENSSL_STRING_value(st, i) ((OPENSSL_STRING)sk_value(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i)) |
| 2089 | #define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st) | 2088 | #define sk_OPENSSL_STRING_num(st) SKM_sk_num(OPENSSL_STRING, st) |
| 2090 | #define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func)) | 2089 | #define sk_OPENSSL_STRING_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_FREE_FUNC2(OPENSSL_STRING, free_func)) |
| 2091 | #define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i) | 2090 | #define sk_OPENSSL_STRING_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val), i) |
| 2092 | #define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st) | 2091 | #define sk_OPENSSL_STRING_free(st) SKM_sk_free(OPENSSL_STRING, st) |
| 2093 | #define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val)) | 2092 | #define sk_OPENSSL_STRING_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), i, CHECKED_PTR_OF(char, val)) |
| 2094 | #define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st)) | 2093 | #define sk_OPENSSL_STRING_zero(st) SKM_sk_zero(OPENSSL_STRING, (st)) |
| 2095 | #define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val)) | 2094 | #define sk_OPENSSL_STRING_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, val)) |
| 2096 | #define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val)) | 2095 | #define sk_OPENSSL_STRING_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_CONST_PTR_OF(char, val)) |
| 2097 | #define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i)) | 2096 | #define sk_OPENSSL_STRING_delete(st, i) SKM_sk_delete(OPENSSL_STRING, (st), (i)) |
| 2098 | #define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr)) | 2097 | #define sk_OPENSSL_STRING_delete_ptr(st, ptr) (OPENSSL_STRING *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_PTR_OF(char, ptr)) |
| 2099 | #define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \ | 2098 | #define sk_OPENSSL_STRING_set_cmp_func(st, cmp) \ |
| 2100 | ((int (*)(const void * const *,const void * const *)) \ | 2099 | ((int (*)(const char * const *,const char * const *)) \ |
| 2101 | sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp))) | 2100 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st), CHECKED_SK_CMP_FUNC(char, cmp))) |
| 2102 | #define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st) | 2101 | #define sk_OPENSSL_STRING_dup(st) SKM_sk_dup(OPENSSL_STRING, st) |
| 2103 | #define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st)) | 2102 | #define sk_OPENSSL_STRING_shift(st) SKM_sk_shift(OPENSSL_STRING, (st)) |
| 2104 | #define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st)) | 2103 | #define sk_OPENSSL_STRING_pop(st) (char *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF(OPENSSL_STRING), st)) |
| 2105 | #define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st)) | 2104 | #define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st)) |
| 2106 | #define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st)) | 2105 | #define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st)) |
| 2107 | 2106 | ||
| 2108 | 2107 | ||
| 2109 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ | 2108 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \ |
diff --git a/src/lib/libcrypto/store/Makefile b/src/lib/libcrypto/store/Makefile new file mode 100644 index 0000000000..0dcfd7857a --- /dev/null +++ b/src/lib/libcrypto/store/Makefile | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/store/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= store | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | #TEST= storetest.c | ||
| 17 | TEST= | ||
| 18 | APPS= | ||
| 19 | |||
| 20 | LIB=$(TOP)/libcrypto.a | ||
| 21 | LIBSRC= str_err.c str_lib.c str_meth.c str_mem.c | ||
| 22 | LIBOBJ= str_err.o str_lib.o str_meth.o str_mem.o | ||
| 23 | |||
| 24 | SRC= $(LIBSRC) | ||
| 25 | |||
| 26 | #EXHEADER= store.h str_compat.h | ||
| 27 | EXHEADER= store.h | ||
| 28 | HEADER= $(EXHEADER) str_locl.h | ||
| 29 | |||
| 30 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 31 | |||
| 32 | top: | ||
| 33 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 34 | |||
| 35 | all: lib | ||
| 36 | |||
| 37 | lib: $(LIBOBJ) | ||
| 38 | $(AR) $(LIB) $(LIBOBJ) | ||
| 39 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 40 | @touch lib | ||
| 41 | |||
| 42 | files: | ||
| 43 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 44 | |||
| 45 | links: | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 47 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 49 | |||
| 50 | install: | ||
| 51 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 52 | @headerlist="$(EXHEADER)"; for i in $$headerlist; \ | ||
| 53 | do \ | ||
| 54 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 55 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 56 | done; | ||
| 57 | |||
| 58 | tags: | ||
| 59 | ctags $(SRC) | ||
| 60 | |||
| 61 | tests: | ||
| 62 | |||
| 63 | lint: | ||
| 64 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 65 | |||
| 66 | depend: | ||
| 67 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 68 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 69 | |||
| 70 | dclean: | ||
| 71 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 72 | mv -f Makefile.new $(MAKEFILE) | ||
| 73 | |||
| 74 | clean: | ||
| 75 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 76 | |||
| 77 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 78 | |||
| 79 | str_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 80 | str_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 81 | str_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 82 | str_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 83 | str_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 84 | str_err.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h | ||
| 85 | str_err.o: str_err.c | ||
| 86 | str_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 87 | str_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 88 | str_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 89 | str_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 90 | str_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 91 | str_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 92 | str_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 93 | str_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 94 | str_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 95 | str_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 96 | str_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 97 | str_lib.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h | ||
| 98 | str_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 99 | str_lib.o: str_lib.c str_locl.h | ||
| 100 | str_mem.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 101 | str_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 102 | str_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 103 | str_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 104 | str_mem.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 105 | str_mem.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h | ||
| 106 | str_mem.o: str_locl.h str_mem.c | ||
| 107 | str_meth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 108 | str_meth.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 109 | str_meth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 110 | str_meth.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 111 | str_meth.o: ../../include/openssl/store.h ../../include/openssl/symhacks.h | ||
| 112 | str_meth.o: str_locl.h str_meth.c | ||
diff --git a/src/lib/libcrypto/store/README b/src/lib/libcrypto/store/README new file mode 100644 index 0000000000..966168f6a5 --- /dev/null +++ b/src/lib/libcrypto/store/README | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | The STORE type | ||
| 2 | ============== | ||
| 3 | |||
| 4 | A STORE, as defined in this code section, is really a rather simple | ||
| 5 | thing which stores objects and per-object associations to a number | ||
| 6 | of attributes. What attributes are supported entirely depends on | ||
| 7 | the particular implementation of a STORE. It has some support for | ||
| 8 | generation of certain objects (for example, keys and CRLs). | ||
| 9 | |||
| 10 | |||
| 11 | Supported object types | ||
| 12 | ---------------------- | ||
| 13 | |||
| 14 | For now, the objects that are supported are the following: | ||
| 15 | |||
| 16 | X.509 certificate | ||
| 17 | X.509 CRL | ||
| 18 | private key | ||
| 19 | public key | ||
| 20 | number | ||
| 21 | arbitrary (application) data | ||
| 22 | |||
| 23 | The intention is that a STORE should be able to store everything | ||
| 24 | needed by an application that wants a cert/key store, as well as | ||
| 25 | the data a CA might need to store (this includes the serial number | ||
| 26 | counter, which explains the support for numbers). | ||
| 27 | |||
| 28 | |||
| 29 | Supported attribute types | ||
| 30 | ------------------------- | ||
| 31 | |||
| 32 | For now, the following attributes are supported: | ||
| 33 | |||
| 34 | Friendly Name - the value is a normal C string | ||
| 35 | Key ID - the value is a 160 bit SHA1 hash | ||
| 36 | Issuer Key ID - the value is a 160 bit SHA1 hash | ||
| 37 | Subject Key ID - the value is a 160 bit SHA1 hash | ||
| 38 | Issuer/Serial Hash - the value is a 160 bit SHA1 hash | ||
| 39 | Issuer - the value is a X509_NAME | ||
| 40 | Serial - the value is a BIGNUM | ||
| 41 | Subject - the value is a X509_NAME | ||
| 42 | Certificate Hash - the value is a 160 bit SHA1 hash | ||
| 43 | Email - the value is a normal C string | ||
| 44 | Filename - the value is a normal C string | ||
| 45 | |||
| 46 | It is expected that these attributes should be enough to support | ||
| 47 | the need from most, if not all, current applications. Applications | ||
| 48 | that need to do certificate verification would typically use Subject | ||
| 49 | Key ID, Issuer/Serial Hash or Subject to look up issuer certificates. | ||
| 50 | S/MIME applications would typically use Email to look up recipient | ||
| 51 | and signer certificates. | ||
| 52 | |||
| 53 | There's added support for combined sets of attributes to search for, | ||
| 54 | with the special OR attribute. | ||
| 55 | |||
| 56 | |||
| 57 | Supported basic functionality | ||
| 58 | ----------------------------- | ||
| 59 | |||
| 60 | The functions that are supported through the STORE type are these: | ||
| 61 | |||
| 62 | generate_object - for example to generate keys and CRLs | ||
| 63 | get_object - to look up one object | ||
| 64 | NOTE: this function is really rather | ||
| 65 | redundant and probably of lesser usage | ||
| 66 | than the list functions | ||
| 67 | store_object - store an object and the attributes | ||
| 68 | associated with it | ||
| 69 | modify_object - modify the attributes associated with | ||
| 70 | a specific object | ||
| 71 | revoke_object - revoke an object | ||
| 72 | NOTE: this only marks an object as | ||
| 73 | invalid, it doesn't remove the object | ||
| 74 | from the database | ||
| 75 | delete_object - remove an object from the database | ||
| 76 | list_object - list objects associated with a given | ||
| 77 | set of attributes | ||
| 78 | NOTE: this is really four functions: | ||
| 79 | list_start, list_next, list_end and | ||
| 80 | list_endp | ||
| 81 | update_store - update the internal data of the store | ||
| 82 | lock_store - lock the store | ||
| 83 | unlock_store - unlock the store | ||
| 84 | |||
| 85 | The list functions need some extra explanation: list_start is | ||
| 86 | used to set up a lookup. That's where the attributes to use in | ||
| 87 | the search are set up. It returns a search context. list_next | ||
| 88 | returns the next object searched for. list_end closes the search. | ||
| 89 | list_endp is used to check if we have reached the end. | ||
| 90 | |||
| 91 | A few words on the store functions as well: update_store is | ||
| 92 | typically used by a CA application to update the internal | ||
| 93 | structure of a database. This may for example involve automatic | ||
| 94 | removal of expired certificates. lock_store and unlock_store | ||
| 95 | are used for locking a store to allow exclusive writes. | ||
diff --git a/src/lib/libcrypto/store/store.h b/src/lib/libcrypto/store/store.h new file mode 100644 index 0000000000..0a28c7d5a2 --- /dev/null +++ b/src/lib/libcrypto/store/store.h | |||
| @@ -0,0 +1,561 @@ | |||
| 1 | /* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2003. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_STORE_H | ||
| 60 | #define HEADER_STORE_H | ||
| 61 | |||
| 62 | #include <openssl/opensslconf.h> | ||
| 63 | |||
| 64 | #ifdef OPENSSL_NO_STORE | ||
| 65 | #error STORE is disabled. | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #include <openssl/ossl_typ.h> | ||
| 69 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 70 | #include <openssl/evp.h> | ||
| 71 | #include <openssl/bn.h> | ||
| 72 | #include <openssl/x509.h> | ||
| 73 | #endif | ||
| 74 | |||
| 75 | #ifdef __cplusplus | ||
| 76 | extern "C" { | ||
| 77 | #endif | ||
| 78 | |||
| 79 | /* Already defined in ossl_typ.h */ | ||
| 80 | /* typedef struct store_st STORE; */ | ||
| 81 | /* typedef struct store_method_st STORE_METHOD; */ | ||
| 82 | |||
| 83 | |||
| 84 | /* All the following functions return 0, a negative number or NULL on error. | ||
| 85 | When everything is fine, they return a positive value or a non-NULL | ||
| 86 | pointer, all depending on their purpose. */ | ||
| 87 | |||
| 88 | /* Creators and destructor. */ | ||
| 89 | STORE *STORE_new_method(const STORE_METHOD *method); | ||
| 90 | STORE *STORE_new_engine(ENGINE *engine); | ||
| 91 | void STORE_free(STORE *ui); | ||
| 92 | |||
| 93 | |||
| 94 | /* Give a user interface parametrised control commands. This can be used to | ||
| 95 | send down an integer, a data pointer or a function pointer, as well as | ||
| 96 | be used to get information from a STORE. */ | ||
| 97 | int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)); | ||
| 98 | |||
| 99 | /* A control to set the directory with keys and certificates. Used by the | ||
| 100 | built-in directory level method. */ | ||
| 101 | #define STORE_CTRL_SET_DIRECTORY 0x0001 | ||
| 102 | /* A control to set a file to load. Used by the built-in file level method. */ | ||
| 103 | #define STORE_CTRL_SET_FILE 0x0002 | ||
| 104 | /* A control to set a configuration file to load. Can be used by any method | ||
| 105 | that wishes to load a configuration file. */ | ||
| 106 | #define STORE_CTRL_SET_CONF_FILE 0x0003 | ||
| 107 | /* A control to set a the section of the loaded configuration file. Can be | ||
| 108 | used by any method that wishes to load a configuration file. */ | ||
| 109 | #define STORE_CTRL_SET_CONF_SECTION 0x0004 | ||
| 110 | |||
| 111 | |||
| 112 | /* Some methods may use extra data */ | ||
| 113 | #define STORE_set_app_data(s,arg) STORE_set_ex_data(s,0,arg) | ||
| 114 | #define STORE_get_app_data(s) STORE_get_ex_data(s,0) | ||
| 115 | int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
| 116 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | ||
| 117 | int STORE_set_ex_data(STORE *r,int idx,void *arg); | ||
| 118 | void *STORE_get_ex_data(STORE *r, int idx); | ||
| 119 | |||
| 120 | /* Use specific methods instead of the built-in one */ | ||
| 121 | const STORE_METHOD *STORE_get_method(STORE *store); | ||
| 122 | const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth); | ||
| 123 | |||
| 124 | /* The standard OpenSSL methods. */ | ||
| 125 | /* This is the in-memory method. It does everything except revoking and updating, | ||
| 126 | and is of course volatile. It's used by other methods that have an in-memory | ||
| 127 | cache. */ | ||
| 128 | const STORE_METHOD *STORE_Memory(void); | ||
| 129 | #if 0 /* Not yet implemented */ | ||
| 130 | /* This is the directory store. It does everything except revoking and updating, | ||
| 131 | and uses STORE_Memory() to cache things in memory. */ | ||
| 132 | const STORE_METHOD *STORE_Directory(void); | ||
| 133 | /* This is the file store. It does everything except revoking and updating, | ||
| 134 | and uses STORE_Memory() to cache things in memory. Certificates are added | ||
| 135 | to it with the store operation, and it will only get cached certificates. */ | ||
| 136 | const STORE_METHOD *STORE_File(void); | ||
| 137 | #endif | ||
| 138 | |||
| 139 | /* Store functions take a type code for the type of data they should store | ||
| 140 | or fetch */ | ||
| 141 | typedef enum STORE_object_types | ||
| 142 | { | ||
| 143 | STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */ | ||
| 144 | STORE_OBJECT_TYPE_X509_CRL= 0x02, /* X509_CRL * */ | ||
| 145 | STORE_OBJECT_TYPE_PRIVATE_KEY= 0x03, /* EVP_PKEY * */ | ||
| 146 | STORE_OBJECT_TYPE_PUBLIC_KEY= 0x04, /* EVP_PKEY * */ | ||
| 147 | STORE_OBJECT_TYPE_NUMBER= 0x05, /* BIGNUM * */ | ||
| 148 | STORE_OBJECT_TYPE_ARBITRARY= 0x06, /* BUF_MEM * */ | ||
| 149 | STORE_OBJECT_TYPE_NUM= 0x06 /* The amount of known | ||
| 150 | object types */ | ||
| 151 | } STORE_OBJECT_TYPES; | ||
| 152 | /* List of text strings corresponding to the object types. */ | ||
| 153 | extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1]; | ||
| 154 | |||
| 155 | /* Some store functions take a parameter list. Those parameters come with | ||
| 156 | one of the following codes. The comments following the codes below indicate | ||
| 157 | what type the value should be a pointer to. */ | ||
| 158 | typedef enum STORE_params | ||
| 159 | { | ||
| 160 | STORE_PARAM_EVP_TYPE= 0x01, /* int */ | ||
| 161 | STORE_PARAM_BITS= 0x02, /* size_t */ | ||
| 162 | STORE_PARAM_KEY_PARAMETERS= 0x03, /* ??? */ | ||
| 163 | STORE_PARAM_KEY_NO_PARAMETERS= 0x04, /* N/A */ | ||
| 164 | STORE_PARAM_AUTH_PASSPHRASE= 0x05, /* char * */ | ||
| 165 | STORE_PARAM_AUTH_KRB5_TICKET= 0x06, /* void * */ | ||
| 166 | STORE_PARAM_TYPE_NUM= 0x06 /* The amount of known | ||
| 167 | parameter types */ | ||
| 168 | } STORE_PARAM_TYPES; | ||
| 169 | /* Parameter value sizes. -1 means unknown, anything else is the required size. */ | ||
| 170 | extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1]; | ||
| 171 | |||
| 172 | /* Store functions take attribute lists. Those attributes come with codes. | ||
| 173 | The comments following the codes below indicate what type the value should | ||
| 174 | be a pointer to. */ | ||
| 175 | typedef enum STORE_attribs | ||
| 176 | { | ||
| 177 | STORE_ATTR_END= 0x00, | ||
| 178 | STORE_ATTR_FRIENDLYNAME= 0x01, /* C string */ | ||
| 179 | STORE_ATTR_KEYID= 0x02, /* 160 bit string (SHA1) */ | ||
| 180 | STORE_ATTR_ISSUERKEYID= 0x03, /* 160 bit string (SHA1) */ | ||
| 181 | STORE_ATTR_SUBJECTKEYID= 0x04, /* 160 bit string (SHA1) */ | ||
| 182 | STORE_ATTR_ISSUERSERIALHASH= 0x05, /* 160 bit string (SHA1) */ | ||
| 183 | STORE_ATTR_ISSUER= 0x06, /* X509_NAME * */ | ||
| 184 | STORE_ATTR_SERIAL= 0x07, /* BIGNUM * */ | ||
| 185 | STORE_ATTR_SUBJECT= 0x08, /* X509_NAME * */ | ||
| 186 | STORE_ATTR_CERTHASH= 0x09, /* 160 bit string (SHA1) */ | ||
| 187 | STORE_ATTR_EMAIL= 0x0a, /* C string */ | ||
| 188 | STORE_ATTR_FILENAME= 0x0b, /* C string */ | ||
| 189 | STORE_ATTR_TYPE_NUM= 0x0b, /* The amount of known | ||
| 190 | attribute types */ | ||
| 191 | STORE_ATTR_OR= 0xff /* This is a special | ||
| 192 | separator, which | ||
| 193 | expresses the OR | ||
| 194 | operation. */ | ||
| 195 | } STORE_ATTR_TYPES; | ||
| 196 | /* Attribute value sizes. -1 means unknown, anything else is the required size. */ | ||
| 197 | extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1]; | ||
| 198 | |||
| 199 | typedef enum STORE_certificate_status | ||
| 200 | { | ||
| 201 | STORE_X509_VALID= 0x00, | ||
| 202 | STORE_X509_EXPIRED= 0x01, | ||
| 203 | STORE_X509_SUSPENDED= 0x02, | ||
| 204 | STORE_X509_REVOKED= 0x03 | ||
| 205 | } STORE_CERTIFICATE_STATUS; | ||
| 206 | |||
| 207 | /* Engine store functions will return a structure that contains all the necessary | ||
| 208 | * information, including revokation status for certificates. This is really not | ||
| 209 | * needed for application authors, as the ENGINE framework functions will extract | ||
| 210 | * the OpenSSL-specific information when at all possible. However, for engine | ||
| 211 | * authors, it's crucial to know this structure. */ | ||
| 212 | typedef struct STORE_OBJECT_st | ||
| 213 | { | ||
| 214 | STORE_OBJECT_TYPES type; | ||
| 215 | union | ||
| 216 | { | ||
| 217 | struct | ||
| 218 | { | ||
| 219 | STORE_CERTIFICATE_STATUS status; | ||
| 220 | X509 *certificate; | ||
| 221 | } x509; | ||
| 222 | X509_CRL *crl; | ||
| 223 | EVP_PKEY *key; | ||
| 224 | BIGNUM *number; | ||
| 225 | BUF_MEM *arbitrary; | ||
| 226 | } data; | ||
| 227 | } STORE_OBJECT; | ||
| 228 | DECLARE_STACK_OF(STORE_OBJECT) | ||
| 229 | STORE_OBJECT *STORE_OBJECT_new(void); | ||
| 230 | void STORE_OBJECT_free(STORE_OBJECT *data); | ||
| 231 | |||
| 232 | |||
| 233 | |||
| 234 | /* The following functions handle the storage. They return 0, a negative number | ||
| 235 | or NULL on error, anything else on success. */ | ||
| 236 | X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[], | ||
| 237 | OPENSSL_ITEM parameters[]); | ||
| 238 | int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[], | ||
| 239 | OPENSSL_ITEM parameters[]); | ||
| 240 | int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[], | ||
| 241 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 242 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 243 | int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[], | ||
| 244 | OPENSSL_ITEM parameters[]); | ||
| 245 | int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[], | ||
| 246 | OPENSSL_ITEM parameters[]); | ||
| 247 | void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[], | ||
| 248 | OPENSSL_ITEM parameters[]); | ||
| 249 | X509 *STORE_list_certificate_next(STORE *e, void *handle); | ||
| 250 | int STORE_list_certificate_end(STORE *e, void *handle); | ||
| 251 | int STORE_list_certificate_endp(STORE *e, void *handle); | ||
| 252 | EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 253 | OPENSSL_ITEM parameters[]); | ||
| 254 | EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 255 | OPENSSL_ITEM parameters[]); | ||
| 256 | int STORE_store_private_key(STORE *e, EVP_PKEY *data, | ||
| 257 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 258 | int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[], | ||
| 259 | OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], | ||
| 260 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 261 | int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 262 | OPENSSL_ITEM parameters[]); | ||
| 263 | int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 264 | OPENSSL_ITEM parameters[]); | ||
| 265 | void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[], | ||
| 266 | OPENSSL_ITEM parameters[]); | ||
| 267 | EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle); | ||
| 268 | int STORE_list_private_key_end(STORE *e, void *handle); | ||
| 269 | int STORE_list_private_key_endp(STORE *e, void *handle); | ||
| 270 | EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 271 | OPENSSL_ITEM parameters[]); | ||
| 272 | int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[], | ||
| 273 | OPENSSL_ITEM parameters[]); | ||
| 274 | int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[], | ||
| 275 | OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], | ||
| 276 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 277 | int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 278 | OPENSSL_ITEM parameters[]); | ||
| 279 | int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[], | ||
| 280 | OPENSSL_ITEM parameters[]); | ||
| 281 | void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[], | ||
| 282 | OPENSSL_ITEM parameters[]); | ||
| 283 | EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle); | ||
| 284 | int STORE_list_public_key_end(STORE *e, void *handle); | ||
| 285 | int STORE_list_public_key_endp(STORE *e, void *handle); | ||
| 286 | X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[], | ||
| 287 | OPENSSL_ITEM parameters[]); | ||
| 288 | X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[], | ||
| 289 | OPENSSL_ITEM parameters[]); | ||
| 290 | int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[], | ||
| 291 | OPENSSL_ITEM parameters[]); | ||
| 292 | int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[], | ||
| 293 | OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], | ||
| 294 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 295 | int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[], | ||
| 296 | OPENSSL_ITEM parameters[]); | ||
| 297 | void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[], | ||
| 298 | OPENSSL_ITEM parameters[]); | ||
| 299 | X509_CRL *STORE_list_crl_next(STORE *e, void *handle); | ||
| 300 | int STORE_list_crl_end(STORE *e, void *handle); | ||
| 301 | int STORE_list_crl_endp(STORE *e, void *handle); | ||
| 302 | int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[], | ||
| 303 | OPENSSL_ITEM parameters[]); | ||
| 304 | int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[], | ||
| 305 | OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], | ||
| 306 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 307 | BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[], | ||
| 308 | OPENSSL_ITEM parameters[]); | ||
| 309 | int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[], | ||
| 310 | OPENSSL_ITEM parameters[]); | ||
| 311 | int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[], | ||
| 312 | OPENSSL_ITEM parameters[]); | ||
| 313 | int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[], | ||
| 314 | OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[], | ||
| 315 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 316 | BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[], | ||
| 317 | OPENSSL_ITEM parameters[]); | ||
| 318 | int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[], | ||
| 319 | OPENSSL_ITEM parameters[]); | ||
| 320 | |||
| 321 | |||
| 322 | /* Create and manipulate methods */ | ||
| 323 | STORE_METHOD *STORE_create_method(char *name); | ||
| 324 | void STORE_destroy_method(STORE_METHOD *store_method); | ||
| 325 | |||
| 326 | /* These callback types are use for store handlers */ | ||
| 327 | typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *); | ||
| 328 | typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *); | ||
| 329 | typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 330 | typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 331 | typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 332 | typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle); | ||
| 333 | typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle); | ||
| 334 | typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 335 | typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 336 | typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]); | ||
| 337 | typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 338 | typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void)); | ||
| 339 | |||
| 340 | int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f); | ||
| 341 | int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f); | ||
| 342 | int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f); | ||
| 343 | int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f); | ||
| 344 | int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f); | ||
| 345 | int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f); | ||
| 346 | int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f); | ||
| 347 | int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f); | ||
| 348 | int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f); | ||
| 349 | int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f); | ||
| 350 | int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f); | ||
| 351 | int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); | ||
| 352 | int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); | ||
| 353 | int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR); | ||
| 354 | int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f); | ||
| 355 | |||
| 356 | STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm); | ||
| 357 | STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm); | ||
| 358 | STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm); | ||
| 359 | STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm); | ||
| 360 | STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm); | ||
| 361 | STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm); | ||
| 362 | STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm); | ||
| 363 | STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm); | ||
| 364 | STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm); | ||
| 365 | STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm); | ||
| 366 | STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm); | ||
| 367 | STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm); | ||
| 368 | STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm); | ||
| 369 | STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm); | ||
| 370 | STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm); | ||
| 371 | |||
| 372 | /* Method helper structures and functions. */ | ||
| 373 | |||
| 374 | /* This structure is the result of parsing through the information in a list | ||
| 375 | of OPENSSL_ITEMs. It stores all the necessary information in a structured | ||
| 376 | way.*/ | ||
| 377 | typedef struct STORE_attr_info_st STORE_ATTR_INFO; | ||
| 378 | |||
| 379 | /* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO. | ||
| 380 | Note that we do this in the list form, since the list of OPENSSL_ITEMs can | ||
| 381 | come in blocks separated with STORE_ATTR_OR. Note that the value returned | ||
| 382 | by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */ | ||
| 383 | void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes); | ||
| 384 | STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle); | ||
| 385 | int STORE_parse_attrs_end(void *handle); | ||
| 386 | int STORE_parse_attrs_endp(void *handle); | ||
| 387 | |||
| 388 | /* Creator and destructor */ | ||
| 389 | STORE_ATTR_INFO *STORE_ATTR_INFO_new(void); | ||
| 390 | int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs); | ||
| 391 | |||
| 392 | /* Manipulators */ | ||
| 393 | char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); | ||
| 394 | unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs, | ||
| 395 | STORE_ATTR_TYPES code); | ||
| 396 | X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); | ||
| 397 | BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code); | ||
| 398 | int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 399 | char *cstr, size_t cstr_size); | ||
| 400 | int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 401 | unsigned char *sha1str, size_t sha1str_size); | ||
| 402 | int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 403 | X509_NAME *dn); | ||
| 404 | int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 405 | BIGNUM *number); | ||
| 406 | int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 407 | char *cstr, size_t cstr_size); | ||
| 408 | int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 409 | unsigned char *sha1str, size_t sha1str_size); | ||
| 410 | int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 411 | X509_NAME *dn); | ||
| 412 | int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 413 | BIGNUM *number); | ||
| 414 | |||
| 415 | /* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values | ||
| 416 | in each contained attribute. */ | ||
| 417 | int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, | ||
| 418 | const STORE_ATTR_INFO * const *b); | ||
| 419 | /* Check if the set of attributes in a is within the range of attributes | ||
| 420 | set in b. */ | ||
| 421 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | ||
| 422 | /* Check if the set of attributes in a are also set in b. */ | ||
| 423 | int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | ||
| 424 | /* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */ | ||
| 425 | int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b); | ||
| 426 | |||
| 427 | |||
| 428 | /* BEGIN ERROR CODES */ | ||
| 429 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 430 | * made after this point may be overwritten when the script is next run. | ||
| 431 | */ | ||
| 432 | void ERR_load_STORE_strings(void); | ||
| 433 | |||
| 434 | /* Error codes for the STORE functions. */ | ||
| 435 | |||
| 436 | /* Function codes. */ | ||
| 437 | #define STORE_F_MEM_DELETE 134 | ||
| 438 | #define STORE_F_MEM_GENERATE 135 | ||
| 439 | #define STORE_F_MEM_LIST_END 168 | ||
| 440 | #define STORE_F_MEM_LIST_NEXT 136 | ||
| 441 | #define STORE_F_MEM_LIST_START 137 | ||
| 442 | #define STORE_F_MEM_MODIFY 169 | ||
| 443 | #define STORE_F_MEM_STORE 138 | ||
| 444 | #define STORE_F_STORE_ATTR_INFO_GET0_CSTR 139 | ||
| 445 | #define STORE_F_STORE_ATTR_INFO_GET0_DN 140 | ||
| 446 | #define STORE_F_STORE_ATTR_INFO_GET0_NUMBER 141 | ||
| 447 | #define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR 142 | ||
| 448 | #define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR 143 | ||
| 449 | #define STORE_F_STORE_ATTR_INFO_MODIFY_DN 144 | ||
| 450 | #define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER 145 | ||
| 451 | #define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR 146 | ||
| 452 | #define STORE_F_STORE_ATTR_INFO_SET_CSTR 147 | ||
| 453 | #define STORE_F_STORE_ATTR_INFO_SET_DN 148 | ||
| 454 | #define STORE_F_STORE_ATTR_INFO_SET_NUMBER 149 | ||
| 455 | #define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150 | ||
| 456 | #define STORE_F_STORE_CERTIFICATE 170 | ||
| 457 | #define STORE_F_STORE_CTRL 161 | ||
| 458 | #define STORE_F_STORE_DELETE_ARBITRARY 158 | ||
| 459 | #define STORE_F_STORE_DELETE_CERTIFICATE 102 | ||
| 460 | #define STORE_F_STORE_DELETE_CRL 103 | ||
| 461 | #define STORE_F_STORE_DELETE_NUMBER 104 | ||
| 462 | #define STORE_F_STORE_DELETE_PRIVATE_KEY 105 | ||
| 463 | #define STORE_F_STORE_DELETE_PUBLIC_KEY 106 | ||
| 464 | #define STORE_F_STORE_GENERATE_CRL 107 | ||
| 465 | #define STORE_F_STORE_GENERATE_KEY 108 | ||
| 466 | #define STORE_F_STORE_GET_ARBITRARY 159 | ||
| 467 | #define STORE_F_STORE_GET_CERTIFICATE 109 | ||
| 468 | #define STORE_F_STORE_GET_CRL 110 | ||
| 469 | #define STORE_F_STORE_GET_NUMBER 111 | ||
| 470 | #define STORE_F_STORE_GET_PRIVATE_KEY 112 | ||
| 471 | #define STORE_F_STORE_GET_PUBLIC_KEY 113 | ||
| 472 | #define STORE_F_STORE_LIST_CERTIFICATE_END 114 | ||
| 473 | #define STORE_F_STORE_LIST_CERTIFICATE_ENDP 153 | ||
| 474 | #define STORE_F_STORE_LIST_CERTIFICATE_NEXT 115 | ||
| 475 | #define STORE_F_STORE_LIST_CERTIFICATE_START 116 | ||
| 476 | #define STORE_F_STORE_LIST_CRL_END 117 | ||
| 477 | #define STORE_F_STORE_LIST_CRL_ENDP 154 | ||
| 478 | #define STORE_F_STORE_LIST_CRL_NEXT 118 | ||
| 479 | #define STORE_F_STORE_LIST_CRL_START 119 | ||
| 480 | #define STORE_F_STORE_LIST_PRIVATE_KEY_END 120 | ||
| 481 | #define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP 155 | ||
| 482 | #define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT 121 | ||
| 483 | #define STORE_F_STORE_LIST_PRIVATE_KEY_START 122 | ||
| 484 | #define STORE_F_STORE_LIST_PUBLIC_KEY_END 123 | ||
| 485 | #define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156 | ||
| 486 | #define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124 | ||
| 487 | #define STORE_F_STORE_LIST_PUBLIC_KEY_START 125 | ||
| 488 | #define STORE_F_STORE_MODIFY_ARBITRARY 162 | ||
| 489 | #define STORE_F_STORE_MODIFY_CERTIFICATE 163 | ||
| 490 | #define STORE_F_STORE_MODIFY_CRL 164 | ||
| 491 | #define STORE_F_STORE_MODIFY_NUMBER 165 | ||
| 492 | #define STORE_F_STORE_MODIFY_PRIVATE_KEY 166 | ||
| 493 | #define STORE_F_STORE_MODIFY_PUBLIC_KEY 167 | ||
| 494 | #define STORE_F_STORE_NEW_ENGINE 133 | ||
| 495 | #define STORE_F_STORE_NEW_METHOD 132 | ||
| 496 | #define STORE_F_STORE_PARSE_ATTRS_END 151 | ||
| 497 | #define STORE_F_STORE_PARSE_ATTRS_ENDP 172 | ||
| 498 | #define STORE_F_STORE_PARSE_ATTRS_NEXT 152 | ||
| 499 | #define STORE_F_STORE_PARSE_ATTRS_START 171 | ||
| 500 | #define STORE_F_STORE_REVOKE_CERTIFICATE 129 | ||
| 501 | #define STORE_F_STORE_REVOKE_PRIVATE_KEY 130 | ||
| 502 | #define STORE_F_STORE_REVOKE_PUBLIC_KEY 131 | ||
| 503 | #define STORE_F_STORE_STORE_ARBITRARY 157 | ||
| 504 | #define STORE_F_STORE_STORE_CERTIFICATE 100 | ||
| 505 | #define STORE_F_STORE_STORE_CRL 101 | ||
| 506 | #define STORE_F_STORE_STORE_NUMBER 126 | ||
| 507 | #define STORE_F_STORE_STORE_PRIVATE_KEY 127 | ||
| 508 | #define STORE_F_STORE_STORE_PUBLIC_KEY 128 | ||
| 509 | |||
| 510 | /* Reason codes. */ | ||
| 511 | #define STORE_R_ALREADY_HAS_A_VALUE 127 | ||
| 512 | #define STORE_R_FAILED_DELETING_ARBITRARY 132 | ||
| 513 | #define STORE_R_FAILED_DELETING_CERTIFICATE 100 | ||
| 514 | #define STORE_R_FAILED_DELETING_KEY 101 | ||
| 515 | #define STORE_R_FAILED_DELETING_NUMBER 102 | ||
| 516 | #define STORE_R_FAILED_GENERATING_CRL 103 | ||
| 517 | #define STORE_R_FAILED_GENERATING_KEY 104 | ||
| 518 | #define STORE_R_FAILED_GETTING_ARBITRARY 133 | ||
| 519 | #define STORE_R_FAILED_GETTING_CERTIFICATE 105 | ||
| 520 | #define STORE_R_FAILED_GETTING_KEY 106 | ||
| 521 | #define STORE_R_FAILED_GETTING_NUMBER 107 | ||
| 522 | #define STORE_R_FAILED_LISTING_CERTIFICATES 108 | ||
| 523 | #define STORE_R_FAILED_LISTING_KEYS 109 | ||
| 524 | #define STORE_R_FAILED_MODIFYING_ARBITRARY 138 | ||
| 525 | #define STORE_R_FAILED_MODIFYING_CERTIFICATE 139 | ||
| 526 | #define STORE_R_FAILED_MODIFYING_CRL 140 | ||
| 527 | #define STORE_R_FAILED_MODIFYING_NUMBER 141 | ||
| 528 | #define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142 | ||
| 529 | #define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143 | ||
| 530 | #define STORE_R_FAILED_REVOKING_CERTIFICATE 110 | ||
| 531 | #define STORE_R_FAILED_REVOKING_KEY 111 | ||
| 532 | #define STORE_R_FAILED_STORING_ARBITRARY 134 | ||
| 533 | #define STORE_R_FAILED_STORING_CERTIFICATE 112 | ||
| 534 | #define STORE_R_FAILED_STORING_KEY 113 | ||
| 535 | #define STORE_R_FAILED_STORING_NUMBER 114 | ||
| 536 | #define STORE_R_NOT_IMPLEMENTED 128 | ||
| 537 | #define STORE_R_NO_CONTROL_FUNCTION 144 | ||
| 538 | #define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135 | ||
| 539 | #define STORE_R_NO_DELETE_NUMBER_FUNCTION 115 | ||
| 540 | #define STORE_R_NO_DELETE_OBJECT_FUNCTION 116 | ||
| 541 | #define STORE_R_NO_GENERATE_CRL_FUNCTION 117 | ||
| 542 | #define STORE_R_NO_GENERATE_OBJECT_FUNCTION 118 | ||
| 543 | #define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION 136 | ||
| 544 | #define STORE_R_NO_GET_OBJECT_FUNCTION 119 | ||
| 545 | #define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION 120 | ||
| 546 | #define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION 131 | ||
| 547 | #define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121 | ||
| 548 | #define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122 | ||
| 549 | #define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123 | ||
| 550 | #define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145 | ||
| 551 | #define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124 | ||
| 552 | #define STORE_R_NO_STORE 129 | ||
| 553 | #define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137 | ||
| 554 | #define STORE_R_NO_STORE_OBJECT_FUNCTION 125 | ||
| 555 | #define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION 126 | ||
| 556 | #define STORE_R_NO_VALUE 130 | ||
| 557 | |||
| 558 | #ifdef __cplusplus | ||
| 559 | } | ||
| 560 | #endif | ||
| 561 | #endif | ||
diff --git a/src/lib/libcrypto/store/str_err.c b/src/lib/libcrypto/store/str_err.c new file mode 100644 index 0000000000..924edf0505 --- /dev/null +++ b/src/lib/libcrypto/store/str_err.c | |||
| @@ -0,0 +1,211 @@ | |||
| 1 | /* crypto/store/str_err.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * openssl-core@OpenSSL.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | /* NOTE: this file was auto generated by the mkerr.pl script: any changes | ||
| 57 | * made to it will be overwritten when the script next updates this file, | ||
| 58 | * only reason strings will be preserved. | ||
| 59 | */ | ||
| 60 | |||
| 61 | #include <stdio.h> | ||
| 62 | #include <openssl/err.h> | ||
| 63 | #include <openssl/store.h> | ||
| 64 | |||
| 65 | /* BEGIN ERROR CODES */ | ||
| 66 | #ifndef OPENSSL_NO_ERR | ||
| 67 | |||
| 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_STORE,func,0) | ||
| 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_STORE,0,reason) | ||
| 70 | |||
| 71 | static ERR_STRING_DATA STORE_str_functs[]= | ||
| 72 | { | ||
| 73 | {ERR_FUNC(STORE_F_MEM_DELETE), "MEM_DELETE"}, | ||
| 74 | {ERR_FUNC(STORE_F_MEM_GENERATE), "MEM_GENERATE"}, | ||
| 75 | {ERR_FUNC(STORE_F_MEM_LIST_END), "MEM_LIST_END"}, | ||
| 76 | {ERR_FUNC(STORE_F_MEM_LIST_NEXT), "MEM_LIST_NEXT"}, | ||
| 77 | {ERR_FUNC(STORE_F_MEM_LIST_START), "MEM_LIST_START"}, | ||
| 78 | {ERR_FUNC(STORE_F_MEM_MODIFY), "MEM_MODIFY"}, | ||
| 79 | {ERR_FUNC(STORE_F_MEM_STORE), "MEM_STORE"}, | ||
| 80 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_CSTR), "STORE_ATTR_INFO_get0_cstr"}, | ||
| 81 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_DN), "STORE_ATTR_INFO_get0_dn"}, | ||
| 82 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_NUMBER), "STORE_ATTR_INFO_get0_number"}, | ||
| 83 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_GET0_SHA1STR), "STORE_ATTR_INFO_get0_sha1str"}, | ||
| 84 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_CSTR), "STORE_ATTR_INFO_modify_cstr"}, | ||
| 85 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_DN), "STORE_ATTR_INFO_modify_dn"}, | ||
| 86 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER), "STORE_ATTR_INFO_modify_number"}, | ||
| 87 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR), "STORE_ATTR_INFO_modify_sha1str"}, | ||
| 88 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_CSTR), "STORE_ATTR_INFO_set_cstr"}, | ||
| 89 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_DN), "STORE_ATTR_INFO_set_dn"}, | ||
| 90 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_NUMBER), "STORE_ATTR_INFO_set_number"}, | ||
| 91 | {ERR_FUNC(STORE_F_STORE_ATTR_INFO_SET_SHA1STR), "STORE_ATTR_INFO_set_sha1str"}, | ||
| 92 | {ERR_FUNC(STORE_F_STORE_CERTIFICATE), "STORE_CERTIFICATE"}, | ||
| 93 | {ERR_FUNC(STORE_F_STORE_CTRL), "STORE_ctrl"}, | ||
| 94 | {ERR_FUNC(STORE_F_STORE_DELETE_ARBITRARY), "STORE_delete_arbitrary"}, | ||
| 95 | {ERR_FUNC(STORE_F_STORE_DELETE_CERTIFICATE), "STORE_delete_certificate"}, | ||
| 96 | {ERR_FUNC(STORE_F_STORE_DELETE_CRL), "STORE_delete_crl"}, | ||
| 97 | {ERR_FUNC(STORE_F_STORE_DELETE_NUMBER), "STORE_delete_number"}, | ||
| 98 | {ERR_FUNC(STORE_F_STORE_DELETE_PRIVATE_KEY), "STORE_delete_private_key"}, | ||
| 99 | {ERR_FUNC(STORE_F_STORE_DELETE_PUBLIC_KEY), "STORE_delete_public_key"}, | ||
| 100 | {ERR_FUNC(STORE_F_STORE_GENERATE_CRL), "STORE_generate_crl"}, | ||
| 101 | {ERR_FUNC(STORE_F_STORE_GENERATE_KEY), "STORE_generate_key"}, | ||
| 102 | {ERR_FUNC(STORE_F_STORE_GET_ARBITRARY), "STORE_get_arbitrary"}, | ||
| 103 | {ERR_FUNC(STORE_F_STORE_GET_CERTIFICATE), "STORE_get_certificate"}, | ||
| 104 | {ERR_FUNC(STORE_F_STORE_GET_CRL), "STORE_get_crl"}, | ||
| 105 | {ERR_FUNC(STORE_F_STORE_GET_NUMBER), "STORE_get_number"}, | ||
| 106 | {ERR_FUNC(STORE_F_STORE_GET_PRIVATE_KEY), "STORE_get_private_key"}, | ||
| 107 | {ERR_FUNC(STORE_F_STORE_GET_PUBLIC_KEY), "STORE_get_public_key"}, | ||
| 108 | {ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_END), "STORE_list_certificate_end"}, | ||
| 109 | {ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_ENDP), "STORE_list_certificate_endp"}, | ||
| 110 | {ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_NEXT), "STORE_list_certificate_next"}, | ||
| 111 | {ERR_FUNC(STORE_F_STORE_LIST_CERTIFICATE_START), "STORE_list_certificate_start"}, | ||
| 112 | {ERR_FUNC(STORE_F_STORE_LIST_CRL_END), "STORE_list_crl_end"}, | ||
| 113 | {ERR_FUNC(STORE_F_STORE_LIST_CRL_ENDP), "STORE_list_crl_endp"}, | ||
| 114 | {ERR_FUNC(STORE_F_STORE_LIST_CRL_NEXT), "STORE_list_crl_next"}, | ||
| 115 | {ERR_FUNC(STORE_F_STORE_LIST_CRL_START), "STORE_list_crl_start"}, | ||
| 116 | {ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_END), "STORE_list_private_key_end"}, | ||
| 117 | {ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_ENDP), "STORE_list_private_key_endp"}, | ||
| 118 | {ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_NEXT), "STORE_list_private_key_next"}, | ||
| 119 | {ERR_FUNC(STORE_F_STORE_LIST_PRIVATE_KEY_START), "STORE_list_private_key_start"}, | ||
| 120 | {ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_END), "STORE_list_public_key_end"}, | ||
| 121 | {ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_ENDP), "STORE_list_public_key_endp"}, | ||
| 122 | {ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_NEXT), "STORE_list_public_key_next"}, | ||
| 123 | {ERR_FUNC(STORE_F_STORE_LIST_PUBLIC_KEY_START), "STORE_list_public_key_start"}, | ||
| 124 | {ERR_FUNC(STORE_F_STORE_MODIFY_ARBITRARY), "STORE_modify_arbitrary"}, | ||
| 125 | {ERR_FUNC(STORE_F_STORE_MODIFY_CERTIFICATE), "STORE_modify_certificate"}, | ||
| 126 | {ERR_FUNC(STORE_F_STORE_MODIFY_CRL), "STORE_modify_crl"}, | ||
| 127 | {ERR_FUNC(STORE_F_STORE_MODIFY_NUMBER), "STORE_modify_number"}, | ||
| 128 | {ERR_FUNC(STORE_F_STORE_MODIFY_PRIVATE_KEY), "STORE_modify_private_key"}, | ||
| 129 | {ERR_FUNC(STORE_F_STORE_MODIFY_PUBLIC_KEY), "STORE_modify_public_key"}, | ||
| 130 | {ERR_FUNC(STORE_F_STORE_NEW_ENGINE), "STORE_new_engine"}, | ||
| 131 | {ERR_FUNC(STORE_F_STORE_NEW_METHOD), "STORE_new_method"}, | ||
| 132 | {ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_END), "STORE_parse_attrs_end"}, | ||
| 133 | {ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_ENDP), "STORE_parse_attrs_endp"}, | ||
| 134 | {ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_NEXT), "STORE_parse_attrs_next"}, | ||
| 135 | {ERR_FUNC(STORE_F_STORE_PARSE_ATTRS_START), "STORE_parse_attrs_start"}, | ||
| 136 | {ERR_FUNC(STORE_F_STORE_REVOKE_CERTIFICATE), "STORE_revoke_certificate"}, | ||
| 137 | {ERR_FUNC(STORE_F_STORE_REVOKE_PRIVATE_KEY), "STORE_revoke_private_key"}, | ||
| 138 | {ERR_FUNC(STORE_F_STORE_REVOKE_PUBLIC_KEY), "STORE_revoke_public_key"}, | ||
| 139 | {ERR_FUNC(STORE_F_STORE_STORE_ARBITRARY), "STORE_store_arbitrary"}, | ||
| 140 | {ERR_FUNC(STORE_F_STORE_STORE_CERTIFICATE), "STORE_store_certificate"}, | ||
| 141 | {ERR_FUNC(STORE_F_STORE_STORE_CRL), "STORE_store_crl"}, | ||
| 142 | {ERR_FUNC(STORE_F_STORE_STORE_NUMBER), "STORE_store_number"}, | ||
| 143 | {ERR_FUNC(STORE_F_STORE_STORE_PRIVATE_KEY), "STORE_store_private_key"}, | ||
| 144 | {ERR_FUNC(STORE_F_STORE_STORE_PUBLIC_KEY), "STORE_store_public_key"}, | ||
| 145 | {0,NULL} | ||
| 146 | }; | ||
| 147 | |||
| 148 | static ERR_STRING_DATA STORE_str_reasons[]= | ||
| 149 | { | ||
| 150 | {ERR_REASON(STORE_R_ALREADY_HAS_A_VALUE) ,"already has a value"}, | ||
| 151 | {ERR_REASON(STORE_R_FAILED_DELETING_ARBITRARY),"failed deleting arbitrary"}, | ||
| 152 | {ERR_REASON(STORE_R_FAILED_DELETING_CERTIFICATE),"failed deleting certificate"}, | ||
| 153 | {ERR_REASON(STORE_R_FAILED_DELETING_KEY) ,"failed deleting key"}, | ||
| 154 | {ERR_REASON(STORE_R_FAILED_DELETING_NUMBER),"failed deleting number"}, | ||
| 155 | {ERR_REASON(STORE_R_FAILED_GENERATING_CRL),"failed generating crl"}, | ||
| 156 | {ERR_REASON(STORE_R_FAILED_GENERATING_KEY),"failed generating key"}, | ||
| 157 | {ERR_REASON(STORE_R_FAILED_GETTING_ARBITRARY),"failed getting arbitrary"}, | ||
| 158 | {ERR_REASON(STORE_R_FAILED_GETTING_CERTIFICATE),"failed getting certificate"}, | ||
| 159 | {ERR_REASON(STORE_R_FAILED_GETTING_KEY) ,"failed getting key"}, | ||
| 160 | {ERR_REASON(STORE_R_FAILED_GETTING_NUMBER),"failed getting number"}, | ||
| 161 | {ERR_REASON(STORE_R_FAILED_LISTING_CERTIFICATES),"failed listing certificates"}, | ||
| 162 | {ERR_REASON(STORE_R_FAILED_LISTING_KEYS) ,"failed listing keys"}, | ||
| 163 | {ERR_REASON(STORE_R_FAILED_MODIFYING_ARBITRARY),"failed modifying arbitrary"}, | ||
| 164 | {ERR_REASON(STORE_R_FAILED_MODIFYING_CERTIFICATE),"failed modifying certificate"}, | ||
| 165 | {ERR_REASON(STORE_R_FAILED_MODIFYING_CRL),"failed modifying crl"}, | ||
| 166 | {ERR_REASON(STORE_R_FAILED_MODIFYING_NUMBER),"failed modifying number"}, | ||
| 167 | {ERR_REASON(STORE_R_FAILED_MODIFYING_PRIVATE_KEY),"failed modifying private key"}, | ||
| 168 | {ERR_REASON(STORE_R_FAILED_MODIFYING_PUBLIC_KEY),"failed modifying public key"}, | ||
| 169 | {ERR_REASON(STORE_R_FAILED_REVOKING_CERTIFICATE),"failed revoking certificate"}, | ||
| 170 | {ERR_REASON(STORE_R_FAILED_REVOKING_KEY) ,"failed revoking key"}, | ||
| 171 | {ERR_REASON(STORE_R_FAILED_STORING_ARBITRARY),"failed storing arbitrary"}, | ||
| 172 | {ERR_REASON(STORE_R_FAILED_STORING_CERTIFICATE),"failed storing certificate"}, | ||
| 173 | {ERR_REASON(STORE_R_FAILED_STORING_KEY) ,"failed storing key"}, | ||
| 174 | {ERR_REASON(STORE_R_FAILED_STORING_NUMBER),"failed storing number"}, | ||
| 175 | {ERR_REASON(STORE_R_NOT_IMPLEMENTED) ,"not implemented"}, | ||
| 176 | {ERR_REASON(STORE_R_NO_CONTROL_FUNCTION) ,"no control function"}, | ||
| 177 | {ERR_REASON(STORE_R_NO_DELETE_ARBITRARY_FUNCTION),"no delete arbitrary function"}, | ||
| 178 | {ERR_REASON(STORE_R_NO_DELETE_NUMBER_FUNCTION),"no delete number function"}, | ||
| 179 | {ERR_REASON(STORE_R_NO_DELETE_OBJECT_FUNCTION),"no delete object function"}, | ||
| 180 | {ERR_REASON(STORE_R_NO_GENERATE_CRL_FUNCTION),"no generate crl function"}, | ||
| 181 | {ERR_REASON(STORE_R_NO_GENERATE_OBJECT_FUNCTION),"no generate object function"}, | ||
| 182 | {ERR_REASON(STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION),"no get object arbitrary function"}, | ||
| 183 | {ERR_REASON(STORE_R_NO_GET_OBJECT_FUNCTION),"no get object function"}, | ||
| 184 | {ERR_REASON(STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION),"no get object number function"}, | ||
| 185 | {ERR_REASON(STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION),"no list object endp function"}, | ||
| 186 | {ERR_REASON(STORE_R_NO_LIST_OBJECT_END_FUNCTION),"no list object end function"}, | ||
| 187 | {ERR_REASON(STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION),"no list object next function"}, | ||
| 188 | {ERR_REASON(STORE_R_NO_LIST_OBJECT_START_FUNCTION),"no list object start function"}, | ||
| 189 | {ERR_REASON(STORE_R_NO_MODIFY_OBJECT_FUNCTION),"no modify object function"}, | ||
| 190 | {ERR_REASON(STORE_R_NO_REVOKE_OBJECT_FUNCTION),"no revoke object function"}, | ||
| 191 | {ERR_REASON(STORE_R_NO_STORE) ,"no store"}, | ||
| 192 | {ERR_REASON(STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION),"no store object arbitrary function"}, | ||
| 193 | {ERR_REASON(STORE_R_NO_STORE_OBJECT_FUNCTION),"no store object function"}, | ||
| 194 | {ERR_REASON(STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION),"no store object number function"}, | ||
| 195 | {ERR_REASON(STORE_R_NO_VALUE) ,"no value"}, | ||
| 196 | {0,NULL} | ||
| 197 | }; | ||
| 198 | |||
| 199 | #endif | ||
| 200 | |||
| 201 | void ERR_load_STORE_strings(void) | ||
| 202 | { | ||
| 203 | #ifndef OPENSSL_NO_ERR | ||
| 204 | |||
| 205 | if (ERR_func_error_string(STORE_str_functs[0].error) == NULL) | ||
| 206 | { | ||
| 207 | ERR_load_strings(0,STORE_str_functs); | ||
| 208 | ERR_load_strings(0,STORE_str_reasons); | ||
| 209 | } | ||
| 210 | #endif | ||
| 211 | } | ||
diff --git a/src/lib/libcrypto/store/str_lib.c b/src/lib/libcrypto/store/str_lib.c new file mode 100644 index 0000000000..f1dbcbd0e0 --- /dev/null +++ b/src/lib/libcrypto/store/str_lib.c | |||
| @@ -0,0 +1,1828 @@ | |||
| 1 | /* crypto/store/str_lib.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2003. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <string.h> | ||
| 60 | #include <openssl/bn.h> | ||
| 61 | #include <openssl/err.h> | ||
| 62 | #ifndef OPENSSL_NO_ENGINE | ||
| 63 | #include <openssl/engine.h> | ||
| 64 | #endif | ||
| 65 | #include <openssl/sha.h> | ||
| 66 | #include <openssl/x509.h> | ||
| 67 | #include "str_locl.h" | ||
| 68 | |||
| 69 | const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1] = | ||
| 70 | { | ||
| 71 | 0, | ||
| 72 | "X.509 Certificate", | ||
| 73 | "X.509 CRL", | ||
| 74 | "Private Key", | ||
| 75 | "Public Key", | ||
| 76 | "Number", | ||
| 77 | "Arbitrary Data" | ||
| 78 | }; | ||
| 79 | |||
| 80 | const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1] = | ||
| 81 | { | ||
| 82 | 0, | ||
| 83 | sizeof(int), /* EVP_TYPE */ | ||
| 84 | sizeof(size_t), /* BITS */ | ||
| 85 | -1, /* KEY_PARAMETERS */ | ||
| 86 | 0 /* KEY_NO_PARAMETERS */ | ||
| 87 | }; | ||
| 88 | |||
| 89 | const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1] = | ||
| 90 | { | ||
| 91 | 0, | ||
| 92 | -1, /* FRIENDLYNAME: C string */ | ||
| 93 | SHA_DIGEST_LENGTH, /* KEYID: SHA1 digest, 160 bits */ | ||
| 94 | SHA_DIGEST_LENGTH, /* ISSUERKEYID: SHA1 digest, 160 bits */ | ||
| 95 | SHA_DIGEST_LENGTH, /* SUBJECTKEYID: SHA1 digest, 160 bits */ | ||
| 96 | SHA_DIGEST_LENGTH, /* ISSUERSERIALHASH: SHA1 digest, 160 bits */ | ||
| 97 | sizeof(X509_NAME *), /* ISSUER: X509_NAME * */ | ||
| 98 | sizeof(BIGNUM *), /* SERIAL: BIGNUM * */ | ||
| 99 | sizeof(X509_NAME *), /* SUBJECT: X509_NAME * */ | ||
| 100 | SHA_DIGEST_LENGTH, /* CERTHASH: SHA1 digest, 160 bits */ | ||
| 101 | -1, /* EMAIL: C string */ | ||
| 102 | -1, /* FILENAME: C string */ | ||
| 103 | }; | ||
| 104 | |||
| 105 | STORE *STORE_new_method(const STORE_METHOD *method) | ||
| 106 | { | ||
| 107 | STORE *ret; | ||
| 108 | |||
| 109 | if (method == NULL) | ||
| 110 | { | ||
| 111 | STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_PASSED_NULL_PARAMETER); | ||
| 112 | return NULL; | ||
| 113 | } | ||
| 114 | |||
| 115 | ret=(STORE *)OPENSSL_malloc(sizeof(STORE)); | ||
| 116 | if (ret == NULL) | ||
| 117 | { | ||
| 118 | STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE); | ||
| 119 | return NULL; | ||
| 120 | } | ||
| 121 | |||
| 122 | ret->meth=method; | ||
| 123 | |||
| 124 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_STORE, ret, &ret->ex_data); | ||
| 125 | if (ret->meth->init && !ret->meth->init(ret)) | ||
| 126 | { | ||
| 127 | STORE_free(ret); | ||
| 128 | ret = NULL; | ||
| 129 | } | ||
| 130 | return ret; | ||
| 131 | } | ||
| 132 | |||
| 133 | STORE *STORE_new_engine(ENGINE *engine) | ||
| 134 | { | ||
| 135 | STORE *ret = NULL; | ||
| 136 | ENGINE *e = engine; | ||
| 137 | const STORE_METHOD *meth = 0; | ||
| 138 | |||
| 139 | #ifdef OPENSSL_NO_ENGINE | ||
| 140 | e = NULL; | ||
| 141 | #else | ||
| 142 | if (engine) | ||
| 143 | { | ||
| 144 | if (!ENGINE_init(engine)) | ||
| 145 | { | ||
| 146 | STOREerr(STORE_F_STORE_NEW_ENGINE, ERR_R_ENGINE_LIB); | ||
| 147 | return NULL; | ||
| 148 | } | ||
| 149 | e = engine; | ||
| 150 | } | ||
| 151 | else | ||
| 152 | { | ||
| 153 | STOREerr(STORE_F_STORE_NEW_ENGINE,ERR_R_PASSED_NULL_PARAMETER); | ||
| 154 | return NULL; | ||
| 155 | } | ||
| 156 | if(e) | ||
| 157 | { | ||
| 158 | meth = ENGINE_get_STORE(e); | ||
| 159 | if(!meth) | ||
| 160 | { | ||
| 161 | STOREerr(STORE_F_STORE_NEW_ENGINE, | ||
| 162 | ERR_R_ENGINE_LIB); | ||
| 163 | ENGINE_finish(e); | ||
| 164 | return NULL; | ||
| 165 | } | ||
| 166 | } | ||
| 167 | #endif | ||
| 168 | |||
| 169 | ret = STORE_new_method(meth); | ||
| 170 | if (ret == NULL) | ||
| 171 | { | ||
| 172 | STOREerr(STORE_F_STORE_NEW_ENGINE,ERR_R_STORE_LIB); | ||
| 173 | return NULL; | ||
| 174 | } | ||
| 175 | |||
| 176 | ret->engine = e; | ||
| 177 | |||
| 178 | return(ret); | ||
| 179 | } | ||
| 180 | |||
| 181 | void STORE_free(STORE *store) | ||
| 182 | { | ||
| 183 | if (store == NULL) | ||
| 184 | return; | ||
| 185 | if (store->meth->clean) | ||
| 186 | store->meth->clean(store); | ||
| 187 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data); | ||
| 188 | OPENSSL_free(store); | ||
| 189 | } | ||
| 190 | |||
| 191 | int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void)) | ||
| 192 | { | ||
| 193 | if (store == NULL) | ||
| 194 | { | ||
| 195 | STOREerr(STORE_F_STORE_CTRL,ERR_R_PASSED_NULL_PARAMETER); | ||
| 196 | return 0; | ||
| 197 | } | ||
| 198 | if (store->meth->ctrl) | ||
| 199 | return store->meth->ctrl(store, cmd, i, p, f); | ||
| 200 | STOREerr(STORE_F_STORE_CTRL,STORE_R_NO_CONTROL_FUNCTION); | ||
| 201 | return 0; | ||
| 202 | } | ||
| 203 | |||
| 204 | |||
| 205 | int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
| 206 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) | ||
| 207 | { | ||
| 208 | return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_STORE, argl, argp, | ||
| 209 | new_func, dup_func, free_func); | ||
| 210 | } | ||
| 211 | |||
| 212 | int STORE_set_ex_data(STORE *r, int idx, void *arg) | ||
| 213 | { | ||
| 214 | return(CRYPTO_set_ex_data(&r->ex_data,idx,arg)); | ||
| 215 | } | ||
| 216 | |||
| 217 | void *STORE_get_ex_data(STORE *r, int idx) | ||
| 218 | { | ||
| 219 | return(CRYPTO_get_ex_data(&r->ex_data,idx)); | ||
| 220 | } | ||
| 221 | |||
| 222 | const STORE_METHOD *STORE_get_method(STORE *store) | ||
| 223 | { | ||
| 224 | return store->meth; | ||
| 225 | } | ||
| 226 | |||
| 227 | const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth) | ||
| 228 | { | ||
| 229 | store->meth=meth; | ||
| 230 | return store->meth; | ||
| 231 | } | ||
| 232 | |||
| 233 | |||
| 234 | /* API helpers */ | ||
| 235 | |||
| 236 | #define check_store(s,fncode,fnname,fnerrcode) \ | ||
| 237 | do \ | ||
| 238 | { \ | ||
| 239 | if ((s) == NULL || (s)->meth == NULL) \ | ||
| 240 | { \ | ||
| 241 | STOREerr((fncode), ERR_R_PASSED_NULL_PARAMETER); \ | ||
| 242 | return 0; \ | ||
| 243 | } \ | ||
| 244 | if ((s)->meth->fnname == NULL) \ | ||
| 245 | { \ | ||
| 246 | STOREerr((fncode), (fnerrcode)); \ | ||
| 247 | return 0; \ | ||
| 248 | } \ | ||
| 249 | } \ | ||
| 250 | while(0) | ||
| 251 | |||
| 252 | /* API functions */ | ||
| 253 | |||
| 254 | X509 *STORE_get_certificate(STORE *s, OPENSSL_ITEM attributes[], | ||
| 255 | OPENSSL_ITEM parameters[]) | ||
| 256 | { | ||
| 257 | STORE_OBJECT *object; | ||
| 258 | X509 *x; | ||
| 259 | |||
| 260 | check_store(s,STORE_F_STORE_GET_CERTIFICATE, | ||
| 261 | get_object,STORE_R_NO_GET_OBJECT_FUNCTION); | ||
| 262 | |||
| 263 | object = s->meth->get_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE, | ||
| 264 | attributes, parameters); | ||
| 265 | if (!object || !object->data.x509.certificate) | ||
| 266 | { | ||
| 267 | STOREerr(STORE_F_STORE_GET_CERTIFICATE, | ||
| 268 | STORE_R_FAILED_GETTING_CERTIFICATE); | ||
| 269 | return 0; | ||
| 270 | } | ||
| 271 | CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509); | ||
| 272 | #ifdef REF_PRINT | ||
| 273 | REF_PRINT("X509",data); | ||
| 274 | #endif | ||
| 275 | x = object->data.x509.certificate; | ||
| 276 | STORE_OBJECT_free(object); | ||
| 277 | return x; | ||
| 278 | } | ||
| 279 | |||
| 280 | int STORE_store_certificate(STORE *s, X509 *data, OPENSSL_ITEM attributes[], | ||
| 281 | OPENSSL_ITEM parameters[]) | ||
| 282 | { | ||
| 283 | STORE_OBJECT *object; | ||
| 284 | int i; | ||
| 285 | |||
| 286 | check_store(s,STORE_F_STORE_CERTIFICATE, | ||
| 287 | store_object,STORE_R_NO_STORE_OBJECT_FUNCTION); | ||
| 288 | |||
| 289 | object = STORE_OBJECT_new(); | ||
| 290 | if (!object) | ||
| 291 | { | ||
| 292 | STOREerr(STORE_F_STORE_STORE_CERTIFICATE, | ||
| 293 | ERR_R_MALLOC_FAILURE); | ||
| 294 | return 0; | ||
| 295 | } | ||
| 296 | |||
| 297 | CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509); | ||
| 298 | #ifdef REF_PRINT | ||
| 299 | REF_PRINT("X509",data); | ||
| 300 | #endif | ||
| 301 | object->data.x509.certificate = data; | ||
| 302 | |||
| 303 | i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE, | ||
| 304 | object, attributes, parameters); | ||
| 305 | |||
| 306 | STORE_OBJECT_free(object); | ||
| 307 | |||
| 308 | if (!i) | ||
| 309 | { | ||
| 310 | STOREerr(STORE_F_STORE_STORE_CERTIFICATE, | ||
| 311 | STORE_R_FAILED_STORING_CERTIFICATE); | ||
| 312 | return 0; | ||
| 313 | } | ||
| 314 | return 1; | ||
| 315 | } | ||
| 316 | |||
| 317 | int STORE_modify_certificate(STORE *s, OPENSSL_ITEM search_attributes[], | ||
| 318 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 319 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]) | ||
| 320 | { | ||
| 321 | check_store(s,STORE_F_STORE_MODIFY_CERTIFICATE, | ||
| 322 | modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION); | ||
| 323 | |||
| 324 | if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE, | ||
| 325 | search_attributes, add_attributes, modify_attributes, | ||
| 326 | delete_attributes, parameters)) | ||
| 327 | { | ||
| 328 | STOREerr(STORE_F_STORE_MODIFY_CERTIFICATE, | ||
| 329 | STORE_R_FAILED_MODIFYING_CERTIFICATE); | ||
| 330 | return 0; | ||
| 331 | } | ||
| 332 | return 1; | ||
| 333 | } | ||
| 334 | |||
| 335 | int STORE_revoke_certificate(STORE *s, OPENSSL_ITEM attributes[], | ||
| 336 | OPENSSL_ITEM parameters[]) | ||
| 337 | { | ||
| 338 | check_store(s,STORE_F_STORE_REVOKE_CERTIFICATE, | ||
| 339 | revoke_object,STORE_R_NO_REVOKE_OBJECT_FUNCTION); | ||
| 340 | |||
| 341 | if (!s->meth->revoke_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE, | ||
| 342 | attributes, parameters)) | ||
| 343 | { | ||
| 344 | STOREerr(STORE_F_STORE_REVOKE_CERTIFICATE, | ||
| 345 | STORE_R_FAILED_REVOKING_CERTIFICATE); | ||
| 346 | return 0; | ||
| 347 | } | ||
| 348 | return 1; | ||
| 349 | } | ||
| 350 | |||
| 351 | int STORE_delete_certificate(STORE *s, OPENSSL_ITEM attributes[], | ||
| 352 | OPENSSL_ITEM parameters[]) | ||
| 353 | { | ||
| 354 | check_store(s,STORE_F_STORE_DELETE_CERTIFICATE, | ||
| 355 | delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION); | ||
| 356 | |||
| 357 | if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_X509_CERTIFICATE, | ||
| 358 | attributes, parameters)) | ||
| 359 | { | ||
| 360 | STOREerr(STORE_F_STORE_DELETE_CERTIFICATE, | ||
| 361 | STORE_R_FAILED_DELETING_CERTIFICATE); | ||
| 362 | return 0; | ||
| 363 | } | ||
| 364 | return 1; | ||
| 365 | } | ||
| 366 | |||
| 367 | void *STORE_list_certificate_start(STORE *s, OPENSSL_ITEM attributes[], | ||
| 368 | OPENSSL_ITEM parameters[]) | ||
| 369 | { | ||
| 370 | void *handle; | ||
| 371 | |||
| 372 | check_store(s,STORE_F_STORE_LIST_CERTIFICATE_START, | ||
| 373 | list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION); | ||
| 374 | |||
| 375 | handle = s->meth->list_object_start(s, | ||
| 376 | STORE_OBJECT_TYPE_X509_CERTIFICATE, attributes, parameters); | ||
| 377 | if (!handle) | ||
| 378 | { | ||
| 379 | STOREerr(STORE_F_STORE_LIST_CERTIFICATE_START, | ||
| 380 | STORE_R_FAILED_LISTING_CERTIFICATES); | ||
| 381 | return 0; | ||
| 382 | } | ||
| 383 | return handle; | ||
| 384 | } | ||
| 385 | |||
| 386 | X509 *STORE_list_certificate_next(STORE *s, void *handle) | ||
| 387 | { | ||
| 388 | STORE_OBJECT *object; | ||
| 389 | X509 *x; | ||
| 390 | |||
| 391 | check_store(s,STORE_F_STORE_LIST_CERTIFICATE_NEXT, | ||
| 392 | list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION); | ||
| 393 | |||
| 394 | object = s->meth->list_object_next(s, handle); | ||
| 395 | if (!object || !object->data.x509.certificate) | ||
| 396 | { | ||
| 397 | STOREerr(STORE_F_STORE_LIST_CERTIFICATE_NEXT, | ||
| 398 | STORE_R_FAILED_LISTING_CERTIFICATES); | ||
| 399 | return 0; | ||
| 400 | } | ||
| 401 | CRYPTO_add(&object->data.x509.certificate->references,1,CRYPTO_LOCK_X509); | ||
| 402 | #ifdef REF_PRINT | ||
| 403 | REF_PRINT("X509",data); | ||
| 404 | #endif | ||
| 405 | x = object->data.x509.certificate; | ||
| 406 | STORE_OBJECT_free(object); | ||
| 407 | return x; | ||
| 408 | } | ||
| 409 | |||
| 410 | int STORE_list_certificate_end(STORE *s, void *handle) | ||
| 411 | { | ||
| 412 | check_store(s,STORE_F_STORE_LIST_CERTIFICATE_END, | ||
| 413 | list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION); | ||
| 414 | |||
| 415 | if (!s->meth->list_object_end(s, handle)) | ||
| 416 | { | ||
| 417 | STOREerr(STORE_F_STORE_LIST_CERTIFICATE_END, | ||
| 418 | STORE_R_FAILED_LISTING_CERTIFICATES); | ||
| 419 | return 0; | ||
| 420 | } | ||
| 421 | return 1; | ||
| 422 | } | ||
| 423 | |||
| 424 | int STORE_list_certificate_endp(STORE *s, void *handle) | ||
| 425 | { | ||
| 426 | check_store(s,STORE_F_STORE_LIST_CERTIFICATE_ENDP, | ||
| 427 | list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION); | ||
| 428 | |||
| 429 | if (!s->meth->list_object_endp(s, handle)) | ||
| 430 | { | ||
| 431 | STOREerr(STORE_F_STORE_LIST_CERTIFICATE_ENDP, | ||
| 432 | STORE_R_FAILED_LISTING_CERTIFICATES); | ||
| 433 | return 0; | ||
| 434 | } | ||
| 435 | return 1; | ||
| 436 | } | ||
| 437 | |||
| 438 | EVP_PKEY *STORE_generate_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 439 | OPENSSL_ITEM parameters[]) | ||
| 440 | { | ||
| 441 | STORE_OBJECT *object; | ||
| 442 | EVP_PKEY *pkey; | ||
| 443 | |||
| 444 | check_store(s,STORE_F_STORE_GENERATE_KEY, | ||
| 445 | generate_object,STORE_R_NO_GENERATE_OBJECT_FUNCTION); | ||
| 446 | |||
| 447 | object = s->meth->generate_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, | ||
| 448 | attributes, parameters); | ||
| 449 | if (!object || !object->data.key) | ||
| 450 | { | ||
| 451 | STOREerr(STORE_F_STORE_GENERATE_KEY, | ||
| 452 | STORE_R_FAILED_GENERATING_KEY); | ||
| 453 | return 0; | ||
| 454 | } | ||
| 455 | CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 456 | #ifdef REF_PRINT | ||
| 457 | REF_PRINT("EVP_PKEY",data); | ||
| 458 | #endif | ||
| 459 | pkey = object->data.key; | ||
| 460 | STORE_OBJECT_free(object); | ||
| 461 | return pkey; | ||
| 462 | } | ||
| 463 | |||
| 464 | EVP_PKEY *STORE_get_private_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 465 | OPENSSL_ITEM parameters[]) | ||
| 466 | { | ||
| 467 | STORE_OBJECT *object; | ||
| 468 | EVP_PKEY *pkey; | ||
| 469 | |||
| 470 | check_store(s,STORE_F_STORE_GET_PRIVATE_KEY, | ||
| 471 | get_object,STORE_R_NO_GET_OBJECT_FUNCTION); | ||
| 472 | |||
| 473 | object = s->meth->get_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, | ||
| 474 | attributes, parameters); | ||
| 475 | if (!object || !object->data.key || !object->data.key) | ||
| 476 | { | ||
| 477 | STOREerr(STORE_F_STORE_GET_PRIVATE_KEY, | ||
| 478 | STORE_R_FAILED_GETTING_KEY); | ||
| 479 | return 0; | ||
| 480 | } | ||
| 481 | CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 482 | #ifdef REF_PRINT | ||
| 483 | REF_PRINT("EVP_PKEY",data); | ||
| 484 | #endif | ||
| 485 | pkey = object->data.key; | ||
| 486 | STORE_OBJECT_free(object); | ||
| 487 | return pkey; | ||
| 488 | } | ||
| 489 | |||
| 490 | int STORE_store_private_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[], | ||
| 491 | OPENSSL_ITEM parameters[]) | ||
| 492 | { | ||
| 493 | STORE_OBJECT *object; | ||
| 494 | int i; | ||
| 495 | |||
| 496 | check_store(s,STORE_F_STORE_STORE_PRIVATE_KEY, | ||
| 497 | store_object,STORE_R_NO_STORE_OBJECT_FUNCTION); | ||
| 498 | |||
| 499 | object = STORE_OBJECT_new(); | ||
| 500 | if (!object) | ||
| 501 | { | ||
| 502 | STOREerr(STORE_F_STORE_STORE_PRIVATE_KEY, | ||
| 503 | ERR_R_MALLOC_FAILURE); | ||
| 504 | return 0; | ||
| 505 | } | ||
| 506 | object->data.key = EVP_PKEY_new(); | ||
| 507 | if (!object->data.key) | ||
| 508 | { | ||
| 509 | STOREerr(STORE_F_STORE_STORE_PRIVATE_KEY, | ||
| 510 | ERR_R_MALLOC_FAILURE); | ||
| 511 | return 0; | ||
| 512 | } | ||
| 513 | |||
| 514 | CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 515 | #ifdef REF_PRINT | ||
| 516 | REF_PRINT("EVP_PKEY",data); | ||
| 517 | #endif | ||
| 518 | object->data.key = data; | ||
| 519 | |||
| 520 | i = s->meth->store_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, object, | ||
| 521 | attributes, parameters); | ||
| 522 | |||
| 523 | STORE_OBJECT_free(object); | ||
| 524 | |||
| 525 | if (!i) | ||
| 526 | { | ||
| 527 | STOREerr(STORE_F_STORE_STORE_PRIVATE_KEY, | ||
| 528 | STORE_R_FAILED_STORING_KEY); | ||
| 529 | return 0; | ||
| 530 | } | ||
| 531 | return i; | ||
| 532 | } | ||
| 533 | |||
| 534 | int STORE_modify_private_key(STORE *s, OPENSSL_ITEM search_attributes[], | ||
| 535 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 536 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]) | ||
| 537 | { | ||
| 538 | check_store(s,STORE_F_STORE_MODIFY_PRIVATE_KEY, | ||
| 539 | modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION); | ||
| 540 | |||
| 541 | if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, | ||
| 542 | search_attributes, add_attributes, modify_attributes, | ||
| 543 | delete_attributes, parameters)) | ||
| 544 | { | ||
| 545 | STOREerr(STORE_F_STORE_MODIFY_PRIVATE_KEY, | ||
| 546 | STORE_R_FAILED_MODIFYING_PRIVATE_KEY); | ||
| 547 | return 0; | ||
| 548 | } | ||
| 549 | return 1; | ||
| 550 | } | ||
| 551 | |||
| 552 | int STORE_revoke_private_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 553 | OPENSSL_ITEM parameters[]) | ||
| 554 | { | ||
| 555 | int i; | ||
| 556 | |||
| 557 | check_store(s,STORE_F_STORE_REVOKE_PRIVATE_KEY, | ||
| 558 | revoke_object,STORE_R_NO_REVOKE_OBJECT_FUNCTION); | ||
| 559 | |||
| 560 | i = s->meth->revoke_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, | ||
| 561 | attributes, parameters); | ||
| 562 | |||
| 563 | if (!i) | ||
| 564 | { | ||
| 565 | STOREerr(STORE_F_STORE_REVOKE_PRIVATE_KEY, | ||
| 566 | STORE_R_FAILED_REVOKING_KEY); | ||
| 567 | return 0; | ||
| 568 | } | ||
| 569 | return i; | ||
| 570 | } | ||
| 571 | |||
| 572 | int STORE_delete_private_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 573 | OPENSSL_ITEM parameters[]) | ||
| 574 | { | ||
| 575 | check_store(s,STORE_F_STORE_DELETE_PRIVATE_KEY, | ||
| 576 | delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION); | ||
| 577 | |||
| 578 | if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY, | ||
| 579 | attributes, parameters)) | ||
| 580 | { | ||
| 581 | STOREerr(STORE_F_STORE_DELETE_PRIVATE_KEY, | ||
| 582 | STORE_R_FAILED_DELETING_KEY); | ||
| 583 | return 0; | ||
| 584 | } | ||
| 585 | return 1; | ||
| 586 | } | ||
| 587 | |||
| 588 | void *STORE_list_private_key_start(STORE *s, OPENSSL_ITEM attributes[], | ||
| 589 | OPENSSL_ITEM parameters[]) | ||
| 590 | { | ||
| 591 | void *handle; | ||
| 592 | |||
| 593 | check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_START, | ||
| 594 | list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION); | ||
| 595 | |||
| 596 | handle = s->meth->list_object_start(s, STORE_OBJECT_TYPE_PRIVATE_KEY, | ||
| 597 | attributes, parameters); | ||
| 598 | if (!handle) | ||
| 599 | { | ||
| 600 | STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_START, | ||
| 601 | STORE_R_FAILED_LISTING_KEYS); | ||
| 602 | return 0; | ||
| 603 | } | ||
| 604 | return handle; | ||
| 605 | } | ||
| 606 | |||
| 607 | EVP_PKEY *STORE_list_private_key_next(STORE *s, void *handle) | ||
| 608 | { | ||
| 609 | STORE_OBJECT *object; | ||
| 610 | EVP_PKEY *pkey; | ||
| 611 | |||
| 612 | check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_NEXT, | ||
| 613 | list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION); | ||
| 614 | |||
| 615 | object = s->meth->list_object_next(s, handle); | ||
| 616 | if (!object || !object->data.key || !object->data.key) | ||
| 617 | { | ||
| 618 | STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_NEXT, | ||
| 619 | STORE_R_FAILED_LISTING_KEYS); | ||
| 620 | return 0; | ||
| 621 | } | ||
| 622 | CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 623 | #ifdef REF_PRINT | ||
| 624 | REF_PRINT("EVP_PKEY",data); | ||
| 625 | #endif | ||
| 626 | pkey = object->data.key; | ||
| 627 | STORE_OBJECT_free(object); | ||
| 628 | return pkey; | ||
| 629 | } | ||
| 630 | |||
| 631 | int STORE_list_private_key_end(STORE *s, void *handle) | ||
| 632 | { | ||
| 633 | check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_END, | ||
| 634 | list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION); | ||
| 635 | |||
| 636 | if (!s->meth->list_object_end(s, handle)) | ||
| 637 | { | ||
| 638 | STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_END, | ||
| 639 | STORE_R_FAILED_LISTING_KEYS); | ||
| 640 | return 0; | ||
| 641 | } | ||
| 642 | return 1; | ||
| 643 | } | ||
| 644 | |||
| 645 | int STORE_list_private_key_endp(STORE *s, void *handle) | ||
| 646 | { | ||
| 647 | check_store(s,STORE_F_STORE_LIST_PRIVATE_KEY_ENDP, | ||
| 648 | list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION); | ||
| 649 | |||
| 650 | if (!s->meth->list_object_endp(s, handle)) | ||
| 651 | { | ||
| 652 | STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_ENDP, | ||
| 653 | STORE_R_FAILED_LISTING_KEYS); | ||
| 654 | return 0; | ||
| 655 | } | ||
| 656 | return 1; | ||
| 657 | } | ||
| 658 | |||
| 659 | EVP_PKEY *STORE_get_public_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 660 | OPENSSL_ITEM parameters[]) | ||
| 661 | { | ||
| 662 | STORE_OBJECT *object; | ||
| 663 | EVP_PKEY *pkey; | ||
| 664 | |||
| 665 | check_store(s,STORE_F_STORE_GET_PUBLIC_KEY, | ||
| 666 | get_object,STORE_R_NO_GET_OBJECT_FUNCTION); | ||
| 667 | |||
| 668 | object = s->meth->get_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, | ||
| 669 | attributes, parameters); | ||
| 670 | if (!object || !object->data.key || !object->data.key) | ||
| 671 | { | ||
| 672 | STOREerr(STORE_F_STORE_GET_PUBLIC_KEY, | ||
| 673 | STORE_R_FAILED_GETTING_KEY); | ||
| 674 | return 0; | ||
| 675 | } | ||
| 676 | CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 677 | #ifdef REF_PRINT | ||
| 678 | REF_PRINT("EVP_PKEY",data); | ||
| 679 | #endif | ||
| 680 | pkey = object->data.key; | ||
| 681 | STORE_OBJECT_free(object); | ||
| 682 | return pkey; | ||
| 683 | } | ||
| 684 | |||
| 685 | int STORE_store_public_key(STORE *s, EVP_PKEY *data, OPENSSL_ITEM attributes[], | ||
| 686 | OPENSSL_ITEM parameters[]) | ||
| 687 | { | ||
| 688 | STORE_OBJECT *object; | ||
| 689 | int i; | ||
| 690 | |||
| 691 | check_store(s,STORE_F_STORE_STORE_PUBLIC_KEY, | ||
| 692 | store_object,STORE_R_NO_STORE_OBJECT_FUNCTION); | ||
| 693 | |||
| 694 | object = STORE_OBJECT_new(); | ||
| 695 | if (!object) | ||
| 696 | { | ||
| 697 | STOREerr(STORE_F_STORE_STORE_PUBLIC_KEY, | ||
| 698 | ERR_R_MALLOC_FAILURE); | ||
| 699 | return 0; | ||
| 700 | } | ||
| 701 | object->data.key = EVP_PKEY_new(); | ||
| 702 | if (!object->data.key) | ||
| 703 | { | ||
| 704 | STOREerr(STORE_F_STORE_STORE_PUBLIC_KEY, | ||
| 705 | ERR_R_MALLOC_FAILURE); | ||
| 706 | return 0; | ||
| 707 | } | ||
| 708 | |||
| 709 | CRYPTO_add(&data->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 710 | #ifdef REF_PRINT | ||
| 711 | REF_PRINT("EVP_PKEY",data); | ||
| 712 | #endif | ||
| 713 | object->data.key = data; | ||
| 714 | |||
| 715 | i = s->meth->store_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, object, | ||
| 716 | attributes, parameters); | ||
| 717 | |||
| 718 | STORE_OBJECT_free(object); | ||
| 719 | |||
| 720 | if (!i) | ||
| 721 | { | ||
| 722 | STOREerr(STORE_F_STORE_STORE_PUBLIC_KEY, | ||
| 723 | STORE_R_FAILED_STORING_KEY); | ||
| 724 | return 0; | ||
| 725 | } | ||
| 726 | return i; | ||
| 727 | } | ||
| 728 | |||
| 729 | int STORE_modify_public_key(STORE *s, OPENSSL_ITEM search_attributes[], | ||
| 730 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 731 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]) | ||
| 732 | { | ||
| 733 | check_store(s,STORE_F_STORE_MODIFY_PUBLIC_KEY, | ||
| 734 | modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION); | ||
| 735 | |||
| 736 | if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, | ||
| 737 | search_attributes, add_attributes, modify_attributes, | ||
| 738 | delete_attributes, parameters)) | ||
| 739 | { | ||
| 740 | STOREerr(STORE_F_STORE_MODIFY_PUBLIC_KEY, | ||
| 741 | STORE_R_FAILED_MODIFYING_PUBLIC_KEY); | ||
| 742 | return 0; | ||
| 743 | } | ||
| 744 | return 1; | ||
| 745 | } | ||
| 746 | |||
| 747 | int STORE_revoke_public_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 748 | OPENSSL_ITEM parameters[]) | ||
| 749 | { | ||
| 750 | int i; | ||
| 751 | |||
| 752 | check_store(s,STORE_F_STORE_REVOKE_PUBLIC_KEY, | ||
| 753 | revoke_object,STORE_R_NO_REVOKE_OBJECT_FUNCTION); | ||
| 754 | |||
| 755 | i = s->meth->revoke_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, | ||
| 756 | attributes, parameters); | ||
| 757 | |||
| 758 | if (!i) | ||
| 759 | { | ||
| 760 | STOREerr(STORE_F_STORE_REVOKE_PUBLIC_KEY, | ||
| 761 | STORE_R_FAILED_REVOKING_KEY); | ||
| 762 | return 0; | ||
| 763 | } | ||
| 764 | return i; | ||
| 765 | } | ||
| 766 | |||
| 767 | int STORE_delete_public_key(STORE *s, OPENSSL_ITEM attributes[], | ||
| 768 | OPENSSL_ITEM parameters[]) | ||
| 769 | { | ||
| 770 | check_store(s,STORE_F_STORE_DELETE_PUBLIC_KEY, | ||
| 771 | delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION); | ||
| 772 | |||
| 773 | if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY, | ||
| 774 | attributes, parameters)) | ||
| 775 | { | ||
| 776 | STOREerr(STORE_F_STORE_DELETE_PUBLIC_KEY, | ||
| 777 | STORE_R_FAILED_DELETING_KEY); | ||
| 778 | return 0; | ||
| 779 | } | ||
| 780 | return 1; | ||
| 781 | } | ||
| 782 | |||
| 783 | void *STORE_list_public_key_start(STORE *s, OPENSSL_ITEM attributes[], | ||
| 784 | OPENSSL_ITEM parameters[]) | ||
| 785 | { | ||
| 786 | void *handle; | ||
| 787 | |||
| 788 | check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_START, | ||
| 789 | list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION); | ||
| 790 | |||
| 791 | handle = s->meth->list_object_start(s, STORE_OBJECT_TYPE_PUBLIC_KEY, | ||
| 792 | attributes, parameters); | ||
| 793 | if (!handle) | ||
| 794 | { | ||
| 795 | STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_START, | ||
| 796 | STORE_R_FAILED_LISTING_KEYS); | ||
| 797 | return 0; | ||
| 798 | } | ||
| 799 | return handle; | ||
| 800 | } | ||
| 801 | |||
| 802 | EVP_PKEY *STORE_list_public_key_next(STORE *s, void *handle) | ||
| 803 | { | ||
| 804 | STORE_OBJECT *object; | ||
| 805 | EVP_PKEY *pkey; | ||
| 806 | |||
| 807 | check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_NEXT, | ||
| 808 | list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION); | ||
| 809 | |||
| 810 | object = s->meth->list_object_next(s, handle); | ||
| 811 | if (!object || !object->data.key || !object->data.key) | ||
| 812 | { | ||
| 813 | STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_NEXT, | ||
| 814 | STORE_R_FAILED_LISTING_KEYS); | ||
| 815 | return 0; | ||
| 816 | } | ||
| 817 | CRYPTO_add(&object->data.key->references,1,CRYPTO_LOCK_EVP_PKEY); | ||
| 818 | #ifdef REF_PRINT | ||
| 819 | REF_PRINT("EVP_PKEY",data); | ||
| 820 | #endif | ||
| 821 | pkey = object->data.key; | ||
| 822 | STORE_OBJECT_free(object); | ||
| 823 | return pkey; | ||
| 824 | } | ||
| 825 | |||
| 826 | int STORE_list_public_key_end(STORE *s, void *handle) | ||
| 827 | { | ||
| 828 | check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_END, | ||
| 829 | list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION); | ||
| 830 | |||
| 831 | if (!s->meth->list_object_end(s, handle)) | ||
| 832 | { | ||
| 833 | STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_END, | ||
| 834 | STORE_R_FAILED_LISTING_KEYS); | ||
| 835 | return 0; | ||
| 836 | } | ||
| 837 | return 1; | ||
| 838 | } | ||
| 839 | |||
| 840 | int STORE_list_public_key_endp(STORE *s, void *handle) | ||
| 841 | { | ||
| 842 | check_store(s,STORE_F_STORE_LIST_PUBLIC_KEY_ENDP, | ||
| 843 | list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION); | ||
| 844 | |||
| 845 | if (!s->meth->list_object_endp(s, handle)) | ||
| 846 | { | ||
| 847 | STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_ENDP, | ||
| 848 | STORE_R_FAILED_LISTING_KEYS); | ||
| 849 | return 0; | ||
| 850 | } | ||
| 851 | return 1; | ||
| 852 | } | ||
| 853 | |||
| 854 | X509_CRL *STORE_generate_crl(STORE *s, OPENSSL_ITEM attributes[], | ||
| 855 | OPENSSL_ITEM parameters[]) | ||
| 856 | { | ||
| 857 | STORE_OBJECT *object; | ||
| 858 | X509_CRL *crl; | ||
| 859 | |||
| 860 | check_store(s,STORE_F_STORE_GENERATE_CRL, | ||
| 861 | generate_object,STORE_R_NO_GENERATE_CRL_FUNCTION); | ||
| 862 | |||
| 863 | object = s->meth->generate_object(s, STORE_OBJECT_TYPE_X509_CRL, | ||
| 864 | attributes, parameters); | ||
| 865 | if (!object || !object->data.crl) | ||
| 866 | { | ||
| 867 | STOREerr(STORE_F_STORE_GENERATE_CRL, | ||
| 868 | STORE_R_FAILED_GENERATING_CRL); | ||
| 869 | return 0; | ||
| 870 | } | ||
| 871 | CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL); | ||
| 872 | #ifdef REF_PRINT | ||
| 873 | REF_PRINT("X509_CRL",data); | ||
| 874 | #endif | ||
| 875 | crl = object->data.crl; | ||
| 876 | STORE_OBJECT_free(object); | ||
| 877 | return crl; | ||
| 878 | } | ||
| 879 | |||
| 880 | X509_CRL *STORE_get_crl(STORE *s, OPENSSL_ITEM attributes[], | ||
| 881 | OPENSSL_ITEM parameters[]) | ||
| 882 | { | ||
| 883 | STORE_OBJECT *object; | ||
| 884 | X509_CRL *crl; | ||
| 885 | |||
| 886 | check_store(s,STORE_F_STORE_GET_CRL, | ||
| 887 | get_object,STORE_R_NO_GET_OBJECT_FUNCTION); | ||
| 888 | |||
| 889 | object = s->meth->get_object(s, STORE_OBJECT_TYPE_X509_CRL, | ||
| 890 | attributes, parameters); | ||
| 891 | if (!object || !object->data.crl) | ||
| 892 | { | ||
| 893 | STOREerr(STORE_F_STORE_GET_CRL, | ||
| 894 | STORE_R_FAILED_GETTING_KEY); | ||
| 895 | return 0; | ||
| 896 | } | ||
| 897 | CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL); | ||
| 898 | #ifdef REF_PRINT | ||
| 899 | REF_PRINT("X509_CRL",data); | ||
| 900 | #endif | ||
| 901 | crl = object->data.crl; | ||
| 902 | STORE_OBJECT_free(object); | ||
| 903 | return crl; | ||
| 904 | } | ||
| 905 | |||
| 906 | int STORE_store_crl(STORE *s, X509_CRL *data, OPENSSL_ITEM attributes[], | ||
| 907 | OPENSSL_ITEM parameters[]) | ||
| 908 | { | ||
| 909 | STORE_OBJECT *object; | ||
| 910 | int i; | ||
| 911 | |||
| 912 | check_store(s,STORE_F_STORE_STORE_CRL, | ||
| 913 | store_object,STORE_R_NO_STORE_OBJECT_FUNCTION); | ||
| 914 | |||
| 915 | object = STORE_OBJECT_new(); | ||
| 916 | if (!object) | ||
| 917 | { | ||
| 918 | STOREerr(STORE_F_STORE_STORE_CRL, | ||
| 919 | ERR_R_MALLOC_FAILURE); | ||
| 920 | return 0; | ||
| 921 | } | ||
| 922 | |||
| 923 | CRYPTO_add(&data->references,1,CRYPTO_LOCK_X509_CRL); | ||
| 924 | #ifdef REF_PRINT | ||
| 925 | REF_PRINT("X509_CRL",data); | ||
| 926 | #endif | ||
| 927 | object->data.crl = data; | ||
| 928 | |||
| 929 | i = s->meth->store_object(s, STORE_OBJECT_TYPE_X509_CRL, object, | ||
| 930 | attributes, parameters); | ||
| 931 | |||
| 932 | STORE_OBJECT_free(object); | ||
| 933 | |||
| 934 | if (!i) | ||
| 935 | { | ||
| 936 | STOREerr(STORE_F_STORE_STORE_CRL, | ||
| 937 | STORE_R_FAILED_STORING_KEY); | ||
| 938 | return 0; | ||
| 939 | } | ||
| 940 | return i; | ||
| 941 | } | ||
| 942 | |||
| 943 | int STORE_modify_crl(STORE *s, OPENSSL_ITEM search_attributes[], | ||
| 944 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 945 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]) | ||
| 946 | { | ||
| 947 | check_store(s,STORE_F_STORE_MODIFY_CRL, | ||
| 948 | modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION); | ||
| 949 | |||
| 950 | if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_X509_CRL, | ||
| 951 | search_attributes, add_attributes, modify_attributes, | ||
| 952 | delete_attributes, parameters)) | ||
| 953 | { | ||
| 954 | STOREerr(STORE_F_STORE_MODIFY_CRL, | ||
| 955 | STORE_R_FAILED_MODIFYING_CRL); | ||
| 956 | return 0; | ||
| 957 | } | ||
| 958 | return 1; | ||
| 959 | } | ||
| 960 | |||
| 961 | int STORE_delete_crl(STORE *s, OPENSSL_ITEM attributes[], | ||
| 962 | OPENSSL_ITEM parameters[]) | ||
| 963 | { | ||
| 964 | check_store(s,STORE_F_STORE_DELETE_CRL, | ||
| 965 | delete_object,STORE_R_NO_DELETE_OBJECT_FUNCTION); | ||
| 966 | |||
| 967 | if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_X509_CRL, | ||
| 968 | attributes, parameters)) | ||
| 969 | { | ||
| 970 | STOREerr(STORE_F_STORE_DELETE_CRL, | ||
| 971 | STORE_R_FAILED_DELETING_KEY); | ||
| 972 | return 0; | ||
| 973 | } | ||
| 974 | return 1; | ||
| 975 | } | ||
| 976 | |||
| 977 | void *STORE_list_crl_start(STORE *s, OPENSSL_ITEM attributes[], | ||
| 978 | OPENSSL_ITEM parameters[]) | ||
| 979 | { | ||
| 980 | void *handle; | ||
| 981 | |||
| 982 | check_store(s,STORE_F_STORE_LIST_CRL_START, | ||
| 983 | list_object_start,STORE_R_NO_LIST_OBJECT_START_FUNCTION); | ||
| 984 | |||
| 985 | handle = s->meth->list_object_start(s, STORE_OBJECT_TYPE_X509_CRL, | ||
| 986 | attributes, parameters); | ||
| 987 | if (!handle) | ||
| 988 | { | ||
| 989 | STOREerr(STORE_F_STORE_LIST_CRL_START, | ||
| 990 | STORE_R_FAILED_LISTING_KEYS); | ||
| 991 | return 0; | ||
| 992 | } | ||
| 993 | return handle; | ||
| 994 | } | ||
| 995 | |||
| 996 | X509_CRL *STORE_list_crl_next(STORE *s, void *handle) | ||
| 997 | { | ||
| 998 | STORE_OBJECT *object; | ||
| 999 | X509_CRL *crl; | ||
| 1000 | |||
| 1001 | check_store(s,STORE_F_STORE_LIST_CRL_NEXT, | ||
| 1002 | list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION); | ||
| 1003 | |||
| 1004 | object = s->meth->list_object_next(s, handle); | ||
| 1005 | if (!object || !object->data.crl) | ||
| 1006 | { | ||
| 1007 | STOREerr(STORE_F_STORE_LIST_CRL_NEXT, | ||
| 1008 | STORE_R_FAILED_LISTING_KEYS); | ||
| 1009 | return 0; | ||
| 1010 | } | ||
| 1011 | CRYPTO_add(&object->data.crl->references,1,CRYPTO_LOCK_X509_CRL); | ||
| 1012 | #ifdef REF_PRINT | ||
| 1013 | REF_PRINT("X509_CRL",data); | ||
| 1014 | #endif | ||
| 1015 | crl = object->data.crl; | ||
| 1016 | STORE_OBJECT_free(object); | ||
| 1017 | return crl; | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | int STORE_list_crl_end(STORE *s, void *handle) | ||
| 1021 | { | ||
| 1022 | check_store(s,STORE_F_STORE_LIST_CRL_END, | ||
| 1023 | list_object_end,STORE_R_NO_LIST_OBJECT_END_FUNCTION); | ||
| 1024 | |||
| 1025 | if (!s->meth->list_object_end(s, handle)) | ||
| 1026 | { | ||
| 1027 | STOREerr(STORE_F_STORE_LIST_CRL_END, | ||
| 1028 | STORE_R_FAILED_LISTING_KEYS); | ||
| 1029 | return 0; | ||
| 1030 | } | ||
| 1031 | return 1; | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | int STORE_list_crl_endp(STORE *s, void *handle) | ||
| 1035 | { | ||
| 1036 | check_store(s,STORE_F_STORE_LIST_CRL_ENDP, | ||
| 1037 | list_object_endp,STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION); | ||
| 1038 | |||
| 1039 | if (!s->meth->list_object_endp(s, handle)) | ||
| 1040 | { | ||
| 1041 | STOREerr(STORE_F_STORE_LIST_CRL_ENDP, | ||
| 1042 | STORE_R_FAILED_LISTING_KEYS); | ||
| 1043 | return 0; | ||
| 1044 | } | ||
| 1045 | return 1; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | int STORE_store_number(STORE *s, BIGNUM *data, OPENSSL_ITEM attributes[], | ||
| 1049 | OPENSSL_ITEM parameters[]) | ||
| 1050 | { | ||
| 1051 | STORE_OBJECT *object; | ||
| 1052 | int i; | ||
| 1053 | |||
| 1054 | check_store(s,STORE_F_STORE_STORE_NUMBER, | ||
| 1055 | store_object,STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION); | ||
| 1056 | |||
| 1057 | object = STORE_OBJECT_new(); | ||
| 1058 | if (!object) | ||
| 1059 | { | ||
| 1060 | STOREerr(STORE_F_STORE_STORE_NUMBER, | ||
| 1061 | ERR_R_MALLOC_FAILURE); | ||
| 1062 | return 0; | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | object->data.number = data; | ||
| 1066 | |||
| 1067 | i = s->meth->store_object(s, STORE_OBJECT_TYPE_NUMBER, object, | ||
| 1068 | attributes, parameters); | ||
| 1069 | |||
| 1070 | STORE_OBJECT_free(object); | ||
| 1071 | |||
| 1072 | if (!i) | ||
| 1073 | { | ||
| 1074 | STOREerr(STORE_F_STORE_STORE_NUMBER, | ||
| 1075 | STORE_R_FAILED_STORING_NUMBER); | ||
| 1076 | return 0; | ||
| 1077 | } | ||
| 1078 | return 1; | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | int STORE_modify_number(STORE *s, OPENSSL_ITEM search_attributes[], | ||
| 1082 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 1083 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]) | ||
| 1084 | { | ||
| 1085 | check_store(s,STORE_F_STORE_MODIFY_NUMBER, | ||
| 1086 | modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION); | ||
| 1087 | |||
| 1088 | if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_NUMBER, | ||
| 1089 | search_attributes, add_attributes, modify_attributes, | ||
| 1090 | delete_attributes, parameters)) | ||
| 1091 | { | ||
| 1092 | STOREerr(STORE_F_STORE_MODIFY_NUMBER, | ||
| 1093 | STORE_R_FAILED_MODIFYING_NUMBER); | ||
| 1094 | return 0; | ||
| 1095 | } | ||
| 1096 | return 1; | ||
| 1097 | } | ||
| 1098 | |||
| 1099 | BIGNUM *STORE_get_number(STORE *s, OPENSSL_ITEM attributes[], | ||
| 1100 | OPENSSL_ITEM parameters[]) | ||
| 1101 | { | ||
| 1102 | STORE_OBJECT *object; | ||
| 1103 | BIGNUM *n; | ||
| 1104 | |||
| 1105 | check_store(s,STORE_F_STORE_GET_NUMBER, | ||
| 1106 | get_object,STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION); | ||
| 1107 | |||
| 1108 | object = s->meth->get_object(s, STORE_OBJECT_TYPE_NUMBER, attributes, | ||
| 1109 | parameters); | ||
| 1110 | if (!object || !object->data.number) | ||
| 1111 | { | ||
| 1112 | STOREerr(STORE_F_STORE_GET_NUMBER, | ||
| 1113 | STORE_R_FAILED_GETTING_NUMBER); | ||
| 1114 | return 0; | ||
| 1115 | } | ||
| 1116 | n = object->data.number; | ||
| 1117 | object->data.number = NULL; | ||
| 1118 | STORE_OBJECT_free(object); | ||
| 1119 | return n; | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | int STORE_delete_number(STORE *s, OPENSSL_ITEM attributes[], | ||
| 1123 | OPENSSL_ITEM parameters[]) | ||
| 1124 | { | ||
| 1125 | check_store(s,STORE_F_STORE_DELETE_NUMBER, | ||
| 1126 | delete_object,STORE_R_NO_DELETE_NUMBER_FUNCTION); | ||
| 1127 | |||
| 1128 | if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_NUMBER, attributes, | ||
| 1129 | parameters)) | ||
| 1130 | { | ||
| 1131 | STOREerr(STORE_F_STORE_DELETE_NUMBER, | ||
| 1132 | STORE_R_FAILED_DELETING_NUMBER); | ||
| 1133 | return 0; | ||
| 1134 | } | ||
| 1135 | return 1; | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | int STORE_store_arbitrary(STORE *s, BUF_MEM *data, OPENSSL_ITEM attributes[], | ||
| 1139 | OPENSSL_ITEM parameters[]) | ||
| 1140 | { | ||
| 1141 | STORE_OBJECT *object; | ||
| 1142 | int i; | ||
| 1143 | |||
| 1144 | check_store(s,STORE_F_STORE_STORE_ARBITRARY, | ||
| 1145 | store_object,STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION); | ||
| 1146 | |||
| 1147 | object = STORE_OBJECT_new(); | ||
| 1148 | if (!object) | ||
| 1149 | { | ||
| 1150 | STOREerr(STORE_F_STORE_STORE_ARBITRARY, | ||
| 1151 | ERR_R_MALLOC_FAILURE); | ||
| 1152 | return 0; | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | object->data.arbitrary = data; | ||
| 1156 | |||
| 1157 | i = s->meth->store_object(s, STORE_OBJECT_TYPE_ARBITRARY, object, | ||
| 1158 | attributes, parameters); | ||
| 1159 | |||
| 1160 | STORE_OBJECT_free(object); | ||
| 1161 | |||
| 1162 | if (!i) | ||
| 1163 | { | ||
| 1164 | STOREerr(STORE_F_STORE_STORE_ARBITRARY, | ||
| 1165 | STORE_R_FAILED_STORING_ARBITRARY); | ||
| 1166 | return 0; | ||
| 1167 | } | ||
| 1168 | return 1; | ||
| 1169 | } | ||
| 1170 | |||
| 1171 | int STORE_modify_arbitrary(STORE *s, OPENSSL_ITEM search_attributes[], | ||
| 1172 | OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], | ||
| 1173 | OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]) | ||
| 1174 | { | ||
| 1175 | check_store(s,STORE_F_STORE_MODIFY_ARBITRARY, | ||
| 1176 | modify_object,STORE_R_NO_MODIFY_OBJECT_FUNCTION); | ||
| 1177 | |||
| 1178 | if (!s->meth->modify_object(s, STORE_OBJECT_TYPE_ARBITRARY, | ||
| 1179 | search_attributes, add_attributes, modify_attributes, | ||
| 1180 | delete_attributes, parameters)) | ||
| 1181 | { | ||
| 1182 | STOREerr(STORE_F_STORE_MODIFY_ARBITRARY, | ||
| 1183 | STORE_R_FAILED_MODIFYING_ARBITRARY); | ||
| 1184 | return 0; | ||
| 1185 | } | ||
| 1186 | return 1; | ||
| 1187 | } | ||
| 1188 | |||
| 1189 | BUF_MEM *STORE_get_arbitrary(STORE *s, OPENSSL_ITEM attributes[], | ||
| 1190 | OPENSSL_ITEM parameters[]) | ||
| 1191 | { | ||
| 1192 | STORE_OBJECT *object; | ||
| 1193 | BUF_MEM *b; | ||
| 1194 | |||
| 1195 | check_store(s,STORE_F_STORE_GET_ARBITRARY, | ||
| 1196 | get_object,STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION); | ||
| 1197 | |||
| 1198 | object = s->meth->get_object(s, STORE_OBJECT_TYPE_ARBITRARY, | ||
| 1199 | attributes, parameters); | ||
| 1200 | if (!object || !object->data.arbitrary) | ||
| 1201 | { | ||
| 1202 | STOREerr(STORE_F_STORE_GET_ARBITRARY, | ||
| 1203 | STORE_R_FAILED_GETTING_ARBITRARY); | ||
| 1204 | return 0; | ||
| 1205 | } | ||
| 1206 | b = object->data.arbitrary; | ||
| 1207 | object->data.arbitrary = NULL; | ||
| 1208 | STORE_OBJECT_free(object); | ||
| 1209 | return b; | ||
| 1210 | } | ||
| 1211 | |||
| 1212 | int STORE_delete_arbitrary(STORE *s, OPENSSL_ITEM attributes[], | ||
| 1213 | OPENSSL_ITEM parameters[]) | ||
| 1214 | { | ||
| 1215 | check_store(s,STORE_F_STORE_DELETE_ARBITRARY, | ||
| 1216 | delete_object,STORE_R_NO_DELETE_ARBITRARY_FUNCTION); | ||
| 1217 | |||
| 1218 | if (!s->meth->delete_object(s, STORE_OBJECT_TYPE_ARBITRARY, attributes, | ||
| 1219 | parameters)) | ||
| 1220 | { | ||
| 1221 | STOREerr(STORE_F_STORE_DELETE_ARBITRARY, | ||
| 1222 | STORE_R_FAILED_DELETING_ARBITRARY); | ||
| 1223 | return 0; | ||
| 1224 | } | ||
| 1225 | return 1; | ||
| 1226 | } | ||
| 1227 | |||
| 1228 | STORE_OBJECT *STORE_OBJECT_new(void) | ||
| 1229 | { | ||
| 1230 | STORE_OBJECT *object = OPENSSL_malloc(sizeof(STORE_OBJECT)); | ||
| 1231 | if (object) memset(object, 0, sizeof(STORE_OBJECT)); | ||
| 1232 | return object; | ||
| 1233 | } | ||
| 1234 | void STORE_OBJECT_free(STORE_OBJECT *data) | ||
| 1235 | { | ||
| 1236 | if (!data) return; | ||
| 1237 | switch (data->type) | ||
| 1238 | { | ||
| 1239 | case STORE_OBJECT_TYPE_X509_CERTIFICATE: | ||
| 1240 | X509_free(data->data.x509.certificate); | ||
| 1241 | break; | ||
| 1242 | case STORE_OBJECT_TYPE_X509_CRL: | ||
| 1243 | X509_CRL_free(data->data.crl); | ||
| 1244 | break; | ||
| 1245 | case STORE_OBJECT_TYPE_PRIVATE_KEY: | ||
| 1246 | case STORE_OBJECT_TYPE_PUBLIC_KEY: | ||
| 1247 | EVP_PKEY_free(data->data.key); | ||
| 1248 | break; | ||
| 1249 | case STORE_OBJECT_TYPE_NUMBER: | ||
| 1250 | BN_free(data->data.number); | ||
| 1251 | break; | ||
| 1252 | case STORE_OBJECT_TYPE_ARBITRARY: | ||
| 1253 | BUF_MEM_free(data->data.arbitrary); | ||
| 1254 | break; | ||
| 1255 | } | ||
| 1256 | OPENSSL_free(data); | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | IMPLEMENT_STACK_OF(STORE_OBJECT*) | ||
| 1260 | |||
| 1261 | |||
| 1262 | struct STORE_attr_info_st | ||
| 1263 | { | ||
| 1264 | unsigned char set[(STORE_ATTR_TYPE_NUM + 8) / 8]; | ||
| 1265 | union | ||
| 1266 | { | ||
| 1267 | char *cstring; | ||
| 1268 | unsigned char *sha1string; | ||
| 1269 | X509_NAME *dn; | ||
| 1270 | BIGNUM *number; | ||
| 1271 | void *any; | ||
| 1272 | } values[STORE_ATTR_TYPE_NUM+1]; | ||
| 1273 | size_t value_sizes[STORE_ATTR_TYPE_NUM+1]; | ||
| 1274 | }; | ||
| 1275 | |||
| 1276 | #define ATTR_IS_SET(a,i) ((i) > 0 && (i) < STORE_ATTR_TYPE_NUM \ | ||
| 1277 | && ((a)->set[(i) / 8] & (1 << ((i) % 8)))) | ||
| 1278 | #define SET_ATTRBIT(a,i) ((a)->set[(i) / 8] |= (1 << ((i) % 8))) | ||
| 1279 | #define CLEAR_ATTRBIT(a,i) ((a)->set[(i) / 8] &= ~(1 << ((i) % 8))) | ||
| 1280 | |||
| 1281 | STORE_ATTR_INFO *STORE_ATTR_INFO_new(void) | ||
| 1282 | { | ||
| 1283 | return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO)); | ||
| 1284 | } | ||
| 1285 | static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, | ||
| 1286 | STORE_ATTR_TYPES code) | ||
| 1287 | { | ||
| 1288 | if (ATTR_IS_SET(attrs,code)) | ||
| 1289 | { | ||
| 1290 | switch(code) | ||
| 1291 | { | ||
| 1292 | case STORE_ATTR_FRIENDLYNAME: | ||
| 1293 | case STORE_ATTR_EMAIL: | ||
| 1294 | case STORE_ATTR_FILENAME: | ||
| 1295 | STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0); | ||
| 1296 | break; | ||
| 1297 | case STORE_ATTR_KEYID: | ||
| 1298 | case STORE_ATTR_ISSUERKEYID: | ||
| 1299 | case STORE_ATTR_SUBJECTKEYID: | ||
| 1300 | case STORE_ATTR_ISSUERSERIALHASH: | ||
| 1301 | case STORE_ATTR_CERTHASH: | ||
| 1302 | STORE_ATTR_INFO_modify_sha1str(attrs, code, NULL, 0); | ||
| 1303 | break; | ||
| 1304 | case STORE_ATTR_ISSUER: | ||
| 1305 | case STORE_ATTR_SUBJECT: | ||
| 1306 | STORE_ATTR_INFO_modify_dn(attrs, code, NULL); | ||
| 1307 | break; | ||
| 1308 | case STORE_ATTR_SERIAL: | ||
| 1309 | STORE_ATTR_INFO_modify_number(attrs, code, NULL); | ||
| 1310 | break; | ||
| 1311 | default: | ||
| 1312 | break; | ||
| 1313 | } | ||
| 1314 | } | ||
| 1315 | } | ||
| 1316 | int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs) | ||
| 1317 | { | ||
| 1318 | if (attrs) | ||
| 1319 | { | ||
| 1320 | STORE_ATTR_TYPES i; | ||
| 1321 | for(i = 0; i++ < STORE_ATTR_TYPE_NUM;) | ||
| 1322 | STORE_ATTR_INFO_attr_free(attrs, i); | ||
| 1323 | OPENSSL_free(attrs); | ||
| 1324 | } | ||
| 1325 | return 1; | ||
| 1326 | } | ||
| 1327 | char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code) | ||
| 1328 | { | ||
| 1329 | if (!attrs) | ||
| 1330 | { | ||
| 1331 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_CSTR, | ||
| 1332 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1333 | return NULL; | ||
| 1334 | } | ||
| 1335 | if (ATTR_IS_SET(attrs,code)) | ||
| 1336 | return attrs->values[code].cstring; | ||
| 1337 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_CSTR, | ||
| 1338 | STORE_R_NO_VALUE); | ||
| 1339 | return NULL; | ||
| 1340 | } | ||
| 1341 | unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs, | ||
| 1342 | STORE_ATTR_TYPES code) | ||
| 1343 | { | ||
| 1344 | if (!attrs) | ||
| 1345 | { | ||
| 1346 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_SHA1STR, | ||
| 1347 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1348 | return NULL; | ||
| 1349 | } | ||
| 1350 | if (ATTR_IS_SET(attrs,code)) | ||
| 1351 | return attrs->values[code].sha1string; | ||
| 1352 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_SHA1STR, | ||
| 1353 | STORE_R_NO_VALUE); | ||
| 1354 | return NULL; | ||
| 1355 | } | ||
| 1356 | X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code) | ||
| 1357 | { | ||
| 1358 | if (!attrs) | ||
| 1359 | { | ||
| 1360 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_DN, | ||
| 1361 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1362 | return NULL; | ||
| 1363 | } | ||
| 1364 | if (ATTR_IS_SET(attrs,code)) | ||
| 1365 | return attrs->values[code].dn; | ||
| 1366 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_DN, | ||
| 1367 | STORE_R_NO_VALUE); | ||
| 1368 | return NULL; | ||
| 1369 | } | ||
| 1370 | BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code) | ||
| 1371 | { | ||
| 1372 | if (!attrs) | ||
| 1373 | { | ||
| 1374 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_NUMBER, | ||
| 1375 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1376 | return NULL; | ||
| 1377 | } | ||
| 1378 | if (ATTR_IS_SET(attrs,code)) | ||
| 1379 | return attrs->values[code].number; | ||
| 1380 | STOREerr(STORE_F_STORE_ATTR_INFO_GET0_NUMBER, | ||
| 1381 | STORE_R_NO_VALUE); | ||
| 1382 | return NULL; | ||
| 1383 | } | ||
| 1384 | int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1385 | char *cstr, size_t cstr_size) | ||
| 1386 | { | ||
| 1387 | if (!attrs) | ||
| 1388 | { | ||
| 1389 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR, | ||
| 1390 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1391 | return 0; | ||
| 1392 | } | ||
| 1393 | if (!ATTR_IS_SET(attrs,code)) | ||
| 1394 | { | ||
| 1395 | if ((attrs->values[code].cstring = BUF_strndup(cstr, cstr_size))) | ||
| 1396 | return 1; | ||
| 1397 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR, | ||
| 1398 | ERR_R_MALLOC_FAILURE); | ||
| 1399 | return 0; | ||
| 1400 | } | ||
| 1401 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_CSTR, STORE_R_ALREADY_HAS_A_VALUE); | ||
| 1402 | return 0; | ||
| 1403 | } | ||
| 1404 | int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1405 | unsigned char *sha1str, size_t sha1str_size) | ||
| 1406 | { | ||
| 1407 | if (!attrs) | ||
| 1408 | { | ||
| 1409 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, | ||
| 1410 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1411 | return 0; | ||
| 1412 | } | ||
| 1413 | if (!ATTR_IS_SET(attrs,code)) | ||
| 1414 | { | ||
| 1415 | if ((attrs->values[code].sha1string = | ||
| 1416 | (unsigned char *)BUF_memdup(sha1str, | ||
| 1417 | sha1str_size))) | ||
| 1418 | return 1; | ||
| 1419 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, | ||
| 1420 | ERR_R_MALLOC_FAILURE); | ||
| 1421 | return 0; | ||
| 1422 | } | ||
| 1423 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, STORE_R_ALREADY_HAS_A_VALUE); | ||
| 1424 | return 0; | ||
| 1425 | } | ||
| 1426 | int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1427 | X509_NAME *dn) | ||
| 1428 | { | ||
| 1429 | if (!attrs) | ||
| 1430 | { | ||
| 1431 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_DN, | ||
| 1432 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1433 | return 0; | ||
| 1434 | } | ||
| 1435 | if (!ATTR_IS_SET(attrs,code)) | ||
| 1436 | { | ||
| 1437 | if ((attrs->values[code].dn = X509_NAME_dup(dn))) | ||
| 1438 | return 1; | ||
| 1439 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_DN, | ||
| 1440 | ERR_R_MALLOC_FAILURE); | ||
| 1441 | return 0; | ||
| 1442 | } | ||
| 1443 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_DN, STORE_R_ALREADY_HAS_A_VALUE); | ||
| 1444 | return 0; | ||
| 1445 | } | ||
| 1446 | int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1447 | BIGNUM *number) | ||
| 1448 | { | ||
| 1449 | if (!attrs) | ||
| 1450 | { | ||
| 1451 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_NUMBER, | ||
| 1452 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1453 | return 0; | ||
| 1454 | } | ||
| 1455 | if (!ATTR_IS_SET(attrs,code)) | ||
| 1456 | { | ||
| 1457 | if ((attrs->values[code].number = BN_dup(number))) | ||
| 1458 | return 1; | ||
| 1459 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_NUMBER, | ||
| 1460 | ERR_R_MALLOC_FAILURE); | ||
| 1461 | return 0; | ||
| 1462 | } | ||
| 1463 | STOREerr(STORE_F_STORE_ATTR_INFO_SET_NUMBER, STORE_R_ALREADY_HAS_A_VALUE); | ||
| 1464 | return 0; | ||
| 1465 | } | ||
| 1466 | int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1467 | char *cstr, size_t cstr_size) | ||
| 1468 | { | ||
| 1469 | if (!attrs) | ||
| 1470 | { | ||
| 1471 | STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_CSTR, | ||
| 1472 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1473 | return 0; | ||
| 1474 | } | ||
| 1475 | if (ATTR_IS_SET(attrs,code)) | ||
| 1476 | { | ||
| 1477 | OPENSSL_free(attrs->values[code].cstring); | ||
| 1478 | attrs->values[code].cstring = NULL; | ||
| 1479 | CLEAR_ATTRBIT(attrs, code); | ||
| 1480 | } | ||
| 1481 | return STORE_ATTR_INFO_set_cstr(attrs, code, cstr, cstr_size); | ||
| 1482 | } | ||
| 1483 | int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1484 | unsigned char *sha1str, size_t sha1str_size) | ||
| 1485 | { | ||
| 1486 | if (!attrs) | ||
| 1487 | { | ||
| 1488 | STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR, | ||
| 1489 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1490 | return 0; | ||
| 1491 | } | ||
| 1492 | if (ATTR_IS_SET(attrs,code)) | ||
| 1493 | { | ||
| 1494 | OPENSSL_free(attrs->values[code].sha1string); | ||
| 1495 | attrs->values[code].sha1string = NULL; | ||
| 1496 | CLEAR_ATTRBIT(attrs, code); | ||
| 1497 | } | ||
| 1498 | return STORE_ATTR_INFO_set_sha1str(attrs, code, sha1str, sha1str_size); | ||
| 1499 | } | ||
| 1500 | int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1501 | X509_NAME *dn) | ||
| 1502 | { | ||
| 1503 | if (!attrs) | ||
| 1504 | { | ||
| 1505 | STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_DN, | ||
| 1506 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1507 | return 0; | ||
| 1508 | } | ||
| 1509 | if (ATTR_IS_SET(attrs,code)) | ||
| 1510 | { | ||
| 1511 | OPENSSL_free(attrs->values[code].dn); | ||
| 1512 | attrs->values[code].dn = NULL; | ||
| 1513 | CLEAR_ATTRBIT(attrs, code); | ||
| 1514 | } | ||
| 1515 | return STORE_ATTR_INFO_set_dn(attrs, code, dn); | ||
| 1516 | } | ||
| 1517 | int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, | ||
| 1518 | BIGNUM *number) | ||
| 1519 | { | ||
| 1520 | if (!attrs) | ||
| 1521 | { | ||
| 1522 | STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER, | ||
| 1523 | ERR_R_PASSED_NULL_PARAMETER); | ||
| 1524 | return 0; | ||
| 1525 | } | ||
| 1526 | if (ATTR_IS_SET(attrs,code)) | ||
| 1527 | { | ||
| 1528 | OPENSSL_free(attrs->values[code].number); | ||
| 1529 | attrs->values[code].number = NULL; | ||
| 1530 | CLEAR_ATTRBIT(attrs, code); | ||
| 1531 | } | ||
| 1532 | return STORE_ATTR_INFO_set_number(attrs, code, number); | ||
| 1533 | } | ||
| 1534 | |||
| 1535 | struct attr_list_ctx_st | ||
| 1536 | { | ||
| 1537 | OPENSSL_ITEM *attributes; | ||
| 1538 | }; | ||
| 1539 | void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes) | ||
| 1540 | { | ||
| 1541 | if (attributes) | ||
| 1542 | { | ||
| 1543 | struct attr_list_ctx_st *context = | ||
| 1544 | (struct attr_list_ctx_st *)OPENSSL_malloc(sizeof(struct attr_list_ctx_st)); | ||
| 1545 | if (context) | ||
| 1546 | context->attributes = attributes; | ||
| 1547 | else | ||
| 1548 | STOREerr(STORE_F_STORE_PARSE_ATTRS_START, | ||
| 1549 | ERR_R_MALLOC_FAILURE); | ||
| 1550 | return context; | ||
| 1551 | } | ||
| 1552 | STOREerr(STORE_F_STORE_PARSE_ATTRS_START, ERR_R_PASSED_NULL_PARAMETER); | ||
| 1553 | return 0; | ||
| 1554 | } | ||
| 1555 | STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle) | ||
| 1556 | { | ||
| 1557 | struct attr_list_ctx_st *context = (struct attr_list_ctx_st *)handle; | ||
| 1558 | |||
| 1559 | if (context && context->attributes) | ||
| 1560 | { | ||
| 1561 | STORE_ATTR_INFO *attrs = NULL; | ||
| 1562 | |||
| 1563 | while(context->attributes | ||
| 1564 | && context->attributes->code != STORE_ATTR_OR | ||
| 1565 | && context->attributes->code != STORE_ATTR_END) | ||
| 1566 | { | ||
| 1567 | switch(context->attributes->code) | ||
| 1568 | { | ||
| 1569 | case STORE_ATTR_FRIENDLYNAME: | ||
| 1570 | case STORE_ATTR_EMAIL: | ||
| 1571 | case STORE_ATTR_FILENAME: | ||
| 1572 | if (!attrs) attrs = STORE_ATTR_INFO_new(); | ||
| 1573 | if (attrs == NULL) | ||
| 1574 | { | ||
| 1575 | STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT, | ||
| 1576 | ERR_R_MALLOC_FAILURE); | ||
| 1577 | goto err; | ||
| 1578 | } | ||
| 1579 | STORE_ATTR_INFO_set_cstr(attrs, | ||
| 1580 | context->attributes->code, | ||
| 1581 | context->attributes->value, | ||
| 1582 | context->attributes->value_size); | ||
| 1583 | break; | ||
| 1584 | case STORE_ATTR_KEYID: | ||
| 1585 | case STORE_ATTR_ISSUERKEYID: | ||
| 1586 | case STORE_ATTR_SUBJECTKEYID: | ||
| 1587 | case STORE_ATTR_ISSUERSERIALHASH: | ||
| 1588 | case STORE_ATTR_CERTHASH: | ||
| 1589 | if (!attrs) attrs = STORE_ATTR_INFO_new(); | ||
| 1590 | if (attrs == NULL) | ||
| 1591 | { | ||
| 1592 | STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT, | ||
| 1593 | ERR_R_MALLOC_FAILURE); | ||
| 1594 | goto err; | ||
| 1595 | } | ||
| 1596 | STORE_ATTR_INFO_set_sha1str(attrs, | ||
| 1597 | context->attributes->code, | ||
| 1598 | context->attributes->value, | ||
| 1599 | context->attributes->value_size); | ||
| 1600 | break; | ||
| 1601 | case STORE_ATTR_ISSUER: | ||
| 1602 | case STORE_ATTR_SUBJECT: | ||
| 1603 | if (!attrs) attrs = STORE_ATTR_INFO_new(); | ||
| 1604 | if (attrs == NULL) | ||
| 1605 | { | ||
| 1606 | STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT, | ||
| 1607 | ERR_R_MALLOC_FAILURE); | ||
| 1608 | goto err; | ||
| 1609 | } | ||
| 1610 | STORE_ATTR_INFO_modify_dn(attrs, | ||
| 1611 | context->attributes->code, | ||
| 1612 | context->attributes->value); | ||
| 1613 | break; | ||
| 1614 | case STORE_ATTR_SERIAL: | ||
| 1615 | if (!attrs) attrs = STORE_ATTR_INFO_new(); | ||
| 1616 | if (attrs == NULL) | ||
| 1617 | { | ||
| 1618 | STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT, | ||
| 1619 | ERR_R_MALLOC_FAILURE); | ||
| 1620 | goto err; | ||
| 1621 | } | ||
| 1622 | STORE_ATTR_INFO_modify_number(attrs, | ||
| 1623 | context->attributes->code, | ||
| 1624 | context->attributes->value); | ||
| 1625 | break; | ||
| 1626 | } | ||
| 1627 | context->attributes++; | ||
| 1628 | } | ||
| 1629 | if (context->attributes->code == STORE_ATTR_OR) | ||
| 1630 | context->attributes++; | ||
| 1631 | return attrs; | ||
| 1632 | err: | ||
| 1633 | while(context->attributes | ||
| 1634 | && context->attributes->code != STORE_ATTR_OR | ||
| 1635 | && context->attributes->code != STORE_ATTR_END) | ||
| 1636 | context->attributes++; | ||
| 1637 | if (context->attributes->code == STORE_ATTR_OR) | ||
| 1638 | context->attributes++; | ||
| 1639 | return NULL; | ||
| 1640 | } | ||
| 1641 | STOREerr(STORE_F_STORE_PARSE_ATTRS_NEXT, ERR_R_PASSED_NULL_PARAMETER); | ||
| 1642 | return NULL; | ||
| 1643 | } | ||
| 1644 | int STORE_parse_attrs_end(void *handle) | ||
| 1645 | { | ||
| 1646 | struct attr_list_ctx_st *context = (struct attr_list_ctx_st *)handle; | ||
| 1647 | |||
| 1648 | if (context && context->attributes) | ||
| 1649 | { | ||
| 1650 | #if 0 | ||
| 1651 | OPENSSL_ITEM *attributes = context->attributes; | ||
| 1652 | #endif | ||
| 1653 | OPENSSL_free(context); | ||
| 1654 | return 1; | ||
| 1655 | } | ||
| 1656 | STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER); | ||
| 1657 | return 0; | ||
| 1658 | } | ||
| 1659 | |||
| 1660 | int STORE_parse_attrs_endp(void *handle) | ||
| 1661 | { | ||
| 1662 | struct attr_list_ctx_st *context = (struct attr_list_ctx_st *)handle; | ||
| 1663 | |||
| 1664 | if (context && context->attributes) | ||
| 1665 | { | ||
| 1666 | return context->attributes->code == STORE_ATTR_END; | ||
| 1667 | } | ||
| 1668 | STOREerr(STORE_F_STORE_PARSE_ATTRS_ENDP, ERR_R_PASSED_NULL_PARAMETER); | ||
| 1669 | return 0; | ||
| 1670 | } | ||
| 1671 | |||
| 1672 | static int attr_info_compare_compute_range( | ||
| 1673 | const unsigned char *abits, const unsigned char *bbits, | ||
| 1674 | unsigned int *alowp, unsigned int *ahighp, | ||
| 1675 | unsigned int *blowp, unsigned int *bhighp) | ||
| 1676 | { | ||
| 1677 | unsigned int alow = (unsigned int)-1, ahigh = 0; | ||
| 1678 | unsigned int blow = (unsigned int)-1, bhigh = 0; | ||
| 1679 | int i, res = 0; | ||
| 1680 | |||
| 1681 | for (i = 0; i < (STORE_ATTR_TYPE_NUM + 8) / 8; i++, abits++, bbits++) | ||
| 1682 | { | ||
| 1683 | if (res == 0) | ||
| 1684 | { | ||
| 1685 | if (*abits < *bbits) res = -1; | ||
| 1686 | if (*abits > *bbits) res = 1; | ||
| 1687 | } | ||
| 1688 | if (*abits) | ||
| 1689 | { | ||
| 1690 | if (alow == (unsigned int)-1) | ||
| 1691 | { | ||
| 1692 | alow = i * 8; | ||
| 1693 | if (!(*abits & 0x01)) alow++; | ||
| 1694 | if (!(*abits & 0x02)) alow++; | ||
| 1695 | if (!(*abits & 0x04)) alow++; | ||
| 1696 | if (!(*abits & 0x08)) alow++; | ||
| 1697 | if (!(*abits & 0x10)) alow++; | ||
| 1698 | if (!(*abits & 0x20)) alow++; | ||
| 1699 | if (!(*abits & 0x40)) alow++; | ||
| 1700 | } | ||
| 1701 | ahigh = i * 8 + 7; | ||
| 1702 | if (!(*abits & 0x80)) ahigh++; | ||
| 1703 | if (!(*abits & 0x40)) ahigh++; | ||
| 1704 | if (!(*abits & 0x20)) ahigh++; | ||
| 1705 | if (!(*abits & 0x10)) ahigh++; | ||
| 1706 | if (!(*abits & 0x08)) ahigh++; | ||
| 1707 | if (!(*abits & 0x04)) ahigh++; | ||
| 1708 | if (!(*abits & 0x02)) ahigh++; | ||
| 1709 | } | ||
| 1710 | if (*bbits) | ||
| 1711 | { | ||
| 1712 | if (blow == (unsigned int)-1) | ||
| 1713 | { | ||
| 1714 | blow = i * 8; | ||
| 1715 | if (!(*bbits & 0x01)) blow++; | ||
| 1716 | if (!(*bbits & 0x02)) blow++; | ||
| 1717 | if (!(*bbits & 0x04)) blow++; | ||
| 1718 | if (!(*bbits & 0x08)) blow++; | ||
| 1719 | if (!(*bbits & 0x10)) blow++; | ||
| 1720 | if (!(*bbits & 0x20)) blow++; | ||
| 1721 | if (!(*bbits & 0x40)) blow++; | ||
| 1722 | } | ||
| 1723 | bhigh = i * 8 + 7; | ||
| 1724 | if (!(*bbits & 0x80)) bhigh++; | ||
| 1725 | if (!(*bbits & 0x40)) bhigh++; | ||
| 1726 | if (!(*bbits & 0x20)) bhigh++; | ||
| 1727 | if (!(*bbits & 0x10)) bhigh++; | ||
| 1728 | if (!(*bbits & 0x08)) bhigh++; | ||
| 1729 | if (!(*bbits & 0x04)) bhigh++; | ||
| 1730 | if (!(*bbits & 0x02)) bhigh++; | ||
| 1731 | } | ||
| 1732 | } | ||
| 1733 | if (ahigh + alow < bhigh + blow) res = -1; | ||
| 1734 | if (ahigh + alow > bhigh + blow) res = 1; | ||
| 1735 | if (alowp) *alowp = alow; | ||
| 1736 | if (ahighp) *ahighp = ahigh; | ||
| 1737 | if (blowp) *blowp = blow; | ||
| 1738 | if (bhighp) *bhighp = bhigh; | ||
| 1739 | return res; | ||
| 1740 | } | ||
| 1741 | |||
| 1742 | int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a, | ||
| 1743 | const STORE_ATTR_INFO * const *b) | ||
| 1744 | { | ||
| 1745 | if (a == b) return 0; | ||
| 1746 | if (!a) return -1; | ||
| 1747 | if (!b) return 1; | ||
| 1748 | return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0); | ||
| 1749 | } | ||
| 1750 | |||
| 1751 | int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | ||
| 1752 | { | ||
| 1753 | unsigned int alow, ahigh, blow, bhigh; | ||
| 1754 | |||
| 1755 | if (a == b) return 1; | ||
| 1756 | if (!a) return 0; | ||
| 1757 | if (!b) return 0; | ||
| 1758 | attr_info_compare_compute_range(a->set, b->set, | ||
| 1759 | &alow, &ahigh, &blow, &bhigh); | ||
| 1760 | if (alow >= blow && ahigh <= bhigh) | ||
| 1761 | return 1; | ||
| 1762 | return 0; | ||
| 1763 | } | ||
| 1764 | |||
| 1765 | int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | ||
| 1766 | { | ||
| 1767 | unsigned char *abits, *bbits; | ||
| 1768 | int i; | ||
| 1769 | |||
| 1770 | if (a == b) return 1; | ||
| 1771 | if (!a) return 0; | ||
| 1772 | if (!b) return 0; | ||
| 1773 | abits = a->set; | ||
| 1774 | bbits = b->set; | ||
| 1775 | for (i = 0; i < (STORE_ATTR_TYPE_NUM + 8) / 8; i++, abits++, bbits++) | ||
| 1776 | { | ||
| 1777 | if (*abits && (*bbits & *abits) != *abits) | ||
| 1778 | return 0; | ||
| 1779 | } | ||
| 1780 | return 1; | ||
| 1781 | } | ||
| 1782 | |||
| 1783 | int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b) | ||
| 1784 | { | ||
| 1785 | STORE_ATTR_TYPES i; | ||
| 1786 | |||
| 1787 | if (a == b) return 1; | ||
| 1788 | if (!STORE_ATTR_INFO_in(a, b)) return 0; | ||
| 1789 | for (i = 1; i < STORE_ATTR_TYPE_NUM; i++) | ||
| 1790 | if (ATTR_IS_SET(a, i)) | ||
| 1791 | { | ||
| 1792 | switch(i) | ||
| 1793 | { | ||
| 1794 | case STORE_ATTR_FRIENDLYNAME: | ||
| 1795 | case STORE_ATTR_EMAIL: | ||
| 1796 | case STORE_ATTR_FILENAME: | ||
| 1797 | if (strcmp(a->values[i].cstring, | ||
| 1798 | b->values[i].cstring)) | ||
| 1799 | return 0; | ||
| 1800 | break; | ||
| 1801 | case STORE_ATTR_KEYID: | ||
| 1802 | case STORE_ATTR_ISSUERKEYID: | ||
| 1803 | case STORE_ATTR_SUBJECTKEYID: | ||
| 1804 | case STORE_ATTR_ISSUERSERIALHASH: | ||
| 1805 | case STORE_ATTR_CERTHASH: | ||
| 1806 | if (memcmp(a->values[i].sha1string, | ||
| 1807 | b->values[i].sha1string, | ||
| 1808 | a->value_sizes[i])) | ||
| 1809 | return 0; | ||
| 1810 | break; | ||
| 1811 | case STORE_ATTR_ISSUER: | ||
| 1812 | case STORE_ATTR_SUBJECT: | ||
| 1813 | if (X509_NAME_cmp(a->values[i].dn, | ||
| 1814 | b->values[i].dn)) | ||
| 1815 | return 0; | ||
| 1816 | break; | ||
| 1817 | case STORE_ATTR_SERIAL: | ||
| 1818 | if (BN_cmp(a->values[i].number, | ||
| 1819 | b->values[i].number)) | ||
| 1820 | return 0; | ||
| 1821 | break; | ||
| 1822 | default: | ||
| 1823 | break; | ||
| 1824 | } | ||
| 1825 | } | ||
| 1826 | |||
| 1827 | return 1; | ||
| 1828 | } | ||
diff --git a/src/lib/libcrypto/store/str_locl.h b/src/lib/libcrypto/store/str_locl.h new file mode 100644 index 0000000000..3f8cb75619 --- /dev/null +++ b/src/lib/libcrypto/store/str_locl.h | |||
| @@ -0,0 +1,124 @@ | |||
| 1 | /* crypto/store/str_locl.h -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2003. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #ifndef HEADER_STORE_LOCL_H | ||
| 60 | #define HEADER_STORE_LOCL_H | ||
| 61 | |||
| 62 | #include <openssl/crypto.h> | ||
| 63 | #include <openssl/store.h> | ||
| 64 | |||
| 65 | #ifdef __cplusplus | ||
| 66 | extern "C" { | ||
| 67 | #endif | ||
| 68 | |||
| 69 | struct store_method_st | ||
| 70 | { | ||
| 71 | char *name; | ||
| 72 | |||
| 73 | /* All the functions return a positive integer or non-NULL for success | ||
| 74 | and 0, a negative integer or NULL for failure */ | ||
| 75 | |||
| 76 | /* Initialise the STORE with private data */ | ||
| 77 | STORE_INITIALISE_FUNC_PTR init; | ||
| 78 | /* Initialise the STORE with private data */ | ||
| 79 | STORE_CLEANUP_FUNC_PTR clean; | ||
| 80 | /* Generate an object of a given type */ | ||
| 81 | STORE_GENERATE_OBJECT_FUNC_PTR generate_object; | ||
| 82 | /* Get an object of a given type. This function isn't really very | ||
| 83 | useful since the listing functions (below) can be used for the | ||
| 84 | same purpose and are much more general. */ | ||
| 85 | STORE_GET_OBJECT_FUNC_PTR get_object; | ||
| 86 | /* Store an object of a given type. */ | ||
| 87 | STORE_STORE_OBJECT_FUNC_PTR store_object; | ||
| 88 | /* Modify the attributes bound to an object of a given type. */ | ||
| 89 | STORE_MODIFY_OBJECT_FUNC_PTR modify_object; | ||
| 90 | /* Revoke an object of a given type. */ | ||
| 91 | STORE_HANDLE_OBJECT_FUNC_PTR revoke_object; | ||
| 92 | /* Delete an object of a given type. */ | ||
| 93 | STORE_HANDLE_OBJECT_FUNC_PTR delete_object; | ||
| 94 | /* List a bunch of objects of a given type and with the associated | ||
| 95 | attributes. */ | ||
| 96 | STORE_START_OBJECT_FUNC_PTR list_object_start; | ||
| 97 | STORE_NEXT_OBJECT_FUNC_PTR list_object_next; | ||
| 98 | STORE_END_OBJECT_FUNC_PTR list_object_end; | ||
| 99 | STORE_END_OBJECT_FUNC_PTR list_object_endp; | ||
| 100 | /* Store-level function to make any necessary update operations. */ | ||
| 101 | STORE_GENERIC_FUNC_PTR update_store; | ||
| 102 | /* Store-level function to get exclusive access to the store. */ | ||
| 103 | STORE_GENERIC_FUNC_PTR lock_store; | ||
| 104 | /* Store-level function to release exclusive access to the store. */ | ||
| 105 | STORE_GENERIC_FUNC_PTR unlock_store; | ||
| 106 | |||
| 107 | /* Generic control function */ | ||
| 108 | STORE_CTRL_FUNC_PTR ctrl; | ||
| 109 | }; | ||
| 110 | |||
| 111 | struct store_st | ||
| 112 | { | ||
| 113 | const STORE_METHOD *meth; | ||
| 114 | /* functional reference if 'meth' is ENGINE-provided */ | ||
| 115 | ENGINE *engine; | ||
| 116 | |||
| 117 | CRYPTO_EX_DATA ex_data; | ||
| 118 | int references; | ||
| 119 | }; | ||
| 120 | #ifdef __cplusplus | ||
| 121 | } | ||
| 122 | #endif | ||
| 123 | |||
| 124 | #endif | ||
diff --git a/src/lib/libcrypto/store/str_mem.c b/src/lib/libcrypto/store/str_mem.c new file mode 100644 index 0000000000..8ac4f7e55c --- /dev/null +++ b/src/lib/libcrypto/store/str_mem.c | |||
| @@ -0,0 +1,365 @@ | |||
| 1 | /* crypto/store/str_mem.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2003. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <string.h> | ||
| 60 | #include <openssl/err.h> | ||
| 61 | #include "str_locl.h" | ||
| 62 | |||
| 63 | /* The memory store is currently highly experimental. It's meant to become | ||
| 64 | a base store used by other stores for internal caching (for full caching | ||
| 65 | support, aging needs to be added). | ||
| 66 | |||
| 67 | The database use is meant to support as much attribute association as | ||
| 68 | possible, while providing for as small search ranges as possible. | ||
| 69 | This is currently provided for by sorting the entries by numbers that | ||
| 70 | are composed of bits set at the positions indicated by attribute type | ||
| 71 | codes. This provides for ranges determined by the highest attribute | ||
| 72 | type code value. A better idea might be to sort by values computed | ||
| 73 | from the range of attributes associated with the object (basically, | ||
| 74 | the difference between the highest and lowest attribute type code) | ||
| 75 | and it's distance from a base (basically, the lowest associated | ||
| 76 | attribute type code). | ||
| 77 | */ | ||
| 78 | |||
| 79 | typedef struct mem_object_data_st | ||
| 80 | { | ||
| 81 | STORE_OBJECT *object; | ||
| 82 | STORE_ATTR_INFO *attr_info; | ||
| 83 | int references; | ||
| 84 | } MEM_OBJECT_DATA; | ||
| 85 | |||
| 86 | DECLARE_STACK_OF(MEM_OBJECT_DATA) | ||
| 87 | struct mem_data_st | ||
| 88 | { | ||
| 89 | STACK_OF(MEM_OBJECT_DATA) *data; /* sorted with | ||
| 90 | * STORE_ATTR_INFO_compare(). */ | ||
| 91 | unsigned int compute_components : 1; /* Currently unused, but can | ||
| 92 | be used to add attributes | ||
| 93 | from parts of the data. */ | ||
| 94 | }; | ||
| 95 | |||
| 96 | DECLARE_STACK_OF(STORE_ATTR_INFO) | ||
| 97 | struct mem_ctx_st | ||
| 98 | { | ||
| 99 | int type; /* The type we're searching for */ | ||
| 100 | STACK_OF(STORE_ATTR_INFO) *search_attributes; /* Sets of | ||
| 101 | attributes to search for. Each | ||
| 102 | element is a STORE_ATTR_INFO. */ | ||
| 103 | int search_index; /* which of the search attributes we | ||
| 104 | found a match for, -1 when we still | ||
| 105 | haven't found any */ | ||
| 106 | int index; /* -1 as long as we're searching for | ||
| 107 | the first */ | ||
| 108 | }; | ||
| 109 | |||
| 110 | static int mem_init(STORE *s); | ||
| 111 | static void mem_clean(STORE *s); | ||
| 112 | static STORE_OBJECT *mem_generate(STORE *s, STORE_OBJECT_TYPES type, | ||
| 113 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 114 | static STORE_OBJECT *mem_get(STORE *s, STORE_OBJECT_TYPES type, | ||
| 115 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 116 | static int mem_store(STORE *s, STORE_OBJECT_TYPES type, | ||
| 117 | STORE_OBJECT *data, OPENSSL_ITEM attributes[], | ||
| 118 | OPENSSL_ITEM parameters[]); | ||
| 119 | static int mem_modify(STORE *s, STORE_OBJECT_TYPES type, | ||
| 120 | OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], | ||
| 121 | OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], | ||
| 122 | OPENSSL_ITEM parameters[]); | ||
| 123 | static int mem_delete(STORE *s, STORE_OBJECT_TYPES type, | ||
| 124 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 125 | static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | ||
| 126 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]); | ||
| 127 | static STORE_OBJECT *mem_list_next(STORE *s, void *handle); | ||
| 128 | static int mem_list_end(STORE *s, void *handle); | ||
| 129 | static int mem_list_endp(STORE *s, void *handle); | ||
| 130 | static int mem_lock(STORE *s, OPENSSL_ITEM attributes[], | ||
| 131 | OPENSSL_ITEM parameters[]); | ||
| 132 | static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[], | ||
| 133 | OPENSSL_ITEM parameters[]); | ||
| 134 | static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void)); | ||
| 135 | |||
| 136 | static STORE_METHOD store_memory = | ||
| 137 | { | ||
| 138 | "OpenSSL memory store interface", | ||
| 139 | mem_init, | ||
| 140 | mem_clean, | ||
| 141 | mem_generate, | ||
| 142 | mem_get, | ||
| 143 | mem_store, | ||
| 144 | mem_modify, | ||
| 145 | NULL, /* revoke */ | ||
| 146 | mem_delete, | ||
| 147 | mem_list_start, | ||
| 148 | mem_list_next, | ||
| 149 | mem_list_end, | ||
| 150 | mem_list_endp, | ||
| 151 | NULL, /* update */ | ||
| 152 | mem_lock, | ||
| 153 | mem_unlock, | ||
| 154 | mem_ctrl | ||
| 155 | }; | ||
| 156 | |||
| 157 | const STORE_METHOD *STORE_Memory(void) | ||
| 158 | { | ||
| 159 | return &store_memory; | ||
| 160 | } | ||
| 161 | |||
| 162 | static int mem_init(STORE *s) | ||
| 163 | { | ||
| 164 | return 1; | ||
| 165 | } | ||
| 166 | |||
| 167 | static void mem_clean(STORE *s) | ||
| 168 | { | ||
| 169 | return; | ||
| 170 | } | ||
| 171 | |||
| 172 | static STORE_OBJECT *mem_generate(STORE *s, STORE_OBJECT_TYPES type, | ||
| 173 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) | ||
| 174 | { | ||
| 175 | STOREerr(STORE_F_MEM_GENERATE, STORE_R_NOT_IMPLEMENTED); | ||
| 176 | return 0; | ||
| 177 | } | ||
| 178 | static STORE_OBJECT *mem_get(STORE *s, STORE_OBJECT_TYPES type, | ||
| 179 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) | ||
| 180 | { | ||
| 181 | void *context = mem_list_start(s, type, attributes, parameters); | ||
| 182 | |||
| 183 | if (context) | ||
| 184 | { | ||
| 185 | STORE_OBJECT *object = mem_list_next(s, context); | ||
| 186 | |||
| 187 | if (mem_list_end(s, context)) | ||
| 188 | return object; | ||
| 189 | } | ||
| 190 | return NULL; | ||
| 191 | } | ||
| 192 | static int mem_store(STORE *s, STORE_OBJECT_TYPES type, | ||
| 193 | STORE_OBJECT *data, OPENSSL_ITEM attributes[], | ||
| 194 | OPENSSL_ITEM parameters[]) | ||
| 195 | { | ||
| 196 | STOREerr(STORE_F_MEM_STORE, STORE_R_NOT_IMPLEMENTED); | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | static int mem_modify(STORE *s, STORE_OBJECT_TYPES type, | ||
| 200 | OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], | ||
| 201 | OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], | ||
| 202 | OPENSSL_ITEM parameters[]) | ||
| 203 | { | ||
| 204 | STOREerr(STORE_F_MEM_MODIFY, STORE_R_NOT_IMPLEMENTED); | ||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | static int mem_delete(STORE *s, STORE_OBJECT_TYPES type, | ||
| 208 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) | ||
| 209 | { | ||
| 210 | STOREerr(STORE_F_MEM_DELETE, STORE_R_NOT_IMPLEMENTED); | ||
| 211 | return 0; | ||
| 212 | } | ||
| 213 | |||
| 214 | /* The list functions may be the hardest to understand. Basically, | ||
| 215 | mem_list_start compiles a stack of attribute info elements, and | ||
| 216 | puts that stack into the context to be returned. mem_list_next | ||
| 217 | will then find the first matching element in the store, and then | ||
| 218 | walk all the way to the end of the store (since any combination | ||
| 219 | of attribute bits above the starting point may match the searched | ||
| 220 | for bit pattern...). */ | ||
| 221 | static void *mem_list_start(STORE *s, STORE_OBJECT_TYPES type, | ||
| 222 | OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]) | ||
| 223 | { | ||
| 224 | struct mem_ctx_st *context = | ||
| 225 | (struct mem_ctx_st *)OPENSSL_malloc(sizeof(struct mem_ctx_st)); | ||
| 226 | void *attribute_context = NULL; | ||
| 227 | STORE_ATTR_INFO *attrs = NULL; | ||
| 228 | |||
| 229 | if (!context) | ||
| 230 | { | ||
| 231 | STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE); | ||
| 232 | return 0; | ||
| 233 | } | ||
| 234 | memset(context, 0, sizeof(struct mem_ctx_st)); | ||
| 235 | |||
| 236 | attribute_context = STORE_parse_attrs_start(attributes); | ||
| 237 | if (!attribute_context) | ||
| 238 | { | ||
| 239 | STOREerr(STORE_F_MEM_LIST_START, ERR_R_STORE_LIB); | ||
| 240 | goto err; | ||
| 241 | } | ||
| 242 | |||
| 243 | while((attrs = STORE_parse_attrs_next(attribute_context))) | ||
| 244 | { | ||
| 245 | if (context->search_attributes == NULL) | ||
| 246 | { | ||
| 247 | context->search_attributes = | ||
| 248 | sk_STORE_ATTR_INFO_new(STORE_ATTR_INFO_compare); | ||
| 249 | if (!context->search_attributes) | ||
| 250 | { | ||
| 251 | STOREerr(STORE_F_MEM_LIST_START, | ||
| 252 | ERR_R_MALLOC_FAILURE); | ||
| 253 | goto err; | ||
| 254 | } | ||
| 255 | } | ||
| 256 | sk_STORE_ATTR_INFO_push(context->search_attributes,attrs); | ||
| 257 | } | ||
| 258 | if (!STORE_parse_attrs_endp(attribute_context)) | ||
| 259 | goto err; | ||
| 260 | STORE_parse_attrs_end(attribute_context); | ||
| 261 | context->search_index = -1; | ||
| 262 | context->index = -1; | ||
| 263 | return context; | ||
| 264 | err: | ||
| 265 | if (attribute_context) STORE_parse_attrs_end(attribute_context); | ||
| 266 | mem_list_end(s, context); | ||
| 267 | return NULL; | ||
| 268 | } | ||
| 269 | static STORE_OBJECT *mem_list_next(STORE *s, void *handle) | ||
| 270 | { | ||
| 271 | int i; | ||
| 272 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; | ||
| 273 | struct mem_object_data_st key = { 0, 0, 1 }; | ||
| 274 | struct mem_data_st *store = | ||
| 275 | (struct mem_data_st *)STORE_get_ex_data(s, 1); | ||
| 276 | int srch; | ||
| 277 | int cres = 0; | ||
| 278 | |||
| 279 | if (!context) | ||
| 280 | { | ||
| 281 | STOREerr(STORE_F_MEM_LIST_NEXT, ERR_R_PASSED_NULL_PARAMETER); | ||
| 282 | return NULL; | ||
| 283 | } | ||
| 284 | if (!store) | ||
| 285 | { | ||
| 286 | STOREerr(STORE_F_MEM_LIST_NEXT, STORE_R_NO_STORE); | ||
| 287 | return NULL; | ||
| 288 | } | ||
| 289 | |||
| 290 | if (context->search_index == -1) | ||
| 291 | { | ||
| 292 | for (i = 0; | ||
| 293 | i < sk_STORE_ATTR_INFO_num(context->search_attributes); | ||
| 294 | i++) | ||
| 295 | { | ||
| 296 | key.attr_info | ||
| 297 | = sk_STORE_ATTR_INFO_value(context->search_attributes, | ||
| 298 | i); | ||
| 299 | srch = sk_MEM_OBJECT_DATA_find_ex(store->data, &key); | ||
| 300 | |||
| 301 | if (srch >= 0) | ||
| 302 | { | ||
| 303 | context->search_index = srch; | ||
| 304 | break; | ||
| 305 | } | ||
| 306 | } | ||
| 307 | } | ||
| 308 | if (context->search_index < 0) | ||
| 309 | return NULL; | ||
| 310 | |||
| 311 | key.attr_info = | ||
| 312 | sk_STORE_ATTR_INFO_value(context->search_attributes, | ||
| 313 | context->search_index); | ||
| 314 | for(srch = context->search_index; | ||
| 315 | srch < sk_MEM_OBJECT_DATA_num(store->data) | ||
| 316 | && STORE_ATTR_INFO_in_range(key.attr_info, | ||
| 317 | sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info) | ||
| 318 | && !(cres = STORE_ATTR_INFO_in_ex(key.attr_info, | ||
| 319 | sk_MEM_OBJECT_DATA_value(store->data, srch)->attr_info)); | ||
| 320 | srch++) | ||
| 321 | ; | ||
| 322 | |||
| 323 | context->search_index = srch; | ||
| 324 | if (cres) | ||
| 325 | return (sk_MEM_OBJECT_DATA_value(store->data, srch))->object; | ||
| 326 | return NULL; | ||
| 327 | } | ||
| 328 | static int mem_list_end(STORE *s, void *handle) | ||
| 329 | { | ||
| 330 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; | ||
| 331 | |||
| 332 | if (!context) | ||
| 333 | { | ||
| 334 | STOREerr(STORE_F_MEM_LIST_END, ERR_R_PASSED_NULL_PARAMETER); | ||
| 335 | return 0; | ||
| 336 | } | ||
| 337 | if (context && context->search_attributes) | ||
| 338 | sk_STORE_ATTR_INFO_free(context->search_attributes); | ||
| 339 | if (context) OPENSSL_free(context); | ||
| 340 | return 1; | ||
| 341 | } | ||
| 342 | static int mem_list_endp(STORE *s, void *handle) | ||
| 343 | { | ||
| 344 | struct mem_ctx_st *context = (struct mem_ctx_st *)handle; | ||
| 345 | |||
| 346 | if (!context | ||
| 347 | || context->search_index | ||
| 348 | == sk_STORE_ATTR_INFO_num(context->search_attributes)) | ||
| 349 | return 1; | ||
| 350 | return 0; | ||
| 351 | } | ||
| 352 | static int mem_lock(STORE *s, OPENSSL_ITEM attributes[], | ||
| 353 | OPENSSL_ITEM parameters[]) | ||
| 354 | { | ||
| 355 | return 1; | ||
| 356 | } | ||
| 357 | static int mem_unlock(STORE *s, OPENSSL_ITEM attributes[], | ||
| 358 | OPENSSL_ITEM parameters[]) | ||
| 359 | { | ||
| 360 | return 1; | ||
| 361 | } | ||
| 362 | static int mem_ctrl(STORE *s, int cmd, long l, void *p, void (*f)(void)) | ||
| 363 | { | ||
| 364 | return 1; | ||
| 365 | } | ||
diff --git a/src/lib/libcrypto/store/str_meth.c b/src/lib/libcrypto/store/str_meth.c new file mode 100644 index 0000000000..a46de03a26 --- /dev/null +++ b/src/lib/libcrypto/store/str_meth.c | |||
| @@ -0,0 +1,250 @@ | |||
| 1 | /* crypto/store/str_meth.c -*- mode:C; c-file-style: "eay" -*- */ | ||
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | ||
| 3 | * project 2003. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * openssl-core@openssl.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <string.h> | ||
| 60 | #include <openssl/buffer.h> | ||
| 61 | #include "str_locl.h" | ||
| 62 | |||
| 63 | STORE_METHOD *STORE_create_method(char *name) | ||
| 64 | { | ||
| 65 | STORE_METHOD *store_method = (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD)); | ||
| 66 | |||
| 67 | if (store_method) | ||
| 68 | { | ||
| 69 | memset(store_method, 0, sizeof(*store_method)); | ||
| 70 | store_method->name = BUF_strdup(name); | ||
| 71 | } | ||
| 72 | return store_method; | ||
| 73 | } | ||
| 74 | |||
| 75 | /* BIG FSCKING WARNING!!!! If you use this on a statically allocated method | ||
| 76 | (that is, it hasn't been allocated using STORE_create_method(), you deserve | ||
| 77 | anything Murphy can throw at you and more! You have been warned. */ | ||
| 78 | void STORE_destroy_method(STORE_METHOD *store_method) | ||
| 79 | { | ||
| 80 | if (!store_method) return; | ||
| 81 | OPENSSL_free(store_method->name); | ||
| 82 | store_method->name = NULL; | ||
| 83 | OPENSSL_free(store_method); | ||
| 84 | } | ||
| 85 | |||
| 86 | int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f) | ||
| 87 | { | ||
| 88 | sm->init = init_f; | ||
| 89 | return 1; | ||
| 90 | } | ||
| 91 | |||
| 92 | int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f) | ||
| 93 | { | ||
| 94 | sm->clean = clean_f; | ||
| 95 | return 1; | ||
| 96 | } | ||
| 97 | |||
| 98 | int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f) | ||
| 99 | { | ||
| 100 | sm->generate_object = generate_f; | ||
| 101 | return 1; | ||
| 102 | } | ||
| 103 | |||
| 104 | int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f) | ||
| 105 | { | ||
| 106 | sm->get_object = get_f; | ||
| 107 | return 1; | ||
| 108 | } | ||
| 109 | |||
| 110 | int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f) | ||
| 111 | { | ||
| 112 | sm->store_object = store_f; | ||
| 113 | return 1; | ||
| 114 | } | ||
| 115 | |||
| 116 | int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR modify_f) | ||
| 117 | { | ||
| 118 | sm->modify_object = modify_f; | ||
| 119 | return 1; | ||
| 120 | } | ||
| 121 | |||
| 122 | int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f) | ||
| 123 | { | ||
| 124 | sm->revoke_object = revoke_f; | ||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f) | ||
| 129 | { | ||
| 130 | sm->delete_object = delete_f; | ||
| 131 | return 1; | ||
| 132 | } | ||
| 133 | |||
| 134 | int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f) | ||
| 135 | { | ||
| 136 | sm->list_object_start = list_start_f; | ||
| 137 | return 1; | ||
| 138 | } | ||
| 139 | |||
| 140 | int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f) | ||
| 141 | { | ||
| 142 | sm->list_object_next = list_next_f; | ||
| 143 | return 1; | ||
| 144 | } | ||
| 145 | |||
| 146 | int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f) | ||
| 147 | { | ||
| 148 | sm->list_object_end = list_end_f; | ||
| 149 | return 1; | ||
| 150 | } | ||
| 151 | |||
| 152 | int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR update_f) | ||
| 153 | { | ||
| 154 | sm->update_store = update_f; | ||
| 155 | return 1; | ||
| 156 | } | ||
| 157 | |||
| 158 | int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR lock_f) | ||
| 159 | { | ||
| 160 | sm->lock_store = lock_f; | ||
| 161 | return 1; | ||
| 162 | } | ||
| 163 | |||
| 164 | int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR unlock_f) | ||
| 165 | { | ||
| 166 | sm->unlock_store = unlock_f; | ||
| 167 | return 1; | ||
| 168 | } | ||
| 169 | |||
| 170 | int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f) | ||
| 171 | { | ||
| 172 | sm->ctrl = ctrl_f; | ||
| 173 | return 1; | ||
| 174 | } | ||
| 175 | |||
| 176 | STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm) | ||
| 177 | { | ||
| 178 | return sm->init; | ||
| 179 | } | ||
| 180 | |||
| 181 | STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm) | ||
| 182 | { | ||
| 183 | return sm->clean; | ||
| 184 | } | ||
| 185 | |||
| 186 | STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm) | ||
| 187 | { | ||
| 188 | return sm->generate_object; | ||
| 189 | } | ||
| 190 | |||
| 191 | STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm) | ||
| 192 | { | ||
| 193 | return sm->get_object; | ||
| 194 | } | ||
| 195 | |||
| 196 | STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm) | ||
| 197 | { | ||
| 198 | return sm->store_object; | ||
| 199 | } | ||
| 200 | |||
| 201 | STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm) | ||
| 202 | { | ||
| 203 | return sm->modify_object; | ||
| 204 | } | ||
| 205 | |||
| 206 | STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm) | ||
| 207 | { | ||
| 208 | return sm->revoke_object; | ||
| 209 | } | ||
| 210 | |||
| 211 | STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm) | ||
| 212 | { | ||
| 213 | return sm->delete_object; | ||
| 214 | } | ||
| 215 | |||
| 216 | STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm) | ||
| 217 | { | ||
| 218 | return sm->list_object_start; | ||
| 219 | } | ||
| 220 | |||
| 221 | STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm) | ||
| 222 | { | ||
| 223 | return sm->list_object_next; | ||
| 224 | } | ||
| 225 | |||
| 226 | STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm) | ||
| 227 | { | ||
| 228 | return sm->list_object_end; | ||
| 229 | } | ||
| 230 | |||
| 231 | STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm) | ||
| 232 | { | ||
| 233 | return sm->update_store; | ||
| 234 | } | ||
| 235 | |||
| 236 | STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm) | ||
| 237 | { | ||
| 238 | return sm->lock_store; | ||
| 239 | } | ||
| 240 | |||
| 241 | STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm) | ||
| 242 | { | ||
| 243 | return sm->unlock_store; | ||
| 244 | } | ||
| 245 | |||
| 246 | STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm) | ||
| 247 | { | ||
| 248 | return sm->ctrl; | ||
| 249 | } | ||
| 250 | |||
diff --git a/src/lib/libcrypto/symhacks.h b/src/lib/libcrypto/symhacks.h new file mode 100644 index 0000000000..3fd4a81692 --- /dev/null +++ b/src/lib/libcrypto/symhacks.h | |||
| @@ -0,0 +1,449 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 3 | * | ||
| 4 | * Redistribution and use in source and binary forms, with or without | ||
| 5 | * modification, are permitted provided that the following conditions | ||
| 6 | * are met: | ||
| 7 | * | ||
| 8 | * 1. Redistributions of source code must retain the above copyright | ||
| 9 | * notice, this list of conditions and the following disclaimer. | ||
| 10 | * | ||
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 12 | * notice, this list of conditions and the following disclaimer in | ||
| 13 | * the documentation and/or other materials provided with the | ||
| 14 | * distribution. | ||
| 15 | * | ||
| 16 | * 3. All advertising materials mentioning features or use of this | ||
| 17 | * software must display the following acknowledgment: | ||
| 18 | * "This product includes software developed by the OpenSSL Project | ||
| 19 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
| 20 | * | ||
| 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 22 | * endorse or promote products derived from this software without | ||
| 23 | * prior written permission. For written permission, please contact | ||
| 24 | * openssl-core@openssl.org. | ||
| 25 | * | ||
| 26 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 27 | * nor may "OpenSSL" appear in their names without prior written | ||
| 28 | * permission of the OpenSSL Project. | ||
| 29 | * | ||
| 30 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 31 | * acknowledgment: | ||
| 32 | * "This product includes software developed by the OpenSSL Project | ||
| 33 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
| 34 | * | ||
| 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 47 | * ==================================================================== | ||
| 48 | * | ||
| 49 | * This product includes cryptographic software written by Eric Young | ||
| 50 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 51 | * Hudson (tjh@cryptsoft.com). | ||
| 52 | * | ||
| 53 | */ | ||
| 54 | |||
| 55 | #ifndef HEADER_SYMHACKS_H | ||
| 56 | #define HEADER_SYMHACKS_H | ||
| 57 | |||
| 58 | #include <openssl/e_os2.h> | ||
| 59 | |||
| 60 | /* Hacks to solve the problem with linkers incapable of handling very long | ||
| 61 | symbol names. In the case of VMS, the limit is 31 characters on VMS for | ||
| 62 | VAX. */ | ||
| 63 | /* Note that this affects util/libeay.num and util/ssleay.num... you may | ||
| 64 | change those manually, but that's not recommended, as those files are | ||
| 65 | controlled centrally and updated on Unix, and the central definition | ||
| 66 | may disagree with yours, which in turn may come with shareable library | ||
| 67 | incompatibilities. */ | ||
| 68 | #ifdef OPENSSL_SYS_VMS | ||
| 69 | |||
| 70 | /* Hack a long name in crypto/ex_data.c */ | ||
| 71 | #undef CRYPTO_get_ex_data_implementation | ||
| 72 | #define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl | ||
| 73 | #undef CRYPTO_set_ex_data_implementation | ||
| 74 | #define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl | ||
| 75 | |||
| 76 | /* Hack a long name in crypto/asn1/a_mbstr.c */ | ||
| 77 | #undef ASN1_STRING_set_default_mask_asc | ||
| 78 | #define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc | ||
| 79 | |||
| 80 | #if 0 /* No longer needed, since safestack macro magic does the job */ | ||
| 81 | /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ | ||
| 82 | #undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO | ||
| 83 | #define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF | ||
| 84 | #undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO | ||
| 85 | #define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #if 0 /* No longer needed, since safestack macro magic does the job */ | ||
| 89 | /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ | ||
| 90 | #undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO | ||
| 91 | #define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF | ||
| 92 | #undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO | ||
| 93 | #define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #if 0 /* No longer needed, since safestack macro magic does the job */ | ||
| 97 | /* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ | ||
| 98 | #undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION | ||
| 99 | #define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC | ||
| 100 | #undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION | ||
| 101 | #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC | ||
| 102 | #endif | ||
| 103 | |||
| 104 | /* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ | ||
| 105 | #undef PEM_read_NETSCAPE_CERT_SEQUENCE | ||
| 106 | #define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ | ||
| 107 | #undef PEM_write_NETSCAPE_CERT_SEQUENCE | ||
| 108 | #define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ | ||
| 109 | #undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE | ||
| 110 | #define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ | ||
| 111 | #undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE | ||
| 112 | #define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ | ||
| 113 | #undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE | ||
| 114 | #define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ | ||
| 115 | |||
| 116 | /* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ | ||
| 117 | #undef PEM_read_PKCS8_PRIV_KEY_INFO | ||
| 118 | #define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO | ||
| 119 | #undef PEM_write_PKCS8_PRIV_KEY_INFO | ||
| 120 | #define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO | ||
| 121 | #undef PEM_read_bio_PKCS8_PRIV_KEY_INFO | ||
| 122 | #define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO | ||
| 123 | #undef PEM_write_bio_PKCS8_PRIV_KEY_INFO | ||
| 124 | #define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO | ||
| 125 | #undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO | ||
| 126 | #define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO | ||
| 127 | |||
| 128 | /* Hack other PEM names */ | ||
| 129 | #undef PEM_write_bio_PKCS8PrivateKey_nid | ||
| 130 | #define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid | ||
| 131 | |||
| 132 | /* Hack some long X509 names */ | ||
| 133 | #undef X509_REVOKED_get_ext_by_critical | ||
| 134 | #define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic | ||
| 135 | #undef X509_policy_tree_get0_user_policies | ||
| 136 | #define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies | ||
| 137 | #undef X509_policy_node_get0_qualifiers | ||
| 138 | #define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers | ||
| 139 | #undef X509_STORE_CTX_get_explicit_policy | ||
| 140 | #define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy | ||
| 141 | #undef X509_STORE_CTX_get0_current_issuer | ||
| 142 | #define X509_STORE_CTX_get0_current_issuer X509_STORE_CTX_get0_cur_issuer | ||
| 143 | |||
| 144 | /* Hack some long CRYPTO names */ | ||
| 145 | #undef CRYPTO_set_dynlock_destroy_callback | ||
| 146 | #define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb | ||
| 147 | #undef CRYPTO_set_dynlock_create_callback | ||
| 148 | #define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb | ||
| 149 | #undef CRYPTO_set_dynlock_lock_callback | ||
| 150 | #define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb | ||
| 151 | #undef CRYPTO_get_dynlock_lock_callback | ||
| 152 | #define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb | ||
| 153 | #undef CRYPTO_get_dynlock_destroy_callback | ||
| 154 | #define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb | ||
| 155 | #undef CRYPTO_get_dynlock_create_callback | ||
| 156 | #define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb | ||
| 157 | #undef CRYPTO_set_locked_mem_ex_functions | ||
| 158 | #define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs | ||
| 159 | #undef CRYPTO_get_locked_mem_ex_functions | ||
| 160 | #define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs | ||
| 161 | |||
| 162 | /* Hack some long SSL names */ | ||
| 163 | #undef SSL_CTX_set_default_verify_paths | ||
| 164 | #define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths | ||
| 165 | #undef SSL_get_ex_data_X509_STORE_CTX_idx | ||
| 166 | #define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx | ||
| 167 | #undef SSL_add_file_cert_subjects_to_stack | ||
| 168 | #define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk | ||
| 169 | #undef SSL_add_dir_cert_subjects_to_stack | ||
| 170 | #define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk | ||
| 171 | #undef SSL_CTX_use_certificate_chain_file | ||
| 172 | #define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file | ||
| 173 | #undef SSL_CTX_set_cert_verify_callback | ||
| 174 | #define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb | ||
| 175 | #undef SSL_CTX_set_default_passwd_cb_userdata | ||
| 176 | #define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud | ||
| 177 | #undef SSL_COMP_get_compression_methods | ||
| 178 | #define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods | ||
| 179 | |||
| 180 | #undef ssl_add_clienthello_renegotiate_ext | ||
| 181 | #define ssl_add_clienthello_renegotiate_ext ssl_add_clienthello_reneg_ext | ||
| 182 | #undef ssl_add_serverhello_renegotiate_ext | ||
| 183 | #define ssl_add_serverhello_renegotiate_ext ssl_add_serverhello_reneg_ext | ||
| 184 | #undef ssl_parse_clienthello_renegotiate_ext | ||
| 185 | #define ssl_parse_clienthello_renegotiate_ext ssl_parse_clienthello_reneg_ext | ||
| 186 | #undef ssl_parse_serverhello_renegotiate_ext | ||
| 187 | #define ssl_parse_serverhello_renegotiate_ext ssl_parse_serverhello_reneg_ext | ||
| 188 | |||
| 189 | /* Hack some long ENGINE names */ | ||
| 190 | #undef ENGINE_get_default_BN_mod_exp_crt | ||
| 191 | #define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt | ||
| 192 | #undef ENGINE_set_default_BN_mod_exp_crt | ||
| 193 | #define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt | ||
| 194 | #undef ENGINE_set_load_privkey_function | ||
| 195 | #define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn | ||
| 196 | #undef ENGINE_get_load_privkey_function | ||
| 197 | #define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn | ||
| 198 | #undef ENGINE_unregister_pkey_asn1_meths | ||
| 199 | #define ENGINE_unregister_pkey_asn1_meths ENGINE_unreg_pkey_asn1_meths | ||
| 200 | #undef ENGINE_register_all_pkey_asn1_meths | ||
| 201 | #define ENGINE_register_all_pkey_asn1_meths ENGINE_reg_all_pkey_asn1_meths | ||
| 202 | #undef ENGINE_set_default_pkey_asn1_meths | ||
| 203 | #define ENGINE_set_default_pkey_asn1_meths ENGINE_set_def_pkey_asn1_meths | ||
| 204 | #undef ENGINE_get_pkey_asn1_meth_engine | ||
| 205 | #define ENGINE_get_pkey_asn1_meth_engine ENGINE_get_pkey_asn1_meth_eng | ||
| 206 | #undef ENGINE_set_load_ssl_client_cert_function | ||
| 207 | #define ENGINE_set_load_ssl_client_cert_function \ | ||
| 208 | ENGINE_set_ld_ssl_clnt_cert_fn | ||
| 209 | #undef ENGINE_get_ssl_client_cert_function | ||
| 210 | #define ENGINE_get_ssl_client_cert_function ENGINE_get_ssl_client_cert_fn | ||
| 211 | |||
| 212 | /* Hack some long OCSP names */ | ||
| 213 | #undef OCSP_REQUEST_get_ext_by_critical | ||
| 214 | #define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit | ||
| 215 | #undef OCSP_BASICRESP_get_ext_by_critical | ||
| 216 | #define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit | ||
| 217 | #undef OCSP_SINGLERESP_get_ext_by_critical | ||
| 218 | #define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit | ||
| 219 | |||
| 220 | /* Hack some long DES names */ | ||
| 221 | #undef _ossl_old_des_ede3_cfb64_encrypt | ||
| 222 | #define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt | ||
| 223 | #undef _ossl_old_des_ede3_ofb64_encrypt | ||
| 224 | #define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt | ||
| 225 | |||
| 226 | /* Hack some long EVP names */ | ||
| 227 | #undef OPENSSL_add_all_algorithms_noconf | ||
| 228 | #define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf | ||
| 229 | #undef OPENSSL_add_all_algorithms_conf | ||
| 230 | #define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf | ||
| 231 | #undef EVP_PKEY_meth_set_verify_recover | ||
| 232 | #define EVP_PKEY_meth_set_verify_recover EVP_PKEY_meth_set_vrfy_recover | ||
| 233 | |||
| 234 | /* Hack some long EC names */ | ||
| 235 | #undef EC_GROUP_set_point_conversion_form | ||
| 236 | #define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form | ||
| 237 | #undef EC_GROUP_get_point_conversion_form | ||
| 238 | #define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form | ||
| 239 | #undef EC_GROUP_clear_free_all_extra_data | ||
| 240 | #define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data | ||
| 241 | #undef EC_POINT_set_Jprojective_coordinates_GFp | ||
| 242 | #define EC_POINT_set_Jprojective_coordinates_GFp \ | ||
| 243 | EC_POINT_set_Jproj_coords_GFp | ||
| 244 | #undef EC_POINT_get_Jprojective_coordinates_GFp | ||
| 245 | #define EC_POINT_get_Jprojective_coordinates_GFp \ | ||
| 246 | EC_POINT_get_Jproj_coords_GFp | ||
| 247 | #undef EC_POINT_set_affine_coordinates_GFp | ||
| 248 | #define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp | ||
| 249 | #undef EC_POINT_get_affine_coordinates_GFp | ||
| 250 | #define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp | ||
| 251 | #undef EC_POINT_set_compressed_coordinates_GFp | ||
| 252 | #define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp | ||
| 253 | #undef EC_POINT_set_affine_coordinates_GF2m | ||
| 254 | #define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m | ||
| 255 | #undef EC_POINT_get_affine_coordinates_GF2m | ||
| 256 | #define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m | ||
| 257 | #undef EC_POINT_set_compressed_coordinates_GF2m | ||
| 258 | #define EC_POINT_set_compressed_coordinates_GF2m \ | ||
| 259 | EC_POINT_set_compr_coords_GF2m | ||
| 260 | #undef ec_GF2m_simple_group_clear_finish | ||
| 261 | #define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish | ||
| 262 | #undef ec_GF2m_simple_group_check_discriminant | ||
| 263 | #define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim | ||
| 264 | #undef ec_GF2m_simple_point_clear_finish | ||
| 265 | #define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish | ||
| 266 | #undef ec_GF2m_simple_point_set_to_infinity | ||
| 267 | #define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf | ||
| 268 | #undef ec_GF2m_simple_points_make_affine | ||
| 269 | #define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine | ||
| 270 | #undef ec_GF2m_simple_point_set_affine_coordinates | ||
| 271 | #define ec_GF2m_simple_point_set_affine_coordinates \ | ||
| 272 | ec_GF2m_smp_pt_set_af_coords | ||
| 273 | #undef ec_GF2m_simple_point_get_affine_coordinates | ||
| 274 | #define ec_GF2m_simple_point_get_affine_coordinates \ | ||
| 275 | ec_GF2m_smp_pt_get_af_coords | ||
| 276 | #undef ec_GF2m_simple_set_compressed_coordinates | ||
| 277 | #define ec_GF2m_simple_set_compressed_coordinates \ | ||
| 278 | ec_GF2m_smp_set_compr_coords | ||
| 279 | #undef ec_GFp_simple_group_set_curve_GFp | ||
| 280 | #define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp | ||
| 281 | #undef ec_GFp_simple_group_get_curve_GFp | ||
| 282 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | ||
| 283 | #undef ec_GFp_simple_group_clear_finish | ||
| 284 | #define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish | ||
| 285 | #undef ec_GFp_simple_group_set_generator | ||
| 286 | #define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator | ||
| 287 | #undef ec_GFp_simple_group_get0_generator | ||
| 288 | #define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator | ||
| 289 | #undef ec_GFp_simple_group_get_cofactor | ||
| 290 | #define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor | ||
| 291 | #undef ec_GFp_simple_point_clear_finish | ||
| 292 | #define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish | ||
| 293 | #undef ec_GFp_simple_point_set_to_infinity | ||
| 294 | #define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf | ||
| 295 | #undef ec_GFp_simple_points_make_affine | ||
| 296 | #define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine | ||
| 297 | #undef ec_GFp_simple_group_get_curve_GFp | ||
| 298 | #define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp | ||
| 299 | #undef ec_GFp_simple_set_Jprojective_coordinates_GFp | ||
| 300 | #define ec_GFp_simple_set_Jprojective_coordinates_GFp \ | ||
| 301 | ec_GFp_smp_set_Jproj_coords_GFp | ||
| 302 | #undef ec_GFp_simple_get_Jprojective_coordinates_GFp | ||
| 303 | #define ec_GFp_simple_get_Jprojective_coordinates_GFp \ | ||
| 304 | ec_GFp_smp_get_Jproj_coords_GFp | ||
| 305 | #undef ec_GFp_simple_point_set_affine_coordinates_GFp | ||
| 306 | #define ec_GFp_simple_point_set_affine_coordinates_GFp \ | ||
| 307 | ec_GFp_smp_pt_set_af_coords_GFp | ||
| 308 | #undef ec_GFp_simple_point_get_affine_coordinates_GFp | ||
| 309 | #define ec_GFp_simple_point_get_affine_coordinates_GFp \ | ||
| 310 | ec_GFp_smp_pt_get_af_coords_GFp | ||
| 311 | #undef ec_GFp_simple_set_compressed_coordinates_GFp | ||
| 312 | #define ec_GFp_simple_set_compressed_coordinates_GFp \ | ||
| 313 | ec_GFp_smp_set_compr_coords_GFp | ||
| 314 | #undef ec_GFp_simple_point_set_affine_coordinates | ||
| 315 | #define ec_GFp_simple_point_set_affine_coordinates \ | ||
| 316 | ec_GFp_smp_pt_set_af_coords | ||
| 317 | #undef ec_GFp_simple_point_get_affine_coordinates | ||
| 318 | #define ec_GFp_simple_point_get_affine_coordinates \ | ||
| 319 | ec_GFp_smp_pt_get_af_coords | ||
| 320 | #undef ec_GFp_simple_set_compressed_coordinates | ||
| 321 | #define ec_GFp_simple_set_compressed_coordinates \ | ||
| 322 | ec_GFp_smp_set_compr_coords | ||
| 323 | #undef ec_GFp_simple_group_check_discriminant | ||
| 324 | #define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim | ||
| 325 | |||
| 326 | /* Hack som long STORE names */ | ||
| 327 | #undef STORE_method_set_initialise_function | ||
| 328 | #define STORE_method_set_initialise_function STORE_meth_set_initialise_fn | ||
| 329 | #undef STORE_method_set_cleanup_function | ||
| 330 | #define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn | ||
| 331 | #undef STORE_method_set_generate_function | ||
| 332 | #define STORE_method_set_generate_function STORE_meth_set_generate_fn | ||
| 333 | #undef STORE_method_set_modify_function | ||
| 334 | #define STORE_method_set_modify_function STORE_meth_set_modify_fn | ||
| 335 | #undef STORE_method_set_revoke_function | ||
| 336 | #define STORE_method_set_revoke_function STORE_meth_set_revoke_fn | ||
| 337 | #undef STORE_method_set_delete_function | ||
| 338 | #define STORE_method_set_delete_function STORE_meth_set_delete_fn | ||
| 339 | #undef STORE_method_set_list_start_function | ||
| 340 | #define STORE_method_set_list_start_function STORE_meth_set_list_start_fn | ||
| 341 | #undef STORE_method_set_list_next_function | ||
| 342 | #define STORE_method_set_list_next_function STORE_meth_set_list_next_fn | ||
| 343 | #undef STORE_method_set_list_end_function | ||
| 344 | #define STORE_method_set_list_end_function STORE_meth_set_list_end_fn | ||
| 345 | #undef STORE_method_set_update_store_function | ||
| 346 | #define STORE_method_set_update_store_function STORE_meth_set_update_store_fn | ||
| 347 | #undef STORE_method_set_lock_store_function | ||
| 348 | #define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn | ||
| 349 | #undef STORE_method_set_unlock_store_function | ||
| 350 | #define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn | ||
| 351 | #undef STORE_method_get_initialise_function | ||
| 352 | #define STORE_method_get_initialise_function STORE_meth_get_initialise_fn | ||
| 353 | #undef STORE_method_get_cleanup_function | ||
| 354 | #define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn | ||
| 355 | #undef STORE_method_get_generate_function | ||
| 356 | #define STORE_method_get_generate_function STORE_meth_get_generate_fn | ||
| 357 | #undef STORE_method_get_modify_function | ||
| 358 | #define STORE_method_get_modify_function STORE_meth_get_modify_fn | ||
| 359 | #undef STORE_method_get_revoke_function | ||
| 360 | #define STORE_method_get_revoke_function STORE_meth_get_revoke_fn | ||
| 361 | #undef STORE_method_get_delete_function | ||
| 362 | #define STORE_method_get_delete_function STORE_meth_get_delete_fn | ||
| 363 | #undef STORE_method_get_list_start_function | ||
| 364 | #define STORE_method_get_list_start_function STORE_meth_get_list_start_fn | ||
| 365 | #undef STORE_method_get_list_next_function | ||
| 366 | #define STORE_method_get_list_next_function STORE_meth_get_list_next_fn | ||
| 367 | #undef STORE_method_get_list_end_function | ||
| 368 | #define STORE_method_get_list_end_function STORE_meth_get_list_end_fn | ||
| 369 | #undef STORE_method_get_update_store_function | ||
| 370 | #define STORE_method_get_update_store_function STORE_meth_get_update_store_fn | ||
| 371 | #undef STORE_method_get_lock_store_function | ||
| 372 | #define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn | ||
| 373 | #undef STORE_method_get_unlock_store_function | ||
| 374 | #define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn | ||
| 375 | |||
| 376 | /* Hack some long TS names */ | ||
| 377 | #undef TS_RESP_CTX_set_status_info_cond | ||
| 378 | #define TS_RESP_CTX_set_status_info_cond TS_RESP_CTX_set_stat_info_cond | ||
| 379 | #undef TS_RESP_CTX_set_clock_precision_digits | ||
| 380 | #define TS_RESP_CTX_set_clock_precision_digits TS_RESP_CTX_set_clk_prec_digits | ||
| 381 | #undef TS_CONF_set_clock_precision_digits | ||
| 382 | #define TS_CONF_set_clock_precision_digits TS_CONF_set_clk_prec_digits | ||
| 383 | |||
| 384 | /* Hack some long CMS names */ | ||
| 385 | #undef CMS_RecipientInfo_ktri_get0_algs | ||
| 386 | #define CMS_RecipientInfo_ktri_get0_algs CMS_RecipInfo_ktri_get0_algs | ||
| 387 | #undef CMS_RecipientInfo_ktri_get0_signer_id | ||
| 388 | #define CMS_RecipientInfo_ktri_get0_signer_id CMS_RecipInfo_ktri_get0_sigr_id | ||
| 389 | #undef CMS_OtherRevocationInfoFormat_it | ||
| 390 | #define CMS_OtherRevocationInfoFormat_it CMS_OtherRevocInfoFormat_it | ||
| 391 | #undef CMS_KeyAgreeRecipientIdentifier_it | ||
| 392 | #define CMS_KeyAgreeRecipientIdentifier_it CMS_KeyAgreeRecipIdentifier_it | ||
| 393 | #undef CMS_OriginatorIdentifierOrKey_it | ||
| 394 | #define CMS_OriginatorIdentifierOrKey_it CMS_OriginatorIdOrKey_it | ||
| 395 | #undef cms_SignerIdentifier_get0_signer_id | ||
| 396 | #define cms_SignerIdentifier_get0_signer_id cms_SignerId_get0_signer_id | ||
| 397 | |||
| 398 | /* Hack some long DTLS1 names */ | ||
| 399 | #undef dtls1_retransmit_buffered_messages | ||
| 400 | #define dtls1_retransmit_buffered_messages dtls1_retransmit_buffered_msgs | ||
| 401 | |||
| 402 | /* Hack some long UI names */ | ||
| 403 | #undef UI_method_get_prompt_constructor | ||
| 404 | #define UI_method_get_prompt_constructor UI_method_get_prompt_constructr | ||
| 405 | #undef UI_method_set_prompt_constructor | ||
| 406 | #define UI_method_set_prompt_constructor UI_method_set_prompt_constructr | ||
| 407 | |||
| 408 | #endif /* defined OPENSSL_SYS_VMS */ | ||
| 409 | |||
| 410 | |||
| 411 | /* Case insensitive linking causes problems.... */ | ||
| 412 | #if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) | ||
| 413 | #undef ERR_load_CRYPTO_strings | ||
| 414 | #define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings | ||
| 415 | #undef OCSP_crlID_new | ||
| 416 | #define OCSP_crlID_new OCSP_crlID2_new | ||
| 417 | |||
| 418 | #undef d2i_ECPARAMETERS | ||
| 419 | #define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS | ||
| 420 | #undef i2d_ECPARAMETERS | ||
| 421 | #define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS | ||
| 422 | #undef d2i_ECPKPARAMETERS | ||
| 423 | #define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS | ||
| 424 | #undef i2d_ECPKPARAMETERS | ||
| 425 | #define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS | ||
| 426 | |||
| 427 | /* These functions do not seem to exist! However, I'm paranoid... | ||
| 428 | Original command in x509v3.h: | ||
| 429 | These functions are being redefined in another directory, | ||
| 430 | and clash when the linker is case-insensitive, so let's | ||
| 431 | hide them a little, by giving them an extra 'o' at the | ||
| 432 | beginning of the name... */ | ||
| 433 | #undef X509v3_cleanup_extensions | ||
| 434 | #define X509v3_cleanup_extensions oX509v3_cleanup_extensions | ||
| 435 | #undef X509v3_add_extension | ||
| 436 | #define X509v3_add_extension oX509v3_add_extension | ||
| 437 | #undef X509v3_add_netscape_extensions | ||
| 438 | #define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions | ||
| 439 | #undef X509v3_add_standard_extensions | ||
| 440 | #define X509v3_add_standard_extensions oX509v3_add_standard_extensions | ||
| 441 | |||
| 442 | /* This one clashes with CMS_data_create */ | ||
| 443 | #undef cms_Data_create | ||
| 444 | #define cms_Data_create priv_cms_Data_create | ||
| 445 | |||
| 446 | #endif | ||
| 447 | |||
| 448 | |||
| 449 | #endif /* ! defined HEADER_VMS_IDHACKS_H */ | ||
diff --git a/src/lib/libcrypto/threads/README b/src/lib/libcrypto/threads/README new file mode 100644 index 0000000000..df6b26e146 --- /dev/null +++ b/src/lib/libcrypto/threads/README | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Mutithreading testing area. | ||
| 2 | |||
| 3 | Since this stuff is very very platorm specific, this is not part of the | ||
| 4 | normal build. Have a read of doc/threads.doc. | ||
| 5 | |||
| 6 | mttest will do some testing and will currently build under Windows NT/95, | ||
| 7 | Solaris and Linux. The IRIX stuff is not finished. | ||
| 8 | |||
| 9 | I have tested this program on a 12 CPU ultra sparc box (solaris 2.5.1) | ||
| 10 | and things seem to work ok. | ||
| 11 | |||
| 12 | The Linux pthreads package can be retrieved from | ||
| 13 | http://www.mit.edu:8001/people/proven/pthreads.html | ||
| 14 | |||
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c new file mode 100644 index 0000000000..eba7aa8a6e --- /dev/null +++ b/src/lib/libcrypto/threads/mttest.c | |||
| @@ -0,0 +1,1310 @@ | |||
| 1 | /* crypto/threads/mttest.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <errno.h> | ||
| 63 | #ifdef LINUX | ||
| 64 | #include <typedefs.h> | ||
| 65 | #endif | ||
| 66 | #ifdef OPENSSL_SYS_WIN32 | ||
| 67 | #include <windows.h> | ||
| 68 | #endif | ||
| 69 | #ifdef SOLARIS | ||
| 70 | #include <synch.h> | ||
| 71 | #include <thread.h> | ||
| 72 | #endif | ||
| 73 | #ifdef IRIX | ||
| 74 | #include <ulocks.h> | ||
| 75 | #include <sys/prctl.h> | ||
| 76 | #endif | ||
| 77 | #ifdef PTHREADS | ||
| 78 | #include <pthread.h> | ||
| 79 | #endif | ||
| 80 | #ifdef OPENSSL_SYS_NETWARE | ||
| 81 | #if !defined __int64 | ||
| 82 | # define __int64 long long | ||
| 83 | #endif | ||
| 84 | #include <nwmpk.h> | ||
| 85 | #endif | ||
| 86 | #include <openssl/lhash.h> | ||
| 87 | #include <openssl/crypto.h> | ||
| 88 | #include <openssl/buffer.h> | ||
| 89 | #include "../../e_os.h" | ||
| 90 | #include <openssl/x509.h> | ||
| 91 | #include <openssl/ssl.h> | ||
| 92 | #include <openssl/err.h> | ||
| 93 | #include <openssl/rand.h> | ||
| 94 | |||
| 95 | #ifdef OPENSSL_NO_FP_API | ||
| 96 | #define APPS_WIN16 | ||
| 97 | #include "../buffer/bss_file.c" | ||
| 98 | #endif | ||
| 99 | |||
| 100 | #ifdef OPENSSL_SYS_NETWARE | ||
| 101 | #define TEST_SERVER_CERT "/openssl/apps/server.pem" | ||
| 102 | #define TEST_CLIENT_CERT "/openssl/apps/client.pem" | ||
| 103 | #else | ||
| 104 | #define TEST_SERVER_CERT "../../apps/server.pem" | ||
| 105 | #define TEST_CLIENT_CERT "../../apps/client.pem" | ||
| 106 | #endif | ||
| 107 | |||
| 108 | #define MAX_THREAD_NUMBER 100 | ||
| 109 | |||
| 110 | int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *xs); | ||
| 111 | void thread_setup(void); | ||
| 112 | void thread_cleanup(void); | ||
| 113 | void do_threads(SSL_CTX *s_ctx,SSL_CTX *c_ctx); | ||
| 114 | |||
| 115 | void irix_locking_callback(int mode,int type,char *file,int line); | ||
| 116 | void solaris_locking_callback(int mode,int type,char *file,int line); | ||
| 117 | void win32_locking_callback(int mode,int type,char *file,int line); | ||
| 118 | void pthreads_locking_callback(int mode,int type,char *file,int line); | ||
| 119 | void netware_locking_callback(int mode,int type,char *file,int line); | ||
| 120 | void beos_locking_callback(int mode,int type,const char *file,int line); | ||
| 121 | |||
| 122 | unsigned long irix_thread_id(void ); | ||
| 123 | unsigned long solaris_thread_id(void ); | ||
| 124 | unsigned long pthreads_thread_id(void ); | ||
| 125 | unsigned long netware_thread_id(void ); | ||
| 126 | unsigned long beos_thread_id(void ); | ||
| 127 | |||
| 128 | #if defined(OPENSSL_SYS_NETWARE) | ||
| 129 | static MPKMutex *lock_cs; | ||
| 130 | static MPKSema ThreadSem; | ||
| 131 | static long *lock_count; | ||
| 132 | #endif | ||
| 133 | |||
| 134 | BIO *bio_err=NULL; | ||
| 135 | BIO *bio_stdout=NULL; | ||
| 136 | |||
| 137 | static char *cipher=NULL; | ||
| 138 | int verbose=0; | ||
| 139 | #ifdef FIONBIO | ||
| 140 | static int s_nbio=0; | ||
| 141 | #endif | ||
| 142 | |||
| 143 | int thread_number=10; | ||
| 144 | int number_of_loops=10; | ||
| 145 | int reconnect=0; | ||
| 146 | int cache_stats=0; | ||
| 147 | |||
| 148 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
| 149 | |||
| 150 | int doit(char *ctx[4]); | ||
| 151 | static void print_stats(FILE *fp, SSL_CTX *ctx) | ||
| 152 | { | ||
| 153 | fprintf(fp,"%4ld items in the session cache\n", | ||
| 154 | SSL_CTX_sess_number(ctx)); | ||
| 155 | fprintf(fp,"%4d client connects (SSL_connect())\n", | ||
| 156 | SSL_CTX_sess_connect(ctx)); | ||
| 157 | fprintf(fp,"%4d client connects that finished\n", | ||
| 158 | SSL_CTX_sess_connect_good(ctx)); | ||
| 159 | fprintf(fp,"%4d server connects (SSL_accept())\n", | ||
| 160 | SSL_CTX_sess_accept(ctx)); | ||
| 161 | fprintf(fp,"%4d server connects that finished\n", | ||
| 162 | SSL_CTX_sess_accept_good(ctx)); | ||
| 163 | fprintf(fp,"%4d session cache hits\n",SSL_CTX_sess_hits(ctx)); | ||
| 164 | fprintf(fp,"%4d session cache misses\n",SSL_CTX_sess_misses(ctx)); | ||
| 165 | fprintf(fp,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ctx)); | ||
| 166 | } | ||
| 167 | |||
| 168 | static void sv_usage(void) | ||
| 169 | { | ||
| 170 | fprintf(stderr,"usage: ssltest [args ...]\n"); | ||
| 171 | fprintf(stderr,"\n"); | ||
| 172 | fprintf(stderr," -server_auth - check server certificate\n"); | ||
| 173 | fprintf(stderr," -client_auth - do client authentication\n"); | ||
| 174 | fprintf(stderr," -v - more output\n"); | ||
| 175 | fprintf(stderr," -CApath arg - PEM format directory of CA's\n"); | ||
| 176 | fprintf(stderr," -CAfile arg - PEM format file of CA's\n"); | ||
| 177 | fprintf(stderr," -threads arg - number of threads\n"); | ||
| 178 | fprintf(stderr," -loops arg - number of 'connections', per thread\n"); | ||
| 179 | fprintf(stderr," -reconnect - reuse session-id's\n"); | ||
| 180 | fprintf(stderr," -stats - server session-id cache stats\n"); | ||
| 181 | fprintf(stderr," -cert arg - server certificate/key\n"); | ||
| 182 | fprintf(stderr," -ccert arg - client certificate/key\n"); | ||
| 183 | fprintf(stderr," -ssl3 - just SSLv3n\n"); | ||
| 184 | } | ||
| 185 | |||
| 186 | int main(int argc, char *argv[]) | ||
| 187 | { | ||
| 188 | char *CApath=NULL,*CAfile=NULL; | ||
| 189 | int badop=0; | ||
| 190 | int ret=1; | ||
| 191 | int client_auth=0; | ||
| 192 | int server_auth=0; | ||
| 193 | SSL_CTX *s_ctx=NULL; | ||
| 194 | SSL_CTX *c_ctx=NULL; | ||
| 195 | char *scert=TEST_SERVER_CERT; | ||
| 196 | char *ccert=TEST_CLIENT_CERT; | ||
| 197 | SSL_METHOD *ssl_method=SSLv23_method(); | ||
| 198 | |||
| 199 | RAND_seed(rnd_seed, sizeof rnd_seed); | ||
| 200 | |||
| 201 | if (bio_err == NULL) | ||
| 202 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
| 203 | if (bio_stdout == NULL) | ||
| 204 | bio_stdout=BIO_new_fp(stdout,BIO_NOCLOSE); | ||
| 205 | argc--; | ||
| 206 | argv++; | ||
| 207 | |||
| 208 | while (argc >= 1) | ||
| 209 | { | ||
| 210 | if (strcmp(*argv,"-server_auth") == 0) | ||
| 211 | server_auth=1; | ||
| 212 | else if (strcmp(*argv,"-client_auth") == 0) | ||
| 213 | client_auth=1; | ||
| 214 | else if (strcmp(*argv,"-reconnect") == 0) | ||
| 215 | reconnect=1; | ||
| 216 | else if (strcmp(*argv,"-stats") == 0) | ||
| 217 | cache_stats=1; | ||
| 218 | else if (strcmp(*argv,"-ssl3") == 0) | ||
| 219 | ssl_method=SSLv3_method(); | ||
| 220 | else if (strcmp(*argv,"-ssl2") == 0) | ||
| 221 | ssl_method=SSLv2_method(); | ||
| 222 | else if (strcmp(*argv,"-CApath") == 0) | ||
| 223 | { | ||
| 224 | if (--argc < 1) goto bad; | ||
| 225 | CApath= *(++argv); | ||
| 226 | } | ||
| 227 | else if (strcmp(*argv,"-CAfile") == 0) | ||
| 228 | { | ||
| 229 | if (--argc < 1) goto bad; | ||
| 230 | CAfile= *(++argv); | ||
| 231 | } | ||
| 232 | else if (strcmp(*argv,"-cert") == 0) | ||
| 233 | { | ||
| 234 | if (--argc < 1) goto bad; | ||
| 235 | scert= *(++argv); | ||
| 236 | } | ||
| 237 | else if (strcmp(*argv,"-ccert") == 0) | ||
| 238 | { | ||
| 239 | if (--argc < 1) goto bad; | ||
| 240 | ccert= *(++argv); | ||
| 241 | } | ||
| 242 | else if (strcmp(*argv,"-threads") == 0) | ||
| 243 | { | ||
| 244 | if (--argc < 1) goto bad; | ||
| 245 | thread_number= atoi(*(++argv)); | ||
| 246 | if (thread_number == 0) thread_number=1; | ||
| 247 | if (thread_number > MAX_THREAD_NUMBER) | ||
| 248 | thread_number=MAX_THREAD_NUMBER; | ||
| 249 | } | ||
| 250 | else if (strcmp(*argv,"-loops") == 0) | ||
| 251 | { | ||
| 252 | if (--argc < 1) goto bad; | ||
| 253 | number_of_loops= atoi(*(++argv)); | ||
| 254 | if (number_of_loops == 0) number_of_loops=1; | ||
| 255 | } | ||
| 256 | else | ||
| 257 | { | ||
| 258 | fprintf(stderr,"unknown option %s\n",*argv); | ||
| 259 | badop=1; | ||
| 260 | break; | ||
| 261 | } | ||
| 262 | argc--; | ||
| 263 | argv++; | ||
| 264 | } | ||
| 265 | if (badop) | ||
| 266 | { | ||
| 267 | bad: | ||
| 268 | sv_usage(); | ||
| 269 | goto end; | ||
| 270 | } | ||
| 271 | |||
| 272 | if (cipher == NULL && OPENSSL_issetugid() == 0) | ||
| 273 | cipher=getenv("SSL_CIPHER"); | ||
| 274 | |||
| 275 | SSL_load_error_strings(); | ||
| 276 | OpenSSL_add_ssl_algorithms(); | ||
| 277 | |||
| 278 | c_ctx=SSL_CTX_new(ssl_method); | ||
| 279 | s_ctx=SSL_CTX_new(ssl_method); | ||
| 280 | if ((c_ctx == NULL) || (s_ctx == NULL)) | ||
| 281 | { | ||
| 282 | ERR_print_errors(bio_err); | ||
| 283 | goto end; | ||
| 284 | } | ||
| 285 | |||
| 286 | SSL_CTX_set_session_cache_mode(s_ctx, | ||
| 287 | SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER); | ||
| 288 | SSL_CTX_set_session_cache_mode(c_ctx, | ||
| 289 | SSL_SESS_CACHE_NO_AUTO_CLEAR|SSL_SESS_CACHE_SERVER); | ||
| 290 | |||
| 291 | if (!SSL_CTX_use_certificate_file(s_ctx,scert,SSL_FILETYPE_PEM)) | ||
| 292 | { | ||
| 293 | ERR_print_errors(bio_err); | ||
| 294 | } | ||
| 295 | else if (!SSL_CTX_use_RSAPrivateKey_file(s_ctx,scert,SSL_FILETYPE_PEM)) | ||
| 296 | { | ||
| 297 | ERR_print_errors(bio_err); | ||
| 298 | goto end; | ||
| 299 | } | ||
| 300 | |||
| 301 | if (client_auth) | ||
| 302 | { | ||
| 303 | SSL_CTX_use_certificate_file(c_ctx,ccert, | ||
| 304 | SSL_FILETYPE_PEM); | ||
| 305 | SSL_CTX_use_RSAPrivateKey_file(c_ctx,ccert, | ||
| 306 | SSL_FILETYPE_PEM); | ||
| 307 | } | ||
| 308 | |||
| 309 | if ( (!SSL_CTX_load_verify_locations(s_ctx,CAfile,CApath)) || | ||
| 310 | (!SSL_CTX_set_default_verify_paths(s_ctx)) || | ||
| 311 | (!SSL_CTX_load_verify_locations(c_ctx,CAfile,CApath)) || | ||
| 312 | (!SSL_CTX_set_default_verify_paths(c_ctx))) | ||
| 313 | { | ||
| 314 | fprintf(stderr,"SSL_load_verify_locations\n"); | ||
| 315 | ERR_print_errors(bio_err); | ||
| 316 | goto end; | ||
| 317 | } | ||
| 318 | |||
| 319 | if (client_auth) | ||
| 320 | { | ||
| 321 | fprintf(stderr,"client authentication\n"); | ||
| 322 | SSL_CTX_set_verify(s_ctx, | ||
| 323 | SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT, | ||
| 324 | verify_callback); | ||
| 325 | } | ||
| 326 | if (server_auth) | ||
| 327 | { | ||
| 328 | fprintf(stderr,"server authentication\n"); | ||
| 329 | SSL_CTX_set_verify(c_ctx,SSL_VERIFY_PEER, | ||
| 330 | verify_callback); | ||
| 331 | } | ||
| 332 | |||
| 333 | thread_setup(); | ||
| 334 | do_threads(s_ctx,c_ctx); | ||
| 335 | thread_cleanup(); | ||
| 336 | end: | ||
| 337 | |||
| 338 | if (c_ctx != NULL) | ||
| 339 | { | ||
| 340 | fprintf(stderr,"Client SSL_CTX stats then free it\n"); | ||
| 341 | print_stats(stderr,c_ctx); | ||
| 342 | SSL_CTX_free(c_ctx); | ||
| 343 | } | ||
| 344 | if (s_ctx != NULL) | ||
| 345 | { | ||
| 346 | fprintf(stderr,"Server SSL_CTX stats then free it\n"); | ||
| 347 | print_stats(stderr,s_ctx); | ||
| 348 | if (cache_stats) | ||
| 349 | { | ||
| 350 | fprintf(stderr,"-----\n"); | ||
| 351 | lh_stats(SSL_CTX_sessions(s_ctx),stderr); | ||
| 352 | fprintf(stderr,"-----\n"); | ||
| 353 | /* lh_node_stats(SSL_CTX_sessions(s_ctx),stderr); | ||
| 354 | fprintf(stderr,"-----\n"); */ | ||
| 355 | lh_node_usage_stats(SSL_CTX_sessions(s_ctx),stderr); | ||
| 356 | fprintf(stderr,"-----\n"); | ||
| 357 | } | ||
| 358 | SSL_CTX_free(s_ctx); | ||
| 359 | fprintf(stderr,"done free\n"); | ||
| 360 | } | ||
| 361 | exit(ret); | ||
| 362 | return(0); | ||
| 363 | } | ||
| 364 | |||
| 365 | #define W_READ 1 | ||
| 366 | #define W_WRITE 2 | ||
| 367 | #define C_DONE 1 | ||
| 368 | #define S_DONE 2 | ||
| 369 | |||
| 370 | int ndoit(SSL_CTX *ssl_ctx[2]) | ||
| 371 | { | ||
| 372 | int i; | ||
| 373 | int ret; | ||
| 374 | char *ctx[4]; | ||
| 375 | |||
| 376 | ctx[0]=(char *)ssl_ctx[0]; | ||
| 377 | ctx[1]=(char *)ssl_ctx[1]; | ||
| 378 | |||
| 379 | if (reconnect) | ||
| 380 | { | ||
| 381 | ctx[2]=(char *)SSL_new(ssl_ctx[0]); | ||
| 382 | ctx[3]=(char *)SSL_new(ssl_ctx[1]); | ||
| 383 | } | ||
| 384 | else | ||
| 385 | { | ||
| 386 | ctx[2]=NULL; | ||
| 387 | ctx[3]=NULL; | ||
| 388 | } | ||
| 389 | |||
| 390 | fprintf(stdout,"started thread %lu\n",CRYPTO_thread_id()); | ||
| 391 | for (i=0; i<number_of_loops; i++) | ||
| 392 | { | ||
| 393 | /* fprintf(stderr,"%4d %2d ctx->ref (%3d,%3d)\n", | ||
| 394 | CRYPTO_thread_id(),i, | ||
| 395 | ssl_ctx[0]->references, | ||
| 396 | ssl_ctx[1]->references); */ | ||
| 397 | /* pthread_delay_np(&tm);*/ | ||
| 398 | |||
| 399 | ret=doit(ctx); | ||
| 400 | if (ret != 0) | ||
| 401 | { | ||
| 402 | fprintf(stdout,"error[%d] %lu - %d\n", | ||
| 403 | i,CRYPTO_thread_id(),ret); | ||
| 404 | return(ret); | ||
| 405 | } | ||
| 406 | } | ||
| 407 | fprintf(stdout,"DONE %lu\n",CRYPTO_thread_id()); | ||
| 408 | if (reconnect) | ||
| 409 | { | ||
| 410 | SSL_free((SSL *)ctx[2]); | ||
| 411 | SSL_free((SSL *)ctx[3]); | ||
| 412 | } | ||
| 413 | # ifdef OPENSSL_SYS_NETWARE | ||
| 414 | MPKSemaphoreSignal(ThreadSem); | ||
| 415 | # endif | ||
| 416 | return(0); | ||
| 417 | } | ||
| 418 | |||
| 419 | int doit(char *ctx[4]) | ||
| 420 | { | ||
| 421 | SSL_CTX *s_ctx,*c_ctx; | ||
| 422 | static char cbuf[200],sbuf[200]; | ||
| 423 | SSL *c_ssl=NULL; | ||
| 424 | SSL *s_ssl=NULL; | ||
| 425 | BIO *c_to_s=NULL; | ||
| 426 | BIO *s_to_c=NULL; | ||
| 427 | BIO *c_bio=NULL; | ||
| 428 | BIO *s_bio=NULL; | ||
| 429 | int c_r,c_w,s_r,s_w; | ||
| 430 | int c_want,s_want; | ||
| 431 | int i; | ||
| 432 | int done=0; | ||
| 433 | int c_write,s_write; | ||
| 434 | int do_server=0,do_client=0; | ||
| 435 | |||
| 436 | s_ctx=(SSL_CTX *)ctx[0]; | ||
| 437 | c_ctx=(SSL_CTX *)ctx[1]; | ||
| 438 | |||
| 439 | if (ctx[2] != NULL) | ||
| 440 | s_ssl=(SSL *)ctx[2]; | ||
| 441 | else | ||
| 442 | s_ssl=SSL_new(s_ctx); | ||
| 443 | |||
| 444 | if (ctx[3] != NULL) | ||
| 445 | c_ssl=(SSL *)ctx[3]; | ||
| 446 | else | ||
| 447 | c_ssl=SSL_new(c_ctx); | ||
| 448 | |||
| 449 | if ((s_ssl == NULL) || (c_ssl == NULL)) goto err; | ||
| 450 | |||
| 451 | c_to_s=BIO_new(BIO_s_mem()); | ||
| 452 | s_to_c=BIO_new(BIO_s_mem()); | ||
| 453 | if ((s_to_c == NULL) || (c_to_s == NULL)) goto err; | ||
| 454 | |||
| 455 | c_bio=BIO_new(BIO_f_ssl()); | ||
| 456 | s_bio=BIO_new(BIO_f_ssl()); | ||
| 457 | if ((c_bio == NULL) || (s_bio == NULL)) goto err; | ||
| 458 | |||
| 459 | SSL_set_connect_state(c_ssl); | ||
| 460 | SSL_set_bio(c_ssl,s_to_c,c_to_s); | ||
| 461 | BIO_set_ssl(c_bio,c_ssl,(ctx[2] == NULL)?BIO_CLOSE:BIO_NOCLOSE); | ||
| 462 | |||
| 463 | SSL_set_accept_state(s_ssl); | ||
| 464 | SSL_set_bio(s_ssl,c_to_s,s_to_c); | ||
| 465 | BIO_set_ssl(s_bio,s_ssl,(ctx[3] == NULL)?BIO_CLOSE:BIO_NOCLOSE); | ||
| 466 | |||
| 467 | c_r=0; s_r=1; | ||
| 468 | c_w=1; s_w=0; | ||
| 469 | c_want=W_WRITE; | ||
| 470 | s_want=0; | ||
| 471 | c_write=1,s_write=0; | ||
| 472 | |||
| 473 | /* We can always do writes */ | ||
| 474 | for (;;) | ||
| 475 | { | ||
| 476 | do_server=0; | ||
| 477 | do_client=0; | ||
| 478 | |||
| 479 | i=(int)BIO_pending(s_bio); | ||
| 480 | if ((i && s_r) || s_w) do_server=1; | ||
| 481 | |||
| 482 | i=(int)BIO_pending(c_bio); | ||
| 483 | if ((i && c_r) || c_w) do_client=1; | ||
| 484 | |||
| 485 | if (do_server && verbose) | ||
| 486 | { | ||
| 487 | if (SSL_in_init(s_ssl)) | ||
| 488 | printf("server waiting in SSL_accept - %s\n", | ||
| 489 | SSL_state_string_long(s_ssl)); | ||
| 490 | else if (s_write) | ||
| 491 | printf("server:SSL_write()\n"); | ||
| 492 | else | ||
| 493 | printf("server:SSL_read()\n"); | ||
| 494 | } | ||
| 495 | |||
| 496 | if (do_client && verbose) | ||
| 497 | { | ||
| 498 | if (SSL_in_init(c_ssl)) | ||
| 499 | printf("client waiting in SSL_connect - %s\n", | ||
| 500 | SSL_state_string_long(c_ssl)); | ||
| 501 | else if (c_write) | ||
| 502 | printf("client:SSL_write()\n"); | ||
| 503 | else | ||
| 504 | printf("client:SSL_read()\n"); | ||
| 505 | } | ||
| 506 | |||
| 507 | if (!do_client && !do_server) | ||
| 508 | { | ||
| 509 | fprintf(stdout,"ERROR IN STARTUP\n"); | ||
| 510 | break; | ||
| 511 | } | ||
| 512 | if (do_client && !(done & C_DONE)) | ||
| 513 | { | ||
| 514 | if (c_write) | ||
| 515 | { | ||
| 516 | i=BIO_write(c_bio,"hello from client\n",18); | ||
| 517 | if (i < 0) | ||
| 518 | { | ||
| 519 | c_r=0; | ||
| 520 | c_w=0; | ||
| 521 | if (BIO_should_retry(c_bio)) | ||
| 522 | { | ||
| 523 | if (BIO_should_read(c_bio)) | ||
| 524 | c_r=1; | ||
| 525 | if (BIO_should_write(c_bio)) | ||
| 526 | c_w=1; | ||
| 527 | } | ||
| 528 | else | ||
| 529 | { | ||
| 530 | fprintf(stderr,"ERROR in CLIENT\n"); | ||
| 531 | ERR_print_errors_fp(stderr); | ||
| 532 | return(1); | ||
| 533 | } | ||
| 534 | } | ||
| 535 | else if (i == 0) | ||
| 536 | { | ||
| 537 | fprintf(stderr,"SSL CLIENT STARTUP FAILED\n"); | ||
| 538 | return(1); | ||
| 539 | } | ||
| 540 | else | ||
| 541 | { | ||
| 542 | /* ok */ | ||
| 543 | c_write=0; | ||
| 544 | } | ||
| 545 | } | ||
| 546 | else | ||
| 547 | { | ||
| 548 | i=BIO_read(c_bio,cbuf,100); | ||
| 549 | if (i < 0) | ||
| 550 | { | ||
| 551 | c_r=0; | ||
| 552 | c_w=0; | ||
| 553 | if (BIO_should_retry(c_bio)) | ||
| 554 | { | ||
| 555 | if (BIO_should_read(c_bio)) | ||
| 556 | c_r=1; | ||
| 557 | if (BIO_should_write(c_bio)) | ||
| 558 | c_w=1; | ||
| 559 | } | ||
| 560 | else | ||
| 561 | { | ||
| 562 | fprintf(stderr,"ERROR in CLIENT\n"); | ||
| 563 | ERR_print_errors_fp(stderr); | ||
| 564 | return(1); | ||
| 565 | } | ||
| 566 | } | ||
| 567 | else if (i == 0) | ||
| 568 | { | ||
| 569 | fprintf(stderr,"SSL CLIENT STARTUP FAILED\n"); | ||
| 570 | return(1); | ||
| 571 | } | ||
| 572 | else | ||
| 573 | { | ||
| 574 | done|=C_DONE; | ||
| 575 | #ifdef undef | ||
| 576 | fprintf(stdout,"CLIENT:from server:"); | ||
| 577 | fwrite(cbuf,1,i,stdout); | ||
| 578 | fflush(stdout); | ||
| 579 | #endif | ||
| 580 | } | ||
| 581 | } | ||
| 582 | } | ||
| 583 | |||
| 584 | if (do_server && !(done & S_DONE)) | ||
| 585 | { | ||
| 586 | if (!s_write) | ||
| 587 | { | ||
| 588 | i=BIO_read(s_bio,sbuf,100); | ||
| 589 | if (i < 0) | ||
| 590 | { | ||
| 591 | s_r=0; | ||
| 592 | s_w=0; | ||
| 593 | if (BIO_should_retry(s_bio)) | ||
| 594 | { | ||
| 595 | if (BIO_should_read(s_bio)) | ||
| 596 | s_r=1; | ||
| 597 | if (BIO_should_write(s_bio)) | ||
| 598 | s_w=1; | ||
| 599 | } | ||
| 600 | else | ||
| 601 | { | ||
| 602 | fprintf(stderr,"ERROR in SERVER\n"); | ||
| 603 | ERR_print_errors_fp(stderr); | ||
| 604 | return(1); | ||
| 605 | } | ||
| 606 | } | ||
| 607 | else if (i == 0) | ||
| 608 | { | ||
| 609 | fprintf(stderr,"SSL SERVER STARTUP FAILED\n"); | ||
| 610 | return(1); | ||
| 611 | } | ||
| 612 | else | ||
| 613 | { | ||
| 614 | s_write=1; | ||
| 615 | s_w=1; | ||
| 616 | #ifdef undef | ||
| 617 | fprintf(stdout,"SERVER:from client:"); | ||
| 618 | fwrite(sbuf,1,i,stdout); | ||
| 619 | fflush(stdout); | ||
| 620 | #endif | ||
| 621 | } | ||
| 622 | } | ||
| 623 | else | ||
| 624 | { | ||
| 625 | i=BIO_write(s_bio,"hello from server\n",18); | ||
| 626 | if (i < 0) | ||
| 627 | { | ||
| 628 | s_r=0; | ||
| 629 | s_w=0; | ||
| 630 | if (BIO_should_retry(s_bio)) | ||
| 631 | { | ||
| 632 | if (BIO_should_read(s_bio)) | ||
| 633 | s_r=1; | ||
| 634 | if (BIO_should_write(s_bio)) | ||
| 635 | s_w=1; | ||
| 636 | } | ||
| 637 | else | ||
| 638 | { | ||
| 639 | fprintf(stderr,"ERROR in SERVER\n"); | ||
| 640 | ERR_print_errors_fp(stderr); | ||
| 641 | return(1); | ||
| 642 | } | ||
| 643 | } | ||
| 644 | else if (i == 0) | ||
| 645 | { | ||
| 646 | fprintf(stderr,"SSL SERVER STARTUP FAILED\n"); | ||
| 647 | return(1); | ||
| 648 | } | ||
| 649 | else | ||
| 650 | { | ||
| 651 | s_write=0; | ||
| 652 | s_r=1; | ||
| 653 | done|=S_DONE; | ||
| 654 | } | ||
| 655 | } | ||
| 656 | } | ||
| 657 | |||
| 658 | if ((done & S_DONE) && (done & C_DONE)) break; | ||
| 659 | # if defined(OPENSSL_SYS_NETWARE) | ||
| 660 | ThreadSwitchWithDelay(); | ||
| 661 | # endif | ||
| 662 | } | ||
| 663 | |||
| 664 | SSL_set_shutdown(c_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); | ||
| 665 | SSL_set_shutdown(s_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); | ||
| 666 | |||
| 667 | #ifdef undef | ||
| 668 | fprintf(stdout,"DONE\n"); | ||
| 669 | #endif | ||
| 670 | err: | ||
| 671 | /* We have to set the BIO's to NULL otherwise they will be | ||
| 672 | * free()ed twice. Once when th s_ssl is SSL_free()ed and | ||
| 673 | * again when c_ssl is SSL_free()ed. | ||
| 674 | * This is a hack required because s_ssl and c_ssl are sharing the same | ||
| 675 | * BIO structure and SSL_set_bio() and SSL_free() automatically | ||
| 676 | * BIO_free non NULL entries. | ||
| 677 | * You should not normally do this or be required to do this */ | ||
| 678 | |||
| 679 | if (s_ssl != NULL) | ||
| 680 | { | ||
| 681 | s_ssl->rbio=NULL; | ||
| 682 | s_ssl->wbio=NULL; | ||
| 683 | } | ||
| 684 | if (c_ssl != NULL) | ||
| 685 | { | ||
| 686 | c_ssl->rbio=NULL; | ||
| 687 | c_ssl->wbio=NULL; | ||
| 688 | } | ||
| 689 | |||
| 690 | /* The SSL's are optionally freed in the following calls */ | ||
| 691 | if (c_to_s != NULL) BIO_free(c_to_s); | ||
| 692 | if (s_to_c != NULL) BIO_free(s_to_c); | ||
| 693 | |||
| 694 | if (c_bio != NULL) BIO_free(c_bio); | ||
| 695 | if (s_bio != NULL) BIO_free(s_bio); | ||
| 696 | return(0); | ||
| 697 | } | ||
| 698 | |||
| 699 | int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 700 | { | ||
| 701 | char *s, buf[256]; | ||
| 702 | |||
| 703 | if (verbose) | ||
| 704 | { | ||
| 705 | s=X509_NAME_oneline(X509_get_subject_name(ctx->current_cert), | ||
| 706 | buf,256); | ||
| 707 | if (s != NULL) | ||
| 708 | { | ||
| 709 | if (ok) | ||
| 710 | fprintf(stderr,"depth=%d %s\n", | ||
| 711 | ctx->error_depth,buf); | ||
| 712 | else | ||
| 713 | fprintf(stderr,"depth=%d error=%d %s\n", | ||
| 714 | ctx->error_depth,ctx->error,buf); | ||
| 715 | } | ||
| 716 | } | ||
| 717 | return(ok); | ||
| 718 | } | ||
| 719 | |||
| 720 | #define THREAD_STACK_SIZE (16*1024) | ||
| 721 | |||
| 722 | #ifdef OPENSSL_SYS_WIN32 | ||
| 723 | |||
| 724 | static HANDLE *lock_cs; | ||
| 725 | |||
| 726 | void thread_setup(void) | ||
| 727 | { | ||
| 728 | int i; | ||
| 729 | |||
| 730 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE)); | ||
| 731 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 732 | { | ||
| 733 | lock_cs[i]=CreateMutex(NULL,FALSE,NULL); | ||
| 734 | } | ||
| 735 | |||
| 736 | CRYPTO_set_locking_callback((void (*)(int,int,char *,int))win32_locking_callback); | ||
| 737 | /* id callback defined */ | ||
| 738 | } | ||
| 739 | |||
| 740 | void thread_cleanup(void) | ||
| 741 | { | ||
| 742 | int i; | ||
| 743 | |||
| 744 | CRYPTO_set_locking_callback(NULL); | ||
| 745 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 746 | CloseHandle(lock_cs[i]); | ||
| 747 | OPENSSL_free(lock_cs); | ||
| 748 | } | ||
| 749 | |||
| 750 | void win32_locking_callback(int mode, int type, char *file, int line) | ||
| 751 | { | ||
| 752 | if (mode & CRYPTO_LOCK) | ||
| 753 | { | ||
| 754 | WaitForSingleObject(lock_cs[type],INFINITE); | ||
| 755 | } | ||
| 756 | else | ||
| 757 | { | ||
| 758 | ReleaseMutex(lock_cs[type]); | ||
| 759 | } | ||
| 760 | } | ||
| 761 | |||
| 762 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 763 | { | ||
| 764 | double ret; | ||
| 765 | SSL_CTX *ssl_ctx[2]; | ||
| 766 | DWORD thread_id[MAX_THREAD_NUMBER]; | ||
| 767 | HANDLE thread_handle[MAX_THREAD_NUMBER]; | ||
| 768 | int i; | ||
| 769 | SYSTEMTIME start,end; | ||
| 770 | |||
| 771 | ssl_ctx[0]=s_ctx; | ||
| 772 | ssl_ctx[1]=c_ctx; | ||
| 773 | |||
| 774 | GetSystemTime(&start); | ||
| 775 | for (i=0; i<thread_number; i++) | ||
| 776 | { | ||
| 777 | thread_handle[i]=CreateThread(NULL, | ||
| 778 | THREAD_STACK_SIZE, | ||
| 779 | (LPTHREAD_START_ROUTINE)ndoit, | ||
| 780 | (void *)ssl_ctx, | ||
| 781 | 0L, | ||
| 782 | &(thread_id[i])); | ||
| 783 | } | ||
| 784 | |||
| 785 | printf("reaping\n"); | ||
| 786 | for (i=0; i<thread_number; i+=50) | ||
| 787 | { | ||
| 788 | int j; | ||
| 789 | |||
| 790 | j=(thread_number < (i+50))?(thread_number-i):50; | ||
| 791 | |||
| 792 | if (WaitForMultipleObjects(j, | ||
| 793 | (CONST HANDLE *)&(thread_handle[i]),TRUE,INFINITE) | ||
| 794 | == WAIT_FAILED) | ||
| 795 | { | ||
| 796 | fprintf(stderr,"WaitForMultipleObjects failed:%d\n",GetLastError()); | ||
| 797 | exit(1); | ||
| 798 | } | ||
| 799 | } | ||
| 800 | GetSystemTime(&end); | ||
| 801 | |||
| 802 | if (start.wDayOfWeek > end.wDayOfWeek) end.wDayOfWeek+=7; | ||
| 803 | ret=(end.wDayOfWeek-start.wDayOfWeek)*24; | ||
| 804 | |||
| 805 | ret=(ret+end.wHour-start.wHour)*60; | ||
| 806 | ret=(ret+end.wMinute-start.wMinute)*60; | ||
| 807 | ret=(ret+end.wSecond-start.wSecond); | ||
| 808 | ret+=(end.wMilliseconds-start.wMilliseconds)/1000.0; | ||
| 809 | |||
| 810 | printf("win32 threads done - %.3f seconds\n",ret); | ||
| 811 | } | ||
| 812 | |||
| 813 | #endif /* OPENSSL_SYS_WIN32 */ | ||
| 814 | |||
| 815 | #ifdef SOLARIS | ||
| 816 | |||
| 817 | static mutex_t *lock_cs; | ||
| 818 | /*static rwlock_t *lock_cs; */ | ||
| 819 | static long *lock_count; | ||
| 820 | |||
| 821 | void thread_setup(void) | ||
| 822 | { | ||
| 823 | int i; | ||
| 824 | |||
| 825 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t)); | ||
| 826 | lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 827 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 828 | { | ||
| 829 | lock_count[i]=0; | ||
| 830 | /* rwlock_init(&(lock_cs[i]),USYNC_THREAD,NULL); */ | ||
| 831 | mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL); | ||
| 832 | } | ||
| 833 | |||
| 834 | CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id); | ||
| 835 | CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); | ||
| 836 | } | ||
| 837 | |||
| 838 | void thread_cleanup(void) | ||
| 839 | { | ||
| 840 | int i; | ||
| 841 | |||
| 842 | CRYPTO_set_locking_callback(NULL); | ||
| 843 | |||
| 844 | fprintf(stderr,"cleanup\n"); | ||
| 845 | |||
| 846 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 847 | { | ||
| 848 | /* rwlock_destroy(&(lock_cs[i])); */ | ||
| 849 | mutex_destroy(&(lock_cs[i])); | ||
| 850 | fprintf(stderr,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i)); | ||
| 851 | } | ||
| 852 | OPENSSL_free(lock_cs); | ||
| 853 | OPENSSL_free(lock_count); | ||
| 854 | |||
| 855 | fprintf(stderr,"done cleanup\n"); | ||
| 856 | |||
| 857 | } | ||
| 858 | |||
| 859 | void solaris_locking_callback(int mode, int type, char *file, int line) | ||
| 860 | { | ||
| 861 | #ifdef undef | ||
| 862 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | ||
| 863 | CRYPTO_thread_id(), | ||
| 864 | (mode&CRYPTO_LOCK)?"l":"u", | ||
| 865 | (type&CRYPTO_READ)?"r":"w",file,line); | ||
| 866 | #endif | ||
| 867 | |||
| 868 | /* | ||
| 869 | if (CRYPTO_LOCK_SSL_CERT == type) | ||
| 870 | fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", | ||
| 871 | CRYPTO_thread_id(), | ||
| 872 | mode,file,line); | ||
| 873 | */ | ||
| 874 | if (mode & CRYPTO_LOCK) | ||
| 875 | { | ||
| 876 | /* if (mode & CRYPTO_READ) | ||
| 877 | rw_rdlock(&(lock_cs[type])); | ||
| 878 | else | ||
| 879 | rw_wrlock(&(lock_cs[type])); */ | ||
| 880 | |||
| 881 | mutex_lock(&(lock_cs[type])); | ||
| 882 | lock_count[type]++; | ||
| 883 | } | ||
| 884 | else | ||
| 885 | { | ||
| 886 | /* rw_unlock(&(lock_cs[type])); */ | ||
| 887 | mutex_unlock(&(lock_cs[type])); | ||
| 888 | } | ||
| 889 | } | ||
| 890 | |||
| 891 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 892 | { | ||
| 893 | SSL_CTX *ssl_ctx[2]; | ||
| 894 | thread_t thread_ctx[MAX_THREAD_NUMBER]; | ||
| 895 | int i; | ||
| 896 | |||
| 897 | ssl_ctx[0]=s_ctx; | ||
| 898 | ssl_ctx[1]=c_ctx; | ||
| 899 | |||
| 900 | thr_setconcurrency(thread_number); | ||
| 901 | for (i=0; i<thread_number; i++) | ||
| 902 | { | ||
| 903 | thr_create(NULL, THREAD_STACK_SIZE, | ||
| 904 | (void *(*)())ndoit, | ||
| 905 | (void *)ssl_ctx, | ||
| 906 | 0L, | ||
| 907 | &(thread_ctx[i])); | ||
| 908 | } | ||
| 909 | |||
| 910 | printf("reaping\n"); | ||
| 911 | for (i=0; i<thread_number; i++) | ||
| 912 | { | ||
| 913 | thr_join(thread_ctx[i],NULL,NULL); | ||
| 914 | } | ||
| 915 | |||
| 916 | printf("solaris threads done (%d,%d)\n", | ||
| 917 | s_ctx->references,c_ctx->references); | ||
| 918 | } | ||
| 919 | |||
| 920 | unsigned long solaris_thread_id(void) | ||
| 921 | { | ||
| 922 | unsigned long ret; | ||
| 923 | |||
| 924 | ret=(unsigned long)thr_self(); | ||
| 925 | return(ret); | ||
| 926 | } | ||
| 927 | #endif /* SOLARIS */ | ||
| 928 | |||
| 929 | #ifdef IRIX | ||
| 930 | |||
| 931 | |||
| 932 | static usptr_t *arena; | ||
| 933 | static usema_t **lock_cs; | ||
| 934 | |||
| 935 | void thread_setup(void) | ||
| 936 | { | ||
| 937 | int i; | ||
| 938 | char filename[20]; | ||
| 939 | |||
| 940 | strcpy(filename,"/tmp/mttest.XXXXXX"); | ||
| 941 | mktemp(filename); | ||
| 942 | |||
| 943 | usconfig(CONF_STHREADIOOFF); | ||
| 944 | usconfig(CONF_STHREADMALLOCOFF); | ||
| 945 | usconfig(CONF_INITUSERS,100); | ||
| 946 | usconfig(CONF_LOCKTYPE,US_DEBUGPLUS); | ||
| 947 | arena=usinit(filename); | ||
| 948 | unlink(filename); | ||
| 949 | |||
| 950 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *)); | ||
| 951 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 952 | { | ||
| 953 | lock_cs[i]=usnewsema(arena,1); | ||
| 954 | } | ||
| 955 | |||
| 956 | CRYPTO_set_id_callback((unsigned long (*)())irix_thread_id); | ||
| 957 | CRYPTO_set_locking_callback((void (*)())irix_locking_callback); | ||
| 958 | } | ||
| 959 | |||
| 960 | void thread_cleanup(void) | ||
| 961 | { | ||
| 962 | int i; | ||
| 963 | |||
| 964 | CRYPTO_set_locking_callback(NULL); | ||
| 965 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 966 | { | ||
| 967 | char buf[10]; | ||
| 968 | |||
| 969 | sprintf(buf,"%2d:",i); | ||
| 970 | usdumpsema(lock_cs[i],stdout,buf); | ||
| 971 | usfreesema(lock_cs[i],arena); | ||
| 972 | } | ||
| 973 | OPENSSL_free(lock_cs); | ||
| 974 | } | ||
| 975 | |||
| 976 | void irix_locking_callback(int mode, int type, char *file, int line) | ||
| 977 | { | ||
| 978 | if (mode & CRYPTO_LOCK) | ||
| 979 | { | ||
| 980 | printf("lock %d\n",type); | ||
| 981 | uspsema(lock_cs[type]); | ||
| 982 | } | ||
| 983 | else | ||
| 984 | { | ||
| 985 | printf("unlock %d\n",type); | ||
| 986 | usvsema(lock_cs[type]); | ||
| 987 | } | ||
| 988 | } | ||
| 989 | |||
| 990 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 991 | { | ||
| 992 | SSL_CTX *ssl_ctx[2]; | ||
| 993 | int thread_ctx[MAX_THREAD_NUMBER]; | ||
| 994 | int i; | ||
| 995 | |||
| 996 | ssl_ctx[0]=s_ctx; | ||
| 997 | ssl_ctx[1]=c_ctx; | ||
| 998 | |||
| 999 | for (i=0; i<thread_number; i++) | ||
| 1000 | { | ||
| 1001 | thread_ctx[i]=sproc((void (*)())ndoit, | ||
| 1002 | PR_SADDR|PR_SFDS,(void *)ssl_ctx); | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | printf("reaping\n"); | ||
| 1006 | for (i=0; i<thread_number; i++) | ||
| 1007 | { | ||
| 1008 | wait(NULL); | ||
| 1009 | } | ||
| 1010 | |||
| 1011 | printf("irix threads done (%d,%d)\n", | ||
| 1012 | s_ctx->references,c_ctx->references); | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | unsigned long irix_thread_id(void) | ||
| 1016 | { | ||
| 1017 | unsigned long ret; | ||
| 1018 | |||
| 1019 | ret=(unsigned long)getpid(); | ||
| 1020 | return(ret); | ||
| 1021 | } | ||
| 1022 | #endif /* IRIX */ | ||
| 1023 | |||
| 1024 | #ifdef PTHREADS | ||
| 1025 | |||
| 1026 | static pthread_mutex_t *lock_cs; | ||
| 1027 | static long *lock_count; | ||
| 1028 | |||
| 1029 | void thread_setup(void) | ||
| 1030 | { | ||
| 1031 | int i; | ||
| 1032 | |||
| 1033 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); | ||
| 1034 | lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 1035 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1036 | { | ||
| 1037 | lock_count[i]=0; | ||
| 1038 | pthread_mutex_init(&(lock_cs[i]),NULL); | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id); | ||
| 1042 | CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback); | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | void thread_cleanup(void) | ||
| 1046 | { | ||
| 1047 | int i; | ||
| 1048 | |||
| 1049 | CRYPTO_set_locking_callback(NULL); | ||
| 1050 | fprintf(stderr,"cleanup\n"); | ||
| 1051 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1052 | { | ||
| 1053 | pthread_mutex_destroy(&(lock_cs[i])); | ||
| 1054 | fprintf(stderr,"%8ld:%s\n",lock_count[i], | ||
| 1055 | CRYPTO_get_lock_name(i)); | ||
| 1056 | } | ||
| 1057 | OPENSSL_free(lock_cs); | ||
| 1058 | OPENSSL_free(lock_count); | ||
| 1059 | |||
| 1060 | fprintf(stderr,"done cleanup\n"); | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | void pthreads_locking_callback(int mode, int type, char *file, | ||
| 1064 | int line) | ||
| 1065 | { | ||
| 1066 | #ifdef undef | ||
| 1067 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | ||
| 1068 | CRYPTO_thread_id(), | ||
| 1069 | (mode&CRYPTO_LOCK)?"l":"u", | ||
| 1070 | (type&CRYPTO_READ)?"r":"w",file,line); | ||
| 1071 | #endif | ||
| 1072 | /* | ||
| 1073 | if (CRYPTO_LOCK_SSL_CERT == type) | ||
| 1074 | fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", | ||
| 1075 | CRYPTO_thread_id(), | ||
| 1076 | mode,file,line); | ||
| 1077 | */ | ||
| 1078 | if (mode & CRYPTO_LOCK) | ||
| 1079 | { | ||
| 1080 | pthread_mutex_lock(&(lock_cs[type])); | ||
| 1081 | lock_count[type]++; | ||
| 1082 | } | ||
| 1083 | else | ||
| 1084 | { | ||
| 1085 | pthread_mutex_unlock(&(lock_cs[type])); | ||
| 1086 | } | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 1090 | { | ||
| 1091 | SSL_CTX *ssl_ctx[2]; | ||
| 1092 | pthread_t thread_ctx[MAX_THREAD_NUMBER]; | ||
| 1093 | int i; | ||
| 1094 | |||
| 1095 | ssl_ctx[0]=s_ctx; | ||
| 1096 | ssl_ctx[1]=c_ctx; | ||
| 1097 | |||
| 1098 | /* | ||
| 1099 | thr_setconcurrency(thread_number); | ||
| 1100 | */ | ||
| 1101 | for (i=0; i<thread_number; i++) | ||
| 1102 | { | ||
| 1103 | pthread_create(&(thread_ctx[i]), NULL, | ||
| 1104 | (void *(*)())ndoit, (void *)ssl_ctx); | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | printf("reaping\n"); | ||
| 1108 | for (i=0; i<thread_number; i++) | ||
| 1109 | { | ||
| 1110 | pthread_join(thread_ctx[i],NULL); | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | printf("pthreads threads done (%d,%d)\n", | ||
| 1114 | s_ctx->references,c_ctx->references); | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | unsigned long pthreads_thread_id(void) | ||
| 1118 | { | ||
| 1119 | unsigned long ret; | ||
| 1120 | |||
| 1121 | ret=(unsigned long)pthread_self(); | ||
| 1122 | return(ret); | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | #endif /* PTHREADS */ | ||
| 1126 | |||
| 1127 | |||
| 1128 | |||
| 1129 | #ifdef OPENSSL_SYS_NETWARE | ||
| 1130 | |||
| 1131 | void thread_setup(void) | ||
| 1132 | { | ||
| 1133 | int i; | ||
| 1134 | |||
| 1135 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(MPKMutex)); | ||
| 1136 | lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 1137 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1138 | { | ||
| 1139 | lock_count[i]=0; | ||
| 1140 | lock_cs[i]=MPKMutexAlloc("OpenSSL mutex"); | ||
| 1141 | } | ||
| 1142 | |||
| 1143 | ThreadSem = MPKSemaphoreAlloc("OpenSSL mttest semaphore", 0 ); | ||
| 1144 | |||
| 1145 | CRYPTO_set_id_callback((unsigned long (*)())netware_thread_id); | ||
| 1146 | CRYPTO_set_locking_callback((void (*)())netware_locking_callback); | ||
| 1147 | } | ||
| 1148 | |||
| 1149 | void thread_cleanup(void) | ||
| 1150 | { | ||
| 1151 | int i; | ||
| 1152 | |||
| 1153 | CRYPTO_set_locking_callback(NULL); | ||
| 1154 | |||
| 1155 | fprintf(stdout,"thread_cleanup\n"); | ||
| 1156 | |||
| 1157 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1158 | { | ||
| 1159 | MPKMutexFree(lock_cs[i]); | ||
| 1160 | fprintf(stdout,"%8ld:%s\n",lock_count[i],CRYPTO_get_lock_name(i)); | ||
| 1161 | } | ||
| 1162 | OPENSSL_free(lock_cs); | ||
| 1163 | OPENSSL_free(lock_count); | ||
| 1164 | |||
| 1165 | MPKSemaphoreFree(ThreadSem); | ||
| 1166 | |||
| 1167 | fprintf(stdout,"done cleanup\n"); | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | void netware_locking_callback(int mode, int type, char *file, int line) | ||
| 1171 | { | ||
| 1172 | if (mode & CRYPTO_LOCK) | ||
| 1173 | { | ||
| 1174 | MPKMutexLock(lock_cs[type]); | ||
| 1175 | lock_count[type]++; | ||
| 1176 | } | ||
| 1177 | else | ||
| 1178 | MPKMutexUnlock(lock_cs[type]); | ||
| 1179 | } | ||
| 1180 | |||
| 1181 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 1182 | { | ||
| 1183 | SSL_CTX *ssl_ctx[2]; | ||
| 1184 | int i; | ||
| 1185 | ssl_ctx[0]=s_ctx; | ||
| 1186 | ssl_ctx[1]=c_ctx; | ||
| 1187 | |||
| 1188 | for (i=0; i<thread_number; i++) | ||
| 1189 | { | ||
| 1190 | BeginThread( (void(*)(void*))ndoit, NULL, THREAD_STACK_SIZE, | ||
| 1191 | (void*)ssl_ctx); | ||
| 1192 | ThreadSwitchWithDelay(); | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | printf("reaping\n"); | ||
| 1196 | |||
| 1197 | /* loop until all threads have signaled the semaphore */ | ||
| 1198 | for (i=0; i<thread_number; i++) | ||
| 1199 | { | ||
| 1200 | MPKSemaphoreWait(ThreadSem); | ||
| 1201 | } | ||
| 1202 | printf("netware threads done (%d,%d)\n", | ||
| 1203 | s_ctx->references,c_ctx->references); | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | unsigned long netware_thread_id(void) | ||
| 1207 | { | ||
| 1208 | unsigned long ret; | ||
| 1209 | |||
| 1210 | ret=(unsigned long)GetThreadID(); | ||
| 1211 | return(ret); | ||
| 1212 | } | ||
| 1213 | #endif /* NETWARE */ | ||
| 1214 | |||
| 1215 | #ifdef BEOS_THREADS | ||
| 1216 | |||
| 1217 | #include <Locker.h> | ||
| 1218 | |||
| 1219 | static BLocker** lock_cs; | ||
| 1220 | static long* lock_count; | ||
| 1221 | |||
| 1222 | void thread_setup(void) | ||
| 1223 | { | ||
| 1224 | int i; | ||
| 1225 | |||
| 1226 | lock_cs=(BLocker**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(BLocker*)); | ||
| 1227 | lock_count=(long*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 1228 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1229 | { | ||
| 1230 | lock_count[i]=0; | ||
| 1231 | lock_cs[i] = new BLocker(CRYPTO_get_lock_name(i)); | ||
| 1232 | } | ||
| 1233 | |||
| 1234 | CRYPTO_set_id_callback((unsigned long (*)())beos_thread_id); | ||
| 1235 | CRYPTO_set_locking_callback(beos_locking_callback); | ||
| 1236 | } | ||
| 1237 | |||
| 1238 | void thread_cleanup(void) | ||
| 1239 | { | ||
| 1240 | int i; | ||
| 1241 | |||
| 1242 | CRYPTO_set_locking_callback(NULL); | ||
| 1243 | fprintf(stderr,"cleanup\n"); | ||
| 1244 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1245 | { | ||
| 1246 | delete lock_cs[i]; | ||
| 1247 | fprintf(stderr,"%8ld:%s\n",lock_count[i], | ||
| 1248 | CRYPTO_get_lock_name(i)); | ||
| 1249 | } | ||
| 1250 | OPENSSL_free(lock_cs); | ||
| 1251 | OPENSSL_free(lock_count); | ||
| 1252 | |||
| 1253 | fprintf(stderr,"done cleanup\n"); | ||
| 1254 | } | ||
| 1255 | |||
| 1256 | void beos_locking_callback(int mode, int type, const char *file, int line) | ||
| 1257 | { | ||
| 1258 | #if 0 | ||
| 1259 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | ||
| 1260 | CRYPTO_thread_id(), | ||
| 1261 | (mode&CRYPTO_LOCK)?"l":"u", | ||
| 1262 | (type&CRYPTO_READ)?"r":"w",file,line); | ||
| 1263 | #endif | ||
| 1264 | if (mode & CRYPTO_LOCK) | ||
| 1265 | { | ||
| 1266 | lock_cs[type]->Lock(); | ||
| 1267 | lock_count[type]++; | ||
| 1268 | } | ||
| 1269 | else | ||
| 1270 | { | ||
| 1271 | lock_cs[type]->Unlock(); | ||
| 1272 | } | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 1276 | { | ||
| 1277 | SSL_CTX *ssl_ctx[2]; | ||
| 1278 | thread_id thread_ctx[MAX_THREAD_NUMBER]; | ||
| 1279 | int i; | ||
| 1280 | |||
| 1281 | ssl_ctx[0]=s_ctx; | ||
| 1282 | ssl_ctx[1]=c_ctx; | ||
| 1283 | |||
| 1284 | for (i=0; i<thread_number; i++) | ||
| 1285 | { | ||
| 1286 | thread_ctx[i] = spawn_thread((thread_func)ndoit, | ||
| 1287 | NULL, B_NORMAL_PRIORITY, (void *)ssl_ctx); | ||
| 1288 | resume_thread(thread_ctx[i]); | ||
| 1289 | } | ||
| 1290 | |||
| 1291 | printf("waiting...\n"); | ||
| 1292 | for (i=0; i<thread_number; i++) | ||
| 1293 | { | ||
| 1294 | status_t result; | ||
| 1295 | wait_for_thread(thread_ctx[i], &result); | ||
| 1296 | } | ||
| 1297 | |||
| 1298 | printf("beos threads done (%d,%d)\n", | ||
| 1299 | s_ctx->references,c_ctx->references); | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | unsigned long beos_thread_id(void) | ||
| 1303 | { | ||
| 1304 | unsigned long ret; | ||
| 1305 | |||
| 1306 | ret=(unsigned long)find_thread(NULL); | ||
| 1307 | return(ret); | ||
| 1308 | } | ||
| 1309 | |||
| 1310 | #endif /* BEOS_THREADS */ | ||
diff --git a/src/lib/libcrypto/threads/netware.bat b/src/lib/libcrypto/threads/netware.bat new file mode 100644 index 0000000000..0b3eca3caf --- /dev/null +++ b/src/lib/libcrypto/threads/netware.bat | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | @echo off | ||
| 2 | rem batch file to build multi-thread test ( mttest.nlm ) | ||
| 3 | |||
| 4 | rem command line arguments: | ||
| 5 | rem debug => build using debug settings | ||
| 6 | |||
| 7 | rem | ||
| 8 | rem After building, copy mttest.nlm to the server and run it, you'll probably | ||
| 9 | rem want to redirect stdout and stderr. An example command line would be | ||
| 10 | rem "mttest.nlm -thread 20 -loops 10 -CAfile \openssl\apps\server.pem >mttest.out 2>mttest.err" | ||
| 11 | rem | ||
| 12 | |||
| 13 | del mttest.nlm | ||
| 14 | |||
| 15 | set BLD_DEBUG= | ||
| 16 | set CFLAGS= | ||
| 17 | set LFLAGS= | ||
| 18 | set LIBS= | ||
| 19 | |||
| 20 | if "%1" == "DEBUG" set BLD_DEBUG=YES | ||
| 21 | if "%1" == "debug" set BLD_DEBUG=YES | ||
| 22 | |||
| 23 | if "%MWCIncludes%" == "" goto inc_error | ||
| 24 | if "%PRELUDE%" == "" goto prelude_error | ||
| 25 | if "%IMPORTS%" == "" goto imports_error | ||
| 26 | |||
| 27 | set CFLAGS=-c -I..\..\outinc_nw -nosyspath -DOPENSSL_SYS_NETWARE -opt off -g -sym internal -maxerrors 20 | ||
| 28 | |||
| 29 | if "%BLD_DEBUG%" == "YES" set LIBS=..\..\out_nw.dbg\ssl.lib ..\..\out_nw.dbg\crypto.lib | ||
| 30 | if "%BLD_DEBUG%" == "" set LIBS=..\..\out_nw\ssl.lib ..\..\out_nw\crypto.lib | ||
| 31 | |||
| 32 | set LFLAGS=-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal | ||
| 33 | |||
| 34 | rem generate command file for metrowerks | ||
| 35 | echo. | ||
| 36 | echo Generating Metrowerks command file: mttest.def | ||
| 37 | echo # dynamically generated command file for metrowerks build > mttest.def | ||
| 38 | echo IMPORT @%IMPORTS%\clib.imp >> mttest.def | ||
| 39 | echo IMPORT @%IMPORTS%\threads.imp >> mttest.def | ||
| 40 | echo IMPORT @%IMPORTS%\ws2nlm.imp >> mttest.def | ||
| 41 | echo IMPORT GetProcessSwitchCount >> mttest.def | ||
| 42 | echo MODULE clib >> mttest.def | ||
| 43 | |||
| 44 | rem compile | ||
| 45 | echo. | ||
| 46 | echo Compiling mttest.c | ||
| 47 | mwccnlm.exe mttest.c %CFLAGS% | ||
| 48 | if errorlevel 1 goto end | ||
| 49 | |||
| 50 | rem link | ||
| 51 | echo. | ||
| 52 | echo Linking mttest.nlm | ||
| 53 | mwldnlm.exe %LFLAGS% -screenname mttest -commandfile mttest.def mttest.o "%PRELUDE%" %LIBS% -o mttest.nlm | ||
| 54 | if errorlevel 1 goto end | ||
| 55 | |||
| 56 | goto end | ||
| 57 | |||
| 58 | :inc_error | ||
| 59 | echo. | ||
| 60 | echo Environment variable MWCIncludes is not set - see install.nw | ||
| 61 | goto end | ||
| 62 | |||
| 63 | :prelude_error | ||
| 64 | echo. | ||
| 65 | echo Environment variable PRELUDE is not set - see install.nw | ||
| 66 | goto end | ||
| 67 | |||
| 68 | :imports_error | ||
| 69 | echo. | ||
| 70 | echo Environment variable IMPORTS is not set - see install.nw | ||
| 71 | goto end | ||
| 72 | |||
| 73 | |||
| 74 | :end | ||
| 75 | set BLD_DEBUG= | ||
| 76 | set CFLAGS= | ||
| 77 | set LFLAGS= | ||
| 78 | set LIBS= | ||
| 79 | |||
diff --git a/src/lib/libcrypto/threads/profile.sh b/src/lib/libcrypto/threads/profile.sh new file mode 100644 index 0000000000..6e3e342fc0 --- /dev/null +++ b/src/lib/libcrypto/threads/profile.sh | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | /bin/rm -f mttest | ||
| 3 | cc -p -DSOLARIS -I../../include -g mttest.c -o mttest -L/usr/lib/libc -ldl -L../.. -lthread -lssl -lcrypto -lnsl -lsocket | ||
| 4 | |||
diff --git a/src/lib/libcrypto/threads/ptest.bat b/src/lib/libcrypto/threads/ptest.bat new file mode 100644 index 0000000000..4071b5ffea --- /dev/null +++ b/src/lib/libcrypto/threads/ptest.bat | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | del mttest.exe | ||
| 2 | |||
| 3 | purify cl /O2 -DWIN32 /MD -I..\..\out mttest.c /Femttest ..\..\out\ssl32.lib ..\..\out\crypt32.lib | ||
| 4 | |||
diff --git a/src/lib/libcrypto/threads/pthread.sh b/src/lib/libcrypto/threads/pthread.sh new file mode 100644 index 0000000000..f1c49821d2 --- /dev/null +++ b/src/lib/libcrypto/threads/pthread.sh | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # build using pthreads | ||
| 4 | # | ||
| 5 | # http://www.mit.edu:8001/people/proven/pthreads.html | ||
| 6 | # | ||
| 7 | /bin/rm -f mttest | ||
| 8 | pgcc -DPTHREADS -I../../include -g mttest.c -o mttest -L../.. -lssl -lcrypto | ||
| 9 | |||
diff --git a/src/lib/libcrypto/threads/pthread2.sh b/src/lib/libcrypto/threads/pthread2.sh new file mode 100644 index 0000000000..41264c6a50 --- /dev/null +++ b/src/lib/libcrypto/threads/pthread2.sh | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # build using pthreads where it's already built into the system | ||
| 4 | # | ||
| 5 | /bin/rm -f mttest | ||
| 6 | gcc -DPTHREADS -I../../include -g mttest.c -o mttest -L../.. -lssl -lcrypto -lpthread | ||
| 7 | |||
diff --git a/src/lib/libcrypto/threads/pthreads-vms.com b/src/lib/libcrypto/threads/pthreads-vms.com new file mode 100644 index 0000000000..1cf92bdf57 --- /dev/null +++ b/src/lib/libcrypto/threads/pthreads-vms.com | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | $! To compile mttest on VMS. | ||
| 2 | $! | ||
| 3 | $! WARNING: only tested with DEC C so far. | ||
| 4 | $ | ||
| 5 | $ if (f$getsyi("cpu").lt.128) | ||
| 6 | $ then | ||
| 7 | $ arch := VAX | ||
| 8 | $ else | ||
| 9 | $ arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE") | ||
| 10 | $ if (arch .eqs. "") then arch = "UNK" | ||
| 11 | $ endif | ||
| 12 | $ define/user openssl [--.include.openssl] | ||
| 13 | $ cc/def=PTHREADS mttest.c | ||
| 14 | $ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib | ||
diff --git a/src/lib/libcrypto/threads/purify.sh b/src/lib/libcrypto/threads/purify.sh new file mode 100644 index 0000000000..6d44fe26b7 --- /dev/null +++ b/src/lib/libcrypto/threads/purify.sh | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | /bin/rm -f mttest | ||
| 3 | purify cc -DSOLARIS -I../../include -g mttest.c -o mttest -L../.. -lthread -lssl -lcrypto -lnsl -lsocket | ||
| 4 | |||
diff --git a/src/lib/libcrypto/threads/solaris.sh b/src/lib/libcrypto/threads/solaris.sh new file mode 100644 index 0000000000..bc93094a27 --- /dev/null +++ b/src/lib/libcrypto/threads/solaris.sh | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | /bin/rm -f mttest | ||
| 3 | cc -DSOLARIS -I../../include -g mttest.c -o mttest -L../.. -lthread -lssl -lcrypto -lnsl -lsocket | ||
| 4 | |||
diff --git a/src/lib/libcrypto/threads/th-lock.c b/src/lib/libcrypto/threads/th-lock.c new file mode 100644 index 0000000000..14aae5f912 --- /dev/null +++ b/src/lib/libcrypto/threads/th-lock.c | |||
| @@ -0,0 +1,387 @@ | |||
| 1 | /* crypto/threads/th-lock.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <errno.h> | ||
| 63 | #ifdef LINUX | ||
| 64 | #include <typedefs.h> | ||
| 65 | #endif | ||
| 66 | #ifdef OPENSSL_SYS_WIN32 | ||
| 67 | #include <windows.h> | ||
| 68 | #endif | ||
| 69 | #ifdef SOLARIS | ||
| 70 | #include <synch.h> | ||
| 71 | #include <thread.h> | ||
| 72 | #endif | ||
| 73 | #ifdef IRIX | ||
| 74 | #include <ulocks.h> | ||
| 75 | #include <sys/prctl.h> | ||
| 76 | #endif | ||
| 77 | #ifdef PTHREADS | ||
| 78 | #include <pthread.h> | ||
| 79 | #endif | ||
| 80 | #include <openssl/lhash.h> | ||
| 81 | #include <openssl/crypto.h> | ||
| 82 | #include <openssl/buffer.h> | ||
| 83 | #include "../../e_os.h" | ||
| 84 | #include <openssl/x509.h> | ||
| 85 | #include <openssl/ssl.h> | ||
| 86 | #include <openssl/err.h> | ||
| 87 | |||
| 88 | void CRYPTO_thread_setup(void); | ||
| 89 | void CRYPTO_thread_cleanup(void); | ||
| 90 | |||
| 91 | static void irix_locking_callback(int mode,int type,char *file,int line); | ||
| 92 | static void solaris_locking_callback(int mode,int type,char *file,int line); | ||
| 93 | static void win32_locking_callback(int mode,int type,char *file,int line); | ||
| 94 | static void pthreads_locking_callback(int mode,int type,char *file,int line); | ||
| 95 | |||
| 96 | static unsigned long irix_thread_id(void ); | ||
| 97 | static unsigned long solaris_thread_id(void ); | ||
| 98 | static unsigned long pthreads_thread_id(void ); | ||
| 99 | |||
| 100 | /* usage: | ||
| 101 | * CRYPTO_thread_setup(); | ||
| 102 | * application code | ||
| 103 | * CRYPTO_thread_cleanup(); | ||
| 104 | */ | ||
| 105 | |||
| 106 | #define THREAD_STACK_SIZE (16*1024) | ||
| 107 | |||
| 108 | #ifdef OPENSSL_SYS_WIN32 | ||
| 109 | |||
| 110 | static HANDLE *lock_cs; | ||
| 111 | |||
| 112 | void CRYPTO_thread_setup(void) | ||
| 113 | { | ||
| 114 | int i; | ||
| 115 | |||
| 116 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(HANDLE)); | ||
| 117 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 118 | { | ||
| 119 | lock_cs[i]=CreateMutex(NULL,FALSE,NULL); | ||
| 120 | } | ||
| 121 | |||
| 122 | CRYPTO_set_locking_callback((void (*)(int,int,char *,int))win32_locking_callback); | ||
| 123 | /* id callback defined */ | ||
| 124 | return(1); | ||
| 125 | } | ||
| 126 | |||
| 127 | static void CRYPTO_thread_cleanup(void) | ||
| 128 | { | ||
| 129 | int i; | ||
| 130 | |||
| 131 | CRYPTO_set_locking_callback(NULL); | ||
| 132 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 133 | CloseHandle(lock_cs[i]); | ||
| 134 | OPENSSL_free(lock_cs); | ||
| 135 | } | ||
| 136 | |||
| 137 | void win32_locking_callback(int mode, int type, char *file, int line) | ||
| 138 | { | ||
| 139 | if (mode & CRYPTO_LOCK) | ||
| 140 | { | ||
| 141 | WaitForSingleObject(lock_cs[type],INFINITE); | ||
| 142 | } | ||
| 143 | else | ||
| 144 | { | ||
| 145 | ReleaseMutex(lock_cs[type]); | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | #endif /* OPENSSL_SYS_WIN32 */ | ||
| 150 | |||
| 151 | #ifdef SOLARIS | ||
| 152 | |||
| 153 | #define USE_MUTEX | ||
| 154 | |||
| 155 | #ifdef USE_MUTEX | ||
| 156 | static mutex_t *lock_cs; | ||
| 157 | #else | ||
| 158 | static rwlock_t *lock_cs; | ||
| 159 | #endif | ||
| 160 | static long *lock_count; | ||
| 161 | |||
| 162 | void CRYPTO_thread_setup(void) | ||
| 163 | { | ||
| 164 | int i; | ||
| 165 | |||
| 166 | #ifdef USE_MUTEX | ||
| 167 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(mutex_t)); | ||
| 168 | #else | ||
| 169 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(rwlock_t)); | ||
| 170 | #endif | ||
| 171 | lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 172 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 173 | { | ||
| 174 | lock_count[i]=0; | ||
| 175 | #ifdef USE_MUTEX | ||
| 176 | mutex_init(&(lock_cs[i]),USYNC_THREAD,NULL); | ||
| 177 | #else | ||
| 178 | rwlock_init(&(lock_cs[i]),USYNC_THREAD,NULL); | ||
| 179 | #endif | ||
| 180 | } | ||
| 181 | |||
| 182 | CRYPTO_set_id_callback((unsigned long (*)())solaris_thread_id); | ||
| 183 | CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); | ||
| 184 | } | ||
| 185 | |||
| 186 | void CRYPTO_thread_cleanup(void) | ||
| 187 | { | ||
| 188 | int i; | ||
| 189 | |||
| 190 | CRYPTO_set_locking_callback(NULL); | ||
| 191 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 192 | { | ||
| 193 | #ifdef USE_MUTEX | ||
| 194 | mutex_destroy(&(lock_cs[i])); | ||
| 195 | #else | ||
| 196 | rwlock_destroy(&(lock_cs[i])); | ||
| 197 | #endif | ||
| 198 | } | ||
| 199 | OPENSSL_free(lock_cs); | ||
| 200 | OPENSSL_free(lock_count); | ||
| 201 | } | ||
| 202 | |||
| 203 | void solaris_locking_callback(int mode, int type, char *file, int line) | ||
| 204 | { | ||
| 205 | #if 0 | ||
| 206 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | ||
| 207 | CRYPTO_thread_id(), | ||
| 208 | (mode&CRYPTO_LOCK)?"l":"u", | ||
| 209 | (type&CRYPTO_READ)?"r":"w",file,line); | ||
| 210 | #endif | ||
| 211 | |||
| 212 | #if 0 | ||
| 213 | if (CRYPTO_LOCK_SSL_CERT == type) | ||
| 214 | fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", | ||
| 215 | CRYPTO_thread_id(), | ||
| 216 | mode,file,line); | ||
| 217 | #endif | ||
| 218 | if (mode & CRYPTO_LOCK) | ||
| 219 | { | ||
| 220 | #ifdef USE_MUTEX | ||
| 221 | mutex_lock(&(lock_cs[type])); | ||
| 222 | #else | ||
| 223 | if (mode & CRYPTO_READ) | ||
| 224 | rw_rdlock(&(lock_cs[type])); | ||
| 225 | else | ||
| 226 | rw_wrlock(&(lock_cs[type])); | ||
| 227 | #endif | ||
| 228 | lock_count[type]++; | ||
| 229 | } | ||
| 230 | else | ||
| 231 | { | ||
| 232 | #ifdef USE_MUTEX | ||
| 233 | mutex_unlock(&(lock_cs[type])); | ||
| 234 | #else | ||
| 235 | rw_unlock(&(lock_cs[type])); | ||
| 236 | #endif | ||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | unsigned long solaris_thread_id(void) | ||
| 241 | { | ||
| 242 | unsigned long ret; | ||
| 243 | |||
| 244 | ret=(unsigned long)thr_self(); | ||
| 245 | return(ret); | ||
| 246 | } | ||
| 247 | #endif /* SOLARIS */ | ||
| 248 | |||
| 249 | #ifdef IRIX | ||
| 250 | /* I don't think this works..... */ | ||
| 251 | |||
| 252 | static usptr_t *arena; | ||
| 253 | static usema_t **lock_cs; | ||
| 254 | |||
| 255 | void CRYPTO_thread_setup(void) | ||
| 256 | { | ||
| 257 | int i; | ||
| 258 | char filename[20]; | ||
| 259 | |||
| 260 | strcpy(filename,"/tmp/mttest.XXXXXX"); | ||
| 261 | mktemp(filename); | ||
| 262 | |||
| 263 | usconfig(CONF_STHREADIOOFF); | ||
| 264 | usconfig(CONF_STHREADMALLOCOFF); | ||
| 265 | usconfig(CONF_INITUSERS,100); | ||
| 266 | usconfig(CONF_LOCKTYPE,US_DEBUGPLUS); | ||
| 267 | arena=usinit(filename); | ||
| 268 | unlink(filename); | ||
| 269 | |||
| 270 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(usema_t *)); | ||
| 271 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 272 | { | ||
| 273 | lock_cs[i]=usnewsema(arena,1); | ||
| 274 | } | ||
| 275 | |||
| 276 | CRYPTO_set_id_callback((unsigned long (*)())irix_thread_id); | ||
| 277 | CRYPTO_set_locking_callback((void (*)())irix_locking_callback); | ||
| 278 | } | ||
| 279 | |||
| 280 | void CRYPTO_thread_cleanup(void) | ||
| 281 | { | ||
| 282 | int i; | ||
| 283 | |||
| 284 | CRYPTO_set_locking_callback(NULL); | ||
| 285 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 286 | { | ||
| 287 | char buf[10]; | ||
| 288 | |||
| 289 | sprintf(buf,"%2d:",i); | ||
| 290 | usdumpsema(lock_cs[i],stdout,buf); | ||
| 291 | usfreesema(lock_cs[i],arena); | ||
| 292 | } | ||
| 293 | OPENSSL_free(lock_cs); | ||
| 294 | } | ||
| 295 | |||
| 296 | void irix_locking_callback(int mode, int type, char *file, int line) | ||
| 297 | { | ||
| 298 | if (mode & CRYPTO_LOCK) | ||
| 299 | { | ||
| 300 | uspsema(lock_cs[type]); | ||
| 301 | } | ||
| 302 | else | ||
| 303 | { | ||
| 304 | usvsema(lock_cs[type]); | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | unsigned long irix_thread_id(void) | ||
| 309 | { | ||
| 310 | unsigned long ret; | ||
| 311 | |||
| 312 | ret=(unsigned long)getpid(); | ||
| 313 | return(ret); | ||
| 314 | } | ||
| 315 | #endif /* IRIX */ | ||
| 316 | |||
| 317 | /* Linux and a few others */ | ||
| 318 | #ifdef PTHREADS | ||
| 319 | |||
| 320 | static pthread_mutex_t *lock_cs; | ||
| 321 | static long *lock_count; | ||
| 322 | |||
| 323 | void CRYPTO_thread_setup(void) | ||
| 324 | { | ||
| 325 | int i; | ||
| 326 | |||
| 327 | lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); | ||
| 328 | lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 329 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 330 | { | ||
| 331 | lock_count[i]=0; | ||
| 332 | pthread_mutex_init(&(lock_cs[i]),NULL); | ||
| 333 | } | ||
| 334 | |||
| 335 | CRYPTO_set_id_callback((unsigned long (*)())pthreads_thread_id); | ||
| 336 | CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback); | ||
| 337 | } | ||
| 338 | |||
| 339 | void thread_cleanup(void) | ||
| 340 | { | ||
| 341 | int i; | ||
| 342 | |||
| 343 | CRYPTO_set_locking_callback(NULL); | ||
| 344 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 345 | { | ||
| 346 | pthread_mutex_destroy(&(lock_cs[i])); | ||
| 347 | } | ||
| 348 | OPENSSL_free(lock_cs); | ||
| 349 | OPENSSL_free(lock_count); | ||
| 350 | } | ||
| 351 | |||
| 352 | void pthreads_locking_callback(int mode, int type, char *file, | ||
| 353 | int line) | ||
| 354 | { | ||
| 355 | #if 0 | ||
| 356 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | ||
| 357 | CRYPTO_thread_id(), | ||
| 358 | (mode&CRYPTO_LOCK)?"l":"u", | ||
| 359 | (type&CRYPTO_READ)?"r":"w",file,line); | ||
| 360 | #endif | ||
| 361 | #if 0 | ||
| 362 | if (CRYPTO_LOCK_SSL_CERT == type) | ||
| 363 | fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", | ||
| 364 | CRYPTO_thread_id(), | ||
| 365 | mode,file,line); | ||
| 366 | #endif | ||
| 367 | if (mode & CRYPTO_LOCK) | ||
| 368 | { | ||
| 369 | pthread_mutex_lock(&(lock_cs[type])); | ||
| 370 | lock_count[type]++; | ||
| 371 | } | ||
| 372 | else | ||
| 373 | { | ||
| 374 | pthread_mutex_unlock(&(lock_cs[type])); | ||
| 375 | } | ||
| 376 | } | ||
| 377 | |||
| 378 | unsigned long pthreads_thread_id(void) | ||
| 379 | { | ||
| 380 | unsigned long ret; | ||
| 381 | |||
| 382 | ret=(unsigned long)pthread_self(); | ||
| 383 | return(ret); | ||
| 384 | } | ||
| 385 | |||
| 386 | #endif /* PTHREADS */ | ||
| 387 | |||
diff --git a/src/lib/libcrypto/threads/win32.bat b/src/lib/libcrypto/threads/win32.bat new file mode 100644 index 0000000000..ee6da80a07 --- /dev/null +++ b/src/lib/libcrypto/threads/win32.bat | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | del mttest.exe | ||
| 2 | |||
| 3 | cl /O2 -DWIN32 /MD -I..\..\out mttest.c /Femttest ..\..\out\ssleay32.lib ..\..\out\libeay32.lib | ||
| 4 | |||
diff --git a/src/lib/libcrypto/ts/Makefile b/src/lib/libcrypto/ts/Makefile new file mode 100644 index 0000000000..c18234555b --- /dev/null +++ b/src/lib/libcrypto/ts/Makefile | |||
| @@ -0,0 +1,269 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/ts/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ts | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I../../include | ||
| 9 | CFLAG = -g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKEDEPPROG= makedepend | ||
| 14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 15 | MAKEFILE= Makefile | ||
| 16 | AR= ar r | ||
| 17 | |||
| 18 | PEX_LIBS= | ||
| 19 | EX_LIBS= | ||
| 20 | |||
| 21 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 22 | |||
| 23 | GENERAL= Makefile | ||
| 24 | TEST= | ||
| 25 | APPS= | ||
| 26 | |||
| 27 | LIB=$(TOP)/libcrypto.a | ||
| 28 | LIBSRC= ts_err.c ts_req_utils.c ts_req_print.c ts_rsp_utils.c ts_rsp_print.c \ | ||
| 29 | ts_rsp_sign.c ts_rsp_verify.c ts_verify_ctx.c ts_lib.c ts_conf.c \ | ||
| 30 | ts_asn1.c | ||
| 31 | LIBOBJ= ts_err.o ts_req_utils.o ts_req_print.o ts_rsp_utils.o ts_rsp_print.o \ | ||
| 32 | ts_rsp_sign.o ts_rsp_verify.o ts_verify_ctx.o ts_lib.o ts_conf.o \ | ||
| 33 | ts_asn1.o | ||
| 34 | |||
| 35 | SRC= $(LIBSRC) | ||
| 36 | |||
| 37 | EXHEADER= ts.h | ||
| 38 | HEADER= $(EXHEADER) | ||
| 39 | |||
| 40 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 41 | |||
| 42 | top: | ||
| 43 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 44 | |||
| 45 | test: | ||
| 46 | |||
| 47 | all: lib | ||
| 48 | |||
| 49 | lib: $(LIBOBJ) | ||
| 50 | $(AR) $(LIB) $(LIBOBJ) | ||
| 51 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 52 | @touch lib | ||
| 53 | |||
| 54 | files: | ||
| 55 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 56 | |||
| 57 | links: | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 60 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 61 | |||
| 62 | install: | ||
| 63 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 64 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 65 | do \ | ||
| 66 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 67 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 68 | done; | ||
| 69 | |||
| 70 | tags: | ||
| 71 | ctags $(SRC) | ||
| 72 | |||
| 73 | lint: | ||
| 74 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 75 | |||
| 76 | depend: | ||
| 77 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 78 | |||
| 79 | dclean: | ||
| 80 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 81 | mv -f Makefile.new $(MAKEFILE) | ||
| 82 | |||
| 83 | clean: | ||
| 84 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff enc dec sign verify | ||
| 85 | |||
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 87 | |||
| 88 | ts_asn1.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 89 | ts_asn1.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 90 | ts_asn1.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 91 | ts_asn1.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 92 | ts_asn1.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 93 | ts_asn1.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 94 | ts_asn1.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 95 | ts_asn1.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 96 | ts_asn1.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 97 | ts_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 98 | ts_asn1.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 99 | ts_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 100 | ts_asn1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 101 | ts_asn1.o: ../../include/openssl/ts.h ../../include/openssl/x509.h | ||
| 102 | ts_asn1.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 103 | ts_asn1.o: ts_asn1.c | ||
| 104 | ts_conf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 105 | ts_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 106 | ts_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 107 | ts_conf.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 108 | ts_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 109 | ts_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 110 | ts_conf.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 111 | ts_conf.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 112 | ts_conf.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 113 | ts_conf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 114 | ts_conf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 115 | ts_conf.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 116 | ts_conf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 117 | ts_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 118 | ts_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 119 | ts_conf.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 120 | ts_conf.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_conf.c | ||
| 121 | ts_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 122 | ts_err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 123 | ts_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 124 | ts_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 125 | ts_err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 126 | ts_err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 127 | ts_err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 128 | ts_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 129 | ts_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 130 | ts_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 131 | ts_err.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 132 | ts_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 133 | ts_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 134 | ts_err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 135 | ts_err.o: ../../include/openssl/x509v3.h ts_err.c | ||
| 136 | ts_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 137 | ts_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 138 | ts_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 139 | ts_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 140 | ts_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 141 | ts_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 142 | ts_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 143 | ts_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 144 | ts_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 145 | ts_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 146 | ts_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/rsa.h | ||
| 147 | ts_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 148 | ts_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 149 | ts_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 150 | ts_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ts.h ts_lib.c | ||
| 151 | ts_req_print.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 152 | ts_req_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 153 | ts_req_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 154 | ts_req_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 155 | ts_req_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 156 | ts_req_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 157 | ts_req_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 158 | ts_req_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 159 | ts_req_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 160 | ts_req_print.o: ../../include/openssl/opensslconf.h | ||
| 161 | ts_req_print.o: ../../include/openssl/opensslv.h | ||
| 162 | ts_req_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 163 | ts_req_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 164 | ts_req_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 165 | ts_req_print.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 166 | ts_req_print.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 167 | ts_req_print.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_print.c | ||
| 168 | ts_req_utils.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 169 | ts_req_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 170 | ts_req_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 171 | ts_req_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 172 | ts_req_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 173 | ts_req_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 174 | ts_req_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 175 | ts_req_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 176 | ts_req_utils.o: ../../include/openssl/objects.h | ||
| 177 | ts_req_utils.o: ../../include/openssl/opensslconf.h | ||
| 178 | ts_req_utils.o: ../../include/openssl/opensslv.h | ||
| 179 | ts_req_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 180 | ts_req_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 181 | ts_req_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 182 | ts_req_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 183 | ts_req_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 184 | ts_req_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_req_utils.c | ||
| 185 | ts_rsp_print.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 186 | ts_rsp_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 187 | ts_rsp_print.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 188 | ts_rsp_print.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
| 189 | ts_rsp_print.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 190 | ts_rsp_print.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 191 | ts_rsp_print.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 192 | ts_rsp_print.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 193 | ts_rsp_print.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 194 | ts_rsp_print.o: ../../include/openssl/opensslconf.h | ||
| 195 | ts_rsp_print.o: ../../include/openssl/opensslv.h | ||
| 196 | ts_rsp_print.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 197 | ts_rsp_print.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 198 | ts_rsp_print.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 199 | ts_rsp_print.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 200 | ts_rsp_print.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 201 | ts_rsp_print.o: ../cryptlib.h ts.h ts_rsp_print.c | ||
| 202 | ts_rsp_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 203 | ts_rsp_sign.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 204 | ts_rsp_sign.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 205 | ts_rsp_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 206 | ts_rsp_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 207 | ts_rsp_sign.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 208 | ts_rsp_sign.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 209 | ts_rsp_sign.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 210 | ts_rsp_sign.o: ../../include/openssl/objects.h | ||
| 211 | ts_rsp_sign.o: ../../include/openssl/opensslconf.h | ||
| 212 | ts_rsp_sign.o: ../../include/openssl/opensslv.h | ||
| 213 | ts_rsp_sign.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 214 | ts_rsp_sign.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 215 | ts_rsp_sign.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 216 | ts_rsp_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 217 | ts_rsp_sign.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 218 | ts_rsp_sign.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_sign.c | ||
| 219 | ts_rsp_utils.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 220 | ts_rsp_utils.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 221 | ts_rsp_utils.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 222 | ts_rsp_utils.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 223 | ts_rsp_utils.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 224 | ts_rsp_utils.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 225 | ts_rsp_utils.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 226 | ts_rsp_utils.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 227 | ts_rsp_utils.o: ../../include/openssl/objects.h | ||
| 228 | ts_rsp_utils.o: ../../include/openssl/opensslconf.h | ||
| 229 | ts_rsp_utils.o: ../../include/openssl/opensslv.h | ||
| 230 | ts_rsp_utils.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 231 | ts_rsp_utils.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 232 | ts_rsp_utils.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 233 | ts_rsp_utils.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 234 | ts_rsp_utils.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 235 | ts_rsp_utils.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_utils.c | ||
| 236 | ts_rsp_verify.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 237 | ts_rsp_verify.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 238 | ts_rsp_verify.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 239 | ts_rsp_verify.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 240 | ts_rsp_verify.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 241 | ts_rsp_verify.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 242 | ts_rsp_verify.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 243 | ts_rsp_verify.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 244 | ts_rsp_verify.o: ../../include/openssl/objects.h | ||
| 245 | ts_rsp_verify.o: ../../include/openssl/opensslconf.h | ||
| 246 | ts_rsp_verify.o: ../../include/openssl/opensslv.h | ||
| 247 | ts_rsp_verify.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 248 | ts_rsp_verify.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 249 | ts_rsp_verify.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 250 | ts_rsp_verify.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 251 | ts_rsp_verify.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 252 | ts_rsp_verify.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_rsp_verify.c | ||
| 253 | ts_verify_ctx.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 254 | ts_verify_ctx.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 255 | ts_verify_ctx.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 256 | ts_verify_ctx.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 257 | ts_verify_ctx.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 258 | ts_verify_ctx.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 259 | ts_verify_ctx.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 260 | ts_verify_ctx.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 261 | ts_verify_ctx.o: ../../include/openssl/objects.h | ||
| 262 | ts_verify_ctx.o: ../../include/openssl/opensslconf.h | ||
| 263 | ts_verify_ctx.o: ../../include/openssl/opensslv.h | ||
| 264 | ts_verify_ctx.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 265 | ts_verify_ctx.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 266 | ts_verify_ctx.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 267 | ts_verify_ctx.o: ../../include/openssl/symhacks.h ../../include/openssl/ts.h | ||
| 268 | ts_verify_ctx.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 269 | ts_verify_ctx.o: ../../include/openssl/x509v3.h ../cryptlib.h ts_verify_ctx.c | ||
diff --git a/src/lib/libcrypto/ts/ts_rsp_verify.c b/src/lib/libcrypto/ts/ts_rsp_verify.c index e1f3b534af..ed0252d7d7 100644 --- a/src/lib/libcrypto/ts/ts_rsp_verify.c +++ b/src/lib/libcrypto/ts/ts_rsp_verify.c | |||
| @@ -509,15 +509,17 @@ static int TS_check_status_info(TS_RESP *response) | |||
| 509 | TS_failure_info[i].code)) | 509 | TS_failure_info[i].code)) |
| 510 | { | 510 | { |
| 511 | if (!first) | 511 | if (!first) |
| 512 | strcpy(failure_text, ","); | 512 | strlcat(failure_text, ",", |
| 513 | TS_STATUS_BUF_SIZE); | ||
| 513 | else | 514 | else |
| 514 | first = 0; | 515 | first = 0; |
| 515 | strcat(failure_text, TS_failure_info[i].text); | 516 | strlcat(failure_text, TS_failure_info[i].text, |
| 517 | TS_STATUS_BUF_SIZE); | ||
| 516 | } | 518 | } |
| 517 | } | 519 | } |
| 518 | } | 520 | } |
| 519 | if (failure_text[0] == '\0') | 521 | if (failure_text[0] == '\0') |
| 520 | strcpy(failure_text, "unspecified"); | 522 | strlcpy(failure_text, "unspecified", TS_STATUS_BUF_SIZE); |
| 521 | 523 | ||
| 522 | /* Making up the error string. */ | 524 | /* Making up the error string. */ |
| 523 | TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN); | 525 | TSerr(TS_F_TS_CHECK_STATUS_INFO, TS_R_NO_TIME_STAMP_TOKEN); |
diff --git a/src/lib/libcrypto/txt_db/Makefile b/src/lib/libcrypto/txt_db/Makefile new file mode 100644 index 0000000000..e6f30331d8 --- /dev/null +++ b/src/lib/libcrypto/txt_db/Makefile | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/txt_db/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= txt_db | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=txt_db.c | ||
| 21 | LIBOBJ=txt_db.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= txt_db.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by top Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | txt_db.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 78 | txt_db.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 79 | txt_db.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 80 | txt_db.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 81 | txt_db.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 82 | txt_db.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 83 | txt_db.o: ../../include/openssl/symhacks.h ../../include/openssl/txt_db.h | ||
| 84 | txt_db.o: ../cryptlib.h txt_db.c | ||
diff --git a/src/lib/libcrypto/ui/Makefile b/src/lib/libcrypto/ui/Makefile new file mode 100644 index 0000000000..a685659fb4 --- /dev/null +++ b/src/lib/libcrypto/ui/Makefile | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/ui/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= ui | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | #TEST= uitest.c | ||
| 17 | TEST= | ||
| 18 | APPS= | ||
| 19 | |||
| 20 | COMPATSRC= ui_compat.c | ||
| 21 | COMPATOBJ= ui_compat.o | ||
| 22 | |||
| 23 | LIB=$(TOP)/libcrypto.a | ||
| 24 | LIBSRC= ui_err.c ui_lib.c ui_openssl.c ui_util.c $(COMPATSRC) | ||
| 25 | LIBOBJ= ui_err.o ui_lib.o ui_openssl.o ui_util.o $(COMPATOBJ) | ||
| 26 | |||
| 27 | SRC= $(LIBSRC) | ||
| 28 | |||
| 29 | EXHEADER= ui.h ui_compat.h | ||
| 30 | HEADER= $(EXHEADER) ui_locl.h | ||
| 31 | |||
| 32 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 33 | |||
| 34 | top: | ||
| 35 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 36 | |||
| 37 | all: lib | ||
| 38 | |||
| 39 | lib: $(LIBOBJ) | ||
| 40 | $(AR) $(LIB) $(LIBOBJ) | ||
| 41 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 42 | @touch lib | ||
| 43 | |||
| 44 | files: | ||
| 45 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 46 | |||
| 47 | links: | ||
| 48 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 49 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 50 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 51 | |||
| 52 | install: | ||
| 53 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 54 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 55 | do \ | ||
| 56 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 57 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 58 | done; | ||
| 59 | |||
| 60 | tags: | ||
| 61 | ctags $(SRC) | ||
| 62 | |||
| 63 | tests: | ||
| 64 | |||
| 65 | lint: | ||
| 66 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 67 | |||
| 68 | depend: | ||
| 69 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 70 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 71 | |||
| 72 | dclean: | ||
| 73 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 74 | mv -f Makefile.new $(MAKEFILE) | ||
| 75 | |||
| 76 | clean: | ||
| 77 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 78 | |||
| 79 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 80 | |||
| 81 | ui_compat.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 82 | ui_compat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 83 | ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/ui.h | ||
| 84 | ui_compat.o: ../../include/openssl/ui_compat.h ui_compat.c | ||
| 85 | ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 86 | ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 87 | ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 88 | ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 89 | ui_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 90 | ui_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h ui_err.c | ||
| 91 | ui_lib.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 92 | ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 93 | ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 94 | ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 95 | ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 96 | ui_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 97 | ui_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 98 | ui_lib.o: ../cryptlib.h ui_lib.c ui_locl.h | ||
| 99 | ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 100 | ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 101 | ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 102 | ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 103 | ui_openssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 104 | ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 105 | ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
| 106 | ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c | ||
| 107 | ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 108 | ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 109 | ui_util.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 110 | ui_util.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 111 | ui_util.o: ../../include/openssl/ui.h ui_locl.h ui_util.c | ||
diff --git a/src/lib/libcrypto/o_init.c b/src/lib/libcrypto/ui/ui_compat.c index 00ed65a6cf..13e0f70d90 100644 --- a/src/lib/libcrypto/o_init.c +++ b/src/lib/libcrypto/ui/ui_compat.c | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | /* o_init.c */ | 1 | /* crypto/ui/ui_compat.c -*- mode:C; c-file-style: "eay" -*- */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | 2 | /* ==================================================================== |
| 6 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved. |
| 7 | * | 4 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
| @@ -56,31 +53,15 @@ | |||
| 56 | * | 53 | * |
| 57 | */ | 54 | */ |
| 58 | 55 | ||
| 59 | #include <e_os.h> | 56 | #include <string.h> |
| 60 | #include <openssl/err.h> | 57 | #include <openssl/ui_compat.h> |
| 61 | |||
| 62 | /* Perform any essential OpenSSL initialization operations. | ||
| 63 | * Currently only sets FIPS callbacks | ||
| 64 | */ | ||
| 65 | 58 | ||
| 66 | void OPENSSL_init(void) | 59 | int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify) |
| 67 | { | 60 | { |
| 68 | #ifdef OPENSSL_FIPS | 61 | return UI_UTIL_read_pw_string(buf, length, prompt, verify); |
| 69 | static int done = 0; | ||
| 70 | if (!done) | ||
| 71 | { | ||
| 72 | int_ERR_lib_init(); | ||
| 73 | #ifdef CRYPTO_MDEBUG | ||
| 74 | CRYPTO_malloc_debug_init(); | ||
| 75 | #endif | ||
| 76 | #ifdef OPENSSL_ENGINE | ||
| 77 | int_EVP_MD_init_engine_callbacks(); | ||
| 78 | int_EVP_CIPHER_init_engine_callbacks(); | ||
| 79 | int_RAND_init_engine_callbacks(); | ||
| 80 | #endif | ||
| 81 | done = 1; | ||
| 82 | } | ||
| 83 | #endif | ||
| 84 | } | 62 | } |
| 85 | |||
| 86 | 63 | ||
| 64 | int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify) | ||
| 65 | { | ||
| 66 | return UI_UTIL_read_pw(buf, buff, size, prompt, verify); | ||
| 67 | } | ||
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index 1bc25f48d5..1e3dba0833 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
| @@ -398,8 +398,8 @@ static int read_till_nl(FILE *in) | |||
| 398 | char buf[SIZE+1]; | 398 | char buf[SIZE+1]; |
| 399 | 399 | ||
| 400 | do { | 400 | do { |
| 401 | if (!fgets(buf,SIZE,in)) | 401 | if (fgets(buf,sizeof(buf),in) == NULL) |
| 402 | return 0; | 402 | break; |
| 403 | } while (strchr(buf,'\n') == NULL); | 403 | } while (strchr(buf,'\n') == NULL); |
| 404 | return 1; | 404 | return 1; |
| 405 | } | 405 | } |
diff --git a/src/lib/libcrypto/uid.c b/src/lib/libcrypto/uid.c new file mode 100644 index 0000000000..b1fd52bada --- /dev/null +++ b/src/lib/libcrypto/uid.c | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | /* crypto/uid.c */ | ||
| 2 | /* ==================================================================== | ||
| 3 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. | ||
| 4 | * | ||
| 5 | * Redistribution and use in source and binary forms, with or without | ||
| 6 | * modification, are permitted provided that the following conditions | ||
| 7 | * are met: | ||
| 8 | * | ||
| 9 | * 1. Redistributions of source code must retain the above copyright | ||
| 10 | * notice, this list of conditions and the following disclaimer. | ||
| 11 | * | ||
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer in | ||
| 14 | * the documentation and/or other materials provided with the | ||
| 15 | * distribution. | ||
| 16 | * | ||
| 17 | * 3. All advertising materials mentioning features or use of this | ||
| 18 | * software must display the following acknowledgment: | ||
| 19 | * "This product includes software developed by the OpenSSL Project | ||
| 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 21 | * | ||
| 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 23 | * endorse or promote products derived from this software without | ||
| 24 | * prior written permission. For written permission, please contact | ||
| 25 | * licensing@OpenSSL.org. | ||
| 26 | * | ||
| 27 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 28 | * nor may "OpenSSL" appear in their names without prior written | ||
| 29 | * permission of the OpenSSL Project. | ||
| 30 | * | ||
| 31 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 32 | * acknowledgment: | ||
| 33 | * "This product includes software developed by the OpenSSL Project | ||
| 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 35 | * | ||
| 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * ==================================================================== | ||
| 49 | * | ||
| 50 | * This product includes cryptographic software written by Eric Young | ||
| 51 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 52 | * Hudson (tjh@cryptsoft.com). | ||
| 53 | * | ||
| 54 | */ | ||
| 55 | |||
| 56 | #include <openssl/crypto.h> | ||
| 57 | #include <openssl/opensslconf.h> | ||
| 58 | |||
| 59 | #if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) | ||
| 60 | |||
| 61 | #include OPENSSL_UNISTD | ||
| 62 | |||
| 63 | int OPENSSL_issetugid(void) | ||
| 64 | { | ||
| 65 | return issetugid(); | ||
| 66 | } | ||
| 67 | |||
| 68 | #elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) | ||
| 69 | |||
| 70 | int OPENSSL_issetugid(void) | ||
| 71 | { | ||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | #else | ||
| 76 | |||
| 77 | #include OPENSSL_UNISTD | ||
| 78 | #include <sys/types.h> | ||
| 79 | |||
| 80 | int OPENSSL_issetugid(void) | ||
| 81 | { | ||
| 82 | if (getuid() != geteuid()) return 1; | ||
| 83 | if (getgid() != getegid()) return 1; | ||
| 84 | return 0; | ||
| 85 | } | ||
| 86 | #endif | ||
| 87 | |||
| 88 | |||
| 89 | |||
diff --git a/src/lib/libcrypto/util/FreeBSD.sh b/src/lib/libcrypto/util/FreeBSD.sh new file mode 100644 index 0000000000..db8edfc6aa --- /dev/null +++ b/src/lib/libcrypto/util/FreeBSD.sh | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | perl util/perlpath.pl /usr/bin | ||
| 4 | perl util/ssldir.pl /usr/local | ||
| 5 | perl util/mk1mf.pl FreeBSD >Makefile.FreeBSD | ||
| 6 | perl Configure FreeBSD | ||
diff --git a/src/lib/libcrypto/util/add_cr.pl b/src/lib/libcrypto/util/add_cr.pl new file mode 100644 index 0000000000..c7b62c11ec --- /dev/null +++ b/src/lib/libcrypto/util/add_cr.pl | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # This adds a copyright message to a souce code file. | ||
| 4 | # It also gets the file name correct. | ||
| 5 | # | ||
| 6 | # perl util/add_cr.pl *.[ch] */*.[ch] */*/*.[ch] | ||
| 7 | # | ||
| 8 | |||
| 9 | foreach (@ARGV) | ||
| 10 | { | ||
| 11 | &dofile($_); | ||
| 12 | } | ||
| 13 | |||
| 14 | sub dofile | ||
| 15 | { | ||
| 16 | local($file)=@_; | ||
| 17 | |||
| 18 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
| 19 | |||
| 20 | print STDERR "doing $file\n"; | ||
| 21 | @in=<IN>; | ||
| 22 | |||
| 23 | return(1) if ($in[0] =~ / NOCW /); | ||
| 24 | |||
| 25 | @out=(); | ||
| 26 | open(OUT,">$file.out") || die "unable to open $file.$$:$!\n"; | ||
| 27 | push(@out,"/* $file */\n"); | ||
| 28 | if (($in[1] !~ /^\/\* Copyright \(C\) [0-9-]+ Eric Young \(eay\@cryptsoft.com\)/)) | ||
| 29 | { | ||
| 30 | push(@out,&Copyright); | ||
| 31 | $i=2; | ||
| 32 | @a=grep(/ Copyright \(C\) /,@in); | ||
| 33 | if ($#a >= 0) | ||
| 34 | { | ||
| 35 | while (($i <= $#in) && ($in[$i] ne " */\n")) | ||
| 36 | { $i++; } | ||
| 37 | $i++ if ($in[$i] eq " */\n"); | ||
| 38 | |||
| 39 | while (($i <= $#in) && ($in[$i] =~ /^\s*$/)) | ||
| 40 | { $i++; } | ||
| 41 | |||
| 42 | push(@out,"\n"); | ||
| 43 | for ( ; $i <= $#in; $i++) | ||
| 44 | { push(@out,$in[$i]); } | ||
| 45 | } | ||
| 46 | else | ||
| 47 | { push(@out,@in); } | ||
| 48 | } | ||
| 49 | else | ||
| 50 | { | ||
| 51 | shift(@in); | ||
| 52 | push(@out,@in); | ||
| 53 | } | ||
| 54 | print OUT @out; | ||
| 55 | close(IN); | ||
| 56 | close(OUT); | ||
| 57 | rename("$file","$file.orig") || die "unable to rename $file:$!\n"; | ||
| 58 | rename("$file.out",$file) || die "unable to rename $file.out:$!\n"; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | sub Copyright | ||
| 64 | { | ||
| 65 | return <<'EOF'; | ||
| 66 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 67 | * All rights reserved. | ||
| 68 | * | ||
| 69 | * This package is an SSL implementation written | ||
| 70 | * by Eric Young (eay@cryptsoft.com). | ||
| 71 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 72 | * | ||
| 73 | * This library is free for commercial and non-commercial use as long as | ||
| 74 | * the following conditions are aheared to. The following conditions | ||
| 75 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 76 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 77 | * included with this distribution is covered by the same copyright terms | ||
| 78 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 79 | * | ||
| 80 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 81 | * the code are not to be removed. | ||
| 82 | * If this package is used in a product, Eric Young should be given attribution | ||
| 83 | * as the author of the parts of the library used. | ||
| 84 | * This can be in the form of a textual message at program startup or | ||
| 85 | * in documentation (online or textual) provided with the package. | ||
| 86 | * | ||
| 87 | * Redistribution and use in source and binary forms, with or without | ||
| 88 | * modification, are permitted provided that the following conditions | ||
| 89 | * are met: | ||
| 90 | * 1. Redistributions of source code must retain the copyright | ||
| 91 | * notice, this list of conditions and the following disclaimer. | ||
| 92 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 93 | * notice, this list of conditions and the following disclaimer in the | ||
| 94 | * documentation and/or other materials provided with the distribution. | ||
| 95 | * 3. All advertising materials mentioning features or use of this software | ||
| 96 | * must display the following acknowledgement: | ||
| 97 | * "This product includes cryptographic software written by | ||
| 98 | * Eric Young (eay@cryptsoft.com)" | ||
| 99 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 100 | * being used are not cryptographic related :-). | ||
| 101 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 102 | * the apps directory (application code) you must include an acknowledgement: | ||
| 103 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 104 | * | ||
| 105 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 106 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 107 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 108 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 109 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 110 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 111 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 112 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 113 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 114 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 115 | * SUCH DAMAGE. | ||
| 116 | * | ||
| 117 | * The licence and distribution terms for any publically available version or | ||
| 118 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 119 | * copied and put under another distribution licence | ||
| 120 | * [including the GNU Public Licence.] | ||
| 121 | */ | ||
| 122 | EOF | ||
| 123 | } | ||
diff --git a/src/lib/libcrypto/util/bat.sh b/src/lib/libcrypto/util/bat.sh new file mode 100644 index 0000000000..4d9a8287d0 --- /dev/null +++ b/src/lib/libcrypto/util/bat.sh | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | $infile="/home/eay/ssl/SSLeay/MINFO"; | ||
| 4 | |||
| 5 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
| 6 | $_=<IN>; | ||
| 7 | for (;;) | ||
| 8 | { | ||
| 9 | chop; | ||
| 10 | |||
| 11 | ($key,$val)=/^([^=]+)=(.*)/; | ||
| 12 | if ($key eq "RELATIVE_DIRECTORY") | ||
| 13 | { | ||
| 14 | if ($lib ne "") | ||
| 15 | { | ||
| 16 | $uc=$lib; | ||
| 17 | $uc =~ s/^lib(.*)\.a/$1/; | ||
| 18 | $uc =~ tr/a-z/A-Z/; | ||
| 19 | $lib_nam{$uc}=$uc; | ||
| 20 | $lib_obj{$uc}.=$libobj." "; | ||
| 21 | } | ||
| 22 | last if ($val eq "FINISHED"); | ||
| 23 | $lib=""; | ||
| 24 | $libobj=""; | ||
| 25 | $dir=$val; | ||
| 26 | } | ||
| 27 | |||
| 28 | if ($key eq "TEST") | ||
| 29 | { $test.=&var_add($dir,$val); } | ||
| 30 | |||
| 31 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
| 32 | { $e_exe.=&var_add($dir,$val); } | ||
| 33 | |||
| 34 | if ($key eq "LIB") | ||
| 35 | { | ||
| 36 | $lib=$val; | ||
| 37 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
| 38 | } | ||
| 39 | |||
| 40 | if ($key eq "EXHEADER") | ||
| 41 | { $exheader.=&var_add($dir,$val); } | ||
| 42 | |||
| 43 | if ($key eq "HEADER") | ||
| 44 | { $header.=&var_add($dir,$val); } | ||
| 45 | |||
| 46 | if ($key eq "LIBSRC") | ||
| 47 | { $libsrc.=&var_add($dir,$val); } | ||
| 48 | |||
| 49 | if (!($_=<IN>)) | ||
| 50 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
| 51 | } | ||
| 52 | close(IN); | ||
| 53 | |||
| 54 | @a=split(/\s+/,$libsrc); | ||
| 55 | foreach (@a) | ||
| 56 | { | ||
| 57 | print "${_}.c\n"; | ||
| 58 | } | ||
| 59 | |||
| 60 | sub var_add | ||
| 61 | { | ||
| 62 | local($dir,$val)=@_; | ||
| 63 | local(@a,$_,$ret); | ||
| 64 | |||
| 65 | return("") if $no_engine && $dir =~ /\/engine/; | ||
| 66 | return("") if $no_idea && $dir =~ /\/idea/; | ||
| 67 | return("") if $no_rc2 && $dir =~ /\/rc2/; | ||
| 68 | return("") if $no_rc4 && $dir =~ /\/rc4/; | ||
| 69 | return("") if $no_rsa && $dir =~ /\/rsa/; | ||
| 70 | return("") if $no_rsa && $dir =~ /^rsaref/; | ||
| 71 | return("") if $no_dsa && $dir =~ /\/dsa/; | ||
| 72 | return("") if $no_dh && $dir =~ /\/dh/; | ||
| 73 | if ($no_des && $dir =~ /\/des/) | ||
| 74 | { | ||
| 75 | if ($val =~ /read_pwd/) | ||
| 76 | { return("$dir/read_pwd "); } | ||
| 77 | else | ||
| 78 | { return(""); } | ||
| 79 | } | ||
| 80 | return("") if $no_mdc2 && $dir =~ /\/mdc2/; | ||
| 81 | return("") if $no_sock && $dir =~ /\/proxy/; | ||
| 82 | return("") if $no_bf && $dir =~ /\/bf/; | ||
| 83 | return("") if $no_cast && $dir =~ /\/cast/; | ||
| 84 | |||
| 85 | $val =~ s/^\s*(.*)\s*$/$1/; | ||
| 86 | @a=split(/\s+/,$val); | ||
| 87 | grep(s/\.[och]$//,@a); | ||
| 88 | |||
| 89 | @a=grep(!/^e_.*_3d$/,@a) if $no_des; | ||
| 90 | @a=grep(!/^e_.*_d$/,@a) if $no_des; | ||
| 91 | @a=grep(!/^e_.*_i$/,@a) if $no_idea; | ||
| 92 | @a=grep(!/^e_.*_r2$/,@a) if $no_rc2; | ||
| 93 | @a=grep(!/^e_.*_bf$/,@a) if $no_bf; | ||
| 94 | @a=grep(!/^e_.*_c$/,@a) if $no_cast; | ||
| 95 | @a=grep(!/^e_rc4$/,@a) if $no_rc4; | ||
| 96 | |||
| 97 | @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | ||
| 98 | @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | ||
| 99 | |||
| 100 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; | ||
| 101 | |||
| 102 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; | ||
| 103 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; | ||
| 104 | |||
| 105 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; | ||
| 106 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; | ||
| 107 | @a=grep(!/(^pem_seal$)/,@a) if $no_rsa; | ||
| 108 | |||
| 109 | @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa; | ||
| 110 | @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa; | ||
| 111 | |||
| 112 | @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4; | ||
| 113 | |||
| 114 | @a=grep(!/_dhp$/,@a) if $no_dh; | ||
| 115 | |||
| 116 | @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha; | ||
| 117 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
| 118 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | ||
| 119 | |||
| 120 | @a=grep(!/^engine$/,@a) if $no_engine; | ||
| 121 | @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa; | ||
| 122 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | ||
| 123 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | ||
| 124 | @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; | ||
| 125 | |||
| 126 | @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
| 127 | |||
| 128 | grep($_="$dir/$_",@a); | ||
| 129 | @a=grep(!/(^|\/)s_/,@a) if $no_sock; | ||
| 130 | @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock; | ||
| 131 | $ret=join(' ',@a)." "; | ||
| 132 | return($ret); | ||
| 133 | } | ||
| 134 | |||
diff --git a/src/lib/libcrypto/util/ck_errf.pl b/src/lib/libcrypto/util/ck_errf.pl new file mode 100644 index 0000000000..f13af5c50b --- /dev/null +++ b/src/lib/libcrypto/util/ck_errf.pl | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # This is just a quick script to scan for cases where the 'error' | ||
| 4 | # function name in a XXXerr() macro is wrong. | ||
| 5 | # | ||
| 6 | # Run in the top level by going | ||
| 7 | # perl util/ck_errf.pl */*.c */*/*.c | ||
| 8 | # | ||
| 9 | |||
| 10 | my $err_strict = 0; | ||
| 11 | my $bad = 0; | ||
| 12 | |||
| 13 | foreach $file (@ARGV) | ||
| 14 | { | ||
| 15 | if ($file eq "-strict") | ||
| 16 | { | ||
| 17 | $err_strict = 1; | ||
| 18 | next; | ||
| 19 | } | ||
| 20 | open(IN,"<$file") || die "unable to open $file\n"; | ||
| 21 | $func=""; | ||
| 22 | while (<IN>) | ||
| 23 | { | ||
| 24 | if (!/;$/ && /^([a-zA-Z].*[\s*])?([A-Za-z_0-9]+)\(.*[),]/) | ||
| 25 | { | ||
| 26 | /^([^()]*(\([^()]*\)[^()]*)*)\(/; | ||
| 27 | $1 =~ /([A-Za-z_0-9]*)$/; | ||
| 28 | $func = $1; | ||
| 29 | $func =~ tr/A-Z/a-z/; | ||
| 30 | } | ||
| 31 | if (/([A-Z0-9]+)err\(([^,]+)/ && ! /ckerr_ignore/) | ||
| 32 | { | ||
| 33 | $errlib=$1; | ||
| 34 | $n=$2; | ||
| 35 | |||
| 36 | if ($func eq "") | ||
| 37 | { print "$file:$.:???:$n\n"; $bad = 1; next; } | ||
| 38 | |||
| 39 | if ($n !~ /([^_]+)_F_(.+)$/) | ||
| 40 | { | ||
| 41 | # print "check -$file:$.:$func:$n\n"; | ||
| 42 | next; | ||
| 43 | } | ||
| 44 | $lib=$1; | ||
| 45 | $n=$2; | ||
| 46 | |||
| 47 | if ($lib ne $errlib) | ||
| 48 | { print "$file:$.:$func:$n [${errlib}err]\n"; $bad = 1; next; } | ||
| 49 | |||
| 50 | $n =~ tr/A-Z/a-z/; | ||
| 51 | if (($n ne $func) && ($errlib ne "SYS")) | ||
| 52 | { print "$file:$.:$func:$n\n"; $bad = 1; next; } | ||
| 53 | # print "$func:$1\n"; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | close(IN); | ||
| 57 | } | ||
| 58 | |||
| 59 | if ($bad && $err_strict) | ||
| 60 | { | ||
| 61 | print STDERR "FATAL: error discrepancy\n"; | ||
| 62 | exit 1; | ||
| 63 | } | ||
| 64 | |||
diff --git a/src/lib/libcrypto/util/clean-depend.pl b/src/lib/libcrypto/util/clean-depend.pl new file mode 100644 index 0000000000..d3525b0ed0 --- /dev/null +++ b/src/lib/libcrypto/util/clean-depend.pl | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #!/usr/local/bin/perl -w | ||
| 2 | # Clean the dependency list in a makefile of standard includes... | ||
| 3 | # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | |||
| 7 | while(<STDIN>) { | ||
| 8 | print; | ||
| 9 | last if /^# DO NOT DELETE THIS LINE/; | ||
| 10 | } | ||
| 11 | |||
| 12 | my %files; | ||
| 13 | |||
| 14 | my $thisfile=""; | ||
| 15 | while(<STDIN>) { | ||
| 16 | my ($dummy, $file,$deps)=/^((.*):)? (.*)$/; | ||
| 17 | my $origfile=""; | ||
| 18 | $thisfile=$file if defined $file; | ||
| 19 | next if !defined $deps; | ||
| 20 | $origfile=$thisfile; | ||
| 21 | $origfile=~s/\.o$/.c/; | ||
| 22 | my @deps=split ' ',$deps; | ||
| 23 | @deps=grep(!/^\//,@deps); | ||
| 24 | @deps=grep(!/^\\$/,@deps); | ||
| 25 | @deps=grep(!/^$origfile$/,@deps); | ||
| 26 | # pull out the kludged kerberos header (if present). | ||
| 27 | @deps=grep(!/^[.\/]+\/krb5.h/,@deps); | ||
| 28 | push @{$files{$thisfile}},@deps; | ||
| 29 | } | ||
| 30 | |||
| 31 | my $file; | ||
| 32 | foreach $file (sort keys %files) { | ||
| 33 | my $len=0; | ||
| 34 | my $dep; | ||
| 35 | my $origfile=$file; | ||
| 36 | $origfile=~s/\.o$/.c/; | ||
| 37 | $file=~s/^\.\///; | ||
| 38 | push @{$files{$file}},$origfile; | ||
| 39 | my $prevdep=""; | ||
| 40 | |||
| 41 | # Remove leading ./ before sorting | ||
| 42 | my @deps = map { $_ =~ s/^\.\///; $_ } @{$files{$file}}; | ||
| 43 | |||
| 44 | foreach $dep (sort @deps) { | ||
| 45 | $dep=~s/^\.\///; | ||
| 46 | next if $prevdep eq $dep; # to exterminate duplicates... | ||
| 47 | $prevdep = $dep; | ||
| 48 | $len=0 if $len+length($dep)+1 >= 80; | ||
| 49 | if($len == 0) { | ||
| 50 | print "\n$file:"; | ||
| 51 | $len=length($file)+1; | ||
| 52 | } | ||
| 53 | print " $dep"; | ||
| 54 | $len+=length($dep)+1; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | print "\n"; | ||
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl new file mode 100644 index 0000000000..eba6d5815e --- /dev/null +++ b/src/lib/libcrypto/util/copy.pl | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | use Fcntl; | ||
| 4 | |||
| 5 | |||
| 6 | # copy.pl | ||
| 7 | |||
| 8 | # Perl script 'copy' comment. On Windows the built in "copy" command also | ||
| 9 | # copies timestamps: this messes up Makefile dependencies. | ||
| 10 | |||
| 11 | my $stripcr = 0; | ||
| 12 | |||
| 13 | my $arg; | ||
| 14 | |||
| 15 | foreach $arg (@ARGV) { | ||
| 16 | if ($arg eq "-stripcr") | ||
| 17 | { | ||
| 18 | $stripcr = 1; | ||
| 19 | next; | ||
| 20 | } | ||
| 21 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... | ||
| 22 | foreach (glob $arg) | ||
| 23 | { | ||
| 24 | push @filelist, $_; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | $fnum = @filelist; | ||
| 29 | |||
| 30 | if ($fnum <= 1) | ||
| 31 | { | ||
| 32 | die "Need at least two filenames"; | ||
| 33 | } | ||
| 34 | |||
| 35 | $dest = pop @filelist; | ||
| 36 | |||
| 37 | if ($fnum > 2 && ! -d $dest) | ||
| 38 | { | ||
| 39 | die "Destination must be a directory"; | ||
| 40 | } | ||
| 41 | |||
| 42 | foreach (@filelist) | ||
| 43 | { | ||
| 44 | if (-d $dest) | ||
| 45 | { | ||
| 46 | $dfile = $_; | ||
| 47 | $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; | ||
| 48 | $dfile = "$dest/$dfile"; | ||
| 49 | } | ||
| 50 | else | ||
| 51 | { | ||
| 52 | $dfile = $dest; | ||
| 53 | } | ||
| 54 | sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; | ||
| 55 | sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) | ||
| 56 | || die "Can't Open $dfile"; | ||
| 57 | while (sysread IN, $buf, 10240) | ||
| 58 | { | ||
| 59 | if ($stripcr) | ||
| 60 | { | ||
| 61 | $buf =~ tr/\015//d; | ||
| 62 | } | ||
| 63 | syswrite(OUT, $buf, length($buf)); | ||
| 64 | } | ||
| 65 | close(IN); | ||
| 66 | close(OUT); | ||
| 67 | print "Copying: $_ to $dfile\n"; | ||
| 68 | } | ||
| 69 | |||
| 70 | |||
diff --git a/src/lib/libcrypto/util/cygwin.sh b/src/lib/libcrypto/util/cygwin.sh new file mode 100644 index 0000000000..a4f2e740b4 --- /dev/null +++ b/src/lib/libcrypto/util/cygwin.sh | |||
| @@ -0,0 +1,141 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # This script configures, builds and packs the binary package for | ||
| 4 | # the Cygwin net distribution version of OpenSSL | ||
| 5 | # | ||
| 6 | |||
| 7 | # Uncomment when debugging | ||
| 8 | #set -x | ||
| 9 | |||
| 10 | CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5" | ||
| 11 | INSTALL_PREFIX=/tmp/install | ||
| 12 | |||
| 13 | VERSION= | ||
| 14 | SUBVERSION=$1 | ||
| 15 | |||
| 16 | function cleanup() | ||
| 17 | { | ||
| 18 | rm -rf ${INSTALL_PREFIX}/etc | ||
| 19 | rm -rf ${INSTALL_PREFIX}/usr | ||
| 20 | } | ||
| 21 | |||
| 22 | function get_openssl_version() | ||
| 23 | { | ||
| 24 | eval `grep '^VERSION=' Makefile` | ||
| 25 | if [ -z "${VERSION}" ] | ||
| 26 | then | ||
| 27 | echo "Error: Couldn't retrieve OpenSSL version from Makefile." | ||
| 28 | echo " Check value of variable VERSION in Makefile." | ||
| 29 | exit 1 | ||
| 30 | fi | ||
| 31 | } | ||
| 32 | |||
| 33 | function base_install() | ||
| 34 | { | ||
| 35 | mkdir -p ${INSTALL_PREFIX} | ||
| 36 | cleanup | ||
| 37 | make install INSTALL_PREFIX="${INSTALL_PREFIX}" | ||
| 38 | } | ||
| 39 | |||
| 40 | function doc_install() | ||
| 41 | { | ||
| 42 | DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl | ||
| 43 | |||
| 44 | mkdir -p ${DOC_DIR} | ||
| 45 | cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR} | ||
| 46 | |||
| 47 | create_cygwin_readme | ||
| 48 | } | ||
| 49 | |||
| 50 | function certs_install() | ||
| 51 | { | ||
| 52 | CERTS_DIR=${INSTALL_PREFIX}/usr/ssl/certs | ||
| 53 | |||
| 54 | mkdir -p ${CERTS_DIR} | ||
| 55 | cp -rp certs/* ${CERTS_DIR} | ||
| 56 | } | ||
| 57 | |||
| 58 | function create_cygwin_readme() | ||
| 59 | { | ||
| 60 | README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin | ||
| 61 | README_FILE=${README_DIR}/openssl-${VERSION}.README | ||
| 62 | |||
| 63 | mkdir -p ${README_DIR} | ||
| 64 | cat > ${README_FILE} <<- EOF | ||
| 65 | The Cygwin version has been built using the following configure: | ||
| 66 | |||
| 67 | ./config ${CONFIG_OPTIONS} | ||
| 68 | |||
| 69 | The IDEA and RC5 algorithms are disabled due to patent and/or | ||
| 70 | licensing issues. | ||
| 71 | EOF | ||
| 72 | } | ||
| 73 | |||
| 74 | function create_profile_files() | ||
| 75 | { | ||
| 76 | PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d | ||
| 77 | |||
| 78 | mkdir -p $PROFILE_DIR | ||
| 79 | cat > ${PROFILE_DIR}/openssl.sh <<- "EOF" | ||
| 80 | export MANPATH="${MANPATH}:/usr/ssl/man" | ||
| 81 | EOF | ||
| 82 | cat > ${PROFILE_DIR}/openssl.csh <<- "EOF" | ||
| 83 | if ( $?MANPATH ) then | ||
| 84 | setenv MANPATH "${MANPATH}:/usr/ssl/man" | ||
| 85 | else | ||
| 86 | setenv MANPATH ":/usr/ssl/man" | ||
| 87 | endif | ||
| 88 | EOF | ||
| 89 | } | ||
| 90 | |||
| 91 | if [ -z "${SUBVERSION}" ] | ||
| 92 | then | ||
| 93 | echo "Usage: $0 subversion" | ||
| 94 | exit 1 | ||
| 95 | fi | ||
| 96 | |||
| 97 | if [ ! -f config ] | ||
| 98 | then | ||
| 99 | echo "You must start this script in the OpenSSL toplevel source dir." | ||
| 100 | exit 1 | ||
| 101 | fi | ||
| 102 | |||
| 103 | ./config ${CONFIG_OPTIONS} | ||
| 104 | |||
| 105 | get_openssl_version | ||
| 106 | |||
| 107 | make depend || exit 1 | ||
| 108 | |||
| 109 | make || exit 1 | ||
| 110 | |||
| 111 | base_install | ||
| 112 | |||
| 113 | doc_install | ||
| 114 | |||
| 115 | certs_install | ||
| 116 | |||
| 117 | create_cygwin_readme | ||
| 118 | |||
| 119 | create_profile_files | ||
| 120 | |||
| 121 | cd ${INSTALL_PREFIX} | ||
| 122 | chmod u+w usr/lib/engines/*.so | ||
| 123 | strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so | ||
| 124 | chmod u-w usr/lib/engines/*.so | ||
| 125 | |||
| 126 | # Runtime package | ||
| 127 | find etc usr/bin usr/lib/engines usr/share/doc usr/ssl/certs \ | ||
| 128 | usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private \ | ||
| 129 | -empty -o \! -type d | | ||
| 130 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - | ||
| 131 | # Development package | ||
| 132 | find usr/include usr/lib/*.a usr/lib/pkgconfig usr/ssl/man/man3 \ | ||
| 133 | -empty -o \! -type d | | ||
| 134 | tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 - | ||
| 135 | |||
| 136 | ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2 | ||
| 137 | ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 | ||
| 138 | |||
| 139 | cleanup | ||
| 140 | |||
| 141 | exit 0 | ||
diff --git a/src/lib/libcrypto/util/deleof.pl b/src/lib/libcrypto/util/deleof.pl new file mode 100644 index 0000000000..155acd88ff --- /dev/null +++ b/src/lib/libcrypto/util/deleof.pl | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | while (<>) | ||
| 4 | { | ||
| 5 | |||
| 6 | last if (/^# DO NOT DELETE THIS LINE/); | ||
| 7 | } | ||
diff --git a/src/lib/libcrypto/util/deltree.com b/src/lib/libcrypto/util/deltree.com new file mode 100644 index 0000000000..9f36b1a5e9 --- /dev/null +++ b/src/lib/libcrypto/util/deltree.com | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | $! DELTREE.COM | ||
| 2 | $ | ||
| 3 | $ call deltree 'p1' | ||
| 4 | $ exit $status | ||
| 5 | $ | ||
| 6 | $ deltree: subroutine ! P1 is a name of a directory | ||
| 7 | $ on control_y then goto dt_STOP | ||
| 8 | $ on warning then goto dt_exit | ||
| 9 | $ _dt_def = f$trnlnm("SYS$DISK")+f$directory() | ||
| 10 | $ if f$parse(p1) .eqs. "" then exit | ||
| 11 | $ set default 'f$parse(p1,,,"DEVICE")''f$parse(p1,,,"DIRECTORY")' | ||
| 12 | $ p1 = f$parse(p1,,,"NAME") + f$parse(p1,,,"TYPE") | ||
| 13 | $ _fp = f$parse(".DIR",p1) | ||
| 14 | $ dt_loop: | ||
| 15 | $ _f = f$search(_fp) | ||
| 16 | $ if _f .eqs. "" then goto dt_loopend | ||
| 17 | $ call deltree [.'f$parse(_f,,,"NAME")']*.* | ||
| 18 | $ goto dt_loop | ||
| 19 | $ dt_loopend: | ||
| 20 | $ _fp = f$parse(p1,".;*") | ||
| 21 | $ if f$search(_fp) .eqs. "" then goto dt_exit | ||
| 22 | $ set noon | ||
| 23 | $ set file/prot=(S:RWED,O:RWED,G:RWED,W:RWED) '_fp' | ||
| 24 | $ set on | ||
| 25 | $ delete/nolog '_fp' | ||
| 26 | $ dt_exit: | ||
| 27 | $ set default '_dt_def' | ||
| 28 | $ goto dt_end | ||
| 29 | $ dt_STOP: | ||
| 30 | $ set default '_dt_def' | ||
| 31 | $ stop/id="" | ||
| 32 | $ exit | ||
| 33 | $ dt_end: | ||
| 34 | $ endsubroutine | ||
diff --git a/src/lib/libcrypto/util/dirname.pl b/src/lib/libcrypto/util/dirname.pl new file mode 100644 index 0000000000..d7a66d96ac --- /dev/null +++ b/src/lib/libcrypto/util/dirname.pl | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | if ($#ARGV < 0) { | ||
| 4 | die "dirname.pl: too few arguments\n"; | ||
| 5 | } elsif ($#ARGV > 0) { | ||
| 6 | die "dirname.pl: too many arguments\n"; | ||
| 7 | } | ||
| 8 | |||
| 9 | my $d = $ARGV[0]; | ||
| 10 | |||
| 11 | if ($d =~ m|.*/.*|) { | ||
| 12 | $d =~ s|/[^/]*$||; | ||
| 13 | } else { | ||
| 14 | $d = "."; | ||
| 15 | } | ||
| 16 | |||
| 17 | print $d,"\n"; | ||
| 18 | exit(0); | ||
diff --git a/src/lib/libcrypto/util/do_ms.sh b/src/lib/libcrypto/util/do_ms.sh new file mode 100644 index 0000000000..515b074cff --- /dev/null +++ b/src/lib/libcrypto/util/do_ms.sh | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # generate the Microsoft makefiles and .def files | ||
| 4 | # | ||
| 5 | |||
| 6 | PATH=util:../util:$PATH | ||
| 7 | |||
| 8 | # perl util/mk1mf.pl no-sock VC-MSDOS >ms/msdos.mak | ||
| 9 | # perl util/mk1mf.pl VC-W31-32 >ms/w31.mak | ||
| 10 | perl util/mk1mf.pl dll VC-WIN16 >ms/w31dll.mak | ||
| 11 | # perl util/mk1mf.pl VC-WIN32 >ms/nt.mak | ||
| 12 | perl util/mk1mf.pl dll VC-WIN32 >ms/ntdll.mak | ||
| 13 | perl util/mk1mf.pl Mingw32 >ms/mingw32.mak | ||
| 14 | perl util/mk1mf.pl Mingw32-files >ms/mingw32f.mak | ||
| 15 | |||
| 16 | perl util/mkdef.pl 16 libeay > ms/libeay16.def | ||
| 17 | perl util/mkdef.pl 32 libeay > ms/libeay32.def | ||
| 18 | perl util/mkdef.pl 16 ssleay > ms/ssleay16.def | ||
| 19 | perl util/mkdef.pl 32 ssleay > ms/ssleay32.def | ||
diff --git a/src/lib/libcrypto/util/domd b/src/lib/libcrypto/util/domd new file mode 100644 index 0000000000..bab48cb7a2 --- /dev/null +++ b/src/lib/libcrypto/util/domd | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Do a makedepend, only leave out the standard headers | ||
| 3 | # Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999 | ||
| 4 | |||
| 5 | TOP=$1 | ||
| 6 | shift | ||
| 7 | if [ "$1" = "-MD" ]; then | ||
| 8 | shift | ||
| 9 | MAKEDEPEND=$1 | ||
| 10 | shift | ||
| 11 | fi | ||
| 12 | if [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi | ||
| 13 | |||
| 14 | cp Makefile Makefile.save | ||
| 15 | # fake the presence of Kerberos | ||
| 16 | touch $TOP/krb5.h | ||
| 17 | if expr "$MAKEDEPEND" : '.*gcc$' > /dev/null; then | ||
| 18 | args="" | ||
| 19 | while [ $# -gt 0 ]; do | ||
| 20 | if [ "$1" != "--" ]; then args="$args $1"; fi | ||
| 21 | shift | ||
| 22 | done | ||
| 23 | sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp | ||
| 24 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp | ||
| 25 | ${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp || exit 1 | ||
| 26 | ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new | ||
| 27 | RC=$? | ||
| 28 | rm -f Makefile.tmp | ||
| 29 | else | ||
| 30 | ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \ | ||
| 31 | ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new | ||
| 32 | RC=$? | ||
| 33 | fi | ||
| 34 | mv Makefile.new Makefile | ||
| 35 | # unfake the presence of Kerberos | ||
| 36 | rm $TOP/krb5.h | ||
| 37 | |||
| 38 | exit $RC | ||
diff --git a/src/lib/libcrypto/util/err-ins.pl b/src/lib/libcrypto/util/err-ins.pl new file mode 100644 index 0000000000..31b70df8d0 --- /dev/null +++ b/src/lib/libcrypto/util/err-ins.pl | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # tack error codes onto the end of a file | ||
| 4 | # | ||
| 5 | |||
| 6 | open(ERR,$ARGV[0]) || die "unable to open error file '$ARGV[0]':$!\n"; | ||
| 7 | @err=<ERR>; | ||
| 8 | close(ERR); | ||
| 9 | |||
| 10 | open(IN,$ARGV[1]) || die "unable to open header file '$ARGV[1]':$!\n"; | ||
| 11 | |||
| 12 | @out=""; | ||
| 13 | while (<IN>) | ||
| 14 | { | ||
| 15 | push(@out,$_); | ||
| 16 | last if /BEGIN ERROR CODES/; | ||
| 17 | } | ||
| 18 | close(IN); | ||
| 19 | |||
| 20 | open(OUT,">$ARGV[1]") || die "unable to open header file '$ARGV[1]':$1\n"; | ||
| 21 | print OUT @out; | ||
| 22 | print OUT @err; | ||
| 23 | print OUT <<"EOF"; | ||
| 24 | |||
| 25 | #ifdef __cplusplus | ||
| 26 | } | ||
| 27 | #endif | ||
| 28 | #endif | ||
| 29 | |||
| 30 | EOF | ||
| 31 | close(OUT); | ||
| 32 | |||
| 33 | |||
diff --git a/src/lib/libcrypto/util/extract-names.pl b/src/lib/libcrypto/util/extract-names.pl new file mode 100644 index 0000000000..35bd6ed843 --- /dev/null +++ b/src/lib/libcrypto/util/extract-names.pl | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | $/ = ""; # Eat a paragraph at once. | ||
| 4 | while(<STDIN>) { | ||
| 5 | chop; | ||
| 6 | s/\n/ /gm; | ||
| 7 | if (/^=head1 /) { | ||
| 8 | $name = 0; | ||
| 9 | } elsif ($name) { | ||
| 10 | if (/ - /) { | ||
| 11 | s/ - .*//; | ||
| 12 | s/,\s+/,/g; | ||
| 13 | s/\s+,/,/g; | ||
| 14 | s/^\s+//g; | ||
| 15 | s/\s+$//g; | ||
| 16 | s/\s/_/g; | ||
| 17 | push @words, split ','; | ||
| 18 | } | ||
| 19 | } | ||
| 20 | if (/^=head1 *NAME *$/) { | ||
| 21 | $name = 1; | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | print join("\n", @words),"\n"; | ||
| 26 | |||
diff --git a/src/lib/libcrypto/util/extract-section.pl b/src/lib/libcrypto/util/extract-section.pl new file mode 100644 index 0000000000..7a0ba4f69a --- /dev/null +++ b/src/lib/libcrypto/util/extract-section.pl | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | while(<STDIN>) { | ||
| 4 | if (/=for\s+comment\s+openssl_manual_section:(\S+)/) | ||
| 5 | { | ||
| 6 | print "$1\n"; | ||
| 7 | exit 0; | ||
| 8 | } | ||
| 9 | } | ||
| 10 | |||
| 11 | print "$ARGV[0]\n"; | ||
| 12 | |||
diff --git a/src/lib/libcrypto/util/files.pl b/src/lib/libcrypto/util/files.pl new file mode 100644 index 0000000000..41f033e3b9 --- /dev/null +++ b/src/lib/libcrypto/util/files.pl | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # used to generate the file MINFO for use by util/mk1mf.pl | ||
| 4 | # It is basically a list of all variables from the passed makefile | ||
| 5 | # | ||
| 6 | |||
| 7 | $s=""; | ||
| 8 | while (<>) | ||
| 9 | { | ||
| 10 | chop; | ||
| 11 | s/#.*//; | ||
| 12 | if (/^(\S+)\s*=\s*(.*)$/) | ||
| 13 | { | ||
| 14 | $o=""; | ||
| 15 | ($s,$b)=($1,$2); | ||
| 16 | for (;;) | ||
| 17 | { | ||
| 18 | if ($b =~ /\\$/) | ||
| 19 | { | ||
| 20 | chop($b); | ||
| 21 | $o.=$b." "; | ||
| 22 | $b=<>; | ||
| 23 | chop($b); | ||
| 24 | } | ||
| 25 | else | ||
| 26 | { | ||
| 27 | $o.=$b." "; | ||
| 28 | last; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | $o =~ s/^\s+//; | ||
| 32 | $o =~ s/\s+$//; | ||
| 33 | $o =~ s/\s+/ /g; | ||
| 34 | |||
| 35 | $o =~ s/\$[({]([^)}]+)[)}]/$sym{$1}/g; | ||
| 36 | $sym{$s}=$o; | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | $pwd=`pwd`; chop($pwd); | ||
| 41 | |||
| 42 | if ($sym{'TOP'} eq ".") | ||
| 43 | { | ||
| 44 | $n=0; | ||
| 45 | $dir="."; | ||
| 46 | } | ||
| 47 | else { | ||
| 48 | $n=split(/\//,$sym{'TOP'}); | ||
| 49 | @_=split(/\//,$pwd); | ||
| 50 | $z=$#_-$n+1; | ||
| 51 | foreach $i ($z .. $#_) { $dir.=$_[$i]."/"; } | ||
| 52 | chop($dir); | ||
| 53 | } | ||
| 54 | |||
| 55 | print "RELATIVE_DIRECTORY=$dir\n"; | ||
| 56 | |||
| 57 | foreach (sort keys %sym) | ||
| 58 | { | ||
| 59 | print "$_=$sym{$_}\n"; | ||
| 60 | } | ||
| 61 | print "RELATIVE_DIRECTORY=\n"; | ||
diff --git a/src/lib/libcrypto/util/fixNT.sh b/src/lib/libcrypto/util/fixNT.sh new file mode 100644 index 0000000000..ab9e766b86 --- /dev/null +++ b/src/lib/libcrypto/util/fixNT.sh | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # clean up the mess that NT makes of my source tree | ||
| 4 | # | ||
| 5 | |||
| 6 | if [ -f makefile -a ! -f Makefile ]; then | ||
| 7 | /bin/mv makefile Makefile | ||
| 8 | fi | ||
| 9 | chmod +x Configure util/* | ||
| 10 | echo cleaning | ||
| 11 | /bin/rm -f `find . -name '*.$$$' -print` 2>/dev/null >/dev/null | ||
| 12 | echo 'removing those damn ^M' | ||
| 13 | perl -pi -e 's/\015//' `find . -type 'f' -print |grep -v '.obj$' |grep -v '.der$' |grep -v '.gz'` | ||
| 14 | make -f Makefile links | ||
diff --git a/src/lib/libcrypto/util/install.sh b/src/lib/libcrypto/util/install.sh new file mode 100644 index 0000000000..e1d0c982df --- /dev/null +++ b/src/lib/libcrypto/util/install.sh | |||
| @@ -0,0 +1,108 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # install - install a program, script, or datafile | ||
| 4 | # This comes from X11R5; it is not part of GNU. | ||
| 5 | # | ||
| 6 | # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ | ||
| 7 | # | ||
| 8 | # This script is compatible with the BSD install script, but was written | ||
| 9 | # from scratch. | ||
| 10 | # | ||
| 11 | |||
| 12 | |||
| 13 | # set DOITPROG to echo to test this script | ||
| 14 | |||
| 15 | doit="${DOITPROG:-}" | ||
| 16 | |||
| 17 | |||
| 18 | # put in absolute paths if you don't have them in your path; or use env. vars. | ||
| 19 | |||
| 20 | mvprog="${MVPROG:-mv}" | ||
| 21 | cpprog="${CPPROG:-cp}" | ||
| 22 | chmodprog="${CHMODPROG:-chmod}" | ||
| 23 | chownprog="${CHOWNPROG:-chown}" | ||
| 24 | chgrpprog="${CHGRPPROG:-chgrp}" | ||
| 25 | stripprog="${STRIPPROG:-strip}" | ||
| 26 | rmprog="${RMPROG:-rm}" | ||
| 27 | |||
| 28 | instcmd="$mvprog" | ||
| 29 | chmodcmd="" | ||
| 30 | chowncmd="" | ||
| 31 | chgrpcmd="" | ||
| 32 | stripcmd="" | ||
| 33 | rmcmd="$rmprog -f" | ||
| 34 | src="" | ||
| 35 | dst="" | ||
| 36 | |||
| 37 | while [ x"$1" != x ]; do | ||
| 38 | case $1 in | ||
| 39 | -c) instcmd="$cpprog" | ||
| 40 | shift | ||
| 41 | continue;; | ||
| 42 | |||
| 43 | -m) chmodcmd="$chmodprog $2" | ||
| 44 | shift | ||
| 45 | shift | ||
| 46 | continue;; | ||
| 47 | |||
| 48 | -o) chowncmd="$chownprog $2" | ||
| 49 | shift | ||
| 50 | shift | ||
| 51 | continue;; | ||
| 52 | |||
| 53 | -g) chgrpcmd="$chgrpprog $2" | ||
| 54 | shift | ||
| 55 | shift | ||
| 56 | continue;; | ||
| 57 | |||
| 58 | -s) stripcmd="$stripprog" | ||
| 59 | shift | ||
| 60 | continue;; | ||
| 61 | |||
| 62 | *) if [ x"$src" = x ] | ||
| 63 | then | ||
| 64 | src=$1 | ||
| 65 | else | ||
| 66 | dst=$1 | ||
| 67 | fi | ||
| 68 | shift | ||
| 69 | continue;; | ||
| 70 | esac | ||
| 71 | done | ||
| 72 | |||
| 73 | if [ x"$src" = x ] | ||
| 74 | then | ||
| 75 | echo "install: no input file specified" | ||
| 76 | exit 1 | ||
| 77 | fi | ||
| 78 | |||
| 79 | if [ x"$dst" = x ] | ||
| 80 | then | ||
| 81 | echo "install: no destination specified" | ||
| 82 | exit 1 | ||
| 83 | fi | ||
| 84 | |||
| 85 | |||
| 86 | # if destination is a directory, append the input filename; if your system | ||
| 87 | # does not like double slashes in filenames, you may need to add some logic | ||
| 88 | |||
| 89 | if [ -d $dst ] | ||
| 90 | then | ||
| 91 | dst="$dst"/`basename $src` | ||
| 92 | fi | ||
| 93 | |||
| 94 | |||
| 95 | # get rid of the old one and mode the new one in | ||
| 96 | |||
| 97 | $doit $rmcmd $dst | ||
| 98 | $doit $instcmd $src $dst | ||
| 99 | |||
| 100 | |||
| 101 | # and set any options; do chmod last to preserve setuid bits | ||
| 102 | |||
| 103 | if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; fi | ||
| 104 | if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; fi | ||
| 105 | if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; fi | ||
| 106 | if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; fi | ||
| 107 | |||
| 108 | exit 0 | ||
diff --git a/src/lib/libcrypto/util/libeay.num b/src/lib/libcrypto/util/libeay.num new file mode 100644 index 0000000000..c68047e955 --- /dev/null +++ b/src/lib/libcrypto/util/libeay.num | |||
| @@ -0,0 +1,4181 @@ | |||
| 1 | SSLeay 1 EXIST::FUNCTION: | ||
| 2 | SSLeay_version 2 EXIST::FUNCTION: | ||
| 3 | ASN1_BIT_STRING_asn1_meth 3 NOEXIST::FUNCTION: | ||
| 4 | ASN1_HEADER_free 4 NOEXIST::FUNCTION: | ||
| 5 | ASN1_HEADER_new 5 NOEXIST::FUNCTION: | ||
| 6 | ASN1_IA5STRING_asn1_meth 6 NOEXIST::FUNCTION: | ||
| 7 | ASN1_INTEGER_get 7 EXIST::FUNCTION: | ||
| 8 | ASN1_INTEGER_set 8 EXIST::FUNCTION: | ||
| 9 | ASN1_INTEGER_to_BN 9 EXIST::FUNCTION: | ||
| 10 | ASN1_OBJECT_create 10 EXIST::FUNCTION: | ||
| 11 | ASN1_OBJECT_free 11 EXIST::FUNCTION: | ||
| 12 | ASN1_OBJECT_new 12 EXIST::FUNCTION: | ||
| 13 | ASN1_PRINTABLE_type 13 EXIST::FUNCTION: | ||
| 14 | ASN1_STRING_cmp 14 EXIST::FUNCTION: | ||
| 15 | ASN1_STRING_dup 15 EXIST::FUNCTION: | ||
| 16 | ASN1_STRING_free 16 EXIST::FUNCTION: | ||
| 17 | ASN1_STRING_new 17 EXIST::FUNCTION: | ||
| 18 | ASN1_STRING_print 18 EXIST::FUNCTION:BIO | ||
| 19 | ASN1_STRING_set 19 EXIST::FUNCTION: | ||
| 20 | ASN1_STRING_type_new 20 EXIST::FUNCTION: | ||
| 21 | ASN1_TYPE_free 21 EXIST::FUNCTION: | ||
| 22 | ASN1_TYPE_new 22 EXIST::FUNCTION: | ||
| 23 | ASN1_UNIVERSALSTRING_to_string 23 EXIST::FUNCTION: | ||
| 24 | ASN1_UTCTIME_check 24 EXIST::FUNCTION: | ||
| 25 | ASN1_UTCTIME_print 25 EXIST::FUNCTION:BIO | ||
| 26 | ASN1_UTCTIME_set 26 EXIST::FUNCTION: | ||
| 27 | ASN1_check_infinite_end 27 EXIST::FUNCTION: | ||
| 28 | ASN1_d2i_bio 28 EXIST::FUNCTION:BIO | ||
| 29 | ASN1_d2i_fp 29 EXIST::FUNCTION:FP_API | ||
| 30 | ASN1_digest 30 EXIST::FUNCTION:EVP | ||
| 31 | ASN1_dup 31 EXIST::FUNCTION: | ||
| 32 | ASN1_get_object 32 EXIST::FUNCTION: | ||
| 33 | ASN1_i2d_bio 33 EXIST::FUNCTION:BIO | ||
| 34 | ASN1_i2d_fp 34 EXIST::FUNCTION:FP_API | ||
| 35 | ASN1_object_size 35 EXIST::FUNCTION: | ||
| 36 | ASN1_parse 36 EXIST::FUNCTION:BIO | ||
| 37 | ASN1_put_object 37 EXIST::FUNCTION: | ||
| 38 | ASN1_sign 38 EXIST::FUNCTION:EVP | ||
| 39 | ASN1_verify 39 EXIST::FUNCTION:EVP | ||
| 40 | BF_cbc_encrypt 40 EXIST::FUNCTION:BF | ||
| 41 | BF_cfb64_encrypt 41 EXIST::FUNCTION:BF | ||
| 42 | BF_ecb_encrypt 42 EXIST::FUNCTION:BF | ||
| 43 | BF_encrypt 43 EXIST::FUNCTION:BF | ||
| 44 | BF_ofb64_encrypt 44 EXIST::FUNCTION:BF | ||
| 45 | BF_options 45 EXIST::FUNCTION:BF | ||
| 46 | BF_set_key 46 EXIST::FUNCTION:BF | ||
| 47 | BIO_CONNECT_free 47 NOEXIST::FUNCTION: | ||
| 48 | BIO_CONNECT_new 48 NOEXIST::FUNCTION: | ||
| 49 | BIO_accept 51 EXIST::FUNCTION: | ||
| 50 | BIO_ctrl 52 EXIST::FUNCTION: | ||
| 51 | BIO_int_ctrl 53 EXIST::FUNCTION: | ||
| 52 | BIO_debug_callback 54 EXIST::FUNCTION: | ||
| 53 | BIO_dump 55 EXIST::FUNCTION: | ||
| 54 | BIO_dup_chain 56 EXIST::FUNCTION: | ||
| 55 | BIO_f_base64 57 EXIST::FUNCTION:BIO | ||
| 56 | BIO_f_buffer 58 EXIST::FUNCTION: | ||
| 57 | BIO_f_cipher 59 EXIST::FUNCTION:BIO | ||
| 58 | BIO_f_md 60 EXIST::FUNCTION:BIO | ||
| 59 | BIO_f_null 61 EXIST::FUNCTION: | ||
| 60 | BIO_f_proxy_server 62 NOEXIST::FUNCTION: | ||
| 61 | BIO_fd_non_fatal_error 63 EXIST::FUNCTION: | ||
| 62 | BIO_fd_should_retry 64 EXIST::FUNCTION: | ||
| 63 | BIO_find_type 65 EXIST::FUNCTION: | ||
| 64 | BIO_free 66 EXIST::FUNCTION: | ||
| 65 | BIO_free_all 67 EXIST::FUNCTION: | ||
| 66 | BIO_get_accept_socket 69 EXIST::FUNCTION: | ||
| 67 | BIO_get_filter_bio 70 NOEXIST::FUNCTION: | ||
| 68 | BIO_get_host_ip 71 EXIST::FUNCTION: | ||
| 69 | BIO_get_port 72 EXIST::FUNCTION: | ||
| 70 | BIO_get_retry_BIO 73 EXIST::FUNCTION: | ||
| 71 | BIO_get_retry_reason 74 EXIST::FUNCTION: | ||
| 72 | BIO_gethostbyname 75 EXIST::FUNCTION: | ||
| 73 | BIO_gets 76 EXIST::FUNCTION: | ||
| 74 | BIO_new 78 EXIST::FUNCTION: | ||
| 75 | BIO_new_accept 79 EXIST::FUNCTION: | ||
| 76 | BIO_new_connect 80 EXIST::FUNCTION: | ||
| 77 | BIO_new_fd 81 EXIST::FUNCTION: | ||
| 78 | BIO_new_file 82 EXIST::FUNCTION:FP_API | ||
| 79 | BIO_new_fp 83 EXIST::FUNCTION:FP_API | ||
| 80 | BIO_new_socket 84 EXIST::FUNCTION: | ||
| 81 | BIO_pop 85 EXIST::FUNCTION: | ||
| 82 | BIO_printf 86 EXIST::FUNCTION: | ||
| 83 | BIO_push 87 EXIST::FUNCTION: | ||
| 84 | BIO_puts 88 EXIST::FUNCTION: | ||
| 85 | BIO_read 89 EXIST::FUNCTION: | ||
| 86 | BIO_s_accept 90 EXIST::FUNCTION: | ||
| 87 | BIO_s_connect 91 EXIST::FUNCTION: | ||
| 88 | BIO_s_fd 92 EXIST::FUNCTION: | ||
| 89 | BIO_s_file 93 EXIST::FUNCTION:FP_API | ||
| 90 | BIO_s_mem 95 EXIST::FUNCTION: | ||
| 91 | BIO_s_null 96 EXIST::FUNCTION: | ||
| 92 | BIO_s_proxy_client 97 NOEXIST::FUNCTION: | ||
| 93 | BIO_s_socket 98 EXIST::FUNCTION: | ||
| 94 | BIO_set 100 EXIST::FUNCTION: | ||
| 95 | BIO_set_cipher 101 EXIST::FUNCTION:BIO | ||
| 96 | BIO_set_tcp_ndelay 102 EXIST::FUNCTION: | ||
| 97 | BIO_sock_cleanup 103 EXIST::FUNCTION: | ||
| 98 | BIO_sock_error 104 EXIST::FUNCTION: | ||
| 99 | BIO_sock_init 105 EXIST::FUNCTION: | ||
| 100 | BIO_sock_non_fatal_error 106 EXIST::FUNCTION: | ||
| 101 | BIO_sock_should_retry 107 EXIST::FUNCTION: | ||
| 102 | BIO_socket_ioctl 108 EXIST::FUNCTION: | ||
| 103 | BIO_write 109 EXIST::FUNCTION: | ||
| 104 | BN_CTX_free 110 EXIST::FUNCTION: | ||
| 105 | BN_CTX_new 111 EXIST::FUNCTION: | ||
| 106 | BN_MONT_CTX_free 112 EXIST::FUNCTION: | ||
| 107 | BN_MONT_CTX_new 113 EXIST::FUNCTION: | ||
| 108 | BN_MONT_CTX_set 114 EXIST::FUNCTION: | ||
| 109 | BN_add 115 EXIST::FUNCTION: | ||
| 110 | BN_add_word 116 EXIST::FUNCTION: | ||
| 111 | BN_hex2bn 117 EXIST::FUNCTION: | ||
| 112 | BN_bin2bn 118 EXIST::FUNCTION: | ||
| 113 | BN_bn2hex 119 EXIST::FUNCTION: | ||
| 114 | BN_bn2bin 120 EXIST::FUNCTION: | ||
| 115 | BN_clear 121 EXIST::FUNCTION: | ||
| 116 | BN_clear_bit 122 EXIST::FUNCTION: | ||
| 117 | BN_clear_free 123 EXIST::FUNCTION: | ||
| 118 | BN_cmp 124 EXIST::FUNCTION: | ||
| 119 | BN_copy 125 EXIST::FUNCTION: | ||
| 120 | BN_div 126 EXIST::FUNCTION: | ||
| 121 | BN_div_word 127 EXIST::FUNCTION: | ||
| 122 | BN_dup 128 EXIST::FUNCTION: | ||
| 123 | BN_free 129 EXIST::FUNCTION: | ||
| 124 | BN_from_montgomery 130 EXIST::FUNCTION: | ||
| 125 | BN_gcd 131 EXIST::FUNCTION: | ||
| 126 | BN_generate_prime 132 EXIST::FUNCTION:DEPRECATED | ||
| 127 | BN_get_word 133 EXIST::FUNCTION: | ||
| 128 | BN_is_bit_set 134 EXIST::FUNCTION: | ||
| 129 | BN_is_prime 135 EXIST::FUNCTION:DEPRECATED | ||
| 130 | BN_lshift 136 EXIST::FUNCTION: | ||
| 131 | BN_lshift1 137 EXIST::FUNCTION: | ||
| 132 | BN_mask_bits 138 EXIST::FUNCTION: | ||
| 133 | BN_mod 139 NOEXIST::FUNCTION: | ||
| 134 | BN_mod_exp 140 EXIST::FUNCTION: | ||
| 135 | BN_mod_exp_mont 141 EXIST::FUNCTION: | ||
| 136 | BN_mod_exp_simple 143 EXIST::FUNCTION: | ||
| 137 | BN_mod_inverse 144 EXIST::FUNCTION: | ||
| 138 | BN_mod_mul 145 EXIST::FUNCTION: | ||
| 139 | BN_mod_mul_montgomery 146 EXIST::FUNCTION: | ||
| 140 | BN_mod_word 148 EXIST::FUNCTION: | ||
| 141 | BN_mul 149 EXIST::FUNCTION: | ||
| 142 | BN_new 150 EXIST::FUNCTION: | ||
| 143 | BN_num_bits 151 EXIST::FUNCTION: | ||
| 144 | BN_num_bits_word 152 EXIST::FUNCTION: | ||
| 145 | BN_options 153 EXIST::FUNCTION: | ||
| 146 | BN_print 154 EXIST::FUNCTION: | ||
| 147 | BN_print_fp 155 EXIST::FUNCTION:FP_API | ||
| 148 | BN_rand 156 EXIST::FUNCTION: | ||
| 149 | BN_reciprocal 157 EXIST::FUNCTION: | ||
| 150 | BN_rshift 158 EXIST::FUNCTION: | ||
| 151 | BN_rshift1 159 EXIST::FUNCTION: | ||
| 152 | BN_set_bit 160 EXIST::FUNCTION: | ||
| 153 | BN_set_word 161 EXIST::FUNCTION: | ||
| 154 | BN_sqr 162 EXIST::FUNCTION: | ||
| 155 | BN_sub 163 EXIST::FUNCTION: | ||
| 156 | BN_to_ASN1_INTEGER 164 EXIST::FUNCTION: | ||
| 157 | BN_ucmp 165 EXIST::FUNCTION: | ||
| 158 | BN_value_one 166 EXIST::FUNCTION: | ||
| 159 | BUF_MEM_free 167 EXIST::FUNCTION: | ||
| 160 | BUF_MEM_grow 168 EXIST::FUNCTION: | ||
| 161 | BUF_MEM_new 169 EXIST::FUNCTION: | ||
| 162 | BUF_strdup 170 EXIST::FUNCTION: | ||
| 163 | CONF_free 171 EXIST::FUNCTION: | ||
| 164 | CONF_get_number 172 EXIST::FUNCTION: | ||
| 165 | CONF_get_section 173 EXIST::FUNCTION: | ||
| 166 | CONF_get_string 174 EXIST::FUNCTION: | ||
| 167 | CONF_load 175 EXIST::FUNCTION: | ||
| 168 | CRYPTO_add_lock 176 EXIST::FUNCTION: | ||
| 169 | CRYPTO_dbg_free 177 EXIST::FUNCTION: | ||
| 170 | CRYPTO_dbg_malloc 178 EXIST::FUNCTION: | ||
| 171 | CRYPTO_dbg_realloc 179 EXIST::FUNCTION: | ||
| 172 | CRYPTO_dbg_remalloc 180 NOEXIST::FUNCTION: | ||
| 173 | CRYPTO_free 181 EXIST::FUNCTION: | ||
| 174 | CRYPTO_get_add_lock_callback 182 EXIST::FUNCTION: | ||
| 175 | CRYPTO_get_id_callback 183 EXIST::FUNCTION:DEPRECATED | ||
| 176 | CRYPTO_get_lock_name 184 EXIST::FUNCTION: | ||
| 177 | CRYPTO_get_locking_callback 185 EXIST::FUNCTION: | ||
| 178 | CRYPTO_get_mem_functions 186 EXIST::FUNCTION: | ||
| 179 | CRYPTO_lock 187 EXIST::FUNCTION: | ||
| 180 | CRYPTO_malloc 188 EXIST::FUNCTION: | ||
| 181 | CRYPTO_mem_ctrl 189 EXIST::FUNCTION: | ||
| 182 | CRYPTO_mem_leaks 190 EXIST::FUNCTION: | ||
| 183 | CRYPTO_mem_leaks_cb 191 EXIST::FUNCTION: | ||
| 184 | CRYPTO_mem_leaks_fp 192 EXIST::FUNCTION:FP_API | ||
| 185 | CRYPTO_realloc 193 EXIST::FUNCTION: | ||
| 186 | CRYPTO_remalloc 194 EXIST::FUNCTION: | ||
| 187 | CRYPTO_set_add_lock_callback 195 EXIST::FUNCTION: | ||
| 188 | CRYPTO_set_id_callback 196 EXIST::FUNCTION:DEPRECATED | ||
| 189 | CRYPTO_set_locking_callback 197 EXIST::FUNCTION: | ||
| 190 | CRYPTO_set_mem_functions 198 EXIST::FUNCTION: | ||
| 191 | CRYPTO_thread_id 199 EXIST::FUNCTION:DEPRECATED | ||
| 192 | DH_check 200 EXIST::FUNCTION:DH | ||
| 193 | DH_compute_key 201 EXIST::FUNCTION:DH | ||
| 194 | DH_free 202 EXIST::FUNCTION:DH | ||
| 195 | DH_generate_key 203 EXIST::FUNCTION:DH | ||
| 196 | DH_generate_parameters 204 EXIST::FUNCTION:DEPRECATED,DH | ||
| 197 | DH_new 205 EXIST::FUNCTION:DH | ||
| 198 | DH_size 206 EXIST::FUNCTION:DH | ||
| 199 | DHparams_print 207 EXIST::FUNCTION:BIO,DH | ||
| 200 | DHparams_print_fp 208 EXIST::FUNCTION:DH,FP_API | ||
| 201 | DSA_free 209 EXIST::FUNCTION:DSA | ||
| 202 | DSA_generate_key 210 EXIST::FUNCTION:DSA | ||
| 203 | DSA_generate_parameters 211 EXIST::FUNCTION:DEPRECATED,DSA | ||
| 204 | DSA_is_prime 212 NOEXIST::FUNCTION: | ||
| 205 | DSA_new 213 EXIST::FUNCTION:DSA | ||
| 206 | DSA_print 214 EXIST::FUNCTION:BIO,DSA | ||
| 207 | DSA_print_fp 215 EXIST::FUNCTION:DSA,FP_API | ||
| 208 | DSA_sign 216 EXIST::FUNCTION:DSA | ||
| 209 | DSA_sign_setup 217 EXIST::FUNCTION:DSA | ||
| 210 | DSA_size 218 EXIST::FUNCTION:DSA | ||
| 211 | DSA_verify 219 EXIST::FUNCTION:DSA | ||
| 212 | DSAparams_print 220 EXIST::FUNCTION:BIO,DSA | ||
| 213 | DSAparams_print_fp 221 EXIST::FUNCTION:DSA,FP_API | ||
| 214 | ERR_clear_error 222 EXIST::FUNCTION: | ||
| 215 | ERR_error_string 223 EXIST::FUNCTION: | ||
| 216 | ERR_free_strings 224 EXIST::FUNCTION: | ||
| 217 | ERR_func_error_string 225 EXIST::FUNCTION: | ||
| 218 | ERR_get_err_state_table 226 EXIST::FUNCTION:LHASH | ||
| 219 | ERR_get_error 227 EXIST::FUNCTION: | ||
| 220 | ERR_get_error_line 228 EXIST::FUNCTION: | ||
| 221 | ERR_get_state 229 EXIST::FUNCTION: | ||
| 222 | ERR_get_string_table 230 EXIST::FUNCTION:LHASH | ||
| 223 | ERR_lib_error_string 231 EXIST::FUNCTION: | ||
| 224 | ERR_load_ASN1_strings 232 EXIST::FUNCTION: | ||
| 225 | ERR_load_BIO_strings 233 EXIST::FUNCTION: | ||
| 226 | ERR_load_BN_strings 234 EXIST::FUNCTION: | ||
| 227 | ERR_load_BUF_strings 235 EXIST::FUNCTION: | ||
| 228 | ERR_load_CONF_strings 236 EXIST::FUNCTION: | ||
| 229 | ERR_load_DH_strings 237 EXIST::FUNCTION:DH | ||
| 230 | ERR_load_DSA_strings 238 EXIST::FUNCTION:DSA | ||
| 231 | ERR_load_ERR_strings 239 EXIST::FUNCTION: | ||
| 232 | ERR_load_EVP_strings 240 EXIST::FUNCTION: | ||
| 233 | ERR_load_OBJ_strings 241 EXIST::FUNCTION: | ||
| 234 | ERR_load_PEM_strings 242 EXIST::FUNCTION: | ||
| 235 | ERR_load_PROXY_strings 243 NOEXIST::FUNCTION: | ||
| 236 | ERR_load_RSA_strings 244 EXIST::FUNCTION:RSA | ||
| 237 | ERR_load_X509_strings 245 EXIST::FUNCTION: | ||
| 238 | ERR_load_crypto_strings 246 EXIST::FUNCTION: | ||
| 239 | ERR_load_strings 247 EXIST::FUNCTION: | ||
| 240 | ERR_peek_error 248 EXIST::FUNCTION: | ||
| 241 | ERR_peek_error_line 249 EXIST::FUNCTION: | ||
| 242 | ERR_print_errors 250 EXIST::FUNCTION:BIO | ||
| 243 | ERR_print_errors_fp 251 EXIST::FUNCTION:FP_API | ||
| 244 | ERR_put_error 252 EXIST::FUNCTION: | ||
| 245 | ERR_reason_error_string 253 EXIST::FUNCTION: | ||
| 246 | ERR_remove_state 254 EXIST::FUNCTION:DEPRECATED | ||
| 247 | EVP_BytesToKey 255 EXIST::FUNCTION: | ||
| 248 | EVP_CIPHER_CTX_cleanup 256 EXIST::FUNCTION: | ||
| 249 | EVP_CipherFinal 257 EXIST::FUNCTION: | ||
| 250 | EVP_CipherInit 258 EXIST::FUNCTION: | ||
| 251 | EVP_CipherUpdate 259 EXIST::FUNCTION: | ||
| 252 | EVP_DecodeBlock 260 EXIST::FUNCTION: | ||
| 253 | EVP_DecodeFinal 261 EXIST::FUNCTION: | ||
| 254 | EVP_DecodeInit 262 EXIST::FUNCTION: | ||
| 255 | EVP_DecodeUpdate 263 EXIST::FUNCTION: | ||
| 256 | EVP_DecryptFinal 264 EXIST::FUNCTION: | ||
| 257 | EVP_DecryptInit 265 EXIST::FUNCTION: | ||
| 258 | EVP_DecryptUpdate 266 EXIST::FUNCTION: | ||
| 259 | EVP_DigestFinal 267 EXIST::FUNCTION: | ||
| 260 | EVP_DigestInit 268 EXIST::FUNCTION: | ||
| 261 | EVP_DigestUpdate 269 EXIST::FUNCTION: | ||
| 262 | EVP_EncodeBlock 270 EXIST::FUNCTION: | ||
| 263 | EVP_EncodeFinal 271 EXIST::FUNCTION: | ||
| 264 | EVP_EncodeInit 272 EXIST::FUNCTION: | ||
| 265 | EVP_EncodeUpdate 273 EXIST::FUNCTION: | ||
| 266 | EVP_EncryptFinal 274 EXIST::FUNCTION: | ||
| 267 | EVP_EncryptInit 275 EXIST::FUNCTION: | ||
| 268 | EVP_EncryptUpdate 276 EXIST::FUNCTION: | ||
| 269 | EVP_OpenFinal 277 EXIST::FUNCTION:RSA | ||
| 270 | EVP_OpenInit 278 EXIST::FUNCTION:RSA | ||
| 271 | EVP_PKEY_assign 279 EXIST::FUNCTION: | ||
| 272 | EVP_PKEY_copy_parameters 280 EXIST::FUNCTION: | ||
| 273 | EVP_PKEY_free 281 EXIST::FUNCTION: | ||
| 274 | EVP_PKEY_missing_parameters 282 EXIST::FUNCTION: | ||
| 275 | EVP_PKEY_new 283 EXIST::FUNCTION: | ||
| 276 | EVP_PKEY_save_parameters 284 EXIST::FUNCTION: | ||
| 277 | EVP_PKEY_size 285 EXIST::FUNCTION: | ||
| 278 | EVP_PKEY_type 286 EXIST::FUNCTION: | ||
| 279 | EVP_SealFinal 287 EXIST::FUNCTION:RSA | ||
| 280 | EVP_SealInit 288 EXIST::FUNCTION:RSA | ||
| 281 | EVP_SignFinal 289 EXIST::FUNCTION: | ||
| 282 | EVP_VerifyFinal 290 EXIST::FUNCTION: | ||
| 283 | EVP_add_alias 291 NOEXIST::FUNCTION: | ||
| 284 | EVP_add_cipher 292 EXIST::FUNCTION: | ||
| 285 | EVP_add_digest 293 EXIST::FUNCTION: | ||
| 286 | EVP_bf_cbc 294 EXIST::FUNCTION:BF | ||
| 287 | EVP_bf_cfb64 295 EXIST::FUNCTION:BF | ||
| 288 | EVP_bf_ecb 296 EXIST::FUNCTION:BF | ||
| 289 | EVP_bf_ofb 297 EXIST::FUNCTION:BF | ||
| 290 | EVP_cleanup 298 EXIST::FUNCTION: | ||
| 291 | EVP_des_cbc 299 EXIST::FUNCTION:DES | ||
| 292 | EVP_des_cfb64 300 EXIST::FUNCTION:DES | ||
| 293 | EVP_des_ecb 301 EXIST::FUNCTION:DES | ||
| 294 | EVP_des_ede 302 EXIST::FUNCTION:DES | ||
| 295 | EVP_des_ede3 303 EXIST::FUNCTION:DES | ||
| 296 | EVP_des_ede3_cbc 304 EXIST::FUNCTION:DES | ||
| 297 | EVP_des_ede3_cfb64 305 EXIST::FUNCTION:DES | ||
| 298 | EVP_des_ede3_ofb 306 EXIST::FUNCTION:DES | ||
| 299 | EVP_des_ede_cbc 307 EXIST::FUNCTION:DES | ||
| 300 | EVP_des_ede_cfb64 308 EXIST::FUNCTION:DES | ||
| 301 | EVP_des_ede_ofb 309 EXIST::FUNCTION:DES | ||
| 302 | EVP_des_ofb 310 EXIST::FUNCTION:DES | ||
| 303 | EVP_desx_cbc 311 EXIST::FUNCTION:DES | ||
| 304 | EVP_dss 312 EXIST::FUNCTION:DSA,SHA | ||
| 305 | EVP_dss1 313 EXIST::FUNCTION:DSA,SHA | ||
| 306 | EVP_enc_null 314 EXIST::FUNCTION: | ||
| 307 | EVP_get_cipherbyname 315 EXIST::FUNCTION: | ||
| 308 | EVP_get_digestbyname 316 EXIST::FUNCTION: | ||
| 309 | EVP_get_pw_prompt 317 EXIST::FUNCTION: | ||
| 310 | EVP_idea_cbc 318 EXIST::FUNCTION:IDEA | ||
| 311 | EVP_idea_cfb64 319 EXIST::FUNCTION:IDEA | ||
| 312 | EVP_idea_ecb 320 EXIST::FUNCTION:IDEA | ||
| 313 | EVP_idea_ofb 321 EXIST::FUNCTION:IDEA | ||
| 314 | EVP_md2 322 EXIST::FUNCTION:MD2 | ||
| 315 | EVP_md5 323 EXIST::FUNCTION:MD5 | ||
| 316 | EVP_md_null 324 EXIST::FUNCTION: | ||
| 317 | EVP_rc2_cbc 325 EXIST::FUNCTION:RC2 | ||
| 318 | EVP_rc2_cfb64 326 EXIST::FUNCTION:RC2 | ||
| 319 | EVP_rc2_ecb 327 EXIST::FUNCTION:RC2 | ||
| 320 | EVP_rc2_ofb 328 EXIST::FUNCTION:RC2 | ||
| 321 | EVP_rc4 329 EXIST::FUNCTION:RC4 | ||
| 322 | EVP_read_pw_string 330 EXIST::FUNCTION: | ||
| 323 | EVP_set_pw_prompt 331 EXIST::FUNCTION: | ||
| 324 | EVP_sha 332 EXIST::FUNCTION:SHA | ||
| 325 | EVP_sha1 333 EXIST::FUNCTION:SHA | ||
| 326 | MD2 334 EXIST::FUNCTION:MD2 | ||
| 327 | MD2_Final 335 EXIST::FUNCTION:MD2 | ||
| 328 | MD2_Init 336 EXIST::FUNCTION:MD2 | ||
| 329 | MD2_Update 337 EXIST::FUNCTION:MD2 | ||
| 330 | MD2_options 338 EXIST::FUNCTION:MD2 | ||
| 331 | MD5 339 EXIST::FUNCTION:MD5 | ||
| 332 | MD5_Final 340 EXIST::FUNCTION:MD5 | ||
| 333 | MD5_Init 341 EXIST::FUNCTION:MD5 | ||
| 334 | MD5_Update 342 EXIST::FUNCTION:MD5 | ||
| 335 | MDC2 343 EXIST::FUNCTION:MDC2 | ||
| 336 | MDC2_Final 344 EXIST::FUNCTION:MDC2 | ||
| 337 | MDC2_Init 345 EXIST::FUNCTION:MDC2 | ||
| 338 | MDC2_Update 346 EXIST::FUNCTION:MDC2 | ||
| 339 | NETSCAPE_SPKAC_free 347 EXIST::FUNCTION: | ||
| 340 | NETSCAPE_SPKAC_new 348 EXIST::FUNCTION: | ||
| 341 | NETSCAPE_SPKI_free 349 EXIST::FUNCTION: | ||
| 342 | NETSCAPE_SPKI_new 350 EXIST::FUNCTION: | ||
| 343 | NETSCAPE_SPKI_sign 351 EXIST::FUNCTION:EVP | ||
| 344 | NETSCAPE_SPKI_verify 352 EXIST::FUNCTION:EVP | ||
| 345 | OBJ_add_object 353 EXIST::FUNCTION: | ||
| 346 | OBJ_bsearch 354 NOEXIST::FUNCTION: | ||
| 347 | OBJ_cleanup 355 EXIST::FUNCTION: | ||
| 348 | OBJ_cmp 356 EXIST::FUNCTION: | ||
| 349 | OBJ_create 357 EXIST::FUNCTION: | ||
| 350 | OBJ_dup 358 EXIST::FUNCTION: | ||
| 351 | OBJ_ln2nid 359 EXIST::FUNCTION: | ||
| 352 | OBJ_new_nid 360 EXIST::FUNCTION: | ||
| 353 | OBJ_nid2ln 361 EXIST::FUNCTION: | ||
| 354 | OBJ_nid2obj 362 EXIST::FUNCTION: | ||
| 355 | OBJ_nid2sn 363 EXIST::FUNCTION: | ||
| 356 | OBJ_obj2nid 364 EXIST::FUNCTION: | ||
| 357 | OBJ_sn2nid 365 EXIST::FUNCTION: | ||
| 358 | OBJ_txt2nid 366 EXIST::FUNCTION: | ||
| 359 | PEM_ASN1_read 367 EXIST::FUNCTION: | ||
| 360 | PEM_ASN1_read_bio 368 EXIST::FUNCTION:BIO | ||
| 361 | PEM_ASN1_write 369 EXIST::FUNCTION: | ||
| 362 | PEM_ASN1_write_bio 370 EXIST::FUNCTION:BIO | ||
| 363 | PEM_SealFinal 371 EXIST::FUNCTION:RSA | ||
| 364 | PEM_SealInit 372 EXIST::FUNCTION:RSA | ||
| 365 | PEM_SealUpdate 373 EXIST::FUNCTION:RSA | ||
| 366 | PEM_SignFinal 374 EXIST::FUNCTION: | ||
| 367 | PEM_SignInit 375 EXIST::FUNCTION: | ||
| 368 | PEM_SignUpdate 376 EXIST::FUNCTION: | ||
| 369 | PEM_X509_INFO_read 377 EXIST::FUNCTION: | ||
| 370 | PEM_X509_INFO_read_bio 378 EXIST::FUNCTION:BIO | ||
| 371 | PEM_X509_INFO_write_bio 379 EXIST::FUNCTION:BIO | ||
| 372 | PEM_dek_info 380 EXIST::FUNCTION: | ||
| 373 | PEM_do_header 381 EXIST::FUNCTION: | ||
| 374 | PEM_get_EVP_CIPHER_INFO 382 EXIST::FUNCTION: | ||
| 375 | PEM_proc_type 383 EXIST::FUNCTION: | ||
| 376 | PEM_read 384 EXIST::FUNCTION: | ||
| 377 | PEM_read_DHparams 385 EXIST:!WIN16:FUNCTION:DH | ||
| 378 | PEM_read_DSAPrivateKey 386 EXIST:!WIN16:FUNCTION:DSA | ||
| 379 | PEM_read_DSAparams 387 EXIST:!WIN16:FUNCTION:DSA | ||
| 380 | PEM_read_PKCS7 388 EXIST:!WIN16:FUNCTION: | ||
| 381 | PEM_read_PrivateKey 389 EXIST:!WIN16:FUNCTION: | ||
| 382 | PEM_read_RSAPrivateKey 390 EXIST:!WIN16:FUNCTION:RSA | ||
| 383 | PEM_read_X509 391 EXIST:!WIN16:FUNCTION: | ||
| 384 | PEM_read_X509_CRL 392 EXIST:!WIN16:FUNCTION: | ||
| 385 | PEM_read_X509_REQ 393 EXIST:!WIN16:FUNCTION: | ||
| 386 | PEM_read_bio 394 EXIST::FUNCTION:BIO | ||
| 387 | PEM_read_bio_DHparams 395 EXIST::FUNCTION:DH | ||
| 388 | PEM_read_bio_DSAPrivateKey 396 EXIST::FUNCTION:DSA | ||
| 389 | PEM_read_bio_DSAparams 397 EXIST::FUNCTION:DSA | ||
| 390 | PEM_read_bio_PKCS7 398 EXIST::FUNCTION: | ||
| 391 | PEM_read_bio_PrivateKey 399 EXIST::FUNCTION: | ||
| 392 | PEM_read_bio_RSAPrivateKey 400 EXIST::FUNCTION:RSA | ||
| 393 | PEM_read_bio_X509 401 EXIST::FUNCTION: | ||
| 394 | PEM_read_bio_X509_CRL 402 EXIST::FUNCTION: | ||
| 395 | PEM_read_bio_X509_REQ 403 EXIST::FUNCTION: | ||
| 396 | PEM_write 404 EXIST::FUNCTION: | ||
| 397 | PEM_write_DHparams 405 EXIST:!WIN16:FUNCTION:DH | ||
| 398 | PEM_write_DSAPrivateKey 406 EXIST:!WIN16:FUNCTION:DSA | ||
| 399 | PEM_write_DSAparams 407 EXIST:!WIN16:FUNCTION:DSA | ||
| 400 | PEM_write_PKCS7 408 EXIST:!WIN16:FUNCTION: | ||
| 401 | PEM_write_PrivateKey 409 EXIST:!WIN16:FUNCTION: | ||
| 402 | PEM_write_RSAPrivateKey 410 EXIST:!WIN16:FUNCTION:RSA | ||
| 403 | PEM_write_X509 411 EXIST:!WIN16:FUNCTION: | ||
| 404 | PEM_write_X509_CRL 412 EXIST:!WIN16:FUNCTION: | ||
| 405 | PEM_write_X509_REQ 413 EXIST:!WIN16:FUNCTION: | ||
| 406 | PEM_write_bio 414 EXIST::FUNCTION:BIO | ||
| 407 | PEM_write_bio_DHparams 415 EXIST::FUNCTION:DH | ||
| 408 | PEM_write_bio_DSAPrivateKey 416 EXIST::FUNCTION:DSA | ||
| 409 | PEM_write_bio_DSAparams 417 EXIST::FUNCTION:DSA | ||
| 410 | PEM_write_bio_PKCS7 418 EXIST::FUNCTION: | ||
| 411 | PEM_write_bio_PrivateKey 419 EXIST::FUNCTION: | ||
| 412 | PEM_write_bio_RSAPrivateKey 420 EXIST::FUNCTION:RSA | ||
| 413 | PEM_write_bio_X509 421 EXIST::FUNCTION: | ||
| 414 | PEM_write_bio_X509_CRL 422 EXIST::FUNCTION: | ||
| 415 | PEM_write_bio_X509_REQ 423 EXIST::FUNCTION: | ||
| 416 | PKCS7_DIGEST_free 424 EXIST::FUNCTION: | ||
| 417 | PKCS7_DIGEST_new 425 EXIST::FUNCTION: | ||
| 418 | PKCS7_ENCRYPT_free 426 EXIST::FUNCTION: | ||
| 419 | PKCS7_ENCRYPT_new 427 EXIST::FUNCTION: | ||
| 420 | PKCS7_ENC_CONTENT_free 428 EXIST::FUNCTION: | ||
| 421 | PKCS7_ENC_CONTENT_new 429 EXIST::FUNCTION: | ||
| 422 | PKCS7_ENVELOPE_free 430 EXIST::FUNCTION: | ||
| 423 | PKCS7_ENVELOPE_new 431 EXIST::FUNCTION: | ||
| 424 | PKCS7_ISSUER_AND_SERIAL_digest 432 EXIST::FUNCTION: | ||
| 425 | PKCS7_ISSUER_AND_SERIAL_free 433 EXIST::FUNCTION: | ||
| 426 | PKCS7_ISSUER_AND_SERIAL_new 434 EXIST::FUNCTION: | ||
| 427 | PKCS7_RECIP_INFO_free 435 EXIST::FUNCTION: | ||
| 428 | PKCS7_RECIP_INFO_new 436 EXIST::FUNCTION: | ||
| 429 | PKCS7_SIGNED_free 437 EXIST::FUNCTION: | ||
| 430 | PKCS7_SIGNED_new 438 EXIST::FUNCTION: | ||
| 431 | PKCS7_SIGNER_INFO_free 439 EXIST::FUNCTION: | ||
| 432 | PKCS7_SIGNER_INFO_new 440 EXIST::FUNCTION: | ||
| 433 | PKCS7_SIGN_ENVELOPE_free 441 EXIST::FUNCTION: | ||
| 434 | PKCS7_SIGN_ENVELOPE_new 442 EXIST::FUNCTION: | ||
| 435 | PKCS7_dup 443 EXIST::FUNCTION: | ||
| 436 | PKCS7_free 444 EXIST::FUNCTION: | ||
| 437 | PKCS7_new 445 EXIST::FUNCTION: | ||
| 438 | PROXY_ENTRY_add_noproxy 446 NOEXIST::FUNCTION: | ||
| 439 | PROXY_ENTRY_clear_noproxy 447 NOEXIST::FUNCTION: | ||
| 440 | PROXY_ENTRY_free 448 NOEXIST::FUNCTION: | ||
| 441 | PROXY_ENTRY_get_noproxy 449 NOEXIST::FUNCTION: | ||
| 442 | PROXY_ENTRY_new 450 NOEXIST::FUNCTION: | ||
| 443 | PROXY_ENTRY_set_server 451 NOEXIST::FUNCTION: | ||
| 444 | PROXY_add_noproxy 452 NOEXIST::FUNCTION: | ||
| 445 | PROXY_add_server 453 NOEXIST::FUNCTION: | ||
| 446 | PROXY_check_by_host 454 NOEXIST::FUNCTION: | ||
| 447 | PROXY_check_url 455 NOEXIST::FUNCTION: | ||
| 448 | PROXY_clear_noproxy 456 NOEXIST::FUNCTION: | ||
| 449 | PROXY_free 457 NOEXIST::FUNCTION: | ||
| 450 | PROXY_get_noproxy 458 NOEXIST::FUNCTION: | ||
| 451 | PROXY_get_proxies 459 NOEXIST::FUNCTION: | ||
| 452 | PROXY_get_proxy_entry 460 NOEXIST::FUNCTION: | ||
| 453 | PROXY_load_conf 461 NOEXIST::FUNCTION: | ||
| 454 | PROXY_new 462 NOEXIST::FUNCTION: | ||
| 455 | PROXY_print 463 NOEXIST::FUNCTION: | ||
| 456 | RAND_bytes 464 EXIST::FUNCTION: | ||
| 457 | RAND_cleanup 465 EXIST::FUNCTION: | ||
| 458 | RAND_file_name 466 EXIST::FUNCTION: | ||
| 459 | RAND_load_file 467 EXIST::FUNCTION: | ||
| 460 | RAND_screen 468 EXIST:WIN32:FUNCTION: | ||
| 461 | RAND_seed 469 EXIST::FUNCTION: | ||
| 462 | RAND_write_file 470 EXIST::FUNCTION: | ||
| 463 | RC2_cbc_encrypt 471 EXIST::FUNCTION:RC2 | ||
| 464 | RC2_cfb64_encrypt 472 EXIST::FUNCTION:RC2 | ||
| 465 | RC2_ecb_encrypt 473 EXIST::FUNCTION:RC2 | ||
| 466 | RC2_encrypt 474 EXIST::FUNCTION:RC2 | ||
| 467 | RC2_ofb64_encrypt 475 EXIST::FUNCTION:RC2 | ||
| 468 | RC2_set_key 476 EXIST::FUNCTION:RC2 | ||
| 469 | RC4 477 EXIST::FUNCTION:RC4 | ||
| 470 | RC4_options 478 EXIST::FUNCTION:RC4 | ||
| 471 | RC4_set_key 479 EXIST::FUNCTION:RC4 | ||
| 472 | RSAPrivateKey_asn1_meth 480 NOEXIST::FUNCTION: | ||
| 473 | RSAPrivateKey_dup 481 EXIST::FUNCTION:RSA | ||
| 474 | RSAPublicKey_dup 482 EXIST::FUNCTION:RSA | ||
| 475 | RSA_PKCS1_SSLeay 483 EXIST::FUNCTION:RSA | ||
| 476 | RSA_free 484 EXIST::FUNCTION:RSA | ||
| 477 | RSA_generate_key 485 EXIST::FUNCTION:DEPRECATED,RSA | ||
| 478 | RSA_new 486 EXIST::FUNCTION:RSA | ||
| 479 | RSA_new_method 487 EXIST::FUNCTION:RSA | ||
| 480 | RSA_print 488 EXIST::FUNCTION:BIO,RSA | ||
| 481 | RSA_print_fp 489 EXIST::FUNCTION:FP_API,RSA | ||
| 482 | RSA_private_decrypt 490 EXIST::FUNCTION:RSA | ||
| 483 | RSA_private_encrypt 491 EXIST::FUNCTION:RSA | ||
| 484 | RSA_public_decrypt 492 EXIST::FUNCTION:RSA | ||
| 485 | RSA_public_encrypt 493 EXIST::FUNCTION:RSA | ||
| 486 | RSA_set_default_method 494 EXIST::FUNCTION:RSA | ||
| 487 | RSA_sign 495 EXIST::FUNCTION:RSA | ||
| 488 | RSA_sign_ASN1_OCTET_STRING 496 EXIST::FUNCTION:RSA | ||
| 489 | RSA_size 497 EXIST::FUNCTION:RSA | ||
| 490 | RSA_verify 498 EXIST::FUNCTION:RSA | ||
| 491 | RSA_verify_ASN1_OCTET_STRING 499 EXIST::FUNCTION:RSA | ||
| 492 | SHA 500 EXIST::FUNCTION:SHA,SHA0 | ||
| 493 | SHA1 501 EXIST::FUNCTION:SHA,SHA1 | ||
| 494 | SHA1_Final 502 EXIST::FUNCTION:SHA,SHA1 | ||
| 495 | SHA1_Init 503 EXIST::FUNCTION:SHA,SHA1 | ||
| 496 | SHA1_Update 504 EXIST::FUNCTION:SHA,SHA1 | ||
| 497 | SHA_Final 505 EXIST::FUNCTION:SHA,SHA0 | ||
| 498 | SHA_Init 506 EXIST::FUNCTION:SHA,SHA0 | ||
| 499 | SHA_Update 507 EXIST::FUNCTION:SHA,SHA0 | ||
| 500 | OpenSSL_add_all_algorithms 508 NOEXIST::FUNCTION: | ||
| 501 | OpenSSL_add_all_ciphers 509 EXIST::FUNCTION: | ||
| 502 | OpenSSL_add_all_digests 510 EXIST::FUNCTION: | ||
| 503 | TXT_DB_create_index 511 EXIST::FUNCTION: | ||
| 504 | TXT_DB_free 512 EXIST::FUNCTION: | ||
| 505 | TXT_DB_get_by_index 513 EXIST::FUNCTION: | ||
| 506 | TXT_DB_insert 514 EXIST::FUNCTION: | ||
| 507 | TXT_DB_read 515 EXIST::FUNCTION:BIO | ||
| 508 | TXT_DB_write 516 EXIST::FUNCTION:BIO | ||
| 509 | X509_ALGOR_free 517 EXIST::FUNCTION: | ||
| 510 | X509_ALGOR_new 518 EXIST::FUNCTION: | ||
| 511 | X509_ATTRIBUTE_free 519 EXIST::FUNCTION: | ||
| 512 | X509_ATTRIBUTE_new 520 EXIST::FUNCTION: | ||
| 513 | X509_CINF_free 521 EXIST::FUNCTION: | ||
| 514 | X509_CINF_new 522 EXIST::FUNCTION: | ||
| 515 | X509_CRL_INFO_free 523 EXIST::FUNCTION: | ||
| 516 | X509_CRL_INFO_new 524 EXIST::FUNCTION: | ||
| 517 | X509_CRL_add_ext 525 EXIST::FUNCTION: | ||
| 518 | X509_CRL_cmp 526 EXIST::FUNCTION: | ||
| 519 | X509_CRL_delete_ext 527 EXIST::FUNCTION: | ||
| 520 | X509_CRL_dup 528 EXIST::FUNCTION: | ||
| 521 | X509_CRL_free 529 EXIST::FUNCTION: | ||
| 522 | X509_CRL_get_ext 530 EXIST::FUNCTION: | ||
| 523 | X509_CRL_get_ext_by_NID 531 EXIST::FUNCTION: | ||
| 524 | X509_CRL_get_ext_by_OBJ 532 EXIST::FUNCTION: | ||
| 525 | X509_CRL_get_ext_by_critical 533 EXIST::FUNCTION: | ||
| 526 | X509_CRL_get_ext_count 534 EXIST::FUNCTION: | ||
| 527 | X509_CRL_new 535 EXIST::FUNCTION: | ||
| 528 | X509_CRL_sign 536 EXIST::FUNCTION:EVP | ||
| 529 | X509_CRL_verify 537 EXIST::FUNCTION:EVP | ||
| 530 | X509_EXTENSION_create_by_NID 538 EXIST::FUNCTION: | ||
| 531 | X509_EXTENSION_create_by_OBJ 539 EXIST::FUNCTION: | ||
| 532 | X509_EXTENSION_dup 540 EXIST::FUNCTION: | ||
| 533 | X509_EXTENSION_free 541 EXIST::FUNCTION: | ||
| 534 | X509_EXTENSION_get_critical 542 EXIST::FUNCTION: | ||
| 535 | X509_EXTENSION_get_data 543 EXIST::FUNCTION: | ||
| 536 | X509_EXTENSION_get_object 544 EXIST::FUNCTION: | ||
| 537 | X509_EXTENSION_new 545 EXIST::FUNCTION: | ||
| 538 | X509_EXTENSION_set_critical 546 EXIST::FUNCTION: | ||
| 539 | X509_EXTENSION_set_data 547 EXIST::FUNCTION: | ||
| 540 | X509_EXTENSION_set_object 548 EXIST::FUNCTION: | ||
| 541 | X509_INFO_free 549 EXIST::FUNCTION:EVP | ||
| 542 | X509_INFO_new 550 EXIST::FUNCTION:EVP | ||
| 543 | X509_LOOKUP_by_alias 551 EXIST::FUNCTION: | ||
| 544 | X509_LOOKUP_by_fingerprint 552 EXIST::FUNCTION: | ||
| 545 | X509_LOOKUP_by_issuer_serial 553 EXIST::FUNCTION: | ||
| 546 | X509_LOOKUP_by_subject 554 EXIST::FUNCTION: | ||
| 547 | X509_LOOKUP_ctrl 555 EXIST::FUNCTION: | ||
| 548 | X509_LOOKUP_file 556 EXIST::FUNCTION: | ||
| 549 | X509_LOOKUP_free 557 EXIST::FUNCTION: | ||
| 550 | X509_LOOKUP_hash_dir 558 EXIST::FUNCTION: | ||
| 551 | X509_LOOKUP_init 559 EXIST::FUNCTION: | ||
| 552 | X509_LOOKUP_new 560 EXIST::FUNCTION: | ||
| 553 | X509_LOOKUP_shutdown 561 EXIST::FUNCTION: | ||
| 554 | X509_NAME_ENTRY_create_by_NID 562 EXIST::FUNCTION: | ||
| 555 | X509_NAME_ENTRY_create_by_OBJ 563 EXIST::FUNCTION: | ||
| 556 | X509_NAME_ENTRY_dup 564 EXIST::FUNCTION: | ||
| 557 | X509_NAME_ENTRY_free 565 EXIST::FUNCTION: | ||
| 558 | X509_NAME_ENTRY_get_data 566 EXIST::FUNCTION: | ||
| 559 | X509_NAME_ENTRY_get_object 567 EXIST::FUNCTION: | ||
| 560 | X509_NAME_ENTRY_new 568 EXIST::FUNCTION: | ||
| 561 | X509_NAME_ENTRY_set_data 569 EXIST::FUNCTION: | ||
| 562 | X509_NAME_ENTRY_set_object 570 EXIST::FUNCTION: | ||
| 563 | X509_NAME_add_entry 571 EXIST::FUNCTION: | ||
| 564 | X509_NAME_cmp 572 EXIST::FUNCTION: | ||
| 565 | X509_NAME_delete_entry 573 EXIST::FUNCTION: | ||
| 566 | X509_NAME_digest 574 EXIST::FUNCTION:EVP | ||
| 567 | X509_NAME_dup 575 EXIST::FUNCTION: | ||
| 568 | X509_NAME_entry_count 576 EXIST::FUNCTION: | ||
| 569 | X509_NAME_free 577 EXIST::FUNCTION: | ||
| 570 | X509_NAME_get_entry 578 EXIST::FUNCTION: | ||
| 571 | X509_NAME_get_index_by_NID 579 EXIST::FUNCTION: | ||
| 572 | X509_NAME_get_index_by_OBJ 580 EXIST::FUNCTION: | ||
| 573 | X509_NAME_get_text_by_NID 581 EXIST::FUNCTION: | ||
| 574 | X509_NAME_get_text_by_OBJ 582 EXIST::FUNCTION: | ||
| 575 | X509_NAME_hash 583 EXIST::FUNCTION: | ||
| 576 | X509_NAME_new 584 EXIST::FUNCTION: | ||
| 577 | X509_NAME_oneline 585 EXIST::FUNCTION:EVP | ||
| 578 | X509_NAME_print 586 EXIST::FUNCTION:BIO | ||
| 579 | X509_NAME_set 587 EXIST::FUNCTION: | ||
| 580 | X509_OBJECT_free_contents 588 EXIST::FUNCTION: | ||
| 581 | X509_OBJECT_retrieve_by_subject 589 EXIST::FUNCTION: | ||
| 582 | X509_OBJECT_up_ref_count 590 EXIST::FUNCTION: | ||
| 583 | X509_PKEY_free 591 EXIST::FUNCTION: | ||
| 584 | X509_PKEY_new 592 EXIST::FUNCTION: | ||
| 585 | X509_PUBKEY_free 593 EXIST::FUNCTION: | ||
| 586 | X509_PUBKEY_get 594 EXIST::FUNCTION: | ||
| 587 | X509_PUBKEY_new 595 EXIST::FUNCTION: | ||
| 588 | X509_PUBKEY_set 596 EXIST::FUNCTION: | ||
| 589 | X509_REQ_INFO_free 597 EXIST::FUNCTION: | ||
| 590 | X509_REQ_INFO_new 598 EXIST::FUNCTION: | ||
| 591 | X509_REQ_dup 599 EXIST::FUNCTION: | ||
| 592 | X509_REQ_free 600 EXIST::FUNCTION: | ||
| 593 | X509_REQ_get_pubkey 601 EXIST::FUNCTION: | ||
| 594 | X509_REQ_new 602 EXIST::FUNCTION: | ||
| 595 | X509_REQ_print 603 EXIST::FUNCTION:BIO | ||
| 596 | X509_REQ_print_fp 604 EXIST::FUNCTION:FP_API | ||
| 597 | X509_REQ_set_pubkey 605 EXIST::FUNCTION: | ||
| 598 | X509_REQ_set_subject_name 606 EXIST::FUNCTION: | ||
| 599 | X509_REQ_set_version 607 EXIST::FUNCTION: | ||
| 600 | X509_REQ_sign 608 EXIST::FUNCTION:EVP | ||
| 601 | X509_REQ_to_X509 609 EXIST::FUNCTION: | ||
| 602 | X509_REQ_verify 610 EXIST::FUNCTION:EVP | ||
| 603 | X509_REVOKED_add_ext 611 EXIST::FUNCTION: | ||
| 604 | X509_REVOKED_delete_ext 612 EXIST::FUNCTION: | ||
| 605 | X509_REVOKED_free 613 EXIST::FUNCTION: | ||
| 606 | X509_REVOKED_get_ext 614 EXIST::FUNCTION: | ||
| 607 | X509_REVOKED_get_ext_by_NID 615 EXIST::FUNCTION: | ||
| 608 | X509_REVOKED_get_ext_by_OBJ 616 EXIST::FUNCTION: | ||
| 609 | X509_REVOKED_get_ext_by_critical 617 EXIST:!VMS:FUNCTION: | ||
| 610 | X509_REVOKED_get_ext_by_critic 617 EXIST:VMS:FUNCTION: | ||
| 611 | X509_REVOKED_get_ext_count 618 EXIST::FUNCTION: | ||
| 612 | X509_REVOKED_new 619 EXIST::FUNCTION: | ||
| 613 | X509_SIG_free 620 EXIST::FUNCTION: | ||
| 614 | X509_SIG_new 621 EXIST::FUNCTION: | ||
| 615 | X509_STORE_CTX_cleanup 622 EXIST::FUNCTION: | ||
| 616 | X509_STORE_CTX_init 623 EXIST::FUNCTION: | ||
| 617 | X509_STORE_add_cert 624 EXIST::FUNCTION: | ||
| 618 | X509_STORE_add_lookup 625 EXIST::FUNCTION: | ||
| 619 | X509_STORE_free 626 EXIST::FUNCTION: | ||
| 620 | X509_STORE_get_by_subject 627 EXIST::FUNCTION: | ||
| 621 | X509_STORE_load_locations 628 EXIST::FUNCTION:STDIO | ||
| 622 | X509_STORE_new 629 EXIST::FUNCTION: | ||
| 623 | X509_STORE_set_default_paths 630 EXIST::FUNCTION:STDIO | ||
| 624 | X509_VAL_free 631 EXIST::FUNCTION: | ||
| 625 | X509_VAL_new 632 EXIST::FUNCTION: | ||
| 626 | X509_add_ext 633 EXIST::FUNCTION: | ||
| 627 | X509_asn1_meth 634 NOEXIST::FUNCTION: | ||
| 628 | X509_certificate_type 635 EXIST::FUNCTION: | ||
| 629 | X509_check_private_key 636 EXIST::FUNCTION: | ||
| 630 | X509_cmp_current_time 637 EXIST::FUNCTION: | ||
| 631 | X509_delete_ext 638 EXIST::FUNCTION: | ||
| 632 | X509_digest 639 EXIST::FUNCTION:EVP | ||
| 633 | X509_dup 640 EXIST::FUNCTION: | ||
| 634 | X509_free 641 EXIST::FUNCTION: | ||
| 635 | X509_get_default_cert_area 642 EXIST::FUNCTION: | ||
| 636 | X509_get_default_cert_dir 643 EXIST::FUNCTION: | ||
| 637 | X509_get_default_cert_dir_env 644 EXIST::FUNCTION: | ||
| 638 | X509_get_default_cert_file 645 EXIST::FUNCTION: | ||
| 639 | X509_get_default_cert_file_env 646 EXIST::FUNCTION: | ||
| 640 | X509_get_default_private_dir 647 EXIST::FUNCTION: | ||
| 641 | X509_get_ext 648 EXIST::FUNCTION: | ||
| 642 | X509_get_ext_by_NID 649 EXIST::FUNCTION: | ||
| 643 | X509_get_ext_by_OBJ 650 EXIST::FUNCTION: | ||
| 644 | X509_get_ext_by_critical 651 EXIST::FUNCTION: | ||
| 645 | X509_get_ext_count 652 EXIST::FUNCTION: | ||
| 646 | X509_get_issuer_name 653 EXIST::FUNCTION: | ||
| 647 | X509_get_pubkey 654 EXIST::FUNCTION: | ||
| 648 | X509_get_pubkey_parameters 655 EXIST::FUNCTION: | ||
| 649 | X509_get_serialNumber 656 EXIST::FUNCTION: | ||
| 650 | X509_get_subject_name 657 EXIST::FUNCTION: | ||
| 651 | X509_gmtime_adj 658 EXIST::FUNCTION: | ||
| 652 | X509_issuer_and_serial_cmp 659 EXIST::FUNCTION: | ||
| 653 | X509_issuer_and_serial_hash 660 EXIST::FUNCTION: | ||
| 654 | X509_issuer_name_cmp 661 EXIST::FUNCTION: | ||
| 655 | X509_issuer_name_hash 662 EXIST::FUNCTION: | ||
| 656 | X509_load_cert_file 663 EXIST::FUNCTION:STDIO | ||
| 657 | X509_new 664 EXIST::FUNCTION: | ||
| 658 | X509_print 665 EXIST::FUNCTION:BIO | ||
| 659 | X509_print_fp 666 EXIST::FUNCTION:FP_API | ||
| 660 | X509_set_issuer_name 667 EXIST::FUNCTION: | ||
| 661 | X509_set_notAfter 668 EXIST::FUNCTION: | ||
| 662 | X509_set_notBefore 669 EXIST::FUNCTION: | ||
| 663 | X509_set_pubkey 670 EXIST::FUNCTION: | ||
| 664 | X509_set_serialNumber 671 EXIST::FUNCTION: | ||
| 665 | X509_set_subject_name 672 EXIST::FUNCTION: | ||
| 666 | X509_set_version 673 EXIST::FUNCTION: | ||
| 667 | X509_sign 674 EXIST::FUNCTION:EVP | ||
| 668 | X509_subject_name_cmp 675 EXIST::FUNCTION: | ||
| 669 | X509_subject_name_hash 676 EXIST::FUNCTION: | ||
| 670 | X509_to_X509_REQ 677 EXIST::FUNCTION: | ||
| 671 | X509_verify 678 EXIST::FUNCTION:EVP | ||
| 672 | X509_verify_cert 679 EXIST::FUNCTION: | ||
| 673 | X509_verify_cert_error_string 680 EXIST::FUNCTION: | ||
| 674 | X509v3_add_ext 681 EXIST::FUNCTION: | ||
| 675 | X509v3_add_extension 682 NOEXIST::FUNCTION: | ||
| 676 | X509v3_add_netscape_extensions 683 NOEXIST::FUNCTION: | ||
| 677 | X509v3_add_standard_extensions 684 NOEXIST::FUNCTION: | ||
| 678 | X509v3_cleanup_extensions 685 NOEXIST::FUNCTION: | ||
| 679 | X509v3_data_type_by_NID 686 NOEXIST::FUNCTION: | ||
| 680 | X509v3_data_type_by_OBJ 687 NOEXIST::FUNCTION: | ||
| 681 | X509v3_delete_ext 688 EXIST::FUNCTION: | ||
| 682 | X509v3_get_ext 689 EXIST::FUNCTION: | ||
| 683 | X509v3_get_ext_by_NID 690 EXIST::FUNCTION: | ||
| 684 | X509v3_get_ext_by_OBJ 691 EXIST::FUNCTION: | ||
| 685 | X509v3_get_ext_by_critical 692 EXIST::FUNCTION: | ||
| 686 | X509v3_get_ext_count 693 EXIST::FUNCTION: | ||
| 687 | X509v3_pack_string 694 NOEXIST::FUNCTION: | ||
| 688 | X509v3_pack_type_by_NID 695 NOEXIST::FUNCTION: | ||
| 689 | X509v3_pack_type_by_OBJ 696 NOEXIST::FUNCTION: | ||
| 690 | X509v3_unpack_string 697 NOEXIST::FUNCTION: | ||
| 691 | _des_crypt 698 NOEXIST::FUNCTION: | ||
| 692 | a2d_ASN1_OBJECT 699 EXIST::FUNCTION: | ||
| 693 | a2i_ASN1_INTEGER 700 EXIST::FUNCTION:BIO | ||
| 694 | a2i_ASN1_STRING 701 EXIST::FUNCTION:BIO | ||
| 695 | asn1_Finish 702 EXIST::FUNCTION: | ||
| 696 | asn1_GetSequence 703 EXIST::FUNCTION: | ||
| 697 | bn_div_words 704 EXIST::FUNCTION: | ||
| 698 | bn_expand2 705 EXIST::FUNCTION: | ||
| 699 | bn_mul_add_words 706 EXIST::FUNCTION: | ||
| 700 | bn_mul_words 707 EXIST::FUNCTION: | ||
| 701 | BN_uadd 708 EXIST::FUNCTION: | ||
| 702 | BN_usub 709 EXIST::FUNCTION: | ||
| 703 | bn_sqr_words 710 EXIST::FUNCTION: | ||
| 704 | _ossl_old_crypt 711 EXIST:!NeXT,!PERL5:FUNCTION:DES | ||
| 705 | d2i_ASN1_BIT_STRING 712 EXIST::FUNCTION: | ||
| 706 | d2i_ASN1_BOOLEAN 713 EXIST::FUNCTION: | ||
| 707 | d2i_ASN1_HEADER 714 NOEXIST::FUNCTION: | ||
| 708 | d2i_ASN1_IA5STRING 715 EXIST::FUNCTION: | ||
| 709 | d2i_ASN1_INTEGER 716 EXIST::FUNCTION: | ||
| 710 | d2i_ASN1_OBJECT 717 EXIST::FUNCTION: | ||
| 711 | d2i_ASN1_OCTET_STRING 718 EXIST::FUNCTION: | ||
| 712 | d2i_ASN1_PRINTABLE 719 EXIST::FUNCTION: | ||
| 713 | d2i_ASN1_PRINTABLESTRING 720 EXIST::FUNCTION: | ||
| 714 | d2i_ASN1_SET 721 EXIST::FUNCTION: | ||
| 715 | d2i_ASN1_T61STRING 722 EXIST::FUNCTION: | ||
| 716 | d2i_ASN1_TYPE 723 EXIST::FUNCTION: | ||
| 717 | d2i_ASN1_UTCTIME 724 EXIST::FUNCTION: | ||
| 718 | d2i_ASN1_bytes 725 EXIST::FUNCTION: | ||
| 719 | d2i_ASN1_type_bytes 726 EXIST::FUNCTION: | ||
| 720 | d2i_DHparams 727 EXIST::FUNCTION:DH | ||
| 721 | d2i_DSAPrivateKey 728 EXIST::FUNCTION:DSA | ||
| 722 | d2i_DSAPrivateKey_bio 729 EXIST::FUNCTION:BIO,DSA | ||
| 723 | d2i_DSAPrivateKey_fp 730 EXIST::FUNCTION:DSA,FP_API | ||
| 724 | d2i_DSAPublicKey 731 EXIST::FUNCTION:DSA | ||
| 725 | d2i_DSAparams 732 EXIST::FUNCTION:DSA | ||
| 726 | d2i_NETSCAPE_SPKAC 733 EXIST::FUNCTION: | ||
| 727 | d2i_NETSCAPE_SPKI 734 EXIST::FUNCTION: | ||
| 728 | d2i_Netscape_RSA 735 EXIST::FUNCTION:RC4,RSA | ||
| 729 | d2i_PKCS7 736 EXIST::FUNCTION: | ||
| 730 | d2i_PKCS7_DIGEST 737 EXIST::FUNCTION: | ||
| 731 | d2i_PKCS7_ENCRYPT 738 EXIST::FUNCTION: | ||
| 732 | d2i_PKCS7_ENC_CONTENT 739 EXIST::FUNCTION: | ||
| 733 | d2i_PKCS7_ENVELOPE 740 EXIST::FUNCTION: | ||
| 734 | d2i_PKCS7_ISSUER_AND_SERIAL 741 EXIST::FUNCTION: | ||
| 735 | d2i_PKCS7_RECIP_INFO 742 EXIST::FUNCTION: | ||
| 736 | d2i_PKCS7_SIGNED 743 EXIST::FUNCTION: | ||
| 737 | d2i_PKCS7_SIGNER_INFO 744 EXIST::FUNCTION: | ||
| 738 | d2i_PKCS7_SIGN_ENVELOPE 745 EXIST::FUNCTION: | ||
| 739 | d2i_PKCS7_bio 746 EXIST::FUNCTION: | ||
| 740 | d2i_PKCS7_fp 747 EXIST::FUNCTION:FP_API | ||
| 741 | d2i_PrivateKey 748 EXIST::FUNCTION: | ||
| 742 | d2i_PublicKey 749 EXIST::FUNCTION: | ||
| 743 | d2i_RSAPrivateKey 750 EXIST::FUNCTION:RSA | ||
| 744 | d2i_RSAPrivateKey_bio 751 EXIST::FUNCTION:BIO,RSA | ||
| 745 | d2i_RSAPrivateKey_fp 752 EXIST::FUNCTION:FP_API,RSA | ||
| 746 | d2i_RSAPublicKey 753 EXIST::FUNCTION:RSA | ||
| 747 | d2i_X509 754 EXIST::FUNCTION: | ||
| 748 | d2i_X509_ALGOR 755 EXIST::FUNCTION: | ||
| 749 | d2i_X509_ATTRIBUTE 756 EXIST::FUNCTION: | ||
| 750 | d2i_X509_CINF 757 EXIST::FUNCTION: | ||
| 751 | d2i_X509_CRL 758 EXIST::FUNCTION: | ||
| 752 | d2i_X509_CRL_INFO 759 EXIST::FUNCTION: | ||
| 753 | d2i_X509_CRL_bio 760 EXIST::FUNCTION:BIO | ||
| 754 | d2i_X509_CRL_fp 761 EXIST::FUNCTION:FP_API | ||
| 755 | d2i_X509_EXTENSION 762 EXIST::FUNCTION: | ||
| 756 | d2i_X509_NAME 763 EXIST::FUNCTION: | ||
| 757 | d2i_X509_NAME_ENTRY 764 EXIST::FUNCTION: | ||
| 758 | d2i_X509_PKEY 765 EXIST::FUNCTION: | ||
| 759 | d2i_X509_PUBKEY 766 EXIST::FUNCTION: | ||
| 760 | d2i_X509_REQ 767 EXIST::FUNCTION: | ||
| 761 | d2i_X509_REQ_INFO 768 EXIST::FUNCTION: | ||
| 762 | d2i_X509_REQ_bio 769 EXIST::FUNCTION:BIO | ||
| 763 | d2i_X509_REQ_fp 770 EXIST::FUNCTION:FP_API | ||
| 764 | d2i_X509_REVOKED 771 EXIST::FUNCTION: | ||
| 765 | d2i_X509_SIG 772 EXIST::FUNCTION: | ||
| 766 | d2i_X509_VAL 773 EXIST::FUNCTION: | ||
| 767 | d2i_X509_bio 774 EXIST::FUNCTION:BIO | ||
| 768 | d2i_X509_fp 775 EXIST::FUNCTION:FP_API | ||
| 769 | DES_cbc_cksum 777 EXIST::FUNCTION:DES | ||
| 770 | DES_cbc_encrypt 778 EXIST::FUNCTION:DES | ||
| 771 | DES_cblock_print_file 779 NOEXIST::FUNCTION: | ||
| 772 | DES_cfb64_encrypt 780 EXIST::FUNCTION:DES | ||
| 773 | DES_cfb_encrypt 781 EXIST::FUNCTION:DES | ||
| 774 | DES_decrypt3 782 EXIST::FUNCTION:DES | ||
| 775 | DES_ecb3_encrypt 783 EXIST::FUNCTION:DES | ||
| 776 | DES_ecb_encrypt 784 EXIST::FUNCTION:DES | ||
| 777 | DES_ede3_cbc_encrypt 785 EXIST::FUNCTION:DES | ||
| 778 | DES_ede3_cfb64_encrypt 786 EXIST::FUNCTION:DES | ||
| 779 | DES_ede3_ofb64_encrypt 787 EXIST::FUNCTION:DES | ||
| 780 | DES_enc_read 788 EXIST::FUNCTION:DES | ||
| 781 | DES_enc_write 789 EXIST::FUNCTION:DES | ||
| 782 | DES_encrypt1 790 EXIST::FUNCTION:DES | ||
| 783 | DES_encrypt2 791 EXIST::FUNCTION:DES | ||
| 784 | DES_encrypt3 792 EXIST::FUNCTION:DES | ||
| 785 | DES_fcrypt 793 EXIST::FUNCTION:DES | ||
| 786 | DES_is_weak_key 794 EXIST::FUNCTION:DES | ||
| 787 | DES_key_sched 795 EXIST::FUNCTION:DES | ||
| 788 | DES_ncbc_encrypt 796 EXIST::FUNCTION:DES | ||
| 789 | DES_ofb64_encrypt 797 EXIST::FUNCTION:DES | ||
| 790 | DES_ofb_encrypt 798 EXIST::FUNCTION:DES | ||
| 791 | DES_options 799 EXIST::FUNCTION:DES | ||
| 792 | DES_pcbc_encrypt 800 EXIST::FUNCTION:DES | ||
| 793 | DES_quad_cksum 801 EXIST::FUNCTION:DES | ||
| 794 | DES_random_key 802 EXIST::FUNCTION:DES | ||
| 795 | _ossl_old_des_random_seed 803 EXIST::FUNCTION:DES | ||
| 796 | _ossl_old_des_read_2passwords 804 EXIST::FUNCTION:DES | ||
| 797 | _ossl_old_des_read_password 805 EXIST::FUNCTION:DES | ||
| 798 | _ossl_old_des_read_pw 806 EXIST::FUNCTION: | ||
| 799 | _ossl_old_des_read_pw_string 807 EXIST::FUNCTION: | ||
| 800 | DES_set_key 808 EXIST::FUNCTION:DES | ||
| 801 | DES_set_odd_parity 809 EXIST::FUNCTION:DES | ||
| 802 | DES_string_to_2keys 810 EXIST::FUNCTION:DES | ||
| 803 | DES_string_to_key 811 EXIST::FUNCTION:DES | ||
| 804 | DES_xcbc_encrypt 812 EXIST::FUNCTION:DES | ||
| 805 | DES_xwhite_in2out 813 NOEXIST::FUNCTION: | ||
| 806 | fcrypt_body 814 NOEXIST::FUNCTION: | ||
| 807 | i2a_ASN1_INTEGER 815 EXIST::FUNCTION:BIO | ||
| 808 | i2a_ASN1_OBJECT 816 EXIST::FUNCTION:BIO | ||
| 809 | i2a_ASN1_STRING 817 EXIST::FUNCTION:BIO | ||
| 810 | i2d_ASN1_BIT_STRING 818 EXIST::FUNCTION: | ||
| 811 | i2d_ASN1_BOOLEAN 819 EXIST::FUNCTION: | ||
| 812 | i2d_ASN1_HEADER 820 NOEXIST::FUNCTION: | ||
| 813 | i2d_ASN1_IA5STRING 821 EXIST::FUNCTION: | ||
| 814 | i2d_ASN1_INTEGER 822 EXIST::FUNCTION: | ||
| 815 | i2d_ASN1_OBJECT 823 EXIST::FUNCTION: | ||
| 816 | i2d_ASN1_OCTET_STRING 824 EXIST::FUNCTION: | ||
| 817 | i2d_ASN1_PRINTABLE 825 EXIST::FUNCTION: | ||
| 818 | i2d_ASN1_SET 826 EXIST::FUNCTION: | ||
| 819 | i2d_ASN1_TYPE 827 EXIST::FUNCTION: | ||
| 820 | i2d_ASN1_UTCTIME 828 EXIST::FUNCTION: | ||
| 821 | i2d_ASN1_bytes 829 EXIST::FUNCTION: | ||
| 822 | i2d_DHparams 830 EXIST::FUNCTION:DH | ||
| 823 | i2d_DSAPrivateKey 831 EXIST::FUNCTION:DSA | ||
| 824 | i2d_DSAPrivateKey_bio 832 EXIST::FUNCTION:BIO,DSA | ||
| 825 | i2d_DSAPrivateKey_fp 833 EXIST::FUNCTION:DSA,FP_API | ||
| 826 | i2d_DSAPublicKey 834 EXIST::FUNCTION:DSA | ||
| 827 | i2d_DSAparams 835 EXIST::FUNCTION:DSA | ||
| 828 | i2d_NETSCAPE_SPKAC 836 EXIST::FUNCTION: | ||
| 829 | i2d_NETSCAPE_SPKI 837 EXIST::FUNCTION: | ||
| 830 | i2d_Netscape_RSA 838 EXIST::FUNCTION:RC4,RSA | ||
| 831 | i2d_PKCS7 839 EXIST::FUNCTION: | ||
| 832 | i2d_PKCS7_DIGEST 840 EXIST::FUNCTION: | ||
| 833 | i2d_PKCS7_ENCRYPT 841 EXIST::FUNCTION: | ||
| 834 | i2d_PKCS7_ENC_CONTENT 842 EXIST::FUNCTION: | ||
| 835 | i2d_PKCS7_ENVELOPE 843 EXIST::FUNCTION: | ||
| 836 | i2d_PKCS7_ISSUER_AND_SERIAL 844 EXIST::FUNCTION: | ||
| 837 | i2d_PKCS7_RECIP_INFO 845 EXIST::FUNCTION: | ||
| 838 | i2d_PKCS7_SIGNED 846 EXIST::FUNCTION: | ||
| 839 | i2d_PKCS7_SIGNER_INFO 847 EXIST::FUNCTION: | ||
| 840 | i2d_PKCS7_SIGN_ENVELOPE 848 EXIST::FUNCTION: | ||
| 841 | i2d_PKCS7_bio 849 EXIST::FUNCTION: | ||
| 842 | i2d_PKCS7_fp 850 EXIST::FUNCTION:FP_API | ||
| 843 | i2d_PrivateKey 851 EXIST::FUNCTION: | ||
| 844 | i2d_PublicKey 852 EXIST::FUNCTION: | ||
| 845 | i2d_RSAPrivateKey 853 EXIST::FUNCTION:RSA | ||
| 846 | i2d_RSAPrivateKey_bio 854 EXIST::FUNCTION:BIO,RSA | ||
| 847 | i2d_RSAPrivateKey_fp 855 EXIST::FUNCTION:FP_API,RSA | ||
| 848 | i2d_RSAPublicKey 856 EXIST::FUNCTION:RSA | ||
| 849 | i2d_X509 857 EXIST::FUNCTION: | ||
| 850 | i2d_X509_ALGOR 858 EXIST::FUNCTION: | ||
| 851 | i2d_X509_ATTRIBUTE 859 EXIST::FUNCTION: | ||
| 852 | i2d_X509_CINF 860 EXIST::FUNCTION: | ||
| 853 | i2d_X509_CRL 861 EXIST::FUNCTION: | ||
| 854 | i2d_X509_CRL_INFO 862 EXIST::FUNCTION: | ||
| 855 | i2d_X509_CRL_bio 863 EXIST::FUNCTION:BIO | ||
| 856 | i2d_X509_CRL_fp 864 EXIST::FUNCTION:FP_API | ||
| 857 | i2d_X509_EXTENSION 865 EXIST::FUNCTION: | ||
| 858 | i2d_X509_NAME 866 EXIST::FUNCTION: | ||
| 859 | i2d_X509_NAME_ENTRY 867 EXIST::FUNCTION: | ||
| 860 | i2d_X509_PKEY 868 EXIST::FUNCTION: | ||
| 861 | i2d_X509_PUBKEY 869 EXIST::FUNCTION: | ||
| 862 | i2d_X509_REQ 870 EXIST::FUNCTION: | ||
| 863 | i2d_X509_REQ_INFO 871 EXIST::FUNCTION: | ||
| 864 | i2d_X509_REQ_bio 872 EXIST::FUNCTION:BIO | ||
| 865 | i2d_X509_REQ_fp 873 EXIST::FUNCTION:FP_API | ||
| 866 | i2d_X509_REVOKED 874 EXIST::FUNCTION: | ||
| 867 | i2d_X509_SIG 875 EXIST::FUNCTION: | ||
| 868 | i2d_X509_VAL 876 EXIST::FUNCTION: | ||
| 869 | i2d_X509_bio 877 EXIST::FUNCTION:BIO | ||
| 870 | i2d_X509_fp 878 EXIST::FUNCTION:FP_API | ||
| 871 | idea_cbc_encrypt 879 EXIST::FUNCTION:IDEA | ||
| 872 | idea_cfb64_encrypt 880 EXIST::FUNCTION:IDEA | ||
| 873 | idea_ecb_encrypt 881 EXIST::FUNCTION:IDEA | ||
| 874 | idea_encrypt 882 EXIST::FUNCTION:IDEA | ||
| 875 | idea_ofb64_encrypt 883 EXIST::FUNCTION:IDEA | ||
| 876 | idea_options 884 EXIST::FUNCTION:IDEA | ||
| 877 | idea_set_decrypt_key 885 EXIST::FUNCTION:IDEA | ||
| 878 | idea_set_encrypt_key 886 EXIST::FUNCTION:IDEA | ||
| 879 | lh_delete 887 EXIST::FUNCTION: | ||
| 880 | lh_doall 888 EXIST::FUNCTION: | ||
| 881 | lh_doall_arg 889 EXIST::FUNCTION: | ||
| 882 | lh_free 890 EXIST::FUNCTION: | ||
| 883 | lh_insert 891 EXIST::FUNCTION: | ||
| 884 | lh_new 892 EXIST::FUNCTION: | ||
| 885 | lh_node_stats 893 EXIST::FUNCTION:FP_API | ||
| 886 | lh_node_stats_bio 894 EXIST::FUNCTION:BIO | ||
| 887 | lh_node_usage_stats 895 EXIST::FUNCTION:FP_API | ||
| 888 | lh_node_usage_stats_bio 896 EXIST::FUNCTION:BIO | ||
| 889 | lh_retrieve 897 EXIST::FUNCTION: | ||
| 890 | lh_stats 898 EXIST::FUNCTION:FP_API | ||
| 891 | lh_stats_bio 899 EXIST::FUNCTION:BIO | ||
| 892 | lh_strhash 900 EXIST::FUNCTION: | ||
| 893 | sk_delete 901 EXIST::FUNCTION: | ||
| 894 | sk_delete_ptr 902 EXIST::FUNCTION: | ||
| 895 | sk_dup 903 EXIST::FUNCTION: | ||
| 896 | sk_find 904 EXIST::FUNCTION: | ||
| 897 | sk_free 905 EXIST::FUNCTION: | ||
| 898 | sk_insert 906 EXIST::FUNCTION: | ||
| 899 | sk_new 907 EXIST::FUNCTION: | ||
| 900 | sk_pop 908 EXIST::FUNCTION: | ||
| 901 | sk_pop_free 909 EXIST::FUNCTION: | ||
| 902 | sk_push 910 EXIST::FUNCTION: | ||
| 903 | sk_set_cmp_func 911 EXIST::FUNCTION: | ||
| 904 | sk_shift 912 EXIST::FUNCTION: | ||
| 905 | sk_unshift 913 EXIST::FUNCTION: | ||
| 906 | sk_zero 914 EXIST::FUNCTION: | ||
| 907 | BIO_f_nbio_test 915 EXIST::FUNCTION: | ||
| 908 | ASN1_TYPE_get 916 EXIST::FUNCTION: | ||
| 909 | ASN1_TYPE_set 917 EXIST::FUNCTION: | ||
| 910 | PKCS7_content_free 918 NOEXIST::FUNCTION: | ||
| 911 | ERR_load_PKCS7_strings 919 EXIST::FUNCTION: | ||
| 912 | X509_find_by_issuer_and_serial 920 EXIST::FUNCTION: | ||
| 913 | X509_find_by_subject 921 EXIST::FUNCTION: | ||
| 914 | PKCS7_ctrl 927 EXIST::FUNCTION: | ||
| 915 | PKCS7_set_type 928 EXIST::FUNCTION: | ||
| 916 | PKCS7_set_content 929 EXIST::FUNCTION: | ||
| 917 | PKCS7_SIGNER_INFO_set 930 EXIST::FUNCTION: | ||
| 918 | PKCS7_add_signer 931 EXIST::FUNCTION: | ||
| 919 | PKCS7_add_certificate 932 EXIST::FUNCTION: | ||
| 920 | PKCS7_add_crl 933 EXIST::FUNCTION: | ||
| 921 | PKCS7_content_new 934 EXIST::FUNCTION: | ||
| 922 | PKCS7_dataSign 935 NOEXIST::FUNCTION: | ||
| 923 | PKCS7_dataVerify 936 EXIST::FUNCTION: | ||
| 924 | PKCS7_dataInit 937 EXIST::FUNCTION: | ||
| 925 | PKCS7_add_signature 938 EXIST::FUNCTION: | ||
| 926 | PKCS7_cert_from_signer_info 939 EXIST::FUNCTION: | ||
| 927 | PKCS7_get_signer_info 940 EXIST::FUNCTION: | ||
| 928 | EVP_delete_alias 941 NOEXIST::FUNCTION: | ||
| 929 | EVP_mdc2 942 EXIST::FUNCTION:MDC2 | ||
| 930 | PEM_read_bio_RSAPublicKey 943 EXIST::FUNCTION:RSA | ||
| 931 | PEM_write_bio_RSAPublicKey 944 EXIST::FUNCTION:RSA | ||
| 932 | d2i_RSAPublicKey_bio 945 EXIST::FUNCTION:BIO,RSA | ||
| 933 | i2d_RSAPublicKey_bio 946 EXIST::FUNCTION:BIO,RSA | ||
| 934 | PEM_read_RSAPublicKey 947 EXIST:!WIN16:FUNCTION:RSA | ||
| 935 | PEM_write_RSAPublicKey 949 EXIST:!WIN16:FUNCTION:RSA | ||
| 936 | d2i_RSAPublicKey_fp 952 EXIST::FUNCTION:FP_API,RSA | ||
| 937 | i2d_RSAPublicKey_fp 954 EXIST::FUNCTION:FP_API,RSA | ||
| 938 | BIO_copy_next_retry 955 EXIST::FUNCTION: | ||
| 939 | RSA_flags 956 EXIST::FUNCTION:RSA | ||
| 940 | X509_STORE_add_crl 957 EXIST::FUNCTION: | ||
| 941 | X509_load_crl_file 958 EXIST::FUNCTION:STDIO | ||
| 942 | EVP_rc2_40_cbc 959 EXIST::FUNCTION:RC2 | ||
| 943 | EVP_rc4_40 960 EXIST::FUNCTION:RC4 | ||
| 944 | EVP_CIPHER_CTX_init 961 EXIST::FUNCTION: | ||
| 945 | HMAC 962 EXIST::FUNCTION:HMAC | ||
| 946 | HMAC_Init 963 EXIST::FUNCTION:HMAC | ||
| 947 | HMAC_Update 964 EXIST::FUNCTION:HMAC | ||
| 948 | HMAC_Final 965 EXIST::FUNCTION:HMAC | ||
| 949 | ERR_get_next_error_library 966 EXIST::FUNCTION: | ||
| 950 | EVP_PKEY_cmp_parameters 967 EXIST::FUNCTION: | ||
| 951 | HMAC_cleanup 968 NOEXIST::FUNCTION: | ||
| 952 | BIO_ptr_ctrl 969 EXIST::FUNCTION: | ||
| 953 | BIO_new_file_internal 970 NOEXIST::FUNCTION: | ||
| 954 | BIO_new_fp_internal 971 NOEXIST::FUNCTION: | ||
| 955 | BIO_s_file_internal 972 NOEXIST::FUNCTION: | ||
| 956 | BN_BLINDING_convert 973 EXIST::FUNCTION: | ||
| 957 | BN_BLINDING_invert 974 EXIST::FUNCTION: | ||
| 958 | BN_BLINDING_update 975 EXIST::FUNCTION: | ||
| 959 | RSA_blinding_on 977 EXIST::FUNCTION:RSA | ||
| 960 | RSA_blinding_off 978 EXIST::FUNCTION:RSA | ||
| 961 | i2t_ASN1_OBJECT 979 EXIST::FUNCTION: | ||
| 962 | BN_BLINDING_new 980 EXIST::FUNCTION: | ||
| 963 | BN_BLINDING_free 981 EXIST::FUNCTION: | ||
| 964 | EVP_cast5_cbc 983 EXIST::FUNCTION:CAST | ||
| 965 | EVP_cast5_cfb64 984 EXIST::FUNCTION:CAST | ||
| 966 | EVP_cast5_ecb 985 EXIST::FUNCTION:CAST | ||
| 967 | EVP_cast5_ofb 986 EXIST::FUNCTION:CAST | ||
| 968 | BF_decrypt 987 EXIST::FUNCTION:BF | ||
| 969 | CAST_set_key 988 EXIST::FUNCTION:CAST | ||
| 970 | CAST_encrypt 989 EXIST::FUNCTION:CAST | ||
| 971 | CAST_decrypt 990 EXIST::FUNCTION:CAST | ||
| 972 | CAST_ecb_encrypt 991 EXIST::FUNCTION:CAST | ||
| 973 | CAST_cbc_encrypt 992 EXIST::FUNCTION:CAST | ||
| 974 | CAST_cfb64_encrypt 993 EXIST::FUNCTION:CAST | ||
| 975 | CAST_ofb64_encrypt 994 EXIST::FUNCTION:CAST | ||
| 976 | RC2_decrypt 995 EXIST::FUNCTION:RC2 | ||
| 977 | OBJ_create_objects 997 EXIST::FUNCTION: | ||
| 978 | BN_exp 998 EXIST::FUNCTION: | ||
| 979 | BN_mul_word 999 EXIST::FUNCTION: | ||
| 980 | BN_sub_word 1000 EXIST::FUNCTION: | ||
| 981 | BN_dec2bn 1001 EXIST::FUNCTION: | ||
| 982 | BN_bn2dec 1002 EXIST::FUNCTION: | ||
| 983 | BIO_ghbn_ctrl 1003 NOEXIST::FUNCTION: | ||
| 984 | CRYPTO_free_ex_data 1004 EXIST::FUNCTION: | ||
| 985 | CRYPTO_get_ex_data 1005 EXIST::FUNCTION: | ||
| 986 | CRYPTO_set_ex_data 1007 EXIST::FUNCTION: | ||
| 987 | ERR_load_CRYPTO_strings 1009 EXIST:!OS2,!VMS:FUNCTION: | ||
| 988 | ERR_load_CRYPTOlib_strings 1009 EXIST:OS2,VMS:FUNCTION: | ||
| 989 | EVP_PKEY_bits 1010 EXIST::FUNCTION: | ||
| 990 | MD5_Transform 1011 EXIST::FUNCTION:MD5 | ||
| 991 | SHA1_Transform 1012 EXIST::FUNCTION:SHA,SHA1 | ||
| 992 | SHA_Transform 1013 EXIST::FUNCTION:SHA,SHA0 | ||
| 993 | X509_STORE_CTX_get_chain 1014 EXIST::FUNCTION: | ||
| 994 | X509_STORE_CTX_get_current_cert 1015 EXIST::FUNCTION: | ||
| 995 | X509_STORE_CTX_get_error 1016 EXIST::FUNCTION: | ||
| 996 | X509_STORE_CTX_get_error_depth 1017 EXIST::FUNCTION: | ||
| 997 | X509_STORE_CTX_get_ex_data 1018 EXIST::FUNCTION: | ||
| 998 | X509_STORE_CTX_set_cert 1020 EXIST::FUNCTION: | ||
| 999 | X509_STORE_CTX_set_chain 1021 EXIST::FUNCTION: | ||
| 1000 | X509_STORE_CTX_set_error 1022 EXIST::FUNCTION: | ||
| 1001 | X509_STORE_CTX_set_ex_data 1023 EXIST::FUNCTION: | ||
| 1002 | CRYPTO_dup_ex_data 1025 EXIST::FUNCTION: | ||
| 1003 | CRYPTO_get_new_lockid 1026 EXIST::FUNCTION: | ||
| 1004 | CRYPTO_new_ex_data 1027 EXIST::FUNCTION: | ||
| 1005 | RSA_set_ex_data 1028 EXIST::FUNCTION:RSA | ||
| 1006 | RSA_get_ex_data 1029 EXIST::FUNCTION:RSA | ||
| 1007 | RSA_get_ex_new_index 1030 EXIST::FUNCTION:RSA | ||
| 1008 | RSA_padding_add_PKCS1_type_1 1031 EXIST::FUNCTION:RSA | ||
| 1009 | RSA_padding_add_PKCS1_type_2 1032 EXIST::FUNCTION:RSA | ||
| 1010 | RSA_padding_add_SSLv23 1033 EXIST::FUNCTION:RSA | ||
| 1011 | RSA_padding_add_none 1034 EXIST::FUNCTION:RSA | ||
| 1012 | RSA_padding_check_PKCS1_type_1 1035 EXIST::FUNCTION:RSA | ||
| 1013 | RSA_padding_check_PKCS1_type_2 1036 EXIST::FUNCTION:RSA | ||
| 1014 | RSA_padding_check_SSLv23 1037 EXIST::FUNCTION:RSA | ||
| 1015 | RSA_padding_check_none 1038 EXIST::FUNCTION:RSA | ||
| 1016 | bn_add_words 1039 EXIST::FUNCTION: | ||
| 1017 | d2i_Netscape_RSA_2 1040 NOEXIST::FUNCTION: | ||
| 1018 | CRYPTO_get_ex_new_index 1041 EXIST::FUNCTION: | ||
| 1019 | RIPEMD160_Init 1042 EXIST::FUNCTION:RIPEMD | ||
| 1020 | RIPEMD160_Update 1043 EXIST::FUNCTION:RIPEMD | ||
| 1021 | RIPEMD160_Final 1044 EXIST::FUNCTION:RIPEMD | ||
| 1022 | RIPEMD160 1045 EXIST::FUNCTION:RIPEMD | ||
| 1023 | RIPEMD160_Transform 1046 EXIST::FUNCTION:RIPEMD | ||
| 1024 | RC5_32_set_key 1047 EXIST::FUNCTION:RC5 | ||
| 1025 | RC5_32_ecb_encrypt 1048 EXIST::FUNCTION:RC5 | ||
| 1026 | RC5_32_encrypt 1049 EXIST::FUNCTION:RC5 | ||
| 1027 | RC5_32_decrypt 1050 EXIST::FUNCTION:RC5 | ||
| 1028 | RC5_32_cbc_encrypt 1051 EXIST::FUNCTION:RC5 | ||
| 1029 | RC5_32_cfb64_encrypt 1052 EXIST::FUNCTION:RC5 | ||
| 1030 | RC5_32_ofb64_encrypt 1053 EXIST::FUNCTION:RC5 | ||
| 1031 | BN_bn2mpi 1058 EXIST::FUNCTION: | ||
| 1032 | BN_mpi2bn 1059 EXIST::FUNCTION: | ||
| 1033 | ASN1_BIT_STRING_get_bit 1060 EXIST::FUNCTION: | ||
| 1034 | ASN1_BIT_STRING_set_bit 1061 EXIST::FUNCTION: | ||
| 1035 | BIO_get_ex_data 1062 EXIST::FUNCTION: | ||
| 1036 | BIO_get_ex_new_index 1063 EXIST::FUNCTION: | ||
| 1037 | BIO_set_ex_data 1064 EXIST::FUNCTION: | ||
| 1038 | X509v3_get_key_usage 1066 NOEXIST::FUNCTION: | ||
| 1039 | X509v3_set_key_usage 1067 NOEXIST::FUNCTION: | ||
| 1040 | a2i_X509v3_key_usage 1068 NOEXIST::FUNCTION: | ||
| 1041 | i2a_X509v3_key_usage 1069 NOEXIST::FUNCTION: | ||
| 1042 | EVP_PKEY_decrypt 1070 EXIST::FUNCTION: | ||
| 1043 | EVP_PKEY_encrypt 1071 EXIST::FUNCTION: | ||
| 1044 | PKCS7_RECIP_INFO_set 1072 EXIST::FUNCTION: | ||
| 1045 | PKCS7_add_recipient 1073 EXIST::FUNCTION: | ||
| 1046 | PKCS7_add_recipient_info 1074 EXIST::FUNCTION: | ||
| 1047 | PKCS7_set_cipher 1075 EXIST::FUNCTION: | ||
| 1048 | ASN1_TYPE_get_int_octetstring 1076 EXIST::FUNCTION: | ||
| 1049 | ASN1_TYPE_get_octetstring 1077 EXIST::FUNCTION: | ||
| 1050 | ASN1_TYPE_set_int_octetstring 1078 EXIST::FUNCTION: | ||
| 1051 | ASN1_TYPE_set_octetstring 1079 EXIST::FUNCTION: | ||
| 1052 | ASN1_UTCTIME_set_string 1080 EXIST::FUNCTION: | ||
| 1053 | ERR_add_error_data 1081 EXIST::FUNCTION:BIO | ||
| 1054 | ERR_set_error_data 1082 EXIST::FUNCTION: | ||
| 1055 | EVP_CIPHER_asn1_to_param 1083 EXIST::FUNCTION: | ||
| 1056 | EVP_CIPHER_param_to_asn1 1084 EXIST::FUNCTION: | ||
| 1057 | EVP_CIPHER_get_asn1_iv 1085 EXIST::FUNCTION: | ||
| 1058 | EVP_CIPHER_set_asn1_iv 1086 EXIST::FUNCTION: | ||
| 1059 | EVP_rc5_32_12_16_cbc 1087 EXIST::FUNCTION:RC5 | ||
| 1060 | EVP_rc5_32_12_16_cfb64 1088 EXIST::FUNCTION:RC5 | ||
| 1061 | EVP_rc5_32_12_16_ecb 1089 EXIST::FUNCTION:RC5 | ||
| 1062 | EVP_rc5_32_12_16_ofb 1090 EXIST::FUNCTION:RC5 | ||
| 1063 | asn1_add_error 1091 EXIST::FUNCTION: | ||
| 1064 | d2i_ASN1_BMPSTRING 1092 EXIST::FUNCTION: | ||
| 1065 | i2d_ASN1_BMPSTRING 1093 EXIST::FUNCTION: | ||
| 1066 | BIO_f_ber 1094 NOEXIST::FUNCTION: | ||
| 1067 | BN_init 1095 EXIST::FUNCTION: | ||
| 1068 | COMP_CTX_new 1096 EXIST::FUNCTION: | ||
| 1069 | COMP_CTX_free 1097 EXIST::FUNCTION: | ||
| 1070 | COMP_CTX_compress_block 1098 NOEXIST::FUNCTION: | ||
| 1071 | COMP_CTX_expand_block 1099 NOEXIST::FUNCTION: | ||
| 1072 | X509_STORE_CTX_get_ex_new_index 1100 EXIST::FUNCTION: | ||
| 1073 | OBJ_NAME_add 1101 EXIST::FUNCTION: | ||
| 1074 | BIO_socket_nbio 1102 EXIST::FUNCTION: | ||
| 1075 | EVP_rc2_64_cbc 1103 EXIST::FUNCTION:RC2 | ||
| 1076 | OBJ_NAME_cleanup 1104 EXIST::FUNCTION: | ||
| 1077 | OBJ_NAME_get 1105 EXIST::FUNCTION: | ||
| 1078 | OBJ_NAME_init 1106 EXIST::FUNCTION: | ||
| 1079 | OBJ_NAME_new_index 1107 EXIST::FUNCTION: | ||
| 1080 | OBJ_NAME_remove 1108 EXIST::FUNCTION: | ||
| 1081 | BN_MONT_CTX_copy 1109 EXIST::FUNCTION: | ||
| 1082 | BIO_new_socks4a_connect 1110 NOEXIST::FUNCTION: | ||
| 1083 | BIO_s_socks4a_connect 1111 NOEXIST::FUNCTION: | ||
| 1084 | PROXY_set_connect_mode 1112 NOEXIST::FUNCTION: | ||
| 1085 | RAND_SSLeay 1113 EXIST::FUNCTION: | ||
| 1086 | RAND_set_rand_method 1114 EXIST::FUNCTION: | ||
| 1087 | RSA_memory_lock 1115 EXIST::FUNCTION:RSA | ||
| 1088 | bn_sub_words 1116 EXIST::FUNCTION: | ||
| 1089 | bn_mul_normal 1117 NOEXIST::FUNCTION: | ||
| 1090 | bn_mul_comba8 1118 NOEXIST::FUNCTION: | ||
| 1091 | bn_mul_comba4 1119 NOEXIST::FUNCTION: | ||
| 1092 | bn_sqr_normal 1120 NOEXIST::FUNCTION: | ||
| 1093 | bn_sqr_comba8 1121 NOEXIST::FUNCTION: | ||
| 1094 | bn_sqr_comba4 1122 NOEXIST::FUNCTION: | ||
| 1095 | bn_cmp_words 1123 NOEXIST::FUNCTION: | ||
| 1096 | bn_mul_recursive 1124 NOEXIST::FUNCTION: | ||
| 1097 | bn_mul_part_recursive 1125 NOEXIST::FUNCTION: | ||
| 1098 | bn_sqr_recursive 1126 NOEXIST::FUNCTION: | ||
| 1099 | bn_mul_low_normal 1127 NOEXIST::FUNCTION: | ||
| 1100 | BN_RECP_CTX_init 1128 EXIST::FUNCTION: | ||
| 1101 | BN_RECP_CTX_new 1129 EXIST::FUNCTION: | ||
| 1102 | BN_RECP_CTX_free 1130 EXIST::FUNCTION: | ||
| 1103 | BN_RECP_CTX_set 1131 EXIST::FUNCTION: | ||
| 1104 | BN_mod_mul_reciprocal 1132 EXIST::FUNCTION: | ||
| 1105 | BN_mod_exp_recp 1133 EXIST::FUNCTION: | ||
| 1106 | BN_div_recp 1134 EXIST::FUNCTION: | ||
| 1107 | BN_CTX_init 1135 EXIST::FUNCTION:DEPRECATED | ||
| 1108 | BN_MONT_CTX_init 1136 EXIST::FUNCTION: | ||
| 1109 | RAND_get_rand_method 1137 EXIST::FUNCTION: | ||
| 1110 | PKCS7_add_attribute 1138 EXIST::FUNCTION: | ||
| 1111 | PKCS7_add_signed_attribute 1139 EXIST::FUNCTION: | ||
| 1112 | PKCS7_digest_from_attributes 1140 EXIST::FUNCTION: | ||
| 1113 | PKCS7_get_attribute 1141 EXIST::FUNCTION: | ||
| 1114 | PKCS7_get_issuer_and_serial 1142 EXIST::FUNCTION: | ||
| 1115 | PKCS7_get_signed_attribute 1143 EXIST::FUNCTION: | ||
| 1116 | COMP_compress_block 1144 EXIST::FUNCTION: | ||
| 1117 | COMP_expand_block 1145 EXIST::FUNCTION: | ||
| 1118 | COMP_rle 1146 EXIST::FUNCTION: | ||
| 1119 | COMP_zlib 1147 EXIST::FUNCTION: | ||
| 1120 | ms_time_diff 1148 NOEXIST::FUNCTION: | ||
| 1121 | ms_time_new 1149 NOEXIST::FUNCTION: | ||
| 1122 | ms_time_free 1150 NOEXIST::FUNCTION: | ||
| 1123 | ms_time_cmp 1151 NOEXIST::FUNCTION: | ||
| 1124 | ms_time_get 1152 NOEXIST::FUNCTION: | ||
| 1125 | PKCS7_set_attributes 1153 EXIST::FUNCTION: | ||
| 1126 | PKCS7_set_signed_attributes 1154 EXIST::FUNCTION: | ||
| 1127 | X509_ATTRIBUTE_create 1155 EXIST::FUNCTION: | ||
| 1128 | X509_ATTRIBUTE_dup 1156 EXIST::FUNCTION: | ||
| 1129 | ASN1_GENERALIZEDTIME_check 1157 EXIST::FUNCTION: | ||
| 1130 | ASN1_GENERALIZEDTIME_print 1158 EXIST::FUNCTION:BIO | ||
| 1131 | ASN1_GENERALIZEDTIME_set 1159 EXIST::FUNCTION: | ||
| 1132 | ASN1_GENERALIZEDTIME_set_string 1160 EXIST::FUNCTION: | ||
| 1133 | ASN1_TIME_print 1161 EXIST::FUNCTION:BIO | ||
| 1134 | BASIC_CONSTRAINTS_free 1162 EXIST::FUNCTION: | ||
| 1135 | BASIC_CONSTRAINTS_new 1163 EXIST::FUNCTION: | ||
| 1136 | ERR_load_X509V3_strings 1164 EXIST::FUNCTION: | ||
| 1137 | NETSCAPE_CERT_SEQUENCE_free 1165 EXIST::FUNCTION: | ||
| 1138 | NETSCAPE_CERT_SEQUENCE_new 1166 EXIST::FUNCTION: | ||
| 1139 | OBJ_txt2obj 1167 EXIST::FUNCTION: | ||
| 1140 | PEM_read_NETSCAPE_CERT_SEQUENCE 1168 EXIST:!VMS,!WIN16:FUNCTION: | ||
| 1141 | PEM_read_NS_CERT_SEQ 1168 EXIST:VMS:FUNCTION: | ||
| 1142 | PEM_read_bio_NETSCAPE_CERT_SEQUENCE 1169 EXIST:!VMS:FUNCTION: | ||
| 1143 | PEM_read_bio_NS_CERT_SEQ 1169 EXIST:VMS:FUNCTION: | ||
| 1144 | PEM_write_NETSCAPE_CERT_SEQUENCE 1170 EXIST:!VMS,!WIN16:FUNCTION: | ||
| 1145 | PEM_write_NS_CERT_SEQ 1170 EXIST:VMS:FUNCTION: | ||
| 1146 | PEM_write_bio_NETSCAPE_CERT_SEQUENCE 1171 EXIST:!VMS:FUNCTION: | ||
| 1147 | PEM_write_bio_NS_CERT_SEQ 1171 EXIST:VMS:FUNCTION: | ||
| 1148 | X509V3_EXT_add 1172 EXIST::FUNCTION: | ||
| 1149 | X509V3_EXT_add_alias 1173 EXIST::FUNCTION: | ||
| 1150 | X509V3_EXT_add_conf 1174 EXIST::FUNCTION: | ||
| 1151 | X509V3_EXT_cleanup 1175 EXIST::FUNCTION: | ||
| 1152 | X509V3_EXT_conf 1176 EXIST::FUNCTION: | ||
| 1153 | X509V3_EXT_conf_nid 1177 EXIST::FUNCTION: | ||
| 1154 | X509V3_EXT_get 1178 EXIST::FUNCTION: | ||
| 1155 | X509V3_EXT_get_nid 1179 EXIST::FUNCTION: | ||
| 1156 | X509V3_EXT_print 1180 EXIST::FUNCTION: | ||
| 1157 | X509V3_EXT_print_fp 1181 EXIST::FUNCTION: | ||
| 1158 | X509V3_add_standard_extensions 1182 EXIST::FUNCTION: | ||
| 1159 | X509V3_add_value 1183 EXIST::FUNCTION: | ||
| 1160 | X509V3_add_value_bool 1184 EXIST::FUNCTION: | ||
| 1161 | X509V3_add_value_int 1185 EXIST::FUNCTION: | ||
| 1162 | X509V3_conf_free 1186 EXIST::FUNCTION: | ||
| 1163 | X509V3_get_value_bool 1187 EXIST::FUNCTION: | ||
| 1164 | X509V3_get_value_int 1188 EXIST::FUNCTION: | ||
| 1165 | X509V3_parse_list 1189 EXIST::FUNCTION: | ||
| 1166 | d2i_ASN1_GENERALIZEDTIME 1190 EXIST::FUNCTION: | ||
| 1167 | d2i_ASN1_TIME 1191 EXIST::FUNCTION: | ||
| 1168 | d2i_BASIC_CONSTRAINTS 1192 EXIST::FUNCTION: | ||
| 1169 | d2i_NETSCAPE_CERT_SEQUENCE 1193 EXIST::FUNCTION: | ||
| 1170 | d2i_ext_ku 1194 NOEXIST::FUNCTION: | ||
| 1171 | ext_ku_free 1195 NOEXIST::FUNCTION: | ||
| 1172 | ext_ku_new 1196 NOEXIST::FUNCTION: | ||
| 1173 | i2d_ASN1_GENERALIZEDTIME 1197 EXIST::FUNCTION: | ||
| 1174 | i2d_ASN1_TIME 1198 EXIST::FUNCTION: | ||
| 1175 | i2d_BASIC_CONSTRAINTS 1199 EXIST::FUNCTION: | ||
| 1176 | i2d_NETSCAPE_CERT_SEQUENCE 1200 EXIST::FUNCTION: | ||
| 1177 | i2d_ext_ku 1201 NOEXIST::FUNCTION: | ||
| 1178 | EVP_MD_CTX_copy 1202 EXIST::FUNCTION: | ||
| 1179 | i2d_ASN1_ENUMERATED 1203 EXIST::FUNCTION: | ||
| 1180 | d2i_ASN1_ENUMERATED 1204 EXIST::FUNCTION: | ||
| 1181 | ASN1_ENUMERATED_set 1205 EXIST::FUNCTION: | ||
| 1182 | ASN1_ENUMERATED_get 1206 EXIST::FUNCTION: | ||
| 1183 | BN_to_ASN1_ENUMERATED 1207 EXIST::FUNCTION: | ||
| 1184 | ASN1_ENUMERATED_to_BN 1208 EXIST::FUNCTION: | ||
| 1185 | i2a_ASN1_ENUMERATED 1209 EXIST::FUNCTION:BIO | ||
| 1186 | a2i_ASN1_ENUMERATED 1210 EXIST::FUNCTION:BIO | ||
| 1187 | i2d_GENERAL_NAME 1211 EXIST::FUNCTION: | ||
| 1188 | d2i_GENERAL_NAME 1212 EXIST::FUNCTION: | ||
| 1189 | GENERAL_NAME_new 1213 EXIST::FUNCTION: | ||
| 1190 | GENERAL_NAME_free 1214 EXIST::FUNCTION: | ||
| 1191 | GENERAL_NAMES_new 1215 EXIST::FUNCTION: | ||
| 1192 | GENERAL_NAMES_free 1216 EXIST::FUNCTION: | ||
| 1193 | d2i_GENERAL_NAMES 1217 EXIST::FUNCTION: | ||
| 1194 | i2d_GENERAL_NAMES 1218 EXIST::FUNCTION: | ||
| 1195 | i2v_GENERAL_NAMES 1219 EXIST::FUNCTION: | ||
| 1196 | i2s_ASN1_OCTET_STRING 1220 EXIST::FUNCTION: | ||
| 1197 | s2i_ASN1_OCTET_STRING 1221 EXIST::FUNCTION: | ||
| 1198 | X509V3_EXT_check_conf 1222 NOEXIST::FUNCTION: | ||
| 1199 | hex_to_string 1223 EXIST::FUNCTION: | ||
| 1200 | string_to_hex 1224 EXIST::FUNCTION: | ||
| 1201 | DES_ede3_cbcm_encrypt 1225 EXIST::FUNCTION:DES | ||
| 1202 | RSA_padding_add_PKCS1_OAEP 1226 EXIST::FUNCTION:RSA | ||
| 1203 | RSA_padding_check_PKCS1_OAEP 1227 EXIST::FUNCTION:RSA | ||
| 1204 | X509_CRL_print_fp 1228 EXIST::FUNCTION:FP_API | ||
| 1205 | X509_CRL_print 1229 EXIST::FUNCTION:BIO | ||
| 1206 | i2v_GENERAL_NAME 1230 EXIST::FUNCTION: | ||
| 1207 | v2i_GENERAL_NAME 1231 EXIST::FUNCTION: | ||
| 1208 | i2d_PKEY_USAGE_PERIOD 1232 EXIST::FUNCTION: | ||
| 1209 | d2i_PKEY_USAGE_PERIOD 1233 EXIST::FUNCTION: | ||
| 1210 | PKEY_USAGE_PERIOD_new 1234 EXIST::FUNCTION: | ||
| 1211 | PKEY_USAGE_PERIOD_free 1235 EXIST::FUNCTION: | ||
| 1212 | v2i_GENERAL_NAMES 1236 EXIST::FUNCTION: | ||
| 1213 | i2s_ASN1_INTEGER 1237 EXIST::FUNCTION: | ||
| 1214 | X509V3_EXT_d2i 1238 EXIST::FUNCTION: | ||
| 1215 | name_cmp 1239 EXIST::FUNCTION: | ||
| 1216 | str_dup 1240 NOEXIST::FUNCTION: | ||
| 1217 | i2s_ASN1_ENUMERATED 1241 EXIST::FUNCTION: | ||
| 1218 | i2s_ASN1_ENUMERATED_TABLE 1242 EXIST::FUNCTION: | ||
| 1219 | BIO_s_log 1243 EXIST:!OS2,!WIN16,!WIN32,!macintosh:FUNCTION: | ||
| 1220 | BIO_f_reliable 1244 EXIST::FUNCTION:BIO | ||
| 1221 | PKCS7_dataFinal 1245 EXIST::FUNCTION: | ||
| 1222 | PKCS7_dataDecode 1246 EXIST::FUNCTION: | ||
| 1223 | X509V3_EXT_CRL_add_conf 1247 EXIST::FUNCTION: | ||
| 1224 | BN_set_params 1248 EXIST::FUNCTION:DEPRECATED | ||
| 1225 | BN_get_params 1249 EXIST::FUNCTION:DEPRECATED | ||
| 1226 | BIO_get_ex_num 1250 NOEXIST::FUNCTION: | ||
| 1227 | BIO_set_ex_free_func 1251 NOEXIST::FUNCTION: | ||
| 1228 | EVP_ripemd160 1252 EXIST::FUNCTION:RIPEMD | ||
| 1229 | ASN1_TIME_set 1253 EXIST::FUNCTION: | ||
| 1230 | i2d_AUTHORITY_KEYID 1254 EXIST::FUNCTION: | ||
| 1231 | d2i_AUTHORITY_KEYID 1255 EXIST::FUNCTION: | ||
| 1232 | AUTHORITY_KEYID_new 1256 EXIST::FUNCTION: | ||
| 1233 | AUTHORITY_KEYID_free 1257 EXIST::FUNCTION: | ||
| 1234 | ASN1_seq_unpack 1258 EXIST::FUNCTION: | ||
| 1235 | ASN1_seq_pack 1259 EXIST::FUNCTION: | ||
| 1236 | ASN1_unpack_string 1260 EXIST::FUNCTION: | ||
| 1237 | ASN1_pack_string 1261 EXIST::FUNCTION: | ||
| 1238 | PKCS12_pack_safebag 1262 NOEXIST::FUNCTION: | ||
| 1239 | PKCS12_MAKE_KEYBAG 1263 EXIST::FUNCTION: | ||
| 1240 | PKCS8_encrypt 1264 EXIST::FUNCTION: | ||
| 1241 | PKCS12_MAKE_SHKEYBAG 1265 EXIST::FUNCTION: | ||
| 1242 | PKCS12_pack_p7data 1266 EXIST::FUNCTION: | ||
| 1243 | PKCS12_pack_p7encdata 1267 EXIST::FUNCTION: | ||
| 1244 | PKCS12_add_localkeyid 1268 EXIST::FUNCTION: | ||
| 1245 | PKCS12_add_friendlyname_asc 1269 EXIST::FUNCTION: | ||
| 1246 | PKCS12_add_friendlyname_uni 1270 EXIST::FUNCTION: | ||
| 1247 | PKCS12_get_friendlyname 1271 EXIST::FUNCTION: | ||
| 1248 | PKCS12_pbe_crypt 1272 EXIST::FUNCTION: | ||
| 1249 | PKCS12_decrypt_d2i 1273 NOEXIST::FUNCTION: | ||
| 1250 | PKCS12_i2d_encrypt 1274 NOEXIST::FUNCTION: | ||
| 1251 | PKCS12_init 1275 EXIST::FUNCTION: | ||
| 1252 | PKCS12_key_gen_asc 1276 EXIST::FUNCTION: | ||
| 1253 | PKCS12_key_gen_uni 1277 EXIST::FUNCTION: | ||
| 1254 | PKCS12_gen_mac 1278 EXIST::FUNCTION: | ||
| 1255 | PKCS12_verify_mac 1279 EXIST::FUNCTION: | ||
| 1256 | PKCS12_set_mac 1280 EXIST::FUNCTION: | ||
| 1257 | PKCS12_setup_mac 1281 EXIST::FUNCTION: | ||
| 1258 | OPENSSL_asc2uni 1282 EXIST::FUNCTION: | ||
| 1259 | OPENSSL_uni2asc 1283 EXIST::FUNCTION: | ||
| 1260 | i2d_PKCS12_BAGS 1284 EXIST::FUNCTION: | ||
| 1261 | PKCS12_BAGS_new 1285 EXIST::FUNCTION: | ||
| 1262 | d2i_PKCS12_BAGS 1286 EXIST::FUNCTION: | ||
| 1263 | PKCS12_BAGS_free 1287 EXIST::FUNCTION: | ||
| 1264 | i2d_PKCS12 1288 EXIST::FUNCTION: | ||
| 1265 | d2i_PKCS12 1289 EXIST::FUNCTION: | ||
| 1266 | PKCS12_new 1290 EXIST::FUNCTION: | ||
| 1267 | PKCS12_free 1291 EXIST::FUNCTION: | ||
| 1268 | i2d_PKCS12_MAC_DATA 1292 EXIST::FUNCTION: | ||
| 1269 | PKCS12_MAC_DATA_new 1293 EXIST::FUNCTION: | ||
| 1270 | d2i_PKCS12_MAC_DATA 1294 EXIST::FUNCTION: | ||
| 1271 | PKCS12_MAC_DATA_free 1295 EXIST::FUNCTION: | ||
| 1272 | i2d_PKCS12_SAFEBAG 1296 EXIST::FUNCTION: | ||
| 1273 | PKCS12_SAFEBAG_new 1297 EXIST::FUNCTION: | ||
| 1274 | d2i_PKCS12_SAFEBAG 1298 EXIST::FUNCTION: | ||
| 1275 | PKCS12_SAFEBAG_free 1299 EXIST::FUNCTION: | ||
| 1276 | ERR_load_PKCS12_strings 1300 EXIST::FUNCTION: | ||
| 1277 | PKCS12_PBE_add 1301 EXIST::FUNCTION: | ||
| 1278 | PKCS8_add_keyusage 1302 EXIST::FUNCTION: | ||
| 1279 | PKCS12_get_attr_gen 1303 EXIST::FUNCTION: | ||
| 1280 | PKCS12_parse 1304 EXIST::FUNCTION: | ||
| 1281 | PKCS12_create 1305 EXIST::FUNCTION: | ||
| 1282 | i2d_PKCS12_bio 1306 EXIST::FUNCTION: | ||
| 1283 | i2d_PKCS12_fp 1307 EXIST::FUNCTION: | ||
| 1284 | d2i_PKCS12_bio 1308 EXIST::FUNCTION: | ||
| 1285 | d2i_PKCS12_fp 1309 EXIST::FUNCTION: | ||
| 1286 | i2d_PBEPARAM 1310 EXIST::FUNCTION: | ||
| 1287 | PBEPARAM_new 1311 EXIST::FUNCTION: | ||
| 1288 | d2i_PBEPARAM 1312 EXIST::FUNCTION: | ||
| 1289 | PBEPARAM_free 1313 EXIST::FUNCTION: | ||
| 1290 | i2d_PKCS8_PRIV_KEY_INFO 1314 EXIST::FUNCTION: | ||
| 1291 | PKCS8_PRIV_KEY_INFO_new 1315 EXIST::FUNCTION: | ||
| 1292 | d2i_PKCS8_PRIV_KEY_INFO 1316 EXIST::FUNCTION: | ||
| 1293 | PKCS8_PRIV_KEY_INFO_free 1317 EXIST::FUNCTION: | ||
| 1294 | EVP_PKCS82PKEY 1318 EXIST::FUNCTION: | ||
| 1295 | EVP_PKEY2PKCS8 1319 EXIST::FUNCTION: | ||
| 1296 | PKCS8_set_broken 1320 EXIST::FUNCTION: | ||
| 1297 | EVP_PBE_ALGOR_CipherInit 1321 NOEXIST::FUNCTION: | ||
| 1298 | EVP_PBE_alg_add 1322 EXIST::FUNCTION: | ||
| 1299 | PKCS5_pbe_set 1323 EXIST::FUNCTION: | ||
| 1300 | EVP_PBE_cleanup 1324 EXIST::FUNCTION: | ||
| 1301 | i2d_SXNET 1325 EXIST::FUNCTION: | ||
| 1302 | d2i_SXNET 1326 EXIST::FUNCTION: | ||
| 1303 | SXNET_new 1327 EXIST::FUNCTION: | ||
| 1304 | SXNET_free 1328 EXIST::FUNCTION: | ||
| 1305 | i2d_SXNETID 1329 EXIST::FUNCTION: | ||
| 1306 | d2i_SXNETID 1330 EXIST::FUNCTION: | ||
| 1307 | SXNETID_new 1331 EXIST::FUNCTION: | ||
| 1308 | SXNETID_free 1332 EXIST::FUNCTION: | ||
| 1309 | DSA_SIG_new 1333 EXIST::FUNCTION:DSA | ||
| 1310 | DSA_SIG_free 1334 EXIST::FUNCTION:DSA | ||
| 1311 | DSA_do_sign 1335 EXIST::FUNCTION:DSA | ||
| 1312 | DSA_do_verify 1336 EXIST::FUNCTION:DSA | ||
| 1313 | d2i_DSA_SIG 1337 EXIST::FUNCTION:DSA | ||
| 1314 | i2d_DSA_SIG 1338 EXIST::FUNCTION:DSA | ||
| 1315 | i2d_ASN1_VISIBLESTRING 1339 EXIST::FUNCTION: | ||
| 1316 | d2i_ASN1_VISIBLESTRING 1340 EXIST::FUNCTION: | ||
| 1317 | i2d_ASN1_UTF8STRING 1341 EXIST::FUNCTION: | ||
| 1318 | d2i_ASN1_UTF8STRING 1342 EXIST::FUNCTION: | ||
| 1319 | i2d_DIRECTORYSTRING 1343 EXIST::FUNCTION: | ||
| 1320 | d2i_DIRECTORYSTRING 1344 EXIST::FUNCTION: | ||
| 1321 | i2d_DISPLAYTEXT 1345 EXIST::FUNCTION: | ||
| 1322 | d2i_DISPLAYTEXT 1346 EXIST::FUNCTION: | ||
| 1323 | d2i_ASN1_SET_OF_X509 1379 NOEXIST::FUNCTION: | ||
| 1324 | i2d_ASN1_SET_OF_X509 1380 NOEXIST::FUNCTION: | ||
| 1325 | i2d_PBKDF2PARAM 1397 EXIST::FUNCTION: | ||
| 1326 | PBKDF2PARAM_new 1398 EXIST::FUNCTION: | ||
| 1327 | d2i_PBKDF2PARAM 1399 EXIST::FUNCTION: | ||
| 1328 | PBKDF2PARAM_free 1400 EXIST::FUNCTION: | ||
| 1329 | i2d_PBE2PARAM 1401 EXIST::FUNCTION: | ||
| 1330 | PBE2PARAM_new 1402 EXIST::FUNCTION: | ||
| 1331 | d2i_PBE2PARAM 1403 EXIST::FUNCTION: | ||
| 1332 | PBE2PARAM_free 1404 EXIST::FUNCTION: | ||
| 1333 | d2i_ASN1_SET_OF_GENERAL_NAME 1421 NOEXIST::FUNCTION: | ||
| 1334 | i2d_ASN1_SET_OF_GENERAL_NAME 1422 NOEXIST::FUNCTION: | ||
| 1335 | d2i_ASN1_SET_OF_SXNETID 1439 NOEXIST::FUNCTION: | ||
| 1336 | i2d_ASN1_SET_OF_SXNETID 1440 NOEXIST::FUNCTION: | ||
| 1337 | d2i_ASN1_SET_OF_POLICYQUALINFO 1457 NOEXIST::FUNCTION: | ||
| 1338 | i2d_ASN1_SET_OF_POLICYQUALINFO 1458 NOEXIST::FUNCTION: | ||
| 1339 | d2i_ASN1_SET_OF_POLICYINFO 1475 NOEXIST::FUNCTION: | ||
| 1340 | i2d_ASN1_SET_OF_POLICYINFO 1476 NOEXIST::FUNCTION: | ||
| 1341 | SXNET_add_id_asc 1477 EXIST::FUNCTION: | ||
| 1342 | SXNET_add_id_ulong 1478 EXIST::FUNCTION: | ||
| 1343 | SXNET_add_id_INTEGER 1479 EXIST::FUNCTION: | ||
| 1344 | SXNET_get_id_asc 1480 EXIST::FUNCTION: | ||
| 1345 | SXNET_get_id_ulong 1481 EXIST::FUNCTION: | ||
| 1346 | SXNET_get_id_INTEGER 1482 EXIST::FUNCTION: | ||
| 1347 | X509V3_set_conf_lhash 1483 EXIST::FUNCTION: | ||
| 1348 | i2d_CERTIFICATEPOLICIES 1484 EXIST::FUNCTION: | ||
| 1349 | CERTIFICATEPOLICIES_new 1485 EXIST::FUNCTION: | ||
| 1350 | CERTIFICATEPOLICIES_free 1486 EXIST::FUNCTION: | ||
| 1351 | d2i_CERTIFICATEPOLICIES 1487 EXIST::FUNCTION: | ||
| 1352 | i2d_POLICYINFO 1488 EXIST::FUNCTION: | ||
| 1353 | POLICYINFO_new 1489 EXIST::FUNCTION: | ||
| 1354 | d2i_POLICYINFO 1490 EXIST::FUNCTION: | ||
| 1355 | POLICYINFO_free 1491 EXIST::FUNCTION: | ||
| 1356 | i2d_POLICYQUALINFO 1492 EXIST::FUNCTION: | ||
| 1357 | POLICYQUALINFO_new 1493 EXIST::FUNCTION: | ||
| 1358 | d2i_POLICYQUALINFO 1494 EXIST::FUNCTION: | ||
| 1359 | POLICYQUALINFO_free 1495 EXIST::FUNCTION: | ||
| 1360 | i2d_USERNOTICE 1496 EXIST::FUNCTION: | ||
| 1361 | USERNOTICE_new 1497 EXIST::FUNCTION: | ||
| 1362 | d2i_USERNOTICE 1498 EXIST::FUNCTION: | ||
| 1363 | USERNOTICE_free 1499 EXIST::FUNCTION: | ||
| 1364 | i2d_NOTICEREF 1500 EXIST::FUNCTION: | ||
| 1365 | NOTICEREF_new 1501 EXIST::FUNCTION: | ||
| 1366 | d2i_NOTICEREF 1502 EXIST::FUNCTION: | ||
| 1367 | NOTICEREF_free 1503 EXIST::FUNCTION: | ||
| 1368 | X509V3_get_string 1504 EXIST::FUNCTION: | ||
| 1369 | X509V3_get_section 1505 EXIST::FUNCTION: | ||
| 1370 | X509V3_string_free 1506 EXIST::FUNCTION: | ||
| 1371 | X509V3_section_free 1507 EXIST::FUNCTION: | ||
| 1372 | X509V3_set_ctx 1508 EXIST::FUNCTION: | ||
| 1373 | s2i_ASN1_INTEGER 1509 EXIST::FUNCTION: | ||
| 1374 | CRYPTO_set_locked_mem_functions 1510 EXIST::FUNCTION: | ||
| 1375 | CRYPTO_get_locked_mem_functions 1511 EXIST::FUNCTION: | ||
| 1376 | CRYPTO_malloc_locked 1512 EXIST::FUNCTION: | ||
| 1377 | CRYPTO_free_locked 1513 EXIST::FUNCTION: | ||
| 1378 | BN_mod_exp2_mont 1514 EXIST::FUNCTION: | ||
| 1379 | ERR_get_error_line_data 1515 EXIST::FUNCTION: | ||
| 1380 | ERR_peek_error_line_data 1516 EXIST::FUNCTION: | ||
| 1381 | PKCS12_PBE_keyivgen 1517 EXIST::FUNCTION: | ||
| 1382 | X509_ALGOR_dup 1518 EXIST::FUNCTION: | ||
| 1383 | d2i_ASN1_SET_OF_DIST_POINT 1535 NOEXIST::FUNCTION: | ||
| 1384 | i2d_ASN1_SET_OF_DIST_POINT 1536 NOEXIST::FUNCTION: | ||
| 1385 | i2d_CRL_DIST_POINTS 1537 EXIST::FUNCTION: | ||
| 1386 | CRL_DIST_POINTS_new 1538 EXIST::FUNCTION: | ||
| 1387 | CRL_DIST_POINTS_free 1539 EXIST::FUNCTION: | ||
| 1388 | d2i_CRL_DIST_POINTS 1540 EXIST::FUNCTION: | ||
| 1389 | i2d_DIST_POINT 1541 EXIST::FUNCTION: | ||
| 1390 | DIST_POINT_new 1542 EXIST::FUNCTION: | ||
| 1391 | d2i_DIST_POINT 1543 EXIST::FUNCTION: | ||
| 1392 | DIST_POINT_free 1544 EXIST::FUNCTION: | ||
| 1393 | i2d_DIST_POINT_NAME 1545 EXIST::FUNCTION: | ||
| 1394 | DIST_POINT_NAME_new 1546 EXIST::FUNCTION: | ||
| 1395 | DIST_POINT_NAME_free 1547 EXIST::FUNCTION: | ||
| 1396 | d2i_DIST_POINT_NAME 1548 EXIST::FUNCTION: | ||
| 1397 | X509V3_add_value_uchar 1549 EXIST::FUNCTION: | ||
| 1398 | d2i_ASN1_SET_OF_X509_ATTRIBUTE 1555 NOEXIST::FUNCTION: | ||
| 1399 | i2d_ASN1_SET_OF_ASN1_TYPE 1560 NOEXIST::FUNCTION: | ||
| 1400 | d2i_ASN1_SET_OF_X509_EXTENSION 1567 NOEXIST::FUNCTION: | ||
| 1401 | d2i_ASN1_SET_OF_X509_NAME_ENTRY 1574 NOEXIST::FUNCTION: | ||
| 1402 | d2i_ASN1_SET_OF_ASN1_TYPE 1589 NOEXIST::FUNCTION: | ||
| 1403 | i2d_ASN1_SET_OF_X509_ATTRIBUTE 1615 NOEXIST::FUNCTION: | ||
| 1404 | i2d_ASN1_SET_OF_X509_EXTENSION 1624 NOEXIST::FUNCTION: | ||
| 1405 | i2d_ASN1_SET_OF_X509_NAME_ENTRY 1633 NOEXIST::FUNCTION: | ||
| 1406 | X509V3_EXT_i2d 1646 EXIST::FUNCTION: | ||
| 1407 | X509V3_EXT_val_prn 1647 EXIST::FUNCTION: | ||
| 1408 | X509V3_EXT_add_list 1648 EXIST::FUNCTION: | ||
| 1409 | EVP_CIPHER_type 1649 EXIST::FUNCTION: | ||
| 1410 | EVP_PBE_CipherInit 1650 EXIST::FUNCTION: | ||
| 1411 | X509V3_add_value_bool_nf 1651 EXIST::FUNCTION: | ||
| 1412 | d2i_ASN1_UINTEGER 1652 EXIST::FUNCTION: | ||
| 1413 | sk_value 1653 EXIST::FUNCTION: | ||
| 1414 | sk_num 1654 EXIST::FUNCTION: | ||
| 1415 | sk_set 1655 EXIST::FUNCTION: | ||
| 1416 | i2d_ASN1_SET_OF_X509_REVOKED 1661 NOEXIST::FUNCTION: | ||
| 1417 | sk_sort 1671 EXIST::FUNCTION: | ||
| 1418 | d2i_ASN1_SET_OF_X509_REVOKED 1674 NOEXIST::FUNCTION: | ||
| 1419 | i2d_ASN1_SET_OF_X509_ALGOR 1682 NOEXIST::FUNCTION: | ||
| 1420 | i2d_ASN1_SET_OF_X509_CRL 1685 NOEXIST::FUNCTION: | ||
| 1421 | d2i_ASN1_SET_OF_X509_ALGOR 1696 NOEXIST::FUNCTION: | ||
| 1422 | d2i_ASN1_SET_OF_X509_CRL 1702 NOEXIST::FUNCTION: | ||
| 1423 | i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO 1723 NOEXIST::FUNCTION: | ||
| 1424 | i2d_ASN1_SET_OF_PKCS7_RECIP_INFO 1738 NOEXIST::FUNCTION: | ||
| 1425 | d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO 1748 NOEXIST::FUNCTION: | ||
| 1426 | d2i_ASN1_SET_OF_PKCS7_RECIP_INFO 1753 NOEXIST::FUNCTION: | ||
| 1427 | PKCS5_PBE_add 1775 EXIST::FUNCTION: | ||
| 1428 | PEM_write_bio_PKCS8 1776 EXIST::FUNCTION: | ||
| 1429 | i2d_PKCS8_fp 1777 EXIST::FUNCTION:FP_API | ||
| 1430 | PEM_read_bio_PKCS8_PRIV_KEY_INFO 1778 EXIST:!VMS:FUNCTION: | ||
| 1431 | PEM_read_bio_P8_PRIV_KEY_INFO 1778 EXIST:VMS:FUNCTION: | ||
| 1432 | d2i_PKCS8_bio 1779 EXIST::FUNCTION:BIO | ||
| 1433 | d2i_PKCS8_PRIV_KEY_INFO_fp 1780 EXIST::FUNCTION:FP_API | ||
| 1434 | PEM_write_bio_PKCS8_PRIV_KEY_INFO 1781 EXIST:!VMS:FUNCTION: | ||
| 1435 | PEM_write_bio_P8_PRIV_KEY_INFO 1781 EXIST:VMS:FUNCTION: | ||
| 1436 | PEM_read_PKCS8 1782 EXIST:!WIN16:FUNCTION: | ||
| 1437 | d2i_PKCS8_PRIV_KEY_INFO_bio 1783 EXIST::FUNCTION:BIO | ||
| 1438 | d2i_PKCS8_fp 1784 EXIST::FUNCTION:FP_API | ||
| 1439 | PEM_write_PKCS8 1785 EXIST:!WIN16:FUNCTION: | ||
| 1440 | PEM_read_PKCS8_PRIV_KEY_INFO 1786 EXIST:!VMS,!WIN16:FUNCTION: | ||
| 1441 | PEM_read_P8_PRIV_KEY_INFO 1786 EXIST:VMS:FUNCTION: | ||
| 1442 | PEM_read_bio_PKCS8 1787 EXIST::FUNCTION: | ||
| 1443 | PEM_write_PKCS8_PRIV_KEY_INFO 1788 EXIST:!VMS,!WIN16:FUNCTION: | ||
| 1444 | PEM_write_P8_PRIV_KEY_INFO 1788 EXIST:VMS:FUNCTION: | ||
| 1445 | PKCS5_PBE_keyivgen 1789 EXIST::FUNCTION: | ||
| 1446 | i2d_PKCS8_bio 1790 EXIST::FUNCTION:BIO | ||
| 1447 | i2d_PKCS8_PRIV_KEY_INFO_fp 1791 EXIST::FUNCTION:FP_API | ||
| 1448 | i2d_PKCS8_PRIV_KEY_INFO_bio 1792 EXIST::FUNCTION:BIO | ||
| 1449 | BIO_s_bio 1793 EXIST::FUNCTION: | ||
| 1450 | PKCS5_pbe2_set 1794 EXIST::FUNCTION: | ||
| 1451 | PKCS5_PBKDF2_HMAC_SHA1 1795 EXIST::FUNCTION: | ||
| 1452 | PKCS5_v2_PBE_keyivgen 1796 EXIST::FUNCTION: | ||
| 1453 | PEM_write_bio_PKCS8PrivateKey 1797 EXIST::FUNCTION: | ||
| 1454 | PEM_write_PKCS8PrivateKey 1798 EXIST::FUNCTION: | ||
| 1455 | BIO_ctrl_get_read_request 1799 EXIST::FUNCTION: | ||
| 1456 | BIO_ctrl_pending 1800 EXIST::FUNCTION: | ||
| 1457 | BIO_ctrl_wpending 1801 EXIST::FUNCTION: | ||
| 1458 | BIO_new_bio_pair 1802 EXIST::FUNCTION: | ||
| 1459 | BIO_ctrl_get_write_guarantee 1803 EXIST::FUNCTION: | ||
| 1460 | CRYPTO_num_locks 1804 EXIST::FUNCTION: | ||
| 1461 | CONF_load_bio 1805 EXIST::FUNCTION: | ||
| 1462 | CONF_load_fp 1806 EXIST::FUNCTION:FP_API | ||
| 1463 | i2d_ASN1_SET_OF_ASN1_OBJECT 1837 NOEXIST::FUNCTION: | ||
| 1464 | d2i_ASN1_SET_OF_ASN1_OBJECT 1844 NOEXIST::FUNCTION: | ||
| 1465 | PKCS7_signatureVerify 1845 EXIST::FUNCTION: | ||
| 1466 | RSA_set_method 1846 EXIST::FUNCTION:RSA | ||
| 1467 | RSA_get_method 1847 EXIST::FUNCTION:RSA | ||
| 1468 | RSA_get_default_method 1848 EXIST::FUNCTION:RSA | ||
| 1469 | RSA_check_key 1869 EXIST::FUNCTION:RSA | ||
| 1470 | OBJ_obj2txt 1870 EXIST::FUNCTION: | ||
| 1471 | DSA_dup_DH 1871 EXIST::FUNCTION:DH,DSA | ||
| 1472 | X509_REQ_get_extensions 1872 EXIST::FUNCTION: | ||
| 1473 | X509_REQ_set_extension_nids 1873 EXIST::FUNCTION: | ||
| 1474 | BIO_nwrite 1874 EXIST::FUNCTION: | ||
| 1475 | X509_REQ_extension_nid 1875 EXIST::FUNCTION: | ||
| 1476 | BIO_nread 1876 EXIST::FUNCTION: | ||
| 1477 | X509_REQ_get_extension_nids 1877 EXIST::FUNCTION: | ||
| 1478 | BIO_nwrite0 1878 EXIST::FUNCTION: | ||
| 1479 | X509_REQ_add_extensions_nid 1879 EXIST::FUNCTION: | ||
| 1480 | BIO_nread0 1880 EXIST::FUNCTION: | ||
| 1481 | X509_REQ_add_extensions 1881 EXIST::FUNCTION: | ||
| 1482 | BIO_new_mem_buf 1882 EXIST::FUNCTION: | ||
| 1483 | DH_set_ex_data 1883 EXIST::FUNCTION:DH | ||
| 1484 | DH_set_method 1884 EXIST::FUNCTION:DH | ||
| 1485 | DSA_OpenSSL 1885 EXIST::FUNCTION:DSA | ||
| 1486 | DH_get_ex_data 1886 EXIST::FUNCTION:DH | ||
| 1487 | DH_get_ex_new_index 1887 EXIST::FUNCTION:DH | ||
| 1488 | DSA_new_method 1888 EXIST::FUNCTION:DSA | ||
| 1489 | DH_new_method 1889 EXIST::FUNCTION:DH | ||
| 1490 | DH_OpenSSL 1890 EXIST::FUNCTION:DH | ||
| 1491 | DSA_get_ex_new_index 1891 EXIST::FUNCTION:DSA | ||
| 1492 | DH_get_default_method 1892 EXIST::FUNCTION:DH | ||
| 1493 | DSA_set_ex_data 1893 EXIST::FUNCTION:DSA | ||
| 1494 | DH_set_default_method 1894 EXIST::FUNCTION:DH | ||
| 1495 | DSA_get_ex_data 1895 EXIST::FUNCTION:DSA | ||
| 1496 | X509V3_EXT_REQ_add_conf 1896 EXIST::FUNCTION: | ||
| 1497 | NETSCAPE_SPKI_print 1897 EXIST::FUNCTION:EVP | ||
| 1498 | NETSCAPE_SPKI_set_pubkey 1898 EXIST::FUNCTION:EVP | ||
| 1499 | NETSCAPE_SPKI_b64_encode 1899 EXIST::FUNCTION:EVP | ||
| 1500 | NETSCAPE_SPKI_get_pubkey 1900 EXIST::FUNCTION:EVP | ||
| 1501 | NETSCAPE_SPKI_b64_decode 1901 EXIST::FUNCTION:EVP | ||
| 1502 | UTF8_putc 1902 EXIST::FUNCTION: | ||
| 1503 | UTF8_getc 1903 EXIST::FUNCTION: | ||
| 1504 | RSA_null_method 1904 EXIST::FUNCTION:RSA | ||
| 1505 | ASN1_tag2str 1905 EXIST::FUNCTION: | ||
| 1506 | BIO_ctrl_reset_read_request 1906 EXIST::FUNCTION: | ||
| 1507 | DISPLAYTEXT_new 1907 EXIST::FUNCTION: | ||
| 1508 | ASN1_GENERALIZEDTIME_free 1908 EXIST::FUNCTION: | ||
| 1509 | X509_REVOKED_get_ext_d2i 1909 EXIST::FUNCTION: | ||
| 1510 | X509_set_ex_data 1910 EXIST::FUNCTION: | ||
| 1511 | X509_reject_set_bit_asc 1911 NOEXIST::FUNCTION: | ||
| 1512 | X509_NAME_add_entry_by_txt 1912 EXIST::FUNCTION: | ||
| 1513 | X509_NAME_add_entry_by_NID 1914 EXIST::FUNCTION: | ||
| 1514 | X509_PURPOSE_get0 1915 EXIST::FUNCTION: | ||
| 1515 | PEM_read_X509_AUX 1917 EXIST:!WIN16:FUNCTION: | ||
| 1516 | d2i_AUTHORITY_INFO_ACCESS 1918 EXIST::FUNCTION: | ||
| 1517 | PEM_write_PUBKEY 1921 EXIST:!WIN16:FUNCTION: | ||
| 1518 | ACCESS_DESCRIPTION_new 1925 EXIST::FUNCTION: | ||
| 1519 | X509_CERT_AUX_free 1926 EXIST::FUNCTION: | ||
| 1520 | d2i_ACCESS_DESCRIPTION 1927 EXIST::FUNCTION: | ||
| 1521 | X509_trust_clear 1928 EXIST::FUNCTION: | ||
| 1522 | X509_TRUST_add 1931 EXIST::FUNCTION: | ||
| 1523 | ASN1_VISIBLESTRING_new 1932 EXIST::FUNCTION: | ||
| 1524 | X509_alias_set1 1933 EXIST::FUNCTION: | ||
| 1525 | ASN1_PRINTABLESTRING_free 1934 EXIST::FUNCTION: | ||
| 1526 | EVP_PKEY_get1_DSA 1935 EXIST::FUNCTION:DSA | ||
| 1527 | ASN1_BMPSTRING_new 1936 EXIST::FUNCTION: | ||
| 1528 | ASN1_mbstring_copy 1937 EXIST::FUNCTION: | ||
| 1529 | ASN1_UTF8STRING_new 1938 EXIST::FUNCTION: | ||
| 1530 | DSA_get_default_method 1941 EXIST::FUNCTION:DSA | ||
| 1531 | i2d_ASN1_SET_OF_ACCESS_DESCRIPTION 1945 NOEXIST::FUNCTION: | ||
| 1532 | ASN1_T61STRING_free 1946 EXIST::FUNCTION: | ||
| 1533 | DSA_set_method 1949 EXIST::FUNCTION:DSA | ||
| 1534 | X509_get_ex_data 1950 EXIST::FUNCTION: | ||
| 1535 | ASN1_STRING_type 1951 EXIST::FUNCTION: | ||
| 1536 | X509_PURPOSE_get_by_sname 1952 EXIST::FUNCTION: | ||
| 1537 | ASN1_TIME_free 1954 EXIST::FUNCTION: | ||
| 1538 | ASN1_OCTET_STRING_cmp 1955 EXIST::FUNCTION: | ||
| 1539 | ASN1_BIT_STRING_new 1957 EXIST::FUNCTION: | ||
| 1540 | X509_get_ext_d2i 1958 EXIST::FUNCTION: | ||
| 1541 | PEM_read_bio_X509_AUX 1959 EXIST::FUNCTION: | ||
| 1542 | ASN1_STRING_set_default_mask_asc 1960 EXIST:!VMS:FUNCTION: | ||
| 1543 | ASN1_STRING_set_def_mask_asc 1960 EXIST:VMS:FUNCTION: | ||
| 1544 | PEM_write_bio_RSA_PUBKEY 1961 EXIST::FUNCTION:RSA | ||
| 1545 | ASN1_INTEGER_cmp 1963 EXIST::FUNCTION: | ||
| 1546 | d2i_RSA_PUBKEY_fp 1964 EXIST::FUNCTION:FP_API,RSA | ||
| 1547 | X509_trust_set_bit_asc 1967 NOEXIST::FUNCTION: | ||
| 1548 | PEM_write_bio_DSA_PUBKEY 1968 EXIST::FUNCTION:DSA | ||
| 1549 | X509_STORE_CTX_free 1969 EXIST::FUNCTION: | ||
| 1550 | EVP_PKEY_set1_DSA 1970 EXIST::FUNCTION:DSA | ||
| 1551 | i2d_DSA_PUBKEY_fp 1971 EXIST::FUNCTION:DSA,FP_API | ||
| 1552 | X509_load_cert_crl_file 1972 EXIST::FUNCTION:STDIO | ||
| 1553 | ASN1_TIME_new 1973 EXIST::FUNCTION: | ||
| 1554 | i2d_RSA_PUBKEY 1974 EXIST::FUNCTION:RSA | ||
| 1555 | X509_STORE_CTX_purpose_inherit 1976 EXIST::FUNCTION: | ||
| 1556 | PEM_read_RSA_PUBKEY 1977 EXIST:!WIN16:FUNCTION:RSA | ||
| 1557 | d2i_X509_AUX 1980 EXIST::FUNCTION: | ||
| 1558 | i2d_DSA_PUBKEY 1981 EXIST::FUNCTION:DSA | ||
| 1559 | X509_CERT_AUX_print 1982 EXIST::FUNCTION:BIO | ||
| 1560 | PEM_read_DSA_PUBKEY 1984 EXIST:!WIN16:FUNCTION:DSA | ||
| 1561 | i2d_RSA_PUBKEY_bio 1985 EXIST::FUNCTION:BIO,RSA | ||
| 1562 | ASN1_BIT_STRING_num_asc 1986 EXIST::FUNCTION: | ||
| 1563 | i2d_PUBKEY 1987 EXIST::FUNCTION: | ||
| 1564 | ASN1_UTCTIME_free 1988 EXIST::FUNCTION: | ||
| 1565 | DSA_set_default_method 1989 EXIST::FUNCTION:DSA | ||
| 1566 | X509_PURPOSE_get_by_id 1990 EXIST::FUNCTION: | ||
| 1567 | ACCESS_DESCRIPTION_free 1994 EXIST::FUNCTION: | ||
| 1568 | PEM_read_bio_PUBKEY 1995 EXIST::FUNCTION: | ||
| 1569 | ASN1_STRING_set_by_NID 1996 EXIST::FUNCTION: | ||
| 1570 | X509_PURPOSE_get_id 1997 EXIST::FUNCTION: | ||
| 1571 | DISPLAYTEXT_free 1998 EXIST::FUNCTION: | ||
| 1572 | OTHERNAME_new 1999 EXIST::FUNCTION: | ||
| 1573 | X509_CERT_AUX_new 2001 EXIST::FUNCTION: | ||
| 1574 | X509_TRUST_cleanup 2007 EXIST::FUNCTION: | ||
| 1575 | X509_NAME_add_entry_by_OBJ 2008 EXIST::FUNCTION: | ||
| 1576 | X509_CRL_get_ext_d2i 2009 EXIST::FUNCTION: | ||
| 1577 | X509_PURPOSE_get0_name 2011 EXIST::FUNCTION: | ||
| 1578 | PEM_read_PUBKEY 2012 EXIST:!WIN16:FUNCTION: | ||
| 1579 | i2d_DSA_PUBKEY_bio 2014 EXIST::FUNCTION:BIO,DSA | ||
| 1580 | i2d_OTHERNAME 2015 EXIST::FUNCTION: | ||
| 1581 | ASN1_OCTET_STRING_free 2016 EXIST::FUNCTION: | ||
| 1582 | ASN1_BIT_STRING_set_asc 2017 EXIST::FUNCTION: | ||
| 1583 | X509_get_ex_new_index 2019 EXIST::FUNCTION: | ||
| 1584 | ASN1_STRING_TABLE_cleanup 2020 EXIST::FUNCTION: | ||
| 1585 | X509_TRUST_get_by_id 2021 EXIST::FUNCTION: | ||
| 1586 | X509_PURPOSE_get_trust 2022 EXIST::FUNCTION: | ||
| 1587 | ASN1_STRING_length 2023 EXIST::FUNCTION: | ||
| 1588 | d2i_ASN1_SET_OF_ACCESS_DESCRIPTION 2024 NOEXIST::FUNCTION: | ||
| 1589 | ASN1_PRINTABLESTRING_new 2025 EXIST::FUNCTION: | ||
| 1590 | X509V3_get_d2i 2026 EXIST::FUNCTION: | ||
| 1591 | ASN1_ENUMERATED_free 2027 EXIST::FUNCTION: | ||
| 1592 | i2d_X509_CERT_AUX 2028 EXIST::FUNCTION: | ||
| 1593 | X509_STORE_CTX_set_trust 2030 EXIST::FUNCTION: | ||
| 1594 | ASN1_STRING_set_default_mask 2032 EXIST::FUNCTION: | ||
| 1595 | X509_STORE_CTX_new 2033 EXIST::FUNCTION: | ||
| 1596 | EVP_PKEY_get1_RSA 2034 EXIST::FUNCTION:RSA | ||
| 1597 | DIRECTORYSTRING_free 2038 EXIST::FUNCTION: | ||
| 1598 | PEM_write_X509_AUX 2039 EXIST:!WIN16:FUNCTION: | ||
| 1599 | ASN1_OCTET_STRING_set 2040 EXIST::FUNCTION: | ||
| 1600 | d2i_DSA_PUBKEY_fp 2041 EXIST::FUNCTION:DSA,FP_API | ||
| 1601 | d2i_RSA_PUBKEY 2044 EXIST::FUNCTION:RSA | ||
| 1602 | X509_TRUST_get0_name 2046 EXIST::FUNCTION: | ||
| 1603 | X509_TRUST_get0 2047 EXIST::FUNCTION: | ||
| 1604 | AUTHORITY_INFO_ACCESS_free 2048 EXIST::FUNCTION: | ||
| 1605 | ASN1_IA5STRING_new 2049 EXIST::FUNCTION: | ||
| 1606 | d2i_DSA_PUBKEY 2050 EXIST::FUNCTION:DSA | ||
| 1607 | X509_check_purpose 2051 EXIST::FUNCTION: | ||
| 1608 | ASN1_ENUMERATED_new 2052 EXIST::FUNCTION: | ||
| 1609 | d2i_RSA_PUBKEY_bio 2053 EXIST::FUNCTION:BIO,RSA | ||
| 1610 | d2i_PUBKEY 2054 EXIST::FUNCTION: | ||
| 1611 | X509_TRUST_get_trust 2055 EXIST::FUNCTION: | ||
| 1612 | X509_TRUST_get_flags 2056 EXIST::FUNCTION: | ||
| 1613 | ASN1_BMPSTRING_free 2057 EXIST::FUNCTION: | ||
| 1614 | ASN1_T61STRING_new 2058 EXIST::FUNCTION: | ||
| 1615 | ASN1_UTCTIME_new 2060 EXIST::FUNCTION: | ||
| 1616 | i2d_AUTHORITY_INFO_ACCESS 2062 EXIST::FUNCTION: | ||
| 1617 | EVP_PKEY_set1_RSA 2063 EXIST::FUNCTION:RSA | ||
| 1618 | X509_STORE_CTX_set_purpose 2064 EXIST::FUNCTION: | ||
| 1619 | ASN1_IA5STRING_free 2065 EXIST::FUNCTION: | ||
| 1620 | PEM_write_bio_X509_AUX 2066 EXIST::FUNCTION: | ||
| 1621 | X509_PURPOSE_get_count 2067 EXIST::FUNCTION: | ||
| 1622 | CRYPTO_add_info 2068 NOEXIST::FUNCTION: | ||
| 1623 | X509_NAME_ENTRY_create_by_txt 2071 EXIST::FUNCTION: | ||
| 1624 | ASN1_STRING_get_default_mask 2072 EXIST::FUNCTION: | ||
| 1625 | X509_alias_get0 2074 EXIST::FUNCTION: | ||
| 1626 | ASN1_STRING_data 2075 EXIST::FUNCTION: | ||
| 1627 | i2d_ACCESS_DESCRIPTION 2077 EXIST::FUNCTION: | ||
| 1628 | X509_trust_set_bit 2078 NOEXIST::FUNCTION: | ||
| 1629 | ASN1_BIT_STRING_free 2080 EXIST::FUNCTION: | ||
| 1630 | PEM_read_bio_RSA_PUBKEY 2081 EXIST::FUNCTION:RSA | ||
| 1631 | X509_add1_reject_object 2082 EXIST::FUNCTION: | ||
| 1632 | X509_check_trust 2083 EXIST::FUNCTION: | ||
| 1633 | PEM_read_bio_DSA_PUBKEY 2088 EXIST::FUNCTION:DSA | ||
| 1634 | X509_PURPOSE_add 2090 EXIST::FUNCTION: | ||
| 1635 | ASN1_STRING_TABLE_get 2091 EXIST::FUNCTION: | ||
| 1636 | ASN1_UTF8STRING_free 2092 EXIST::FUNCTION: | ||
| 1637 | d2i_DSA_PUBKEY_bio 2093 EXIST::FUNCTION:BIO,DSA | ||
| 1638 | PEM_write_RSA_PUBKEY 2095 EXIST:!WIN16:FUNCTION:RSA | ||
| 1639 | d2i_OTHERNAME 2096 EXIST::FUNCTION: | ||
| 1640 | X509_reject_set_bit 2098 NOEXIST::FUNCTION: | ||
| 1641 | PEM_write_DSA_PUBKEY 2101 EXIST:!WIN16:FUNCTION:DSA | ||
| 1642 | X509_PURPOSE_get0_sname 2105 EXIST::FUNCTION: | ||
| 1643 | EVP_PKEY_set1_DH 2107 EXIST::FUNCTION:DH | ||
| 1644 | ASN1_OCTET_STRING_dup 2108 EXIST::FUNCTION: | ||
| 1645 | ASN1_BIT_STRING_set 2109 EXIST::FUNCTION: | ||
| 1646 | X509_TRUST_get_count 2110 EXIST::FUNCTION: | ||
| 1647 | ASN1_INTEGER_free 2111 EXIST::FUNCTION: | ||
| 1648 | OTHERNAME_free 2112 EXIST::FUNCTION: | ||
| 1649 | i2d_RSA_PUBKEY_fp 2113 EXIST::FUNCTION:FP_API,RSA | ||
| 1650 | ASN1_INTEGER_dup 2114 EXIST::FUNCTION: | ||
| 1651 | d2i_X509_CERT_AUX 2115 EXIST::FUNCTION: | ||
| 1652 | PEM_write_bio_PUBKEY 2117 EXIST::FUNCTION: | ||
| 1653 | ASN1_VISIBLESTRING_free 2118 EXIST::FUNCTION: | ||
| 1654 | X509_PURPOSE_cleanup 2119 EXIST::FUNCTION: | ||
| 1655 | ASN1_mbstring_ncopy 2123 EXIST::FUNCTION: | ||
| 1656 | ASN1_GENERALIZEDTIME_new 2126 EXIST::FUNCTION: | ||
| 1657 | EVP_PKEY_get1_DH 2128 EXIST::FUNCTION:DH | ||
| 1658 | ASN1_OCTET_STRING_new 2130 EXIST::FUNCTION: | ||
| 1659 | ASN1_INTEGER_new 2131 EXIST::FUNCTION: | ||
| 1660 | i2d_X509_AUX 2132 EXIST::FUNCTION: | ||
| 1661 | ASN1_BIT_STRING_name_print 2134 EXIST::FUNCTION:BIO | ||
| 1662 | X509_cmp 2135 EXIST::FUNCTION: | ||
| 1663 | ASN1_STRING_length_set 2136 EXIST::FUNCTION: | ||
| 1664 | DIRECTORYSTRING_new 2137 EXIST::FUNCTION: | ||
| 1665 | X509_add1_trust_object 2140 EXIST::FUNCTION: | ||
| 1666 | PKCS12_newpass 2141 EXIST::FUNCTION: | ||
| 1667 | SMIME_write_PKCS7 2142 EXIST::FUNCTION: | ||
| 1668 | SMIME_read_PKCS7 2143 EXIST::FUNCTION: | ||
| 1669 | DES_set_key_checked 2144 EXIST::FUNCTION:DES | ||
| 1670 | PKCS7_verify 2145 EXIST::FUNCTION: | ||
| 1671 | PKCS7_encrypt 2146 EXIST::FUNCTION: | ||
| 1672 | DES_set_key_unchecked 2147 EXIST::FUNCTION:DES | ||
| 1673 | SMIME_crlf_copy 2148 EXIST::FUNCTION: | ||
| 1674 | i2d_ASN1_PRINTABLESTRING 2149 EXIST::FUNCTION: | ||
| 1675 | PKCS7_get0_signers 2150 EXIST::FUNCTION: | ||
| 1676 | PKCS7_decrypt 2151 EXIST::FUNCTION: | ||
| 1677 | SMIME_text 2152 EXIST::FUNCTION: | ||
| 1678 | PKCS7_simple_smimecap 2153 EXIST::FUNCTION: | ||
| 1679 | PKCS7_get_smimecap 2154 EXIST::FUNCTION: | ||
| 1680 | PKCS7_sign 2155 EXIST::FUNCTION: | ||
| 1681 | PKCS7_add_attrib_smimecap 2156 EXIST::FUNCTION: | ||
| 1682 | CRYPTO_dbg_set_options 2157 EXIST::FUNCTION: | ||
| 1683 | CRYPTO_remove_all_info 2158 EXIST::FUNCTION: | ||
| 1684 | CRYPTO_get_mem_debug_functions 2159 EXIST::FUNCTION: | ||
| 1685 | CRYPTO_is_mem_check_on 2160 EXIST::FUNCTION: | ||
| 1686 | CRYPTO_set_mem_debug_functions 2161 EXIST::FUNCTION: | ||
| 1687 | CRYPTO_pop_info 2162 EXIST::FUNCTION: | ||
| 1688 | CRYPTO_push_info_ 2163 EXIST::FUNCTION: | ||
| 1689 | CRYPTO_set_mem_debug_options 2164 EXIST::FUNCTION: | ||
| 1690 | PEM_write_PKCS8PrivateKey_nid 2165 EXIST::FUNCTION: | ||
| 1691 | PEM_write_bio_PKCS8PrivateKey_nid 2166 EXIST:!VMS:FUNCTION: | ||
| 1692 | PEM_write_bio_PKCS8PrivKey_nid 2166 EXIST:VMS:FUNCTION: | ||
| 1693 | d2i_PKCS8PrivateKey_bio 2167 EXIST::FUNCTION: | ||
| 1694 | ASN1_NULL_free 2168 EXIST::FUNCTION: | ||
| 1695 | d2i_ASN1_NULL 2169 EXIST::FUNCTION: | ||
| 1696 | ASN1_NULL_new 2170 EXIST::FUNCTION: | ||
| 1697 | i2d_PKCS8PrivateKey_bio 2171 EXIST::FUNCTION: | ||
| 1698 | i2d_PKCS8PrivateKey_fp 2172 EXIST::FUNCTION: | ||
| 1699 | i2d_ASN1_NULL 2173 EXIST::FUNCTION: | ||
| 1700 | i2d_PKCS8PrivateKey_nid_fp 2174 EXIST::FUNCTION: | ||
| 1701 | d2i_PKCS8PrivateKey_fp 2175 EXIST::FUNCTION: | ||
| 1702 | i2d_PKCS8PrivateKey_nid_bio 2176 EXIST::FUNCTION: | ||
| 1703 | i2d_PKCS8PrivateKeyInfo_fp 2177 EXIST::FUNCTION:FP_API | ||
| 1704 | i2d_PKCS8PrivateKeyInfo_bio 2178 EXIST::FUNCTION:BIO | ||
| 1705 | PEM_cb 2179 NOEXIST::FUNCTION: | ||
| 1706 | i2d_PrivateKey_fp 2180 EXIST::FUNCTION:FP_API | ||
| 1707 | d2i_PrivateKey_bio 2181 EXIST::FUNCTION:BIO | ||
| 1708 | d2i_PrivateKey_fp 2182 EXIST::FUNCTION:FP_API | ||
| 1709 | i2d_PrivateKey_bio 2183 EXIST::FUNCTION:BIO | ||
| 1710 | X509_reject_clear 2184 EXIST::FUNCTION: | ||
| 1711 | X509_TRUST_set_default 2185 EXIST::FUNCTION: | ||
| 1712 | d2i_AutoPrivateKey 2186 EXIST::FUNCTION: | ||
| 1713 | X509_ATTRIBUTE_get0_type 2187 EXIST::FUNCTION: | ||
| 1714 | X509_ATTRIBUTE_set1_data 2188 EXIST::FUNCTION: | ||
| 1715 | X509at_get_attr 2189 EXIST::FUNCTION: | ||
| 1716 | X509at_get_attr_count 2190 EXIST::FUNCTION: | ||
| 1717 | X509_ATTRIBUTE_create_by_NID 2191 EXIST::FUNCTION: | ||
| 1718 | X509_ATTRIBUTE_set1_object 2192 EXIST::FUNCTION: | ||
| 1719 | X509_ATTRIBUTE_count 2193 EXIST::FUNCTION: | ||
| 1720 | X509_ATTRIBUTE_create_by_OBJ 2194 EXIST::FUNCTION: | ||
| 1721 | X509_ATTRIBUTE_get0_object 2195 EXIST::FUNCTION: | ||
| 1722 | X509at_get_attr_by_NID 2196 EXIST::FUNCTION: | ||
| 1723 | X509at_add1_attr 2197 EXIST::FUNCTION: | ||
| 1724 | X509_ATTRIBUTE_get0_data 2198 EXIST::FUNCTION: | ||
| 1725 | X509at_delete_attr 2199 EXIST::FUNCTION: | ||
| 1726 | X509at_get_attr_by_OBJ 2200 EXIST::FUNCTION: | ||
| 1727 | RAND_add 2201 EXIST::FUNCTION: | ||
| 1728 | BIO_number_written 2202 EXIST::FUNCTION: | ||
| 1729 | BIO_number_read 2203 EXIST::FUNCTION: | ||
| 1730 | X509_STORE_CTX_get1_chain 2204 EXIST::FUNCTION: | ||
| 1731 | ERR_load_RAND_strings 2205 EXIST::FUNCTION: | ||
| 1732 | RAND_pseudo_bytes 2206 EXIST::FUNCTION: | ||
| 1733 | X509_REQ_get_attr_by_NID 2207 EXIST::FUNCTION: | ||
| 1734 | X509_REQ_get_attr 2208 EXIST::FUNCTION: | ||
| 1735 | X509_REQ_add1_attr_by_NID 2209 EXIST::FUNCTION: | ||
| 1736 | X509_REQ_get_attr_by_OBJ 2210 EXIST::FUNCTION: | ||
| 1737 | X509at_add1_attr_by_NID 2211 EXIST::FUNCTION: | ||
| 1738 | X509_REQ_add1_attr_by_OBJ 2212 EXIST::FUNCTION: | ||
| 1739 | X509_REQ_get_attr_count 2213 EXIST::FUNCTION: | ||
| 1740 | X509_REQ_add1_attr 2214 EXIST::FUNCTION: | ||
| 1741 | X509_REQ_delete_attr 2215 EXIST::FUNCTION: | ||
| 1742 | X509at_add1_attr_by_OBJ 2216 EXIST::FUNCTION: | ||
| 1743 | X509_REQ_add1_attr_by_txt 2217 EXIST::FUNCTION: | ||
| 1744 | X509_ATTRIBUTE_create_by_txt 2218 EXIST::FUNCTION: | ||
| 1745 | X509at_add1_attr_by_txt 2219 EXIST::FUNCTION: | ||
| 1746 | BN_pseudo_rand 2239 EXIST::FUNCTION: | ||
| 1747 | BN_is_prime_fasttest 2240 EXIST::FUNCTION:DEPRECATED | ||
| 1748 | BN_CTX_end 2241 EXIST::FUNCTION: | ||
| 1749 | BN_CTX_start 2242 EXIST::FUNCTION: | ||
| 1750 | BN_CTX_get 2243 EXIST::FUNCTION: | ||
| 1751 | EVP_PKEY2PKCS8_broken 2244 EXIST::FUNCTION: | ||
| 1752 | ASN1_STRING_TABLE_add 2245 EXIST::FUNCTION: | ||
| 1753 | CRYPTO_dbg_get_options 2246 EXIST::FUNCTION: | ||
| 1754 | AUTHORITY_INFO_ACCESS_new 2247 EXIST::FUNCTION: | ||
| 1755 | CRYPTO_get_mem_debug_options 2248 EXIST::FUNCTION: | ||
| 1756 | DES_crypt 2249 EXIST::FUNCTION:DES | ||
| 1757 | PEM_write_bio_X509_REQ_NEW 2250 EXIST::FUNCTION: | ||
| 1758 | PEM_write_X509_REQ_NEW 2251 EXIST:!WIN16:FUNCTION: | ||
| 1759 | BIO_callback_ctrl 2252 EXIST::FUNCTION: | ||
| 1760 | RAND_egd 2253 EXIST::FUNCTION: | ||
| 1761 | RAND_status 2254 EXIST::FUNCTION: | ||
| 1762 | bn_dump1 2255 NOEXIST::FUNCTION: | ||
| 1763 | DES_check_key_parity 2256 EXIST::FUNCTION:DES | ||
| 1764 | lh_num_items 2257 EXIST::FUNCTION: | ||
| 1765 | RAND_event 2258 EXIST:WIN32:FUNCTION: | ||
| 1766 | DSO_new 2259 EXIST::FUNCTION: | ||
| 1767 | DSO_new_method 2260 EXIST::FUNCTION: | ||
| 1768 | DSO_free 2261 EXIST::FUNCTION: | ||
| 1769 | DSO_flags 2262 EXIST::FUNCTION: | ||
| 1770 | DSO_up 2263 NOEXIST::FUNCTION: | ||
| 1771 | DSO_set_default_method 2264 EXIST::FUNCTION: | ||
| 1772 | DSO_get_default_method 2265 EXIST::FUNCTION: | ||
| 1773 | DSO_get_method 2266 EXIST::FUNCTION: | ||
| 1774 | DSO_set_method 2267 EXIST::FUNCTION: | ||
| 1775 | DSO_load 2268 EXIST::FUNCTION: | ||
| 1776 | DSO_bind_var 2269 EXIST::FUNCTION: | ||
| 1777 | DSO_METHOD_null 2270 EXIST::FUNCTION: | ||
| 1778 | DSO_METHOD_openssl 2271 EXIST::FUNCTION: | ||
| 1779 | DSO_METHOD_dlfcn 2272 EXIST::FUNCTION: | ||
| 1780 | DSO_METHOD_win32 2273 EXIST::FUNCTION: | ||
| 1781 | ERR_load_DSO_strings 2274 EXIST::FUNCTION: | ||
| 1782 | DSO_METHOD_dl 2275 EXIST::FUNCTION: | ||
| 1783 | NCONF_load 2276 EXIST::FUNCTION: | ||
| 1784 | NCONF_load_fp 2278 EXIST::FUNCTION:FP_API | ||
| 1785 | NCONF_new 2279 EXIST::FUNCTION: | ||
| 1786 | NCONF_get_string 2280 EXIST::FUNCTION: | ||
| 1787 | NCONF_free 2281 EXIST::FUNCTION: | ||
| 1788 | NCONF_get_number 2282 NOEXIST::FUNCTION: | ||
| 1789 | CONF_dump_fp 2283 EXIST::FUNCTION: | ||
| 1790 | NCONF_load_bio 2284 EXIST::FUNCTION: | ||
| 1791 | NCONF_dump_fp 2285 EXIST::FUNCTION: | ||
| 1792 | NCONF_get_section 2286 EXIST::FUNCTION: | ||
| 1793 | NCONF_dump_bio 2287 EXIST::FUNCTION: | ||
| 1794 | CONF_dump_bio 2288 EXIST::FUNCTION: | ||
| 1795 | NCONF_free_data 2289 EXIST::FUNCTION: | ||
| 1796 | CONF_set_default_method 2290 EXIST::FUNCTION: | ||
| 1797 | ERR_error_string_n 2291 EXIST::FUNCTION: | ||
| 1798 | BIO_snprintf 2292 EXIST::FUNCTION: | ||
| 1799 | DSO_ctrl 2293 EXIST::FUNCTION: | ||
| 1800 | i2d_ASN1_SET_OF_ASN1_INTEGER 2317 NOEXIST::FUNCTION: | ||
| 1801 | i2d_ASN1_SET_OF_PKCS12_SAFEBAG 2320 NOEXIST::FUNCTION: | ||
| 1802 | i2d_ASN1_SET_OF_PKCS7 2328 NOEXIST::FUNCTION: | ||
| 1803 | BIO_vfree 2334 EXIST::FUNCTION: | ||
| 1804 | d2i_ASN1_SET_OF_ASN1_INTEGER 2339 NOEXIST::FUNCTION: | ||
| 1805 | d2i_ASN1_SET_OF_PKCS12_SAFEBAG 2341 NOEXIST::FUNCTION: | ||
| 1806 | ASN1_UTCTIME_get 2350 NOEXIST::FUNCTION: | ||
| 1807 | X509_REQ_digest 2362 EXIST::FUNCTION:EVP | ||
| 1808 | X509_CRL_digest 2391 EXIST::FUNCTION:EVP | ||
| 1809 | d2i_ASN1_SET_OF_PKCS7 2397 NOEXIST::FUNCTION: | ||
| 1810 | EVP_CIPHER_CTX_set_key_length 2399 EXIST::FUNCTION: | ||
| 1811 | EVP_CIPHER_CTX_ctrl 2400 EXIST::FUNCTION: | ||
| 1812 | BN_mod_exp_mont_word 2401 EXIST::FUNCTION: | ||
| 1813 | RAND_egd_bytes 2402 EXIST::FUNCTION: | ||
| 1814 | X509_REQ_get1_email 2403 EXIST::FUNCTION: | ||
| 1815 | X509_get1_email 2404 EXIST::FUNCTION: | ||
| 1816 | X509_email_free 2405 EXIST::FUNCTION: | ||
| 1817 | i2d_RSA_NET 2406 EXIST::FUNCTION:RC4,RSA | ||
| 1818 | d2i_RSA_NET_2 2407 NOEXIST::FUNCTION: | ||
| 1819 | d2i_RSA_NET 2408 EXIST::FUNCTION:RC4,RSA | ||
| 1820 | DSO_bind_func 2409 EXIST::FUNCTION: | ||
| 1821 | CRYPTO_get_new_dynlockid 2410 EXIST::FUNCTION: | ||
| 1822 | sk_new_null 2411 EXIST::FUNCTION: | ||
| 1823 | CRYPTO_set_dynlock_destroy_callback 2412 EXIST:!VMS:FUNCTION: | ||
| 1824 | CRYPTO_set_dynlock_destroy_cb 2412 EXIST:VMS:FUNCTION: | ||
| 1825 | CRYPTO_destroy_dynlockid 2413 EXIST::FUNCTION: | ||
| 1826 | CRYPTO_set_dynlock_size 2414 NOEXIST::FUNCTION: | ||
| 1827 | CRYPTO_set_dynlock_create_callback 2415 EXIST:!VMS:FUNCTION: | ||
| 1828 | CRYPTO_set_dynlock_create_cb 2415 EXIST:VMS:FUNCTION: | ||
| 1829 | CRYPTO_set_dynlock_lock_callback 2416 EXIST:!VMS:FUNCTION: | ||
| 1830 | CRYPTO_set_dynlock_lock_cb 2416 EXIST:VMS:FUNCTION: | ||
| 1831 | CRYPTO_get_dynlock_lock_callback 2417 EXIST:!VMS:FUNCTION: | ||
| 1832 | CRYPTO_get_dynlock_lock_cb 2417 EXIST:VMS:FUNCTION: | ||
| 1833 | CRYPTO_get_dynlock_destroy_callback 2418 EXIST:!VMS:FUNCTION: | ||
| 1834 | CRYPTO_get_dynlock_destroy_cb 2418 EXIST:VMS:FUNCTION: | ||
| 1835 | CRYPTO_get_dynlock_value 2419 EXIST::FUNCTION: | ||
| 1836 | CRYPTO_get_dynlock_create_callback 2420 EXIST:!VMS:FUNCTION: | ||
| 1837 | CRYPTO_get_dynlock_create_cb 2420 EXIST:VMS:FUNCTION: | ||
| 1838 | c2i_ASN1_BIT_STRING 2421 EXIST::FUNCTION: | ||
| 1839 | i2c_ASN1_BIT_STRING 2422 EXIST::FUNCTION: | ||
| 1840 | RAND_poll 2423 EXIST::FUNCTION: | ||
| 1841 | c2i_ASN1_INTEGER 2424 EXIST::FUNCTION: | ||
| 1842 | i2c_ASN1_INTEGER 2425 EXIST::FUNCTION: | ||
| 1843 | BIO_dump_indent 2426 EXIST::FUNCTION: | ||
| 1844 | ASN1_parse_dump 2427 EXIST::FUNCTION:BIO | ||
| 1845 | c2i_ASN1_OBJECT 2428 EXIST::FUNCTION: | ||
| 1846 | X509_NAME_print_ex_fp 2429 EXIST::FUNCTION:FP_API | ||
| 1847 | ASN1_STRING_print_ex_fp 2430 EXIST::FUNCTION:FP_API | ||
| 1848 | X509_NAME_print_ex 2431 EXIST::FUNCTION:BIO | ||
| 1849 | ASN1_STRING_print_ex 2432 EXIST::FUNCTION:BIO | ||
| 1850 | MD4 2433 EXIST::FUNCTION:MD4 | ||
| 1851 | MD4_Transform 2434 EXIST::FUNCTION:MD4 | ||
| 1852 | MD4_Final 2435 EXIST::FUNCTION:MD4 | ||
| 1853 | MD4_Update 2436 EXIST::FUNCTION:MD4 | ||
| 1854 | MD4_Init 2437 EXIST::FUNCTION:MD4 | ||
| 1855 | EVP_md4 2438 EXIST::FUNCTION:MD4 | ||
| 1856 | i2d_PUBKEY_bio 2439 EXIST::FUNCTION:BIO | ||
| 1857 | i2d_PUBKEY_fp 2440 EXIST::FUNCTION:FP_API | ||
| 1858 | d2i_PUBKEY_bio 2441 EXIST::FUNCTION:BIO | ||
| 1859 | ASN1_STRING_to_UTF8 2442 EXIST::FUNCTION: | ||
| 1860 | BIO_vprintf 2443 EXIST::FUNCTION: | ||
| 1861 | BIO_vsnprintf 2444 EXIST::FUNCTION: | ||
| 1862 | d2i_PUBKEY_fp 2445 EXIST::FUNCTION:FP_API | ||
| 1863 | X509_cmp_time 2446 EXIST::FUNCTION: | ||
| 1864 | X509_STORE_CTX_set_time 2447 EXIST::FUNCTION: | ||
| 1865 | X509_STORE_CTX_get1_issuer 2448 EXIST::FUNCTION: | ||
| 1866 | X509_OBJECT_retrieve_match 2449 EXIST::FUNCTION: | ||
| 1867 | X509_OBJECT_idx_by_subject 2450 EXIST::FUNCTION: | ||
| 1868 | X509_STORE_CTX_set_flags 2451 EXIST::FUNCTION: | ||
| 1869 | X509_STORE_CTX_trusted_stack 2452 EXIST::FUNCTION: | ||
| 1870 | X509_time_adj 2453 EXIST::FUNCTION: | ||
| 1871 | X509_check_issued 2454 EXIST::FUNCTION: | ||
| 1872 | ASN1_UTCTIME_cmp_time_t 2455 EXIST::FUNCTION: | ||
| 1873 | DES_set_weak_key_flag 2456 NOEXIST::FUNCTION: | ||
| 1874 | DES_check_key 2457 NOEXIST::FUNCTION: | ||
| 1875 | DES_rw_mode 2458 NOEXIST::FUNCTION: | ||
| 1876 | RSA_PKCS1_RSAref 2459 NOEXIST::FUNCTION: | ||
| 1877 | X509_keyid_set1 2460 EXIST::FUNCTION: | ||
| 1878 | BIO_next 2461 EXIST::FUNCTION: | ||
| 1879 | DSO_METHOD_vms 2462 EXIST::FUNCTION: | ||
| 1880 | BIO_f_linebuffer 2463 EXIST:VMS:FUNCTION: | ||
| 1881 | BN_bntest_rand 2464 EXIST::FUNCTION: | ||
| 1882 | OPENSSL_issetugid 2465 EXIST::FUNCTION: | ||
| 1883 | BN_rand_range 2466 EXIST::FUNCTION: | ||
| 1884 | ERR_load_ENGINE_strings 2467 EXIST::FUNCTION:ENGINE | ||
| 1885 | ENGINE_set_DSA 2468 EXIST::FUNCTION:ENGINE | ||
| 1886 | ENGINE_get_finish_function 2469 EXIST::FUNCTION:ENGINE | ||
| 1887 | ENGINE_get_default_RSA 2470 EXIST::FUNCTION:ENGINE | ||
| 1888 | ENGINE_get_BN_mod_exp 2471 NOEXIST::FUNCTION: | ||
| 1889 | DSA_get_default_openssl_method 2472 NOEXIST::FUNCTION: | ||
| 1890 | ENGINE_set_DH 2473 EXIST::FUNCTION:ENGINE | ||
| 1891 | ENGINE_set_def_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: | ||
| 1892 | ENGINE_set_default_BN_mod_exp_crt 2474 NOEXIST::FUNCTION: | ||
| 1893 | ENGINE_init 2475 EXIST::FUNCTION:ENGINE | ||
| 1894 | DH_get_default_openssl_method 2476 NOEXIST::FUNCTION: | ||
| 1895 | RSA_set_default_openssl_method 2477 NOEXIST::FUNCTION: | ||
| 1896 | ENGINE_finish 2478 EXIST::FUNCTION:ENGINE | ||
| 1897 | ENGINE_load_public_key 2479 EXIST::FUNCTION:ENGINE | ||
| 1898 | ENGINE_get_DH 2480 EXIST::FUNCTION:ENGINE | ||
| 1899 | ENGINE_ctrl 2481 EXIST::FUNCTION:ENGINE | ||
| 1900 | ENGINE_get_init_function 2482 EXIST::FUNCTION:ENGINE | ||
| 1901 | ENGINE_set_init_function 2483 EXIST::FUNCTION:ENGINE | ||
| 1902 | ENGINE_set_default_DSA 2484 EXIST::FUNCTION:ENGINE | ||
| 1903 | ENGINE_get_name 2485 EXIST::FUNCTION:ENGINE | ||
| 1904 | ENGINE_get_last 2486 EXIST::FUNCTION:ENGINE | ||
| 1905 | ENGINE_get_prev 2487 EXIST::FUNCTION:ENGINE | ||
| 1906 | ENGINE_get_default_DH 2488 EXIST::FUNCTION:ENGINE | ||
| 1907 | ENGINE_get_RSA 2489 EXIST::FUNCTION:ENGINE | ||
| 1908 | ENGINE_set_default 2490 EXIST::FUNCTION:ENGINE | ||
| 1909 | ENGINE_get_RAND 2491 EXIST::FUNCTION:ENGINE | ||
| 1910 | ENGINE_get_first 2492 EXIST::FUNCTION:ENGINE | ||
| 1911 | ENGINE_by_id 2493 EXIST::FUNCTION:ENGINE | ||
| 1912 | ENGINE_set_finish_function 2494 EXIST::FUNCTION:ENGINE | ||
| 1913 | ENGINE_get_def_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: | ||
| 1914 | ENGINE_get_default_BN_mod_exp_crt 2495 NOEXIST::FUNCTION: | ||
| 1915 | RSA_get_default_openssl_method 2496 NOEXIST::FUNCTION: | ||
| 1916 | ENGINE_set_RSA 2497 EXIST::FUNCTION:ENGINE | ||
| 1917 | ENGINE_load_private_key 2498 EXIST::FUNCTION:ENGINE | ||
| 1918 | ENGINE_set_default_RAND 2499 EXIST::FUNCTION:ENGINE | ||
| 1919 | ENGINE_set_BN_mod_exp 2500 NOEXIST::FUNCTION: | ||
| 1920 | ENGINE_remove 2501 EXIST::FUNCTION:ENGINE | ||
| 1921 | ENGINE_free 2502 EXIST::FUNCTION:ENGINE | ||
| 1922 | ENGINE_get_BN_mod_exp_crt 2503 NOEXIST::FUNCTION: | ||
| 1923 | ENGINE_get_next 2504 EXIST::FUNCTION:ENGINE | ||
| 1924 | ENGINE_set_name 2505 EXIST::FUNCTION:ENGINE | ||
| 1925 | ENGINE_get_default_DSA 2506 EXIST::FUNCTION:ENGINE | ||
| 1926 | ENGINE_set_default_BN_mod_exp 2507 NOEXIST::FUNCTION: | ||
| 1927 | ENGINE_set_default_RSA 2508 EXIST::FUNCTION:ENGINE | ||
| 1928 | ENGINE_get_default_RAND 2509 EXIST::FUNCTION:ENGINE | ||
| 1929 | ENGINE_get_default_BN_mod_exp 2510 NOEXIST::FUNCTION: | ||
| 1930 | ENGINE_set_RAND 2511 EXIST::FUNCTION:ENGINE | ||
| 1931 | ENGINE_set_id 2512 EXIST::FUNCTION:ENGINE | ||
| 1932 | ENGINE_set_BN_mod_exp_crt 2513 NOEXIST::FUNCTION: | ||
| 1933 | ENGINE_set_default_DH 2514 EXIST::FUNCTION:ENGINE | ||
| 1934 | ENGINE_new 2515 EXIST::FUNCTION:ENGINE | ||
| 1935 | ENGINE_get_id 2516 EXIST::FUNCTION:ENGINE | ||
| 1936 | DSA_set_default_openssl_method 2517 NOEXIST::FUNCTION: | ||
| 1937 | ENGINE_add 2518 EXIST::FUNCTION:ENGINE | ||
| 1938 | DH_set_default_openssl_method 2519 NOEXIST::FUNCTION: | ||
| 1939 | ENGINE_get_DSA 2520 EXIST::FUNCTION:ENGINE | ||
| 1940 | ENGINE_get_ctrl_function 2521 EXIST::FUNCTION:ENGINE | ||
| 1941 | ENGINE_set_ctrl_function 2522 EXIST::FUNCTION:ENGINE | ||
| 1942 | BN_pseudo_rand_range 2523 EXIST::FUNCTION: | ||
| 1943 | X509_STORE_CTX_set_verify_cb 2524 EXIST::FUNCTION: | ||
| 1944 | ERR_load_COMP_strings 2525 EXIST::FUNCTION: | ||
| 1945 | PKCS12_item_decrypt_d2i 2526 EXIST::FUNCTION: | ||
| 1946 | ASN1_UTF8STRING_it 2527 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1947 | ASN1_UTF8STRING_it 2527 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1948 | ENGINE_unregister_ciphers 2528 EXIST::FUNCTION:ENGINE | ||
| 1949 | ENGINE_get_ciphers 2529 EXIST::FUNCTION:ENGINE | ||
| 1950 | d2i_OCSP_BASICRESP 2530 EXIST::FUNCTION: | ||
| 1951 | KRB5_CHECKSUM_it 2531 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1952 | KRB5_CHECKSUM_it 2531 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1953 | EC_POINT_add 2532 EXIST::FUNCTION:EC | ||
| 1954 | ASN1_item_ex_i2d 2533 EXIST::FUNCTION: | ||
| 1955 | OCSP_CERTID_it 2534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1956 | OCSP_CERTID_it 2534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1957 | d2i_OCSP_RESPBYTES 2535 EXIST::FUNCTION: | ||
| 1958 | X509V3_add1_i2d 2536 EXIST::FUNCTION: | ||
| 1959 | PKCS7_ENVELOPE_it 2537 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1960 | PKCS7_ENVELOPE_it 2537 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1961 | UI_add_input_boolean 2538 EXIST::FUNCTION: | ||
| 1962 | ENGINE_unregister_RSA 2539 EXIST::FUNCTION:ENGINE | ||
| 1963 | X509V3_EXT_nconf 2540 EXIST::FUNCTION: | ||
| 1964 | ASN1_GENERALSTRING_free 2541 EXIST::FUNCTION: | ||
| 1965 | d2i_OCSP_CERTSTATUS 2542 EXIST::FUNCTION: | ||
| 1966 | X509_REVOKED_set_serialNumber 2543 EXIST::FUNCTION: | ||
| 1967 | X509_print_ex 2544 EXIST::FUNCTION:BIO | ||
| 1968 | OCSP_ONEREQ_get1_ext_d2i 2545 EXIST::FUNCTION: | ||
| 1969 | ENGINE_register_all_RAND 2546 EXIST::FUNCTION:ENGINE | ||
| 1970 | ENGINE_load_dynamic 2547 EXIST::FUNCTION:ENGINE | ||
| 1971 | PBKDF2PARAM_it 2548 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1972 | PBKDF2PARAM_it 2548 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1973 | EXTENDED_KEY_USAGE_new 2549 EXIST::FUNCTION: | ||
| 1974 | EC_GROUP_clear_free 2550 EXIST::FUNCTION:EC | ||
| 1975 | OCSP_sendreq_bio 2551 EXIST::FUNCTION: | ||
| 1976 | ASN1_item_digest 2552 EXIST::FUNCTION:EVP | ||
| 1977 | OCSP_BASICRESP_delete_ext 2553 EXIST::FUNCTION: | ||
| 1978 | OCSP_SIGNATURE_it 2554 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1979 | OCSP_SIGNATURE_it 2554 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1980 | X509_CRL_it 2555 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1981 | X509_CRL_it 2555 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1982 | OCSP_BASICRESP_add_ext 2556 EXIST::FUNCTION: | ||
| 1983 | KRB5_ENCKEY_it 2557 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1984 | KRB5_ENCKEY_it 2557 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1985 | UI_method_set_closer 2558 EXIST::FUNCTION: | ||
| 1986 | X509_STORE_set_purpose 2559 EXIST::FUNCTION: | ||
| 1987 | i2d_ASN1_GENERALSTRING 2560 EXIST::FUNCTION: | ||
| 1988 | OCSP_response_status 2561 EXIST::FUNCTION: | ||
| 1989 | i2d_OCSP_SERVICELOC 2562 EXIST::FUNCTION: | ||
| 1990 | ENGINE_get_digest_engine 2563 EXIST::FUNCTION:ENGINE | ||
| 1991 | EC_GROUP_set_curve_GFp 2564 EXIST::FUNCTION:EC | ||
| 1992 | OCSP_REQUEST_get_ext_by_OBJ 2565 EXIST::FUNCTION: | ||
| 1993 | _ossl_old_des_random_key 2566 EXIST::FUNCTION:DES | ||
| 1994 | ASN1_T61STRING_it 2567 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 1995 | ASN1_T61STRING_it 2567 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 1996 | EC_GROUP_method_of 2568 EXIST::FUNCTION:EC | ||
| 1997 | i2d_KRB5_APREQ 2569 EXIST::FUNCTION: | ||
| 1998 | _ossl_old_des_encrypt 2570 EXIST::FUNCTION:DES | ||
| 1999 | ASN1_PRINTABLE_new 2571 EXIST::FUNCTION: | ||
| 2000 | HMAC_Init_ex 2572 EXIST::FUNCTION:HMAC | ||
| 2001 | d2i_KRB5_AUTHENT 2573 EXIST::FUNCTION: | ||
| 2002 | OCSP_archive_cutoff_new 2574 EXIST::FUNCTION: | ||
| 2003 | EC_POINT_set_Jprojective_coordinates_GFp 2575 EXIST:!VMS:FUNCTION:EC | ||
| 2004 | EC_POINT_set_Jproj_coords_GFp 2575 EXIST:VMS:FUNCTION:EC | ||
| 2005 | _ossl_old_des_is_weak_key 2576 EXIST::FUNCTION:DES | ||
| 2006 | OCSP_BASICRESP_get_ext_by_OBJ 2577 EXIST::FUNCTION: | ||
| 2007 | EC_POINT_oct2point 2578 EXIST::FUNCTION:EC | ||
| 2008 | OCSP_SINGLERESP_get_ext_count 2579 EXIST::FUNCTION: | ||
| 2009 | UI_ctrl 2580 EXIST::FUNCTION: | ||
| 2010 | _shadow_DES_rw_mode 2581 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES | ||
| 2011 | _shadow_DES_rw_mode 2581 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES | ||
| 2012 | asn1_do_adb 2582 EXIST::FUNCTION: | ||
| 2013 | ASN1_template_i2d 2583 EXIST::FUNCTION: | ||
| 2014 | ENGINE_register_DH 2584 EXIST::FUNCTION:ENGINE | ||
| 2015 | UI_construct_prompt 2585 EXIST::FUNCTION: | ||
| 2016 | X509_STORE_set_trust 2586 EXIST::FUNCTION: | ||
| 2017 | UI_dup_input_string 2587 EXIST::FUNCTION: | ||
| 2018 | d2i_KRB5_APREQ 2588 EXIST::FUNCTION: | ||
| 2019 | EVP_MD_CTX_copy_ex 2589 EXIST::FUNCTION: | ||
| 2020 | OCSP_request_is_signed 2590 EXIST::FUNCTION: | ||
| 2021 | i2d_OCSP_REQINFO 2591 EXIST::FUNCTION: | ||
| 2022 | KRB5_ENCKEY_free 2592 EXIST::FUNCTION: | ||
| 2023 | OCSP_resp_get0 2593 EXIST::FUNCTION: | ||
| 2024 | GENERAL_NAME_it 2594 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2025 | GENERAL_NAME_it 2594 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2026 | ASN1_GENERALIZEDTIME_it 2595 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2027 | ASN1_GENERALIZEDTIME_it 2595 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2028 | X509_STORE_set_flags 2596 EXIST::FUNCTION: | ||
| 2029 | EC_POINT_set_compressed_coordinates_GFp 2597 EXIST:!VMS:FUNCTION:EC | ||
| 2030 | EC_POINT_set_compr_coords_GFp 2597 EXIST:VMS:FUNCTION:EC | ||
| 2031 | OCSP_response_status_str 2598 EXIST::FUNCTION: | ||
| 2032 | d2i_OCSP_REVOKEDINFO 2599 EXIST::FUNCTION: | ||
| 2033 | OCSP_basic_add1_cert 2600 EXIST::FUNCTION: | ||
| 2034 | ERR_get_implementation 2601 EXIST::FUNCTION: | ||
| 2035 | EVP_CipherFinal_ex 2602 EXIST::FUNCTION: | ||
| 2036 | OCSP_CERTSTATUS_new 2603 EXIST::FUNCTION: | ||
| 2037 | CRYPTO_cleanup_all_ex_data 2604 EXIST::FUNCTION: | ||
| 2038 | OCSP_resp_find 2605 EXIST::FUNCTION: | ||
| 2039 | BN_nnmod 2606 EXIST::FUNCTION: | ||
| 2040 | X509_CRL_sort 2607 EXIST::FUNCTION: | ||
| 2041 | X509_REVOKED_set_revocationDate 2608 EXIST::FUNCTION: | ||
| 2042 | ENGINE_register_RAND 2609 EXIST::FUNCTION:ENGINE | ||
| 2043 | OCSP_SERVICELOC_new 2610 EXIST::FUNCTION: | ||
| 2044 | EC_POINT_set_affine_coordinates_GFp 2611 EXIST:!VMS:FUNCTION:EC | ||
| 2045 | EC_POINT_set_affine_coords_GFp 2611 EXIST:VMS:FUNCTION:EC | ||
| 2046 | _ossl_old_des_options 2612 EXIST::FUNCTION:DES | ||
| 2047 | SXNET_it 2613 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2048 | SXNET_it 2613 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2049 | UI_dup_input_boolean 2614 EXIST::FUNCTION: | ||
| 2050 | PKCS12_add_CSPName_asc 2615 EXIST::FUNCTION: | ||
| 2051 | EC_POINT_is_at_infinity 2616 EXIST::FUNCTION:EC | ||
| 2052 | ENGINE_load_cryptodev 2617 EXIST::FUNCTION:ENGINE | ||
| 2053 | DSO_convert_filename 2618 EXIST::FUNCTION: | ||
| 2054 | POLICYQUALINFO_it 2619 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2055 | POLICYQUALINFO_it 2619 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2056 | ENGINE_register_ciphers 2620 EXIST::FUNCTION:ENGINE | ||
| 2057 | BN_mod_lshift_quick 2621 EXIST::FUNCTION: | ||
| 2058 | DSO_set_filename 2622 EXIST::FUNCTION: | ||
| 2059 | ASN1_item_free 2623 EXIST::FUNCTION: | ||
| 2060 | KRB5_TKTBODY_free 2624 EXIST::FUNCTION: | ||
| 2061 | AUTHORITY_KEYID_it 2625 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2062 | AUTHORITY_KEYID_it 2625 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2063 | KRB5_APREQBODY_new 2626 EXIST::FUNCTION: | ||
| 2064 | X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION: | ||
| 2065 | ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION:ENGINE | ||
| 2066 | i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION: | ||
| 2067 | EVP_MD_CTX_init 2630 EXIST::FUNCTION: | ||
| 2068 | EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION: | ||
| 2069 | PKCS7_ATTR_SIGN_it 2632 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2070 | PKCS7_ATTR_SIGN_it 2632 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2071 | UI_add_error_string 2633 EXIST::FUNCTION: | ||
| 2072 | KRB5_CHECKSUM_free 2634 EXIST::FUNCTION: | ||
| 2073 | OCSP_REQUEST_get_ext 2635 EXIST::FUNCTION: | ||
| 2074 | ENGINE_load_ubsec 2636 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2075 | ENGINE_register_all_digests 2637 EXIST::FUNCTION:ENGINE | ||
| 2076 | PKEY_USAGE_PERIOD_it 2638 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2077 | PKEY_USAGE_PERIOD_it 2638 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2078 | PKCS12_unpack_authsafes 2639 EXIST::FUNCTION: | ||
| 2079 | ASN1_item_unpack 2640 EXIST::FUNCTION: | ||
| 2080 | NETSCAPE_SPKAC_it 2641 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2081 | NETSCAPE_SPKAC_it 2641 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2082 | X509_REVOKED_it 2642 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2083 | X509_REVOKED_it 2642 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2084 | ASN1_STRING_encode 2643 NOEXIST::FUNCTION: | ||
| 2085 | EVP_aes_128_ecb 2644 EXIST::FUNCTION:AES | ||
| 2086 | KRB5_AUTHENT_free 2645 EXIST::FUNCTION: | ||
| 2087 | OCSP_BASICRESP_get_ext_by_critical 2646 EXIST:!VMS:FUNCTION: | ||
| 2088 | OCSP_BASICRESP_get_ext_by_crit 2646 EXIST:VMS:FUNCTION: | ||
| 2089 | OCSP_cert_status_str 2647 EXIST::FUNCTION: | ||
| 2090 | d2i_OCSP_REQUEST 2648 EXIST::FUNCTION: | ||
| 2091 | UI_dup_info_string 2649 EXIST::FUNCTION: | ||
| 2092 | _ossl_old_des_xwhite_in2out 2650 NOEXIST::FUNCTION: | ||
| 2093 | PKCS12_it 2651 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2094 | PKCS12_it 2651 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2095 | OCSP_SINGLERESP_get_ext_by_critical 2652 EXIST:!VMS:FUNCTION: | ||
| 2096 | OCSP_SINGLERESP_get_ext_by_crit 2652 EXIST:VMS:FUNCTION: | ||
| 2097 | OCSP_CERTSTATUS_free 2653 EXIST::FUNCTION: | ||
| 2098 | _ossl_old_des_crypt 2654 EXIST::FUNCTION:DES | ||
| 2099 | ASN1_item_i2d 2655 EXIST::FUNCTION: | ||
| 2100 | EVP_DecryptFinal_ex 2656 EXIST::FUNCTION: | ||
| 2101 | ENGINE_load_openssl 2657 EXIST::FUNCTION:ENGINE | ||
| 2102 | ENGINE_get_cmd_defns 2658 EXIST::FUNCTION:ENGINE | ||
| 2103 | ENGINE_set_load_privkey_function 2659 EXIST:!VMS:FUNCTION:ENGINE | ||
| 2104 | ENGINE_set_load_privkey_fn 2659 EXIST:VMS:FUNCTION:ENGINE | ||
| 2105 | EVP_EncryptFinal_ex 2660 EXIST::FUNCTION: | ||
| 2106 | ENGINE_set_default_digests 2661 EXIST::FUNCTION:ENGINE | ||
| 2107 | X509_get0_pubkey_bitstr 2662 EXIST::FUNCTION: | ||
| 2108 | asn1_ex_i2c 2663 EXIST::FUNCTION: | ||
| 2109 | ENGINE_register_RSA 2664 EXIST::FUNCTION:ENGINE | ||
| 2110 | ENGINE_unregister_DSA 2665 EXIST::FUNCTION:ENGINE | ||
| 2111 | _ossl_old_des_key_sched 2666 EXIST::FUNCTION:DES | ||
| 2112 | X509_EXTENSION_it 2667 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2113 | X509_EXTENSION_it 2667 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2114 | i2d_KRB5_AUTHENT 2668 EXIST::FUNCTION: | ||
| 2115 | SXNETID_it 2669 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2116 | SXNETID_it 2669 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2117 | d2i_OCSP_SINGLERESP 2670 EXIST::FUNCTION: | ||
| 2118 | EDIPARTYNAME_new 2671 EXIST::FUNCTION: | ||
| 2119 | PKCS12_certbag2x509 2672 EXIST::FUNCTION: | ||
| 2120 | _ossl_old_des_ofb64_encrypt 2673 EXIST::FUNCTION:DES | ||
| 2121 | d2i_EXTENDED_KEY_USAGE 2674 EXIST::FUNCTION: | ||
| 2122 | ERR_print_errors_cb 2675 EXIST::FUNCTION: | ||
| 2123 | ENGINE_set_ciphers 2676 EXIST::FUNCTION:ENGINE | ||
| 2124 | d2i_KRB5_APREQBODY 2677 EXIST::FUNCTION: | ||
| 2125 | UI_method_get_flusher 2678 EXIST::FUNCTION: | ||
| 2126 | X509_PUBKEY_it 2679 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2127 | X509_PUBKEY_it 2679 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2128 | _ossl_old_des_enc_read 2680 EXIST::FUNCTION:DES | ||
| 2129 | PKCS7_ENCRYPT_it 2681 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2130 | PKCS7_ENCRYPT_it 2681 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2131 | i2d_OCSP_RESPONSE 2682 EXIST::FUNCTION: | ||
| 2132 | EC_GROUP_get_cofactor 2683 EXIST::FUNCTION:EC | ||
| 2133 | PKCS12_unpack_p7data 2684 EXIST::FUNCTION: | ||
| 2134 | d2i_KRB5_AUTHDATA 2685 EXIST::FUNCTION: | ||
| 2135 | OCSP_copy_nonce 2686 EXIST::FUNCTION: | ||
| 2136 | KRB5_AUTHDATA_new 2687 EXIST::FUNCTION: | ||
| 2137 | OCSP_RESPDATA_new 2688 EXIST::FUNCTION: | ||
| 2138 | EC_GFp_mont_method 2689 EXIST::FUNCTION:EC | ||
| 2139 | OCSP_REVOKEDINFO_free 2690 EXIST::FUNCTION: | ||
| 2140 | UI_get_ex_data 2691 EXIST::FUNCTION: | ||
| 2141 | KRB5_APREQBODY_free 2692 EXIST::FUNCTION: | ||
| 2142 | EC_GROUP_get0_generator 2693 EXIST::FUNCTION:EC | ||
| 2143 | UI_get_default_method 2694 EXIST::FUNCTION: | ||
| 2144 | X509V3_set_nconf 2695 EXIST::FUNCTION: | ||
| 2145 | PKCS12_item_i2d_encrypt 2696 EXIST::FUNCTION: | ||
| 2146 | X509_add1_ext_i2d 2697 EXIST::FUNCTION: | ||
| 2147 | PKCS7_SIGNER_INFO_it 2698 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2148 | PKCS7_SIGNER_INFO_it 2698 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2149 | KRB5_PRINCNAME_new 2699 EXIST::FUNCTION: | ||
| 2150 | PKCS12_SAFEBAG_it 2700 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2151 | PKCS12_SAFEBAG_it 2700 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2152 | EC_GROUP_get_order 2701 EXIST::FUNCTION:EC | ||
| 2153 | d2i_OCSP_RESPID 2702 EXIST::FUNCTION: | ||
| 2154 | OCSP_request_verify 2703 EXIST::FUNCTION: | ||
| 2155 | NCONF_get_number_e 2704 EXIST::FUNCTION: | ||
| 2156 | _ossl_old_des_decrypt3 2705 EXIST::FUNCTION:DES | ||
| 2157 | X509_signature_print 2706 EXIST::FUNCTION:EVP | ||
| 2158 | OCSP_SINGLERESP_free 2707 EXIST::FUNCTION: | ||
| 2159 | ENGINE_load_builtin_engines 2708 EXIST::FUNCTION:ENGINE | ||
| 2160 | i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION: | ||
| 2161 | OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION: | ||
| 2162 | OCSP_RESPBYTES_new 2711 EXIST::FUNCTION: | ||
| 2163 | EVP_MD_CTX_create 2712 EXIST::FUNCTION: | ||
| 2164 | OCSP_resp_find_status 2713 EXIST::FUNCTION: | ||
| 2165 | X509_ALGOR_it 2714 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2166 | X509_ALGOR_it 2714 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2167 | ASN1_TIME_it 2715 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2168 | ASN1_TIME_it 2715 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2169 | OCSP_request_set1_name 2716 EXIST::FUNCTION: | ||
| 2170 | OCSP_ONEREQ_get_ext_count 2717 EXIST::FUNCTION: | ||
| 2171 | UI_get0_result 2718 EXIST::FUNCTION: | ||
| 2172 | PKCS12_AUTHSAFES_it 2719 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2173 | PKCS12_AUTHSAFES_it 2719 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2174 | EVP_aes_256_ecb 2720 EXIST::FUNCTION:AES | ||
| 2175 | PKCS12_pack_authsafes 2721 EXIST::FUNCTION: | ||
| 2176 | ASN1_IA5STRING_it 2722 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2177 | ASN1_IA5STRING_it 2722 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2178 | UI_get_input_flags 2723 EXIST::FUNCTION: | ||
| 2179 | EC_GROUP_set_generator 2724 EXIST::FUNCTION:EC | ||
| 2180 | _ossl_old_des_string_to_2keys 2725 EXIST::FUNCTION:DES | ||
| 2181 | OCSP_CERTID_free 2726 EXIST::FUNCTION: | ||
| 2182 | X509_CERT_AUX_it 2727 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2183 | X509_CERT_AUX_it 2727 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2184 | CERTIFICATEPOLICIES_it 2728 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2185 | CERTIFICATEPOLICIES_it 2728 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2186 | _ossl_old_des_ede3_cbc_encrypt 2729 EXIST::FUNCTION:DES | ||
| 2187 | RAND_set_rand_engine 2730 EXIST::FUNCTION:ENGINE | ||
| 2188 | DSO_get_loaded_filename 2731 EXIST::FUNCTION: | ||
| 2189 | X509_ATTRIBUTE_it 2732 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2190 | X509_ATTRIBUTE_it 2732 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2191 | OCSP_ONEREQ_get_ext_by_NID 2733 EXIST::FUNCTION: | ||
| 2192 | PKCS12_decrypt_skey 2734 EXIST::FUNCTION: | ||
| 2193 | KRB5_AUTHENT_it 2735 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2194 | KRB5_AUTHENT_it 2735 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2195 | UI_dup_error_string 2736 EXIST::FUNCTION: | ||
| 2196 | RSAPublicKey_it 2737 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA | ||
| 2197 | RSAPublicKey_it 2737 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA | ||
| 2198 | i2d_OCSP_REQUEST 2738 EXIST::FUNCTION: | ||
| 2199 | PKCS12_x509crl2certbag 2739 EXIST::FUNCTION: | ||
| 2200 | OCSP_SERVICELOC_it 2740 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2201 | OCSP_SERVICELOC_it 2740 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2202 | ASN1_item_sign 2741 EXIST::FUNCTION:EVP | ||
| 2203 | X509_CRL_set_issuer_name 2742 EXIST::FUNCTION: | ||
| 2204 | OBJ_NAME_do_all_sorted 2743 EXIST::FUNCTION: | ||
| 2205 | i2d_OCSP_BASICRESP 2744 EXIST::FUNCTION: | ||
| 2206 | i2d_OCSP_RESPBYTES 2745 EXIST::FUNCTION: | ||
| 2207 | PKCS12_unpack_p7encdata 2746 EXIST::FUNCTION: | ||
| 2208 | HMAC_CTX_init 2747 EXIST::FUNCTION:HMAC | ||
| 2209 | ENGINE_get_digest 2748 EXIST::FUNCTION:ENGINE | ||
| 2210 | OCSP_RESPONSE_print 2749 EXIST::FUNCTION: | ||
| 2211 | KRB5_TKTBODY_it 2750 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2212 | KRB5_TKTBODY_it 2750 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2213 | ACCESS_DESCRIPTION_it 2751 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2214 | ACCESS_DESCRIPTION_it 2751 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2215 | PKCS7_ISSUER_AND_SERIAL_it 2752 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2216 | PKCS7_ISSUER_AND_SERIAL_it 2752 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2217 | PBE2PARAM_it 2753 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2218 | PBE2PARAM_it 2753 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2219 | PKCS12_certbag2x509crl 2754 EXIST::FUNCTION: | ||
| 2220 | PKCS7_SIGNED_it 2755 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2221 | PKCS7_SIGNED_it 2755 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2222 | ENGINE_get_cipher 2756 EXIST::FUNCTION:ENGINE | ||
| 2223 | i2d_OCSP_CRLID 2757 EXIST::FUNCTION: | ||
| 2224 | OCSP_SINGLERESP_new 2758 EXIST::FUNCTION: | ||
| 2225 | ENGINE_cmd_is_executable 2759 EXIST::FUNCTION:ENGINE | ||
| 2226 | RSA_up_ref 2760 EXIST::FUNCTION:RSA | ||
| 2227 | ASN1_GENERALSTRING_it 2761 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2228 | ASN1_GENERALSTRING_it 2761 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2229 | ENGINE_register_DSA 2762 EXIST::FUNCTION:ENGINE | ||
| 2230 | X509V3_EXT_add_nconf_sk 2763 EXIST::FUNCTION: | ||
| 2231 | ENGINE_set_load_pubkey_function 2764 EXIST::FUNCTION:ENGINE | ||
| 2232 | PKCS8_decrypt 2765 EXIST::FUNCTION: | ||
| 2233 | PEM_bytes_read_bio 2766 EXIST::FUNCTION:BIO | ||
| 2234 | DIRECTORYSTRING_it 2767 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2235 | DIRECTORYSTRING_it 2767 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2236 | d2i_OCSP_CRLID 2768 EXIST::FUNCTION: | ||
| 2237 | EC_POINT_is_on_curve 2769 EXIST::FUNCTION:EC | ||
| 2238 | CRYPTO_set_locked_mem_ex_functions 2770 EXIST:!VMS:FUNCTION: | ||
| 2239 | CRYPTO_set_locked_mem_ex_funcs 2770 EXIST:VMS:FUNCTION: | ||
| 2240 | d2i_KRB5_CHECKSUM 2771 EXIST::FUNCTION: | ||
| 2241 | ASN1_item_dup 2772 EXIST::FUNCTION: | ||
| 2242 | X509_it 2773 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2243 | X509_it 2773 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2244 | BN_mod_add 2774 EXIST::FUNCTION: | ||
| 2245 | KRB5_AUTHDATA_free 2775 EXIST::FUNCTION: | ||
| 2246 | _ossl_old_des_cbc_cksum 2776 EXIST::FUNCTION:DES | ||
| 2247 | ASN1_item_verify 2777 EXIST::FUNCTION:EVP | ||
| 2248 | CRYPTO_set_mem_ex_functions 2778 EXIST::FUNCTION: | ||
| 2249 | EC_POINT_get_Jprojective_coordinates_GFp 2779 EXIST:!VMS:FUNCTION:EC | ||
| 2250 | EC_POINT_get_Jproj_coords_GFp 2779 EXIST:VMS:FUNCTION:EC | ||
| 2251 | ZLONG_it 2780 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2252 | ZLONG_it 2780 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2253 | CRYPTO_get_locked_mem_ex_functions 2781 EXIST:!VMS:FUNCTION: | ||
| 2254 | CRYPTO_get_locked_mem_ex_funcs 2781 EXIST:VMS:FUNCTION: | ||
| 2255 | ASN1_TIME_check 2782 EXIST::FUNCTION: | ||
| 2256 | UI_get0_user_data 2783 EXIST::FUNCTION: | ||
| 2257 | HMAC_CTX_cleanup 2784 EXIST::FUNCTION:HMAC | ||
| 2258 | DSA_up_ref 2785 EXIST::FUNCTION:DSA | ||
| 2259 | _ossl_old_des_ede3_cfb64_encrypt 2786 EXIST:!VMS:FUNCTION:DES | ||
| 2260 | _ossl_odes_ede3_cfb64_encrypt 2786 EXIST:VMS:FUNCTION:DES | ||
| 2261 | ASN1_BMPSTRING_it 2787 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2262 | ASN1_BMPSTRING_it 2787 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2263 | ASN1_tag2bit 2788 EXIST::FUNCTION: | ||
| 2264 | UI_method_set_flusher 2789 EXIST::FUNCTION: | ||
| 2265 | X509_ocspid_print 2790 EXIST::FUNCTION:BIO | ||
| 2266 | KRB5_ENCDATA_it 2791 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2267 | KRB5_ENCDATA_it 2791 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2268 | ENGINE_get_load_pubkey_function 2792 EXIST::FUNCTION:ENGINE | ||
| 2269 | UI_add_user_data 2793 EXIST::FUNCTION: | ||
| 2270 | OCSP_REQUEST_delete_ext 2794 EXIST::FUNCTION: | ||
| 2271 | UI_get_method 2795 EXIST::FUNCTION: | ||
| 2272 | OCSP_ONEREQ_free 2796 EXIST::FUNCTION: | ||
| 2273 | ASN1_PRINTABLESTRING_it 2797 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2274 | ASN1_PRINTABLESTRING_it 2797 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2275 | X509_CRL_set_nextUpdate 2798 EXIST::FUNCTION: | ||
| 2276 | OCSP_REQUEST_it 2799 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2277 | OCSP_REQUEST_it 2799 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2278 | OCSP_BASICRESP_it 2800 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2279 | OCSP_BASICRESP_it 2800 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2280 | AES_ecb_encrypt 2801 EXIST::FUNCTION:AES | ||
| 2281 | BN_mod_sqr 2802 EXIST::FUNCTION: | ||
| 2282 | NETSCAPE_CERT_SEQUENCE_it 2803 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2283 | NETSCAPE_CERT_SEQUENCE_it 2803 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2284 | GENERAL_NAMES_it 2804 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2285 | GENERAL_NAMES_it 2804 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2286 | AUTHORITY_INFO_ACCESS_it 2805 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2287 | AUTHORITY_INFO_ACCESS_it 2805 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2288 | ASN1_FBOOLEAN_it 2806 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2289 | ASN1_FBOOLEAN_it 2806 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2290 | UI_set_ex_data 2807 EXIST::FUNCTION: | ||
| 2291 | _ossl_old_des_string_to_key 2808 EXIST::FUNCTION:DES | ||
| 2292 | ENGINE_register_all_RSA 2809 EXIST::FUNCTION:ENGINE | ||
| 2293 | d2i_KRB5_PRINCNAME 2810 EXIST::FUNCTION: | ||
| 2294 | OCSP_RESPBYTES_it 2811 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2295 | OCSP_RESPBYTES_it 2811 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2296 | X509_CINF_it 2812 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2297 | X509_CINF_it 2812 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2298 | ENGINE_unregister_digests 2813 EXIST::FUNCTION:ENGINE | ||
| 2299 | d2i_EDIPARTYNAME 2814 EXIST::FUNCTION: | ||
| 2300 | d2i_OCSP_SERVICELOC 2815 EXIST::FUNCTION: | ||
| 2301 | ENGINE_get_digests 2816 EXIST::FUNCTION:ENGINE | ||
| 2302 | _ossl_old_des_set_odd_parity 2817 EXIST::FUNCTION:DES | ||
| 2303 | OCSP_RESPDATA_free 2818 EXIST::FUNCTION: | ||
| 2304 | d2i_KRB5_TICKET 2819 EXIST::FUNCTION: | ||
| 2305 | OTHERNAME_it 2820 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2306 | OTHERNAME_it 2820 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2307 | EVP_MD_CTX_cleanup 2821 EXIST::FUNCTION: | ||
| 2308 | d2i_ASN1_GENERALSTRING 2822 EXIST::FUNCTION: | ||
| 2309 | X509_CRL_set_version 2823 EXIST::FUNCTION: | ||
| 2310 | BN_mod_sub 2824 EXIST::FUNCTION: | ||
| 2311 | OCSP_SINGLERESP_get_ext_by_NID 2825 EXIST::FUNCTION: | ||
| 2312 | ENGINE_get_ex_new_index 2826 EXIST::FUNCTION:ENGINE | ||
| 2313 | OCSP_REQUEST_free 2827 EXIST::FUNCTION: | ||
| 2314 | OCSP_REQUEST_add1_ext_i2d 2828 EXIST::FUNCTION: | ||
| 2315 | X509_VAL_it 2829 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2316 | X509_VAL_it 2829 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2317 | EC_POINTs_make_affine 2830 EXIST::FUNCTION:EC | ||
| 2318 | EC_POINT_mul 2831 EXIST::FUNCTION:EC | ||
| 2319 | X509V3_EXT_add_nconf 2832 EXIST::FUNCTION: | ||
| 2320 | X509_TRUST_set 2833 EXIST::FUNCTION: | ||
| 2321 | X509_CRL_add1_ext_i2d 2834 EXIST::FUNCTION: | ||
| 2322 | _ossl_old_des_fcrypt 2835 EXIST::FUNCTION:DES | ||
| 2323 | DISPLAYTEXT_it 2836 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2324 | DISPLAYTEXT_it 2836 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2325 | X509_CRL_set_lastUpdate 2837 EXIST::FUNCTION: | ||
| 2326 | OCSP_BASICRESP_free 2838 EXIST::FUNCTION: | ||
| 2327 | OCSP_BASICRESP_add1_ext_i2d 2839 EXIST::FUNCTION: | ||
| 2328 | d2i_KRB5_AUTHENTBODY 2840 EXIST::FUNCTION: | ||
| 2329 | CRYPTO_set_ex_data_implementation 2841 EXIST:!VMS:FUNCTION: | ||
| 2330 | CRYPTO_set_ex_data_impl 2841 EXIST:VMS:FUNCTION: | ||
| 2331 | KRB5_ENCDATA_new 2842 EXIST::FUNCTION: | ||
| 2332 | DSO_up_ref 2843 EXIST::FUNCTION: | ||
| 2333 | OCSP_crl_reason_str 2844 EXIST::FUNCTION: | ||
| 2334 | UI_get0_result_string 2845 EXIST::FUNCTION: | ||
| 2335 | ASN1_GENERALSTRING_new 2846 EXIST::FUNCTION: | ||
| 2336 | X509_SIG_it 2847 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2337 | X509_SIG_it 2847 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2338 | ERR_set_implementation 2848 EXIST::FUNCTION: | ||
| 2339 | ERR_load_EC_strings 2849 EXIST::FUNCTION:EC | ||
| 2340 | UI_get0_action_string 2850 EXIST::FUNCTION: | ||
| 2341 | OCSP_ONEREQ_get_ext 2851 EXIST::FUNCTION: | ||
| 2342 | EC_POINT_method_of 2852 EXIST::FUNCTION:EC | ||
| 2343 | i2d_KRB5_APREQBODY 2853 EXIST::FUNCTION: | ||
| 2344 | _ossl_old_des_ecb3_encrypt 2854 EXIST::FUNCTION:DES | ||
| 2345 | CRYPTO_get_mem_ex_functions 2855 EXIST::FUNCTION: | ||
| 2346 | ENGINE_get_ex_data 2856 EXIST::FUNCTION:ENGINE | ||
| 2347 | UI_destroy_method 2857 EXIST::FUNCTION: | ||
| 2348 | ASN1_item_i2d_bio 2858 EXIST::FUNCTION:BIO | ||
| 2349 | OCSP_ONEREQ_get_ext_by_OBJ 2859 EXIST::FUNCTION: | ||
| 2350 | ASN1_primitive_new 2860 EXIST::FUNCTION: | ||
| 2351 | ASN1_PRINTABLE_it 2861 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2352 | ASN1_PRINTABLE_it 2861 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2353 | EVP_aes_192_ecb 2862 EXIST::FUNCTION:AES | ||
| 2354 | OCSP_SIGNATURE_new 2863 EXIST::FUNCTION: | ||
| 2355 | LONG_it 2864 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2356 | LONG_it 2864 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2357 | ASN1_VISIBLESTRING_it 2865 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2358 | ASN1_VISIBLESTRING_it 2865 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2359 | OCSP_SINGLERESP_add1_ext_i2d 2866 EXIST::FUNCTION: | ||
| 2360 | d2i_OCSP_CERTID 2867 EXIST::FUNCTION: | ||
| 2361 | ASN1_item_d2i_fp 2868 EXIST::FUNCTION:FP_API | ||
| 2362 | CRL_DIST_POINTS_it 2869 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2363 | CRL_DIST_POINTS_it 2869 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2364 | GENERAL_NAME_print 2870 EXIST::FUNCTION: | ||
| 2365 | OCSP_SINGLERESP_delete_ext 2871 EXIST::FUNCTION: | ||
| 2366 | PKCS12_SAFEBAGS_it 2872 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2367 | PKCS12_SAFEBAGS_it 2872 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2368 | d2i_OCSP_SIGNATURE 2873 EXIST::FUNCTION: | ||
| 2369 | OCSP_request_add1_nonce 2874 EXIST::FUNCTION: | ||
| 2370 | ENGINE_set_cmd_defns 2875 EXIST::FUNCTION:ENGINE | ||
| 2371 | OCSP_SERVICELOC_free 2876 EXIST::FUNCTION: | ||
| 2372 | EC_GROUP_free 2877 EXIST::FUNCTION:EC | ||
| 2373 | ASN1_BIT_STRING_it 2878 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2374 | ASN1_BIT_STRING_it 2878 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2375 | X509_REQ_it 2879 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2376 | X509_REQ_it 2879 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2377 | _ossl_old_des_cbc_encrypt 2880 EXIST::FUNCTION:DES | ||
| 2378 | ERR_unload_strings 2881 EXIST::FUNCTION: | ||
| 2379 | PKCS7_SIGN_ENVELOPE_it 2882 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2380 | PKCS7_SIGN_ENVELOPE_it 2882 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2381 | EDIPARTYNAME_free 2883 EXIST::FUNCTION: | ||
| 2382 | OCSP_REQINFO_free 2884 EXIST::FUNCTION: | ||
| 2383 | EC_GROUP_new_curve_GFp 2885 EXIST::FUNCTION:EC | ||
| 2384 | OCSP_REQUEST_get1_ext_d2i 2886 EXIST::FUNCTION: | ||
| 2385 | PKCS12_item_pack_safebag 2887 EXIST::FUNCTION: | ||
| 2386 | asn1_ex_c2i 2888 EXIST::FUNCTION: | ||
| 2387 | ENGINE_register_digests 2889 EXIST::FUNCTION:ENGINE | ||
| 2388 | i2d_OCSP_REVOKEDINFO 2890 EXIST::FUNCTION: | ||
| 2389 | asn1_enc_restore 2891 EXIST::FUNCTION: | ||
| 2390 | UI_free 2892 EXIST::FUNCTION: | ||
| 2391 | UI_new_method 2893 EXIST::FUNCTION: | ||
| 2392 | EVP_EncryptInit_ex 2894 EXIST::FUNCTION: | ||
| 2393 | X509_pubkey_digest 2895 EXIST::FUNCTION:EVP | ||
| 2394 | EC_POINT_invert 2896 EXIST::FUNCTION:EC | ||
| 2395 | OCSP_basic_sign 2897 EXIST::FUNCTION: | ||
| 2396 | i2d_OCSP_RESPID 2898 EXIST::FUNCTION: | ||
| 2397 | OCSP_check_nonce 2899 EXIST::FUNCTION: | ||
| 2398 | ENGINE_ctrl_cmd 2900 EXIST::FUNCTION:ENGINE | ||
| 2399 | d2i_KRB5_ENCKEY 2901 EXIST::FUNCTION: | ||
| 2400 | OCSP_parse_url 2902 EXIST::FUNCTION: | ||
| 2401 | OCSP_SINGLERESP_get_ext 2903 EXIST::FUNCTION: | ||
| 2402 | OCSP_CRLID_free 2904 EXIST::FUNCTION: | ||
| 2403 | OCSP_BASICRESP_get1_ext_d2i 2905 EXIST::FUNCTION: | ||
| 2404 | RSAPrivateKey_it 2906 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA | ||
| 2405 | RSAPrivateKey_it 2906 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA | ||
| 2406 | ENGINE_register_all_DH 2907 EXIST::FUNCTION:ENGINE | ||
| 2407 | i2d_EDIPARTYNAME 2908 EXIST::FUNCTION: | ||
| 2408 | EC_POINT_get_affine_coordinates_GFp 2909 EXIST:!VMS:FUNCTION:EC | ||
| 2409 | EC_POINT_get_affine_coords_GFp 2909 EXIST:VMS:FUNCTION:EC | ||
| 2410 | OCSP_CRLID_new 2910 EXIST::FUNCTION: | ||
| 2411 | ENGINE_get_flags 2911 EXIST::FUNCTION:ENGINE | ||
| 2412 | OCSP_ONEREQ_it 2912 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2413 | OCSP_ONEREQ_it 2912 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2414 | UI_process 2913 EXIST::FUNCTION: | ||
| 2415 | ASN1_INTEGER_it 2914 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2416 | ASN1_INTEGER_it 2914 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2417 | EVP_CipherInit_ex 2915 EXIST::FUNCTION: | ||
| 2418 | UI_get_string_type 2916 EXIST::FUNCTION: | ||
| 2419 | ENGINE_unregister_DH 2917 EXIST::FUNCTION:ENGINE | ||
| 2420 | ENGINE_register_all_DSA 2918 EXIST::FUNCTION:ENGINE | ||
| 2421 | OCSP_ONEREQ_get_ext_by_critical 2919 EXIST::FUNCTION: | ||
| 2422 | bn_dup_expand 2920 EXIST::FUNCTION:DEPRECATED | ||
| 2423 | OCSP_cert_id_new 2921 EXIST::FUNCTION: | ||
| 2424 | BASIC_CONSTRAINTS_it 2922 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2425 | BASIC_CONSTRAINTS_it 2922 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2426 | BN_mod_add_quick 2923 EXIST::FUNCTION: | ||
| 2427 | EC_POINT_new 2924 EXIST::FUNCTION:EC | ||
| 2428 | EVP_MD_CTX_destroy 2925 EXIST::FUNCTION: | ||
| 2429 | OCSP_RESPBYTES_free 2926 EXIST::FUNCTION: | ||
| 2430 | EVP_aes_128_cbc 2927 EXIST::FUNCTION:AES | ||
| 2431 | OCSP_SINGLERESP_get1_ext_d2i 2928 EXIST::FUNCTION: | ||
| 2432 | EC_POINT_free 2929 EXIST::FUNCTION:EC | ||
| 2433 | DH_up_ref 2930 EXIST::FUNCTION:DH | ||
| 2434 | X509_NAME_ENTRY_it 2931 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2435 | X509_NAME_ENTRY_it 2931 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2436 | UI_get_ex_new_index 2932 EXIST::FUNCTION: | ||
| 2437 | BN_mod_sub_quick 2933 EXIST::FUNCTION: | ||
| 2438 | OCSP_ONEREQ_add_ext 2934 EXIST::FUNCTION: | ||
| 2439 | OCSP_request_sign 2935 EXIST::FUNCTION: | ||
| 2440 | EVP_DigestFinal_ex 2936 EXIST::FUNCTION: | ||
| 2441 | ENGINE_set_digests 2937 EXIST::FUNCTION:ENGINE | ||
| 2442 | OCSP_id_issuer_cmp 2938 EXIST::FUNCTION: | ||
| 2443 | OBJ_NAME_do_all 2939 EXIST::FUNCTION: | ||
| 2444 | EC_POINTs_mul 2940 EXIST::FUNCTION:EC | ||
| 2445 | ENGINE_register_complete 2941 EXIST::FUNCTION:ENGINE | ||
| 2446 | X509V3_EXT_nconf_nid 2942 EXIST::FUNCTION: | ||
| 2447 | ASN1_SEQUENCE_it 2943 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2448 | ASN1_SEQUENCE_it 2943 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2449 | UI_set_default_method 2944 EXIST::FUNCTION: | ||
| 2450 | RAND_query_egd_bytes 2945 EXIST::FUNCTION: | ||
| 2451 | UI_method_get_writer 2946 EXIST::FUNCTION: | ||
| 2452 | UI_OpenSSL 2947 EXIST::FUNCTION: | ||
| 2453 | PEM_def_callback 2948 EXIST::FUNCTION: | ||
| 2454 | ENGINE_cleanup 2949 EXIST::FUNCTION:ENGINE | ||
| 2455 | DIST_POINT_it 2950 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2456 | DIST_POINT_it 2950 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2457 | OCSP_SINGLERESP_it 2951 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2458 | OCSP_SINGLERESP_it 2951 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2459 | d2i_KRB5_TKTBODY 2952 EXIST::FUNCTION: | ||
| 2460 | EC_POINT_cmp 2953 EXIST::FUNCTION:EC | ||
| 2461 | OCSP_REVOKEDINFO_new 2954 EXIST::FUNCTION: | ||
| 2462 | i2d_OCSP_CERTSTATUS 2955 EXIST::FUNCTION: | ||
| 2463 | OCSP_basic_add1_nonce 2956 EXIST::FUNCTION: | ||
| 2464 | ASN1_item_ex_d2i 2957 EXIST::FUNCTION: | ||
| 2465 | BN_mod_lshift1_quick 2958 EXIST::FUNCTION: | ||
| 2466 | UI_set_method 2959 EXIST::FUNCTION: | ||
| 2467 | OCSP_id_get0_info 2960 EXIST::FUNCTION: | ||
| 2468 | BN_mod_sqrt 2961 EXIST::FUNCTION: | ||
| 2469 | EC_GROUP_copy 2962 EXIST::FUNCTION:EC | ||
| 2470 | KRB5_ENCDATA_free 2963 EXIST::FUNCTION: | ||
| 2471 | _ossl_old_des_cfb_encrypt 2964 EXIST::FUNCTION:DES | ||
| 2472 | OCSP_SINGLERESP_get_ext_by_OBJ 2965 EXIST::FUNCTION: | ||
| 2473 | OCSP_cert_to_id 2966 EXIST::FUNCTION: | ||
| 2474 | OCSP_RESPID_new 2967 EXIST::FUNCTION: | ||
| 2475 | OCSP_RESPDATA_it 2968 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2476 | OCSP_RESPDATA_it 2968 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2477 | d2i_OCSP_RESPDATA 2969 EXIST::FUNCTION: | ||
| 2478 | ENGINE_register_all_complete 2970 EXIST::FUNCTION:ENGINE | ||
| 2479 | OCSP_check_validity 2971 EXIST::FUNCTION: | ||
| 2480 | PKCS12_BAGS_it 2972 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2481 | PKCS12_BAGS_it 2972 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2482 | OCSP_url_svcloc_new 2973 EXIST::FUNCTION: | ||
| 2483 | ASN1_template_free 2974 EXIST::FUNCTION: | ||
| 2484 | OCSP_SINGLERESP_add_ext 2975 EXIST::FUNCTION: | ||
| 2485 | KRB5_AUTHENTBODY_it 2976 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2486 | KRB5_AUTHENTBODY_it 2976 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2487 | X509_supported_extension 2977 EXIST::FUNCTION: | ||
| 2488 | i2d_KRB5_AUTHDATA 2978 EXIST::FUNCTION: | ||
| 2489 | UI_method_get_opener 2979 EXIST::FUNCTION: | ||
| 2490 | ENGINE_set_ex_data 2980 EXIST::FUNCTION:ENGINE | ||
| 2491 | OCSP_REQUEST_print 2981 EXIST::FUNCTION: | ||
| 2492 | CBIGNUM_it 2982 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2493 | CBIGNUM_it 2982 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2494 | KRB5_TICKET_new 2983 EXIST::FUNCTION: | ||
| 2495 | KRB5_APREQ_new 2984 EXIST::FUNCTION: | ||
| 2496 | EC_GROUP_get_curve_GFp 2985 EXIST::FUNCTION:EC | ||
| 2497 | KRB5_ENCKEY_new 2986 EXIST::FUNCTION: | ||
| 2498 | ASN1_template_d2i 2987 EXIST::FUNCTION: | ||
| 2499 | _ossl_old_des_quad_cksum 2988 EXIST::FUNCTION:DES | ||
| 2500 | OCSP_single_get0_status 2989 EXIST::FUNCTION: | ||
| 2501 | BN_swap 2990 EXIST::FUNCTION: | ||
| 2502 | POLICYINFO_it 2991 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2503 | POLICYINFO_it 2991 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2504 | ENGINE_set_destroy_function 2992 EXIST::FUNCTION:ENGINE | ||
| 2505 | asn1_enc_free 2993 EXIST::FUNCTION: | ||
| 2506 | OCSP_RESPID_it 2994 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2507 | OCSP_RESPID_it 2994 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2508 | EC_GROUP_new 2995 EXIST::FUNCTION:EC | ||
| 2509 | EVP_aes_256_cbc 2996 EXIST::FUNCTION:AES | ||
| 2510 | i2d_KRB5_PRINCNAME 2997 EXIST::FUNCTION: | ||
| 2511 | _ossl_old_des_encrypt2 2998 EXIST::FUNCTION:DES | ||
| 2512 | _ossl_old_des_encrypt3 2999 EXIST::FUNCTION:DES | ||
| 2513 | PKCS8_PRIV_KEY_INFO_it 3000 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2514 | PKCS8_PRIV_KEY_INFO_it 3000 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2515 | OCSP_REQINFO_it 3001 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2516 | OCSP_REQINFO_it 3001 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2517 | PBEPARAM_it 3002 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2518 | PBEPARAM_it 3002 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2519 | KRB5_AUTHENTBODY_new 3003 EXIST::FUNCTION: | ||
| 2520 | X509_CRL_add0_revoked 3004 EXIST::FUNCTION: | ||
| 2521 | EDIPARTYNAME_it 3005 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2522 | EDIPARTYNAME_it 3005 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2523 | NETSCAPE_SPKI_it 3006 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2524 | NETSCAPE_SPKI_it 3006 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2525 | UI_get0_test_string 3007 EXIST::FUNCTION: | ||
| 2526 | ENGINE_get_cipher_engine 3008 EXIST::FUNCTION:ENGINE | ||
| 2527 | ENGINE_register_all_ciphers 3009 EXIST::FUNCTION:ENGINE | ||
| 2528 | EC_POINT_copy 3010 EXIST::FUNCTION:EC | ||
| 2529 | BN_kronecker 3011 EXIST::FUNCTION: | ||
| 2530 | _ossl_old_des_ede3_ofb64_encrypt 3012 EXIST:!VMS:FUNCTION:DES | ||
| 2531 | _ossl_odes_ede3_ofb64_encrypt 3012 EXIST:VMS:FUNCTION:DES | ||
| 2532 | UI_method_get_reader 3013 EXIST::FUNCTION: | ||
| 2533 | OCSP_BASICRESP_get_ext_count 3014 EXIST::FUNCTION: | ||
| 2534 | ASN1_ENUMERATED_it 3015 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2535 | ASN1_ENUMERATED_it 3015 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2536 | UI_set_result 3016 EXIST::FUNCTION: | ||
| 2537 | i2d_KRB5_TICKET 3017 EXIST::FUNCTION: | ||
| 2538 | X509_print_ex_fp 3018 EXIST::FUNCTION:FP_API | ||
| 2539 | EVP_CIPHER_CTX_set_padding 3019 EXIST::FUNCTION: | ||
| 2540 | d2i_OCSP_RESPONSE 3020 EXIST::FUNCTION: | ||
| 2541 | ASN1_UTCTIME_it 3021 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2542 | ASN1_UTCTIME_it 3021 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2543 | _ossl_old_des_enc_write 3022 EXIST::FUNCTION:DES | ||
| 2544 | OCSP_RESPONSE_new 3023 EXIST::FUNCTION: | ||
| 2545 | AES_set_encrypt_key 3024 EXIST::FUNCTION:AES | ||
| 2546 | OCSP_resp_count 3025 EXIST::FUNCTION: | ||
| 2547 | KRB5_CHECKSUM_new 3026 EXIST::FUNCTION: | ||
| 2548 | ENGINE_load_cswift 3027 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2549 | OCSP_onereq_get0_id 3028 EXIST::FUNCTION: | ||
| 2550 | ENGINE_set_default_ciphers 3029 EXIST::FUNCTION:ENGINE | ||
| 2551 | NOTICEREF_it 3030 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2552 | NOTICEREF_it 3030 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2553 | X509V3_EXT_CRL_add_nconf 3031 EXIST::FUNCTION: | ||
| 2554 | OCSP_REVOKEDINFO_it 3032 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2555 | OCSP_REVOKEDINFO_it 3032 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2556 | AES_encrypt 3033 EXIST::FUNCTION:AES | ||
| 2557 | OCSP_REQUEST_new 3034 EXIST::FUNCTION: | ||
| 2558 | ASN1_ANY_it 3035 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2559 | ASN1_ANY_it 3035 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2560 | CRYPTO_ex_data_new_class 3036 EXIST::FUNCTION: | ||
| 2561 | _ossl_old_des_ncbc_encrypt 3037 EXIST::FUNCTION:DES | ||
| 2562 | i2d_KRB5_TKTBODY 3038 EXIST::FUNCTION: | ||
| 2563 | EC_POINT_clear_free 3039 EXIST::FUNCTION:EC | ||
| 2564 | AES_decrypt 3040 EXIST::FUNCTION:AES | ||
| 2565 | asn1_enc_init 3041 EXIST::FUNCTION: | ||
| 2566 | UI_get_result_maxsize 3042 EXIST::FUNCTION: | ||
| 2567 | OCSP_CERTID_new 3043 EXIST::FUNCTION: | ||
| 2568 | ENGINE_unregister_RAND 3044 EXIST::FUNCTION:ENGINE | ||
| 2569 | UI_method_get_closer 3045 EXIST::FUNCTION: | ||
| 2570 | d2i_KRB5_ENCDATA 3046 EXIST::FUNCTION: | ||
| 2571 | OCSP_request_onereq_count 3047 EXIST::FUNCTION: | ||
| 2572 | OCSP_basic_verify 3048 EXIST::FUNCTION: | ||
| 2573 | KRB5_AUTHENTBODY_free 3049 EXIST::FUNCTION: | ||
| 2574 | ASN1_item_d2i 3050 EXIST::FUNCTION: | ||
| 2575 | ASN1_primitive_free 3051 EXIST::FUNCTION: | ||
| 2576 | i2d_EXTENDED_KEY_USAGE 3052 EXIST::FUNCTION: | ||
| 2577 | i2d_OCSP_SIGNATURE 3053 EXIST::FUNCTION: | ||
| 2578 | asn1_enc_save 3054 EXIST::FUNCTION: | ||
| 2579 | ENGINE_load_nuron 3055 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2580 | _ossl_old_des_pcbc_encrypt 3056 EXIST::FUNCTION:DES | ||
| 2581 | PKCS12_MAC_DATA_it 3057 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2582 | PKCS12_MAC_DATA_it 3057 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2583 | OCSP_accept_responses_new 3058 EXIST::FUNCTION: | ||
| 2584 | asn1_do_lock 3059 EXIST::FUNCTION: | ||
| 2585 | PKCS7_ATTR_VERIFY_it 3060 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2586 | PKCS7_ATTR_VERIFY_it 3060 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2587 | KRB5_APREQBODY_it 3061 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2588 | KRB5_APREQBODY_it 3061 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2589 | i2d_OCSP_SINGLERESP 3062 EXIST::FUNCTION: | ||
| 2590 | ASN1_item_ex_new 3063 EXIST::FUNCTION: | ||
| 2591 | UI_add_verify_string 3064 EXIST::FUNCTION: | ||
| 2592 | _ossl_old_des_set_key 3065 EXIST::FUNCTION:DES | ||
| 2593 | KRB5_PRINCNAME_it 3066 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2594 | KRB5_PRINCNAME_it 3066 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2595 | EVP_DecryptInit_ex 3067 EXIST::FUNCTION: | ||
| 2596 | i2d_OCSP_CERTID 3068 EXIST::FUNCTION: | ||
| 2597 | ASN1_item_d2i_bio 3069 EXIST::FUNCTION:BIO | ||
| 2598 | EC_POINT_dbl 3070 EXIST::FUNCTION:EC | ||
| 2599 | asn1_get_choice_selector 3071 EXIST::FUNCTION: | ||
| 2600 | i2d_KRB5_CHECKSUM 3072 EXIST::FUNCTION: | ||
| 2601 | ENGINE_set_table_flags 3073 EXIST::FUNCTION:ENGINE | ||
| 2602 | AES_options 3074 EXIST::FUNCTION:AES | ||
| 2603 | ENGINE_load_chil 3075 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2604 | OCSP_id_cmp 3076 EXIST::FUNCTION: | ||
| 2605 | OCSP_BASICRESP_new 3077 EXIST::FUNCTION: | ||
| 2606 | OCSP_REQUEST_get_ext_by_NID 3078 EXIST::FUNCTION: | ||
| 2607 | KRB5_APREQ_it 3079 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2608 | KRB5_APREQ_it 3079 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2609 | ENGINE_get_destroy_function 3080 EXIST::FUNCTION:ENGINE | ||
| 2610 | CONF_set_nconf 3081 EXIST::FUNCTION: | ||
| 2611 | ASN1_PRINTABLE_free 3082 EXIST::FUNCTION: | ||
| 2612 | OCSP_BASICRESP_get_ext_by_NID 3083 EXIST::FUNCTION: | ||
| 2613 | DIST_POINT_NAME_it 3084 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2614 | DIST_POINT_NAME_it 3084 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2615 | X509V3_extensions_print 3085 EXIST::FUNCTION: | ||
| 2616 | _ossl_old_des_cfb64_encrypt 3086 EXIST::FUNCTION:DES | ||
| 2617 | X509_REVOKED_add1_ext_i2d 3087 EXIST::FUNCTION: | ||
| 2618 | _ossl_old_des_ofb_encrypt 3088 EXIST::FUNCTION:DES | ||
| 2619 | KRB5_TKTBODY_new 3089 EXIST::FUNCTION: | ||
| 2620 | ASN1_OCTET_STRING_it 3090 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2621 | ASN1_OCTET_STRING_it 3090 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2622 | ERR_load_UI_strings 3091 EXIST::FUNCTION: | ||
| 2623 | i2d_KRB5_ENCKEY 3092 EXIST::FUNCTION: | ||
| 2624 | ASN1_template_new 3093 EXIST::FUNCTION: | ||
| 2625 | OCSP_SIGNATURE_free 3094 EXIST::FUNCTION: | ||
| 2626 | ASN1_item_i2d_fp 3095 EXIST::FUNCTION:FP_API | ||
| 2627 | KRB5_PRINCNAME_free 3096 EXIST::FUNCTION: | ||
| 2628 | PKCS7_RECIP_INFO_it 3097 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2629 | PKCS7_RECIP_INFO_it 3097 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2630 | EXTENDED_KEY_USAGE_it 3098 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2631 | EXTENDED_KEY_USAGE_it 3098 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2632 | EC_GFp_simple_method 3099 EXIST::FUNCTION:EC | ||
| 2633 | EC_GROUP_precompute_mult 3100 EXIST::FUNCTION:EC | ||
| 2634 | OCSP_request_onereq_get0 3101 EXIST::FUNCTION: | ||
| 2635 | UI_method_set_writer 3102 EXIST::FUNCTION: | ||
| 2636 | KRB5_AUTHENT_new 3103 EXIST::FUNCTION: | ||
| 2637 | X509_CRL_INFO_it 3104 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2638 | X509_CRL_INFO_it 3104 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2639 | DSO_set_name_converter 3105 EXIST::FUNCTION: | ||
| 2640 | AES_set_decrypt_key 3106 EXIST::FUNCTION:AES | ||
| 2641 | PKCS7_DIGEST_it 3107 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2642 | PKCS7_DIGEST_it 3107 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2643 | PKCS12_x5092certbag 3108 EXIST::FUNCTION: | ||
| 2644 | EVP_DigestInit_ex 3109 EXIST::FUNCTION: | ||
| 2645 | i2a_ACCESS_DESCRIPTION 3110 EXIST::FUNCTION: | ||
| 2646 | OCSP_RESPONSE_it 3111 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2647 | OCSP_RESPONSE_it 3111 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2648 | PKCS7_ENC_CONTENT_it 3112 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2649 | PKCS7_ENC_CONTENT_it 3112 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2650 | OCSP_request_add0_id 3113 EXIST::FUNCTION: | ||
| 2651 | EC_POINT_make_affine 3114 EXIST::FUNCTION:EC | ||
| 2652 | DSO_get_filename 3115 EXIST::FUNCTION: | ||
| 2653 | OCSP_CERTSTATUS_it 3116 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2654 | OCSP_CERTSTATUS_it 3116 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2655 | OCSP_request_add1_cert 3117 EXIST::FUNCTION: | ||
| 2656 | UI_get0_output_string 3118 EXIST::FUNCTION: | ||
| 2657 | UI_dup_verify_string 3119 EXIST::FUNCTION: | ||
| 2658 | BN_mod_lshift 3120 EXIST::FUNCTION: | ||
| 2659 | KRB5_AUTHDATA_it 3121 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2660 | KRB5_AUTHDATA_it 3121 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2661 | asn1_set_choice_selector 3122 EXIST::FUNCTION: | ||
| 2662 | OCSP_basic_add1_status 3123 EXIST::FUNCTION: | ||
| 2663 | OCSP_RESPID_free 3124 EXIST::FUNCTION: | ||
| 2664 | asn1_get_field_ptr 3125 EXIST::FUNCTION: | ||
| 2665 | UI_add_input_string 3126 EXIST::FUNCTION: | ||
| 2666 | OCSP_CRLID_it 3127 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2667 | OCSP_CRLID_it 3127 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2668 | i2d_KRB5_AUTHENTBODY 3128 EXIST::FUNCTION: | ||
| 2669 | OCSP_REQUEST_get_ext_count 3129 EXIST::FUNCTION: | ||
| 2670 | ENGINE_load_atalla 3130 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2671 | X509_NAME_it 3131 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2672 | X509_NAME_it 3131 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2673 | USERNOTICE_it 3132 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2674 | USERNOTICE_it 3132 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2675 | OCSP_REQINFO_new 3133 EXIST::FUNCTION: | ||
| 2676 | OCSP_BASICRESP_get_ext 3134 EXIST::FUNCTION: | ||
| 2677 | CRYPTO_get_ex_data_implementation 3135 EXIST:!VMS:FUNCTION: | ||
| 2678 | CRYPTO_get_ex_data_impl 3135 EXIST:VMS:FUNCTION: | ||
| 2679 | ASN1_item_pack 3136 EXIST::FUNCTION: | ||
| 2680 | i2d_KRB5_ENCDATA 3137 EXIST::FUNCTION: | ||
| 2681 | X509_PURPOSE_set 3138 EXIST::FUNCTION: | ||
| 2682 | X509_REQ_INFO_it 3139 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2683 | X509_REQ_INFO_it 3139 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2684 | UI_method_set_opener 3140 EXIST::FUNCTION: | ||
| 2685 | ASN1_item_ex_free 3141 EXIST::FUNCTION: | ||
| 2686 | ASN1_BOOLEAN_it 3142 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2687 | ASN1_BOOLEAN_it 3142 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2688 | ENGINE_get_table_flags 3143 EXIST::FUNCTION:ENGINE | ||
| 2689 | UI_create_method 3144 EXIST::FUNCTION: | ||
| 2690 | OCSP_ONEREQ_add1_ext_i2d 3145 EXIST::FUNCTION: | ||
| 2691 | _shadow_DES_check_key 3146 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DES | ||
| 2692 | _shadow_DES_check_key 3146 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DES | ||
| 2693 | d2i_OCSP_REQINFO 3147 EXIST::FUNCTION: | ||
| 2694 | UI_add_info_string 3148 EXIST::FUNCTION: | ||
| 2695 | UI_get_result_minsize 3149 EXIST::FUNCTION: | ||
| 2696 | ASN1_NULL_it 3150 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2697 | ASN1_NULL_it 3150 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2698 | BN_mod_lshift1 3151 EXIST::FUNCTION: | ||
| 2699 | d2i_OCSP_ONEREQ 3152 EXIST::FUNCTION: | ||
| 2700 | OCSP_ONEREQ_new 3153 EXIST::FUNCTION: | ||
| 2701 | KRB5_TICKET_it 3154 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2702 | KRB5_TICKET_it 3154 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2703 | EVP_aes_192_cbc 3155 EXIST::FUNCTION:AES | ||
| 2704 | KRB5_TICKET_free 3156 EXIST::FUNCTION: | ||
| 2705 | UI_new 3157 EXIST::FUNCTION: | ||
| 2706 | OCSP_response_create 3158 EXIST::FUNCTION: | ||
| 2707 | _ossl_old_des_xcbc_encrypt 3159 EXIST::FUNCTION:DES | ||
| 2708 | PKCS7_it 3160 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2709 | PKCS7_it 3160 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2710 | OCSP_REQUEST_get_ext_by_critical 3161 EXIST:!VMS:FUNCTION: | ||
| 2711 | OCSP_REQUEST_get_ext_by_crit 3161 EXIST:VMS:FUNCTION: | ||
| 2712 | ENGINE_set_flags 3162 EXIST::FUNCTION:ENGINE | ||
| 2713 | _ossl_old_des_ecb_encrypt 3163 EXIST::FUNCTION:DES | ||
| 2714 | OCSP_response_get1_basic 3164 EXIST::FUNCTION: | ||
| 2715 | EVP_Digest 3165 EXIST::FUNCTION: | ||
| 2716 | OCSP_ONEREQ_delete_ext 3166 EXIST::FUNCTION: | ||
| 2717 | ASN1_TBOOLEAN_it 3167 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2718 | ASN1_TBOOLEAN_it 3167 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2719 | ASN1_item_new 3168 EXIST::FUNCTION: | ||
| 2720 | ASN1_TIME_to_generalizedtime 3169 EXIST::FUNCTION: | ||
| 2721 | BIGNUM_it 3170 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2722 | BIGNUM_it 3170 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2723 | AES_cbc_encrypt 3171 EXIST::FUNCTION:AES | ||
| 2724 | ENGINE_get_load_privkey_function 3172 EXIST:!VMS:FUNCTION:ENGINE | ||
| 2725 | ENGINE_get_load_privkey_fn 3172 EXIST:VMS:FUNCTION:ENGINE | ||
| 2726 | OCSP_RESPONSE_free 3173 EXIST::FUNCTION: | ||
| 2727 | UI_method_set_reader 3174 EXIST::FUNCTION: | ||
| 2728 | i2d_ASN1_T61STRING 3175 EXIST::FUNCTION: | ||
| 2729 | EC_POINT_set_to_infinity 3176 EXIST::FUNCTION:EC | ||
| 2730 | ERR_load_OCSP_strings 3177 EXIST::FUNCTION: | ||
| 2731 | EC_POINT_point2oct 3178 EXIST::FUNCTION:EC | ||
| 2732 | KRB5_APREQ_free 3179 EXIST::FUNCTION: | ||
| 2733 | ASN1_OBJECT_it 3180 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2734 | ASN1_OBJECT_it 3180 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2735 | OCSP_crlID_new 3181 EXIST:!OS2,!VMS:FUNCTION: | ||
| 2736 | OCSP_crlID2_new 3181 EXIST:OS2,VMS:FUNCTION: | ||
| 2737 | CONF_modules_load_file 3182 EXIST::FUNCTION: | ||
| 2738 | CONF_imodule_set_usr_data 3183 EXIST::FUNCTION: | ||
| 2739 | ENGINE_set_default_string 3184 EXIST::FUNCTION:ENGINE | ||
| 2740 | CONF_module_get_usr_data 3185 EXIST::FUNCTION: | ||
| 2741 | ASN1_add_oid_module 3186 EXIST::FUNCTION: | ||
| 2742 | CONF_modules_finish 3187 EXIST::FUNCTION: | ||
| 2743 | OPENSSL_config 3188 EXIST::FUNCTION: | ||
| 2744 | CONF_modules_unload 3189 EXIST::FUNCTION: | ||
| 2745 | CONF_imodule_get_value 3190 EXIST::FUNCTION: | ||
| 2746 | CONF_module_set_usr_data 3191 EXIST::FUNCTION: | ||
| 2747 | CONF_parse_list 3192 EXIST::FUNCTION: | ||
| 2748 | CONF_module_add 3193 EXIST::FUNCTION: | ||
| 2749 | CONF_get1_default_config_file 3194 EXIST::FUNCTION: | ||
| 2750 | CONF_imodule_get_flags 3195 EXIST::FUNCTION: | ||
| 2751 | CONF_imodule_get_module 3196 EXIST::FUNCTION: | ||
| 2752 | CONF_modules_load 3197 EXIST::FUNCTION: | ||
| 2753 | CONF_imodule_get_name 3198 EXIST::FUNCTION: | ||
| 2754 | ERR_peek_top_error 3199 NOEXIST::FUNCTION: | ||
| 2755 | CONF_imodule_get_usr_data 3200 EXIST::FUNCTION: | ||
| 2756 | CONF_imodule_set_flags 3201 EXIST::FUNCTION: | ||
| 2757 | ENGINE_add_conf_module 3202 EXIST::FUNCTION:ENGINE | ||
| 2758 | ERR_peek_last_error_line 3203 EXIST::FUNCTION: | ||
| 2759 | ERR_peek_last_error_line_data 3204 EXIST::FUNCTION: | ||
| 2760 | ERR_peek_last_error 3205 EXIST::FUNCTION: | ||
| 2761 | DES_read_2passwords 3206 EXIST::FUNCTION:DES | ||
| 2762 | DES_read_password 3207 EXIST::FUNCTION:DES | ||
| 2763 | UI_UTIL_read_pw 3208 EXIST::FUNCTION: | ||
| 2764 | UI_UTIL_read_pw_string 3209 EXIST::FUNCTION: | ||
| 2765 | ENGINE_load_aep 3210 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2766 | ENGINE_load_sureware 3211 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2767 | OPENSSL_add_all_algorithms_noconf 3212 EXIST:!VMS:FUNCTION: | ||
| 2768 | OPENSSL_add_all_algo_noconf 3212 EXIST:VMS:FUNCTION: | ||
| 2769 | OPENSSL_add_all_algorithms_conf 3213 EXIST:!VMS:FUNCTION: | ||
| 2770 | OPENSSL_add_all_algo_conf 3213 EXIST:VMS:FUNCTION: | ||
| 2771 | OPENSSL_load_builtin_modules 3214 EXIST::FUNCTION: | ||
| 2772 | AES_ofb128_encrypt 3215 EXIST::FUNCTION:AES | ||
| 2773 | AES_ctr128_encrypt 3216 EXIST::FUNCTION:AES | ||
| 2774 | AES_cfb128_encrypt 3217 EXIST::FUNCTION:AES | ||
| 2775 | ENGINE_load_4758cca 3218 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 2776 | _ossl_096_des_random_seed 3219 EXIST::FUNCTION:DES | ||
| 2777 | EVP_aes_256_ofb 3220 EXIST::FUNCTION:AES | ||
| 2778 | EVP_aes_192_ofb 3221 EXIST::FUNCTION:AES | ||
| 2779 | EVP_aes_128_cfb128 3222 EXIST::FUNCTION:AES | ||
| 2780 | EVP_aes_256_cfb128 3223 EXIST::FUNCTION:AES | ||
| 2781 | EVP_aes_128_ofb 3224 EXIST::FUNCTION:AES | ||
| 2782 | EVP_aes_192_cfb128 3225 EXIST::FUNCTION:AES | ||
| 2783 | CONF_modules_free 3226 EXIST::FUNCTION: | ||
| 2784 | NCONF_default 3227 EXIST::FUNCTION: | ||
| 2785 | OPENSSL_no_config 3228 EXIST::FUNCTION: | ||
| 2786 | NCONF_WIN32 3229 EXIST::FUNCTION: | ||
| 2787 | ASN1_UNIVERSALSTRING_new 3230 EXIST::FUNCTION: | ||
| 2788 | EVP_des_ede_ecb 3231 EXIST::FUNCTION:DES | ||
| 2789 | i2d_ASN1_UNIVERSALSTRING 3232 EXIST::FUNCTION: | ||
| 2790 | ASN1_UNIVERSALSTRING_free 3233 EXIST::FUNCTION: | ||
| 2791 | ASN1_UNIVERSALSTRING_it 3234 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2792 | ASN1_UNIVERSALSTRING_it 3234 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2793 | d2i_ASN1_UNIVERSALSTRING 3235 EXIST::FUNCTION: | ||
| 2794 | EVP_des_ede3_ecb 3236 EXIST::FUNCTION:DES | ||
| 2795 | X509_REQ_print_ex 3237 EXIST::FUNCTION:BIO | ||
| 2796 | ENGINE_up_ref 3238 EXIST::FUNCTION:ENGINE | ||
| 2797 | BUF_MEM_grow_clean 3239 EXIST::FUNCTION: | ||
| 2798 | CRYPTO_realloc_clean 3240 EXIST::FUNCTION: | ||
| 2799 | BUF_strlcat 3241 EXIST::FUNCTION: | ||
| 2800 | BIO_indent 3242 EXIST::FUNCTION: | ||
| 2801 | BUF_strlcpy 3243 EXIST::FUNCTION: | ||
| 2802 | OpenSSLDie 3244 EXIST::FUNCTION: | ||
| 2803 | OPENSSL_cleanse 3245 EXIST::FUNCTION: | ||
| 2804 | ENGINE_setup_bsd_cryptodev 3246 EXIST:__FreeBSD__:FUNCTION:ENGINE | ||
| 2805 | ERR_release_err_state_table 3247 EXIST::FUNCTION:LHASH | ||
| 2806 | EVP_aes_128_cfb8 3248 EXIST::FUNCTION:AES | ||
| 2807 | FIPS_corrupt_rsa 3249 NOEXIST::FUNCTION: | ||
| 2808 | FIPS_selftest_des 3250 NOEXIST::FUNCTION: | ||
| 2809 | EVP_aes_128_cfb1 3251 EXIST::FUNCTION:AES | ||
| 2810 | EVP_aes_192_cfb8 3252 EXIST::FUNCTION:AES | ||
| 2811 | FIPS_mode_set 3253 NOEXIST::FUNCTION: | ||
| 2812 | FIPS_selftest_dsa 3254 NOEXIST::FUNCTION: | ||
| 2813 | EVP_aes_256_cfb8 3255 EXIST::FUNCTION:AES | ||
| 2814 | FIPS_allow_md5 3256 NOEXIST::FUNCTION: | ||
| 2815 | DES_ede3_cfb_encrypt 3257 EXIST::FUNCTION:DES | ||
| 2816 | EVP_des_ede3_cfb8 3258 EXIST::FUNCTION:DES | ||
| 2817 | FIPS_rand_seeded 3259 NOEXIST::FUNCTION: | ||
| 2818 | AES_cfbr_encrypt_block 3260 NOEXIST::FUNCTION: | ||
| 2819 | AES_cfb8_encrypt 3261 EXIST::FUNCTION:AES | ||
| 2820 | FIPS_rand_seed 3262 NOEXIST::FUNCTION: | ||
| 2821 | FIPS_corrupt_des 3263 NOEXIST::FUNCTION: | ||
| 2822 | EVP_aes_192_cfb1 3264 EXIST::FUNCTION:AES | ||
| 2823 | FIPS_selftest_aes 3265 NOEXIST::FUNCTION: | ||
| 2824 | FIPS_set_prng_key 3266 NOEXIST::FUNCTION: | ||
| 2825 | EVP_des_cfb8 3267 EXIST::FUNCTION:DES | ||
| 2826 | FIPS_corrupt_dsa 3268 NOEXIST::FUNCTION: | ||
| 2827 | FIPS_test_mode 3269 NOEXIST::FUNCTION: | ||
| 2828 | FIPS_rand_method 3270 NOEXIST::FUNCTION: | ||
| 2829 | EVP_aes_256_cfb1 3271 EXIST::FUNCTION:AES | ||
| 2830 | ERR_load_FIPS_strings 3272 NOEXIST::FUNCTION: | ||
| 2831 | FIPS_corrupt_aes 3273 NOEXIST::FUNCTION: | ||
| 2832 | FIPS_selftest_sha1 3274 NOEXIST::FUNCTION: | ||
| 2833 | FIPS_selftest_rsa 3275 NOEXIST::FUNCTION: | ||
| 2834 | FIPS_corrupt_sha1 3276 NOEXIST::FUNCTION: | ||
| 2835 | EVP_des_cfb1 3277 EXIST::FUNCTION:DES | ||
| 2836 | FIPS_dsa_check 3278 NOEXIST::FUNCTION: | ||
| 2837 | AES_cfb1_encrypt 3279 EXIST::FUNCTION:AES | ||
| 2838 | EVP_des_ede3_cfb1 3280 EXIST::FUNCTION:DES | ||
| 2839 | FIPS_rand_check 3281 NOEXIST::FUNCTION: | ||
| 2840 | FIPS_md5_allowed 3282 NOEXIST::FUNCTION: | ||
| 2841 | FIPS_mode 3283 NOEXIST::FUNCTION: | ||
| 2842 | FIPS_selftest_failed 3284 NOEXIST::FUNCTION: | ||
| 2843 | sk_is_sorted 3285 EXIST::FUNCTION: | ||
| 2844 | X509_check_ca 3286 EXIST::FUNCTION: | ||
| 2845 | private_idea_set_encrypt_key 3287 NOEXIST::FUNCTION: | ||
| 2846 | HMAC_CTX_set_flags 3288 EXIST::FUNCTION:HMAC | ||
| 2847 | private_SHA_Init 3289 NOEXIST::FUNCTION: | ||
| 2848 | private_CAST_set_key 3290 NOEXIST::FUNCTION: | ||
| 2849 | private_RIPEMD160_Init 3291 NOEXIST::FUNCTION: | ||
| 2850 | private_RC5_32_set_key 3292 NOEXIST::FUNCTION: | ||
| 2851 | private_MD5_Init 3293 NOEXIST::FUNCTION: | ||
| 2852 | private_RC4_set_key 3294 NOEXIST::FUNCTION: | ||
| 2853 | private_MDC2_Init 3295 NOEXIST::FUNCTION: | ||
| 2854 | private_RC2_set_key 3296 NOEXIST::FUNCTION: | ||
| 2855 | private_MD4_Init 3297 NOEXIST::FUNCTION: | ||
| 2856 | private_BF_set_key 3298 NOEXIST::FUNCTION: | ||
| 2857 | private_MD2_Init 3299 NOEXIST::FUNCTION: | ||
| 2858 | d2i_PROXY_CERT_INFO_EXTENSION 3300 EXIST::FUNCTION: | ||
| 2859 | PROXY_POLICY_it 3301 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2860 | PROXY_POLICY_it 3301 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2861 | i2d_PROXY_POLICY 3302 EXIST::FUNCTION: | ||
| 2862 | i2d_PROXY_CERT_INFO_EXTENSION 3303 EXIST::FUNCTION: | ||
| 2863 | d2i_PROXY_POLICY 3304 EXIST::FUNCTION: | ||
| 2864 | PROXY_CERT_INFO_EXTENSION_new 3305 EXIST::FUNCTION: | ||
| 2865 | PROXY_CERT_INFO_EXTENSION_free 3306 EXIST::FUNCTION: | ||
| 2866 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2867 | PROXY_CERT_INFO_EXTENSION_it 3307 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2868 | PROXY_POLICY_free 3308 EXIST::FUNCTION: | ||
| 2869 | PROXY_POLICY_new 3309 EXIST::FUNCTION: | ||
| 2870 | BN_MONT_CTX_set_locked 3310 EXIST::FUNCTION: | ||
| 2871 | FIPS_selftest_rng 3311 NOEXIST::FUNCTION: | ||
| 2872 | EVP_sha384 3312 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 2873 | EVP_sha512 3313 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 2874 | EVP_sha224 3314 EXIST::FUNCTION:SHA,SHA256 | ||
| 2875 | EVP_sha256 3315 EXIST::FUNCTION:SHA,SHA256 | ||
| 2876 | FIPS_selftest_hmac 3316 NOEXIST::FUNCTION: | ||
| 2877 | FIPS_corrupt_rng 3317 NOEXIST::FUNCTION: | ||
| 2878 | BN_mod_exp_mont_consttime 3318 EXIST::FUNCTION: | ||
| 2879 | RSA_X931_hash_id 3319 EXIST::FUNCTION:RSA | ||
| 2880 | RSA_padding_check_X931 3320 EXIST::FUNCTION:RSA | ||
| 2881 | RSA_verify_PKCS1_PSS 3321 EXIST::FUNCTION:RSA | ||
| 2882 | RSA_padding_add_X931 3322 EXIST::FUNCTION:RSA | ||
| 2883 | RSA_padding_add_PKCS1_PSS 3323 EXIST::FUNCTION:RSA | ||
| 2884 | PKCS1_MGF1 3324 EXIST::FUNCTION:RSA | ||
| 2885 | BN_X931_generate_Xpq 3325 NOEXIST::FUNCTION: | ||
| 2886 | RSA_X931_generate_key 3326 NOEXIST::FUNCTION: | ||
| 2887 | BN_X931_derive_prime 3327 NOEXIST::FUNCTION: | ||
| 2888 | BN_X931_generate_prime 3328 NOEXIST::FUNCTION: | ||
| 2889 | RSA_X931_derive 3329 NOEXIST::FUNCTION: | ||
| 2890 | BIO_new_dgram 3330 EXIST::FUNCTION: | ||
| 2891 | BN_get0_nist_prime_384 3331 EXIST::FUNCTION: | ||
| 2892 | ERR_set_mark 3332 EXIST::FUNCTION: | ||
| 2893 | X509_STORE_CTX_set0_crls 3333 EXIST::FUNCTION: | ||
| 2894 | ENGINE_set_STORE 3334 EXIST::FUNCTION:ENGINE | ||
| 2895 | ENGINE_register_ECDSA 3335 EXIST::FUNCTION:ENGINE | ||
| 2896 | STORE_meth_set_list_start_fn 3336 NOEXIST::FUNCTION: | ||
| 2897 | STORE_method_set_list_start_function 3336 NOEXIST::FUNCTION: | ||
| 2898 | BN_BLINDING_invert_ex 3337 EXIST::FUNCTION: | ||
| 2899 | NAME_CONSTRAINTS_free 3338 EXIST::FUNCTION: | ||
| 2900 | STORE_ATTR_INFO_set_number 3339 NOEXIST::FUNCTION: | ||
| 2901 | BN_BLINDING_get_thread_id 3340 EXIST::FUNCTION:DEPRECATED | ||
| 2902 | X509_STORE_CTX_set0_param 3341 EXIST::FUNCTION: | ||
| 2903 | POLICY_MAPPING_it 3342 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2904 | POLICY_MAPPING_it 3342 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2905 | STORE_parse_attrs_start 3343 NOEXIST::FUNCTION: | ||
| 2906 | POLICY_CONSTRAINTS_free 3344 EXIST::FUNCTION: | ||
| 2907 | EVP_PKEY_add1_attr_by_NID 3345 EXIST::FUNCTION: | ||
| 2908 | BN_nist_mod_192 3346 EXIST::FUNCTION: | ||
| 2909 | EC_GROUP_get_trinomial_basis 3347 EXIST::FUNCTION:EC | ||
| 2910 | STORE_set_method 3348 NOEXIST::FUNCTION: | ||
| 2911 | GENERAL_SUBTREE_free 3349 EXIST::FUNCTION: | ||
| 2912 | NAME_CONSTRAINTS_it 3350 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2913 | NAME_CONSTRAINTS_it 3350 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2914 | ECDH_get_default_method 3351 EXIST::FUNCTION:ECDH | ||
| 2915 | PKCS12_add_safe 3352 EXIST::FUNCTION: | ||
| 2916 | EC_KEY_new_by_curve_name 3353 EXIST::FUNCTION:EC | ||
| 2917 | STORE_meth_get_update_store_fn 3354 NOEXIST::FUNCTION: | ||
| 2918 | STORE_method_get_update_store_function 3354 NOEXIST::FUNCTION: | ||
| 2919 | ENGINE_register_ECDH 3355 EXIST::FUNCTION:ENGINE | ||
| 2920 | SHA512_Update 3356 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 2921 | i2d_ECPrivateKey 3357 EXIST::FUNCTION:EC | ||
| 2922 | BN_get0_nist_prime_192 3358 EXIST::FUNCTION: | ||
| 2923 | STORE_modify_certificate 3359 NOEXIST::FUNCTION: | ||
| 2924 | EC_POINT_set_affine_coordinates_GF2m 3360 EXIST:!VMS:FUNCTION:EC | ||
| 2925 | EC_POINT_set_affine_coords_GF2m 3360 EXIST:VMS:FUNCTION:EC | ||
| 2926 | BN_GF2m_mod_exp_arr 3361 EXIST::FUNCTION: | ||
| 2927 | STORE_ATTR_INFO_modify_number 3362 NOEXIST::FUNCTION: | ||
| 2928 | X509_keyid_get0 3363 EXIST::FUNCTION: | ||
| 2929 | ENGINE_load_gmp 3364 EXIST::FUNCTION:ENGINE,GMP,STATIC_ENGINE | ||
| 2930 | pitem_new 3365 EXIST::FUNCTION: | ||
| 2931 | BN_GF2m_mod_mul_arr 3366 EXIST::FUNCTION: | ||
| 2932 | STORE_list_public_key_endp 3367 NOEXIST::FUNCTION: | ||
| 2933 | o2i_ECPublicKey 3368 EXIST::FUNCTION:EC | ||
| 2934 | EC_KEY_copy 3369 EXIST::FUNCTION:EC | ||
| 2935 | BIO_dump_fp 3370 EXIST::FUNCTION:FP_API | ||
| 2936 | X509_policy_node_get0_parent 3371 EXIST::FUNCTION: | ||
| 2937 | EC_GROUP_check_discriminant 3372 EXIST::FUNCTION:EC | ||
| 2938 | i2o_ECPublicKey 3373 EXIST::FUNCTION:EC | ||
| 2939 | EC_KEY_precompute_mult 3374 EXIST::FUNCTION:EC | ||
| 2940 | a2i_IPADDRESS 3375 EXIST::FUNCTION: | ||
| 2941 | STORE_meth_set_initialise_fn 3376 NOEXIST::FUNCTION: | ||
| 2942 | STORE_method_set_initialise_function 3376 NOEXIST::FUNCTION: | ||
| 2943 | X509_STORE_CTX_set_depth 3377 EXIST::FUNCTION: | ||
| 2944 | X509_VERIFY_PARAM_inherit 3378 EXIST::FUNCTION: | ||
| 2945 | EC_POINT_point2bn 3379 EXIST::FUNCTION:EC | ||
| 2946 | STORE_ATTR_INFO_set_dn 3380 NOEXIST::FUNCTION: | ||
| 2947 | X509_policy_tree_get0_policies 3381 EXIST::FUNCTION: | ||
| 2948 | EC_GROUP_new_curve_GF2m 3382 EXIST::FUNCTION:EC | ||
| 2949 | STORE_destroy_method 3383 NOEXIST::FUNCTION: | ||
| 2950 | ENGINE_unregister_STORE 3384 EXIST::FUNCTION:ENGINE | ||
| 2951 | EVP_PKEY_get1_EC_KEY 3385 EXIST::FUNCTION:EC | ||
| 2952 | STORE_ATTR_INFO_get0_number 3386 NOEXIST::FUNCTION: | ||
| 2953 | ENGINE_get_default_ECDH 3387 EXIST::FUNCTION:ENGINE | ||
| 2954 | EC_KEY_get_conv_form 3388 EXIST::FUNCTION:EC | ||
| 2955 | ASN1_OCTET_STRING_NDEF_it 3389 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 2956 | ASN1_OCTET_STRING_NDEF_it 3389 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 2957 | STORE_delete_public_key 3390 NOEXIST::FUNCTION: | ||
| 2958 | STORE_get_public_key 3391 NOEXIST::FUNCTION: | ||
| 2959 | STORE_modify_arbitrary 3392 NOEXIST::FUNCTION: | ||
| 2960 | ENGINE_get_static_state 3393 EXIST::FUNCTION:ENGINE | ||
| 2961 | pqueue_iterator 3394 EXIST::FUNCTION: | ||
| 2962 | ECDSA_SIG_new 3395 EXIST::FUNCTION:ECDSA | ||
| 2963 | OPENSSL_DIR_end 3396 EXIST::FUNCTION: | ||
| 2964 | BN_GF2m_mod_sqr 3397 EXIST::FUNCTION: | ||
| 2965 | EC_POINT_bn2point 3398 EXIST::FUNCTION:EC | ||
| 2966 | X509_VERIFY_PARAM_set_depth 3399 EXIST::FUNCTION: | ||
| 2967 | EC_KEY_set_asn1_flag 3400 EXIST::FUNCTION:EC | ||
| 2968 | STORE_get_method 3401 NOEXIST::FUNCTION: | ||
| 2969 | EC_KEY_get_key_method_data 3402 EXIST::FUNCTION:EC | ||
| 2970 | ECDSA_sign_ex 3403 EXIST::FUNCTION:ECDSA | ||
| 2971 | STORE_parse_attrs_end 3404 NOEXIST::FUNCTION: | ||
| 2972 | EC_GROUP_get_point_conversion_form 3405 EXIST:!VMS:FUNCTION:EC | ||
| 2973 | EC_GROUP_get_point_conv_form 3405 EXIST:VMS:FUNCTION:EC | ||
| 2974 | STORE_method_set_store_function 3406 NOEXIST::FUNCTION: | ||
| 2975 | STORE_ATTR_INFO_in 3407 NOEXIST::FUNCTION: | ||
| 2976 | PEM_read_bio_ECPKParameters 3408 EXIST::FUNCTION:EC | ||
| 2977 | EC_GROUP_get_pentanomial_basis 3409 EXIST::FUNCTION:EC | ||
| 2978 | EVP_PKEY_add1_attr_by_txt 3410 EXIST::FUNCTION: | ||
| 2979 | BN_BLINDING_set_flags 3411 EXIST::FUNCTION: | ||
| 2980 | X509_VERIFY_PARAM_set1_policies 3412 EXIST::FUNCTION: | ||
| 2981 | X509_VERIFY_PARAM_set1_name 3413 EXIST::FUNCTION: | ||
| 2982 | X509_VERIFY_PARAM_set_purpose 3414 EXIST::FUNCTION: | ||
| 2983 | STORE_get_number 3415 NOEXIST::FUNCTION: | ||
| 2984 | ECDSA_sign_setup 3416 EXIST::FUNCTION:ECDSA | ||
| 2985 | BN_GF2m_mod_solve_quad_arr 3417 EXIST::FUNCTION: | ||
| 2986 | EC_KEY_up_ref 3418 EXIST::FUNCTION:EC | ||
| 2987 | POLICY_MAPPING_free 3419 EXIST::FUNCTION: | ||
| 2988 | BN_GF2m_mod_div 3420 EXIST::FUNCTION: | ||
| 2989 | X509_VERIFY_PARAM_set_flags 3421 EXIST::FUNCTION: | ||
| 2990 | EC_KEY_free 3422 EXIST::FUNCTION:EC | ||
| 2991 | STORE_meth_set_list_next_fn 3423 NOEXIST::FUNCTION: | ||
| 2992 | STORE_method_set_list_next_function 3423 NOEXIST::FUNCTION: | ||
| 2993 | PEM_write_bio_ECPrivateKey 3424 EXIST::FUNCTION:EC | ||
| 2994 | d2i_EC_PUBKEY 3425 EXIST::FUNCTION:EC | ||
| 2995 | STORE_meth_get_generate_fn 3426 NOEXIST::FUNCTION: | ||
| 2996 | STORE_method_get_generate_function 3426 NOEXIST::FUNCTION: | ||
| 2997 | STORE_meth_set_list_end_fn 3427 NOEXIST::FUNCTION: | ||
| 2998 | STORE_method_set_list_end_function 3427 NOEXIST::FUNCTION: | ||
| 2999 | pqueue_print 3428 EXIST::FUNCTION: | ||
| 3000 | EC_GROUP_have_precompute_mult 3429 EXIST::FUNCTION:EC | ||
| 3001 | EC_KEY_print_fp 3430 EXIST::FUNCTION:EC,FP_API | ||
| 3002 | BN_GF2m_mod_arr 3431 EXIST::FUNCTION: | ||
| 3003 | PEM_write_bio_X509_CERT_PAIR 3432 EXIST::FUNCTION: | ||
| 3004 | EVP_PKEY_cmp 3433 EXIST::FUNCTION: | ||
| 3005 | X509_policy_level_node_count 3434 EXIST::FUNCTION: | ||
| 3006 | STORE_new_engine 3435 NOEXIST::FUNCTION: | ||
| 3007 | STORE_list_public_key_start 3436 NOEXIST::FUNCTION: | ||
| 3008 | X509_VERIFY_PARAM_new 3437 EXIST::FUNCTION: | ||
| 3009 | ECDH_get_ex_data 3438 EXIST::FUNCTION:ECDH | ||
| 3010 | EVP_PKEY_get_attr 3439 EXIST::FUNCTION: | ||
| 3011 | ECDSA_do_sign 3440 EXIST::FUNCTION:ECDSA | ||
| 3012 | ENGINE_unregister_ECDH 3441 EXIST::FUNCTION:ENGINE | ||
| 3013 | ECDH_OpenSSL 3442 EXIST::FUNCTION:ECDH | ||
| 3014 | EC_KEY_set_conv_form 3443 EXIST::FUNCTION:EC | ||
| 3015 | EC_POINT_dup 3444 EXIST::FUNCTION:EC | ||
| 3016 | GENERAL_SUBTREE_new 3445 EXIST::FUNCTION: | ||
| 3017 | STORE_list_crl_endp 3446 NOEXIST::FUNCTION: | ||
| 3018 | EC_get_builtin_curves 3447 EXIST::FUNCTION:EC | ||
| 3019 | X509_policy_node_get0_qualifiers 3448 EXIST:!VMS:FUNCTION: | ||
| 3020 | X509_pcy_node_get0_qualifiers 3448 EXIST:VMS:FUNCTION: | ||
| 3021 | STORE_list_crl_end 3449 NOEXIST::FUNCTION: | ||
| 3022 | EVP_PKEY_set1_EC_KEY 3450 EXIST::FUNCTION:EC | ||
| 3023 | BN_GF2m_mod_sqrt_arr 3451 EXIST::FUNCTION: | ||
| 3024 | i2d_ECPrivateKey_bio 3452 EXIST::FUNCTION:BIO,EC | ||
| 3025 | ECPKParameters_print_fp 3453 EXIST::FUNCTION:EC,FP_API | ||
| 3026 | pqueue_find 3454 EXIST::FUNCTION: | ||
| 3027 | ECDSA_SIG_free 3455 EXIST::FUNCTION:ECDSA | ||
| 3028 | PEM_write_bio_ECPKParameters 3456 EXIST::FUNCTION:EC | ||
| 3029 | STORE_method_set_ctrl_function 3457 NOEXIST::FUNCTION: | ||
| 3030 | STORE_list_public_key_end 3458 NOEXIST::FUNCTION: | ||
| 3031 | EC_KEY_set_private_key 3459 EXIST::FUNCTION:EC | ||
| 3032 | pqueue_peek 3460 EXIST::FUNCTION: | ||
| 3033 | STORE_get_arbitrary 3461 NOEXIST::FUNCTION: | ||
| 3034 | STORE_store_crl 3462 NOEXIST::FUNCTION: | ||
| 3035 | X509_policy_node_get0_policy 3463 EXIST::FUNCTION: | ||
| 3036 | PKCS12_add_safes 3464 EXIST::FUNCTION: | ||
| 3037 | BN_BLINDING_convert_ex 3465 EXIST::FUNCTION: | ||
| 3038 | X509_policy_tree_free 3466 EXIST::FUNCTION: | ||
| 3039 | OPENSSL_ia32cap_loc 3467 EXIST::FUNCTION: | ||
| 3040 | BN_GF2m_poly2arr 3468 EXIST::FUNCTION: | ||
| 3041 | STORE_ctrl 3469 NOEXIST::FUNCTION: | ||
| 3042 | STORE_ATTR_INFO_compare 3470 NOEXIST::FUNCTION: | ||
| 3043 | BN_get0_nist_prime_224 3471 EXIST::FUNCTION: | ||
| 3044 | i2d_ECParameters 3472 EXIST::FUNCTION:EC | ||
| 3045 | i2d_ECPKParameters 3473 EXIST::FUNCTION:EC | ||
| 3046 | BN_GENCB_call 3474 EXIST::FUNCTION: | ||
| 3047 | d2i_ECPKParameters 3475 EXIST::FUNCTION:EC | ||
| 3048 | STORE_meth_set_generate_fn 3476 NOEXIST::FUNCTION: | ||
| 3049 | STORE_method_set_generate_function 3476 NOEXIST::FUNCTION: | ||
| 3050 | ENGINE_set_ECDH 3477 EXIST::FUNCTION:ENGINE | ||
| 3051 | NAME_CONSTRAINTS_new 3478 EXIST::FUNCTION: | ||
| 3052 | SHA256_Init 3479 EXIST::FUNCTION:SHA,SHA256 | ||
| 3053 | EC_KEY_get0_public_key 3480 EXIST::FUNCTION:EC | ||
| 3054 | PEM_write_bio_EC_PUBKEY 3481 EXIST::FUNCTION:EC | ||
| 3055 | STORE_ATTR_INFO_set_cstr 3482 NOEXIST::FUNCTION: | ||
| 3056 | STORE_list_crl_next 3483 NOEXIST::FUNCTION: | ||
| 3057 | STORE_ATTR_INFO_in_range 3484 NOEXIST::FUNCTION: | ||
| 3058 | ECParameters_print 3485 EXIST::FUNCTION:BIO,EC | ||
| 3059 | STORE_meth_set_delete_fn 3486 NOEXIST::FUNCTION: | ||
| 3060 | STORE_method_set_delete_function 3486 NOEXIST::FUNCTION: | ||
| 3061 | STORE_list_certificate_next 3487 NOEXIST::FUNCTION: | ||
| 3062 | ASN1_generate_nconf 3488 EXIST::FUNCTION: | ||
| 3063 | BUF_memdup 3489 EXIST::FUNCTION: | ||
| 3064 | BN_GF2m_mod_mul 3490 EXIST::FUNCTION: | ||
| 3065 | STORE_meth_get_list_next_fn 3491 NOEXIST::FUNCTION: | ||
| 3066 | STORE_method_get_list_next_function 3491 NOEXIST::FUNCTION: | ||
| 3067 | STORE_ATTR_INFO_get0_dn 3492 NOEXIST::FUNCTION: | ||
| 3068 | STORE_list_private_key_next 3493 NOEXIST::FUNCTION: | ||
| 3069 | EC_GROUP_set_seed 3494 EXIST::FUNCTION:EC | ||
| 3070 | X509_VERIFY_PARAM_set_trust 3495 EXIST::FUNCTION: | ||
| 3071 | STORE_ATTR_INFO_free 3496 NOEXIST::FUNCTION: | ||
| 3072 | STORE_get_private_key 3497 NOEXIST::FUNCTION: | ||
| 3073 | EVP_PKEY_get_attr_count 3498 EXIST::FUNCTION: | ||
| 3074 | STORE_ATTR_INFO_new 3499 NOEXIST::FUNCTION: | ||
| 3075 | EC_GROUP_get_curve_GF2m 3500 EXIST::FUNCTION:EC | ||
| 3076 | STORE_meth_set_revoke_fn 3501 NOEXIST::FUNCTION: | ||
| 3077 | STORE_method_set_revoke_function 3501 NOEXIST::FUNCTION: | ||
| 3078 | STORE_store_number 3502 NOEXIST::FUNCTION: | ||
| 3079 | BN_is_prime_ex 3503 EXIST::FUNCTION: | ||
| 3080 | STORE_revoke_public_key 3504 NOEXIST::FUNCTION: | ||
| 3081 | X509_STORE_CTX_get0_param 3505 EXIST::FUNCTION: | ||
| 3082 | STORE_delete_arbitrary 3506 NOEXIST::FUNCTION: | ||
| 3083 | PEM_read_X509_CERT_PAIR 3507 EXIST:!WIN16:FUNCTION: | ||
| 3084 | X509_STORE_set_depth 3508 EXIST::FUNCTION: | ||
| 3085 | ECDSA_get_ex_data 3509 EXIST::FUNCTION:ECDSA | ||
| 3086 | SHA224 3510 EXIST::FUNCTION:SHA,SHA256 | ||
| 3087 | BIO_dump_indent_fp 3511 EXIST::FUNCTION:FP_API | ||
| 3088 | EC_KEY_set_group 3512 EXIST::FUNCTION:EC | ||
| 3089 | BUF_strndup 3513 EXIST::FUNCTION: | ||
| 3090 | STORE_list_certificate_start 3514 NOEXIST::FUNCTION: | ||
| 3091 | BN_GF2m_mod 3515 EXIST::FUNCTION: | ||
| 3092 | X509_REQ_check_private_key 3516 EXIST::FUNCTION: | ||
| 3093 | EC_GROUP_get_seed_len 3517 EXIST::FUNCTION:EC | ||
| 3094 | ERR_load_STORE_strings 3518 NOEXIST::FUNCTION: | ||
| 3095 | PEM_read_bio_EC_PUBKEY 3519 EXIST::FUNCTION:EC | ||
| 3096 | STORE_list_private_key_end 3520 NOEXIST::FUNCTION: | ||
| 3097 | i2d_EC_PUBKEY 3521 EXIST::FUNCTION:EC | ||
| 3098 | ECDSA_get_default_method 3522 EXIST::FUNCTION:ECDSA | ||
| 3099 | ASN1_put_eoc 3523 EXIST::FUNCTION: | ||
| 3100 | X509_STORE_CTX_get_explicit_policy 3524 EXIST:!VMS:FUNCTION: | ||
| 3101 | X509_STORE_CTX_get_expl_policy 3524 EXIST:VMS:FUNCTION: | ||
| 3102 | X509_VERIFY_PARAM_table_cleanup 3525 EXIST::FUNCTION: | ||
| 3103 | STORE_modify_private_key 3526 NOEXIST::FUNCTION: | ||
| 3104 | X509_VERIFY_PARAM_free 3527 EXIST::FUNCTION: | ||
| 3105 | EC_METHOD_get_field_type 3528 EXIST::FUNCTION:EC | ||
| 3106 | EC_GFp_nist_method 3529 EXIST::FUNCTION:EC | ||
| 3107 | STORE_meth_set_modify_fn 3530 NOEXIST::FUNCTION: | ||
| 3108 | STORE_method_set_modify_function 3530 NOEXIST::FUNCTION: | ||
| 3109 | STORE_parse_attrs_next 3531 NOEXIST::FUNCTION: | ||
| 3110 | ENGINE_load_padlock 3532 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 3111 | EC_GROUP_set_curve_name 3533 EXIST::FUNCTION:EC | ||
| 3112 | X509_CERT_PAIR_it 3534 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3113 | X509_CERT_PAIR_it 3534 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3114 | STORE_meth_get_revoke_fn 3535 NOEXIST::FUNCTION: | ||
| 3115 | STORE_method_get_revoke_function 3535 NOEXIST::FUNCTION: | ||
| 3116 | STORE_method_set_get_function 3536 NOEXIST::FUNCTION: | ||
| 3117 | STORE_modify_number 3537 NOEXIST::FUNCTION: | ||
| 3118 | STORE_method_get_store_function 3538 NOEXIST::FUNCTION: | ||
| 3119 | STORE_store_private_key 3539 NOEXIST::FUNCTION: | ||
| 3120 | BN_GF2m_mod_sqr_arr 3540 EXIST::FUNCTION: | ||
| 3121 | RSA_setup_blinding 3541 EXIST::FUNCTION:RSA | ||
| 3122 | BIO_s_datagram 3542 EXIST::FUNCTION:DGRAM | ||
| 3123 | STORE_Memory 3543 NOEXIST::FUNCTION: | ||
| 3124 | sk_find_ex 3544 EXIST::FUNCTION: | ||
| 3125 | EC_GROUP_set_curve_GF2m 3545 EXIST::FUNCTION:EC | ||
| 3126 | ENGINE_set_default_ECDSA 3546 EXIST::FUNCTION:ENGINE | ||
| 3127 | POLICY_CONSTRAINTS_new 3547 EXIST::FUNCTION: | ||
| 3128 | BN_GF2m_mod_sqrt 3548 EXIST::FUNCTION: | ||
| 3129 | ECDH_set_default_method 3549 EXIST::FUNCTION:ECDH | ||
| 3130 | EC_KEY_generate_key 3550 EXIST::FUNCTION:EC | ||
| 3131 | SHA384_Update 3551 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3132 | BN_GF2m_arr2poly 3552 EXIST::FUNCTION: | ||
| 3133 | STORE_method_get_get_function 3553 NOEXIST::FUNCTION: | ||
| 3134 | STORE_meth_set_cleanup_fn 3554 NOEXIST::FUNCTION: | ||
| 3135 | STORE_method_set_cleanup_function 3554 NOEXIST::FUNCTION: | ||
| 3136 | EC_GROUP_check 3555 EXIST::FUNCTION:EC | ||
| 3137 | d2i_ECPrivateKey_bio 3556 EXIST::FUNCTION:BIO,EC | ||
| 3138 | EC_KEY_insert_key_method_data 3557 EXIST::FUNCTION:EC | ||
| 3139 | STORE_meth_get_lock_store_fn 3558 NOEXIST::FUNCTION: | ||
| 3140 | STORE_method_get_lock_store_function 3558 NOEXIST::FUNCTION: | ||
| 3141 | X509_VERIFY_PARAM_get_depth 3559 EXIST::FUNCTION: | ||
| 3142 | SHA224_Final 3560 EXIST::FUNCTION:SHA,SHA256 | ||
| 3143 | STORE_meth_set_update_store_fn 3561 NOEXIST::FUNCTION: | ||
| 3144 | STORE_method_set_update_store_function 3561 NOEXIST::FUNCTION: | ||
| 3145 | SHA224_Update 3562 EXIST::FUNCTION:SHA,SHA256 | ||
| 3146 | d2i_ECPrivateKey 3563 EXIST::FUNCTION:EC | ||
| 3147 | ASN1_item_ndef_i2d 3564 EXIST::FUNCTION: | ||
| 3148 | STORE_delete_private_key 3565 NOEXIST::FUNCTION: | ||
| 3149 | ERR_pop_to_mark 3566 EXIST::FUNCTION: | ||
| 3150 | ENGINE_register_all_STORE 3567 EXIST::FUNCTION:ENGINE | ||
| 3151 | X509_policy_level_get0_node 3568 EXIST::FUNCTION: | ||
| 3152 | i2d_PKCS7_NDEF 3569 EXIST::FUNCTION: | ||
| 3153 | EC_GROUP_get_degree 3570 EXIST::FUNCTION:EC | ||
| 3154 | ASN1_generate_v3 3571 EXIST::FUNCTION: | ||
| 3155 | STORE_ATTR_INFO_modify_cstr 3572 NOEXIST::FUNCTION: | ||
| 3156 | X509_policy_tree_level_count 3573 EXIST::FUNCTION: | ||
| 3157 | BN_GF2m_add 3574 EXIST::FUNCTION: | ||
| 3158 | EC_KEY_get0_group 3575 EXIST::FUNCTION:EC | ||
| 3159 | STORE_generate_crl 3576 NOEXIST::FUNCTION: | ||
| 3160 | STORE_store_public_key 3577 NOEXIST::FUNCTION: | ||
| 3161 | X509_CERT_PAIR_free 3578 EXIST::FUNCTION: | ||
| 3162 | STORE_revoke_private_key 3579 NOEXIST::FUNCTION: | ||
| 3163 | BN_nist_mod_224 3580 EXIST::FUNCTION: | ||
| 3164 | SHA512_Final 3581 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3165 | STORE_ATTR_INFO_modify_dn 3582 NOEXIST::FUNCTION: | ||
| 3166 | STORE_meth_get_initialise_fn 3583 NOEXIST::FUNCTION: | ||
| 3167 | STORE_method_get_initialise_function 3583 NOEXIST::FUNCTION: | ||
| 3168 | STORE_delete_number 3584 NOEXIST::FUNCTION: | ||
| 3169 | i2d_EC_PUBKEY_bio 3585 EXIST::FUNCTION:BIO,EC | ||
| 3170 | BIO_dgram_non_fatal_error 3586 EXIST::FUNCTION: | ||
| 3171 | EC_GROUP_get_asn1_flag 3587 EXIST::FUNCTION:EC | ||
| 3172 | STORE_ATTR_INFO_in_ex 3588 NOEXIST::FUNCTION: | ||
| 3173 | STORE_list_crl_start 3589 NOEXIST::FUNCTION: | ||
| 3174 | ECDH_get_ex_new_index 3590 EXIST::FUNCTION:ECDH | ||
| 3175 | STORE_meth_get_modify_fn 3591 NOEXIST::FUNCTION: | ||
| 3176 | STORE_method_get_modify_function 3591 NOEXIST::FUNCTION: | ||
| 3177 | v2i_ASN1_BIT_STRING 3592 EXIST::FUNCTION: | ||
| 3178 | STORE_store_certificate 3593 NOEXIST::FUNCTION: | ||
| 3179 | OBJ_bsearch_ex 3594 NOEXIST::FUNCTION: | ||
| 3180 | X509_STORE_CTX_set_default 3595 EXIST::FUNCTION: | ||
| 3181 | STORE_ATTR_INFO_set_sha1str 3596 NOEXIST::FUNCTION: | ||
| 3182 | BN_GF2m_mod_inv 3597 EXIST::FUNCTION: | ||
| 3183 | BN_GF2m_mod_exp 3598 EXIST::FUNCTION: | ||
| 3184 | STORE_modify_public_key 3599 NOEXIST::FUNCTION: | ||
| 3185 | STORE_meth_get_list_start_fn 3600 NOEXIST::FUNCTION: | ||
| 3186 | STORE_method_get_list_start_function 3600 NOEXIST::FUNCTION: | ||
| 3187 | EC_GROUP_get0_seed 3601 EXIST::FUNCTION:EC | ||
| 3188 | STORE_store_arbitrary 3602 NOEXIST::FUNCTION: | ||
| 3189 | STORE_meth_set_unlock_store_fn 3603 NOEXIST::FUNCTION: | ||
| 3190 | STORE_method_set_unlock_store_function 3603 NOEXIST::FUNCTION: | ||
| 3191 | BN_GF2m_mod_div_arr 3604 EXIST::FUNCTION: | ||
| 3192 | ENGINE_set_ECDSA 3605 EXIST::FUNCTION:ENGINE | ||
| 3193 | STORE_create_method 3606 NOEXIST::FUNCTION: | ||
| 3194 | ECPKParameters_print 3607 EXIST::FUNCTION:BIO,EC | ||
| 3195 | EC_KEY_get0_private_key 3608 EXIST::FUNCTION:EC | ||
| 3196 | PEM_write_EC_PUBKEY 3609 EXIST:!WIN16:FUNCTION:EC | ||
| 3197 | X509_VERIFY_PARAM_set1 3610 EXIST::FUNCTION: | ||
| 3198 | ECDH_set_method 3611 EXIST::FUNCTION:ECDH | ||
| 3199 | v2i_GENERAL_NAME_ex 3612 EXIST::FUNCTION: | ||
| 3200 | ECDH_set_ex_data 3613 EXIST::FUNCTION:ECDH | ||
| 3201 | STORE_generate_key 3614 NOEXIST::FUNCTION: | ||
| 3202 | BN_nist_mod_521 3615 EXIST::FUNCTION: | ||
| 3203 | X509_policy_tree_get0_level 3616 EXIST::FUNCTION: | ||
| 3204 | EC_GROUP_set_point_conversion_form 3617 EXIST:!VMS:FUNCTION:EC | ||
| 3205 | EC_GROUP_set_point_conv_form 3617 EXIST:VMS:FUNCTION:EC | ||
| 3206 | PEM_read_EC_PUBKEY 3618 EXIST:!WIN16:FUNCTION:EC | ||
| 3207 | i2d_ECDSA_SIG 3619 EXIST::FUNCTION:ECDSA | ||
| 3208 | ECDSA_OpenSSL 3620 EXIST::FUNCTION:ECDSA | ||
| 3209 | STORE_delete_crl 3621 NOEXIST::FUNCTION: | ||
| 3210 | EC_KEY_get_enc_flags 3622 EXIST::FUNCTION:EC | ||
| 3211 | ASN1_const_check_infinite_end 3623 EXIST::FUNCTION: | ||
| 3212 | EVP_PKEY_delete_attr 3624 EXIST::FUNCTION: | ||
| 3213 | ECDSA_set_default_method 3625 EXIST::FUNCTION:ECDSA | ||
| 3214 | EC_POINT_set_compressed_coordinates_GF2m 3626 EXIST:!VMS:FUNCTION:EC | ||
| 3215 | EC_POINT_set_compr_coords_GF2m 3626 EXIST:VMS:FUNCTION:EC | ||
| 3216 | EC_GROUP_cmp 3627 EXIST::FUNCTION:EC | ||
| 3217 | STORE_revoke_certificate 3628 NOEXIST::FUNCTION: | ||
| 3218 | BN_get0_nist_prime_256 3629 EXIST::FUNCTION: | ||
| 3219 | STORE_meth_get_delete_fn 3630 NOEXIST::FUNCTION: | ||
| 3220 | STORE_method_get_delete_function 3630 NOEXIST::FUNCTION: | ||
| 3221 | SHA224_Init 3631 EXIST::FUNCTION:SHA,SHA256 | ||
| 3222 | PEM_read_ECPrivateKey 3632 EXIST:!WIN16:FUNCTION:EC | ||
| 3223 | SHA512_Init 3633 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3224 | STORE_parse_attrs_endp 3634 NOEXIST::FUNCTION: | ||
| 3225 | BN_set_negative 3635 EXIST::FUNCTION: | ||
| 3226 | ERR_load_ECDSA_strings 3636 EXIST::FUNCTION:ECDSA | ||
| 3227 | EC_GROUP_get_basis_type 3637 EXIST::FUNCTION:EC | ||
| 3228 | STORE_list_public_key_next 3638 NOEXIST::FUNCTION: | ||
| 3229 | i2v_ASN1_BIT_STRING 3639 EXIST::FUNCTION: | ||
| 3230 | STORE_OBJECT_free 3640 NOEXIST::FUNCTION: | ||
| 3231 | BN_nist_mod_384 3641 EXIST::FUNCTION: | ||
| 3232 | i2d_X509_CERT_PAIR 3642 EXIST::FUNCTION: | ||
| 3233 | PEM_write_ECPKParameters 3643 EXIST:!WIN16:FUNCTION:EC | ||
| 3234 | ECDH_compute_key 3644 EXIST::FUNCTION:ECDH | ||
| 3235 | STORE_ATTR_INFO_get0_sha1str 3645 NOEXIST::FUNCTION: | ||
| 3236 | ENGINE_register_all_ECDH 3646 EXIST::FUNCTION:ENGINE | ||
| 3237 | pqueue_pop 3647 EXIST::FUNCTION: | ||
| 3238 | STORE_ATTR_INFO_get0_cstr 3648 NOEXIST::FUNCTION: | ||
| 3239 | POLICY_CONSTRAINTS_it 3649 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3240 | POLICY_CONSTRAINTS_it 3649 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3241 | STORE_get_ex_new_index 3650 NOEXIST::FUNCTION: | ||
| 3242 | EVP_PKEY_get_attr_by_OBJ 3651 EXIST::FUNCTION: | ||
| 3243 | X509_VERIFY_PARAM_add0_policy 3652 EXIST::FUNCTION: | ||
| 3244 | BN_GF2m_mod_solve_quad 3653 EXIST::FUNCTION: | ||
| 3245 | SHA256 3654 EXIST::FUNCTION:SHA,SHA256 | ||
| 3246 | i2d_ECPrivateKey_fp 3655 EXIST::FUNCTION:EC,FP_API | ||
| 3247 | X509_policy_tree_get0_user_policies 3656 EXIST:!VMS:FUNCTION: | ||
| 3248 | X509_pcy_tree_get0_usr_policies 3656 EXIST:VMS:FUNCTION: | ||
| 3249 | OPENSSL_DIR_read 3657 EXIST::FUNCTION: | ||
| 3250 | ENGINE_register_all_ECDSA 3658 EXIST::FUNCTION:ENGINE | ||
| 3251 | X509_VERIFY_PARAM_lookup 3659 EXIST::FUNCTION: | ||
| 3252 | EC_POINT_get_affine_coordinates_GF2m 3660 EXIST:!VMS:FUNCTION:EC | ||
| 3253 | EC_POINT_get_affine_coords_GF2m 3660 EXIST:VMS:FUNCTION:EC | ||
| 3254 | EC_GROUP_dup 3661 EXIST::FUNCTION:EC | ||
| 3255 | ENGINE_get_default_ECDSA 3662 EXIST::FUNCTION:ENGINE | ||
| 3256 | EC_KEY_new 3663 EXIST::FUNCTION:EC | ||
| 3257 | SHA256_Transform 3664 EXIST::FUNCTION:SHA,SHA256 | ||
| 3258 | EC_KEY_set_enc_flags 3665 EXIST::FUNCTION:EC | ||
| 3259 | ECDSA_verify 3666 EXIST::FUNCTION:ECDSA | ||
| 3260 | EC_POINT_point2hex 3667 EXIST::FUNCTION:EC | ||
| 3261 | ENGINE_get_STORE 3668 EXIST::FUNCTION:ENGINE | ||
| 3262 | SHA512 3669 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3263 | STORE_get_certificate 3670 NOEXIST::FUNCTION: | ||
| 3264 | ECDSA_do_sign_ex 3671 EXIST::FUNCTION:ECDSA | ||
| 3265 | ECDSA_do_verify 3672 EXIST::FUNCTION:ECDSA | ||
| 3266 | d2i_ECPrivateKey_fp 3673 EXIST::FUNCTION:EC,FP_API | ||
| 3267 | STORE_delete_certificate 3674 NOEXIST::FUNCTION: | ||
| 3268 | SHA512_Transform 3675 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3269 | X509_STORE_set1_param 3676 EXIST::FUNCTION: | ||
| 3270 | STORE_method_get_ctrl_function 3677 NOEXIST::FUNCTION: | ||
| 3271 | STORE_free 3678 NOEXIST::FUNCTION: | ||
| 3272 | PEM_write_ECPrivateKey 3679 EXIST:!WIN16:FUNCTION:EC | ||
| 3273 | STORE_meth_get_unlock_store_fn 3680 NOEXIST::FUNCTION: | ||
| 3274 | STORE_method_get_unlock_store_function 3680 NOEXIST::FUNCTION: | ||
| 3275 | STORE_get_ex_data 3681 NOEXIST::FUNCTION: | ||
| 3276 | EC_KEY_set_public_key 3682 EXIST::FUNCTION:EC | ||
| 3277 | PEM_read_ECPKParameters 3683 EXIST:!WIN16:FUNCTION:EC | ||
| 3278 | X509_CERT_PAIR_new 3684 EXIST::FUNCTION: | ||
| 3279 | ENGINE_register_STORE 3685 EXIST::FUNCTION:ENGINE | ||
| 3280 | RSA_generate_key_ex 3686 EXIST::FUNCTION:RSA | ||
| 3281 | DSA_generate_parameters_ex 3687 EXIST::FUNCTION:DSA | ||
| 3282 | ECParameters_print_fp 3688 EXIST::FUNCTION:EC,FP_API | ||
| 3283 | X509V3_NAME_from_section 3689 EXIST::FUNCTION: | ||
| 3284 | EVP_PKEY_add1_attr 3690 EXIST::FUNCTION: | ||
| 3285 | STORE_modify_crl 3691 NOEXIST::FUNCTION: | ||
| 3286 | STORE_list_private_key_start 3692 NOEXIST::FUNCTION: | ||
| 3287 | POLICY_MAPPINGS_it 3693 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3288 | POLICY_MAPPINGS_it 3693 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3289 | GENERAL_SUBTREE_it 3694 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3290 | GENERAL_SUBTREE_it 3694 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3291 | EC_GROUP_get_curve_name 3695 EXIST::FUNCTION:EC | ||
| 3292 | PEM_write_X509_CERT_PAIR 3696 EXIST:!WIN16:FUNCTION: | ||
| 3293 | BIO_dump_indent_cb 3697 EXIST::FUNCTION: | ||
| 3294 | d2i_X509_CERT_PAIR 3698 EXIST::FUNCTION: | ||
| 3295 | STORE_list_private_key_endp 3699 NOEXIST::FUNCTION: | ||
| 3296 | asn1_const_Finish 3700 EXIST::FUNCTION: | ||
| 3297 | i2d_EC_PUBKEY_fp 3701 EXIST::FUNCTION:EC,FP_API | ||
| 3298 | BN_nist_mod_256 3702 EXIST::FUNCTION: | ||
| 3299 | X509_VERIFY_PARAM_add0_table 3703 EXIST::FUNCTION: | ||
| 3300 | pqueue_free 3704 EXIST::FUNCTION: | ||
| 3301 | BN_BLINDING_create_param 3705 EXIST::FUNCTION: | ||
| 3302 | ECDSA_size 3706 EXIST::FUNCTION:ECDSA | ||
| 3303 | d2i_EC_PUBKEY_bio 3707 EXIST::FUNCTION:BIO,EC | ||
| 3304 | BN_get0_nist_prime_521 3708 EXIST::FUNCTION: | ||
| 3305 | STORE_ATTR_INFO_modify_sha1str 3709 NOEXIST::FUNCTION: | ||
| 3306 | BN_generate_prime_ex 3710 EXIST::FUNCTION: | ||
| 3307 | EC_GROUP_new_by_curve_name 3711 EXIST::FUNCTION:EC | ||
| 3308 | SHA256_Final 3712 EXIST::FUNCTION:SHA,SHA256 | ||
| 3309 | DH_generate_parameters_ex 3713 EXIST::FUNCTION:DH | ||
| 3310 | PEM_read_bio_ECPrivateKey 3714 EXIST::FUNCTION:EC | ||
| 3311 | STORE_meth_get_cleanup_fn 3715 NOEXIST::FUNCTION: | ||
| 3312 | STORE_method_get_cleanup_function 3715 NOEXIST::FUNCTION: | ||
| 3313 | ENGINE_get_ECDH 3716 EXIST::FUNCTION:ENGINE | ||
| 3314 | d2i_ECDSA_SIG 3717 EXIST::FUNCTION:ECDSA | ||
| 3315 | BN_is_prime_fasttest_ex 3718 EXIST::FUNCTION: | ||
| 3316 | ECDSA_sign 3719 EXIST::FUNCTION:ECDSA | ||
| 3317 | X509_policy_check 3720 EXIST::FUNCTION: | ||
| 3318 | EVP_PKEY_get_attr_by_NID 3721 EXIST::FUNCTION: | ||
| 3319 | STORE_set_ex_data 3722 NOEXIST::FUNCTION: | ||
| 3320 | ENGINE_get_ECDSA 3723 EXIST::FUNCTION:ENGINE | ||
| 3321 | EVP_ecdsa 3724 EXIST::FUNCTION:SHA | ||
| 3322 | BN_BLINDING_get_flags 3725 EXIST::FUNCTION: | ||
| 3323 | PKCS12_add_cert 3726 EXIST::FUNCTION: | ||
| 3324 | STORE_OBJECT_new 3727 NOEXIST::FUNCTION: | ||
| 3325 | ERR_load_ECDH_strings 3728 EXIST::FUNCTION:ECDH | ||
| 3326 | EC_KEY_dup 3729 EXIST::FUNCTION:EC | ||
| 3327 | EVP_CIPHER_CTX_rand_key 3730 EXIST::FUNCTION: | ||
| 3328 | ECDSA_set_method 3731 EXIST::FUNCTION:ECDSA | ||
| 3329 | a2i_IPADDRESS_NC 3732 EXIST::FUNCTION: | ||
| 3330 | d2i_ECParameters 3733 EXIST::FUNCTION:EC | ||
| 3331 | STORE_list_certificate_end 3734 NOEXIST::FUNCTION: | ||
| 3332 | STORE_get_crl 3735 NOEXIST::FUNCTION: | ||
| 3333 | X509_POLICY_NODE_print 3736 EXIST::FUNCTION: | ||
| 3334 | SHA384_Init 3737 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3335 | EC_GF2m_simple_method 3738 EXIST::FUNCTION:EC | ||
| 3336 | ECDSA_set_ex_data 3739 EXIST::FUNCTION:ECDSA | ||
| 3337 | SHA384_Final 3740 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3338 | PKCS7_set_digest 3741 EXIST::FUNCTION: | ||
| 3339 | EC_KEY_print 3742 EXIST::FUNCTION:BIO,EC | ||
| 3340 | STORE_meth_set_lock_store_fn 3743 NOEXIST::FUNCTION: | ||
| 3341 | STORE_method_set_lock_store_function 3743 NOEXIST::FUNCTION: | ||
| 3342 | ECDSA_get_ex_new_index 3744 EXIST::FUNCTION:ECDSA | ||
| 3343 | SHA384 3745 EXIST:!VMSVAX:FUNCTION:SHA,SHA512 | ||
| 3344 | POLICY_MAPPING_new 3746 EXIST::FUNCTION: | ||
| 3345 | STORE_list_certificate_endp 3747 NOEXIST::FUNCTION: | ||
| 3346 | X509_STORE_CTX_get0_policy_tree 3748 EXIST::FUNCTION: | ||
| 3347 | EC_GROUP_set_asn1_flag 3749 EXIST::FUNCTION:EC | ||
| 3348 | EC_KEY_check_key 3750 EXIST::FUNCTION:EC | ||
| 3349 | d2i_EC_PUBKEY_fp 3751 EXIST::FUNCTION:EC,FP_API | ||
| 3350 | PKCS7_set0_type_other 3752 EXIST::FUNCTION: | ||
| 3351 | PEM_read_bio_X509_CERT_PAIR 3753 EXIST::FUNCTION: | ||
| 3352 | pqueue_next 3754 EXIST::FUNCTION: | ||
| 3353 | STORE_meth_get_list_end_fn 3755 NOEXIST::FUNCTION: | ||
| 3354 | STORE_method_get_list_end_function 3755 NOEXIST::FUNCTION: | ||
| 3355 | EVP_PKEY_add1_attr_by_OBJ 3756 EXIST::FUNCTION: | ||
| 3356 | X509_VERIFY_PARAM_set_time 3757 EXIST::FUNCTION: | ||
| 3357 | pqueue_new 3758 EXIST::FUNCTION: | ||
| 3358 | ENGINE_set_default_ECDH 3759 EXIST::FUNCTION:ENGINE | ||
| 3359 | STORE_new_method 3760 NOEXIST::FUNCTION: | ||
| 3360 | PKCS12_add_key 3761 EXIST::FUNCTION: | ||
| 3361 | DSO_merge 3762 EXIST::FUNCTION: | ||
| 3362 | EC_POINT_hex2point 3763 EXIST::FUNCTION:EC | ||
| 3363 | BIO_dump_cb 3764 EXIST::FUNCTION: | ||
| 3364 | SHA256_Update 3765 EXIST::FUNCTION:SHA,SHA256 | ||
| 3365 | pqueue_insert 3766 EXIST::FUNCTION: | ||
| 3366 | pitem_free 3767 EXIST::FUNCTION: | ||
| 3367 | BN_GF2m_mod_inv_arr 3768 EXIST::FUNCTION: | ||
| 3368 | ENGINE_unregister_ECDSA 3769 EXIST::FUNCTION:ENGINE | ||
| 3369 | BN_BLINDING_set_thread_id 3770 EXIST::FUNCTION:DEPRECATED | ||
| 3370 | get_rfc3526_prime_8192 3771 EXIST::FUNCTION: | ||
| 3371 | X509_VERIFY_PARAM_clear_flags 3772 EXIST::FUNCTION: | ||
| 3372 | get_rfc2409_prime_1024 3773 EXIST::FUNCTION: | ||
| 3373 | DH_check_pub_key 3774 EXIST::FUNCTION:DH | ||
| 3374 | get_rfc3526_prime_2048 3775 EXIST::FUNCTION: | ||
| 3375 | get_rfc3526_prime_6144 3776 EXIST::FUNCTION: | ||
| 3376 | get_rfc3526_prime_1536 3777 EXIST::FUNCTION: | ||
| 3377 | get_rfc3526_prime_3072 3778 EXIST::FUNCTION: | ||
| 3378 | get_rfc3526_prime_4096 3779 EXIST::FUNCTION: | ||
| 3379 | get_rfc2409_prime_768 3780 EXIST::FUNCTION: | ||
| 3380 | X509_VERIFY_PARAM_get_flags 3781 EXIST::FUNCTION: | ||
| 3381 | EVP_CIPHER_CTX_new 3782 EXIST::FUNCTION: | ||
| 3382 | EVP_CIPHER_CTX_free 3783 EXIST::FUNCTION: | ||
| 3383 | Camellia_cbc_encrypt 3784 EXIST::FUNCTION:CAMELLIA | ||
| 3384 | Camellia_cfb128_encrypt 3785 EXIST::FUNCTION:CAMELLIA | ||
| 3385 | Camellia_cfb1_encrypt 3786 EXIST::FUNCTION:CAMELLIA | ||
| 3386 | Camellia_cfb8_encrypt 3787 EXIST::FUNCTION:CAMELLIA | ||
| 3387 | Camellia_ctr128_encrypt 3788 EXIST::FUNCTION:CAMELLIA | ||
| 3388 | Camellia_cfbr_encrypt_block 3789 NOEXIST::FUNCTION: | ||
| 3389 | Camellia_decrypt 3790 EXIST::FUNCTION:CAMELLIA | ||
| 3390 | Camellia_ecb_encrypt 3791 EXIST::FUNCTION:CAMELLIA | ||
| 3391 | Camellia_encrypt 3792 EXIST::FUNCTION:CAMELLIA | ||
| 3392 | Camellia_ofb128_encrypt 3793 EXIST::FUNCTION:CAMELLIA | ||
| 3393 | Camellia_set_key 3794 EXIST::FUNCTION:CAMELLIA | ||
| 3394 | EVP_camellia_128_cbc 3795 EXIST::FUNCTION:CAMELLIA | ||
| 3395 | EVP_camellia_128_cfb128 3796 EXIST::FUNCTION:CAMELLIA | ||
| 3396 | EVP_camellia_128_cfb1 3797 EXIST::FUNCTION:CAMELLIA | ||
| 3397 | EVP_camellia_128_cfb8 3798 EXIST::FUNCTION:CAMELLIA | ||
| 3398 | EVP_camellia_128_ecb 3799 EXIST::FUNCTION:CAMELLIA | ||
| 3399 | EVP_camellia_128_ofb 3800 EXIST::FUNCTION:CAMELLIA | ||
| 3400 | EVP_camellia_192_cbc 3801 EXIST::FUNCTION:CAMELLIA | ||
| 3401 | EVP_camellia_192_cfb128 3802 EXIST::FUNCTION:CAMELLIA | ||
| 3402 | EVP_camellia_192_cfb1 3803 EXIST::FUNCTION:CAMELLIA | ||
| 3403 | EVP_camellia_192_cfb8 3804 EXIST::FUNCTION:CAMELLIA | ||
| 3404 | EVP_camellia_192_ecb 3805 EXIST::FUNCTION:CAMELLIA | ||
| 3405 | EVP_camellia_192_ofb 3806 EXIST::FUNCTION:CAMELLIA | ||
| 3406 | EVP_camellia_256_cbc 3807 EXIST::FUNCTION:CAMELLIA | ||
| 3407 | EVP_camellia_256_cfb128 3808 EXIST::FUNCTION:CAMELLIA | ||
| 3408 | EVP_camellia_256_cfb1 3809 EXIST::FUNCTION:CAMELLIA | ||
| 3409 | EVP_camellia_256_cfb8 3810 EXIST::FUNCTION:CAMELLIA | ||
| 3410 | EVP_camellia_256_ecb 3811 EXIST::FUNCTION:CAMELLIA | ||
| 3411 | EVP_camellia_256_ofb 3812 EXIST::FUNCTION:CAMELLIA | ||
| 3412 | a2i_ipadd 3813 EXIST::FUNCTION: | ||
| 3413 | ASIdentifiers_free 3814 EXIST::FUNCTION:RFC3779 | ||
| 3414 | i2d_ASIdOrRange 3815 EXIST::FUNCTION:RFC3779 | ||
| 3415 | EVP_CIPHER_block_size 3816 EXIST::FUNCTION: | ||
| 3416 | v3_asid_is_canonical 3817 EXIST::FUNCTION:RFC3779 | ||
| 3417 | IPAddressChoice_free 3818 EXIST::FUNCTION:RFC3779 | ||
| 3418 | EVP_CIPHER_CTX_set_app_data 3819 EXIST::FUNCTION: | ||
| 3419 | BIO_set_callback_arg 3820 EXIST::FUNCTION: | ||
| 3420 | v3_addr_add_prefix 3821 EXIST::FUNCTION:RFC3779 | ||
| 3421 | IPAddressOrRange_it 3822 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3422 | IPAddressOrRange_it 3822 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3423 | BIO_set_flags 3823 EXIST::FUNCTION: | ||
| 3424 | ASIdentifiers_it 3824 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3425 | ASIdentifiers_it 3824 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3426 | v3_addr_get_range 3825 EXIST::FUNCTION:RFC3779 | ||
| 3427 | BIO_method_type 3826 EXIST::FUNCTION: | ||
| 3428 | v3_addr_inherits 3827 EXIST::FUNCTION:RFC3779 | ||
| 3429 | IPAddressChoice_it 3828 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3430 | IPAddressChoice_it 3828 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3431 | AES_ige_encrypt 3829 EXIST::FUNCTION:AES | ||
| 3432 | v3_addr_add_range 3830 EXIST::FUNCTION:RFC3779 | ||
| 3433 | EVP_CIPHER_CTX_nid 3831 EXIST::FUNCTION: | ||
| 3434 | d2i_ASRange 3832 EXIST::FUNCTION:RFC3779 | ||
| 3435 | v3_addr_add_inherit 3833 EXIST::FUNCTION:RFC3779 | ||
| 3436 | v3_asid_add_id_or_range 3834 EXIST::FUNCTION:RFC3779 | ||
| 3437 | v3_addr_validate_resource_set 3835 EXIST::FUNCTION:RFC3779 | ||
| 3438 | EVP_CIPHER_iv_length 3836 EXIST::FUNCTION: | ||
| 3439 | EVP_MD_type 3837 EXIST::FUNCTION: | ||
| 3440 | v3_asid_canonize 3838 EXIST::FUNCTION:RFC3779 | ||
| 3441 | IPAddressRange_free 3839 EXIST::FUNCTION:RFC3779 | ||
| 3442 | v3_asid_add_inherit 3840 EXIST::FUNCTION:RFC3779 | ||
| 3443 | EVP_CIPHER_CTX_key_length 3841 EXIST::FUNCTION: | ||
| 3444 | IPAddressRange_new 3842 EXIST::FUNCTION:RFC3779 | ||
| 3445 | ASIdOrRange_new 3843 EXIST::FUNCTION:RFC3779 | ||
| 3446 | EVP_MD_size 3844 EXIST::FUNCTION: | ||
| 3447 | EVP_MD_CTX_test_flags 3845 EXIST::FUNCTION: | ||
| 3448 | BIO_clear_flags 3846 EXIST::FUNCTION: | ||
| 3449 | i2d_ASRange 3847 EXIST::FUNCTION:RFC3779 | ||
| 3450 | IPAddressRange_it 3848 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3451 | IPAddressRange_it 3848 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3452 | IPAddressChoice_new 3849 EXIST::FUNCTION:RFC3779 | ||
| 3453 | ASIdentifierChoice_new 3850 EXIST::FUNCTION:RFC3779 | ||
| 3454 | ASRange_free 3851 EXIST::FUNCTION:RFC3779 | ||
| 3455 | EVP_MD_pkey_type 3852 EXIST::FUNCTION: | ||
| 3456 | EVP_MD_CTX_clear_flags 3853 EXIST::FUNCTION: | ||
| 3457 | IPAddressFamily_free 3854 EXIST::FUNCTION:RFC3779 | ||
| 3458 | i2d_IPAddressFamily 3855 EXIST::FUNCTION:RFC3779 | ||
| 3459 | IPAddressOrRange_new 3856 EXIST::FUNCTION:RFC3779 | ||
| 3460 | EVP_CIPHER_flags 3857 EXIST::FUNCTION: | ||
| 3461 | v3_asid_validate_resource_set 3858 EXIST::FUNCTION:RFC3779 | ||
| 3462 | d2i_IPAddressRange 3859 EXIST::FUNCTION:RFC3779 | ||
| 3463 | AES_bi_ige_encrypt 3860 EXIST::FUNCTION:AES | ||
| 3464 | BIO_get_callback 3861 EXIST::FUNCTION: | ||
| 3465 | IPAddressOrRange_free 3862 EXIST::FUNCTION:RFC3779 | ||
| 3466 | v3_addr_subset 3863 EXIST::FUNCTION:RFC3779 | ||
| 3467 | d2i_IPAddressFamily 3864 EXIST::FUNCTION:RFC3779 | ||
| 3468 | v3_asid_subset 3865 EXIST::FUNCTION:RFC3779 | ||
| 3469 | BIO_test_flags 3866 EXIST::FUNCTION: | ||
| 3470 | i2d_ASIdentifierChoice 3867 EXIST::FUNCTION:RFC3779 | ||
| 3471 | ASRange_it 3868 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3472 | ASRange_it 3868 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3473 | d2i_ASIdentifiers 3869 EXIST::FUNCTION:RFC3779 | ||
| 3474 | ASRange_new 3870 EXIST::FUNCTION:RFC3779 | ||
| 3475 | d2i_IPAddressChoice 3871 EXIST::FUNCTION:RFC3779 | ||
| 3476 | v3_addr_get_afi 3872 EXIST::FUNCTION:RFC3779 | ||
| 3477 | EVP_CIPHER_key_length 3873 EXIST::FUNCTION: | ||
| 3478 | EVP_Cipher 3874 EXIST::FUNCTION: | ||
| 3479 | i2d_IPAddressOrRange 3875 EXIST::FUNCTION:RFC3779 | ||
| 3480 | ASIdOrRange_it 3876 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3481 | ASIdOrRange_it 3876 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3482 | EVP_CIPHER_nid 3877 EXIST::FUNCTION: | ||
| 3483 | i2d_IPAddressChoice 3878 EXIST::FUNCTION:RFC3779 | ||
| 3484 | EVP_CIPHER_CTX_block_size 3879 EXIST::FUNCTION: | ||
| 3485 | ASIdentifiers_new 3880 EXIST::FUNCTION:RFC3779 | ||
| 3486 | v3_addr_validate_path 3881 EXIST::FUNCTION:RFC3779 | ||
| 3487 | IPAddressFamily_new 3882 EXIST::FUNCTION:RFC3779 | ||
| 3488 | EVP_MD_CTX_set_flags 3883 EXIST::FUNCTION: | ||
| 3489 | v3_addr_is_canonical 3884 EXIST::FUNCTION:RFC3779 | ||
| 3490 | i2d_IPAddressRange 3885 EXIST::FUNCTION:RFC3779 | ||
| 3491 | IPAddressFamily_it 3886 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3492 | IPAddressFamily_it 3886 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3493 | v3_asid_inherits 3887 EXIST::FUNCTION:RFC3779 | ||
| 3494 | EVP_CIPHER_CTX_cipher 3888 EXIST::FUNCTION: | ||
| 3495 | EVP_CIPHER_CTX_get_app_data 3889 EXIST::FUNCTION: | ||
| 3496 | EVP_MD_block_size 3890 EXIST::FUNCTION: | ||
| 3497 | EVP_CIPHER_CTX_flags 3891 EXIST::FUNCTION: | ||
| 3498 | v3_asid_validate_path 3892 EXIST::FUNCTION:RFC3779 | ||
| 3499 | d2i_IPAddressOrRange 3893 EXIST::FUNCTION:RFC3779 | ||
| 3500 | v3_addr_canonize 3894 EXIST::FUNCTION:RFC3779 | ||
| 3501 | ASIdentifierChoice_it 3895 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RFC3779 | ||
| 3502 | ASIdentifierChoice_it 3895 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RFC3779 | ||
| 3503 | EVP_MD_CTX_md 3896 EXIST::FUNCTION: | ||
| 3504 | d2i_ASIdentifierChoice 3897 EXIST::FUNCTION:RFC3779 | ||
| 3505 | BIO_method_name 3898 EXIST::FUNCTION: | ||
| 3506 | EVP_CIPHER_CTX_iv_length 3899 EXIST::FUNCTION: | ||
| 3507 | ASIdOrRange_free 3900 EXIST::FUNCTION:RFC3779 | ||
| 3508 | ASIdentifierChoice_free 3901 EXIST::FUNCTION:RFC3779 | ||
| 3509 | BIO_get_callback_arg 3902 EXIST::FUNCTION: | ||
| 3510 | BIO_set_callback 3903 EXIST::FUNCTION: | ||
| 3511 | d2i_ASIdOrRange 3904 EXIST::FUNCTION:RFC3779 | ||
| 3512 | i2d_ASIdentifiers 3905 EXIST::FUNCTION:RFC3779 | ||
| 3513 | SEED_decrypt 3908 EXIST::FUNCTION:SEED | ||
| 3514 | SEED_encrypt 3909 EXIST::FUNCTION:SEED | ||
| 3515 | SEED_cbc_encrypt 3910 EXIST::FUNCTION:SEED | ||
| 3516 | EVP_seed_ofb 3911 EXIST::FUNCTION:SEED | ||
| 3517 | SEED_cfb128_encrypt 3912 EXIST::FUNCTION:SEED | ||
| 3518 | SEED_ofb128_encrypt 3913 EXIST::FUNCTION:SEED | ||
| 3519 | EVP_seed_cbc 3914 EXIST::FUNCTION:SEED | ||
| 3520 | SEED_ecb_encrypt 3915 EXIST::FUNCTION:SEED | ||
| 3521 | EVP_seed_ecb 3916 EXIST::FUNCTION:SEED | ||
| 3522 | SEED_set_key 3917 EXIST::FUNCTION:SEED | ||
| 3523 | EVP_seed_cfb128 3918 EXIST::FUNCTION:SEED | ||
| 3524 | X509_EXTENSIONS_it 3919 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3525 | X509_EXTENSIONS_it 3919 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3526 | X509_get1_ocsp 3920 EXIST::FUNCTION: | ||
| 3527 | OCSP_REQ_CTX_free 3921 EXIST::FUNCTION: | ||
| 3528 | i2d_X509_EXTENSIONS 3922 EXIST::FUNCTION: | ||
| 3529 | OCSP_sendreq_nbio 3923 EXIST::FUNCTION: | ||
| 3530 | OCSP_sendreq_new 3924 EXIST::FUNCTION: | ||
| 3531 | d2i_X509_EXTENSIONS 3925 EXIST::FUNCTION: | ||
| 3532 | X509_ALGORS_it 3926 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3533 | X509_ALGORS_it 3926 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3534 | X509_ALGOR_get0 3927 EXIST::FUNCTION: | ||
| 3535 | X509_ALGOR_set0 3928 EXIST::FUNCTION: | ||
| 3536 | AES_unwrap_key 3929 EXIST::FUNCTION:AES | ||
| 3537 | AES_wrap_key 3930 EXIST::FUNCTION:AES | ||
| 3538 | X509at_get0_data_by_OBJ 3931 EXIST::FUNCTION: | ||
| 3539 | ASN1_TYPE_set1 3932 EXIST::FUNCTION: | ||
| 3540 | ASN1_STRING_set0 3933 EXIST::FUNCTION: | ||
| 3541 | i2d_X509_ALGORS 3934 EXIST::FUNCTION: | ||
| 3542 | BIO_f_zlib 3935 EXIST:ZLIB:FUNCTION: | ||
| 3543 | COMP_zlib_cleanup 3936 EXIST::FUNCTION: | ||
| 3544 | d2i_X509_ALGORS 3937 EXIST::FUNCTION: | ||
| 3545 | CMS_ReceiptRequest_free 3938 EXIST::FUNCTION:CMS | ||
| 3546 | PEM_write_CMS 3939 EXIST:!WIN16:FUNCTION:CMS | ||
| 3547 | CMS_add0_CertificateChoices 3940 EXIST::FUNCTION:CMS | ||
| 3548 | CMS_unsigned_add1_attr_by_OBJ 3941 EXIST::FUNCTION:CMS | ||
| 3549 | ERR_load_CMS_strings 3942 EXIST::FUNCTION:CMS | ||
| 3550 | CMS_sign_receipt 3943 EXIST::FUNCTION:CMS | ||
| 3551 | i2d_CMS_ContentInfo 3944 EXIST::FUNCTION:CMS | ||
| 3552 | CMS_signed_delete_attr 3945 EXIST::FUNCTION:CMS | ||
| 3553 | d2i_CMS_bio 3946 EXIST::FUNCTION:CMS | ||
| 3554 | CMS_unsigned_get_attr_by_NID 3947 EXIST::FUNCTION:CMS | ||
| 3555 | CMS_verify 3948 EXIST::FUNCTION:CMS | ||
| 3556 | SMIME_read_CMS 3949 EXIST::FUNCTION:CMS | ||
| 3557 | CMS_decrypt_set1_key 3950 EXIST::FUNCTION:CMS | ||
| 3558 | CMS_SignerInfo_get0_algs 3951 EXIST::FUNCTION:CMS | ||
| 3559 | CMS_add1_cert 3952 EXIST::FUNCTION:CMS | ||
| 3560 | CMS_set_detached 3953 EXIST::FUNCTION:CMS | ||
| 3561 | CMS_encrypt 3954 EXIST::FUNCTION:CMS | ||
| 3562 | CMS_EnvelopedData_create 3955 EXIST::FUNCTION:CMS | ||
| 3563 | CMS_uncompress 3956 EXIST::FUNCTION:CMS | ||
| 3564 | CMS_add0_crl 3957 EXIST::FUNCTION:CMS | ||
| 3565 | CMS_SignerInfo_verify_content 3958 EXIST::FUNCTION:CMS | ||
| 3566 | CMS_unsigned_get0_data_by_OBJ 3959 EXIST::FUNCTION:CMS | ||
| 3567 | PEM_write_bio_CMS 3960 EXIST::FUNCTION:CMS | ||
| 3568 | CMS_unsigned_get_attr 3961 EXIST::FUNCTION:CMS | ||
| 3569 | CMS_RecipientInfo_ktri_cert_cmp 3962 EXIST::FUNCTION:CMS | ||
| 3570 | CMS_RecipientInfo_ktri_get0_algs 3963 EXIST:!VMS:FUNCTION:CMS | ||
| 3571 | CMS_RecipInfo_ktri_get0_algs 3963 EXIST:VMS:FUNCTION:CMS | ||
| 3572 | CMS_ContentInfo_free 3964 EXIST::FUNCTION:CMS | ||
| 3573 | CMS_final 3965 EXIST::FUNCTION:CMS | ||
| 3574 | CMS_add_simple_smimecap 3966 EXIST::FUNCTION:CMS | ||
| 3575 | CMS_SignerInfo_verify 3967 EXIST::FUNCTION:CMS | ||
| 3576 | CMS_data 3968 EXIST::FUNCTION:CMS | ||
| 3577 | CMS_ContentInfo_it 3969 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:CMS | ||
| 3578 | CMS_ContentInfo_it 3969 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:CMS | ||
| 3579 | d2i_CMS_ReceiptRequest 3970 EXIST::FUNCTION:CMS | ||
| 3580 | CMS_compress 3971 EXIST::FUNCTION:CMS | ||
| 3581 | CMS_digest_create 3972 EXIST::FUNCTION:CMS | ||
| 3582 | CMS_SignerInfo_cert_cmp 3973 EXIST::FUNCTION:CMS | ||
| 3583 | CMS_SignerInfo_sign 3974 EXIST::FUNCTION:CMS | ||
| 3584 | CMS_data_create 3975 EXIST::FUNCTION:CMS | ||
| 3585 | i2d_CMS_bio 3976 EXIST::FUNCTION:CMS | ||
| 3586 | CMS_EncryptedData_set1_key 3977 EXIST::FUNCTION:CMS | ||
| 3587 | CMS_decrypt 3978 EXIST::FUNCTION:CMS | ||
| 3588 | int_smime_write_ASN1 3979 NOEXIST::FUNCTION: | ||
| 3589 | CMS_unsigned_delete_attr 3980 EXIST::FUNCTION:CMS | ||
| 3590 | CMS_unsigned_get_attr_count 3981 EXIST::FUNCTION:CMS | ||
| 3591 | CMS_add_smimecap 3982 EXIST::FUNCTION:CMS | ||
| 3592 | PEM_read_CMS 3983 EXIST:!WIN16:FUNCTION:CMS | ||
| 3593 | CMS_signed_get_attr_by_OBJ 3984 EXIST::FUNCTION:CMS | ||
| 3594 | d2i_CMS_ContentInfo 3985 EXIST::FUNCTION:CMS | ||
| 3595 | CMS_add_standard_smimecap 3986 EXIST::FUNCTION:CMS | ||
| 3596 | CMS_ContentInfo_new 3987 EXIST::FUNCTION:CMS | ||
| 3597 | CMS_RecipientInfo_type 3988 EXIST::FUNCTION:CMS | ||
| 3598 | CMS_get0_type 3989 EXIST::FUNCTION:CMS | ||
| 3599 | CMS_is_detached 3990 EXIST::FUNCTION:CMS | ||
| 3600 | CMS_sign 3991 EXIST::FUNCTION:CMS | ||
| 3601 | CMS_signed_add1_attr 3992 EXIST::FUNCTION:CMS | ||
| 3602 | CMS_unsigned_get_attr_by_OBJ 3993 EXIST::FUNCTION:CMS | ||
| 3603 | SMIME_write_CMS 3994 EXIST::FUNCTION:CMS | ||
| 3604 | CMS_EncryptedData_decrypt 3995 EXIST::FUNCTION:CMS | ||
| 3605 | CMS_get0_RecipientInfos 3996 EXIST::FUNCTION:CMS | ||
| 3606 | CMS_add0_RevocationInfoChoice 3997 EXIST::FUNCTION:CMS | ||
| 3607 | CMS_decrypt_set1_pkey 3998 EXIST::FUNCTION:CMS | ||
| 3608 | CMS_SignerInfo_set1_signer_cert 3999 EXIST::FUNCTION:CMS | ||
| 3609 | CMS_get0_signers 4000 EXIST::FUNCTION:CMS | ||
| 3610 | CMS_ReceiptRequest_get0_values 4001 EXIST::FUNCTION:CMS | ||
| 3611 | CMS_signed_get0_data_by_OBJ 4002 EXIST::FUNCTION:CMS | ||
| 3612 | CMS_get0_SignerInfos 4003 EXIST::FUNCTION:CMS | ||
| 3613 | CMS_add0_cert 4004 EXIST::FUNCTION:CMS | ||
| 3614 | CMS_EncryptedData_encrypt 4005 EXIST::FUNCTION:CMS | ||
| 3615 | CMS_digest_verify 4006 EXIST::FUNCTION:CMS | ||
| 3616 | CMS_set1_signers_certs 4007 EXIST::FUNCTION:CMS | ||
| 3617 | CMS_signed_get_attr 4008 EXIST::FUNCTION:CMS | ||
| 3618 | CMS_RecipientInfo_set0_key 4009 EXIST::FUNCTION:CMS | ||
| 3619 | CMS_SignedData_init 4010 EXIST::FUNCTION:CMS | ||
| 3620 | CMS_RecipientInfo_kekri_get0_id 4011 EXIST::FUNCTION:CMS | ||
| 3621 | CMS_verify_receipt 4012 EXIST::FUNCTION:CMS | ||
| 3622 | CMS_ReceiptRequest_it 4013 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:CMS | ||
| 3623 | CMS_ReceiptRequest_it 4013 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:CMS | ||
| 3624 | PEM_read_bio_CMS 4014 EXIST::FUNCTION:CMS | ||
| 3625 | CMS_get1_crls 4015 EXIST::FUNCTION:CMS | ||
| 3626 | CMS_add0_recipient_key 4016 EXIST::FUNCTION:CMS | ||
| 3627 | SMIME_read_ASN1 4017 EXIST::FUNCTION: | ||
| 3628 | CMS_ReceiptRequest_new 4018 EXIST::FUNCTION:CMS | ||
| 3629 | CMS_get0_content 4019 EXIST::FUNCTION:CMS | ||
| 3630 | CMS_get1_ReceiptRequest 4020 EXIST::FUNCTION:CMS | ||
| 3631 | CMS_signed_add1_attr_by_OBJ 4021 EXIST::FUNCTION:CMS | ||
| 3632 | CMS_RecipientInfo_kekri_id_cmp 4022 EXIST::FUNCTION:CMS | ||
| 3633 | CMS_add1_ReceiptRequest 4023 EXIST::FUNCTION:CMS | ||
| 3634 | CMS_SignerInfo_get0_signer_id 4024 EXIST::FUNCTION:CMS | ||
| 3635 | CMS_unsigned_add1_attr_by_NID 4025 EXIST::FUNCTION:CMS | ||
| 3636 | CMS_unsigned_add1_attr 4026 EXIST::FUNCTION:CMS | ||
| 3637 | CMS_signed_get_attr_by_NID 4027 EXIST::FUNCTION:CMS | ||
| 3638 | CMS_get1_certs 4028 EXIST::FUNCTION:CMS | ||
| 3639 | CMS_signed_add1_attr_by_NID 4029 EXIST::FUNCTION:CMS | ||
| 3640 | CMS_unsigned_add1_attr_by_txt 4030 EXIST::FUNCTION:CMS | ||
| 3641 | CMS_dataFinal 4031 EXIST::FUNCTION:CMS | ||
| 3642 | CMS_RecipientInfo_ktri_get0_signer_id 4032 EXIST:!VMS:FUNCTION:CMS | ||
| 3643 | CMS_RecipInfo_ktri_get0_sigr_id 4032 EXIST:VMS:FUNCTION:CMS | ||
| 3644 | i2d_CMS_ReceiptRequest 4033 EXIST::FUNCTION:CMS | ||
| 3645 | CMS_add1_recipient_cert 4034 EXIST::FUNCTION:CMS | ||
| 3646 | CMS_dataInit 4035 EXIST::FUNCTION:CMS | ||
| 3647 | CMS_signed_add1_attr_by_txt 4036 EXIST::FUNCTION:CMS | ||
| 3648 | CMS_RecipientInfo_decrypt 4037 EXIST::FUNCTION:CMS | ||
| 3649 | CMS_signed_get_attr_count 4038 EXIST::FUNCTION:CMS | ||
| 3650 | CMS_get0_eContentType 4039 EXIST::FUNCTION:CMS | ||
| 3651 | CMS_set1_eContentType 4040 EXIST::FUNCTION:CMS | ||
| 3652 | CMS_ReceiptRequest_create0 4041 EXIST::FUNCTION:CMS | ||
| 3653 | CMS_add1_signer 4042 EXIST::FUNCTION:CMS | ||
| 3654 | CMS_RecipientInfo_set0_pkey 4043 EXIST::FUNCTION:CMS | ||
| 3655 | ENGINE_set_load_ssl_client_cert_function 4044 EXIST:!VMS:FUNCTION:ENGINE | ||
| 3656 | ENGINE_set_ld_ssl_clnt_cert_fn 4044 EXIST:VMS:FUNCTION:ENGINE | ||
| 3657 | ENGINE_get_ssl_client_cert_function 4045 EXIST:!VMS:FUNCTION:ENGINE | ||
| 3658 | ENGINE_get_ssl_client_cert_fn 4045 EXIST:VMS:FUNCTION:ENGINE | ||
| 3659 | ENGINE_load_ssl_client_cert 4046 EXIST::FUNCTION:ENGINE | ||
| 3660 | ENGINE_load_capi 4047 EXIST::FUNCTION:ENGINE,STATIC_ENGINE | ||
| 3661 | OPENSSL_isservice 4048 EXIST::FUNCTION: | ||
| 3662 | FIPS_dsa_sig_decode 4049 NOEXIST::FUNCTION: | ||
| 3663 | EVP_CIPHER_CTX_clear_flags 4050 EXIST::FUNCTION: | ||
| 3664 | FIPS_rand_status 4051 NOEXIST::FUNCTION: | ||
| 3665 | FIPS_rand_set_key 4052 NOEXIST::FUNCTION: | ||
| 3666 | CRYPTO_set_mem_info_functions 4053 NOEXIST::FUNCTION: | ||
| 3667 | RSA_X931_generate_key_ex 4054 NOEXIST::FUNCTION: | ||
| 3668 | int_ERR_set_state_func 4055 NOEXIST::FUNCTION: | ||
| 3669 | int_EVP_MD_set_engine_callbacks 4056 NOEXIST::FUNCTION: | ||
| 3670 | int_CRYPTO_set_do_dynlock_callback 4057 NOEXIST::FUNCTION: | ||
| 3671 | FIPS_rng_stick 4058 NOEXIST::FUNCTION: | ||
| 3672 | EVP_CIPHER_CTX_set_flags 4059 EXIST::FUNCTION: | ||
| 3673 | BN_X931_generate_prime_ex 4060 NOEXIST::FUNCTION: | ||
| 3674 | FIPS_selftest_check 4061 NOEXIST::FUNCTION: | ||
| 3675 | FIPS_rand_set_dt 4062 NOEXIST::FUNCTION: | ||
| 3676 | CRYPTO_dbg_pop_info 4063 NOEXIST::FUNCTION: | ||
| 3677 | FIPS_dsa_free 4064 NOEXIST::FUNCTION: | ||
| 3678 | RSA_X931_derive_ex 4065 NOEXIST::FUNCTION: | ||
| 3679 | FIPS_rsa_new 4066 NOEXIST::FUNCTION: | ||
| 3680 | FIPS_rand_bytes 4067 NOEXIST::FUNCTION: | ||
| 3681 | fips_cipher_test 4068 NOEXIST::FUNCTION: | ||
| 3682 | EVP_CIPHER_CTX_test_flags 4069 EXIST::FUNCTION: | ||
| 3683 | CRYPTO_malloc_debug_init 4070 NOEXIST::FUNCTION: | ||
| 3684 | CRYPTO_dbg_push_info 4071 NOEXIST::FUNCTION: | ||
| 3685 | FIPS_corrupt_rsa_keygen 4072 NOEXIST::FUNCTION: | ||
| 3686 | FIPS_dh_new 4073 NOEXIST::FUNCTION: | ||
| 3687 | FIPS_corrupt_dsa_keygen 4074 NOEXIST::FUNCTION: | ||
| 3688 | FIPS_dh_free 4075 NOEXIST::FUNCTION: | ||
| 3689 | fips_pkey_signature_test 4076 NOEXIST::FUNCTION: | ||
| 3690 | EVP_add_alg_module 4077 NOEXIST::FUNCTION: | ||
| 3691 | int_RAND_init_engine_callbacks 4078 NOEXIST::FUNCTION: | ||
| 3692 | int_EVP_CIPHER_set_engine_callbacks 4079 NOEXIST::FUNCTION: | ||
| 3693 | int_EVP_MD_init_engine_callbacks 4080 NOEXIST::FUNCTION: | ||
| 3694 | FIPS_rand_test_mode 4081 NOEXIST::FUNCTION: | ||
| 3695 | FIPS_rand_reset 4082 NOEXIST::FUNCTION: | ||
| 3696 | FIPS_dsa_new 4083 NOEXIST::FUNCTION: | ||
| 3697 | int_RAND_set_callbacks 4084 NOEXIST::FUNCTION: | ||
| 3698 | BN_X931_derive_prime_ex 4085 NOEXIST::FUNCTION: | ||
| 3699 | int_ERR_lib_init 4086 NOEXIST::FUNCTION: | ||
| 3700 | int_EVP_CIPHER_init_engine_callbacks 4087 NOEXIST::FUNCTION: | ||
| 3701 | FIPS_rsa_free 4088 NOEXIST::FUNCTION: | ||
| 3702 | FIPS_dsa_sig_encode 4089 NOEXIST::FUNCTION: | ||
| 3703 | CRYPTO_dbg_remove_all_info 4090 NOEXIST::FUNCTION: | ||
| 3704 | OPENSSL_init 4091 NOEXIST::FUNCTION: | ||
| 3705 | private_Camellia_set_key 4092 NOEXIST::FUNCTION: | ||
| 3706 | CRYPTO_strdup 4093 EXIST::FUNCTION: | ||
| 3707 | JPAKE_STEP3A_process 4094 EXIST::FUNCTION:JPAKE | ||
| 3708 | JPAKE_STEP1_release 4095 EXIST::FUNCTION:JPAKE | ||
| 3709 | JPAKE_get_shared_key 4096 EXIST::FUNCTION:JPAKE | ||
| 3710 | JPAKE_STEP3B_init 4097 EXIST::FUNCTION:JPAKE | ||
| 3711 | JPAKE_STEP1_generate 4098 EXIST::FUNCTION:JPAKE | ||
| 3712 | JPAKE_STEP1_init 4099 EXIST::FUNCTION:JPAKE | ||
| 3713 | JPAKE_STEP3B_process 4100 EXIST::FUNCTION:JPAKE | ||
| 3714 | JPAKE_STEP2_generate 4101 EXIST::FUNCTION:JPAKE | ||
| 3715 | JPAKE_CTX_new 4102 EXIST::FUNCTION:JPAKE | ||
| 3716 | JPAKE_CTX_free 4103 EXIST::FUNCTION:JPAKE | ||
| 3717 | JPAKE_STEP3B_release 4104 EXIST::FUNCTION:JPAKE | ||
| 3718 | JPAKE_STEP3A_release 4105 EXIST::FUNCTION:JPAKE | ||
| 3719 | JPAKE_STEP2_process 4106 EXIST::FUNCTION:JPAKE | ||
| 3720 | JPAKE_STEP3B_generate 4107 EXIST::FUNCTION:JPAKE | ||
| 3721 | JPAKE_STEP1_process 4108 EXIST::FUNCTION:JPAKE | ||
| 3722 | JPAKE_STEP3A_generate 4109 EXIST::FUNCTION:JPAKE | ||
| 3723 | JPAKE_STEP2_release 4110 EXIST::FUNCTION:JPAKE | ||
| 3724 | JPAKE_STEP3A_init 4111 EXIST::FUNCTION:JPAKE | ||
| 3725 | ERR_load_JPAKE_strings 4112 EXIST::FUNCTION:JPAKE | ||
| 3726 | JPAKE_STEP2_init 4113 EXIST::FUNCTION:JPAKE | ||
| 3727 | pqueue_size 4114 EXIST::FUNCTION: | ||
| 3728 | i2d_TS_ACCURACY 4115 EXIST::FUNCTION: | ||
| 3729 | i2d_TS_MSG_IMPRINT_fp 4116 EXIST::FUNCTION: | ||
| 3730 | i2d_TS_MSG_IMPRINT 4117 EXIST::FUNCTION: | ||
| 3731 | EVP_PKEY_print_public 4118 EXIST::FUNCTION: | ||
| 3732 | EVP_PKEY_CTX_new 4119 EXIST::FUNCTION: | ||
| 3733 | i2d_TS_TST_INFO 4120 EXIST::FUNCTION: | ||
| 3734 | EVP_PKEY_asn1_find 4121 EXIST::FUNCTION: | ||
| 3735 | DSO_METHOD_beos 4122 EXIST::FUNCTION: | ||
| 3736 | TS_CONF_load_cert 4123 EXIST::FUNCTION: | ||
| 3737 | TS_REQ_get_ext 4124 EXIST::FUNCTION: | ||
| 3738 | EVP_PKEY_sign_init 4125 EXIST::FUNCTION: | ||
| 3739 | ASN1_item_print 4126 EXIST::FUNCTION: | ||
| 3740 | TS_TST_INFO_set_nonce 4127 EXIST::FUNCTION: | ||
| 3741 | TS_RESP_dup 4128 EXIST::FUNCTION: | ||
| 3742 | ENGINE_register_pkey_meths 4129 EXIST::FUNCTION:ENGINE | ||
| 3743 | EVP_PKEY_asn1_add0 4130 EXIST::FUNCTION: | ||
| 3744 | PKCS7_add0_attrib_signing_time 4131 EXIST::FUNCTION: | ||
| 3745 | i2d_TS_TST_INFO_fp 4132 EXIST::FUNCTION: | ||
| 3746 | BIO_asn1_get_prefix 4133 EXIST::FUNCTION: | ||
| 3747 | TS_TST_INFO_set_time 4134 EXIST::FUNCTION: | ||
| 3748 | EVP_PKEY_meth_set_decrypt 4135 EXIST::FUNCTION: | ||
| 3749 | EVP_PKEY_set_type_str 4136 EXIST::FUNCTION: | ||
| 3750 | EVP_PKEY_CTX_get_keygen_info 4137 EXIST::FUNCTION: | ||
| 3751 | TS_REQ_set_policy_id 4138 EXIST::FUNCTION: | ||
| 3752 | d2i_TS_RESP_fp 4139 EXIST::FUNCTION: | ||
| 3753 | ENGINE_get_pkey_asn1_meth_engine 4140 EXIST:!VMS:FUNCTION:ENGINE | ||
| 3754 | ENGINE_get_pkey_asn1_meth_eng 4140 EXIST:VMS:FUNCTION:ENGINE | ||
| 3755 | WHIRLPOOL_Init 4141 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL | ||
| 3756 | TS_RESP_set_status_info 4142 EXIST::FUNCTION: | ||
| 3757 | EVP_PKEY_keygen 4143 EXIST::FUNCTION: | ||
| 3758 | EVP_DigestSignInit 4144 EXIST::FUNCTION: | ||
| 3759 | TS_ACCURACY_set_millis 4145 EXIST::FUNCTION: | ||
| 3760 | TS_REQ_dup 4146 EXIST::FUNCTION: | ||
| 3761 | GENERAL_NAME_dup 4147 EXIST::FUNCTION: | ||
| 3762 | ASN1_SEQUENCE_ANY_it 4148 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3763 | ASN1_SEQUENCE_ANY_it 4148 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3764 | WHIRLPOOL 4149 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL | ||
| 3765 | X509_STORE_get1_crls 4150 EXIST::FUNCTION: | ||
| 3766 | ENGINE_get_pkey_asn1_meth 4151 EXIST::FUNCTION:ENGINE | ||
| 3767 | EVP_PKEY_asn1_new 4152 EXIST::FUNCTION: | ||
| 3768 | BIO_new_NDEF 4153 EXIST::FUNCTION: | ||
| 3769 | ENGINE_get_pkey_meth 4154 EXIST::FUNCTION:ENGINE | ||
| 3770 | TS_MSG_IMPRINT_set_algo 4155 EXIST::FUNCTION: | ||
| 3771 | i2d_TS_TST_INFO_bio 4156 EXIST::FUNCTION: | ||
| 3772 | TS_TST_INFO_set_ordering 4157 EXIST::FUNCTION: | ||
| 3773 | TS_TST_INFO_get_ext_by_OBJ 4158 EXIST::FUNCTION: | ||
| 3774 | CRYPTO_THREADID_set_pointer 4159 EXIST::FUNCTION: | ||
| 3775 | TS_CONF_get_tsa_section 4160 EXIST::FUNCTION: | ||
| 3776 | SMIME_write_ASN1 4161 EXIST::FUNCTION: | ||
| 3777 | TS_RESP_CTX_set_signer_key 4162 EXIST::FUNCTION: | ||
| 3778 | EVP_PKEY_encrypt_old 4163 EXIST::FUNCTION: | ||
| 3779 | EVP_PKEY_encrypt_init 4164 EXIST::FUNCTION: | ||
| 3780 | CRYPTO_THREADID_cpy 4165 EXIST::FUNCTION: | ||
| 3781 | ASN1_PCTX_get_cert_flags 4166 EXIST::FUNCTION: | ||
| 3782 | i2d_ESS_SIGNING_CERT 4167 EXIST::FUNCTION: | ||
| 3783 | TS_CONF_load_key 4168 EXIST::FUNCTION: | ||
| 3784 | i2d_ASN1_SEQUENCE_ANY 4169 EXIST::FUNCTION: | ||
| 3785 | d2i_TS_MSG_IMPRINT_bio 4170 EXIST::FUNCTION: | ||
| 3786 | EVP_PKEY_asn1_set_public 4171 EXIST::FUNCTION: | ||
| 3787 | b2i_PublicKey_bio 4172 EXIST::FUNCTION: | ||
| 3788 | BIO_asn1_set_prefix 4173 EXIST::FUNCTION: | ||
| 3789 | EVP_PKEY_new_mac_key 4174 EXIST::FUNCTION: | ||
| 3790 | BIO_new_CMS 4175 EXIST::FUNCTION:CMS | ||
| 3791 | CRYPTO_THREADID_cmp 4176 EXIST::FUNCTION: | ||
| 3792 | TS_REQ_ext_free 4177 EXIST::FUNCTION: | ||
| 3793 | EVP_PKEY_asn1_set_free 4178 EXIST::FUNCTION: | ||
| 3794 | EVP_PKEY_get0_asn1 4179 EXIST::FUNCTION: | ||
| 3795 | d2i_NETSCAPE_X509 4180 EXIST::FUNCTION: | ||
| 3796 | EVP_PKEY_verify_recover_init 4181 EXIST::FUNCTION: | ||
| 3797 | EVP_PKEY_CTX_set_data 4182 EXIST::FUNCTION: | ||
| 3798 | EVP_PKEY_keygen_init 4183 EXIST::FUNCTION: | ||
| 3799 | TS_RESP_CTX_set_status_info 4184 EXIST::FUNCTION: | ||
| 3800 | TS_MSG_IMPRINT_get_algo 4185 EXIST::FUNCTION: | ||
| 3801 | TS_REQ_print_bio 4186 EXIST::FUNCTION: | ||
| 3802 | EVP_PKEY_CTX_ctrl_str 4187 EXIST::FUNCTION: | ||
| 3803 | EVP_PKEY_get_default_digest_nid 4188 EXIST::FUNCTION: | ||
| 3804 | PEM_write_bio_PKCS7_stream 4189 EXIST::FUNCTION: | ||
| 3805 | TS_MSG_IMPRINT_print_bio 4190 EXIST::FUNCTION: | ||
| 3806 | BN_asc2bn 4191 EXIST::FUNCTION: | ||
| 3807 | TS_REQ_get_policy_id 4192 EXIST::FUNCTION: | ||
| 3808 | ENGINE_set_default_pkey_asn1_meths 4193 EXIST:!VMS:FUNCTION:ENGINE | ||
| 3809 | ENGINE_set_def_pkey_asn1_meths 4193 EXIST:VMS:FUNCTION:ENGINE | ||
| 3810 | d2i_TS_ACCURACY 4194 EXIST::FUNCTION: | ||
| 3811 | DSO_global_lookup 4195 EXIST::FUNCTION: | ||
| 3812 | TS_CONF_set_tsa_name 4196 EXIST::FUNCTION: | ||
| 3813 | i2d_ASN1_SET_ANY 4197 EXIST::FUNCTION: | ||
| 3814 | ENGINE_load_gost 4198 EXIST::FUNCTION:ENGINE,GOST,STATIC_ENGINE | ||
| 3815 | WHIRLPOOL_BitUpdate 4199 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL | ||
| 3816 | ASN1_PCTX_get_flags 4200 EXIST::FUNCTION: | ||
| 3817 | TS_TST_INFO_get_ext_by_NID 4201 EXIST::FUNCTION: | ||
| 3818 | TS_RESP_new 4202 EXIST::FUNCTION: | ||
| 3819 | ESS_CERT_ID_dup 4203 EXIST::FUNCTION: | ||
| 3820 | TS_STATUS_INFO_dup 4204 EXIST::FUNCTION: | ||
| 3821 | TS_REQ_delete_ext 4205 EXIST::FUNCTION: | ||
| 3822 | EVP_DigestVerifyFinal 4206 EXIST::FUNCTION: | ||
| 3823 | EVP_PKEY_print_params 4207 EXIST::FUNCTION: | ||
| 3824 | i2d_CMS_bio_stream 4208 EXIST::FUNCTION:CMS | ||
| 3825 | TS_REQ_get_msg_imprint 4209 EXIST::FUNCTION: | ||
| 3826 | OBJ_find_sigid_by_algs 4210 EXIST::FUNCTION: | ||
| 3827 | TS_TST_INFO_get_serial 4211 EXIST::FUNCTION: | ||
| 3828 | TS_REQ_get_nonce 4212 EXIST::FUNCTION: | ||
| 3829 | X509_PUBKEY_set0_param 4213 EXIST::FUNCTION: | ||
| 3830 | EVP_PKEY_CTX_set0_keygen_info 4214 EXIST::FUNCTION: | ||
| 3831 | DIST_POINT_set_dpname 4215 EXIST::FUNCTION: | ||
| 3832 | i2d_ISSUING_DIST_POINT 4216 EXIST::FUNCTION: | ||
| 3833 | ASN1_SET_ANY_it 4217 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3834 | ASN1_SET_ANY_it 4217 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3835 | EVP_PKEY_CTX_get_data 4218 EXIST::FUNCTION: | ||
| 3836 | TS_STATUS_INFO_print_bio 4219 EXIST::FUNCTION: | ||
| 3837 | EVP_PKEY_derive_init 4220 EXIST::FUNCTION: | ||
| 3838 | d2i_TS_TST_INFO 4221 EXIST::FUNCTION: | ||
| 3839 | EVP_PKEY_asn1_add_alias 4222 EXIST::FUNCTION: | ||
| 3840 | d2i_TS_RESP_bio 4223 EXIST::FUNCTION: | ||
| 3841 | OTHERNAME_cmp 4224 EXIST::FUNCTION: | ||
| 3842 | GENERAL_NAME_set0_value 4225 EXIST::FUNCTION: | ||
| 3843 | PKCS7_RECIP_INFO_get0_alg 4226 EXIST::FUNCTION: | ||
| 3844 | TS_RESP_CTX_new 4227 EXIST::FUNCTION: | ||
| 3845 | TS_RESP_set_tst_info 4228 EXIST::FUNCTION: | ||
| 3846 | PKCS7_final 4229 EXIST::FUNCTION: | ||
| 3847 | EVP_PKEY_base_id 4230 EXIST::FUNCTION: | ||
| 3848 | TS_RESP_CTX_set_signer_cert 4231 EXIST::FUNCTION: | ||
| 3849 | TS_REQ_set_msg_imprint 4232 EXIST::FUNCTION: | ||
| 3850 | EVP_PKEY_CTX_ctrl 4233 EXIST::FUNCTION: | ||
| 3851 | TS_CONF_set_digests 4234 EXIST::FUNCTION: | ||
| 3852 | d2i_TS_MSG_IMPRINT 4235 EXIST::FUNCTION: | ||
| 3853 | EVP_PKEY_meth_set_ctrl 4236 EXIST::FUNCTION: | ||
| 3854 | TS_REQ_get_ext_by_NID 4237 EXIST::FUNCTION: | ||
| 3855 | PKCS5_pbe_set0_algor 4238 EXIST::FUNCTION: | ||
| 3856 | BN_BLINDING_thread_id 4239 EXIST::FUNCTION: | ||
| 3857 | TS_ACCURACY_new 4240 EXIST::FUNCTION: | ||
| 3858 | X509_CRL_METHOD_free 4241 EXIST::FUNCTION: | ||
| 3859 | ASN1_PCTX_get_nm_flags 4242 EXIST::FUNCTION: | ||
| 3860 | EVP_PKEY_meth_set_sign 4243 EXIST::FUNCTION: | ||
| 3861 | CRYPTO_THREADID_current 4244 EXIST::FUNCTION: | ||
| 3862 | EVP_PKEY_decrypt_init 4245 EXIST::FUNCTION: | ||
| 3863 | NETSCAPE_X509_free 4246 EXIST::FUNCTION: | ||
| 3864 | i2b_PVK_bio 4247 EXIST::FUNCTION:RC4 | ||
| 3865 | EVP_PKEY_print_private 4248 EXIST::FUNCTION: | ||
| 3866 | GENERAL_NAME_get0_value 4249 EXIST::FUNCTION: | ||
| 3867 | b2i_PVK_bio 4250 EXIST::FUNCTION:RC4 | ||
| 3868 | ASN1_UTCTIME_adj 4251 EXIST::FUNCTION: | ||
| 3869 | TS_TST_INFO_new 4252 EXIST::FUNCTION: | ||
| 3870 | EVP_MD_do_all_sorted 4253 EXIST::FUNCTION: | ||
| 3871 | TS_CONF_set_default_engine 4254 EXIST::FUNCTION: | ||
| 3872 | TS_ACCURACY_set_seconds 4255 EXIST::FUNCTION: | ||
| 3873 | TS_TST_INFO_get_time 4256 EXIST::FUNCTION: | ||
| 3874 | PKCS8_pkey_get0 4257 EXIST::FUNCTION: | ||
| 3875 | EVP_PKEY_asn1_get0 4258 EXIST::FUNCTION: | ||
| 3876 | OBJ_add_sigid 4259 EXIST::FUNCTION: | ||
| 3877 | PKCS7_SIGNER_INFO_sign 4260 EXIST::FUNCTION: | ||
| 3878 | EVP_PKEY_paramgen_init 4261 EXIST::FUNCTION: | ||
| 3879 | EVP_PKEY_sign 4262 EXIST::FUNCTION: | ||
| 3880 | OBJ_sigid_free 4263 EXIST::FUNCTION: | ||
| 3881 | EVP_PKEY_meth_set_init 4264 EXIST::FUNCTION: | ||
| 3882 | d2i_ESS_ISSUER_SERIAL 4265 EXIST::FUNCTION: | ||
| 3883 | ISSUING_DIST_POINT_new 4266 EXIST::FUNCTION: | ||
| 3884 | ASN1_TIME_adj 4267 EXIST::FUNCTION: | ||
| 3885 | TS_OBJ_print_bio 4268 EXIST::FUNCTION: | ||
| 3886 | EVP_PKEY_meth_set_verify_recover 4269 EXIST:!VMS:FUNCTION: | ||
| 3887 | EVP_PKEY_meth_set_vrfy_recover 4269 EXIST:VMS:FUNCTION: | ||
| 3888 | TS_RESP_get_status_info 4270 EXIST::FUNCTION: | ||
| 3889 | CMS_stream 4271 EXIST::FUNCTION:CMS | ||
| 3890 | EVP_PKEY_CTX_set_cb 4272 EXIST::FUNCTION: | ||
| 3891 | PKCS7_to_TS_TST_INFO 4273 EXIST::FUNCTION: | ||
| 3892 | ASN1_PCTX_get_oid_flags 4274 EXIST::FUNCTION: | ||
| 3893 | TS_TST_INFO_add_ext 4275 EXIST::FUNCTION: | ||
| 3894 | EVP_PKEY_meth_set_derive 4276 EXIST::FUNCTION: | ||
| 3895 | i2d_TS_RESP_fp 4277 EXIST::FUNCTION: | ||
| 3896 | i2d_TS_MSG_IMPRINT_bio 4278 EXIST::FUNCTION: | ||
| 3897 | TS_RESP_CTX_set_accuracy 4279 EXIST::FUNCTION: | ||
| 3898 | TS_REQ_set_nonce 4280 EXIST::FUNCTION: | ||
| 3899 | ESS_CERT_ID_new 4281 EXIST::FUNCTION: | ||
| 3900 | ENGINE_pkey_asn1_find_str 4282 EXIST::FUNCTION:ENGINE | ||
| 3901 | TS_REQ_get_ext_count 4283 EXIST::FUNCTION: | ||
| 3902 | BUF_reverse 4284 EXIST::FUNCTION: | ||
| 3903 | TS_TST_INFO_print_bio 4285 EXIST::FUNCTION: | ||
| 3904 | d2i_ISSUING_DIST_POINT 4286 EXIST::FUNCTION: | ||
| 3905 | ENGINE_get_pkey_meths 4287 EXIST::FUNCTION:ENGINE | ||
| 3906 | i2b_PrivateKey_bio 4288 EXIST::FUNCTION: | ||
| 3907 | i2d_TS_RESP 4289 EXIST::FUNCTION: | ||
| 3908 | b2i_PublicKey 4290 EXIST::FUNCTION: | ||
| 3909 | TS_VERIFY_CTX_cleanup 4291 EXIST::FUNCTION: | ||
| 3910 | TS_STATUS_INFO_free 4292 EXIST::FUNCTION: | ||
| 3911 | TS_RESP_verify_token 4293 EXIST::FUNCTION: | ||
| 3912 | OBJ_bsearch_ex_ 4294 EXIST::FUNCTION: | ||
| 3913 | ASN1_bn_print 4295 EXIST::FUNCTION:BIO | ||
| 3914 | EVP_PKEY_asn1_get_count 4296 EXIST::FUNCTION: | ||
| 3915 | ENGINE_register_pkey_asn1_meths 4297 EXIST::FUNCTION:ENGINE | ||
| 3916 | ASN1_PCTX_set_nm_flags 4298 EXIST::FUNCTION: | ||
| 3917 | EVP_DigestVerifyInit 4299 EXIST::FUNCTION: | ||
| 3918 | ENGINE_set_default_pkey_meths 4300 EXIST::FUNCTION:ENGINE | ||
| 3919 | TS_TST_INFO_get_policy_id 4301 EXIST::FUNCTION: | ||
| 3920 | TS_REQ_get_cert_req 4302 EXIST::FUNCTION: | ||
| 3921 | X509_CRL_set_meth_data 4303 EXIST::FUNCTION: | ||
| 3922 | PKCS8_pkey_set0 4304 EXIST::FUNCTION: | ||
| 3923 | ASN1_STRING_copy 4305 EXIST::FUNCTION: | ||
| 3924 | d2i_TS_TST_INFO_fp 4306 EXIST::FUNCTION: | ||
| 3925 | X509_CRL_match 4307 EXIST::FUNCTION: | ||
| 3926 | EVP_PKEY_asn1_set_private 4308 EXIST::FUNCTION: | ||
| 3927 | TS_TST_INFO_get_ext_d2i 4309 EXIST::FUNCTION: | ||
| 3928 | TS_RESP_CTX_add_policy 4310 EXIST::FUNCTION: | ||
| 3929 | d2i_TS_RESP 4311 EXIST::FUNCTION: | ||
| 3930 | TS_CONF_load_certs 4312 EXIST::FUNCTION: | ||
| 3931 | TS_TST_INFO_get_msg_imprint 4313 EXIST::FUNCTION: | ||
| 3932 | ERR_load_TS_strings 4314 EXIST::FUNCTION: | ||
| 3933 | TS_TST_INFO_get_version 4315 EXIST::FUNCTION: | ||
| 3934 | EVP_PKEY_CTX_dup 4316 EXIST::FUNCTION: | ||
| 3935 | EVP_PKEY_meth_set_verify 4317 EXIST::FUNCTION: | ||
| 3936 | i2b_PublicKey_bio 4318 EXIST::FUNCTION: | ||
| 3937 | TS_CONF_set_certs 4319 EXIST::FUNCTION: | ||
| 3938 | EVP_PKEY_asn1_get0_info 4320 EXIST::FUNCTION: | ||
| 3939 | TS_VERIFY_CTX_free 4321 EXIST::FUNCTION: | ||
| 3940 | TS_REQ_get_ext_by_critical 4322 EXIST::FUNCTION: | ||
| 3941 | TS_RESP_CTX_set_serial_cb 4323 EXIST::FUNCTION: | ||
| 3942 | X509_CRL_get_meth_data 4324 EXIST::FUNCTION: | ||
| 3943 | TS_RESP_CTX_set_time_cb 4325 EXIST::FUNCTION: | ||
| 3944 | TS_MSG_IMPRINT_get_msg 4326 EXIST::FUNCTION: | ||
| 3945 | TS_TST_INFO_ext_free 4327 EXIST::FUNCTION: | ||
| 3946 | TS_REQ_get_version 4328 EXIST::FUNCTION: | ||
| 3947 | TS_REQ_add_ext 4329 EXIST::FUNCTION: | ||
| 3948 | EVP_PKEY_CTX_set_app_data 4330 EXIST::FUNCTION: | ||
| 3949 | OBJ_bsearch_ 4331 EXIST::FUNCTION: | ||
| 3950 | EVP_PKEY_meth_set_verifyctx 4332 EXIST::FUNCTION: | ||
| 3951 | i2d_PKCS7_bio_stream 4333 EXIST::FUNCTION: | ||
| 3952 | CRYPTO_THREADID_set_numeric 4334 EXIST::FUNCTION: | ||
| 3953 | PKCS7_sign_add_signer 4335 EXIST::FUNCTION: | ||
| 3954 | d2i_TS_TST_INFO_bio 4336 EXIST::FUNCTION: | ||
| 3955 | TS_TST_INFO_get_ordering 4337 EXIST::FUNCTION: | ||
| 3956 | TS_RESP_print_bio 4338 EXIST::FUNCTION: | ||
| 3957 | TS_TST_INFO_get_exts 4339 EXIST::FUNCTION: | ||
| 3958 | HMAC_CTX_copy 4340 EXIST::FUNCTION:HMAC | ||
| 3959 | PKCS5_pbe2_set_iv 4341 EXIST::FUNCTION: | ||
| 3960 | ENGINE_get_pkey_asn1_meths 4342 EXIST::FUNCTION:ENGINE | ||
| 3961 | b2i_PrivateKey 4343 EXIST::FUNCTION: | ||
| 3962 | EVP_PKEY_CTX_get_app_data 4344 EXIST::FUNCTION: | ||
| 3963 | TS_REQ_set_cert_req 4345 EXIST::FUNCTION: | ||
| 3964 | CRYPTO_THREADID_set_callback 4346 EXIST::FUNCTION: | ||
| 3965 | TS_CONF_set_serial 4347 EXIST::FUNCTION: | ||
| 3966 | TS_TST_INFO_free 4348 EXIST::FUNCTION: | ||
| 3967 | d2i_TS_REQ_fp 4349 EXIST::FUNCTION: | ||
| 3968 | TS_RESP_verify_response 4350 EXIST::FUNCTION: | ||
| 3969 | i2d_ESS_ISSUER_SERIAL 4351 EXIST::FUNCTION: | ||
| 3970 | TS_ACCURACY_get_seconds 4352 EXIST::FUNCTION: | ||
| 3971 | EVP_CIPHER_do_all 4353 EXIST::FUNCTION: | ||
| 3972 | b2i_PrivateKey_bio 4354 EXIST::FUNCTION: | ||
| 3973 | OCSP_CERTID_dup 4355 EXIST::FUNCTION: | ||
| 3974 | X509_PUBKEY_get0_param 4356 EXIST::FUNCTION: | ||
| 3975 | TS_MSG_IMPRINT_dup 4357 EXIST::FUNCTION: | ||
| 3976 | PKCS7_print_ctx 4358 EXIST::FUNCTION: | ||
| 3977 | i2d_TS_REQ_bio 4359 EXIST::FUNCTION: | ||
| 3978 | EVP_whirlpool 4360 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL | ||
| 3979 | EVP_PKEY_asn1_set_param 4361 EXIST::FUNCTION: | ||
| 3980 | EVP_PKEY_meth_set_encrypt 4362 EXIST::FUNCTION: | ||
| 3981 | ASN1_PCTX_set_flags 4363 EXIST::FUNCTION: | ||
| 3982 | i2d_ESS_CERT_ID 4364 EXIST::FUNCTION: | ||
| 3983 | TS_VERIFY_CTX_new 4365 EXIST::FUNCTION: | ||
| 3984 | TS_RESP_CTX_set_extension_cb 4366 EXIST::FUNCTION: | ||
| 3985 | ENGINE_register_all_pkey_meths 4367 EXIST::FUNCTION:ENGINE | ||
| 3986 | TS_RESP_CTX_set_status_info_cond 4368 EXIST:!VMS:FUNCTION: | ||
| 3987 | TS_RESP_CTX_set_stat_info_cond 4368 EXIST:VMS:FUNCTION: | ||
| 3988 | EVP_PKEY_verify 4369 EXIST::FUNCTION: | ||
| 3989 | WHIRLPOOL_Final 4370 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL | ||
| 3990 | X509_CRL_METHOD_new 4371 EXIST::FUNCTION: | ||
| 3991 | EVP_DigestSignFinal 4372 EXIST::FUNCTION: | ||
| 3992 | TS_RESP_CTX_set_def_policy 4373 EXIST::FUNCTION: | ||
| 3993 | NETSCAPE_X509_it 4374 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 3994 | NETSCAPE_X509_it 4374 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 3995 | TS_RESP_create_response 4375 EXIST::FUNCTION: | ||
| 3996 | PKCS7_SIGNER_INFO_get0_algs 4376 EXIST::FUNCTION: | ||
| 3997 | TS_TST_INFO_get_nonce 4377 EXIST::FUNCTION: | ||
| 3998 | EVP_PKEY_decrypt_old 4378 EXIST::FUNCTION: | ||
| 3999 | TS_TST_INFO_set_policy_id 4379 EXIST::FUNCTION: | ||
| 4000 | TS_CONF_set_ess_cert_id_chain 4380 EXIST::FUNCTION: | ||
| 4001 | EVP_PKEY_CTX_get0_pkey 4381 EXIST::FUNCTION: | ||
| 4002 | d2i_TS_REQ 4382 EXIST::FUNCTION: | ||
| 4003 | EVP_PKEY_asn1_find_str 4383 EXIST::FUNCTION: | ||
| 4004 | BIO_f_asn1 4384 EXIST::FUNCTION: | ||
| 4005 | ESS_SIGNING_CERT_new 4385 EXIST::FUNCTION: | ||
| 4006 | EVP_PBE_find 4386 EXIST::FUNCTION: | ||
| 4007 | X509_CRL_get0_by_cert 4387 EXIST::FUNCTION: | ||
| 4008 | EVP_PKEY_derive 4388 EXIST::FUNCTION: | ||
| 4009 | i2d_TS_REQ 4389 EXIST::FUNCTION: | ||
| 4010 | TS_TST_INFO_delete_ext 4390 EXIST::FUNCTION: | ||
| 4011 | ESS_ISSUER_SERIAL_free 4391 EXIST::FUNCTION: | ||
| 4012 | ASN1_PCTX_set_str_flags 4392 EXIST::FUNCTION: | ||
| 4013 | ENGINE_get_pkey_asn1_meth_str 4393 EXIST::FUNCTION:ENGINE | ||
| 4014 | TS_CONF_set_signer_key 4394 EXIST::FUNCTION: | ||
| 4015 | TS_ACCURACY_get_millis 4395 EXIST::FUNCTION: | ||
| 4016 | TS_RESP_get_token 4396 EXIST::FUNCTION: | ||
| 4017 | TS_ACCURACY_dup 4397 EXIST::FUNCTION: | ||
| 4018 | ENGINE_register_all_pkey_asn1_meths 4398 EXIST:!VMS:FUNCTION:ENGINE | ||
| 4019 | ENGINE_reg_all_pkey_asn1_meths 4398 EXIST:VMS:FUNCTION:ENGINE | ||
| 4020 | X509_CRL_set_default_method 4399 EXIST::FUNCTION: | ||
| 4021 | CRYPTO_THREADID_hash 4400 EXIST::FUNCTION: | ||
| 4022 | CMS_ContentInfo_print_ctx 4401 EXIST::FUNCTION:CMS | ||
| 4023 | TS_RESP_free 4402 EXIST::FUNCTION: | ||
| 4024 | ISSUING_DIST_POINT_free 4403 EXIST::FUNCTION: | ||
| 4025 | ESS_ISSUER_SERIAL_new 4404 EXIST::FUNCTION: | ||
| 4026 | CMS_add1_crl 4405 EXIST::FUNCTION:CMS | ||
| 4027 | PKCS7_add1_attrib_digest 4406 EXIST::FUNCTION: | ||
| 4028 | TS_RESP_CTX_add_md 4407 EXIST::FUNCTION: | ||
| 4029 | TS_TST_INFO_dup 4408 EXIST::FUNCTION: | ||
| 4030 | ENGINE_set_pkey_asn1_meths 4409 EXIST::FUNCTION:ENGINE | ||
| 4031 | PEM_write_bio_Parameters 4410 EXIST::FUNCTION: | ||
| 4032 | TS_TST_INFO_get_accuracy 4411 EXIST::FUNCTION: | ||
| 4033 | X509_CRL_get0_by_serial 4412 EXIST::FUNCTION: | ||
| 4034 | TS_TST_INFO_set_version 4413 EXIST::FUNCTION: | ||
| 4035 | TS_RESP_CTX_get_tst_info 4414 EXIST::FUNCTION: | ||
| 4036 | TS_RESP_verify_signature 4415 EXIST::FUNCTION: | ||
| 4037 | CRYPTO_THREADID_get_callback 4416 EXIST::FUNCTION: | ||
| 4038 | TS_TST_INFO_get_tsa 4417 EXIST::FUNCTION: | ||
| 4039 | TS_STATUS_INFO_new 4418 EXIST::FUNCTION: | ||
| 4040 | EVP_PKEY_CTX_get_cb 4419 EXIST::FUNCTION: | ||
| 4041 | TS_REQ_get_ext_d2i 4420 EXIST::FUNCTION: | ||
| 4042 | GENERAL_NAME_set0_othername 4421 EXIST::FUNCTION: | ||
| 4043 | TS_TST_INFO_get_ext_count 4422 EXIST::FUNCTION: | ||
| 4044 | TS_RESP_CTX_get_request 4423 EXIST::FUNCTION: | ||
| 4045 | i2d_NETSCAPE_X509 4424 EXIST::FUNCTION: | ||
| 4046 | ENGINE_get_pkey_meth_engine 4425 EXIST::FUNCTION:ENGINE | ||
| 4047 | EVP_PKEY_meth_set_signctx 4426 EXIST::FUNCTION: | ||
| 4048 | EVP_PKEY_asn1_copy 4427 EXIST::FUNCTION: | ||
| 4049 | ASN1_TYPE_cmp 4428 EXIST::FUNCTION: | ||
| 4050 | EVP_CIPHER_do_all_sorted 4429 EXIST::FUNCTION: | ||
| 4051 | EVP_PKEY_CTX_free 4430 EXIST::FUNCTION: | ||
| 4052 | ISSUING_DIST_POINT_it 4431 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: | ||
| 4053 | ISSUING_DIST_POINT_it 4431 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: | ||
| 4054 | d2i_TS_MSG_IMPRINT_fp 4432 EXIST::FUNCTION: | ||
| 4055 | X509_STORE_get1_certs 4433 EXIST::FUNCTION: | ||
| 4056 | EVP_PKEY_CTX_get_operation 4434 EXIST::FUNCTION: | ||
| 4057 | d2i_ESS_SIGNING_CERT 4435 EXIST::FUNCTION: | ||
| 4058 | TS_CONF_set_ordering 4436 EXIST::FUNCTION: | ||
| 4059 | EVP_PBE_alg_add_type 4437 EXIST::FUNCTION: | ||
| 4060 | TS_REQ_set_version 4438 EXIST::FUNCTION: | ||
| 4061 | EVP_PKEY_get0 4439 EXIST::FUNCTION: | ||
| 4062 | BIO_asn1_set_suffix 4440 EXIST::FUNCTION: | ||
| 4063 | i2d_TS_STATUS_INFO 4441 EXIST::FUNCTION: | ||
| 4064 | EVP_MD_do_all 4442 EXIST::FUNCTION: | ||
| 4065 | TS_TST_INFO_set_accuracy 4443 EXIST::FUNCTION: | ||
| 4066 | PKCS7_add_attrib_content_type 4444 EXIST::FUNCTION: | ||
| 4067 | ERR_remove_thread_state 4445 EXIST::FUNCTION: | ||
| 4068 | EVP_PKEY_meth_add0 4446 EXIST::FUNCTION: | ||
| 4069 | TS_TST_INFO_set_tsa 4447 EXIST::FUNCTION: | ||
| 4070 | EVP_PKEY_meth_new 4448 EXIST::FUNCTION: | ||
| 4071 | WHIRLPOOL_Update 4449 EXIST:!VMSVAX:FUNCTION:WHIRLPOOL | ||
| 4072 | TS_CONF_set_accuracy 4450 EXIST::FUNCTION: | ||
| 4073 | ASN1_PCTX_set_oid_flags 4451 EXIST::FUNCTION: | ||
| 4074 | ESS_SIGNING_CERT_dup 4452 EXIST::FUNCTION: | ||
| 4075 | d2i_TS_REQ_bio 4453 EXIST::FUNCTION: | ||
| 4076 | X509_time_adj_ex 4454 EXIST::FUNCTION: | ||
| 4077 | TS_RESP_CTX_add_flags 4455 EXIST::FUNCTION: | ||
| 4078 | d2i_TS_STATUS_INFO 4456 EXIST::FUNCTION: | ||
| 4079 | TS_MSG_IMPRINT_set_msg 4457 EXIST::FUNCTION: | ||
| 4080 | BIO_asn1_get_suffix 4458 EXIST::FUNCTION: | ||
| 4081 | TS_REQ_free 4459 EXIST::FUNCTION: | ||
| 4082 | EVP_PKEY_meth_free 4460 EXIST::FUNCTION: | ||
| 4083 | TS_REQ_get_exts 4461 EXIST::FUNCTION: | ||
| 4084 | TS_RESP_CTX_set_clock_precision_digits 4462 EXIST:!VMS:FUNCTION: | ||
| 4085 | TS_RESP_CTX_set_clk_prec_digits 4462 EXIST:VMS:FUNCTION: | ||
| 4086 | TS_RESP_CTX_add_failure_info 4463 EXIST::FUNCTION: | ||
| 4087 | i2d_TS_RESP_bio 4464 EXIST::FUNCTION: | ||
| 4088 | EVP_PKEY_CTX_get0_peerkey 4465 EXIST::FUNCTION: | ||
| 4089 | PEM_write_bio_CMS_stream 4466 EXIST::FUNCTION:CMS | ||
| 4090 | TS_REQ_new 4467 EXIST::FUNCTION: | ||
| 4091 | TS_MSG_IMPRINT_new 4468 EXIST::FUNCTION: | ||
| 4092 | EVP_PKEY_meth_find 4469 EXIST::FUNCTION: | ||
| 4093 | EVP_PKEY_id 4470 EXIST::FUNCTION: | ||
| 4094 | TS_TST_INFO_set_serial 4471 EXIST::FUNCTION: | ||
| 4095 | a2i_GENERAL_NAME 4472 EXIST::FUNCTION: | ||
| 4096 | TS_CONF_set_crypto_device 4473 EXIST::FUNCTION: | ||
| 4097 | EVP_PKEY_verify_init 4474 EXIST::FUNCTION: | ||
| 4098 | TS_CONF_set_policies 4475 EXIST::FUNCTION: | ||
| 4099 | ASN1_PCTX_new 4476 EXIST::FUNCTION: | ||
| 4100 | ESS_CERT_ID_free 4477 EXIST::FUNCTION: | ||
| 4101 | ENGINE_unregister_pkey_meths 4478 EXIST::FUNCTION:ENGINE | ||
| 4102 | TS_MSG_IMPRINT_free 4479 EXIST::FUNCTION: | ||
| 4103 | TS_VERIFY_CTX_init 4480 EXIST::FUNCTION: | ||
| 4104 | PKCS7_stream 4481 EXIST::FUNCTION: | ||
| 4105 | TS_RESP_CTX_set_certs 4482 EXIST::FUNCTION: | ||
| 4106 | TS_CONF_set_def_policy 4483 EXIST::FUNCTION: | ||
| 4107 | ASN1_GENERALIZEDTIME_adj 4484 EXIST::FUNCTION: | ||
| 4108 | NETSCAPE_X509_new 4485 EXIST::FUNCTION: | ||
| 4109 | TS_ACCURACY_free 4486 EXIST::FUNCTION: | ||
| 4110 | TS_RESP_get_tst_info 4487 EXIST::FUNCTION: | ||
| 4111 | EVP_PKEY_derive_set_peer 4488 EXIST::FUNCTION: | ||
| 4112 | PEM_read_bio_Parameters 4489 EXIST::FUNCTION: | ||
| 4113 | TS_CONF_set_clock_precision_digits 4490 EXIST:!VMS:FUNCTION: | ||
| 4114 | TS_CONF_set_clk_prec_digits 4490 EXIST:VMS:FUNCTION: | ||
| 4115 | ESS_ISSUER_SERIAL_dup 4491 EXIST::FUNCTION: | ||
| 4116 | TS_ACCURACY_get_micros 4492 EXIST::FUNCTION: | ||
| 4117 | ASN1_PCTX_get_str_flags 4493 EXIST::FUNCTION: | ||
| 4118 | NAME_CONSTRAINTS_check 4494 EXIST::FUNCTION: | ||
| 4119 | ASN1_BIT_STRING_check 4495 EXIST::FUNCTION: | ||
| 4120 | X509_check_akid 4496 EXIST::FUNCTION: | ||
| 4121 | ENGINE_unregister_pkey_asn1_meths 4497 EXIST:!VMS:FUNCTION:ENGINE | ||
| 4122 | ENGINE_unreg_pkey_asn1_meths 4497 EXIST:VMS:FUNCTION:ENGINE | ||
| 4123 | ASN1_PCTX_free 4498 EXIST::FUNCTION: | ||
| 4124 | PEM_write_bio_ASN1_stream 4499 EXIST::FUNCTION: | ||
| 4125 | i2d_ASN1_bio_stream 4500 EXIST::FUNCTION: | ||
| 4126 | TS_X509_ALGOR_print_bio 4501 EXIST::FUNCTION: | ||
| 4127 | EVP_PKEY_meth_set_cleanup 4502 EXIST::FUNCTION: | ||
| 4128 | EVP_PKEY_asn1_free 4503 EXIST::FUNCTION: | ||
| 4129 | ESS_SIGNING_CERT_free 4504 EXIST::FUNCTION: | ||
| 4130 | TS_TST_INFO_set_msg_imprint 4505 EXIST::FUNCTION: | ||
| 4131 | GENERAL_NAME_cmp 4506 EXIST::FUNCTION: | ||
| 4132 | d2i_ASN1_SET_ANY 4507 EXIST::FUNCTION: | ||
| 4133 | ENGINE_set_pkey_meths 4508 EXIST::FUNCTION:ENGINE | ||
| 4134 | i2d_TS_REQ_fp 4509 EXIST::FUNCTION: | ||
| 4135 | d2i_ASN1_SEQUENCE_ANY 4510 EXIST::FUNCTION: | ||
| 4136 | GENERAL_NAME_get0_otherName 4511 EXIST::FUNCTION: | ||
| 4137 | d2i_ESS_CERT_ID 4512 EXIST::FUNCTION: | ||
| 4138 | OBJ_find_sigid_algs 4513 EXIST::FUNCTION: | ||
| 4139 | EVP_PKEY_meth_set_keygen 4514 EXIST::FUNCTION: | ||
| 4140 | PKCS5_PBKDF2_HMAC 4515 EXIST::FUNCTION: | ||
| 4141 | EVP_PKEY_paramgen 4516 EXIST::FUNCTION: | ||
| 4142 | EVP_PKEY_meth_set_paramgen 4517 EXIST::FUNCTION: | ||
| 4143 | BIO_new_PKCS7 4518 EXIST::FUNCTION: | ||
| 4144 | EVP_PKEY_verify_recover 4519 EXIST::FUNCTION: | ||
| 4145 | TS_ext_print_bio 4520 EXIST::FUNCTION: | ||
| 4146 | TS_ASN1_INTEGER_print_bio 4521 EXIST::FUNCTION: | ||
| 4147 | check_defer 4522 EXIST::FUNCTION: | ||
| 4148 | DSO_pathbyaddr 4523 EXIST::FUNCTION: | ||
| 4149 | EVP_PKEY_set_type 4524 EXIST::FUNCTION: | ||
| 4150 | TS_ACCURACY_set_micros 4525 EXIST::FUNCTION: | ||
| 4151 | TS_REQ_to_TS_VERIFY_CTX 4526 EXIST::FUNCTION: | ||
| 4152 | EVP_PKEY_meth_set_copy 4527 EXIST::FUNCTION: | ||
| 4153 | ASN1_PCTX_set_cert_flags 4528 EXIST::FUNCTION: | ||
| 4154 | TS_TST_INFO_get_ext 4529 EXIST::FUNCTION: | ||
| 4155 | EVP_PKEY_asn1_set_ctrl 4530 EXIST::FUNCTION: | ||
| 4156 | TS_TST_INFO_get_ext_by_critical 4531 EXIST::FUNCTION: | ||
| 4157 | EVP_PKEY_CTX_new_id 4532 EXIST::FUNCTION: | ||
| 4158 | TS_REQ_get_ext_by_OBJ 4533 EXIST::FUNCTION: | ||
| 4159 | TS_CONF_set_signer_cert 4534 EXIST::FUNCTION: | ||
| 4160 | X509_NAME_hash_old 4535 EXIST::FUNCTION: | ||
| 4161 | ASN1_TIME_set_string 4536 EXIST::FUNCTION: | ||
| 4162 | EVP_MD_flags 4537 EXIST::FUNCTION: | ||
| 4163 | TS_RESP_CTX_free 4538 EXIST::FUNCTION: | ||
| 4164 | DSAparams_dup 4539 EXIST::FUNCTION:DSA | ||
| 4165 | DHparams_dup 4540 EXIST::FUNCTION:DH | ||
| 4166 | OCSP_REQ_CTX_add1_header 4541 EXIST::FUNCTION: | ||
| 4167 | OCSP_REQ_CTX_set1_req 4542 EXIST::FUNCTION: | ||
| 4168 | X509_STORE_set_verify_cb 4543 EXIST::FUNCTION: | ||
| 4169 | X509_STORE_CTX_get0_current_crl 4544 EXIST::FUNCTION: | ||
| 4170 | X509_STORE_CTX_get0_parent_ctx 4545 EXIST::FUNCTION: | ||
| 4171 | X509_STORE_CTX_get0_current_issuer 4546 EXIST:!VMS:FUNCTION: | ||
| 4172 | X509_STORE_CTX_get0_cur_issuer 4546 EXIST:VMS:FUNCTION: | ||
| 4173 | X509_issuer_name_hash_old 4547 EXIST::FUNCTION:MD5 | ||
| 4174 | X509_subject_name_hash_old 4548 EXIST::FUNCTION:MD5 | ||
| 4175 | EVP_CIPHER_CTX_copy 4549 EXIST::FUNCTION: | ||
| 4176 | UI_method_get_prompt_constructor 4550 EXIST:!VMS:FUNCTION: | ||
| 4177 | UI_method_get_prompt_constructr 4550 EXIST:VMS:FUNCTION: | ||
| 4178 | UI_method_set_prompt_constructor 4551 EXIST:!VMS:FUNCTION: | ||
| 4179 | UI_method_set_prompt_constructr 4551 EXIST:VMS:FUNCTION: | ||
| 4180 | EVP_read_pw_string_min 4552 EXIST::FUNCTION: | ||
| 4181 | ENGINE_load_aesni 4553 EXIST::FUNCTION:ENGINE | ||
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl new file mode 100644 index 0000000000..780029a03f --- /dev/null +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
| @@ -0,0 +1,1146 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # A bit of an evil hack but it post processes the file ../MINFO which | ||
| 3 | # is generated by `make files` in the top directory. | ||
| 4 | # This script outputs one mega makefile that has no shell stuff or any | ||
| 5 | # funny stuff | ||
| 6 | # | ||
| 7 | |||
| 8 | $INSTALLTOP="/usr/local/ssl"; | ||
| 9 | $OPENSSLDIR="/usr/local/ssl"; | ||
| 10 | $OPTIONS=""; | ||
| 11 | $ssl_version=""; | ||
| 12 | $banner="\t\@echo Building OpenSSL"; | ||
| 13 | |||
| 14 | my $no_static_engine = 1; | ||
| 15 | my $engines = ""; | ||
| 16 | local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic | ||
| 17 | local $zlib_lib = ""; | ||
| 18 | local $perl_asm = 0; # 1 to autobuild asm files from perl scripts | ||
| 19 | |||
| 20 | # Options to import from top level Makefile | ||
| 21 | |||
| 22 | my %mf_import = ( | ||
| 23 | VERSION => \$ssl_version, | ||
| 24 | OPTIONS => \$OPTIONS, | ||
| 25 | INSTALLTOP => \$INSTALLTOP, | ||
| 26 | OPENSSLDIR => \$OPENSSLDIR, | ||
| 27 | PLATFORM => \$mf_platform, | ||
| 28 | CFLAG => \$mf_cflag, | ||
| 29 | DEPFLAG => \$mf_depflag, | ||
| 30 | CPUID_OBJ => \$mf_cpuid_asm, | ||
| 31 | BN_ASM => \$mf_bn_asm, | ||
| 32 | DES_ENC => \$mf_des_asm, | ||
| 33 | AES_ENC => \$mf_aes_asm, | ||
| 34 | BF_ENC => \$mf_bf_asm, | ||
| 35 | CAST_ENC => \$mf_cast_asm, | ||
| 36 | RC4_ENC => \$mf_rc4_asm, | ||
| 37 | RC5_ENC => \$mf_rc5_asm, | ||
| 38 | MD5_ASM_OBJ => \$mf_md5_asm, | ||
| 39 | SHA1_ASM_OBJ => \$mf_sha_asm, | ||
| 40 | RMD160_ASM_OBJ => \$mf_rmd_asm, | ||
| 41 | WP_ASM_OBJ => \$mf_wp_asm, | ||
| 42 | CMLL_ENC => \$mf_cm_asm | ||
| 43 | ); | ||
| 44 | |||
| 45 | |||
| 46 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | ||
| 47 | while(<IN>) { | ||
| 48 | my ($mf_opt, $mf_ref); | ||
| 49 | while (($mf_opt, $mf_ref) = each %mf_import) { | ||
| 50 | if (/^$mf_opt\s*=\s*(.*)$/) { | ||
| 51 | $$mf_ref = $1; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | } | ||
| 55 | close(IN); | ||
| 56 | |||
| 57 | $debug = 1 if $mf_platform =~ /^debug-/; | ||
| 58 | |||
| 59 | die "Makefile is not the toplevel Makefile!\n" if $ssl_version eq ""; | ||
| 60 | |||
| 61 | $infile="MINFO"; | ||
| 62 | |||
| 63 | %ops=( | ||
| 64 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", | ||
| 65 | "VC-WIN64I", "Microsoft C/C++ - Win64/IA-64", | ||
| 66 | "VC-WIN64A", "Microsoft C/C++ - Win64/x64", | ||
| 67 | "VC-CE", "Microsoft eMbedded Visual C++ 3.0 - Windows CE ONLY", | ||
| 68 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | ||
| 69 | "Mingw32", "GNU C++ - Windows NT or 9x", | ||
| 70 | "Mingw32-files", "Create files with DOS copy ...", | ||
| 71 | "BC-NT", "Borland C++ 4.5 - Windows NT", | ||
| 72 | "linux-elf","Linux elf", | ||
| 73 | "ultrix-mips","DEC mips ultrix", | ||
| 74 | "FreeBSD","FreeBSD distribution", | ||
| 75 | "OS2-EMX", "EMX GCC OS/2", | ||
| 76 | "netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets", | ||
| 77 | "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets", | ||
| 78 | "netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets", | ||
| 79 | "netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets", | ||
| 80 | "default","cc under unix", | ||
| 81 | "auto", "auto detect from top level Makefile" | ||
| 82 | ); | ||
| 83 | |||
| 84 | $platform=""; | ||
| 85 | my $xcflags=""; | ||
| 86 | foreach (@ARGV) | ||
| 87 | { | ||
| 88 | if (!&read_options && !defined($ops{$_})) | ||
| 89 | { | ||
| 90 | print STDERR "unknown option - $_\n"; | ||
| 91 | print STDERR "usage: perl mk1mf.pl [options] [system]\n"; | ||
| 92 | print STDERR "\nwhere [system] can be one of the following\n"; | ||
| 93 | foreach $i (sort keys %ops) | ||
| 94 | { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } | ||
| 95 | print STDERR <<"EOF"; | ||
| 96 | and [options] can be one of | ||
| 97 | no-md2 no-md4 no-md5 no-sha no-mdc2 - Skip this digest | ||
| 98 | no-ripemd | ||
| 99 | no-rc2 no-rc4 no-rc5 no-idea no-des - Skip this symetric cipher | ||
| 100 | no-bf no-cast no-aes no-camellia no-seed | ||
| 101 | no-rsa no-dsa no-dh - Skip this public key cipher | ||
| 102 | no-ssl2 no-ssl3 - Skip this version of SSL | ||
| 103 | just-ssl - remove all non-ssl keys/digest | ||
| 104 | no-asm - No x86 asm | ||
| 105 | no-krb5 - No KRB5 | ||
| 106 | no-ec - No EC | ||
| 107 | no-ecdsa - No ECDSA | ||
| 108 | no-ecdh - No ECDH | ||
| 109 | no-engine - No engine | ||
| 110 | no-hw - No hw | ||
| 111 | nasm - Use NASM for x86 asm | ||
| 112 | nw-nasm - Use NASM x86 asm for NetWare | ||
| 113 | nw-mwasm - Use Metrowerks x86 asm for NetWare | ||
| 114 | gaswin - Use GNU as with Mingw32 | ||
| 115 | no-socks - No socket code | ||
| 116 | no-err - No error strings | ||
| 117 | dll/shlib - Build shared libraries (MS) | ||
| 118 | debug - Debug build | ||
| 119 | profile - Profiling build | ||
| 120 | gcc - Use Gcc (unix) | ||
| 121 | |||
| 122 | Values that can be set | ||
| 123 | TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler | ||
| 124 | |||
| 125 | -L<ex_lib_path> -l<ex_lib> - extra library flags (unix) | ||
| 126 | -<ex_cc_flags> - extra 'cc' flags, | ||
| 127 | added (MS), or replace (unix) | ||
| 128 | EOF | ||
| 129 | exit(1); | ||
| 130 | } | ||
| 131 | $platform=$_; | ||
| 132 | } | ||
| 133 | foreach (grep(!/^$/, split(/ /, $OPTIONS))) | ||
| 134 | { | ||
| 135 | print STDERR "unknown option - $_\n" if !&read_options; | ||
| 136 | } | ||
| 137 | |||
| 138 | $no_static_engine = 0 if (!$shlib); | ||
| 139 | |||
| 140 | $no_mdc2=1 if ($no_des); | ||
| 141 | |||
| 142 | $no_ssl3=1 if ($no_md5 || $no_sha); | ||
| 143 | $no_ssl3=1 if ($no_rsa && $no_dh); | ||
| 144 | |||
| 145 | $no_ssl2=1 if ($no_md5); | ||
| 146 | $no_ssl2=1 if ($no_rsa); | ||
| 147 | |||
| 148 | $out_def="out"; | ||
| 149 | $inc_def="outinc"; | ||
| 150 | $tmp_def="tmp"; | ||
| 151 | |||
| 152 | $perl="perl" unless defined $perl; | ||
| 153 | $mkdir="-mkdir" unless defined $mkdir; | ||
| 154 | |||
| 155 | ($ssl,$crypto)=("ssl","crypto"); | ||
| 156 | $ranlib="echo ranlib"; | ||
| 157 | |||
| 158 | $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; | ||
| 159 | $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; | ||
| 160 | $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | ||
| 161 | |||
| 162 | # $bin_dir.=$o causes a core dump on my sparc :-( | ||
| 163 | |||
| 164 | |||
| 165 | $NT=0; | ||
| 166 | |||
| 167 | push(@INC,"util/pl","pl"); | ||
| 168 | |||
| 169 | if ($platform eq "auto") { | ||
| 170 | $platform = $mf_platform; | ||
| 171 | print STDERR "Imported platform $mf_platform\n"; | ||
| 172 | } | ||
| 173 | |||
| 174 | if (($platform =~ /VC-(.+)/)) | ||
| 175 | { | ||
| 176 | $FLAVOR=$1; | ||
| 177 | $NT = 1 if $1 eq "NT"; | ||
| 178 | require 'VC-32.pl'; | ||
| 179 | } | ||
| 180 | elsif ($platform eq "Mingw32") | ||
| 181 | { | ||
| 182 | require 'Mingw32.pl'; | ||
| 183 | } | ||
| 184 | elsif ($platform eq "Mingw32-files") | ||
| 185 | { | ||
| 186 | require 'Mingw32f.pl'; | ||
| 187 | } | ||
| 188 | elsif ($platform eq "BC-NT") | ||
| 189 | { | ||
| 190 | $bc=1; | ||
| 191 | require 'BC-32.pl'; | ||
| 192 | } | ||
| 193 | elsif ($platform eq "FreeBSD") | ||
| 194 | { | ||
| 195 | require 'unix.pl'; | ||
| 196 | $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; | ||
| 197 | } | ||
| 198 | elsif ($platform eq "linux-elf") | ||
| 199 | { | ||
| 200 | require "unix.pl"; | ||
| 201 | require "linux.pl"; | ||
| 202 | $unix=1; | ||
| 203 | } | ||
| 204 | elsif ($platform eq "ultrix-mips") | ||
| 205 | { | ||
| 206 | require "unix.pl"; | ||
| 207 | require "ultrix.pl"; | ||
| 208 | $unix=1; | ||
| 209 | } | ||
| 210 | elsif ($platform eq "OS2-EMX") | ||
| 211 | { | ||
| 212 | $wc=1; | ||
| 213 | require 'OS2-EMX.pl'; | ||
| 214 | } | ||
| 215 | elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") || | ||
| 216 | ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock")) | ||
| 217 | { | ||
| 218 | $LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock"; | ||
| 219 | $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock"); | ||
| 220 | require 'netware.pl'; | ||
| 221 | } | ||
| 222 | else | ||
| 223 | { | ||
| 224 | require "unix.pl"; | ||
| 225 | |||
| 226 | $unix=1; | ||
| 227 | $cflags.=' -DTERMIO'; | ||
| 228 | } | ||
| 229 | |||
| 230 | $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":""); | ||
| 231 | $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":""); | ||
| 232 | $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def; | ||
| 233 | |||
| 234 | $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq '')); | ||
| 235 | |||
| 236 | $cflags= "$xcflags$cflags" if $xcflags ne ""; | ||
| 237 | |||
| 238 | $cflags.=" -DOPENSSL_NO_IDEA" if $no_idea; | ||
| 239 | $cflags.=" -DOPENSSL_NO_AES" if $no_aes; | ||
| 240 | $cflags.=" -DOPENSSL_NO_CAMELLIA" if $no_camellia; | ||
| 241 | $cflags.=" -DOPENSSL_NO_SEED" if $no_seed; | ||
| 242 | $cflags.=" -DOPENSSL_NO_RC2" if $no_rc2; | ||
| 243 | $cflags.=" -DOPENSSL_NO_RC4" if $no_rc4; | ||
| 244 | $cflags.=" -DOPENSSL_NO_RC5" if $no_rc5; | ||
| 245 | $cflags.=" -DOPENSSL_NO_MD2" if $no_md2; | ||
| 246 | $cflags.=" -DOPENSSL_NO_MD4" if $no_md4; | ||
| 247 | $cflags.=" -DOPENSSL_NO_MD5" if $no_md5; | ||
| 248 | $cflags.=" -DOPENSSL_NO_SHA" if $no_sha; | ||
| 249 | $cflags.=" -DOPENSSL_NO_SHA1" if $no_sha1; | ||
| 250 | $cflags.=" -DOPENSSL_NO_RIPEMD" if $no_ripemd; | ||
| 251 | $cflags.=" -DOPENSSL_NO_MDC2" if $no_mdc2; | ||
| 252 | $cflags.=" -DOPENSSL_NO_BF" if $no_bf; | ||
| 253 | $cflags.=" -DOPENSSL_NO_CAST" if $no_cast; | ||
| 254 | $cflags.=" -DOPENSSL_NO_DES" if $no_des; | ||
| 255 | $cflags.=" -DOPENSSL_NO_RSA" if $no_rsa; | ||
| 256 | $cflags.=" -DOPENSSL_NO_DSA" if $no_dsa; | ||
| 257 | $cflags.=" -DOPENSSL_NO_DH" if $no_dh; | ||
| 258 | $cflags.=" -DOPENSSL_NO_WHIRLPOOL" if $no_whirlpool; | ||
| 259 | $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock; | ||
| 260 | $cflags.=" -DOPENSSL_NO_SSL2" if $no_ssl2; | ||
| 261 | $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3; | ||
| 262 | $cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext; | ||
| 263 | $cflags.=" -DOPENSSL_NO_CMS" if $no_cms; | ||
| 264 | $cflags.=" -DOPENSSL_NO_ERR" if $no_err; | ||
| 265 | $cflags.=" -DOPENSSL_NO_KRB5" if $no_krb5; | ||
| 266 | $cflags.=" -DOPENSSL_NO_EC" if $no_ec; | ||
| 267 | $cflags.=" -DOPENSSL_NO_ECDSA" if $no_ecdsa; | ||
| 268 | $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; | ||
| 269 | $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; | ||
| 270 | $cflags.=" -DOPENSSL_NO_HW" if $no_hw; | ||
| 271 | $cflags.=" -DOPENSSL_NO_JPAKE" if $no_jpake; | ||
| 272 | $cflags.= " -DZLIB" if $zlib_opt; | ||
| 273 | $cflags.= " -DZLIB_SHARED" if $zlib_opt == 2; | ||
| 274 | |||
| 275 | if ($no_static_engine) | ||
| 276 | { | ||
| 277 | $cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; | ||
| 278 | } | ||
| 279 | else | ||
| 280 | { | ||
| 281 | $cflags .= " -DOPENSSL_NO_DYNAMIC_ENGINE"; | ||
| 282 | } | ||
| 283 | |||
| 284 | #$cflags.=" -DRSAref" if $rsaref ne ""; | ||
| 285 | |||
| 286 | ## if ($unix) | ||
| 287 | ## { $cflags="$c_flags" if ($c_flags ne ""); } | ||
| 288 | ##else | ||
| 289 | { $cflags="$c_flags$cflags" if ($c_flags ne ""); } | ||
| 290 | |||
| 291 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | ||
| 292 | |||
| 293 | |||
| 294 | %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", | ||
| 295 | "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); | ||
| 296 | |||
| 297 | if ($msdos) | ||
| 298 | { | ||
| 299 | $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; | ||
| 300 | $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; | ||
| 301 | $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; | ||
| 302 | $banner.="\t\@echo documentation for details.\n"; | ||
| 303 | } | ||
| 304 | |||
| 305 | # have to do this to allow $(CC) under unix | ||
| 306 | $link="$bin_dir$link" if ($link !~ /^\$/); | ||
| 307 | |||
| 308 | $INSTALLTOP =~ s|/|$o|g; | ||
| 309 | $OPENSSLDIR =~ s|/|$o|g; | ||
| 310 | |||
| 311 | ############################################# | ||
| 312 | # We parse in input file and 'store' info for later printing. | ||
| 313 | open(IN,"<$infile") || die "unable to open $infile:$!\n"; | ||
| 314 | $_=<IN>; | ||
| 315 | for (;;) | ||
| 316 | { | ||
| 317 | chop; | ||
| 318 | |||
| 319 | ($key,$val)=/^([^=]+)=(.*)/; | ||
| 320 | if ($key eq "RELATIVE_DIRECTORY") | ||
| 321 | { | ||
| 322 | if ($lib ne "") | ||
| 323 | { | ||
| 324 | $uc=$lib; | ||
| 325 | $uc =~ s/^lib(.*)\.a/$1/; | ||
| 326 | $uc =~ tr/a-z/A-Z/; | ||
| 327 | $lib_nam{$uc}=$uc; | ||
| 328 | $lib_obj{$uc}.=$libobj." "; | ||
| 329 | } | ||
| 330 | last if ($val eq "FINISHED"); | ||
| 331 | $lib=""; | ||
| 332 | $libobj=""; | ||
| 333 | $dir=$val; | ||
| 334 | } | ||
| 335 | |||
| 336 | if ($key eq "KRB5_INCLUDES") | ||
| 337 | { $cflags .= " $val";} | ||
| 338 | |||
| 339 | if ($key eq "ZLIB_INCLUDE") | ||
| 340 | { $cflags .= " $val" if $val ne "";} | ||
| 341 | |||
| 342 | if ($key eq "LIBZLIB") | ||
| 343 | { $zlib_lib = "$val" if $val ne "";} | ||
| 344 | |||
| 345 | if ($key eq "LIBKRB5") | ||
| 346 | { $ex_libs .= " $val" if $val ne "";} | ||
| 347 | |||
| 348 | if ($key eq "TEST") | ||
| 349 | { $test.=&var_add($dir,$val, 0); } | ||
| 350 | |||
| 351 | if (($key eq "PROGS") || ($key eq "E_OBJ")) | ||
| 352 | { $e_exe.=&var_add($dir,$val, 0); } | ||
| 353 | |||
| 354 | if ($key eq "LIB") | ||
| 355 | { | ||
| 356 | $lib=$val; | ||
| 357 | $lib =~ s/^.*\/([^\/]+)$/$1/; | ||
| 358 | } | ||
| 359 | |||
| 360 | if ($key eq "EXHEADER") | ||
| 361 | { $exheader.=&var_add($dir,$val, 1); } | ||
| 362 | |||
| 363 | if ($key eq "HEADER") | ||
| 364 | { $header.=&var_add($dir,$val, 1); } | ||
| 365 | |||
| 366 | if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine)) | ||
| 367 | { $libobj=&var_add($dir,$val, 0); } | ||
| 368 | if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine) | ||
| 369 | { $engines.=$val } | ||
| 370 | |||
| 371 | if (!($_=<IN>)) | ||
| 372 | { $_="RELATIVE_DIRECTORY=FINISHED\n"; } | ||
| 373 | } | ||
| 374 | close(IN); | ||
| 375 | |||
| 376 | if ($shlib) | ||
| 377 | { | ||
| 378 | $extra_install= <<"EOF"; | ||
| 379 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}bin\" | ||
| 380 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}bin\" | ||
| 381 | \$(CP) \"\$(L_SSL)\" \"\$(INSTALLTOP)${o}lib\" | ||
| 382 | \$(CP) \"\$(L_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" | ||
| 383 | EOF | ||
| 384 | if ($no_static_engine) | ||
| 385 | { | ||
| 386 | $extra_install .= <<"EOF" | ||
| 387 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
| 388 | \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\" | ||
| 389 | EOF | ||
| 390 | } | ||
| 391 | } | ||
| 392 | else | ||
| 393 | { | ||
| 394 | $extra_install= <<"EOF"; | ||
| 395 | \$(CP) \"\$(O_SSL)\" \"\$(INSTALLTOP)${o}lib\" | ||
| 396 | \$(CP) \"\$(O_CRYPTO)\" \"\$(INSTALLTOP)${o}lib\" | ||
| 397 | EOF | ||
| 398 | $ex_libs .= " $zlib_lib" if $zlib_opt == 1; | ||
| 399 | } | ||
| 400 | |||
| 401 | $defs= <<"EOF"; | ||
| 402 | # This makefile has been automatically generated from the OpenSSL distribution. | ||
| 403 | # This single makefile will build the complete OpenSSL distribution and | ||
| 404 | # by default leave the 'intertesting' output files in .${o}out and the stuff | ||
| 405 | # that needs deleting in .${o}tmp. | ||
| 406 | # The file was generated by running 'make makefile.one', which | ||
| 407 | # does a 'make files', which writes all the environment variables from all | ||
| 408 | # the makefiles to the file call MINFO. This file is used by | ||
| 409 | # util${o}mk1mf.pl to generate makefile.one. | ||
| 410 | # The 'makefile per directory' system suites me when developing this | ||
| 411 | # library and also so I can 'distribute' indervidual library sections. | ||
| 412 | # The one monster makefile better suits building in non-unix | ||
| 413 | # environments. | ||
| 414 | |||
| 415 | EOF | ||
| 416 | |||
| 417 | $defs .= $preamble if defined $preamble; | ||
| 418 | |||
| 419 | $defs.= <<"EOF"; | ||
| 420 | INSTALLTOP=$INSTALLTOP | ||
| 421 | OPENSSLDIR=$OPENSSLDIR | ||
| 422 | |||
| 423 | # Set your compiler options | ||
| 424 | PLATFORM=$platform | ||
| 425 | CC=$bin_dir${cc} | ||
| 426 | CFLAG=$cflags | ||
| 427 | APP_CFLAG=$app_cflag | ||
| 428 | LIB_CFLAG=$lib_cflag | ||
| 429 | SHLIB_CFLAG=$shl_cflag | ||
| 430 | APP_EX_OBJ=$app_ex_obj | ||
| 431 | SHLIB_EX_OBJ=$shlib_ex_obj | ||
| 432 | # add extra libraries to this define, for solaris -lsocket -lnsl would | ||
| 433 | # be added | ||
| 434 | EX_LIBS=$ex_libs | ||
| 435 | |||
| 436 | # The OpenSSL directory | ||
| 437 | SRC_D=$src_dir | ||
| 438 | |||
| 439 | LINK=$link | ||
| 440 | LFLAGS=$lflags | ||
| 441 | RSC=$rsc | ||
| 442 | |||
| 443 | # The output directory for everything intersting | ||
| 444 | OUT_D=$out_dir | ||
| 445 | # The output directory for all the temporary muck | ||
| 446 | TMP_D=$tmp_dir | ||
| 447 | # The output directory for the header files | ||
| 448 | INC_D=$inc_dir | ||
| 449 | INCO_D=$inc_dir${o}openssl | ||
| 450 | |||
| 451 | PERL=$perl | ||
| 452 | CP=$cp | ||
| 453 | RM=$rm | ||
| 454 | RANLIB=$ranlib | ||
| 455 | MKDIR=$mkdir | ||
| 456 | MKLIB=$bin_dir$mklib | ||
| 457 | MLFLAGS=$mlflags | ||
| 458 | ASM=$bin_dir$asm | ||
| 459 | |||
| 460 | ###################################################### | ||
| 461 | # You should not need to touch anything below this point | ||
| 462 | ###################################################### | ||
| 463 | |||
| 464 | E_EXE=openssl | ||
| 465 | SSL=$ssl | ||
| 466 | CRYPTO=$crypto | ||
| 467 | |||
| 468 | # BIN_D - Binary output directory | ||
| 469 | # TEST_D - Binary test file output directory | ||
| 470 | # LIB_D - library output directory | ||
| 471 | # ENG_D - dynamic engine output directory | ||
| 472 | # Note: if you change these point to different directories then uncomment out | ||
| 473 | # the lines around the 'NB' comment below. | ||
| 474 | # | ||
| 475 | BIN_D=\$(OUT_D) | ||
| 476 | TEST_D=\$(OUT_D) | ||
| 477 | LIB_D=\$(OUT_D) | ||
| 478 | ENG_D=\$(OUT_D) | ||
| 479 | |||
| 480 | # INCL_D - local library directory | ||
| 481 | # OBJ_D - temp object file directory | ||
| 482 | OBJ_D=\$(TMP_D) | ||
| 483 | INCL_D=\$(TMP_D) | ||
| 484 | |||
| 485 | O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp | ||
| 486 | O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp | ||
| 487 | SO_SSL= $plib\$(SSL)$so_shlibp | ||
| 488 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | ||
| 489 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp | ||
| 490 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp | ||
| 491 | |||
| 492 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) | ||
| 493 | |||
| 494 | ###################################################### | ||
| 495 | # Don't touch anything below this point | ||
| 496 | ###################################################### | ||
| 497 | |||
| 498 | INC=-I\$(INC_D) -I\$(INCL_D) | ||
| 499 | APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) | ||
| 500 | LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) | ||
| 501 | SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG) | ||
| 502 | LIBS_DEP=\$(O_CRYPTO) \$(O_SSL) | ||
| 503 | |||
| 504 | ############################################# | ||
| 505 | EOF | ||
| 506 | |||
| 507 | $rules=<<"EOF"; | ||
| 508 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe | ||
| 509 | |||
| 510 | banner: | ||
| 511 | $banner | ||
| 512 | |||
| 513 | \$(TMP_D): | ||
| 514 | \$(MKDIR) \"\$(TMP_D)\" | ||
| 515 | # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different | ||
| 516 | #\$(BIN_D): | ||
| 517 | # \$(MKDIR) \$(BIN_D) | ||
| 518 | # | ||
| 519 | #\$(TEST_D): | ||
| 520 | # \$(MKDIR) \$(TEST_D) | ||
| 521 | |||
| 522 | \$(LIB_D): | ||
| 523 | \$(MKDIR) \"\$(LIB_D)\" | ||
| 524 | |||
| 525 | \$(INCO_D): \$(INC_D) | ||
| 526 | \$(MKDIR) \"\$(INCO_D)\" | ||
| 527 | |||
| 528 | \$(INC_D): | ||
| 529 | \$(MKDIR) \"\$(INC_D)\" | ||
| 530 | |||
| 531 | headers: \$(HEADER) \$(EXHEADER) | ||
| 532 | @ | ||
| 533 | |||
| 534 | lib: \$(LIBS_DEP) \$(E_SHLIB) | ||
| 535 | |||
| 536 | exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep | ||
| 537 | |||
| 538 | install: all | ||
| 539 | \$(MKDIR) \"\$(INSTALLTOP)\" | ||
| 540 | \$(MKDIR) \"\$(INSTALLTOP)${o}bin\" | ||
| 541 | \$(MKDIR) \"\$(INSTALLTOP)${o}include\" | ||
| 542 | \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\" | ||
| 543 | \$(MKDIR) \"\$(INSTALLTOP)${o}lib\" | ||
| 544 | \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\" | ||
| 545 | \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\" | ||
| 546 | \$(MKDIR) \"\$(OPENSSLDIR)\" | ||
| 547 | \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\" | ||
| 548 | $extra_install | ||
| 549 | |||
| 550 | |||
| 551 | test: \$(T_EXE) | ||
| 552 | cd \$(BIN_D) | ||
| 553 | ..${o}ms${o}test | ||
| 554 | |||
| 555 | clean: | ||
| 556 | \$(RM) \$(TMP_D)$o*.* | ||
| 557 | |||
| 558 | vclean: | ||
| 559 | \$(RM) \$(TMP_D)$o*.* | ||
| 560 | \$(RM) \$(OUT_D)$o*.* | ||
| 561 | |||
| 562 | EOF | ||
| 563 | |||
| 564 | my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; | ||
| 565 | $platform_cpp_symbol =~ s/-/_/g; | ||
| 566 | if (open(IN,"crypto/buildinf.h")) | ||
| 567 | { | ||
| 568 | # Remove entry for this platform in existing file buildinf.h. | ||
| 569 | |||
| 570 | my $old_buildinf_h = ""; | ||
| 571 | while (<IN>) | ||
| 572 | { | ||
| 573 | if (/^\#ifdef $platform_cpp_symbol$/) | ||
| 574 | { | ||
| 575 | while (<IN>) { last if (/^\#endif/); } | ||
| 576 | } | ||
| 577 | else | ||
| 578 | { | ||
| 579 | $old_buildinf_h .= $_; | ||
| 580 | } | ||
| 581 | } | ||
| 582 | close(IN); | ||
| 583 | |||
| 584 | open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
| 585 | print OUT $old_buildinf_h; | ||
| 586 | close(OUT); | ||
| 587 | } | ||
| 588 | |||
| 589 | open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
| 590 | printf OUT <<EOF; | ||
| 591 | #ifdef $platform_cpp_symbol | ||
| 592 | /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */ | ||
| 593 | #define CFLAGS "$cc $cflags" | ||
| 594 | #define PLATFORM "$platform" | ||
| 595 | EOF | ||
| 596 | printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | ||
| 597 | printf OUT "#endif\n"; | ||
| 598 | close(OUT); | ||
| 599 | |||
| 600 | # Strip of trailing ' ' | ||
| 601 | foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); } | ||
| 602 | $test=&clean_up_ws($test); | ||
| 603 | $e_exe=&clean_up_ws($e_exe); | ||
| 604 | $exheader=&clean_up_ws($exheader); | ||
| 605 | $header=&clean_up_ws($header); | ||
| 606 | |||
| 607 | # First we strip the exheaders from the headers list | ||
| 608 | foreach (split(/\s+/,$exheader)){ $h{$_}=1; } | ||
| 609 | foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; } | ||
| 610 | chop($h); $header=$h; | ||
| 611 | |||
| 612 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",""); | ||
| 613 | $rules.=&do_copy_rule("\$(INCL_D)",$header,""); | ||
| 614 | |||
| 615 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",""); | ||
| 616 | $rules.=&do_copy_rule("\$(INCO_D)",$exheader,""); | ||
| 617 | |||
| 618 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); | ||
| 619 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | ||
| 620 | |||
| 621 | $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj); | ||
| 622 | $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)'); | ||
| 623 | |||
| 624 | foreach (values %lib_nam) | ||
| 625 | { | ||
| 626 | $lib_obj=$lib_obj{$_}; | ||
| 627 | local($slib)=$shlib; | ||
| 628 | |||
| 629 | if (($_ eq "SSL") && $no_ssl2 && $no_ssl3) | ||
| 630 | { | ||
| 631 | $rules.="\$(O_SSL):\n\n"; | ||
| 632 | next; | ||
| 633 | } | ||
| 634 | |||
| 635 | $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj); | ||
| 636 | $lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)"; | ||
| 637 | $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib); | ||
| 638 | } | ||
| 639 | |||
| 640 | # hack to add version info on MSVC | ||
| 641 | if (($platform eq "VC-WIN32") || ($platform eq "VC-WIN64A") | ||
| 642 | || ($platform eq "VC-WIN64I") || ($platform eq "VC-NT")) { | ||
| 643 | $rules.= <<"EOF"; | ||
| 644 | \$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc | ||
| 645 | \$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc | ||
| 646 | |||
| 647 | \$(OBJ_D)\\\$(SSL).res: ms\\version32.rc | ||
| 648 | \$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc | ||
| 649 | |||
| 650 | EOF | ||
| 651 | } | ||
| 652 | |||
| 653 | $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep); | ||
| 654 | foreach (split(/\s+/,$test)) | ||
| 655 | { | ||
| 656 | $t=&bname($_); | ||
| 657 | $tt="\$(OBJ_D)${o}$t${obj}"; | ||
| 658 | $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
| 659 | } | ||
| 660 | |||
| 661 | $defs.=&do_defs("E_SHLIB",$engines,"\$(ENG_D)",$shlibp); | ||
| 662 | |||
| 663 | foreach (split(/\s+/,$engines)) | ||
| 664 | { | ||
| 665 | $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib); | ||
| 666 | $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,""); | ||
| 667 | } | ||
| 668 | |||
| 669 | |||
| 670 | |||
| 671 | $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)"); | ||
| 672 | $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)"); | ||
| 673 | |||
| 674 | $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); | ||
| 675 | |||
| 676 | print $defs; | ||
| 677 | |||
| 678 | if ($platform eq "linux-elf") { | ||
| 679 | print <<"EOF"; | ||
| 680 | # Generate perlasm output files | ||
| 681 | %.cpp: | ||
| 682 | (cd \$(\@D)/..; PERL=perl make -f Makefile asm/\$(\@F)) | ||
| 683 | EOF | ||
| 684 | } | ||
| 685 | print "###################################################################\n"; | ||
| 686 | print $rules; | ||
| 687 | |||
| 688 | ############################################### | ||
| 689 | # strip off any trailing .[och] and append the relative directory | ||
| 690 | # also remembering to do nothing if we are in one of the dropped | ||
| 691 | # directories | ||
| 692 | sub var_add | ||
| 693 | { | ||
| 694 | local($dir,$val,$keepext)=@_; | ||
| 695 | local(@a,$_,$ret); | ||
| 696 | |||
| 697 | return("") if $no_engine && $dir =~ /\/engine/; | ||
| 698 | return("") if $no_hw && $dir =~ /\/hw/; | ||
| 699 | return("") if $no_idea && $dir =~ /\/idea/; | ||
| 700 | return("") if $no_aes && $dir =~ /\/aes/; | ||
| 701 | return("") if $no_camellia && $dir =~ /\/camellia/; | ||
| 702 | return("") if $no_seed && $dir =~ /\/seed/; | ||
| 703 | return("") if $no_rc2 && $dir =~ /\/rc2/; | ||
| 704 | return("") if $no_rc4 && $dir =~ /\/rc4/; | ||
| 705 | return("") if $no_rc5 && $dir =~ /\/rc5/; | ||
| 706 | return("") if $no_rsa && $dir =~ /\/rsa/; | ||
| 707 | return("") if $no_rsa && $dir =~ /^rsaref/; | ||
| 708 | return("") if $no_dsa && $dir =~ /\/dsa/; | ||
| 709 | return("") if $no_dh && $dir =~ /\/dh/; | ||
| 710 | return("") if $no_ec && $dir =~ /\/ec/; | ||
| 711 | return("") if $no_cms && $dir =~ /\/cms/; | ||
| 712 | return("") if $no_jpake && $dir =~ /\/jpake/; | ||
| 713 | if ($no_des && $dir =~ /\/des/) | ||
| 714 | { | ||
| 715 | if ($val =~ /read_pwd/) | ||
| 716 | { return("$dir/read_pwd "); } | ||
| 717 | else | ||
| 718 | { return(""); } | ||
| 719 | } | ||
| 720 | return("") if $no_mdc2 && $dir =~ /\/mdc2/; | ||
| 721 | return("") if $no_sock && $dir =~ /\/proxy/; | ||
| 722 | return("") if $no_bf && $dir =~ /\/bf/; | ||
| 723 | return("") if $no_cast && $dir =~ /\/cast/; | ||
| 724 | return("") if $no_whirlpool && $dir =~ /\/whrlpool/; | ||
| 725 | |||
| 726 | $val =~ s/^\s*(.*)\s*$/$1/; | ||
| 727 | @a=split(/\s+/,$val); | ||
| 728 | grep(s/\.[och]$//,@a) unless $keepext; | ||
| 729 | |||
| 730 | @a=grep(!/^e_.*_3d$/,@a) if $no_des; | ||
| 731 | @a=grep(!/^e_.*_d$/,@a) if $no_des; | ||
| 732 | @a=grep(!/^e_.*_ae$/,@a) if $no_idea; | ||
| 733 | @a=grep(!/^e_.*_i$/,@a) if $no_aes; | ||
| 734 | @a=grep(!/^e_.*_r2$/,@a) if $no_rc2; | ||
| 735 | @a=grep(!/^e_.*_r5$/,@a) if $no_rc5; | ||
| 736 | @a=grep(!/^e_.*_bf$/,@a) if $no_bf; | ||
| 737 | @a=grep(!/^e_.*_c$/,@a) if $no_cast; | ||
| 738 | @a=grep(!/^e_rc4$/,@a) if $no_rc4; | ||
| 739 | @a=grep(!/^e_camellia$/,@a) if $no_camellia; | ||
| 740 | @a=grep(!/^e_seed$/,@a) if $no_seed; | ||
| 741 | |||
| 742 | #@a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2; | ||
| 743 | #@a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3; | ||
| 744 | |||
| 745 | @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock; | ||
| 746 | |||
| 747 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; | ||
| 748 | @a=grep(!/(^md4)|(_md4$)/,@a) if $no_md4; | ||
| 749 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; | ||
| 750 | @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd; | ||
| 751 | |||
| 752 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; | ||
| 753 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; | ||
| 754 | @a=grep(!/(^pem_seal$)/,@a) if $no_rsa; | ||
| 755 | |||
| 756 | @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa; | ||
| 757 | @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa; | ||
| 758 | |||
| 759 | @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4; | ||
| 760 | |||
| 761 | @a=grep(!/_dhp$/,@a) if $no_dh; | ||
| 762 | |||
| 763 | @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha; | ||
| 764 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
| 765 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | ||
| 766 | |||
| 767 | @a=grep(!/^engine$/,@a) if $no_engine; | ||
| 768 | @a=grep(!/^hw$/,@a) if $no_hw; | ||
| 769 | @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; | ||
| 770 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | ||
| 771 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | ||
| 772 | @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; | ||
| 773 | |||
| 774 | @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | ||
| 775 | |||
| 776 | grep($_="$dir/$_",@a); | ||
| 777 | @a=grep(!/(^|\/)s_/,@a) if $no_sock; | ||
| 778 | @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock; | ||
| 779 | $ret=join(' ',@a)." "; | ||
| 780 | return($ret); | ||
| 781 | } | ||
| 782 | |||
| 783 | # change things so that each 'token' is only separated by one space | ||
| 784 | sub clean_up_ws | ||
| 785 | { | ||
| 786 | local($w)=@_; | ||
| 787 | |||
| 788 | $w =~ s/^\s*(.*)\s*$/$1/; | ||
| 789 | $w =~ s/\s+/ /g; | ||
| 790 | return($w); | ||
| 791 | } | ||
| 792 | |||
| 793 | sub do_defs | ||
| 794 | { | ||
| 795 | local($var,$files,$location,$postfix)=@_; | ||
| 796 | local($_,$ret,$pf); | ||
| 797 | local(*OUT,$tmp,$t); | ||
| 798 | |||
| 799 | $files =~ s/\//$o/g if $o ne '/'; | ||
| 800 | $ret="$var="; | ||
| 801 | $n=1; | ||
| 802 | $Vars{$var}.=""; | ||
| 803 | foreach (split(/ /,$files)) | ||
| 804 | { | ||
| 805 | $orig=$_; | ||
| 806 | $_=&bname($_) unless /^\$/; | ||
| 807 | if ($n++ == 2) | ||
| 808 | { | ||
| 809 | $n=0; | ||
| 810 | $ret.="\\\n\t"; | ||
| 811 | } | ||
| 812 | if (($_ =~ /bss_file/) && ($postfix eq ".h")) | ||
| 813 | { $pf=".c"; } | ||
| 814 | else { $pf=$postfix; } | ||
| 815 | if ($_ =~ /BN_ASM/) { $t="$_ "; } | ||
| 816 | elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; } | ||
| 817 | elsif ($_ =~ /AES_ASM/){ $t="$_ "; } | ||
| 818 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } | ||
| 819 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } | ||
| 820 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } | ||
| 821 | elsif ($_ =~ /RC4_ENC/) { $t="$_ "; } | ||
| 822 | elsif ($_ =~ /RC5_ENC/) { $t="$_ "; } | ||
| 823 | elsif ($_ =~ /MD5_ASM/) { $t="$_ "; } | ||
| 824 | elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; } | ||
| 825 | elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; } | ||
| 826 | elsif ($_ =~ /WHIRLPOOL_ASM/){ $t="$_ "; } | ||
| 827 | elsif ($_ =~ /CPUID_ASM/){ $t="$_ "; } | ||
| 828 | else { $t="$location${o}$_$pf "; } | ||
| 829 | |||
| 830 | $Vars{$var}.="$t "; | ||
| 831 | $ret.=$t; | ||
| 832 | } | ||
| 833 | # hack to add version info on MSVC | ||
| 834 | if ($shlib && (($platform eq "VC-WIN32") || ($platfrom eq "VC-WIN64I") || ($platform eq "VC-WIN64A") || ($platform eq "VC-NT"))) | ||
| 835 | { | ||
| 836 | if ($var eq "CRYPTOOBJ") | ||
| 837 | { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } | ||
| 838 | elsif ($var eq "SSLOBJ") | ||
| 839 | { $ret.="\$(OBJ_D)\\\$(SSL).res "; } | ||
| 840 | } | ||
| 841 | chomp($ret); | ||
| 842 | $ret.="\n\n"; | ||
| 843 | return($ret); | ||
| 844 | } | ||
| 845 | |||
| 846 | # return the name with the leading path removed | ||
| 847 | sub bname | ||
| 848 | { | ||
| 849 | local($ret)=@_; | ||
| 850 | $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/; | ||
| 851 | return($ret); | ||
| 852 | } | ||
| 853 | |||
| 854 | # return the leading path | ||
| 855 | sub dname | ||
| 856 | { | ||
| 857 | my $ret=shift; | ||
| 858 | $ret =~ s/(^.*)[\\\/][^\\\/]+$/$1/; | ||
| 859 | return($ret); | ||
| 860 | } | ||
| 861 | |||
| 862 | ############################################################## | ||
| 863 | # do a rule for each file that says 'compile' to new direcory | ||
| 864 | # compile the files in '$files' into $to | ||
| 865 | sub do_compile_rule | ||
| 866 | { | ||
| 867 | local($to,$files,$ex)=@_; | ||
| 868 | local($ret,$_,$n,$d,$s); | ||
| 869 | |||
| 870 | $files =~ s/\//$o/g if $o ne '/'; | ||
| 871 | foreach (split(/\s+/,$files)) | ||
| 872 | { | ||
| 873 | $n=&bname($_); | ||
| 874 | $d=&dname($_); | ||
| 875 | if (-f "${_}.c") | ||
| 876 | { | ||
| 877 | $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex) | ||
| 878 | } | ||
| 879 | elsif (-f ($s="${d}${o}asm${o}${n}.pl") or | ||
| 880 | ($s=~s/sha256/sha512/ and -f $s) or | ||
| 881 | -f ($s="${d}${o}${n}.pl")) | ||
| 882 | { | ||
| 883 | $ret.=&perlasm_compile_target("$to${o}$n$obj",$s,$n); | ||
| 884 | } | ||
| 885 | elsif (-f ($s="${d}${o}asm${o}${n}.S") or | ||
| 886 | -f ($s="${d}${o}${n}.S")) | ||
| 887 | { | ||
| 888 | $ret.=&Sasm_compile_target("$to${o}$n$obj",$s,$n); | ||
| 889 | } | ||
| 890 | else { die "no rule for $_"; } | ||
| 891 | } | ||
| 892 | return($ret); | ||
| 893 | } | ||
| 894 | |||
| 895 | ############################################################## | ||
| 896 | # do a rule for each file that says 'compile' to new direcory | ||
| 897 | sub perlasm_compile_target | ||
| 898 | { | ||
| 899 | my($target,$source,$bname)=@_; | ||
| 900 | my($ret); | ||
| 901 | |||
| 902 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
| 903 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
| 904 | $ret.="\t\$(PERL) $source $asmtype \$(CFLAG) >\$\@\n\n"; | ||
| 905 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
| 906 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
| 907 | return($ret); | ||
| 908 | } | ||
| 909 | |||
| 910 | sub Sasm_compile_target | ||
| 911 | { | ||
| 912 | my($target,$source,$bname)=@_; | ||
| 913 | my($ret); | ||
| 914 | |||
| 915 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
| 916 | $ret ="\$(TMP_D)$o$bname.asm: $source\n"; | ||
| 917 | $ret.="\t\$(CC) -E \$(CFLAG) $source >\$\@\n\n"; | ||
| 918 | $ret.="$target: \$(TMP_D)$o$bname.asm\n"; | ||
| 919 | $ret.="\t\$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm\n\n"; | ||
| 920 | return($ret); | ||
| 921 | } | ||
| 922 | |||
| 923 | sub cc_compile_target | ||
| 924 | { | ||
| 925 | local($target,$source,$ex_flags)=@_; | ||
| 926 | local($ret); | ||
| 927 | |||
| 928 | $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/); | ||
| 929 | $target =~ s/\//$o/g if $o ne "/"; | ||
| 930 | $source =~ s/\//$o/g if $o ne "/"; | ||
| 931 | $ret ="$target: \$(SRC_D)$o$source\n\t"; | ||
| 932 | $ret.="\$(CC) ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n"; | ||
| 933 | return($ret); | ||
| 934 | } | ||
| 935 | |||
| 936 | ############################################################## | ||
| 937 | sub do_asm_rule | ||
| 938 | { | ||
| 939 | local($target,$src)=@_; | ||
| 940 | local($ret,@s,@t,$i); | ||
| 941 | |||
| 942 | $target =~ s/\//$o/g if $o ne "/"; | ||
| 943 | $src =~ s/\//$o/g if $o ne "/"; | ||
| 944 | |||
| 945 | @t=split(/\s+/,$target); | ||
| 946 | @s=split(/\s+/,$src); | ||
| 947 | |||
| 948 | |||
| 949 | for ($i=0; $i<=$#s; $i++) | ||
| 950 | { | ||
| 951 | my $objfile = $t[$i]; | ||
| 952 | my $srcfile = $s[$i]; | ||
| 953 | |||
| 954 | if ($perl_asm == 1) | ||
| 955 | { | ||
| 956 | my $plasm = $objfile; | ||
| 957 | $plasm =~ s/${obj}/.pl/; | ||
| 958 | $ret.="$srcfile: $plasm\n"; | ||
| 959 | $ret.="\t\$(PERL) $plasm $asmtype \$(CFLAG) >$srcfile\n\n"; | ||
| 960 | } | ||
| 961 | |||
| 962 | $ret.="$objfile: $srcfile\n"; | ||
| 963 | $ret.="\t\$(ASM) $afile$objfile \$(SRC_D)$o$srcfile\n\n"; | ||
| 964 | } | ||
| 965 | return($ret); | ||
| 966 | } | ||
| 967 | |||
| 968 | sub do_shlib_rule | ||
| 969 | { | ||
| 970 | local($n,$def)=@_; | ||
| 971 | local($ret,$nn); | ||
| 972 | local($t); | ||
| 973 | |||
| 974 | ($nn=$n) =~ tr/a-z/A-Z/; | ||
| 975 | $ret.="$n.dll: \$(${nn}OBJ)\n"; | ||
| 976 | if ($vc && $w32) | ||
| 977 | { | ||
| 978 | $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n"; | ||
| 979 | } | ||
| 980 | $ret.="\n"; | ||
| 981 | return($ret); | ||
| 982 | } | ||
| 983 | |||
| 984 | # do a rule for each file that says 'copy' to new direcory on change | ||
| 985 | sub do_copy_rule | ||
| 986 | { | ||
| 987 | local($to,$files,$p)=@_; | ||
| 988 | local($ret,$_,$n,$pp); | ||
| 989 | |||
| 990 | $files =~ s/\//$o/g if $o ne '/'; | ||
| 991 | foreach (split(/\s+/,$files)) | ||
| 992 | { | ||
| 993 | $n=&bname($_); | ||
| 994 | if ($n =~ /bss_file/) | ||
| 995 | { $pp=".c"; } | ||
| 996 | else { $pp=$p; } | ||
| 997 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n"; | ||
| 998 | } | ||
| 999 | return($ret); | ||
| 1000 | } | ||
| 1001 | |||
| 1002 | sub read_options | ||
| 1003 | { | ||
| 1004 | # Many options are handled in a similar way. In particular | ||
| 1005 | # no-xxx sets zero or more scalars to 1. | ||
| 1006 | # Process these using a hash containing the option name and | ||
| 1007 | # reference to the scalars to set. | ||
| 1008 | |||
| 1009 | my %valid_options = ( | ||
| 1010 | "no-rc2" => \$no_rc2, | ||
| 1011 | "no-rc4" => \$no_rc4, | ||
| 1012 | "no-rc5" => \$no_rc5, | ||
| 1013 | "no-idea" => \$no_idea, | ||
| 1014 | "no-aes" => \$no_aes, | ||
| 1015 | "no-camellia" => \$no_camellia, | ||
| 1016 | "no-seed" => \$no_seed, | ||
| 1017 | "no-des" => \$no_des, | ||
| 1018 | "no-bf" => \$no_bf, | ||
| 1019 | "no-cast" => \$no_cast, | ||
| 1020 | "no-md2" => \$no_md2, | ||
| 1021 | "no-md4" => \$no_md4, | ||
| 1022 | "no-md5" => \$no_md5, | ||
| 1023 | "no-sha" => \$no_sha, | ||
| 1024 | "no-sha1" => \$no_sha1, | ||
| 1025 | "no-ripemd" => \$no_ripemd, | ||
| 1026 | "no-mdc2" => \$no_mdc2, | ||
| 1027 | "no-whirlpool" => \$no_whirlpool, | ||
| 1028 | "no-patents" => | ||
| 1029 | [\$no_rc2, \$no_rc4, \$no_rc5, \$no_idea, \$no_rsa], | ||
| 1030 | "no-rsa" => \$no_rsa, | ||
| 1031 | "no-dsa" => \$no_dsa, | ||
| 1032 | "no-dh" => \$no_dh, | ||
| 1033 | "no-hmac" => \$no_hmac, | ||
| 1034 | "no-asm" => \$no_asm, | ||
| 1035 | "nasm" => \$nasm, | ||
| 1036 | "nw-nasm" => \$nw_nasm, | ||
| 1037 | "nw-mwasm" => \$nw_mwasm, | ||
| 1038 | "gaswin" => \$gaswin, | ||
| 1039 | "no-ssl2" => \$no_ssl2, | ||
| 1040 | "no-ssl3" => \$no_ssl3, | ||
| 1041 | "no-tlsext" => \$no_tlsext, | ||
| 1042 | "no-cms" => \$no_cms, | ||
| 1043 | "no-jpake" => \$no_jpake, | ||
| 1044 | "no-err" => \$no_err, | ||
| 1045 | "no-sock" => \$no_sock, | ||
| 1046 | "no-krb5" => \$no_krb5, | ||
| 1047 | "no-ec" => \$no_ec, | ||
| 1048 | "no-ecdsa" => \$no_ecdsa, | ||
| 1049 | "no-ecdh" => \$no_ecdh, | ||
| 1050 | "no-engine" => \$no_engine, | ||
| 1051 | "no-hw" => \$no_hw, | ||
| 1052 | "just-ssl" => | ||
| 1053 | [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast, | ||
| 1054 | \$no_md2, \$no_sha, \$no_mdc2, \$no_dsa, \$no_dh, | ||
| 1055 | \$no_ssl2, \$no_err, \$no_ripemd, \$no_rc5, | ||
| 1056 | \$no_aes, \$no_camellia, \$no_seed], | ||
| 1057 | "rsaref" => 0, | ||
| 1058 | "gcc" => \$gcc, | ||
| 1059 | "debug" => \$debug, | ||
| 1060 | "profile" => \$profile, | ||
| 1061 | "shlib" => \$shlib, | ||
| 1062 | "dll" => \$shlib, | ||
| 1063 | "shared" => 0, | ||
| 1064 | "no-gmp" => 0, | ||
| 1065 | "no-rfc3779" => 0, | ||
| 1066 | "no-montasm" => 0, | ||
| 1067 | "no-shared" => 0, | ||
| 1068 | "no-store" => 0, | ||
| 1069 | "no-zlib" => 0, | ||
| 1070 | "no-zlib-dynamic" => 0, | ||
| 1071 | ); | ||
| 1072 | |||
| 1073 | if (exists $valid_options{$_}) | ||
| 1074 | { | ||
| 1075 | my $r = $valid_options{$_}; | ||
| 1076 | if ( ref $r eq "SCALAR") | ||
| 1077 | { $$r = 1;} | ||
| 1078 | elsif ( ref $r eq "ARRAY") | ||
| 1079 | { | ||
| 1080 | my $r2; | ||
| 1081 | foreach $r2 (@$r) | ||
| 1082 | { | ||
| 1083 | $$r2 = 1; | ||
| 1084 | } | ||
| 1085 | } | ||
| 1086 | } | ||
| 1087 | elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } | ||
| 1088 | elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 } | ||
| 1089 | elsif (/^enable-zlib-dynamic$/) | ||
| 1090 | { | ||
| 1091 | $zlib_opt = 2; | ||
| 1092 | } | ||
| 1093 | elsif (/^no-static-engine/) | ||
| 1094 | { | ||
| 1095 | $no_static_engine = 1; | ||
| 1096 | } | ||
| 1097 | elsif (/^enable-static-engine/) | ||
| 1098 | { | ||
| 1099 | $no_static_engine = 0; | ||
| 1100 | } | ||
| 1101 | # There are also enable-xxx options which correspond to | ||
| 1102 | # the no-xxx. Since the scalars are enabled by default | ||
| 1103 | # these can be ignored. | ||
| 1104 | elsif (/^enable-/) | ||
| 1105 | { | ||
| 1106 | my $t = $_; | ||
| 1107 | $t =~ s/^enable/no/; | ||
| 1108 | if (exists $valid_options{$t}) | ||
| 1109 | {return 1;} | ||
| 1110 | return 0; | ||
| 1111 | } | ||
| 1112 | # experimental-xxx is mostly like enable-xxx, but opensslconf.v | ||
| 1113 | # will still set OPENSSL_NO_xxx unless we set OPENSSL_EXPERIMENTAL_xxx. | ||
| 1114 | # (No need to fail if we don't know the algorithm -- this is for adventurous users only.) | ||
| 1115 | elsif (/^experimental-/) | ||
| 1116 | { | ||
| 1117 | my $algo, $ALGO; | ||
| 1118 | ($algo = $_) =~ s/^experimental-//; | ||
| 1119 | ($ALGO = $algo) =~ tr/[a-z]/[A-Z]/; | ||
| 1120 | |||
| 1121 | $xcflags="-DOPENSSL_EXPERIMENTAL_$ALGO $xcflags"; | ||
| 1122 | |||
| 1123 | } | ||
| 1124 | elsif (/^--with-krb5-flavor=(.*)$/) | ||
| 1125 | { | ||
| 1126 | my $krb5_flavor = $1; | ||
| 1127 | if ($krb5_flavor =~ /^force-[Hh]eimdal$/) | ||
| 1128 | { | ||
| 1129 | $xcflags="-DKRB5_HEIMDAL $xcflags"; | ||
| 1130 | } | ||
| 1131 | elsif ($krb5_flavor =~ /^MIT/i) | ||
| 1132 | { | ||
| 1133 | $xcflags="-DKRB5_MIT $xcflags"; | ||
| 1134 | if ($krb5_flavor =~ /^MIT[._-]*1[._-]*[01]/i) | ||
| 1135 | { | ||
| 1136 | $xcflags="-DKRB5_MIT_OLD11 $xcflags" | ||
| 1137 | } | ||
| 1138 | } | ||
| 1139 | } | ||
| 1140 | elsif (/^([^=]*)=(.*)$/ && !/^-D/){ $VARS{$1}=$2; } | ||
| 1141 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | ||
| 1142 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | ||
| 1143 | { $c_flags.="$_ "; } | ||
| 1144 | else { return(0); } | ||
| 1145 | return(1); | ||
| 1146 | } | ||
diff --git a/src/lib/libcrypto/util/mkcerts.sh b/src/lib/libcrypto/util/mkcerts.sh new file mode 100644 index 0000000000..0184fcb70e --- /dev/null +++ b/src/lib/libcrypto/util/mkcerts.sh | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # This script will re-make all the required certs. | ||
| 4 | # cd apps | ||
| 5 | # sh ../util/mkcerts.sh | ||
| 6 | # mv ca-cert.pem pca-cert.pem ../certs | ||
| 7 | # cd .. | ||
| 8 | # cat certs/*.pem >>apps/server.pem | ||
| 9 | # cat certs/*.pem >>apps/server2.pem | ||
| 10 | # SSLEAY=`pwd`/apps/ssleay; export SSLEAY | ||
| 11 | # sh tools/c_rehash certs | ||
| 12 | # | ||
| 13 | |||
| 14 | CAbits=1024 | ||
| 15 | SSLEAY="../apps/openssl" | ||
| 16 | CONF="-config ../apps/openssl.cnf" | ||
| 17 | |||
| 18 | # create pca request. | ||
| 19 | echo creating $CAbits bit PCA cert request | ||
| 20 | $SSLEAY req $CONF \ | ||
| 21 | -new -md5 -newkey $CAbits \ | ||
| 22 | -keyout pca-key.pem \ | ||
| 23 | -out pca-req.pem -nodes >/dev/null <<EOF | ||
| 24 | AU | ||
| 25 | Queensland | ||
| 26 | . | ||
| 27 | CryptSoft Pty Ltd | ||
| 28 | . | ||
| 29 | Test PCA (1024 bit) | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | EOF | ||
| 34 | |||
| 35 | if [ $? != 0 ]; then | ||
| 36 | echo problems generating PCA request | ||
| 37 | exit 1 | ||
| 38 | fi | ||
| 39 | |||
| 40 | #sign it. | ||
| 41 | echo | ||
| 42 | echo self signing PCA | ||
| 43 | $SSLEAY x509 -md5 -days 1461 \ | ||
| 44 | -req -signkey pca-key.pem \ | ||
| 45 | -CAcreateserial -CAserial pca-cert.srl \ | ||
| 46 | -in pca-req.pem -out pca-cert.pem | ||
| 47 | |||
| 48 | if [ $? != 0 ]; then | ||
| 49 | echo problems self signing PCA cert | ||
| 50 | exit 1 | ||
| 51 | fi | ||
| 52 | echo | ||
| 53 | |||
| 54 | # create ca request. | ||
| 55 | echo creating $CAbits bit CA cert request | ||
| 56 | $SSLEAY req $CONF \ | ||
| 57 | -new -md5 -newkey $CAbits \ | ||
| 58 | -keyout ca-key.pem \ | ||
| 59 | -out ca-req.pem -nodes >/dev/null <<EOF | ||
| 60 | AU | ||
| 61 | Queensland | ||
| 62 | . | ||
| 63 | CryptSoft Pty Ltd | ||
| 64 | . | ||
| 65 | Test CA (1024 bit) | ||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | EOF | ||
| 70 | |||
| 71 | if [ $? != 0 ]; then | ||
| 72 | echo problems generating CA request | ||
| 73 | exit 1 | ||
| 74 | fi | ||
| 75 | |||
| 76 | #sign it. | ||
| 77 | echo | ||
| 78 | echo signing CA | ||
| 79 | $SSLEAY x509 -md5 -days 1461 \ | ||
| 80 | -req \ | ||
| 81 | -CAcreateserial -CAserial pca-cert.srl \ | ||
| 82 | -CA pca-cert.pem -CAkey pca-key.pem \ | ||
| 83 | -in ca-req.pem -out ca-cert.pem | ||
| 84 | |||
| 85 | if [ $? != 0 ]; then | ||
| 86 | echo problems signing CA cert | ||
| 87 | exit 1 | ||
| 88 | fi | ||
| 89 | echo | ||
| 90 | |||
| 91 | # create server request. | ||
| 92 | echo creating 512 bit server cert request | ||
| 93 | $SSLEAY req $CONF \ | ||
| 94 | -new -md5 -newkey 512 \ | ||
| 95 | -keyout s512-key.pem \ | ||
| 96 | -out s512-req.pem -nodes >/dev/null <<EOF | ||
| 97 | AU | ||
| 98 | Queensland | ||
| 99 | . | ||
| 100 | CryptSoft Pty Ltd | ||
| 101 | . | ||
| 102 | Server test cert (512 bit) | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | EOF | ||
| 107 | |||
| 108 | if [ $? != 0 ]; then | ||
| 109 | echo problems generating 512 bit server cert request | ||
| 110 | exit 1 | ||
| 111 | fi | ||
| 112 | |||
| 113 | #sign it. | ||
| 114 | echo | ||
| 115 | echo signing 512 bit server cert | ||
| 116 | $SSLEAY x509 -md5 -days 365 \ | ||
| 117 | -req \ | ||
| 118 | -CAcreateserial -CAserial ca-cert.srl \ | ||
| 119 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
| 120 | -in s512-req.pem -out server.pem | ||
| 121 | |||
| 122 | if [ $? != 0 ]; then | ||
| 123 | echo problems signing 512 bit server cert | ||
| 124 | exit 1 | ||
| 125 | fi | ||
| 126 | echo | ||
| 127 | |||
| 128 | # create 1024 bit server request. | ||
| 129 | echo creating 1024 bit server cert request | ||
| 130 | $SSLEAY req $CONF \ | ||
| 131 | -new -md5 -newkey 1024 \ | ||
| 132 | -keyout s1024key.pem \ | ||
| 133 | -out s1024req.pem -nodes >/dev/null <<EOF | ||
| 134 | AU | ||
| 135 | Queensland | ||
| 136 | . | ||
| 137 | CryptSoft Pty Ltd | ||
| 138 | . | ||
| 139 | Server test cert (1024 bit) | ||
| 140 | |||
| 141 | |||
| 142 | |||
| 143 | EOF | ||
| 144 | |||
| 145 | if [ $? != 0 ]; then | ||
| 146 | echo problems generating 1024 bit server cert request | ||
| 147 | exit 1 | ||
| 148 | fi | ||
| 149 | |||
| 150 | #sign it. | ||
| 151 | echo | ||
| 152 | echo signing 1024 bit server cert | ||
| 153 | $SSLEAY x509 -md5 -days 365 \ | ||
| 154 | -req \ | ||
| 155 | -CAcreateserial -CAserial ca-cert.srl \ | ||
| 156 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
| 157 | -in s1024req.pem -out server2.pem | ||
| 158 | |||
| 159 | if [ $? != 0 ]; then | ||
| 160 | echo problems signing 1024 bit server cert | ||
| 161 | exit 1 | ||
| 162 | fi | ||
| 163 | echo | ||
| 164 | |||
| 165 | # create 512 bit client request. | ||
| 166 | echo creating 512 bit client cert request | ||
| 167 | $SSLEAY req $CONF \ | ||
| 168 | -new -md5 -newkey 512 \ | ||
| 169 | -keyout c512-key.pem \ | ||
| 170 | -out c512-req.pem -nodes >/dev/null <<EOF | ||
| 171 | AU | ||
| 172 | Queensland | ||
| 173 | . | ||
| 174 | CryptSoft Pty Ltd | ||
| 175 | . | ||
| 176 | Client test cert (512 bit) | ||
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | EOF | ||
| 181 | |||
| 182 | if [ $? != 0 ]; then | ||
| 183 | echo problems generating 512 bit client cert request | ||
| 184 | exit 1 | ||
| 185 | fi | ||
| 186 | |||
| 187 | #sign it. | ||
| 188 | echo | ||
| 189 | echo signing 512 bit client cert | ||
| 190 | $SSLEAY x509 -md5 -days 365 \ | ||
| 191 | -req \ | ||
| 192 | -CAcreateserial -CAserial ca-cert.srl \ | ||
| 193 | -CA ca-cert.pem -CAkey ca-key.pem \ | ||
| 194 | -in c512-req.pem -out client.pem | ||
| 195 | |||
| 196 | if [ $? != 0 ]; then | ||
| 197 | echo problems signing 512 bit client cert | ||
| 198 | exit 1 | ||
| 199 | fi | ||
| 200 | |||
| 201 | echo cleanup | ||
| 202 | |||
| 203 | cat pca-key.pem >> pca-cert.pem | ||
| 204 | cat ca-key.pem >> ca-cert.pem | ||
| 205 | cat s512-key.pem >> server.pem | ||
| 206 | cat s1024key.pem >> server2.pem | ||
| 207 | cat c512-key.pem >> client.pem | ||
| 208 | |||
| 209 | for i in pca-cert.pem ca-cert.pem server.pem server2.pem client.pem | ||
| 210 | do | ||
| 211 | $SSLEAY x509 -issuer -subject -in $i -noout >$$ | ||
| 212 | cat $$ | ||
| 213 | /bin/cat $i >>$$ | ||
| 214 | /bin/mv $$ $i | ||
| 215 | done | ||
| 216 | |||
| 217 | #/bin/rm -f *key.pem *req.pem *.srl | ||
| 218 | |||
| 219 | echo Finished | ||
| 220 | |||
diff --git a/src/lib/libcrypto/util/mkdef.pl b/src/lib/libcrypto/util/mkdef.pl new file mode 100644 index 0000000000..a4a17e3ae9 --- /dev/null +++ b/src/lib/libcrypto/util/mkdef.pl | |||
| @@ -0,0 +1,1506 @@ | |||
| 1 | #!/usr/local/bin/perl -w | ||
| 2 | # | ||
| 3 | # generate a .def file | ||
| 4 | # | ||
| 5 | # It does this by parsing the header files and looking for the | ||
| 6 | # prototyped functions: it then prunes the output. | ||
| 7 | # | ||
| 8 | # Intermediary files are created, call libeay.num and ssleay.num,... | ||
| 9 | # Previously, they had the following format: | ||
| 10 | # | ||
| 11 | # routine-name nnnn | ||
| 12 | # | ||
| 13 | # But that isn't enough for a number of reasons, the first on being that | ||
| 14 | # this format is (needlessly) very Win32-centric, and even then... | ||
| 15 | # One of the biggest problems is that there's no information about what | ||
| 16 | # routines should actually be used, which varies with what crypto algorithms | ||
| 17 | # are disabled. Also, some operating systems (for example VMS with VAX C) | ||
| 18 | # need to keep track of the global variables as well as the functions. | ||
| 19 | # | ||
| 20 | # So, a remake of this script is done so as to include information on the | ||
| 21 | # kind of symbol it is (function or variable) and what algorithms they're | ||
| 22 | # part of. This will allow easy translating to .def files or the corresponding | ||
| 23 | # file in other operating systems (a .opt file for VMS, possibly with a .mar | ||
| 24 | # file). | ||
| 25 | # | ||
| 26 | # The format now becomes: | ||
| 27 | # | ||
| 28 | # routine-name nnnn info | ||
| 29 | # | ||
| 30 | # and the "info" part is actually a colon-separated string of fields with | ||
| 31 | # the following meaning: | ||
| 32 | # | ||
| 33 | # existence:platform:kind:algorithms | ||
| 34 | # | ||
| 35 | # - "existence" can be "EXIST" or "NOEXIST" depending on if the symbol is | ||
| 36 | # found somewhere in the source, | ||
| 37 | # - "platforms" is empty if it exists on all platforms, otherwise it contains | ||
| 38 | # comma-separated list of the platform, just as they are if the symbol exists | ||
| 39 | # for those platforms, or prepended with a "!" if not. This helps resolve | ||
| 40 | # symbol name variants for platforms where the names are too long for the | ||
| 41 | # compiler or linker, or if the systems is case insensitive and there is a | ||
| 42 | # clash, or the symbol is implemented differently (see | ||
| 43 | # EXPORT_VAR_AS_FUNCTION). This script assumes renaming of symbols is found | ||
| 44 | # in the file crypto/symhacks.h. | ||
| 45 | # The semantics for the platforms is that every item is checked against the | ||
| 46 | # environment. For the negative items ("!FOO"), if any of them is false | ||
| 47 | # (i.e. "FOO" is true) in the environment, the corresponding symbol can't be | ||
| 48 | # used. For the positive itms, if all of them are false in the environment, | ||
| 49 | # the corresponding symbol can't be used. Any combination of positive and | ||
| 50 | # negative items are possible, and of course leave room for some redundancy. | ||
| 51 | # - "kind" is "FUNCTION" or "VARIABLE". The meaning of that is obvious. | ||
| 52 | # - "algorithms" is a comma-separated list of algorithm names. This helps | ||
| 53 | # exclude symbols that are part of an algorithm that some user wants to | ||
| 54 | # exclude. | ||
| 55 | # | ||
| 56 | |||
| 57 | my $debug=0; | ||
| 58 | |||
| 59 | my $crypto_num= "util/libeay.num"; | ||
| 60 | my $ssl_num= "util/ssleay.num"; | ||
| 61 | my $libname; | ||
| 62 | |||
| 63 | my $do_update = 0; | ||
| 64 | my $do_rewrite = 1; | ||
| 65 | my $do_crypto = 0; | ||
| 66 | my $do_ssl = 0; | ||
| 67 | my $do_ctest = 0; | ||
| 68 | my $do_ctestall = 0; | ||
| 69 | my $do_checkexist = 0; | ||
| 70 | |||
| 71 | my $VMSVAX=0; | ||
| 72 | my $VMSNonVAX=0; | ||
| 73 | my $VMS=0; | ||
| 74 | my $W32=0; | ||
| 75 | my $W16=0; | ||
| 76 | my $NT=0; | ||
| 77 | my $OS2=0; | ||
| 78 | # Set this to make typesafe STACK definitions appear in DEF | ||
| 79 | my $safe_stack_def = 0; | ||
| 80 | |||
| 81 | my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT", | ||
| 82 | "EXPORT_VAR_AS_FUNCTION", "ZLIB" ); | ||
| 83 | my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" ); | ||
| 84 | my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", | ||
| 85 | "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1", | ||
| 86 | "SHA256", "SHA512", "RIPEMD", | ||
| 87 | "MDC2", "WHIRLPOOL", "RSA", "DSA", "DH", "EC", "ECDH", "ECDSA", | ||
| 88 | "HMAC", "AES", "CAMELLIA", "SEED", "GOST", | ||
| 89 | # Envelope "algorithms" | ||
| 90 | "EVP", "X509", "ASN1_TYPEDEFS", | ||
| 91 | # Helper "algorithms" | ||
| 92 | "BIO", "COMP", "BUFFER", "LHASH", "STACK", "ERR", | ||
| 93 | "LOCKING", | ||
| 94 | # External "algorithms" | ||
| 95 | "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", | ||
| 96 | # Engines | ||
| 97 | "STATIC_ENGINE", "ENGINE", "HW", "GMP", | ||
| 98 | # RFC3779 | ||
| 99 | "RFC3779", | ||
| 100 | # TLS | ||
| 101 | "TLSEXT", "PSK", | ||
| 102 | # CMS | ||
| 103 | "CMS", | ||
| 104 | # CryptoAPI Engine | ||
| 105 | "CAPIENG", | ||
| 106 | # SSL v2 | ||
| 107 | "SSL2", | ||
| 108 | # JPAKE | ||
| 109 | "JPAKE", | ||
| 110 | # Deprecated functions | ||
| 111 | "DEPRECATED" ); | ||
| 112 | |||
| 113 | my $options=""; | ||
| 114 | open(IN,"<Makefile") || die "unable to open Makefile!\n"; | ||
| 115 | while(<IN>) { | ||
| 116 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
| 117 | } | ||
| 118 | close(IN); | ||
| 119 | |||
| 120 | # The following ciphers may be excluded (by Configure). This means functions | ||
| 121 | # defined with ifndef(NO_XXX) are not included in the .def file, and everything | ||
| 122 | # in directory xxx is ignored. | ||
| 123 | my $no_rc2; my $no_rc4; my $no_rc5; my $no_idea; my $no_des; my $no_bf; | ||
| 124 | my $no_cast; my $no_whirlpool; my $no_camellia; my $no_seed; | ||
| 125 | my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; | ||
| 126 | my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; | ||
| 127 | my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; | ||
| 128 | my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; | ||
| 129 | my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; | ||
| 130 | my $no_jpake; my $no_ssl2; | ||
| 131 | |||
| 132 | my $zlib; | ||
| 133 | |||
| 134 | |||
| 135 | foreach (@ARGV, split(/ /, $options)) | ||
| 136 | { | ||
| 137 | $debug=1 if $_ eq "debug"; | ||
| 138 | $W32=1 if $_ eq "32"; | ||
| 139 | $W16=1 if $_ eq "16"; | ||
| 140 | if($_ eq "NT") { | ||
| 141 | $W32 = 1; | ||
| 142 | $NT = 1; | ||
| 143 | } | ||
| 144 | if ($_ eq "VMS-VAX") { | ||
| 145 | $VMS=1; | ||
| 146 | $VMSVAX=1; | ||
| 147 | } | ||
| 148 | if ($_ eq "VMS-NonVAX") { | ||
| 149 | $VMS=1; | ||
| 150 | $VMSNonVAX=1; | ||
| 151 | } | ||
| 152 | $VMS=1 if $_ eq "VMS"; | ||
| 153 | $OS2=1 if $_ eq "OS2"; | ||
| 154 | if ($_ eq "zlib" || $_ eq "enable-zlib" || $_ eq "zlib-dynamic" | ||
| 155 | || $_ eq "enable-zlib-dynamic") { | ||
| 156 | $zlib = 1; | ||
| 157 | } | ||
| 158 | |||
| 159 | $do_ssl=1 if $_ eq "ssleay"; | ||
| 160 | if ($_ eq "ssl") { | ||
| 161 | $do_ssl=1; | ||
| 162 | $libname=$_ | ||
| 163 | } | ||
| 164 | $do_crypto=1 if $_ eq "libeay"; | ||
| 165 | if ($_ eq "crypto") { | ||
| 166 | $do_crypto=1; | ||
| 167 | $libname=$_; | ||
| 168 | } | ||
| 169 | $no_static_engine=1 if $_ eq "no-static-engine"; | ||
| 170 | $no_static_engine=0 if $_ eq "enable-static-engine"; | ||
| 171 | $do_update=1 if $_ eq "update"; | ||
| 172 | $do_rewrite=1 if $_ eq "rewrite"; | ||
| 173 | $do_ctest=1 if $_ eq "ctest"; | ||
| 174 | $do_ctestall=1 if $_ eq "ctestall"; | ||
| 175 | $do_checkexist=1 if $_ eq "exist"; | ||
| 176 | #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; | ||
| 177 | |||
| 178 | if (/^no-rc2$/) { $no_rc2=1; } | ||
| 179 | elsif (/^no-rc4$/) { $no_rc4=1; } | ||
| 180 | elsif (/^no-rc5$/) { $no_rc5=1; } | ||
| 181 | elsif (/^no-idea$/) { $no_idea=1; } | ||
| 182 | elsif (/^no-des$/) { $no_des=1; $no_mdc2=1; } | ||
| 183 | elsif (/^no-bf$/) { $no_bf=1; } | ||
| 184 | elsif (/^no-cast$/) { $no_cast=1; } | ||
| 185 | elsif (/^no-whirlpool$/) { $no_whirlpool=1; } | ||
| 186 | elsif (/^no-md2$/) { $no_md2=1; } | ||
| 187 | elsif (/^no-md4$/) { $no_md4=1; } | ||
| 188 | elsif (/^no-md5$/) { $no_md5=1; } | ||
| 189 | elsif (/^no-sha$/) { $no_sha=1; } | ||
| 190 | elsif (/^no-ripemd$/) { $no_ripemd=1; } | ||
| 191 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | ||
| 192 | elsif (/^no-rsa$/) { $no_rsa=1; } | ||
| 193 | elsif (/^no-dsa$/) { $no_dsa=1; } | ||
| 194 | elsif (/^no-dh$/) { $no_dh=1; } | ||
| 195 | elsif (/^no-ec$/) { $no_ec=1; } | ||
| 196 | elsif (/^no-ecdsa$/) { $no_ecdsa=1; } | ||
| 197 | elsif (/^no-ecdh$/) { $no_ecdh=1; } | ||
| 198 | elsif (/^no-hmac$/) { $no_hmac=1; } | ||
| 199 | elsif (/^no-aes$/) { $no_aes=1; } | ||
| 200 | elsif (/^no-camellia$/) { $no_camellia=1; } | ||
| 201 | elsif (/^no-seed$/) { $no_seed=1; } | ||
| 202 | elsif (/^no-evp$/) { $no_evp=1; } | ||
| 203 | elsif (/^no-lhash$/) { $no_lhash=1; } | ||
| 204 | elsif (/^no-stack$/) { $no_stack=1; } | ||
| 205 | elsif (/^no-err$/) { $no_err=1; } | ||
| 206 | elsif (/^no-buffer$/) { $no_buffer=1; } | ||
| 207 | elsif (/^no-bio$/) { $no_bio=1; } | ||
| 208 | #elsif (/^no-locking$/) { $no_locking=1; } | ||
| 209 | elsif (/^no-comp$/) { $no_comp=1; } | ||
| 210 | elsif (/^no-dso$/) { $no_dso=1; } | ||
| 211 | elsif (/^no-krb5$/) { $no_krb5=1; } | ||
| 212 | elsif (/^no-engine$/) { $no_engine=1; } | ||
| 213 | elsif (/^no-hw$/) { $no_hw=1; } | ||
| 214 | elsif (/^no-gmp$/) { $no_gmp=1; } | ||
| 215 | elsif (/^no-rfc3779$/) { $no_rfc3779=1; } | ||
| 216 | elsif (/^no-tlsext$/) { $no_tlsext=1; } | ||
| 217 | elsif (/^no-cms$/) { $no_cms=1; } | ||
| 218 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | ||
| 219 | elsif (/^no-capieng$/) { $no_capieng=1; } | ||
| 220 | elsif (/^no-jpake$/) { $no_jpake=1; } | ||
| 221 | } | ||
| 222 | |||
| 223 | |||
| 224 | if (!$libname) { | ||
| 225 | if ($do_ssl) { | ||
| 226 | $libname="SSLEAY"; | ||
| 227 | } | ||
| 228 | if ($do_crypto) { | ||
| 229 | $libname="LIBEAY"; | ||
| 230 | } | ||
| 231 | } | ||
| 232 | |||
| 233 | # If no platform is given, assume WIN32 | ||
| 234 | if ($W32 + $W16 + $VMS + $OS2 == 0) { | ||
| 235 | $W32 = 1; | ||
| 236 | } | ||
| 237 | |||
| 238 | # Add extra knowledge | ||
| 239 | if ($W16) { | ||
| 240 | $no_fp_api=1; | ||
| 241 | } | ||
| 242 | |||
| 243 | if (!$do_ssl && !$do_crypto) | ||
| 244 | { | ||
| 245 | print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n"; | ||
| 246 | exit(1); | ||
| 247 | } | ||
| 248 | |||
| 249 | %ssl_list=&load_numbers($ssl_num); | ||
| 250 | $max_ssl = $max_num; | ||
| 251 | %crypto_list=&load_numbers($crypto_num); | ||
| 252 | $max_crypto = $max_num; | ||
| 253 | |||
| 254 | my $ssl="ssl/ssl.h"; | ||
| 255 | $ssl.=" ssl/kssl.h"; | ||
| 256 | $ssl.=" ssl/tls1.h"; | ||
| 257 | |||
| 258 | my $crypto ="crypto/crypto.h"; | ||
| 259 | $crypto.=" crypto/o_dir.h"; | ||
| 260 | $crypto.=" crypto/des/des.h crypto/des/des_old.h" ; # unless $no_des; | ||
| 261 | $crypto.=" crypto/idea/idea.h" ; # unless $no_idea; | ||
| 262 | $crypto.=" crypto/rc4/rc4.h" ; # unless $no_rc4; | ||
| 263 | $crypto.=" crypto/rc5/rc5.h" ; # unless $no_rc5; | ||
| 264 | $crypto.=" crypto/rc2/rc2.h" ; # unless $no_rc2; | ||
| 265 | $crypto.=" crypto/bf/blowfish.h" ; # unless $no_bf; | ||
| 266 | $crypto.=" crypto/cast/cast.h" ; # unless $no_cast; | ||
| 267 | $crypto.=" crypto/whrlpool/whrlpool.h" ; | ||
| 268 | $crypto.=" crypto/md2/md2.h" ; # unless $no_md2; | ||
| 269 | $crypto.=" crypto/md4/md4.h" ; # unless $no_md4; | ||
| 270 | $crypto.=" crypto/md5/md5.h" ; # unless $no_md5; | ||
| 271 | $crypto.=" crypto/mdc2/mdc2.h" ; # unless $no_mdc2; | ||
| 272 | $crypto.=" crypto/sha/sha.h" ; # unless $no_sha; | ||
| 273 | $crypto.=" crypto/ripemd/ripemd.h" ; # unless $no_ripemd; | ||
| 274 | $crypto.=" crypto/aes/aes.h" ; # unless $no_aes; | ||
| 275 | $crypto.=" crypto/camellia/camellia.h" ; # unless $no_camellia; | ||
| 276 | $crypto.=" crypto/seed/seed.h"; # unless $no_seed; | ||
| 277 | |||
| 278 | $crypto.=" crypto/bn/bn.h"; | ||
| 279 | $crypto.=" crypto/rsa/rsa.h" ; # unless $no_rsa; | ||
| 280 | $crypto.=" crypto/dsa/dsa.h" ; # unless $no_dsa; | ||
| 281 | $crypto.=" crypto/dh/dh.h" ; # unless $no_dh; | ||
| 282 | $crypto.=" crypto/ec/ec.h" ; # unless $no_ec; | ||
| 283 | $crypto.=" crypto/ecdsa/ecdsa.h" ; # unless $no_ecdsa; | ||
| 284 | $crypto.=" crypto/ecdh/ecdh.h" ; # unless $no_ecdh; | ||
| 285 | $crypto.=" crypto/hmac/hmac.h" ; # unless $no_hmac; | ||
| 286 | |||
| 287 | $crypto.=" crypto/engine/engine.h"; # unless $no_engine; | ||
| 288 | $crypto.=" crypto/stack/stack.h" ; # unless $no_stack; | ||
| 289 | $crypto.=" crypto/buffer/buffer.h" ; # unless $no_buffer; | ||
| 290 | $crypto.=" crypto/bio/bio.h" ; # unless $no_bio; | ||
| 291 | $crypto.=" crypto/dso/dso.h" ; # unless $no_dso; | ||
| 292 | $crypto.=" crypto/lhash/lhash.h" ; # unless $no_lhash; | ||
| 293 | $crypto.=" crypto/conf/conf.h"; | ||
| 294 | $crypto.=" crypto/txt_db/txt_db.h"; | ||
| 295 | |||
| 296 | $crypto.=" crypto/evp/evp.h" ; # unless $no_evp; | ||
| 297 | $crypto.=" crypto/objects/objects.h"; | ||
| 298 | $crypto.=" crypto/pem/pem.h"; | ||
| 299 | #$crypto.=" crypto/meth/meth.h"; | ||
| 300 | $crypto.=" crypto/asn1/asn1.h"; | ||
| 301 | $crypto.=" crypto/asn1/asn1t.h"; | ||
| 302 | $crypto.=" crypto/asn1/asn1_mac.h"; | ||
| 303 | $crypto.=" crypto/err/err.h" ; # unless $no_err; | ||
| 304 | $crypto.=" crypto/pkcs7/pkcs7.h"; | ||
| 305 | $crypto.=" crypto/pkcs12/pkcs12.h"; | ||
| 306 | $crypto.=" crypto/x509/x509.h"; | ||
| 307 | $crypto.=" crypto/x509/x509_vfy.h"; | ||
| 308 | $crypto.=" crypto/x509v3/x509v3.h"; | ||
| 309 | $crypto.=" crypto/ts/ts.h"; | ||
| 310 | $crypto.=" crypto/rand/rand.h"; | ||
| 311 | $crypto.=" crypto/comp/comp.h" ; # unless $no_comp; | ||
| 312 | $crypto.=" crypto/ocsp/ocsp.h"; | ||
| 313 | $crypto.=" crypto/ui/ui.h crypto/ui/ui_compat.h"; | ||
| 314 | $crypto.=" crypto/krb5/krb5_asn.h"; | ||
| 315 | #$crypto.=" crypto/store/store.h"; | ||
| 316 | $crypto.=" crypto/pqueue/pqueue.h"; | ||
| 317 | $crypto.=" crypto/cms/cms.h"; | ||
| 318 | $crypto.=" crypto/jpake/jpake.h"; | ||
| 319 | |||
| 320 | my $symhacks="crypto/symhacks.h"; | ||
| 321 | |||
| 322 | my @ssl_symbols = &do_defs("SSLEAY", $ssl, $symhacks); | ||
| 323 | my @crypto_symbols = &do_defs("LIBEAY", $crypto, $symhacks); | ||
| 324 | |||
| 325 | if ($do_update) { | ||
| 326 | |||
| 327 | if ($do_ssl == 1) { | ||
| 328 | |||
| 329 | &maybe_add_info("SSLEAY",*ssl_list,@ssl_symbols); | ||
| 330 | if ($do_rewrite == 1) { | ||
| 331 | open(OUT, ">$ssl_num"); | ||
| 332 | &rewrite_numbers(*OUT,"SSLEAY",*ssl_list,@ssl_symbols); | ||
| 333 | } else { | ||
| 334 | open(OUT, ">>$ssl_num"); | ||
| 335 | } | ||
| 336 | &update_numbers(*OUT,"SSLEAY",*ssl_list,$max_ssl,@ssl_symbols); | ||
| 337 | close OUT; | ||
| 338 | } | ||
| 339 | |||
| 340 | if($do_crypto == 1) { | ||
| 341 | |||
| 342 | &maybe_add_info("LIBEAY",*crypto_list,@crypto_symbols); | ||
| 343 | if ($do_rewrite == 1) { | ||
| 344 | open(OUT, ">$crypto_num"); | ||
| 345 | &rewrite_numbers(*OUT,"LIBEAY",*crypto_list,@crypto_symbols); | ||
| 346 | } else { | ||
| 347 | open(OUT, ">>$crypto_num"); | ||
| 348 | } | ||
| 349 | &update_numbers(*OUT,"LIBEAY",*crypto_list,$max_crypto,@crypto_symbols); | ||
| 350 | close OUT; | ||
| 351 | } | ||
| 352 | |||
| 353 | } elsif ($do_checkexist) { | ||
| 354 | &check_existing(*ssl_list, @ssl_symbols) | ||
| 355 | if $do_ssl == 1; | ||
| 356 | &check_existing(*crypto_list, @crypto_symbols) | ||
| 357 | if $do_crypto == 1; | ||
| 358 | } elsif ($do_ctest || $do_ctestall) { | ||
| 359 | |||
| 360 | print <<"EOF"; | ||
| 361 | |||
| 362 | /* Test file to check all DEF file symbols are present by trying | ||
| 363 | * to link to all of them. This is *not* intended to be run! | ||
| 364 | */ | ||
| 365 | |||
| 366 | int main() | ||
| 367 | { | ||
| 368 | EOF | ||
| 369 | &print_test_file(*STDOUT,"SSLEAY",*ssl_list,$do_ctestall,@ssl_symbols) | ||
| 370 | if $do_ssl == 1; | ||
| 371 | |||
| 372 | &print_test_file(*STDOUT,"LIBEAY",*crypto_list,$do_ctestall,@crypto_symbols) | ||
| 373 | if $do_crypto == 1; | ||
| 374 | |||
| 375 | print "}\n"; | ||
| 376 | |||
| 377 | } else { | ||
| 378 | |||
| 379 | &print_def_file(*STDOUT,$libname,*ssl_list,@ssl_symbols) | ||
| 380 | if $do_ssl == 1; | ||
| 381 | |||
| 382 | &print_def_file(*STDOUT,$libname,*crypto_list,@crypto_symbols) | ||
| 383 | if $do_crypto == 1; | ||
| 384 | |||
| 385 | } | ||
| 386 | |||
| 387 | |||
| 388 | sub do_defs | ||
| 389 | { | ||
| 390 | my($name,$files,$symhacksfile)=@_; | ||
| 391 | my $file; | ||
| 392 | my @ret; | ||
| 393 | my %syms; | ||
| 394 | my %platform; # For anything undefined, we assume "" | ||
| 395 | my %kind; # For anything undefined, we assume "FUNCTION" | ||
| 396 | my %algorithm; # For anything undefined, we assume "" | ||
| 397 | my %variant; | ||
| 398 | my %variant_cnt; # To be able to allocate "name{n}" if "name" | ||
| 399 | # is the same name as the original. | ||
| 400 | my $cpp; | ||
| 401 | my %unknown_algorithms = (); | ||
| 402 | |||
| 403 | foreach $file (split(/\s+/,$symhacksfile." ".$files)) | ||
| 404 | { | ||
| 405 | print STDERR "DEBUG: starting on $file:\n" if $debug; | ||
| 406 | open(IN,"<$file") || die "unable to open $file:$!\n"; | ||
| 407 | my $line = "", my $def= ""; | ||
| 408 | my %tag = ( | ||
| 409 | (map { $_ => 0 } @known_platforms), | ||
| 410 | (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), | ||
| 411 | (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), | ||
| 412 | NOPROTO => 0, | ||
| 413 | PERL5 => 0, | ||
| 414 | _WINDLL => 0, | ||
| 415 | CONST_STRICT => 0, | ||
| 416 | TRUE => 1, | ||
| 417 | ); | ||
| 418 | my $symhacking = $file eq $symhacksfile; | ||
| 419 | my @current_platforms = (); | ||
| 420 | my @current_algorithms = (); | ||
| 421 | |||
| 422 | # params: symbol, alias, platforms, kind | ||
| 423 | # The reason to put this subroutine in a variable is that | ||
| 424 | # it will otherwise create it's own, unshared, version of | ||
| 425 | # %tag and %variant... | ||
| 426 | my $make_variant = sub | ||
| 427 | { | ||
| 428 | my ($s, $a, $p, $k) = @_; | ||
| 429 | my ($a1, $a2); | ||
| 430 | |||
| 431 | print STDERR "DEBUG: make_variant: Entered with ",$s,", ",$a,", ",(defined($p)?$p:""),", ",(defined($k)?$k:""),"\n" if $debug; | ||
| 432 | if (defined($p)) | ||
| 433 | { | ||
| 434 | $a1 = join(",",$p, | ||
| 435 | grep(!/^$/, | ||
| 436 | map { $tag{$_} == 1 ? $_ : "" } | ||
| 437 | @known_platforms)); | ||
| 438 | } | ||
| 439 | else | ||
| 440 | { | ||
| 441 | $a1 = join(",", | ||
| 442 | grep(!/^$/, | ||
| 443 | map { $tag{$_} == 1 ? $_ : "" } | ||
| 444 | @known_platforms)); | ||
| 445 | } | ||
| 446 | $a2 = join(",", | ||
| 447 | grep(!/^$/, | ||
| 448 | map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : "" } | ||
| 449 | @known_ossl_platforms)); | ||
| 450 | print STDERR "DEBUG: make_variant: a1 = $a1; a2 = $a2\n" if $debug; | ||
| 451 | if ($a1 eq "") { $a1 = $a2; } | ||
| 452 | elsif ($a1 ne "" && $a2 ne "") { $a1 .= ",".$a2; } | ||
| 453 | if ($a eq $s) | ||
| 454 | { | ||
| 455 | if (!defined($variant_cnt{$s})) | ||
| 456 | { | ||
| 457 | $variant_cnt{$s} = 0; | ||
| 458 | } | ||
| 459 | $variant_cnt{$s}++; | ||
| 460 | $a .= "{$variant_cnt{$s}}"; | ||
| 461 | } | ||
| 462 | my $toadd = $a.":".$a1.(defined($k)?":".$k:""); | ||
| 463 | my $togrep = $s.'(\{[0-9]+\})?:'.$a1.(defined($k)?":".$k:""); | ||
| 464 | if (!grep(/^$togrep$/, | ||
| 465 | split(/;/, defined($variant{$s})?$variant{$s}:""))) { | ||
| 466 | if (defined($variant{$s})) { $variant{$s} .= ";"; } | ||
| 467 | $variant{$s} .= $toadd; | ||
| 468 | } | ||
| 469 | print STDERR "DEBUG: make_variant: Exit with variant of ",$s," = ",$variant{$s},"\n" if $debug; | ||
| 470 | }; | ||
| 471 | |||
| 472 | print STDERR "DEBUG: parsing ----------\n" if $debug; | ||
| 473 | while(<IN>) { | ||
| 474 | if (/\/\* Error codes for the \w+ functions\. \*\//) | ||
| 475 | { | ||
| 476 | undef @tag; | ||
| 477 | last; | ||
| 478 | } | ||
| 479 | if ($line ne '') { | ||
| 480 | $_ = $line . $_; | ||
| 481 | $line = ''; | ||
| 482 | } | ||
| 483 | |||
| 484 | if (/\\$/) { | ||
| 485 | chomp; # remove eol | ||
| 486 | chop; # remove ending backslash | ||
| 487 | $line = $_; | ||
| 488 | next; | ||
| 489 | } | ||
| 490 | |||
| 491 | if(/\/\*/) { | ||
| 492 | if (not /\*\//) { # multiline comment... | ||
| 493 | $line = $_; # ... just accumulate | ||
| 494 | next; | ||
| 495 | } else { | ||
| 496 | s/\/\*.*?\*\///gs;# wipe it | ||
| 497 | } | ||
| 498 | } | ||
| 499 | |||
| 500 | if ($cpp) { | ||
| 501 | $cpp++ if /^#\s*if/; | ||
| 502 | $cpp-- if /^#\s*endif/; | ||
| 503 | next; | ||
| 504 | } | ||
| 505 | $cpp = 1 if /^#.*ifdef.*cplusplus/; | ||
| 506 | |||
| 507 | s/{[^{}]*}//gs; # ignore {} blocks | ||
| 508 | print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; | ||
| 509 | print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; | ||
| 510 | if (/^\#\s*ifndef\s+(.*)/) { | ||
| 511 | push(@tag,"-"); | ||
| 512 | push(@tag,$1); | ||
| 513 | $tag{$1}=-1; | ||
| 514 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
| 515 | } elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) { | ||
| 516 | push(@tag,"-"); | ||
| 517 | if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) { | ||
| 518 | my $tmp_1 = $1; | ||
| 519 | my $tmp_; | ||
| 520 | foreach $tmp_ (split '\&\&',$tmp_1) { | ||
| 521 | $tmp_ =~ /!defined\(([^\)]+)\)/; | ||
| 522 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
| 523 | push(@tag,$1); | ||
| 524 | $tag{$1}=-1; | ||
| 525 | } | ||
| 526 | } else { | ||
| 527 | print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O... | ||
| 528 | print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug; | ||
| 529 | push(@tag,$1); | ||
| 530 | $tag{$1}=-1; | ||
| 531 | } | ||
| 532 | } elsif (/^\#\s*ifdef\s+(\S*)/) { | ||
| 533 | push(@tag,"-"); | ||
| 534 | push(@tag,$1); | ||
| 535 | $tag{$1}=1; | ||
| 536 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
| 537 | } elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) { | ||
| 538 | push(@tag,"-"); | ||
| 539 | if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) { | ||
| 540 | my $tmp_1 = $1; | ||
| 541 | my $tmp_; | ||
| 542 | foreach $tmp_ (split '\|\|',$tmp_1) { | ||
| 543 | $tmp_ =~ /defined\(([^\)]+)\)/; | ||
| 544 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
| 545 | push(@tag,$1); | ||
| 546 | $tag{$1}=1; | ||
| 547 | } | ||
| 548 | } else { | ||
| 549 | print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O... | ||
| 550 | print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug; | ||
| 551 | push(@tag,$1); | ||
| 552 | $tag{$1}=1; | ||
| 553 | } | ||
| 554 | } elsif (/^\#\s*error\s+(\w+) is disabled\./) { | ||
| 555 | my $tag_i = $#tag; | ||
| 556 | while($tag[$tag_i] ne "-") { | ||
| 557 | if ($tag[$tag_i] eq "OPENSSL_NO_".$1) { | ||
| 558 | $tag{$tag[$tag_i]}=2; | ||
| 559 | print STDERR "DEBUG: $file: chaged tag $1 = 2\n" if $debug; | ||
| 560 | } | ||
| 561 | $tag_i--; | ||
| 562 | } | ||
| 563 | } elsif (/^\#\s*endif/) { | ||
| 564 | my $tag_i = $#tag; | ||
| 565 | while($tag_i > 0 && $tag[$tag_i] ne "-") { | ||
| 566 | my $t=$tag[$tag_i]; | ||
| 567 | print STDERR "DEBUG: \$t=\"$t\"\n" if $debug; | ||
| 568 | if ($tag{$t}==2) { | ||
| 569 | $tag{$t}=-1; | ||
| 570 | } else { | ||
| 571 | $tag{$t}=0; | ||
| 572 | } | ||
| 573 | print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; | ||
| 574 | pop(@tag); | ||
| 575 | if ($t =~ /^OPENSSL_NO_([A-Z0-9_]+)$/) { | ||
| 576 | $t=$1; | ||
| 577 | } else { | ||
| 578 | $t=""; | ||
| 579 | } | ||
| 580 | if ($t ne "" | ||
| 581 | && !grep(/^$t$/, @known_algorithms)) { | ||
| 582 | $unknown_algorithms{$t} = 1; | ||
| 583 | #print STDERR "DEBUG: Added as unknown algorithm: $t\n" if $debug; | ||
| 584 | } | ||
| 585 | $tag_i--; | ||
| 586 | } | ||
| 587 | pop(@tag); | ||
| 588 | } elsif (/^\#\s*else/) { | ||
| 589 | my $tag_i = $#tag; | ||
| 590 | while($tag[$tag_i] ne "-") { | ||
| 591 | my $t=$tag[$tag_i]; | ||
| 592 | $tag{$t}= -$tag{$t}; | ||
| 593 | print STDERR "DEBUG: $file: changed tag ",$t," = ",$tag{$t},"\n" if $debug; | ||
| 594 | $tag_i--; | ||
| 595 | } | ||
| 596 | } elsif (/^\#\s*if\s+1/) { | ||
| 597 | push(@tag,"-"); | ||
| 598 | # Dummy tag | ||
| 599 | push(@tag,"TRUE"); | ||
| 600 | $tag{"TRUE"}=1; | ||
| 601 | print STDERR "DEBUG: $file: found 1\n" if $debug; | ||
| 602 | } elsif (/^\#\s*if\s+0/) { | ||
| 603 | push(@tag,"-"); | ||
| 604 | # Dummy tag | ||
| 605 | push(@tag,"TRUE"); | ||
| 606 | $tag{"TRUE"}=-1; | ||
| 607 | print STDERR "DEBUG: $file: found 0\n" if $debug; | ||
| 608 | } elsif (/^\#\s*define\s+(\w+)\s+(\w+)/ | ||
| 609 | && $symhacking && $tag{'TRUE'} != -1) { | ||
| 610 | # This is for aliasing. When we find an alias, | ||
| 611 | # we have to invert | ||
| 612 | &$make_variant($1,$2); | ||
| 613 | print STDERR "DEBUG: $file: defined $1 = $2\n" if $debug; | ||
| 614 | } | ||
| 615 | if (/^\#/) { | ||
| 616 | @current_platforms = | ||
| 617 | grep(!/^$/, | ||
| 618 | map { $tag{$_} == 1 ? $_ : | ||
| 619 | $tag{$_} == -1 ? "!".$_ : "" } | ||
| 620 | @known_platforms); | ||
| 621 | push @current_platforms | ||
| 622 | , grep(!/^$/, | ||
| 623 | map { $tag{"OPENSSL_SYS_".$_} == 1 ? $_ : | ||
| 624 | $tag{"OPENSSL_SYS_".$_} == -1 ? "!".$_ : "" } | ||
| 625 | @known_ossl_platforms); | ||
| 626 | @current_algorithms = | ||
| 627 | grep(!/^$/, | ||
| 628 | map { $tag{"OPENSSL_NO_".$_} == -1 ? $_ : "" } | ||
| 629 | @known_algorithms); | ||
| 630 | $def .= | ||
| 631 | "#INFO:" | ||
| 632 | .join(',',@current_platforms).":" | ||
| 633 | .join(',',@current_algorithms).";"; | ||
| 634 | next; | ||
| 635 | } | ||
| 636 | if ($tag{'TRUE'} != -1) { | ||
| 637 | if (/^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
| 638 | next; | ||
| 639 | } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
| 640 | $def .= "int d2i_$3(void);"; | ||
| 641 | $def .= "int i2d_$3(void);"; | ||
| 642 | # Variant for platforms that do not | ||
| 643 | # have to access globale variables | ||
| 644 | # in shared libraries through functions | ||
| 645 | $def .= | ||
| 646 | "#INFO:" | ||
| 647 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 648 | .join(',',@current_algorithms).";"; | ||
| 649 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
| 650 | $def .= | ||
| 651 | "#INFO:" | ||
| 652 | .join(',',@current_platforms).":" | ||
| 653 | .join(',',@current_algorithms).";"; | ||
| 654 | # Variant for platforms that have to | ||
| 655 | # access globale variables in shared | ||
| 656 | # libraries through functions | ||
| 657 | &$make_variant("$2_it","$2_it", | ||
| 658 | "EXPORT_VAR_AS_FUNCTION", | ||
| 659 | "FUNCTION"); | ||
| 660 | next; | ||
| 661 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_fname\s*\(\s*(\w*)\s*,\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
| 662 | $def .= "int d2i_$3(void);"; | ||
| 663 | $def .= "int i2d_$3(void);"; | ||
| 664 | $def .= "int $3_free(void);"; | ||
| 665 | $def .= "int $3_new(void);"; | ||
| 666 | # Variant for platforms that do not | ||
| 667 | # have to access globale variables | ||
| 668 | # in shared libraries through functions | ||
| 669 | $def .= | ||
| 670 | "#INFO:" | ||
| 671 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 672 | .join(',',@current_algorithms).";"; | ||
| 673 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
| 674 | $def .= | ||
| 675 | "#INFO:" | ||
| 676 | .join(',',@current_platforms).":" | ||
| 677 | .join(',',@current_algorithms).";"; | ||
| 678 | # Variant for platforms that have to | ||
| 679 | # access globale variables in shared | ||
| 680 | # libraries through functions | ||
| 681 | &$make_variant("$2_it","$2_it", | ||
| 682 | "EXPORT_VAR_AS_FUNCTION", | ||
| 683 | "FUNCTION"); | ||
| 684 | next; | ||
| 685 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS\s*\(\s*(\w*)\s*\)/ || | ||
| 686 | /^\s*DECLARE_ASN1_FUNCTIONS_const\s*\(\s*(\w*)\s*\)/) { | ||
| 687 | $def .= "int d2i_$1(void);"; | ||
| 688 | $def .= "int i2d_$1(void);"; | ||
| 689 | $def .= "int $1_free(void);"; | ||
| 690 | $def .= "int $1_new(void);"; | ||
| 691 | # Variant for platforms that do not | ||
| 692 | # have to access globale variables | ||
| 693 | # in shared libraries through functions | ||
| 694 | $def .= | ||
| 695 | "#INFO:" | ||
| 696 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 697 | .join(',',@current_algorithms).";"; | ||
| 698 | $def .= "OPENSSL_EXTERN int $1_it;"; | ||
| 699 | $def .= | ||
| 700 | "#INFO:" | ||
| 701 | .join(',',@current_platforms).":" | ||
| 702 | .join(',',@current_algorithms).";"; | ||
| 703 | # Variant for platforms that have to | ||
| 704 | # access globale variables in shared | ||
| 705 | # libraries through functions | ||
| 706 | &$make_variant("$1_it","$1_it", | ||
| 707 | "EXPORT_VAR_AS_FUNCTION", | ||
| 708 | "FUNCTION"); | ||
| 709 | next; | ||
| 710 | } elsif (/^\s*DECLARE_ASN1_ENCODE_FUNCTIONS_const\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
| 711 | $def .= "int d2i_$2(void);"; | ||
| 712 | $def .= "int i2d_$2(void);"; | ||
| 713 | # Variant for platforms that do not | ||
| 714 | # have to access globale variables | ||
| 715 | # in shared libraries through functions | ||
| 716 | $def .= | ||
| 717 | "#INFO:" | ||
| 718 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 719 | .join(',',@current_algorithms).";"; | ||
| 720 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
| 721 | $def .= | ||
| 722 | "#INFO:" | ||
| 723 | .join(',',@current_platforms).":" | ||
| 724 | .join(',',@current_algorithms).";"; | ||
| 725 | # Variant for platforms that have to | ||
| 726 | # access globale variables in shared | ||
| 727 | # libraries through functions | ||
| 728 | &$make_variant("$2_it","$2_it", | ||
| 729 | "EXPORT_VAR_AS_FUNCTION", | ||
| 730 | "FUNCTION"); | ||
| 731 | next; | ||
| 732 | } elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) { | ||
| 733 | $def .= "int $1_free(void);"; | ||
| 734 | $def .= "int $1_new(void);"; | ||
| 735 | next; | ||
| 736 | } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
| 737 | $def .= "int d2i_$2(void);"; | ||
| 738 | $def .= "int i2d_$2(void);"; | ||
| 739 | $def .= "int $2_free(void);"; | ||
| 740 | $def .= "int $2_new(void);"; | ||
| 741 | # Variant for platforms that do not | ||
| 742 | # have to access globale variables | ||
| 743 | # in shared libraries through functions | ||
| 744 | $def .= | ||
| 745 | "#INFO:" | ||
| 746 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 747 | .join(',',@current_algorithms).";"; | ||
| 748 | $def .= "OPENSSL_EXTERN int $2_it;"; | ||
| 749 | $def .= | ||
| 750 | "#INFO:" | ||
| 751 | .join(',',@current_platforms).":" | ||
| 752 | .join(',',@current_algorithms).";"; | ||
| 753 | # Variant for platforms that have to | ||
| 754 | # access globale variables in shared | ||
| 755 | # libraries through functions | ||
| 756 | &$make_variant("$2_it","$2_it", | ||
| 757 | "EXPORT_VAR_AS_FUNCTION", | ||
| 758 | "FUNCTION"); | ||
| 759 | next; | ||
| 760 | } elsif (/^\s*DECLARE_ASN1_ITEM\s*\(\s*(\w*)\s*\)/) { | ||
| 761 | # Variant for platforms that do not | ||
| 762 | # have to access globale variables | ||
| 763 | # in shared libraries through functions | ||
| 764 | $def .= | ||
| 765 | "#INFO:" | ||
| 766 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 767 | .join(',',@current_algorithms).";"; | ||
| 768 | $def .= "OPENSSL_EXTERN int $1_it;"; | ||
| 769 | $def .= | ||
| 770 | "#INFO:" | ||
| 771 | .join(',',@current_platforms).":" | ||
| 772 | .join(',',@current_algorithms).";"; | ||
| 773 | # Variant for platforms that have to | ||
| 774 | # access globale variables in shared | ||
| 775 | # libraries through functions | ||
| 776 | &$make_variant("$1_it","$1_it", | ||
| 777 | "EXPORT_VAR_AS_FUNCTION", | ||
| 778 | "FUNCTION"); | ||
| 779 | next; | ||
| 780 | } elsif (/^\s*DECLARE_ASN1_NDEF_FUNCTION\s*\(\s*(\w*)\s*\)/) { | ||
| 781 | $def .= "int i2d_$1_NDEF(void);"; | ||
| 782 | } elsif (/^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { | ||
| 783 | next; | ||
| 784 | } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION\s*\(\s*(\w*)\s*\)/) { | ||
| 785 | $def .= "int $1_print_ctx(void);"; | ||
| 786 | next; | ||
| 787 | } elsif (/^\s*DECLARE_ASN1_PRINT_FUNCTION_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
| 788 | $def .= "int $2_print_ctx(void);"; | ||
| 789 | next; | ||
| 790 | } elsif (/^\s*DECLARE_PKCS12_STACK_OF\s*\(\s*(\w*)\s*\)/) { | ||
| 791 | next; | ||
| 792 | } elsif (/^DECLARE_PEM_rw\s*\(\s*(\w*)\s*,/ || | ||
| 793 | /^DECLARE_PEM_rw_cb\s*\(\s*(\w*)\s*,/ || | ||
| 794 | /^DECLARE_PEM_rw_const\s*\(\s*(\w*)\s*,/ ) { | ||
| 795 | # Things not in Win16 | ||
| 796 | $def .= | ||
| 797 | "#INFO:" | ||
| 798 | .join(',',"!WIN16",@current_platforms).":" | ||
| 799 | .join(',',@current_algorithms).";"; | ||
| 800 | $def .= "int PEM_read_$1(void);"; | ||
| 801 | $def .= "int PEM_write_$1(void);"; | ||
| 802 | $def .= | ||
| 803 | "#INFO:" | ||
| 804 | .join(',',@current_platforms).":" | ||
| 805 | .join(',',@current_algorithms).";"; | ||
| 806 | # Things that are everywhere | ||
| 807 | $def .= "int PEM_read_bio_$1(void);"; | ||
| 808 | $def .= "int PEM_write_bio_$1(void);"; | ||
| 809 | next; | ||
| 810 | } elsif (/^DECLARE_PEM_write\s*\(\s*(\w*)\s*,/ || | ||
| 811 | /^DECLARE_PEM_write_cb\s*\(\s*(\w*)\s*,/ ) { | ||
| 812 | # Things not in Win16 | ||
| 813 | $def .= | ||
| 814 | "#INFO:" | ||
| 815 | .join(',',"!WIN16",@current_platforms).":" | ||
| 816 | .join(',',@current_algorithms).";"; | ||
| 817 | $def .= "int PEM_write_$1(void);"; | ||
| 818 | $def .= | ||
| 819 | "#INFO:" | ||
| 820 | .join(',',@current_platforms).":" | ||
| 821 | .join(',',@current_algorithms).";"; | ||
| 822 | # Things that are everywhere | ||
| 823 | $def .= "int PEM_write_bio_$1(void);"; | ||
| 824 | next; | ||
| 825 | } elsif (/^DECLARE_PEM_read\s*\(\s*(\w*)\s*,/ || | ||
| 826 | /^DECLARE_PEM_read_cb\s*\(\s*(\w*)\s*,/ ) { | ||
| 827 | # Things not in Win16 | ||
| 828 | $def .= | ||
| 829 | "#INFO:" | ||
| 830 | .join(',',"!WIN16",@current_platforms).":" | ||
| 831 | .join(',',@current_algorithms).";"; | ||
| 832 | $def .= "int PEM_read_$1(void);"; | ||
| 833 | $def .= | ||
| 834 | "#INFO:" | ||
| 835 | .join(',',@current_platforms).":" | ||
| 836 | .join(',',@current_algorithms).";"; | ||
| 837 | # Things that are everywhere | ||
| 838 | $def .= "int PEM_read_bio_$1(void);"; | ||
| 839 | next; | ||
| 840 | } elsif (/^OPENSSL_DECLARE_GLOBAL\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { | ||
| 841 | # Variant for platforms that do not | ||
| 842 | # have to access globale variables | ||
| 843 | # in shared libraries through functions | ||
| 844 | $def .= | ||
| 845 | "#INFO:" | ||
| 846 | .join(',',"!EXPORT_VAR_AS_FUNCTION",@current_platforms).":" | ||
| 847 | .join(',',@current_algorithms).";"; | ||
| 848 | $def .= "OPENSSL_EXTERN int _shadow_$2;"; | ||
| 849 | $def .= | ||
| 850 | "#INFO:" | ||
| 851 | .join(',',@current_platforms).":" | ||
| 852 | .join(',',@current_algorithms).";"; | ||
| 853 | # Variant for platforms that have to | ||
| 854 | # access globale variables in shared | ||
| 855 | # libraries through functions | ||
| 856 | &$make_variant("_shadow_$2","_shadow_$2", | ||
| 857 | "EXPORT_VAR_AS_FUNCTION", | ||
| 858 | "FUNCTION"); | ||
| 859 | } elsif ($tag{'CONST_STRICT'} != 1) { | ||
| 860 | if (/\{|\/\*|\([^\)]*$/) { | ||
| 861 | $line = $_; | ||
| 862 | } else { | ||
| 863 | $def .= $_; | ||
| 864 | } | ||
| 865 | } | ||
| 866 | } | ||
| 867 | } | ||
| 868 | close(IN); | ||
| 869 | |||
| 870 | my $algs; | ||
| 871 | my $plays; | ||
| 872 | |||
| 873 | print STDERR "DEBUG: postprocessing ----------\n" if $debug; | ||
| 874 | foreach (split /;/, $def) { | ||
| 875 | my $s; my $k = "FUNCTION"; my $p; my $a; | ||
| 876 | s/^[\n\s]*//g; | ||
| 877 | s/[\n\s]*$//g; | ||
| 878 | next if(/\#undef/); | ||
| 879 | next if(/typedef\W/); | ||
| 880 | next if(/\#define/); | ||
| 881 | |||
| 882 | # Reduce argument lists to empty () | ||
| 883 | # fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {} | ||
| 884 | while(/\(.*\)/s) { | ||
| 885 | s/\([^\(\)]+\)/\{\}/gs; | ||
| 886 | s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f | ||
| 887 | } | ||
| 888 | # pretend as we didn't use curly braces: {} -> () | ||
| 889 | s/\{\}/\(\)/gs; | ||
| 890 | |||
| 891 | s/STACK_OF\(\)/void/gs; | ||
| 892 | s/LHASH_OF\(\)/void/gs; | ||
| 893 | |||
| 894 | print STDERR "DEBUG: \$_ = \"$_\"\n" if $debug; | ||
| 895 | if (/^\#INFO:([^:]*):(.*)$/) { | ||
| 896 | $plats = $1; | ||
| 897 | $algs = $2; | ||
| 898 | print STDERR "DEBUG: found info on platforms ($plats) and algorithms ($algs)\n" if $debug; | ||
| 899 | next; | ||
| 900 | } elsif (/^\s*OPENSSL_EXTERN\s.*?(\w+(\{[0-9]+\})?)(\[[0-9]*\])*\s*$/) { | ||
| 901 | $s = $1; | ||
| 902 | $k = "VARIABLE"; | ||
| 903 | print STDERR "DEBUG: found external variable $s\n" if $debug; | ||
| 904 | } elsif (/TYPEDEF_\w+_OF/s) { | ||
| 905 | next; | ||
| 906 | } elsif (/(\w+)\s*\(\).*/s) { # first token prior [first] () is | ||
| 907 | $s = $1; # a function name! | ||
| 908 | print STDERR "DEBUG: found function $s\n" if $debug; | ||
| 909 | } elsif (/\(/ and not (/=/)) { | ||
| 910 | print STDERR "File $file: cannot parse: $_;\n"; | ||
| 911 | next; | ||
| 912 | } else { | ||
| 913 | next; | ||
| 914 | } | ||
| 915 | |||
| 916 | $syms{$s} = 1; | ||
| 917 | $kind{$s} = $k; | ||
| 918 | |||
| 919 | $p = $plats; | ||
| 920 | $a = $algs; | ||
| 921 | $a .= ",BF" if($s =~ /EVP_bf/); | ||
| 922 | $a .= ",CAST" if($s =~ /EVP_cast/); | ||
| 923 | $a .= ",DES" if($s =~ /EVP_des/); | ||
| 924 | $a .= ",DSA" if($s =~ /EVP_dss/); | ||
| 925 | $a .= ",IDEA" if($s =~ /EVP_idea/); | ||
| 926 | $a .= ",MD2" if($s =~ /EVP_md2/); | ||
| 927 | $a .= ",MD4" if($s =~ /EVP_md4/); | ||
| 928 | $a .= ",MD5" if($s =~ /EVP_md5/); | ||
| 929 | $a .= ",RC2" if($s =~ /EVP_rc2/); | ||
| 930 | $a .= ",RC4" if($s =~ /EVP_rc4/); | ||
| 931 | $a .= ",RC5" if($s =~ /EVP_rc5/); | ||
| 932 | $a .= ",RIPEMD" if($s =~ /EVP_ripemd/); | ||
| 933 | $a .= ",SHA" if($s =~ /EVP_sha/); | ||
| 934 | $a .= ",RSA" if($s =~ /EVP_(Open|Seal)(Final|Init)/); | ||
| 935 | $a .= ",RSA" if($s =~ /PEM_Seal(Final|Init|Update)/); | ||
| 936 | $a .= ",RSA" if($s =~ /RSAPrivateKey/); | ||
| 937 | $a .= ",RSA" if($s =~ /SSLv23?_((client|server)_)?method/); | ||
| 938 | |||
| 939 | $platform{$s} = | ||
| 940 | &reduce_platforms((defined($platform{$s})?$platform{$s}.',':"").$p); | ||
| 941 | $algorithm{$s} .= ','.$a; | ||
| 942 | |||
| 943 | if (defined($variant{$s})) { | ||
| 944 | foreach $v (split /;/,$variant{$s}) { | ||
| 945 | (my $r, my $p, my $k) = split(/:/,$v); | ||
| 946 | my $ip = join ',',map({ /^!(.*)$/ ? $1 : "!".$_ } split /,/, $p); | ||
| 947 | $syms{$r} = 1; | ||
| 948 | if (!defined($k)) { $k = $kind{$s}; } | ||
| 949 | $kind{$r} = $k."(".$s.")"; | ||
| 950 | $algorithm{$r} = $algorithm{$s}; | ||
| 951 | $platform{$r} = &reduce_platforms($platform{$s}.",".$p.",".$p); | ||
| 952 | $platform{$s} = &reduce_platforms($platform{$s}.','.$ip.','.$ip); | ||
| 953 | print STDERR "DEBUG: \$variant{\"$s\"} = ",$v,"; \$r = $r; \$p = ",$platform{$r},"; \$a = ",$algorithm{$r},"; \$kind = ",$kind{$r},"\n" if $debug; | ||
| 954 | } | ||
| 955 | } | ||
| 956 | print STDERR "DEBUG: \$s = $s; \$p = ",$platform{$s},"; \$a = ",$algorithm{$s},"; \$kind = ",$kind{$s},"\n" if $debug; | ||
| 957 | } | ||
| 958 | } | ||
| 959 | |||
| 960 | # Prune the returned symbols | ||
| 961 | |||
| 962 | delete $syms{"bn_dump1"}; | ||
| 963 | $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh"; | ||
| 964 | |||
| 965 | $platform{"PEM_read_NS_CERT_SEQ"} = "VMS"; | ||
| 966 | $platform{"PEM_write_NS_CERT_SEQ"} = "VMS"; | ||
| 967 | $platform{"PEM_read_P8_PRIV_KEY_INFO"} = "VMS"; | ||
| 968 | $platform{"PEM_write_P8_PRIV_KEY_INFO"} = "VMS"; | ||
| 969 | $platform{"EVP_sha384"} = "!VMSVAX"; | ||
| 970 | $platform{"EVP_sha512"} = "!VMSVAX"; | ||
| 971 | $platform{"SHA384_Init"} = "!VMSVAX"; | ||
| 972 | $platform{"SHA384_Transform"} = "!VMSVAX"; | ||
| 973 | $platform{"SHA384_Update"} = "!VMSVAX"; | ||
| 974 | $platform{"SHA384_Final"} = "!VMSVAX"; | ||
| 975 | $platform{"SHA384"} = "!VMSVAX"; | ||
| 976 | $platform{"SHA512_Init"} = "!VMSVAX"; | ||
| 977 | $platform{"SHA512_Transform"} = "!VMSVAX"; | ||
| 978 | $platform{"SHA512_Update"} = "!VMSVAX"; | ||
| 979 | $platform{"SHA512_Final"} = "!VMSVAX"; | ||
| 980 | $platform{"SHA512"} = "!VMSVAX"; | ||
| 981 | $platform{"WHIRLPOOL_Init"} = "!VMSVAX"; | ||
| 982 | $platform{"WHIRLPOOL"} = "!VMSVAX"; | ||
| 983 | $platform{"WHIRLPOOL_BitUpdate"} = "!VMSVAX"; | ||
| 984 | $platform{"EVP_whirlpool"} = "!VMSVAX"; | ||
| 985 | $platform{"WHIRLPOOL_Final"} = "!VMSVAX"; | ||
| 986 | $platform{"WHIRLPOOL_Update"} = "!VMSVAX"; | ||
| 987 | |||
| 988 | |||
| 989 | # Info we know about | ||
| 990 | |||
| 991 | push @ret, map { $_."\\".&info_string($_,"EXIST", | ||
| 992 | $platform{$_}, | ||
| 993 | $kind{$_}, | ||
| 994 | $algorithm{$_}) } keys %syms; | ||
| 995 | |||
| 996 | if (keys %unknown_algorithms) { | ||
| 997 | print STDERR "WARNING: mkdef.pl doesn't know the following algorithms:\n"; | ||
| 998 | print STDERR "\t",join("\n\t",keys %unknown_algorithms),"\n"; | ||
| 999 | } | ||
| 1000 | return(@ret); | ||
| 1001 | } | ||
| 1002 | |||
| 1003 | # Param: string of comma-separated platform-specs. | ||
| 1004 | sub reduce_platforms | ||
| 1005 | { | ||
| 1006 | my ($platforms) = @_; | ||
| 1007 | my $pl = defined($platforms) ? $platforms : ""; | ||
| 1008 | my %p = map { $_ => 0 } split /,/, $pl; | ||
| 1009 | my $ret; | ||
| 1010 | |||
| 1011 | print STDERR "DEBUG: Entered reduce_platforms with \"$platforms\"\n" | ||
| 1012 | if $debug; | ||
| 1013 | # We do this, because if there's code like the following, it really | ||
| 1014 | # means the function exists in all cases and should therefore be | ||
| 1015 | # everywhere. By increasing and decreasing, we may attain 0: | ||
| 1016 | # | ||
| 1017 | # ifndef WIN16 | ||
| 1018 | # int foo(); | ||
| 1019 | # else | ||
| 1020 | # int _fat foo(); | ||
| 1021 | # endif | ||
| 1022 | foreach $platform (split /,/, $pl) { | ||
| 1023 | if ($platform =~ /^!(.*)$/) { | ||
| 1024 | $p{$1}--; | ||
| 1025 | } else { | ||
| 1026 | $p{$platform}++; | ||
| 1027 | } | ||
| 1028 | } | ||
| 1029 | foreach $platform (keys %p) { | ||
| 1030 | if ($p{$platform} == 0) { delete $p{$platform}; } | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | delete $p{""}; | ||
| 1034 | |||
| 1035 | $ret = join(',',sort(map { $p{$_} < 0 ? "!".$_ : $_ } keys %p)); | ||
| 1036 | print STDERR "DEBUG: Exiting reduce_platforms with \"$ret\"\n" | ||
| 1037 | if $debug; | ||
| 1038 | return $ret; | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | sub info_string { | ||
| 1042 | (my $symbol, my $exist, my $platforms, my $kind, my $algorithms) = @_; | ||
| 1043 | |||
| 1044 | my %a = defined($algorithms) ? | ||
| 1045 | map { $_ => 1 } split /,/, $algorithms : (); | ||
| 1046 | my $k = defined($kind) ? $kind : "FUNCTION"; | ||
| 1047 | my $ret; | ||
| 1048 | my $p = &reduce_platforms($platforms); | ||
| 1049 | |||
| 1050 | delete $a{""}; | ||
| 1051 | |||
| 1052 | $ret = $exist; | ||
| 1053 | $ret .= ":".$p; | ||
| 1054 | $ret .= ":".$k; | ||
| 1055 | $ret .= ":".join(',',sort keys %a); | ||
| 1056 | return $ret; | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | sub maybe_add_info { | ||
| 1060 | (my $name, *nums, my @symbols) = @_; | ||
| 1061 | my $sym; | ||
| 1062 | my $new_info = 0; | ||
| 1063 | my %syms=(); | ||
| 1064 | |||
| 1065 | print STDERR "Updating $name info\n"; | ||
| 1066 | foreach $sym (@symbols) { | ||
| 1067 | (my $s, my $i) = split /\\/, $sym; | ||
| 1068 | if (defined($nums{$s})) { | ||
| 1069 | $i =~ s/^(.*?:.*?:\w+)(\(\w+\))?/$1/; | ||
| 1070 | (my $n, my $dummy) = split /\\/, $nums{$s}; | ||
| 1071 | if (!defined($dummy) || $i ne $dummy) { | ||
| 1072 | $nums{$s} = $n."\\".$i; | ||
| 1073 | $new_info++; | ||
| 1074 | print STDERR "DEBUG: maybe_add_info for $s: \"$dummy\" => \"$i\"\n" if $debug; | ||
| 1075 | } | ||
| 1076 | } | ||
| 1077 | $syms{$s} = 1; | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | my @s=sort { &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") } keys %nums; | ||
| 1081 | foreach $sym (@s) { | ||
| 1082 | (my $n, my $i) = split /\\/, $nums{$sym}; | ||
| 1083 | if (!defined($syms{$sym}) && $i !~ /^NOEXIST:/) { | ||
| 1084 | $new_info++; | ||
| 1085 | print STDERR "DEBUG: maybe_add_info for $sym: -> undefined\n" if $debug; | ||
| 1086 | } | ||
| 1087 | } | ||
| 1088 | if ($new_info) { | ||
| 1089 | print STDERR "$new_info old symbols got an info update\n"; | ||
| 1090 | if (!$do_rewrite) { | ||
| 1091 | print STDERR "You should do a rewrite to fix this.\n"; | ||
| 1092 | } | ||
| 1093 | } else { | ||
| 1094 | print STDERR "No old symbols needed info update\n"; | ||
| 1095 | } | ||
| 1096 | } | ||
| 1097 | |||
| 1098 | # Param: string of comma-separated keywords, each possibly prefixed with a "!" | ||
| 1099 | sub is_valid | ||
| 1100 | { | ||
| 1101 | my ($keywords_txt,$platforms) = @_; | ||
| 1102 | my (@keywords) = split /,/,$keywords_txt; | ||
| 1103 | my ($falsesum, $truesum) = (0, 1); | ||
| 1104 | |||
| 1105 | # Param: one keyword | ||
| 1106 | sub recognise | ||
| 1107 | { | ||
| 1108 | my ($keyword,$platforms) = @_; | ||
| 1109 | |||
| 1110 | if ($platforms) { | ||
| 1111 | # platforms | ||
| 1112 | if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; } | ||
| 1113 | if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; } | ||
| 1114 | if ($keyword eq "VMS" && $VMS) { return 1; } | ||
| 1115 | if ($keyword eq "WIN32" && $W32) { return 1; } | ||
| 1116 | if ($keyword eq "WIN16" && $W16) { return 1; } | ||
| 1117 | if ($keyword eq "WINNT" && $NT) { return 1; } | ||
| 1118 | if ($keyword eq "OS2" && $OS2) { return 1; } | ||
| 1119 | # Special platforms: | ||
| 1120 | # EXPORT_VAR_AS_FUNCTION means that global variables | ||
| 1121 | # will be represented as functions. This currently | ||
| 1122 | # only happens on VMS-VAX. | ||
| 1123 | if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) { | ||
| 1124 | return 1; | ||
| 1125 | } | ||
| 1126 | if ($keyword eq "ZLIB" && $zlib) { return 1; } | ||
| 1127 | return 0; | ||
| 1128 | } else { | ||
| 1129 | # algorithms | ||
| 1130 | if ($keyword eq "RC2" && $no_rc2) { return 0; } | ||
| 1131 | if ($keyword eq "RC4" && $no_rc4) { return 0; } | ||
| 1132 | if ($keyword eq "RC5" && $no_rc5) { return 0; } | ||
| 1133 | if ($keyword eq "IDEA" && $no_idea) { return 0; } | ||
| 1134 | if ($keyword eq "DES" && $no_des) { return 0; } | ||
| 1135 | if ($keyword eq "BF" && $no_bf) { return 0; } | ||
| 1136 | if ($keyword eq "CAST" && $no_cast) { return 0; } | ||
| 1137 | if ($keyword eq "MD2" && $no_md2) { return 0; } | ||
| 1138 | if ($keyword eq "MD4" && $no_md4) { return 0; } | ||
| 1139 | if ($keyword eq "MD5" && $no_md5) { return 0; } | ||
| 1140 | if ($keyword eq "SHA" && $no_sha) { return 0; } | ||
| 1141 | if ($keyword eq "RIPEMD" && $no_ripemd) { return 0; } | ||
| 1142 | if ($keyword eq "MDC2" && $no_mdc2) { return 0; } | ||
| 1143 | if ($keyword eq "WHIRLPOOL" && $no_whirlpool) { return 0; } | ||
| 1144 | if ($keyword eq "RSA" && $no_rsa) { return 0; } | ||
| 1145 | if ($keyword eq "DSA" && $no_dsa) { return 0; } | ||
| 1146 | if ($keyword eq "DH" && $no_dh) { return 0; } | ||
| 1147 | if ($keyword eq "EC" && $no_ec) { return 0; } | ||
| 1148 | if ($keyword eq "ECDSA" && $no_ecdsa) { return 0; } | ||
| 1149 | if ($keyword eq "ECDH" && $no_ecdh) { return 0; } | ||
| 1150 | if ($keyword eq "HMAC" && $no_hmac) { return 0; } | ||
| 1151 | if ($keyword eq "AES" && $no_aes) { return 0; } | ||
| 1152 | if ($keyword eq "CAMELLIA" && $no_camellia) { return 0; } | ||
| 1153 | if ($keyword eq "SEED" && $no_seed) { return 0; } | ||
| 1154 | if ($keyword eq "EVP" && $no_evp) { return 0; } | ||
| 1155 | if ($keyword eq "LHASH" && $no_lhash) { return 0; } | ||
| 1156 | if ($keyword eq "STACK" && $no_stack) { return 0; } | ||
| 1157 | if ($keyword eq "ERR" && $no_err) { return 0; } | ||
| 1158 | if ($keyword eq "BUFFER" && $no_buffer) { return 0; } | ||
| 1159 | if ($keyword eq "BIO" && $no_bio) { return 0; } | ||
| 1160 | if ($keyword eq "COMP" && $no_comp) { return 0; } | ||
| 1161 | if ($keyword eq "DSO" && $no_dso) { return 0; } | ||
| 1162 | if ($keyword eq "KRB5" && $no_krb5) { return 0; } | ||
| 1163 | if ($keyword eq "ENGINE" && $no_engine) { return 0; } | ||
| 1164 | if ($keyword eq "HW" && $no_hw) { return 0; } | ||
| 1165 | if ($keyword eq "FP_API" && $no_fp_api) { return 0; } | ||
| 1166 | if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } | ||
| 1167 | if ($keyword eq "GMP" && $no_gmp) { return 0; } | ||
| 1168 | if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } | ||
| 1169 | if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } | ||
| 1170 | if ($keyword eq "PSK" && $no_psk) { return 0; } | ||
| 1171 | if ($keyword eq "CMS" && $no_cms) { return 0; } | ||
| 1172 | if ($keyword eq "SSL2" && $no_ssl2) { return 0; } | ||
| 1173 | if ($keyword eq "CAPIENG" && $no_capieng) { return 0; } | ||
| 1174 | if ($keyword eq "JPAKE" && $no_jpake) { return 0; } | ||
| 1175 | if ($keyword eq "DEPRECATED" && $no_deprecated) { return 0; } | ||
| 1176 | |||
| 1177 | # Nothing recognise as true | ||
| 1178 | return 1; | ||
| 1179 | } | ||
| 1180 | } | ||
| 1181 | |||
| 1182 | foreach $k (@keywords) { | ||
| 1183 | if ($k =~ /^!(.*)$/) { | ||
| 1184 | $falsesum += &recognise($1,$platforms); | ||
| 1185 | } else { | ||
| 1186 | $truesum *= &recognise($k,$platforms); | ||
| 1187 | } | ||
| 1188 | } | ||
| 1189 | print STDERR "DEBUG: [",$#keywords,",",$#keywords < 0,"] is_valid($keywords_txt) => (\!$falsesum) && $truesum = ",(!$falsesum) && $truesum,"\n" if $debug; | ||
| 1190 | return (!$falsesum) && $truesum; | ||
| 1191 | } | ||
| 1192 | |||
| 1193 | sub print_test_file | ||
| 1194 | { | ||
| 1195 | (*OUT,my $name,*nums,my $testall,my @symbols)=@_; | ||
| 1196 | my $n = 1; my @e; my @r; | ||
| 1197 | my $sym; my $prev = ""; my $prefSSLeay; | ||
| 1198 | |||
| 1199 | (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); | ||
| 1200 | (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:.*/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:.*/,@symbols); | ||
| 1201 | @symbols=((sort @e),(sort @r)); | ||
| 1202 | |||
| 1203 | foreach $sym (@symbols) { | ||
| 1204 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
| 1205 | my $v = 0; | ||
| 1206 | $v = 1 if $i=~ /^.*?:.*?:VARIABLE/; | ||
| 1207 | my $p = ($i =~ /^[^:]*:([^:]*):/,$1); | ||
| 1208 | my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); | ||
| 1209 | if (!defined($nums{$s})) { | ||
| 1210 | print STDERR "Warning: $s does not have a number assigned\n" | ||
| 1211 | if(!$do_update); | ||
| 1212 | } elsif (is_valid($p,1) && is_valid($a,0)) { | ||
| 1213 | my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); | ||
| 1214 | if ($prev eq $s2) { | ||
| 1215 | print OUT "\t/* The following has already appeared previously */\n"; | ||
| 1216 | print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; | ||
| 1217 | } | ||
| 1218 | $prev = $s2; # To warn about duplicates... | ||
| 1219 | |||
| 1220 | ($nn,$ni)=($nums{$s2} =~ /^(.*?)\\(.*)$/); | ||
| 1221 | if ($v) { | ||
| 1222 | print OUT "\textern int $s2; /* type unknown */ /* $nn $ni */\n"; | ||
| 1223 | } else { | ||
| 1224 | print OUT "\textern int $s2(); /* type unknown */ /* $nn $ni */\n"; | ||
| 1225 | } | ||
| 1226 | } | ||
| 1227 | } | ||
| 1228 | } | ||
| 1229 | |||
| 1230 | sub get_version { | ||
| 1231 | local *MF; | ||
| 1232 | my $v = '?'; | ||
| 1233 | open MF, 'Makefile' or return $v; | ||
| 1234 | while (<MF>) { | ||
| 1235 | $v = $1, last if /^VERSION=(.*?)\s*$/; | ||
| 1236 | } | ||
| 1237 | close MF; | ||
| 1238 | return $v; | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | sub print_def_file | ||
| 1242 | { | ||
| 1243 | (*OUT,my $name,*nums,my @symbols)=@_; | ||
| 1244 | my $n = 1; my @e; my @r; my @v; my $prev=""; | ||
| 1245 | my $liboptions=""; | ||
| 1246 | my $libname = $name; | ||
| 1247 | my $http_vendor = 'www.openssl.org/'; | ||
| 1248 | my $version = get_version(); | ||
| 1249 | my $what = "OpenSSL: implementation of Secure Socket Layer"; | ||
| 1250 | my $description = "$what $version, $name - http://$http_vendor"; | ||
| 1251 | |||
| 1252 | if ($W32) | ||
| 1253 | { $libname.="32"; } | ||
| 1254 | elsif ($W16) | ||
| 1255 | { $libname.="16"; } | ||
| 1256 | elsif ($OS2) | ||
| 1257 | { # DLL names should not clash on the whole system. | ||
| 1258 | # However, they should not have any particular relationship | ||
| 1259 | # to the name of the static library. Chose descriptive names | ||
| 1260 | # (must be at most 8 chars). | ||
| 1261 | my %translate = (ssl => 'open_ssl', crypto => 'cryptssl'); | ||
| 1262 | $libname = $translate{$name} || $name; | ||
| 1263 | $liboptions = <<EOO; | ||
| 1264 | INITINSTANCE | ||
| 1265 | DATA MULTIPLE NONSHARED | ||
| 1266 | EOO | ||
| 1267 | # Vendor field can't contain colon, drat; so we omit http:// | ||
| 1268 | $description = "\@#$http_vendor:$version#\@$what; DLL for library $name. Build for EMX -Zmtd"; | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | print OUT <<"EOF"; | ||
| 1272 | ; | ||
| 1273 | ; Definition file for the DLL version of the $name library from OpenSSL | ||
| 1274 | ; | ||
| 1275 | |||
| 1276 | LIBRARY $libname $liboptions | ||
| 1277 | |||
| 1278 | EOF | ||
| 1279 | |||
| 1280 | if ($W16) { | ||
| 1281 | print <<"EOF"; | ||
| 1282 | CODE PRELOAD MOVEABLE | ||
| 1283 | DATA PRELOAD MOVEABLE SINGLE | ||
| 1284 | |||
| 1285 | EXETYPE WINDOWS | ||
| 1286 | |||
| 1287 | HEAPSIZE 4096 | ||
| 1288 | STACKSIZE 8192 | ||
| 1289 | |||
| 1290 | EOF | ||
| 1291 | } | ||
| 1292 | |||
| 1293 | print "EXPORTS\n"; | ||
| 1294 | |||
| 1295 | (@e)=grep(/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); | ||
| 1296 | (@r)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:FUNCTION/ && !/^SSLeay(\{[0-9]+\})?\\.*?:.*?:FUNCTION/,@symbols); | ||
| 1297 | (@v)=grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:VARIABLE/,@symbols); | ||
| 1298 | @symbols=((sort @e),(sort @r), (sort @v)); | ||
| 1299 | |||
| 1300 | |||
| 1301 | foreach $sym (@symbols) { | ||
| 1302 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
| 1303 | my $v = 0; | ||
| 1304 | $v = 1 if $i =~ /^.*?:.*?:VARIABLE/; | ||
| 1305 | if (!defined($nums{$s})) { | ||
| 1306 | printf STDERR "Warning: $s does not have a number assigned\n" | ||
| 1307 | if(!$do_update); | ||
| 1308 | } else { | ||
| 1309 | (my $n, my $dummy) = split /\\/, $nums{$s}; | ||
| 1310 | my %pf = (); | ||
| 1311 | my $p = ($i =~ /^[^:]*:([^:]*):/,$1); | ||
| 1312 | my $a = ($i =~ /^[^:]*:[^:]*:[^:]*:([^:]*)/,$1); | ||
| 1313 | if (is_valid($p,1) && is_valid($a,0)) { | ||
| 1314 | my $s2 = ($s =~ /^(.*?)(\{[0-9]+\})?$/, $1); | ||
| 1315 | if ($prev eq $s2) { | ||
| 1316 | print STDERR "Warning: Symbol '",$s2,"' redefined. old=",($nums{$prev} =~ /^(.*?)\\/,$1),", new=",($nums{$s2} =~ /^(.*?)\\/,$1),"\n"; | ||
| 1317 | } | ||
| 1318 | $prev = $s2; # To warn about duplicates... | ||
| 1319 | if($v && !$OS2) { | ||
| 1320 | printf OUT " %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n; | ||
| 1321 | } else { | ||
| 1322 | printf OUT " %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n; | ||
| 1323 | } | ||
| 1324 | } | ||
| 1325 | } | ||
| 1326 | } | ||
| 1327 | printf OUT "\n"; | ||
| 1328 | } | ||
| 1329 | |||
| 1330 | sub load_numbers | ||
| 1331 | { | ||
| 1332 | my($name)=@_; | ||
| 1333 | my(@a,%ret); | ||
| 1334 | |||
| 1335 | $max_num = 0; | ||
| 1336 | $num_noinfo = 0; | ||
| 1337 | $prev = ""; | ||
| 1338 | $prev_cnt = 0; | ||
| 1339 | |||
| 1340 | open(IN,"<$name") || die "unable to open $name:$!\n"; | ||
| 1341 | while (<IN>) { | ||
| 1342 | chop; | ||
| 1343 | s/#.*$//; | ||
| 1344 | next if /^\s*$/; | ||
| 1345 | @a=split; | ||
| 1346 | if (defined $ret{$a[0]}) { | ||
| 1347 | # This is actually perfectly OK | ||
| 1348 | #print STDERR "Warning: Symbol '",$a[0],"' redefined. old=",$ret{$a[0]},", new=",$a[1],"\n"; | ||
| 1349 | } | ||
| 1350 | if ($max_num > $a[1]) { | ||
| 1351 | print STDERR "Warning: Number decreased from ",$max_num," to ",$a[1],"\n"; | ||
| 1352 | } | ||
| 1353 | elsif ($max_num == $a[1]) { | ||
| 1354 | # This is actually perfectly OK | ||
| 1355 | #print STDERR "Warning: Symbol ",$a[0]," has same number as previous ",$prev,": ",$a[1],"\n"; | ||
| 1356 | if ($a[0] eq $prev) { | ||
| 1357 | $prev_cnt++; | ||
| 1358 | $a[0] .= "{$prev_cnt}"; | ||
| 1359 | } | ||
| 1360 | } | ||
| 1361 | else { | ||
| 1362 | $prev_cnt = 0; | ||
| 1363 | } | ||
| 1364 | if ($#a < 2) { | ||
| 1365 | # Existence will be proven later, in do_defs | ||
| 1366 | $ret{$a[0]}=$a[1]; | ||
| 1367 | $num_noinfo++; | ||
| 1368 | } else { | ||
| 1369 | $ret{$a[0]}=$a[1]."\\".$a[2]; # \\ is a special marker | ||
| 1370 | } | ||
| 1371 | $max_num = $a[1] if $a[1] > $max_num; | ||
| 1372 | $prev=$a[0]; | ||
| 1373 | } | ||
| 1374 | if ($num_noinfo) { | ||
| 1375 | print STDERR "Warning: $num_noinfo symbols were without info."; | ||
| 1376 | if ($do_rewrite) { | ||
| 1377 | printf STDERR " The rewrite will fix this.\n"; | ||
| 1378 | } else { | ||
| 1379 | printf STDERR " You should do a rewrite to fix this.\n"; | ||
| 1380 | } | ||
| 1381 | } | ||
| 1382 | close(IN); | ||
| 1383 | return(%ret); | ||
| 1384 | } | ||
| 1385 | |||
| 1386 | sub parse_number | ||
| 1387 | { | ||
| 1388 | (my $str, my $what) = @_; | ||
| 1389 | (my $n, my $i) = split(/\\/,$str); | ||
| 1390 | if ($what eq "n") { | ||
| 1391 | return $n; | ||
| 1392 | } else { | ||
| 1393 | return $i; | ||
| 1394 | } | ||
| 1395 | } | ||
| 1396 | |||
| 1397 | sub rewrite_numbers | ||
| 1398 | { | ||
| 1399 | (*OUT,$name,*nums,@symbols)=@_; | ||
| 1400 | my $thing; | ||
| 1401 | |||
| 1402 | print STDERR "Rewriting $name\n"; | ||
| 1403 | |||
| 1404 | my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); | ||
| 1405 | my $r; my %r; my %rsyms; | ||
| 1406 | foreach $r (@r) { | ||
| 1407 | (my $s, my $i) = split /\\/, $r; | ||
| 1408 | my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; | ||
| 1409 | $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; | ||
| 1410 | $r{$a} = $s."\\".$i; | ||
| 1411 | $rsyms{$s} = 1; | ||
| 1412 | } | ||
| 1413 | |||
| 1414 | my %syms = (); | ||
| 1415 | foreach $_ (@symbols) { | ||
| 1416 | (my $n, my $i) = split /\\/; | ||
| 1417 | $syms{$n} = 1; | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | my @s=sort { | ||
| 1421 | &parse_number($nums{$a},"n") <=> &parse_number($nums{$b},"n") | ||
| 1422 | || $a cmp $b | ||
| 1423 | } keys %nums; | ||
| 1424 | foreach $sym (@s) { | ||
| 1425 | (my $n, my $i) = split /\\/, $nums{$sym}; | ||
| 1426 | next if defined($i) && $i =~ /^.*?:.*?:\w+\(\w+\)/; | ||
| 1427 | next if defined($rsyms{$sym}); | ||
| 1428 | print STDERR "DEBUG: rewrite_numbers for sym = ",$sym,": i = ",$i,", n = ",$n,", rsym{sym} = ",$rsyms{$sym},"syms{sym} = ",$syms{$sym},"\n" if $debug; | ||
| 1429 | $i="NOEXIST::FUNCTION:" | ||
| 1430 | if !defined($i) || $i eq "" || !defined($syms{$sym}); | ||
| 1431 | my $s2 = $sym; | ||
| 1432 | $s2 =~ s/\{[0-9]+\}$//; | ||
| 1433 | printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; | ||
| 1434 | if (exists $r{$sym}) { | ||
| 1435 | (my $s, $i) = split /\\/,$r{$sym}; | ||
| 1436 | my $s2 = $s; | ||
| 1437 | $s2 =~ s/\{[0-9]+\}$//; | ||
| 1438 | printf OUT "%s%-39s %d\t%s\n","",$s2,$n,$i; | ||
| 1439 | } | ||
| 1440 | } | ||
| 1441 | } | ||
| 1442 | |||
| 1443 | sub update_numbers | ||
| 1444 | { | ||
| 1445 | (*OUT,$name,*nums,my $start_num, my @symbols)=@_; | ||
| 1446 | my $new_syms = 0; | ||
| 1447 | |||
| 1448 | print STDERR "Updating $name numbers\n"; | ||
| 1449 | |||
| 1450 | my @r = grep(/^\w+(\{[0-9]+\})?\\.*?:.*?:\w+\(\w+\)/,@symbols); | ||
| 1451 | my $r; my %r; my %rsyms; | ||
| 1452 | foreach $r (@r) { | ||
| 1453 | (my $s, my $i) = split /\\/, $r; | ||
| 1454 | my $a = $1 if $i =~ /^.*?:.*?:\w+\((\w+)\)/; | ||
| 1455 | $i =~ s/^(.*?:.*?:\w+)\(\w+\)/$1/; | ||
| 1456 | $r{$a} = $s."\\".$i; | ||
| 1457 | $rsyms{$s} = 1; | ||
| 1458 | } | ||
| 1459 | |||
| 1460 | foreach $sym (@symbols) { | ||
| 1461 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
| 1462 | next if $i =~ /^.*?:.*?:\w+\(\w+\)/; | ||
| 1463 | next if defined($rsyms{$sym}); | ||
| 1464 | die "ERROR: Symbol $sym had no info attached to it." | ||
| 1465 | if $i eq ""; | ||
| 1466 | if (!exists $nums{$s}) { | ||
| 1467 | $new_syms++; | ||
| 1468 | my $s2 = $s; | ||
| 1469 | $s2 =~ s/\{[0-9]+\}$//; | ||
| 1470 | printf OUT "%s%-39s %d\t%s\n","",$s2, ++$start_num,$i; | ||
| 1471 | if (exists $r{$s}) { | ||
| 1472 | ($s, $i) = split /\\/,$r{$s}; | ||
| 1473 | $s =~ s/\{[0-9]+\}$//; | ||
| 1474 | printf OUT "%s%-39s %d\t%s\n","",$s, $start_num,$i; | ||
| 1475 | } | ||
| 1476 | } | ||
| 1477 | } | ||
| 1478 | if($new_syms) { | ||
| 1479 | print STDERR "$new_syms New symbols added\n"; | ||
| 1480 | } else { | ||
| 1481 | print STDERR "No New symbols Added\n"; | ||
| 1482 | } | ||
| 1483 | } | ||
| 1484 | |||
| 1485 | sub check_existing | ||
| 1486 | { | ||
| 1487 | (*nums, my @symbols)=@_; | ||
| 1488 | my %existing; my @remaining; | ||
| 1489 | @remaining=(); | ||
| 1490 | foreach $sym (@symbols) { | ||
| 1491 | (my $s, my $i) = $sym =~ /^(.*?)\\(.*)$/; | ||
| 1492 | $existing{$s}=1; | ||
| 1493 | } | ||
| 1494 | foreach $sym (keys %nums) { | ||
| 1495 | if (!exists $existing{$sym}) { | ||
| 1496 | push @remaining, $sym; | ||
| 1497 | } | ||
| 1498 | } | ||
| 1499 | if(@remaining) { | ||
| 1500 | print STDERR "The following symbols do not seem to exist:\n"; | ||
| 1501 | foreach $sym (@remaining) { | ||
| 1502 | print STDERR "\t",$sym,"\n"; | ||
| 1503 | } | ||
| 1504 | } | ||
| 1505 | } | ||
| 1506 | |||
diff --git a/src/lib/libcrypto/util/mkdir-p.pl b/src/lib/libcrypto/util/mkdir-p.pl new file mode 100644 index 0000000000..e73d02b073 --- /dev/null +++ b/src/lib/libcrypto/util/mkdir-p.pl | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | # mkdir-p.pl | ||
| 4 | |||
| 5 | # On some systems, the -p option to mkdir (= also create any missing parent | ||
| 6 | # directories) is not available. | ||
| 7 | |||
| 8 | my $arg; | ||
| 9 | |||
| 10 | foreach $arg (@ARGV) { | ||
| 11 | $arg =~ tr|\\|/|; | ||
| 12 | &do_mkdir_p($arg); | ||
| 13 | } | ||
| 14 | |||
| 15 | |||
| 16 | sub do_mkdir_p { | ||
| 17 | local($dir) = @_; | ||
| 18 | |||
| 19 | $dir =~ s|/*\Z(?!\n)||s; | ||
| 20 | |||
| 21 | if (-d $dir) { | ||
| 22 | return; | ||
| 23 | } | ||
| 24 | |||
| 25 | if ($dir =~ m|[^/]/|s) { | ||
| 26 | local($parent) = $dir; | ||
| 27 | $parent =~ s|[^/]*\Z(?!\n)||s; | ||
| 28 | |||
| 29 | do_mkdir_p($parent); | ||
| 30 | } | ||
| 31 | |||
| 32 | mkdir($dir, 0777) || die "Cannot create directory $dir: $!\n"; | ||
| 33 | print "created directory `$dir'\n"; | ||
| 34 | } | ||
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl index 2c99467d34..15b774f277 100644 --- a/src/lib/libcrypto/util/mkerr.pl +++ b/src/lib/libcrypto/util/mkerr.pl | |||
| @@ -391,7 +391,7 @@ foreach $lib (keys %csrc) | |||
| 391 | } else { | 391 | } else { |
| 392 | push @out, | 392 | push @out, |
| 393 | "/* ====================================================================\n", | 393 | "/* ====================================================================\n", |
| 394 | " * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.\n", | 394 | " * Copyright (c) 2001-2010 The OpenSSL Project. All rights reserved.\n", |
| 395 | " *\n", | 395 | " *\n", |
| 396 | " * Redistribution and use in source and binary forms, with or without\n", | 396 | " * Redistribution and use in source and binary forms, with or without\n", |
| 397 | " * modification, are permitted provided that the following conditions\n", | 397 | " * modification, are permitted provided that the following conditions\n", |
| @@ -576,7 +576,7 @@ EOF | |||
| 576 | print OUT <<"EOF"; | 576 | print OUT <<"EOF"; |
| 577 | /* $cfile */ | 577 | /* $cfile */ |
| 578 | /* ==================================================================== | 578 | /* ==================================================================== |
| 579 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 579 | * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved. |
| 580 | * | 580 | * |
| 581 | * Redistribution and use in source and binary forms, with or without | 581 | * Redistribution and use in source and binary forms, with or without |
| 582 | * modification, are permitted provided that the following conditions | 582 | * modification, are permitted provided that the following conditions |
diff --git a/src/lib/libcrypto/util/mkfiles.pl b/src/lib/libcrypto/util/mkfiles.pl new file mode 100644 index 0000000000..6d15831450 --- /dev/null +++ b/src/lib/libcrypto/util/mkfiles.pl | |||
| @@ -0,0 +1,141 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # This is a hacked version of files.pl for systems that can't do a 'make files'. | ||
| 4 | # Do a perl util/mkminfo.pl >MINFO to build MINFO | ||
| 5 | # Written by Steve Henson 1999. | ||
| 6 | |||
| 7 | # List of directories to process | ||
| 8 | |||
| 9 | my @dirs = ( | ||
| 10 | ".", | ||
| 11 | "crypto", | ||
| 12 | "crypto/md2", | ||
| 13 | "crypto/md4", | ||
| 14 | "crypto/md5", | ||
| 15 | "crypto/sha", | ||
| 16 | "crypto/mdc2", | ||
| 17 | "crypto/hmac", | ||
| 18 | "crypto/ripemd", | ||
| 19 | "crypto/des", | ||
| 20 | "crypto/rc2", | ||
| 21 | "crypto/rc4", | ||
| 22 | "crypto/rc5", | ||
| 23 | "crypto/idea", | ||
| 24 | "crypto/bf", | ||
| 25 | "crypto/cast", | ||
| 26 | "crypto/aes", | ||
| 27 | "crypto/camellia", | ||
| 28 | "crypto/seed", | ||
| 29 | "crypto/modes", | ||
| 30 | "crypto/bn", | ||
| 31 | "crypto/rsa", | ||
| 32 | "crypto/dsa", | ||
| 33 | "crypto/dso", | ||
| 34 | "crypto/dh", | ||
| 35 | "crypto/ec", | ||
| 36 | "crypto/ecdh", | ||
| 37 | "crypto/ecdsa", | ||
| 38 | "crypto/buffer", | ||
| 39 | "crypto/bio", | ||
| 40 | "crypto/stack", | ||
| 41 | "crypto/lhash", | ||
| 42 | "crypto/rand", | ||
| 43 | "crypto/err", | ||
| 44 | "crypto/objects", | ||
| 45 | "crypto/evp", | ||
| 46 | "crypto/asn1", | ||
| 47 | "crypto/pem", | ||
| 48 | "crypto/x509", | ||
| 49 | "crypto/x509v3", | ||
| 50 | "crypto/cms", | ||
| 51 | "crypto/conf", | ||
| 52 | "crypto/jpake", | ||
| 53 | "crypto/txt_db", | ||
| 54 | "crypto/pkcs7", | ||
| 55 | "crypto/pkcs12", | ||
| 56 | "crypto/comp", | ||
| 57 | "crypto/engine", | ||
| 58 | "crypto/ocsp", | ||
| 59 | "crypto/ui", | ||
| 60 | "crypto/krb5", | ||
| 61 | #"crypto/store", | ||
| 62 | "crypto/pqueue", | ||
| 63 | "crypto/whrlpool", | ||
| 64 | "crypto/ts", | ||
| 65 | "ssl", | ||
| 66 | "apps", | ||
| 67 | "engines", | ||
| 68 | "engines/ccgost", | ||
| 69 | "test", | ||
| 70 | "tools" | ||
| 71 | ); | ||
| 72 | |||
| 73 | %top; | ||
| 74 | |||
| 75 | foreach (@dirs) { | ||
| 76 | &files_dir ($_, "Makefile"); | ||
| 77 | } | ||
| 78 | |||
| 79 | exit(0); | ||
| 80 | |||
| 81 | sub files_dir | ||
| 82 | { | ||
| 83 | my ($dir, $makefile) = @_; | ||
| 84 | |||
| 85 | my %sym; | ||
| 86 | |||
| 87 | open (IN, "$dir/$makefile") || die "Can't open $dir/$makefile"; | ||
| 88 | |||
| 89 | my $s=""; | ||
| 90 | |||
| 91 | while (<IN>) | ||
| 92 | { | ||
| 93 | chop; | ||
| 94 | s/#.*//; | ||
| 95 | if (/^(\S+)\s*=\s*(.*)$/) | ||
| 96 | { | ||
| 97 | $o=""; | ||
| 98 | ($s,$b)=($1,$2); | ||
| 99 | for (;;) | ||
| 100 | { | ||
| 101 | if ($b =~ /\\$/) | ||
| 102 | { | ||
| 103 | chop($b); | ||
| 104 | $o.=$b." "; | ||
| 105 | $b=<IN>; | ||
| 106 | chop($b); | ||
| 107 | } | ||
| 108 | else | ||
| 109 | { | ||
| 110 | $o.=$b." "; | ||
| 111 | last; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | $o =~ s/^\s+//; | ||
| 115 | $o =~ s/\s+$//; | ||
| 116 | $o =~ s/\s+/ /g; | ||
| 117 | |||
| 118 | $o =~ s/\$[({]([^)}]+)[)}]/$top{$1} or $sym{$1}/ge; | ||
| 119 | $sym{$s}=($top{$s} or $o); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | print "RELATIVE_DIRECTORY=$dir\n"; | ||
| 124 | |||
| 125 | foreach (sort keys %sym) | ||
| 126 | { | ||
| 127 | print "$_=$sym{$_}\n"; | ||
| 128 | } | ||
| 129 | if ($dir eq "." && defined($sym{"BUILDENV"})) | ||
| 130 | { | ||
| 131 | foreach (split(' ',$sym{"BUILDENV"})) | ||
| 132 | { | ||
| 133 | /^(.+)=/; | ||
| 134 | $top{$1}=$sym{$1}; | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | print "RELATIVE_DIRECTORY=\n"; | ||
| 139 | |||
| 140 | close (IN); | ||
| 141 | } | ||
diff --git a/src/lib/libcrypto/util/mklink.pl b/src/lib/libcrypto/util/mklink.pl new file mode 100644 index 0000000000..61db12c68f --- /dev/null +++ b/src/lib/libcrypto/util/mklink.pl | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | # mklink.pl | ||
| 4 | |||
| 5 | # The first command line argument is a non-empty relative path | ||
| 6 | # specifying the "from" directory. | ||
| 7 | # Each other argument is a file name not containing / and | ||
| 8 | # names a file in the current directory. | ||
| 9 | # | ||
| 10 | # For each of these files, we create in the "from" directory a link | ||
| 11 | # of the same name pointing to the local file. | ||
| 12 | # | ||
| 13 | # We assume that the directory structure is a tree, i.e. that it does | ||
| 14 | # not contain symbolic links and that the parent of / is never referenced. | ||
| 15 | # Apart from this, this script should be able to handle even the most | ||
| 16 | # pathological cases. | ||
| 17 | |||
| 18 | use Cwd; | ||
| 19 | |||
| 20 | my $from = shift; | ||
| 21 | my @files = @ARGV; | ||
| 22 | |||
| 23 | my @from_path = split(/[\\\/]/, $from); | ||
| 24 | my $pwd = getcwd(); | ||
| 25 | chomp($pwd); | ||
| 26 | my @pwd_path = split(/[\\\/]/, $pwd); | ||
| 27 | |||
| 28 | my @to_path = (); | ||
| 29 | |||
| 30 | my $dirname; | ||
| 31 | foreach $dirname (@from_path) { | ||
| 32 | |||
| 33 | # In this loop, @to_path always is a relative path from | ||
| 34 | # @pwd_path (interpreted is an absolute path) to the original pwd. | ||
| 35 | |||
| 36 | # At the end, @from_path (as a relative path from the original pwd) | ||
| 37 | # designates the same directory as the absolute path @pwd_path, | ||
| 38 | # which means that @to_path then is a path from there to the original pwd. | ||
| 39 | |||
| 40 | next if ($dirname eq "" || $dirname eq "."); | ||
| 41 | |||
| 42 | if ($dirname eq "..") { | ||
| 43 | @to_path = (pop(@pwd_path), @to_path); | ||
| 44 | } else { | ||
| 45 | @to_path = ("..", @to_path); | ||
| 46 | push(@pwd_path, $dirname); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | my $to = join('/', @to_path); | ||
| 51 | |||
| 52 | my $file; | ||
| 53 | $symlink_exists=eval {symlink("",""); 1}; | ||
| 54 | if ($^O eq "msys") { $symlink_exists=0 }; | ||
| 55 | foreach $file (@files) { | ||
| 56 | my $err = ""; | ||
| 57 | if ($symlink_exists) { | ||
| 58 | unlink "$from/$file"; | ||
| 59 | symlink("$to/$file", "$from/$file") or $err = " [$!]"; | ||
| 60 | } else { | ||
| 61 | unlink "$from/$file"; | ||
| 62 | open (OLD, "<$file") or die "Can't open $file: $!"; | ||
| 63 | open (NEW, ">$from/$file") or die "Can't open $from/$file: $!"; | ||
| 64 | binmode(OLD); | ||
| 65 | binmode(NEW); | ||
| 66 | while (<OLD>) { | ||
| 67 | print NEW $_; | ||
| 68 | } | ||
| 69 | close (OLD) or die "Can't close $file: $!"; | ||
| 70 | close (NEW) or die "Can't close $from/$file: $!"; | ||
| 71 | } | ||
| 72 | print $file . " => $from/$file$err\n"; | ||
| 73 | } | ||
diff --git a/src/lib/libcrypto/util/mkrc.pl b/src/lib/libcrypto/util/mkrc.pl new file mode 100755 index 0000000000..0ceadcf8d1 --- /dev/null +++ b/src/lib/libcrypto/util/mkrc.pl | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | #!/bin/env perl | ||
| 2 | # | ||
| 3 | open FD,"crypto/opensslv.h"; | ||
| 4 | while(<FD>) { | ||
| 5 | if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) { | ||
| 6 | $ver = hex($1); | ||
| 7 | $v1 = ($ver>>28); | ||
| 8 | $v2 = ($ver>>20)&0xff; | ||
| 9 | $v3 = ($ver>>12)&0xff; | ||
| 10 | $v4 = ($ver>> 4)&0xff; | ||
| 11 | $beta = $ver&0xf; | ||
| 12 | $version = "$v1.$v2.$v3"; | ||
| 13 | if ($beta==0xf) { $version .= chr(ord('a')+$v4-1) if ($v4); } | ||
| 14 | elsif ($beta==0){ $version .= "-dev"; } | ||
| 15 | else { $version .= "-beta$beta"; } | ||
| 16 | last; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | close(FD); | ||
| 20 | |||
| 21 | $filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/; | ||
| 22 | $basename = $1; | ||
| 23 | $extname = $2; | ||
| 24 | |||
| 25 | if ($extname =~ /dll/i) { $description = "OpenSSL shared library"; } | ||
| 26 | else { $description = "OpenSSL application"; } | ||
| 27 | |||
| 28 | print <<___; | ||
| 29 | #include <winver.h> | ||
| 30 | |||
| 31 | LANGUAGE 0x09,0x01 | ||
| 32 | |||
| 33 | 1 VERSIONINFO | ||
| 34 | FILEVERSION $v1,$v2,$v3,$v4 | ||
| 35 | PRODUCTVERSION $v1,$v2,$v3,$v4 | ||
| 36 | FILEFLAGSMASK 0x3fL | ||
| 37 | #ifdef _DEBUG | ||
| 38 | FILEFLAGS 0x01L | ||
| 39 | #else | ||
| 40 | FILEFLAGS 0x00L | ||
| 41 | #endif | ||
| 42 | FILEOS VOS__WINDOWS32 | ||
| 43 | FILETYPE VFT_DLL | ||
| 44 | FILESUBTYPE 0x0L | ||
| 45 | BEGIN | ||
| 46 | BLOCK "StringFileInfo" | ||
| 47 | BEGIN | ||
| 48 | BLOCK "040904b0" | ||
| 49 | BEGIN | ||
| 50 | // Required: | ||
| 51 | VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0" | ||
| 52 | VALUE "FileDescription", "$description\\0" | ||
| 53 | VALUE "FileVersion", "$version\\0" | ||
| 54 | VALUE "InternalName", "$basename\\0" | ||
| 55 | VALUE "OriginalFilename", "$filename\\0" | ||
| 56 | VALUE "ProductName", "The OpenSSL Toolkit\\0" | ||
| 57 | VALUE "ProductVersion", "$version\\0" | ||
| 58 | // Optional: | ||
| 59 | //VALUE "Comments", "\\0" | ||
| 60 | VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0" | ||
| 61 | //VALUE "LegalTrademarks", "\\0" | ||
| 62 | //VALUE "PrivateBuild", "\\0" | ||
| 63 | //VALUE "SpecialBuild", "\\0" | ||
| 64 | END | ||
| 65 | END | ||
| 66 | BLOCK "VarFileInfo" | ||
| 67 | BEGIN | ||
| 68 | VALUE "Translation", 0x409, 0x4b0 | ||
| 69 | END | ||
| 70 | END | ||
| 71 | ___ | ||
diff --git a/src/lib/libcrypto/util/mkstack.pl b/src/lib/libcrypto/util/mkstack.pl index f708610a78..6a43757c95 100644 --- a/src/lib/libcrypto/util/mkstack.pl +++ b/src/lib/libcrypto/util/mkstack.pl | |||
| @@ -104,25 +104,25 @@ EOF | |||
| 104 | 104 | ||
| 105 | #define sk_${t1}_new(cmp) ((STACK_OF($t1) *)sk_new(CHECKED_SK_CMP_FUNC($t2, cmp))) | 105 | #define sk_${t1}_new(cmp) ((STACK_OF($t1) *)sk_new(CHECKED_SK_CMP_FUNC($t2, cmp))) |
| 106 | #define sk_${t1}_new_null() ((STACK_OF($t1) *)sk_new_null()) | 106 | #define sk_${t1}_new_null() ((STACK_OF($t1) *)sk_new_null()) |
| 107 | #define sk_${t1}_push(st, val) sk_push(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val)) | 107 | #define sk_${t1}_push(st, val) sk_push(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) |
| 108 | #define sk_${t1}_find(st, val) sk_find(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val)) | 108 | #define sk_${t1}_find(st, val) sk_find(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) |
| 109 | #define sk_${t1}_value(st, i) (($t1)sk_value(CHECKED_STACK_OF($t1, st), i)) | 109 | #define sk_${t1}_value(st, i) (($t1)sk_value(CHECKED_PTR_OF(STACK_OF($t1), st), i)) |
| 110 | #define sk_${t1}_num(st) SKM_sk_num($t1, st) | 110 | #define sk_${t1}_num(st) SKM_sk_num($t1, st) |
| 111 | #define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF($t1, st), CHECKED_SK_FREE_FUNC2($t1, free_func)) | 111 | #define sk_${t1}_pop_free(st, free_func) sk_pop_free(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_FREE_FUNC2($t1, free_func)) |
| 112 | #define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val), i) | 112 | #define sk_${t1}_insert(st, val, i) sk_insert(CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val), i) |
| 113 | #define sk_${t1}_free(st) SKM_sk_free(${t1}, st) | 113 | #define sk_${t1}_free(st) SKM_sk_free(${t1}, st) |
| 114 | #define sk_${t1}_set(st, i, val) sk_set(CHECKED_STACK_OF($t1, st), i, CHECKED_PTR_OF($t2, val)) | 114 | #define sk_${t1}_set(st, i, val) sk_set((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), i, CHECKED_PTR_OF($t2, val)) |
| 115 | #define sk_${t1}_zero(st) SKM_sk_zero($t1, (st)) | 115 | #define sk_${t1}_zero(st) SKM_sk_zero($t1, (st)) |
| 116 | #define sk_${t1}_unshift(st, val) sk_unshift(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, val)) | 116 | #define sk_${t1}_unshift(st, val) sk_unshift((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, val)) |
| 117 | #define sk_${t1}_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF($t1), st), CHECKED_CONST_PTR_OF($t2, val)) | 117 | #define sk_${t1}_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF($t1), st), CHECKED_CONST_PTR_OF($t2, val)) |
| 118 | #define sk_${t1}_delete(st, i) SKM_sk_delete($t1, (st), (i)) | 118 | #define sk_${t1}_delete(st, i) SKM_sk_delete($t1, (st), (i)) |
| 119 | #define sk_${t1}_delete_ptr(st, ptr) ($t1 *)sk_delete_ptr(CHECKED_STACK_OF($t1, st), CHECKED_PTR_OF($t2, ptr)) | 119 | #define sk_${t1}_delete_ptr(st, ptr) ($t1 *)sk_delete_ptr((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_PTR_OF($t2, ptr)) |
| 120 | #define sk_${t1}_set_cmp_func(st, cmp) \\ | 120 | #define sk_${t1}_set_cmp_func(st, cmp) \\ |
| 121 | ((int (*)(const $t2 * const *,const $t2 * const *)) \\ | 121 | ((int (*)(const $t2 * const *,const $t2 * const *)) \\ |
| 122 | sk_set_cmp_func(CHECKED_STACK_OF($t1, st), CHECKED_SK_CMP_FUNC($t2, cmp))) | 122 | sk_set_cmp_func((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st), CHECKED_SK_CMP_FUNC($t2, cmp))) |
| 123 | #define sk_${t1}_dup(st) SKM_sk_dup($t1, st) | 123 | #define sk_${t1}_dup(st) SKM_sk_dup($t1, st) |
| 124 | #define sk_${t1}_shift(st) SKM_sk_shift($t1, (st)) | 124 | #define sk_${t1}_shift(st) SKM_sk_shift($t1, (st)) |
| 125 | #define sk_${t1}_pop(st) ($t2 *)sk_pop(CHECKED_STACK_OF($t1, st)) | 125 | #define sk_${t1}_pop(st) ($t2 *)sk_pop((_STACK *)CHECKED_PTR_OF(STACK_OF($t1), st)) |
| 126 | #define sk_${t1}_sort(st) SKM_sk_sort($t1, (st)) | 126 | #define sk_${t1}_sort(st) SKM_sk_sort($t1, (st)) |
| 127 | #define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st)) | 127 | #define sk_${t1}_is_sorted(st) SKM_sk_is_sorted($t1, (st)) |
| 128 | 128 | ||
diff --git a/src/lib/libcrypto/util/opensslwrap.sh b/src/lib/libcrypto/util/opensslwrap.sh new file mode 100755 index 0000000000..b27cbb897f --- /dev/null +++ b/src/lib/libcrypto/util/opensslwrap.sh | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | HERE="`echo $0 | sed -e 's|[^/]*$||'`" | ||
| 4 | OPENSSL="${HERE}../apps/openssl" | ||
| 5 | |||
| 6 | if [ -d "${HERE}../engines" -a "x$OPENSSL_ENGINES" = "x" ]; then | ||
| 7 | OPENSSL_ENGINES="${HERE}../engines"; export OPENSSL_ENGINES | ||
| 8 | fi | ||
| 9 | |||
| 10 | if [ -x "${OPENSSL}.exe" ]; then | ||
| 11 | # The original reason for this script existence is to work around | ||
| 12 | # certain caveats in run-time linker behaviour. On Windows platforms | ||
| 13 | # adjusting $PATH used to be sufficient, but with introduction of | ||
| 14 | # SafeDllSearchMode in XP/2003 the only way to get it right in | ||
| 15 | # *all* possible situations is to copy newly built .DLLs to apps/ | ||
| 16 | # and test/, which is now done elsewhere... The $PATH is adjusted | ||
| 17 | # for backward compatibility (and nostagical reasons:-). | ||
| 18 | if [ "$OSTYPE" != msdosdjgpp ]; then | ||
| 19 | PATH="${HERE}..:$PATH"; export PATH | ||
| 20 | fi | ||
| 21 | exec "${OPENSSL}.exe" "$@" | ||
| 22 | elif [ -x "${OPENSSL}" -a -x "${HERE}shlib_wrap.sh" ]; then | ||
| 23 | exec "${HERE}shlib_wrap.sh" "${OPENSSL}" "$@" | ||
| 24 | else | ||
| 25 | exec "${OPENSSL}" "$@" # hope for the best... | ||
| 26 | fi | ||
diff --git a/src/lib/libcrypto/util/perlpath.pl b/src/lib/libcrypto/util/perlpath.pl new file mode 100644 index 0000000000..a1f236bd98 --- /dev/null +++ b/src/lib/libcrypto/util/perlpath.pl | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # modify the '#!/usr/local/bin/perl' | ||
| 4 | # line in all scripts that rely on perl. | ||
| 5 | # | ||
| 6 | |||
| 7 | require "find.pl"; | ||
| 8 | |||
| 9 | $#ARGV == 0 || print STDERR "usage: perlpath newpath (eg /usr/bin)\n"; | ||
| 10 | &find("."); | ||
| 11 | |||
| 12 | sub wanted | ||
| 13 | { | ||
| 14 | return unless /\.pl$/ || /^[Cc]onfigur/; | ||
| 15 | |||
| 16 | open(IN,"<$_") || die "unable to open $dir/$_:$!\n"; | ||
| 17 | @a=<IN>; | ||
| 18 | close(IN); | ||
| 19 | |||
| 20 | if (-d $ARGV[0]) { | ||
| 21 | $a[0]="#!$ARGV[0]/perl\n"; | ||
| 22 | } | ||
| 23 | else { | ||
| 24 | $a[0]="#!$ARGV[0]\n"; | ||
| 25 | } | ||
| 26 | |||
| 27 | # Playing it safe... | ||
| 28 | $new="$_.new"; | ||
| 29 | open(OUT,">$new") || die "unable to open $dir/$new:$!\n"; | ||
| 30 | print OUT @a; | ||
| 31 | close(OUT); | ||
| 32 | |||
| 33 | rename($new,$_) || die "unable to rename $dir/$new:$!\n"; | ||
| 34 | chmod(0755,$_) || die "unable to chmod $dir/$new:$!\n"; | ||
| 35 | } | ||
diff --git a/src/lib/libcrypto/util/pl/BC-32.pl b/src/lib/libcrypto/util/pl/BC-32.pl new file mode 100644 index 0000000000..1f1e13fb40 --- /dev/null +++ b/src/lib/libcrypto/util/pl/BC-32.pl | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # Borland C++ builder 3 and 4 -- Janez Jere <jj@void.si> | ||
| 3 | # | ||
| 4 | |||
| 5 | $ssl= "ssleay32"; | ||
| 6 | $crypto="libeay32"; | ||
| 7 | |||
| 8 | $o='\\'; | ||
| 9 | $cp='copy'; | ||
| 10 | $rm='del'; | ||
| 11 | |||
| 12 | # C compiler stuff | ||
| 13 | $cc='bcc32'; | ||
| 14 | $lflags="-ap -Tpe -x -Gn "; | ||
| 15 | $mlflags=''; | ||
| 16 | |||
| 17 | $out_def="out32"; | ||
| 18 | $tmp_def="tmp32"; | ||
| 19 | $inc_def="inc32"; | ||
| 20 | #enable max error messages, disable most common warnings | ||
| 21 | $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp "; | ||
| 22 | if ($debug) | ||
| 23 | { | ||
| 24 | $cflags.="-Od -y -v -vi- -D_DEBUG"; | ||
| 25 | $mlflags.=' '; | ||
| 26 | } | ||
| 27 | else | ||
| 28 | { | ||
| 29 | $cflags.="-O2 -ff -fp"; | ||
| 30 | } | ||
| 31 | |||
| 32 | $obj='.obj'; | ||
| 33 | $ofile="-o"; | ||
| 34 | |||
| 35 | # EXE linking stuff | ||
| 36 | $link="ilink32"; | ||
| 37 | $efile=""; | ||
| 38 | $exep='.exe'; | ||
| 39 | if ($no_sock) | ||
| 40 | { $ex_libs=""; } | ||
| 41 | else { $ex_libs="cw32mt.lib import32.lib"; } | ||
| 42 | |||
| 43 | # static library stuff | ||
| 44 | $mklib='tlib /P64'; | ||
| 45 | $ranlib=''; | ||
| 46 | $plib=""; | ||
| 47 | $libp=".lib"; | ||
| 48 | $shlibp=($shlib)?".dll":".lib"; | ||
| 49 | $lfile=''; | ||
| 50 | |||
| 51 | $shlib_ex_obj=""; | ||
| 52 | $app_ex_obj="c0x32.obj"; | ||
| 53 | |||
| 54 | $asm='nasmw -f obj -d__omf__'; | ||
| 55 | $asm.=" /Zi" if $debug; | ||
| 56 | $afile='-o'; | ||
| 57 | |||
| 58 | $bn_mulw_obj=''; | ||
| 59 | $bn_mulw_src=''; | ||
| 60 | $des_enc_obj=''; | ||
| 61 | $des_enc_src=''; | ||
| 62 | $bf_enc_obj=''; | ||
| 63 | $bf_enc_src=''; | ||
| 64 | |||
| 65 | if (!$no_asm) | ||
| 66 | { | ||
| 67 | $bn_mulw_obj='crypto\bn\asm\bn_win32.obj'; | ||
| 68 | $bn_mulw_src='crypto\bn\asm\bn_win32.asm'; | ||
| 69 | $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj'; | ||
| 70 | $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm'; | ||
| 71 | $bf_enc_obj='crypto\bf\asm\b_win32.obj'; | ||
| 72 | $bf_enc_src='crypto\bf\asm\b_win32.asm'; | ||
| 73 | $cast_enc_obj='crypto\cast\asm\c_win32.obj'; | ||
| 74 | $cast_enc_src='crypto\cast\asm\c_win32.asm'; | ||
| 75 | $rc4_enc_obj='crypto\rc4\asm\r4_win32.obj'; | ||
| 76 | $rc4_enc_src='crypto\rc4\asm\r4_win32.asm'; | ||
| 77 | $rc5_enc_obj='crypto\rc5\asm\r5_win32.obj'; | ||
| 78 | $rc5_enc_src='crypto\rc5\asm\r5_win32.asm'; | ||
| 79 | $md5_asm_obj='crypto\md5\asm\m5_win32.obj'; | ||
| 80 | $md5_asm_src='crypto\md5\asm\m5_win32.asm'; | ||
| 81 | $sha1_asm_obj='crypto\sha\asm\s1_win32.obj'; | ||
| 82 | $sha1_asm_src='crypto\sha\asm\s1_win32.asm'; | ||
| 83 | $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj'; | ||
| 84 | $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm'; | ||
| 85 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM"; | ||
| 86 | } | ||
| 87 | |||
| 88 | if ($shlib) | ||
| 89 | { | ||
| 90 | $mlflags.=" $lflags /dll"; | ||
| 91 | # $cflags =~ s| /MD| /MT|; | ||
| 92 | $lib_cflag=" /GD -D_WINDLL -D_DLL"; | ||
| 93 | $out_def="out32dll"; | ||
| 94 | $tmp_def="tmp32dll"; | ||
| 95 | } | ||
| 96 | |||
| 97 | sub do_lib_rule | ||
| 98 | { | ||
| 99 | local($objs,$target,$name,$shlib)=@_; | ||
| 100 | local($ret,$Name); | ||
| 101 | |||
| 102 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 103 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 104 | |||
| 105 | # $target="\$(LIB_D)$o$target"; | ||
| 106 | $ret.="$target: $objs\n"; | ||
| 107 | if (!$shlib) | ||
| 108 | { | ||
| 109 | $ret.=<<___; | ||
| 110 | -\$(RM) $lfile$target | ||
| 111 | \$(MKLIB) $lfile$target \@&&! | ||
| 112 | +\$(**: = &^ | ||
| 113 | +) | ||
| 114 | ! | ||
| 115 | ___ | ||
| 116 | } | ||
| 117 | else | ||
| 118 | { | ||
| 119 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
| 120 | $ex.=' ws2_32.lib gdi32.lib'; | ||
| 121 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; | ||
| 122 | } | ||
| 123 | $ret.="\n"; | ||
| 124 | return($ret); | ||
| 125 | } | ||
| 126 | |||
| 127 | sub do_link_rule | ||
| 128 | { | ||
| 129 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 130 | local($ret,$_); | ||
| 131 | |||
| 132 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 133 | $n=&bname($targer); | ||
| 134 | $ret.="$target: $files $dep_libs\n"; | ||
| 135 | $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n"; | ||
| 136 | return($ret); | ||
| 137 | } | ||
| 138 | |||
| 139 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl new file mode 100644 index 0000000000..fe3fb27a78 --- /dev/null +++ b/src/lib/libcrypto/util/pl/Mingw32.pl | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # Mingw32.pl -- Mingw | ||
| 4 | # | ||
| 5 | |||
| 6 | $o='/'; | ||
| 7 | $cp='cp'; | ||
| 8 | $rm='rm -f'; | ||
| 9 | $mkdir='gmkdir'; | ||
| 10 | |||
| 11 | $o='\\'; | ||
| 12 | $cp='copy'; | ||
| 13 | $rm='del'; | ||
| 14 | $mkdir='mkdir'; | ||
| 15 | |||
| 16 | # C compiler stuff | ||
| 17 | |||
| 18 | $cc='gcc'; | ||
| 19 | if ($debug) | ||
| 20 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -g2 -ggdb"; } | ||
| 21 | else | ||
| 22 | { $cflags="-DL_ENDIAN -DDSO_WIN32 -fomit-frame-pointer -O3 -mcpu=i486 -Wall"; } | ||
| 23 | |||
| 24 | if ($gaswin and !$no_asm) | ||
| 25 | { | ||
| 26 | $bn_asm_obj='$(OBJ_D)\bn-win32.o'; | ||
| 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; | ||
| 28 | $bnco_asm_obj='$(OBJ_D)\co-win32.o'; | ||
| 29 | $bnco_asm_src='crypto/bn/asm/co-win32.s'; | ||
| 30 | $des_enc_obj='$(OBJ_D)\d-win32.o $(OBJ_D)\y-win32.o'; | ||
| 31 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; | ||
| 32 | $bf_enc_obj='$(OBJ_D)\b-win32.o'; | ||
| 33 | $bf_enc_src='crypto/bf/asm/b-win32.s'; | ||
| 34 | # $cast_enc_obj='$(OBJ_D)\c-win32.o'; | ||
| 35 | # $cast_enc_src='crypto/cast/asm/c-win32.s'; | ||
| 36 | $rc4_enc_obj='$(OBJ_D)\r4-win32.o'; | ||
| 37 | $rc4_enc_src='crypto/rc4/asm/r4-win32.s'; | ||
| 38 | $rc5_enc_obj='$(OBJ_D)\r5-win32.o'; | ||
| 39 | $rc5_enc_src='crypto/rc5/asm/r5-win32.s'; | ||
| 40 | $md5_asm_obj='$(OBJ_D)\m5-win32.o'; | ||
| 41 | $md5_asm_src='crypto/md5/asm/m5-win32.s'; | ||
| 42 | $rmd160_asm_obj='$(OBJ_D)\rm-win32.o'; | ||
| 43 | $rmd160_asm_src='crypto/ripemd/asm/rm-win32.s'; | ||
| 44 | $sha1_asm_obj='$(OBJ_D)\s1-win32.o'; | ||
| 45 | $sha1_asm_src='crypto/sha/asm/s1-win32.s'; | ||
| 46 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS"; | ||
| 47 | } | ||
| 48 | |||
| 49 | |||
| 50 | $obj='.o'; | ||
| 51 | $ofile='-o '; | ||
| 52 | |||
| 53 | # EXE linking stuff | ||
| 54 | $link='${CC}'; | ||
| 55 | $lflags='${CFLAGS}'; | ||
| 56 | $efile='-o '; | ||
| 57 | $exep=''; | ||
| 58 | $ex_libs="-lws2_32 -lgdi32"; | ||
| 59 | |||
| 60 | # static library stuff | ||
| 61 | $mklib='ar r'; | ||
| 62 | $mlflags=''; | ||
| 63 | $ranlib='ranlib'; | ||
| 64 | $plib='lib'; | ||
| 65 | $libp=".a"; | ||
| 66 | $shlibp=".a"; | ||
| 67 | $lfile=''; | ||
| 68 | |||
| 69 | $asm='as'; | ||
| 70 | $afile='-o '; | ||
| 71 | #$bn_asm_obj=""; | ||
| 72 | #$bn_asm_src=""; | ||
| 73 | #$des_enc_obj=""; | ||
| 74 | #$des_enc_src=""; | ||
| 75 | #$bf_enc_obj=""; | ||
| 76 | #$bf_enc_src=""; | ||
| 77 | |||
| 78 | sub do_lib_rule | ||
| 79 | { | ||
| 80 | local($obj,$target,$name,$shlib)=@_; | ||
| 81 | local($ret,$_,$Name); | ||
| 82 | |||
| 83 | $target =~ s/\//$o/g if $o ne '/'; | ||
| 84 | $target="$target"; | ||
| 85 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 86 | |||
| 87 | $ret.="$target: \$(${Name}OBJ)\n"; | ||
| 88 | $ret.="\tif exist $target \$(RM) $target\n"; | ||
| 89 | $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n"; | ||
| 90 | $ret.="\t\$(RANLIB) $target\n\n"; | ||
| 91 | } | ||
| 92 | |||
| 93 | sub do_link_rule | ||
| 94 | { | ||
| 95 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 96 | local($ret,$_); | ||
| 97 | |||
| 98 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 99 | $n=&bname($target); | ||
| 100 | $ret.="$target: $files $dep_libs\n"; | ||
| 101 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | ||
| 102 | return($ret); | ||
| 103 | } | ||
| 104 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/OS2-EMX.pl b/src/lib/libcrypto/util/pl/OS2-EMX.pl new file mode 100644 index 0000000000..28cd116907 --- /dev/null +++ b/src/lib/libcrypto/util/pl/OS2-EMX.pl | |||
| @@ -0,0 +1,120 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # OS2-EMX.pl - for EMX GCC on OS/2 | ||
| 4 | # | ||
| 5 | |||
| 6 | $o='/'; | ||
| 7 | $cp='cp'; | ||
| 8 | $rm='rm -f'; | ||
| 9 | |||
| 10 | $preamble = "SHELL=sh\n"; | ||
| 11 | |||
| 12 | # C compiler stuff | ||
| 13 | |||
| 14 | $cc='gcc'; | ||
| 15 | $cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmtd -Wall "; | ||
| 16 | $cflags.="-Zomf " if $shlib; | ||
| 17 | $shl_cflag="-Zdll"; | ||
| 18 | |||
| 19 | if ($debug) { | ||
| 20 | $cflags.="-g "; | ||
| 21 | } | ||
| 22 | |||
| 23 | $obj=$shlib ? '.obj' : '.o'; | ||
| 24 | $ofile='-o '; | ||
| 25 | |||
| 26 | # EXE linking stuff | ||
| 27 | $link='${CC}'; | ||
| 28 | $lflags='${CFLAGS} -Zbsd-signals -s'; | ||
| 29 | $efile='-o '; | ||
| 30 | $exep='.exe'; | ||
| 31 | $ex_libs="-lsocket"; | ||
| 32 | |||
| 33 | # static library stuff | ||
| 34 | $mklib='ar r'; | ||
| 35 | $mlflags=''; | ||
| 36 | $ranlib="ar s"; | ||
| 37 | $plib=''; | ||
| 38 | $libp=$shlib ? ".lib" : ".a"; | ||
| 39 | $shlibp=$shlib ? ".dll" : ".a"; | ||
| 40 | $lfile=''; | ||
| 41 | |||
| 42 | $asm=$shlib ? 'as -Zomf' : 'as'; | ||
| 43 | $afile='-o '; | ||
| 44 | $bn_asm_obj=""; | ||
| 45 | $bn_asm_src=""; | ||
| 46 | $des_enc_obj=""; | ||
| 47 | $des_enc_src=""; | ||
| 48 | $bf_enc_obj=""; | ||
| 49 | $bf_enc_src=""; | ||
| 50 | |||
| 51 | if (!$no_asm) | ||
| 52 | { | ||
| 53 | $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj"; | ||
| 54 | $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm"; | ||
| 55 | $des_enc_obj="crypto/des/asm/d-os2$obj crypto/des/asm/y-os2$obj"; | ||
| 56 | $des_enc_src="crypto/des/asm/d-os2.asm crypto/des/asm/y-os2.asm"; | ||
| 57 | $bf_enc_obj="crypto/bf/asm/b-os2$obj"; | ||
| 58 | $bf_enc_src="crypto/bf/asm/b-os2.asm"; | ||
| 59 | $cast_enc_obj="crypto/cast/asm/c-os2$obj"; | ||
| 60 | $cast_enc_src="crypto/cast/asm/c-os2.asm"; | ||
| 61 | $rc4_enc_obj="crypto/rc4/asm/r4-os2$obj"; | ||
| 62 | $rc4_enc_src="crypto/rc4/asm/r4-os2.asm"; | ||
| 63 | $rc5_enc_obj="crypto/rc5/asm/r5-os2$obj"; | ||
| 64 | $rc5_enc_src="crypto/rc5/asm/r5-os2.asm"; | ||
| 65 | $md5_asm_obj="crypto/md5/asm/m5-os2$obj"; | ||
| 66 | $md5_asm_src="crypto/md5/asm/m5-os2.asm"; | ||
| 67 | $sha1_asm_obj="crypto/sha/asm/s1-os2$obj"; | ||
| 68 | $sha1_asm_src="crypto/sha/asm/s1-os2.asm"; | ||
| 69 | $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj"; | ||
| 70 | $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm"; | ||
| 71 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS"; | ||
| 72 | } | ||
| 73 | |||
| 74 | if ($shlib) | ||
| 75 | { | ||
| 76 | $mlflags.=" $lflags -Zdll"; | ||
| 77 | $lib_cflag=" -D_DLL"; | ||
| 78 | $out_def="out_dll"; | ||
| 79 | $tmp_def="tmp_dll"; | ||
| 80 | } | ||
| 81 | |||
| 82 | sub do_lib_rule | ||
| 83 | { | ||
| 84 | local($obj,$target,$name,$shlib)=@_; | ||
| 85 | local($ret,$_,$Name); | ||
| 86 | |||
| 87 | $target =~ s/\//$o/g if $o ne '/'; | ||
| 88 | $target="$target"; | ||
| 89 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 90 | |||
| 91 | $ret.="$target: \$(${Name}OBJ)\n"; | ||
| 92 | if (!$shlib) | ||
| 93 | { | ||
| 94 | $ret.="\t\$(RM) $target\n"; | ||
| 95 | $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n"; | ||
| 96 | $ret.="\t\$(RANLIB) $target\n\n"; | ||
| 97 | } | ||
| 98 | else | ||
| 99 | { | ||
| 100 | local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; | ||
| 101 | $ex.=' -lsocket'; | ||
| 102 | $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n"; | ||
| 103 | $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n"; | ||
| 104 | $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n"; | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | sub do_link_rule | ||
| 109 | { | ||
| 110 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 111 | local($ret,$_); | ||
| 112 | |||
| 113 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 114 | $n=&bname($target); | ||
| 115 | $ret.="$target: $files $dep_libs\n"; | ||
| 116 | $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n"; | ||
| 117 | return($ret); | ||
| 118 | } | ||
| 119 | |||
| 120 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl new file mode 100644 index 0000000000..c3e29fda96 --- /dev/null +++ b/src/lib/libcrypto/util/pl/VC-32.pl | |||
| @@ -0,0 +1,338 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # VC-32.pl - unified script for Microsoft Visual C++, covering Win32, | ||
| 3 | # Win64 and WinCE [follow $FLAVOR variable to trace the differences]. | ||
| 4 | # | ||
| 5 | |||
| 6 | $ssl= "ssleay32"; | ||
| 7 | $crypto="libeay32"; | ||
| 8 | |||
| 9 | $o='\\'; | ||
| 10 | $cp='$(PERL) util/copy.pl'; | ||
| 11 | $mkdir='$(PERL) util/mkdir-p.pl'; | ||
| 12 | $rm='del /Q'; | ||
| 13 | |||
| 14 | $zlib_lib="zlib1.lib"; | ||
| 15 | |||
| 16 | # Santize -L options for ms link | ||
| 17 | $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g; | ||
| 18 | $l_flags =~ s/-L(\S+)/\/libpath:$1/g; | ||
| 19 | |||
| 20 | # C compiler stuff | ||
| 21 | $cc='cl'; | ||
| 22 | if ($FLAVOR =~ /WIN64/) | ||
| 23 | { | ||
| 24 | # Note that we currently don't have /WX on Win64! There is a lot of | ||
| 25 | # warnings, but only of two types: | ||
| 26 | # | ||
| 27 | # C4344: conversion from '__int64' to 'int/long', possible loss of data | ||
| 28 | # C4267: conversion from 'size_t' to 'int/long', possible loss of data | ||
| 29 | # | ||
| 30 | # Amount of latter type is minimized by aliasing strlen to function of | ||
| 31 | # own desing and limiting its return value to 2GB-1 (see e_os.h). As | ||
| 32 | # per 0.9.8 release remaining warnings were explicitly examined and | ||
| 33 | # considered safe to ignore. | ||
| 34 | # | ||
| 35 | $base_cflags= " $mf_cflag"; | ||
| 36 | my $f = $shlib?' /MD':' /MT'; | ||
| 37 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | ||
| 38 | $opt_cflags=$f.' /Ox'; | ||
| 39 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | ||
| 40 | $lflags="/nologo /subsystem:console /opt:ref"; | ||
| 41 | |||
| 42 | *::perlasm_compile_target = sub { | ||
| 43 | my ($target,$source,$bname)=@_; | ||
| 44 | my $ret; | ||
| 45 | |||
| 46 | $bname =~ s/(.*)\.[^\.]$/$1/; | ||
| 47 | $ret=<<___; | ||
| 48 | \$(TMP_D)$o$bname.asm: $source | ||
| 49 | set ASM=\$(ASM) | ||
| 50 | \$(PERL) $source \$\@ | ||
| 51 | |||
| 52 | $target: \$(TMP_D)$o$bname.asm | ||
| 53 | \$(ASM) $afile\$\@ \$(TMP_D)$o$bname.asm | ||
| 54 | |||
| 55 | ___ | ||
| 56 | } | ||
| 57 | } | ||
| 58 | elsif ($FLAVOR =~ /CE/) | ||
| 59 | { | ||
| 60 | # sanity check | ||
| 61 | die '%OSVERSION% is not defined' if (!defined($ENV{'OSVERSION'})); | ||
| 62 | die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'})); | ||
| 63 | die '%TARGETCPU% is not defined' if (!defined($ENV{'TARGETCPU'})); | ||
| 64 | |||
| 65 | # | ||
| 66 | # Idea behind this is to mimic flags set by eVC++ IDE... | ||
| 67 | # | ||
| 68 | $wcevers = $ENV{'OSVERSION'}; # WCENNN | ||
| 69 | die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/); | ||
| 70 | $wcecdefs = "-D_WIN32_WCE=$1$2 -DUNDER_CE=$1$2"; # -D_WIN32_WCE=NNN | ||
| 71 | $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN | ||
| 72 | |||
| 73 | $wceplatf = $ENV{'PLATFORM'}; | ||
| 74 | $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d; | ||
| 75 | $wcecdefs .= " -DWCE_PLATFORM_$wceplatf"; | ||
| 76 | |||
| 77 | $wcetgt = $ENV{'TARGETCPU'}; # just shorter name... | ||
| 78 | SWITCH: for($wcetgt) { | ||
| 79 | /^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_"; | ||
| 80 | $wcelflag.=" /machine:IX86"; last; }; | ||
| 81 | /^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt"; | ||
| 82 | $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/); | ||
| 83 | $wcecdefs.=" -QRarch4T -QRinterwork-return"; | ||
| 84 | $wcelflag.=" /machine:THUMB"; last; }; | ||
| 85 | /^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt"; | ||
| 86 | $wcelflag.=" /machine:ARM"; last; }; | ||
| 87 | /^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt"; | ||
| 88 | $wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32"; | ||
| 89 | $wcelflag.=" /machine:MIPSFPU"; last; }; | ||
| 90 | /^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt"; | ||
| 91 | $wcecdefs.=" -DMIPSII -QMmips16"; | ||
| 92 | $wcelflag.=" /machine:MIPS16"; last; }; | ||
| 93 | /^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt"; | ||
| 94 | $wcecdefs.=" -QMmips2"; | ||
| 95 | $wcelflag.=" /machine:MIPS"; last; }; | ||
| 96 | /^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000"; | ||
| 97 | $wcelflag.=" /machine:MIPS"; last; }; | ||
| 98 | /^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_$wcetgt_ -DSHx"; | ||
| 99 | $wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/); | ||
| 100 | $wcelflag.=" /machine:$wcetgt"; last; }; | ||
| 101 | { $wcecdefs.=" -D$wcetgt -D_$wcetgt_"; | ||
| 102 | $wcelflag.=" /machine:$wcetgt"; last; }; | ||
| 103 | } | ||
| 104 | |||
| 105 | $cc='$(CC)'; | ||
| 106 | $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT'; | ||
| 107 | $base_cflags.=" $wcecdefs"; | ||
| 108 | $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'})); | ||
| 109 | $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'})); | ||
| 110 | $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics... | ||
| 111 | $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG'; | ||
| 112 | $lflags="/nologo /opt:ref $wcelflag"; | ||
| 113 | } | ||
| 114 | else # Win32 | ||
| 115 | { | ||
| 116 | $base_cflags= " $mf_cflag"; | ||
| 117 | my $f = $shlib?' /MD':' /MT'; | ||
| 118 | $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib | ||
| 119 | $opt_cflags=$f.' /Ox /O2 /Ob2'; | ||
| 120 | $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; | ||
| 121 | $lflags="/nologo /subsystem:console /opt:ref"; | ||
| 122 | } | ||
| 123 | $mlflags=''; | ||
| 124 | |||
| 125 | $out_def ="out32"; $out_def.="dll" if ($shlib); | ||
| 126 | $out_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/); | ||
| 127 | $tmp_def ="tmp32"; $tmp_def.="dll" if ($shlib); | ||
| 128 | $tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/); | ||
| 129 | $inc_def="inc32"; | ||
| 130 | |||
| 131 | if ($debug) | ||
| 132 | { | ||
| 133 | $cflags=$dbg_cflags.$base_cflags; | ||
| 134 | } | ||
| 135 | else | ||
| 136 | { | ||
| 137 | $cflags=$opt_cflags.$base_cflags; | ||
| 138 | } | ||
| 139 | |||
| 140 | # generate symbols.pdb unconditionally | ||
| 141 | $app_cflag.=" /Zi /Fd$tmp_def/app"; | ||
| 142 | $lib_cflag.=" /Zi /Fd$tmp_def/lib"; | ||
| 143 | $lflags.=" /debug"; | ||
| 144 | |||
| 145 | $obj='.obj'; | ||
| 146 | $asm_suffix='.asm'; | ||
| 147 | $ofile="/Fo"; | ||
| 148 | |||
| 149 | # EXE linking stuff | ||
| 150 | $link="link"; | ||
| 151 | $rsc="rc"; | ||
| 152 | $efile="/out:"; | ||
| 153 | $exep='.exe'; | ||
| 154 | if ($no_sock) { $ex_libs=''; } | ||
| 155 | elsif ($FLAVOR =~ /CE/) { $ex_libs='winsock.lib'; } | ||
| 156 | else { $ex_libs='ws2_32.lib'; } | ||
| 157 | |||
| 158 | if ($FLAVOR =~ /CE/) | ||
| 159 | { | ||
| 160 | $ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib' if (defined($ENV{'WCECOMPAT'})); | ||
| 161 | $ex_libs.=' $(PORTSDK_LIBPATH)/portlib.lib' if (defined($ENV{'PORTSDK_LIBPATH'})); | ||
| 162 | $ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86"); | ||
| 163 | } | ||
| 164 | else | ||
| 165 | { | ||
| 166 | $ex_libs.=' gdi32.lib advapi32.lib crypt32.lib user32.lib'; | ||
| 167 | $ex_libs.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/ and `cl 2>&1` =~ /14\.00\.4[0-9]{4}\./); | ||
| 168 | # WIN32 UNICODE build gets linked with unicows.lib for | ||
| 169 | # backward compatibility with Win9x. | ||
| 170 | $ex_libs="unicows.lib $ex_libs" if ($FLAVOR =~ /WIN32/ and $cflags =~ /\-DUNICODE/); | ||
| 171 | } | ||
| 172 | |||
| 173 | # static library stuff | ||
| 174 | $mklib='lib /nologo'; | ||
| 175 | $ranlib=''; | ||
| 176 | $plib=""; | ||
| 177 | $libp=".lib"; | ||
| 178 | $shlibp=($shlib)?".dll":".lib"; | ||
| 179 | $lfile='/out:'; | ||
| 180 | |||
| 181 | $shlib_ex_obj=""; | ||
| 182 | $app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/); | ||
| 183 | if ($FLAVOR =~ /WIN64A/) { | ||
| 184 | if (`nasm -v 2>NUL` =~ /NASM version ([0-9]+\.[0-9]+)/ && $1 >= 2.0) { | ||
| 185 | $asm='nasm -f win64 -DNEAR -Ox -g'; | ||
| 186 | $afile='-o '; | ||
| 187 | } else { | ||
| 188 | $asm='ml64 /c /Cp /Cx /Zi'; | ||
| 189 | $afile='/Fo'; | ||
| 190 | } | ||
| 191 | } elsif ($FLAVOR =~ /WIN64I/) { | ||
| 192 | $asm='ias -d debug'; | ||
| 193 | $afile="-o "; | ||
| 194 | } elsif ($nasm) { | ||
| 195 | my $ver=`nasm -v 2>NUL`; | ||
| 196 | my $vew=`nasmw -v 2>NUL`; | ||
| 197 | # pick newest version | ||
| 198 | $asm=($ver gt $vew?"nasm":"nasmw")." -f win32"; | ||
| 199 | $asmtype="win32n"; | ||
| 200 | $afile='-o '; | ||
| 201 | } else { | ||
| 202 | $asm='ml /nologo /Cp /coff /c /Cx /Zi'; | ||
| 203 | $afile='/Fo'; | ||
| 204 | $asmtype="win32"; | ||
| 205 | } | ||
| 206 | |||
| 207 | $bn_asm_obj=''; | ||
| 208 | $bn_asm_src=''; | ||
| 209 | $des_enc_obj=''; | ||
| 210 | $des_enc_src=''; | ||
| 211 | $bf_enc_obj=''; | ||
| 212 | $bf_enc_src=''; | ||
| 213 | |||
| 214 | if (!$no_asm) | ||
| 215 | { | ||
| 216 | win32_import_asm($mf_bn_asm, "bn", \$bn_asm_obj, \$bn_asm_src); | ||
| 217 | win32_import_asm($mf_aes_asm, "aes", \$aes_asm_obj, \$aes_asm_src); | ||
| 218 | win32_import_asm($mf_des_asm, "des", \$des_enc_obj, \$des_enc_src); | ||
| 219 | win32_import_asm($mf_bf_asm, "bf", \$bf_enc_obj, \$bf_enc_src); | ||
| 220 | win32_import_asm($mf_cast_asm, "cast", \$cast_enc_obj, \$cast_enc_src); | ||
| 221 | win32_import_asm($mf_rc4_asm, "rc4", \$rc4_enc_obj, \$rc4_enc_src); | ||
| 222 | win32_import_asm($mf_rc5_asm, "rc5", \$rc5_enc_obj, \$rc5_enc_src); | ||
| 223 | win32_import_asm($mf_md5_asm, "md5", \$md5_asm_obj, \$md5_asm_src); | ||
| 224 | win32_import_asm($mf_sha_asm, "sha", \$sha1_asm_obj, \$sha1_asm_src); | ||
| 225 | win32_import_asm($mf_rmd_asm, "ripemd", \$rmd160_asm_obj, \$rmd160_asm_src); | ||
| 226 | win32_import_asm($mf_wp_asm, "whrlpool", \$whirlpool_asm_obj, \$whirlpool_asm_src); | ||
| 227 | win32_import_asm($mf_cpuid_asm, "", \$cpuid_asm_obj, \$cpuid_asm_src); | ||
| 228 | $perl_asm = 1; | ||
| 229 | } | ||
| 230 | |||
| 231 | if ($shlib && $FLAVOR !~ /CE/) | ||
| 232 | { | ||
| 233 | $mlflags.=" $lflags /dll"; | ||
| 234 | $lib_cflag.=" -D_WINDLL"; | ||
| 235 | # | ||
| 236 | # Engage Applink... | ||
| 237 | # | ||
| 238 | $app_ex_obj.=" \$(OBJ_D)\\applink.obj /implib:\$(TMP_D)\\junk.lib"; | ||
| 239 | $cflags.=" -DOPENSSL_USE_APPLINK -I."; | ||
| 240 | # I'm open for better suggestions than overriding $banner... | ||
| 241 | $banner=<<'___'; | ||
| 242 | @echo Building OpenSSL | ||
| 243 | |||
| 244 | $(OBJ_D)\applink.obj: ms\applink.c | ||
| 245 | $(CC) /Fo$(OBJ_D)\applink.obj $(APP_CFLAGS) -c ms\applink.c | ||
| 246 | $(OBJ_D)\uplink.obj: ms\uplink.c ms\applink.c | ||
| 247 | $(CC) /Fo$(OBJ_D)\uplink.obj $(SHLIB_CFLAGS) -c ms\uplink.c | ||
| 248 | $(INCO_D)\applink.c: ms\applink.c | ||
| 249 | $(CP) ms\applink.c $(INCO_D)\applink.c | ||
| 250 | |||
| 251 | EXHEADER= $(EXHEADER) $(INCO_D)\applink.c | ||
| 252 | |||
| 253 | LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj | ||
| 254 | CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ) | ||
| 255 | ___ | ||
| 256 | $banner.=<<'___' if ($FLAVOR =~ /WIN64/); | ||
| 257 | CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ) | ||
| 258 | ___ | ||
| 259 | } | ||
| 260 | elsif ($shlib && $FLAVOR =~ /CE/) | ||
| 261 | { | ||
| 262 | $mlflags.=" $lflags /dll"; | ||
| 263 | $lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'})); | ||
| 264 | $lib_cflag.=" -D_WINDLL -D_DLL"; | ||
| 265 | } | ||
| 266 | |||
| 267 | sub do_lib_rule | ||
| 268 | { | ||
| 269 | local($objs,$target,$name,$shlib)=@_; | ||
| 270 | local($ret); | ||
| 271 | |||
| 272 | $taget =~ s/\//$o/g if $o ne '/'; | ||
| 273 | if ($name ne "") | ||
| 274 | { | ||
| 275 | $name =~ tr/a-z/A-Z/; | ||
| 276 | $name = "/def:ms/${name}.def"; | ||
| 277 | } | ||
| 278 | |||
| 279 | # $target="\$(LIB_D)$o$target"; | ||
| 280 | $ret.="$target: $objs\n"; | ||
| 281 | if (!$shlib) | ||
| 282 | { | ||
| 283 | # $ret.="\t\$(RM) \$(O_$Name)\n"; | ||
| 284 | $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs\n<<\n"; | ||
| 285 | } | ||
| 286 | else | ||
| 287 | { | ||
| 288 | local($ex)=($target =~ /O_CRYPTO/)?'':' $(L_CRYPTO)'; | ||
| 289 | $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; | ||
| 290 | $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n"; | ||
| 291 | $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; | ||
| 292 | } | ||
| 293 | $ret.="\n"; | ||
| 294 | return($ret); | ||
| 295 | } | ||
| 296 | |||
| 297 | sub do_link_rule | ||
| 298 | { | ||
| 299 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 300 | local($ret,$_); | ||
| 301 | |||
| 302 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 303 | $n=&bname($targer); | ||
| 304 | $ret.="$target: $files $dep_libs\n"; | ||
| 305 | $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n"; | ||
| 306 | $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; | ||
| 307 | $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n"; | ||
| 308 | return($ret); | ||
| 309 | } | ||
| 310 | |||
| 311 | sub win32_import_asm | ||
| 312 | { | ||
| 313 | my ($mf_var, $asm_name, $oref, $sref) = @_; | ||
| 314 | my $asm_dir; | ||
| 315 | if ($asm_name eq "") | ||
| 316 | { | ||
| 317 | $asm_dir = "crypto\\"; | ||
| 318 | } | ||
| 319 | else | ||
| 320 | { | ||
| 321 | $asm_dir = "crypto\\$asm_name\\asm\\"; | ||
| 322 | } | ||
| 323 | |||
| 324 | $$oref = ""; | ||
| 325 | $mf_var =~ s/\.o$/.obj/g; | ||
| 326 | |||
| 327 | foreach (split(/ /, $mf_var)) | ||
| 328 | { | ||
| 329 | $$oref .= $asm_dir . $_ . " "; | ||
| 330 | } | ||
| 331 | $$oref =~ s/ $//; | ||
| 332 | $$sref = $$oref; | ||
| 333 | $$sref =~ s/\.obj/.asm/g; | ||
| 334 | |||
| 335 | } | ||
| 336 | |||
| 337 | |||
| 338 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/linux.pl b/src/lib/libcrypto/util/pl/linux.pl new file mode 100644 index 0000000000..d24f7b7291 --- /dev/null +++ b/src/lib/libcrypto/util/pl/linux.pl | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # linux.pl - the standard unix makefile stuff. | ||
| 4 | # | ||
| 5 | |||
| 6 | $o='/'; | ||
| 7 | $cp='/bin/cp'; | ||
| 8 | $rm='/bin/rm -f'; | ||
| 9 | |||
| 10 | # C compiler stuff | ||
| 11 | |||
| 12 | $cc='gcc'; | ||
| 13 | if ($debug) | ||
| 14 | { $cflags="-g2 -ggdb -DREF_CHECK -DCRYPTO_MDEBUG"; } | ||
| 15 | elsif ($profile) | ||
| 16 | { $cflags="-pg -O3"; } | ||
| 17 | else | ||
| 18 | { $cflags="-O3 -fomit-frame-pointer"; } | ||
| 19 | |||
| 20 | if (!$no_asm) | ||
| 21 | { | ||
| 22 | $bn_asm_obj='$(OBJ_D)/bn86-elf.o'; | ||
| 23 | $bn_asm_src='crypto/bn/asm/bn86unix.cpp'; | ||
| 24 | $bnco_asm_obj='$(OBJ_D)/co86-elf.o'; | ||
| 25 | $bnco_asm_src='crypto/bn/asm/co86unix.cpp'; | ||
| 26 | $des_enc_obj='$(OBJ_D)/dx86-elf.o $(OBJ_D)/yx86-elf.o'; | ||
| 27 | $des_enc_src='crypto/des/asm/dx86unix.cpp crypto/des/asm/yx86unix.cpp'; | ||
| 28 | $bf_enc_obj='$(OBJ_D)/bx86-elf.o'; | ||
| 29 | $bf_enc_src='crypto/bf/asm/bx86unix.cpp'; | ||
| 30 | $cast_enc_obj='$(OBJ_D)/cx86-elf.o'; | ||
| 31 | $cast_enc_src='crypto/cast/asm/cx86unix.cpp'; | ||
| 32 | $rc4_enc_obj='$(OBJ_D)/rx86-elf.o'; | ||
| 33 | $rc4_enc_src='crypto/rc4/asm/rx86unix.cpp'; | ||
| 34 | $rc5_enc_obj='$(OBJ_D)/r586-elf.o'; | ||
| 35 | $rc5_enc_src='crypto/rc5/asm/r586unix.cpp'; | ||
| 36 | $md5_asm_obj='$(OBJ_D)/mx86-elf.o'; | ||
| 37 | $md5_asm_src='crypto/md5/asm/mx86unix.cpp'; | ||
| 38 | $rmd160_asm_obj='$(OBJ_D)/rm86-elf.o'; | ||
| 39 | $rmd160_asm_src='crypto/ripemd/asm/rm86unix.cpp'; | ||
| 40 | $sha1_asm_obj='$(OBJ_D)/sx86-elf.o'; | ||
| 41 | $sha1_asm_src='crypto/sha/asm/sx86unix.cpp'; | ||
| 42 | $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS"; | ||
| 43 | } | ||
| 44 | |||
| 45 | $cflags.=" -DTERMIO -DL_ENDIAN -m486 -Wall"; | ||
| 46 | |||
| 47 | if ($shlib) | ||
| 48 | { | ||
| 49 | $shl_cflag=" -DPIC -fpic"; | ||
| 50 | $shlibp=".so.$ssl_version"; | ||
| 51 | $so_shlibp=".so"; | ||
| 52 | } | ||
| 53 | |||
| 54 | sub do_shlib_rule | ||
| 55 | { | ||
| 56 | local($obj,$target,$name,$shlib,$so_name)=@_; | ||
| 57 | local($ret,$_,$Name); | ||
| 58 | |||
| 59 | $target =~ s/\//$o/g if $o ne '/'; | ||
| 60 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 61 | |||
| 62 | $ret.="$target: \$(${Name}OBJ)\n"; | ||
| 63 | $ret.="\t\$(RM) target\n"; | ||
| 64 | $ret.="\tgcc \${CFLAGS} -shared -Wl,-soname,$target -o $target \$(${Name}OBJ)\n"; | ||
| 65 | ($t=$target) =~ s/(^.*)\/[^\/]*$/$1/; | ||
| 66 | if ($so_name ne "") | ||
| 67 | { | ||
| 68 | $ret.="\t\$(RM) \$(LIB_D)$o$so_name\n"; | ||
| 69 | $ret.="\tln -s $target \$(LIB_D)$o$so_name\n\n"; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | sub do_link_rule | ||
| 74 | { | ||
| 75 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 76 | local($ret,$_); | ||
| 77 | |||
| 78 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 79 | $n=&bname($target); | ||
| 80 | $ret.="$target: $files $dep_libs\n"; | ||
| 81 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | ||
| 82 | return($ret); | ||
| 83 | } | ||
| 84 | |||
| 85 | sub do_asm_rule | ||
| 86 | { | ||
| 87 | local($target,$src)=@_; | ||
| 88 | local($ret,@s,@t,$i); | ||
| 89 | |||
| 90 | $target =~ s/\//$o/g if $o ne "/"; | ||
| 91 | $src =~ s/\//$o/g if $o ne "/"; | ||
| 92 | |||
| 93 | @s=split(/\s+/,$src); | ||
| 94 | @t=split(/\s+/,$target); | ||
| 95 | |||
| 96 | for ($i=0; $i<=$#s; $i++) | ||
| 97 | { | ||
| 98 | $ret.="$t[$i]: $s[$i]\n"; | ||
| 99 | $ret.="\tgcc -E -DELF \$(SRC_D)$o$s[$i]|\$(AS) $afile$t[$i]\n\n"; | ||
| 100 | } | ||
| 101 | return($ret); | ||
| 102 | } | ||
| 103 | |||
| 104 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/netware.pl b/src/lib/libcrypto/util/pl/netware.pl new file mode 100644 index 0000000000..c78bcfc874 --- /dev/null +++ b/src/lib/libcrypto/util/pl/netware.pl | |||
| @@ -0,0 +1,532 @@ | |||
| 1 | # Metrowerks Codewarrior or gcc / nlmconv for NetWare | ||
| 2 | # | ||
| 3 | |||
| 4 | $version_header = "crypto/opensslv.h"; | ||
| 5 | open(IN, "$version_header") or die "Couldn't open $version_header: $!"; | ||
| 6 | while (<IN>) { | ||
| 7 | if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/) | ||
| 8 | { | ||
| 9 | # die "OpenSSL version detected: $1.$2.$3.$4\n"; | ||
| 10 | #$nlmvernum = "$1,$2,$3"; | ||
| 11 | $nlmvernum = "$1,".($2*10+$3).",".($4*1); | ||
| 12 | #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):""); | ||
| 13 | break; | ||
| 14 | } | ||
| 15 | } | ||
| 16 | close(IN) or die "Couldn't close $version_header: $!"; | ||
| 17 | |||
| 18 | $readme_file = "README"; | ||
| 19 | open(IN, $readme_file) or die "Couldn't open $readme_file: $!"; | ||
| 20 | while (<IN>) { | ||
| 21 | if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/) | ||
| 22 | { | ||
| 23 | #$nlmvernum = "$1,$2,$3"; | ||
| 24 | #$nlmvernum = "$1,".($2*10+$3).",".($4*1); | ||
| 25 | $nlmverstr = "$1.$2.$3$4$5"; | ||
| 26 | } | ||
| 27 | elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/) | ||
| 28 | { | ||
| 29 | $nlmcpystr = $1; | ||
| 30 | } | ||
| 31 | break if ($nlmvernum && $nlmcpystr); | ||
| 32 | } | ||
| 33 | close(IN) or die "Couldn't close $readme_file: $!"; | ||
| 34 | |||
| 35 | # Define stacksize here | ||
| 36 | $nlmstack = "32768"; | ||
| 37 | |||
| 38 | # some default settings here in case we failed to find them in README | ||
| 39 | $nlmvernum = "1,0,0" if (!$nlmvernum); | ||
| 40 | $nlmverstr = "OpenSSL" if (!$nlmverstr); | ||
| 41 | $nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr); | ||
| 42 | |||
| 43 | # die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n"; | ||
| 44 | |||
| 45 | # The import files and other misc imports needed to link | ||
| 46 | @misc_imports = ("GetProcessSwitchCount", "RunningProcess", | ||
| 47 | "GetSuperHighResolutionTimer"); | ||
| 48 | if ($LIBC) | ||
| 49 | { | ||
| 50 | @import_files = ("libc.imp"); | ||
| 51 | @module_files = ("libc"); | ||
| 52 | $libarch = "LIBC"; | ||
| 53 | } | ||
| 54 | else | ||
| 55 | { | ||
| 56 | # clib build | ||
| 57 | @import_files = ("clib.imp"); | ||
| 58 | push(@import_files, "socklib.imp") if ($BSDSOCK); | ||
| 59 | @module_files = ("clib"); | ||
| 60 | # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16"); | ||
| 61 | $libarch = "CLIB"; | ||
| 62 | } | ||
| 63 | if ($BSDSOCK) | ||
| 64 | { | ||
| 65 | $libarch .= "-BSD"; | ||
| 66 | } | ||
| 67 | else | ||
| 68 | { | ||
| 69 | $libarch .= "-WS2"; | ||
| 70 | push(@import_files, "ws2nlm.imp"); | ||
| 71 | } | ||
| 72 | |||
| 73 | # The "IMPORTS" environment variable must be set and point to the location | ||
| 74 | # where import files (*.imp) can be found. | ||
| 75 | # Example: set IMPORTS=c:\ndk\nwsdk\imports | ||
| 76 | $import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n"); | ||
| 77 | |||
| 78 | |||
| 79 | # The "PRELUDE" environment variable must be set and point to the location | ||
| 80 | # and name of the prelude source to link with ( nwpre.obj is recommended ). | ||
| 81 | # Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj | ||
| 82 | $prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n"); | ||
| 83 | |||
| 84 | # The "INCLUDES" environment variable must be set and point to the location | ||
| 85 | # where import files (*.imp) can be found. | ||
| 86 | $include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n"); | ||
| 87 | $include_path =~ s/\\/\//g; | ||
| 88 | $include_path = join(" -I", split(/;/, $include_path)); | ||
| 89 | |||
| 90 | # check for gcc compiler | ||
| 91 | $gnuc = $ENV{"GNUC"}; | ||
| 92 | |||
| 93 | #$ssl= "ssleay32"; | ||
| 94 | #$crypto="libeay32"; | ||
| 95 | |||
| 96 | if ($gnuc) | ||
| 97 | { | ||
| 98 | # C compiler | ||
| 99 | $cc='gcc'; | ||
| 100 | # Linker | ||
| 101 | $link='nlmconv'; | ||
| 102 | # librarian | ||
| 103 | $mklib='ar'; | ||
| 104 | $o='/'; | ||
| 105 | # cp command | ||
| 106 | $cp='cp -af'; | ||
| 107 | # rm command | ||
| 108 | $rm='rm -f'; | ||
| 109 | # mv command | ||
| 110 | $mv='mv -f'; | ||
| 111 | # mkdir command | ||
| 112 | $mkdir='gmkdir'; | ||
| 113 | #$ranlib='ranlib'; | ||
| 114 | } | ||
| 115 | else | ||
| 116 | { | ||
| 117 | # C compiler | ||
| 118 | $cc='mwccnlm'; | ||
| 119 | # Linker | ||
| 120 | $link='mwldnlm'; | ||
| 121 | # librarian | ||
| 122 | $mklib='mwldnlm'; | ||
| 123 | # Path separator | ||
| 124 | $o='\\'; | ||
| 125 | # cp command | ||
| 126 | $cp='copy >nul:'; | ||
| 127 | # rm command | ||
| 128 | $rm='del /f /q'; | ||
| 129 | } | ||
| 130 | |||
| 131 | # assembler | ||
| 132 | if ($nw_nasm) | ||
| 133 | { | ||
| 134 | $asm=(`nasm -v 2>NUL` gt `nasmw -v 2>NUL`?"nasm":"nasmw"); | ||
| 135 | if ($gnuc) | ||
| 136 | { | ||
| 137 | $asm.=" -s -f elf"; | ||
| 138 | } | ||
| 139 | else | ||
| 140 | { | ||
| 141 | $asm.=" -s -f coff -d __coff__"; | ||
| 142 | } | ||
| 143 | $afile="-o "; | ||
| 144 | $asm.=" -g" if $debug; | ||
| 145 | } | ||
| 146 | elsif ($nw_mwasm) | ||
| 147 | { | ||
| 148 | $asm="mwasmnlm -maxerrors 20"; | ||
| 149 | $afile="-o "; | ||
| 150 | $asm.=" -g" if $debug; | ||
| 151 | } | ||
| 152 | elsif ($nw_masm) | ||
| 153 | { | ||
| 154 | # masm assembly settings - it should be possible to use masm but haven't | ||
| 155 | # got it working. | ||
| 156 | # $asm='ml /Cp /coff /c /Cx'; | ||
| 157 | # $asm.=" /Zi" if $debug; | ||
| 158 | # $afile='/Fo'; | ||
| 159 | die("Support for masm assembler not yet functional\n"); | ||
| 160 | } | ||
| 161 | else | ||
| 162 | { | ||
| 163 | $asm=""; | ||
| 164 | $afile=""; | ||
| 165 | } | ||
| 166 | |||
| 167 | |||
| 168 | |||
| 169 | if ($gnuc) | ||
| 170 | { | ||
| 171 | # compile flags for GNUC | ||
| 172 | # additional flags based upon debug | non-debug | ||
| 173 | if ($debug) | ||
| 174 | { | ||
| 175 | $cflags="-g -DDEBUG"; | ||
| 176 | } | ||
| 177 | else | ||
| 178 | { | ||
| 179 | $cflags="-O2"; | ||
| 180 | } | ||
| 181 | $cflags.=" -nostdinc -I$include_path \\ | ||
| 182 | -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\ | ||
| 183 | -funsigned-char -Wall -Wno-unused -Wno-uninitialized"; | ||
| 184 | |||
| 185 | # link flags | ||
| 186 | $lflags="-T"; | ||
| 187 | } | ||
| 188 | else | ||
| 189 | { | ||
| 190 | # compile flags for CodeWarrior | ||
| 191 | # additional flags based upon debug | non-debug | ||
| 192 | if ($debug) | ||
| 193 | { | ||
| 194 | $cflags="-opt off -g -sym internal -DDEBUG"; | ||
| 195 | } | ||
| 196 | else | ||
| 197 | { | ||
| 198 | # CodeWarrior compiler has a problem with optimizations for floating | ||
| 199 | # points - no optimizations until further investigation | ||
| 200 | # $cflags="-opt all"; | ||
| 201 | } | ||
| 202 | |||
| 203 | # NOTES: Several c files in the crypto subdirectory include headers from | ||
| 204 | # their local directories. Metrowerks wouldn't find these h files | ||
| 205 | # without adding individual include directives as compile flags | ||
| 206 | # or modifying the c files. Instead of adding individual include | ||
| 207 | # paths for each subdirectory a recursive include directive | ||
| 208 | # is used ( -ir crypto ). | ||
| 209 | # | ||
| 210 | # A similar issue exists for the engines and apps subdirectories. | ||
| 211 | # | ||
| 212 | # Turned off the "possible" warnings ( -w nopossible ). Metrowerks | ||
| 213 | # complained a lot about various stuff. May want to turn back | ||
| 214 | # on for further development. | ||
| 215 | $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\ | ||
| 216 | -msgstyle gcc -align 4 -processor pentium -char unsigned \\ | ||
| 217 | -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\ | ||
| 218 | -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20"; | ||
| 219 | |||
| 220 | # link flags | ||
| 221 | $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile"; | ||
| 222 | } | ||
| 223 | |||
| 224 | # common defines | ||
| 225 | $cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32"; | ||
| 226 | |||
| 227 | # If LibC build add in NKS_LIBC define and set the entry/exit | ||
| 228 | # routines - The default entry/exit routines are for CLib and don't exist | ||
| 229 | # in LibC | ||
| 230 | if ($LIBC) | ||
| 231 | { | ||
| 232 | $cflags.=" -DNETWARE_LIBC"; | ||
| 233 | $nlmstart = "_LibCPrelude"; | ||
| 234 | $nlmexit = "_LibCPostlude"; | ||
| 235 | @nlm_flags = ("pseudopreemption", "flag_on 64"); | ||
| 236 | } | ||
| 237 | else | ||
| 238 | { | ||
| 239 | $cflags.=" -DNETWARE_CLIB"; | ||
| 240 | $nlmstart = "_Prelude"; | ||
| 241 | $nlmexit = "_Stop"; | ||
| 242 | } | ||
| 243 | |||
| 244 | # If BSD Socket support is requested, set a define for the compiler | ||
| 245 | if ($BSDSOCK) | ||
| 246 | { | ||
| 247 | $cflags.=" -DNETWARE_BSDSOCK"; | ||
| 248 | if (!$LIBC) | ||
| 249 | { | ||
| 250 | $cflags.=" -DNETDB_USE_INTERNET"; | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | |||
| 255 | # linking stuff | ||
| 256 | # for the output directories use the mk1mf.pl values with "_nw" appended | ||
| 257 | if ($shlib) | ||
| 258 | { | ||
| 259 | if ($LIBC) | ||
| 260 | { | ||
| 261 | $out_def.="_nw_libc_nlm"; | ||
| 262 | $tmp_def.="_nw_libc_nlm"; | ||
| 263 | $inc_def.="_nw_libc_nlm"; | ||
| 264 | } | ||
| 265 | else # NETWARE_CLIB | ||
| 266 | { | ||
| 267 | $out_def.="_nw_clib_nlm"; | ||
| 268 | $tmp_def.="_nw_clib_nlm"; | ||
| 269 | $inc_def.="_nw_clib_nlm"; | ||
| 270 | } | ||
| 271 | } | ||
| 272 | else | ||
| 273 | { | ||
| 274 | if ($gnuc) # GNUC Tools | ||
| 275 | { | ||
| 276 | $libp=".a"; | ||
| 277 | $shlibp=".a"; | ||
| 278 | $lib_flags="-cr"; | ||
| 279 | } | ||
| 280 | else # CodeWarrior | ||
| 281 | { | ||
| 282 | $libp=".lib"; | ||
| 283 | $shlibp=".lib"; | ||
| 284 | $lib_flags="-nodefaults -type library -o"; | ||
| 285 | } | ||
| 286 | if ($LIBC) | ||
| 287 | { | ||
| 288 | $out_def.="_nw_libc"; | ||
| 289 | $tmp_def.="_nw_libc"; | ||
| 290 | $inc_def.="_nw_libc"; | ||
| 291 | } | ||
| 292 | else # NETWARE_CLIB | ||
| 293 | { | ||
| 294 | $out_def.="_nw_clib"; | ||
| 295 | $tmp_def.="_nw_clib"; | ||
| 296 | $inc_def.="_nw_clib"; | ||
| 297 | } | ||
| 298 | } | ||
| 299 | |||
| 300 | # used by mk1mf.pl | ||
| 301 | $obj='.o'; | ||
| 302 | $ofile='-o '; | ||
| 303 | $efile=''; | ||
| 304 | $exep='.nlm'; | ||
| 305 | $ex_libs=''; | ||
| 306 | |||
| 307 | if (!$no_asm) | ||
| 308 | { | ||
| 309 | $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}"; | ||
| 310 | $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm"; | ||
| 311 | $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}"; | ||
| 312 | $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm"; | ||
| 313 | $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}"; | ||
| 314 | $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm"; | ||
| 315 | $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}"; | ||
| 316 | $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm"; | ||
| 317 | $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}"; | ||
| 318 | $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm"; | ||
| 319 | $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}"; | ||
| 320 | $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm"; | ||
| 321 | $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}"; | ||
| 322 | $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm"; | ||
| 323 | $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}"; | ||
| 324 | $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm"; | ||
| 325 | $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}"; | ||
| 326 | $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm"; | ||
| 327 | $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj} \$(OBJ_D)${o}sha256-nw${obj} \$(OBJ_D)${o}sha512-nw${obj}"; | ||
| 328 | $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm crypto${o}sha${o}asm${o}sha256-nw.asm crypto${o}sha${o}asm${o}sha512-nw.asm"; | ||
| 329 | $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}"; | ||
| 330 | $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm"; | ||
| 331 | $whirlpool_asm_obj="\$(OBJ_D)${o}wp-nw${obj}"; | ||
| 332 | $whirlpool_asm_src="crypto${o}whrlpool${o}asm${o}wp-nw.asm"; | ||
| 333 | $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}"; | ||
| 334 | $cpuid_asm_src="crypto${o}x86cpuid-nw.asm"; | ||
| 335 | $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DWHIRLPOOL_ASM"; | ||
| 336 | $cflags.=" -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM"; | ||
| 337 | $cflags.=" -DAES_ASM -DRMD160_ASM"; | ||
| 338 | } | ||
| 339 | else | ||
| 340 | { | ||
| 341 | $bn_asm_obj=''; | ||
| 342 | $bn_asm_src=''; | ||
| 343 | $bnco_asm_obj=''; | ||
| 344 | $bnco_asm_src=''; | ||
| 345 | $aes_asm_obj=''; | ||
| 346 | $aes_asm_src=''; | ||
| 347 | $des_enc_obj=''; | ||
| 348 | $des_enc_src=''; | ||
| 349 | $bf_enc_obj=''; | ||
| 350 | $bf_enc_src=''; | ||
| 351 | $cast_enc_obj=''; | ||
| 352 | $cast_enc_src=''; | ||
| 353 | $rc4_enc_obj=''; | ||
| 354 | $rc4_enc_src=''; | ||
| 355 | $rc5_enc_obj=''; | ||
| 356 | $rc5_enc_src=''; | ||
| 357 | $md5_asm_obj=''; | ||
| 358 | $md5_asm_src=''; | ||
| 359 | $sha1_asm_obj=''; | ||
| 360 | $sha1_asm_src=''; | ||
| 361 | $rmd160_asm_obj=''; | ||
| 362 | $rmd160_asm_src=''; | ||
| 363 | $whirlpool_asm_obj=''; | ||
| 364 | $whirlpool_asm_src=''; | ||
| 365 | $cpuid_asm_obj=''; | ||
| 366 | $cpuid_asm_src=''; | ||
| 367 | } | ||
| 368 | |||
| 369 | # create the *.def linker command files in \openssl\netware\ directory | ||
| 370 | sub do_def_file | ||
| 371 | { | ||
| 372 | # strip off the leading path | ||
| 373 | my($target) = bname(shift); | ||
| 374 | my($i); | ||
| 375 | |||
| 376 | if ($target =~ /(.*).nlm/) | ||
| 377 | { | ||
| 378 | $target = $1; | ||
| 379 | } | ||
| 380 | |||
| 381 | # special case for openssl - the mk1mf.pl defines E_EXE = openssl | ||
| 382 | if ($target =~ /E_EXE/) | ||
| 383 | { | ||
| 384 | $target =~ s/\$\(E_EXE\)/openssl/; | ||
| 385 | } | ||
| 386 | |||
| 387 | # Note: originally tried to use full path ( \openssl\netware\$target.def ) | ||
| 388 | # Metrowerks linker choked on this with an assertion failure. bug??? | ||
| 389 | # | ||
| 390 | my($def_file) = "netware${o}$target.def"; | ||
| 391 | |||
| 392 | open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n"); | ||
| 393 | |||
| 394 | print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" ); | ||
| 395 | print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" ); | ||
| 396 | print( DEF_OUT "#\n"); | ||
| 397 | print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n"); | ||
| 398 | print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n"); | ||
| 399 | print( DEF_OUT "VERSION $nlmvernum\n"); | ||
| 400 | print( DEF_OUT "STACK $nlmstack\n"); | ||
| 401 | print( DEF_OUT "START $nlmstart\n"); | ||
| 402 | print( DEF_OUT "EXIT $nlmexit\n"); | ||
| 403 | |||
| 404 | # special case for openssl | ||
| 405 | if ($target eq "openssl") | ||
| 406 | { | ||
| 407 | print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n"); | ||
| 408 | } | ||
| 409 | else | ||
| 410 | { | ||
| 411 | print( DEF_OUT "SCREENNAME \"DEFAULT\"\n"); | ||
| 412 | } | ||
| 413 | |||
| 414 | foreach $i (@misc_imports) | ||
| 415 | { | ||
| 416 | print( DEF_OUT "IMPORT $i\n"); | ||
| 417 | } | ||
| 418 | |||
| 419 | foreach $i (@import_files) | ||
| 420 | { | ||
| 421 | print( DEF_OUT "IMPORT \@$import_path${o}$i\n"); | ||
| 422 | } | ||
| 423 | |||
| 424 | foreach $i (@module_files) | ||
| 425 | { | ||
| 426 | print( DEF_OUT "MODULE $i\n"); | ||
| 427 | } | ||
| 428 | |||
| 429 | foreach $i (@nlm_flags) | ||
| 430 | { | ||
| 431 | print( DEF_OUT "$i\n"); | ||
| 432 | } | ||
| 433 | |||
| 434 | if ($gnuc) | ||
| 435 | { | ||
| 436 | if ($target =~ /openssl/) | ||
| 437 | { | ||
| 438 | print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n"); | ||
| 439 | print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n"); | ||
| 440 | } | ||
| 441 | else | ||
| 442 | { | ||
| 443 | print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n"); | ||
| 444 | } | ||
| 445 | print( DEF_OUT "INPUT $prelude\n"); | ||
| 446 | print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n"); | ||
| 447 | print( DEF_OUT "OUTPUT $target.nlm\n"); | ||
| 448 | } | ||
| 449 | |||
| 450 | close(DEF_OUT); | ||
| 451 | return($def_file); | ||
| 452 | } | ||
| 453 | |||
| 454 | sub do_lib_rule | ||
| 455 | { | ||
| 456 | my($objs,$target,$name,$shlib)=@_; | ||
| 457 | my($ret); | ||
| 458 | |||
| 459 | $ret.="$target: $objs\n"; | ||
| 460 | if (!$shlib) | ||
| 461 | { | ||
| 462 | $ret.="\t\@echo Building Lib: $name\n"; | ||
| 463 | $ret.="\t\$(MKLIB) $lib_flags $target $objs\n"; | ||
| 464 | $ret.="\t\@echo .\n" | ||
| 465 | } | ||
| 466 | else | ||
| 467 | { | ||
| 468 | die( "Building as NLM not currently supported!" ); | ||
| 469 | } | ||
| 470 | |||
| 471 | $ret.="\n"; | ||
| 472 | return($ret); | ||
| 473 | } | ||
| 474 | |||
| 475 | sub do_link_rule | ||
| 476 | { | ||
| 477 | my($target,$files,$dep_libs,$libs)=@_; | ||
| 478 | my($ret); | ||
| 479 | my($def_file) = do_def_file($target); | ||
| 480 | |||
| 481 | $ret.="$target: $files $dep_libs\n"; | ||
| 482 | |||
| 483 | # NOTE: When building the test nlms no screen name is given | ||
| 484 | # which causes the console screen to be used. By using the console | ||
| 485 | # screen there is no "<press any key to continue>" message which | ||
| 486 | # requires user interaction. The test script ( do_tests.pl ) needs | ||
| 487 | # to be able to run the tests without requiring user interaction. | ||
| 488 | # | ||
| 489 | # However, the sample program "openssl.nlm" is used by the tests and is | ||
| 490 | # a interactive sample so a screen is desired when not be run by the | ||
| 491 | # tests. To solve the problem, two versions of the program are built: | ||
| 492 | # openssl2 - no screen used by tests | ||
| 493 | # openssl - default screen - use for normal interactive modes | ||
| 494 | # | ||
| 495 | |||
| 496 | # special case for openssl - the mk1mf.pl defines E_EXE = openssl | ||
| 497 | if ($target =~ /E_EXE/) | ||
| 498 | { | ||
| 499 | my($target2) = $target; | ||
| 500 | |||
| 501 | $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/; | ||
| 502 | |||
| 503 | # openssl2 | ||
| 504 | my($def_file2) = do_def_file($target2); | ||
| 505 | |||
| 506 | if ($gnuc) | ||
| 507 | { | ||
| 508 | $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n"; | ||
| 509 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n"; | ||
| 510 | $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n"; | ||
| 511 | } | ||
| 512 | else | ||
| 513 | { | ||
| 514 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n"; | ||
| 515 | } | ||
| 516 | } | ||
| 517 | if ($gnuc) | ||
| 518 | { | ||
| 519 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n"; | ||
| 520 | $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n"; | ||
| 521 | } | ||
| 522 | else | ||
| 523 | { | ||
| 524 | $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n"; | ||
| 525 | } | ||
| 526 | |||
| 527 | $ret.="\n"; | ||
| 528 | return($ret); | ||
| 529 | |||
| 530 | } | ||
| 531 | |||
| 532 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/ultrix.pl b/src/lib/libcrypto/util/pl/ultrix.pl new file mode 100644 index 0000000000..ea370c71f9 --- /dev/null +++ b/src/lib/libcrypto/util/pl/ultrix.pl | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # linux.pl - the standard unix makefile stuff. | ||
| 4 | # | ||
| 5 | |||
| 6 | $o='/'; | ||
| 7 | $cp='/bin/cp'; | ||
| 8 | $rm='/bin/rm -f'; | ||
| 9 | |||
| 10 | # C compiler stuff | ||
| 11 | |||
| 12 | $cc='cc'; | ||
| 13 | if ($debug) | ||
| 14 | { $cflags="-g -DREF_CHECK -DCRYPTO_MDEBUG"; } | ||
| 15 | else | ||
| 16 | { $cflags="-O2"; } | ||
| 17 | |||
| 18 | $cflags.=" -std1 -DL_ENDIAN"; | ||
| 19 | |||
| 20 | if (!$no_asm) | ||
| 21 | { | ||
| 22 | $bn_asm_obj='$(OBJ_D)/mips1.o'; | ||
| 23 | $bn_asm_src='crypto/bn/asm/mips1.s'; | ||
| 24 | } | ||
| 25 | |||
| 26 | sub do_link_rule | ||
| 27 | { | ||
| 28 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 29 | local($ret,$_); | ||
| 30 | |||
| 31 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 32 | $n=&bname($target); | ||
| 33 | $ret.="$target: $files $dep_libs\n"; | ||
| 34 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | ||
| 35 | return($ret); | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; | ||
diff --git a/src/lib/libcrypto/util/pl/unix.pl b/src/lib/libcrypto/util/pl/unix.pl new file mode 100644 index 0000000000..146611ad99 --- /dev/null +++ b/src/lib/libcrypto/util/pl/unix.pl | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # unix.pl - the standard unix makefile stuff. | ||
| 4 | # | ||
| 5 | |||
| 6 | $o='/'; | ||
| 7 | $cp='/bin/cp'; | ||
| 8 | $rm='/bin/rm -f'; | ||
| 9 | |||
| 10 | # C compiler stuff | ||
| 11 | |||
| 12 | if ($gcc) | ||
| 13 | { | ||
| 14 | $cc='gcc'; | ||
| 15 | if ($debug) | ||
| 16 | { $cflags="-g2 -ggdb"; } | ||
| 17 | else | ||
| 18 | { $cflags="-O3 -fomit-frame-pointer"; } | ||
| 19 | } | ||
| 20 | else | ||
| 21 | { | ||
| 22 | $cc='cc'; | ||
| 23 | if ($debug) | ||
| 24 | { $cflags="-g"; } | ||
| 25 | else | ||
| 26 | { $cflags="-O"; } | ||
| 27 | } | ||
| 28 | $obj='.o'; | ||
| 29 | $ofile='-o '; | ||
| 30 | |||
| 31 | # EXE linking stuff | ||
| 32 | $link='${CC}'; | ||
| 33 | $lflags='${CFLAGS}'; | ||
| 34 | $efile='-o '; | ||
| 35 | $exep=''; | ||
| 36 | $ex_libs=""; | ||
| 37 | |||
| 38 | # static library stuff | ||
| 39 | $mklib='ar r'; | ||
| 40 | $mlflags=''; | ||
| 41 | $ranlib=&which("ranlib") or $ranlib="true"; | ||
| 42 | $plib='lib'; | ||
| 43 | $libp=".a"; | ||
| 44 | $shlibp=".a"; | ||
| 45 | $lfile=''; | ||
| 46 | |||
| 47 | $asm='as'; | ||
| 48 | $afile='-o '; | ||
| 49 | $bn_asm_obj=""; | ||
| 50 | $bn_asm_src=""; | ||
| 51 | $des_enc_obj=""; | ||
| 52 | $des_enc_src=""; | ||
| 53 | $bf_enc_obj=""; | ||
| 54 | $bf_enc_src=""; | ||
| 55 | |||
| 56 | sub do_lib_rule | ||
| 57 | { | ||
| 58 | local($obj,$target,$name,$shlib)=@_; | ||
| 59 | local($ret,$_,$Name); | ||
| 60 | |||
| 61 | $target =~ s/\//$o/g if $o ne '/'; | ||
| 62 | $target="$target"; | ||
| 63 | ($Name=$name) =~ tr/a-z/A-Z/; | ||
| 64 | |||
| 65 | $ret.="$target: \$(${Name}OBJ)\n"; | ||
| 66 | $ret.="\t\$(RM) $target\n"; | ||
| 67 | $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n"; | ||
| 68 | $ret.="\t\$(RANLIB) $target\n\n"; | ||
| 69 | } | ||
| 70 | |||
| 71 | sub do_link_rule | ||
| 72 | { | ||
| 73 | local($target,$files,$dep_libs,$libs)=@_; | ||
| 74 | local($ret,$_); | ||
| 75 | |||
| 76 | $file =~ s/\//$o/g if $o ne '/'; | ||
| 77 | $n=&bname($target); | ||
| 78 | $ret.="$target: $files $dep_libs\n"; | ||
| 79 | $ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; | ||
| 80 | return($ret); | ||
| 81 | } | ||
| 82 | |||
| 83 | sub which | ||
| 84 | { | ||
| 85 | my ($name)=@_; | ||
| 86 | my $path; | ||
| 87 | foreach $path (split /:/, $ENV{PATH}) | ||
| 88 | { | ||
| 89 | if (-x "$path/$name") | ||
| 90 | { | ||
| 91 | return "$path/$name"; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | 1; | ||
diff --git a/src/lib/libcrypto/util/pod2man.pl b/src/lib/libcrypto/util/pod2man.pl new file mode 100644 index 0000000000..025d914f2e --- /dev/null +++ b/src/lib/libcrypto/util/pod2man.pl | |||
| @@ -0,0 +1,1184 @@ | |||
| 1 | : #!/usr/bin/perl-5.005 | ||
| 2 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | ||
| 3 | if $running_under_some_shell; | ||
| 4 | |||
| 5 | $DEF_PM_SECTION = '3pm' || '3'; | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | pod2man - translate embedded Perl pod directives into man pages | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | B<pod2man> | ||
| 14 | [ B<--section=>I<manext> ] | ||
| 15 | [ B<--release=>I<relpatch> ] | ||
| 16 | [ B<--center=>I<string> ] | ||
| 17 | [ B<--date=>I<string> ] | ||
| 18 | [ B<--fixed=>I<font> ] | ||
| 19 | [ B<--official> ] | ||
| 20 | [ B<--lax> ] | ||
| 21 | I<inputfile> | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | B<pod2man> converts its input file containing embedded pod directives (see | ||
| 26 | L<perlpod>) into nroff source suitable for viewing with nroff(1) or | ||
| 27 | troff(1) using the man(7) macro set. | ||
| 28 | |||
| 29 | Besides the obvious pod conversions, B<pod2man> also takes care of | ||
| 30 | func(), func(n), and simple variable references like $foo or @bar so | ||
| 31 | you don't have to use code escapes for them; complex expressions like | ||
| 32 | C<$fred{'stuff'}> will still need to be escaped, though. Other nagging | ||
| 33 | little roffish things that it catches include translating the minus in | ||
| 34 | something like foo-bar, making a long dash--like this--into a real em | ||
| 35 | dash, fixing up "paired quotes", putting a little space after the | ||
| 36 | parens in something like func(), making C++ and PI look right, making | ||
| 37 | double underbars have a little tiny space between them, making ALLCAPS | ||
| 38 | a teeny bit smaller in troff(1), and escaping backslashes so you don't | ||
| 39 | have to. | ||
| 40 | |||
| 41 | =head1 OPTIONS | ||
| 42 | |||
| 43 | =over 8 | ||
| 44 | |||
| 45 | =item center | ||
| 46 | |||
| 47 | Set the centered header to a specific string. The default is | ||
| 48 | "User Contributed Perl Documentation", unless the C<--official> flag is | ||
| 49 | given, in which case the default is "Perl Programmers Reference Guide". | ||
| 50 | |||
| 51 | =item date | ||
| 52 | |||
| 53 | Set the left-hand footer string to this value. By default, | ||
| 54 | the modification date of the input file will be used. | ||
| 55 | |||
| 56 | =item fixed | ||
| 57 | |||
| 58 | The fixed font to use for code refs. Defaults to CW. | ||
| 59 | |||
| 60 | =item official | ||
| 61 | |||
| 62 | Set the default header to indicate that this page is of | ||
| 63 | the standard release in case C<--center> is not given. | ||
| 64 | |||
| 65 | =item release | ||
| 66 | |||
| 67 | Set the centered footer. By default, this is the current | ||
| 68 | perl release. | ||
| 69 | |||
| 70 | =item section | ||
| 71 | |||
| 72 | Set the section for the C<.TH> macro. The standard conventions on | ||
| 73 | sections are to use 1 for user commands, 2 for system calls, 3 for | ||
| 74 | functions, 4 for devices, 5 for file formats, 6 for games, 7 for | ||
| 75 | miscellaneous information, and 8 for administrator commands. This works | ||
| 76 | best if you put your Perl man pages in a separate tree, like | ||
| 77 | F</usr/local/perl/man/>. By default, section 1 will be used | ||
| 78 | unless the file ends in F<.pm> in which case section 3 will be selected. | ||
| 79 | |||
| 80 | =item lax | ||
| 81 | |||
| 82 | Don't complain when required sections aren't present. | ||
| 83 | |||
| 84 | =back | ||
| 85 | |||
| 86 | =head1 Anatomy of a Proper Man Page | ||
| 87 | |||
| 88 | For those not sure of the proper layout of a man page, here's | ||
| 89 | an example of the skeleton of a proper man page. Head of the | ||
| 90 | major headers should be setout as a C<=head1> directive, and | ||
| 91 | are historically written in the rather startling ALL UPPER CASE | ||
| 92 | format, although this is not mandatory. | ||
| 93 | Minor headers may be included using C<=head2>, and are | ||
| 94 | typically in mixed case. | ||
| 95 | |||
| 96 | =over 10 | ||
| 97 | |||
| 98 | =item NAME | ||
| 99 | |||
| 100 | Mandatory section; should be a comma-separated list of programs or | ||
| 101 | functions documented by this podpage, such as: | ||
| 102 | |||
| 103 | foo, bar - programs to do something | ||
| 104 | |||
| 105 | =item SYNOPSIS | ||
| 106 | |||
| 107 | A short usage summary for programs and functions, which | ||
| 108 | may someday be deemed mandatory. | ||
| 109 | |||
| 110 | =item DESCRIPTION | ||
| 111 | |||
| 112 | Long drawn out discussion of the program. It's a good idea to break this | ||
| 113 | up into subsections using the C<=head2> directives, like | ||
| 114 | |||
| 115 | =head2 A Sample Subection | ||
| 116 | |||
| 117 | =head2 Yet Another Sample Subection | ||
| 118 | |||
| 119 | =item OPTIONS | ||
| 120 | |||
| 121 | Some people make this separate from the description. | ||
| 122 | |||
| 123 | =item RETURN VALUE | ||
| 124 | |||
| 125 | What the program or function returns if successful. | ||
| 126 | |||
| 127 | =item ERRORS | ||
| 128 | |||
| 129 | Exceptions, return codes, exit stati, and errno settings. | ||
| 130 | |||
| 131 | =item EXAMPLES | ||
| 132 | |||
| 133 | Give some example uses of the program. | ||
| 134 | |||
| 135 | =item ENVIRONMENT | ||
| 136 | |||
| 137 | Envariables this program might care about. | ||
| 138 | |||
| 139 | =item FILES | ||
| 140 | |||
| 141 | All files used by the program. You should probably use the FE<lt>E<gt> | ||
| 142 | for these. | ||
| 143 | |||
| 144 | =item SEE ALSO | ||
| 145 | |||
| 146 | Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). | ||
| 147 | |||
| 148 | =item NOTES | ||
| 149 | |||
| 150 | Miscellaneous commentary. | ||
| 151 | |||
| 152 | =item CAVEATS | ||
| 153 | |||
| 154 | Things to take special care with; sometimes called WARNINGS. | ||
| 155 | |||
| 156 | =item DIAGNOSTICS | ||
| 157 | |||
| 158 | All possible messages the program can print out--and | ||
| 159 | what they mean. | ||
| 160 | |||
| 161 | =item BUGS | ||
| 162 | |||
| 163 | Things that are broken or just don't work quite right. | ||
| 164 | |||
| 165 | =item RESTRICTIONS | ||
| 166 | |||
| 167 | Bugs you don't plan to fix :-) | ||
| 168 | |||
| 169 | =item AUTHOR | ||
| 170 | |||
| 171 | Who wrote it (or AUTHORS if multiple). | ||
| 172 | |||
| 173 | =item HISTORY | ||
| 174 | |||
| 175 | Programs derived from other sources sometimes have this, or | ||
| 176 | you might keep a modification log here. | ||
| 177 | |||
| 178 | =back | ||
| 179 | |||
| 180 | =head1 EXAMPLES | ||
| 181 | |||
| 182 | pod2man program > program.1 | ||
| 183 | pod2man some_module.pm > /usr/perl/man/man3/some_module.3 | ||
| 184 | pod2man --section=7 note.pod > note.7 | ||
| 185 | |||
| 186 | =head1 DIAGNOSTICS | ||
| 187 | |||
| 188 | The following diagnostics are generated by B<pod2man>. Items | ||
| 189 | marked "(W)" are non-fatal, whereas the "(F)" errors will cause | ||
| 190 | B<pod2man> to immediately exit with a non-zero status. | ||
| 191 | |||
| 192 | =over 4 | ||
| 193 | |||
| 194 | =item bad option in paragraph %d of %s: ``%s'' should be [%s]<%s> | ||
| 195 | |||
| 196 | (W) If you start include an option, you should set it off | ||
| 197 | as bold, italic, or code. | ||
| 198 | |||
| 199 | =item can't open %s: %s | ||
| 200 | |||
| 201 | (F) The input file wasn't available for the given reason. | ||
| 202 | |||
| 203 | =item Improper man page - no dash in NAME header in paragraph %d of %s | ||
| 204 | |||
| 205 | (W) The NAME header did not have an isolated dash in it. This is | ||
| 206 | considered important. | ||
| 207 | |||
| 208 | =item Invalid man page - no NAME line in %s | ||
| 209 | |||
| 210 | (F) You did not include a NAME header, which is essential. | ||
| 211 | |||
| 212 | =item roff font should be 1 or 2 chars, not `%s' (F) | ||
| 213 | |||
| 214 | (F) The font specified with the C<--fixed> option was not | ||
| 215 | a one- or two-digit roff font. | ||
| 216 | |||
| 217 | =item %s is missing required section: %s | ||
| 218 | |||
| 219 | (W) Required sections include NAME, DESCRIPTION, and if you're | ||
| 220 | using a section starting with a 3, also a SYNOPSIS. Actually, | ||
| 221 | not having a NAME is a fatal. | ||
| 222 | |||
| 223 | =item Unknown escape: %s in %s | ||
| 224 | |||
| 225 | (W) An unknown HTML entity (probably for an 8-bit character) was given via | ||
| 226 | a C<EE<lt>E<gt>> directive. Besides amp, lt, gt, and quot, recognized | ||
| 227 | entities are Aacute, aacute, Acirc, acirc, AElig, aelig, Agrave, agrave, | ||
| 228 | Aring, aring, Atilde, atilde, Auml, auml, Ccedil, ccedil, Eacute, eacute, | ||
| 229 | Ecirc, ecirc, Egrave, egrave, ETH, eth, Euml, euml, Iacute, iacute, Icirc, | ||
| 230 | icirc, Igrave, igrave, Iuml, iuml, Ntilde, ntilde, Oacute, oacute, Ocirc, | ||
| 231 | ocirc, Ograve, ograve, Oslash, oslash, Otilde, otilde, Ouml, ouml, szlig, | ||
| 232 | THORN, thorn, Uacute, uacute, Ucirc, ucirc, Ugrave, ugrave, Uuml, uuml, | ||
| 233 | Yacute, yacute, and yuml. | ||
| 234 | |||
| 235 | =item Unmatched =back | ||
| 236 | |||
| 237 | (W) You have a C<=back> without a corresponding C<=over>. | ||
| 238 | |||
| 239 | =item Unrecognized pod directive: %s | ||
| 240 | |||
| 241 | (W) You specified a pod directive that isn't in the known list of | ||
| 242 | C<=head1>, C<=head2>, C<=item>, C<=over>, C<=back>, or C<=cut>. | ||
| 243 | |||
| 244 | |||
| 245 | =back | ||
| 246 | |||
| 247 | =head1 NOTES | ||
| 248 | |||
| 249 | If you would like to print out a lot of man page continuously, you | ||
| 250 | probably want to set the C and D registers to set contiguous page | ||
| 251 | numbering and even/odd paging, at least on some versions of man(7). | ||
| 252 | Settting the F register will get you some additional experimental | ||
| 253 | indexing: | ||
| 254 | |||
| 255 | troff -man -rC1 -rD1 -rF1 perl.1 perldata.1 perlsyn.1 ... | ||
| 256 | |||
| 257 | The indexing merely outputs messages via C<.tm> for each | ||
| 258 | major page, section, subsection, item, and any C<XE<lt>E<gt>> | ||
| 259 | directives. | ||
| 260 | |||
| 261 | |||
| 262 | =head1 RESTRICTIONS | ||
| 263 | |||
| 264 | None at this time. | ||
| 265 | |||
| 266 | =head1 BUGS | ||
| 267 | |||
| 268 | The =over and =back directives don't really work right. They | ||
| 269 | take absolute positions instead of offsets, don't nest well, and | ||
| 270 | making people count is suboptimal in any event. | ||
| 271 | |||
| 272 | =head1 AUTHORS | ||
| 273 | |||
| 274 | Original prototype by Larry Wall, but so massively hacked over by | ||
| 275 | Tom Christiansen such that Larry probably doesn't recognize it anymore. | ||
| 276 | |||
| 277 | =cut | ||
| 278 | |||
| 279 | $/ = ""; | ||
| 280 | $cutting = 1; | ||
| 281 | @Indices = (); | ||
| 282 | |||
| 283 | # We try first to get the version number from a local binary, in case we're | ||
| 284 | # running an installed version of Perl to produce documentation from an | ||
| 285 | # uninstalled newer version's pod files. | ||
| 286 | if ($^O ne 'plan9' and $^O ne 'dos' and $^O ne 'os2' and $^O ne 'MSWin32') { | ||
| 287 | my $perl = (-x './perl' && -f './perl' ) ? | ||
| 288 | './perl' : | ||
| 289 | ((-x '../perl' && -f '../perl') ? | ||
| 290 | '../perl' : | ||
| 291 | ''); | ||
| 292 | ($version,$patch) = `$perl -e 'print $]'` =~ /^(\d\.\d{3})(\d{2})?/ if $perl; | ||
| 293 | } | ||
| 294 | # No luck; we'll just go with the running Perl's version | ||
| 295 | ($version,$patch) = $] =~ /^(.{5})(\d{2})?/ unless $version; | ||
| 296 | $DEF_RELEASE = "perl $version"; | ||
| 297 | $DEF_RELEASE .= ", patch $patch" if $patch; | ||
| 298 | |||
| 299 | |||
| 300 | sub makedate { | ||
| 301 | my $secs = shift; | ||
| 302 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secs); | ||
| 303 | my $mname = (qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec})[$mon]; | ||
| 304 | $year += 1900; | ||
| 305 | return "$mday/$mname/$year"; | ||
| 306 | } | ||
| 307 | |||
| 308 | use Getopt::Long; | ||
| 309 | |||
| 310 | $DEF_SECTION = 1; | ||
| 311 | $DEF_CENTER = "User Contributed Perl Documentation"; | ||
| 312 | $STD_CENTER = "Perl Programmers Reference Guide"; | ||
| 313 | $DEF_FIXED = 'CW'; | ||
| 314 | $DEF_LAX = 0; | ||
| 315 | |||
| 316 | sub usage { | ||
| 317 | warn "$0: @_\n" if @_; | ||
| 318 | die <<EOF; | ||
| 319 | usage: $0 [options] podpage | ||
| 320 | Options are: | ||
| 321 | --section=manext (default "$DEF_SECTION") | ||
| 322 | --release=relpatch (default "$DEF_RELEASE") | ||
| 323 | --center=string (default "$DEF_CENTER") | ||
| 324 | --date=string (default "$DEF_DATE") | ||
| 325 | --fixed=font (default "$DEF_FIXED") | ||
| 326 | --official (default NOT) | ||
| 327 | --lax (default NOT) | ||
| 328 | EOF | ||
| 329 | } | ||
| 330 | |||
| 331 | $uok = GetOptions( qw( | ||
| 332 | section=s | ||
| 333 | release=s | ||
| 334 | center=s | ||
| 335 | date=s | ||
| 336 | fixed=s | ||
| 337 | official | ||
| 338 | lax | ||
| 339 | help)); | ||
| 340 | |||
| 341 | $DEF_DATE = makedate((stat($ARGV[0]))[9] || time()); | ||
| 342 | |||
| 343 | usage("Usage error!") unless $uok; | ||
| 344 | usage() if $opt_help; | ||
| 345 | usage("Need one and only one podpage argument") unless @ARGV == 1; | ||
| 346 | |||
| 347 | $section = $opt_section || ($ARGV[0] =~ /\.pm$/ | ||
| 348 | ? $DEF_PM_SECTION : $DEF_SECTION); | ||
| 349 | $RP = $opt_release || $DEF_RELEASE; | ||
| 350 | $center = $opt_center || ($opt_official ? $STD_CENTER : $DEF_CENTER); | ||
| 351 | $lax = $opt_lax || $DEF_LAX; | ||
| 352 | |||
| 353 | $CFont = $opt_fixed || $DEF_FIXED; | ||
| 354 | |||
| 355 | if (length($CFont) == 2) { | ||
| 356 | $CFont_embed = "\\f($CFont"; | ||
| 357 | } | ||
| 358 | elsif (length($CFont) == 1) { | ||
| 359 | $CFont_embed = "\\f$CFont"; | ||
| 360 | } | ||
| 361 | else { | ||
| 362 | die "roff font should be 1 or 2 chars, not `$CFont_embed'"; | ||
| 363 | } | ||
| 364 | |||
| 365 | $date = $opt_date || $DEF_DATE; | ||
| 366 | |||
| 367 | for (qw{NAME DESCRIPTION}) { | ||
| 368 | # for (qw{NAME DESCRIPTION AUTHOR}) { | ||
| 369 | $wanna_see{$_}++; | ||
| 370 | } | ||
| 371 | $wanna_see{SYNOPSIS}++ if $section =~ /^3/; | ||
| 372 | |||
| 373 | |||
| 374 | $name = @ARGV ? $ARGV[0] : "<STDIN>"; | ||
| 375 | $Filename = $name; | ||
| 376 | if ($section =~ /^1/) { | ||
| 377 | require File::Basename; | ||
| 378 | $name = uc File::Basename::basename($name); | ||
| 379 | } | ||
| 380 | $name =~ s/\.(pod|p[lm])$//i; | ||
| 381 | |||
| 382 | # Lose everything up to the first of | ||
| 383 | # */lib/*perl* standard or site_perl module | ||
| 384 | # */*perl*/lib from -D prefix=/opt/perl | ||
| 385 | # */*perl*/ random module hierarchy | ||
| 386 | # which works. | ||
| 387 | $name =~ s-//+-/-g; | ||
| 388 | if ($name =~ s-^.*?/lib/[^/]*perl[^/]*/--i | ||
| 389 | or $name =~ s-^.*?/[^/]*perl[^/]*/lib/--i | ||
| 390 | or $name =~ s-^.*?/[^/]*perl[^/]*/--i) { | ||
| 391 | # Lose ^site(_perl)?/. | ||
| 392 | $name =~ s-^site(_perl)?/--; | ||
| 393 | # Lose ^arch/. (XXX should we use Config? Just for archname?) | ||
| 394 | $name =~ s~^(.*-$^O|$^O-.*)/~~o; | ||
| 395 | # Lose ^version/. | ||
| 396 | $name =~ s-^\d+\.\d+/--; | ||
| 397 | } | ||
| 398 | |||
| 399 | # Translate Getopt/Long to Getopt::Long, etc. | ||
| 400 | $name =~ s(/)(::)g; | ||
| 401 | |||
| 402 | if ($name ne 'something') { | ||
| 403 | FCHECK: { | ||
| 404 | open(F, "< $ARGV[0]") || die "can't open $ARGV[0]: $!"; | ||
| 405 | while (<F>) { | ||
| 406 | next unless /^=\b/; | ||
| 407 | if (/^=head1\s+NAME\s*$/) { # an /m would forgive mistakes | ||
| 408 | $_ = <F>; | ||
| 409 | unless (/\s*-+\s+/) { | ||
| 410 | $oops++; | ||
| 411 | warn "$0: Improper man page - no dash in NAME header in paragraph $. of $ARGV[0]\n" | ||
| 412 | } else { | ||
| 413 | my @n = split /\s+-+\s+/; | ||
| 414 | if (@n != 2) { | ||
| 415 | $oops++; | ||
| 416 | warn "$0: Improper man page - malformed NAME header in paragraph $. of $ARGV[0]\n" | ||
| 417 | } | ||
| 418 | else { | ||
| 419 | $n[0] =~ s/\n/ /g; | ||
| 420 | $n[1] =~ s/\n/ /g; | ||
| 421 | %namedesc = @n; | ||
| 422 | } | ||
| 423 | } | ||
| 424 | last FCHECK; | ||
| 425 | } | ||
| 426 | next if /^=cut\b/; # DB_File and Net::Ping have =cut before NAME | ||
| 427 | next if /^=pod\b/; # It is OK to have =pod before NAME | ||
| 428 | next if /^=(for|begin|end)\s+comment\b/; # It is OK to have =for =begin or =end comment before NAME | ||
| 429 | die "$0: Invalid man page - 1st pod line is not NAME in $ARGV[0]\n" unless $lax; | ||
| 430 | } | ||
| 431 | die "$0: Invalid man page - no documentation in $ARGV[0]\n" unless $lax; | ||
| 432 | } | ||
| 433 | close F; | ||
| 434 | } | ||
| 435 | |||
| 436 | print <<"END"; | ||
| 437 | .rn '' }` | ||
| 438 | ''' \$RCSfile\$\$Revision\$\$Date\$ | ||
| 439 | ''' | ||
| 440 | ''' \$Log\$ | ||
| 441 | ''' | ||
| 442 | .de Sh | ||
| 443 | .br | ||
| 444 | .if t .Sp | ||
| 445 | .ne 5 | ||
| 446 | .PP | ||
| 447 | \\fB\\\\\$1\\fR | ||
| 448 | .PP | ||
| 449 | .. | ||
| 450 | .de Sp | ||
| 451 | .if t .sp .5v | ||
| 452 | .if n .sp | ||
| 453 | .. | ||
| 454 | .de Ip | ||
| 455 | .br | ||
| 456 | .ie \\\\n(.\$>=3 .ne \\\\\$3 | ||
| 457 | .el .ne 3 | ||
| 458 | .IP "\\\\\$1" \\\\\$2 | ||
| 459 | .. | ||
| 460 | .de Vb | ||
| 461 | .ft $CFont | ||
| 462 | .nf | ||
| 463 | .ne \\\\\$1 | ||
| 464 | .. | ||
| 465 | .de Ve | ||
| 466 | .ft R | ||
| 467 | |||
| 468 | .fi | ||
| 469 | .. | ||
| 470 | ''' | ||
| 471 | ''' | ||
| 472 | ''' Set up \\*(-- to give an unbreakable dash; | ||
| 473 | ''' string Tr holds user defined translation string. | ||
| 474 | ''' Bell System Logo is used as a dummy character. | ||
| 475 | ''' | ||
| 476 | .tr \\(*W-|\\(bv\\*(Tr | ||
| 477 | .ie n \\{\\ | ||
| 478 | .ds -- \\(*W- | ||
| 479 | .ds PI pi | ||
| 480 | .if (\\n(.H=4u)&(1m=24u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-12u'-\\" diablo 10 pitch | ||
| 481 | .if (\\n(.H=4u)&(1m=20u) .ds -- \\(*W\\h'-12u'\\(*W\\h'-8u'-\\" diablo 12 pitch | ||
| 482 | .ds L" "" | ||
| 483 | .ds R" "" | ||
| 484 | ''' \\*(M", \\*(S", \\*(N" and \\*(T" are the equivalent of | ||
| 485 | ''' \\*(L" and \\*(R", except that they are used on ".xx" lines, | ||
| 486 | ''' such as .IP and .SH, which do another additional levels of | ||
| 487 | ''' double-quote interpretation | ||
| 488 | .ds M" """ | ||
| 489 | .ds S" """ | ||
| 490 | .ds N" """"" | ||
| 491 | .ds T" """"" | ||
| 492 | .ds L' ' | ||
| 493 | .ds R' ' | ||
| 494 | .ds M' ' | ||
| 495 | .ds S' ' | ||
| 496 | .ds N' ' | ||
| 497 | .ds T' ' | ||
| 498 | 'br\\} | ||
| 499 | .el\\{\\ | ||
| 500 | .ds -- \\(em\\| | ||
| 501 | .tr \\*(Tr | ||
| 502 | .ds L" `` | ||
| 503 | .ds R" '' | ||
| 504 | .ds M" `` | ||
| 505 | .ds S" '' | ||
| 506 | .ds N" `` | ||
| 507 | .ds T" '' | ||
| 508 | .ds L' ` | ||
| 509 | .ds R' ' | ||
| 510 | .ds M' ` | ||
| 511 | .ds S' ' | ||
| 512 | .ds N' ` | ||
| 513 | .ds T' ' | ||
| 514 | .ds PI \\(*p | ||
| 515 | 'br\\} | ||
| 516 | END | ||
| 517 | |||
| 518 | print <<'END'; | ||
| 519 | .\" If the F register is turned on, we'll generate | ||
| 520 | .\" index entries out stderr for the following things: | ||
| 521 | .\" TH Title | ||
| 522 | .\" SH Header | ||
| 523 | .\" Sh Subsection | ||
| 524 | .\" Ip Item | ||
| 525 | .\" X<> Xref (embedded | ||
| 526 | .\" Of course, you have to process the output yourself | ||
| 527 | .\" in some meaninful fashion. | ||
| 528 | .if \nF \{ | ||
| 529 | .de IX | ||
| 530 | .tm Index:\\$1\t\\n%\t"\\$2" | ||
| 531 | .. | ||
| 532 | .nr % 0 | ||
| 533 | .rr F | ||
| 534 | .\} | ||
| 535 | END | ||
| 536 | |||
| 537 | print <<"END"; | ||
| 538 | .TH $name $section "$RP" "$date" "$center" | ||
| 539 | .UC | ||
| 540 | END | ||
| 541 | |||
| 542 | push(@Indices, qq{.IX Title "$name $section"}); | ||
| 543 | |||
| 544 | while (($name, $desc) = each %namedesc) { | ||
| 545 | for ($name, $desc) { s/^\s+//; s/\s+$//; } | ||
| 546 | push(@Indices, qq(.IX Name "$name - $desc"\n)); | ||
| 547 | } | ||
| 548 | |||
| 549 | print <<'END'; | ||
| 550 | .if n .hy 0 | ||
| 551 | .if n .na | ||
| 552 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | ||
| 553 | .de CQ \" put $1 in typewriter font | ||
| 554 | END | ||
| 555 | print ".ft $CFont\n"; | ||
| 556 | print <<'END'; | ||
| 557 | 'if n "\c | ||
| 558 | 'if t \\&\\$1\c | ||
| 559 | 'if n \\&\\$1\c | ||
| 560 | 'if n \&" | ||
| 561 | \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 | ||
| 562 | '.ft R | ||
| 563 | .. | ||
| 564 | .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 | ||
| 565 | . \" AM - accent mark definitions | ||
| 566 | .bd B 3 | ||
| 567 | . \" fudge factors for nroff and troff | ||
| 568 | .if n \{\ | ||
| 569 | . ds #H 0 | ||
| 570 | . ds #V .8m | ||
| 571 | . ds #F .3m | ||
| 572 | . ds #[ \f1 | ||
| 573 | . ds #] \fP | ||
| 574 | .\} | ||
| 575 | .if t \{\ | ||
| 576 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | ||
| 577 | . ds #V .6m | ||
| 578 | . ds #F 0 | ||
| 579 | . ds #[ \& | ||
| 580 | . ds #] \& | ||
| 581 | .\} | ||
| 582 | . \" simple accents for nroff and troff | ||
| 583 | .if n \{\ | ||
| 584 | . ds ' \& | ||
| 585 | . ds ` \& | ||
| 586 | . ds ^ \& | ||
| 587 | . ds , \& | ||
| 588 | . ds ~ ~ | ||
| 589 | . ds ? ? | ||
| 590 | . ds ! ! | ||
| 591 | . ds / | ||
| 592 | . ds q | ||
| 593 | .\} | ||
| 594 | .if t \{\ | ||
| 595 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | ||
| 596 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | ||
| 597 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | ||
| 598 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | ||
| 599 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | ||
| 600 | . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' | ||
| 601 | . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' | ||
| 602 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | ||
| 603 | . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' | ||
| 604 | .\} | ||
| 605 | . \" troff and (daisy-wheel) nroff accents | ||
| 606 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | ||
| 607 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | ||
| 608 | .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] | ||
| 609 | .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' | ||
| 610 | .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' | ||
| 611 | .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] | ||
| 612 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | ||
| 613 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | ||
| 614 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | ||
| 615 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | ||
| 616 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | ||
| 617 | .ds ae a\h'-(\w'a'u*4/10)'e | ||
| 618 | .ds Ae A\h'-(\w'A'u*4/10)'E | ||
| 619 | .ds oe o\h'-(\w'o'u*4/10)'e | ||
| 620 | .ds Oe O\h'-(\w'O'u*4/10)'E | ||
| 621 | . \" corrections for vroff | ||
| 622 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | ||
| 623 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | ||
| 624 | . \" for low resolution devices (crt and lpr) | ||
| 625 | .if \n(.H>23 .if \n(.V>19 \ | ||
| 626 | \{\ | ||
| 627 | . ds : e | ||
| 628 | . ds 8 ss | ||
| 629 | . ds v \h'-1'\o'\(aa\(ga' | ||
| 630 | . ds _ \h'-1'^ | ||
| 631 | . ds . \h'-1'. | ||
| 632 | . ds 3 3 | ||
| 633 | . ds o a | ||
| 634 | . ds d- d\h'-1'\(ga | ||
| 635 | . ds D- D\h'-1'\(hy | ||
| 636 | . ds th \o'bp' | ||
| 637 | . ds Th \o'LP' | ||
| 638 | . ds ae ae | ||
| 639 | . ds Ae AE | ||
| 640 | . ds oe oe | ||
| 641 | . ds Oe OE | ||
| 642 | .\} | ||
| 643 | .rm #[ #] #H #V #F C | ||
| 644 | END | ||
| 645 | |||
| 646 | $indent = 0; | ||
| 647 | |||
| 648 | $begun = ""; | ||
| 649 | |||
| 650 | # Unrolling [^A-Z>]|[A-Z](?!<) gives: // MRE pp 165. | ||
| 651 | my $nonest = '(?:[^A-Z>]*(?:[A-Z](?!<)[^A-Z>]*)*)'; | ||
| 652 | |||
| 653 | while (<>) { | ||
| 654 | if ($cutting) { | ||
| 655 | next unless /^=/; | ||
| 656 | $cutting = 0; | ||
| 657 | } | ||
| 658 | if ($begun) { | ||
| 659 | if (/^=end\s+$begun/) { | ||
| 660 | $begun = ""; | ||
| 661 | } | ||
| 662 | elsif ($begun =~ /^(roff|man)$/) { | ||
| 663 | print STDOUT $_; | ||
| 664 | } | ||
| 665 | next; | ||
| 666 | } | ||
| 667 | chomp; | ||
| 668 | |||
| 669 | # Translate verbatim paragraph | ||
| 670 | |||
| 671 | if (/^\s/) { | ||
| 672 | @lines = split(/\n/); | ||
| 673 | for (@lines) { | ||
| 674 | 1 while s | ||
| 675 | {^( [^\t]* ) \t ( \t* ) } | ||
| 676 | { $1 . ' ' x (8 - (length($1)%8) + 8 * (length($2))) }ex; | ||
| 677 | s/\\/\\e/g; | ||
| 678 | s/\A/\\&/s; | ||
| 679 | } | ||
| 680 | $lines = @lines; | ||
| 681 | makespace() unless $verbatim++; | ||
| 682 | print ".Vb $lines\n"; | ||
| 683 | print join("\n", @lines), "\n"; | ||
| 684 | print ".Ve\n"; | ||
| 685 | $needspace = 0; | ||
| 686 | next; | ||
| 687 | } | ||
| 688 | |||
| 689 | $verbatim = 0; | ||
| 690 | |||
| 691 | if (/^=for\s+(\S+)\s*/s) { | ||
| 692 | if ($1 eq "man" or $1 eq "roff") { | ||
| 693 | print STDOUT $',"\n\n"; | ||
| 694 | } else { | ||
| 695 | # ignore unknown for | ||
| 696 | } | ||
| 697 | next; | ||
| 698 | } | ||
| 699 | elsif (/^=begin\s+(\S+)\s*/s) { | ||
| 700 | $begun = $1; | ||
| 701 | if ($1 eq "man" or $1 eq "roff") { | ||
| 702 | print STDOUT $'."\n\n"; | ||
| 703 | } | ||
| 704 | next; | ||
| 705 | } | ||
| 706 | |||
| 707 | # check for things that'll hosed our noremap scheme; affects $_ | ||
| 708 | init_noremap(); | ||
| 709 | |||
| 710 | if (!/^=item/) { | ||
| 711 | |||
| 712 | # trofficate backslashes; must do it before what happens below | ||
| 713 | s/\\/noremap('\\e')/ge; | ||
| 714 | |||
| 715 | # protect leading periods and quotes against *roff | ||
| 716 | # mistaking them for directives | ||
| 717 | s/^(?:[A-Z]<)?[.']/\\&$&/gm; | ||
| 718 | |||
| 719 | # first hide the escapes in case we need to | ||
| 720 | # intuit something and get it wrong due to fmting | ||
| 721 | |||
| 722 | 1 while s/([A-Z]<$nonest>)/noremap($1)/ge; | ||
| 723 | |||
| 724 | # func() is a reference to a perl function | ||
| 725 | s{ | ||
| 726 | \b | ||
| 727 | ( | ||
| 728 | [:\w]+ \(\) | ||
| 729 | ) | ||
| 730 | } {I<$1>}gx; | ||
| 731 | |||
| 732 | # func(n) is a reference to a perl function or a man page | ||
| 733 | s{ | ||
| 734 | ([:\w]+) | ||
| 735 | ( | ||
| 736 | \( [^\051]+ \) | ||
| 737 | ) | ||
| 738 | } {I<$1>\\|$2}gx; | ||
| 739 | |||
| 740 | # convert simple variable references | ||
| 741 | s/(\s+)([\$\@%][\w:]+)(?!\()/${1}C<$2>/g; | ||
| 742 | |||
| 743 | if (m{ ( | ||
| 744 | [\-\w]+ | ||
| 745 | \( | ||
| 746 | [^\051]*? | ||
| 747 | [\@\$,] | ||
| 748 | [^\051]*? | ||
| 749 | \) | ||
| 750 | ) | ||
| 751 | }x && $` !~ /([LCI]<[^<>]*|-)$/ && !/^=\w/) | ||
| 752 | { | ||
| 753 | warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [LCI]<$1>\n"; | ||
| 754 | $oops++; | ||
| 755 | } | ||
| 756 | |||
| 757 | while (/(-[a-zA-Z])\b/g && $` !~ /[\w\-]$/) { | ||
| 758 | warn "$0: bad option in paragraph $. of $ARGV: ``$1'' should be [CB]<$1>\n"; | ||
| 759 | $oops++; | ||
| 760 | } | ||
| 761 | |||
| 762 | # put it back so we get the <> processed again; | ||
| 763 | clear_noremap(0); # 0 means leave the E's | ||
| 764 | |||
| 765 | } else { | ||
| 766 | # trofficate backslashes | ||
| 767 | s/\\/noremap('\\e')/ge; | ||
| 768 | |||
| 769 | } | ||
| 770 | |||
| 771 | # need to hide E<> first; they're processed in clear_noremap | ||
| 772 | s/(E<[^<>]+>)/noremap($1)/ge; | ||
| 773 | |||
| 774 | |||
| 775 | $maxnest = 10; | ||
| 776 | while ($maxnest-- && /[A-Z]</) { | ||
| 777 | |||
| 778 | # can't do C font here | ||
| 779 | s/([BI])<($nonest)>/font($1) . $2 . font('R')/eg; | ||
| 780 | |||
| 781 | # files and filelike refs in italics | ||
| 782 | s/F<($nonest)>/I<$1>/g; | ||
| 783 | |||
| 784 | # no break -- usually we want C<> for this | ||
| 785 | s/S<($nonest)>/nobreak($1)/eg; | ||
| 786 | |||
| 787 | # LREF: a la HREF L<show this text|man/section> | ||
| 788 | s:L<([^|>]+)\|[^>]+>:$1:g; | ||
| 789 | |||
| 790 | # LREF: a manpage(3f) | ||
| 791 | s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g; | ||
| 792 | |||
| 793 | # LREF: an =item on another manpage | ||
| 794 | s{ | ||
| 795 | L< | ||
| 796 | ([^/]+) | ||
| 797 | / | ||
| 798 | ( | ||
| 799 | [:\w]+ | ||
| 800 | (\(\))? | ||
| 801 | ) | ||
| 802 | > | ||
| 803 | } {the C<$2> entry in the I<$1> manpage}gx; | ||
| 804 | |||
| 805 | # LREF: an =item on this manpage | ||
| 806 | s{ | ||
| 807 | ((?: | ||
| 808 | L< | ||
| 809 | / | ||
| 810 | ( | ||
| 811 | [:\w]+ | ||
| 812 | (\(\))? | ||
| 813 | ) | ||
| 814 | > | ||
| 815 | (,?\s+(and\s+)?)? | ||
| 816 | )+) | ||
| 817 | } { internal_lrefs($1) }gex; | ||
| 818 | |||
| 819 | # LREF: a =head2 (head1?), maybe on a manpage, maybe right here | ||
| 820 | # the "func" can disambiguate | ||
| 821 | s{ | ||
| 822 | L< | ||
| 823 | (?: | ||
| 824 | ([a-zA-Z]\S+?) / | ||
| 825 | )? | ||
| 826 | "?(.*?)"? | ||
| 827 | > | ||
| 828 | }{ | ||
| 829 | do { | ||
| 830 | $1 # if no $1, assume it means on this page. | ||
| 831 | ? "the section on I<$2> in the I<$1> manpage" | ||
| 832 | : "the section on I<$2>" | ||
| 833 | } | ||
| 834 | }gesx; # s in case it goes over multiple lines, so . matches \n | ||
| 835 | |||
| 836 | s/Z<>/\\&/g; | ||
| 837 | |||
| 838 | # comes last because not subject to reprocessing | ||
| 839 | s/C<($nonest)>/noremap("${CFont_embed}${1}\\fR")/eg; | ||
| 840 | } | ||
| 841 | |||
| 842 | if (s/^=//) { | ||
| 843 | $needspace = 0; # Assume this. | ||
| 844 | |||
| 845 | s/\n/ /g; | ||
| 846 | |||
| 847 | ($Cmd, $_) = split(' ', $_, 2); | ||
| 848 | |||
| 849 | $dotlevel = 1; | ||
| 850 | if ($Cmd eq 'head1') { | ||
| 851 | $dotlevel = 1; | ||
| 852 | } | ||
| 853 | elsif ($Cmd eq 'head2') { | ||
| 854 | $dotlevel = 1; | ||
| 855 | } | ||
| 856 | elsif ($Cmd eq 'item') { | ||
| 857 | $dotlevel = 2; | ||
| 858 | } | ||
| 859 | |||
| 860 | if (defined $_) { | ||
| 861 | &escapes($dotlevel); | ||
| 862 | s/"/""/g; | ||
| 863 | } | ||
| 864 | |||
| 865 | clear_noremap(1); | ||
| 866 | |||
| 867 | if ($Cmd eq 'cut') { | ||
| 868 | $cutting = 1; | ||
| 869 | } | ||
| 870 | elsif ($Cmd eq 'head1') { | ||
| 871 | s/\s+$//; | ||
| 872 | delete $wanna_see{$_} if exists $wanna_see{$_}; | ||
| 873 | print qq{.SH "$_"\n}; | ||
| 874 | push(@Indices, qq{.IX Header "$_"\n}); | ||
| 875 | } | ||
| 876 | elsif ($Cmd eq 'head2') { | ||
| 877 | print qq{.Sh "$_"\n}; | ||
| 878 | push(@Indices, qq{.IX Subsection "$_"\n}); | ||
| 879 | } | ||
| 880 | elsif ($Cmd eq 'over') { | ||
| 881 | push(@indent,$indent); | ||
| 882 | $indent += ($_ + 0) || 5; | ||
| 883 | } | ||
| 884 | elsif ($Cmd eq 'back') { | ||
| 885 | $indent = pop(@indent); | ||
| 886 | warn "$0: Unmatched =back in paragraph $. of $ARGV\n" unless defined $indent; | ||
| 887 | $needspace = 1; | ||
| 888 | } | ||
| 889 | elsif ($Cmd eq 'item') { | ||
| 890 | s/^\*( |$)/\\(bu$1/g; | ||
| 891 | # if you know how to get ":s please do | ||
| 892 | s/\\\*\(L"([^"]+?)\\\*\(R"/'$1'/g; | ||
| 893 | s/\\\*\(L"([^"]+?)""/'$1'/g; | ||
| 894 | s/[^"]""([^"]+?)""[^"]/'$1'/g; | ||
| 895 | # here do something about the $" in perlvar? | ||
| 896 | print STDOUT qq{.Ip "$_" $indent\n}; | ||
| 897 | push(@Indices, qq{.IX Item "$_"\n}); | ||
| 898 | } | ||
| 899 | elsif ($Cmd eq 'pod') { | ||
| 900 | # this is just a comment | ||
| 901 | } | ||
| 902 | else { | ||
| 903 | warn "$0: Unrecognized pod directive in paragraph $. of $ARGV: $Cmd\n"; | ||
| 904 | } | ||
| 905 | } | ||
| 906 | else { | ||
| 907 | if ($needspace) { | ||
| 908 | &makespace; | ||
| 909 | } | ||
| 910 | &escapes(0); | ||
| 911 | clear_noremap(1); | ||
| 912 | print $_, "\n"; | ||
| 913 | $needspace = 1; | ||
| 914 | } | ||
| 915 | } | ||
| 916 | |||
| 917 | print <<"END"; | ||
| 918 | |||
| 919 | .rn }` '' | ||
| 920 | END | ||
| 921 | |||
| 922 | if (%wanna_see && !$lax) { | ||
| 923 | @missing = keys %wanna_see; | ||
| 924 | warn "$0: $Filename is missing required section" | ||
| 925 | . (@missing > 1 && "s") | ||
| 926 | . ": @missing\n"; | ||
| 927 | $oops++; | ||
| 928 | } | ||
| 929 | |||
| 930 | foreach (@Indices) { print "$_\n"; } | ||
| 931 | |||
| 932 | exit; | ||
| 933 | #exit ($oops != 0); | ||
| 934 | |||
| 935 | ######################################################################### | ||
| 936 | |||
| 937 | sub nobreak { | ||
| 938 | my $string = shift; | ||
| 939 | $string =~ s/ /\\ /g; | ||
| 940 | $string; | ||
| 941 | } | ||
| 942 | |||
| 943 | sub escapes { | ||
| 944 | my $indot = shift; | ||
| 945 | |||
| 946 | s/X<(.*?)>/mkindex($1)/ge; | ||
| 947 | |||
| 948 | # translate the minus in foo-bar into foo\-bar for roff | ||
| 949 | s/([^0-9a-z-])-([^-])/$1\\-$2/g; | ||
| 950 | |||
| 951 | # make -- into the string version \*(-- (defined above) | ||
| 952 | s/\b--\b/\\*(--/g; | ||
| 953 | s/"--([^"])/"\\*(--$1/g; # should be a better way | ||
| 954 | s/([^"])--"/$1\\*(--"/g; | ||
| 955 | |||
| 956 | # fix up quotes; this is somewhat tricky | ||
| 957 | my $dotmacroL = 'L'; | ||
| 958 | my $dotmacroR = 'R'; | ||
| 959 | if ( $indot == 1 ) { | ||
| 960 | $dotmacroL = 'M'; | ||
| 961 | $dotmacroR = 'S'; | ||
| 962 | } | ||
| 963 | elsif ( $indot >= 2 ) { | ||
| 964 | $dotmacroL = 'N'; | ||
| 965 | $dotmacroR = 'T'; | ||
| 966 | } | ||
| 967 | if (!/""/) { | ||
| 968 | s/(^|\s)(['"])/noremap("$1\\*($dotmacroL$2")/ge; | ||
| 969 | s/(['"])($|[\-\s,;\\!?.])/noremap("\\*($dotmacroR$1$2")/ge; | ||
| 970 | } | ||
| 971 | |||
| 972 | #s/(?!")(?:.)--(?!")(?:.)/\\*(--/g; | ||
| 973 | #s/(?:(?!")(?:.)--(?:"))|(?:(?:")--(?!")(?:.))/\\*(--/g; | ||
| 974 | |||
| 975 | |||
| 976 | # make sure that func() keeps a bit a space tween the parens | ||
| 977 | ### s/\b\(\)/\\|()/g; | ||
| 978 | ### s/\b\(\)/(\\|)/g; | ||
| 979 | |||
| 980 | # make C++ into \*C+, which is a squinched version (defined above) | ||
| 981 | s/\bC\+\+/\\*(C+/g; | ||
| 982 | |||
| 983 | # make double underbars have a little tiny space between them | ||
| 984 | s/__/_\\|_/g; | ||
| 985 | |||
| 986 | # PI goes to \*(PI (defined above) | ||
| 987 | s/\bPI\b/noremap('\\*(PI')/ge; | ||
| 988 | |||
| 989 | # make all caps a teeny bit smaller, but don't muck with embedded code literals | ||
| 990 | my $hidCFont = font('C'); | ||
| 991 | if ($Cmd !~ /^head1/) { # SH already makes smaller | ||
| 992 | # /g isn't enough; 1 while or we'll be off | ||
| 993 | |||
| 994 | # 1 while s{ | ||
| 995 | # (?!$hidCFont)(..|^.|^) | ||
| 996 | # \b | ||
| 997 | # ( | ||
| 998 | # [A-Z][\/A-Z+:\-\d_$.]+ | ||
| 999 | # ) | ||
| 1000 | # (s?) | ||
| 1001 | # \b | ||
| 1002 | # } {$1\\s-1$2\\s0}gmox; | ||
| 1003 | |||
| 1004 | 1 while s{ | ||
| 1005 | (?!$hidCFont)(..|^.|^) | ||
| 1006 | ( | ||
| 1007 | \b[A-Z]{2,}[\/A-Z+:\-\d_\$]*\b | ||
| 1008 | ) | ||
| 1009 | } { | ||
| 1010 | $1 . noremap( '\\s-1' . $2 . '\\s0' ) | ||
| 1011 | }egmox; | ||
| 1012 | |||
| 1013 | } | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | # make troff just be normal, but make small nroff get quoted | ||
| 1017 | # decided to just put the quotes in the text; sigh; | ||
| 1018 | sub ccvt { | ||
| 1019 | local($_,$prev) = @_; | ||
| 1020 | noremap(qq{.CQ "$_" \n\\&}); | ||
| 1021 | } | ||
| 1022 | |||
| 1023 | sub makespace { | ||
| 1024 | if ($indent) { | ||
| 1025 | print ".Sp\n"; | ||
| 1026 | } | ||
| 1027 | else { | ||
| 1028 | print ".PP\n"; | ||
| 1029 | } | ||
| 1030 | } | ||
| 1031 | |||
| 1032 | sub mkindex { | ||
| 1033 | my ($entry) = @_; | ||
| 1034 | my @entries = split m:\s*/\s*:, $entry; | ||
| 1035 | push @Indices, ".IX Xref " . join ' ', map {qq("$_")} @entries; | ||
| 1036 | return ''; | ||
| 1037 | } | ||
| 1038 | |||
| 1039 | sub font { | ||
| 1040 | local($font) = shift; | ||
| 1041 | return '\\f' . noremap($font); | ||
| 1042 | } | ||
| 1043 | |||
| 1044 | sub noremap { | ||
| 1045 | local($thing_to_hide) = shift; | ||
| 1046 | $thing_to_hide =~ tr/\000-\177/\200-\377/; | ||
| 1047 | return $thing_to_hide; | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | sub init_noremap { | ||
| 1051 | # escape high bit characters in input stream | ||
| 1052 | s/([\200-\377])/"E<".ord($1).">"/ge; | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | sub clear_noremap { | ||
| 1056 | my $ready_to_print = $_[0]; | ||
| 1057 | |||
| 1058 | tr/\200-\377/\000-\177/; | ||
| 1059 | |||
| 1060 | # trofficate backslashes | ||
| 1061 | # s/(?!\\e)(?:..|^.|^)\\/\\e/g; | ||
| 1062 | |||
| 1063 | # now for the E<>s, which have been hidden until now | ||
| 1064 | # otherwise the interative \w<> processing would have | ||
| 1065 | # been hosed by the E<gt> | ||
| 1066 | s { | ||
| 1067 | E< | ||
| 1068 | ( | ||
| 1069 | ( \d + ) | ||
| 1070 | | ( [A-Za-z]+ ) | ||
| 1071 | ) | ||
| 1072 | > | ||
| 1073 | } { | ||
| 1074 | do { | ||
| 1075 | defined $2 | ||
| 1076 | ? chr($2) | ||
| 1077 | : | ||
| 1078 | exists $HTML_Escapes{$3} | ||
| 1079 | ? do { $HTML_Escapes{$3} } | ||
| 1080 | : do { | ||
| 1081 | warn "$0: Unknown escape in paragraph $. of $ARGV: ``$&''\n"; | ||
| 1082 | "E<$1>"; | ||
| 1083 | } | ||
| 1084 | } | ||
| 1085 | }egx if $ready_to_print; | ||
| 1086 | } | ||
| 1087 | |||
| 1088 | sub internal_lrefs { | ||
| 1089 | local($_) = shift; | ||
| 1090 | local $trailing_and = s/and\s+$// ? "and " : ""; | ||
| 1091 | |||
| 1092 | s{L</([^>]+)>}{$1}g; | ||
| 1093 | my(@items) = split( /(?:,?\s+(?:and\s+)?)/ ); | ||
| 1094 | my $retstr = "the "; | ||
| 1095 | my $i; | ||
| 1096 | for ($i = 0; $i <= $#items; $i++) { | ||
| 1097 | $retstr .= "C<$items[$i]>"; | ||
| 1098 | $retstr .= ", " if @items > 2 && $i != $#items; | ||
| 1099 | $retstr .= " and " if $i+2 == @items; | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | $retstr .= " entr" . ( @items > 1 ? "ies" : "y" ) | ||
| 1103 | . " elsewhere in this document"; | ||
| 1104 | # terminal space to avoid words running together (pattern used | ||
| 1105 | # strips terminal spaces) | ||
| 1106 | $retstr .= " " if length $trailing_and; | ||
| 1107 | $retstr .= $trailing_and; | ||
| 1108 | |||
| 1109 | return $retstr; | ||
| 1110 | |||
| 1111 | } | ||
| 1112 | |||
| 1113 | BEGIN { | ||
| 1114 | %HTML_Escapes = ( | ||
| 1115 | 'amp' => '&', # ampersand | ||
| 1116 | 'lt' => '<', # left chevron, less-than | ||
| 1117 | 'gt' => '>', # right chevron, greater-than | ||
| 1118 | 'quot' => '"', # double quote | ||
| 1119 | |||
| 1120 | "Aacute" => "A\\*'", # capital A, acute accent | ||
| 1121 | "aacute" => "a\\*'", # small a, acute accent | ||
| 1122 | "Acirc" => "A\\*^", # capital A, circumflex accent | ||
| 1123 | "acirc" => "a\\*^", # small a, circumflex accent | ||
| 1124 | "AElig" => '\*(AE', # capital AE diphthong (ligature) | ||
| 1125 | "aelig" => '\*(ae', # small ae diphthong (ligature) | ||
| 1126 | "Agrave" => "A\\*`", # capital A, grave accent | ||
| 1127 | "agrave" => "A\\*`", # small a, grave accent | ||
| 1128 | "Aring" => 'A\\*o', # capital A, ring | ||
| 1129 | "aring" => 'a\\*o', # small a, ring | ||
| 1130 | "Atilde" => 'A\\*~', # capital A, tilde | ||
| 1131 | "atilde" => 'a\\*~', # small a, tilde | ||
| 1132 | "Auml" => 'A\\*:', # capital A, dieresis or umlaut mark | ||
| 1133 | "auml" => 'a\\*:', # small a, dieresis or umlaut mark | ||
| 1134 | "Ccedil" => 'C\\*,', # capital C, cedilla | ||
| 1135 | "ccedil" => 'c\\*,', # small c, cedilla | ||
| 1136 | "Eacute" => "E\\*'", # capital E, acute accent | ||
| 1137 | "eacute" => "e\\*'", # small e, acute accent | ||
| 1138 | "Ecirc" => "E\\*^", # capital E, circumflex accent | ||
| 1139 | "ecirc" => "e\\*^", # small e, circumflex accent | ||
| 1140 | "Egrave" => "E\\*`", # capital E, grave accent | ||
| 1141 | "egrave" => "e\\*`", # small e, grave accent | ||
| 1142 | "ETH" => '\\*(D-', # capital Eth, Icelandic | ||
| 1143 | "eth" => '\\*(d-', # small eth, Icelandic | ||
| 1144 | "Euml" => "E\\*:", # capital E, dieresis or umlaut mark | ||
| 1145 | "euml" => "e\\*:", # small e, dieresis or umlaut mark | ||
| 1146 | "Iacute" => "I\\*'", # capital I, acute accent | ||
| 1147 | "iacute" => "i\\*'", # small i, acute accent | ||
| 1148 | "Icirc" => "I\\*^", # capital I, circumflex accent | ||
| 1149 | "icirc" => "i\\*^", # small i, circumflex accent | ||
| 1150 | "Igrave" => "I\\*`", # capital I, grave accent | ||
| 1151 | "igrave" => "i\\*`", # small i, grave accent | ||
| 1152 | "Iuml" => "I\\*:", # capital I, dieresis or umlaut mark | ||
| 1153 | "iuml" => "i\\*:", # small i, dieresis or umlaut mark | ||
| 1154 | "Ntilde" => 'N\*~', # capital N, tilde | ||
| 1155 | "ntilde" => 'n\*~', # small n, tilde | ||
| 1156 | "Oacute" => "O\\*'", # capital O, acute accent | ||
| 1157 | "oacute" => "o\\*'", # small o, acute accent | ||
| 1158 | "Ocirc" => "O\\*^", # capital O, circumflex accent | ||
| 1159 | "ocirc" => "o\\*^", # small o, circumflex accent | ||
| 1160 | "Ograve" => "O\\*`", # capital O, grave accent | ||
| 1161 | "ograve" => "o\\*`", # small o, grave accent | ||
| 1162 | "Oslash" => "O\\*/", # capital O, slash | ||
| 1163 | "oslash" => "o\\*/", # small o, slash | ||
| 1164 | "Otilde" => "O\\*~", # capital O, tilde | ||
| 1165 | "otilde" => "o\\*~", # small o, tilde | ||
| 1166 | "Ouml" => "O\\*:", # capital O, dieresis or umlaut mark | ||
| 1167 | "ouml" => "o\\*:", # small o, dieresis or umlaut mark | ||
| 1168 | "szlig" => '\*8', # small sharp s, German (sz ligature) | ||
| 1169 | "THORN" => '\\*(Th', # capital THORN, Icelandic | ||
| 1170 | "thorn" => '\\*(th',, # small thorn, Icelandic | ||
| 1171 | "Uacute" => "U\\*'", # capital U, acute accent | ||
| 1172 | "uacute" => "u\\*'", # small u, acute accent | ||
| 1173 | "Ucirc" => "U\\*^", # capital U, circumflex accent | ||
| 1174 | "ucirc" => "u\\*^", # small u, circumflex accent | ||
| 1175 | "Ugrave" => "U\\*`", # capital U, grave accent | ||
| 1176 | "ugrave" => "u\\*`", # small u, grave accent | ||
| 1177 | "Uuml" => "U\\*:", # capital U, dieresis or umlaut mark | ||
| 1178 | "uuml" => "u\\*:", # small u, dieresis or umlaut mark | ||
| 1179 | "Yacute" => "Y\\*'", # capital Y, acute accent | ||
| 1180 | "yacute" => "y\\*'", # small y, acute accent | ||
| 1181 | "yuml" => "y\\*:", # small y, dieresis or umlaut mark | ||
| 1182 | ); | ||
| 1183 | } | ||
| 1184 | |||
diff --git a/src/lib/libcrypto/util/pod2mantest b/src/lib/libcrypto/util/pod2mantest new file mode 100644 index 0000000000..384e683df4 --- /dev/null +++ b/src/lib/libcrypto/util/pod2mantest | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # This script is used by test/Makefile to check whether a sane 'pod2man' | ||
| 4 | # is installed. | ||
| 5 | # ('make install' should not try to run 'pod2man' if it does not exist or if | ||
| 6 | # it is a broken 'pod2man' version that is known to cause trouble. if we find | ||
| 7 | # the system 'pod2man' to be broken, we use our own copy instead) | ||
| 8 | # | ||
| 9 | # In any case, output an appropriate command line for running (or not | ||
| 10 | # running) pod2man. | ||
| 11 | |||
| 12 | |||
| 13 | IFS=: | ||
| 14 | if test "$OSTYPE" = "msdosdjgpp"; then IFS=";"; fi | ||
| 15 | |||
| 16 | try_without_dir=true | ||
| 17 | # First we try "pod2man", then "$dir/pod2man" for each item in $PATH. | ||
| 18 | for dir in dummy${IFS}$PATH; do | ||
| 19 | if [ "$try_without_dir" = true ]; then | ||
| 20 | # first iteration | ||
| 21 | pod2man=pod2man | ||
| 22 | try_without_dir=false | ||
| 23 | else | ||
| 24 | # second and later iterations | ||
| 25 | pod2man="$dir/pod2man" | ||
| 26 | if [ ! -f "$pod2man" ]; then # '-x' is not available on Ultrix | ||
| 27 | pod2man='' | ||
| 28 | fi | ||
| 29 | fi | ||
| 30 | |||
| 31 | if [ ! "$pod2man" = '' ]; then | ||
| 32 | failure=none | ||
| 33 | |||
| 34 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | fgrep OpenSSL >/dev/null; then | ||
| 35 | : | ||
| 36 | else | ||
| 37 | failure=BasicTest | ||
| 38 | fi | ||
| 39 | |||
| 40 | if [ "$failure" = none ]; then | ||
| 41 | if "$pod2man" --section=1 --center=OpenSSL --release=dev pod2mantest.pod | grep '^MARKER - ' >/dev/null; then | ||
| 42 | failure=MultilineTest | ||
| 43 | fi | ||
| 44 | fi | ||
| 45 | |||
| 46 | |||
| 47 | if [ "$failure" = none ]; then | ||
| 48 | echo "$pod2man" | ||
| 49 | exit 0 | ||
| 50 | fi | ||
| 51 | |||
| 52 | echo "$pod2man does not work properly ('$failure' failed). Looking for another pod2man ..." >&2 | ||
| 53 | fi | ||
| 54 | done | ||
| 55 | |||
| 56 | echo "No working pod2man found. Consider installing a new version." >&2 | ||
| 57 | echo "As a workaround, we'll use a bundled old copy of pod2man.pl." >&2 | ||
| 58 | echo "$1 ../../util/pod2man.pl" | ||
diff --git a/src/lib/libcrypto/util/pod2mantest.pod b/src/lib/libcrypto/util/pod2mantest.pod new file mode 100644 index 0000000000..5d2539a17f --- /dev/null +++ b/src/lib/libcrypto/util/pod2mantest.pod | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | foo, bar, | ||
| 6 | MARKER - test of multiline name section | ||
| 7 | |||
| 8 | =head1 DESCRIPTION | ||
| 9 | |||
| 10 | This is a test .pod file to see if we have a buggy pod2man or not. | ||
| 11 | If we have a buggy implementation, we will get a line matching the | ||
| 12 | regular expression "^ +MARKER - test of multiline name section *$" | ||
| 13 | at the end of the resulting document. | ||
| 14 | |||
| 15 | =cut | ||
diff --git a/src/lib/libcrypto/util/point.sh b/src/lib/libcrypto/util/point.sh new file mode 100644 index 0000000000..da39899cb1 --- /dev/null +++ b/src/lib/libcrypto/util/point.sh | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | rm -f "$2" | ||
| 4 | if test "$OSTYPE" = msdosdjgpp || test "x$PLATFORM" = xmingw ; then | ||
| 5 | cp "$1" "$2" | ||
| 6 | else | ||
| 7 | ln -s "$1" "$2" | ||
| 8 | fi | ||
| 9 | echo "$2 => $1" | ||
| 10 | |||
diff --git a/src/lib/libcrypto/util/selftest.pl b/src/lib/libcrypto/util/selftest.pl new file mode 100644 index 0000000000..7b32e9f4ff --- /dev/null +++ b/src/lib/libcrypto/util/selftest.pl | |||
| @@ -0,0 +1,201 @@ | |||
| 1 | #!/usr/local/bin/perl -w | ||
| 2 | # | ||
| 3 | # Run the test suite and generate a report | ||
| 4 | # | ||
| 5 | |||
| 6 | if (! -f "Configure") { | ||
| 7 | print "Please run perl util/selftest.pl in the OpenSSL directory.\n"; | ||
| 8 | exit 1; | ||
| 9 | } | ||
| 10 | |||
| 11 | my $report="testlog"; | ||
| 12 | my $os="??"; | ||
| 13 | my $version="??"; | ||
| 14 | my $platform0="??"; | ||
| 15 | my $platform="??"; | ||
| 16 | my $options="??"; | ||
| 17 | my $last="??"; | ||
| 18 | my $ok=0; | ||
| 19 | my $cc="cc"; | ||
| 20 | my $cversion="??"; | ||
| 21 | my $sep="-----------------------------------------------------------------------------\n"; | ||
| 22 | my $not_our_fault="\nPlease ask your system administrator/vendor for more information.\n[Problems with your operating system setup should not be reported\nto the OpenSSL project.]\n"; | ||
| 23 | |||
| 24 | open(OUT,">$report") or die; | ||
| 25 | |||
| 26 | print OUT "OpenSSL self-test report:\n\n"; | ||
| 27 | |||
| 28 | $uname=`uname -a`; | ||
| 29 | $uname="??\n" if $uname eq ""; | ||
| 30 | |||
| 31 | $c=`sh config -t`; | ||
| 32 | foreach $_ (split("\n",$c)) { | ||
| 33 | $os=$1 if (/Operating system: (.*)$/); | ||
| 34 | $platform0=$1 if (/Configuring for (.*)$/); | ||
| 35 | } | ||
| 36 | |||
| 37 | system "sh config" if (! -f "Makefile"); | ||
| 38 | |||
| 39 | if (open(IN,"<Makefile")) { | ||
| 40 | while (<IN>) { | ||
| 41 | $version=$1 if (/^VERSION=(.*)$/); | ||
| 42 | $platform=$1 if (/^PLATFORM=(.*)$/); | ||
| 43 | $options=$1 if (/^OPTIONS=(.*)$/); | ||
| 44 | $cc=$1 if (/^CC= *(.*)$/); | ||
| 45 | } | ||
| 46 | close(IN); | ||
| 47 | } else { | ||
| 48 | print OUT "Error running config!\n"; | ||
| 49 | } | ||
| 50 | |||
| 51 | $cversion=`$cc -v 2>&1`; | ||
| 52 | $cversion=`$cc -V 2>&1` if $cversion =~ "[Uu]sage"; | ||
| 53 | $cversion=`$cc -V |head -1` if $cversion =~ "Error"; | ||
| 54 | $cversion=`$cc --version` if $cversion eq ""; | ||
| 55 | $cversion =~ s/Reading specs.*\n//; | ||
| 56 | $cversion =~ s/usage.*\n//; | ||
| 57 | chomp $cversion; | ||
| 58 | |||
| 59 | if (open(IN,"<CHANGES")) { | ||
| 60 | while(<IN>) { | ||
| 61 | if (/\*\) (.{0,55})/ && !/applies to/) { | ||
| 62 | $last=$1; | ||
| 63 | last; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | close(IN); | ||
| 67 | } | ||
| 68 | |||
| 69 | print OUT "OpenSSL version: $version\n"; | ||
| 70 | print OUT "Last change: $last...\n"; | ||
| 71 | print OUT "Options: $options\n" if $options ne ""; | ||
| 72 | print OUT "OS (uname): $uname"; | ||
| 73 | print OUT "OS (config): $os\n"; | ||
| 74 | print OUT "Target (default): $platform0\n"; | ||
| 75 | print OUT "Target: $platform\n"; | ||
| 76 | print OUT "Compiler: $cversion\n"; | ||
| 77 | print OUT "\n"; | ||
| 78 | |||
| 79 | print "Checking compiler...\n"; | ||
| 80 | if (open(TEST,">cctest.c")) { | ||
| 81 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; | ||
| 82 | close(TEST); | ||
| 83 | system("$cc -o cctest cctest.c"); | ||
| 84 | if (`./cctest` !~ /Hello world/) { | ||
| 85 | print OUT "Compiler doesn't work.\n"; | ||
| 86 | print OUT $not_our_fault; | ||
| 87 | goto err; | ||
| 88 | } | ||
| 89 | system("ar r cctest.a /dev/null"); | ||
| 90 | if (not -f "cctest.a") { | ||
| 91 | print OUT "Check your archive tool (ar).\n"; | ||
| 92 | print OUT $not_our_fault; | ||
| 93 | goto err; | ||
| 94 | } | ||
| 95 | } else { | ||
| 96 | print OUT "Can't create cctest.c\n"; | ||
| 97 | } | ||
| 98 | if (open(TEST,">cctest.c")) { | ||
| 99 | print TEST "#include <stdio.h>\n#include <stdlib.h>\n#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; | ||
| 100 | close(TEST); | ||
| 101 | system("$cc -o cctest -Iinclude cctest.c"); | ||
| 102 | $cctest = `./cctest`; | ||
| 103 | if ($cctest !~ /OpenSSL $version/) { | ||
| 104 | if ($cctest =~ /OpenSSL/) { | ||
| 105 | print OUT "#include uses headers from different OpenSSL version!\n"; | ||
| 106 | } else { | ||
| 107 | print OUT "Can't compile test program!\n"; | ||
| 108 | } | ||
| 109 | print OUT $not_our_fault; | ||
| 110 | goto err; | ||
| 111 | } | ||
| 112 | } else { | ||
| 113 | print OUT "Can't create cctest.c\n"; | ||
| 114 | } | ||
| 115 | |||
| 116 | print "Running make...\n"; | ||
| 117 | if (system("make 2>&1 | tee make.log") > 255) { | ||
| 118 | |||
| 119 | print OUT "make failed!\n"; | ||
| 120 | if (open(IN,"<make.log")) { | ||
| 121 | print OUT $sep; | ||
| 122 | while (<IN>) { | ||
| 123 | print OUT; | ||
| 124 | } | ||
| 125 | close(IN); | ||
| 126 | print OUT $sep; | ||
| 127 | } else { | ||
| 128 | print OUT "make.log not found!\n"; | ||
| 129 | } | ||
| 130 | goto err; | ||
| 131 | } | ||
| 132 | |||
| 133 | # Not sure why this is here. The tests themselves can detect if their | ||
| 134 | # particular feature isn't included, and should therefore skip themselves. | ||
| 135 | # To skip *all* tests just because one algorithm isn't included is like | ||
| 136 | # shooting mosquito with an elephant gun... | ||
| 137 | # -- Richard Levitte, inspired by problem report 1089 | ||
| 138 | # | ||
| 139 | #$_=$options; | ||
| 140 | #s/no-asm//; | ||
| 141 | #s/no-shared//; | ||
| 142 | #s/no-krb5//; | ||
| 143 | #if (/no-/) | ||
| 144 | #{ | ||
| 145 | # print OUT "Test skipped.\n"; | ||
| 146 | # goto err; | ||
| 147 | #} | ||
| 148 | |||
| 149 | print "Running make test...\n"; | ||
| 150 | if (system("make test 2>&1 | tee maketest.log") > 255) | ||
| 151 | { | ||
| 152 | print OUT "make test failed!\n"; | ||
| 153 | } else { | ||
| 154 | $ok=1; | ||
| 155 | } | ||
| 156 | |||
| 157 | if ($ok and open(IN,"<maketest.log")) { | ||
| 158 | while (<IN>) { | ||
| 159 | $ok=2 if /^platform: $platform/; | ||
| 160 | } | ||
| 161 | close(IN); | ||
| 162 | } | ||
| 163 | |||
| 164 | if ($ok != 2) { | ||
| 165 | print OUT "Failure!\n"; | ||
| 166 | if (open(IN,"<make.log")) { | ||
| 167 | print OUT $sep; | ||
| 168 | while (<IN>) { | ||
| 169 | print OUT; | ||
| 170 | } | ||
| 171 | close(IN); | ||
| 172 | print OUT $sep; | ||
| 173 | } else { | ||
| 174 | print OUT "make.log not found!\n"; | ||
| 175 | } | ||
| 176 | if (open(IN,"<maketest.log")) { | ||
| 177 | while (<IN>) { | ||
| 178 | print OUT; | ||
| 179 | } | ||
| 180 | close(IN); | ||
| 181 | print OUT $sep; | ||
| 182 | } else { | ||
| 183 | print OUT "maketest.log not found!\n"; | ||
| 184 | } | ||
| 185 | } else { | ||
| 186 | print OUT "Test passed.\n"; | ||
| 187 | } | ||
| 188 | err: | ||
| 189 | close(OUT); | ||
| 190 | |||
| 191 | print "\n"; | ||
| 192 | open(IN,"<$report") or die; | ||
| 193 | while (<IN>) { | ||
| 194 | if (/$sep/) { | ||
| 195 | print "[...]\n"; | ||
| 196 | last; | ||
| 197 | } | ||
| 198 | print; | ||
| 199 | } | ||
| 200 | print "\nTest report in file $report\n"; | ||
| 201 | |||
diff --git a/src/lib/libcrypto/util/shlib_wrap.sh b/src/lib/libcrypto/util/shlib_wrap.sh new file mode 100755 index 0000000000..9416d593d2 --- /dev/null +++ b/src/lib/libcrypto/util/shlib_wrap.sh | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | [ $# -ne 0 ] || set -x # debug mode without arguments:-) | ||
| 4 | |||
| 5 | THERE="`echo $0 | sed -e 's|[^/]*$||' 2>/dev/null`.." | ||
| 6 | [ -d "${THERE}" ] || exec "$@" # should never happen... | ||
| 7 | |||
| 8 | # Alternative to this is to parse ${THERE}/Makefile... | ||
| 9 | LIBCRYPTOSO="${THERE}/libcrypto.so" | ||
| 10 | if [ -f "$LIBCRYPTOSO" ]; then | ||
| 11 | while [ -h "$LIBCRYPTOSO" ]; do | ||
| 12 | LIBCRYPTOSO="${THERE}/`ls -l "$LIBCRYPTOSO" | sed -e 's|.*\-> ||'`" | ||
| 13 | done | ||
| 14 | SOSUFFIX=`echo ${LIBCRYPTOSO} | sed -e 's|.*\.so||' 2>/dev/null` | ||
| 15 | LIBSSLSO="${THERE}/libssl.so${SOSUFFIX}" | ||
| 16 | fi | ||
| 17 | |||
| 18 | SYSNAME=`(uname -s) 2>/dev/null`; | ||
| 19 | case "$SYSNAME" in | ||
| 20 | SunOS|IRIX*) | ||
| 21 | # SunOS and IRIX run-time linkers evaluate alternative | ||
| 22 | # variables depending on target ABI... | ||
| 23 | rld_var=LD_LIBRARY_PATH | ||
| 24 | case "`(/usr/bin/file "$LIBCRYPTOSO") 2>/dev/null`" in | ||
| 25 | *ELF\ 64*SPARC*|*ELF\ 64*AMD64*) | ||
| 26 | [ -n "$LD_LIBRARY_PATH_64" ] && rld_var=LD_LIBRARY_PATH_64 | ||
| 27 | LD_PRELOAD_64="$LIBCRYPTOSO $LIBSSLSO"; export LD_PRELOAD_64 | ||
| 28 | preload_var=LD_PRELOAD_64 | ||
| 29 | ;; | ||
| 30 | # Why are newly built .so's preloaded anyway? Because run-time | ||
| 31 | # .so lookup path embedded into application takes precedence | ||
| 32 | # over LD_LIBRARY_PATH and as result application ends up linking | ||
| 33 | # to previously installed .so's. On IRIX instead of preloading | ||
| 34 | # newly built .so's we trick run-time linker to fail to find | ||
| 35 | # the installed .so by setting _RLD_ROOT variable. | ||
| 36 | *ELF\ 32*MIPS*) | ||
| 37 | #_RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD_LIST | ||
| 38 | _RLD_ROOT=/no/such/dir; export _RLD_ROOT | ||
| 39 | eval $rld_var=\"/usr/lib'${'$rld_var':+:$'$rld_var'}'\" | ||
| 40 | preload_var=_RLD_LIST | ||
| 41 | ;; | ||
| 42 | *ELF\ N32*MIPS*) | ||
| 43 | [ -n "$LD_LIBRARYN32_PATH" ] && rld_var=LD_LIBRARYN32_PATH | ||
| 44 | #_RLDN32_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLDN32_LIST | ||
| 45 | _RLDN32_ROOT=/no/such/dir; export _RLDN32_ROOT | ||
| 46 | eval $rld_var=\"/usr/lib32'${'$rld_var':+:$'$rld_var'}'\" | ||
| 47 | preload_var=_RLDN32_LIST | ||
| 48 | ;; | ||
| 49 | *ELF\ 64*MIPS*) | ||
| 50 | [ -n "$LD_LIBRARY64_PATH" ] && rld_var=LD_LIBRARY64_PATH | ||
| 51 | #_RLD64_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT"; export _RLD64_LIST | ||
| 52 | _RLD64_ROOT=/no/such/dir; export _RLD64_ROOT | ||
| 53 | eval $rld_var=\"/usr/lib64'${'$rld_var':+:$'$rld_var'}'\" | ||
| 54 | preload_var=_RLD64_LIST | ||
| 55 | ;; | ||
| 56 | esac | ||
| 57 | eval $rld_var=\"${THERE}'${'$rld_var':+:$'$rld_var'}'\"; export $rld_var | ||
| 58 | unset rld_var | ||
| 59 | ;; | ||
| 60 | *) LD_LIBRARY_PATH="${THERE}:$LD_LIBRARY_PATH" # Linux, ELF HP-UX | ||
| 61 | DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X | ||
| 62 | SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX | ||
| 63 | LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2 | ||
| 64 | export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH | ||
| 65 | # Even though $PATH is adjusted [for Windows sake], it doesn't | ||
| 66 | # necessarily does the trick. Trouble is that with introduction | ||
| 67 | # of SafeDllSearchMode in XP/2003 it's more appropriate to copy | ||
| 68 | # .DLLs in vicinity of executable, which is done elsewhere... | ||
| 69 | if [ "$OSTYPE" != msdosdjgpp ]; then | ||
| 70 | PATH="${THERE}:$PATH"; export PATH | ||
| 71 | fi | ||
| 72 | ;; | ||
| 73 | esac | ||
| 74 | |||
| 75 | if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then | ||
| 76 | # Following three lines are major excuse for isolating them into | ||
| 77 | # this wrapper script. Original reason for setting LD_PRELOAD | ||
| 78 | # was to make it possible to pass 'make test' when user linked | ||
| 79 | # with -rpath pointing to previous version installation. Wrapping | ||
| 80 | # it into a script makes it possible to do so on multi-ABI | ||
| 81 | # platforms. | ||
| 82 | case "$SYSNAME" in | ||
| 83 | *BSD|QNX) LD_PRELOAD="$LIBCRYPTOSO:$LIBSSLSO" ;; # *BSD, QNX | ||
| 84 | *) LD_PRELOAD="$LIBCRYPTOSO $LIBSSLSO" ;; # SunOS, Linux, ELF HP-UX | ||
| 85 | esac | ||
| 86 | _RLD_LIST="$LIBCRYPTOSO:$LIBSSLSO:DEFAULT" # Tru64, o32 IRIX | ||
| 87 | DYLD_INSERT_LIBRARIES="$LIBCRYPTOSO:$LIBSSLSO" # MacOS X | ||
| 88 | export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES | ||
| 89 | fi | ||
| 90 | |||
| 91 | cmd="$1${EXE_EXT}" | ||
| 92 | shift | ||
| 93 | exec "$cmd" "$@" | ||
diff --git a/src/lib/libcrypto/util/sp-diff.pl b/src/lib/libcrypto/util/sp-diff.pl new file mode 100644 index 0000000000..9d6c60387f --- /dev/null +++ b/src/lib/libcrypto/util/sp-diff.pl | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | # | ||
| 3 | # This file takes as input, the files that have been output from | ||
| 4 | # ssleay speed. | ||
| 5 | # It prints a table of the relative differences with %100 being 'no difference' | ||
| 6 | # | ||
| 7 | |||
| 8 | ($#ARGV == 1) || die "$0 speedout1 speedout2\n"; | ||
| 9 | |||
| 10 | %one=&loadfile($ARGV[0]); | ||
| 11 | %two=&loadfile($ARGV[1]); | ||
| 12 | |||
| 13 | $line=0; | ||
| 14 | foreach $a ("md2","md4","md5","sha","sha1","rc4","des cfb","des cbc","des ede3", | ||
| 15 | "idea cfb","idea cbc","rc2 cfb","rc2 cbc","blowfish cbc","cast cbc") | ||
| 16 | { | ||
| 17 | if (defined($one{$a,8}) && defined($two{$a,8})) | ||
| 18 | { | ||
| 19 | print "type 8 byte% 64 byte% 256 byte% 1024 byte% 8192 byte%\n" | ||
| 20 | unless $line; | ||
| 21 | $line++; | ||
| 22 | printf "%-12s ",$a; | ||
| 23 | foreach $b (8,64,256,1024,8192) | ||
| 24 | { | ||
| 25 | $r=$two{$a,$b}/$one{$a,$b}*100; | ||
| 26 | printf "%12.2f",$r; | ||
| 27 | } | ||
| 28 | print "\n"; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | foreach $a ( | ||
| 33 | "rsa 512","rsa 1024","rsa 2048","rsa 4096", | ||
| 34 | "dsa 512","dsa 1024","dsa 2048", | ||
| 35 | ) | ||
| 36 | { | ||
| 37 | if (defined($one{$a,1}) && defined($two{$a,1})) | ||
| 38 | { | ||
| 39 | $r1=($one{$a,1}/$two{$a,1})*100; | ||
| 40 | $r2=($one{$a,2}/$two{$a,2})*100; | ||
| 41 | printf "$a bits %% %6.2f %% %6.2f\n",$r1,$r2; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | sub loadfile | ||
| 46 | { | ||
| 47 | local($file)=@_; | ||
| 48 | local($_,%ret); | ||
| 49 | |||
| 50 | open(IN,"<$file") || die "unable to open '$file' for input\n"; | ||
| 51 | $header=1; | ||
| 52 | while (<IN>) | ||
| 53 | { | ||
| 54 | $header=0 if /^[dr]sa/; | ||
| 55 | if (/^type/) { $header=0; next; } | ||
| 56 | next if $header; | ||
| 57 | chop; | ||
| 58 | @a=split; | ||
| 59 | if ($a[0] =~ /^[dr]sa$/) | ||
| 60 | { | ||
| 61 | ($n,$t1,$t2)=($_ =~ /^([dr]sa\s+\d+)\s+bits\s+([.\d]+)s\s+([.\d]+)/); | ||
| 62 | $ret{$n,1}=$t1; | ||
| 63 | $ret{$n,2}=$t2; | ||
| 64 | } | ||
| 65 | else | ||
| 66 | { | ||
| 67 | $n=join(' ',grep(/[^k]$/,@a)); | ||
| 68 | @k=grep(s/k$//,@a); | ||
| 69 | |||
| 70 | $ret{$n, 8}=$k[0]; | ||
| 71 | $ret{$n, 64}=$k[1]; | ||
| 72 | $ret{$n, 256}=$k[2]; | ||
| 73 | $ret{$n,1024}=$k[3]; | ||
| 74 | $ret{$n,8192}=$k[4]; | ||
| 75 | } | ||
| 76 | } | ||
| 77 | close(IN); | ||
| 78 | return(%ret); | ||
| 79 | } | ||
| 80 | |||
diff --git a/src/lib/libcrypto/util/speed.sh b/src/lib/libcrypto/util/speed.sh new file mode 100644 index 0000000000..f489706197 --- /dev/null +++ b/src/lib/libcrypto/util/speed.sh | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # | ||
| 4 | # This is a ugly script use, in conjuction with editing the 'b' | ||
| 5 | # configuration in the $(TOP)/Configure script which will | ||
| 6 | # output when finished a file called speed.log which is the | ||
| 7 | # timings of SSLeay with various options turned on or off. | ||
| 8 | # | ||
| 9 | # from the $(TOP) directory | ||
| 10 | # Edit Configure, modifying things to do with the b/bl-4c-2c etc | ||
| 11 | # configurations. | ||
| 12 | # | ||
| 13 | |||
| 14 | make clean | ||
| 15 | perl Configure b | ||
| 16 | make | ||
| 17 | apps/ssleay version -v -b -f >speed.1 | ||
| 18 | apps/ssleay speed >speed.1l | ||
| 19 | |||
| 20 | perl Configure bl-4c-2c | ||
| 21 | /bin/rm -f crypto/rc4/*.o crypto/bn/bn*.o crypto/md2/md2_dgst.o | ||
| 22 | make | ||
| 23 | apps/ssleay speed rc4 rsa md2 >speed.2l | ||
| 24 | |||
| 25 | perl Configure bl-4c-ri | ||
| 26 | /bin/rm -f crypto/rc4/rc4*.o | ||
| 27 | make | ||
| 28 | apps/ssleay speed rc4 >speed.3l | ||
| 29 | |||
| 30 | perl Configure b2-is-ri-dp | ||
| 31 | /bin/rm -f crypto/idea/i_*.o crypto/rc4/*.o crypto/des/ecb_enc.o crypto/bn/bn*.o | ||
| 32 | apps/ssleay speed rsa rc4 idea des >speed.4l | ||
| 33 | |||
| 34 | cat speed.1 >speed.log | ||
| 35 | cat speed.1l >>speed.log | ||
| 36 | perl util/sp-diff.pl speed.1l speed.2l >>speed.log | ||
| 37 | perl util/sp-diff.pl speed.1l speed.3l >>speed.log | ||
| 38 | perl util/sp-diff.pl speed.1l speed.4l >>speed.log | ||
| 39 | |||
diff --git a/src/lib/libcrypto/util/src-dep.pl b/src/lib/libcrypto/util/src-dep.pl new file mode 100644 index 0000000000..ad997e4746 --- /dev/null +++ b/src/lib/libcrypto/util/src-dep.pl | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | # we make up an array of | ||
| 4 | # $file{function_name}=filename; | ||
| 5 | # $unres{filename}="func1 func2 ...." | ||
| 6 | $debug=1; | ||
| 7 | #$nm_func="parse_linux"; | ||
| 8 | $nm_func="parse_solaris"; | ||
| 9 | |||
| 10 | foreach (@ARGV) | ||
| 11 | { | ||
| 12 | &$nm_func($_); | ||
| 13 | } | ||
| 14 | |||
| 15 | foreach $file (sort keys %unres) | ||
| 16 | { | ||
| 17 | @a=split(/\s+/,$unres{$file}); | ||
| 18 | %ff=(); | ||
| 19 | foreach $func (@a) | ||
| 20 | { | ||
| 21 | $f=$file{$func}; | ||
| 22 | $ff{$f}=1 if $f ne ""; | ||
| 23 | } | ||
| 24 | |||
| 25 | foreach $a (keys %ff) | ||
| 26 | { $we_need{$file}.="$a "; } | ||
| 27 | } | ||
| 28 | |||
| 29 | foreach $file (sort keys %we_need) | ||
| 30 | { | ||
| 31 | # print " $file $we_need{$file}\n"; | ||
| 32 | foreach $bit (split(/\s+/,$we_need{$file})) | ||
| 33 | { push(@final,&walk($bit)); } | ||
| 34 | |||
| 35 | foreach (@final) { $fin{$_}=1; } | ||
| 36 | @final=""; | ||
| 37 | foreach (sort keys %fin) | ||
| 38 | { push(@final,$_); } | ||
| 39 | |||
| 40 | print "$file: @final\n"; | ||
| 41 | } | ||
| 42 | |||
| 43 | sub walk | ||
| 44 | { | ||
| 45 | local($f)=@_; | ||
| 46 | local(@a,%seen,@ret,$r); | ||
| 47 | |||
| 48 | @ret=""; | ||
| 49 | $f =~ s/^\s+//; | ||
| 50 | $f =~ s/\s+$//; | ||
| 51 | return "" if ($f =~ "^\s*$"); | ||
| 52 | |||
| 53 | return(split(/\s/,$done{$f})) if defined ($done{$f}); | ||
| 54 | |||
| 55 | return if $in{$f} > 0; | ||
| 56 | $in{$f}++; | ||
| 57 | push(@ret,$f); | ||
| 58 | foreach $r (split(/\s+/,$we_need{$f})) | ||
| 59 | { | ||
| 60 | push(@ret,&walk($r)); | ||
| 61 | } | ||
| 62 | $in{$f}--; | ||
| 63 | $done{$f}=join(" ",@ret); | ||
| 64 | return(@ret); | ||
| 65 | } | ||
| 66 | |||
| 67 | sub parse_linux | ||
| 68 | { | ||
| 69 | local($name)=@_; | ||
| 70 | |||
| 71 | open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n"; | ||
| 72 | while (<IN>) | ||
| 73 | { | ||
| 74 | chop; | ||
| 75 | next if /^\s*$/; | ||
| 76 | if (/^[^[](.*):$/) | ||
| 77 | { | ||
| 78 | $file=$1; | ||
| 79 | $file="$1.c" if /\[(.*).o\]/; | ||
| 80 | print STDERR "$file\n"; | ||
| 81 | $we_need{$file}=" "; | ||
| 82 | next; | ||
| 83 | } | ||
| 84 | |||
| 85 | @a=split(/\s*\|\s*/); | ||
| 86 | next unless $#a == 7; | ||
| 87 | next unless $a[4] eq "GLOB"; | ||
| 88 | if ($a[6] eq "UNDEF") | ||
| 89 | { | ||
| 90 | $unres{$file}.=$a[7]." "; | ||
| 91 | } | ||
| 92 | else | ||
| 93 | { | ||
| 94 | if ($file{$a[7]} ne "") | ||
| 95 | { | ||
| 96 | print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n"; | ||
| 97 | } | ||
| 98 | else | ||
| 99 | { | ||
| 100 | $file{$a[7]}=$file; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | } | ||
| 104 | close(IN); | ||
| 105 | } | ||
| 106 | |||
| 107 | sub parse_solaris | ||
| 108 | { | ||
| 109 | local($name)=@_; | ||
| 110 | |||
| 111 | open(IN,"nm $name|") || die "unable to run 'nn $name':$!\n"; | ||
| 112 | while (<IN>) | ||
| 113 | { | ||
| 114 | chop; | ||
| 115 | next if /^\s*$/; | ||
| 116 | if (/^(\S+):$/) | ||
| 117 | { | ||
| 118 | $file=$1; | ||
| 119 | #$file="$1.c" if $file =~ /^(.*).o$/; | ||
| 120 | print STDERR "$file\n"; | ||
| 121 | $we_need{$file}=" "; | ||
| 122 | next; | ||
| 123 | } | ||
| 124 | @a=split(/\s*\|\s*/); | ||
| 125 | next unless $#a == 7; | ||
| 126 | next unless $a[4] eq "GLOB"; | ||
| 127 | if ($a[6] eq "UNDEF") | ||
| 128 | { | ||
| 129 | $unres{$file}.=$a[7]." "; | ||
| 130 | print STDERR "$file needs $a[7]\n" if $debug; | ||
| 131 | } | ||
| 132 | else | ||
| 133 | { | ||
| 134 | if ($file{$a[7]} ne "") | ||
| 135 | { | ||
| 136 | print STDERR "duplicate definition of $a[7],\n$file{$a[7]} and $file \n"; | ||
| 137 | } | ||
| 138 | else | ||
| 139 | { | ||
| 140 | $file{$a[7]}=$file; | ||
| 141 | print STDERR "$file has $a[7]\n" if $debug; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | } | ||
| 145 | close(IN); | ||
| 146 | } | ||
| 147 | |||
diff --git a/src/lib/libcrypto/util/ssleay.num b/src/lib/libcrypto/util/ssleay.num new file mode 100644 index 0000000000..15a58e7b13 --- /dev/null +++ b/src/lib/libcrypto/util/ssleay.num | |||
| @@ -0,0 +1,261 @@ | |||
| 1 | ERR_load_SSL_strings 1 EXIST::FUNCTION: | ||
| 2 | SSL_CIPHER_description 2 EXIST::FUNCTION: | ||
| 3 | SSL_CTX_add_client_CA 3 EXIST::FUNCTION: | ||
| 4 | SSL_CTX_add_session 4 EXIST::FUNCTION: | ||
| 5 | SSL_CTX_check_private_key 5 EXIST::FUNCTION: | ||
| 6 | SSL_CTX_ctrl 6 EXIST::FUNCTION: | ||
| 7 | SSL_CTX_flush_sessions 7 EXIST::FUNCTION: | ||
| 8 | SSL_CTX_free 8 EXIST::FUNCTION: | ||
| 9 | SSL_CTX_get_client_CA_list 9 EXIST::FUNCTION: | ||
| 10 | SSL_CTX_get_verify_callback 10 EXIST::FUNCTION: | ||
| 11 | SSL_CTX_get_verify_mode 11 EXIST::FUNCTION: | ||
| 12 | SSL_CTX_new 12 EXIST::FUNCTION: | ||
| 13 | SSL_CTX_remove_session 13 EXIST::FUNCTION: | ||
| 14 | SSL_CTX_set_cipher_list 15 EXIST::FUNCTION: | ||
| 15 | SSL_CTX_set_client_CA_list 16 EXIST::FUNCTION: | ||
| 16 | SSL_CTX_set_default_passwd_cb 17 EXIST::FUNCTION: | ||
| 17 | SSL_CTX_set_ssl_version 19 EXIST::FUNCTION: | ||
| 18 | SSL_CTX_set_verify 21 EXIST::FUNCTION: | ||
| 19 | SSL_CTX_use_PrivateKey 22 EXIST::FUNCTION: | ||
| 20 | SSL_CTX_use_PrivateKey_ASN1 23 EXIST::FUNCTION: | ||
| 21 | SSL_CTX_use_PrivateKey_file 24 EXIST::FUNCTION:STDIO | ||
| 22 | SSL_CTX_use_RSAPrivateKey 25 EXIST::FUNCTION:RSA | ||
| 23 | SSL_CTX_use_RSAPrivateKey_ASN1 26 EXIST::FUNCTION:RSA | ||
| 24 | SSL_CTX_use_RSAPrivateKey_file 27 EXIST::FUNCTION:RSA,STDIO | ||
| 25 | SSL_CTX_use_certificate 28 EXIST::FUNCTION: | ||
| 26 | SSL_CTX_use_certificate_ASN1 29 EXIST::FUNCTION: | ||
| 27 | SSL_CTX_use_certificate_file 30 EXIST::FUNCTION:STDIO | ||
| 28 | SSL_SESSION_free 31 EXIST::FUNCTION: | ||
| 29 | SSL_SESSION_new 32 EXIST::FUNCTION: | ||
| 30 | SSL_SESSION_print 33 EXIST::FUNCTION:BIO | ||
| 31 | SSL_SESSION_print_fp 34 EXIST::FUNCTION:FP_API | ||
| 32 | SSL_accept 35 EXIST::FUNCTION: | ||
| 33 | SSL_add_client_CA 36 EXIST::FUNCTION: | ||
| 34 | SSL_alert_desc_string 37 EXIST::FUNCTION: | ||
| 35 | SSL_alert_desc_string_long 38 EXIST::FUNCTION: | ||
| 36 | SSL_alert_type_string 39 EXIST::FUNCTION: | ||
| 37 | SSL_alert_type_string_long 40 EXIST::FUNCTION: | ||
| 38 | SSL_check_private_key 41 EXIST::FUNCTION: | ||
| 39 | SSL_clear 42 EXIST::FUNCTION: | ||
| 40 | SSL_connect 43 EXIST::FUNCTION: | ||
| 41 | SSL_copy_session_id 44 EXIST::FUNCTION: | ||
| 42 | SSL_ctrl 45 EXIST::FUNCTION: | ||
| 43 | SSL_dup 46 EXIST::FUNCTION: | ||
| 44 | SSL_dup_CA_list 47 EXIST::FUNCTION: | ||
| 45 | SSL_free 48 EXIST::FUNCTION: | ||
| 46 | SSL_get_certificate 49 EXIST::FUNCTION: | ||
| 47 | SSL_get_cipher_list 52 EXIST::FUNCTION: | ||
| 48 | SSL_get_ciphers 55 EXIST::FUNCTION: | ||
| 49 | SSL_get_client_CA_list 56 EXIST::FUNCTION: | ||
| 50 | SSL_get_default_timeout 57 EXIST::FUNCTION: | ||
| 51 | SSL_get_error 58 EXIST::FUNCTION: | ||
| 52 | SSL_get_fd 59 EXIST::FUNCTION: | ||
| 53 | SSL_get_peer_cert_chain 60 EXIST::FUNCTION: | ||
| 54 | SSL_get_peer_certificate 61 EXIST::FUNCTION: | ||
| 55 | SSL_get_rbio 63 EXIST::FUNCTION:BIO | ||
| 56 | SSL_get_read_ahead 64 EXIST::FUNCTION: | ||
| 57 | SSL_get_shared_ciphers 65 EXIST::FUNCTION: | ||
| 58 | SSL_get_ssl_method 66 EXIST::FUNCTION: | ||
| 59 | SSL_get_verify_callback 69 EXIST::FUNCTION: | ||
| 60 | SSL_get_verify_mode 70 EXIST::FUNCTION: | ||
| 61 | SSL_get_version 71 EXIST::FUNCTION: | ||
| 62 | SSL_get_wbio 72 EXIST::FUNCTION:BIO | ||
| 63 | SSL_load_client_CA_file 73 EXIST::FUNCTION:STDIO | ||
| 64 | SSL_load_error_strings 74 EXIST::FUNCTION: | ||
| 65 | SSL_new 75 EXIST::FUNCTION: | ||
| 66 | SSL_peek 76 EXIST::FUNCTION: | ||
| 67 | SSL_pending 77 EXIST::FUNCTION: | ||
| 68 | SSL_read 78 EXIST::FUNCTION: | ||
| 69 | SSL_renegotiate 79 EXIST::FUNCTION: | ||
| 70 | SSL_rstate_string 80 EXIST::FUNCTION: | ||
| 71 | SSL_rstate_string_long 81 EXIST::FUNCTION: | ||
| 72 | SSL_set_accept_state 82 EXIST::FUNCTION: | ||
| 73 | SSL_set_bio 83 EXIST::FUNCTION:BIO | ||
| 74 | SSL_set_cipher_list 84 EXIST::FUNCTION: | ||
| 75 | SSL_set_client_CA_list 85 EXIST::FUNCTION: | ||
| 76 | SSL_set_connect_state 86 EXIST::FUNCTION: | ||
| 77 | SSL_set_fd 87 EXIST::FUNCTION:SOCK | ||
| 78 | SSL_set_read_ahead 88 EXIST::FUNCTION: | ||
| 79 | SSL_set_rfd 89 EXIST::FUNCTION:SOCK | ||
| 80 | SSL_set_session 90 EXIST::FUNCTION: | ||
| 81 | SSL_set_ssl_method 91 EXIST::FUNCTION: | ||
| 82 | SSL_set_verify 94 EXIST::FUNCTION: | ||
| 83 | SSL_set_wfd 95 EXIST::FUNCTION:SOCK | ||
| 84 | SSL_shutdown 96 EXIST::FUNCTION: | ||
| 85 | SSL_state_string 97 EXIST::FUNCTION: | ||
| 86 | SSL_state_string_long 98 EXIST::FUNCTION: | ||
| 87 | SSL_use_PrivateKey 99 EXIST::FUNCTION: | ||
| 88 | SSL_use_PrivateKey_ASN1 100 EXIST::FUNCTION: | ||
| 89 | SSL_use_PrivateKey_file 101 EXIST::FUNCTION:STDIO | ||
| 90 | SSL_use_RSAPrivateKey 102 EXIST::FUNCTION:RSA | ||
| 91 | SSL_use_RSAPrivateKey_ASN1 103 EXIST::FUNCTION:RSA | ||
| 92 | SSL_use_RSAPrivateKey_file 104 EXIST::FUNCTION:RSA,STDIO | ||
| 93 | SSL_use_certificate 105 EXIST::FUNCTION: | ||
| 94 | SSL_use_certificate_ASN1 106 EXIST::FUNCTION: | ||
| 95 | SSL_use_certificate_file 107 EXIST::FUNCTION:STDIO | ||
| 96 | SSL_write 108 EXIST::FUNCTION: | ||
| 97 | SSLeay_add_ssl_algorithms 109 NOEXIST::FUNCTION: | ||
| 98 | SSLv23_client_method 110 EXIST::FUNCTION:RSA | ||
| 99 | SSLv23_method 111 EXIST::FUNCTION:RSA | ||
| 100 | SSLv23_server_method 112 EXIST::FUNCTION:RSA | ||
| 101 | SSLv2_client_method 113 EXIST::FUNCTION:RSA,SSL2 | ||
| 102 | SSLv2_method 114 EXIST::FUNCTION:RSA,SSL2 | ||
| 103 | SSLv2_server_method 115 EXIST::FUNCTION:RSA,SSL2 | ||
| 104 | SSLv3_client_method 116 EXIST::FUNCTION: | ||
| 105 | SSLv3_method 117 EXIST::FUNCTION: | ||
| 106 | SSLv3_server_method 118 EXIST::FUNCTION: | ||
| 107 | d2i_SSL_SESSION 119 EXIST::FUNCTION: | ||
| 108 | i2d_SSL_SESSION 120 EXIST::FUNCTION: | ||
| 109 | BIO_f_ssl 121 EXIST::FUNCTION:BIO | ||
| 110 | BIO_new_ssl 122 EXIST::FUNCTION:BIO | ||
| 111 | BIO_proxy_ssl_copy_session_id 123 NOEXIST::FUNCTION: | ||
| 112 | BIO_ssl_copy_session_id 124 EXIST::FUNCTION:BIO | ||
| 113 | SSL_do_handshake 125 EXIST::FUNCTION: | ||
| 114 | SSL_get_privatekey 126 EXIST::FUNCTION: | ||
| 115 | SSL_get_current_cipher 127 EXIST::FUNCTION: | ||
| 116 | SSL_CIPHER_get_bits 128 EXIST::FUNCTION: | ||
| 117 | SSL_CIPHER_get_version 129 EXIST::FUNCTION: | ||
| 118 | SSL_CIPHER_get_name 130 EXIST::FUNCTION: | ||
| 119 | BIO_ssl_shutdown 131 EXIST::FUNCTION:BIO | ||
| 120 | SSL_SESSION_cmp 132 NOEXIST::FUNCTION: | ||
| 121 | SSL_SESSION_hash 133 NOEXIST::FUNCTION: | ||
| 122 | SSL_SESSION_get_time 134 EXIST::FUNCTION: | ||
| 123 | SSL_SESSION_set_time 135 EXIST::FUNCTION: | ||
| 124 | SSL_SESSION_get_timeout 136 EXIST::FUNCTION: | ||
| 125 | SSL_SESSION_set_timeout 137 EXIST::FUNCTION: | ||
| 126 | SSL_CTX_get_ex_data 138 EXIST::FUNCTION: | ||
| 127 | SSL_CTX_get_quiet_shutdown 140 EXIST::FUNCTION: | ||
| 128 | SSL_CTX_load_verify_locations 141 EXIST::FUNCTION: | ||
| 129 | SSL_CTX_set_default_verify_paths 142 EXIST:!VMS:FUNCTION: | ||
| 130 | SSL_CTX_set_def_verify_paths 142 EXIST:VMS:FUNCTION: | ||
| 131 | SSL_CTX_set_ex_data 143 EXIST::FUNCTION: | ||
| 132 | SSL_CTX_set_quiet_shutdown 145 EXIST::FUNCTION: | ||
| 133 | SSL_SESSION_get_ex_data 146 EXIST::FUNCTION: | ||
| 134 | SSL_SESSION_set_ex_data 148 EXIST::FUNCTION: | ||
| 135 | SSL_get_SSL_CTX 150 EXIST::FUNCTION: | ||
| 136 | SSL_get_ex_data 151 EXIST::FUNCTION: | ||
| 137 | SSL_get_quiet_shutdown 153 EXIST::FUNCTION: | ||
| 138 | SSL_get_session 154 EXIST::FUNCTION: | ||
| 139 | SSL_get_shutdown 155 EXIST::FUNCTION: | ||
| 140 | SSL_get_verify_result 157 EXIST::FUNCTION: | ||
| 141 | SSL_set_ex_data 158 EXIST::FUNCTION: | ||
| 142 | SSL_set_info_callback 160 EXIST::FUNCTION: | ||
| 143 | SSL_set_quiet_shutdown 161 EXIST::FUNCTION: | ||
| 144 | SSL_set_shutdown 162 EXIST::FUNCTION: | ||
| 145 | SSL_set_verify_result 163 EXIST::FUNCTION: | ||
| 146 | SSL_version 164 EXIST::FUNCTION: | ||
| 147 | SSL_get_info_callback 165 EXIST::FUNCTION: | ||
| 148 | SSL_state 166 EXIST::FUNCTION: | ||
| 149 | SSL_CTX_get_ex_new_index 167 EXIST::FUNCTION: | ||
| 150 | SSL_SESSION_get_ex_new_index 168 EXIST::FUNCTION: | ||
| 151 | SSL_get_ex_new_index 169 EXIST::FUNCTION: | ||
| 152 | TLSv1_method 170 EXIST::FUNCTION: | ||
| 153 | TLSv1_server_method 171 EXIST::FUNCTION: | ||
| 154 | TLSv1_client_method 172 EXIST::FUNCTION: | ||
| 155 | BIO_new_buffer_ssl_connect 173 EXIST::FUNCTION:BIO | ||
| 156 | BIO_new_ssl_connect 174 EXIST::FUNCTION:BIO | ||
| 157 | SSL_get_ex_data_X509_STORE_CTX_idx 175 EXIST:!VMS:FUNCTION: | ||
| 158 | SSL_get_ex_d_X509_STORE_CTX_idx 175 EXIST:VMS:FUNCTION: | ||
| 159 | SSL_CTX_set_tmp_dh_callback 176 EXIST::FUNCTION:DH | ||
| 160 | SSL_CTX_set_tmp_rsa_callback 177 EXIST::FUNCTION:RSA | ||
| 161 | SSL_CTX_set_timeout 178 EXIST::FUNCTION: | ||
| 162 | SSL_CTX_get_timeout 179 EXIST::FUNCTION: | ||
| 163 | SSL_CTX_get_cert_store 180 EXIST::FUNCTION: | ||
| 164 | SSL_CTX_set_cert_store 181 EXIST::FUNCTION: | ||
| 165 | SSL_want 182 EXIST::FUNCTION: | ||
| 166 | SSL_library_init 183 EXIST::FUNCTION: | ||
| 167 | SSL_COMP_add_compression_method 184 EXIST::FUNCTION:COMP | ||
| 168 | SSL_add_file_cert_subjects_to_stack 185 EXIST:!VMS:FUNCTION:STDIO | ||
| 169 | SSL_add_file_cert_subjs_to_stk 185 EXIST:VMS:FUNCTION:STDIO | ||
| 170 | SSL_set_tmp_rsa_callback 186 EXIST::FUNCTION:RSA | ||
| 171 | SSL_set_tmp_dh_callback 187 EXIST::FUNCTION:DH | ||
| 172 | SSL_add_dir_cert_subjects_to_stack 188 EXIST:!VMS:FUNCTION:STDIO | ||
| 173 | SSL_add_dir_cert_subjs_to_stk 188 EXIST:VMS:FUNCTION:STDIO | ||
| 174 | SSL_set_session_id_context 189 EXIST::FUNCTION: | ||
| 175 | SSL_CTX_use_certificate_chain_file 222 EXIST:!VMS:FUNCTION:STDIO | ||
| 176 | SSL_CTX_use_cert_chain_file 222 EXIST:VMS:FUNCTION:STDIO | ||
| 177 | SSL_CTX_set_verify_depth 225 EXIST::FUNCTION: | ||
| 178 | SSL_set_verify_depth 226 EXIST::FUNCTION: | ||
| 179 | SSL_CTX_get_verify_depth 228 EXIST::FUNCTION: | ||
| 180 | SSL_get_verify_depth 229 EXIST::FUNCTION: | ||
| 181 | SSL_CTX_set_session_id_context 231 EXIST::FUNCTION: | ||
| 182 | SSL_CTX_set_cert_verify_callback 232 EXIST:!VMS:FUNCTION: | ||
| 183 | SSL_CTX_set_cert_verify_cb 232 EXIST:VMS:FUNCTION: | ||
| 184 | SSL_CTX_set_default_passwd_cb_userdata 235 EXIST:!VMS:FUNCTION: | ||
| 185 | SSL_CTX_set_def_passwd_cb_ud 235 EXIST:VMS:FUNCTION: | ||
| 186 | SSL_set_purpose 236 EXIST::FUNCTION: | ||
| 187 | SSL_CTX_set_trust 237 EXIST::FUNCTION: | ||
| 188 | SSL_CTX_set_purpose 238 EXIST::FUNCTION: | ||
| 189 | SSL_set_trust 239 EXIST::FUNCTION: | ||
| 190 | SSL_get_finished 240 EXIST::FUNCTION: | ||
| 191 | SSL_get_peer_finished 241 EXIST::FUNCTION: | ||
| 192 | SSL_get1_session 242 EXIST::FUNCTION: | ||
| 193 | SSL_CTX_callback_ctrl 243 EXIST::FUNCTION: | ||
| 194 | SSL_callback_ctrl 244 EXIST::FUNCTION: | ||
| 195 | SSL_CTX_sessions 245 EXIST::FUNCTION: | ||
| 196 | SSL_get_rfd 246 EXIST::FUNCTION: | ||
| 197 | SSL_get_wfd 247 EXIST::FUNCTION: | ||
| 198 | kssl_cget_tkt 248 EXIST::FUNCTION:KRB5 | ||
| 199 | SSL_has_matching_session_id 249 EXIST::FUNCTION: | ||
| 200 | kssl_err_set 250 EXIST::FUNCTION:KRB5 | ||
| 201 | kssl_ctx_show 251 EXIST::FUNCTION:KRB5 | ||
| 202 | kssl_validate_times 252 EXIST::FUNCTION:KRB5 | ||
| 203 | kssl_check_authent 253 EXIST::FUNCTION:KRB5 | ||
| 204 | kssl_ctx_new 254 EXIST::FUNCTION:KRB5 | ||
| 205 | kssl_build_principal_2 255 EXIST::FUNCTION:KRB5 | ||
| 206 | kssl_skip_confound 256 EXIST::FUNCTION:KRB5 | ||
| 207 | kssl_sget_tkt 257 EXIST::FUNCTION:KRB5 | ||
| 208 | SSL_set_generate_session_id 258 EXIST::FUNCTION: | ||
| 209 | kssl_ctx_setkey 259 EXIST::FUNCTION:KRB5 | ||
| 210 | kssl_ctx_setprinc 260 EXIST::FUNCTION:KRB5 | ||
| 211 | kssl_ctx_free 261 EXIST::FUNCTION:KRB5 | ||
| 212 | kssl_krb5_free_data_contents 262 EXIST::FUNCTION:KRB5 | ||
| 213 | kssl_ctx_setstring 263 EXIST::FUNCTION:KRB5 | ||
| 214 | SSL_CTX_set_generate_session_id 264 EXIST::FUNCTION: | ||
| 215 | SSL_renegotiate_pending 265 EXIST::FUNCTION: | ||
| 216 | SSL_CTX_set_msg_callback 266 EXIST::FUNCTION: | ||
| 217 | SSL_set_msg_callback 267 EXIST::FUNCTION: | ||
| 218 | DTLSv1_client_method 268 EXIST::FUNCTION: | ||
| 219 | SSL_CTX_set_tmp_ecdh_callback 269 EXIST::FUNCTION:ECDH | ||
| 220 | SSL_set_tmp_ecdh_callback 270 EXIST::FUNCTION:ECDH | ||
| 221 | SSL_COMP_get_name 271 EXIST::FUNCTION:COMP | ||
| 222 | SSL_get_current_compression 272 EXIST::FUNCTION:COMP | ||
| 223 | DTLSv1_method 273 EXIST::FUNCTION: | ||
| 224 | SSL_get_current_expansion 274 EXIST::FUNCTION:COMP | ||
| 225 | DTLSv1_server_method 275 EXIST::FUNCTION: | ||
| 226 | SSL_COMP_get_compression_methods 276 EXIST:!VMS:FUNCTION:COMP | ||
| 227 | SSL_COMP_get_compress_methods 276 EXIST:VMS:FUNCTION:COMP | ||
| 228 | SSL_SESSION_get_id 277 EXIST::FUNCTION: | ||
| 229 | SSL_CTX_sess_set_new_cb 278 EXIST::FUNCTION: | ||
| 230 | SSL_CTX_sess_get_get_cb 279 EXIST::FUNCTION: | ||
| 231 | SSL_CTX_sess_set_get_cb 280 EXIST::FUNCTION: | ||
| 232 | SSL_CTX_set_cookie_verify_cb 281 EXIST::FUNCTION: | ||
| 233 | SSL_CTX_get_info_callback 282 EXIST::FUNCTION: | ||
| 234 | SSL_CTX_set_cookie_generate_cb 283 EXIST::FUNCTION: | ||
| 235 | SSL_CTX_set_client_cert_cb 284 EXIST::FUNCTION: | ||
| 236 | SSL_CTX_sess_set_remove_cb 285 EXIST::FUNCTION: | ||
| 237 | SSL_CTX_set_info_callback 286 EXIST::FUNCTION: | ||
| 238 | SSL_CTX_sess_get_new_cb 287 EXIST::FUNCTION: | ||
| 239 | SSL_CTX_get_client_cert_cb 288 EXIST::FUNCTION: | ||
| 240 | SSL_CTX_sess_get_remove_cb 289 EXIST::FUNCTION: | ||
| 241 | SSL_set_SSL_CTX 290 EXIST::FUNCTION: | ||
| 242 | SSL_get_servername 291 EXIST::FUNCTION:TLSEXT | ||
| 243 | SSL_get_servername_type 292 EXIST::FUNCTION:TLSEXT | ||
| 244 | SSL_CTX_set_client_cert_engine 293 EXIST::FUNCTION:ENGINE | ||
| 245 | SSL_CTX_use_psk_identity_hint 294 EXIST::FUNCTION:PSK | ||
| 246 | SSL_CTX_set_psk_client_callback 295 EXIST::FUNCTION:PSK | ||
| 247 | PEM_write_bio_SSL_SESSION 296 EXIST::FUNCTION: | ||
| 248 | SSL_get_psk_identity_hint 297 EXIST::FUNCTION:PSK | ||
| 249 | SSL_set_psk_server_callback 298 EXIST::FUNCTION:PSK | ||
| 250 | SSL_use_psk_identity_hint 299 EXIST::FUNCTION:PSK | ||
| 251 | SSL_set_psk_client_callback 300 EXIST::FUNCTION:PSK | ||
| 252 | PEM_read_SSL_SESSION 301 EXIST:!WIN16:FUNCTION: | ||
| 253 | PEM_read_bio_SSL_SESSION 302 EXIST::FUNCTION: | ||
| 254 | SSL_CTX_set_psk_server_callback 303 EXIST::FUNCTION:PSK | ||
| 255 | SSL_get_psk_identity 304 EXIST::FUNCTION:PSK | ||
| 256 | PEM_write_SSL_SESSION 305 EXIST:!WIN16:FUNCTION: | ||
| 257 | SSL_set_session_ticket_ext 306 EXIST::FUNCTION: | ||
| 258 | SSL_set_session_secret_cb 307 EXIST::FUNCTION: | ||
| 259 | SSL_set_session_ticket_ext_cb 308 EXIST::FUNCTION: | ||
| 260 | SSL_set1_param 309 EXIST::FUNCTION: | ||
| 261 | SSL_CTX_set1_param 310 EXIST::FUNCTION: | ||
diff --git a/src/lib/libcrypto/util/tab_num.pl b/src/lib/libcrypto/util/tab_num.pl new file mode 100644 index 0000000000..a81ed0edc2 --- /dev/null +++ b/src/lib/libcrypto/util/tab_num.pl | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | $num=1; | ||
| 4 | $width=40; | ||
| 5 | |||
| 6 | while (<>) | ||
| 7 | { | ||
| 8 | chop; | ||
| 9 | |||
| 10 | $i=length($_); | ||
| 11 | |||
| 12 | $n=$width-$i; | ||
| 13 | $i=int(($n+7)/8); | ||
| 14 | print $_.("\t" x $i).$num."\n"; | ||
| 15 | $num++; | ||
| 16 | } | ||
| 17 | |||
diff --git a/src/lib/libcrypto/util/x86asm.sh b/src/lib/libcrypto/util/x86asm.sh new file mode 100644 index 0000000000..d2090a9849 --- /dev/null +++ b/src/lib/libcrypto/util/x86asm.sh | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | echo Generating x86 assember | ||
| 4 | echo Bignum | ||
| 5 | (cd crypto/bn/asm; perl x86.pl cpp > bn86unix.cpp) | ||
| 6 | (cd crypto/bn/asm; perl x86.pl win32 > bn-win32.asm) | ||
| 7 | |||
| 8 | echo DES | ||
| 9 | (cd crypto/des/asm; perl des-586.pl cpp > dx86unix.cpp) | ||
| 10 | (cd crypto/des/asm; perl des-586.pl win32 > d-win32.asm) | ||
| 11 | |||
| 12 | echo "crypt(3)" | ||
| 13 | (cd crypto/des/asm; perl crypt586.pl cpp > yx86unix.cpp) | ||
| 14 | (cd crypto/des/asm; perl crypt586.pl win32 > y-win32.asm) | ||
| 15 | |||
| 16 | echo Blowfish | ||
| 17 | (cd crypto/bf/asm; perl bf-586.pl cpp > bx86unix.cpp) | ||
| 18 | (cd crypto/bf/asm; perl bf-586.pl win32 > b-win32.asm) | ||
| 19 | |||
| 20 | echo CAST5 | ||
| 21 | (cd crypto/cast/asm; perl cast-586.pl cpp > cx86unix.cpp) | ||
| 22 | (cd crypto/cast/asm; perl cast-586.pl win32 > c-win32.asm) | ||
| 23 | |||
| 24 | echo RC4 | ||
| 25 | (cd crypto/rc4/asm; perl rc4-586.pl cpp > rx86unix.cpp) | ||
| 26 | (cd crypto/rc4/asm; perl rc4-586.pl win32 > r4-win32.asm) | ||
| 27 | |||
| 28 | echo MD5 | ||
| 29 | (cd crypto/md5/asm; perl md5-586.pl cpp > mx86unix.cpp) | ||
| 30 | (cd crypto/md5/asm; perl md5-586.pl win32 > m5-win32.asm) | ||
| 31 | |||
| 32 | echo SHA1 | ||
| 33 | (cd crypto/sha/asm; perl sha1-586.pl cpp > sx86unix.cpp) | ||
| 34 | (cd crypto/sha/asm; perl sha1-586.pl win32 > s1-win32.asm) | ||
| 35 | |||
| 36 | echo RIPEMD160 | ||
| 37 | (cd crypto/ripemd/asm; perl rmd-586.pl cpp > rm86unix.cpp) | ||
| 38 | (cd crypto/ripemd/asm; perl rmd-586.pl win32 > rm-win32.asm) | ||
| 39 | |||
| 40 | echo RC5/32 | ||
| 41 | (cd crypto/rc5/asm; perl rc5-586.pl cpp > r586unix.cpp) | ||
| 42 | (cd crypto/rc5/asm; perl rc5-586.pl win32 > r5-win32.asm) | ||
diff --git a/src/lib/libcrypto/vms_rms.h b/src/lib/libcrypto/vms_rms.h new file mode 100755 index 0000000000..00a00d993f --- /dev/null +++ b/src/lib/libcrypto/vms_rms.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | |||
| 2 | #ifdef NAML$C_MAXRSS | ||
| 3 | |||
| 4 | # define CC_RMS_NAMX cc$rms_naml | ||
| 5 | # define FAB_NAMX fab$l_naml | ||
| 6 | # define FAB_OR_NAML( fab, naml) naml | ||
| 7 | # define FAB_OR_NAML_DNA naml$l_long_defname | ||
| 8 | # define FAB_OR_NAML_DNS naml$l_long_defname_size | ||
| 9 | # define FAB_OR_NAML_FNA naml$l_long_filename | ||
| 10 | # define FAB_OR_NAML_FNS naml$l_long_filename_size | ||
| 11 | # define NAMX_ESA naml$l_long_expand | ||
| 12 | # define NAMX_ESL naml$l_long_expand_size | ||
| 13 | # define NAMX_ESS naml$l_long_expand_alloc | ||
| 14 | # define NAMX_NOP naml$b_nop | ||
| 15 | # define SET_NAMX_NO_SHORT_UPCASE( nam) nam.naml$v_no_short_upcase = 1 | ||
| 16 | |||
| 17 | # if __INITIAL_POINTER_SIZE == 64 | ||
| 18 | # define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna = (__char_ptr32) -1; \ | ||
| 19 | fab.fab$l_fna = (__char_ptr32) -1; | ||
| 20 | # else /* __INITIAL_POINTER_SIZE == 64 */ | ||
| 21 | # define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna = (char *) -1; \ | ||
| 22 | fab.fab$l_fna = (char *) -1; | ||
| 23 | # endif /* __INITIAL_POINTER_SIZE == 64 [else] */ | ||
| 24 | |||
| 25 | # define NAMX_MAXRSS NAML$C_MAXRSS | ||
| 26 | # define NAMX_STRUCT NAML | ||
| 27 | |||
| 28 | #else /* def NAML$C_MAXRSS */ | ||
| 29 | |||
| 30 | # define CC_RMS_NAMX cc$rms_nam | ||
| 31 | # define FAB_NAMX fab$l_nam | ||
| 32 | # define FAB_OR_NAML( fab, naml) fab | ||
| 33 | # define FAB_OR_NAML_DNA fab$l_dna | ||
| 34 | # define FAB_OR_NAML_DNS fab$b_dns | ||
| 35 | # define FAB_OR_NAML_FNA fab$l_fna | ||
| 36 | # define FAB_OR_NAML_FNS fab$b_fns | ||
| 37 | # define NAMX_ESA nam$l_esa | ||
| 38 | # define NAMX_ESL nam$b_esl | ||
| 39 | # define NAMX_ESS nam$b_ess | ||
| 40 | # define NAMX_NOP nam$b_nop | ||
| 41 | # define NAMX_DNA_FNA_SET(fab) | ||
| 42 | # define NAMX_MAXRSS NAM$C_MAXRSS | ||
| 43 | # define NAMX_STRUCT NAM | ||
| 44 | # ifdef NAM$M_NO_SHORT_UPCASE | ||
| 45 | # define SET_NAMX_NO_SHORT_UPCASE( nam) naml.naml$v_no_short_upcase = 1 | ||
| 46 | # else /* def NAM$M_NO_SHORT_UPCASE */ | ||
| 47 | # define SET_NAMX_NO_SHORT_UPCASE( nam) | ||
| 48 | # endif /* def NAM$M_NO_SHORT_UPCASE [else] */ | ||
| 49 | |||
| 50 | #endif /* def NAML$C_MAXRSS [else] */ | ||
| 51 | |||
diff --git a/src/lib/libcrypto/whrlpool/Makefile b/src/lib/libcrypto/whrlpool/Makefile new file mode 100644 index 0000000000..566b996290 --- /dev/null +++ b/src/lib/libcrypto/whrlpool/Makefile | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | # | ||
| 2 | # crypto/whrlpool/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= whrlpool | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | CPP= $(CC) -E | ||
| 9 | INCLUDES= | ||
| 10 | CFLAG=-g | ||
| 11 | MAKEFILE= Makefile | ||
| 12 | AR= ar r | ||
| 13 | |||
| 14 | WP_ASM_OBJ=wp_block.o | ||
| 15 | |||
| 16 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 17 | ASFLAGS= $(INCLUDES) $(ASFLAG) | ||
| 18 | AFLAGS= $(ASFLAGS) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST=wp_test.c | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC=wp_dgst.c wp_block.c | ||
| 26 | LIBOBJ=wp_dgst.o $(WP_ASM_OBJ) | ||
| 27 | |||
| 28 | SRC= $(LIBSRC) | ||
| 29 | |||
| 30 | EXHEADER= whrlpool.h | ||
| 31 | HEADER= wp_locl.h $(EXHEADER) | ||
| 32 | |||
| 33 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 34 | |||
| 35 | top: | ||
| 36 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 37 | |||
| 38 | all: lib | ||
| 39 | |||
| 40 | lib: $(LIBOBJ) | ||
| 41 | $(AR) $(LIB) $(LIBOBJ) | ||
| 42 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 43 | @touch lib | ||
| 44 | |||
| 45 | wp-mmx.s: asm/wp-mmx.pl ../perlasm/x86asm.pl | ||
| 46 | $(PERL) asm/wp-mmx.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@ | ||
| 47 | |||
| 48 | wp-x86_64.s: asm/wp-x86_64.pl | ||
| 49 | $(PERL) asm/wp-x86_64.pl $(PERLASM_SCHEME) > $@ | ||
| 50 | |||
| 51 | $(LIBOBJ): $(LIBSRC) | ||
| 52 | |||
| 53 | files: | ||
| 54 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 55 | |||
| 56 | links: | ||
| 57 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 58 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 59 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 60 | |||
| 61 | install: | ||
| 62 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 63 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 64 | do \ | ||
| 65 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 66 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 67 | done; | ||
| 68 | |||
| 69 | tags: | ||
| 70 | ctags $(SRC) | ||
| 71 | |||
| 72 | tests: | ||
| 73 | |||
| 74 | lint: | ||
| 75 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 76 | |||
| 77 | depend: | ||
| 78 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 79 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 80 | |||
| 81 | dclean: | ||
| 82 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 83 | mv -f Makefile.new $(MAKEFILE) | ||
| 84 | |||
| 85 | clean: | ||
| 86 | rm -f *.s *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 87 | |||
| 88 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 89 | |||
| 90 | wp_block.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 91 | wp_block.o: ../../include/openssl/whrlpool.h wp_block.c wp_locl.h | ||
| 92 | wp_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
| 93 | wp_dgst.o: ../../include/openssl/whrlpool.h wp_dgst.c wp_locl.h | ||
diff --git a/src/lib/libcrypto/whrlpool/wp_test.c b/src/lib/libcrypto/whrlpool/wp_test.c new file mode 100644 index 0000000000..c68c2c62ca --- /dev/null +++ b/src/lib/libcrypto/whrlpool/wp_test.c | |||
| @@ -0,0 +1,228 @@ | |||
| 1 | /* ==================================================================== | ||
| 2 | * Copyright (c) 2005 The OpenSSL Project. All rights reserved. | ||
| 3 | * ==================================================================== | ||
| 4 | */ | ||
| 5 | #include <stdio.h> | ||
| 6 | #include <string.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | |||
| 9 | #include <openssl/whrlpool.h> | ||
| 10 | #include <openssl/crypto.h> | ||
| 11 | |||
| 12 | #if defined(OPENSSL_NO_WHIRLPOOL) | ||
| 13 | int main(int argc, char *argv[]) | ||
| 14 | { | ||
| 15 | printf("No Whirlpool support\n"); | ||
| 16 | return(0); | ||
| 17 | } | ||
| 18 | #else | ||
| 19 | |||
| 20 | /* ISO/IEC 10118-3 test vector set */ | ||
| 21 | unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 22 | 0x19,0xFA,0x61,0xD7,0x55,0x22,0xA4,0x66, | ||
| 23 | 0x9B,0x44,0xE3,0x9C,0x1D,0x2E,0x17,0x26, | ||
| 24 | 0xC5,0x30,0x23,0x21,0x30,0xD4,0x07,0xF8, | ||
| 25 | 0x9A,0xFE,0xE0,0x96,0x49,0x97,0xF7,0xA7, | ||
| 26 | 0x3E,0x83,0xBE,0x69,0x8B,0x28,0x8F,0xEB, | ||
| 27 | 0xCF,0x88,0xE3,0xE0,0x3C,0x4F,0x07,0x57, | ||
| 28 | 0xEA,0x89,0x64,0xE5,0x9B,0x63,0xD9,0x37, | ||
| 29 | 0x08,0xB1,0x38,0xCC,0x42,0xA6,0x6E,0xB3 }; | ||
| 30 | |||
| 31 | unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 32 | 0x8A,0xCA,0x26,0x02,0x79,0x2A,0xEC,0x6F, | ||
| 33 | 0x11,0xA6,0x72,0x06,0x53,0x1F,0xB7,0xD7, | ||
| 34 | 0xF0,0xDF,0xF5,0x94,0x13,0x14,0x5E,0x69, | ||
| 35 | 0x73,0xC4,0x50,0x01,0xD0,0x08,0x7B,0x42, | ||
| 36 | 0xD1,0x1B,0xC6,0x45,0x41,0x3A,0xEF,0xF6, | ||
| 37 | 0x3A,0x42,0x39,0x1A,0x39,0x14,0x5A,0x59, | ||
| 38 | 0x1A,0x92,0x20,0x0D,0x56,0x01,0x95,0xE5, | ||
| 39 | 0x3B,0x47,0x85,0x84,0xFD,0xAE,0x23,0x1A }; | ||
| 40 | |||
| 41 | unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 42 | 0x4E,0x24,0x48,0xA4,0xC6,0xF4,0x86,0xBB, | ||
| 43 | 0x16,0xB6,0x56,0x2C,0x73,0xB4,0x02,0x0B, | ||
| 44 | 0xF3,0x04,0x3E,0x3A,0x73,0x1B,0xCE,0x72, | ||
| 45 | 0x1A,0xE1,0xB3,0x03,0xD9,0x7E,0x6D,0x4C, | ||
| 46 | 0x71,0x81,0xEE,0xBD,0xB6,0xC5,0x7E,0x27, | ||
| 47 | 0x7D,0x0E,0x34,0x95,0x71,0x14,0xCB,0xD6, | ||
| 48 | 0xC7,0x97,0xFC,0x9D,0x95,0xD8,0xB5,0x82, | ||
| 49 | 0xD2,0x25,0x29,0x20,0x76,0xD4,0xEE,0xF5 }; | ||
| 50 | |||
| 51 | unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 52 | 0x37,0x8C,0x84,0xA4,0x12,0x6E,0x2D,0xC6, | ||
| 53 | 0xE5,0x6D,0xCC,0x74,0x58,0x37,0x7A,0xAC, | ||
| 54 | 0x83,0x8D,0x00,0x03,0x22,0x30,0xF5,0x3C, | ||
| 55 | 0xE1,0xF5,0x70,0x0C,0x0F,0xFB,0x4D,0x3B, | ||
| 56 | 0x84,0x21,0x55,0x76,0x59,0xEF,0x55,0xC1, | ||
| 57 | 0x06,0xB4,0xB5,0x2A,0xC5,0xA4,0xAA,0xA6, | ||
| 58 | 0x92,0xED,0x92,0x00,0x52,0x83,0x8F,0x33, | ||
| 59 | 0x62,0xE8,0x6D,0xBD,0x37,0xA8,0x90,0x3E }; | ||
| 60 | |||
| 61 | unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 62 | 0xF1,0xD7,0x54,0x66,0x26,0x36,0xFF,0xE9, | ||
| 63 | 0x2C,0x82,0xEB,0xB9,0x21,0x2A,0x48,0x4A, | ||
| 64 | 0x8D,0x38,0x63,0x1E,0xAD,0x42,0x38,0xF5, | ||
| 65 | 0x44,0x2E,0xE1,0x3B,0x80,0x54,0xE4,0x1B, | ||
| 66 | 0x08,0xBF,0x2A,0x92,0x51,0xC3,0x0B,0x6A, | ||
| 67 | 0x0B,0x8A,0xAE,0x86,0x17,0x7A,0xB4,0xA6, | ||
| 68 | 0xF6,0x8F,0x67,0x3E,0x72,0x07,0x86,0x5D, | ||
| 69 | 0x5D,0x98,0x19,0xA3,0xDB,0xA4,0xEB,0x3B }; | ||
| 70 | |||
| 71 | unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 72 | 0xDC,0x37,0xE0,0x08,0xCF,0x9E,0xE6,0x9B, | ||
| 73 | 0xF1,0x1F,0x00,0xED,0x9A,0xBA,0x26,0x90, | ||
| 74 | 0x1D,0xD7,0xC2,0x8C,0xDE,0xC0,0x66,0xCC, | ||
| 75 | 0x6A,0xF4,0x2E,0x40,0xF8,0x2F,0x3A,0x1E, | ||
| 76 | 0x08,0xEB,0xA2,0x66,0x29,0x12,0x9D,0x8F, | ||
| 77 | 0xB7,0xCB,0x57,0x21,0x1B,0x92,0x81,0xA6, | ||
| 78 | 0x55,0x17,0xCC,0x87,0x9D,0x7B,0x96,0x21, | ||
| 79 | 0x42,0xC6,0x5F,0x5A,0x7A,0xF0,0x14,0x67 }; | ||
| 80 | |||
| 81 | unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 82 | 0x46,0x6E,0xF1,0x8B,0xAB,0xB0,0x15,0x4D, | ||
| 83 | 0x25,0xB9,0xD3,0x8A,0x64,0x14,0xF5,0xC0, | ||
| 84 | 0x87,0x84,0x37,0x2B,0xCC,0xB2,0x04,0xD6, | ||
| 85 | 0x54,0x9C,0x4A,0xFA,0xDB,0x60,0x14,0x29, | ||
| 86 | 0x4D,0x5B,0xD8,0xDF,0x2A,0x6C,0x44,0xE5, | ||
| 87 | 0x38,0xCD,0x04,0x7B,0x26,0x81,0xA5,0x1A, | ||
| 88 | 0x2C,0x60,0x48,0x1E,0x88,0xC5,0xA2,0x0B, | ||
| 89 | 0x2C,0x2A,0x80,0xCF,0x3A,0x9A,0x08,0x3B }; | ||
| 90 | |||
| 91 | unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 92 | 0x2A,0x98,0x7E,0xA4,0x0F,0x91,0x70,0x61, | ||
| 93 | 0xF5,0xD6,0xF0,0xA0,0xE4,0x64,0x4F,0x48, | ||
| 94 | 0x8A,0x7A,0x5A,0x52,0xDE,0xEE,0x65,0x62, | ||
| 95 | 0x07,0xC5,0x62,0xF9,0x88,0xE9,0x5C,0x69, | ||
| 96 | 0x16,0xBD,0xC8,0x03,0x1B,0xC5,0xBE,0x1B, | ||
| 97 | 0x7B,0x94,0x76,0x39,0xFE,0x05,0x0B,0x56, | ||
| 98 | 0x93,0x9B,0xAA,0xA0,0xAD,0xFF,0x9A,0xE6, | ||
| 99 | 0x74,0x5B,0x7B,0x18,0x1C,0x3B,0xE3,0xFD }; | ||
| 100 | |||
| 101 | unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = { | ||
| 102 | 0x0C,0x99,0x00,0x5B,0xEB,0x57,0xEF,0xF5, | ||
| 103 | 0x0A,0x7C,0xF0,0x05,0x56,0x0D,0xDF,0x5D, | ||
| 104 | 0x29,0x05,0x7F,0xD8,0x6B,0x20,0xBF,0xD6, | ||
| 105 | 0x2D,0xEC,0xA0,0xF1,0xCC,0xEA,0x4A,0xF5, | ||
| 106 | 0x1F,0xC1,0x54,0x90,0xED,0xDC,0x47,0xAF, | ||
| 107 | 0x32,0xBB,0x2B,0x66,0xC3,0x4F,0xF9,0xAD, | ||
| 108 | 0x8C,0x60,0x08,0xAD,0x67,0x7F,0x77,0x12, | ||
| 109 | 0x69,0x53,0xB2,0x26,0xE4,0xED,0x8B,0x01 }; | ||
| 110 | |||
| 111 | int main (int argc,char *argv[]) | ||
| 112 | { unsigned char md[WHIRLPOOL_DIGEST_LENGTH]; | ||
| 113 | int i; | ||
| 114 | WHIRLPOOL_CTX ctx; | ||
| 115 | |||
| 116 | #ifdef OPENSSL_IA32_SSE2 | ||
| 117 | /* Alternative to this is to call OpenSSL_add_all_algorithms... | ||
| 118 | * The below code is retained exclusively for debugging purposes. */ | ||
| 119 | { char *env; | ||
| 120 | |||
| 121 | if ((env=getenv("OPENSSL_ia32cap"))) | ||
| 122 | OPENSSL_ia32cap = strtoul (env,NULL,0); | ||
| 123 | } | ||
| 124 | #endif | ||
| 125 | |||
| 126 | fprintf(stdout,"Testing Whirlpool "); | ||
| 127 | |||
| 128 | WHIRLPOOL("",0,md); | ||
| 129 | if (memcmp(md,iso_test_1,sizeof(iso_test_1))) | ||
| 130 | { fflush(stdout); | ||
| 131 | fprintf(stderr,"\nTEST 1 of 9 failed.\n"); | ||
| 132 | return 1; | ||
| 133 | } | ||
| 134 | else | ||
| 135 | fprintf(stdout,"."); fflush(stdout); | ||
| 136 | |||
| 137 | WHIRLPOOL("a",1,md); | ||
| 138 | if (memcmp(md,iso_test_2,sizeof(iso_test_2))) | ||
| 139 | { fflush(stdout); | ||
| 140 | fprintf(stderr,"\nTEST 2 of 9 failed.\n"); | ||
| 141 | return 1; | ||
| 142 | } | ||
| 143 | else | ||
| 144 | fprintf(stdout,"."); fflush(stdout); | ||
| 145 | |||
| 146 | WHIRLPOOL("abc",3,md); | ||
| 147 | if (memcmp(md,iso_test_3,sizeof(iso_test_3))) | ||
| 148 | { fflush(stdout); | ||
| 149 | fprintf(stderr,"\nTEST 3 of 9 failed.\n"); | ||
| 150 | return 1; | ||
| 151 | } | ||
| 152 | else | ||
| 153 | fprintf(stdout,"."); fflush(stdout); | ||
| 154 | |||
| 155 | WHIRLPOOL("message digest",14,md); | ||
| 156 | if (memcmp(md,iso_test_4,sizeof(iso_test_4))) | ||
| 157 | { fflush(stdout); | ||
| 158 | fprintf(stderr,"\nTEST 4 of 9 failed.\n"); | ||
| 159 | return 1; | ||
| 160 | } | ||
| 161 | else | ||
| 162 | fprintf(stdout,"."); fflush(stdout); | ||
| 163 | |||
| 164 | WHIRLPOOL("abcdefghijklmnopqrstuvwxyz",26,md); | ||
| 165 | if (memcmp(md,iso_test_5,sizeof(iso_test_5))) | ||
| 166 | { fflush(stdout); | ||
| 167 | fprintf(stderr,"\nTEST 5 of 9 failed.\n"); | ||
| 168 | return 1; | ||
| 169 | } | ||
| 170 | else | ||
| 171 | fprintf(stdout,"."); fflush(stdout); | ||
| 172 | |||
| 173 | WHIRLPOOL( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
| 174 | "abcdefghijklmnopqrstuvwxyz" | ||
| 175 | "0123456789",62,md); | ||
| 176 | if (memcmp(md,iso_test_6,sizeof(iso_test_6))) | ||
| 177 | { fflush(stdout); | ||
| 178 | fprintf(stderr,"\nTEST 6 of 9 failed.\n"); | ||
| 179 | return 1; | ||
| 180 | } | ||
| 181 | else | ||
| 182 | fprintf(stdout,"."); fflush(stdout); | ||
| 183 | |||
| 184 | WHIRLPOOL( "1234567890""1234567890""1234567890""1234567890" | ||
| 185 | "1234567890""1234567890""1234567890""1234567890",80,md); | ||
| 186 | if (memcmp(md,iso_test_7,sizeof(iso_test_7))) | ||
| 187 | { fflush(stdout); | ||
| 188 | fprintf(stderr,"\nTEST 7 of 9 failed.\n"); | ||
| 189 | return 1; | ||
| 190 | } | ||
| 191 | else | ||
| 192 | fprintf(stdout,"."); fflush(stdout); | ||
| 193 | |||
| 194 | WHIRLPOOL("abcdbcdecdefdefgefghfghighijhijk",32,md); | ||
| 195 | if (memcmp(md,iso_test_8,sizeof(iso_test_8))) | ||
| 196 | { fflush(stdout); | ||
| 197 | fprintf(stderr,"\nTEST 8 of 9 failed.\n"); | ||
| 198 | return 1; | ||
| 199 | } | ||
| 200 | else | ||
| 201 | fprintf(stdout,"."); fflush(stdout); | ||
| 202 | |||
| 203 | WHIRLPOOL_Init (&ctx); | ||
| 204 | for (i=0;i<1000000;i+=288) | ||
| 205 | WHIRLPOOL_Update (&ctx, "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 206 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 207 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 208 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 209 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 210 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 211 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 212 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa" | ||
| 213 | "aaaaaaaa""aaaaaaaa""aaaaaaaa""aaaaaaaa", | ||
| 214 | (1000000-i)<288?1000000-i:288); | ||
| 215 | WHIRLPOOL_Final (md,&ctx); | ||
| 216 | if (memcmp(md,iso_test_9,sizeof(iso_test_9))) | ||
| 217 | { fflush(stdout); | ||
| 218 | fprintf(stderr,"\nTEST 9 of 9 failed.\n"); | ||
| 219 | return 1; | ||
| 220 | } | ||
| 221 | else | ||
| 222 | fprintf(stdout,"."); fflush(stdout); | ||
| 223 | |||
| 224 | fprintf(stdout," passed.\n"); fflush(stdout); | ||
| 225 | |||
| 226 | return 0; | ||
| 227 | } | ||
| 228 | #endif | ||
diff --git a/src/lib/libcrypto/x509/Makefile b/src/lib/libcrypto/x509/Makefile new file mode 100644 index 0000000000..72c82278f4 --- /dev/null +++ b/src/lib/libcrypto/x509/Makefile | |||
| @@ -0,0 +1,407 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/x509/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= x509 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile README | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= x509_def.c x509_d2.c x509_r2x.c x509_cmp.c \ | ||
| 21 | x509_obj.c x509_req.c x509spki.c x509_vfy.c \ | ||
| 22 | x509_set.c x509cset.c x509rset.c x509_err.c \ | ||
| 23 | x509name.c x509_v3.c x509_ext.c x509_att.c \ | ||
| 24 | x509type.c x509_lu.c x_all.c x509_txt.c \ | ||
| 25 | x509_trs.c by_file.c by_dir.c x509_vpm.c | ||
| 26 | LIBOBJ= x509_def.o x509_d2.o x509_r2x.o x509_cmp.o \ | ||
| 27 | x509_obj.o x509_req.o x509spki.o x509_vfy.o \ | ||
| 28 | x509_set.o x509cset.o x509rset.o x509_err.o \ | ||
| 29 | x509name.o x509_v3.o x509_ext.o x509_att.o \ | ||
| 30 | x509type.o x509_lu.o x_all.o x509_txt.o \ | ||
| 31 | x509_trs.o by_file.o by_dir.o x509_vpm.o | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= x509.h x509_vfy.h | ||
| 36 | HEADER= $(EXHEADER) | ||
| 37 | |||
| 38 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 39 | |||
| 40 | top: | ||
| 41 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 42 | |||
| 43 | all: lib | ||
| 44 | |||
| 45 | lib: $(LIBOBJ) | ||
| 46 | $(AR) $(LIB) $(LIBOBJ) | ||
| 47 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 48 | @touch lib | ||
| 49 | |||
| 50 | files: | ||
| 51 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 52 | |||
| 53 | links: | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 57 | |||
| 58 | install: | ||
| 59 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 60 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 61 | do \ | ||
| 62 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 63 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 64 | done; | ||
| 65 | |||
| 66 | tags: | ||
| 67 | ctags $(SRC) | ||
| 68 | |||
| 69 | tests: | ||
| 70 | |||
| 71 | lint: | ||
| 72 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 73 | |||
| 74 | depend: | ||
| 75 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 76 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 77 | |||
| 78 | dclean: | ||
| 79 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 80 | mv -f Makefile.new $(MAKEFILE) | ||
| 81 | |||
| 82 | clean: | ||
| 83 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 84 | |||
| 85 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 86 | |||
| 87 | by_dir.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 88 | by_dir.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 89 | by_dir.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 90 | by_dir.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 91 | by_dir.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 92 | by_dir.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 93 | by_dir.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 94 | by_dir.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 95 | by_dir.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 96 | by_dir.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 97 | by_dir.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 98 | by_dir.o: ../../include/openssl/x509_vfy.h ../cryptlib.h by_dir.c | ||
| 99 | by_file.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 100 | by_file.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 101 | by_file.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | by_file.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 103 | by_file.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 104 | by_file.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 105 | by_file.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 106 | by_file.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 107 | by_file.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem.h | ||
| 108 | by_file.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs7.h | ||
| 109 | by_file.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 110 | by_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 111 | by_file.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 112 | by_file.o: ../cryptlib.h by_file.c | ||
| 113 | x509_att.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 114 | x509_att.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 115 | x509_att.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 116 | x509_att.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 117 | x509_att.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 118 | x509_att.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 119 | x509_att.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 120 | x509_att.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 121 | x509_att.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 122 | x509_att.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 123 | x509_att.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 124 | x509_att.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 125 | x509_att.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 126 | x509_att.o: ../cryptlib.h x509_att.c | ||
| 127 | x509_cmp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 128 | x509_cmp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 129 | x509_cmp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 130 | x509_cmp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 131 | x509_cmp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 132 | x509_cmp.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 133 | x509_cmp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 134 | x509_cmp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 135 | x509_cmp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 136 | x509_cmp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 137 | x509_cmp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 138 | x509_cmp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 139 | x509_cmp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 140 | x509_cmp.o: ../cryptlib.h x509_cmp.c | ||
| 141 | x509_d2.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 142 | x509_d2.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 143 | x509_d2.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 144 | x509_d2.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 145 | x509_d2.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 146 | x509_d2.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 147 | x509_d2.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 148 | x509_d2.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 149 | x509_d2.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 150 | x509_d2.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 151 | x509_d2.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 152 | x509_d2.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 153 | x509_d2.o: ../cryptlib.h x509_d2.c | ||
| 154 | x509_def.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 155 | x509_def.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 156 | x509_def.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 157 | x509_def.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 158 | x509_def.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 159 | x509_def.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 160 | x509_def.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 161 | x509_def.o: ../../include/openssl/opensslconf.h | ||
| 162 | x509_def.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 163 | x509_def.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 164 | x509_def.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 165 | x509_def.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 166 | x509_def.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_def.c | ||
| 167 | x509_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 168 | x509_err.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 169 | x509_err.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 170 | x509_err.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 171 | x509_err.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 172 | x509_err.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 173 | x509_err.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 174 | x509_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 175 | x509_err.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 176 | x509_err.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 177 | x509_err.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 178 | x509_err.o: ../../include/openssl/x509_vfy.h x509_err.c | ||
| 179 | x509_ext.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 180 | x509_ext.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 181 | x509_ext.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 182 | x509_ext.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 183 | x509_ext.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 184 | x509_ext.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 185 | x509_ext.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 186 | x509_ext.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 187 | x509_ext.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 188 | x509_ext.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 189 | x509_ext.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 190 | x509_ext.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 191 | x509_ext.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 192 | x509_ext.o: ../cryptlib.h x509_ext.c | ||
| 193 | x509_lu.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 194 | x509_lu.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 195 | x509_lu.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 196 | x509_lu.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 197 | x509_lu.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 198 | x509_lu.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 199 | x509_lu.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 200 | x509_lu.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 201 | x509_lu.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 202 | x509_lu.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 203 | x509_lu.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 204 | x509_lu.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 205 | x509_lu.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 206 | x509_lu.o: ../cryptlib.h x509_lu.c | ||
| 207 | x509_obj.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 208 | x509_obj.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 209 | x509_obj.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 210 | x509_obj.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 211 | x509_obj.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 212 | x509_obj.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 213 | x509_obj.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 214 | x509_obj.o: ../../include/openssl/opensslconf.h | ||
| 215 | x509_obj.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 216 | x509_obj.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 217 | x509_obj.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 218 | x509_obj.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 219 | x509_obj.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_obj.c | ||
| 220 | x509_r2x.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 221 | x509_r2x.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
| 222 | x509_r2x.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 223 | x509_r2x.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 224 | x509_r2x.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 225 | x509_r2x.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 226 | x509_r2x.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 227 | x509_r2x.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 228 | x509_r2x.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 229 | x509_r2x.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 230 | x509_r2x.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 231 | x509_r2x.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 232 | x509_r2x.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_r2x.c | ||
| 233 | x509_req.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 234 | x509_req.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 235 | x509_req.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 236 | x509_req.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 237 | x509_req.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 238 | x509_req.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 239 | x509_req.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 240 | x509_req.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 241 | x509_req.o: ../../include/openssl/opensslconf.h | ||
| 242 | x509_req.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 243 | x509_req.o: ../../include/openssl/pem.h ../../include/openssl/pem2.h | ||
| 244 | x509_req.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 245 | x509_req.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 246 | x509_req.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 247 | x509_req.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_req.c | ||
| 248 | x509_set.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 249 | x509_set.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 250 | x509_set.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 251 | x509_set.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 252 | x509_set.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 253 | x509_set.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 254 | x509_set.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 255 | x509_set.o: ../../include/openssl/opensslconf.h | ||
| 256 | x509_set.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 257 | x509_set.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 258 | x509_set.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 259 | x509_set.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 260 | x509_set.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_set.c | ||
| 261 | x509_trs.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 262 | x509_trs.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 263 | x509_trs.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 264 | x509_trs.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 265 | x509_trs.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 266 | x509_trs.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 267 | x509_trs.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 268 | x509_trs.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 269 | x509_trs.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 270 | x509_trs.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 271 | x509_trs.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 272 | x509_trs.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 273 | x509_trs.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 274 | x509_trs.o: ../cryptlib.h x509_trs.c | ||
| 275 | x509_txt.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 276 | x509_txt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 277 | x509_txt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 278 | x509_txt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 279 | x509_txt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 280 | x509_txt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 281 | x509_txt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 282 | x509_txt.o: ../../include/openssl/opensslconf.h | ||
| 283 | x509_txt.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 284 | x509_txt.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 285 | x509_txt.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 286 | x509_txt.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 287 | x509_txt.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509_txt.c | ||
| 288 | x509_v3.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 289 | x509_v3.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 290 | x509_v3.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 291 | x509_v3.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 292 | x509_v3.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 293 | x509_v3.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 294 | x509_v3.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 295 | x509_v3.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 296 | x509_v3.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 297 | x509_v3.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 298 | x509_v3.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 299 | x509_v3.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 300 | x509_v3.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 301 | x509_v3.o: ../cryptlib.h x509_v3.c | ||
| 302 | x509_vfy.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 303 | x509_vfy.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 304 | x509_vfy.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 305 | x509_vfy.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 306 | x509_vfy.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 307 | x509_vfy.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 308 | x509_vfy.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 309 | x509_vfy.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 310 | x509_vfy.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 311 | x509_vfy.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 312 | x509_vfy.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 313 | x509_vfy.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 314 | x509_vfy.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 315 | x509_vfy.o: ../cryptlib.h x509_vfy.c | ||
| 316 | x509_vpm.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 317 | x509_vpm.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 318 | x509_vpm.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 319 | x509_vpm.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 320 | x509_vpm.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 321 | x509_vpm.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 322 | x509_vpm.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 323 | x509_vpm.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 324 | x509_vpm.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 325 | x509_vpm.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 326 | x509_vpm.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 327 | x509_vpm.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 328 | x509_vpm.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 329 | x509_vpm.o: ../cryptlib.h x509_vpm.c | ||
| 330 | x509cset.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 331 | x509cset.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 332 | x509cset.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 333 | x509cset.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 334 | x509cset.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 335 | x509cset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 336 | x509cset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 337 | x509cset.o: ../../include/openssl/opensslconf.h | ||
| 338 | x509cset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 339 | x509cset.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 340 | x509cset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 341 | x509cset.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 342 | x509cset.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509cset.c | ||
| 343 | x509name.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 344 | x509name.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 345 | x509name.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 346 | x509name.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 347 | x509name.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 348 | x509name.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 349 | x509name.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 350 | x509name.o: ../../include/openssl/opensslconf.h | ||
| 351 | x509name.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 352 | x509name.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 353 | x509name.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 354 | x509name.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 355 | x509name.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509name.c | ||
| 356 | x509rset.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 357 | x509rset.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 358 | x509rset.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 359 | x509rset.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 360 | x509rset.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 361 | x509rset.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 362 | x509rset.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 363 | x509rset.o: ../../include/openssl/opensslconf.h | ||
| 364 | x509rset.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 365 | x509rset.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 366 | x509rset.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 367 | x509rset.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 368 | x509rset.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509rset.c | ||
| 369 | x509spki.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 370 | x509spki.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 371 | x509spki.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 372 | x509spki.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 373 | x509spki.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 374 | x509spki.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 375 | x509spki.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 376 | x509spki.o: ../../include/openssl/opensslconf.h | ||
| 377 | x509spki.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 378 | x509spki.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 379 | x509spki.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 380 | x509spki.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 381 | x509spki.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509spki.c | ||
| 382 | x509type.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 383 | x509type.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 384 | x509type.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 385 | x509type.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 386 | x509type.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 387 | x509type.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 388 | x509type.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 389 | x509type.o: ../../include/openssl/opensslconf.h | ||
| 390 | x509type.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 391 | x509type.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 392 | x509type.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 393 | x509type.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 394 | x509type.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x509type.c | ||
| 395 | x_all.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 396 | x_all.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 397 | x_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
| 398 | x_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 399 | x_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 400 | x_all.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 401 | x_all.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 402 | x_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 403 | x_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 404 | x_all.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
| 405 | x_all.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 406 | x_all.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 407 | x_all.o: ../../include/openssl/x509_vfy.h ../cryptlib.h x_all.c | ||
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index e6f8a40395..604f4fb27f 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
| @@ -258,7 +258,6 @@ typedef struct x509_cinf_st | |||
| 258 | ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ | 258 | ASN1_BIT_STRING *issuerUID; /* [ 1 ] optional in v2 */ |
| 259 | ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ | 259 | ASN1_BIT_STRING *subjectUID; /* [ 2 ] optional in v2 */ |
| 260 | STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ | 260 | STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ |
| 261 | ASN1_ENCODING enc; | ||
| 262 | } X509_CINF; | 261 | } X509_CINF; |
| 263 | 262 | ||
| 264 | /* This stuff is certificate "auxiliary info" | 263 | /* This stuff is certificate "auxiliary info" |
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 5a0b0249b4..87ebf62525 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
| @@ -703,7 +703,6 @@ static int check_cert(X509_STORE_CTX *ctx) | |||
| 703 | x = sk_X509_value(ctx->chain, cnum); | 703 | x = sk_X509_value(ctx->chain, cnum); |
| 704 | ctx->current_cert = x; | 704 | ctx->current_cert = x; |
| 705 | ctx->current_issuer = NULL; | 705 | ctx->current_issuer = NULL; |
| 706 | ctx->current_crl_score = 0; | ||
| 707 | ctx->current_reasons = 0; | 706 | ctx->current_reasons = 0; |
| 708 | while (ctx->current_reasons != CRLDP_ALL_REASONS) | 707 | while (ctx->current_reasons != CRLDP_ALL_REASONS) |
| 709 | { | 708 | { |
| @@ -2016,9 +2015,6 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
| 2016 | ctx->error_depth=0; | 2015 | ctx->error_depth=0; |
| 2017 | ctx->current_cert=NULL; | 2016 | ctx->current_cert=NULL; |
| 2018 | ctx->current_issuer=NULL; | 2017 | ctx->current_issuer=NULL; |
| 2019 | ctx->current_crl=NULL; | ||
| 2020 | ctx->current_crl_score=0; | ||
| 2021 | ctx->current_reasons=0; | ||
| 2022 | ctx->tree = NULL; | 2018 | ctx->tree = NULL; |
| 2023 | ctx->parent = NULL; | 2019 | ctx->parent = NULL; |
| 2024 | 2020 | ||
| @@ -2038,7 +2034,7 @@ int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509, | |||
| 2038 | if (store) | 2034 | if (store) |
| 2039 | ret = X509_VERIFY_PARAM_inherit(ctx->param, store->param); | 2035 | ret = X509_VERIFY_PARAM_inherit(ctx->param, store->param); |
| 2040 | else | 2036 | else |
| 2041 | ctx->param->inh_flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE; | 2037 | ctx->param->flags |= X509_VP_FLAG_DEFAULT|X509_VP_FLAG_ONCE; |
| 2042 | 2038 | ||
| 2043 | if (store) | 2039 | if (store) |
| 2044 | { | 2040 | { |
diff --git a/src/lib/libcrypto/x509/x_all.c b/src/lib/libcrypto/x509/x_all.c index 8ec88c215a..ebae30b701 100644 --- a/src/lib/libcrypto/x509/x_all.c +++ b/src/lib/libcrypto/x509/x_all.c | |||
| @@ -90,7 +90,6 @@ int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r) | |||
| 90 | 90 | ||
| 91 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) | 91 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) |
| 92 | { | 92 | { |
| 93 | x->cert_info->enc.modified = 1; | ||
| 94 | return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CINF), x->cert_info->signature, | 93 | return(ASN1_item_sign(ASN1_ITEM_rptr(X509_CINF), x->cert_info->signature, |
| 95 | x->sig_alg, x->signature, x->cert_info,pkey,md)); | 94 | x->sig_alg, x->signature, x->cert_info,pkey,md)); |
| 96 | } | 95 | } |
diff --git a/src/lib/libcrypto/x509v3/Makefile b/src/lib/libcrypto/x509v3/Makefile new file mode 100644 index 0000000000..556ef351bf --- /dev/null +++ b/src/lib/libcrypto/x509v3/Makefile | |||
| @@ -0,0 +1,591 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/x509v3/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= x509v3 | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile README | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC= v3_bcons.c v3_bitst.c v3_conf.c v3_extku.c v3_ia5.c v3_lib.c \ | ||
| 21 | v3_prn.c v3_utl.c v3err.c v3_genn.c v3_alt.c v3_skey.c v3_akey.c v3_pku.c \ | ||
| 22 | v3_int.c v3_enum.c v3_sxnet.c v3_cpols.c v3_crld.c v3_purp.c v3_info.c \ | ||
| 23 | v3_ocsp.c v3_akeya.c v3_pmaps.c v3_pcons.c v3_ncons.c v3_pcia.c v3_pci.c \ | ||
| 24 | pcy_cache.c pcy_node.c pcy_data.c pcy_map.c pcy_tree.c pcy_lib.c \ | ||
| 25 | v3_asid.c v3_addr.c | ||
| 26 | LIBOBJ= v3_bcons.o v3_bitst.o v3_conf.o v3_extku.o v3_ia5.o v3_lib.o \ | ||
| 27 | v3_prn.o v3_utl.o v3err.o v3_genn.o v3_alt.o v3_skey.o v3_akey.o v3_pku.o \ | ||
| 28 | v3_int.o v3_enum.o v3_sxnet.o v3_cpols.o v3_crld.o v3_purp.o v3_info.o \ | ||
| 29 | v3_ocsp.o v3_akeya.o v3_pmaps.o v3_pcons.o v3_ncons.o v3_pcia.o v3_pci.o \ | ||
| 30 | pcy_cache.o pcy_node.o pcy_data.o pcy_map.o pcy_tree.o pcy_lib.o \ | ||
| 31 | v3_asid.o v3_addr.o | ||
| 32 | |||
| 33 | SRC= $(LIBSRC) | ||
| 34 | |||
| 35 | EXHEADER= x509v3.h | ||
| 36 | HEADER= $(EXHEADER) pcy_int.h | ||
| 37 | |||
| 38 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 39 | |||
| 40 | top: | ||
| 41 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 42 | |||
| 43 | all: lib | ||
| 44 | |||
| 45 | lib: $(LIBOBJ) | ||
| 46 | $(AR) $(LIB) $(LIBOBJ) | ||
| 47 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 48 | @touch lib | ||
| 49 | |||
| 50 | files: | ||
| 51 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 52 | |||
| 53 | links: | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 57 | |||
| 58 | install: | ||
| 59 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 60 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 61 | do \ | ||
| 62 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 63 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 64 | done; | ||
| 65 | |||
| 66 | tags: | ||
| 67 | ctags $(SRC) | ||
| 68 | |||
| 69 | tests: | ||
| 70 | |||
| 71 | lint: | ||
| 72 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 73 | |||
| 74 | depend: | ||
| 75 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 76 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 77 | |||
| 78 | dclean: | ||
| 79 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 80 | mv -f Makefile.new $(MAKEFILE) | ||
| 81 | |||
| 82 | clean: | ||
| 83 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 84 | |||
| 85 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 86 | |||
| 87 | pcy_cache.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 88 | pcy_cache.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 89 | pcy_cache.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 90 | pcy_cache.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 91 | pcy_cache.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 92 | pcy_cache.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 93 | pcy_cache.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 94 | pcy_cache.o: ../../include/openssl/objects.h | ||
| 95 | pcy_cache.o: ../../include/openssl/opensslconf.h | ||
| 96 | pcy_cache.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 97 | pcy_cache.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 98 | pcy_cache.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 99 | pcy_cache.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 100 | pcy_cache.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 101 | pcy_cache.o: ../cryptlib.h pcy_cache.c pcy_int.h | ||
| 102 | pcy_data.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 103 | pcy_data.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 104 | pcy_data.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 105 | pcy_data.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 106 | pcy_data.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 107 | pcy_data.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 108 | pcy_data.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 109 | pcy_data.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 110 | pcy_data.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 111 | pcy_data.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 112 | pcy_data.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 113 | pcy_data.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 114 | pcy_data.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 115 | pcy_data.o: ../cryptlib.h pcy_data.c pcy_int.h | ||
| 116 | pcy_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 117 | pcy_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 118 | pcy_lib.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 119 | pcy_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 120 | pcy_lib.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 121 | pcy_lib.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 122 | pcy_lib.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 123 | pcy_lib.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 124 | pcy_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 125 | pcy_lib.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 126 | pcy_lib.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 127 | pcy_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 128 | pcy_lib.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 129 | pcy_lib.o: ../cryptlib.h pcy_int.h pcy_lib.c | ||
| 130 | pcy_map.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 131 | pcy_map.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 132 | pcy_map.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 133 | pcy_map.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 134 | pcy_map.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 135 | pcy_map.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 136 | pcy_map.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 137 | pcy_map.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 138 | pcy_map.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 139 | pcy_map.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 140 | pcy_map.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 141 | pcy_map.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 142 | pcy_map.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 143 | pcy_map.o: ../cryptlib.h pcy_int.h pcy_map.c | ||
| 144 | pcy_node.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 145 | pcy_node.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 146 | pcy_node.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 147 | pcy_node.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 148 | pcy_node.o: ../../include/openssl/ecdsa.h ../../include/openssl/evp.h | ||
| 149 | pcy_node.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 150 | pcy_node.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 151 | pcy_node.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 152 | pcy_node.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 153 | pcy_node.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 154 | pcy_node.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 155 | pcy_node.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 156 | pcy_node.o: pcy_int.h pcy_node.c | ||
| 157 | pcy_tree.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 158 | pcy_tree.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 159 | pcy_tree.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 160 | pcy_tree.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 161 | pcy_tree.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 162 | pcy_tree.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 163 | pcy_tree.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 164 | pcy_tree.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 165 | pcy_tree.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 166 | pcy_tree.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 167 | pcy_tree.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 168 | pcy_tree.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 169 | pcy_tree.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 170 | pcy_tree.o: ../cryptlib.h pcy_int.h pcy_tree.c | ||
| 171 | v3_addr.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 172 | v3_addr.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 173 | v3_addr.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 174 | v3_addr.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 175 | v3_addr.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 176 | v3_addr.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 177 | v3_addr.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 178 | v3_addr.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 179 | v3_addr.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 180 | v3_addr.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 181 | v3_addr.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 182 | v3_addr.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 183 | v3_addr.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 184 | v3_addr.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_addr.c | ||
| 185 | v3_akey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 186 | v3_akey.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 187 | v3_akey.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 188 | v3_akey.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 189 | v3_akey.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 190 | v3_akey.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 191 | v3_akey.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 192 | v3_akey.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 193 | v3_akey.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 194 | v3_akey.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 195 | v3_akey.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 196 | v3_akey.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 197 | v3_akey.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 198 | v3_akey.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_akey.c | ||
| 199 | v3_akeya.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 200 | v3_akeya.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 201 | v3_akeya.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 202 | v3_akeya.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 203 | v3_akeya.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 204 | v3_akeya.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 205 | v3_akeya.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 206 | v3_akeya.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 207 | v3_akeya.o: ../../include/openssl/opensslconf.h | ||
| 208 | v3_akeya.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 209 | v3_akeya.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 210 | v3_akeya.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 211 | v3_akeya.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 212 | v3_akeya.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 213 | v3_akeya.o: ../cryptlib.h v3_akeya.c | ||
| 214 | v3_alt.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 215 | v3_alt.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 216 | v3_alt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 217 | v3_alt.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 218 | v3_alt.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 219 | v3_alt.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 220 | v3_alt.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 221 | v3_alt.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 222 | v3_alt.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 223 | v3_alt.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 224 | v3_alt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 225 | v3_alt.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 226 | v3_alt.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_alt.c | ||
| 227 | v3_asid.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 228 | v3_asid.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 229 | v3_asid.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 230 | v3_asid.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 231 | v3_asid.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 232 | v3_asid.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 233 | v3_asid.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 234 | v3_asid.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 235 | v3_asid.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 236 | v3_asid.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 237 | v3_asid.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 238 | v3_asid.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 239 | v3_asid.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 240 | v3_asid.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 241 | v3_asid.o: ../cryptlib.h v3_asid.c | ||
| 242 | v3_bcons.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 243 | v3_bcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 244 | v3_bcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 245 | v3_bcons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 246 | v3_bcons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 247 | v3_bcons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 248 | v3_bcons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 249 | v3_bcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 250 | v3_bcons.o: ../../include/openssl/opensslconf.h | ||
| 251 | v3_bcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 252 | v3_bcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 253 | v3_bcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 254 | v3_bcons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 255 | v3_bcons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 256 | v3_bcons.o: ../cryptlib.h v3_bcons.c | ||
| 257 | v3_bitst.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 258 | v3_bitst.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 259 | v3_bitst.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 260 | v3_bitst.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 261 | v3_bitst.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 262 | v3_bitst.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 263 | v3_bitst.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 264 | v3_bitst.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 265 | v3_bitst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 266 | v3_bitst.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 267 | v3_bitst.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 268 | v3_bitst.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 269 | v3_bitst.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 270 | v3_bitst.o: ../cryptlib.h v3_bitst.c | ||
| 271 | v3_conf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 272 | v3_conf.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 273 | v3_conf.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 274 | v3_conf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 275 | v3_conf.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 276 | v3_conf.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 277 | v3_conf.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 278 | v3_conf.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 279 | v3_conf.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 280 | v3_conf.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 281 | v3_conf.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 282 | v3_conf.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 283 | v3_conf.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 284 | v3_conf.o: ../cryptlib.h v3_conf.c | ||
| 285 | v3_cpols.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 286 | v3_cpols.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 287 | v3_cpols.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 288 | v3_cpols.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 289 | v3_cpols.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 290 | v3_cpols.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 291 | v3_cpols.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 292 | v3_cpols.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 293 | v3_cpols.o: ../../include/openssl/opensslconf.h | ||
| 294 | v3_cpols.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 295 | v3_cpols.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 296 | v3_cpols.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 297 | v3_cpols.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 298 | v3_cpols.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 299 | v3_cpols.o: ../cryptlib.h pcy_int.h v3_cpols.c | ||
| 300 | v3_crld.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 301 | v3_crld.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 302 | v3_crld.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 303 | v3_crld.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 304 | v3_crld.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 305 | v3_crld.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 306 | v3_crld.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 307 | v3_crld.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 308 | v3_crld.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 309 | v3_crld.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 310 | v3_crld.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 311 | v3_crld.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 312 | v3_crld.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 313 | v3_crld.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_crld.c | ||
| 314 | v3_enum.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 315 | v3_enum.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 316 | v3_enum.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 317 | v3_enum.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 318 | v3_enum.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 319 | v3_enum.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 320 | v3_enum.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 321 | v3_enum.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 322 | v3_enum.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 323 | v3_enum.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 324 | v3_enum.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 325 | v3_enum.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 326 | v3_enum.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 327 | v3_enum.o: ../cryptlib.h v3_enum.c | ||
| 328 | v3_extku.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 329 | v3_extku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 330 | v3_extku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 331 | v3_extku.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 332 | v3_extku.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 333 | v3_extku.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 334 | v3_extku.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 335 | v3_extku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 336 | v3_extku.o: ../../include/openssl/opensslconf.h | ||
| 337 | v3_extku.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 338 | v3_extku.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 339 | v3_extku.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 340 | v3_extku.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 341 | v3_extku.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 342 | v3_extku.o: ../cryptlib.h v3_extku.c | ||
| 343 | v3_genn.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 344 | v3_genn.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 345 | v3_genn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 346 | v3_genn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 347 | v3_genn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 348 | v3_genn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 349 | v3_genn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 350 | v3_genn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 351 | v3_genn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 352 | v3_genn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 353 | v3_genn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 354 | v3_genn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 355 | v3_genn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 356 | v3_genn.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_genn.c | ||
| 357 | v3_ia5.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 358 | v3_ia5.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 359 | v3_ia5.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 360 | v3_ia5.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 361 | v3_ia5.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 362 | v3_ia5.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 363 | v3_ia5.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 364 | v3_ia5.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 365 | v3_ia5.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 366 | v3_ia5.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 367 | v3_ia5.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 368 | v3_ia5.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 369 | v3_ia5.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_ia5.c | ||
| 370 | v3_info.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 371 | v3_info.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 372 | v3_info.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 373 | v3_info.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 374 | v3_info.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 375 | v3_info.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 376 | v3_info.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 377 | v3_info.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 378 | v3_info.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 379 | v3_info.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 380 | v3_info.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 381 | v3_info.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 382 | v3_info.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 383 | v3_info.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_info.c | ||
| 384 | v3_int.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 385 | v3_int.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 386 | v3_int.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 387 | v3_int.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 388 | v3_int.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 389 | v3_int.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 390 | v3_int.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 391 | v3_int.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 392 | v3_int.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 393 | v3_int.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 394 | v3_int.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 395 | v3_int.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 396 | v3_int.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_int.c | ||
| 397 | v3_lib.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 398 | v3_lib.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 399 | v3_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 400 | v3_lib.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 401 | v3_lib.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 402 | v3_lib.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 403 | v3_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 404 | v3_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 405 | v3_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 406 | v3_lib.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 407 | v3_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 408 | v3_lib.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 409 | v3_lib.o: ../../include/openssl/x509v3.h ../cryptlib.h ext_dat.h v3_lib.c | ||
| 410 | v3_ncons.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 411 | v3_ncons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 412 | v3_ncons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 413 | v3_ncons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 414 | v3_ncons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 415 | v3_ncons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 416 | v3_ncons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 417 | v3_ncons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 418 | v3_ncons.o: ../../include/openssl/opensslconf.h | ||
| 419 | v3_ncons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 420 | v3_ncons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 421 | v3_ncons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 422 | v3_ncons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 423 | v3_ncons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 424 | v3_ncons.o: ../cryptlib.h v3_ncons.c | ||
| 425 | v3_ocsp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 426 | v3_ocsp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 427 | v3_ocsp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 428 | v3_ocsp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 429 | v3_ocsp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 430 | v3_ocsp.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 431 | v3_ocsp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 432 | v3_ocsp.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 433 | v3_ocsp.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 434 | v3_ocsp.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 435 | v3_ocsp.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 436 | v3_ocsp.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 437 | v3_ocsp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 438 | v3_ocsp.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_ocsp.c | ||
| 439 | v3_pci.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 440 | v3_pci.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 441 | v3_pci.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 442 | v3_pci.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 443 | v3_pci.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 444 | v3_pci.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 445 | v3_pci.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 446 | v3_pci.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 447 | v3_pci.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 448 | v3_pci.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 449 | v3_pci.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 450 | v3_pci.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 451 | v3_pci.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pci.c | ||
| 452 | v3_pcia.o: ../../include/openssl/asn1.h ../../include/openssl/asn1t.h | ||
| 453 | v3_pcia.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 454 | v3_pcia.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 455 | v3_pcia.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 456 | v3_pcia.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 457 | v3_pcia.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 458 | v3_pcia.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 459 | v3_pcia.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 460 | v3_pcia.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 461 | v3_pcia.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 462 | v3_pcia.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 463 | v3_pcia.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 464 | v3_pcia.o: ../../include/openssl/x509v3.h v3_pcia.c | ||
| 465 | v3_pcons.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 466 | v3_pcons.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 467 | v3_pcons.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 468 | v3_pcons.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 469 | v3_pcons.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 470 | v3_pcons.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 471 | v3_pcons.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 472 | v3_pcons.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 473 | v3_pcons.o: ../../include/openssl/opensslconf.h | ||
| 474 | v3_pcons.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 475 | v3_pcons.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 476 | v3_pcons.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 477 | v3_pcons.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 478 | v3_pcons.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 479 | v3_pcons.o: ../cryptlib.h v3_pcons.c | ||
| 480 | v3_pku.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 481 | v3_pku.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 482 | v3_pku.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 483 | v3_pku.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 484 | v3_pku.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 485 | v3_pku.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 486 | v3_pku.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 487 | v3_pku.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 488 | v3_pku.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 489 | v3_pku.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 490 | v3_pku.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 491 | v3_pku.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 492 | v3_pku.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 493 | v3_pku.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_pku.c | ||
| 494 | v3_pmaps.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 495 | v3_pmaps.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 496 | v3_pmaps.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 497 | v3_pmaps.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 498 | v3_pmaps.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 499 | v3_pmaps.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 500 | v3_pmaps.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 501 | v3_pmaps.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 502 | v3_pmaps.o: ../../include/openssl/opensslconf.h | ||
| 503 | v3_pmaps.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 504 | v3_pmaps.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 505 | v3_pmaps.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 506 | v3_pmaps.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 507 | v3_pmaps.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 508 | v3_pmaps.o: ../cryptlib.h v3_pmaps.c | ||
| 509 | v3_prn.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 510 | v3_prn.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 511 | v3_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 512 | v3_prn.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 513 | v3_prn.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 514 | v3_prn.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 515 | v3_prn.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 516 | v3_prn.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 517 | v3_prn.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 518 | v3_prn.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 519 | v3_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 520 | v3_prn.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 521 | v3_prn.o: ../../include/openssl/x509v3.h ../cryptlib.h v3_prn.c | ||
| 522 | v3_purp.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 523 | v3_purp.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 524 | v3_purp.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 525 | v3_purp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 526 | v3_purp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 527 | v3_purp.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 528 | v3_purp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 529 | v3_purp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 530 | v3_purp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 531 | v3_purp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 532 | v3_purp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 533 | v3_purp.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 534 | v3_purp.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 535 | v3_purp.o: ../cryptlib.h v3_purp.c | ||
| 536 | v3_skey.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 537 | v3_skey.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 538 | v3_skey.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 539 | v3_skey.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 540 | v3_skey.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 541 | v3_skey.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 542 | v3_skey.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 543 | v3_skey.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 544 | v3_skey.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 545 | v3_skey.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 546 | v3_skey.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 547 | v3_skey.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 548 | v3_skey.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 549 | v3_skey.o: ../cryptlib.h v3_skey.c | ||
| 550 | v3_sxnet.o: ../../e_os.h ../../include/openssl/asn1.h | ||
| 551 | v3_sxnet.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
| 552 | v3_sxnet.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 553 | v3_sxnet.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 554 | v3_sxnet.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 555 | v3_sxnet.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 556 | v3_sxnet.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 557 | v3_sxnet.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 558 | v3_sxnet.o: ../../include/openssl/opensslconf.h | ||
| 559 | v3_sxnet.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 560 | v3_sxnet.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 561 | v3_sxnet.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 562 | v3_sxnet.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 563 | v3_sxnet.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 564 | v3_sxnet.o: ../cryptlib.h v3_sxnet.c | ||
| 565 | v3_utl.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 566 | v3_utl.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 567 | v3_utl.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 568 | v3_utl.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 569 | v3_utl.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h | ||
| 570 | v3_utl.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 571 | v3_utl.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 572 | v3_utl.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h | ||
| 573 | v3_utl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 574 | v3_utl.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h | ||
| 575 | v3_utl.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
| 576 | v3_utl.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h | ||
| 577 | v3_utl.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 578 | v3_utl.o: ../cryptlib.h v3_utl.c | ||
| 579 | v3err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 580 | v3err.o: ../../include/openssl/buffer.h ../../include/openssl/conf.h | ||
| 581 | v3err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 582 | v3err.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 583 | v3err.o: ../../include/openssl/ecdsa.h ../../include/openssl/err.h | ||
| 584 | v3err.o: ../../include/openssl/evp.h ../../include/openssl/lhash.h | ||
| 585 | v3err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 586 | v3err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 587 | v3err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pkcs7.h | ||
| 588 | v3err.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 589 | v3err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 590 | v3err.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 591 | v3err.o: ../../include/openssl/x509v3.h v3err.c | ||
diff --git a/src/lib/libcrypto/x509v3/pcy_tree.c b/src/lib/libcrypto/x509v3/pcy_tree.c index bb9777348f..92f6b24556 100644 --- a/src/lib/libcrypto/x509v3/pcy_tree.c +++ b/src/lib/libcrypto/x509v3/pcy_tree.c | |||
| @@ -341,8 +341,9 @@ static int tree_link_nodes(X509_POLICY_LEVEL *curr, | |||
| 341 | const X509_POLICY_CACHE *cache) | 341 | const X509_POLICY_CACHE *cache) |
| 342 | { | 342 | { |
| 343 | int i; | 343 | int i; |
| 344 | X509_POLICY_LEVEL *last; | ||
| 344 | X509_POLICY_DATA *data; | 345 | X509_POLICY_DATA *data; |
| 345 | 346 | last = curr - 1; | |
| 346 | for (i = 0; i < sk_X509_POLICY_DATA_num(cache->data); i++) | 347 | for (i = 0; i < sk_X509_POLICY_DATA_num(cache->data); i++) |
| 347 | { | 348 | { |
| 348 | data = sk_X509_POLICY_DATA_value(cache->data, i); | 349 | data = sk_X509_POLICY_DATA_value(cache->data, i); |
diff --git a/src/lib/libcrypto/x509v3/tabtest.c b/src/lib/libcrypto/x509v3/tabtest.c new file mode 100644 index 0000000000..5ed6eb6891 --- /dev/null +++ b/src/lib/libcrypto/x509v3/tabtest.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* tabtest.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Simple program to check the ext_dat.h is correct and print out | ||
| 60 | * problems if it is not. | ||
| 61 | */ | ||
| 62 | |||
| 63 | #include <stdio.h> | ||
| 64 | |||
| 65 | #include <openssl/x509v3.h> | ||
| 66 | |||
| 67 | #include "ext_dat.h" | ||
| 68 | |||
| 69 | main() | ||
| 70 | { | ||
| 71 | int i, prev = -1, bad = 0; | ||
| 72 | X509V3_EXT_METHOD **tmp; | ||
| 73 | i = sizeof(standard_exts) / sizeof(X509V3_EXT_METHOD *); | ||
| 74 | if(i != STANDARD_EXTENSION_COUNT) | ||
| 75 | fprintf(stderr, "Extension number invalid expecting %d\n", i); | ||
| 76 | tmp = standard_exts; | ||
| 77 | for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) { | ||
| 78 | if((*tmp)->ext_nid < prev) bad = 1; | ||
| 79 | prev = (*tmp)->ext_nid; | ||
| 80 | |||
| 81 | } | ||
| 82 | if(bad) { | ||
| 83 | tmp = standard_exts; | ||
| 84 | fprintf(stderr, "Extensions out of order!\n"); | ||
| 85 | for(i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) | ||
| 86 | printf("%d : %s\n", (*tmp)->ext_nid, OBJ_nid2sn((*tmp)->ext_nid)); | ||
| 87 | } else fprintf(stderr, "Order OK\n"); | ||
| 88 | } | ||
diff --git a/src/lib/libcrypto/x509v3/v3_addr.c b/src/lib/libcrypto/x509v3/v3_addr.c new file mode 100644 index 0000000000..9087d66e0a --- /dev/null +++ b/src/lib/libcrypto/x509v3/v3_addr.c | |||
| @@ -0,0 +1,1287 @@ | |||
| 1 | /* | ||
| 2 | * Contributed to the OpenSSL Project by the American Registry for | ||
| 3 | * Internet Numbers ("ARIN"). | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | */ | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Implementation of RFC 3779 section 2.2. | ||
| 60 | */ | ||
| 61 | |||
| 62 | #include <stdio.h> | ||
| 63 | #include <stdlib.h> | ||
| 64 | |||
| 65 | #include "cryptlib.h" | ||
| 66 | #include <openssl/conf.h> | ||
| 67 | #include <openssl/asn1.h> | ||
| 68 | #include <openssl/asn1t.h> | ||
| 69 | #include <openssl/buffer.h> | ||
| 70 | #include <openssl/x509v3.h> | ||
| 71 | |||
| 72 | #ifndef OPENSSL_NO_RFC3779 | ||
| 73 | |||
| 74 | /* | ||
| 75 | * OpenSSL ASN.1 template translation of RFC 3779 2.2.3. | ||
| 76 | */ | ||
| 77 | |||
| 78 | ASN1_SEQUENCE(IPAddressRange) = { | ||
| 79 | ASN1_SIMPLE(IPAddressRange, min, ASN1_BIT_STRING), | ||
| 80 | ASN1_SIMPLE(IPAddressRange, max, ASN1_BIT_STRING) | ||
| 81 | } ASN1_SEQUENCE_END(IPAddressRange) | ||
| 82 | |||
| 83 | ASN1_CHOICE(IPAddressOrRange) = { | ||
| 84 | ASN1_SIMPLE(IPAddressOrRange, u.addressPrefix, ASN1_BIT_STRING), | ||
| 85 | ASN1_SIMPLE(IPAddressOrRange, u.addressRange, IPAddressRange) | ||
| 86 | } ASN1_CHOICE_END(IPAddressOrRange) | ||
| 87 | |||
| 88 | ASN1_CHOICE(IPAddressChoice) = { | ||
| 89 | ASN1_SIMPLE(IPAddressChoice, u.inherit, ASN1_NULL), | ||
| 90 | ASN1_SEQUENCE_OF(IPAddressChoice, u.addressesOrRanges, IPAddressOrRange) | ||
| 91 | } ASN1_CHOICE_END(IPAddressChoice) | ||
| 92 | |||
| 93 | ASN1_SEQUENCE(IPAddressFamily) = { | ||
| 94 | ASN1_SIMPLE(IPAddressFamily, addressFamily, ASN1_OCTET_STRING), | ||
| 95 | ASN1_SIMPLE(IPAddressFamily, ipAddressChoice, IPAddressChoice) | ||
| 96 | } ASN1_SEQUENCE_END(IPAddressFamily) | ||
| 97 | |||
| 98 | ASN1_ITEM_TEMPLATE(IPAddrBlocks) = | ||
| 99 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, | ||
| 100 | IPAddrBlocks, IPAddressFamily) | ||
| 101 | ASN1_ITEM_TEMPLATE_END(IPAddrBlocks) | ||
| 102 | |||
| 103 | IMPLEMENT_ASN1_FUNCTIONS(IPAddressRange) | ||
| 104 | IMPLEMENT_ASN1_FUNCTIONS(IPAddressOrRange) | ||
| 105 | IMPLEMENT_ASN1_FUNCTIONS(IPAddressChoice) | ||
| 106 | IMPLEMENT_ASN1_FUNCTIONS(IPAddressFamily) | ||
| 107 | |||
| 108 | /* | ||
| 109 | * How much buffer space do we need for a raw address? | ||
| 110 | */ | ||
| 111 | #define ADDR_RAW_BUF_LEN 16 | ||
| 112 | |||
| 113 | /* | ||
| 114 | * What's the address length associated with this AFI? | ||
| 115 | */ | ||
| 116 | static int length_from_afi(const unsigned afi) | ||
| 117 | { | ||
| 118 | switch (afi) { | ||
| 119 | case IANA_AFI_IPV4: | ||
| 120 | return 4; | ||
| 121 | case IANA_AFI_IPV6: | ||
| 122 | return 16; | ||
| 123 | default: | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 128 | /* | ||
| 129 | * Extract the AFI from an IPAddressFamily. | ||
| 130 | */ | ||
| 131 | unsigned int v3_addr_get_afi(const IPAddressFamily *f) | ||
| 132 | { | ||
| 133 | return ((f != NULL && | ||
| 134 | f->addressFamily != NULL && | ||
| 135 | f->addressFamily->data != NULL) | ||
| 136 | ? ((f->addressFamily->data[0] << 8) | | ||
| 137 | (f->addressFamily->data[1])) | ||
| 138 | : 0); | ||
| 139 | } | ||
| 140 | |||
| 141 | /* | ||
| 142 | * Expand the bitstring form of an address into a raw byte array. | ||
| 143 | * At the moment this is coded for simplicity, not speed. | ||
| 144 | */ | ||
| 145 | static void addr_expand(unsigned char *addr, | ||
| 146 | const ASN1_BIT_STRING *bs, | ||
| 147 | const int length, | ||
| 148 | const unsigned char fill) | ||
| 149 | { | ||
| 150 | OPENSSL_assert(bs->length >= 0 && bs->length <= length); | ||
| 151 | if (bs->length > 0) { | ||
| 152 | memcpy(addr, bs->data, bs->length); | ||
| 153 | if ((bs->flags & 7) != 0) { | ||
| 154 | unsigned char mask = 0xFF >> (8 - (bs->flags & 7)); | ||
| 155 | if (fill == 0) | ||
| 156 | addr[bs->length - 1] &= ~mask; | ||
| 157 | else | ||
| 158 | addr[bs->length - 1] |= mask; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | memset(addr + bs->length, fill, length - bs->length); | ||
| 162 | } | ||
| 163 | |||
| 164 | /* | ||
| 165 | * Extract the prefix length from a bitstring. | ||
| 166 | */ | ||
| 167 | #define addr_prefixlen(bs) ((int) ((bs)->length * 8 - ((bs)->flags & 7))) | ||
| 168 | |||
| 169 | /* | ||
| 170 | * i2r handler for one address bitstring. | ||
| 171 | */ | ||
| 172 | static int i2r_address(BIO *out, | ||
| 173 | const unsigned afi, | ||
| 174 | const unsigned char fill, | ||
| 175 | const ASN1_BIT_STRING *bs) | ||
| 176 | { | ||
| 177 | unsigned char addr[ADDR_RAW_BUF_LEN]; | ||
| 178 | int i, n; | ||
| 179 | |||
| 180 | switch (afi) { | ||
| 181 | case IANA_AFI_IPV4: | ||
| 182 | addr_expand(addr, bs, 4, fill); | ||
| 183 | BIO_printf(out, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]); | ||
| 184 | break; | ||
| 185 | case IANA_AFI_IPV6: | ||
| 186 | addr_expand(addr, bs, 16, fill); | ||
| 187 | for (n = 16; n > 1 && addr[n-1] == 0x00 && addr[n-2] == 0x00; n -= 2) | ||
| 188 | ; | ||
| 189 | for (i = 0; i < n; i += 2) | ||
| 190 | BIO_printf(out, "%x%s", (addr[i] << 8) | addr[i+1], (i < 14 ? ":" : "")); | ||
| 191 | if (i < 16) | ||
| 192 | BIO_puts(out, ":"); | ||
| 193 | if (i == 0) | ||
| 194 | BIO_puts(out, ":"); | ||
| 195 | break; | ||
| 196 | default: | ||
| 197 | for (i = 0; i < bs->length; i++) | ||
| 198 | BIO_printf(out, "%s%02x", (i > 0 ? ":" : ""), bs->data[i]); | ||
| 199 | BIO_printf(out, "[%d]", (int) (bs->flags & 7)); | ||
| 200 | break; | ||
| 201 | } | ||
| 202 | return 1; | ||
| 203 | } | ||
| 204 | |||
| 205 | /* | ||
| 206 | * i2r handler for a sequence of addresses and ranges. | ||
| 207 | */ | ||
| 208 | static int i2r_IPAddressOrRanges(BIO *out, | ||
| 209 | const int indent, | ||
| 210 | const IPAddressOrRanges *aors, | ||
| 211 | const unsigned afi) | ||
| 212 | { | ||
| 213 | int i; | ||
| 214 | for (i = 0; i < sk_IPAddressOrRange_num(aors); i++) { | ||
| 215 | const IPAddressOrRange *aor = sk_IPAddressOrRange_value(aors, i); | ||
| 216 | BIO_printf(out, "%*s", indent, ""); | ||
| 217 | switch (aor->type) { | ||
| 218 | case IPAddressOrRange_addressPrefix: | ||
| 219 | if (!i2r_address(out, afi, 0x00, aor->u.addressPrefix)) | ||
| 220 | return 0; | ||
| 221 | BIO_printf(out, "/%d\n", addr_prefixlen(aor->u.addressPrefix)); | ||
| 222 | continue; | ||
| 223 | case IPAddressOrRange_addressRange: | ||
| 224 | if (!i2r_address(out, afi, 0x00, aor->u.addressRange->min)) | ||
| 225 | return 0; | ||
| 226 | BIO_puts(out, "-"); | ||
| 227 | if (!i2r_address(out, afi, 0xFF, aor->u.addressRange->max)) | ||
| 228 | return 0; | ||
| 229 | BIO_puts(out, "\n"); | ||
| 230 | continue; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | return 1; | ||
| 234 | } | ||
| 235 | |||
| 236 | /* | ||
| 237 | * i2r handler for an IPAddrBlocks extension. | ||
| 238 | */ | ||
| 239 | static int i2r_IPAddrBlocks(const X509V3_EXT_METHOD *method, | ||
| 240 | void *ext, | ||
| 241 | BIO *out, | ||
| 242 | int indent) | ||
| 243 | { | ||
| 244 | const IPAddrBlocks *addr = ext; | ||
| 245 | int i; | ||
| 246 | for (i = 0; i < sk_IPAddressFamily_num(addr); i++) { | ||
| 247 | IPAddressFamily *f = sk_IPAddressFamily_value(addr, i); | ||
| 248 | const unsigned int afi = v3_addr_get_afi(f); | ||
| 249 | switch (afi) { | ||
| 250 | case IANA_AFI_IPV4: | ||
| 251 | BIO_printf(out, "%*sIPv4", indent, ""); | ||
| 252 | break; | ||
| 253 | case IANA_AFI_IPV6: | ||
| 254 | BIO_printf(out, "%*sIPv6", indent, ""); | ||
| 255 | break; | ||
| 256 | default: | ||
| 257 | BIO_printf(out, "%*sUnknown AFI %u", indent, "", afi); | ||
| 258 | break; | ||
| 259 | } | ||
| 260 | if (f->addressFamily->length > 2) { | ||
| 261 | switch (f->addressFamily->data[2]) { | ||
| 262 | case 1: | ||
| 263 | BIO_puts(out, " (Unicast)"); | ||
| 264 | break; | ||
| 265 | case 2: | ||
| 266 | BIO_puts(out, " (Multicast)"); | ||
| 267 | break; | ||
| 268 | case 3: | ||
| 269 | BIO_puts(out, " (Unicast/Multicast)"); | ||
| 270 | break; | ||
| 271 | case 4: | ||
| 272 | BIO_puts(out, " (MPLS)"); | ||
| 273 | break; | ||
| 274 | case 64: | ||
| 275 | BIO_puts(out, " (Tunnel)"); | ||
| 276 | break; | ||
| 277 | case 65: | ||
| 278 | BIO_puts(out, " (VPLS)"); | ||
| 279 | break; | ||
| 280 | case 66: | ||
| 281 | BIO_puts(out, " (BGP MDT)"); | ||
| 282 | break; | ||
| 283 | case 128: | ||
| 284 | BIO_puts(out, " (MPLS-labeled VPN)"); | ||
| 285 | break; | ||
| 286 | default: | ||
| 287 | BIO_printf(out, " (Unknown SAFI %u)", | ||
| 288 | (unsigned) f->addressFamily->data[2]); | ||
| 289 | break; | ||
| 290 | } | ||
| 291 | } | ||
| 292 | switch (f->ipAddressChoice->type) { | ||
| 293 | case IPAddressChoice_inherit: | ||
| 294 | BIO_puts(out, ": inherit\n"); | ||
| 295 | break; | ||
| 296 | case IPAddressChoice_addressesOrRanges: | ||
| 297 | BIO_puts(out, ":\n"); | ||
| 298 | if (!i2r_IPAddressOrRanges(out, | ||
| 299 | indent + 2, | ||
| 300 | f->ipAddressChoice->u.addressesOrRanges, | ||
| 301 | afi)) | ||
| 302 | return 0; | ||
| 303 | break; | ||
| 304 | } | ||
| 305 | } | ||
| 306 | return 1; | ||
| 307 | } | ||
| 308 | |||
| 309 | /* | ||
| 310 | * Sort comparison function for a sequence of IPAddressOrRange | ||
| 311 | * elements. | ||
| 312 | */ | ||
| 313 | static int IPAddressOrRange_cmp(const IPAddressOrRange *a, | ||
| 314 | const IPAddressOrRange *b, | ||
| 315 | const int length) | ||
| 316 | { | ||
| 317 | unsigned char addr_a[ADDR_RAW_BUF_LEN], addr_b[ADDR_RAW_BUF_LEN]; | ||
| 318 | int prefixlen_a = 0, prefixlen_b = 0; | ||
| 319 | int r; | ||
| 320 | |||
| 321 | switch (a->type) { | ||
| 322 | case IPAddressOrRange_addressPrefix: | ||
| 323 | addr_expand(addr_a, a->u.addressPrefix, length, 0x00); | ||
| 324 | prefixlen_a = addr_prefixlen(a->u.addressPrefix); | ||
| 325 | break; | ||
| 326 | case IPAddressOrRange_addressRange: | ||
| 327 | addr_expand(addr_a, a->u.addressRange->min, length, 0x00); | ||
| 328 | prefixlen_a = length * 8; | ||
| 329 | break; | ||
| 330 | } | ||
| 331 | |||
| 332 | switch (b->type) { | ||
| 333 | case IPAddressOrRange_addressPrefix: | ||
| 334 | addr_expand(addr_b, b->u.addressPrefix, length, 0x00); | ||
| 335 | prefixlen_b = addr_prefixlen(b->u.addressPrefix); | ||
| 336 | break; | ||
| 337 | case IPAddressOrRange_addressRange: | ||
| 338 | addr_expand(addr_b, b->u.addressRange->min, length, 0x00); | ||
| 339 | prefixlen_b = length * 8; | ||
| 340 | break; | ||
| 341 | } | ||
| 342 | |||
| 343 | if ((r = memcmp(addr_a, addr_b, length)) != 0) | ||
| 344 | return r; | ||
| 345 | else | ||
| 346 | return prefixlen_a - prefixlen_b; | ||
| 347 | } | ||
| 348 | |||
| 349 | /* | ||
| 350 | * IPv4-specific closure over IPAddressOrRange_cmp, since sk_sort() | ||
| 351 | * comparision routines are only allowed two arguments. | ||
| 352 | */ | ||
| 353 | static int v4IPAddressOrRange_cmp(const IPAddressOrRange * const *a, | ||
| 354 | const IPAddressOrRange * const *b) | ||
| 355 | { | ||
| 356 | return IPAddressOrRange_cmp(*a, *b, 4); | ||
| 357 | } | ||
| 358 | |||
| 359 | /* | ||
| 360 | * IPv6-specific closure over IPAddressOrRange_cmp, since sk_sort() | ||
| 361 | * comparision routines are only allowed two arguments. | ||
| 362 | */ | ||
| 363 | static int v6IPAddressOrRange_cmp(const IPAddressOrRange * const *a, | ||
| 364 | const IPAddressOrRange * const *b) | ||
| 365 | { | ||
| 366 | return IPAddressOrRange_cmp(*a, *b, 16); | ||
| 367 | } | ||
| 368 | |||
| 369 | /* | ||
| 370 | * Calculate whether a range collapses to a prefix. | ||
| 371 | * See last paragraph of RFC 3779 2.2.3.7. | ||
| 372 | */ | ||
| 373 | static int range_should_be_prefix(const unsigned char *min, | ||
| 374 | const unsigned char *max, | ||
| 375 | const int length) | ||
| 376 | { | ||
| 377 | unsigned char mask; | ||
| 378 | int i, j; | ||
| 379 | |||
| 380 | for (i = 0; i < length && min[i] == max[i]; i++) | ||
| 381 | ; | ||
| 382 | for (j = length - 1; j >= 0 && min[j] == 0x00 && max[j] == 0xFF; j--) | ||
| 383 | ; | ||
| 384 | if (i < j) | ||
| 385 | return -1; | ||
| 386 | if (i > j) | ||
| 387 | return i * 8; | ||
| 388 | mask = min[i] ^ max[i]; | ||
| 389 | switch (mask) { | ||
| 390 | case 0x01: j = 7; break; | ||
| 391 | case 0x03: j = 6; break; | ||
| 392 | case 0x07: j = 5; break; | ||
| 393 | case 0x0F: j = 4; break; | ||
| 394 | case 0x1F: j = 3; break; | ||
| 395 | case 0x3F: j = 2; break; | ||
| 396 | case 0x7F: j = 1; break; | ||
| 397 | default: return -1; | ||
| 398 | } | ||
| 399 | if ((min[i] & mask) != 0 || (max[i] & mask) != mask) | ||
| 400 | return -1; | ||
| 401 | else | ||
| 402 | return i * 8 + j; | ||
| 403 | } | ||
| 404 | |||
| 405 | /* | ||
| 406 | * Construct a prefix. | ||
| 407 | */ | ||
| 408 | static int make_addressPrefix(IPAddressOrRange **result, | ||
| 409 | unsigned char *addr, | ||
| 410 | const int prefixlen) | ||
| 411 | { | ||
| 412 | int bytelen = (prefixlen + 7) / 8, bitlen = prefixlen % 8; | ||
| 413 | IPAddressOrRange *aor = IPAddressOrRange_new(); | ||
| 414 | |||
| 415 | if (aor == NULL) | ||
| 416 | return 0; | ||
| 417 | aor->type = IPAddressOrRange_addressPrefix; | ||
| 418 | if (aor->u.addressPrefix == NULL && | ||
| 419 | (aor->u.addressPrefix = ASN1_BIT_STRING_new()) == NULL) | ||
| 420 | goto err; | ||
| 421 | if (!ASN1_BIT_STRING_set(aor->u.addressPrefix, addr, bytelen)) | ||
| 422 | goto err; | ||
| 423 | aor->u.addressPrefix->flags &= ~7; | ||
| 424 | aor->u.addressPrefix->flags |= ASN1_STRING_FLAG_BITS_LEFT; | ||
| 425 | if (bitlen > 0) { | ||
| 426 | aor->u.addressPrefix->data[bytelen - 1] &= ~(0xFF >> bitlen); | ||
| 427 | aor->u.addressPrefix->flags |= 8 - bitlen; | ||
| 428 | } | ||
| 429 | |||
| 430 | *result = aor; | ||
| 431 | return 1; | ||
| 432 | |||
| 433 | err: | ||
| 434 | IPAddressOrRange_free(aor); | ||
| 435 | return 0; | ||
| 436 | } | ||
| 437 | |||
| 438 | /* | ||
| 439 | * Construct a range. If it can be expressed as a prefix, | ||
| 440 | * return a prefix instead. Doing this here simplifies | ||
| 441 | * the rest of the code considerably. | ||
| 442 | */ | ||
| 443 | static int make_addressRange(IPAddressOrRange **result, | ||
| 444 | unsigned char *min, | ||
| 445 | unsigned char *max, | ||
| 446 | const int length) | ||
| 447 | { | ||
| 448 | IPAddressOrRange *aor; | ||
| 449 | int i, prefixlen; | ||
| 450 | |||
| 451 | if ((prefixlen = range_should_be_prefix(min, max, length)) >= 0) | ||
| 452 | return make_addressPrefix(result, min, prefixlen); | ||
| 453 | |||
| 454 | if ((aor = IPAddressOrRange_new()) == NULL) | ||
| 455 | return 0; | ||
| 456 | aor->type = IPAddressOrRange_addressRange; | ||
| 457 | OPENSSL_assert(aor->u.addressRange == NULL); | ||
| 458 | if ((aor->u.addressRange = IPAddressRange_new()) == NULL) | ||
| 459 | goto err; | ||
| 460 | if (aor->u.addressRange->min == NULL && | ||
| 461 | (aor->u.addressRange->min = ASN1_BIT_STRING_new()) == NULL) | ||
| 462 | goto err; | ||
| 463 | if (aor->u.addressRange->max == NULL && | ||
| 464 | (aor->u.addressRange->max = ASN1_BIT_STRING_new()) == NULL) | ||
| 465 | goto err; | ||
| 466 | |||
| 467 | for (i = length; i > 0 && min[i - 1] == 0x00; --i) | ||
| 468 | ; | ||
| 469 | if (!ASN1_BIT_STRING_set(aor->u.addressRange->min, min, i)) | ||
| 470 | goto err; | ||
| 471 | aor->u.addressRange->min->flags &= ~7; | ||
| 472 | aor->u.addressRange->min->flags |= ASN1_STRING_FLAG_BITS_LEFT; | ||
| 473 | if (i > 0) { | ||
| 474 | unsigned char b = min[i - 1]; | ||
| 475 | int j = 1; | ||
| 476 | while ((b & (0xFFU >> j)) != 0) | ||
| 477 | ++j; | ||
| 478 | aor->u.addressRange->min->flags |= 8 - j; | ||
| 479 | } | ||
| 480 | |||
| 481 | for (i = length; i > 0 && max[i - 1] == 0xFF; --i) | ||
| 482 | ; | ||
| 483 | if (!ASN1_BIT_STRING_set(aor->u.addressRange->max, max, i)) | ||
| 484 | goto err; | ||
| 485 | aor->u.addressRange->max->flags &= ~7; | ||
| 486 | aor->u.addressRange->max->flags |= ASN1_STRING_FLAG_BITS_LEFT; | ||
| 487 | if (i > 0) { | ||
| 488 | unsigned char b = max[i - 1]; | ||
| 489 | int j = 1; | ||
| 490 | while ((b & (0xFFU >> j)) != (0xFFU >> j)) | ||
| 491 | ++j; | ||
| 492 | aor->u.addressRange->max->flags |= 8 - j; | ||
| 493 | } | ||
| 494 | |||
| 495 | *result = aor; | ||
| 496 | return 1; | ||
| 497 | |||
| 498 | err: | ||
| 499 | IPAddressOrRange_free(aor); | ||
| 500 | return 0; | ||
| 501 | } | ||
| 502 | |||
| 503 | /* | ||
| 504 | * Construct a new address family or find an existing one. | ||
| 505 | */ | ||
| 506 | static IPAddressFamily *make_IPAddressFamily(IPAddrBlocks *addr, | ||
| 507 | const unsigned afi, | ||
| 508 | const unsigned *safi) | ||
| 509 | { | ||
| 510 | IPAddressFamily *f; | ||
| 511 | unsigned char key[3]; | ||
| 512 | unsigned keylen; | ||
| 513 | int i; | ||
| 514 | |||
| 515 | key[0] = (afi >> 8) & 0xFF; | ||
| 516 | key[1] = afi & 0xFF; | ||
| 517 | if (safi != NULL) { | ||
| 518 | key[2] = *safi & 0xFF; | ||
| 519 | keylen = 3; | ||
| 520 | } else { | ||
| 521 | keylen = 2; | ||
| 522 | } | ||
| 523 | |||
| 524 | for (i = 0; i < sk_IPAddressFamily_num(addr); i++) { | ||
| 525 | f = sk_IPAddressFamily_value(addr, i); | ||
| 526 | OPENSSL_assert(f->addressFamily->data != NULL); | ||
| 527 | if (f->addressFamily->length == keylen && | ||
| 528 | !memcmp(f->addressFamily->data, key, keylen)) | ||
| 529 | return f; | ||
| 530 | } | ||
| 531 | |||
| 532 | if ((f = IPAddressFamily_new()) == NULL) | ||
| 533 | goto err; | ||
| 534 | if (f->ipAddressChoice == NULL && | ||
| 535 | (f->ipAddressChoice = IPAddressChoice_new()) == NULL) | ||
| 536 | goto err; | ||
| 537 | if (f->addressFamily == NULL && | ||
| 538 | (f->addressFamily = ASN1_OCTET_STRING_new()) == NULL) | ||
| 539 | goto err; | ||
| 540 | if (!ASN1_OCTET_STRING_set(f->addressFamily, key, keylen)) | ||
| 541 | goto err; | ||
| 542 | if (!sk_IPAddressFamily_push(addr, f)) | ||
| 543 | goto err; | ||
| 544 | |||
| 545 | return f; | ||
| 546 | |||
| 547 | err: | ||
| 548 | IPAddressFamily_free(f); | ||
| 549 | return NULL; | ||
| 550 | } | ||
| 551 | |||
| 552 | /* | ||
| 553 | * Add an inheritance element. | ||
| 554 | */ | ||
| 555 | int v3_addr_add_inherit(IPAddrBlocks *addr, | ||
| 556 | const unsigned afi, | ||
| 557 | const unsigned *safi) | ||
| 558 | { | ||
| 559 | IPAddressFamily *f = make_IPAddressFamily(addr, afi, safi); | ||
| 560 | if (f == NULL || | ||
| 561 | f->ipAddressChoice == NULL || | ||
| 562 | (f->ipAddressChoice->type == IPAddressChoice_addressesOrRanges && | ||
| 563 | f->ipAddressChoice->u.addressesOrRanges != NULL)) | ||
| 564 | return 0; | ||
| 565 | if (f->ipAddressChoice->type == IPAddressChoice_inherit && | ||
| 566 | f->ipAddressChoice->u.inherit != NULL) | ||
| 567 | return 1; | ||
| 568 | if (f->ipAddressChoice->u.inherit == NULL && | ||
| 569 | (f->ipAddressChoice->u.inherit = ASN1_NULL_new()) == NULL) | ||
| 570 | return 0; | ||
| 571 | f->ipAddressChoice->type = IPAddressChoice_inherit; | ||
| 572 | return 1; | ||
| 573 | } | ||
| 574 | |||
| 575 | /* | ||
| 576 | * Construct an IPAddressOrRange sequence, or return an existing one. | ||
| 577 | */ | ||
| 578 | static IPAddressOrRanges *make_prefix_or_range(IPAddrBlocks *addr, | ||
| 579 | const unsigned afi, | ||
| 580 | const unsigned *safi) | ||
| 581 | { | ||
| 582 | IPAddressFamily *f = make_IPAddressFamily(addr, afi, safi); | ||
| 583 | IPAddressOrRanges *aors = NULL; | ||
| 584 | |||
| 585 | if (f == NULL || | ||
| 586 | f->ipAddressChoice == NULL || | ||
| 587 | (f->ipAddressChoice->type == IPAddressChoice_inherit && | ||
| 588 | f->ipAddressChoice->u.inherit != NULL)) | ||
| 589 | return NULL; | ||
| 590 | if (f->ipAddressChoice->type == IPAddressChoice_addressesOrRanges) | ||
| 591 | aors = f->ipAddressChoice->u.addressesOrRanges; | ||
| 592 | if (aors != NULL) | ||
| 593 | return aors; | ||
| 594 | if ((aors = sk_IPAddressOrRange_new_null()) == NULL) | ||
| 595 | return NULL; | ||
| 596 | switch (afi) { | ||
| 597 | case IANA_AFI_IPV4: | ||
| 598 | sk_IPAddressOrRange_set_cmp_func(aors, v4IPAddressOrRange_cmp); | ||
| 599 | break; | ||
| 600 | case IANA_AFI_IPV6: | ||
| 601 | sk_IPAddressOrRange_set_cmp_func(aors, v6IPAddressOrRange_cmp); | ||
| 602 | break; | ||
| 603 | } | ||
| 604 | f->ipAddressChoice->type = IPAddressChoice_addressesOrRanges; | ||
| 605 | f->ipAddressChoice->u.addressesOrRanges = aors; | ||
| 606 | return aors; | ||
| 607 | } | ||
| 608 | |||
| 609 | /* | ||
| 610 | * Add a prefix. | ||
| 611 | */ | ||
| 612 | int v3_addr_add_prefix(IPAddrBlocks *addr, | ||
| 613 | const unsigned afi, | ||
| 614 | const unsigned *safi, | ||
| 615 | unsigned char *a, | ||
| 616 | const int prefixlen) | ||
| 617 | { | ||
| 618 | IPAddressOrRanges *aors = make_prefix_or_range(addr, afi, safi); | ||
| 619 | IPAddressOrRange *aor; | ||
| 620 | if (aors == NULL || !make_addressPrefix(&aor, a, prefixlen)) | ||
| 621 | return 0; | ||
| 622 | if (sk_IPAddressOrRange_push(aors, aor)) | ||
| 623 | return 1; | ||
| 624 | IPAddressOrRange_free(aor); | ||
| 625 | return 0; | ||
| 626 | } | ||
| 627 | |||
| 628 | /* | ||
| 629 | * Add a range. | ||
| 630 | */ | ||
| 631 | int v3_addr_add_range(IPAddrBlocks *addr, | ||
| 632 | const unsigned afi, | ||
| 633 | const unsigned *safi, | ||
| 634 | unsigned char *min, | ||
| 635 | unsigned char *max) | ||
| 636 | { | ||
| 637 | IPAddressOrRanges *aors = make_prefix_or_range(addr, afi, safi); | ||
| 638 | IPAddressOrRange *aor; | ||
| 639 | int length = length_from_afi(afi); | ||
| 640 | if (aors == NULL) | ||
| 641 | return 0; | ||
| 642 | if (!make_addressRange(&aor, min, max, length)) | ||
| 643 | return 0; | ||
| 644 | if (sk_IPAddressOrRange_push(aors, aor)) | ||
| 645 | return 1; | ||
| 646 | IPAddressOrRange_free(aor); | ||
| 647 | return 0; | ||
| 648 | } | ||
| 649 | |||
| 650 | /* | ||
| 651 | * Extract min and max values from an IPAddressOrRange. | ||
| 652 | */ | ||
| 653 | static void extract_min_max(IPAddressOrRange *aor, | ||
| 654 | unsigned char *min, | ||
| 655 | unsigned char *max, | ||
| 656 | int length) | ||
| 657 | { | ||
| 658 | OPENSSL_assert(aor != NULL && min != NULL && max != NULL); | ||
| 659 | switch (aor->type) { | ||
| 660 | case IPAddressOrRange_addressPrefix: | ||
| 661 | addr_expand(min, aor->u.addressPrefix, length, 0x00); | ||
| 662 | addr_expand(max, aor->u.addressPrefix, length, 0xFF); | ||
| 663 | return; | ||
| 664 | case IPAddressOrRange_addressRange: | ||
| 665 | addr_expand(min, aor->u.addressRange->min, length, 0x00); | ||
| 666 | addr_expand(max, aor->u.addressRange->max, length, 0xFF); | ||
| 667 | return; | ||
| 668 | } | ||
| 669 | } | ||
| 670 | |||
| 671 | /* | ||
| 672 | * Public wrapper for extract_min_max(). | ||
| 673 | */ | ||
| 674 | int v3_addr_get_range(IPAddressOrRange *aor, | ||
| 675 | const unsigned afi, | ||
| 676 | unsigned char *min, | ||
| 677 | unsigned char *max, | ||
| 678 | const int length) | ||
| 679 | { | ||
| 680 | int afi_length = length_from_afi(afi); | ||
| 681 | if (aor == NULL || min == NULL || max == NULL || | ||
| 682 | afi_length == 0 || length < afi_length || | ||
| 683 | (aor->type != IPAddressOrRange_addressPrefix && | ||
| 684 | aor->type != IPAddressOrRange_addressRange)) | ||
| 685 | return 0; | ||
| 686 | extract_min_max(aor, min, max, afi_length); | ||
| 687 | return afi_length; | ||
| 688 | } | ||
| 689 | |||
| 690 | /* | ||
| 691 | * Sort comparision function for a sequence of IPAddressFamily. | ||
| 692 | * | ||
| 693 | * The last paragraph of RFC 3779 2.2.3.3 is slightly ambiguous about | ||
| 694 | * the ordering: I can read it as meaning that IPv6 without a SAFI | ||
| 695 | * comes before IPv4 with a SAFI, which seems pretty weird. The | ||
| 696 | * examples in appendix B suggest that the author intended the | ||
| 697 | * null-SAFI rule to apply only within a single AFI, which is what I | ||
| 698 | * would have expected and is what the following code implements. | ||
| 699 | */ | ||
| 700 | static int IPAddressFamily_cmp(const IPAddressFamily * const *a_, | ||
| 701 | const IPAddressFamily * const *b_) | ||
| 702 | { | ||
| 703 | const ASN1_OCTET_STRING *a = (*a_)->addressFamily; | ||
| 704 | const ASN1_OCTET_STRING *b = (*b_)->addressFamily; | ||
| 705 | int len = ((a->length <= b->length) ? a->length : b->length); | ||
| 706 | int cmp = memcmp(a->data, b->data, len); | ||
| 707 | return cmp ? cmp : a->length - b->length; | ||
| 708 | } | ||
| 709 | |||
| 710 | /* | ||
| 711 | * Check whether an IPAddrBLocks is in canonical form. | ||
| 712 | */ | ||
| 713 | int v3_addr_is_canonical(IPAddrBlocks *addr) | ||
| 714 | { | ||
| 715 | unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN]; | ||
| 716 | unsigned char b_min[ADDR_RAW_BUF_LEN], b_max[ADDR_RAW_BUF_LEN]; | ||
| 717 | IPAddressOrRanges *aors; | ||
| 718 | int i, j, k; | ||
| 719 | |||
| 720 | /* | ||
| 721 | * Empty extension is cannonical. | ||
| 722 | */ | ||
| 723 | if (addr == NULL) | ||
| 724 | return 1; | ||
| 725 | |||
| 726 | /* | ||
| 727 | * Check whether the top-level list is in order. | ||
| 728 | */ | ||
| 729 | for (i = 0; i < sk_IPAddressFamily_num(addr) - 1; i++) { | ||
| 730 | const IPAddressFamily *a = sk_IPAddressFamily_value(addr, i); | ||
| 731 | const IPAddressFamily *b = sk_IPAddressFamily_value(addr, i + 1); | ||
| 732 | if (IPAddressFamily_cmp(&a, &b) >= 0) | ||
| 733 | return 0; | ||
| 734 | } | ||
| 735 | |||
| 736 | /* | ||
| 737 | * Top level's ok, now check each address family. | ||
| 738 | */ | ||
| 739 | for (i = 0; i < sk_IPAddressFamily_num(addr); i++) { | ||
| 740 | IPAddressFamily *f = sk_IPAddressFamily_value(addr, i); | ||
| 741 | int length = length_from_afi(v3_addr_get_afi(f)); | ||
| 742 | |||
| 743 | /* | ||
| 744 | * Inheritance is canonical. Anything other than inheritance or | ||
| 745 | * a SEQUENCE OF IPAddressOrRange is an ASN.1 error or something. | ||
| 746 | */ | ||
| 747 | if (f == NULL || f->ipAddressChoice == NULL) | ||
| 748 | return 0; | ||
| 749 | switch (f->ipAddressChoice->type) { | ||
| 750 | case IPAddressChoice_inherit: | ||
| 751 | continue; | ||
| 752 | case IPAddressChoice_addressesOrRanges: | ||
| 753 | break; | ||
| 754 | default: | ||
| 755 | return 0; | ||
| 756 | } | ||
| 757 | |||
| 758 | /* | ||
| 759 | * It's an IPAddressOrRanges sequence, check it. | ||
| 760 | */ | ||
| 761 | aors = f->ipAddressChoice->u.addressesOrRanges; | ||
| 762 | if (sk_IPAddressOrRange_num(aors) == 0) | ||
| 763 | return 0; | ||
| 764 | for (j = 0; j < sk_IPAddressOrRange_num(aors) - 1; j++) { | ||
| 765 | IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, j); | ||
| 766 | IPAddressOrRange *b = sk_IPAddressOrRange_value(aors, j + 1); | ||
| 767 | |||
| 768 | extract_min_max(a, a_min, a_max, length); | ||
| 769 | extract_min_max(b, b_min, b_max, length); | ||
| 770 | |||
| 771 | /* | ||
| 772 | * Punt misordered list, overlapping start, or inverted range. | ||
| 773 | */ | ||
| 774 | if (memcmp(a_min, b_min, length) >= 0 || | ||
| 775 | memcmp(a_min, a_max, length) > 0 || | ||
| 776 | memcmp(b_min, b_max, length) > 0) | ||
| 777 | return 0; | ||
| 778 | |||
| 779 | /* | ||
| 780 | * Punt if adjacent or overlapping. Check for adjacency by | ||
| 781 | * subtracting one from b_min first. | ||
| 782 | */ | ||
| 783 | for (k = length - 1; k >= 0 && b_min[k]-- == 0x00; k--) | ||
| 784 | ; | ||
| 785 | if (memcmp(a_max, b_min, length) >= 0) | ||
| 786 | return 0; | ||
| 787 | |||
| 788 | /* | ||
| 789 | * Check for range that should be expressed as a prefix. | ||
| 790 | */ | ||
| 791 | if (a->type == IPAddressOrRange_addressRange && | ||
| 792 | range_should_be_prefix(a_min, a_max, length) >= 0) | ||
| 793 | return 0; | ||
| 794 | } | ||
| 795 | |||
| 796 | /* | ||
| 797 | * Check final range to see if it should be a prefix. | ||
| 798 | */ | ||
| 799 | j = sk_IPAddressOrRange_num(aors) - 1; | ||
| 800 | { | ||
| 801 | IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, j); | ||
| 802 | if (a->type == IPAddressOrRange_addressRange) { | ||
| 803 | extract_min_max(a, a_min, a_max, length); | ||
| 804 | if (range_should_be_prefix(a_min, a_max, length) >= 0) | ||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | } | ||
| 808 | } | ||
| 809 | |||
| 810 | /* | ||
| 811 | * If we made it through all that, we're happy. | ||
| 812 | */ | ||
| 813 | return 1; | ||
| 814 | } | ||
| 815 | |||
| 816 | /* | ||
| 817 | * Whack an IPAddressOrRanges into canonical form. | ||
| 818 | */ | ||
| 819 | static int IPAddressOrRanges_canonize(IPAddressOrRanges *aors, | ||
| 820 | const unsigned afi) | ||
| 821 | { | ||
| 822 | int i, j, length = length_from_afi(afi); | ||
| 823 | |||
| 824 | /* | ||
| 825 | * Sort the IPAddressOrRanges sequence. | ||
| 826 | */ | ||
| 827 | sk_IPAddressOrRange_sort(aors); | ||
| 828 | |||
| 829 | /* | ||
| 830 | * Clean up representation issues, punt on duplicates or overlaps. | ||
| 831 | */ | ||
| 832 | for (i = 0; i < sk_IPAddressOrRange_num(aors) - 1; i++) { | ||
| 833 | IPAddressOrRange *a = sk_IPAddressOrRange_value(aors, i); | ||
| 834 | IPAddressOrRange *b = sk_IPAddressOrRange_value(aors, i + 1); | ||
| 835 | unsigned char a_min[ADDR_RAW_BUF_LEN], a_max[ADDR_RAW_BUF_LEN]; | ||
| 836 | unsigned char b_min[ADDR_RAW_BUF_LEN], b_max[ADDR_RAW_BUF_LEN]; | ||
| 837 | |||
| 838 | extract_min_max(a, a_min, a_max, length); | ||
| 839 | extract_min_max(b, b_min, b_max, length); | ||
| 840 | |||
| 841 | /* | ||
| 842 | * Punt overlaps. | ||
| 843 | */ | ||
| 844 | if (memcmp(a_max, b_min, length) >= 0) | ||
| 845 | return 0; | ||
| 846 | |||
| 847 | /* | ||
| 848 | * Merge if a and b are adjacent. We check for | ||
| 849 | * adjacency by subtracting one from b_min first. | ||
| 850 | */ | ||
| 851 | for (j = length - 1; j >= 0 && b_min[j]-- == 0x00; j--) | ||
| 852 | ; | ||
| 853 | if (memcmp(a_max, b_min, length) == 0) { | ||
| 854 | IPAddressOrRange *merged; | ||
| 855 | if (!make_addressRange(&merged, a_min, b_max, length)) | ||
| 856 | return 0; | ||
| 857 | sk_IPAddressOrRange_set(aors, i, merged); | ||
| 858 | sk_IPAddressOrRange_delete(aors, i + 1); | ||
| 859 | IPAddressOrRange_free(a); | ||
| 860 | IPAddressOrRange_free(b); | ||
| 861 | --i; | ||
| 862 | continue; | ||
| 863 | } | ||
| 864 | } | ||
| 865 | |||
| 866 | return 1; | ||
| 867 | } | ||
| 868 | |||
| 869 | /* | ||
| 870 | * Whack an IPAddrBlocks extension into canonical form. | ||
| 871 | */ | ||
| 872 | int v3_addr_canonize(IPAddrBlocks *addr) | ||
| 873 | { | ||
| 874 | int i; | ||
| 875 | for (i = 0; i < sk_IPAddressFamily_num(addr); i++) { | ||
| 876 | IPAddressFamily *f = sk_IPAddressFamily_value(addr, i); | ||
| 877 | if (f->ipAddressChoice->type == IPAddressChoice_addressesOrRanges && | ||
| 878 | !IPAddressOrRanges_canonize(f->ipAddressChoice->u.addressesOrRanges, | ||
| 879 | v3_addr_get_afi(f))) | ||
| 880 | return 0; | ||
| 881 | } | ||
| 882 | sk_IPAddressFamily_set_cmp_func(addr, IPAddressFamily_cmp); | ||
| 883 | sk_IPAddressFamily_sort(addr); | ||
| 884 | OPENSSL_assert(v3_addr_is_canonical(addr)); | ||
| 885 | return 1; | ||
| 886 | } | ||
| 887 | |||
| 888 | /* | ||
| 889 | * v2i handler for the IPAddrBlocks extension. | ||
| 890 | */ | ||
| 891 | static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | ||
| 892 | struct v3_ext_ctx *ctx, | ||
| 893 | STACK_OF(CONF_VALUE) *values) | ||
| 894 | { | ||
| 895 | static const char v4addr_chars[] = "0123456789."; | ||
| 896 | static const char v6addr_chars[] = "0123456789.:abcdefABCDEF"; | ||
| 897 | IPAddrBlocks *addr = NULL; | ||
| 898 | char *s = NULL, *t; | ||
| 899 | int i; | ||
| 900 | |||
| 901 | if ((addr = sk_IPAddressFamily_new(IPAddressFamily_cmp)) == NULL) { | ||
| 902 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); | ||
| 903 | return NULL; | ||
| 904 | } | ||
| 905 | |||
| 906 | for (i = 0; i < sk_CONF_VALUE_num(values); i++) { | ||
| 907 | CONF_VALUE *val = sk_CONF_VALUE_value(values, i); | ||
| 908 | unsigned char min[ADDR_RAW_BUF_LEN], max[ADDR_RAW_BUF_LEN]; | ||
| 909 | unsigned afi, *safi = NULL, safi_; | ||
| 910 | const char *addr_chars; | ||
| 911 | int prefixlen, i1, i2, delim, length; | ||
| 912 | |||
| 913 | if ( !name_cmp(val->name, "IPv4")) { | ||
| 914 | afi = IANA_AFI_IPV4; | ||
| 915 | } else if (!name_cmp(val->name, "IPv6")) { | ||
| 916 | afi = IANA_AFI_IPV6; | ||
| 917 | } else if (!name_cmp(val->name, "IPv4-SAFI")) { | ||
| 918 | afi = IANA_AFI_IPV4; | ||
| 919 | safi = &safi_; | ||
| 920 | } else if (!name_cmp(val->name, "IPv6-SAFI")) { | ||
| 921 | afi = IANA_AFI_IPV6; | ||
| 922 | safi = &safi_; | ||
| 923 | } else { | ||
| 924 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_NAME_ERROR); | ||
| 925 | X509V3_conf_err(val); | ||
| 926 | goto err; | ||
| 927 | } | ||
| 928 | |||
| 929 | switch (afi) { | ||
| 930 | case IANA_AFI_IPV4: | ||
| 931 | addr_chars = v4addr_chars; | ||
| 932 | break; | ||
| 933 | case IANA_AFI_IPV6: | ||
| 934 | addr_chars = v6addr_chars; | ||
| 935 | break; | ||
| 936 | } | ||
| 937 | |||
| 938 | length = length_from_afi(afi); | ||
| 939 | |||
| 940 | /* | ||
| 941 | * Handle SAFI, if any, and BUF_strdup() so we can null-terminate | ||
| 942 | * the other input values. | ||
| 943 | */ | ||
| 944 | if (safi != NULL) { | ||
| 945 | *safi = strtoul(val->value, &t, 0); | ||
| 946 | t += strspn(t, " \t"); | ||
| 947 | if (*safi > 0xFF || *t++ != ':') { | ||
| 948 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_SAFI); | ||
| 949 | X509V3_conf_err(val); | ||
| 950 | goto err; | ||
| 951 | } | ||
| 952 | t += strspn(t, " \t"); | ||
| 953 | s = BUF_strdup(t); | ||
| 954 | } else { | ||
| 955 | s = BUF_strdup(val->value); | ||
| 956 | } | ||
| 957 | if (s == NULL) { | ||
| 958 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); | ||
| 959 | goto err; | ||
| 960 | } | ||
| 961 | |||
| 962 | /* | ||
| 963 | * Check for inheritance. Not worth additional complexity to | ||
| 964 | * optimize this (seldom-used) case. | ||
| 965 | */ | ||
| 966 | if (!strcmp(s, "inherit")) { | ||
| 967 | if (!v3_addr_add_inherit(addr, afi, safi)) { | ||
| 968 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_INHERITANCE); | ||
| 969 | X509V3_conf_err(val); | ||
| 970 | goto err; | ||
| 971 | } | ||
| 972 | OPENSSL_free(s); | ||
| 973 | s = NULL; | ||
| 974 | continue; | ||
| 975 | } | ||
| 976 | |||
| 977 | i1 = strspn(s, addr_chars); | ||
| 978 | i2 = i1 + strspn(s + i1, " \t"); | ||
| 979 | delim = s[i2++]; | ||
| 980 | s[i1] = '\0'; | ||
| 981 | |||
| 982 | if (a2i_ipadd(min, s) != length) { | ||
| 983 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_IPADDRESS); | ||
| 984 | X509V3_conf_err(val); | ||
| 985 | goto err; | ||
| 986 | } | ||
| 987 | |||
| 988 | switch (delim) { | ||
| 989 | case '/': | ||
| 990 | prefixlen = (int) strtoul(s + i2, &t, 10); | ||
| 991 | if (t == s + i2 || *t != '\0') { | ||
| 992 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); | ||
| 993 | X509V3_conf_err(val); | ||
| 994 | goto err; | ||
| 995 | } | ||
| 996 | if (!v3_addr_add_prefix(addr, afi, safi, min, prefixlen)) { | ||
| 997 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); | ||
| 998 | goto err; | ||
| 999 | } | ||
| 1000 | break; | ||
| 1001 | case '-': | ||
| 1002 | i1 = i2 + strspn(s + i2, " \t"); | ||
| 1003 | i2 = i1 + strspn(s + i1, addr_chars); | ||
| 1004 | if (i1 == i2 || s[i2] != '\0') { | ||
| 1005 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); | ||
| 1006 | X509V3_conf_err(val); | ||
| 1007 | goto err; | ||
| 1008 | } | ||
| 1009 | if (a2i_ipadd(max, s + i1) != length) { | ||
| 1010 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_IPADDRESS); | ||
| 1011 | X509V3_conf_err(val); | ||
| 1012 | goto err; | ||
| 1013 | } | ||
| 1014 | if (!v3_addr_add_range(addr, afi, safi, min, max)) { | ||
| 1015 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); | ||
| 1016 | goto err; | ||
| 1017 | } | ||
| 1018 | break; | ||
| 1019 | case '\0': | ||
| 1020 | if (!v3_addr_add_prefix(addr, afi, safi, min, length * 8)) { | ||
| 1021 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); | ||
| 1022 | goto err; | ||
| 1023 | } | ||
| 1024 | break; | ||
| 1025 | default: | ||
| 1026 | X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); | ||
| 1027 | X509V3_conf_err(val); | ||
| 1028 | goto err; | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | OPENSSL_free(s); | ||
| 1032 | s = NULL; | ||
| 1033 | } | ||
| 1034 | |||
| 1035 | /* | ||
| 1036 | * Canonize the result, then we're done. | ||
| 1037 | */ | ||
| 1038 | if (!v3_addr_canonize(addr)) | ||
| 1039 | goto err; | ||
| 1040 | return addr; | ||
| 1041 | |||
| 1042 | err: | ||
| 1043 | OPENSSL_free(s); | ||
| 1044 | sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); | ||
| 1045 | return NULL; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | /* | ||
| 1049 | * OpenSSL dispatch | ||
| 1050 | */ | ||
| 1051 | const X509V3_EXT_METHOD v3_addr = { | ||
| 1052 | NID_sbgp_ipAddrBlock, /* nid */ | ||
| 1053 | 0, /* flags */ | ||
| 1054 | ASN1_ITEM_ref(IPAddrBlocks), /* template */ | ||
| 1055 | 0, 0, 0, 0, /* old functions, ignored */ | ||
| 1056 | 0, /* i2s */ | ||
| 1057 | 0, /* s2i */ | ||
| 1058 | 0, /* i2v */ | ||
| 1059 | v2i_IPAddrBlocks, /* v2i */ | ||
| 1060 | i2r_IPAddrBlocks, /* i2r */ | ||
| 1061 | 0, /* r2i */ | ||
| 1062 | NULL /* extension-specific data */ | ||
| 1063 | }; | ||
| 1064 | |||
| 1065 | /* | ||
| 1066 | * Figure out whether extension sues inheritance. | ||
| 1067 | */ | ||
| 1068 | int v3_addr_inherits(IPAddrBlocks *addr) | ||
| 1069 | { | ||
| 1070 | int i; | ||
| 1071 | if (addr == NULL) | ||
| 1072 | return 0; | ||
| 1073 | for (i = 0; i < sk_IPAddressFamily_num(addr); i++) { | ||
| 1074 | IPAddressFamily *f = sk_IPAddressFamily_value(addr, i); | ||
| 1075 | if (f->ipAddressChoice->type == IPAddressChoice_inherit) | ||
| 1076 | return 1; | ||
| 1077 | } | ||
| 1078 | return 0; | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | /* | ||
| 1082 | * Figure out whether parent contains child. | ||
| 1083 | */ | ||
| 1084 | static int addr_contains(IPAddressOrRanges *parent, | ||
| 1085 | IPAddressOrRanges *child, | ||
| 1086 | int length) | ||
| 1087 | { | ||
| 1088 | unsigned char p_min[ADDR_RAW_BUF_LEN], p_max[ADDR_RAW_BUF_LEN]; | ||
| 1089 | unsigned char c_min[ADDR_RAW_BUF_LEN], c_max[ADDR_RAW_BUF_LEN]; | ||
| 1090 | int p, c; | ||
| 1091 | |||
| 1092 | if (child == NULL || parent == child) | ||
| 1093 | return 1; | ||
| 1094 | if (parent == NULL) | ||
| 1095 | return 0; | ||
| 1096 | |||
| 1097 | p = 0; | ||
| 1098 | for (c = 0; c < sk_IPAddressOrRange_num(child); c++) { | ||
| 1099 | extract_min_max(sk_IPAddressOrRange_value(child, c), | ||
| 1100 | c_min, c_max, length); | ||
| 1101 | for (;; p++) { | ||
| 1102 | if (p >= sk_IPAddressOrRange_num(parent)) | ||
| 1103 | return 0; | ||
| 1104 | extract_min_max(sk_IPAddressOrRange_value(parent, p), | ||
| 1105 | p_min, p_max, length); | ||
| 1106 | if (memcmp(p_max, c_max, length) < 0) | ||
| 1107 | continue; | ||
| 1108 | if (memcmp(p_min, c_min, length) > 0) | ||
| 1109 | return 0; | ||
| 1110 | break; | ||
| 1111 | } | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | return 1; | ||
| 1115 | } | ||
| 1116 | |||
| 1117 | /* | ||
| 1118 | * Test whether a is a subset of b. | ||
| 1119 | */ | ||
| 1120 | int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b) | ||
| 1121 | { | ||
| 1122 | int i; | ||
| 1123 | if (a == NULL || a == b) | ||
| 1124 | return 1; | ||
| 1125 | if (b == NULL || v3_addr_inherits(a) || v3_addr_inherits(b)) | ||
| 1126 | return 0; | ||
| 1127 | sk_IPAddressFamily_set_cmp_func(b, IPAddressFamily_cmp); | ||
| 1128 | for (i = 0; i < sk_IPAddressFamily_num(a); i++) { | ||
| 1129 | IPAddressFamily *fa = sk_IPAddressFamily_value(a, i); | ||
| 1130 | int j = sk_IPAddressFamily_find(b, fa); | ||
| 1131 | IPAddressFamily *fb; | ||
| 1132 | fb = sk_IPAddressFamily_value(b, j); | ||
| 1133 | if (fb == NULL) | ||
| 1134 | return 0; | ||
| 1135 | if (!addr_contains(fb->ipAddressChoice->u.addressesOrRanges, | ||
| 1136 | fa->ipAddressChoice->u.addressesOrRanges, | ||
| 1137 | length_from_afi(v3_addr_get_afi(fb)))) | ||
| 1138 | return 0; | ||
| 1139 | } | ||
| 1140 | return 1; | ||
| 1141 | } | ||
| 1142 | |||
| 1143 | /* | ||
| 1144 | * Validation error handling via callback. | ||
| 1145 | */ | ||
| 1146 | #define validation_err(_err_) \ | ||
| 1147 | do { \ | ||
| 1148 | if (ctx != NULL) { \ | ||
| 1149 | ctx->error = _err_; \ | ||
| 1150 | ctx->error_depth = i; \ | ||
| 1151 | ctx->current_cert = x; \ | ||
| 1152 | ret = ctx->verify_cb(0, ctx); \ | ||
| 1153 | } else { \ | ||
| 1154 | ret = 0; \ | ||
| 1155 | } \ | ||
| 1156 | if (!ret) \ | ||
| 1157 | goto done; \ | ||
| 1158 | } while (0) | ||
| 1159 | |||
| 1160 | /* | ||
| 1161 | * Core code for RFC 3779 2.3 path validation. | ||
| 1162 | */ | ||
| 1163 | static int v3_addr_validate_path_internal(X509_STORE_CTX *ctx, | ||
| 1164 | STACK_OF(X509) *chain, | ||
| 1165 | IPAddrBlocks *ext) | ||
| 1166 | { | ||
| 1167 | IPAddrBlocks *child = NULL; | ||
| 1168 | int i, j, ret = 1; | ||
| 1169 | X509 *x; | ||
| 1170 | |||
| 1171 | OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0); | ||
| 1172 | OPENSSL_assert(ctx != NULL || ext != NULL); | ||
| 1173 | OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL); | ||
| 1174 | |||
| 1175 | /* | ||
| 1176 | * Figure out where to start. If we don't have an extension to | ||
| 1177 | * check, we're done. Otherwise, check canonical form and | ||
| 1178 | * set up for walking up the chain. | ||
| 1179 | */ | ||
| 1180 | if (ext != NULL) { | ||
| 1181 | i = -1; | ||
| 1182 | x = NULL; | ||
| 1183 | } else { | ||
| 1184 | i = 0; | ||
| 1185 | x = sk_X509_value(chain, i); | ||
| 1186 | OPENSSL_assert(x != NULL); | ||
| 1187 | if ((ext = x->rfc3779_addr) == NULL) | ||
| 1188 | goto done; | ||
| 1189 | } | ||
| 1190 | if (!v3_addr_is_canonical(ext)) | ||
| 1191 | validation_err(X509_V_ERR_INVALID_EXTENSION); | ||
| 1192 | sk_IPAddressFamily_set_cmp_func(ext, IPAddressFamily_cmp); | ||
| 1193 | if ((child = sk_IPAddressFamily_dup(ext)) == NULL) { | ||
| 1194 | X509V3err(X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL, ERR_R_MALLOC_FAILURE); | ||
| 1195 | ret = 0; | ||
| 1196 | goto done; | ||
| 1197 | } | ||
| 1198 | |||
| 1199 | /* | ||
| 1200 | * Now walk up the chain. No cert may list resources that its | ||
| 1201 | * parent doesn't list. | ||
| 1202 | */ | ||
| 1203 | for (i++; i < sk_X509_num(chain); i++) { | ||
| 1204 | x = sk_X509_value(chain, i); | ||
| 1205 | OPENSSL_assert(x != NULL); | ||
| 1206 | if (!v3_addr_is_canonical(x->rfc3779_addr)) | ||
| 1207 | validation_err(X509_V_ERR_INVALID_EXTENSION); | ||
| 1208 | if (x->rfc3779_addr == NULL) { | ||
| 1209 | for (j = 0; j < sk_IPAddressFamily_num(child); j++) { | ||
| 1210 | IPAddressFamily *fc = sk_IPAddressFamily_value(child, j); | ||
| 1211 | if (fc->ipAddressChoice->type != IPAddressChoice_inherit) { | ||
| 1212 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 1213 | break; | ||
| 1214 | } | ||
| 1215 | } | ||
| 1216 | continue; | ||
| 1217 | } | ||
| 1218 | sk_IPAddressFamily_set_cmp_func(x->rfc3779_addr, IPAddressFamily_cmp); | ||
| 1219 | for (j = 0; j < sk_IPAddressFamily_num(child); j++) { | ||
| 1220 | IPAddressFamily *fc = sk_IPAddressFamily_value(child, j); | ||
| 1221 | int k = sk_IPAddressFamily_find(x->rfc3779_addr, fc); | ||
| 1222 | IPAddressFamily *fp = sk_IPAddressFamily_value(x->rfc3779_addr, k); | ||
| 1223 | if (fp == NULL) { | ||
| 1224 | if (fc->ipAddressChoice->type == IPAddressChoice_addressesOrRanges) { | ||
| 1225 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 1226 | break; | ||
| 1227 | } | ||
| 1228 | continue; | ||
| 1229 | } | ||
| 1230 | if (fp->ipAddressChoice->type == IPAddressChoice_addressesOrRanges) { | ||
| 1231 | if (fc->ipAddressChoice->type == IPAddressChoice_inherit || | ||
| 1232 | addr_contains(fp->ipAddressChoice->u.addressesOrRanges, | ||
| 1233 | fc->ipAddressChoice->u.addressesOrRanges, | ||
| 1234 | length_from_afi(v3_addr_get_afi(fc)))) | ||
| 1235 | sk_IPAddressFamily_set(child, j, fp); | ||
| 1236 | else | ||
| 1237 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 1238 | } | ||
| 1239 | } | ||
| 1240 | } | ||
| 1241 | |||
| 1242 | /* | ||
| 1243 | * Trust anchor can't inherit. | ||
| 1244 | */ | ||
| 1245 | OPENSSL_assert(x != NULL); | ||
| 1246 | if (x->rfc3779_addr != NULL) { | ||
| 1247 | for (j = 0; j < sk_IPAddressFamily_num(x->rfc3779_addr); j++) { | ||
| 1248 | IPAddressFamily *fp = sk_IPAddressFamily_value(x->rfc3779_addr, j); | ||
| 1249 | if (fp->ipAddressChoice->type == IPAddressChoice_inherit && | ||
| 1250 | sk_IPAddressFamily_find(child, fp) >= 0) | ||
| 1251 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 1252 | } | ||
| 1253 | } | ||
| 1254 | |||
| 1255 | done: | ||
| 1256 | sk_IPAddressFamily_free(child); | ||
| 1257 | return ret; | ||
| 1258 | } | ||
| 1259 | |||
| 1260 | #undef validation_err | ||
| 1261 | |||
| 1262 | /* | ||
| 1263 | * RFC 3779 2.3 path validation -- called from X509_verify_cert(). | ||
| 1264 | */ | ||
| 1265 | int v3_addr_validate_path(X509_STORE_CTX *ctx) | ||
| 1266 | { | ||
| 1267 | return v3_addr_validate_path_internal(ctx, ctx->chain, NULL); | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | /* | ||
| 1271 | * RFC 3779 2.3 path validation of an extension. | ||
| 1272 | * Test whether chain covers extension. | ||
| 1273 | */ | ||
| 1274 | int v3_addr_validate_resource_set(STACK_OF(X509) *chain, | ||
| 1275 | IPAddrBlocks *ext, | ||
| 1276 | int allow_inheritance) | ||
| 1277 | { | ||
| 1278 | if (ext == NULL) | ||
| 1279 | return 1; | ||
| 1280 | if (chain == NULL || sk_X509_num(chain) == 0) | ||
| 1281 | return 0; | ||
| 1282 | if (!allow_inheritance && v3_addr_inherits(ext)) | ||
| 1283 | return 0; | ||
| 1284 | return v3_addr_validate_path_internal(NULL, chain, ext); | ||
| 1285 | } | ||
| 1286 | |||
| 1287 | #endif /* OPENSSL_NO_RFC3779 */ | ||
diff --git a/src/lib/libcrypto/x509v3/v3_alt.c b/src/lib/libcrypto/x509v3/v3_alt.c index d29d94338e..91aefcddc1 100644 --- a/src/lib/libcrypto/x509v3/v3_alt.c +++ b/src/lib/libcrypto/x509v3/v3_alt.c | |||
| @@ -153,9 +153,9 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, | |||
| 153 | BIO_snprintf(htmp, sizeof htmp, | 153 | BIO_snprintf(htmp, sizeof htmp, |
| 154 | "%X", p[0] << 8 | p[1]); | 154 | "%X", p[0] << 8 | p[1]); |
| 155 | p += 2; | 155 | p += 2; |
| 156 | strcat(oline, htmp); | 156 | strlcat(oline, htmp, sizeof(oline)); |
| 157 | if (i != 7) | 157 | if (i != 7) |
| 158 | strcat(oline, ":"); | 158 | strlcat(oline, ":", sizeof(oline)); |
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | else | 161 | else |
diff --git a/src/lib/libcrypto/x509v3/v3_asid.c b/src/lib/libcrypto/x509v3/v3_asid.c new file mode 100644 index 0000000000..56702f86b9 --- /dev/null +++ b/src/lib/libcrypto/x509v3/v3_asid.c | |||
| @@ -0,0 +1,844 @@ | |||
| 1 | /* | ||
| 2 | * Contributed to the OpenSSL Project by the American Registry for | ||
| 3 | * Internet Numbers ("ARIN"). | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | */ | ||
| 57 | |||
| 58 | /* | ||
| 59 | * Implementation of RFC 3779 section 3.2. | ||
| 60 | */ | ||
| 61 | |||
| 62 | #include <stdio.h> | ||
| 63 | #include <string.h> | ||
| 64 | #include <assert.h> | ||
| 65 | #include "cryptlib.h" | ||
| 66 | #include <openssl/conf.h> | ||
| 67 | #include <openssl/asn1.h> | ||
| 68 | #include <openssl/asn1t.h> | ||
| 69 | #include <openssl/x509v3.h> | ||
| 70 | #include <openssl/x509.h> | ||
| 71 | #include <openssl/bn.h> | ||
| 72 | |||
| 73 | #ifndef OPENSSL_NO_RFC3779 | ||
| 74 | |||
| 75 | /* | ||
| 76 | * OpenSSL ASN.1 template translation of RFC 3779 3.2.3. | ||
| 77 | */ | ||
| 78 | |||
| 79 | ASN1_SEQUENCE(ASRange) = { | ||
| 80 | ASN1_SIMPLE(ASRange, min, ASN1_INTEGER), | ||
| 81 | ASN1_SIMPLE(ASRange, max, ASN1_INTEGER) | ||
| 82 | } ASN1_SEQUENCE_END(ASRange) | ||
| 83 | |||
| 84 | ASN1_CHOICE(ASIdOrRange) = { | ||
| 85 | ASN1_SIMPLE(ASIdOrRange, u.id, ASN1_INTEGER), | ||
| 86 | ASN1_SIMPLE(ASIdOrRange, u.range, ASRange) | ||
| 87 | } ASN1_CHOICE_END(ASIdOrRange) | ||
| 88 | |||
| 89 | ASN1_CHOICE(ASIdentifierChoice) = { | ||
| 90 | ASN1_SIMPLE(ASIdentifierChoice, u.inherit, ASN1_NULL), | ||
| 91 | ASN1_SEQUENCE_OF(ASIdentifierChoice, u.asIdsOrRanges, ASIdOrRange) | ||
| 92 | } ASN1_CHOICE_END(ASIdentifierChoice) | ||
| 93 | |||
| 94 | ASN1_SEQUENCE(ASIdentifiers) = { | ||
| 95 | ASN1_EXP_OPT(ASIdentifiers, asnum, ASIdentifierChoice, 0), | ||
| 96 | ASN1_EXP_OPT(ASIdentifiers, rdi, ASIdentifierChoice, 1) | ||
| 97 | } ASN1_SEQUENCE_END(ASIdentifiers) | ||
| 98 | |||
| 99 | IMPLEMENT_ASN1_FUNCTIONS(ASRange) | ||
| 100 | IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange) | ||
| 101 | IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice) | ||
| 102 | IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers) | ||
| 103 | |||
| 104 | /* | ||
| 105 | * i2r method for an ASIdentifierChoice. | ||
| 106 | */ | ||
| 107 | static int i2r_ASIdentifierChoice(BIO *out, | ||
| 108 | ASIdentifierChoice *choice, | ||
| 109 | int indent, | ||
| 110 | const char *msg) | ||
| 111 | { | ||
| 112 | int i; | ||
| 113 | char *s; | ||
| 114 | if (choice == NULL) | ||
| 115 | return 1; | ||
| 116 | BIO_printf(out, "%*s%s:\n", indent, "", msg); | ||
| 117 | switch (choice->type) { | ||
| 118 | case ASIdentifierChoice_inherit: | ||
| 119 | BIO_printf(out, "%*sinherit\n", indent + 2, ""); | ||
| 120 | break; | ||
| 121 | case ASIdentifierChoice_asIdsOrRanges: | ||
| 122 | for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges); i++) { | ||
| 123 | ASIdOrRange *aor = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i); | ||
| 124 | switch (aor->type) { | ||
| 125 | case ASIdOrRange_id: | ||
| 126 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL) | ||
| 127 | return 0; | ||
| 128 | BIO_printf(out, "%*s%s\n", indent + 2, "", s); | ||
| 129 | OPENSSL_free(s); | ||
| 130 | break; | ||
| 131 | case ASIdOrRange_range: | ||
| 132 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL) | ||
| 133 | return 0; | ||
| 134 | BIO_printf(out, "%*s%s-", indent + 2, "", s); | ||
| 135 | OPENSSL_free(s); | ||
| 136 | if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL) | ||
| 137 | return 0; | ||
| 138 | BIO_printf(out, "%s\n", s); | ||
| 139 | OPENSSL_free(s); | ||
| 140 | break; | ||
| 141 | default: | ||
| 142 | return 0; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | break; | ||
| 146 | default: | ||
| 147 | return 0; | ||
| 148 | } | ||
| 149 | return 1; | ||
| 150 | } | ||
| 151 | |||
| 152 | /* | ||
| 153 | * i2r method for an ASIdentifier extension. | ||
| 154 | */ | ||
| 155 | static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method, | ||
| 156 | void *ext, | ||
| 157 | BIO *out, | ||
| 158 | int indent) | ||
| 159 | { | ||
| 160 | ASIdentifiers *asid = ext; | ||
| 161 | return (i2r_ASIdentifierChoice(out, asid->asnum, indent, | ||
| 162 | "Autonomous System Numbers") && | ||
| 163 | i2r_ASIdentifierChoice(out, asid->rdi, indent, | ||
| 164 | "Routing Domain Identifiers")); | ||
| 165 | } | ||
| 166 | |||
| 167 | /* | ||
| 168 | * Sort comparision function for a sequence of ASIdOrRange elements. | ||
| 169 | */ | ||
| 170 | static int ASIdOrRange_cmp(const ASIdOrRange * const *a_, | ||
| 171 | const ASIdOrRange * const *b_) | ||
| 172 | { | ||
| 173 | const ASIdOrRange *a = *a_, *b = *b_; | ||
| 174 | |||
| 175 | assert((a->type == ASIdOrRange_id && a->u.id != NULL) || | ||
| 176 | (a->type == ASIdOrRange_range && a->u.range != NULL && | ||
| 177 | a->u.range->min != NULL && a->u.range->max != NULL)); | ||
| 178 | |||
| 179 | assert((b->type == ASIdOrRange_id && b->u.id != NULL) || | ||
| 180 | (b->type == ASIdOrRange_range && b->u.range != NULL && | ||
| 181 | b->u.range->min != NULL && b->u.range->max != NULL)); | ||
| 182 | |||
| 183 | if (a->type == ASIdOrRange_id && b->type == ASIdOrRange_id) | ||
| 184 | return ASN1_INTEGER_cmp(a->u.id, b->u.id); | ||
| 185 | |||
| 186 | if (a->type == ASIdOrRange_range && b->type == ASIdOrRange_range) { | ||
| 187 | int r = ASN1_INTEGER_cmp(a->u.range->min, b->u.range->min); | ||
| 188 | return r != 0 ? r : ASN1_INTEGER_cmp(a->u.range->max, b->u.range->max); | ||
| 189 | } | ||
| 190 | |||
| 191 | if (a->type == ASIdOrRange_id) | ||
| 192 | return ASN1_INTEGER_cmp(a->u.id, b->u.range->min); | ||
| 193 | else | ||
| 194 | return ASN1_INTEGER_cmp(a->u.range->min, b->u.id); | ||
| 195 | } | ||
| 196 | |||
| 197 | /* | ||
| 198 | * Add an inherit element. | ||
| 199 | */ | ||
| 200 | int v3_asid_add_inherit(ASIdentifiers *asid, int which) | ||
| 201 | { | ||
| 202 | ASIdentifierChoice **choice; | ||
| 203 | if (asid == NULL) | ||
| 204 | return 0; | ||
| 205 | switch (which) { | ||
| 206 | case V3_ASID_ASNUM: | ||
| 207 | choice = &asid->asnum; | ||
| 208 | break; | ||
| 209 | case V3_ASID_RDI: | ||
| 210 | choice = &asid->rdi; | ||
| 211 | break; | ||
| 212 | default: | ||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | if (*choice == NULL) { | ||
| 216 | if ((*choice = ASIdentifierChoice_new()) == NULL) | ||
| 217 | return 0; | ||
| 218 | assert((*choice)->u.inherit == NULL); | ||
| 219 | if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL) | ||
| 220 | return 0; | ||
| 221 | (*choice)->type = ASIdentifierChoice_inherit; | ||
| 222 | } | ||
| 223 | return (*choice)->type == ASIdentifierChoice_inherit; | ||
| 224 | } | ||
| 225 | |||
| 226 | /* | ||
| 227 | * Add an ID or range to an ASIdentifierChoice. | ||
| 228 | */ | ||
| 229 | int v3_asid_add_id_or_range(ASIdentifiers *asid, | ||
| 230 | int which, | ||
| 231 | ASN1_INTEGER *min, | ||
| 232 | ASN1_INTEGER *max) | ||
| 233 | { | ||
| 234 | ASIdentifierChoice **choice; | ||
| 235 | ASIdOrRange *aor; | ||
| 236 | if (asid == NULL) | ||
| 237 | return 0; | ||
| 238 | switch (which) { | ||
| 239 | case V3_ASID_ASNUM: | ||
| 240 | choice = &asid->asnum; | ||
| 241 | break; | ||
| 242 | case V3_ASID_RDI: | ||
| 243 | choice = &asid->rdi; | ||
| 244 | break; | ||
| 245 | default: | ||
| 246 | return 0; | ||
| 247 | } | ||
| 248 | if (*choice != NULL && (*choice)->type == ASIdentifierChoice_inherit) | ||
| 249 | return 0; | ||
| 250 | if (*choice == NULL) { | ||
| 251 | if ((*choice = ASIdentifierChoice_new()) == NULL) | ||
| 252 | return 0; | ||
| 253 | assert((*choice)->u.asIdsOrRanges == NULL); | ||
| 254 | (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp); | ||
| 255 | if ((*choice)->u.asIdsOrRanges == NULL) | ||
| 256 | return 0; | ||
| 257 | (*choice)->type = ASIdentifierChoice_asIdsOrRanges; | ||
| 258 | } | ||
| 259 | if ((aor = ASIdOrRange_new()) == NULL) | ||
| 260 | return 0; | ||
| 261 | if (max == NULL) { | ||
| 262 | aor->type = ASIdOrRange_id; | ||
| 263 | aor->u.id = min; | ||
| 264 | } else { | ||
| 265 | aor->type = ASIdOrRange_range; | ||
| 266 | if ((aor->u.range = ASRange_new()) == NULL) | ||
| 267 | goto err; | ||
| 268 | ASN1_INTEGER_free(aor->u.range->min); | ||
| 269 | aor->u.range->min = min; | ||
| 270 | ASN1_INTEGER_free(aor->u.range->max); | ||
| 271 | aor->u.range->max = max; | ||
| 272 | } | ||
| 273 | if (!(sk_ASIdOrRange_push((*choice)->u.asIdsOrRanges, aor))) | ||
| 274 | goto err; | ||
| 275 | return 1; | ||
| 276 | |||
| 277 | err: | ||
| 278 | ASIdOrRange_free(aor); | ||
| 279 | return 0; | ||
| 280 | } | ||
| 281 | |||
| 282 | /* | ||
| 283 | * Extract min and max values from an ASIdOrRange. | ||
| 284 | */ | ||
| 285 | static void extract_min_max(ASIdOrRange *aor, | ||
| 286 | ASN1_INTEGER **min, | ||
| 287 | ASN1_INTEGER **max) | ||
| 288 | { | ||
| 289 | assert(aor != NULL && min != NULL && max != NULL); | ||
| 290 | switch (aor->type) { | ||
| 291 | case ASIdOrRange_id: | ||
| 292 | *min = aor->u.id; | ||
| 293 | *max = aor->u.id; | ||
| 294 | return; | ||
| 295 | case ASIdOrRange_range: | ||
| 296 | *min = aor->u.range->min; | ||
| 297 | *max = aor->u.range->max; | ||
| 298 | return; | ||
| 299 | } | ||
| 300 | } | ||
| 301 | |||
| 302 | /* | ||
| 303 | * Check whether an ASIdentifierChoice is in canonical form. | ||
| 304 | */ | ||
| 305 | static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice) | ||
| 306 | { | ||
| 307 | ASN1_INTEGER *a_max_plus_one = NULL; | ||
| 308 | BIGNUM *bn = NULL; | ||
| 309 | int i, ret = 0; | ||
| 310 | |||
| 311 | /* | ||
| 312 | * Empty element or inheritance is canonical. | ||
| 313 | */ | ||
| 314 | if (choice == NULL || choice->type == ASIdentifierChoice_inherit) | ||
| 315 | return 1; | ||
| 316 | |||
| 317 | /* | ||
| 318 | * If not a list, or if empty list, it's broken. | ||
| 319 | */ | ||
| 320 | if (choice->type != ASIdentifierChoice_asIdsOrRanges || | ||
| 321 | sk_ASIdOrRange_num(choice->u.asIdsOrRanges) == 0) | ||
| 322 | return 0; | ||
| 323 | |||
| 324 | /* | ||
| 325 | * It's a list, check it. | ||
| 326 | */ | ||
| 327 | for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) { | ||
| 328 | ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i); | ||
| 329 | ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1); | ||
| 330 | ASN1_INTEGER *a_min, *a_max, *b_min, *b_max; | ||
| 331 | |||
| 332 | extract_min_max(a, &a_min, &a_max); | ||
| 333 | extract_min_max(b, &b_min, &b_max); | ||
| 334 | |||
| 335 | /* | ||
| 336 | * Punt misordered list, overlapping start, or inverted range. | ||
| 337 | */ | ||
| 338 | if (ASN1_INTEGER_cmp(a_min, b_min) >= 0 || | ||
| 339 | ASN1_INTEGER_cmp(a_min, a_max) > 0 || | ||
| 340 | ASN1_INTEGER_cmp(b_min, b_max) > 0) | ||
| 341 | goto done; | ||
| 342 | |||
| 343 | /* | ||
| 344 | * Calculate a_max + 1 to check for adjacency. | ||
| 345 | */ | ||
| 346 | if ((bn == NULL && (bn = BN_new()) == NULL) || | ||
| 347 | ASN1_INTEGER_to_BN(a_max, bn) == NULL || | ||
| 348 | !BN_add_word(bn, 1) || | ||
| 349 | (a_max_plus_one = BN_to_ASN1_INTEGER(bn, a_max_plus_one)) == NULL) { | ||
| 350 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL, | ||
| 351 | ERR_R_MALLOC_FAILURE); | ||
| 352 | goto done; | ||
| 353 | } | ||
| 354 | |||
| 355 | /* | ||
| 356 | * Punt if adjacent or overlapping. | ||
| 357 | */ | ||
| 358 | if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) >= 0) | ||
| 359 | goto done; | ||
| 360 | } | ||
| 361 | |||
| 362 | ret = 1; | ||
| 363 | |||
| 364 | done: | ||
| 365 | ASN1_INTEGER_free(a_max_plus_one); | ||
| 366 | BN_free(bn); | ||
| 367 | return ret; | ||
| 368 | } | ||
| 369 | |||
| 370 | /* | ||
| 371 | * Check whether an ASIdentifier extension is in canonical form. | ||
| 372 | */ | ||
| 373 | int v3_asid_is_canonical(ASIdentifiers *asid) | ||
| 374 | { | ||
| 375 | return (asid == NULL || | ||
| 376 | (ASIdentifierChoice_is_canonical(asid->asnum) || | ||
| 377 | ASIdentifierChoice_is_canonical(asid->rdi))); | ||
| 378 | } | ||
| 379 | |||
| 380 | /* | ||
| 381 | * Whack an ASIdentifierChoice into canonical form. | ||
| 382 | */ | ||
| 383 | static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | ||
| 384 | { | ||
| 385 | ASN1_INTEGER *a_max_plus_one = NULL; | ||
| 386 | BIGNUM *bn = NULL; | ||
| 387 | int i, ret = 0; | ||
| 388 | |||
| 389 | /* | ||
| 390 | * Nothing to do for empty element or inheritance. | ||
| 391 | */ | ||
| 392 | if (choice == NULL || choice->type == ASIdentifierChoice_inherit) | ||
| 393 | return 1; | ||
| 394 | |||
| 395 | /* | ||
| 396 | * We have a list. Sort it. | ||
| 397 | */ | ||
| 398 | assert(choice->type == ASIdentifierChoice_asIdsOrRanges); | ||
| 399 | sk_ASIdOrRange_sort(choice->u.asIdsOrRanges); | ||
| 400 | |||
| 401 | /* | ||
| 402 | * Now check for errors and suboptimal encoding, rejecting the | ||
| 403 | * former and fixing the latter. | ||
| 404 | */ | ||
| 405 | for (i = 0; i < sk_ASIdOrRange_num(choice->u.asIdsOrRanges) - 1; i++) { | ||
| 406 | ASIdOrRange *a = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i); | ||
| 407 | ASIdOrRange *b = sk_ASIdOrRange_value(choice->u.asIdsOrRanges, i + 1); | ||
| 408 | ASN1_INTEGER *a_min, *a_max, *b_min, *b_max; | ||
| 409 | |||
| 410 | extract_min_max(a, &a_min, &a_max); | ||
| 411 | extract_min_max(b, &b_min, &b_max); | ||
| 412 | |||
| 413 | /* | ||
| 414 | * Make sure we're properly sorted (paranoia). | ||
| 415 | */ | ||
| 416 | assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0); | ||
| 417 | |||
| 418 | /* | ||
| 419 | * Check for overlaps. | ||
| 420 | */ | ||
| 421 | if (ASN1_INTEGER_cmp(a_max, b_min) >= 0) { | ||
| 422 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | ||
| 423 | X509V3_R_EXTENSION_VALUE_ERROR); | ||
| 424 | goto done; | ||
| 425 | } | ||
| 426 | |||
| 427 | /* | ||
| 428 | * Calculate a_max + 1 to check for adjacency. | ||
| 429 | */ | ||
| 430 | if ((bn == NULL && (bn = BN_new()) == NULL) || | ||
| 431 | ASN1_INTEGER_to_BN(a_max, bn) == NULL || | ||
| 432 | !BN_add_word(bn, 1) || | ||
| 433 | (a_max_plus_one = BN_to_ASN1_INTEGER(bn, a_max_plus_one)) == NULL) { | ||
| 434 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, ERR_R_MALLOC_FAILURE); | ||
| 435 | goto done; | ||
| 436 | } | ||
| 437 | |||
| 438 | /* | ||
| 439 | * If a and b are adjacent, merge them. | ||
| 440 | */ | ||
| 441 | if (ASN1_INTEGER_cmp(a_max_plus_one, b_min) == 0) { | ||
| 442 | ASRange *r; | ||
| 443 | switch (a->type) { | ||
| 444 | case ASIdOrRange_id: | ||
| 445 | if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) { | ||
| 446 | X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE, | ||
| 447 | ERR_R_MALLOC_FAILURE); | ||
| 448 | goto done; | ||
| 449 | } | ||
| 450 | r->min = a_min; | ||
| 451 | r->max = b_max; | ||
| 452 | a->type = ASIdOrRange_range; | ||
| 453 | a->u.range = r; | ||
| 454 | break; | ||
| 455 | case ASIdOrRange_range: | ||
| 456 | ASN1_INTEGER_free(a->u.range->max); | ||
| 457 | a->u.range->max = b_max; | ||
| 458 | break; | ||
| 459 | } | ||
| 460 | switch (b->type) { | ||
| 461 | case ASIdOrRange_id: | ||
| 462 | b->u.id = NULL; | ||
| 463 | break; | ||
| 464 | case ASIdOrRange_range: | ||
| 465 | b->u.range->max = NULL; | ||
| 466 | break; | ||
| 467 | } | ||
| 468 | ASIdOrRange_free(b); | ||
| 469 | sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1); | ||
| 470 | i--; | ||
| 471 | continue; | ||
| 472 | } | ||
| 473 | } | ||
| 474 | |||
| 475 | assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */ | ||
| 476 | |||
| 477 | ret = 1; | ||
| 478 | |||
| 479 | done: | ||
| 480 | ASN1_INTEGER_free(a_max_plus_one); | ||
| 481 | BN_free(bn); | ||
| 482 | return ret; | ||
| 483 | } | ||
| 484 | |||
| 485 | /* | ||
| 486 | * Whack an ASIdentifier extension into canonical form. | ||
| 487 | */ | ||
| 488 | int v3_asid_canonize(ASIdentifiers *asid) | ||
| 489 | { | ||
| 490 | return (asid == NULL || | ||
| 491 | (ASIdentifierChoice_canonize(asid->asnum) && | ||
| 492 | ASIdentifierChoice_canonize(asid->rdi))); | ||
| 493 | } | ||
| 494 | |||
| 495 | /* | ||
| 496 | * v2i method for an ASIdentifier extension. | ||
| 497 | */ | ||
| 498 | static void *v2i_ASIdentifiers(const struct v3_ext_method *method, | ||
| 499 | struct v3_ext_ctx *ctx, | ||
| 500 | STACK_OF(CONF_VALUE) *values) | ||
| 501 | { | ||
| 502 | ASIdentifiers *asid = NULL; | ||
| 503 | int i; | ||
| 504 | |||
| 505 | if ((asid = ASIdentifiers_new()) == NULL) { | ||
| 506 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | ||
| 507 | return NULL; | ||
| 508 | } | ||
| 509 | |||
| 510 | for (i = 0; i < sk_CONF_VALUE_num(values); i++) { | ||
| 511 | CONF_VALUE *val = sk_CONF_VALUE_value(values, i); | ||
| 512 | ASN1_INTEGER *min = NULL, *max = NULL; | ||
| 513 | int i1, i2, i3, is_range, which; | ||
| 514 | |||
| 515 | /* | ||
| 516 | * Figure out whether this is an AS or an RDI. | ||
| 517 | */ | ||
| 518 | if ( !name_cmp(val->name, "AS")) { | ||
| 519 | which = V3_ASID_ASNUM; | ||
| 520 | } else if (!name_cmp(val->name, "RDI")) { | ||
| 521 | which = V3_ASID_RDI; | ||
| 522 | } else { | ||
| 523 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_EXTENSION_NAME_ERROR); | ||
| 524 | X509V3_conf_err(val); | ||
| 525 | goto err; | ||
| 526 | } | ||
| 527 | |||
| 528 | /* | ||
| 529 | * Handle inheritance. | ||
| 530 | */ | ||
| 531 | if (!strcmp(val->value, "inherit")) { | ||
| 532 | if (v3_asid_add_inherit(asid, which)) | ||
| 533 | continue; | ||
| 534 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_INHERITANCE); | ||
| 535 | X509V3_conf_err(val); | ||
| 536 | goto err; | ||
| 537 | } | ||
| 538 | |||
| 539 | /* | ||
| 540 | * Number, range, or mistake, pick it apart and figure out which. | ||
| 541 | */ | ||
| 542 | i1 = strspn(val->value, "0123456789"); | ||
| 543 | if (val->value[i1] == '\0') { | ||
| 544 | is_range = 0; | ||
| 545 | } else { | ||
| 546 | is_range = 1; | ||
| 547 | i2 = i1 + strspn(val->value + i1, " \t"); | ||
| 548 | if (val->value[i2] != '-') { | ||
| 549 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_ASNUMBER); | ||
| 550 | X509V3_conf_err(val); | ||
| 551 | goto err; | ||
| 552 | } | ||
| 553 | i2++; | ||
| 554 | i2 = i2 + strspn(val->value + i2, " \t"); | ||
| 555 | i3 = i2 + strspn(val->value + i2, "0123456789"); | ||
| 556 | if (val->value[i3] != '\0') { | ||
| 557 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, X509V3_R_INVALID_ASRANGE); | ||
| 558 | X509V3_conf_err(val); | ||
| 559 | goto err; | ||
| 560 | } | ||
| 561 | } | ||
| 562 | |||
| 563 | /* | ||
| 564 | * Syntax is ok, read and add it. | ||
| 565 | */ | ||
| 566 | if (!is_range) { | ||
| 567 | if (!X509V3_get_value_int(val, &min)) { | ||
| 568 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | ||
| 569 | goto err; | ||
| 570 | } | ||
| 571 | } else { | ||
| 572 | char *s = BUF_strdup(val->value); | ||
| 573 | if (s == NULL) { | ||
| 574 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | ||
| 575 | goto err; | ||
| 576 | } | ||
| 577 | s[i1] = '\0'; | ||
| 578 | min = s2i_ASN1_INTEGER(NULL, s); | ||
| 579 | max = s2i_ASN1_INTEGER(NULL, s + i2); | ||
| 580 | OPENSSL_free(s); | ||
| 581 | if (min == NULL || max == NULL) { | ||
| 582 | ASN1_INTEGER_free(min); | ||
| 583 | ASN1_INTEGER_free(max); | ||
| 584 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | ||
| 585 | goto err; | ||
| 586 | } | ||
| 587 | } | ||
| 588 | if (!v3_asid_add_id_or_range(asid, which, min, max)) { | ||
| 589 | ASN1_INTEGER_free(min); | ||
| 590 | ASN1_INTEGER_free(max); | ||
| 591 | X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE); | ||
| 592 | goto err; | ||
| 593 | } | ||
| 594 | } | ||
| 595 | |||
| 596 | /* | ||
| 597 | * Canonize the result, then we're done. | ||
| 598 | */ | ||
| 599 | if (!v3_asid_canonize(asid)) | ||
| 600 | goto err; | ||
| 601 | return asid; | ||
| 602 | |||
| 603 | err: | ||
| 604 | ASIdentifiers_free(asid); | ||
| 605 | return NULL; | ||
| 606 | } | ||
| 607 | |||
| 608 | /* | ||
| 609 | * OpenSSL dispatch. | ||
| 610 | */ | ||
| 611 | const X509V3_EXT_METHOD v3_asid = { | ||
| 612 | NID_sbgp_autonomousSysNum, /* nid */ | ||
| 613 | 0, /* flags */ | ||
| 614 | ASN1_ITEM_ref(ASIdentifiers), /* template */ | ||
| 615 | 0, 0, 0, 0, /* old functions, ignored */ | ||
| 616 | 0, /* i2s */ | ||
| 617 | 0, /* s2i */ | ||
| 618 | 0, /* i2v */ | ||
| 619 | v2i_ASIdentifiers, /* v2i */ | ||
| 620 | i2r_ASIdentifiers, /* i2r */ | ||
| 621 | 0, /* r2i */ | ||
| 622 | NULL /* extension-specific data */ | ||
| 623 | }; | ||
| 624 | |||
| 625 | /* | ||
| 626 | * Figure out whether extension uses inheritance. | ||
| 627 | */ | ||
| 628 | int v3_asid_inherits(ASIdentifiers *asid) | ||
| 629 | { | ||
| 630 | return (asid != NULL && | ||
| 631 | ((asid->asnum != NULL && | ||
| 632 | asid->asnum->type == ASIdentifierChoice_inherit) || | ||
| 633 | (asid->rdi != NULL && | ||
| 634 | asid->rdi->type == ASIdentifierChoice_inherit))); | ||
| 635 | } | ||
| 636 | |||
| 637 | /* | ||
| 638 | * Figure out whether parent contains child. | ||
| 639 | */ | ||
| 640 | static int asid_contains(ASIdOrRanges *parent, ASIdOrRanges *child) | ||
| 641 | { | ||
| 642 | ASN1_INTEGER *p_min, *p_max, *c_min, *c_max; | ||
| 643 | int p, c; | ||
| 644 | |||
| 645 | if (child == NULL || parent == child) | ||
| 646 | return 1; | ||
| 647 | if (parent == NULL) | ||
| 648 | return 0; | ||
| 649 | |||
| 650 | p = 0; | ||
| 651 | for (c = 0; c < sk_ASIdOrRange_num(child); c++) { | ||
| 652 | extract_min_max(sk_ASIdOrRange_value(child, c), &c_min, &c_max); | ||
| 653 | for (;; p++) { | ||
| 654 | if (p >= sk_ASIdOrRange_num(parent)) | ||
| 655 | return 0; | ||
| 656 | extract_min_max(sk_ASIdOrRange_value(parent, p), &p_min, &p_max); | ||
| 657 | if (ASN1_INTEGER_cmp(p_max, c_max) < 0) | ||
| 658 | continue; | ||
| 659 | if (ASN1_INTEGER_cmp(p_min, c_min) > 0) | ||
| 660 | return 0; | ||
| 661 | break; | ||
| 662 | } | ||
| 663 | } | ||
| 664 | |||
| 665 | return 1; | ||
| 666 | } | ||
| 667 | |||
| 668 | /* | ||
| 669 | * Test whether a is a subet of b. | ||
| 670 | */ | ||
| 671 | int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b) | ||
| 672 | { | ||
| 673 | return (a == NULL || | ||
| 674 | a == b || | ||
| 675 | (b != NULL && | ||
| 676 | !v3_asid_inherits(a) && | ||
| 677 | !v3_asid_inherits(b) && | ||
| 678 | asid_contains(b->asnum->u.asIdsOrRanges, | ||
| 679 | a->asnum->u.asIdsOrRanges) && | ||
| 680 | asid_contains(b->rdi->u.asIdsOrRanges, | ||
| 681 | a->rdi->u.asIdsOrRanges))); | ||
| 682 | } | ||
| 683 | |||
| 684 | /* | ||
| 685 | * Validation error handling via callback. | ||
| 686 | */ | ||
| 687 | #define validation_err(_err_) \ | ||
| 688 | do { \ | ||
| 689 | if (ctx != NULL) { \ | ||
| 690 | ctx->error = _err_; \ | ||
| 691 | ctx->error_depth = i; \ | ||
| 692 | ctx->current_cert = x; \ | ||
| 693 | ret = ctx->verify_cb(0, ctx); \ | ||
| 694 | } else { \ | ||
| 695 | ret = 0; \ | ||
| 696 | } \ | ||
| 697 | if (!ret) \ | ||
| 698 | goto done; \ | ||
| 699 | } while (0) | ||
| 700 | |||
| 701 | /* | ||
| 702 | * Core code for RFC 3779 3.3 path validation. | ||
| 703 | */ | ||
| 704 | static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | ||
| 705 | STACK_OF(X509) *chain, | ||
| 706 | ASIdentifiers *ext) | ||
| 707 | { | ||
| 708 | ASIdOrRanges *child_as = NULL, *child_rdi = NULL; | ||
| 709 | int i, ret = 1, inherit_as = 0, inherit_rdi = 0; | ||
| 710 | X509 *x; | ||
| 711 | |||
| 712 | assert(chain != NULL && sk_X509_num(chain) > 0); | ||
| 713 | assert(ctx != NULL || ext != NULL); | ||
| 714 | assert(ctx == NULL || ctx->verify_cb != NULL); | ||
| 715 | |||
| 716 | /* | ||
| 717 | * Figure out where to start. If we don't have an extension to | ||
| 718 | * check, we're done. Otherwise, check canonical form and | ||
| 719 | * set up for walking up the chain. | ||
| 720 | */ | ||
| 721 | if (ext != NULL) { | ||
| 722 | i = -1; | ||
| 723 | x = NULL; | ||
| 724 | } else { | ||
| 725 | i = 0; | ||
| 726 | x = sk_X509_value(chain, i); | ||
| 727 | assert(x != NULL); | ||
| 728 | if ((ext = x->rfc3779_asid) == NULL) | ||
| 729 | goto done; | ||
| 730 | } | ||
| 731 | if (!v3_asid_is_canonical(ext)) | ||
| 732 | validation_err(X509_V_ERR_INVALID_EXTENSION); | ||
| 733 | if (ext->asnum != NULL) { | ||
| 734 | switch (ext->asnum->type) { | ||
| 735 | case ASIdentifierChoice_inherit: | ||
| 736 | inherit_as = 1; | ||
| 737 | break; | ||
| 738 | case ASIdentifierChoice_asIdsOrRanges: | ||
| 739 | child_as = ext->asnum->u.asIdsOrRanges; | ||
| 740 | break; | ||
| 741 | } | ||
| 742 | } | ||
| 743 | if (ext->rdi != NULL) { | ||
| 744 | switch (ext->rdi->type) { | ||
| 745 | case ASIdentifierChoice_inherit: | ||
| 746 | inherit_rdi = 1; | ||
| 747 | break; | ||
| 748 | case ASIdentifierChoice_asIdsOrRanges: | ||
| 749 | child_rdi = ext->rdi->u.asIdsOrRanges; | ||
| 750 | break; | ||
| 751 | } | ||
| 752 | } | ||
| 753 | |||
| 754 | /* | ||
| 755 | * Now walk up the chain. Extensions must be in canonical form, no | ||
| 756 | * cert may list resources that its parent doesn't list. | ||
| 757 | */ | ||
| 758 | for (i++; i < sk_X509_num(chain); i++) { | ||
| 759 | x = sk_X509_value(chain, i); | ||
| 760 | assert(x != NULL); | ||
| 761 | if (x->rfc3779_asid == NULL) { | ||
| 762 | if (child_as != NULL || child_rdi != NULL) | ||
| 763 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 764 | continue; | ||
| 765 | } | ||
| 766 | if (!v3_asid_is_canonical(x->rfc3779_asid)) | ||
| 767 | validation_err(X509_V_ERR_INVALID_EXTENSION); | ||
| 768 | if (x->rfc3779_asid->asnum == NULL && child_as != NULL) { | ||
| 769 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 770 | child_as = NULL; | ||
| 771 | inherit_as = 0; | ||
| 772 | } | ||
| 773 | if (x->rfc3779_asid->asnum != NULL && | ||
| 774 | x->rfc3779_asid->asnum->type == ASIdentifierChoice_asIdsOrRanges) { | ||
| 775 | if (inherit_as || | ||
| 776 | asid_contains(x->rfc3779_asid->asnum->u.asIdsOrRanges, child_as)) { | ||
| 777 | child_as = x->rfc3779_asid->asnum->u.asIdsOrRanges; | ||
| 778 | inherit_as = 0; | ||
| 779 | } else { | ||
| 780 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 781 | } | ||
| 782 | } | ||
| 783 | if (x->rfc3779_asid->rdi == NULL && child_rdi != NULL) { | ||
| 784 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 785 | child_rdi = NULL; | ||
| 786 | inherit_rdi = 0; | ||
| 787 | } | ||
| 788 | if (x->rfc3779_asid->rdi != NULL && | ||
| 789 | x->rfc3779_asid->rdi->type == ASIdentifierChoice_asIdsOrRanges) { | ||
| 790 | if (inherit_rdi || | ||
| 791 | asid_contains(x->rfc3779_asid->rdi->u.asIdsOrRanges, child_rdi)) { | ||
| 792 | child_rdi = x->rfc3779_asid->rdi->u.asIdsOrRanges; | ||
| 793 | inherit_rdi = 0; | ||
| 794 | } else { | ||
| 795 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 796 | } | ||
| 797 | } | ||
| 798 | } | ||
| 799 | |||
| 800 | /* | ||
| 801 | * Trust anchor can't inherit. | ||
| 802 | */ | ||
| 803 | assert(x != NULL); | ||
| 804 | if (x->rfc3779_asid != NULL) { | ||
| 805 | if (x->rfc3779_asid->asnum != NULL && | ||
| 806 | x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit) | ||
| 807 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 808 | if (x->rfc3779_asid->rdi != NULL && | ||
| 809 | x->rfc3779_asid->rdi->type == ASIdentifierChoice_inherit) | ||
| 810 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | ||
| 811 | } | ||
| 812 | |||
| 813 | done: | ||
| 814 | return ret; | ||
| 815 | } | ||
| 816 | |||
| 817 | #undef validation_err | ||
| 818 | |||
| 819 | /* | ||
| 820 | * RFC 3779 3.3 path validation -- called from X509_verify_cert(). | ||
| 821 | */ | ||
| 822 | int v3_asid_validate_path(X509_STORE_CTX *ctx) | ||
| 823 | { | ||
| 824 | return v3_asid_validate_path_internal(ctx, ctx->chain, NULL); | ||
| 825 | } | ||
| 826 | |||
| 827 | /* | ||
| 828 | * RFC 3779 3.3 path validation of an extension. | ||
| 829 | * Test whether chain covers extension. | ||
| 830 | */ | ||
| 831 | int v3_asid_validate_resource_set(STACK_OF(X509) *chain, | ||
| 832 | ASIdentifiers *ext, | ||
| 833 | int allow_inheritance) | ||
| 834 | { | ||
| 835 | if (ext == NULL) | ||
| 836 | return 1; | ||
| 837 | if (chain == NULL || sk_X509_num(chain) == 0) | ||
| 838 | return 0; | ||
| 839 | if (!allow_inheritance && v3_asid_inherits(ext)) | ||
| 840 | return 0; | ||
| 841 | return v3_asid_validate_path_internal(NULL, chain, ext); | ||
| 842 | } | ||
| 843 | |||
| 844 | #endif /* OPENSSL_NO_RFC3779 */ | ||
diff --git a/src/lib/libcrypto/x509v3/v3conf.c b/src/lib/libcrypto/x509v3/v3conf.c new file mode 100644 index 0000000000..a9e6ca3542 --- /dev/null +++ b/src/lib/libcrypto/x509v3/v3conf.c | |||
| @@ -0,0 +1,127 @@ | |||
| 1 | /* v3conf.c */ | ||
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 5 | /* ==================================================================== | ||
| 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | ||
| 7 | * | ||
| 8 | * Redistribution and use in source and binary forms, with or without | ||
| 9 | * modification, are permitted provided that the following conditions | ||
| 10 | * are met: | ||
| 11 | * | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * | ||
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 16 | * notice, this list of conditions and the following disclaimer in | ||
| 17 | * the documentation and/or other materials provided with the | ||
| 18 | * distribution. | ||
| 19 | * | ||
| 20 | * 3. All advertising materials mentioning features or use of this | ||
| 21 | * software must display the following acknowledgment: | ||
| 22 | * "This product includes software developed by the OpenSSL Project | ||
| 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | ||
| 24 | * | ||
| 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
| 26 | * endorse or promote products derived from this software without | ||
| 27 | * prior written permission. For written permission, please contact | ||
| 28 | * licensing@OpenSSL.org. | ||
| 29 | * | ||
| 30 | * 5. Products derived from this software may not be called "OpenSSL" | ||
| 31 | * nor may "OpenSSL" appear in their names without prior written | ||
| 32 | * permission of the OpenSSL Project. | ||
| 33 | * | ||
| 34 | * 6. Redistributions of any form whatsoever must retain the following | ||
| 35 | * acknowledgment: | ||
| 36 | * "This product includes software developed by the OpenSSL Project | ||
| 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | ||
| 38 | * | ||
| 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
| 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
| 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
| 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 51 | * ==================================================================== | ||
| 52 | * | ||
| 53 | * This product includes cryptographic software written by Eric Young | ||
| 54 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
| 55 | * Hudson (tjh@cryptsoft.com). | ||
| 56 | * | ||
| 57 | */ | ||
| 58 | |||
| 59 | |||
| 60 | #include <stdio.h> | ||
| 61 | #include "cryptlib.h" | ||
| 62 | #include <openssl/asn1.h> | ||
| 63 | #include <openssl/conf.h> | ||
| 64 | #include <openssl/x509.h> | ||
| 65 | #include <openssl/x509v3.h> | ||
| 66 | |||
| 67 | /* Test application to add extensions from a config file */ | ||
| 68 | |||
| 69 | int main(int argc, char **argv) | ||
| 70 | { | ||
| 71 | LHASH *conf; | ||
| 72 | X509 *cert; | ||
| 73 | FILE *inf; | ||
| 74 | char *conf_file; | ||
| 75 | int i; | ||
| 76 | int count; | ||
| 77 | X509_EXTENSION *ext; | ||
| 78 | X509V3_add_standard_extensions(); | ||
| 79 | ERR_load_crypto_strings(); | ||
| 80 | if(!argv[1]) { | ||
| 81 | fprintf(stderr, "Usage: v3conf cert.pem [file.cnf]\n"); | ||
| 82 | exit(1); | ||
| 83 | } | ||
| 84 | conf_file = argv[2]; | ||
| 85 | if(!conf_file) conf_file = "test.cnf"; | ||
| 86 | conf = CONF_load(NULL, "test.cnf", NULL); | ||
| 87 | if(!conf) { | ||
| 88 | fprintf(stderr, "Error opening Config file %s\n", conf_file); | ||
| 89 | ERR_print_errors_fp(stderr); | ||
| 90 | exit(1); | ||
| 91 | } | ||
| 92 | |||
| 93 | inf = fopen(argv[1], "r"); | ||
| 94 | if(!inf) { | ||
| 95 | fprintf(stderr, "Can't open certificate file %s\n", argv[1]); | ||
| 96 | exit(1); | ||
| 97 | } | ||
| 98 | cert = PEM_read_X509(inf, NULL, NULL); | ||
| 99 | if(!cert) { | ||
| 100 | fprintf(stderr, "Error reading certificate file %s\n", argv[1]); | ||
| 101 | exit(1); | ||
| 102 | } | ||
| 103 | fclose(inf); | ||
| 104 | |||
| 105 | sk_pop_free(cert->cert_info->extensions, X509_EXTENSION_free); | ||
| 106 | cert->cert_info->extensions = NULL; | ||
| 107 | |||
| 108 | if(!X509V3_EXT_add_conf(conf, NULL, "test_section", cert)) { | ||
| 109 | fprintf(stderr, "Error adding extensions\n"); | ||
| 110 | ERR_print_errors_fp(stderr); | ||
| 111 | exit(1); | ||
| 112 | } | ||
| 113 | |||
| 114 | count = X509_get_ext_count(cert); | ||
| 115 | printf("%d extensions\n", count); | ||
| 116 | for(i = 0; i < count; i++) { | ||
| 117 | ext = X509_get_ext(cert, i); | ||
| 118 | printf("%s", OBJ_nid2ln(OBJ_obj2nid(ext->object))); | ||
| 119 | if(ext->critical) printf(",critical:\n"); | ||
| 120 | else printf(":\n"); | ||
| 121 | X509V3_EXT_print_fp(stdout, ext, 0, 0); | ||
| 122 | printf("\n"); | ||
| 123 | |||
| 124 | } | ||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
diff --git a/src/lib/libcrypto/buffer/buf_str.c b/src/lib/libcrypto/x509v3/v3prin.c index 28dd1e401e..d5ff268296 100644 --- a/src/lib/libcrypto/buffer/buf_str.c +++ b/src/lib/libcrypto/x509v3/v3prin.c | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | /* crypto/buffer/buf_str.c */ | 1 | /* v3prin.c */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | ||
| 3 | * project 1999. | ||
| 4 | */ | ||
| 2 | /* ==================================================================== | 5 | /* ==================================================================== |
| 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
| 4 | * | 7 | * |
| 5 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
| @@ -53,64 +56,44 @@ | |||
| 53 | * | 56 | * |
| 54 | */ | 57 | */ |
| 55 | 58 | ||
| 56 | #include <stdio.h> | ||
| 57 | #include "cryptlib.h" | ||
| 58 | #include <openssl/buffer.h> | ||
| 59 | |||
| 60 | char *BUF_strdup(const char *str) | ||
| 61 | { | ||
| 62 | if (str == NULL) return(NULL); | ||
| 63 | return BUF_strndup(str, strlen(str)); | ||
| 64 | } | ||
| 65 | 59 | ||
| 66 | char *BUF_strndup(const char *str, size_t siz) | ||
| 67 | { | ||
| 68 | char *ret; | ||
| 69 | 60 | ||
| 70 | if (str == NULL) return(NULL); | 61 | #include <stdio.h> |
| 62 | #include <openssl/asn1.h> | ||
| 63 | #include <openssl/conf.h> | ||
| 64 | #include <openssl/x509.h> | ||
| 65 | #include <openssl/x509v3.h> | ||
| 71 | 66 | ||
| 72 | ret=OPENSSL_malloc(siz+1); | 67 | int main(int argc, char **argv) |
| 73 | if (ret == NULL) | 68 | { |
| 74 | { | 69 | X509 *cert; |
| 75 | BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE); | 70 | FILE *inf; |
| 76 | return(NULL); | 71 | int i, count; |
| 77 | } | 72 | X509_EXTENSION *ext; |
| 78 | BUF_strlcpy(ret,str,siz+1); | 73 | X509V3_add_standard_extensions(); |
| 79 | return(ret); | 74 | ERR_load_crypto_strings(); |
| 75 | if(!argv[1]) { | ||
| 76 | fprintf(stderr, "Usage v3prin cert.pem\n"); | ||
| 77 | exit(1); | ||
| 80 | } | 78 | } |
| 81 | 79 | if(!(inf = fopen(argv[1], "r"))) { | |
| 82 | void *BUF_memdup(const void *data, size_t siz) | 80 | fprintf(stderr, "Can't open %s\n", argv[1]); |
| 83 | { | 81 | exit(1); |
| 84 | void *ret; | ||
| 85 | |||
| 86 | if (data == NULL) return(NULL); | ||
| 87 | |||
| 88 | ret=OPENSSL_malloc(siz); | ||
| 89 | if (ret == NULL) | ||
| 90 | { | ||
| 91 | BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); | ||
| 92 | return(NULL); | ||
| 93 | } | ||
| 94 | return memcpy(ret, data, siz); | ||
| 95 | } | ||
| 96 | |||
| 97 | size_t BUF_strlcpy(char *dst, const char *src, size_t size) | ||
| 98 | { | ||
| 99 | size_t l = 0; | ||
| 100 | for(; size > 1 && *src; size--) | ||
| 101 | { | ||
| 102 | *dst++ = *src++; | ||
| 103 | l++; | ||
| 104 | } | ||
| 105 | if (size) | ||
| 106 | *dst = '\0'; | ||
| 107 | return l + strlen(src); | ||
| 108 | } | 82 | } |
| 109 | 83 | if(!(cert = PEM_read_X509(inf, NULL, NULL))) { | |
| 110 | size_t BUF_strlcat(char *dst, const char *src, size_t size) | 84 | fprintf(stderr, "Can't read certificate %s\n", argv[1]); |
| 111 | { | 85 | ERR_print_errors_fp(stderr); |
| 112 | size_t l = 0; | 86 | exit(1); |
| 113 | for(; size > 0 && *dst; size--, dst++) | 87 | } |
| 114 | l++; | 88 | fclose(inf); |
| 115 | return l + BUF_strlcpy(dst, src, size); | 89 | count = X509_get_ext_count(cert); |
| 90 | printf("%d extensions\n", count); | ||
| 91 | for(i = 0; i < count; i++) { | ||
| 92 | ext = X509_get_ext(cert, i); | ||
| 93 | printf("%s\n", OBJ_nid2ln(OBJ_obj2nid(ext->object))); | ||
| 94 | if(!X509V3_EXT_print_fp(stdout, ext, 0, 0)) ERR_print_errors_fp(stderr); | ||
| 95 | printf("\n"); | ||
| 96 | |||
| 116 | } | 97 | } |
| 98 | return 0; | ||
| 99 | } | ||
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl index c96821a3c8..b771a8539d 100644 --- a/src/lib/libcrypto/x86_64cpuid.pl +++ b/src/lib/libcrypto/x86_64cpuid.pl | |||
| @@ -12,9 +12,10 @@ open STDOUT,"| $^X ${dir}perlasm/x86_64-xlate.pl $flavour $output"; | |||
| 12 | if ($win64) { $arg1="%rcx"; $arg2="%rdx"; } | 12 | if ($win64) { $arg1="%rcx"; $arg2="%rdx"; } |
| 13 | else { $arg1="%rdi"; $arg2="%rsi"; } | 13 | else { $arg1="%rdi"; $arg2="%rsi"; } |
| 14 | print<<___; | 14 | print<<___; |
| 15 | #include <machine/asm.h> | ||
| 15 | .extern OPENSSL_cpuid_setup | 16 | .extern OPENSSL_cpuid_setup |
| 16 | .section .init | 17 | .section .init |
| 17 | call OPENSSL_cpuid_setup | 18 | call PIC_PLT(OPENSSL_cpuid_setup) |
| 18 | 19 | ||
| 19 | .text | 20 | .text |
| 20 | 21 | ||
